Re: V3D UIF texture format conversion with TFU

2024-03-01 Thread Alejandro Piñeiro
Hi, sorry, I realized that you sent first this email to me privately, but didn't have time to reply. On 1/3/24 14:33, Macoy Madson wrote: Hello, I have been looking at the code in Gallium/drivers/v3d related to texture conversion, specifically v3dx_tfu.c. I have been trying to find how

Re: Re-use of Intel driver genxml files in other project

2023-10-24 Thread Alejandro Piñeiro
Hi, On 24/10/23 0:44, Thomas Erbesdobler wrote: Hi everyone, I'm currently working on a very simple OpenCL runtime for Intel GPUs, which I would like to make available as open source project (and maybe also distribute it). To generate the ring-commands (the command stream which controls the

Re: VkRunner ported to Rust

2023-02-20 Thread Alejandro Piñeiro
On 20/2/23 16:53, Neil Roberts wrote: Hi folks, Hi Neil! Does anybody remember VkRunner? It’s a little tool to help write shader-based tests for Vulkan. It’s the same concept as Piglit’s shader_runner but for Vulkan instead of OpenGL. There are a couple of tests using it in Piglit but

[Mesa-dev] [PATCH] docs: advice to resolve discussion on gitlab MR doc

2019-05-16 Thread Alejandro Piñeiro
For newcomers to gitlab, it is not evident that it is better to press the "Resolve Discussion" button when you update your branch handling feedback. --- As the commit message says, it is not always evident. I was pointed to do that when I started to use gitlab, and just today I mentioned it to

[Mesa-dev] [PATCH] docs: document MESA_GLSL=errors keyword

2019-04-18 Thread Alejandro Piñeiro
Added with commit 0161691f3518, still checked on shaderapi.c _mesa_get_shader_flag method. --- docs/shading.html | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/shading.html b/docs/shading.html index 9e3c7218e31..76f25316f86 100644 --- a/docs/shading.html +++ b/docs/shading.html @@ -59,6

[Mesa-dev] [PATCH] spirv: handle FragCoord and SamplePosition builtins

2019-02-08 Thread Alejandro Piñeiro
Those builtins need to fill origin_upper_left and pixel_center_integer on the nir variable. Those depends on the execution mode, that moved recently to be handled after creating the variables. This commit adds a pass over the fragment shader inputs to set the proper value once we have all the

[Mesa-dev] [PATCH 0/2] spirv/nir: fix pixel_center_integer/origin_upper_left (two different solutions)

2019-02-08 Thread Alejandro Piñeiro
Note that the two patches are independent. Are two possible solutions for the same problem. Details below. As mentioned on the following MR: https://gitlab.freedesktop.org/mesa/mesa/merge_requests/144 changing the order of how ExecutionModes are handled affected handling OriginUpperLeft and

[Mesa-dev] [PATCH] nir: move pixel_center_integer/origin_upper_left to shader_info.fs

2019-02-08 Thread Alejandro Piñeiro
Although on GLSL those are set using a layout qualifier to gl_FragCoord builtin, they are basically a global mode. In fact, on SPIR-V they are set as an global ExecutionMode, not as a decoration for the builtin. With this change, we are just mapping them more similar to SPIR-V, instead of more

[Mesa-dev] [PATCH 1/1] spirv: handle FragCoord and SamplePosition builtins

2019-02-08 Thread Alejandro Piñeiro
Those builtins need to fill origin_upper_left and pixel_center_integer on the nir variable. Those depends on the execution mode, that moved recently to be handled after creating the variables. This commit adds a pass over the fragment shader inputs to set the proper value once we have all the

[Mesa-dev] [PATCH] nir: remove unused variable

2018-12-13 Thread Alejandro Piñeiro
To avoid the following warning: ./src/compiler/nir/nir_loop_analyze.c:807:16: warning: unused variable ‘ns’ [-Wunused-variable] nir_shader *ns = impl->function->shader; --- Perhaps this is solved on any of the loop analysis patches pending to be reviewed, but just in case, sending it.

[Mesa-dev] [PATCH] spirv/nir: adjust location assignment for the case of arrays of blocks

2018-12-13 Thread Alejandro Piñeiro
This is needed due how the types get rearranged after the struct splitting. So for example, this array of blocks: layout(location = 0) out block { vec4 v; vec3 v2; } x[2]; Would be splitted on two nir variables with the following types: * vec4 v[2] * vec3 v2[2] So we need to

[Mesa-dev] [RFC PATCH 13/13] nir/linker: use nir_gather_xfb_info

2018-12-08 Thread Alejandro Piñeiro
Instead of a custom ARB_gl_spirv xfb gather info pass. In fact, this is not only about reusing code, but the current custom code was not handling properly how many varyings are enumerated from some complex types. So this change is also about fixing some corner cases. ---

[Mesa-dev] [RFC PATCH 12/13] nir/xfb_info: handle arrays and AoA of basic types

2018-12-08 Thread Alejandro Piñeiro
On OpenGL, a array of a simple type adds just one varying. So gl_transform_feedback_varying_info struct defined at mtypes.h includes the parameters Type (base_type) and Size (number of elements). This commit checks this when the recursive add_var_xfb_outputs call handles arrays, to ensure that

