aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
Commit message (Collapse)AuthorAgeFilesLines
* nir: improvements to native_integers removalJonathan Marek2019-05-311-10/+0
| | | | | | | | | Improvements related to the patch that removed native_integers: * In glsl_to_nir, special cases for i2f,u2f,etc are no longer needed * In prog_to_nir, use sge/slt and let lower_scmp lower it if needed Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Drop imov/fmov in favor of one mov instructionJason Ekstrand2019-05-241-1/+1
| | | | | | | | | | | | | | | | The difference between imov and fmov has been a constant source of confusion in NIR for years. No one really knows why we have two or when to use one vs. the other. The real reason is that they do different things in the presence of source and destination modifiers. However, without modifiers (which many back-ends don't have), they are identical. Now that we've reworked nir_lower_to_source_mods to leave one abs/neg instruction in place rather than replacing them with imov or fmov instructions, we don't need two different instructions at all anymore. Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Vasily Khoruzhick <[email protected]> Acked-by: Rob Clark <[email protected]>
* nir/builder: Remove the use_fmov parameter from nir_swizzleJason Ekstrand2019-05-241-3/+3
| | | | | | | | | | This flag has caused more confusion than good in most cases. You can validly use imov for floats or fmov for integers because, without source modifiers, neither modify their input in any way. Using imov for floats is more reliable so we go that direction. Reviewed-by: Kristian H. Kristensen <[email protected]> Acked-by: Alyssa Rosenzweig <[email protected]>
* glsl: simplify resource list building codeTimothy Arceri2019-05-233-77/+87
| | | | | | | | | | | | | | This greatly simplifies the code to calculate if we should add a buffer to the resource list. This uses the spec rules and simple math to decide if we should add the buffer rather than complex string processing. This patch refines a patch present in the ARB_gl_spriv merge request for the NIR linker and applies it to the GLSL IR linker. This is why we also move the function to the shared linker code, because we will want to reuse the code for the NIR linker also. Reviewed-by: Tapani Pälli <[email protected]>
* Revert "glsl: do not use deprecated bison-keyword"Erik Faye-Lund2019-05-212-2/+2
| | | | This reverts commit eb85124a9f6e9cb94d0d4a99f91bbae374777e3a.
* glsl: do not use deprecated bison-keywordErik Faye-Lund2019-05-212-2/+2
| | | | | | | | | | %error-verbose has been deprecated since Bison 3.0, which was released in 2013. In Bison 3.3.1 which was recently released, this has started causing warnings. Let's update the code to do this in the modern way intead, to avoid cluttering the output needlessly. Signed-off-by: Erik Faye-Lund <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl/nir: init non-static class member.Dave Airlie2019-05-171-0/+1
| | | | | | | | glsl_to_nir.cpp:276: uninit_member: Non-static class member "sig" is not initialized in this constructor nor in any functions that it calls. Reported by coverity Acked-by: Ilia Mirkin <[email protected]>
* glsl: init non-static class member in link uniforms. (v2)Dave Airlie2019-05-171-1/+2
| | | | | | | | | | link_uniforms.cpp:477: uninit_member: Non-static class member "shader_storage_blocks_write_access" is not initialized in this constructor nor in any functions that it calls. Reported by coverity. v2: fix 9->0 typo (Ilia) Acked-by: Ilia Mirkin <[email protected]>
* compiler: Add lowering support for 64-bit saturate operations to softwareAnuj Phogat2019-05-151-0/+12
| | | | | | | | | | Fixes 7 Khronos GL CTS tests: KHR-GL45.gpu_shader_fp64.builtin.smoothstep_dvec{double, 2, 3, 4} KHR-GL45.gpu_shader_fp64.builtin.smoothstep_against_scalar_dvec{2, 3, 4} Suggested-by: Jason Ekstrand <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: s/GLboolean/bool/ to silence MSVC compiler warningBrian Paul2019-05-081-1/+1
| | | | | | It complains about mixing GLboolean and bool in the |= expression. Reviewed-by: Roland Scheidegger <[email protected]>
* glsl_to_nir: remove unused type_is_int()Timothy Arceri2019-05-081-9/+0
| | | | | | This was missed in e00fa99b08b3. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* glsl_to_nir: drop supports_intsChristian Gmeiner2019-05-071-23/+8
| | | | | | | At initial nir level all drivers are supporting ints. Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: nir_shader_compiler_options: drop native_integersChristian Gmeiner2019-05-071-1/+1
| | | | | | | | Driver which do not support native integers should use a lowering pass to go from integers to floats. Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* meson: Don't build glsl cache_test when shader cache is disabledDylan Baker2019-05-031-12/+13
| | | | | | | v2: - Use new with_shader_cache variable instead of host_machine.system() == 'windows' Reviewed-by: Eric Anholt <[email protected]>
* glsl/tests: define ssize_t on windowsDylan Baker2019-05-031-0/+4
| | | | Reviewed-by: Eric Anholt <[email protected]>
* glsl: fix general_ir_test with mingwDylan Baker2019-05-031-7/+7
| | | | | | | | Somewhere down in the depths of the mingw headers 'interface' is defined, change it to iface like a similar patch did. Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: fix and clean up NV_compute_shader_derivatives supportMarek Olšák2019-05-021-54/+24
| | | | | | | - make sure compute shader derivatives are exposed for all extensions - unify duplicated code Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
* glsl: fix typo in #warning messageBrian Paul2019-05-021-1/+1
| | | | Trivial. Spotted by Eric Engestrom.
* glsl: work around MinGW 7.x compiler bugBrian Paul2019-05-011-0/+15
| | | | | | | | | | | I'm not sure what triggered this, but building with scons platform=windows toolchain=crossmingw machine=x86 build=profile with MinGW g++ 7.3 or 7.4 causes an internal compiler error. We can work around it by forcing -O1 optimization. Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Neha Bhende <[email protected]>
* delete autotools .gitignore filesEric Engestrom2019-04-295-29/+0
| | | | | | | | One special case, `src/util/xmlpool/.gitignore` is not entirely deleted, as `xmlpool.pot` still gets generated (eg. by `ninja xmlpool-pot`). Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* glsl/linker: check for xfb_offset aliasingAndres Gomez2019-04-292-31/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From page 76 (page 80 of the PDF) of the GLSL 4.60 v.5 spec: " No aliasing in output buffers is allowed: It is a compile-time or link-time error to specify variables with overlapping transform feedback offsets." Currently, this is expected to fail, but it succeeds: " ... layout (xfb_offset = 0) out vec2 a; layout (xfb_offset = 0) out vec4 b; ... " Fixes the following piglit test: tests/spec/arb_enhanced_layouts/compiler/transform-feedback-layout-qualifiers/xfb_offset/invalid-overlap.vert Fixes the following test: KHR-GL44.enhanced_layouts.xfb_output_overlapping v2: - Use a data structure to track the used components instead of a nested loop (Ilia). v3: - Take the BITSET_WORD array out from the gl_transform_feedback_buffer struct and make it local to the validation process (Timothy). - Do not use a nested scope for the validation (Timothy). v4: - Add reference to the fixed piglit test in the commit log. - Add reference to the fixed VK-GL-CTS test in the commit log (Tapani). - Empty initialize the BITSET_WORD pointers array (Tapani). Cc: Timothy Arceri <[email protected]> Cc: Ilia Mirkin <[email protected]> Signed-off-by: Andres Gomez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl/list: Add an exec_list_is_singular() helper.Kenneth Graunke2019-04-281-0/+7
| | | | | | | Similar to list_is_singular() in util/list.h. Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: use empty brace initializerTapani Pälli2019-04-261-2/+2
| | | | | | | | | fixes following warning with clang: warning: suggest braces around initialization of subobject Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* glsl: fix shader_storage_blocks_write_access for SSBO block arrays (v2)Marek Olšák2019-04-251-3/+19
| | | | | | | | | | This fixes KHR-GL45.compute_shader.resources-max on radeonsi. Fixes: 4e1e8f684bf "glsl: remember which SSBOs are not read-only and pass it to gallium" v2: use is_interface_array, protect again assertion failures in u_bit_consecutive Reviewed-by: Dave Airlie <[email protected]>
* glsl: handle interactions between EXT_gpu_shader4 and texture extensionsMarek Olšák2019-04-243-323/+412
| | | | | | also, EXT_texture_buffer_object has to be enabled separately. Reviewed-by: Eric Anholt <[email protected]>
* glsl: allow "varying out" for fragment shader outputs with EXT_gpu_shader4Marek Olšák2019-04-243-2/+19
| | | | Reviewed-by: Eric Anholt <[email protected]>
* glsl: add texture builtin functions for EXT_gpu_shader4Marek Olšák2019-04-241-25/+667
| | | | | | | | | v2: some fixes to texture functions thanks to piglit tests Reviewed-by: Timothy Arceri <[email protected]> (v1) Reviewed-by: Ian Romanick <[email protected]> (v1) Tested-by: Dieter Nützel <[email protected]> (v1) Reviewed-by: Eric Anholt <[email protected]>
* glsl: add arithmetic builtin functions for EXT_gpu_shader4Marek Olšák2019-04-241-13/+35
| | | | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: add builtin variables for EXT_gpu_shader4Marek Olšák2019-04-241-3/+4
| | | | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: apply some 1.30 and other rules to EXT_gpu_shader4 as wellMarek Olšák2019-04-243-8/+12
| | | | Reviewed-by: Eric Anholt <[email protected]>
* glsl: enable types for EXT_gpu_shader4Chris Forbes2019-04-242-25/+57
| | | | | | | Reviewed-by: Timothy Arceri <[email protected]> Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: add `unsigned int` type for EXT_GPU_shader4Marek Olšák2019-04-242-2/+11
| | | | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: enable noperspective|flat|centroid for EXT_gpu_shader4Chris Forbes2019-04-241-3/+3
| | | | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: add scaffolding for EXT_gpu_shader4Chris Forbes2019-04-243-0/+4
| | | | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glsl: Silence may unused parameter warnings in glsl/ir.hIan Romanick2019-04-231-1/+1
| | | | | | | | | | | | | Every file that included glsl/ir.h had a warning like: src/compiler/glsl/ir.h: In member function ‘virtual bool ir_rvalue::is_lvalue(const _mesa_glsl_parse_state*) const’: src/compiler/glsl/ir.h:236:64: warning: unused parameter ‘state’ [-Wunused-parameter] virtual bool is_lvalue(const struct _mesa_glsl_parse_state *state = NULL) const ^ Cc: Samuel Pitoiset <[email protected]> Fixes: fa4ebf6b8d9 ("glsl: add _mesa_glsl_parse_state object to is_lvalue()") Reviewed-by: Sagar Ghuge <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* st/mesa/radeonsi: fix race between destruction of types and shader compilationTimothy Arceri2019-04-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit 624789e3708c moved the destruction of types out of atexit() and made use of a ref count instead. This is useful for avoiding a crash where drivers such as radeonsi are still compiling in a thread when the app exits and has not called MakeCurrent to change from the current context. While the above scenario is technically an app bug we shouldn't crash. However that change caused another race condition between the shader compilation tread in radeonsi and context teardown functions. This patch makes two changes to fix this new problem: First we explicitly call _mesa_destroy_shader_compiler_types() when destroying the st context rather than calling it indirectly via _mesa_free_context_data(). We do this as we must call it after st_destroy_context_priv() so that we don't destory the glsl types before the compilation threads finish. Next wait for the shader threads to finish in si_destroy_context() this also means we need to call context destroy before destroying the queues in si_destroy_screen(). Fixes: 624789e3708c ("compiler/glsl: handle case where we have multiple users for types") Reviewed-by: Marek Olšák <[email protected]>
* Revert "glsl: Set location on structure-split sampler uniform variables"Kenneth Graunke2019-04-221-1/+8
| | | | | | | | | | | | | | | | | | | This reverts commit 9e0c744f07a21fc7bb018a77cf83b057436d0d1b, which regressed dEQP-GLES2.functional.uniform_api.random.3. It turns out that the newly produced location is meaningless and impossible to consume by drivers that want to look at gl_uniform_storage, so it's probably better to leave it unset (0) than a number that looks usable. Leave a tombstone^Wcomment to discourage the next person from making the obvious looking fix. See the next commit for a longer description of the problem. This breaks tests/spec/glsl-1.10/execution/samplers/uniform-struct on i965, which was originally fixed by the revert. The next commit will fix it again. Reviewed-by: Jason Ekstrand <[email protected]>
* glsl_to_nir: Initialize debug variableKristian H. Kristensen2019-04-191-1/+1
| | | | | | | | If we want to assert on found == true when the loop exits early, we need to initialize it to false. Signed-off-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* compiler/glsl: handle case where we have multiple users for typesTapani Pälli2019-04-163-3/+22
| | | | | | | | | | | | | | | | | | Both Vulkan and OpenGL might be using glsl_types simultaneously or we can also have multiple concurrent Vulkan instances using glsl_types. Patch adds a one time init to track number of users and will release types only when last user calls _glsl_type_singleton_decref(). This change fixes glsl_type memory leaks we have with anv driver. v2: reuse hash_mutex, cleanup, apply fix also to radv driver and rename helper functions (Jason) v3: move init, destroy to happen on GL context init and destroy Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl/linker: always validate explicit locations for first and last interfacesAndres Gomez2019-04-153-20/+17
| | | | | | | | | | | | Until now, we were only doing this when linking a SSO program. However, nothing avoids linking a non SSO program which doesn't have both a VS and FS. In those cases, we also need to report the usual linking errors, if happening. v2: Use a better name for the renamed function (Timothy). Signed-off-by: Andres Gomez <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa, glsl: add support for EXT_shader_image_load_formattedRhys Perry2019-04-153-0/+13
| | | | | | | | v3: rebase Signed-off-by: Rhys Perry <[email protected]> Reviewed-by: Marek Olšák <[email protected]> (v2) Signed-off-by: Marek Olšák <[email protected]>
* nir: make nir_const_value scalarKarol Herbst2019-04-142-14/+14
| | | | | | | | | v2: remove & operator in a couple of memsets add some memsets v3: fixup lima Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> (v2)
* glsl: Set location on structure-split sampler uniform variablesKenneth Graunke2019-04-121-0/+1
| | | | | | | | | | | | | gl_nir_lower_samplers_as_deref splits structure uniform variables, creating new variables for individual fields. As part of that, it calculates a new location. It then never set this on the new variables. Thanks to Michael Fiano for finding this bug. Fixes crashes on i965 with Piglit's new tests/spec/glsl-1.10/execution/samplers/uniform-struct test, which was reduced from the failing case in Michael's app. Fixes: f003859f97c nir: Make gl_nir_lower_samplers use gl_nir_lower_samplers_as_deref Reviewed-by: Timothy Arceri <[email protected]>
* glsl: allow the #extension directive within code blocks for the dri optionMarek Olšák2019-04-121-0/+9
| | | | | | for Viewperf 13 Acked-by: Timothy Arceri <[email protected]>
* glsl/nir: add support for lowering bindless images_derefsKarol Herbst2019-04-123-0/+99
| | | | | | | | | | | v2: handle atomics as well make use of nir_rewrite_image_intrinsic v3: remove call to nir_remove_dead_derefs v4: (Timothy Arceri) dont actually call lowering yet Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> (v3) Reviewed-by: Marek Olšák <[email protected]>
* glsl/nir: fetch the type for images from the deref instructionKarol Herbst2019-04-121-3/+3
| | | | | | | | fixes retrieving the sampler type for bindless images stored inside structs. Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* glsl_to_nir: handle bindless texturesKarol Herbst2019-04-121-4/+15
| | | | | | | | | v2: add support for AMD Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> (v1) Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* Revert "glsl: fix shader_storage_blocks_write_access for SSBO block arrays"Marek Olšák2019-04-101-6/+2
| | | | | | This reverts commit b7ca074cc0df6101c428b2dfa53a59a0c6620af2. It broke a lot of tests.
* glsl/standalone: add GLES3.1 and GLES3.2 compatibilityKarol Herbst2019-04-101-0/+5
| | | | | | | | | | also set some constants for SSBOs. With that it can compile the shader from: dEQP-GLES31.functional.ssbo.layout.random.all_per_block_buffers.18 Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: fix shader_storage_blocks_write_access for SSBO block arraysMarek Olšák2019-04-091-2/+6
| | | | | | | | CTS: GL45-CTS.compute_shader.resources-max Fixes: 4e1e8f684bf "glsl: remember which SSBOs are not read-only and pass it to gallium" Reviewed-by: Timothy Arceri <[email protected]>