summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* automake: use only the folder name if it's a subfolder of the present oneEmil Velikov2014-03-111-2/+2
| | | | | | | v2: Resolve rebase conflicts. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Jon TURNEY <[email protected]>
* automake: silence folder creationEmil Velikov2014-03-111-2/+2
| | | | | | | | | | | There is little gain in printing whenever a folder is created. v2: - Use $(AM_V_at) over @ to have control in verbose builds. Suggested by Erik Faye-Lund. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Jon TURNEY <[email protected]>
* mesa/glsl: introduce a remap table for uniform locationsTapani Pälli2014-03-102-11/+30
| | | | | | | | | | | | | | | | | Patch adds a remap table for uniforms that is used to provide a mapping from application specified uniform location to actual location in the UniformStorage. Existing UniformLocationBaseScale usage is removed as table can be used to set sequential values for array uniform elements. This mapping helps to implement GL_ARB_explicit_uniform_location so that uniforms locations can be reorganized and handled in a more easy manner. v2: small fixes + rename parameters for merge and split functions (Ian) improve documentation, remove old check for location bounds (Eric) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glcpp: Do not remove spaces to preserve locations.Sir Anthony2014-03-084-5/+5
| | | | | | | | | After preprocessing by glcpp all adjacent spaces were replaced by single one and glsl parser received column-shifted shader source. It negatively affected ast location set up and produced wrong error messages for heavily-spaced shaders. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Change locations from yylloc to appropriate tokens positions.Sir Anthony2014-03-081-101/+114
| | | | Reviewed-by: Carl Worth <[email protected]>
* glsl: Add ast_node method to set location range.Sir Anthony2014-03-081-0/+14
| | | | Reviewed-by: Carl Worth <[email protected]>
* glsl: Make ast_node location comments more informative.Sir Anthony2014-03-081-4/+4
| | | | Reviewed-by: Carl Worth <[email protected]>
* glsl: Extend ast location structure to hande end token position.Sir Anthony2014-03-082-11/+17
| | | | Reviewed-by: Carl Worth <[email protected]>
* glsl: Update lexers in glsl and glcpp to hande end position of token.Sir Anthony2014-03-082-2/+4
| | | | Reviewed-by: Carl Worth <[email protected]>
* glsl: fix compiler warnings in link_uniforms.cppBrian Paul2014-03-061-1/+2
| | | | | | | | | With a non-debug build, gcc has two complaints: 1. 'found' var not used. Silence with '(void) found;' 2. 'id' not initialized. It's assigned by the UniformHash->get() call, actually. But init it to zero to silence gcc. Reviewed-by: Matt Turner <[email protected]>
* glsl: switch to c11 mutex functionsBrian Paul2014-03-031-7/+7
| | | | Reviewed-by: José Fonseca <[email protected]>
* glsl: Fix broken LRP algebraic optimization.Kenneth Graunke2014-03-021-1/+3
| | | | | | | | | | | | | | | | | | | | | opt_algebraic was translating lrp(x, 0, a) into add(x, -mul(x, a)). Unfortunately, this references "x" twice, which is invalid in the IR, leading to assertion failures in the validator. Normally, cloning IR solves this. However, "x" could actually be an arbitrary expression tree, so copying it could result in huge piles of wasted computation. This is why we avoid reusing subexpressions. Instead, transform it into mul(x, add(1.0, -a)), which is equivalent but doesn't need two references to "x". Fixes a regression since d5fa8a95621169, which isn't in any stable branches. Fixes 18 shaders in shader-db (bastion and yofrankie). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Don't vectorize horizontal expressions.Matt Turner2014-02-281-0/+15
| | | | | Cc: "10.1" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75224
* glsl: Add is_horizontal() method to ir_expression.Matt Turner2014-02-281-0/+12
| | | | Cc: "10.1" <[email protected]>
* glsl: Optimize lrp(x, 0, a) into x - (x * a).Matt Turner2014-02-281-0/+2
| | | | | | | | Helps one program in shader-db: instructions in affected programs: 96 -> 92 (-4.17%) Reviewed-by: Ian Romanick <[email protected]>
* glsl: Optimize lrp(0, y, a) into y * a.Matt Turner2014-02-281-0/+2
| | | | | | | | Helps two programs in shader-db: instructions in affected programs: 254 -> 234 (-7.87%) Reviewed-by: Ian Romanick <[email protected]>
* glsl: add switch case for MESA_SHADER_COMPUTEBrian Paul2014-02-261-0/+3
| | | | | | To fix warning about unhandled enum value. Reviewed-by: Anuj Phogat <[email protected]>
* glsl: Delete LRP_TO_ARITH lowering pass flag.Kenneth Graunke2014-02-262-35/+2
| | | | | | | | | | | | | | Tt's kind of a trap---calling do_common_optimization() after lower_instructions() may cause opt_algebraic() to reintroduce ir_triop_lrp expressions that were lowered, effectively defeating the point. Because of this, nobody uses it. v2: Delete more code (caught by Ian Romanick). Cc: "10.1" <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Eric Anholt <[email protected]>
* glsl: removed unused dimension_count varibleTimothy Arceri2014-02-261-6/+2
| | | | | | | | This variable is no longer needed after the cleanup to the code prior to the first arrays of array series Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl/i965: move lower_offset_array up to GLSL compiler level.Dave Airlie2014-02-253-0/+92
| | | | | | | | This lowering pass will be useful for gallium drivers as well, in order to support the GL TG4 oddity that is textureGatherOffsets. Reviewed-by: Chris Forbes <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: Add a file argument to the IR printer.Eric Anholt2014-02-227-114/+123
| | | | | | | | | | | | While we want to be able to print to stdout for glsl_compiler, for debugging drivers we want to be able to dump to stderr because that's where other driver debug (like LIBGL_DEBUG) tends to go, and because some apps actually close stdout to shut up their own messages (such as the X Server, or NWN). Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl/sso: Add parser and AST-to-HIR support for separate shader object layoutsIan Romanick2014-02-214-13/+71
| | | | | | | | | | | | GL_ARB_separate_shader_objects adds the ability to specify location layouts for interstage inputs and outputs. In addition, this extension makes 'in' and 'out' generally available for shader inputs and outputs. This mimics the behavior of GL_ARB_explicit_attrib_location. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* mesa/sso: Add extension tracking for ARB_separate_shader_objectsIan Romanick2014-02-212-0/+8
| | | | | | | This adds the necessary bits for both the API and the GLSL compiler. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* glsl: add gl_InvocationID variable for ARB_gpu_shader5Jordan Justen2014-02-201-0/+2
| | | | | | | | | v2: * Make gl_InvocationID a system value Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* glsl/linker: produce gl_shader_program Geom.InvocationsJordan Justen2014-02-202-0/+22
| | | | | | | | | | Grab the parsed invocation count, check for consistency during linking, and finally save the result in gl_shader_program Geom.Invocations. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* glsl: parse invocations layout qualifier for ARB_gpu_shader5Jordan Justen2014-02-203-0/+43
| | | | | | | | | | | | _mesa_glsl_parse_state in_qualifier->invocations will store the invocations count. v3: * Use in_qualifier to allow the primitive to be specied separately from the invocations count (merge_qualifiers) Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* glsl: Generate error for invalid input layout declarationsJordan Justen2014-02-201-0/+13
| | | | | | | | Fixes various piglit tests: spec/glsl-1.50/compiler/incorrect-in-layout-qualifier-*.geom Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* glsl: convert GS input primitive to use ast_type_qualifierJordan Justen2014-02-206-66/+96
| | | | | | | | | | | | | | | | | | | | | | | | We introduce a new merge_in_qualifier ast_type_qualifier which allows specialized handling of merging input layout qualifiers. By merging layout qualifiers into state->in_qualifier, we allow multiple input qualifiers. For example, the primitive type can be specified specified separately from the invocations count (ARB_gpu_shader5). state->gs_input_prim_type is moved into state->in_qualifier->prim_type state->gs_input_prim_type_specified is still processed separately so we can determine when the input primitive is specified. This is important since certain scenerios are not supported until after the primitive type has been specified in the shader code. v4: * Merge with compute shader input layout qualifiers Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* glsl: Silence "type qualifiers ignored on function return type" warningIan Romanick2014-02-191-1/+1
| | | | | | | | | | | | | | The const in const unsigned foo(void); is meaningless. Removing it silences this warning: src/glsl/ast_to_hir.cpp:1802:56: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* glsl: Only warn for macro names containing __Ian Romanick2014-02-191-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | From page 14 (page 20 of the PDF) of the GLSL 1.10 spec: "In addition, all identifiers containing two consecutive underscores (__) are reserved as possible future keywords." The intention is that names containing __ are reserved for internal use by the implementation, and names prefixed with GL_ are reserved for use by Khronos. Names simply containing __ are dangerous to use, but should be allowed. Per the Khronos bug mentioned below, a future version of the GLSL specification will clarify this. Signed-off-by: Ian Romanick <[email protected]> Cc: "9.2 10.0 10.1" <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Tested-by: Kenneth Graunke <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Tested-by: Darius Spitznagel <[email protected]> Cc: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870 Bugzilla: Khronos #11702
* glcpp: Only warn for macro names containing __Ian Romanick2014-02-192-5/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Section 3.3 (Preprocessor) of the GLSL 1.30 spec (and later) and the GLSL ES spec (all versions) say: "All macro names containing two consecutive underscores ( __ ) are reserved for future use as predefined macro names. All macro names prefixed with "GL_" ("GL" followed by a single underscore) are also reserved." The intention is that names containing __ are reserved for internal use by the implementation, and names prefixed with GL_ are reserved for use by Khronos. Since every extension adds a name prefixed with GL_ (i.e., the name of the extension), that should be an error. Names simply containing __ are dangerous to use, but should be allowed. In similar cases, the C++ preprocessor specification says, "no diagnostic is required." Per the Khronos bug mentioned below, a future version of the GLSL specification will clarify this. Signed-off-by: Ian Romanick <[email protected]> Cc: "9.2 10.0 10.1" <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Tested-by: Kenneth Graunke <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Tested-by: Darius Spitznagel <[email protected]> Cc: Tapani Pälli <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870 Bugzilla: Khronos #11702
* glsl: Fix condition to generate shader link errorAnuj Phogat2014-02-181-4/+5
| | | | | | | | | | | | | | | | | | | GL_ARB_ES2_compatibility doesn't say anything about shader linking when one of the shaders (vertex or fragment shader) is absent. So, the extension shouldn't change the behavior specified in GLSL specification. Tested the behavior on proprietary linux drivers of NVIDIA and AMD. Both of them allow linking a version 100 shader program in OpenGL context, when one of the shaders is absent. Makes following Khronos CTS tests to pass: successfulcompilevert_linkprogram.test successfulcompilefrag_linkprogram.test Cc: [email protected] Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: rename _restrict to restrict_flagBrian Paul2014-02-127-8/+8
| | | | | | | | | | | To fix MSVC compile breakage. Evidently, _restrict is an MSVC keyword, though the docs only mention __restrict (with two underscores). Note: we may want to also rename _volatile to volatile_flag to be consistent. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74900 Reviewed-by: Ian Romanick <[email protected]>
* glsl/linker: Propagate image uniform access qualifiers to the driver.Francisco Jerez2014-02-121-0/+35
| | | | Reviewed-by: Paul Berry <[email protected]>
* glsl/linker: Assign image uniform indices.Francisco Jerez2014-02-121-1/+23
| | | | Reviewed-by: Paul Berry <[email protected]>
* glsl/linker: Count and check image resources.Francisco Jerez2014-02-122-1/+59
| | | | | | | v2: Add comment about the reason why image variables take up space from the default uniform block. Reviewed-by: Paul Berry <[email protected]>
* glsl: Add image built-in function generator.Francisco Jerez2014-02-121-0/+251
| | | | | | | | | | | | | | | | | | Because of the combinatorial explosion of different image built-ins with different image dimensionalities and base data types, enumerating all the 242 possibilities would be annoying and a waste of .text space. Instead use a special path in the built-in builder that loops over all the known image types. v2: Generate built-ins on GLSL version 4.20 too. Rename '_has_float_data_type' to '_supports_float_data_type'. Avoid duplicating enumeration of image built-ins in create_intrinsics() and create_builtins(). v3: Use a more orthodox approach for passing image built-in generator parameters. v4: Cosmetic changes. Acked-by: Paul Berry <[email protected]>
* glsl: Add built-in constants for ARB_shader_image_load_store.Francisco Jerez2014-02-123-0/+37
| | | | | | v2: Add them on GLSL version 4.20 too. Reviewed-by: Paul Berry <[email protected]>
* glcpp: Add built-in define for ARB_shader_image_load_store.Francisco Jerez2014-02-121-0/+3
| | | | Reviewed-by: Paul Berry <[email protected]>
* glsl: Add built-in types defined by ARB_shader_image_load_store.Francisco Jerez2014-02-122-0/+104
| | | | Reviewed-by: Paul Berry <[email protected]>
* glsl/ast: Generalize some sampler variable restrictions to all opaque types.Francisco Jerez2014-02-122-31/+36
| | | | | | | | | | | | No opaque types may be statically initialized in the shader, all opaque variables must be declared uniform or be part of an "in" function parameter declaration, no opaque types may be used as the return type of a function. v2: Add explicit check for opaque types in interface blocks. Check for opaque types in ir_dereference::is_lvalue(). Reviewed-by: Paul Berry <[email protected]>
* glsl/ast: Forbid declaration of image variables in structures and uniform ↵Francisco Jerez2014-02-121-0/+10
| | | | | | | | | | | | | | | | | blocks. Aggregating images inside uniform blocks is explicitly disallowed by the standard, aggregating them inside structures is not (as of GL 4.4), but there is a similar problem as with atomic counters: image uniform declarations require either a "writeonly" memory qualifier or an explicit format qualifier, which are explicitly forbidden in structure member declarations. In the resolution of Khronos bug #10903 the same wording applied to atomic counters was decided to mean that they're not allowed inside structures -- Rejecting image member declarations within structures seems the most reasonable option for now. Reviewed-by: Paul Berry <[email protected]>
* glsl/ast: Make sure that image argument qualifiers match the function prototype.Francisco Jerez2014-02-121-1/+6
| | | | Reviewed-by: Paul Berry <[email protected]>
* glsl/ast: Verify that function calls don't discard image format qualifiers.Francisco Jerez2014-02-121-0/+58
| | | | Reviewed-by: Paul Berry <[email protected]>
* glsl/ast: Validate and apply memory qualifiers to image variables.Francisco Jerez2014-02-121-0/+51
| | | | Reviewed-by: Paul Berry <[email protected]>
* glsl/parser: Handle image built-in types.Francisco Jerez2014-02-121-0/+33
| | | | Reviewed-by: Paul Berry <[email protected]>
* glsl/parser: Handle image memory qualifiers.Francisco Jerez2014-02-121-0/+83
| | | | | | v2: Make the "map" array static const. Reviewed-by: Paul Berry <[email protected]>
* glsl/parser: Handle the early_fragment_tests input layout qualifier.Francisco Jerez2014-02-123-1/+20
| | | | | | v2: Only allow the early_fragment_tests qualifier in fragment shaders. Reviewed-by: Paul Berry <[email protected]>
* glsl/lexer: Add new tokens for ARB_shader_image_load_store.Francisco Jerez2014-02-122-39/+56
| | | | Reviewed-by: Paul Berry <[email protected]>
* glsl/ast: Keep track of type qualifiers defined by ARB_shader_image_load_store.Francisco Jerez2014-02-123-3/+38
| | | | | | | | v2: Add comment next to the read_only and write_only qualifier flags. Change temporary copies of the type qualifier mask to use uint64_t too. Reviewed-by: Paul Berry <[email protected]>