Nobody seems to be using it, and only nv50 had a partial implementation.
Signed-off-by: Christian König <christian.koenig@amd.com>
full_declaration.Range = tgsi_default_declaration_range();
full_declaration.Semantic = tgsi_default_declaration_semantic();
full_declaration.Interp = tgsi_default_declaration_interp();
- full_declaration.ImmediateData.u = NULL;
full_declaration.Resource = tgsi_default_declaration_resource();
full_declaration.SamplerView = tgsi_default_declaration_sampler_view();
header );
}
- if (full_decl->Declaration.File == TGSI_FILE_IMMEDIATE_ARRAY) {
- unsigned i, j;
- union tgsi_immediate_data *data;
-
- for (i = 0; i <= dr->Last; ++i) {
- for (j = 0; j < 4; ++j) {
- unsigned idx = i*4 + j;
- if (maxsize <= size)
- return 0;
- data = (union tgsi_immediate_data *) &tokens[size];
- ++size;
-
- *data = full_decl->ImmediateData.u[idx];
- declaration_grow( declaration, header );
- }
- }
- }
-
if (full_decl->Declaration.File == TGSI_FILE_RESOURCE) {
struct tgsi_declaration_resource *dr;
TXT( ", INVARIANT" );
}
-
- if (decl->Declaration.File == TGSI_FILE_IMMEDIATE_ARRAY) {
- unsigned i;
- char range_indent[4];
-
- TXT(" {");
-
- if (decl->Range.Last < 10)
- range_indent[0] = '\0';
- else if (decl->Range.Last < 100) {
- range_indent[0] = ' ';
- range_indent[1] = '\0';
- } else if (decl->Range.Last < 1000) {
- range_indent[0] = ' ';
- range_indent[1] = ' ';
- range_indent[2] = '\0';
- } else {
- range_indent[0] = ' ';
- range_indent[1] = ' ';
- range_indent[2] = ' ';
- range_indent[3] = '\0';
- }
-
- dump_imm_data(iter, decl->ImmediateData.u,
- 4, TGSI_IMM_FLOAT32);
- for(i = 1; i <= decl->Range.Last; ++i) {
- /* indent by strlen of:
- * "DCL IMMX[0..1] {" */
- CHR('\n');
- TXT( " " );
- TXT( range_indent );
- dump_imm_data(iter, decl->ImmediateData.u + i,
- 4, TGSI_IMM_FLOAT32);
- }
-
- TXT(" }");
- }
-
EOL();
return TRUE;
++mach->NumOutputs;
}
}
- if (parse.FullToken.FullDeclaration.Declaration.File ==
- TGSI_FILE_IMMEDIATE_ARRAY) {
- unsigned reg;
- struct tgsi_full_declaration *decl =
- &parse.FullToken.FullDeclaration;
- debug_assert(decl->Range.Last < TGSI_EXEC_NUM_IMMEDIATES);
- for (reg = decl->Range.First; reg <= decl->Range.Last; ++reg) {
- for( i = 0; i < 4; i++ ) {
- int idx = reg * 4 + i;
- mach->ImmArray[reg][i] = decl->ImmediateData.u[idx].Float;
- }
- }
- }
memcpy(declarations + numDeclarations,
&parse.FullToken.FullDeclaration,
sizeof(declarations[0]));
}
break;
- case TGSI_FILE_TEMPORARY_ARRAY:
- for (i = 0; i < TGSI_QUAD_SIZE; i++) {
- assert(index->i[i] < TGSI_EXEC_NUM_TEMPS);
- assert(index2D->i[i] < TGSI_EXEC_NUM_TEMP_ARRAYS);
-
- chan->u[i] =
- mach->TempArray[index2D->i[i]][index->i[i]].xyzw[swizzle].u[i];
- }
- break;
-
case TGSI_FILE_IMMEDIATE:
for (i = 0; i < TGSI_QUAD_SIZE; i++) {
assert(index->i[i] >= 0 && index->i[i] < (int)mach->ImmLimit);
}
break;
- case TGSI_FILE_IMMEDIATE_ARRAY:
- for (i = 0; i < TGSI_QUAD_SIZE; i++) {
- assert(index2D->i[i] == 0);
-
- chan->f[i] = mach->ImmArray[index->i[i]][swizzle];
- }
- break;
-
case TGSI_FILE_ADDRESS:
for (i = 0; i < TGSI_QUAD_SIZE; i++) {
assert(index->i[i] >= 0);
dst = &mach->Temps[offset + index].xyzw[chan_index];
break;
- case TGSI_FILE_TEMPORARY_ARRAY:
- index = reg->Register.Index;
- assert( index < TGSI_EXEC_NUM_TEMPS );
- assert( index2D.i[0] < TGSI_EXEC_NUM_TEMP_ARRAYS );
- /* XXX we use index2D.i[0] here but somehow we might
- * end up with someone trying to store indirectly in
- * different buffers */
- dst = &mach->TempArray[index2D.i[0]][offset + index].xyzw[chan_index];
- break;
-
case TGSI_FILE_ADDRESS:
index = reg->Register.Index;
dst = &mach->Addrs[index].xyzw[chan_index];
#define TGSI_EXEC_NUM_TEMPS 4096
#define TGSI_EXEC_NUM_IMMEDIATES 256
-#define TGSI_EXEC_NUM_TEMP_ARRAYS 8
/*
* Locations of various utility registers (_I = Index, _C = Channel)
*/
struct tgsi_exec_vector Temps[TGSI_EXEC_NUM_TEMPS +
TGSI_EXEC_NUM_TEMP_EXTRAS];
- struct tgsi_exec_vector TempArray[TGSI_EXEC_NUM_TEMP_ARRAYS][TGSI_EXEC_NUM_TEMPS];
float Imms[TGSI_EXEC_NUM_IMMEDIATES][4];
next_token( ctx, &decl->Semantic );
}
- if (decl->Declaration.File == TGSI_FILE_IMMEDIATE_ARRAY) {
- unsigned i, j;
- decl->ImmediateData.u = (union tgsi_immediate_data*)
- &ctx->Tokens[ctx->Position];
- for (i = 0; i <= decl->Range.Last; ++i) {
- for (j = 0; j < 4; ++j) {
- ctx->Position++;
- }
- }
- }
-
if (decl->Declaration.File == TGSI_FILE_RESOURCE) {
next_token(ctx, &decl->Resource);
}
struct tgsi_src_register DimIndirect;
};
-struct tgsi_immediate_array_data
-{
- union tgsi_immediate_data *u;
-};
-
struct tgsi_full_declaration
{
struct tgsi_declaration Declaration;
struct tgsi_declaration_dimension Dim;
struct tgsi_declaration_interp Interp;
struct tgsi_declaration_semantic Semantic;
- struct tgsi_immediate_array_data ImmediateData;
struct tgsi_declaration_resource Resource;
struct tgsi_declaration_sampler_view SamplerView;
};
"IMM",
"PRED",
"SV",
- "IMMX",
- "TEMPX",
"RES"
};
"IMM",
"PRED",
"SV",
- "IMMX",
- "TEMPX",
"RES",
"SVIEW"
};
const char *cur, *cur2;
uint advance;
boolean is_vs_input;
- boolean is_imm_array;
if (!eat_white( &ctx->cur )) {
report_error( ctx, "Syntax error" );
is_vs_input = (file == TGSI_FILE_INPUT &&
ctx->processor == TGSI_PROCESSOR_VERTEX);
- is_imm_array = (file == TGSI_FILE_IMMEDIATE_ARRAY);
cur = ctx->cur;
eat_opt_white( &cur );
}
}
}
- } else if (is_imm_array) {
- unsigned i;
- union tgsi_immediate_data *vals_itr;
- /* we have our immediate data */
- if (*cur != '{') {
- report_error( ctx, "Immediate array without data" );
- return FALSE;
- }
- ++cur;
- ctx->cur = cur;
-
- decl.ImmediateData.u =
- MALLOC(sizeof(union tgsi_immediate_data) * 4 *
- (decl.Range.Last + 1));
- vals_itr = decl.ImmediateData.u;
- for (i = 0; i <= decl.Range.Last; ++i) {
- if (!parse_immediate_data(ctx, TGSI_IMM_FLOAT32, vals_itr)) {
- FREE(decl.ImmediateData.u);
- return FALSE;
- }
- vals_itr += 4;
- eat_opt_white( &ctx->cur );
- if (*ctx->cur != ',') {
- if (i != decl.Range.Last) {
- report_error( ctx, "Not enough data in immediate array!" );
- FREE(decl.ImmediateData.u);
- return FALSE;
- }
- } else
- ++ctx->cur;
- }
- eat_opt_white( &ctx->cur );
- if (*ctx->cur != '}') {
- FREE(decl.ImmediateData.u);
- report_error( ctx, "Immediate array data missing closing '}'" );
- return FALSE;
- }
- ++ctx->cur;
}
cur = ctx->cur;
ctx->header,
(uint) (ctx->tokens_end - ctx->tokens_cur) );
- if (is_imm_array)
- FREE(decl.ImmediateData.u);
-
if (advance == 0)
return FALSE;
ctx->tokens_cur += advance;
case TGSI_FILE_PREDICATE: return nv50_ir::FILE_PREDICATE;
case TGSI_FILE_IMMEDIATE: return nv50_ir::FILE_IMMEDIATE;
case TGSI_FILE_SYSTEM_VALUE: return nv50_ir::FILE_SYSTEM_VALUE;
- case TGSI_FILE_IMMEDIATE_ARRAY: return nv50_ir::FILE_IMMEDIATE;
- case TGSI_FILE_TEMPORARY_ARRAY: return nv50_ir::FILE_MEMORY_LOCAL;
case TGSI_FILE_RESOURCE: return nv50_ir::FILE_MEMORY_GLOBAL;
case TGSI_FILE_SAMPLER:
case TGSI_FILE_NULL:
nv50_ir::DynArray tempArrays;
nv50_ir::DynArray immdArrays;
- int tempArrayCount;
- int immdArrayCount;
typedef nv50_ir::BuildUtil::Location Location;
// these registers are per-subroutine, cannot be used for parameter passing
resources.resize(scan.file_max[TGSI_FILE_RESOURCE] + 1);
info->immd.bufSize = 0;
- tempArrayCount = 0;
- immdArrayCount = 0;
info->numInputs = scan.file_max[TGSI_FILE_INPUT] + 1;
info->numOutputs = scan.file_max[TGSI_FILE_OUTPUT] + 1;
for (i = first; i <= last; ++i)
textureViews[i].target = decl->SamplerView.Resource;
break;
- case TGSI_FILE_IMMEDIATE_ARRAY:
- {
- if (decl->Dim.Index2D >= immdArrayCount)
- immdArrayCount = decl->Dim.Index2D + 1;
- immdArrays[decl->Dim.Index2D].u32 = (last + 1) << 2;
- uint32_t base, count;
- switch (decl->Declaration.UsageMask) {
- case 0x1: c = 1; break;
- case 0x3: c = 2; break;
- default:
- c = 4;
- break;
- }
- immdArrays[decl->Dim.Index2D].u32 |= c;
- count = (last + 1) * c;
- base = info->immd.bufSize / 4;
- info->immd.bufSize = (info->immd.bufSize + count * 4 + 0xf) & ~0xf;
- info->immd.buf = (uint32_t *)REALLOC(info->immd.buf, base * 4,
- info->immd.bufSize);
- // NOTE: this assumes array declarations are ordered by Dim.Index2D
- for (i = 0; i < count; ++i)
- info->immd.buf[base + i] = decl->ImmediateData.u[i].Uint;
- }
- break;
- case TGSI_FILE_TEMPORARY_ARRAY:
- {
- if (decl->Dim.Index2D >= tempArrayCount)
- tempArrayCount = decl->Dim.Index2D + 1;
- tempArrays[decl->Dim.Index2D].u32 = (last + 1) << 2;
- uint32_t count;
- switch (decl->Declaration.UsageMask) {
- case 0x1: c = 1; break;
- case 0x3: c = 2; break;
- default:
- c = 4;
- break;
- }
- tempArrays[decl->Dim.Index2D].u32 |= c;
- count = (last + 1) * c;
- info->bin.tlsSpace += (info->bin.tlsSpace + count * 4 + 0xf) & ~0xf;
- }
- break;
case TGSI_FILE_NULL:
case TGSI_FILE_TEMPORARY:
case TGSI_FILE_ADDRESS:
DataArray aData; // TGSI_FILE_ADDRESS
DataArray pData; // TGSI_FILE_PREDICATE
DataArray oData; // TGSI_FILE_OUTPUT (if outputs in registers)
- std::vector<DataArray> lData; // TGSI_FILE_TEMPORARY_ARRAY
- std::vector<DataArray> iData; // TGSI_FILE_IMMEDIATE_ARRAY
Value *zero;
Value *fragCoord[4];
return &pData;
case TGSI_FILE_ADDRESS:
return &aData;
- case TGSI_FILE_TEMPORARY_ARRAY:
- assert(idx < code->tempArrayCount);
- return &lData[idx];
- case TGSI_FILE_IMMEDIATE_ARRAY:
- assert(idx < code->immdArrayCount);
- return &iData[idx];
case TGSI_FILE_OUTPUT:
assert(prog->getType() == Program::TYPE_FRAGMENT);
return &oData;
return NULL;
if (dst.isIndirect(0) ||
- f == TGSI_FILE_TEMPORARY_ARRAY ||
f == TGSI_FILE_SYSTEM_VALUE ||
(f == TGSI_FILE_OUTPUT && prog->getType() != Program::TYPE_FRAGMENT))
return getScratch();
mkStore(OP_EXPORT, TYPE_U32, dstToSym(dst, c), ptr, val);
} else
if (f == TGSI_FILE_TEMPORARY ||
- f == TGSI_FILE_TEMPORARY_ARRAY ||
f == TGSI_FILE_PREDICATE ||
f == TGSI_FILE_ADDRESS ||
f == TGSI_FILE_OUTPUT) {
aData.setup(TGSI_FILE_ADDRESS, 0, 0, aSize, 4, 4, FILE_ADDRESS, 0);
oData.setup(TGSI_FILE_OUTPUT, 0, 0, oSize, 4, 4, FILE_GPR, 0);
- for (int vol = 0, i = 0; i < code->tempArrayCount; ++i) {
- int len = code->tempArrays[i].u32 >> 2;
- int dim = code->tempArrays[i].u32 & 3;
-
- lData.push_back(DataArray(this));
- lData.back().setup(TGSI_FILE_TEMPORARY_ARRAY, i, vol, len, dim, 4,
- FILE_MEMORY_LOCAL, 0);
-
- vol += (len * dim * 4 + 0xf) & ~0xf;
- }
-
- for (int vol = 0, i = 0; i < code->immdArrayCount; ++i) {
- int len = code->immdArrays[i].u32 >> 2;
- int dim = code->immdArrays[i].u32 & 3;
-
- lData.push_back(DataArray(this));
- lData.back().setup(TGSI_FILE_IMMEDIATE_ARRAY, i, vol, len, dim, 4,
- FILE_MEMORY_CONST, 14);
-
- vol += (len * dim * 4 + 0xf) & ~0xf;
- }
-
zero = mkImm((uint32_t)0);
vtxBaseValid = 0;
TGSI_FILE_IMMEDIATE =7,
TGSI_FILE_PREDICATE =8,
TGSI_FILE_SYSTEM_VALUE =9,
- TGSI_FILE_IMMEDIATE_ARRAY =10,
- TGSI_FILE_TEMPORARY_ARRAY =11,
- TGSI_FILE_RESOURCE =12,
- TGSI_FILE_SAMPLER_VIEW =13,
+ TGSI_FILE_RESOURCE =10,
+ TGSI_FILE_SAMPLER_VIEW =11,
TGSI_FILE_COUNT /**< how many TGSI_FILE_ types */
};