aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/program
Commit message (Collapse)AuthorAgeFilesLines
* glsl: Add ir node for barrierChris Forbes2015-06-121-0/+7
| | | | | | | | | v2: * Changes suggested by mattst88 [[email protected]: Add nir support] Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ben Widawsky <[email protected]>
* mesa; add a dummy _mesa_error_no_memory() symbol to libglsl_utilEmil Velikov2015-06-121-0/+30
| | | | | | | | | | | | Rather than forcing everyone to provide their own definition of the symbol provide a common (dummy) one. This helps us resolve the build of the standalone pipe-drivers (amongst others), which are missing the symbol. Cc: Rob Clark <[email protected]> Cc: "10.6" <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* prog_to_nir: Fix fragment depth writes.Kenneth Graunke2015-06-061-3/+19
| | | | | | | | | | | | | | | | | | | In the ARB_fragment_program specification, the result.depth output variable is treated as a vec4, where the fragment depth is stored in the .z component, and the other three components are undefined. This is different than GLSL, which uses a scalar value (gl_FragDepth). To make this consistent for driver backends, this patch makes prog_to_nir use a scalar output variable for FRAG_RESULT_DEPTH, moving result.depth.z into the first component. Fixes Glean's fragProg1 "Z-write test" subtest. Cc: [email protected] Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90000 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: use GL_GEOMETRY_PROGRAM_NV instead of MESA_GEOMETRY_PROGRAMMarek Olšák2015-06-052-7/+7
| | | | | | | | There's no reason to use our own definition. Tessellation will use the NV definitions too. Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove useless gl_compute_program_state::CurrentMarek Olšák2015-06-051-3/+0
| | | | | | | This is for user assembly shaders only (not GLSL). We won't support those. Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove unused geometry shader variablesMarek Olšák2015-06-051-9/+0
| | | | | | | These states are for GS assembly shaders only. We don't support those. Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* prog_to_nir: Make RSQ properly take the absolute value of its argument.Kenneth Graunke2015-06-041-1/+2
| | | | | | | | | | | | | | | | | I just botched this when writing the original code. From the ARB_vertex_program specification: "The RSQ instruction approximates the reciprocal of the square root of the absolute value of the scalar operand and replicates it to all four components of the result vector." Fixes a Glean vertProg1 subtest: RSQ test 2 (reciprocal square root of negative value) Cc: [email protected] Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90547 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* main: fix a regression in uniform handling introduced by 87a4bc5Martin Peres2015-06-041-1/+1
| | | | | | | | The comment was accurate but the condition was reversed... Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Signed-off-by: Martin Peres <[email protected]>
* mesa: reference built-in uniforms into gl_uniform_storageMartin Peres2015-06-041-2/+7
| | | | | | | | | | | | | | | This change introduces a new field in gl_uniform_storage to explicitely say that a uniform is built-in. In the case where it is, no storage is defined to make it clear that it is read-only from the mesa side. I fixed all the places in the code that made use of the structure that I changed. Any place making a wrong assumption and using the storage straight away will just crash. This patch seems to implement the path of least resistance towards listing built-in uniforms in GL_ACTIVE_UNIFORM (and other APIs). Reviewed-by: Tapani Pälli <[email protected]> Signed-off-by: Martin Peres <[email protected]>
* program: Replace gl_inst_opcode with enum prog_opcode.Matt Turner2015-06-034-16/+16
| | | | | | Both were introduced at the same time. I'm not sure why we needed two. Reviewed-by: Brian Paul <[email protected]>
* program: Remove dead Aux field from prog_instruction.Matt Turner2015-06-031-3/+0
| | | | | | | Appears to have been last used by the i965 driver (removed by commit 098acf6c). Reviewed-by: Brian Paul <[email protected]>
* program: Shrink and rename SaturateMode field to Saturate.Matt Turner2015-06-0310-30/+18
| | | | | | | | | | | It was 2 bits to accommodate SATURATE_PLUS_MINUS_ONE (removed by commit 09b566e1). A similar change was made to TGSI recently in commit e1c4e8aa. Reducing the size from 2 bits to 1 reduces the size of the bit fields from 17 bits to 16, which is a much nicer number. Reviewed-by: Brian Paul <[email protected]>
* prog_to_nir: Remove OPCODE_MOV special case.Matt Turner2015-06-021-1/+1
| | | | | | OPCODE_MOV is in the op_trans[] array. Reviewed-by: Kenneth Graunke <[email protected]>
* prog_to_nir: Remove from op_trans[] opcodes handled in the switch.Matt Turner2015-06-021-7/+7
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* Fix an unused variable warningJason Ekstrand2015-05-251-2/+0
| | | | Trivial. Deleted the 2 unneeded lines.
* prog_to_nir: Use a variable for uniform dataJason Ekstrand2015-05-231-30/+35
| | | | | | | | | | | | | Previously, the prog_to_nir pass was directly generating uniform load/store intrinsics. This converts it to use a single giant "parameters" variable and we now depend on lowering to get the uniform load/store intrinsics. One advantage of this is that we now have one code-path after we do the initial conversion into NIR. No shader-db changes. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* main: Refactor _mesa_[update|get]_clamp_fragment_color.Laura Ekstrand2015-05-141-2/+2
| | | | | Reviewed-by: Fredrik Höglund <[email protected]> Signed-off-by: Fredrik Höglund <[email protected]>
* prog_to_nir: OPCODE_EXP is not nir_op_fexpIan Romanick2015-05-081-1/+1
| | | | | | | | | It's a weird thing that provides some values related to 2**x. It's also already handled by a case in the switch. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Acked-by: Jason Ekstrand <[email protected]>
* mesa/cs: Update program.c for compute shaders.Paul Berry2015-05-021-0/+3
| | | | | | Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa/cs: Add inline functions for dealing with compute shaders.Paul Berry2015-05-021-0/+22
| | | | | | Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* Fix a few typosZoë Blade2015-04-272-3/+3
| | | | Reviewed-by: Francisco Jerez <[email protected]>
* android: export the path of the generated headersChih-Wei Huang2015-04-221-0/+2
| | | | | | | The modules need the headers can get the path automatically. Signed-off-by: Chih-Wei Huang <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* android: fix the building rules for Android 5.0Chih-Wei Huang2015-04-221-2/+1
| | | | | | | | | | | | | | | | | Android 5.0 allows modules to generate source into $OUT/gen, which will then be copied into $OUT/obj and $OUT/obj_$(TARGET_2ND_ARCH) as necessary. Modules will need to change calls to local-intermediates-dir into local-generated-sources-dir. The patch changes local-intermediates-dir into local-generated-sources-dir. If the Android version is less than 5.0, fallback to local-intermediates-dir. The patch also fixes the 64-bit building issue of Android 5.0. v2 [Emil Velikov] - Keep the LOCAL_UNSTRIPPED_PATH variable. Signed-off-by: Chih-Wei Huang <[email protected]>
* android: fix a building error of libmesa_programChih-Wei Huang2015-04-221-0/+1
| | | | | | | Add libmesa_glsl to LOCAL_STATIC_LIBRARIES to get its exported include path (for nir_opcodes.h). Signed-off-by: Chih-Wei Huang <[email protected]>
* android: build the Mesa IR -> NIR translatorEmil Velikov2015-04-221-1/+2
| | | | Signed-off-by: Emil Velikov <[email protected]>
* android: add gallium dirs to more places in the treeEmil Velikov2015-04-221-1/+3
| | | | | | | | Similar to e8c5cbfd921(mesa: Add gallium include dirs to more parts of the tree.) Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Chih-Wei Huang <[email protected]>
* android: add $(mesa_top)/src include to the whole of mesaEmil Velikov2015-04-221-1/+0
| | | | | | | | | Many parts of mesa already have the include with others depending on it but it's missing. Add it once at the top makefile and be done with it. Cc: "10.4 10.5" <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Chih-Wei Huang <[email protected]>
* nir: Fix per-component negation in prog_to_nir's SWZ handling.Kenneth Graunke2015-04-211-7/+18
| | | | | | | | | | I missed the fact that the ARB_fragment_program SWZ instruction allows per-component negation. To fix this, move Abs/Negate handling into both the simple case and the SWZ case's per-component loop. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90000 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa/program: remove dead codeMarek Olšák2015-04-162-81/+0
| | | | Reviewed-by: Matt Turner <[email protected]>
* i965: Create NIR during LinkShader() and ProgramStringNotify().Kenneth Graunke2015-04-111-0/+5
| | | | | | | | | | | | | | | | | | | | | | | Previously, we translated into NIR and did all the optimizations and lowering as part of running fs_visitor. This meant that we did all of that work twice for fragment shaders - once for SIMD8, and again for SIMD16. We also had to redo it every time we hit a state based recompile. We now generate NIR once at link time. ARB programs don't have linking, so we instead generate it at ProgramStringNotify time. Mesa's fixed function vertex program handling doesn't bother to inform the driver about new programs at all (which is rather mean), so we generate NIR at the last minute, if it hasn't happened already. shader-db runs ~9.4% faster on my i7-5600U, with a release build. v2: Check NirOptions != NULL in ProgramStringNotify(). Don't bother using _mesa_program_enum_to_shader_stage as we already know it. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Constify prog_to_nir's gl_program pointer.Kenneth Graunke2015-04-102-3/+3
| | | | | | | | | prog_to_nir should not modify the incoming Mesa IR program - just translate it. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* nir: Allocate dereferences out of their parent instruction or deref.Kenneth Graunke2015-04-071-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Jason pointed out that variable dereferences in NIR are really part of their parent instruction, and should have the same lifetime. Unlike in GLSL IR, they're not used very often - just for intrinsic variables, call parameters & return, and indirect samplers for texturing. Also, nir_deref_var is the top-level concept, and nir_deref_array/nir_deref_record are child nodes. This patch attempts to allocate nir_deref_vars out of their parent instruction, and any sub-dereferences out of their parent deref. It enforces these restrictions in the validator as well. This means that freeing an instruction should free its associated dereference chain as well. The memory sweeper pass can also happily ignore them. v2: Rename make_deref to evaluate_deref and make it take a nir_instr * instead of void *. This involves adding &instr->instr everywhere. (Requested by Jason Ekstrand.) Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* program: Remove unused emit_scs().Matt Turner2015-04-061-98/+0
| | | | | | | Was only used by the sin_reduced/cos_reduced cases, which themselves were impossible to reach. Reviewed-by: Jason Ekstrand <[email protected]>
* glsl: Remove never used sin_reduced/cos_reduced.Matt Turner2015-04-061-6/+0
| | | | | | | | These were added in commit f2616e56, presumably in preparation for translating ARB vp/fp into GLSL IR. That never happened, and neither did a lowering pass that actually generated these instructions. Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Use _mesa_flsll(InputsRead) in prog->nir.Kenneth Graunke2015-04-011-2/+2
| | | | | | | | | | | | | | | | InputsRead is a 64-bit bitfield. Using _mesa_fls would silently truncate off the high bits, claiming inputs 32..56 (VARYING_SLOT_MAX) were never read. Using <= here was a hack I threw in at the last minute to fix programs which happened to use input slot 32. Switch back to using < now that the underlying problem is fixed. Fixes crashes in "Euro Truck Simulator 2" when using prog->nir, which uses input slot 33. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* nir: In prog->nir, don't wrap dot products with ptn_channel(..., X).Kenneth Graunke2015-04-011-4/+4
| | | | | | | | ptn_move_dest and nir_fadd already take care of replicating the last channel out, so we can just use a scalar and skip splatting it. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: remove unneeded #include of colormac.hBrian Paul2015-04-011-1/+0
| | | | | Acked-by: Matt Turner <[email protected]> Reviewed-by: Mark Janes <[email protected]>
* nir: Implement a Mesa IR -> NIR translator.Kenneth Graunke2015-03-273-0/+1136
| | | | | | | | | | | | | | | | | | | Shamelessly ripped off from Eric Anholt's tgsi_to_nir pass. This is not built on SCons, like the rest of NIR. v2: - Delete redundant c->s, c->impl, and c->cf_node_list pointers (Ken) - Use nir_builder directly instead of ptn_compile in more places (Ken) - Drop 'struct' keyword in front of nir_builder (ken) - Add a file level Doxygen comment (Ken) - Use scalar constants instead of splatting (Eric) - Use nir_builder helpers for constants, moves, and swizzles (Connor) v3: Minor indentation improvements. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: reorder prog_instructionDave Airlie2015-03-211-3/+3
| | | | | | | | reduces size from 64 to 56 bytes. Acked-by: Brian Paul <[email protected]> Reviewed-by: Alex Deucher [email protected]> Signed-off-by: Dave Airlie <[email protected]>
* mesa: use strdup() instead of _mesa_strdup()Brian Paul2015-03-114-6/+6
| | | | | | | | | We were already using strdup() in various places in Mesa. Get rid of the _mesa_strdup() wrapper. All the callers pass a non-NULL argument so the NULL check isn't needed either. Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: include stdio.h where neededBrian Paul2015-03-051-0/+1
| | | | | | | Instead of relying on glapi.h or some other header to provide it. Acked-by: Matt Turner <[email protected]> Reviewed-by: José Fonseca <[email protected]>
* mesa/program: replace Elements() with ARRAY_SIZE()Brian Paul2015-03-024-12/+12
| | | | Acked-by: Ilia Mirkin <[email protected]>
* mesa: trim down includes of compiler.hBrian Paul2015-03-021-1/+0
| | | | | | | In some cases, glheader.h is the right #include. Also remove some instances of struct _glapi_table declarations. Acked-by: Matt Turner <[email protected]>
* mesa: move ONE_DIV_SQRT_LN2 to prog_statevars.cBrian Paul2015-02-281-0/+3
| | | | Reviewed-by: Ian Romanick <[email protected]>
* mesa: trim down #includes in compiler.hBrian Paul2015-02-261-1/+1
| | | | | | | | Don't include stuff we don't need. Fix a few #includes elsewhere to keep thing building. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: include stdarg.h only where it's usedBrian Paul2015-02-261-0/+2
| | | | | Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: remove INV_SQRTF() macroBrian Paul2015-02-241-1/+1
| | | | | Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: replace FABSF with fabsfBrian Paul2015-02-241-15/+15
| | | | Reviewed-by: Matt Turner <[email protected]>
* mesa: replace FLOORF with floorfBrian Paul2015-02-241-9/+9
| | | | Reviewed-by: Matt Turner <[email protected]>
* mesa: replace FREXPF, LDEXPF with frexpf, ldexpfBrian Paul2015-02-241-2/+3
| | | | | | Start getting rid of some imports.h macros. Use the c99 functions instead. Reviewed-by: Matt Turner <[email protected]>