summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/auxiliary/tgsi
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-01-28 08:56:54 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-01-28 08:56:54 +0000
commitd305570c9b1fd87c4acdec589761cfa39fd04a3b (patch)
treee340315dd9d6966ccc3a48aa7a845e2213e40e62 /lib/mesa/src/gallium/auxiliary/tgsi
parent1c5c7896c1d54abd25c0f33ca996165b359eecb3 (diff)
Merge Mesa 22.3.4
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/tgsi')
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_aa_point.c16
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_emulate.c169
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_emulate.h38
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.c18
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.h16
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_from_mesa.h35
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h8
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_point_sprite.c43
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_scan.c2
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_scan.h2
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_strings.c7
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_text.c2
-rw-r--r--lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.c19
13 files changed, 94 insertions, 281 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_aa_point.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_aa_point.c
index 58f610fc4..ace4d9a10 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_aa_point.c
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_aa_point.c
@@ -47,6 +47,7 @@ struct aa_transform_context
unsigned num_imm; // number of immediates
unsigned num_input; // number of inputs
unsigned aa_point_coord_index;
+ bool need_texcoord_semantic;
};
static inline struct aa_transform_context *
@@ -113,8 +114,15 @@ aa_prolog(struct tgsi_transform_context *ctx)
/* Declare new generic input/texcoord */
texIn = ts->num_input++;
- tgsi_transform_input_decl(ctx, texIn, TGSI_SEMANTIC_GENERIC,
- ts->aa_point_coord_index, TGSI_INTERPOLATE_LINEAR);
+ if (ts->need_texcoord_semantic) {
+ tgsi_transform_input_decl(ctx, texIn, TGSI_SEMANTIC_TEXCOORD,
+ ts->aa_point_coord_index,
+ TGSI_INTERPOLATE_LINEAR);
+ } else {
+ tgsi_transform_input_decl(ctx, texIn, TGSI_SEMANTIC_GENERIC,
+ ts->aa_point_coord_index,
+ TGSI_INTERPOLATE_LINEAR);
+ }
/* Declare extra immediates */
imm = ts->num_imm++;
@@ -271,7 +279,8 @@ aa_epilog(struct tgsi_transform_context *ctx)
*/
struct tgsi_token *
tgsi_add_aa_point(const struct tgsi_token *tokens_in,
- const int aa_point_coord_index)
+ const int aa_point_coord_index,
+ const bool need_texcoord_semantic)
{
struct aa_transform_context transform;
const uint num_new_tokens = 200; /* should be enough */
@@ -291,6 +300,7 @@ tgsi_add_aa_point(const struct tgsi_token *tokens_in,
assert(aa_point_coord_index != -1);
transform.aa_point_coord_index = (unsigned)aa_point_coord_index;
+ transform.need_texcoord_semantic = need_texcoord_semantic;
transform.num_tmp = 0;
transform.num_imm = 0;
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_emulate.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_emulate.c
deleted file mode 100644
index 59d2e4c95..000000000
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_emulate.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (C) 2015 Advanced Micro Devices, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-#include "tgsi/tgsi_transform.h"
-#include "tgsi/tgsi_scan.h"
-#include "tgsi/tgsi_dump.h"
-#include "util/u_debug.h"
-
-#include "tgsi_emulate.h"
-
-struct tgsi_emulation_context {
- struct tgsi_transform_context base;
- struct tgsi_shader_info info;
- unsigned flags;
- bool first_instruction_emitted;
-};
-
-static inline struct tgsi_emulation_context *
-tgsi_emulation_context(struct tgsi_transform_context *tctx)
-{
- return (struct tgsi_emulation_context *)tctx;
-}
-
-static void
-transform_decl(struct tgsi_transform_context *tctx,
- struct tgsi_full_declaration *decl)
-{
- struct tgsi_emulation_context *ctx = tgsi_emulation_context(tctx);
-
- if (ctx->flags & TGSI_EMU_FORCE_PERSAMPLE_INTERP &&
- decl->Declaration.File == TGSI_FILE_INPUT) {
- assert(decl->Declaration.Interpolate);
- decl->Interp.Location = TGSI_INTERPOLATE_LOC_SAMPLE;
- }
-
- tctx->emit_declaration(tctx, decl);
-}
-
-static void
-passthrough_edgeflag(struct tgsi_transform_context *tctx)
-{
- struct tgsi_emulation_context *ctx = tgsi_emulation_context(tctx);
- struct tgsi_full_declaration decl;
- struct tgsi_full_instruction new_inst;
-
- /* Input */
- decl = tgsi_default_full_declaration();
- decl.Declaration.File = TGSI_FILE_INPUT;
- decl.Range.First = decl.Range.Last = ctx->info.num_inputs;
- tctx->emit_declaration(tctx, &decl);
-
- /* Output */
- decl = tgsi_default_full_declaration();
- decl.Declaration.File = TGSI_FILE_OUTPUT;
- decl.Declaration.Semantic = true;
- decl.Range.First = decl.Range.Last = ctx->info.num_outputs;
- decl.Semantic.Name = TGSI_SEMANTIC_EDGEFLAG;
- decl.Semantic.Index = 0;
- tctx->emit_declaration(tctx, &decl);
-
- /* MOV */
- new_inst = tgsi_default_full_instruction();
- new_inst.Instruction.Opcode = TGSI_OPCODE_MOV;
-
- new_inst.Instruction.NumDstRegs = 1;
- new_inst.Dst[0].Register.File = TGSI_FILE_OUTPUT;
- new_inst.Dst[0].Register.Index = ctx->info.num_outputs;
- new_inst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_XYZW;
-
- new_inst.Instruction.NumSrcRegs = 1;
- new_inst.Src[0].Register.File = TGSI_FILE_INPUT;
- new_inst.Src[0].Register.Index = ctx->info.num_inputs;
- new_inst.Src[0].Register.SwizzleX = TGSI_SWIZZLE_X;
- new_inst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_X;
- new_inst.Src[0].Register.SwizzleZ = TGSI_SWIZZLE_X;
- new_inst.Src[0].Register.SwizzleW = TGSI_SWIZZLE_X;
-
- tctx->emit_instruction(tctx, &new_inst);
-}
-
-static void
-transform_instr(struct tgsi_transform_context *tctx,
- struct tgsi_full_instruction *inst)
-{
- struct tgsi_emulation_context *ctx = tgsi_emulation_context(tctx);
-
- /* Pass through edgeflags. */
- if (!ctx->first_instruction_emitted) {
- ctx->first_instruction_emitted = true;
-
- if (ctx->flags & TGSI_EMU_PASSTHROUGH_EDGEFLAG)
- passthrough_edgeflag(tctx);
- }
-
- /* Clamp color outputs. */
- if (ctx->flags & TGSI_EMU_CLAMP_COLOR_OUTPUTS) {
- int i;
- for (i = 0; i < inst->Instruction.NumDstRegs; i++) {
- unsigned semantic;
-
- if (inst->Dst[i].Register.File != TGSI_FILE_OUTPUT ||
- inst->Dst[i].Register.Indirect)
- continue;
-
- semantic =
- ctx->info.output_semantic_name[inst->Dst[i].Register.Index];
-
- if (semantic == TGSI_SEMANTIC_COLOR ||
- semantic == TGSI_SEMANTIC_BCOLOR)
- inst->Instruction.Saturate = true;
- }
- }
-
- tctx->emit_instruction(tctx, inst);
-}
-
-const struct tgsi_token *
-tgsi_emulate(const struct tgsi_token *tokens, unsigned flags)
-{
- struct tgsi_emulation_context ctx;
- struct tgsi_token *newtoks;
- int newlen;
-
- if (!(flags & (TGSI_EMU_CLAMP_COLOR_OUTPUTS |
- TGSI_EMU_PASSTHROUGH_EDGEFLAG |
- TGSI_EMU_FORCE_PERSAMPLE_INTERP)))
- return NULL;
-
- memset(&ctx, 0, sizeof(ctx));
- ctx.flags = flags;
- tgsi_scan_shader(tokens, &ctx.info);
-
- if (flags & TGSI_EMU_FORCE_PERSAMPLE_INTERP)
- ctx.base.transform_declaration = transform_decl;
-
- if (flags & (TGSI_EMU_CLAMP_COLOR_OUTPUTS |
- TGSI_EMU_PASSTHROUGH_EDGEFLAG))
- ctx.base.transform_instruction = transform_instr;
-
- newlen = tgsi_num_tokens(tokens) + 20;
- newtoks = tgsi_alloc_tokens(newlen);
- if (!newtoks)
- return NULL;
-
- tgsi_transform_shader(tokens, newtoks, newlen, &ctx.base);
- return newtoks;
-}
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_emulate.h b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_emulate.h
deleted file mode 100644
index 425cec72e..000000000
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_emulate.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2015 Advanced Micro Devices, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-#ifndef TGSI_GL_EMULATION_H_
-#define TGSI_GL_EMULATION_H_
-
-#include "pipe/p_shader_tokens.h"
-
-#define TGSI_EMU_CLAMP_COLOR_OUTPUTS (1 << 0)
-#define TGSI_EMU_PASSTHROUGH_EDGEFLAG (1 << 1)
-#define TGSI_EMU_FORCE_PERSAMPLE_INTERP (1 << 2)
-
-const struct tgsi_token *
-tgsi_emulate(const struct tgsi_token *tokens, unsigned flags);
-
-#endif /* TGSI_GL_EMULATION_H_ */
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.c
index ae1daa6dc..5e440353e 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -1288,18 +1288,10 @@ micro_div(
const union tgsi_exec_channel *src0,
const union tgsi_exec_channel *src1 )
{
- if (src1->f[0] != 0) {
- dst->f[0] = src0->f[0] / src1->f[0];
- }
- if (src1->f[1] != 0) {
- dst->f[1] = src0->f[1] / src1->f[1];
- }
- if (src1->f[2] != 0) {
- dst->f[2] = src0->f[2] / src1->f[2];
- }
- if (src1->f[3] != 0) {
- dst->f[3] = src0->f[3] / src1->f[3];
- }
+ dst->f[0] = src0->f[0] / src1->f[0];
+ dst->f[1] = src0->f[1] / src1->f[1];
+ dst->f[2] = src0->f[2] / src1->f[2];
+ dst->f[3] = src0->f[3] / src1->f[3];
}
static void
@@ -1884,7 +1876,7 @@ emit_primitive(struct tgsi_exec_machine *mach,
prim_count = &mach->OutputPrimCount[stream_id];
if (mach->ExecMask) {
++(*prim_count);
- debug_assert((*prim_count * mach->NumOutputs) < TGSI_MAX_TOTAL_VERTICES);
+ assert((*prim_count * mach->NumOutputs) < TGSI_MAX_TOTAL_VERTICES);
mach->Primitives[stream_id][*prim_count] = 0;
}
}
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.h b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 257769819..80acf6359 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -446,13 +446,13 @@ tgsi_exec_get_shader_param(enum pipe_shader_cap param)
return TGSI_EXEC_MAX_INPUT_ATTRIBS;
case PIPE_SHADER_CAP_MAX_OUTPUTS:
return 32;
- case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFER0_SIZE:
return TGSI_EXEC_MAX_CONST_BUFFER_SIZE;
case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
return PIPE_MAX_CONSTANT_BUFFERS;
case PIPE_SHADER_CAP_MAX_TEMPS:
return TGSI_EXEC_NUM_TEMPS;
- case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ case PIPE_SHADER_CAP_CONT_SUPPORTED:
return 1;
case PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR:
case PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR:
@@ -480,14 +480,11 @@ tgsi_exec_get_shader_param(enum pipe_shader_cap param)
return 1 << PIPE_SHADER_IR_TGSI;
case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED:
return 1;
- case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
- case PIPE_SHADER_CAP_TGSI_LDEXP_SUPPORTED:
+ case PIPE_SHADER_CAP_DFRACEXP_DLDEXP_SUPPORTED:
+ case PIPE_SHADER_CAP_LDEXP_SUPPORTED:
case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE:
return 1;
- case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED:
- case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
- case PIPE_SHADER_CAP_LOWER_IF_THRESHOLD:
- case PIPE_SHADER_CAP_TGSI_SKIP_MERGE_REGISTERS:
+ case PIPE_SHADER_CAP_DROUND_SUPPORTED:
case PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTERS:
case PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTER_BUFFERS:
return 0;
@@ -495,9 +492,6 @@ tgsi_exec_get_shader_param(enum pipe_shader_cap param)
return PIPE_MAX_SHADER_BUFFERS;
case PIPE_SHADER_CAP_MAX_SHADER_IMAGES:
return PIPE_MAX_SHADER_IMAGES;
-
- case PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT:
- return 32;
}
/* if we get here, we missed a shader cap above (and should have seen
* a compiler warning.)
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_from_mesa.h b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_from_mesa.h
index e3f1456d8..c3595b93c 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_from_mesa.h
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_from_mesa.h
@@ -61,38 +61,19 @@ tgsi_get_interp_mode(enum glsl_interp_mode mode, bool color);
static inline enum pipe_shader_type
pipe_shader_type_from_mesa(gl_shader_stage stage)
{
- switch (stage) {
- case MESA_SHADER_VERTEX:
- return PIPE_SHADER_VERTEX;
- case MESA_SHADER_TESS_CTRL:
- return PIPE_SHADER_TESS_CTRL;
- case MESA_SHADER_TESS_EVAL:
- return PIPE_SHADER_TESS_EVAL;
- case MESA_SHADER_GEOMETRY:
- return PIPE_SHADER_GEOMETRY;
- case MESA_SHADER_FRAGMENT:
- return PIPE_SHADER_FRAGMENT;
- case MESA_SHADER_COMPUTE:
- case MESA_SHADER_KERNEL:
- return PIPE_SHADER_COMPUTE;
- default:
- unreachable("bad shader stage");
- }
+ STATIC_ASSERT((enum pipe_shader_type) MESA_SHADER_VERTEX == PIPE_SHADER_VERTEX);
+ STATIC_ASSERT((enum pipe_shader_type) MESA_SHADER_FRAGMENT == PIPE_SHADER_FRAGMENT);
+ STATIC_ASSERT((enum pipe_shader_type) MESA_SHADER_TESS_CTRL == PIPE_SHADER_TESS_CTRL);
+ STATIC_ASSERT((enum pipe_shader_type) MESA_SHADER_TESS_EVAL == PIPE_SHADER_TESS_EVAL);
+ STATIC_ASSERT((enum pipe_shader_type) MESA_SHADER_GEOMETRY == PIPE_SHADER_GEOMETRY);
+ STATIC_ASSERT((enum pipe_shader_type) MESA_SHADER_COMPUTE == PIPE_SHADER_COMPUTE);
+ return (enum pipe_shader_type)stage;
}
static inline gl_shader_stage
tgsi_processor_to_shader_stage(unsigned processor)
{
- switch (processor) {
- case PIPE_SHADER_FRAGMENT: return MESA_SHADER_FRAGMENT;
- case PIPE_SHADER_VERTEX: return MESA_SHADER_VERTEX;
- case PIPE_SHADER_GEOMETRY: return MESA_SHADER_GEOMETRY;
- case PIPE_SHADER_TESS_CTRL: return MESA_SHADER_TESS_CTRL;
- case PIPE_SHADER_TESS_EVAL: return MESA_SHADER_TESS_EVAL;
- case PIPE_SHADER_COMPUTE: return MESA_SHADER_COMPUTE;
- default:
- unreachable("invalid TGSI processor");
- }
+ return (gl_shader_stage)processor;
}
#ifdef __cplusplus
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
index 684c06144..ed87d736c 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
@@ -73,7 +73,15 @@ OP11(DDX)
OP11(DDY)
OP11(DDX_FINE)
OP11(DDY_FINE)
+OP00(DEMOTE)
OP00(KILL)
+OP10(READ_HELPER)
+OP11(VOTE_ALL)
+OP11(VOTE_ANY)
+OP11(VOTE_EQ)
+OP11(BALLOT)
+OP11(READ_FIRST)
+OP12(READ_INVOC)
OP11(PK2H)
OP11(PK2US)
OP11(PK4B)
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_point_sprite.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_point_sprite.c
index 432a137fc..eb17a1be0 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_point_sprite.c
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_point_sprite.c
@@ -95,6 +95,7 @@ struct psprite_transform_context
unsigned point_coord_k; // aa point coord threshold distance
unsigned stream_out_point_pos:1; // set if to stream out original point pos
unsigned aa_point:1; // set if doing aa point
+ unsigned need_texcoord_semantic:1; // set if need texcoord semantic
unsigned out_tmp_index[PIPE_MAX_SHADER_OUTPUTS];
int max_generic; // max generic semantic index
};
@@ -131,11 +132,16 @@ psprite_decl(struct tgsi_transform_context *ctx,
else if (decl->Semantic.Name == TGSI_SEMANTIC_POSITION) {
ts->point_pos_out = decl->Range.First;
}
- else if (decl->Semantic.Name == TGSI_SEMANTIC_GENERIC &&
+ else if (!ts->need_texcoord_semantic &&
+ decl->Semantic.Name == TGSI_SEMANTIC_GENERIC &&
decl->Semantic.Index < 32) {
ts->point_coord_decl |= 1 << decl->Semantic.Index;
ts->max_generic = MAX2(ts->max_generic, (int)decl->Semantic.Index);
}
+ else if (ts->need_texcoord_semantic &&
+ decl->Semantic.Name == TGSI_SEMANTIC_TEXCOORD) {
+ ts->point_coord_decl |= 1 << decl->Semantic.Index;
+ }
ts->num_out = MAX2(ts->num_out, range_end);
}
else if (decl->Declaration.File == TGSI_FILE_TEMPORARY) {
@@ -213,22 +219,35 @@ psprite_prolog(struct tgsi_transform_context *ctx)
*/
ts->point_coord_out = ts->num_out;
if (point_coord_enable) {
- for (i = 0, en = point_coord_enable; en; en>>=1, i++) {
- if (en & 0x1) {
- tgsi_transform_output_decl(ctx, ts->num_out++,
- TGSI_SEMANTIC_GENERIC, i, 0);
- ts->max_generic = MAX2(ts->max_generic, (int)i);
+ if (ts->need_texcoord_semantic) {
+ for (i = 0, en = point_coord_enable; en; en>>=1, i++) {
+ if (en & 0x1) {
+ tgsi_transform_output_decl(ctx, ts->num_out++,
+ TGSI_SEMANTIC_TEXCOORD, i, 0);
+ }
+ }
+ } else {
+ for (i = 0, en = point_coord_enable; en; en>>=1, i++) {
+ if (en & 0x1) {
+ tgsi_transform_output_decl(ctx, ts->num_out++,
+ TGSI_SEMANTIC_GENERIC, i, 0);
+ ts->max_generic = MAX2(ts->max_generic, (int)i);
+ }
}
}
}
/* add an extra generic output for aa point texcoord */
if (ts->aa_point) {
- ts->point_coord_aa = ts->max_generic + 1;
- assert((ts->point_coord_enable & (1 << ts->point_coord_aa)) == 0);
- ts->point_coord_enable |= 1 << (ts->point_coord_aa);
- tgsi_transform_output_decl(ctx, ts->num_out++, TGSI_SEMANTIC_GENERIC,
- ts->point_coord_aa, 0);
+ if (ts->need_texcoord_semantic) {
+ ts->point_coord_aa = 0;
+ } else {
+ ts->point_coord_aa = ts->max_generic + 1;
+ assert((ts->point_coord_enable & (1 << ts->point_coord_aa)) == 0);
+ ts->point_coord_enable |= 1 << (ts->point_coord_aa);
+ tgsi_transform_output_decl(ctx, ts->num_out++, TGSI_SEMANTIC_GENERIC,
+ ts->point_coord_aa, 0);
+ }
}
/* Declare extra immediates */
@@ -503,6 +522,7 @@ tgsi_add_point_sprite(const struct tgsi_token *tokens_in,
const unsigned point_coord_enable,
const bool sprite_origin_lower_left,
const bool stream_out_point_pos,
+ const bool need_texcoord_semantic,
int *aa_point_coord_index)
{
struct psprite_transform_context transform;
@@ -533,6 +553,7 @@ tgsi_add_point_sprite(const struct tgsi_token *tokens_in,
transform.stream_out_point_pos = stream_out_point_pos;
transform.point_coord_enable = point_coord_enable;
transform.aa_point = aa_point_coord_index != NULL;
+ transform.need_texcoord_semantic = need_texcoord_semantic;
transform.max_generic = -1;
/* point sprite directions based on the immediates (0, 1, 0.5, -1) */
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_scan.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 5fab72eb6..a083711d1 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -615,12 +615,10 @@ scan_declaration(struct tgsi_shader_info *info,
case TGSI_FILE_INPUT:
assert(array_id < ARRAY_SIZE(info->input_array_first));
info->input_array_first[array_id] = fulldecl->Range.First;
- info->input_array_last[array_id] = fulldecl->Range.Last;
break;
case TGSI_FILE_OUTPUT:
assert(array_id < ARRAY_SIZE(info->output_array_first));
info->output_array_first[array_id] = fulldecl->Range.First;
- info->output_array_last[array_id] = fulldecl->Range.Last;
break;
}
info->array_max[file] = MAX2(info->array_max[file], array_id);
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_scan.h b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 076c138e4..a9b2014a9 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -72,9 +72,7 @@ struct tgsi_shader_info
ubyte num_stream_output_components[4];
ubyte input_array_first[PIPE_MAX_SHADER_INPUTS];
- ubyte input_array_last[PIPE_MAX_SHADER_INPUTS];
ubyte output_array_first[PIPE_MAX_SHADER_OUTPUTS];
- ubyte output_array_last[PIPE_MAX_SHADER_OUTPUTS];
unsigned array_max[TGSI_FILE_COUNT]; /**< highest index array per register file */
uint immediate_count; /**< number of immediates declared */
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_strings.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_strings.c
index acc88966e..ea601e649 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_strings.c
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_strings.c
@@ -35,10 +35,10 @@
const char *tgsi_processor_type_names[6] =
{
"VERT",
- "FRAG",
- "GEOM",
"TESS_CTRL",
"TESS_EVAL",
+ "GEOM",
+ "FRAG",
"COMP"
};
@@ -160,11 +160,12 @@ const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
"CS_FIXED_BLOCK_WIDTH",
"CS_FIXED_BLOCK_HEIGHT",
"CS_FIXED_BLOCK_DEPTH",
- "MUL_ZERO_WINS",
+ "LEGACY_MATH_RULES",
"VS_BLIT_SGPRS_AMD",
"CS_USER_DATA_COMPONENTS_AMD",
"LAYER_VIEWPORT_RELATIVE",
"FS_BLEND_EQUATION_ADVANCED",
+ "SEPARABLE_PROGRAM",
};
const char *tgsi_return_type_names[TGSI_RETURN_TYPE_COUNT] =
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_text.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_text.c
index 9779f212c..7802f1049 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -148,7 +148,7 @@ static int str_match_format(const char **pcur)
for (unsigned i = 0; i < PIPE_FORMAT_COUNT; i++) {
const struct util_format_description *desc =
util_format_description(i);
- if (desc && str_match_nocase_whole(pcur, desc->name)) {
+ if (str_match_nocase_whole(pcur, desc->name)) {
return i;
}
}
diff --git a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 207fcc45b..398d59b95 100644
--- a/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/lib/mesa/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -98,7 +98,7 @@ struct const_decl {
};
struct hw_atomic_decl {
- struct {
+ struct hw_atomic_decl_range {
unsigned first;
unsigned last;
unsigned array_id;
@@ -308,6 +308,8 @@ ureg_DECL_fs_input_centroid_layout(struct ureg_program *ureg,
assert(ureg->input[i].interp_location == interp_location);
if (ureg->input[i].array_id == array_id) {
ureg->input[i].usage_mask |= usage_mask;
+ ureg->input[i].last = MAX2(ureg->input[i].last, ureg->input[i].first + array_size - 1);
+ ureg->nr_input_regs = MAX2(ureg->nr_input_regs, ureg->input[i].last + 1);
goto out;
}
assert((ureg->input[i].usage_mask & usage_mask) == 0);
@@ -445,6 +447,8 @@ ureg_DECL_output_layout(struct ureg_program *ureg,
ureg->output[i].semantic_index == semantic_index) {
if (ureg->output[i].array_id == array_id) {
ureg->output[i].usage_mask |= usage_mask;
+ ureg->output[i].last = MAX2(ureg->output[i].last, ureg->output[i].first + array_size - 1);
+ ureg->nr_output_regs = MAX2(ureg->nr_output_regs, ureg->output[i].last + 1);
goto out;
}
assert((ureg->output[i].usage_mask & usage_mask) == 0);
@@ -1831,6 +1835,14 @@ output_sort(const void *in_a, const void *in_b)
return a->first - b->first;
}
+static int
+atomic_decl_range_sort(const void *in_a, const void *in_b)
+{
+ const struct hw_atomic_decl_range *a = in_a, *b = in_b;
+
+ return a->first - b->first;
+}
+
static void emit_decls( struct ureg_program *ureg )
{
unsigned i,j;
@@ -2014,6 +2026,11 @@ static void emit_decls( struct ureg_program *ureg )
if (decl->nr_hw_atomic_ranges) {
uint j;
+ /* GLSL-to-TGSI generated HW atomic counters in order, and r600 depends
+ * on it.
+ */
+ qsort(decl->hw_atomic_range, decl->nr_hw_atomic_ranges, sizeof(struct hw_atomic_decl_range), atomic_decl_range_sort);
+
for (j = 0; j < decl->nr_hw_atomic_ranges; j++) {
emit_decl_atomic_2d(ureg,
decl->hw_atomic_range[j].first,