summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/tgsi/tgsi_text.c
AgeCommit message (Collapse)AuthorFilesLines
2023-10-26treewide: Merge num_mesh_vertices_per_primitive and u_vertices_per_prim into ↵Yonggang Luo1-2/+1
mesa_vertices_per_prim Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25880>
2023-07-06tgsi: uint -> unsignedErik Faye-Lund1-47/+47
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>
2023-07-06tgsi: use enum for shader-typeErik Faye-Lund1-1/+1
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>
2023-07-06tgsi: use enum for property-nameErik Faye-Lund1-1/+1
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>
2023-07-06tgsi: use enum for tgsi-file typeErik Faye-Lund1-13/+13
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>
2023-06-27treewide: Replace the usage of TRUE/FALSE with true/falseYonggang Luo1-150/+150
this is a separate patch as it's won't affect the code style Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: David Heidelberg <david.heidelberg@collabora.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23577>
2023-06-27treewide: style fixes after replace usage of boolean to boolYonggang Luo1-1/+1
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: David Heidelberg <david.heidelberg@collabora.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23577>
2023-06-27treewide: replace usage of boolean to boolYonggang Luo1-47/+47
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: David Heidelberg <david.heidelberg@collabora.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23577>
2023-06-03compiler: Rename shader_prim to mesa_prim and replace all usage of ↵Yonggang Luo1-1/+1
pipe_prim_type with mesa_prim This is a prepare step to remove depends on p_defines.h in src/util/* This is done by: replace pipe_prim_type with mesa_prim replace shader_prim with mesa_prim replace PIPE_PRIM_MAX with MESA_PRIM_COUNT replace SHADER_PRIM_ with MESA_PRIM_ replace PIPE_PRIM_ with MESA_PRIM_ This patch only replace code only Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23369>
2023-04-27tgsi: use locale independent float and double parsingThong Thai1-46/+4
The atof and strtod functions use the locale of the user when determining if a decimal is a comma, ',' or a period, '.'. Thanks to @fzwoch for helping find the cause of a shader-related issue. Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5760 Signed-off-by: Thong Thai <thong.thai@amd.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22699>
2022-07-21tgsi: Remove format desc null checkKonstantin Seurer1-1/+1
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17490>
2018-06-29gallium: plumb invariant output attrib thru TGSIJoe M. Kniss1-4/+14
Add support for glsl 'invariant' modifier for output data declarations. Gallium drivers that use TGSI serialization currently loose invariant modifiers in glsl shaders. v2: use boolean for invariant instead of unsigned. Tested: chromiumos on qemu with virglrenderer. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2018-06-20gallium/aux/tgsi_text.c: Fix -Wsign-compare warningsGert Wollny1-4/+4
tgsi/tgsi_text.c: In function 'parse_identifier': tgsi/tgsi_text.c:218:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (i == len - 1) ^~ tgsi/tgsi_text.c: In function 'parse_optional_swizzle': tgsi/tgsi_text.c:873:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < components; i++) { ^ tgsi/tgsi_text.c: In function 'parse_instruction': tgsi/tgsi_text.c:1103:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < info->num_dst + info->num_src + info->is_tex; i++) { ^ tgsi/tgsi_text.c:1118:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] else if (i < info->num_dst + info->num_src) { ^ tgsi/tgsi_text.c: In function 'parse_immediate': tgsi/tgsi_text.c:1660:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (type = 0; type < ARRAY_SIZE(tgsi_immediate_type_names); ++type) { ^ Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-08-23gallium: use tgsi_get_opcode_name instead of tgsi_opcode_info::mnemonicNicolai Hähnle1-2/+3
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-07-21tgsi/text: parse _PRECISE modifierKarol Herbst1-3/+14
v2: use str_match_no_case to fix _SAT_PRECISE detection v4: usd is_digit_alpha_underscore to match end of mods Signed-off-by: Karol Herbst <karolherbst@gmail.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-04-01gallium: remove support for predicates from TGSI (v2)Marek Olšák1-37/+0
Neved used. v2: gallivm: rename "pred" -> "exec_mask" etnaviv: remove the cap gallium: fix tgsi_instruction::Padding Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2017-02-07gallium/tgsi: fix oob access in parse instructionLi Qiang1-1/+1
When parsing texture instruction, it doesn't stop if the 'cur' is ',', the loop variable 'i' will also be increased and be used to index the 'inst.TexOffsets' array. This can lead an oob access issue. This patch avoid this. Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Li Qiang <liq3ea@gmail.com>
2017-01-11gallium/tgsi: fix overflow in parse propertyLi Qiang1-3/+6
In parse_identifier, it doesn't stop copying '*pcur' untill encounter the NULL. As the 'ret' has a fixed-size buffer, if the '*pcur' has a long string, there will be a buffer overflow. This patch avoid this. Signed-off-by: Li Qiang <liq3ea@gmail.com> Signed-off-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2016-12-12tgsi: add Stream{X,Y,Z,W} fields to tgsi_declaration_semanticNicolai Hähnle1-0/+48
This is for geometry shader outputs. Without it, drivers have no way of knowing which stream each output is intended for, and have to conservatively write all outputs to all streams. Separate stream numbers for each component are required due to output packing. Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-09-21gallium/tgsi: add support for 64-bit integer immediates.Dave Airlie1-0/+44
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-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-25tgsi: print TGSI_PROPERTY_NEXT_SHADER value as string, not an integerBrian Paul1-0/+22
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-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-27tgsi: s/Elements/ARRAY_SIZE/Brian Paul1-4/+4
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2016-04-22gallium: use PIPE_SHADER_* everywhere, remove TGSI_PROCESSOR_*Marek Olšák1-13/+13
Acked-by: Jose Fonseca <jfonseca@vmware.com>
2016-03-21tgsi: Add support for global / private / input MEMORYHans de Goede1-2/+12
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-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-02-15tgsi: show textual format representationIlia Mirkin1-3/+10
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 Pitoiset1-0/+3
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-01-08tgsi: provide a way to encode memory qualifiers for SSBOIlia Mirkin1-0/+27
Each load/store on most hardware can specify what caching to do. Since SSBO allows individual variables to also have separate caching modes, allow loads/stores to have the qualifiers instead of attempting to encode them in declarations. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-01-08ureg: add buffer support to uregIlia Mirkin1-0/+5
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-01-08tgsi: add ureg support for image declsIlia Mirkin1-4/+6
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2015-10-23tgsi: add option to dump floats as hex valuesDave Airlie1-1/+10
This adds support to the parser to accept hex values as floats, and then adds support to the dumper to allow the user to select to dump float as 32-bit hex numbers. This is required to get accurate values for virgl use of TGSI. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-08-17tgsi: fix parsing of tessellation shader inputs/outputsMarcos Paulo de Souza1-1/+16
Tessellation control shaders write to outputs as OUT[ADDR[0].x][0], make sure to parse the indirect dimension on outputs. Also tess control inputs/outputs and tess eval input declarations need to receive the same treatment as geometry shader inputs. Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2015-08-17tgsi: set implicit array size for tess stagesMarcos Paulo de Souza1-1/+5
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2015-05-26tgsi/text: enable parsing tessellation shadersMarek Olšák1-0/+4
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2015-05-20gallium: remove TGSI_SAT_MINUS_PLUS_ONEMarek Olšák1-9/+3
It's a remnant of some old NV extension. Unused. I also have a patch that removes predicates if anyone is interested. Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2015-02-21tgsi: fix type-mismatch warningMarek Olšák1-1/+1
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-02-20tgsi: add support for flt64 constantsDave Airlie1-0/+22
These act like flt32 except they take up two slots, and you can only add 2 x flt64 constants in one slot. The main reason they are different is we don't want to match half a flt64 constants against a flt32 constant in the matching code, we need to make sure we treat both parts of the flt64 as an single structure. Cleaned up printing/parsing by Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-09-22gallium: replace pipe_type enum with tgsi_return_type enumBrian Paul1-3/+3
The only place the enum pipe_type was used is for the TGSI sampler view return type. So make it a TGSI type. Note: it appears this part of TGSI isn't used by anyone so it may be removed in the future. v2: the new name is tgsi_return_type, not tgsi_type. This means we can drop the previously posted tgsi_type -> tgsi_opcode_type patch. Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-09-16tgsi: accept offsets for sample opcodes too in the text parserRoland Scheidegger1-3/+2
sample opcodes are a little oddly represented in the opcode_info, since they don't count as texture instructions - they don't have valid target information, but they may have offsets (unlike "ordinary" texture instructions, the texture token may be optional for them). So just make sure with these opcodes the optional offsets are accepted. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-07-09tgsi: add interpolation location modifier support to text parserIlia Mirkin1-0/+17
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-07-09tgsi: properly parse indirect dimension references (e.g. for UBOs)Ilia Mirkin1-0/+7
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Brian Paul <brianp@vmware.com>
2014-05-14tgsi: support parsing texture offsets from text tgsi shadersIlia Mirkin1-5/+48
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Roland Scheidegger <sroland@vmware.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-06-18tgsi: text parser: fix parsing of array in declarationDave Airlie1-3/+9
I noticed this code didn't work as advertised while doing some passing around of TGSI shaders and trying to reparse them, and things failing. This seems to fix it here for at least the small test case I hacked into a graw test. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-07tgsi: replace tgsi_file_names tgsi_file_names[] with tgsi_file_name() functionBrian Paul1-1/+1
This change came from the discovery that the STATIC_ASSERT to check that the number of register file strings didn't actually work. Similar changes could be made for the other string arrays in tgsi_string.c Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-03-26gallium/tgsi: fix valgrind warningMarek Olšák1-1/+1
"Conditional jump or move depends on uninitialised value(s)" Reviewed-by: Brian Paul <brianp@vmware.com>