summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_simple_shaders.c
AgeCommit message (Collapse)AuthorFilesLines
2020-06-05util: Add util functionality for GL4.1 supportNeha Bhende1-0/+108
This patch adds the following tgsi utilities * tgsi_dynamic_indexing: This utility flattens out the dyanamic indexing of constant buffers * tgsi_vpos: This utility writes zeros to position at index 0 in vertex shader. This utility can be used if there is no shader output in vertex shader * util_make_tess_ctrl_passthrough_shader: This adds passthough tessellation control shader. Input of passthrough tess ctrl shader is output of vertex shader and output is input of tessellation eval shader. If program has tessellation eval shader but no tessellation control shader, this utility can be used to create passthrough tessellation control shader. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com> Signed-off-by: Neha Bhende <bhenden@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5317>
2020-05-28util: Initialize pipe_shader_state for passthrough and transform shadersNeha Bhende1-5/+5
mesa/st is initializing pipe_shader_state for user define shaders. This patch intialized pipe_shader_state for all passthough and transform shaders. This fixes crashes for several opengl apps. Issue is found in vmware internal testing Fixes: f01c0565bb9 ("draw: free the NIR IR.") Reviewed-by: Charmaine Lee <charmainel@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5240>
2020-04-15u_blitter: fix stencil blittingDave Airlie1-1/+1
Fixes: KHR-GL45.packed_depth_stencil.blit.depth32f_stencil8 Reviewed-by: Roland Scheidegger <sroland@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4560>
2019-07-19util: use standard name for snprintf()Eric Engestrom1-2/+2
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2019-07-03gallium/u_blitter: implement copying from ZS to color and vice versaMarek Olšák1-0/+161
This is for drivers that can't map depth and stencil and need to blit them to a color texture for CPU access. This also useful for drivers using separate depth and stencil. Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
2019-07-03gallium/util: rewrite depth-stencil blit shadersMarek Olšák1-148/+37
- merge all 3 functions (Z, S, ZS) - don't write the color output - read the value from texel.x, then write it to position.z or stencil.y (don't use the value from texel.y or texel.z) Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
2019-05-08gallium/util: fix two MSVC compiler warningsBrian Paul1-2/+2
Remove stray const qualifier. s/unsigned/enum tgsi_semantic/ Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2018-02-08gallium/util: s/uint/enum tgsi_semantic/ in simple shader codeBrian Paul1-2/+2
Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2018-02-07gallium/util: replace unsigned with tgsi enum typesBrian Paul1-17/+19
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2018-02-07u_blit,u_simple_shaders: add shader to convert from xrbias formatRoland Scheidegger1-0/+47
We need this to handle some oddball dx10 format (DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM). What you can do with this format is very limited, hence we don't want to add it as a gallium format (we could not express the properties of this format as ordinary format properties neither, so like all special formats it would need specific code for handling it in any case). While here, also nuke the array for different shaders for different writemasks, as it was not actually used (always full masks are passed in for generating shaders). Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2018-02-07u_simple_shaders: fix mask handling in util_make_fragment_tex_shader_writemaskRoland Scheidegger1-1/+1
The writemask handling was busted, since writing defaults to output meant they got overwritten by the tex sampling anyway. Albeit the affected components were undefined, so maybe with some luck it still would have worked with some drivers - if not could as well kill it... (This would have affected u_blitter but not u_blit since the latter always used xyzw mask.) Reviewed-by: Brian Paul <brianp@vmware.com>
2017-08-22gallium/u_simple_shaders: do util_make_layered_clear_vertex_shader differentlyMarek Olšák1-23/+17
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Tested-by: Brian Paul <brianp@vmware.com>
2017-07-25gallium/util: s/unsigned/enum tgsi_texture_type/Brian Paul1-7/+8
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2017-07-21tgsi: populate preciseKarol Herbst1-1/+1
Only implemented for glsl->tgsi. Other converters just set precise to 0. v2: remove precise paramter from ureg_tex_insn and ureg_memory_insn Signed-off-by: Karol Herbst <karolherbst@gmail.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-06-07gallium/util: add _LZ and TXF options to simple shadersMarek Olšák1-21/+49
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-04-08util: fix swizzle of INSTANCEID system valueNicolai Hähnle1-1/+1
radeonsi added stricter checking for correct swizzles in debug builds. Reported-by: Michel Dänzer <michel.daenzer@amd.com> Fixes: 4cf29427770f ("radeonsi: support 64-bit system values") Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-11-23util: fix missing swizzle components in the SINT <-> UINT conversion stringCharmaine Lee1-2/+2
Fixes tgsi error introduced in commit 3817a7a. The error complains missing swizzle component in the conversion string "UMIN TEMP[0], TEMP[0], IMM[0].x". Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2016-11-16u_simple_shaders: try to un-break the Windows buildNicolai Hähnle1-2/+3
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
2016-11-16util/blitter: add clamping during SINT <-> UINT blitsNicolai Hähnle1-18/+62
Even though glBlitFramebuffer cannot be used for SINT <-> UINT blits, we still need to handle this type of blit here because it can happen as part of texture uploads / downloads, e.g. uploading a GL_RGBA8I texture from GL_UNSIGNED_INT data. Fixes parts of GL45-CTS.gtf32.GL3Tests.packed_pixels.packed_pixels. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
2016-05-11gallium: refactor pipe_shader_state to support multiple IR'sRob Clark1-6/+12
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-03gallium,utils: Fix trivial sign compare warningsJan Vesely1-2/+2
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Jakob Sinclair <sinclair.jakob@openmailbox.org> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2016-04-28gallium/util: s/Elements/ARRAY_SIZE/Brian Paul1-6/+6
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-04-22gallium: use PIPE_SHADER_* everywhere, remove TGSI_PROCESSOR_*Marek Olšák1-10/+10
Acked-by: Jose Fonseca <jfonseca@vmware.com>
2016-03-21gallium/util: declare sampler view in util_make_fs_blit_msaa_depthstencil()Brian Paul1-1/+2
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2015-12-06gallium/auxiliary: Sanitize NULL checks into canonical formEdward O'Callaghan1-8/+8
Use NULL tests of the form `if (ptr)' or `if (!ptr)'. They do not depend on the definition of the symbol NULL. Further, they provide the opportunity for the accidental assignment, are clear and succinct. Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-09-01gallium/util: add a utility to create geometry passthrough shaderCharmaine Lee1-0/+51
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-06-21util/blitter (and friends): generate appropriate SVIEW declsRob Clark1-18/+60
Some hardware needs to know the sampler type. Update the blit related shaders to include SVIEW decl. Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2015-02-06gallium/u_tests: test a NULL buffer sampler viewMarek Olšák1-3/+9
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
2014-11-17st/mesa: add a fallback for clear_with_quad when no vs_layerIlia Mirkin1-0/+70
Not all drivers can set gl_Layer from VS. Add a fallback that passes the instance id from VS to GS, and then uses the GS to set the layer. Tested by adding quad_buffers |= clear_buffers; clear_buffers = 0; to the st_Clear logic, and forcing set_vertex_shader_layered in all cases. No piglit regressions (on piglits with 'clear' in the name). Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Cc: "10.4 10.3" <mesa-stable@lists.freedesktop.org>
2014-11-16tgsi/ureg: simplify code for declaring propertiesMarek Olšák1-1/+1
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
2014-11-16gallium/util: add a window_space option to the passthrough vertex shaderMarek Olšák1-2/+8
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
2014-01-17s/Tungsten Graphics/VMware/José Fonseca1-2/+2
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the old copyright name is creating unnecessary confusion, hence this change. This was the sed script I used: $ cat tg2vmw.sed # Run as: # # git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed # # Rename copyrights s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g /Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./ s/TUNGSTEN GRAPHICS/VMWARE/g # Rename emails s/alanh@tungstengraphics.com/alanh@vmware.com/ s/jens@tungstengraphics.com/jowen@vmware.com/g s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/ s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g s/keithw\?@tungstengraphics.com/keithw@vmware.com/g s/michel@tungstengraphics.com/daenzer@vmware.com/g s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/ s/zack@tungstengraphics.com/zackr@vmware.com/ # Remove dead links s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g # C string src/gallium/state_trackers/vega/api_misc.c s/"Tungsten Graphics, Inc"/"VMware, Inc"/ Reviewed-by: Brian Paul <brianp@vmware.com>
2013-12-14gallium/u_blitter: implement shader-based MSAA resolve with bilinear filteringMarek Olšák1-0/+95
For scaled resolve. The filter is only good for magnification. If somebody has an idea how to implement a good filter for minification, I'm all ears. I'd have to use derivatives probably. Reviewed-by: Brian Paul <brianp@vmware.com>
2013-12-14gallium/u_blitter: implement shader-based MSAA resolveMarek Olšák1-0/+59
We need this for integer formats and upside-down blits, which Radeons don't support for MSAA resolving. It can be used by calling util_blitter_blit. Reviewed-by: Brian Paul <brianp@vmware.com>
2013-12-03gallium/util: implement layered framebuffer clear in u_blitterMarek Olšák1-0/+26
All bound layers (from first_layer to last_layer) should be cleared. This uses a vertex shader which outputs gl_Layer = gl_InstanceID, so each instance goes to a different layer. By rendering a quad and setting the instance count to the number of layers, it will trivially clear all layers. This requires AMD_vertex_shader_layer (or PIPE_CAP_TGSI_VS_LAYER), which only radeonsi supports at the moment. r600 could do this too. Standard DX11 hardware will have to use a geometry shader though, which has higher overhead.
2013-06-13gallium/u_blitter: make clearing independent of the number of bound colorbuffersMarek Olšák1-0/+12
We can use the fragment shader TGSI property WRITES_ALL_CBUFS. Reviewed-by: Brian Paul <brianp@vmware.com>
2013-06-13gallium/util: make WRITES_ALL_CBUFS optional in the passthrough fragment shaderMarek Olšák1-3/+6
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-03-11gallium/util: attempt to fix blitting multisample texture arraysMarek Olšák1-1/+1
We don't have a test for this yet, but obviously the swizzle was wrong.
2013-01-15gallium/util: fix glClear with MRT by making the FS write to all cbufsMarek Olšák1-4/+30
Reviewed-by: Brian Paul <brianp@vmware.com>
2012-08-15gallium/u_blitter: implement blitting multisample resourcesMarek Olšák1-0/+133
It can blit only one sample at a time (it should be called in a loop).
2012-07-12gallium/u_blitter: accelerate stencil-only copyingMarek Olšák1-0/+46
This doesn't seem to be used by anything yet, but better safe than sorry. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2012-07-12gallium/u_blitter: accelerate depth-stencil copying using shader stencil exportMarek Olšák1-0/+54
This fixes stencil buffer write transfers on r600g. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2011-12-15gallium: utility helper functions for stream outputMarek Olšák1-1/+13
2010-11-28u_blitter: interpolate clear color using a GENERIC varying instead of COLORMarek Olšák1-4/+7
There are also some u_simple_shaders changes. On r300, the TGSI_SEMANTIC_COLOR varying is a fixed-point number clamped to the range [0,1] and limited to 12 bits of precision. Therefore we can't use it for passing through a clear color in order to clear high precision texture formats. This also makes u_blitter use only one vertex shader instead of two.
2010-08-26util: Include missing header in u_simple_shaders.c.Vinson Lee1-0/+1
Include p_state.h for PIPE_MAX_COLOR_BUFS symbol.
2010-06-03gallium: add interpolation parameter to simple shader functionsBrian Paul1-4/+15
This lets us specify linear interpolation instead of perspective interpolation for blit operations. Might be a bit faster.
2010-02-02gallium: Make pipe_atomic a regular int32_t.José Fonseca1-0/+1
2010-01-05gallium/util: replace 8 with PIPE_MAX_COLOR_BUFSBrian Paul1-2/+2
2010-01-05gallium/util: comments and whitespace fixesBrian Paul1-3/+15
2009-12-15util: add new fragment shaders to simple_shadersMarek Olšák1-7/+63
New shaders: * Fragment shader which writes depth sampled from a texture * Fragment shader which copies COLOR[0] to multiple render targets Additional improvements: * The fragment 'tex' shaders now take a sampler type (TGSI_TEXTURE_*) so that they can sample from any type of texture, not only from a 2D one.