summaryrefslogtreecommitdiffstats
path: root/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'public/master' into vulkanJason Ekstrand2016-04-079-248/+280
|\
| * nir/types: Add a wrapper for count_attribute_slotsJason Ekstrand2016-04-072-0/+10
| | | | | | | | Reviewed-by: Rob Clark <[email protected]>
| * glsl: use has_shader_storage_buffer_objects helperIlia Mirkin2016-04-051-2/+1
| | | | | | | | | | | | | | | | Replaces open-coded logic with existing helper. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
| * glsl: remove remaining tabs in link_uniform_blocks.cppTimothy Arceri2016-04-061-5/+5
| | | | | | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
| * mesa: remove unused IsShaderStorage fieldTimothy Arceri2016-04-061-1/+0
| | | | | | | | Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
| * glsl: fully split apart buffer block arraysTimothy Arceri2016-04-066-238/+251
| | | | | | | | | | | | | | | | | | | | | | | | With this change we create the UBO and SSBO arrays separately from the beginning rather than putting them into a combined array and splitting it apart later. A bug is with UBO and SSBO stage reference querying is also fixed as we now use the block index to lookup the references in the separate arrays not the combined buffer block array. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
| * nir: Use PRIi64 and PRIu64 instead of %ld and %lu.Kenneth Graunke2016-04-041-2/+3
| | | | | | | | | | | | | | | | | | %ld and %lu aren't the right format specifiers for int64_t and uint64_t on 32-bit (x86) systems. They're %zu on Linux and %Iu on Windows. Use the standard C99 macros in hopes that they work everywhere. Signed-off-by: Kenneth Graunke <[email protected]>
| * glsl: Lower variable indexing of system value arrays unconditionally.Kenneth Graunke2016-04-041-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lower_variable_index_to_cond_assign() did not handle system values. gl_SampleMaskIn[] is a system value, and also an array. Accessing it with a variable index would trigger an unreachable() assert. Rather than adding a new EmitNoIndirectSystemValues flag, we simply lower unconditionally. There is exactly one case where this occurs, and for all current drivers, lowering produces optimal code. Even for future drivers with 32x MSAA, it produces reasonable code. Fixes Piglit's new samplemaskin-indirect test. Also fixes many ES31-CTS tests when OES_sample_variables is enabled. Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* | Merge remote-tracking branch 'public/master' into vulkanJason Ekstrand2016-04-0415-1634/+1572
|\|
| * nir/search: Don't match inexact expressions with exact subexpressionsJason Ekstrand2016-04-041-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the first pass of implementing exact handling, I made a mistake with search-and-replace. In particular, we only reallly handled exact/inexact on the root of the tree. Instead, we need to check every node in the tree for an exact/inexact match. As an example of this, consider the following GLSL code precise float a = b + c; if (a < 0) { do_stuff(); } In that case, only the add will be declared "exact" and an expression that looks for "b + c < 0" will still match and replace it with "b < -c" which may yield different results. The solution is to simply bail if any of the values are exact when matching an inexact expression. Reviewed-by: Ian Romanick <[email protected]>
| * glsl: Print "precise" on ir_variable nodes.Kenneth Graunke2016-04-031-2/+3
| | | | | | | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
| * glsl: make *sampler2DMSArray available in ESSL 3.20Ilia Mirkin2016-04-031-5/+7
| | | | | | | | | | | | | | | | Also avoid double-adding the *sampler2DMS types when the array ext is enabled. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
| * glsl: make ssbo predicate return true when in a GLSL 430 or ESSL 310 shaderIlia Mirkin2016-04-031-1/+2
| | | | | | | | | | | | | | | | | | I can't tell whether this actually matters, but we're creating function signatures with this predicate, so it should probably match when SSBO's are available. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
| * glsl: allow conservative depth qualifiers in GLSL 420Ilia Mirkin2016-04-031-1/+3
| | | | | | | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
| * glsl: add ARB_ES3_1_compatibility supportIlia Mirkin2016-04-035-8/+18
| | | | | | | | | | | | | | | | Oddly a bunch of the features it adds are actually from ESSL 3.20. But the spec is quite clear, oh well. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
| * glsl: rename var and simplify ifTimothy Arceri2016-04-021-4/+4
| | | | | | | | | | | | is_ubo_var is true for both UBOs and SSBOs Reviewed-by: Kenneth Graunke <[email protected]>
| * glsl: store ubo or ssbo index in block indexTimothy Arceri2016-04-022-22/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we store the buffer block index i.e the index of a combined ubo/ssbo list. Fixes several dEQP-GLES31.functional tests: - program_interface_query.uniform.block_index.block_array - program_interface_query.uniform.block_index.named_block - program_interface_query.uniform.block_index.unnamed_block - program_interface_query.uniform.random.10 - program_interface_query.uniform.random.15 - program_interface_query.uniform.random.22 - program_interface_query.uniform.random.24 - program_interface_query.uniform.random.26 - program_interface_query.uniform.random.28 - program_interface_query.uniform.random.3 - program_interface_query.uniform.random.31 - program_interface_query.uniform.random.38 - program_interface_query.uniform.random.5 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94116 Reviewed-by: Kenneth Graunke <[email protected]>
| * glsl: store stage reference in gl_uniform_blockTimothy Arceri2016-04-022-22/+22
| | | | | | | | | | | | | | | | | | This allows us to simplify the code and drop InterfaceBlockStageIndex which is a per stage array of integers the size of all blocks in the program combined including duplicates across stages. Adding a stage ref per block will use less memory. Reviewed-by: Kenneth Graunke <[email protected]>
| * glsl: simplify buffer block resource limit checkingTimothy Arceri2016-04-021-55/+32
| | | | | | | | | | | | | | | | | | | | This changes the code to use the buffer counts stored for each stage rather than counting from scratch. It also moves the checks outside of the for loop which means we now just get a single link error message if we go over the max rather than X error messages where X is the number we have exceeded the max by. Reviewed-by: Kenneth Graunke <[email protected]>
| * glsl: simplify SSBO resources checkTimothy Arceri2016-04-021-7/+1
| | | | | | | | | | | | We already have a count of active SSBOs per stage so use it. Reviewed-by: Kenneth Graunke <[email protected]>
| * glsl: split buffer block arrays earlierTimothy Arceri2016-04-021-27/+27
| | | | | | | | | | | | | | This will allow us to use them when checking resources in a following patch and clean up a bunch of code. Reviewed-by: Kenneth Graunke <[email protected]>
| * glsl: only set buffer block binding once during initialisationTimothy Arceri2016-04-021-26/+6
| | | | | | | | | | | | | | | | Since 8683d54d2be825 there is now a single instance of the buffer block information that needs to be updated rather than one instance for each stage. Reviewed-by: Kenneth Graunke <[email protected]>
| * glsl: Fix prorgram interface query locations biasing for SSO.Kenneth Graunke2016-04-011-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With SSO, the GL_PROGRAM_INPUT and GL_PROGRAM_OUTPUT interfaces refer to the first and last shader stage linked into a program. This may not be the vertex and fragment shader stages. So, subtracting VERT_ATTRIB_GENERIC0 and FRAG_RESULT_DATA0 is bogus. We need to subtract VERT_ATTRIB_GENERIC0 for VS inputs, FRAG_RESULT_DATA0 for FS outputs, and VARYING_SLOT_VAR0 for other cases. Note that built-in variables get a location of -1. Fixes 4 dEQP-GLES31.functional.program_interface_query tests: - program_input.location.separable_fragment.var_explicit_location - program_input.location.separable_fragment.var_array_explicit_location - program_output.location.separable_vertex.var_array_explicit_location - program_output.location.separable_vertex.var_array_explicit_location Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
| * glsl: Return -1 for program interface query locations in many cases.Kenneth Graunke2016-04-011-5/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were recording locations for all variables, even ones without an explicit location set. Implement the rules from the spec, and record -1 in the resource list accordngly. Make program_resource_location stop doing math on negative values. Remove hacks that are no longer necessary now that we've stopped doing that. Fixes 4 dEQP-GLES31.functional.program_interface_query tests: - program_input.location.separable_fragment.var - program_input.location.separable_fragment.var_array - program_output.location.separable_vertex.var_array - program_output.location.separable_vertex.var_array v2: Delete more code Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
| * glsl: Consolidate gl_VertexIDMESA -> gl_VertexID query hacks.Kenneth Graunke2016-04-011-2/+10
| | | | | | | | | | | | | | | | | | A program will either have gl_VertexID or gl_VertexIDMESA (the lowered zero-based version), not both. Just spoof it in the resource list so the hacks are done in a single place. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
| * glsl: Clean up some leftover cruft.Kenneth Graunke2016-04-011-4/+1
| | | | | | | | | | | | | | stages is always 1 << stage now. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
| * glsl: Add all system variables to the input resource list.Kenneth Graunke2016-04-011-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | System values are just built-in input variables that we've opted to special-case out of convenience. We need to consider all inputs, regardless of how we've classified them. Unfortunately, there's one exception: we shouldn't add gl_BaseVertex unless ARB_shader_draw_parameters is enabled, because it doesn't actually exist in the language, and shouldn't be counted in the GL_ACTIVE_RESOURCES query. Fixes dEQP-GLES31.functional.program_interface_query.program_input. resource_list.compute.empty, which expects gl_NumWorkGroups to appear in the resource list. v2: Delete more code Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
| * glsl: Delete hack for VS system values.Kenneth Graunke2016-04-011-4/+0
| | | | | | | | | | | | | | | | | | | | | | This makes no sense. If the stage being considered is the vertex shader, then we'll add inputs and system values appropriately. If we're not considering the vertex shader, then we absolutely should not do anything with it. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
| * glsl: Make add_interface_variables only consider the appropriate stage.Kenneth Graunke2016-04-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add_interface_variables() is supposed to add variables for the inputs of the first shader stage linked into a program, and the outputs of the last shader stage linked into a program. From the ARB_program_interface_query specification: "* PROGRAM_INPUT corresponds to the set of active input variables used by the first shader stage of <program>. If <program> includes multiple shader stages, input variables from any shader stage other than the first will not be enumerated. * PROGRAM_OUTPUT corresponds to the set of active output variables (section 2.14.11) used by the last shader stage of <program>. If <program> includes multiple shader stages, output variables from any shader stage other than the last will not be enumerated." Previously, we used build_stageref here, which walks over all linked shaders in the program. This meant that internal varyings would be visible. We don't actually need any of build_stageref's code: we already explicitly skip packed varyings, handle modes, and the name comparisons just do a fuzzy string comparison of name with itself. Fixes two tests: dEQP-GLES31.functional.program_interface_query. program_{input,output}.referenced_by.referenced_by_vertex_fragment. These tests have a VS and FS linked together into a single program. Both stages have an input called "shaderInput". But the FS input should not be visible because it isn't the first stage. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
| * glsl: Clarify "mask" variable in add_interface_variables().Kenneth Graunke2016-04-011-5/+5
| | | | | | | | | | | | | | | | | | | | This is a bitfield of which stages refer to a variable. It is not used to mask off bits. In fact, it's used to contribute additional bits. Rename it and tidy a bit of the logic. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
| * glsl: Pass stage to add_interface_variables().Kenneth Graunke2016-04-011-5/+5
| | | | | | | | | | | | | | | | | | | | add_interface_variables is supposed to add variables from either the first or last stage of a linked shader. But it has no way of knowing the stage it's being asked to process, which makes it impossible to produce correct stagerefs. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
| * glsl: Make vertex ID lowering declare gl_BaseVertex as hidden.Kenneth Graunke2016-04-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the GL_ARB_shader_draw_parameters extension is enabled, we'll already have a gl_BaseVertex variable. It will have var->how_declared set to ir_var_declared_implicitly, and will appear in the program resource list. If not, we make one for internal use. We don't want it to be listed in the program resource list, as the application won't be expecting it. Marking it hidden will properly exclude it. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
| * glsl: Exclude ir_var_hidden variables from the program resource list.Kenneth Graunke2016-04-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | We occasionally generate variables internally that we want to exclude from the program resource list, as applications won't be expecting them to be present. The next patch will make use of this. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
| * glsl: Don't require matching centroid qualifiersJordan Justen2016-04-011-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note: This patch appears to violate older OpenGL and OpenGLES specs. The OpenGLES GLSL 3.1 and OpenGL GLSL 4.3 specifications both remove the requirement for the output and input centroid qualifiers to match. The deqp dEQP-GLES3.functional.shaders.linkage.varying.rules.differing_interpolation_2 test wants the newer OpenGLES 3.1 specification behavior, even for OpenGLES 3.0. This patch simply removes the checking in all cases. The OpenGLES 3.0 conformance test suite doesn't appear to require the older ("must match") spec behavior. For reference, here are the relavent spec citations: The OpenGL 4.2 spec says: "the last active shader stage output variables and fragment shader input variables of the same name must match in type and qualification (other than out matching to in)" The OpenGL 4.3 spec says: "interpolation qualification (e.g., flat) and auxiliary qualification (e.g. centroid) may differ." The OpenGLES GLSL 3.00.4 specification says: "The output of the vertex shader and the input of the fragment shader form an interface. For this interface, vertex shader output variables and fragment shader input variables of the same name must match in type and qualification (other than precision and out matching to in)." The OpenGLES GLSL 3.10 Specification says: "interpolation qualification (e.g., flat) and auxiliary qualification (e.g. centroid) may differ" Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92743 Bugzilla: https://cvs.khronos.org/bugzilla/show_bug.cgi?id=7819 Signed-off-by: Jordan Justen <[email protected]> Cc: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
| * glsl: remove tabs and fix some other style issues in glcpp-parse.yTimothy Arceri2016-04-021-1424/+1352
| | | | | | | | | | | | Note there are still tabs left in the parser rules. Acked-by: Dave Airlie <[email protected]>
* | nir: Stop double-printing function argumentsJason Ekstrand2016-04-041-10/+0
| |
* | glsl: Stop force-enabling compute shadersJason Ekstrand2016-04-041-2/+0
| | | | | | | | This isn't needed since we no longer use the GLSL compiler in Vulkan.
* | glsl/standalone: Get rid of the unneeded _mesa_error_no_memory stubJason Ekstrand2016-04-041-6/+0
| | | | | | | | | | | | This hasn't been needed since we stopped using the GLSL compiler in the Vulkan driver and it was tripping up scons. Removing it fixes the scons build.
* | Remove more spirv2nir remnantsJason Ekstrand2016-04-043-28/+2
| |
* | nir/gather_info: Add an assert for supported stagesJason Ekstrand2016-04-011-0/+6
| |
* | nir: Move variable_get_io_mask back into gather_infoJason Ekstrand2016-04-012-31/+31
| | | | | | | | | | | | It used to be in nir_gather_info.c until I moved it out to nir.h so it could be re-used with some linking code that never got merged. We'll move it back out if and when we have real code to share it with.
* | Merge remote-tracking branch 'public/master' into vulkanJason Ekstrand2016-04-0133-316/+1220
|\|
| * nir: Add an opcode for stomping a 32-bit value to 16-bit precisionJason Ekstrand2016-04-011-0/+1
| | | | | | | | | | | | This correlates directly to the SPIR-V opcode OpQuantizeToF16 Reviewed-by: Rob Clark <[email protected]>
| * compiler: random comment fixupRob Clark2016-04-011-1/+1
| | | | | | | | | | | | | | | | Just noticed this in passing.. gl_shader_stage already has tess so this comment no longer applies. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
| * glsl: do not raise unitialized variable warnings on builtins/reserved GL ↵Alejandro Piñeiro2016-04-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | variables Needed because not all the built-in variables are marked as system values, so they still have the mode ir_var_auto. Right now it fixes raising the warning when gl_GlobalInvocationID and gl_LocalInvocationIndex are used. v2: use is_gl_identifier instead of filtering for some names (Ilia Mirkin) Reviewed-by: Kenneth Graunke <[email protected]>
| * nir: Simplify a bcsel to logical-orIan Romanick2016-03-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Oddly, this did not affect the shader where I first noticed the pattern. That particular shader doesn't get its if-statement converted to a bcsel because there are two assignments in the else-statement. This led to me submitting https://bugs.freedesktop.org/show_bug.cgi?id=94747. shader-db results: Sandy Bridge total instructions in shared programs: 8467384 -> 8467069 (-0.00%) instructions in affected programs: 36594 -> 36279 (-0.86%) helped: 46 HURT: 0 total cycles in shared programs: 117573448 -> 117568518 (-0.00%) cycles in affected programs: 339114 -> 334184 (-1.45%) helped: 46 HURT: 0 Ivy Bridge / Haswell / Broadwell / Skylake: total instructions in shared programs: 7774258 -> 7773999 (-0.00%) instructions in affected programs: 30874 -> 30615 (-0.84%) helped: 46 HURT: 0 total cycles in shared programs: 65739190 -> 65734530 (-0.01%) cycles in affected programs: 180380 -> 175720 (-2.58%) helped: 45 HURT: 1 No change on G45 or Ironlake. I also tried these expressions, but none of them affected any shaders in shader-db: (('bcsel', a, 'a@bool', 'b@bool'), ('ior', a, b)), (('bcsel', a, 'b@bool', False), ('iand', a, b)), (('bcsel', a, 'b@bool', 'a@bool'), ('iand', a, b)), Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
| * mesa: add GL_OES_shader_multisample_interpolation supportIlia Mirkin2016-03-305-7/+14
| | | | | | | | | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
| * glsl: add GL_OES_sample_variables supportIlia Mirkin2016-03-304-4/+16
| | | | | | | | | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
| * glsl: add gl_MaxSamples, new in GL 4.5 / GL ES 3.2Ilia Mirkin2016-03-303-0/+9
| | | | | | | | | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
| * nir: Fix typo from commit 6702f1acde9.Matt Turner2016-03-301-1/+1
| |