[Mesa-dev] [RFC PATCH 02/13] nir: don't assert when xfb_buffer/stride is present but not xfb_offset

2018-12-08 Thread Alejandro Piñeiro
In order to allow nir_gather_xfb_info to be used on OpenGL, specifically ARB_gl_spirv. So, from OpenGL 4.6 spec, section 11.1.2.1, "Output Variables": "outputs specifying both an *XfbBuffer* and an *Offset* are captured, while outputs not specifying both of these are not captured.

[Mesa-dev] [RFC PATCH 11/13] nir: adding varyings on nir_xfb_info and gather_info

2018-12-08 Thread Alejandro Piñeiro
In order to be used for OpenGL (right now for ARB_gl_spirv). This commit adds two new structures: * nir_xfb_varying_info: that identifies each individual varying. For each one, we need to know the type, buffer and xfb_offset * nir_xfb_buffer_info: as now for each buffer, in addition to

[Mesa-dev] [RFC PATCH 08/13] spirv/nir: interface_type should only be set for blocks, not any structs

2018-12-08 Thread Alejandro Piñeiro
Current code assumes that if the type is an struct it would behave as a block. That is not always the case (like xfb_offset/xfb_buffer assignment on arrays of structs vs arrays of blocks), so we need to differentiate. --- src/compiler/spirv/vtn_variables.c | 17 + 1 file changed,

[Mesa-dev] [RFC PATCH 10/13] nir/xfb: WIP: handle xfb buffer/offset rule for block arrays

2018-12-08 Thread Alejandro Piñeiro
From GLSL 4.60 spec, Section 4.4.2. Output Layout Qualifiers, subsection Transform Feedback Layout Qualifiers: "When a block is declared as an array, all members of block array-element 0 are captured, as previously described, by the declared or inherited xfb_buffer. Generally, an array

[Mesa-dev] [RFC PATCH 09/13] nir/spirv: only expose interface type for arrays of interface blocks

2018-12-08 Thread Alejandro Piñeiro
In the same way that just a struct is not a interface block, and array of structs is not an array of interface blocks. At least at the NIR level. --- src/compiler/spirv/vtn_variables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/spirv/vtn_variables.c

[Mesa-dev] [RFC PATCH 05/13] spirv/nir: fixing the xfb_offset for arrays of structs

2018-12-08 Thread Alejandro Piñeiro
GLSLang computes the xfb_offset for struct members. In fact, for basic structs, the xfb nir gathering pass expect those to be filled, as one struct variable is lowered to several nir variables, and those need to have the xfb offset already set. See [1]. But, as one existing comments at spirv to

[Mesa-dev] [RFC PATCH 00/13] Reusing nir xfb gathering for ARB_gl_spirv, wip array of blocks, plus other fixes

2018-12-08 Thread Alejandro Piñeiro
, regresses) here: https://github.com/Igalia/piglit/tree/apinheiro/xfb Alejandro Piñeiro (13): spirv/nir: update Xfb decoration comment nir: don't assert when xfb_buffer/stride is present but not xfb_offset nir: fix output offset compute for dvec3/4 nir: add component_offset at nir_xfb_info

[Mesa-dev] [RFC PATCH 04/13] nir: add component_offset at nir_xfb_info

2018-12-08 Thread Alejandro Piñeiro
Where component_offset here is the offset when accessing components of a packed variable. Or in other words, location_frac on nir.h. Different places of mesa use different names for it. Technically nir_xfb_info consumer can get the same from the component_mask, it seems somewhat forced to make it

[Mesa-dev] [RFC PATCH 01/13] spirv/nir: update Xfb decoration comment

2018-12-08 Thread Alejandro Piñeiro
Now Vulkan radv driver, and ARB_gl_spirv implementation supports transform feedback. Having said so, those decorations are handled elsewhere. Reviewed-by: Jason Ekstrand --- src/compiler/spirv/spirv_to_nir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[Mesa-dev] [RFC PATCH 03/13] nir: fix output offset compute for dvec3/4

2018-12-08 Thread Alejandro Piñeiro
The offset compute was working fine for the case of attrib_slots=1, and updating the offset for the following varying. But in the case of attrib_slots=2 (so dvec3/4), we are basically splitting the comp_slots needed in two outputs. In that case we can't add to the offset the full size of the

[Mesa-dev] [RFC PATCH 07/13] spirv/nir: use array_element as interface_type for any array

2018-12-08 Thread Alejandro Piñeiro
This commit removes several of the checks when assigning the array_element as the interface_type. Reading the comment, and what commit bb04b84114d2780307f9cbd04447216c3f2d1c0c added on top, this is done conservatively, for only the builtin cases that makes sense at that moment. But even if those

[Mesa-dev] [RFC PATCH 06/13] nir: fixing the xfb_offset for arrays of structs

2018-12-08 Thread Alejandro Piñeiro
Equivalent to previous patch (so comments applies), but implemented on a different place. We would need to chose in which one. --- src/compiler/nir/nir_gather_xfb_info.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/src/compiler/nir/nir_gather_xfb_info.c

