aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/opt_dead_builtin_varyings.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl: don't lower fragdata array if the output data types don't matchSamuel Iglesias Gonsalvez2015-05-051-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 7e414b58640aee6e243d337e72cea290c354f632 broke the gl_FragData array into separate gl_FragData[i] variables, so drivers can eliminate useless writes to gl_FragData improving their performance. The problem occurs when GLSL IR code is linked in the following case: * The FS output variable base data type does not match gl_FragData one (float vector) * The FS output variable is replaced by gl_out_FragDataX because of commit 7e414b58640aee6 with X from 0 to GL_MAX_DRAW_BUFFERS. Then the FS output variable base data type is lost in the resulting GLSL IR, making that the driver does a wrong assignment to gl_out_FragData components because of unmatching data types. This patch reverts the fragdata array lowering when the output var base data type doesn't match gl_out_FragData, i.e., when output variable base data type is not a float or a float vector. This patch fixes 250 dEQP tests (tested in an Intel Haswell machine) dEQP-GLES3.functional.fragment_out.random.* (22 failed tests) dEQP-GLES3.functional.fragment_out.array.uint.* (120 failed tests) dEQP-GLES3.functional.fragment_out.array.int.* (108 failed tests) Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* Fix a few typosZoë Blade2015-04-271-4/+4
| | | | Reviewed-by: Francisco Jerez <[email protected]>
* glsl: Remove 'struct' from ir_variable declaration.Matt Turner2014-06-171-1/+1
| | | | | Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Remove support for desktop OpenGL GL_EXT_separate_shader_objectsIan Romanick2014-05-021-6/+1
| | | | | | | | | | | | | | | | I don't know of any applications that actually use it. Now that Mesa supports GL_ARB_separate_shader_objects in all drivers, this extension is just cruft. The entrypoints for the extension remain in the XML. This is done so that a new libGL will continue to provide dispatch support for old drivers that try to expose this extension. Future patches will add OpenGL ES GL_EXT_separate_shader_objects, but that's a different thing. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Use gl_shader::Stage instead of gl_shader::Type where possible.Paul Berry2014-01-081-2/+2
| | | | | | | | | | | | | | | | | | | | | This reduces confusion since gl_shader::Type is sometimes GL_SHADER_PROGRAM_MESA but is more frequently GL_SHADER_{VERTEX,GEOMETRY,FRAGMENT}. It also has the advantage that when switching on gl_shader::Stage, the compiler will alert if one of the possible enum types is unhandled. Finally, many functions in src/glsl (especially those dealing with linking) already use gl_shader_stage to represent pipeline stages; using gl_shader::Stage in those functions avoids the need for a conversion. Note: in the process I changed _mesa_write_shader_to_file() so that if it encounters an unexpected shader stage, it will use a file suffix of "????" rather than "geom". Reviewed-by: Brian Paul <[email protected]> v2: Split from patch "mesa: Store gl_shader_stage enum in gl_shader objects." Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: move variables in to ir_variable::data, part IITapani Pälli2013-12-121-8/+8
| | | | | | | | | | | | | This patch moves following bitfields and variables to the data structure: explicit_location, explicit_index, explicit_binding, has_initializer, is_unmatched_generic_inout, location_frac, from_named_ifc_block_nonarray, from_named_ifc_block_array, depth_layout, location, index, binding, max_array_access, atomic Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: move variables in to ir_variable::data, part ITapani Pälli2013-12-121-3/+3
| | | | | | | | | | This patch moves following bitfields in to the data structure: used, assigned, how_declared, mode, interpolation, origin_upper_left, pixel_center_integer Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* glsl: fix crash introduced by the previous commitMarek Olšák2013-10-301-1/+1
|
* glsl: break the gl_FragData array into separate gl_FragData[i] variablesMarek Olšák2013-10-291-33/+134
| | | | | | | | | | | | | | | | This avoids a defect in lower_output_reads. The problem is lower_output_reads treats the gl_FragData array as a single variable. It first redirects all output writes to a temporary variable (array) and then writes the whole temporary variable to the output, generating assignments to all elements of gl_FragData. BTW this pass can be modified to lower all arrays, not just inputs and outputs. The question is whether it is worth it. Reviewed-by: Paul Berry <[email protected]> v2: addressed Paul Berry's comments
* glsl: Hide many classes local to individual .cpp files in anon namespaces.Eric Anholt2013-09-231-0/+2
| | | | | | | | This gives the compiler the chance to inline and not export class symbols even in the absence of LTO. Saves about 60kb on disk. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: remove struct keyword from ir_variable declarationsBrian Paul2013-09-091-4/+4
| | | | | | To silence MSVC warnings. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: don't eliminate texcoords that can be set by GL_COORD_REPLACEMarek Olšák2013-08-181-8/+19
| | | | | | | | | Tested by examining generated TGSI shaders from piglit/glsl-routing. Cc: [email protected] Reviewed-by: Henri Verbeet <[email protected]> Tested-by: Henri Verbeet <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Ensure snprintf is defined on MSVC builds.José Fonseca2013-07-031-0/+1
| | | | | | | Should fix: src\glsl\opt_dead_builtin_varyings.cpp(244) : error C3861: 'snprintf': identifier not found ...
* glsl/linker: eliminate unused and set-but-unused built-in varyingsMarek Olšák2013-07-021-0/+476
This eliminates built-in varyings such as gl_Color, gl_SecondaryColor, gl_TexCoord, and gl_FogFragCoord if they are unused by the next stage or not written at all (e.g. gl_TexCoord elements). The gl_TexCoord array is broken down into separate vec4s if needed. v2: - use a switch statement in varying_info_visitor::visit(ir_variable*) - use snprintf - disable the optimization for GLES2 Reviewed-by: Ian Romanick <[email protected]>