summaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* glsl: update default precision qualifier when it is set in the shaderSamuel Iglesias Gonsálvez2016-10-261-1/+4
| | | | | | | | | | | | Default precision qualifier for a data type could be set several times inside a shader. This patch allows to update the default precision qualifier for the given type that is saved in the symbol table. If it is not in the symbol table, just add it. Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97804 Reviewed-by: Timothy Arceri <[email protected]>
* nir: stop adjusting driver location for varying packingTimothy Arceri2016-10-262-47/+2
| | | | | | | | | | | | As of 59864e8e020 we just use the location assigned by the front-end and no longer need this for i965. Since there were some issues in the logic with assigning arrays the same driver location if they didn't start at the same location just remove it and let other drivers implement a solution if needed when they add ARB_enhanced_layouts support. Reviewed-by: Kenneth Graunke <[email protected]>
* compiler: remove copy_shader_info()Timothy Arceri2016-10-262-35/+1
| | | | | | | This temporary helper is no longer needed now that we have finished refactoring common shader metadata. Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: set uses texture gather directly in shader_infoTimothy Arceri2016-10-262-3/+1
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* glsl/st/mesa: use common system values read fieldTimothy Arceri2016-10-262-3/+2
| | | | | | | | | And set system values read directly in shader_info. st/mesa changes where: Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: set patch outputs written directly in shader_infoTimothy Arceri2016-10-262-3/+2
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: set patch inputs read directly in shader_infoTimothy Arceri2016-10-262-3/+2
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: set outputs read directly in shader_infoTimothy Arceri2016-10-262-3/+2
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* r200/glsl/st/mesa: use common outputs written fieldTimothy Arceri2016-10-262-7/+6
| | | | | | | | | And set outputs written directly in shader_info. st/mesa changes where: Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/glsl: set double inputs read directly in shader_infoTimothy Arceri2016-10-262-2/+1
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* r200/i915/st/mesa/compiler: use common inputs read fieldTimothy Arceri2016-10-262-7/+6
| | | | | | | | | | | | And set set inputs_read directly in shader_info. To avoid regressions between changes this change is a squashed version of the following patches. st/mesa changes where: Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/compiler: copy early fragment tests to shader_info in ↵Timothy Arceri2016-10-261-4/+0
| | | | | | _mesa_copy_linked_program_data() Reviewed-by: Jason Ekstrand <[email protected]>
* st/mesa/r200/i915/i965: eliminate gl_fragment_programTimothy Arceri2016-10-261-11/+2
| | | | | | | | | | Here we move OriginUpperLeft and PixelCenterInteger into gl_program all other fields have been replace by shader_info. V2: Don't use anonymous union/structs to hold vertex/fragment fields suggested by Ian. Reviewed-by: Jason Ekstrand <[email protected]>
* i965/mesa/st/swrast: set fs shader_info directly and switch to using itTimothy Arceri2016-10-262-13/+4
| | | | | | | Note we access shader_info from the program struct rather than the nir_shader pointer because shader cache won't create a nir_shader. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: remove now unused IsCentroid from gl_fragment_programTimothy Arceri2016-10-261-5/+1
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* compiler: update the comment for enum glsl_interp_modeTimothy Arceri2016-10-261-1/+1
| | | | | | We no longer store the interp mode with the program metadata. Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: remove now unused InterpQualifierTimothy Arceri2016-10-261-5/+2
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: set cs shader_info metadata directlyTimothy Arceri2016-10-261-9/+0
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* compiler: add additional cs metadata fields to shader infoTimothy Arceri2016-10-262-0/+6
| | | | | | And copy values from GLSL. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: set gs shader_info metadata directlyTimothy Arceri2016-10-261-10/+0
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* compiler: add input primative field for gs in shader infoTimothy Arceri2016-10-262-0/+4
| | | | | | And copy the value from GLSL. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: copy tes metadata directly to shared shader infoTimothy Arceri2016-10-261-11/+0
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* compiler: add fields for tes metadata to shader infoTimothy Arceri2016-10-262-0/+18
| | | | | | And copy the values from gl_tess_eval_program struct. Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: set tcs shader_info metadata directlyTimothy Arceri2016-10-261-4/+0
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: add temporary copy_shader_info() functionTimothy Arceri2016-10-264-46/+88
| | | | | | | | | | | | | This function is added here to ease refactoring towards using the new shared shader_info. Once refactoring is complete and values are set directly it will be removed. We call it from _mesa_copy_linked_program_data() rather than glsl_to_nir() so that the values will be set for all drivers. In order to do this some calls need to be moved around so that we make sure to call do_set_program_inouts() before _mesa_copy_linked_program_data() Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: add a shader info field to the gl_program typeTimothy Arceri2016-10-261-1/+2
| | | | | | | | | | And use this field as the source for shader info in the nir_shader this will allow us to set some of these fields from GLSL directly. It will also simplify restoring from shader cache and allow the removal of duplicate fields from GLSL. Reviewed-by: Jason Ekstrand <[email protected]>
* nir/i965/anv/radv/gallium: make shader info a pointerTimothy Arceri2016-10-2614-96/+102
| | | | | | | | | | When restoring something from shader cache we won't have and don't want to create a nir_shader this change detaches the two. There are other advantages such as being able to reuse the shader info populated by GLSL IR. Reviewed-by: Jason Ekstrand <[email protected]>
* nir: move nir_shader_info to a common compiler headerTimothy Arceri2016-10-262-96/+133
| | | | | | | This will allow use to stop copying values between structs and will also simplify handling handling these values in the shader cache. Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: add matrix layout information to interface block typesIago Toral Quiroga2016-10-248-12/+42
| | | | | | | | | | | | | | | | | | | | | | So far we have been checking that interface block definitions had matching matrix layouts by comparing the definitions of their fields, however, this does not cover the case where the interface blocks are defined with mismatching matrix layouts but don't define any field with a matrix type. In this case Mesa will not fail to link because none of the fields will inherit the mismatching layout qualifier. This patch fixes the problem in the same way we fixed it for packing layout information: we add the the layout information to the interface type and then we check it matches during the uniform block linking process. v2: Fix unit tests so they pass the new parameter to glsl_type::get_interface_instance() Fixes: dEQP-GLES31.functional.shaders.linkage.uniform.block.layout_qualifier_mismatch_3 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98245 Reviewed-by: Nicolai Hähnle <[email protected]> (v1)
* glsl/mesa: remove unused namespace support from the symbol tableTimothy Arceri2016-10-242-11/+11
| | | | | | | | | | | | | | | | | | Namespace support seems to have been unused for a very long time. Previously the hash table entry was never removed and the symbol name wasn't freed until the symbol table was destroyed. In theory this could reduced the number of times we need to copy a string as duplicate names are reused. However in practice there is likely only a limited number of symbols that are the same and this is likely to cause other less than optimal behaviour such as the hash_table continuously growing. Along with dropping namespace support this change removes entries from the hash table as they become unused. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* glsl/es31: precision qualifier doesn't need to match in shader interface ↵Samuel Iglesias Gonsálvez2016-10-242-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | block members It is specific only to GLSL ES 3.1. From the spec, section 4.3.9 "Interface Blocks": "Matched block names within a shader interface (as defined above) must match in terms of having the same number of declarations with the same sequence of types and the same sequence of member names, as well as having the same qualification as specified in section 9.2 (“Matching of Qualifiers“)." But in GLSL ES 3.0 and 3.2, it is the opposite: "Matched block names within a shader interface (as defined above) must match in terms of having the same number of declarations with the same sequence of types, precisions and the same sequence of member names, as well as having the matching member-wise layout qualification as defined in section 9.2 (“Matching of Qualifiers”)." Fixes: dEQP-GLES31.functional.shaders.linkage.uniform.block.differing_precision Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98243 Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: move intrastage_match() after interstage_member_mismatch()Samuel Iglesias Gonsálvez2016-10-241-46/+46
| | | | | Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Indirect array indexing on non-last SSBO member must fail compilationIago Toral Quiroga2016-10-202-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the changes in comit 5b2675093e863a52, we moved this check to the linker, but the spec expects this to be checked at compile-time. There are dEQP tests that expect an error at compile time and the spec seems to confirm that expectation: "Except for the last declared member of a shader storage block (section 4.3.9 “Interface Blocks”), the size of an array must be declared (explicitly sized) before it is indexed with anything other than an integral constant expression. The size of any array must be declared before passing it as an argument to a function. Violation of any of these rules result in compile-time errors. It is legal to declare an array without a size (unsized) and then later redeclare the same name as an array of the same type and specify a size, or index it only with integral constant expressions (implicitly sized)." Commit 5b2675093e863a52 tries to take care of the case where we have implicitly sized arrays in SSBOs and it does so by checking the max_array_access field in ir_variable during linking. In this patch we change the approach: we look for indirect access on SSBO arrays, and when we find one, we emit a compile-time error if the accessed member is not the last in the SSBO definition. There is a corner case that the specs do not address directly though and that dEQP checks for: the case of an unsized array in an SSBO definition that is not defined last but is never used in the shader code either. The following dEQP tests expect a compile-time error in this scenario: dEQP-GLES31.functional.debug.negative_coverage.callbacks.shader.compile_compute_shader dEQP-GLES31.functional.debug.negative_coverage.get_error.shader.compile_compute_shader dEQP-GLES31.functional.debug.negative_coverage.log.shader.compile_compute_shader However, since the unsized array is never used it is never indexed with a non-constant expression, so by the spec quotation above, it should be valid and the tests are probably incorrect. Reviewed-by: Nicolai Hähnle <[email protected]>
* nir: Optimize integer division and modulus with 1Ian Romanick2016-10-191-0/+4
| | | | | | | | | | | | | | The previous power-of-two rules didn't catch idiv (because i965 doesn't set lower_idiv) and imod cases. The udiv and umod cases should have been caught, but I included them for orthogonality. This fixes silly code observed from compute shaders with local_size_[xy] = 1. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98299 Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: Remove unused function import_prototypesIan Romanick2016-10-173-132/+0
| | | | | | | | | | Once upon a time, this was used to extract prototypes from the shader containing GLSL built-in functions. This was removed by f5692f45 in November 2010 for Mesa 7.10. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl: Remove prototypes for nonexistent functionsIan Romanick2016-10-171-9/+0
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl: Replace assert with unreachableIan Romanick2016-10-171-1/+2
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* glsl: print non-zero bindings of variablesNicolai Hähnle2016-10-171-2/+6
| | | | Reviewed-by: Marek Olšák <[email protected]>
* glsl: fail compilation of compute shaders when unsupportedIago Toral Quiroga2016-10-171-0/+13
| | | | | | | | | | | | | | | | | | | | | | | Generally, we only check for the presence of compute shaders during parsing when we find any language (like layout qualifiers) that are specific to compute shaders, however, it is possible to define an empty compute shader does not use any language specific to compute shaders at all and we should fail the compilation anyway. dEQP checks this. This patch adds a check for compute shader availability after we have parsed the source code. At this point we know the effective GLSL version and also extensions enabled in the shader. Fixes a subcase of the following dEQP tests: dEQP-GLES31.functional.debug.negative_coverage.callbacks.shader.compile_compute_shader dEQP-GLES31.functional.debug.negative_coverage.get_error.shader.compile_compute_shader dEQP-GLES31.functional.debug.negative_coverage.log.shader.compile_compute_shader The tests still fail because there is one more subcase that fails that needs another fix. Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Disable textureOffset(sampler2DArrayShadow, ...) in GLSL ES.Kenneth Graunke2016-10-161-1/+7
| | | | | | | | | | | | This has apparently never existed in GLSL ES. Fixes dEQP-GLES3.functional.shaders.texture_functions.invalid .textureoffset_sampler2darrayshadow_vec4_ivec2_vertex and .textureoffset_sampler2darrayshadow_vec4_ivec2_fragment Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98244 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: Drop the ES requirement that VS outputs must be flat qualified.Kenneth Graunke2016-10-151-8/+4
| | | | | | | | | | | | | | | | | | | Several conformance tests violate this requirement: ES31-CTS.core.tessellation_shader.max_patch_vertices ES31-CTS.core.tessellation_shader.tessellation_control_to_tessellation_evaluation.data_pass_through I submitted a merge request to fix the conformance tests, but Khronos opted to drop this GLSL ES specific requirement in favor of making flat qualification of VS outputs optional, matching modern desktop GL. Note that there were 7 Piglit tests which enforce this rule: tests/spec/glsl-es-3.00/compiler/interpolation/qualifiers/*nonflat* but these were deleted in Piglit commit acc0a2fabbd714bc704c16f1675e7c0. Bugzilla: https://cvs.khronos.org/bugzilla/show_bug.cgi?id=15465#c7 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: dump explicit location when printing IRNicolai Hähnle2016-10-121-3/+7
| | | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
* glsl: Add missing cache_destroy stub function.Vinson Lee2016-10-101-0/+5
| | | | | | | | | | | | CC glsl/tests/cache_test.o glsl/tests/cache_test.c: In function ‘test_cache_create’: glsl/tests/cache_test.c:160:4: error: implicit declaration of function ‘cache_destroy’ [-Werror=implicit-function-declaration] cache_destroy(cache); ^ Fixes: 87ab26b2ab35 ("glsl: Add initial functions to implement an on-disk cache") Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: prohibit lowp, mediump precision on atomic_uintTapani Pälli2016-10-101-0/+14
| | | | | | | | | | | | Fixes following dEQP tests: dEQP-GLES31.functional.debug.negative_coverage.callbacks.atomic_counter.atomic_precision dEQP-GLES31.functional.debug.negative_coverage.get_error.atomic_counter.atomic_precision dEQP-GLES31.functional.debug.negative_coverage.log.atomic_counter.atomic_precision Signed-off-by: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98131 Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: optimize copy_propagation_elements passTapani Pälli2016-10-101-50/+148
| | | | | | | | | | | | | | | | Changes make copy_propagation_elements pass faster, reducing link time spent in test case of bug 94477. Does not fix the actual issue but brings down the total time. No regressions seen in CI. v2 (idr): Formatting / whitespace fixes. Embed the acp_ref in the acp_entry. v3 (idr): Delete unused copy constructor. Use while(pop_head) instead of foreach() { remove }. Signed-off-by: Tapani Pälli <[email protected]> Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Let cache_test build when the shader cache is not enabledIan Romanick2016-10-071-0/+4
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Tested-by: Aaron Watry <[email protected]>
* nir: Fix the control flow tests for nir_loop_first_block changesJason Ekstrand2016-10-061-1/+1
| | | | | | | | | Commit 2ed17d46de045404042f13c6591895a1cf31b167 changed nir_loop_first_cf_node and friends to return a nir_block instead of a nir_cf_node. This broke one of the NIR control flow tests. Signed-off-by: Jason Ekstrand <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98128
* glsl: add gl_LocalGroupSizeARB as a system valueSamuel Pitoiset2016-10-072-0/+7
| | | | | | | | v2: - only add it if the ext is enabled (Ilia) Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl/linker: handle errors when a variable local size is usedSamuel Pitoiset2016-10-071-2/+23
| | | | | | | | | | | | | Compute shaders can now include a fixed local size as defined by ARB_compute_shader or a variable size as defined by ARB_compute_variable_group_size. v2: - update formatting spec quotations (Ian) - various cosmetic changes (Ian) Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* glsl: reject compute shaders with fixed and variable local sizeSamuel Pitoiset2016-10-071-0/+14
| | | | | | | | | | | The ARB_compute_variable_group_size specification explains that when a compute shader includes both a fixed and a variable local size, a compile-time error occurs. v2: - update formatting spec quotations (Ian) Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>