Re: [Mesa-dev] [PATCH 6/7] RFC: nir/xfb_info: arrays of basic types adds just one varying

2018-11-13 Thread Alejandro Piñeiro
of code reuse, or should ARB_gl_spirv stick to their own gathering pass? On 10/11/18 12:13, Alejandro Piñeiro wrote: > On 09/11/18 16:58, Jason Ekstrand wrote: >> On November 9, 2018 06:39:25 Alejandro Piñeiro >> wrote: >>> On 08/11/18 23:14, Jason Ekstrand wrote: >&

Re: [Mesa-dev] [PATCH 2/2] i965: Do NIR shader cloning in the caller.

2018-11-10 Thread Alejandro Piñeiro
I was tempted to suggest to add a comment somewhere mentioning this policy change, but there are so many functions that Im not sure what would be that somewhere. Ramblings apart: Reviewed-by: Alejandro Piñeiro On 10/11/18 09:17, Kenneth Graunke wrote: > This moves nir_shader_cl

Re: [Mesa-dev] [PATCH 1/2] i965: Use a 'nir' temporary rather than poking at brw_program

2018-11-10 Thread Alejandro Piñeiro
Reviewed-by: Alejandro Piñeiro On 10/11/18 09:17, Kenneth Graunke wrote: > It's shorter and will also be useful when I adjust cloning soon. > --- > src/mesa/drivers/dri/i965/brw_cs.c | 6 +++--- > src/mesa/drivers/dri/i965/brw_gs.c | 11 ++- > src/mesa/drivers/dri/i965

Re: [Mesa-dev] [PATCH 6/7] RFC: nir/xfb_info: arrays of basic types adds just one varying

2018-11-10 Thread Alejandro Piñeiro
On 09/11/18 16:58, Jason Ekstrand wrote: > On November 9, 2018 06:39:25 Alejandro Piñeiro > wrote: >> On 08/11/18 23:14, Jason Ekstrand wrote: >>> On Thu, Nov 8, 2018 at 7:22 AM Alejandro Piñeiro >>> mailto:apinhe...@igalia.com>> wrote: >>> >>

[Mesa-dev] [PATCH v2] nir: fix output offset compute for dvec3/4

2018-11-09 Thread Alejandro Piñeiro
The offset compute was working fine for the case of attrib_slots=1, and updating the offset for the following varying. But in the case of attrib_slots=2 (so dvec3/4), we are basically splitting the comp_slots needed in two outputs. In that case we can't add to the offset the full size of the

Re: [Mesa-dev] [PATCH 2/7] nir: don't assert when xfb_buffer/stride is present but not xfb_offset

2018-11-09 Thread Alejandro Piñeiro
On 08/11/18 22:42, Jason Ekstrand wrote: > On Thu, Nov 8, 2018 at 7:22 AM Alejandro Piñeiro <mailto:apinhe...@igalia.com>> wrote: > > In order to allow nir_gather_xfb_info to be used on OpenGL, > specifically ARB_gl_spirv. > > So, from OpenGL 4.6 spec

Re: [Mesa-dev] [PATCH 6/7] RFC: nir/xfb_info: arrays of basic types adds just one varying

2018-11-09 Thread Alejandro Piñeiro
On 08/11/18 23:14, Jason Ekstrand wrote: > On Thu, Nov 8, 2018 at 7:22 AM Alejandro Piñeiro <mailto:apinhe...@igalia.com>> wrote: > > On OpenGL, a array of a simple type adds just one varying. So > gl_transform_feedback_varying_info struct defined at mtypes.h includes

[Mesa-dev] [PATCH 3/7] nir: fix output offset compute for dvec3/4

2018-11-08 Thread Alejandro Piñeiro
The offset compute was working fine for the case of attrib_slots=1, and updating the offset for the following varying. But in the case of attrib_slots=2 (so dvec3/4), we are basically splitting the comp_slots needed in two outputs. In that case we can't add to the offset the full size of the

[Mesa-dev] [PATCH 7/7] nir/linker: use nir_gather_xfb_info

2018-11-08 Thread Alejandro Piñeiro
Instead of a custom ARB_gl_spirv xfb gather info pass. In fact, this is not only about reusing code, but the current custom code was not handling properly how many varyings are enumerated from some complex types. So this change is also about fixing some corner cases. ---

[Mesa-dev] [PATCH 4/7] nir: add component_offset at nir_xfb_info

2018-11-08 Thread Alejandro Piñeiro
Where component_offset here is the offset when accessing components of a packed variable. Or in other words, location_frac on nir.h. Different places of mesa use different names for it. Technically nir_xfb_info consumer can get the same from the component_mask, it seems somewhat forced to make it

[Mesa-dev] [PATCH 1/7] spirv/nir: update Xfb decoration comment

2018-11-08 Thread Alejandro Piñeiro
Although it is true that Vulkan doesn't support transform feedback yet, spirv to nir is handling it due ARB_gl_spirv support. Having said so, those decorations are handled elsewhere. --- src/compiler/spirv/spirv_to_nir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[Mesa-dev] [PATCH 5/7] RFC: nir: adding varyings on nir_xfb_info and gather_info

