summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/tgsi
AgeCommit message (Collapse)AuthorFilesLines
2016-04-22gallium: remove helpers converting to/from TGSI_PROCESSOR_*Marek Olšák1-2/+1
Acked-by: Jose Fonseca <jfonseca@vmware.com>
2016-04-22gallium: use PIPE_SHADER_* everywhere, remove TGSI_PROCESSOR_*Marek Olšák11-72/+72
Acked-by: Jose Fonseca <jfonseca@vmware.com>
2016-04-19tgsi/lowering: improved lowering for LRPRussell King1-35/+20
Provide an improved lowering for LRP, which can be implemented in two MAD instructions with a bit of rearranging of the equation, rather than the literal implementation of two multiplies, an add and a subtract. Signed-off-by: Russell King <rmk@arm.linux.org.uk> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-04-19tgsi/lowering: improved lowering for XPDRussell King1-22/+13
Improve XPD lowering to consume less instructions by using the MAD instruction to perform the multiply and subtraction together. Signed-off-by: Russell King <rmk@arm.linux.org.uk> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-04-19tgsi/lowering: add support for lowering TRUNCRussell King2-0/+85
Add support for lowering TRUNC using the following sequence: FRC tmpA, |src| SUB tmpA, |src|, tmpA CMP dst, -tmpA, tmpA Note that this is incompatible with FRC lowering. Signed-off-by: Russell King <rmk@arm.linux.org.uk> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-04-19tgsi/lowering: add support for lowering FLR and CEILRussell King2-20/+149
Add support for lowering FLR and CEIL to FRC/SUB and FRC/ADD instructions for GPUs that support FRC but not FLR or CEIL. Since these uses FRC, it is invalid to ask for FLR or CEIL to be lowered along with FRC, so add an assert to catch this invalid configuration. We also need to deal with FLR instructions emitted by the lowering code. Fix these up with the FRC+SUB equivalent when FLR lowering is enabled. Signed-off-by: Russell King <rmk@arm.linux.org.uk> Reviewed-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> Signed-off-by: Rob Clark <robclark@freedesktop.org>
2016-04-13tgsi: fix buffer overflowThomas Hindoe Paaboel Andersen1-1/+1
Increase r to four channels as rgba is written to it Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-04-12gallium: Use STATIC_ASSERT whenever possible.Jose Fonseca2-2/+2
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2016-04-12softpipe: add SSBO/shader atomics support.Dave Airlie1-1/+2
This adds support for the features requires for ARB_shader_storage_buffer_object and ARB_shader_atomic_counters, ARB_shader_atomic_counter_ops. [airlied: some cleanups applied] Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-04-12tgsi: add support for buffer/atomic operations to tgsi_exec.Dave Airlie2-10/+241
This adds support for doing load/store/atomic operations on buffer objects. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-04-07tgsi/scan: add an assert for the size of the samplers_declared bitfieldNicolai Hähnle1-1/+2
The literal 1 is a (signed) int, and shifting into the sign bit is undefined in C, so change occurences of 1 to 1u. Reviewed-by: Brian Paul <brianp@vmware.com>
2016-04-02tgsi: add simple tgsi_is_msaa_target() helperBrian Paul1-0/+8
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2016-04-02gallium: add threads per block TGSI propertyBas Nieuwenhuizen1-0/+3
The value 0 for unknown has been chosen to so that drivers using tgsi_scan_shader do not need to detect missing properties if they zero-initialize the struct. Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-04-01tgsi: silence compiler warning in fetch_sampler_unit()Samuel Pitoiset1-1/+1
The unit variable can be used uninitialized. Fixes: 24e77cb09 ("tgsi: handle indirect sampler arrays. (v2)") Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-04-01tgsi: fix out of bounds access in exec_atomop()Samuel Pitoiset1-1/+1
The number of channels must be 4 for all RGBA components. Fixes: 22d129601 ("tgsi: add support for image operations to tgsi_exec. (v2.1)") Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-03-31tgsi: split tgsi_util_get_texture_coord_dim() function into twoBrian Paul3-41/+38
It was kind of overloaded, returning two different things. Now get the index of the shadow reference src register with a new tgsi_util_get_shadow_ref_src_index() function. To verify the new code, I added some temp/debug code which looped over all TGSI_TEXTURE_x values, calling the old function and new and checking that the returned indexes matched. Also tested piglit "shadow" tests with softpipe/llvmpipe. No testing of ilo and radeonsi changes. Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-03-31tgsi: skip texture query opcodes when examining texture targetsBrian Paul1-1/+15
Should fix the assertion in piglit spec@arb_gpu_shader5@texturegather@fs-r-none-shadow-2d when the TXQ instruction specifies a 2D target but the sampler view was declared as SHADOW2D. Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2016-03-31softpipe: add image support to softpipe (v3)Dave Airlie1-1/+3
This adds support for ARB_shader_image_load_store to softpipe. v2: add RESQ support (Ilia) v3: constify, cleanup internals, add some comments (Brian). Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-03-31tgsi: add support for image operations to tgsi_exec. (v2.1)Dave Airlie2-2/+315
This adds support for load/store/atomic operations on images along with image tracking support. v2: add RESQ support. (Ilia) v2.1: constify interface (Brian) split get_image_coord_dim (Brian) Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-03-31tgsi: introduce NonHelperMaskDave Airlie2-0/+5
This is a mask of which of the current 2x2 grid are non-helper invocations. This allows us to mask off the helper invocations later for the image operations. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-03-31tgsi_exec: handle execmask when doing indirect lookupsDave Airlie1-3/+9
Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-03-31tgsi_exec: add support for up to 3 address registers (v2)Dave Airlie1-2/+3
v2: be consistent with other definitions. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-03-30tgsi: (trivial) only verify target for is_tex instructionsRoland Scheidegger1-8/+7
d3d10 state tracker does not encode (valid) target (only offsets are really used from the texture bits), since that information always comes from the sview dcl, and not the instruction (note the meaning of target is actually slightly different between gl and d3d10 in any case, because d3d10 target does never include shadow bit). Also move the msaa sampler identification as well - would need to set that on the sview not sampler, so while this does not fix it make it at least obvious it won't work with sample instructions.
2016-03-29tgsi: simplify tgsi_shader_info::is_msaa_sampler checkingBrian Paul1-3/+2
We assert that fullinst->Instruction.Texture != 0 above so no need to check it in the conditional. We also have the fullinst->Texture.Texture value in a local variable, so use it. Reviewed-by: José Fonseca <jfonseca@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2016-03-29tgsi: collect texture sampler target info in tgsi_scan_shader()Brian Paul2-2/+37
Texture sample instructions specify a sampler unit and texture target such as "1D", "2D", "CUBE", etc. Sampler view declarations also specify the sampler unit and texture target. This patch checks that the texture instructions agree with the declarations and collects the texture target type for each sampler unit. v2: only compare instruction's texture target to the sampler view declaration target if the instruction is a TEX instruction, not a SAMPLE instruction. Reviewed-by: José Fonseca <jfonseca@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2016-03-22tgsi: drop unused set_exec/kill_mask interfaces.Dave Airlie1-25/+0
These don't get used and haven't been in git history from what I can see, so drop them. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-03-21tgsi/scan: add writes_memory to flag presence of stores or atomicsNicolai Hähnle2-4/+9
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-03-21tgsi/scan: track which shader images are really buffersNicolai Hähnle2-0/+7
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-03-21tgsi/scan: add images_writemaskNicolai Hähnle2-2/+21
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-03-21gallium/tgsi: pass TGSI tex target to tgsi_transform_tex_inst()Brian Paul1-7/+10
Instead of hard-coded 2D tex target in tgsi_transform_tex_2d_inst() Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2016-03-21tgsi: Add support for global / private / input MEMORYHans de Goede5-20/+38
Extend the MEMORY file support to differentiate between global, private and shared memory, as well as "input" memory. "MEMORY[x], INPUT" is intended to access OpenCL kernel parameters, a special memory type is added for this, since the actual storage of these (e.g. UBO-s) may differ per implementation. The uploading of kernel parameters is handled by launch_grid, "MEMORY[x], INPUT" allows drivers to use an access mechanism for parameter reads which matches with the upload method. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> (v1) Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v2)
2016-03-21tgsi: Fix decl.Atomic and .Shared not propagating when parsing tgsi textHans de Goede1-0/+6
When support for decl.Atomic and .Shared was added, tgsi_build_declaration was not updated to propagate these properly. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> (v1) Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v2)
2016-03-20tgsi: Fix return of uninitialized memory in tgsi_*_instruction_memoryHans de Goede1-0/+4
tgsi_default_instruction_memory / tgsi_build_instruction_memory were returning uninitialized memory for tgsi_instruction_memory.Texture and tgsi_instruction_memory.Format. Note 0 means not set, and thus is a correct default initializer for these. Fixes: 3243b6fc97 ("tgsi: add Texture and Format to tgsi_instruction_memory") Cc: Nicolai Hähnle <nicolai.haehnle@amd.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-03-19gallium: add TGSI property NEXT_SHADERMarek Olšák3-0/+22
Radeonsi needs to know which shader stage will execute after a shader in order to make the best decision about which shader variant to compile first. This is only set for VS and TES, because we don't need it elsewhere. VS has 3 variants: - next shader is FS - next shader is GS - next shader is TCS TES has 2 variants: - next shader is FS - next shader is GS Currently, radeonsi always assumes the next shader is FS, which is suboptimal, since st/mesa always knows which shader is next if the GLSL program is not a "separate shader". By default, ureg always sets "next shader is FS". Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-03-18tgsi: add tgsi_transform_op3_inst() functionBrian Paul1-0/+34
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2016-03-14tgsi: add tgsi_full_src_register_from_dst helper functionNicolai Hähnle2-0/+20
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-03-14tgsi: add TGSI_PROPERTY_FS_EARLY_DEPTH_STENCILNicolai Hähnle1-0/+1
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-03-14st/glsl_to_tgsi: provide Texture and Format information for image opsNicolai Hähnle2-5/+15
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-03-14tgsi: add Texture and Format to tgsi_instruction_memoryNicolai Hähnle1-0/+8
Frontends should have this information readily available, and it simplifies image LOAD/STORE/ATOM* handling especially with indirect image access. Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-03-09gallium: do not wrap header inclusion inEmil Velikov2-4/+4
Add one missing extern C guard within include/pipe/p_video_enums.h, and remove the wrapping throughout gallium. On Haiku one could even use the gallium debug_printf() although that's another topic. v2: Leave dbghelp.h as is (Jose) Cc: Jose Fonseca <jfonseca@vmware.com> Cc: Brian Paul <brianp@vmware.com> Cc: Alexander von Gluck IV <kallisti5@unixzen.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2016-03-09tgsi: set correct output mode for RESQNicolai Hähnle1-1/+1
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-03-07tgsi: fix parsing of shared memory declarationsSamuel Pitoiset1-1/+3
The SHARED TGSI keyword is only allowed with TGSI_FILE_MEMORY and not with TGSI_FILE_BUFFER. I have found this by using the nouveau_compiler from command line. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Cc: "11.2" <mesa-stable@lists.freedesktop.org>
2016-03-01tgsi/scan: count memory instructionsMarek Olšák2-0/+20
for radeonsi Reviewed-by: Brian Paul <brianp@vmware.com>
2016-02-23tgsi/scan: handle holes between VS inputs, assert-fail in other casesMarek Olšák1-1/+9
"st/mesa: overhaul vertex setup for clearing, glDrawPixels, glBitmap" added a vertex shader declaring IN[0] and IN[2], but not IN[1]. Drivers relying on tgsi_shader_info can't handle holes in declarations, because tgsi_shader_info doesn't track that. This is just a quick workaround meant for stable that will work for vertex shaders. This fixes radeonsi DrawPixels and CopyPixels crashes. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Brian Paul <brianp@vmware.com>
2016-02-18gallivm, tgsi: provide fake sample_i_ms implementationsRoland Scheidegger1-3/+5
Just like the rest of the msaa "implementation" it's just fake for now... Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2016-02-15tgsi: show textual format representationIlia Mirkin2-4/+11
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-02-15gallium: add PIPE_SHADER_CAP_MAX_SHADER_IMAGESIlia Mirkin1-0/+1
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-02-13tgsi/ureg: add shared variables support for compute shadersSamuel Pitoiset6-0/+45
This introduces TGSI_FILE_MEMORY for shared, global and local memory. Only shared memory is currently supported. Changes from v2: - introduce TGSI_FILE_MEMORY Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-02-13gallium: add PIPE_SHADER_CAP_SUPPORTED_IRSSamuel Pitoiset1-0/+2
This cap indicates the supported representations of programs. It should be a mask of pipe_shader_ir bits. It will allow to enable ARB_compute_shader if the underlying driver supports TGSI. Changes from v2: - improve description of PIPE_SHADER_CAP_SUPPORTED_IRS Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-02-08tgsi: minor whitespace fixes in tgsi_scan.cBrian Paul1-4/+2
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>