summaryrefslogtreecommitdiffstats
path: root/src/glsl
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch mesa-public/master into vulkanJason Ekstrand2016-02-057-25/+31
|\
| * glsl: Conditionalize atan2 math.Kenneth Graunke2016-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In the old hand-writen implementation of atan2, the calculation of atan(y/x) was performed conditionally in the "then" block of the outermost if statement. I believe I accidentally lifted this out into unconditional code when converting to IR builder. For reference, the original hand-written IR is visible in commit 722eff674b832e2321f791c68358ef52d2a1ff25. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Cc: Erik Faye-Lund <[email protected]>
| * glsl: add support for GL_OES_geometry_shaderMarta Lofstedt2016-01-224-14/+23
| | | | | | | | | | | | | | | | | | This adds glsl support of GL_OES_geometry_shader for OpenGL ES 3.1. Signed-off-by: Marta Lofstedt <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
| * glsl: always compute proper varying type, irrespective of varying packingIlia Mirkin2016-01-221-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally there's a producer and consumer, and the producer var gets picked. In both the vertex->gs and tes->gs cases, that's the un-arrayed version. In the SSO case, however, there is no producer. So we picked the arrayed GS variable, and as a result, used more slots than we should. More critically, these slots would also no longer line up with the producer's calculation. To fix this, we need to fix up the type of the variable based on stage no matter what. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93650 Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Cc: "11.0 11.1" <[email protected]>
| * glsl/lower_instructions: fix regression in dldexp_to_arithIago Toral Quiroga2016-01-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The commit b4e198f47f842 changed the offset and bits parameters of the bitfield insert operation from scalars to vectors. However, the lowering of ldexp on doubles operates on each vector component and emits scalar code (since it has to deal with the lower and upper 32-bit chunks of each double component), so it needs its bits and offset parameters to be scalars. Fixes fp64 regression (crash) in: spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-ldexp-dvec4.shader_test Reviewed-by: Ilia Mirkin <[email protected]>
* | nir/spirv: fix build_mat4_det stack smasherMark Janes2016-02-021-2/+5
| | | | | | | | | | | | | | | | | | | | | | When generating a sub-determinate matrix, a 3-element swizzle array was indexed with clever inline boolean logic. Unfortunately, when i and j are both 3, the index overruns the array, smashing the next variable on the stack. For 64 bit builds, the alignment of the 3-element unsigned array leaves 32 bits of spacing before the next local variable, hiding this bug. On i386, a subcolumn pointer was smashed then dereferenced.
* | nir/spirv: Fix UBO loads of a single element of a row-major matrixJason Ekstrand2016-02-011-0/+2
| |
* | nir/spirv: Handle the LOD parameter of OpImageQuerySizeLodJason Ekstrand2016-02-011-0/+4
| |
* | nir/spirv: Add support for SpvOpImageJason Ekstrand2016-02-011-0/+12
| |
* | nir/spirv: Fix the UBO loading case of a single row-major matric columnJason Ekstrand2016-02-011-2/+5
| |
* | nir/spirv: Fix the UBO loading case of a single row-major matric columnJason Ekstrand2016-02-011-3/+7
| |
* | vtn: Improve accuracy of acos approximation.Francisco Jerez2016-01-271-3/+3
| | | | | | | | | | | | | | | | The adjusted polynomial coefficients come from the numerical minimization of the L2 norm of the relative error. The old coefficients would give a maximum relative error of about 15000 ULP in the neighborhood around acos(x) = 0, the new ones give a relative error bounded by less than 2000 ULP in the same neighborhood.
* | An alternate arccosine implementationJason Ekstrand2016-01-271-2/+24
| |
* | vtn: Make tanh implementation even stupiderKenneth Graunke2016-01-271-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dEQP "precision" test tries to verify that the reference functions float sinh(float a) { return ((exp(a) - exp(-a)) / 2); } float cosh(float a) { return ((exp(a) + exp(-a)) / 2); } float tanh(float a) { return (sinh(a) / cosh(a)); } produce the same values as the built-ins. We simplified away the multiplication by 0.5 in the numerator and denominator, and apparently this causes them not to match for exactly 1 out of 13,632 values. So, put it back in, fixing the test, but making our code generation (and precision?) worse.
* | nir/opt_algebraic: Use a more elementary mechanism for lowering ldexpJason Ekstrand2016-01-271-62/+2
| |
* | vtn: Fix atan2 for non-scalars.Kenneth Graunke2016-01-271-24/+3
| | | | | | | | | | | | | | | | | | | | | | The if/then/else block was bogus, as it can only take a scalar condition, and we need to select component-wise. The GLSL IR implementation of atan2 handles this by looping over components, but I decided to try and do it vector-wise, and messed up. For now, just bcsel. It means that we do the atan1 math even if all components hit the quick case, but it works, and presumably at least one component will hit the expensive path anyway.
* | vtn: Fix Modf.Kenneth Graunke2016-01-271-4/+8
| | | | | | | | | | | | | | | | | | We were botching this for negative numbers - floor of a negative rounds the wrong way. Additionally, both results are supposed to retain the sign of the original. To fix this, just take the abs of both values, then put the sign back. There's probably a better way to do this, but this works for now.
* | vtn: Delete references to IMix opcode.Kenneth Graunke2016-01-261-1/+0
| | | | | | | | | | | | This is being removed in SPIR-V. Bugzilla: https://cvs.khronos.org/bugzilla/show_bug.cgi?id=15452
* | nir/spirv: Add proper support for InstanceIndexJason Ekstrand2016-01-261-1/+3
| |
* | nir/lower_io: Lower INSTNACE_INDEXJason Ekstrand2016-01-261-0/+6
| |
* | glsl/enums: Add an enum for Vulkan instance indexJason Ekstrand2016-01-262-0/+8
| |
* | Merge remote-tracking branch 'mattst88/nir-lower-pack-unpack' into vulkanJason Ekstrand2016-01-2521-278/+432
|\ \
| * | nir: Add lowering support for unpacking opcodes.Matt Turner2016-01-252-0/+32
| | |
| * | nir: Add lowering support for packing opcodes.Matt Turner2016-01-254-0/+66
| | |
| * | nir: Add opcodes to extract bytes or words.Matt Turner2016-01-253-0/+28
| | | | | | | | | | | | The uint versions zero extend while the int versions sign extend.
| * | glsl: Remove 2x16 half-precision pack/unpack opcodes.Matt Turner2016-01-256-161/+8
| | | | | | | | | | | | i965/fs was the only consumer, and we're now doing the lowering in NIR.
| * | nir: Add lowering of nir_op_unpack_half_2x16.Matt Turner2016-01-252-4/+29
| | |
| * | nir: Make argument order of unop_convert match binop_convert.Matt Turner2016-01-251-10/+10
| |/ | | | | | | Strangely the return and parameter types were reversed.
| * Revert "glsl: move uniform calculation to link_uniforms"Tapani Pälli2016-01-203-85/+24
| | | | | | | | This reverts commit 4475d8f9169195baefa893b9b147fe20414cda7c.
| * glsl: move uniform calculation to link_uniformsTapani Pälli2016-01-203-24/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch moves uniform calculation to happen during link_uniforms, this is possible with help of UniformRemapTable that has all the reserved locations. Location assignment for implicit locations is changed so that we utilize also the 'holes' that explicit uniform location assignment might have left in UniformRemapTable, this makes it possible to fit more uniforms as previously we were lazy here and wasting space. Fixes following CTS tests: ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array v2: code cleanups, increment NumUniformRemapTable correctly, fix find_empty_block to work properly and add some more comments. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Marta Lofstedt <[email protected]>
| * glsl: add missing explicit_image_format flag to has_layout()Timothy Arceri2016-01-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | Fixes piglit regression after fixes to duplicate layout rules. Previously catching multiple layouts was relying on the code meant to catch duplicates within a single layout(...), this change triggers the rules for multiple layouts. Cc: Mark Janes <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
| * glsl: Don't abbreviate tessellation shader stage names.Kenneth Graunke2016-01-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have a patch that writes shaders as .shader_test files, and it uses this function to create the headers (i.e. [vertex shader]). [tess ctrl shader] isn't a valid shader_runner header - it's spelled out as [tessellation control shader]. There's no real reason to abbreviate it, so spell it out. v2: Rebase on Rob's patches to move the code. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]>
| * glsl: allow multiple layout qualifiers for a single declarationTimothy Arceri2016-01-203-19/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the ARB_shading_language_420pack spec: "More than one layout qualifier may appear in a single declaration. If the same layout-qualifier-name occurs in multiple layout qualifiers for the same declaration, the last one overrides the former ones." The parser was already failing correctly when the extension is not available but testing for duplicates within a single layout qualifier was still causing this to fail when available as both cases share the same function for merging. Here we add a parameter to differentiate between the two uses and apply it to the duplicate test. Acked-by: Matt Turner <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
| * glsl: update parser to allow duplicate default layout qualifiersTimothy Arceri2016-01-203-15/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to only create a single node for each default declaration we add a new boolean parameter to the in/out merge function to only create one once we reach the rightmost layout qualifier. From the ARB_shading_language_420pack spec: "More than one layout qualifier may appear in a single declaration. If the same layout-qualifier-name occurs in multiple layout qualifiers for the same declaration, the last one overrides the former ones." Acked-by: Matt Turner <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
| * glsl: move default layout qualifier rules out of the parserTimothy Arceri2016-01-202-28/+23
| | | | | | | | | | Acked-by: Matt Turner <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
| * glsl: split layout_defaults into specific typesTimothy Arceri2016-01-201-4/+22
| | | | | | | | | | | | | | | | This will allow merging of duplicate layout qualifiers as allowed by ARB_shading_language_420pack Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
| * glsl: allow duplicate layout-qualifier-namesTimothy Arceri2016-01-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is added by ARB_enhanced_layouts although it doesn't fit into any of the six main changes so we enable this independently. From the ARB_enhanced_layouts spec: "More than one layout qualifier may appear in a single declaration. Additionally, the same layout-qualifier-name can occur multiple times within a layout qualifier or across multiple layout qualifiers in the same declaration" Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
| * glsl: Restore Mesa-style to shader_enums.c/h.Matt Turner2016-01-192-16/+24
| |
| * glsl: fix interface block error messageTimothy Arceri2016-01-191-1/+1
| | | | | | | | | | | | | | | | Print the stream value not the pointer to the expression, also use the unsigned format specifier. Cc: 11.1 <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
| * glsl: fix subroutine lowering reusing actual parmatersDave Airlie2016-01-181-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the oglconform tests was crashing here, and it was due to not cloning the actual parameters before creating the new call. This makes a call clone function that does the right things to make sure we clone all the needed info, and points the callee at it. (It differs from ->clone due to this). this may fix https://bugs.freedesktop.org/show_bug.cgi?id=93722, I had this patch in my cts fixes tree, but hadn't had time to make sure I liked it. Cc: "11.0 11.1" <[email protected]> Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
| * glsl: remove special case for detecting stream duplicatesTimothy Arceri2016-01-181-5/+0
| | | | | | | | | | | | | | Any duplicates in a single declaration will already fail the generic duplicates test due to the explicit_stream flag being set. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
| * glsl: add missing explicit_stream flag to has_layout()Timothy Arceri2016-01-181-1/+2
| | | | | | | | | | | | | | | | | | This will allow the ARB_shading_language_420pack rules in glsl_parser.yy for catching duplicate layout qualifiers to be triggered for the stream identifier rather than relying on the code meant to catch duplicates within a single layout(...) Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
| * glsl: fix segfault linking subroutine uniform with explicit locationTimothy Arceri2016-01-181-1/+1
| | | | | | | | | | Reviewed-by: Dave Airlie <[email protected]> Cc: "11.0 11.1" [email protected]
| * nir/print: const_index is signedRob Clark2016-01-161-1/+1
| | | | | | | | | | | | | | Noticed this with $piglit/bin/vp-address-01 Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
| * nir: few missing struct namesRob Clark2016-01-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | nir.h is a bit inconsistent about 'typedef struct {} nir_foo' vs 'typedef struct nir_foo {} nir_foo'. But missing struct name tags is inconvenient when you need a fwd declaration without pulling in all of nir. So add missing struct name tag for nir_variable, and a couple other spots where it would likely be useful. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
| * glsl: Allow implicit int -> uint conversions for bitwise operators (&, ^, |).Kenneth Graunke2016-01-151-8/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ARB has decided that implicit conversions should be performed for bitwise operators in future language revisions. Implementations of current language revisions may or may not perform them. This patch makes Mesa apply implicti conversions even on current language versions. Applications appear to expect this behavior, and there's really no downside to doing so. Fixes shader compilation in Shadow of Mordor. Bugzilla: https://www.khronos.org/bugzilla/show_bug.cgi?id=1405 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Cc: [email protected]
| * glsl: restrict consumer stage condition to modify interpolation typeSamuel Iglesias Gonsálvez2016-01-151-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only modify interpolation type for integer-based varyings or when the consumer is known and different than fragment shader. If we are linking separate shader programs and the consumer is unknown, the consumer could be added later and be a fragment shader. If we modify the interpolation type in this case, we could read wrong values in the fragment shader inputs, as shown in bug 93320. Fixes the following CTS test: ES31-CTS.vertex_attrib_binding.advanced-bindingUpdate Fixes the following dEQP tests: dEQP-GLES31.functional.separate_shader.random.102 dEQP-GLES31.functional.separate_shader.random.111 dEQP-GLES31.functional.separate_shader.random.115 dEQP-GLES31.functional.separate_shader.random.17 dEQP-GLES31.functional.separate_shader.random.22 dEQP-GLES31.functional.separate_shader.random.23 dEQP-GLES31.functional.separate_shader.random.3 dEQP-GLES31.functional.separate_shader.random.32 dEQP-GLES31.functional.separate_shader.random.39 dEQP-GLES31.functional.separate_shader.random.64 dEQP-GLES31.functional.separate_shader.random.73 dEQP-GLES31.functional.separate_shader.random.91 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93320 Signed-off-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
| * nir/builder: Add a nir_build_ivec4() convenience helper.Kenneth Graunke2016-01-141-0/+14
| | | | | | | | | | | | | | | | nir_build_ivec4 is more readable and succinct than using nir_build_imm directly, even if you have C99. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
| * glsl: mark explicit uniforms as explicit in other stages tooTapani Pälli2016-01-151-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If shader declares uniform explicit location in one stage but implicit in another, explicit location should be used. Patch marks implicit uniforms as explicit if they were explicit in previous stage. This makes sure that we don't treat them implicit later when assigning locations. Fixes following CTS test: ES31-CTS.explicit_uniform_location.uniform-loc-implicit-in-some-stages3 v2: move check to cross_validate_globals (Timothy) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* | nir/opcodes: Properly flush denormals in fquantize2f16Jason Ekstrand2016-01-221-1/+1
| |