2018-11-08 Thread Alejandro Piñeiro
In order to be used for OpenGL (right now for ARB_gl_spirv). This commit adds two new structures: * nir_xfb_varying_info: that identifies each individual varying. For each one, we need to know the type, buffer and xfb_offset * nir_xfb_buffer_info: as now for each buffer, in addition to

[Mesa-dev] [PATCH 0/7] RFC: adapt nir_gather_xfb_info to be used by ARB_gl_spirv

2018-11-08 Thread Alejandro Piñeiro
d too much info, or needed to change too much that pass. So I focused on modifying the code as less as possible. But that lead to some debatable decisions. It is more detailed on the patches with RFC. BR Alejandro Piñeiro (7): spirv/nir: update Xfb decoration comment nir: don't assert when

[Mesa-dev] [PATCH 2/7] nir: don't assert when xfb_buffer/stride is present but not xfb_offset

2018-11-08 Thread Alejandro Piñeiro
In order to allow nir_gather_xfb_info to be used on OpenGL, specifically ARB_gl_spirv. So, from OpenGL 4.6 spec, section 11.1.2.1, "Output Variables": "outputs specifying both an *XfbBuffer* and an *Offset* are captured, while outputs not specifying both of these are not captured.

[Mesa-dev] [PATCH 6/7] RFC: nir/xfb_info: arrays of basic types adds just one varying

2018-11-08 Thread Alejandro Piñeiro
On OpenGL, a array of a simple type adds just one varying. So gl_transform_feedback_varying_info struct defined at mtypes.h includes the parameters Type (base_type) and Size (number of elements). This commit checks this when the recursive add_var_xfb_outputs call handles arrays, to ensure that

[Mesa-dev] [PATCH v2] spirv/nir: don't set interface_type if it is not a struct

