summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* glsl: make linker error message more informativeTimothy Arceri2015-08-131-2/+3
| | | | Reviewed-by: Ilia Mirkin <[email protected]>
* glsl: Add missing spec quote about atomic counter in structsTimothy Arceri2015-08-111-4/+4
| | | | Reviewed-by: Thomas Helland <[email protected]>
* glsl: remove stage ref generation for transform feedbackTimothy Arceri2015-08-071-6/+4
| | | | | | | | | Stage ref cannot be queried for transform feedback. Also simplify the build_stageref function by passing the correct mode for uniforms. Reviewed-by: Tapani Pälli <[email protected]>
* mesa: save which transform feedback buffer is associated with which streamMarek Olšák2015-08-061-0/+1
| | | | Reviewed-by: Dave Airlie <[email protected]>
* glsl: Initialize patch member of glsl_struct_fieldMichel Dänzer2015-08-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is apparently a subtle difference in C++ between F f; and F f(); The former will use the default constructor. If there is no default constructor specified, the compiler provides one that simply invokes the default constructor for each field. For built-in basic types, the default constructor does nothing. The later will, according to http://stackoverflow.com/questions/2417065/does-the-default-constructor-initialize-built-in-types) perform value-initialization of the type. For built-in types this means initializing to zero. The per_vertex_accumulator constructor is: per_vertex_accumulator::per_vertex_accumulator() : fields(), num_fields(0) { } This is the second form of constructor, so the glsl_struct_field objects were previously zero initialized. With the addition of an empty default constructor in commit 7ac946e5, per_vertex_accumulator::fields receive no initialization. Fixes a bunch of random (mostly tessellation related) piglit failures since commit 7ac946e5 ("glsl: Add constuctors for the common cases of glsl_struct_field"). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91544 Reviewed-by: Ian Romanick <[email protected]>
* nir: add missing type to type_size_vec4()Timothy Arceri2015-08-051-0/+2
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl: add variable mode check to build_stagerefTapani Pälli2015-08-051-4/+13
| | | | | | | | | | | | | Currently stage reference mask is built using the variable name only. However it can happen that input of one stage has same name as output from another stage. Adding check of variable mode makes sure we do not pick wrong variable. Fixes some subcases from ES31-CTS.program_interface_query.no-locations Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* nir: Add a nir_lower_load_const_to_scalar() pass.Eric Anholt2015-08-043-0/+105
| | | | | | | | This is useful to increase the CSE opportunities for a scalar backend. It avoids regressions when dropping vc4's custom CSE implementation. v2: Cleanups by Matt (decl in the for loop, and unreachable()). Reviewed-by: Matt Turner <[email protected]>
* nir: Add algebraic opt for no-op iand.Eric Anholt2015-08-041-0/+1
| | | | | | I lazily generated some of these in VC4 NIR lowering. Reviewed-by: Iago Toral Quiroga <[email protected]>
* Revert "nir: Use a single bit for the dual-source blend index"Eric Anholt2015-08-041-6/+2
| | | | | This reverts commit ab5b7a0fe659ff6f9c1885d5cb047b6531959506. We use more than one bit of value in tgsi_to_nir.
* mesa: Use _mesa_lroundevenf() in some more places.Matt Turner2015-08-041-10/+4
|
* glsl: replace old hash table with new and faster oneAlejandro Seguí2015-08-041-7/+11
| | | | | | | | The util/hash_table was intended to be a fast hash table replacement for the program/hash_table see 35fd61bd99c1 and 72e55bb6888ff. Reviewed-by: Timothy Arceri <[email protected]>
* glsl: Add constuctors for the common cases of glsl_struct_fieldIan Romanick2015-08-034-56/+53
| | | | | | | | | | | | | | | | | | | | | | | | Fixes a giant pile of GCC warnings: builtin_types.cpp:60:1: warning: missing initializer for member 'glsl_struct_field::stream' [-Wmissing-field-initializers] I had to add a default constructor because a non-default constructor was added. Otherwise the only constructor would be the one with parameters, and all the plases like glsl_struct_field foo; would fail to compile. I wanted to do this in two patches. All of the initializers of glsl_struct_field structures had to be converted to use the constructor because C++ apparently forces you to do one or the other: builtin_types.cpp:61:1: error: could not convert '{glsl_type::float_type, "near", -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0, -1}' from '<brace-enclosed initializer list>' to 'glsl_struct_field' Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Francisco Jerez <[email protected]> Reviewed-by: Juha-Pekka Heikkila <[email protected]>
* nir: Fix output swizzle in get_mul_for_srcSamuel Iglesias Gonsalvez2015-08-031-1/+12
| | | | | | | | | | | | | | | Avoid copying an overwritten swizzle, use the original values. Example: Former swizzle[] = xyzw src->swizzle[] = zyxx The expected output swizzle = zyxx but if we reuse swizzle in the loop, then output swizzle would be zyzz. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/nir_lower_io: Add vec4 supportIago Toral Quiroga2015-08-032-27/+78
| | | | | | | | | | The current implementation operates in scalar mode only, so add a vec4 mode where types are padded to vec4 sizes. This will be useful in the i965 driver for its vec4 nir backend (and possbly other drivers that have vec4-based shaders). Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Use a single bit for the dual-source blend indexTimothy Arceri2015-08-031-2/+6
| | | | | | | | | | The only values allowed are 0 and 1, and the value is checked before assigning. This is a copy of 8eeca7a56c that seems to have been made to the glsl ir type after it was copied for use in nir but before nir landed. Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Initialize parse-state in constructor of lower_subroutine.Matt Turner2015-07-311-3/+3
| | | | | | Static analysis tools don't like partial object initializations. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* glsl: set stage flag for structs and arrays in resource listTimothy Arceri2015-07-301-3/+13
| | | | | | | | This fixes the remaining failing tests in: ES31-CTS.program_interface_query.uniform-types Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* glsl: Avoid double promotion.Matt Turner2015-07-291-2/+2
|
* nir: Avoid double promotion.Matt Turner2015-07-291-2/+2
| | | | Reviewed-by: Iago Toral Quiroga <[email protected]>
* glsl: Remove MSVC implementations of copysign and isnormal.Matt Turner2015-07-292-26/+2
| | | | Non-Gallium parts of Mesa require MSVC 2013 which provides these.
* glsl: Fix a bug where LHS swizzles of swizzles were too small.Kenneth Graunke2015-07-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A simple shader such as vec4 color; color.xy.x = 1.0; would cause ir_assignment::set_lhs() to generate bogus IR: (swiz xy (swiz x (constant float (1.0)))) We were setting the number of components of each new RHS swizzle based on the highest channel used in the LHS swizzle. So, .xy.y would generate (swiz xy (swiz xx ...)), while .xy.x would break. Our existing Piglit test happened to use .xzy.z, which worked, since 'z' is the third component, resulting in an xxx swizzle. This patch sets the number of swizzle components based on the size of the LHS swizzle's inner value, so we always have the correct number at each step. Fixes new Piglit tests glsl-vs-swizzle-swizzle-lhs-[23]. Fixes ir_validate assertions in in Metro 2033 Redux. v2: Move num_components updating completely out of update_rhs_swizzle (suggested by Timothy Arceri). Simplify. Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: verify location when dual source blendingTapani Pälli2015-07-291-0/+19
| | | | | | | | | | | | Same check is made for glBindFragDataLocationIndexed but it was missing when using layout qualifiers. Fixes following Piglit test: arb_blend_func_extended-output-location Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: move max_index calc to assign_attribute_or_color_locationsTapani Pälli2015-07-291-8/+15
| | | | | | | | | | | Change function to get all gl_constants for inspection, this is used by follow-up patch. v2: rebase, update function documentation Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* glsl: enable conservative depth, ssbo based on GLSL versionIlia Mirkin2015-07-271-2/+3
| | | | | | | | Add in missed version checks in the GLSL parser Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* glsl: recognize ARB_shading_language_420pack to be enabled with 4.20+Ilia Mirkin2015-07-242-9/+14
| | | | | | | | | The 420pack extension enables various GLSL rules that need to be applied to any GLSL 4.20+ shader even if the extension is not explicitly enabled. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
* glsl/glcpp: fix SIGSEGV when checking error condition for macro redefinitionSamuel Iglesias Gonsalvez2015-07-241-2/+2
| | | | | | | | | | | | | | | Commit a6e9cd14c does not take into account than node_{a,b}->next could be NULL in some circumstances, such as in a shader containing this code: #define A 1 /* comment */ #define A 1 /* comment */ This patch fixes the segmentation fault for cases like that. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91290 Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Cc: [email protected]
* i965: add support for ARB_shader_subroutineDave Airlie2015-07-242-2/+3
| | | | | | | | This just adds some missing pieces to nir/i965, it is lightly tested on my Haswell. Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: add uniform and program resource support (v2)Dave Airlie2015-07-233-7/+286
| | | | | | | | | | | | | | | | | | | This adds linker support for subroutine uniforms, they have some subtle differences from real uniforms, we also hide them and they are given internal uniform names. This also adds the subroutine locations and subroutine uniforms to the program resource tracking for later use. v1.1: drop is_subroutine_def v2: handle explicit location properly, ARB_explicit_location has a lot of language for subroutine shaders. Calculate a link time the number of compatible subroutines for a uniform, to make program resource easier later. Acked-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl/ir: add subroutine lowering pass (v2.3)Dave Airlie2015-07-234-0/+113
| | | | | | | | | | | | | | This lowers the enhanced ir_call using the lookaside table of subroutines into an if ladder. This initially was done at the AST level but it caused some ordering issues so a separate pass was required. v2: clone return value derefs. v2.1: update for subroutine->int convert. v2.2: add a clone for the array index Reviewed-by: Chris Forbes <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: add ast/parser support for subroutine parsing storage (v3.2)Dave Airlie2015-07-239-116/+326
| | | | | | | | | | | | | | | | | | | | | | | | | | This is the guts of the GLSL parser and AST support for shader subroutines. The code creates a subroutine type in the parser, and uses that there to validate the identifiers. The parser also distinguishes between subroutine types/function prototypes /uniforms and subroutine defintions for functions. Then in the AST conversion it recreates the types, and stores the subroutine definition info or subroutine info into the ir_function along with a side lookup table in the parser state. It also converts subroutine calls into the enhanced ir_call. v2: move to handling method calls in function handling not in field selection. v3: merge Chris's previous parser patches in here, to make it clearer what's changed in one place. v3.1: add more documentation, drop unused include v3.2: drop is_subroutine_def Reviewed-by: Chris Forbes <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl/ir: allow ir_call to handle subroutine callingDave Airlie2015-07-231-1/+20
| | | | | | | | | This adds a ir_variable which contains the subroutine uniform and an array rvalue for the deref of that uniform, these are stored in the ir_call and lowered later. Reviewed-by: Chris Forbes <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl/ir: add subroutine information storage to ir_function (v1.1)Dave Airlie2015-07-234-1/+26
| | | | | | | | | | | We need to store two sets of info into the ir_function, if this is a function definition with a subroutine list (subroutine_def) or if it a subroutine prototype. v1.1: add some more documentation. Reviewed-by: Chris Forbes <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: don't eliminate subroutine types.Dave Airlie2015-07-231-0/+3
| | | | | | | | This stops dead code from removing subroutines types, we need these for the queries to work properly. Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl/types: add new subroutine type (v3.2)Dave Airlie2015-07-2312-0/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | This type will be used to store the name of subroutine types as in subroutine void myfunc(void); will store myfunc into a subroutine type. This is required to the parser can identify a subroutine type in a uniform decleration as a valid type, and also for looking up the type later. Also add contains_subroutine method. v2: handle subroutine to int comparisons, needed for lowering pass. v3: do subroutine to int with it's own IR operation to avoid hacking on asserts (Kayden) v3.1: fix warnings in this patch, fix nir, fix tgsi v3.2: fixup tests Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Chris Forbes <[email protected]> Signed-off-by: Dave Airlie <[email protected]> tests: fix warnings
* glsl: Make `subroutine` a reserved keywordChris Forbes2015-07-231-1/+1
| | | | | | | Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Chris Forbes <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: Add extension plumbing and define for ARB_shader_subroutineChris Forbes2015-07-234-0/+7
| | | | | | | Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Chris Forbes <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl/tests: fix varying_test since tess changes.Dave Airlie2015-07-231-1/+1
| | | | | | | This fixes make check since the tess changes. Tested-by: Michel Dänzer <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* glsl: use separate varying slots for patch varyingsMarek Olšák2015-07-233-11/+44
| | | | | | | The idea is to allow 32 normal varyings and 32 patch varyings, a total of 64. Previously, only a total of 32 was allowed. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: fix locations of 2-dimensional varyings without varying packing (v2)Marek Olšák2015-07-231-9/+28
| | | | | | v2: renamed producer/consumer_type -> producer/consumer_stage Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: don't demote tess control shader outputsMarek Olšák2015-07-231-1/+5
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: disable varying packing between tessellation shadersMarek Olšák2015-07-231-8/+21
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: allow indexing of gl_out with a non-const if length isn't knownMarek Olšák2015-07-231-0/+10
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: allow redeclaration of TCS gl_out[]Chris Forbes2015-07-231-4/+16
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: validate restrictions on use of barrier()Chris Forbes2015-07-231-0/+99
| | | | | | | | | | With the exception of always-taken switch cases (which are indistinguishable from straight line code in our IR), this disallows use of the builtin barrier() function in all the places it may not appear. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: allow barrier() in tessellation control shadersMarek Olšák2015-07-231-2/+2
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: analyze TES usage of gl_ClipDistanceChris Forbes2015-07-231-0/+19
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: push vertex count determination down one levelChris Forbes2015-07-233-17/+11
| | | | | | | We have the prog here, so we don't need the caller to work this out for us. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: pass shader stage to lower_output_reads and handle tess controlIlia Mirkin2015-07-232-5/+10
| | | | | | | | | | | | | Tessellation control outputs can be read in directly without first having been written. Accessing these will require some special logic anyways, so just let them through. V2: Never lower tess control output reads, whether patch or not -- both can be read back by other threads. Signed-off-by: Ilia Mirkin <[email protected]> Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: properly size unsized arrays in tess stagesChris Forbes2015-07-231-2/+47
| | | | Reviewed-by: Kenneth Graunke <[email protected]>