summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/tgsi
AgeCommit message (Collapse)AuthorFilesLines
2017-03-14tgsi: fix memory leak in tgsi sanity checkDave Airlie1-3/+5
This just fixes this without repeating the code. Reported-by: Li Qiang Cc: "17.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit 69fc7a2c828adbb454072d386a26b568e56dd886)
2017-02-16tgsi-dump: dump label if instruction has oneMarc-André Lureau1-11/+13
The instruction has an associated label when Instruction.Label == 1, as can be seen in ureg_emit_label() or tgsi_build_full_instruction(). This fixes dump generating extra :0 labels on conditionals, and virgl parsing more than the expected tokens and eventually reaching "Illegal command buffer" (when parsing more than a safety margin of 10 we currently have). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit dc2d9b8da14b97376cca9c87e2408763b11bdaa7)
2016-12-14tgsi: fix the src type of TGSI_OPCODE_MEMBARMarek Olšák1-0/+1
It's a literal integer. The next commit will need this. Cc: 13.0 <mesa-stable@lists.freedesktop.org> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (cherry picked from commit 16ba04d6deea4f89cbaec00a001d5c2ac841692b)
2016-10-18gallium/tgsi: add missing #includeMarek Olšák1-0/+2
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-10-13tgsi: fix comment typo in tgsi_ureg.cBrian Paul1-1/+1
Trivial.
2016-10-12tgsi/ureg: add ureg_DECL_output_layoutNicolai Hähnle2-13/+38
For specifying an exact location/component. v2: change the order of parameters (Dave) Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> (v1) Reviewed-by: Dave Airlie <airlied@redhat.com> (v1)
2016-10-12tgsi/ureg: add layout/component input declarationsNicolai Hähnle2-12/+76
v2: change the order of parameters (Dave) Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> (v1) Reviewed-by: Dave Airlie <airlied@redhat.com> (v1)
2016-10-12tgsi/scan: fix num_inputs/num_outputs for shaders with overlapping arraysNicolai Hähnle1-8/+2
v2: remove a tautological left-over assert (Marek) Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> (v1) Reviewed-by: Dave Airlie <airlied@redhat.com> (v1)
2016-10-05tgsi/scan: don't set interp flags for inputs only used by INTERP (v2)Marek Olšák1-48/+57
(v1 pushed, then reverted) This fixes 9 randomly failing tests on radeonsi: GL45-CTS.shader_multisample_interpolation.render.interpolate_at_centroid.* v2: use input_interpolate[input] (correct) instead of input_interpolate[index] (incorrect) Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-09-21gallivm/llvmpipe: prepare support for ARB_gpu_shader_int64.Dave Airlie1-1/+2
This enables 64-bit integer support in gallivm and llvmpipe. v2: add conversion opcodes. v3: - PIPE_CAP_INT64 is not there yet - restrict DIV/MOD defaults to the CPU, as for 32 bits - TGSI_OPCODE_I2U64 becomes TGSI_OPCODE_U2I64 Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-09-21tgsi/softpipe: prepare ARB_gpu_shader_int64 support. (v3)Dave Airlie1-132/+541
This adds all the opcodes to tgsi_exec for softpipe to use. v2: add conversion opcodes. v3: - no PIPE_CAP_INT64 yet - change TGSI_OPCODE_I2U64 to TGSI_OPCODE_U2I64 Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-09-21gallium/tgsi: add support for 64-bit integer immediates.Dave Airlie6-2/+115
This adds support to TGSI for 64-bit integer immediates. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-09-21gallium: add opcode and types for 64-bit integers. (v3)Dave Airlie2-11/+85
This just adds the basic support for 64-bit opcodes, and the new types. v2: add conversion opcodes. add documentation. v3: - make docs more consistent - change TGSI_OPCODE_I2U64 to TGSI_OPCODE_U2I64 Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v2) Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-09-17tgsi: Enable returns from within loopsLars Hamre1-0/+4
Fixes the following piglit test (for softpipe): /spec/glsl-1.10/execution/fs-loop-return Signed-off-by: Lars Hamre <chemecse@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2016-09-15Revert "tgsi/scan: don't set interp flags for inputs only used by INTERP ↵Marek Olšák1-57/+48
instructions" This reverts commit 524fd55d2d973f50a5d8bc2255684610f5faae32. Reason: https://bugs.freedesktop.org/show_bug.cgi?id=97808
2016-09-13tgsi/scan: don't set interp flags for inputs only used by INTERP instructionsMarek Olšák1-48/+57
radeonsi depends on the interp flags a little bit too much. This fixes 9 randomly failing tests: GL45-CTS.shader_multisample_interpolation.render.interpolate_at_centroid.* Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-08-29tgsi/scan: remember sampler view typesMarek Olšák2-0/+5
Reviewed-by: Brian Paul <brianp@vmware.com>
2016-08-17tgsi/scan: add tgsi_scan_arraysNicolai Hähnle2-0/+93
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-07-02tgsi: Add WORK_DIM System ValueHans de Goede1-0/+1
Add a new WORK_DIM SV type, this is will return the grid dimensions (1-4) for compute (opencl) kernels. This is necessary to implement the opencl get_work_dim() function. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2016-06-11gallium/tgsi: add 64-bitness type check function.Dave Airlie1-0/+7
Currently this just doubles, but we'll convert users to this so making adding 64-bit integers easier. Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-06-07tgsi/scan: add uses_derivatives (v2)Nicolai Hähnle2-0/+31
v2: - TG4 does not calculate derivatives (Ilia) - also handle SAMPLE* instructions (Roland) Cc: 12.0 <mesa-stable@lists.freedesktop.org> Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v1) Reviewed-by: Brian Paul <brianp@vmware.com> (v1) Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2016-06-06gallium: add VOTE_* opcodes to implement GL_ARB_shader_group_voteIlia Mirkin1-0/+3
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-06-06tgsi: fix mixed data type comparison in tgsi_point_sprite.cCharmaine Lee1-3/+3
Cast the unsigned semantic index to integer datatype before comparing to max_generic, otherwise, max_generic which is initialized to -1 will be converted to unsigned int before the comparison, causing a wrong semantic index to be assigned to a shader output. Fixes the assert running TurboCAD_gl.trace. (VMware bug 1667265) Also tested with glretrace, mesa demos pointblast, spriteblast and pointcoord. v2: use the original max_generic variable but add the (int) cast to the semantic index, as suggested by Brian. Reviewed-by: Brian Paul <brianp@vmware.com>
2016-06-06tgsi: use truncf in micro_truncLars Hamre1-4/+4
Switches to using truncf in micro_trunc. Fixes the following piglit tests (for softpipe): /spec/glsl-1.30/execution/built-in-functions/... fs-trunc-float fs-trunc-vec2 fs-trunc-vec3 fs-trunc-vec4 vs-trunc-float vs-trunc-vec2 vs-trunc-vec3 vs-trunc-vec4 /spec/glsl-1.50/execution/built-in-functions/... gs-trunc-float gs-trunc-vec2 gs-trunc-vec3 gs-trunc-vec4 Signed-off-by: Lars Hamre <chemecse@gmail.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2016-05-26tgsi: fix coverity out-of-bounds warningRob Clark1-0/+3
CID 1271532 (#1 of 1): Out-of-bounds read (OVERRUN)34. overrun-local: Overrunning array of 2 16-byte elements at element index 2 (byte offset 32) by dereferencing pointer &inst.Dst[i]. Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com>
2016-05-26tgsi: fix out of bounds accessRob Clark1-1/+1
Not sure why coverity calls this an out-of-bounds read vs out-of-bounds write. CID 1358920 (#1 of 1): Out-of-bounds read (OVERRUN)9. overrun-local: Overrunning array r of 3 16-byte elements at element index 3 (byte offset 48) using index chan (which evaluates to 3). Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com>
2016-05-26gallium/tgsi: use _mesa_roundevenf in micro_rndLars Hamre1-4/+5
Fixes the following piglit tests (for softpipe): /spec/glsl-1.30/execution/built-in-functions/... fs-roundeven-float fs-roundeven-vec2 fs-roundeven-vec3 fs-roundeven-vec4 vs-roundeven-float vs-roundeven-vec2 vs-roundeven-vec3 vs-roundeven-vec4 /spec/glsl-1.50/execution/built-in-functions/... gs-roundeven-float gs-roundeven-vec2 gs-roundeven-vec3 gs-roundeven-vec4 Signed-off-by: Lars Hamre <chemecse@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2016-05-25tgsi: print TGSI_PROPERTY_NEXT_SHADER value as string, not an integerBrian Paul2-0/+25
Print "GEOM" instead of "2", for example. v2: also update the text parsing code, per Ilia. Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-05-25tgsi: s/6/PIPE_SHADER_TYPES/ for tgsi_processor_type_names array sizeBrian Paul1-1/+1
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-05-23tgsi: remove culldist semantic.Dave Airlie1-1/+0
This isn't used anymore in the tree, culldist's are part of the clipdist semantic, we could in theory rename it, but I'm not sure there is much point, and I'd have to be careful with virgl. Reviewed-by: Roland Scheidegger <sroland@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-05-23draw: stop using CULLDIST semantic.Dave Airlie1-2/+1
The way the HW works doesn't really fit with having two semantics for this. The GLSL compiler emits 2 vec4s and two properties, this makes draw use those instead of CULLDIST semantics. Reviewed-by: Roland Scheidegger <sroland@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-05-11gallium: refactor pipe_shader_state to support multiple IR'sRob Clark1-3/+1
The goal is to allow the pipe driver to request something other than TGSI, but detect whether what is getting is TGSI vs what it requested. The pipe drivers will always have to support TGSI (and convert that into whatever it is that they prefer), but in some cases we should be able to skip the TGSI intermediate step (such as glsl->nir vs glsl->tgsi->nir). I think pipe_compute_state should get similar treatment. Currently, afaict, it has one user and one consumer, which has allowed it to be sloppy wrt. supporting alternative IR's. Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-05-07gallium: fix various undefined left shifts into sign bitNicolai Hähnle1-1/+1
Funnily enough, some of these were turned into a compile-time error by gcc with -fsanitize=undefined ("initializer is not a constant"). Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-05-01tgsi: initialize stack allocated structWuZhen1-0/+7
Cc: "11.2 11.1" <mesa-stable@lists.freedesktop.org> Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-04-29tgsi/text: fix parsing of memory instructionsNicolai Hähnle1-13/+27
Properly handle Target and Format parameters when present. Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-04-29tgsi/text: add str_match_name_from_arrayNicolai Hähnle1-0/+18
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-04-29tgsi/text: add str_match_format helper functionNicolai Hähnle1-9/+22
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-04-29tgsi/build: pass Memory.Texture and .Format through tgsi_build_full_instructionNicolai Hähnle1-2/+6
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-04-29tgsi/dump: signal nospace when the last print exceeded the sizeNicolai Hähnle1-4/+6
Previously, there was a bug where nospace wasn't signalled if it just so happened that the very last print exceeded the available space. Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-04-29tgsi/dump: shared dump_ctx initializationNicolai Hähnle1-31/+17
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-04-27tgsi: s/Elements/ARRAY_SIZE/Brian Paul6-28/+28
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2016-04-27tgsi/exec: initialise SysSemanticToIndex array to -1Dave Airlie1-0/+3
We want to use the SysSemanticToIndex to tell if we've seen the semantics at all. Acked-by: Roland Scheidegger <sroland@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-04-27tgsi/exec: implement restartable machine.Dave Airlie2-17/+35
This lets us restart the machine at a PC value, and exits the machine when we hit a barrier. Compute shaders will then execute all the threads up to the barrier, then restart the machines after the barrier once all are done. v2: comment the code a bit, change return types. Acked-by: Roland Scheidegger <sroland@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-04-27tgsi/exec: make inputs/outputs optional for compute shaders.Dave Airlie1-19/+24
compute shaders don't need input/outputs so don't bother allocating memory for these. Acked-by: Roland Scheidegger <sroland@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-04-27tgsi/exec: implement load/store/atomic on MEMORY.Dave Airlie2-3/+150
This implements basic load/store/atomic ops on MEMORY types for compute shaders. Acked-by: Roland Scheidegger <sroland@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-04-27tgsi/exec: split out setting up masks to separate functionDave Airlie1-9/+14
This is just a cleanup that will make later changes easier to make. Acked-by: Roland Scheidegger <sroland@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-04-27tgsi: accept a starting PC value for exec machine.Dave Airlie2-2/+2
This will be used later to restart barriered execution threads in compute, for now we just want to change the API. Acked-by: Roland Scheidegger <sroland@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-04-27tgsi: move to using vector for system values.Dave Airlie2-2/+2
For compute support some of the system values are .xyz types, so move to using a vector instead of a single channel. [airlied: squash swizzle fix from compute series]. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-04-27tgsi/exec: fix system value handling.Dave Airlie1-3/+5
a) SysSemanticToIndex needs to be indexed with the semantic name not the decl->Declaration.Semantic. b) doing this in run is too late, as the mappings are all setup prior to run in the execs. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-04-26tgsi: pass a shader type to the machine create and clean up.Dave Airlie2-12/+12
There was definitely bugs here mixing up the PIPE_ and TGSI_ defines, hopefully they didn't cause any problems, since mostly it was special cases for GEOMETRY. This clarifies at shader machine create what type of shader this machine will execute. This is needed also for compute shaders where we don't want to allocate inputs/outputs. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>