2018-11-06 Thread Alejandro Piñeiro
vnt_variables uses interface_type on several use cases, but on nir variable it is more limited. From nir.h: /** * For variables that are in an interface block or are an instance of an * interface block, this is the \c GLSL_TYPE_INTERFACE type for that block. * * \sa

[Mesa-dev] [PATCH] glspirv: no need to force entrypoint name to "main"

2018-10-31 Thread Alejandro Piñeiro
Since commit "intel/compiler: Stop assuming the entrypoint is called "main"" there is no need to force the entrypoint name to be "main". --- src/mesa/main/glspirv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c index 98b7ea77348..04e46ba571e

[Mesa-dev] [PATCH 23/28] nir/linker: add program ubo/ssbo at the resource list

2018-10-22 Thread Alejandro Piñeiro
--- src/compiler/glsl/gl_nir_linker.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 547549bc4e0..138a12e532d 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@

[Mesa-dev] [PATCH 25/28] i965: call to gl_nir_link_uniform_blocks

2018-10-22 Thread Alejandro Piñeiro
When using a SPIR-V shader. Note that needs to be done before linking uniforms, so when creating the uniform storage entries, block_index could be filled properly (among other things). --- src/mesa/drivers/dri/i965/brw_link.cpp | 4 1 file changed, 4 insertions(+) diff --git

[Mesa-dev] [PATCH 27/28] mesa: add NULL name check for several length queries

2018-10-22 Thread Alejandro Piñeiro
Since ARB_gl_spirv it is possible to miss a lot of name reflection information, so it is needed to add NULL name checks for several queries, and return a specific value on those cases. This commit add them for ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, ACTIVE_ATTRIBUTE_MAX_LENGTH and

[Mesa-dev] [PATCH 26/28] mesa: add NULL name check for NUM_ACTIVE_VARIABLES query

2018-10-22 Thread Alejandro Piñeiro
This can happens if we are running an SPIR-V shader (ARB_gl_spirv). --- src/mesa/main/shader_query.cpp | 30 -- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index

[Mesa-dev] [PATCH 28/28] nir/linker: Add inputs/outputs to the program resource list

2018-10-22 Thread Alejandro Piñeiro
From: Antia Puentes --- src/compiler/glsl/gl_nir_linker.c | 79 +++ 1 file changed, 79 insertions(+) diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 138a12e532d..acec0fe1f03 100644 ---

[Mesa-dev] [PATCH 24/28] i965: use GLboolean for all brw_link_shader returns

2018-10-22 Thread Alejandro Piñeiro
The function had a mix of true/GL_TRUE and false/GL_FALSE returns. Using GL_TRUE/GL_FALSE as the function returns a GLboolean. --- src/mesa/drivers/dri/i965/brw_link.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp

[Mesa-dev] [PATCH 21/28] nir/linker: update already processed uniforms search for UBOs/SSBOs

2018-10-22 Thread Alejandro Piñeiro
Until now, we were using the uniform explicit location to check if the current nir variable already was processed, and entries on the uniform storage added. But for UBOs/SSBOs, entries are added but we lack a explicit location. For those we need to rely on the UBO/SSBO binding (to the nir

[Mesa-dev] [PATCH 20/28] nir/linker: fill up uniform_storage with explicit data

2018-10-22 Thread Alejandro Piñeiro
Specifically, offset, array_stride, matrix_stride and row_major. On GLSL, most of that info is computed, but on ARB_gl_spirv they are explicit, and for Mesa, included on the glsl_type. From ARB_gl_spirv spec: "Mapping of layouts std140/std430 -> explicit *Offset*, *ArrayStride*, and

[Mesa-dev] [PATCH 22/28] nir/linker: Set the uniform's block_index

2018-10-22 Thread Alejandro Piñeiro
From: Antia Puentes Binding comparison is used to determine the block the uniform is part of. To do the binding comparison we need the information in UniformBlocks[] and ShaderStorageBlocks[] to be available, so we have to call gl_nir_link_uniform_blocks() before linking the uniforms. ---

[Mesa-dev] [PATCH 19/28] nir/linker: use only the array element type for array of ssbo/ubo

2018-10-22 Thread Alejandro Piñeiro
For this interfaces, the inner members are added only once as uniforms or resources, in opposite to other cases, like a uniform array of structs. For those guessing why a issue (16) from ARB_program_interface_query was used, instead of a quote of the core spec: The core spec is not really clear

[Mesa-dev] [PATCH 10/28] glsl_types/nir: add matrix_stride plus nir wrapper helpers

2018-10-22 Thread Alejandro Piñeiro
From ARB_gl_spirv spec: "7.6.2.spv SPIR-V Uniform Offsets and Strides The SPIR-V decorations *GLSLShared* or *GLSLPacked* must not be used. A variable in the *Uniform* Storage Class decorated as a *Block* must be explicitly laid out using the *Offset*, *ArrayStride*, and

[Mesa-dev] [PATCH 11/28] spirv/nir: fill glsl_struct_field explicit_matrix_stride

2018-10-22 Thread Alejandro Piñeiro
--- src/compiler/spirv/spirv_to_nir.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 52c3c968bb7..1201143d2f4 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -816,6

[Mesa-dev] [PATCH 12/28] glsl_types/nir: add explicit_array_stride plus nir wrapper helpers

2018-10-22 Thread Alejandro Piñeiro
From ARB_gl_spirv: "Mapping of layouts std140/std430 -> explicit *Offset*, *ArrayStride*, and *MatrixStride* Decoration on struct members" That means that we would not have available any kind of layout info, and we should use explicit array strides. This

[Mesa-dev] [PATCH 15/28] nir/linker/i965: Lower vulkan_resource_index during linking

2018-10-22 Thread Alejandro Piñeiro
From: Neil Roberts When linking a program using ARB_gl_spirv it now lowers the vulkan_resource_index intrinsic as an extra pass on the nir shader. Unlike Vulkan this can be done without waiting for the extra state from the pipeline layout. It also adds the call to this lowering on the i965

[Mesa-dev] [PATCH 18/28] nir/linker: fill is_shader_storage for uniforms

2018-10-22 Thread Alejandro Piñeiro
--- src/compiler/glsl/gl_nir_link_uniforms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c index 1a491dc2e5d..00995fb3f76 100644 --- a/src/compiler/glsl/gl_nir_link_uniforms.c +++

[Mesa-dev] [PATCH 16/28] nir/linker: handle non-ubo uses of vulkan_resource_index

2018-10-22 Thread Alejandro Piñeiro
of the vulkan_resource_index is determined by searching for an intrinsic which uses the result. Unfortunately some other lower passes can add instructions to perform arithmetic on the result so the search needs to be performed recursively on the result of those. Signed-off-by: Neil Roberts Signed-off-by: Alejandro Piñeiro

[Mesa-dev] [PATCH 14/28] nir: add is_in_ubo/ssbo/block helpers

2018-10-22 Thread Alejandro Piñeiro
Equivalent to the already existing ir_variable is_in_buffer_block and is_in_shader_storage_block, adding the uniform buffer object one. I'm using the short forms (ssbo, ubo) to avoid having method names too long. --- src/compiler/nir/nir.h | 22 ++ 1 file changed, 22

[Mesa-dev] [PATCH 17/28] nir/linker: add gl_nir_link_uniform_blocks.c

2018-10-22 Thread Alejandro Piñeiro
-by: Alejandro Piñeiro Signed-off-by: Neil Roberts --- src/compiler/Makefile.sources | 1 + src/compiler/glsl/gl_nir_link_uniform_blocks.c | 713 + src/compiler/glsl/gl_nir_linker.h | 3 + src/compiler/glsl/meson.build | 1

[Mesa-dev] [PATCH 13/28] spirv/nir: fill glsl_type array stride

2018-10-22 Thread Alejandro Piñeiro
We need all the info when asking for the type, so we needed to call type_decoration_cb earlier, in order to get the ArrayStride. It is somewhat ugly to do this only for Array types, but we can't do it before the switch as type_decoration_cb have some asserts to ensure that the type and the

[Mesa-dev] [PATCH 08/28] spirv/nir: Handle location decorations on block interface members

2018-10-22 Thread Alejandro Piñeiro
b0c643d, where spirv_to_nir stopped to do struct member splitting, done it later in NIR (Alejandro Piñeiro) Signed-off-by: Neil Roberts Signed-off-by: Alejandro Piñeiro --- src/compiler/spirv/vtn_private.h | 6 src/compiler/spirv/vtn_variables.c | 62

[Mesa-dev] [PATCH 09/28] nir/types: add three new wrapper helpers

2018-10-22 Thread Alejandro Piñeiro
To already existing fields on glsl_types. Specifically: * glsl_get_struct_field_offset * glsl_get_struct_field_matrix_layout * glsl_type_arrays_of_arrays_size --- src/compiler/nir_types.cpp | 21 + src/compiler/nir_types.h | 8 2 files changed, 29

[Mesa-dev] [PATCH 02/28] spirv/nir: translate ssbo

2018-10-22 Thread Alejandro Piñeiro
They are supported by SPIR-V for OpenGL. OpenGL codepath expect nir to include the ssbo as nir variables. --- src/compiler/spirv/vtn_variables.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index

[Mesa-dev] [PATCH 05/28] spirv/nir: include SPIR-V explicit offset on the glsl struct type

2018-10-22 Thread Alejandro Piñeiro
From ARB_gl_spirv spec: "Mapping of layouts std140/std430 -> explicit *Offset*, *ArrayStride*, and *MatrixStride* Decoration on struct members" and "A variable in the *Uniform* Storage Class decorated as a *Block* must be explicitly laid out using the

[Mesa-dev] [PATCH 06/28] spirv/nir: include row major coming from SPIR-V on the glsl type

2018-10-22 Thread Alejandro Piñeiro
--- src/compiler/spirv/spirv_to_nir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 28f4716b40e..52c3c968bb7 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -743,6 +743,7

[Mesa-dev] [PATCH 04/28] spirv/nir: fill up nir variable info for ubos and ssbo

2018-10-22 Thread Alejandro Piñeiro
Some nir variables are only filled up for some specific modes. We found to need the binding for ubos/ssbos. The comment before that code (starts with XXX) points that binding still needs to be filled up for uniform variables at that point, and that should be fixed, although it doesn't specify why

[Mesa-dev] [PATCH 00/28 v3] ARB_gl_spirv: v3 ubo/ssbo support, plus CTS goodness

2018-10-22 Thread Alejandro Piñeiro
/piglit/tree/arb_gl_spirv-series5-ubo-ssbo-v3 Thanks in advance. Alejandro Piñeiro (23): spirv/nir: translate uniform blocks spirv/nir: translate ssbo spirv/nir: setting interface type for ubos/ssbos spirv/nir: fill up nir variable info for ubos and ssbo spirv/nir: include SPIR-V explicit

[Mesa-dev] [PATCH 07/28] spirv/nir: don't set interface_type if it is not a struct

2018-10-22 Thread Alejandro Piñeiro
vnt_variables uses interface_type on several use cases, but on nir variable it is more limited. From nir.h: /** * For variables that are in an interface block or are an instance of an * interface block, this is the \c GLSL_TYPE_INTERFACE type for that block. * * \sa

[Mesa-dev] [PATCH 01/28] spirv/nir: translate uniform blocks

2018-10-22 Thread Alejandro Piñeiro
They are supported by SPIR-V for ARB_gl_spirv. --- src/compiler/spirv/vtn_variables.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index cc3438bff23..3eb1e4e9c97 100644 ---

[Mesa-dev] [PATCH 03/28] spirv/nir: setting interface type for ubos/ssbos

2018-10-22 Thread Alejandro Piñeiro
Right now, a type is considered a ubo/ssbo if the mode is uniform/shader_storage and the interface_type is different to NULL. See ir_variable::in_in_buffer_block as an example. --- src/compiler/spirv/vtn_variables.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git

Re: [Mesa-dev] [PATCH 06/13] nir: Add a pass for gathering transform feedback info

2018-10-14 Thread Alejandro Piñeiro
Just in case you missed my Rb the first time you sent this patch: Reviewed-by: Alejandro Piñeiro On 13/10/18 15:09, Jason Ekstrand wrote: > This is different from the GL_ARB_spirv pass because it generates a much > simpler data structure that isn't tied to OpenGL and mtypes.h. > -

Re: [Mesa-dev] [PATCH] nir: Add a pass for gathering transform feedback info

2018-10-10 Thread Alejandro Piñeiro
this patch: Reviewed-by: Alejandro Piñeiro On 05/10/18 16:13, Jason Ekstrand wrote: > This is different from the GL_ARB_spirv pass because it generates a much > simpler data structure that isn't tied to OpenGL and mtypes.h. > --- > src/compiler/Makefile.sources | 4 +- > s

Re: [Mesa-dev] [PATCH] nir: Add a pass for gathering transform feedback info

2018-10-08 Thread Alejandro Piñeiro
I was not able to finish trying to get ARB_gl_spirv using this pass. The major difference is that on ARB_gl_spirv (and afaiu on GLSL too) we are merging the info of all the available xfb varyings from all the stages, while this pass gathers info from a individual nir shader (so one individual

Re: [Mesa-dev] [PATCH] nir: Add a pass for gathering transform feedback info

2018-10-05 Thread Alejandro Piñeiro
On 05/10/18 17:44, Jason Ekstrand wrote: > On Fri, Oct 5, 2018 at 10:34 AM Alejandro Piñeiro > mailto:apinhe...@igalia.com>> wrote: > > On 05/10/18 16:13, Jason Ekstrand wrote: > > This is different from the GL_ARB_spirv pass because it > generates a much >

Re: [Mesa-dev] [PATCH] nir: Add a pass for gathering transform feedback info

2018-10-05 Thread Alejandro Piñeiro
On 05/10/18 16:13, Jason Ekstrand wrote: > This is different from the GL_ARB_spirv pass because it generates a much > simpler data structure that isn't tied to OpenGL and mtypes.h. I have just skimmed it (don't have time right now for a full check, will take a deeper look next Monday), but FWIW,

Re: [Mesa-dev] [PATCH 1/5] glspirv: drop pointless assert (size_t is unsigned)

2018-10-05 Thread Alejandro Piñeiro
Reviewed-by: Alejandro Piñeiro On 05/10/18 02:00, Dave Airlie wrote: > From: Dave Airlie > > Found by coverity > --- > src/mesa/main/glspirv.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c > index fecf

[Mesa-dev] [PATCH v2] glsl_types/nir: add explicit_array_stride plus nir wrapper helpers

2018-10-01 Thread Alejandro Piñeiro
From ARB_gl_spirv: "Mapping of layouts std140/std430 -> explicit *Offset*, *ArrayStride*, and *MatrixStride* Decoration on struct members" That means that we would not have available any kind of layout info, and we should use explicit array strides. This

[Mesa-dev] [PATCH v2 26/28] mesa: add NULL name check for NUM_ACTIVE_VARIABLES query

2018-09-27 Thread Alejandro Piñeiro
This can happens if we are running an SPIR-V shader (ARB_gl_spirv). --- src/mesa/main/shader_query.cpp | 30 -- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index

[Mesa-dev] [PATCH v2 28/28] nir/linker: Add inputs/outputs to the program resource list

2018-09-27 Thread Alejandro Piñeiro
From: Antia Puentes --- src/compiler/glsl/gl_nir_linker.c | 79 +++ 1 file changed, 79 insertions(+) diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 138a12e532d..acec0fe1f03 100644 ---

[Mesa-dev] [PATCH v2 27/28] mesa: add NULL name check for several length queries

2018-09-27 Thread Alejandro Piñeiro
Since ARB_gl_spirv it is possible to miss a lot of name reflection information, so it is needed to add NULL name checks for several queries, and return a specific value on those cases. This commit add them for ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, ACTIVE_ATTRIBUTE_MAX_LENGTH and

[Mesa-dev] [PATCH v2 22/28] nir/linker: Set the uniform's block_index

2018-09-27 Thread Alejandro Piñeiro
From: Antia Puentes Binding comparison is used to determine the block the uniform is part of. To do the binding comparison we need the information in UniformBlocks[] and ShaderStorageBlocks[] to be available, so we have to call gl_nir_link_uniform_blocks() before linking the uniforms. ---

[Mesa-dev] [PATCH v2 24/28] i965: use GLboolean for all brw_link_shader returns

2018-09-27 Thread Alejandro Piñeiro
The function had a mix of true/GL_TRUE and false/GL_FALSE returns. Using GL_TRUE/GL_FALSE as the function returns a GLboolean. --- src/mesa/drivers/dri/i965/brw_link.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp

[Mesa-dev] [PATCH v2 25/28] i965: call to gl_nir_link_uniform_blocks

2018-09-27 Thread Alejandro Piñeiro
When using a SPIR-V shader. Note that needs to be done before linking uniforms, so when creating the uniform storage entries, block_index could be filled properly (among other things). --- src/mesa/drivers/dri/i965/brw_link.cpp | 4 1 file changed, 4 insertions(+) diff --git

[Mesa-dev] [PATCH v2 23/28] nir/linker: add program ubo/ssbo at the resource list

2018-09-27 Thread Alejandro Piñeiro
--- src/compiler/glsl/gl_nir_linker.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 547549bc4e0..138a12e532d 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@

[Mesa-dev] [PATCH v2 21/28] nir/linker: update already processed uniforms search for UBOs/SSBOs

2018-09-27 Thread Alejandro Piñeiro
Until now, we were using the uniform explicit location to check if the current nir variable already was processed, and entries on the uniform storage added. But for UBOs/SSBOs, entries are added but we lack a explicit location. For those we need to rely on the UBO/SSBO binding (to the nir

[Mesa-dev] [PATCH v2 12/28] glsl_types/nir: add explicit_array_stride plus nir wrapper helpers

2018-09-27 Thread Alejandro Piñeiro
From ARB_gl_spirv: "Mapping of layouts std140/std430 -> explicit *Offset*, *ArrayStride*, and *MatrixStride* Decoration on struct members" That means that we would not have available any kind of layout info, and we should use explicit array strides. This

[Mesa-dev] [PATCH v2 18/28] nir/linker: fill is_shader_storage for uniforms

2018-09-27 Thread Alejandro Piñeiro
--- src/compiler/glsl/gl_nir_link_uniforms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/gl_nir_link_uniforms.c b/src/compiler/glsl/gl_nir_link_uniforms.c index 1a491dc2e5d..00995fb3f76 100644 --- a/src/compiler/glsl/gl_nir_link_uniforms.c +++

[Mesa-dev] [PATCH v2 19/28] nir/linker: use only the array element type for array of ssbo/ubo

2018-09-27 Thread Alejandro Piñeiro
For this interfaces, the inner members are added only once as uniforms or resources, in opposite to other cases, like a uniform array of structs. For those guessing why a issue (16) from ARB_program_interface_query was used, instead of a quote of the core spec: The core spec is not really clear

[Mesa-dev] [PATCH v2 11/28] spirv/nir: fill glsl_struct_field explicit_matrix_stride

2018-09-27 Thread Alejandro Piñeiro
--- src/compiler/spirv/spirv_to_nir.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 101e2b0bf02..02de2f640c1 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -798,6

[Mesa-dev] [PATCH v2 15/28] nir/linker/i965: Lower vulkan_resource_index during linking

2018-09-27 Thread Alejandro Piñeiro
From: Neil Roberts When linking a program using ARB_gl_spirv it now lowers the vulkan_resource_index intrinsic as an extra pass on the nir shader. Unlike Vulkan this can be done without waiting for the extra state from the pipeline layout. It also adds the call to this lowering on the i965

[Mesa-dev] [PATCH v2 14/28] nir: add is_in_ubo/ssbo/block helpers

2018-09-27 Thread Alejandro Piñeiro
Equivalent to the already existing ir_variable is_in_buffer_block and is_in_shader_storage_block, adding the uniform buffer object one. I'm using the short forms (ssbo, ubo) to avoid having method names too long. --- src/compiler/nir/nir.h | 22 ++ 1 file changed, 22

[Mesa-dev] [PATCH v2 20/28] nir/linker: fill up uniform_storage with explicit data

2018-09-27 Thread Alejandro Piñeiro
Specifically, offset, array_stride, matrix_stride and row_major. On GLSL, most of that info is computed, but on ARB_gl_spirv they are explicit, and for Mesa, included on the glsl_type. From ARB_gl_spirv spec: "Mapping of layouts std140/std430 -> explicit *Offset*, *ArrayStride*, and

[Mesa-dev] [PATCH v2 13/28] spirv/nir: fill glsl_type array stride

2018-09-27 Thread Alejandro Piñeiro
We need all the info when asking for the type, so we needed to call type_decoration_cb earlier, in order to get the ArrayStride. It is somewhat ugly to do this only for Array types, but we can't do it before the switch as type_decoration_cb have some asserts to ensure that the type and the

[Mesa-dev] [PATCH v2 17/28] nir/linker: add gl_nir_link_uniform_blocks.c

2018-09-27 Thread Alejandro Piñeiro
-by: Alejandro Piñeiro Signed-off-by: Neil Roberts --- src/compiler/Makefile.sources | 1 + src/compiler/glsl/gl_nir_link_uniform_blocks.c | 713 + src/compiler/glsl/gl_nir_linker.h | 3 + src/compiler/glsl/meson.build | 1

[Mesa-dev] [PATCH v2 16/28] nir/linker: handle non-ubo uses of vulkan_resource_index

2018-09-27 Thread Alejandro Piñeiro
of the vulkan_resource_index is determined by searching for an intrinsic which uses the result. Unfortunately some other lower passes can add instructions to perform arithmetic on the result so the search needs to be performed recursively on the result of those. Signed-off-by: Neil Roberts Signed-off-by: Alejandro Piñeiro

[Mesa-dev] [PATCH v2 00/28] ARB_gl_spirv: v2 ubo/ssbo support, plus CTS goodness

2018-09-27 Thread Alejandro Piñeiro
ned, with this series would pass the CTS ARB_gl_spirv tests on i965. Alejandro Piñeiro (23): spirv/nir: translate uniform blocks spirv/nir: translate ssbo spirv/nir: setting interface type for ubos/ssbos spirv/nir: fill up nir variable info for ubos and ssbo spirv/nir: include SPIR-V

[Mesa-dev] [PATCH v2 02/28] spirv/nir: translate ssbo

2018-09-27 Thread Alejandro Piñeiro
They are supported by SPIR-V for OpenGL. OpenGL codepath expect nir to include the ssbo as nir variables. --- src/compiler/spirv/vtn_variables.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index

[Mesa-dev] [PATCH v2 10/28] glsl_types/nir: add matrix_stride plus nir wrapper helpers

2018-09-27 Thread Alejandro Piñeiro
From ARB_gl_spirv spec: "7.6.2.spv SPIR-V Uniform Offsets and Strides The SPIR-V decorations *GLSLShared* or *GLSLPacked* must not be used. A variable in the *Uniform* Storage Class decorated as a *Block* must be explicitly laid out using the *Offset*, *ArrayStride*, and

[Mesa-dev] [PATCH v2 06/28] spirv/nir: include row major coming from SPIR-V on the glsl type

2018-09-27 Thread Alejandro Piñeiro
--- src/compiler/spirv/spirv_to_nir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 15a3e8cce9a..101e2b0bf02 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -725,6 +725,7

  1   2   3   4   5   6   7   8   9   10   >