aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ir_set_program_inouts.cpp
Commit message (Collapse)AuthorAgeFilesLines
* compiler: Move double_inputs to gl_program::DualSlotInputsJason Ekstrand2018-09-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Previously, we had two field in shader_info: double_inputs_read and double_inputs. Presumably, the one was for all double inputs that are read and the other is all that exist. However, because nir_gather_info regenerates these two values, there is a possibility, if a variable gets deleted, that the value of double_inputs could change over time. This is a problem because double_inputs is used to remap the input locations to a two-slot-per-dvec3/4 scheme for i965. If that mapping were to change between glsl_to_nir and back-end state setup, we would fall over when trying to map the NIR outputs back onto the GL location space. This commit changes the way slot re-mapping works. Instead of the double_inputs field in shader_info, it adds a DualSlotInputs bitfield to gl_program. By having it in gl_program, we more easily guarantee that NIR passes won't touch it after it's been set. It also makes more sense to put it in a GL data structure since it's really a mapping from GL slots to back-end and/or NIR slots and not really a NIR shader thing. Tested-by: Alejandro Piñeiro <[email protected]> (ARB_gl_spirv tests) Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: include mtypes.h lessMarek Olšák2018-04-121-1/+1
| | | | | | | | | | - remove mtypes.h from most header files - add main/menums.h for often used definitions - remove main/core.h v2: fix radv build Reviewed-by: Brian Paul <[email protected]>
* compiler: tidy up double_inputs_read usesTimothy Arceri2018-01-301-1/+1
| | | | | | | | | | | | | First we move double_inputs_read into a vs struct in the union, double_inputs_read is only used for vs inputs so this will save space and also allows us to add a new double_inputs field. We add the new field because c2acf97fcc9b changed the behaviour of double_inputs_read, and while it's no longer used to track actual reads in i965 we do still want to track this for gallium drivers. Reviewed-by: Marek Olšák <[email protected]>
* Revert recent GLSL slot counting fiasco.Kenneth Graunke2017-01-071-30/+9
| | | | | | | | | | | | | | | | | | | | | | | | I apparently broke mark_whole_variable in ir_set_program_inouts. It was passing a type that wasn't var->type, so the wrapper didn't work out. It's all broken, revert it and start over. Fixes all kinds of things on other drivers. Revert "glsl: Make is_fixed_function_array actually check for varyings." This reverts commit 42699e12711668a142b7acf11c168cf4301c1295. Revert "glsl: Mark whole variable used for ClipDistance and TessLevel*." This reverts commit 5c580e64cc206ab160e1767c42e4d6c81f67da4d. Revert "glsl: Override the # of varying slots for ClipDistance and TessLevel*." This reverts commit 8b5749f65ac434961308ccb579fb8a816e4f29d5. Revert "glsl: Create and use a new ir_variable::count_attribute_slots() wrapper." This reverts commit 6aa5cb34d03765b7be8611aa516bc201bd337f73.
* glsl: Make is_fixed_function_array actually check for varyings.Kenneth Graunke2017-01-071-0/+4
| | | | | | | | | | | We can't check VARYING_SLOT_* locations until we've determined that the variable is actually a varying. Fixes assert failures in drivers which actually use this path, such as radeonsi and i915. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99314 Signed-off-by: Kenneth Graunke <[email protected]>
* glsl: Mark whole variable used for ClipDistance and TessLevel*.Kenneth Graunke2017-01-061-3/+23
| | | | | | | | | | | | | | | | | | | | There's no point in trying to mark partial array access for gl_ClipDistance, gl_TessLevelOuter, or gl_TessLevelInner - they're special built-in variables that control fixed function hardware, and will likely be used in an all-or-nothing fashion. Since these arrays only occupy 1-2 varying slots, we have to avoid our normal processing which increments the slot value by the array index. (I wrote this code before i965 switched from ir_set_program_inouts to nir_shader_gather_info. It's not used by anyone today, and I'm not sure how valuable it is...the alternative to GLSL IR lowering is NIR compact arrays, at which point you should use nir_gather_info.) Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Create and use a new ir_variable::count_attribute_slots() wrapper.Kenneth Graunke2017-01-061-6/+3
| | | | | | | | | This wraps glsl_type::count_attribute_slots(), but will soon contain a couple of overrides for a couple of GLSL built-ins variables. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: set uses texture gather directly in shader_infoTimothy Arceri2016-10-261-1/+1
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* glsl/st/mesa: use common system values read fieldTimothy Arceri2016-10-261-2/+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-261-2/+2
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: set patch inputs read directly in shader_infoTimothy Arceri2016-10-261-2/+2
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: set outputs read directly in shader_infoTimothy Arceri2016-10-261-2/+2
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* r200/glsl/st/mesa: use common outputs written fieldTimothy Arceri2016-10-261-6/+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-261-1/+1
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* r200/i915/st/mesa/compiler: use common inputs read fieldTimothy Arceri2016-10-261-6/+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]>
* i965/mesa/st/swrast: set fs shader_info directly and switch to using itTimothy Arceri2016-10-261-10/+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]>
* glsl: remove now unused InterpQualifierTimothy Arceri2016-10-261-5/+2
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: remove the UsesDFdy flagTimothy Arceri2016-10-061-17/+2
| | | | | | Seems the last user of this was removed in 08bc74e69. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: add gl_BoundingBox and associated varying slotsIlia Mirkin2016-08-301-1/+3
| | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Fix gl_program::OutputsWritten computation for dual-source blending.Francisco Jerez2016-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | In the fragment shader OutputsWritten is a bitset of FRAG_RESULT_* enumerants, which represent the location of each color output written by the shader. The secondary and primary color outputs of a given render target using dual-source blending have the same location, so the 'idx' computation below will give the wrong bit as result if the 'var->data.index' term is non-zero -- E.g. if the shader writes the primary and secondary colors of the FRAG_RESULT_COLOR output, ir_set_program_inouts will think that the shader writes both FRAG_RESULT_COLOR and FRAG_RESULT_SAMPLE_MASK, which is just bogus. That would cause the brw_wm_prog_key::nr_color_regions computation done in the i965 driver during fragment shader precompilation to be wrong, which currently leads to unnecessary recompilation of shaders that use dual-source blending, and triggers an assertion failure in fs_visitor::emit_fb_writes() on my i965-fb-fetch branch. Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: Calculate bitset of secondary outputs written in ir_set_program_inouts.Francisco Jerez2016-08-301-2/+7
| | | | Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: Keep track of the set of fragment outputs read by a GL program.Francisco Jerez2016-08-241-0/+3
| | | | | | | | This is the set of shader outputs whose initial value is provided to the shader by some external means when the shader is executed, rather than computed by the shader itself. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Don't consider read-only fragment outputs to be written to.Francisco Jerez2016-08-241-1/+1
| | | | | | | | Since they cannot be written. This prevents adding fragment outputs to the OutputsWritten set that are only read from via the gl_LastFragData array but never written to. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Delete bogus ir_set_program_inouts assert.Kenneth Graunke2016-08-071-3/+7
| | | | | | | | | | | | | | | | This assertion is bogus. Varying structs, and arrays of structs, are allowed by GLSL, and we can see them here. While we currently don't have any partial-variable support for those, simply returning false and marking the entire thing as used is certainly legitimate. I believe this is often swept under the rug by varying packing, but that's disabled in certain tessellation situations. Hit by 20 dEQP-GLES31.functional.tessellation.user_defined_io.* tests. Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* compiler: Rename INTERP_QUALIFIER_* to INTERP_MODE_*.Kenneth Graunke2016-07-171-1/+1
| | | | | | | | | | | | | | | | | Likewise, rename the enum type to glsl_interp_mode. Beyond the GLSL front-end, talking about "interpolation modes" seems more natural than "interpolation qualifiers" - in the IR, we're removed from how exactly the source language specifies how to interpolate an input. Also, SPIR-V calls these "decorations" rather than "qualifiers". Generated by: $ find . -regextype egrep -regex '.*\.(c|cpp|h)' -type f -exec sed -i \ -e 's/INTERP_QUALIFIER_/INTERP_MODE_/g' \ -e 's/glsl_interp_qualifier/glsl_interp_mode/g' {} \; Signed-off-by: Kenneth Graunke <[email protected]> Acked-by: Dave Airlie <[email protected]>
* glsl/types: rename is_dual_slot_double to is_dual_slot_64bit.Dave Airlie2016-06-091-2/+2
| | | | | | | In the future int64 support will have the same requirements. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: Assert that inputs have a location assignedIan Romanick2016-05-181-0/+2
| | | | | | | This catches a problem previously undetected until deep in the backend. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Rename "vertex_input_slots" -> "is_vertex_input"Matt Turner2016-04-131-3/+3
| | | | | | | | | | | vertex_input_slots would be an appropriate name for an integer, but not a bool. Also remove a cond ? true : false from a count_attribute_slots() call site, noticed during the rename. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl: move to compiler/Emil Velikov2016-01-261-0/+453
Signed-off-by: Emil Velikov <[email protected]> Acked-by: Matt Turner <[email protected]> Acked-by: Jose Fonseca <[email protected]>