summaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* nir: copy front interpolation when creating fake back color inputIlia Mirkin2017-07-081-2/+6
| | | | | | | | Fixes a bunch of gl_BackColor interpolation tests that had explicit interpolation specified on the fragment shader gl_Color. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* nir/spirv: Remove unnecessary comment.Andres Gomez2017-07-081-5/+0
| | | | | | | | | It should have been removed after 00c47e111c. Cc: Jason Ekstrand <[email protected]> Cc: Connor Abbott <[email protected]> Signed-off-by: Andres Gomez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: check if any of the named builtins are available firstIlia Mirkin2017-07-053-4/+14
| | | | | | | | | | | | | | | | | | | | | _mesa_glsl_has_builtin_function is used to determine whether any variant of a builtin are available, for the purpose of enforcing the GLSL ES 3.00+ rule that overloads or overrides of builtins are disallowed. However the builtin_builder contains information on all builtins, irrespective of parse state, or versions, or extension enablement. As a result we would say that a builtin existed even if it was not actually available. To resolve this, first check if at least one signature is available for a builtin before returning true. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101666 Signed-off-by: Ilia Mirkin <[email protected]> Cc: [email protected] Reviewed-by: Timothy Arceri <[email protected]> Acked-by: Lionel Landwerlin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir/spirv: Rework function argument setupJason Ekstrand2017-07-053-28/+34
| | | | | | | | Now that we have proper pointer types, we can be more sensible about the way we set up function arguments and deal with the two cases of pointer vs. SSA parameters distinctly. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Stop trying to convert pointers to SSA in glsl450Jason Ekstrand2017-07-051-1/+6
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Use real pointer typesJason Ekstrand2017-07-054-15/+60
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Stop using glsl_type for function typesJason Ekstrand2017-07-053-31/+31
| | | | | | | We're going to want the full vtn_type available to us anyway at which point glsl_type isn't really buying us anything. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Beef up the type system a bitJason Ekstrand2017-07-052-28/+59
| | | | | | | | | This adds a vtn concept of base_type as well as a couple of other fields. This lets us be a tiny bit more efficient in some cases but, more importantly, it will eventually let us express things the GLSL type system can't. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Compact vtn_typeJason Ekstrand2017-07-052-26/+39
| | | | | | | Use an anonymous union of structs to help keep the structure small and better organized. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Simplify type copyingJason Ekstrand2017-07-051-7/+1
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Compute offsets for UBOs and SSBOs up-frontJason Ekstrand2017-07-052-27/+138
| | | | | | | | | Now that we have a pointer wrapper class, we can create offsets for UBOs and SSBOs up-front instead of waiting until we have the full access chain. For push constants, we still use the old mechanism because it provides us with some nice range information. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Rework the way pointers get dereferencedJason Ekstrand2017-07-052-64/+88
| | | | | | | This has the advantage of moving all of the "extend an access chain" code into one place. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Break variable creation out into a helperJason Ekstrand2017-07-051-172/+184
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Remove unneeded parameters from pointer_to_offsetJason Ekstrand2017-07-053-19/+8
| | | | | | | | Everyone now calls it with stop_at_matrix = false. Since we're now always walking all the way to the end of the access chain, the type returned is just the same as ptr->type; Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Simplify matrix loads/storesJason Ekstrand2017-07-052-100/+90
| | | | | | | | | | | | | | | | | | | | | Instead of handling all of the complexity at the end, we choose to decorate types a bit more cleverly. When we have a row-major matrix type, we give it the stride of a single vector and give it's array element type (which represents a column) the actual matrix stride. Previously, we were using stop_at_matrix and handling everything from matrix on down as special cases but now we walk the access chain all the way to the end and then load. Even though this looks like it may lead to a significant functional change, it doesn't. The reason why we needed to do stop_at_matrix before was to handle row-major properly since the offsets and strides would be all out-of-order. Now that row major matrix types have the small stride on the matrix and the large stride on the vector, offsetting to a single column of a row-major matrix works fine. The load/store code simply picks up on the fact that the stride isn't the type size and does multiple loads. The generated code from these methods should be the same. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Use the correct stride for non-32-bit vectorsJason Ekstrand2017-07-051-1/+1
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Wrap access chains in a new vtn_pointer data structureJason Ekstrand2017-07-054-159/+187
| | | | | | | | | | | | The vtn_pointer structure provides a bit better abstraction than passing access chains around directly. For one thing, if the pointer just points to a variable, we don't need the access chain at all. Also, pointers know what their dereferenced type is so we can avoid passing the type in a bunch of places. Finally, pointers can, in theory, be extended to the case where you don't actually know what variable is being referenced. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Rename some things from access_chain to pointerJason Ekstrand2017-07-054-82/+73
| | | | | | | We're about to add a vtn_pointer data structure and this will prevent some rename churn in the next commit. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Split up Uniform and UniformConstant storage classesJason Ekstrand2017-07-051-3/+7
| | | | | | | | | We were originally handling them together because I was rather unclear on the distinction. However, keeping them combined keeps the confusion. Split them up so that it's more clear from the code how we expect the two storage classes to be used. Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Add a storage_class_to_mode helperJason Ekstrand2017-07-051-45/+78
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Use the type from the deref for atomicsJason Ekstrand2017-07-051-3/+3
| | | | | | | Previously, we were using the type of the variable which is incorrect. Cc: "17.1" <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir/spirv: Move a "}"Jason Ekstrand2017-07-051-1/+1
| | | | | | | It's closing a "{" at the begining of a switch case. Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* glsl_to_nir: zero-initialize var->data.descriptor_setNicolai Hähnle2017-07-051-0/+1
| | | | | | | This is convenient for backends that support both Vulkan and OpenGL while lowering samplers to derefs with nir_lower_samplers_as_deref. Reviewed-by: Timothy Arceri <[email protected]>
* glsl: add glsl_base_type_is_integerNicolai Hähnle2017-07-051-0/+11
| | | | | | We will use this from radeonsi/nir, which we want to keep as pure C code. Reviewed-by: Samuel Pitoiset <[email protected]>
* nir: add NIR_PRINT environment variableNicolai Hähnle2017-07-051-0/+19
| | | | Reviewed-by: Rob Clark <[email protected]>
* glsl/blob: add valgrind checks that written data is definedNicolai Hähnle2017-07-052-0/+13
| | | | | | | | | | | | | Undefined data will eventually trigger a valgrind error while computing its CRC32 while writing it into the disk cache, but at that point, it is basically impossible to track down where the undefined data came from. With this change, finding the origin of undefined data becomes easy. v2: remove duplicate VALGRIND_CFLAGS (Emil) Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glsl: explicitly zero out padding to gl_shader_variable bitfieldNicolai Hähnle2017-07-051-1/+4
| | | | | | | | | | Otherwise, the padding bits remain undefined, which leads to valgrind errors when storing the gl_shader_variable in the disk cache. v2: use rzalloc instead of an explicit padding member variable Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: look for multiple variables simultaneously with find_assignment_visitorNicolai Hähnle2017-07-051-41/+81
| | | | | | | | | | | | Save some passes over the IR. v2: redesign to make the users of find_assignments more readable v3: - fix missing ! - add some comments and make the num_found check more explicit (Timothy) Reviewed-by: Ian Romanick <[email protected]> (v1) Reviewed-by: Timothy Arceri <[email protected]>
* spirv: fix OpBitcast when the src and dst bitsize are different (v3)Connor Abbott2017-07-031-1/+66
| | | | | | | | | | | | | | | Before, we were just implementing it with a move, which is incorrect when the source and destination have different bitsizes. To implement it properly, we need to use the 64-bit pack/unpack opcodes. Since glslang uses OpBitcast to implement packInt2x32 and unpackInt2x32, this should fix them on anv (and radv once we enable the int64 capability). v2: make supporting non-32/64 bit easier (Jason) v3: add another assert (Jason) Fixes: b3135c3c ("anv: Advertise shaderInt64 on Broadwell and above") Signed-off-by: Connor Abbott <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: simplify disable_varying_optimizations_for_ssoNicolai Hähnle2017-07-031-18/+11
| | | | | | | | | We always have stage == first and stage == last when first == last, so drop the special case. Also rephrase the comment to make the logic clearer. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: always print non-zero var->data.location_fracNicolai Hähnle2017-07-031-1/+1
| | | | | | | This is helpful in debugging varying assignments. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* nir: Add a lowering pass for UYVY texturesJohnson Lin2017-06-302-0/+19
| | | | | | Similar with support for YUYV but with byte order difference in sampler Reviewed-by: Kristian H. Kristensen <[email protected]>
* nir: implement GLSL.std.450 NMax, NMIn and NClamp operationsJuan A. Suarez Romero2017-06-271-0/+3
| | | | | | v2: NIR fmax/fmin already handles NaN (Connor). Reviewed by: Elie Tournier <[email protected]>
* nir: add support for 64-bit in SmoothStep functionJuan A. Suarez Romero2017-06-271-3/+5
| | | | | | | | | | | According to GLSL.std.450 spec, SmoothStep expects input to be a floating-point type, but it does not restrict the bitsize. Current implementation relies on inputs to be 32-bit. This commit extends the support to 64-bit size inputs. Reviewed by: Elie Tournier <[email protected]>
* nir: sge operation is defined for floating-point typesJuan A. Suarez Romero2017-06-271-1/+1
| | | | | | | According to GLSL.std.450 spec, the operand for step() function must be a floating-point. It does not restrict the value to 32-bit floats. Reviewed by: Elie Tournier <[email protected]>
* glsl: do not call link_xfb_stride_layout_qualifiers() for fragment shadersJuan A. Suarez Romero2017-06-261-2/+5
| | | | | | | | | | | | | | | | | xfb only applies to the latest stage before the fragment shader, so there is no need to invoke it in the fragment shader. Fixes: KHR-GL45.enhanced_layouts.xfb_stride_of_empty_list KHR-GL45.enhanced_layouts.xfb_stride_of_empty_list_and_api v2: do reset only if shaders provide an explicit stride v3: do not call link_xfb_stride_layout_qualifiers() for fragment shaders (Timothy) Reviewed-by: Timothy Arceri <[email protected]> Signed-off-by: Juan A. Suarez Romero <[email protected]>
* glsl: tidy up int declarationTimothy Arceri2017-06-221-2/+1
| | | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* glsl: fix typo in commentTimothy Arceri2017-06-221-1/+1
| | | | | | Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]>
* glsl: Track whether uniforms are active per stageKenneth Graunke2017-06-223-0/+9
| | | | | | | | | | for finer granularity state flagging v2: Marek - use a bitmask, add shader cache support Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* spirv: Work around the Doom shader bugJason Ekstrand2017-06-202-0/+28
| | | | | | | | | | | | | | | | | Doom shipped with a broken version of GLSLang which handles samplers as function arguments in a way that isn't spec-compliant. In particular, it creates a temporary local sampler variable and copies the sampler into it. While Dave has had a hack patch out for a while that gets it working, we've never landed it because we've been hoping that a game update would come out with fixed shaders. Unfortunately, no game update appears on to be on the horizon and I've found this issue in yet another application so I think we're stuck working around it. Hopefully, we can delete this code one day. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99467 Cc: "17.1" <[email protected]> Tested-by: Grazvydas Ignotas <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glsl: Update build instructions for int64.glslIan Romanick2017-06-201-2/+2
| | | | | | Trivial Signed-off-by: Ian Romanick <[email protected]>
* glsl: Fix indent in dump codeElie Tournier2017-06-201-7/+7
| | | | | Signed-off-by: Elie Tournier <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: gl_Max{Vertex,Fragment}UniformComponents exist in all desktop GL versionsIago Toral Quiroga2017-06-191-7/+9
| | | | | | | | | | The current implementation assumed that these were replaced in GLSL >= 4.10 by gl_Max{Vertex,Fragment}UniformVectors, however this is not true: both built-ins should be produced from GLSL 4.10 onwards. This was raised by new CTS tests that are in development. Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: add ir_variable::contains_bindless()Samuel Pitoiset2017-06-141-0/+11
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: set the explicit binding value for bindless samplers/imagesSamuel Pitoiset2017-06-141-6/+29
| | | | | | | | | This handles a situation like: layout (bindless_sampler, binding = 7) uniform sampler2D; Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: pass the ir_variable object to set_opaque_binding()Samuel Pitoiset2017-06-141-3/+4
| | | | | | | | In order to set the explicit binding value for bindless samplers/images. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: process uniform images declared bindlessSamuel Pitoiset2017-06-142-9/+85
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: process uniform samplers declared bindlessSamuel Pitoiset2017-06-142-11/+95
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: add support for glUniformHandleui64*ARB()Samuel Pitoiset2017-06-143-0/+9
| | | | | | | | | | | | | | Bindless sampler/image handles are represented using 64-bit unsigned integers. The ARB_bindless_texture spec says: "The error INVALID_OPERATION is generated by UniformHandleui64{v}ARB if the sampler or image uniform being updated has the "bound_sampler" or "bound_image" layout qualifier"." Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: simplify an assertion in lower_ubo_referenceNicolai Hähnle2017-06-131-1/+1
| | | | | | Struct types are now equal when they're structurally equal. Reviewed-by: Timothy Arceri <[email protected]>