summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* glsl: interleave constant propagation and foldingTimothy Arceri2015-08-211-2/+43
| | | | | | | | | | | The constant folding pass can take a long time to complete so rather than running through the entire pass each time a new constant is propagated (and vice versa) interleave them. This change helps ES31-CTS.arrays_of_arrays.InteractionFunctionCalls1 go from around 2 min -> 23 sec. Reviewed-by: Ian Romanick <[email protected]>
* nv50/ir: pre-compute BFE arg when both bits and offset are immIlia Mirkin2015-08-201-3/+9
| | | | | | | | | | Due to a quirk in how the nv50 opt passes run, the algebraic optimization that looks for these BFE's happens before the constant folding pass. Rearranging these passes isn't a great idea, but this is easy enough to fix. Allows a following cvt to eliminate the bfe in certain situations. Signed-off-by: Ilia Mirkin <[email protected]>
* glsl: expose textureQueryLod in GLSL 4.00+ fragment shadersIlia Mirkin2015-08-201-37/+82
| | | | | | | | | | | | | | | See issue from the ARB_texture_query_lod spec for LOD vs Lod confusion: (3) The core specification uses the "Lod" spelling, not "LOD". Should this extension be modified to use "Lod"? RESOLVED: The "Lod" spelling is the correct spelling for the core specification and the preferred spelling for use. However, use of "LOD" also exists, as the extension predated the core specification, so this extension won't remove use of "LOD". Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* Revert "mesa/formats: refactor by collapsing cases in switch statement by type"Nanley Chery2015-08-201-17/+135
| | | | | | | | | | | This reverts commit ffe6c6ad5f719dedd1b6b95e8590e3f20b23d340. _mesa_format_num_components() does not include the padding bits in mesa formats containing 'X' channels. This could cause mipmap generation for certain uncompressed formats to underestimate the number of channels in the source image by 1. Signed-off-by: Nanley Chery <[email protected]>
* r600g: Fix handling of TGSI_OPCODE_ARR with SBGlenn Kennard2015-08-211-1/+1
| | | | | | | | | FLT_TO_INT goes in the vector pipes on evergreen/NI, not the trans unit as on earlier chips. Signed-off-by: Glenn Kennard <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* r600: Turn 'r600_shader_key' struct into unionEdward O'Callaghan2015-08-214-38/+42
| | | | | | | | | | | | This struct was getting a bit crowded, following the lead of radeonsi, mirror the idea of having sub-structures for each shader type. Turning 'r600_shader_key' into an union saves some trivial memory and CPU cycles for the shader keys. [airlied: drop as_ls, and reorder so larger fields at start.] Signed-off-by: Edward O'Callaghan <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* r600: Rewrite r600_shader_selector_key() to use a switch stmtEdward O'Callaghan2015-08-211-7/+17
| | | | | | Signed-off-by: Edward O'Callaghan <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* i965: Use NIR by default for vertex shadersJason Ekstrand2015-08-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shader-db results for vec4 on i965: total instructions in shared programs: 1499894 -> 1502261 (0.16%) instructions in affected programs: 1414224 -> 1416591 (0.17%) helped: 2434 HURT: 10543 GAINED: 1 LOST: 0 Shader-db results for vec4 on g4x: total instructions in shared programs: 1437411 -> 1439779 (0.16%) instructions in affected programs: 1362402 -> 1364770 (0.17%) helped: 2434 HURT: 10544 GAINED: 0 LOST: 0 Shader-db results for vec4 on Iron Lake: total instructions in shared programs: 1437214 -> 1439593 (0.17%) instructions in affected programs: 1362205 -> 1364584 (0.17%) helped: 2433 HURT: 10544 GAINED: 1 LOST: 0 Shader-db results for vec4 on Sandy Bridge: total instructions in shared programs: 2022092 -> 1941570 (-3.98%) instructions in affected programs: 1886838 -> 1806316 (-4.27%) helped: 7510 HURT: 10737 GAINED: 0 LOST: 0 Shader-db results for vec4 on Ivy Bridge: total instructions in shared programs: 1853749 -> 1804960 (-2.63%) instructions in affected programs: 1686736 -> 1637947 (-2.89%) helped: 6735 HURT: 11101 GAINED: 0 LOST: 0 Shader-db results for vec4 on Haswell: total instructions in shared programs: 1853749 -> 1804960 (-2.63%) instructions in affected programs: 1686736 -> 1637947 (-2.89%) helped: 6735 HURT: 11101 GAINED: 0 LOST: 0 Signed-off-by: Jason Ekstrand <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Acked-by: Matt Turner <[email protected]>
* glsl: check if return_deref in lower_subroutine_visitor::visit_leave isn't NULLKai Wasserbäch2015-08-211-1/+1
| | | | | | | | | Fixes a crash in Piglit's spec@arb_shader_subroutine@[email protected] for me. Signed-off-by: Kai Wasserbäch <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* nv50/ir: Handle OP_CVT when folding constant expressionsTobias Klausmann2015-08-201-0/+78
| | | | | [imirkin: handle more type combinations, use macro] Signed-off-by: Ilia Mirkin <[email protected]>
* nvc0/ir: undo more shifts still by allowing a pre-SHL to occurIlia Mirkin2015-08-201-15/+33
| | | | | | | | This happens with unpackSnorm lowering. There's yet another bitfield-extract behind it, but there's too much variation to be worth cutting through. Signed-off-by: Ilia Mirkin <[email protected]>
* nvc0/ir: don't require AND when the high byte is being addressedIlia Mirkin2015-08-201-0/+12
| | | | | | | unpackUnorm* lowering doesn't AND the high byte/word as it's unnecessary. Detect that situation as well. Signed-off-by: Ilia Mirkin <[email protected]>
* nvc0/ir: detect i2f/i2i which operate on specific bytes/wordsIlia Mirkin2015-08-204-4/+82
| | | | | | | | | | | Some Unigine shaders have been observed to unpack bytes out of 32-bit integers and convert them to floats. I2F/I2I can handle this sort of thing directly. Detect the handleable situations. This misses 16-bit word capabilities in nv50, but I haven't seen shaders that would actually make use of that. Signed-off-by: Ilia Mirkin <[email protected]>
* nvc0/ir: detect AND/SHR pairs and convert into EXTBFIlia Mirkin2015-08-201-20/+46
| | | | | | | Some shaders appear to extract bits using shift/and combos. Detect (some) of those and convert to EXTBF instead. Signed-off-by: Ilia Mirkin <[email protected]>
* nv50/ir: support different unordered_set implementationsChih-Wei Huang2015-08-205-12/+57
| | | | | | | | | | | | If build with C++11 standard, use std::unordered_set. Otherwise if build on old Android version with stlport, use std::tr1::unordered_set with a wrapper class. Otherwise use std::tr1::unordered_set. Signed-off-by: Chih-Wei Huang <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* i965: Fix "handle nir_intrinsic_image_size"Martin Peres2015-08-201-4/+3
| | | | | | | | | | | | | | I pushed a half-baked version of "i965: handle nir_intrinsic_image_size" by accident. Not having the Reviewed-by: tags on the last two commits should have been a red flag but I somehow missed it after the QA check. This patch should fix image-size for non-int images. I will add support to the piglit test for all the other image types. Sorry for the noise. Signed-off-by: Martin Peres <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* i965: enable GL_ARB_shader_image_sizeMartin Peres2015-08-201-0/+1
| | | | Signed-off-by: Martin Peres <[email protected]>
* i965: handle nir_intrinsic_image_sizeMartin Peres2015-08-201-0/+46
| | | | | | | | | | | | | | v2, Review from Francisco Jerez: - avoid the camelCase for the booleans - init the booleans using the sampler type - force the initialization of all the components of the output register v3: - Rename a variable from CubeMapArray to CubeArray to re-use GLSL's name (Ilia) - Fix some indentation and drop parenthesis (Topi) - Fix a signed/unsigned comparaison warning Signed-off-by: Martin Peres <[email protected]>
* nir: convert the glsl intrinsic image_size to nir_intrinsic_image_sizeMartin Peres2015-08-202-6/+17
| | | | | | | | | | | | | | | | | v2, review from Francisco Jerez: - make the destination variable as large as what the nir instrinsic defines (4) instead of the size of the return variable of glsl. This is still safe for the already existing code because all the intrinsics affected returned the same amount of components as expected by glsl IR. In the case of image_size, it is not possible to do so because the returned number of component depends on the image type and this case is not well handled by nir. v3: - Style fix Signed-off-by: Martin Peres <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* glsl: add support for the imageSize builtinMartin Peres2015-08-201-16/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code is heavily inspired from Francisco Jerez's code supporting the image_load_store extension. Backends willing to support this builtin should handle __intrinsic_image_size. v2: Based on the review of Ilia Mirkin - Enable the extension for GLES 3.1 - Fix indentation - Fix the return type (float to int, number of components for CubeImages) - Add a warning related to GLES 3.1 v3: Based on the review of Francisco Jerez - Refactor the code to share both add_image_function and _image with the other image-related functions v4: Based on Topi Pohjolainen's comments - Do not add parenthesis for the return value v5: based on Francisco Jerez's comments: - Fix a few indent issues - Reduce the size of a condition by testing the dimension and array properties instead of enumerating all the formats. Signed-off-by: Martin Peres <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* main: add extension GL_ARB_shader_image_sizeMartin Peres2015-08-205-0/+8
| | | | | | Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Francisco Jerez <[email protected]> Signed-off-by: Martin Peres <[email protected]>
* mesa: Add ES31 API tag for the extension table.Francisco Jerez2015-08-201-0/+7
| | | | | | | | | | I'll mark the OES_shader_image_atomic extension entry with this tag to make sure that we don't expose it on earlier GLES API versions accidentally, because according to the extension: "OpenGL ES 3.1 and GLSL ES 3.10 are required." Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Parse the allowed image format qualifiers in GLSL ES 3.1.Francisco Jerez2015-08-201-41/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This includes the minimum required desktop/ES GLSL version in the format qualifier table in anticipation of new GLSL versions extending the set of supported image formats. According to section 4.4.7 of the GLSL ES 3.1 spec: "The format layout qualifier identifiers for image variable declarations are: [...] rgba32f rgba16f r32f rgba8 rgba8_snorm [...] rgba32i rgba16i rgba8i r32i [...] rgba32ui rgba16ui rgba8ui r32ui" Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Recognise image memory qualifiers in GLSL ES 3.1.Francisco Jerez2015-08-201-5/+5
| | | | Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Define image-related built-in constants required by GLSL ES 3.1.Francisco Jerez2015-08-201-7/+15
| | | | Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Remove duplicate definition of gl_MaxTess*ImageUniforms built-in ↵Francisco Jerez2015-08-201-2/+0
| | | | | | | | | | | constants. These seem to have been re-added at some point during the ARB_tessellation_shader implementation work. AFAICT the second (correct) definition of each constant would have had no effect because the symbols were already defined. Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Accept atomic_uint type in GLSL ES 3.1.Francisco Jerez2015-08-201-1/+1
| | | | Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Accept supported image types in GLSL ES 3.1.Francisco Jerez2015-08-202-24/+24
| | | | | | | | These are a subset of the image types supported by desktop GL, excluding 1D, 1D array, rectangle, buffer, cube array, 2D MS and 2D MS array texture targets. Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Expose image load and store built-ins in GLSL ES 3.1.Francisco Jerez2015-08-201-1/+1
| | | | Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Use a separate availability class for image atomic built-ins.Francisco Jerez2015-08-201-11/+23
| | | | | | | These are not part of unextended GLSL ES 3.1. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Allow precision qualifiers on general opaque types.Francisco Jerez2015-08-201-4/+6
| | | | | | | | | | From the GLSL ES 3.1 spec, section 4.7.3: "Any floating point, integer, opaque type declaration can have the type preceded by one of these precision qualifiers: [...] highp [...], mediump [...], lowp [...]." Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Implement GLSL ES restriction on images being either readonly or ↵Francisco Jerez2015-08-201-0/+18
| | | | | | writeonly. Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Require that all image uniforms have a format qualifier in GLSL ES.Francisco Jerez2015-08-201-4/+10
| | | | | | | | | | | | | | | | | | | | Note that this is slightly more permissive than the spec language requires: "Any image variable must specify a format layout qualifier." The GLSL ES spec seems really sketchy regarding format layout qualifiers on function formal parameters -- On the one hand they are required, but on the other hand it doesn't provide any syntax to specify them (see section 6.1.1), they don't participate in parameter type matching for overload resolution, and are in fact explictly forbidden ("Layout qualifiers cannot be used on formal function parameters"). Of course none of the image built-in functions defined by the spec specify format layout qualifiers (and they probably couldn't sensibly), to contradict its own requirement. This probably qualifies for a spec bug, but in the meantime do the sensible thing and require layout qualifiers on uniforms *only*. Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Add support for image binding qualifiers.Francisco Jerez2015-08-202-8/+33
| | | | | | | | Support for binding an image to an image unit explicitly in the shader source is required by both GLSL 4.2 and GLSL ES 3.1, but not by the original ARB_shader_image_load_store extension. Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Forbid non-constant image array indexing in GLSL ES 3.1.Francisco Jerez2015-08-201-0/+15
| | | | Reviewed-by: Timothy Arceri <[email protected]>
* mesa: Refuse to bind image uniforms using glUniform in GLES.Francisco Jerez2015-08-201-1/+3
| | | | | | | | The GLES 3.1 spec removed support for updating the image unit bound to an image uniform using glUniform1i() calls. Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Refuse to bind a mutable texture object to an image unit in GLES.Francisco Jerez2015-08-201-0/+12
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: Initialize image unit state to different defaults in GLES.Francisco Jerez2015-08-201-2/+3
| | | | | | | | | There is no GL_R8 image format in GLES, according to the state table 20.32 of the GLES 3.1 spec the default value should be GL_R32UI. The ES31-CTS.shader_image_load_store.basic-api-bind Khronos conformance test checks that this is the case. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Reset image unit state to the default values when a bound image is ↵Francisco Jerez2015-08-203-7/+23
| | | | | | | | | | | | | | | deleted. The ES31-CTS.shader_image_load_store.basic-api-bind conformance test expects the whole image unit state to be reset when the bound texture object is deleted. The ARB_shader_image_load_store extension is rather vague regarding what should happen with image unit state other than the texture object in that case, but the GL 4.2 and GLES 3.1 specifications (section "Automatic Unbinding of Deleted Objects") explicitly require it to be reset to the default values. Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Reject image formats not supported by GLES.Francisco Jerez2015-08-201-2/+65
| | | | | | Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Don't lose track of the shader image layer originally specified by the ↵Francisco Jerez2015-08-203-8/+15
| | | | | | | | | | | | | | | | user. The spec requires that all layers of the image starting from the 0-th are bound to the image unit regardless of the Layer parameter when Layered is true, so I was setting gl_image_unit::Layer to zero in that case for the convenience of the driver back-end. However the ES31-CTS.shader_image_load_store.basic-api-bind conformance test checks that the layer value returned by glGetInteger is the same that was originally specified, regardless of the value of layered. Rename Layer to _Layer as is usual for other derived state and keep track of the original layer value as gl_image_unit::Layer. Reviewed-by: Ian Romanick <[email protected]>
* mesa: Rename MaxCombinedImageUnitsAndFragmentOutputs to ↵Francisco Jerez2015-08-207-7/+7
| | | | | | | | | | | | | MaxCombinedShaderOutputResources. The name of both the GLSL built-in variable and the glGetInteger param with the same value changed in GLSL ES 3.1 and GL 4.5. Its semantics also changed slightly, since the limit now also takes into account the number of SSBs in use. Switch our internal data structures to the up-to-date name. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* nir: Use nir_builder in nir_lower_io's get_io_offset().Kenneth Graunke2015-08-191-28/+14
| | | | | | | Much more readable. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Pull nir_lower_io's load_op selection into a helper function.Kenneth Graunke2015-08-191-17/+22
| | | | | | | Makes the function a bit smaller. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/formats: refactor by collapsing cases in switch statement by typeNanley Chery2015-08-191-135/+17
| | | | | | | Combine the adjacent cases which have the same GL type in the switch statemnt. Reviewed-by: Chad Versace <[email protected]> Signed-off-by: Nanley Chery <[email protected]>
* mesa/formats: add more MESA_FORMAT_LAYOUTsNanley Chery2015-08-194-33/+19
| | | | | | | | | | Add the classes of compressed formats as layouts. This allows the detection of compressed formats belonging to a certain category of compressed formats. v2. simplify layout name construction (Ilia). Reviewed-by: Chad Versace <[email protected]> Signed-off-by: Nanley Chery <[email protected]>
* glsl: Fix up GL_ARB_compute_shader for GLSL ES 3.1Marta Lofstedt2015-08-192-3/+7
| | | | | | | | | | GL_ARB_compute_shader is limited for GLSL version 430. This enables for GLSL ES version 310. V2: Updated error string to also include GLSL 3.10 Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa/main: Add GL_IMAGE_FORMAT_COMPATIBILITY_TYPE to glGetTexParameterfvMarta Lofstedt2015-08-191-0/+6
| | | | | | | | | According to Open GL ES 3.1 specification, section 8.10.2 GL_IMAGE_FORMAT_COMPATIBILITY_TYPE should be supported by glGetTexParameterfv. Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* radeonsi: fix a typo as_es -> as_ls in a stringMarek Olšák2015-08-191-1/+1
| | | | Trivial.
* winsys/amdgpu: fix the type of memory usage countersMarek Olšák2015-08-191-2/+2
| | | | | | | | | If the 32-bit types overflowed, the driver could submit an IB that uses much more memory than is available. Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Michel Dänzer <[email protected]>