gallium/tgsi: Split sampler views from shader resources.
This commit splits the current concept of resource into "sampler views" and "shader resources": "Sampler views" are textures or buffers that are bound to a given shader stage and can be read from in conjunction with a sampler object. They are analogous to OpenGL texture objects or Direct3D SRVs. "Shader resources" are textures or buffers that can be read and written from a shader. There's no support for floating point coordinates, address wrap modes or filtering, and, unlike sampler views, shader resources are global for the whole graphics pipeline. They are analogous to OpenGL image objects (as in ARB_shader_image_load_store) or Direct3D UAVs. Most hardware is likely to implement shader resources and sampler views as separate objects, so, having the distinction at the API level simplifies things slightly for the driver. This patch introduces the SVIEW register file with a declaration token and syntax analogous to the already existing RES register file. After this change, the SAMPLE_* opcodes no longer accept a resource as input, but rather a SVIEW object. To preserve the functionality of reading from a sampler view with integer coordinates, the SAMPLE_I(_MS) opcodes are introduced which are similar to LOAD(_MS) but take a SVIEW register instead of a RES register as argument.
This commit is contained in:
@@ -227,42 +227,66 @@ tgsi_build_declaration_semantic(
|
|||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct tgsi_declaration_resource
|
static struct tgsi_declaration_resource
|
||||||
tgsi_default_declaration_resource(void)
|
tgsi_default_declaration_resource(void)
|
||||||
{
|
{
|
||||||
struct tgsi_declaration_resource declaration_resource;
|
struct tgsi_declaration_resource dr;
|
||||||
|
|
||||||
declaration_resource.Resource = TGSI_TEXTURE_UNKNOWN;
|
dr.Resource = TGSI_BUFFER;
|
||||||
declaration_resource.ReturnTypeX = PIPE_TYPE_UNORM;
|
|
||||||
declaration_resource.ReturnTypeY = PIPE_TYPE_UNORM;
|
|
||||||
declaration_resource.ReturnTypeZ = PIPE_TYPE_UNORM;
|
|
||||||
declaration_resource.ReturnTypeW = PIPE_TYPE_UNORM;
|
|
||||||
|
|
||||||
return declaration_resource;
|
return dr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tgsi_declaration_resource
|
static struct tgsi_declaration_resource
|
||||||
tgsi_build_declaration_resource(unsigned texture,
|
tgsi_build_declaration_resource(unsigned texture,
|
||||||
unsigned return_type_x,
|
|
||||||
unsigned return_type_y,
|
|
||||||
unsigned return_type_z,
|
|
||||||
unsigned return_type_w,
|
|
||||||
struct tgsi_declaration *declaration,
|
struct tgsi_declaration *declaration,
|
||||||
struct tgsi_header *header)
|
struct tgsi_header *header)
|
||||||
{
|
{
|
||||||
struct tgsi_declaration_resource declaration_resource;
|
struct tgsi_declaration_resource dr;
|
||||||
|
|
||||||
declaration_resource = tgsi_default_declaration_resource();
|
dr = tgsi_default_declaration_resource();
|
||||||
declaration_resource.Resource = texture;
|
dr.Resource = texture;
|
||||||
declaration_resource.ReturnTypeX = return_type_x;
|
|
||||||
declaration_resource.ReturnTypeY = return_type_y;
|
|
||||||
declaration_resource.ReturnTypeZ = return_type_z;
|
|
||||||
declaration_resource.ReturnTypeW = return_type_w;
|
|
||||||
|
|
||||||
declaration_grow(declaration, header);
|
declaration_grow(declaration, header);
|
||||||
|
|
||||||
return declaration_resource;
|
return dr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct tgsi_declaration_sampler_view
|
||||||
|
tgsi_default_declaration_sampler_view(void)
|
||||||
|
{
|
||||||
|
struct tgsi_declaration_sampler_view dsv;
|
||||||
|
|
||||||
|
dsv.Resource = TGSI_BUFFER;
|
||||||
|
dsv.ReturnTypeX = PIPE_TYPE_UNORM;
|
||||||
|
dsv.ReturnTypeY = PIPE_TYPE_UNORM;
|
||||||
|
dsv.ReturnTypeZ = PIPE_TYPE_UNORM;
|
||||||
|
dsv.ReturnTypeW = PIPE_TYPE_UNORM;
|
||||||
|
|
||||||
|
return dsv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct tgsi_declaration_sampler_view
|
||||||
|
tgsi_build_declaration_sampler_view(unsigned texture,
|
||||||
|
unsigned return_type_x,
|
||||||
|
unsigned return_type_y,
|
||||||
|
unsigned return_type_z,
|
||||||
|
unsigned return_type_w,
|
||||||
|
struct tgsi_declaration *declaration,
|
||||||
|
struct tgsi_header *header)
|
||||||
|
{
|
||||||
|
struct tgsi_declaration_sampler_view dsv;
|
||||||
|
|
||||||
|
dsv = tgsi_default_declaration_sampler_view();
|
||||||
|
dsv.Resource = texture;
|
||||||
|
dsv.ReturnTypeX = return_type_x;
|
||||||
|
dsv.ReturnTypeY = return_type_y;
|
||||||
|
dsv.ReturnTypeZ = return_type_z;
|
||||||
|
dsv.ReturnTypeW = return_type_w;
|
||||||
|
|
||||||
|
declaration_grow(declaration, header);
|
||||||
|
|
||||||
|
return dsv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -276,6 +300,7 @@ tgsi_default_full_declaration( void )
|
|||||||
full_declaration.Semantic = tgsi_default_declaration_semantic();
|
full_declaration.Semantic = tgsi_default_declaration_semantic();
|
||||||
full_declaration.ImmediateData.u = NULL;
|
full_declaration.ImmediateData.u = NULL;
|
||||||
full_declaration.Resource = tgsi_default_declaration_resource();
|
full_declaration.Resource = tgsi_default_declaration_resource();
|
||||||
|
full_declaration.SamplerView = tgsi_default_declaration_sampler_view();
|
||||||
|
|
||||||
return full_declaration;
|
return full_declaration;
|
||||||
}
|
}
|
||||||
@@ -375,14 +400,29 @@ tgsi_build_full_declaration(
|
|||||||
size++;
|
size++;
|
||||||
|
|
||||||
*dr = tgsi_build_declaration_resource(full_decl->Resource.Resource,
|
*dr = tgsi_build_declaration_resource(full_decl->Resource.Resource,
|
||||||
full_decl->Resource.ReturnTypeX,
|
|
||||||
full_decl->Resource.ReturnTypeY,
|
|
||||||
full_decl->Resource.ReturnTypeZ,
|
|
||||||
full_decl->Resource.ReturnTypeW,
|
|
||||||
declaration,
|
declaration,
|
||||||
header);
|
header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (full_decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) {
|
||||||
|
struct tgsi_declaration_sampler_view *dsv;
|
||||||
|
|
||||||
|
if (maxsize <= size) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
dsv = (struct tgsi_declaration_sampler_view *)&tokens[size];
|
||||||
|
size++;
|
||||||
|
|
||||||
|
*dsv = tgsi_build_declaration_sampler_view(
|
||||||
|
full_decl->SamplerView.Resource,
|
||||||
|
full_decl->SamplerView.ReturnTypeX,
|
||||||
|
full_decl->SamplerView.ReturnTypeY,
|
||||||
|
full_decl->SamplerView.ReturnTypeZ,
|
||||||
|
full_decl->SamplerView.ReturnTypeW,
|
||||||
|
declaration,
|
||||||
|
header);
|
||||||
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -285,21 +285,25 @@ iter_declaration(
|
|||||||
if (decl->Declaration.File == TGSI_FILE_RESOURCE) {
|
if (decl->Declaration.File == TGSI_FILE_RESOURCE) {
|
||||||
TXT(", ");
|
TXT(", ");
|
||||||
ENM(decl->Resource.Resource, tgsi_texture_names);
|
ENM(decl->Resource.Resource, tgsi_texture_names);
|
||||||
TXT(", ");
|
}
|
||||||
if ((decl->Resource.ReturnTypeX == decl->Resource.ReturnTypeY) &&
|
|
||||||
(decl->Resource.ReturnTypeX == decl->Resource.ReturnTypeZ) &&
|
|
||||||
(decl->Resource.ReturnTypeX == decl->Resource.ReturnTypeW)) {
|
|
||||||
ENM(decl->Resource.ReturnTypeX, tgsi_type_names);
|
|
||||||
} else {
|
|
||||||
ENM(decl->Resource.ReturnTypeX, tgsi_type_names);
|
|
||||||
TXT(", ");
|
|
||||||
ENM(decl->Resource.ReturnTypeY, tgsi_type_names);
|
|
||||||
TXT(", ");
|
|
||||||
ENM(decl->Resource.ReturnTypeZ, tgsi_type_names);
|
|
||||||
TXT(", ");
|
|
||||||
ENM(decl->Resource.ReturnTypeW, tgsi_type_names);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) {
|
||||||
|
TXT(", ");
|
||||||
|
ENM(decl->SamplerView.Resource, tgsi_texture_names);
|
||||||
|
TXT(", ");
|
||||||
|
if ((decl->SamplerView.ReturnTypeX == decl->SamplerView.ReturnTypeY) &&
|
||||||
|
(decl->SamplerView.ReturnTypeX == decl->SamplerView.ReturnTypeZ) &&
|
||||||
|
(decl->SamplerView.ReturnTypeX == decl->SamplerView.ReturnTypeW)) {
|
||||||
|
ENM(decl->SamplerView.ReturnTypeX, tgsi_type_names);
|
||||||
|
} else {
|
||||||
|
ENM(decl->SamplerView.ReturnTypeX, tgsi_type_names);
|
||||||
|
TXT(", ");
|
||||||
|
ENM(decl->SamplerView.ReturnTypeY, tgsi_type_names);
|
||||||
|
TXT(", ");
|
||||||
|
ENM(decl->SamplerView.ReturnTypeZ, tgsi_type_names);
|
||||||
|
TXT(", ");
|
||||||
|
ENM(decl->SamplerView.ReturnTypeW, tgsi_type_names);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT &&
|
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT &&
|
||||||
|
@@ -2121,7 +2121,7 @@ exec_sample(struct tgsi_exec_machine *mach,
|
|||||||
control = tgsi_sampler_lod_bias;
|
control = tgsi_sampler_lod_bias;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mach->Resources[resource_unit].Resource) {
|
switch (mach->SamplerViews[resource_unit].Resource) {
|
||||||
case TGSI_TEXTURE_1D:
|
case TGSI_TEXTURE_1D:
|
||||||
case TGSI_TEXTURE_SHADOW1D:
|
case TGSI_TEXTURE_SHADOW1D:
|
||||||
FETCH(&r[0], 0, TGSI_CHAN_X);
|
FETCH(&r[0], 0, TGSI_CHAN_X);
|
||||||
@@ -2215,7 +2215,7 @@ exec_sample_d(struct tgsi_exec_machine *mach,
|
|||||||
* XXX: This is fake SAMPLE_D -- the derivatives are not taken into account, yet.
|
* XXX: This is fake SAMPLE_D -- the derivatives are not taken into account, yet.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch (mach->Resources[resource_unit].Resource) {
|
switch (mach->SamplerViews[resource_unit].Resource) {
|
||||||
case TGSI_TEXTURE_1D:
|
case TGSI_TEXTURE_1D:
|
||||||
case TGSI_TEXTURE_SHADOW1D:
|
case TGSI_TEXTURE_SHADOW1D:
|
||||||
|
|
||||||
@@ -2338,8 +2338,8 @@ static void
|
|||||||
exec_declaration(struct tgsi_exec_machine *mach,
|
exec_declaration(struct tgsi_exec_machine *mach,
|
||||||
const struct tgsi_full_declaration *decl)
|
const struct tgsi_full_declaration *decl)
|
||||||
{
|
{
|
||||||
if (decl->Declaration.File == TGSI_FILE_RESOURCE) {
|
if (decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) {
|
||||||
mach->Resources[decl->Range.First] = decl->Resource;
|
mach->SamplerViews[decl->Range.First] = decl->SamplerView;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4154,11 +4154,11 @@ exec_instruction(
|
|||||||
exec_endswitch(mach);
|
exec_endswitch(mach);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TGSI_OPCODE_LOAD:
|
case TGSI_OPCODE_SAMPLE_I:
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TGSI_OPCODE_LOAD_MS:
|
case TGSI_OPCODE_SAMPLE_I_MS:
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -4190,7 +4190,7 @@ exec_instruction(
|
|||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TGSI_OPCODE_RESINFO:
|
case TGSI_OPCODE_SVIEWINFO:
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -331,7 +331,8 @@ struct tgsi_exec_machine
|
|||||||
struct tgsi_full_declaration *Declarations;
|
struct tgsi_full_declaration *Declarations;
|
||||||
uint NumDeclarations;
|
uint NumDeclarations;
|
||||||
|
|
||||||
struct tgsi_declaration_resource Resources[PIPE_MAX_SHADER_RESOURCES];
|
struct tgsi_declaration_sampler_view
|
||||||
|
SamplerViews[PIPE_MAX_SHADER_SAMPLER_VIEWS];
|
||||||
|
|
||||||
boolean UsedGeometryShader;
|
boolean UsedGeometryShader;
|
||||||
};
|
};
|
||||||
|
@@ -183,22 +183,23 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
|
|||||||
{ 0, 0, 0, 0, 0, 0, NONE, "DEFAULT", TGSI_OPCODE_DEFAULT },
|
{ 0, 0, 0, 0, 0, 0, NONE, "DEFAULT", TGSI_OPCODE_DEFAULT },
|
||||||
{ 0, 0, 0, 0, 0, 0, NONE, "ENDSWITCH", TGSI_OPCODE_ENDSWITCH },
|
{ 0, 0, 0, 0, 0, 0, NONE, "ENDSWITCH", TGSI_OPCODE_ENDSWITCH },
|
||||||
|
|
||||||
{ 1, 2, 0, 0, 0, 0, OTHR, "LOAD", TGSI_OPCODE_LOAD },
|
|
||||||
{ 1, 2, 0, 0, 0, 0, OTHR, "LOAD_MS", TGSI_OPCODE_LOAD_MS },
|
|
||||||
{ 1, 3, 0, 0, 0, 0, OTHR, "SAMPLE", TGSI_OPCODE_SAMPLE },
|
{ 1, 3, 0, 0, 0, 0, OTHR, "SAMPLE", TGSI_OPCODE_SAMPLE },
|
||||||
|
{ 1, 2, 0, 0, 0, 0, OTHR, "SAMPLE_I", TGSI_OPCODE_SAMPLE_I },
|
||||||
|
{ 1, 2, 0, 0, 0, 0, OTHR, "SAMPLE_I_MS", TGSI_OPCODE_SAMPLE_I_MS },
|
||||||
{ 1, 4, 0, 0, 0, 0, OTHR, "SAMPLE_B", TGSI_OPCODE_SAMPLE_B },
|
{ 1, 4, 0, 0, 0, 0, OTHR, "SAMPLE_B", TGSI_OPCODE_SAMPLE_B },
|
||||||
{ 1, 4, 0, 0, 0, 0, OTHR, "SAMPLE_C", TGSI_OPCODE_SAMPLE_C },
|
{ 1, 4, 0, 0, 0, 0, OTHR, "SAMPLE_C", TGSI_OPCODE_SAMPLE_C },
|
||||||
{ 1, 4, 0, 0, 0, 0, OTHR, "SAMPLE_C_LZ", TGSI_OPCODE_SAMPLE_C_LZ },
|
{ 1, 4, 0, 0, 0, 0, OTHR, "SAMPLE_C_LZ", TGSI_OPCODE_SAMPLE_C_LZ },
|
||||||
{ 1, 5, 0, 0, 0, 0, OTHR, "SAMPLE_D", TGSI_OPCODE_SAMPLE_D },
|
{ 1, 5, 0, 0, 0, 0, OTHR, "SAMPLE_D", TGSI_OPCODE_SAMPLE_D },
|
||||||
{ 1, 3, 0, 0, 0, 0, OTHR, "SAMPLE_L", TGSI_OPCODE_SAMPLE_L },
|
{ 1, 3, 0, 0, 0, 0, OTHR, "SAMPLE_L", TGSI_OPCODE_SAMPLE_L },
|
||||||
{ 1, 3, 0, 0, 0, 0, OTHR, "GATHER4", TGSI_OPCODE_GATHER4 },
|
{ 1, 3, 0, 0, 0, 0, OTHR, "GATHER4", TGSI_OPCODE_GATHER4 },
|
||||||
{ 1, 2, 0, 0, 0, 0, OTHR, "RESINFO", TGSI_OPCODE_RESINFO },
|
{ 1, 2, 0, 0, 0, 0, OTHR, "SVIEWINFO", TGSI_OPCODE_SVIEWINFO },
|
||||||
{ 1, 2, 0, 0, 0, 0, OTHR, "SAMPLE_POS", TGSI_OPCODE_SAMPLE_POS },
|
{ 1, 2, 0, 0, 0, 0, OTHR, "SAMPLE_POS", TGSI_OPCODE_SAMPLE_POS },
|
||||||
{ 1, 2, 0, 0, 0, 0, OTHR, "SAMPLE_INFO", TGSI_OPCODE_SAMPLE_INFO },
|
{ 1, 2, 0, 0, 0, 0, OTHR, "SAMPLE_INFO", TGSI_OPCODE_SAMPLE_INFO },
|
||||||
{ 1, 1, 0, 0, 0, 0, COMP, "UARL", TGSI_OPCODE_UARL },
|
{ 1, 1, 0, 0, 0, 0, COMP, "UARL", TGSI_OPCODE_UARL },
|
||||||
{ 1, 3, 0, 0, 0, 0, COMP, "UCMP", TGSI_OPCODE_UCMP },
|
{ 1, 3, 0, 0, 0, 0, COMP, "UCMP", TGSI_OPCODE_UCMP },
|
||||||
{ 1, 1, 0, 0, 0, 0, COMP, "IABS", TGSI_OPCODE_IABS },
|
{ 1, 1, 0, 0, 0, 0, COMP, "IABS", TGSI_OPCODE_IABS },
|
||||||
{ 1, 1, 0, 0, 0, 0, COMP, "ISSG", TGSI_OPCODE_ISSG },
|
{ 1, 1, 0, 0, 0, 0, COMP, "ISSG", TGSI_OPCODE_ISSG },
|
||||||
|
{ 1, 2, 0, 0, 0, 0, OTHR, "LOAD", TGSI_OPCODE_LOAD },
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct tgsi_opcode_info *
|
const struct tgsi_opcode_info *
|
||||||
|
@@ -168,16 +168,16 @@ OP01(CASE)
|
|||||||
OP00(DEFAULT)
|
OP00(DEFAULT)
|
||||||
OP00(ENDSWITCH)
|
OP00(ENDSWITCH)
|
||||||
|
|
||||||
OP12(LOAD)
|
|
||||||
OP12(LOAD_MS)
|
|
||||||
OP13(SAMPLE)
|
OP13(SAMPLE)
|
||||||
|
OP12(SAMPLE_I)
|
||||||
|
OP12(SAMPLE_I_MS)
|
||||||
OP14(SAMPLE_B)
|
OP14(SAMPLE_B)
|
||||||
OP14(SAMPLE_C)
|
OP14(SAMPLE_C)
|
||||||
OP14(SAMPLE_C_LZ)
|
OP14(SAMPLE_C_LZ)
|
||||||
OP15(SAMPLE_D)
|
OP15(SAMPLE_D)
|
||||||
OP13(SAMPLE_L)
|
OP13(SAMPLE_L)
|
||||||
OP13(GATHER4)
|
OP13(GATHER4)
|
||||||
OP12(RESINFO)
|
OP12(SVIEWINFO)
|
||||||
OP13(SAMPLE_POS)
|
OP13(SAMPLE_POS)
|
||||||
OP12(SAMPLE_INFO)
|
OP12(SAMPLE_INFO)
|
||||||
|
|
||||||
|
@@ -132,6 +132,10 @@ tgsi_parse_token(
|
|||||||
next_token(ctx, &decl->Resource);
|
next_token(ctx, &decl->Resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) {
|
||||||
|
next_token(ctx, &decl->SamplerView);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -70,6 +70,7 @@ struct tgsi_full_declaration
|
|||||||
struct tgsi_declaration_semantic Semantic;
|
struct tgsi_declaration_semantic Semantic;
|
||||||
struct tgsi_immediate_array_data ImmediateData;
|
struct tgsi_immediate_array_data ImmediateData;
|
||||||
struct tgsi_declaration_resource Resource;
|
struct tgsi_declaration_resource Resource;
|
||||||
|
struct tgsi_declaration_sampler_view SamplerView;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tgsi_full_immediate
|
struct tgsi_full_immediate
|
||||||
|
@@ -53,7 +53,8 @@ const char *tgsi_file_names[TGSI_FILE_COUNT] =
|
|||||||
"SV",
|
"SV",
|
||||||
"IMMX",
|
"IMMX",
|
||||||
"TEMPX",
|
"TEMPX",
|
||||||
"RES"
|
"RES",
|
||||||
|
"SVIEW"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] =
|
const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] =
|
||||||
|
@@ -1066,6 +1066,22 @@ static boolean parse_declaration( struct translate_ctx *ctx )
|
|||||||
report_error(ctx, "Expected texture target");
|
report_error(ctx, "Expected texture target");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx->cur = cur;
|
||||||
|
|
||||||
|
} else if (file == TGSI_FILE_SAMPLER_VIEW) {
|
||||||
|
for (i = 0; i < TGSI_TEXTURE_COUNT; i++) {
|
||||||
|
if (str_match_no_case(&cur, tgsi_texture_names[i])) {
|
||||||
|
if (!is_digit_alpha_underscore(cur)) {
|
||||||
|
decl.SamplerView.Resource = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == TGSI_TEXTURE_COUNT) {
|
||||||
|
report_error(ctx, "Expected texture target");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
eat_opt_white( &cur );
|
eat_opt_white( &cur );
|
||||||
if (*cur != ',') {
|
if (*cur != ',') {
|
||||||
report_error( ctx, "Expected `,'" );
|
report_error( ctx, "Expected `,'" );
|
||||||
@@ -1079,16 +1095,16 @@ static boolean parse_declaration( struct translate_ctx *ctx )
|
|||||||
if (!is_digit_alpha_underscore(cur)) {
|
if (!is_digit_alpha_underscore(cur)) {
|
||||||
switch (j) {
|
switch (j) {
|
||||||
case 0:
|
case 0:
|
||||||
decl.Resource.ReturnTypeX = i;
|
decl.SamplerView.ReturnTypeX = i;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
decl.Resource.ReturnTypeY = i;
|
decl.SamplerView.ReturnTypeY = i;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
decl.Resource.ReturnTypeZ = i;
|
decl.SamplerView.ReturnTypeZ = i;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
decl.Resource.ReturnTypeW = i;
|
decl.SamplerView.ReturnTypeW = i;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
@@ -1116,10 +1132,10 @@ static boolean parse_declaration( struct translate_ctx *ctx )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (j < 4) {
|
if (j < 4) {
|
||||||
decl.Resource.ReturnTypeY =
|
decl.SamplerView.ReturnTypeY =
|
||||||
decl.Resource.ReturnTypeZ =
|
decl.SamplerView.ReturnTypeZ =
|
||||||
decl.Resource.ReturnTypeW =
|
decl.SamplerView.ReturnTypeW =
|
||||||
decl.Resource.ReturnTypeX;
|
decl.SamplerView.ReturnTypeX;
|
||||||
}
|
}
|
||||||
ctx->cur = cur;
|
ctx->cur = cur;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -47,7 +47,7 @@ union tgsi_any_token {
|
|||||||
struct tgsi_declaration_range decl_range;
|
struct tgsi_declaration_range decl_range;
|
||||||
struct tgsi_declaration_dimension decl_dim;
|
struct tgsi_declaration_dimension decl_dim;
|
||||||
struct tgsi_declaration_semantic decl_semantic;
|
struct tgsi_declaration_semantic decl_semantic;
|
||||||
struct tgsi_declaration_resource decl_resource;
|
struct tgsi_declaration_sampler_view decl_sampler_view;
|
||||||
struct tgsi_immediate imm;
|
struct tgsi_immediate imm;
|
||||||
union tgsi_immediate_data imm_data;
|
union tgsi_immediate_data imm_data;
|
||||||
struct tgsi_instruction insn;
|
struct tgsi_instruction insn;
|
||||||
@@ -147,8 +147,8 @@ struct ureg_program
|
|||||||
unsigned return_type_y;
|
unsigned return_type_y;
|
||||||
unsigned return_type_z;
|
unsigned return_type_z;
|
||||||
unsigned return_type_w;
|
unsigned return_type_w;
|
||||||
} resource[PIPE_MAX_SHADER_RESOURCES];
|
} sampler_view[PIPE_MAX_SHADER_SAMPLER_VIEWS];
|
||||||
unsigned nr_resources;
|
unsigned nr_sampler_views;
|
||||||
|
|
||||||
unsigned temps_active[UREG_MAX_TEMP / 32];
|
unsigned temps_active[UREG_MAX_TEMP / 32];
|
||||||
unsigned nr_temps;
|
unsigned nr_temps;
|
||||||
@@ -615,34 +615,34 @@ struct ureg_src ureg_DECL_sampler( struct ureg_program *ureg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate a new shader resource.
|
* Allocate a new shader sampler view.
|
||||||
*/
|
*/
|
||||||
struct ureg_src
|
struct ureg_src
|
||||||
ureg_DECL_resource(struct ureg_program *ureg,
|
ureg_DECL_sampler_view(struct ureg_program *ureg,
|
||||||
unsigned index,
|
unsigned index,
|
||||||
unsigned target,
|
unsigned target,
|
||||||
unsigned return_type_x,
|
unsigned return_type_x,
|
||||||
unsigned return_type_y,
|
unsigned return_type_y,
|
||||||
unsigned return_type_z,
|
unsigned return_type_z,
|
||||||
unsigned return_type_w)
|
unsigned return_type_w)
|
||||||
{
|
{
|
||||||
struct ureg_src reg = ureg_src_register(TGSI_FILE_RESOURCE, index);
|
struct ureg_src reg = ureg_src_register(TGSI_FILE_SAMPLER_VIEW, index);
|
||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
for (i = 0; i < ureg->nr_resources; i++) {
|
for (i = 0; i < ureg->nr_sampler_views; i++) {
|
||||||
if (ureg->resource[i].index == index) {
|
if (ureg->sampler_view[i].index == index) {
|
||||||
return reg;
|
return reg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < PIPE_MAX_SHADER_RESOURCES) {
|
if (i < PIPE_MAX_SHADER_SAMPLER_VIEWS) {
|
||||||
ureg->resource[i].index = index;
|
ureg->sampler_view[i].index = index;
|
||||||
ureg->resource[i].target = target;
|
ureg->sampler_view[i].target = target;
|
||||||
ureg->resource[i].return_type_x = return_type_x;
|
ureg->sampler_view[i].return_type_x = return_type_x;
|
||||||
ureg->resource[i].return_type_y = return_type_y;
|
ureg->sampler_view[i].return_type_y = return_type_y;
|
||||||
ureg->resource[i].return_type_z = return_type_z;
|
ureg->sampler_view[i].return_type_z = return_type_z;
|
||||||
ureg->resource[i].return_type_w = return_type_w;
|
ureg->sampler_view[i].return_type_w = return_type_w;
|
||||||
ureg->nr_resources++;
|
ureg->nr_sampler_views++;
|
||||||
return reg;
|
return reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -891,7 +891,7 @@ ureg_emit_dst( struct ureg_program *ureg,
|
|||||||
assert(dst.File != TGSI_FILE_CONSTANT);
|
assert(dst.File != TGSI_FILE_CONSTANT);
|
||||||
assert(dst.File != TGSI_FILE_INPUT);
|
assert(dst.File != TGSI_FILE_INPUT);
|
||||||
assert(dst.File != TGSI_FILE_SAMPLER);
|
assert(dst.File != TGSI_FILE_SAMPLER);
|
||||||
assert(dst.File != TGSI_FILE_RESOURCE);
|
assert(dst.File != TGSI_FILE_SAMPLER_VIEW);
|
||||||
assert(dst.File != TGSI_FILE_IMMEDIATE);
|
assert(dst.File != TGSI_FILE_IMMEDIATE);
|
||||||
assert(dst.File < TGSI_FILE_COUNT);
|
assert(dst.File < TGSI_FILE_COUNT);
|
||||||
|
|
||||||
@@ -1297,20 +1297,20 @@ emit_decl_range2D(struct ureg_program *ureg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
emit_decl_resource(struct ureg_program *ureg,
|
emit_decl_sampler_view(struct ureg_program *ureg,
|
||||||
unsigned index,
|
unsigned index,
|
||||||
unsigned target,
|
unsigned target,
|
||||||
unsigned return_type_x,
|
unsigned return_type_x,
|
||||||
unsigned return_type_y,
|
unsigned return_type_y,
|
||||||
unsigned return_type_z,
|
unsigned return_type_z,
|
||||||
unsigned return_type_w )
|
unsigned return_type_w )
|
||||||
{
|
{
|
||||||
union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 3);
|
union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 3);
|
||||||
|
|
||||||
out[0].value = 0;
|
out[0].value = 0;
|
||||||
out[0].decl.Type = TGSI_TOKEN_TYPE_DECLARATION;
|
out[0].decl.Type = TGSI_TOKEN_TYPE_DECLARATION;
|
||||||
out[0].decl.NrTokens = 3;
|
out[0].decl.NrTokens = 3;
|
||||||
out[0].decl.File = TGSI_FILE_RESOURCE;
|
out[0].decl.File = TGSI_FILE_SAMPLER_VIEW;
|
||||||
out[0].decl.UsageMask = 0xf;
|
out[0].decl.UsageMask = 0xf;
|
||||||
out[0].decl.Interpolate = TGSI_INTERPOLATE_CONSTANT;
|
out[0].decl.Interpolate = TGSI_INTERPOLATE_CONSTANT;
|
||||||
|
|
||||||
@@ -1319,11 +1319,11 @@ emit_decl_resource(struct ureg_program *ureg,
|
|||||||
out[1].decl_range.Last = index;
|
out[1].decl_range.Last = index;
|
||||||
|
|
||||||
out[2].value = 0;
|
out[2].value = 0;
|
||||||
out[2].decl_resource.Resource = target;
|
out[2].decl_sampler_view.Resource = target;
|
||||||
out[2].decl_resource.ReturnTypeX = return_type_x;
|
out[2].decl_sampler_view.ReturnTypeX = return_type_x;
|
||||||
out[2].decl_resource.ReturnTypeY = return_type_y;
|
out[2].decl_sampler_view.ReturnTypeY = return_type_y;
|
||||||
out[2].decl_resource.ReturnTypeZ = return_type_z;
|
out[2].decl_sampler_view.ReturnTypeZ = return_type_z;
|
||||||
out[2].decl_resource.ReturnTypeW = return_type_w;
|
out[2].decl_sampler_view.ReturnTypeW = return_type_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1473,14 +1473,14 @@ static void emit_decls( struct ureg_program *ureg )
|
|||||||
ureg->sampler[i].Index, 1 );
|
ureg->sampler[i].Index, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ureg->nr_resources; i++) {
|
for (i = 0; i < ureg->nr_sampler_views; i++) {
|
||||||
emit_decl_resource(ureg,
|
emit_decl_sampler_view(ureg,
|
||||||
ureg->resource[i].index,
|
ureg->sampler_view[i].index,
|
||||||
ureg->resource[i].target,
|
ureg->sampler_view[i].target,
|
||||||
ureg->resource[i].return_type_x,
|
ureg->sampler_view[i].return_type_x,
|
||||||
ureg->resource[i].return_type_y,
|
ureg->sampler_view[i].return_type_y,
|
||||||
ureg->resource[i].return_type_z,
|
ureg->sampler_view[i].return_type_z,
|
||||||
ureg->resource[i].return_type_w);
|
ureg->sampler_view[i].return_type_w);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ureg->const_decls.nr_constant_ranges) {
|
if (ureg->const_decls.nr_constant_ranges) {
|
||||||
|
@@ -292,13 +292,13 @@ ureg_DECL_sampler( struct ureg_program *,
|
|||||||
unsigned index );
|
unsigned index );
|
||||||
|
|
||||||
struct ureg_src
|
struct ureg_src
|
||||||
ureg_DECL_resource(struct ureg_program *,
|
ureg_DECL_sampler_view(struct ureg_program *,
|
||||||
unsigned index,
|
unsigned index,
|
||||||
unsigned target,
|
unsigned target,
|
||||||
unsigned return_type_x,
|
unsigned return_type_x,
|
||||||
unsigned return_type_y,
|
unsigned return_type_y,
|
||||||
unsigned return_type_z,
|
unsigned return_type_z,
|
||||||
unsigned return_type_w );
|
unsigned return_type_w );
|
||||||
|
|
||||||
|
|
||||||
static INLINE struct ureg_src
|
static INLINE struct ureg_src
|
||||||
|
@@ -1312,28 +1312,36 @@ This opcode is the inverse of :opcode:`DFRACEXP`.
|
|||||||
dst.zw = \sqrt{src.zw}
|
dst.zw = \sqrt{src.zw}
|
||||||
|
|
||||||
|
|
||||||
.. _resourceopcodes:
|
.. _samplingopcodes:
|
||||||
|
|
||||||
Resource Access Opcodes
|
Resource Sampling Opcodes
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Those opcodes follow very closely semantics of the respective Direct3D
|
Those opcodes follow very closely semantics of the respective Direct3D
|
||||||
instructions. If in doubt double check Direct3D documentation.
|
instructions. If in doubt double check Direct3D documentation.
|
||||||
|
|
||||||
.. opcode:: LOAD - Simplified alternative to the "SAMPLE" instruction.
|
.. opcode:: SAMPLE - Using provided address, sample data from the
|
||||||
Using the provided integer address, LOAD fetches data
|
specified texture using the filtering mode identified
|
||||||
from the specified buffer/texture without any filtering.
|
by the gven sampler. The source data may come from
|
||||||
|
any resource type other than buffers.
|
||||||
|
SAMPLE dst, address, sampler_view, sampler
|
||||||
|
e.g.
|
||||||
|
SAMPLE TEMP[0], TEMP[1], SVIEW[0], SAMP[0]
|
||||||
|
|
||||||
|
.. opcode:: SAMPLE_I - Simplified alternative to the SAMPLE instruction.
|
||||||
|
Using the provided integer address, SAMPLE_I fetches data
|
||||||
|
from the specified sampler view without any filtering.
|
||||||
The source data may come from any resource type other
|
The source data may come from any resource type other
|
||||||
than CUBE.
|
than CUBE.
|
||||||
LOAD dst, address, resource
|
SAMPLE_I dst, address, sampler_view
|
||||||
e.g.
|
e.g.
|
||||||
LOAD TEMP[0], TEMP[1], RES[0]
|
SAMPLE_I TEMP[0], TEMP[1], SVIEW[0]
|
||||||
The 'address' is specified as unsigned integers. If the
|
The 'address' is specified as unsigned integers. If the
|
||||||
'address' is out of range [0...(# texels - 1)] the
|
'address' is out of range [0...(# texels - 1)] the
|
||||||
result of the fetch is always 0 in all components.
|
result of the fetch is always 0 in all components.
|
||||||
As such the instruction doesn't honor address wrap
|
As such the instruction doesn't honor address wrap
|
||||||
modes, in cases where that behavior is desirable
|
modes, in cases where that behavior is desirable
|
||||||
'sample' instruction should be used.
|
'SAMPLE' instruction should be used.
|
||||||
address.w always provides an unsigned integer mipmap
|
address.w always provides an unsigned integer mipmap
|
||||||
level. If the value is out of the range then the
|
level. If the value is out of the range then the
|
||||||
instruction always returns 0 in all components.
|
instruction always returns 0 in all components.
|
||||||
@@ -1348,7 +1356,7 @@ instructions. If in doubt double check Direct3D documentation.
|
|||||||
For 2D texture arrays address.z provides the array
|
For 2D texture arrays address.z provides the array
|
||||||
index, otherwise it exhibits the same behavior as in
|
index, otherwise it exhibits the same behavior as in
|
||||||
the case for 1D texture arrays.
|
the case for 1D texture arrays.
|
||||||
The exeact semantics of the source address are presented
|
The exact semantics of the source address are presented
|
||||||
in the table below:
|
in the table below:
|
||||||
resource type X Y Z W
|
resource type X Y Z W
|
||||||
------------- ------------------------
|
------------- ------------------------
|
||||||
@@ -1364,25 +1372,16 @@ instructions. If in doubt double check Direct3D documentation.
|
|||||||
Where 'mpl' is a mipmap level and 'idx' is the
|
Where 'mpl' is a mipmap level and 'idx' is the
|
||||||
array index.
|
array index.
|
||||||
|
|
||||||
|
.. opcode:: SAMPLE_I_MS - Just like SAMPLE_I but allows fetch data from
|
||||||
.. opcode:: LOAD_MS - Just like LOAD but allows fetch data from
|
|
||||||
multi-sampled surfaces.
|
multi-sampled surfaces.
|
||||||
|
|
||||||
.. opcode:: SAMPLE - Using provided address, sample data from the
|
|
||||||
specified texture using the filtering mode identified
|
|
||||||
by the gven sampler. The source data may come from
|
|
||||||
any resource type other than buffers.
|
|
||||||
SAMPLE dst, address, resource, sampler
|
|
||||||
e.g.
|
|
||||||
SAMPLE TEMP[0], TEMP[1], RES[0], SAMP[0]
|
|
||||||
|
|
||||||
.. opcode:: SAMPLE_B - Just like the SAMPLE instruction with the
|
.. opcode:: SAMPLE_B - Just like the SAMPLE instruction with the
|
||||||
exception that an additiona bias is applied to the
|
exception that an additiona bias is applied to the
|
||||||
level of detail computed as part of the instruction
|
level of detail computed as part of the instruction
|
||||||
execution.
|
execution.
|
||||||
SAMPLE_B dst, address, resource, sampler, lod_bias
|
SAMPLE_B dst, address, sampler_view, sampler, lod_bias
|
||||||
e.g.
|
e.g.
|
||||||
SAMPLE_B TEMP[0], TEMP[1], RES[0], SAMP[0], TEMP[2].x
|
SAMPLE_B TEMP[0], TEMP[1], SVIEW[0], SAMP[0], TEMP[2].x
|
||||||
|
|
||||||
.. opcode:: SAMPLE_C - Similar to the SAMPLE instruction but it
|
.. opcode:: SAMPLE_C - Similar to the SAMPLE instruction but it
|
||||||
performs a comparison filter. The operands to SAMPLE_C
|
performs a comparison filter. The operands to SAMPLE_C
|
||||||
@@ -1394,33 +1393,32 @@ instructions. If in doubt double check Direct3D documentation.
|
|||||||
reference value against the red component value for the
|
reference value against the red component value for the
|
||||||
surce resource at each texel that the currently configured
|
surce resource at each texel that the currently configured
|
||||||
texture filter covers based on the provided coordinates.
|
texture filter covers based on the provided coordinates.
|
||||||
SAMPLE_C dst, address, resource.r, sampler, ref_value
|
SAMPLE_C dst, address, sampler_view.r, sampler, ref_value
|
||||||
e.g.
|
e.g.
|
||||||
SAMPLE_C TEMP[0], TEMP[1], RES[0].r, SAMP[0], TEMP[2].x
|
SAMPLE_C TEMP[0], TEMP[1], SVIEW[0].r, SAMP[0], TEMP[2].x
|
||||||
|
|
||||||
.. opcode:: SAMPLE_C_LZ - Same as SAMPLE_C, but LOD is 0 and derivatives
|
.. opcode:: SAMPLE_C_LZ - Same as SAMPLE_C, but LOD is 0 and derivatives
|
||||||
are ignored. The LZ stands for level-zero.
|
are ignored. The LZ stands for level-zero.
|
||||||
SAMPLE_C_LZ dst, address, resource.r, sampler, ref_value
|
SAMPLE_C_LZ dst, address, sampler_view.r, sampler, ref_value
|
||||||
e.g.
|
e.g.
|
||||||
SAMPLE_C_LZ TEMP[0], TEMP[1], RES[0].r, SAMP[0], TEMP[2].x
|
SAMPLE_C_LZ TEMP[0], TEMP[1], SVIEW[0].r, SAMP[0], TEMP[2].x
|
||||||
|
|
||||||
|
|
||||||
.. opcode:: SAMPLE_D - SAMPLE_D is identical to the SAMPLE opcode except
|
.. opcode:: SAMPLE_D - SAMPLE_D is identical to the SAMPLE opcode except
|
||||||
that the derivatives for the source address in the x
|
that the derivatives for the source address in the x
|
||||||
direction and the y direction are provided by extra
|
direction and the y direction are provided by extra
|
||||||
parameters.
|
parameters.
|
||||||
SAMPLE_D dst, address, resource, sampler, der_x, der_y
|
SAMPLE_D dst, address, sampler_view, sampler, der_x, der_y
|
||||||
e.g.
|
e.g.
|
||||||
SAMPLE_D TEMP[0], TEMP[1], RES[0], SAMP[0], TEMP[2], TEMP[3]
|
SAMPLE_D TEMP[0], TEMP[1], SVIEW[0], SAMP[0], TEMP[2], TEMP[3]
|
||||||
|
|
||||||
.. opcode:: SAMPLE_L - SAMPLE_L is identical to the SAMPLE opcode except
|
.. opcode:: SAMPLE_L - SAMPLE_L is identical to the SAMPLE opcode except
|
||||||
that the LOD is provided directly as a scalar value,
|
that the LOD is provided directly as a scalar value,
|
||||||
representing no anisotropy. Source addresses A channel
|
representing no anisotropy. Source addresses A channel
|
||||||
is used as the LOD.
|
is used as the LOD.
|
||||||
SAMPLE_L dst, address, resource, sampler
|
SAMPLE_L dst, address, sampler_view, sampler
|
||||||
e.g.
|
e.g.
|
||||||
SAMPLE_L TEMP[0], TEMP[1], RES[0], SAMP[0]
|
SAMPLE_L TEMP[0], TEMP[1], SVIEW[0], SAMP[0]
|
||||||
|
|
||||||
|
|
||||||
.. opcode:: GATHER4 - Gathers the four texels to be used in a bi-linear
|
.. opcode:: GATHER4 - Gathers the four texels to be used in a bi-linear
|
||||||
filtering operation and packs them into a single register.
|
filtering operation and packs them into a single register.
|
||||||
@@ -1435,18 +1433,18 @@ instructions. If in doubt double check Direct3D documentation.
|
|||||||
the magnitude of the deltas are half a texel.
|
the magnitude of the deltas are half a texel.
|
||||||
|
|
||||||
|
|
||||||
.. opcode:: RESINFO - query the dimensions of a given input buffer.
|
.. opcode:: SVIEWINFO - query the dimensions of a given sampler view.
|
||||||
dst receives width, height, depth or array size and
|
dst receives width, height, depth or array size and
|
||||||
number of mipmap levels. The dst can have a writemask
|
number of mipmap levels. The dst can have a writemask
|
||||||
which will specify what info is the caller interested
|
which will specify what info is the caller interested
|
||||||
in.
|
in.
|
||||||
RESINFO dst, src_mip_level, resource
|
SVIEWINFO dst, src_mip_level, sampler_view
|
||||||
e.g.
|
e.g.
|
||||||
RESINFO TEMP[0], TEMP[1].x, RES[0]
|
SVIEWINFO TEMP[0], TEMP[1].x, SVIEW[0]
|
||||||
src_mip_level is an unsigned integer scalar. If it's
|
src_mip_level is an unsigned integer scalar. If it's
|
||||||
out of range then returns 0 for width, height and
|
out of range then returns 0 for width, height and
|
||||||
depth/array size but the total number of mipmap is
|
depth/array size but the total number of mipmap is
|
||||||
still returned correctly for the given resource.
|
still returned correctly for the given sampler view.
|
||||||
The returned width, height and depth values are for
|
The returned width, height and depth values are for
|
||||||
the mipmap level selected by the src_mip_level and
|
the mipmap level selected by the src_mip_level and
|
||||||
are in the number of texels.
|
are in the number of texels.
|
||||||
@@ -1463,6 +1461,36 @@ instructions. If in doubt double check Direct3D documentation.
|
|||||||
not a render target, the result is 0.
|
not a render target, the result is 0.
|
||||||
|
|
||||||
|
|
||||||
|
.. _resourceopcodes:
|
||||||
|
|
||||||
|
Resource Access Opcodes
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. opcode:: LOAD - Fetch data from a shader resource
|
||||||
|
|
||||||
|
Syntax: ``LOAD dst, resource, address``
|
||||||
|
|
||||||
|
Example: ``LOAD TEMP[0], RES[0], TEMP[1]``
|
||||||
|
|
||||||
|
Using the provided integer address, LOAD fetches data
|
||||||
|
from the specified buffer or texture without any
|
||||||
|
filtering.
|
||||||
|
|
||||||
|
The 'address' is specified as a vector of unsigned
|
||||||
|
integers. If the 'address' is out of range the result
|
||||||
|
is unspecified.
|
||||||
|
|
||||||
|
Only the first mipmap level of a resource can be read
|
||||||
|
from using this instruction.
|
||||||
|
|
||||||
|
For 1D or 2D texture arrays, the array index is
|
||||||
|
provided as an unsigned integer in address.y or
|
||||||
|
address.z, respectively. address.yz are ignored for
|
||||||
|
buffers and 1D textures. address.z is ignored for 1D
|
||||||
|
texture arrays and 2D textures. address.w is always
|
||||||
|
ignored.
|
||||||
|
|
||||||
|
|
||||||
Explanation of symbols used
|
Explanation of symbols used
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
@@ -1690,12 +1718,28 @@ is a writable stencil reference value. Only the Y component is writable.
|
|||||||
This allows the fragment shader to change the fragments stencilref value.
|
This allows the fragment shader to change the fragments stencilref value.
|
||||||
|
|
||||||
|
|
||||||
Declaration Resource
|
Declaration Sampler View
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Follows Declaration token if file is TGSI_FILE_SAMPLER_VIEW.
|
||||||
|
|
||||||
|
DCL SVIEW[#], resource, type(s)
|
||||||
|
|
||||||
|
Declares a shader input sampler view and assigns it to a SVIEW[#]
|
||||||
|
register.
|
||||||
|
|
||||||
|
resource can be one of BUFFER, 1D, 2D, 3D, 1DArray and 2DArray.
|
||||||
|
|
||||||
|
type must be 1 or 4 entries (if specifying on a per-component
|
||||||
|
level) out of UNORM, SNORM, SINT, UINT and FLOAT.
|
||||||
|
|
||||||
|
|
||||||
|
Declaration Resource
|
||||||
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Follows Declaration token if file is TGSI_FILE_RESOURCE.
|
Follows Declaration token if file is TGSI_FILE_RESOURCE.
|
||||||
|
|
||||||
DCL RES[#], resource, type(s)
|
DCL RES[#], resource
|
||||||
|
|
||||||
Declares a shader input resource and assigns it to a RES[#]
|
Declares a shader input resource and assigns it to a RES[#]
|
||||||
register.
|
register.
|
||||||
@@ -1703,9 +1747,6 @@ Declaration Resource
|
|||||||
resource can be one of BUFFER, 1D, 2D, 3D, CUBE, 1DArray and
|
resource can be one of BUFFER, 1D, 2D, 3D, CUBE, 1DArray and
|
||||||
2DArray.
|
2DArray.
|
||||||
|
|
||||||
type must be 1 or 4 entries (if specifying on a per-component
|
|
||||||
level) out of UNORM, SNORM, SINT, UINT and FLOAT.
|
|
||||||
|
|
||||||
|
|
||||||
Properties
|
Properties
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@@ -548,7 +548,7 @@ static nv50_ir::operation translateOpcode(uint opcode)
|
|||||||
NV50_IR_OPCODE_CASE(SAMPLE_D, TXD);
|
NV50_IR_OPCODE_CASE(SAMPLE_D, TXD);
|
||||||
NV50_IR_OPCODE_CASE(SAMPLE_L, TXL);
|
NV50_IR_OPCODE_CASE(SAMPLE_L, TXL);
|
||||||
NV50_IR_OPCODE_CASE(GATHER4, TXG);
|
NV50_IR_OPCODE_CASE(GATHER4, TXG);
|
||||||
NV50_IR_OPCODE_CASE(RESINFO, TXQ);
|
NV50_IR_OPCODE_CASE(SVIEWINFO, TXQ);
|
||||||
|
|
||||||
NV50_IR_OPCODE_CASE(END, EXIT);
|
NV50_IR_OPCODE_CASE(END, EXIT);
|
||||||
|
|
||||||
@@ -597,8 +597,8 @@ public:
|
|||||||
|
|
||||||
int clipVertexOutput;
|
int clipVertexOutput;
|
||||||
|
|
||||||
uint8_t *resourceTargets; // TGSI_TEXTURE_*
|
uint8_t *samplerViewTargets; // TGSI_TEXTURE_*
|
||||||
unsigned resourceCount;
|
unsigned samplerViewCount;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int inferSysValDirection(unsigned sn) const;
|
int inferSysValDirection(unsigned sn) const;
|
||||||
@@ -617,7 +617,7 @@ Source::Source(struct nv50_ir_prog_info *prog) : info(prog)
|
|||||||
if (prog->dbgFlags & NV50_IR_DEBUG_BASIC)
|
if (prog->dbgFlags & NV50_IR_DEBUG_BASIC)
|
||||||
tgsi_dump(tokens, 0);
|
tgsi_dump(tokens, 0);
|
||||||
|
|
||||||
resourceTargets = NULL;
|
samplerViewTargets = NULL;
|
||||||
|
|
||||||
mainTempsInLMem = FALSE;
|
mainTempsInLMem = FALSE;
|
||||||
}
|
}
|
||||||
@@ -632,8 +632,8 @@ Source::~Source()
|
|||||||
if (info->immd.type)
|
if (info->immd.type)
|
||||||
FREE(info->immd.type);
|
FREE(info->immd.type);
|
||||||
|
|
||||||
if (resourceTargets)
|
if (samplerViewTargets)
|
||||||
delete[] resourceTargets;
|
delete[] samplerViewTargets;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Source::scanSource()
|
bool Source::scanSource()
|
||||||
@@ -650,8 +650,8 @@ bool Source::scanSource()
|
|||||||
|
|
||||||
clipVertexOutput = -1;
|
clipVertexOutput = -1;
|
||||||
|
|
||||||
resourceCount = scan.file_max[TGSI_FILE_RESOURCE] + 1;
|
samplerViewCount = scan.file_max[TGSI_FILE_SAMPLER_VIEW] + 1;
|
||||||
resourceTargets = new uint8_t[resourceCount];
|
samplerViewTargets = new uint8_t[samplerViewCount];
|
||||||
|
|
||||||
info->immd.bufSize = 0;
|
info->immd.bufSize = 0;
|
||||||
tempArrayCount = 0;
|
tempArrayCount = 0;
|
||||||
@@ -874,9 +874,9 @@ bool Source::scanDeclaration(const struct tgsi_full_declaration *decl)
|
|||||||
info->sv[i].input = inferSysValDirection(sn);
|
info->sv[i].input = inferSysValDirection(sn);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TGSI_FILE_RESOURCE:
|
case TGSI_FILE_SAMPLER_VIEW:
|
||||||
for (i = first; i <= last; ++i)
|
for (i = first; i <= last; ++i)
|
||||||
resourceTargets[i] = decl->Resource.Resource;
|
samplerViewTargets[i] = decl->SamplerView.Resource;
|
||||||
break;
|
break;
|
||||||
case TGSI_FILE_IMMEDIATE_ARRAY:
|
case TGSI_FILE_IMMEDIATE_ARRAY:
|
||||||
{
|
{
|
||||||
@@ -1000,13 +1000,15 @@ bool Source::scanInstruction(const struct tgsi_full_instruction *inst)
|
|||||||
nv50_ir::TexInstruction::Target
|
nv50_ir::TexInstruction::Target
|
||||||
Instruction::getTexture(const tgsi::Source *code, int s) const
|
Instruction::getTexture(const tgsi::Source *code, int s) const
|
||||||
{
|
{
|
||||||
if (insn->Instruction.Texture) {
|
switch (getSrc(s).getFile()) {
|
||||||
return translateTexture(insn->Texture.Texture);
|
case TGSI_FILE_SAMPLER_VIEW: {
|
||||||
} else {
|
|
||||||
// XXX: indirect access
|
// XXX: indirect access
|
||||||
unsigned int r = getSrc(s).getIndex(0);
|
unsigned int r = getSrc(s).getIndex(0);
|
||||||
assert(r < code->resourceCount);
|
assert(r < code->samplerViewCount);
|
||||||
return translateTexture(code->resourceTargets[r]);
|
return translateTexture(code->samplerViewTargets[r]);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return translateTexture(insn->Texture.Texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2042,7 +2044,7 @@ Converter::handleInstruction(const struct tgsi_full_instruction *insn)
|
|||||||
handleTXF(dst0, 1);
|
handleTXF(dst0, 1);
|
||||||
break;
|
break;
|
||||||
case TGSI_OPCODE_TXQ:
|
case TGSI_OPCODE_TXQ:
|
||||||
case TGSI_OPCODE_RESINFO:
|
case TGSI_OPCODE_SVIEWINFO:
|
||||||
handleTXQ(dst0, TXQ_DIMS);
|
handleTXQ(dst0, TXQ_DIMS);
|
||||||
break;
|
break;
|
||||||
case TGSI_OPCODE_F2I:
|
case TGSI_OPCODE_F2I:
|
||||||
|
@@ -5220,16 +5220,16 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = {
|
|||||||
{TGSI_OPCODE_CASE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
{TGSI_OPCODE_CASE, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_DEFAULT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
{TGSI_OPCODE_DEFAULT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_ENDSWITCH, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
{TGSI_OPCODE_ENDSWITCH, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_LOAD, 0, 0, tgsi_unsupported},
|
|
||||||
{TGSI_OPCODE_LOAD_MS, 0, 0, tgsi_unsupported},
|
|
||||||
{TGSI_OPCODE_SAMPLE, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE, 0, 0, tgsi_unsupported},
|
||||||
|
{TGSI_OPCODE_SAMPLE_I, 0, 0, tgsi_unsupported},
|
||||||
|
{TGSI_OPCODE_SAMPLE_I_MS, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_B, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_B, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_C, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_C, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_C_LZ, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_C_LZ, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_D, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_D, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_L, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_L, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_GATHER4, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_GATHER4, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_RESINFO, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SVIEWINFO, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_POS, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_POS, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_INFO, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_INFO, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_UARL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT, tgsi_r600_arl},
|
{TGSI_OPCODE_UARL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT, tgsi_r600_arl},
|
||||||
@@ -5394,16 +5394,16 @@ static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction[] = {
|
|||||||
{TGSI_OPCODE_CASE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
{TGSI_OPCODE_CASE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_DEFAULT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
{TGSI_OPCODE_DEFAULT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_ENDSWITCH, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
{TGSI_OPCODE_ENDSWITCH, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_LOAD, 0, 0, tgsi_unsupported},
|
|
||||||
{TGSI_OPCODE_LOAD_MS, 0, 0, tgsi_unsupported},
|
|
||||||
{TGSI_OPCODE_SAMPLE, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE, 0, 0, tgsi_unsupported},
|
||||||
|
{TGSI_OPCODE_SAMPLE_I, 0, 0, tgsi_unsupported},
|
||||||
|
{TGSI_OPCODE_SAMPLE_I_MS, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_B, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_B, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_C, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_C, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_C_LZ, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_C_LZ, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_D, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_D, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_L, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_L, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_GATHER4, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_GATHER4, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_RESINFO, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SVIEWINFO, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_POS, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_POS, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_INFO, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_INFO, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_UARL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT, tgsi_eg_arl},
|
{TGSI_OPCODE_UARL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT, tgsi_eg_arl},
|
||||||
@@ -5568,16 +5568,16 @@ static struct r600_shader_tgsi_instruction cm_shader_tgsi_instruction[] = {
|
|||||||
{TGSI_OPCODE_CASE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
{TGSI_OPCODE_CASE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_DEFAULT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
{TGSI_OPCODE_DEFAULT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_ENDSWITCH, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
{TGSI_OPCODE_ENDSWITCH, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_LOAD, 0, 0, tgsi_unsupported},
|
|
||||||
{TGSI_OPCODE_LOAD_MS, 0, 0, tgsi_unsupported},
|
|
||||||
{TGSI_OPCODE_SAMPLE, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE, 0, 0, tgsi_unsupported},
|
||||||
|
{TGSI_OPCODE_SAMPLE_I, 0, 0, tgsi_unsupported},
|
||||||
|
{TGSI_OPCODE_SAMPLE_I_MS, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_B, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_B, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_C, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_C, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_C_LZ, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_C_LZ, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_D, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_D, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_L, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_L, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_GATHER4, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_GATHER4, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_RESINFO, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SVIEWINFO, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_POS, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_POS, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_SAMPLE_INFO, 0, 0, tgsi_unsupported},
|
{TGSI_OPCODE_SAMPLE_INFO, 0, 0, tgsi_unsupported},
|
||||||
{TGSI_OPCODE_UARL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT, tgsi_eg_arl},
|
{TGSI_OPCODE_UARL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT, tgsi_eg_arl},
|
||||||
|
@@ -76,6 +76,7 @@ enum tgsi_file_type {
|
|||||||
TGSI_FILE_IMMEDIATE_ARRAY =10,
|
TGSI_FILE_IMMEDIATE_ARRAY =10,
|
||||||
TGSI_FILE_TEMPORARY_ARRAY =11,
|
TGSI_FILE_TEMPORARY_ARRAY =11,
|
||||||
TGSI_FILE_RESOURCE =12,
|
TGSI_FILE_RESOURCE =12,
|
||||||
|
TGSI_FILE_SAMPLER_VIEW =13,
|
||||||
TGSI_FILE_COUNT /**< how many TGSI_FILE_ types */
|
TGSI_FILE_COUNT /**< how many TGSI_FILE_ types */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -159,6 +160,11 @@ struct tgsi_declaration_semantic
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct tgsi_declaration_resource {
|
struct tgsi_declaration_resource {
|
||||||
|
unsigned Resource : 8; /**< one of TGSI_TEXTURE_ */
|
||||||
|
unsigned Padding : 24;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct tgsi_declaration_sampler_view {
|
||||||
unsigned Resource : 8; /**< one of TGSI_TEXTURE_ */
|
unsigned Resource : 8; /**< one of TGSI_TEXTURE_ */
|
||||||
unsigned ReturnTypeX : 6; /**< one of enum pipe_type */
|
unsigned ReturnTypeX : 6; /**< one of enum pipe_type */
|
||||||
unsigned ReturnTypeY : 6; /**< one of enum pipe_type */
|
unsigned ReturnTypeY : 6; /**< one of enum pipe_type */
|
||||||
@@ -372,16 +378,16 @@ struct tgsi_property_data {
|
|||||||
#define TGSI_OPCODE_ENDSWITCH 144
|
#define TGSI_OPCODE_ENDSWITCH 144
|
||||||
|
|
||||||
/* resource related opcodes */
|
/* resource related opcodes */
|
||||||
#define TGSI_OPCODE_LOAD 145
|
#define TGSI_OPCODE_SAMPLE 145
|
||||||
#define TGSI_OPCODE_LOAD_MS 146
|
#define TGSI_OPCODE_SAMPLE_I 146
|
||||||
#define TGSI_OPCODE_SAMPLE 147
|
#define TGSI_OPCODE_SAMPLE_I_MS 147
|
||||||
#define TGSI_OPCODE_SAMPLE_B 148
|
#define TGSI_OPCODE_SAMPLE_B 148
|
||||||
#define TGSI_OPCODE_SAMPLE_C 149
|
#define TGSI_OPCODE_SAMPLE_C 149
|
||||||
#define TGSI_OPCODE_SAMPLE_C_LZ 150
|
#define TGSI_OPCODE_SAMPLE_C_LZ 150
|
||||||
#define TGSI_OPCODE_SAMPLE_D 151
|
#define TGSI_OPCODE_SAMPLE_D 151
|
||||||
#define TGSI_OPCODE_SAMPLE_L 152
|
#define TGSI_OPCODE_SAMPLE_L 152
|
||||||
#define TGSI_OPCODE_GATHER4 153
|
#define TGSI_OPCODE_GATHER4 153
|
||||||
#define TGSI_OPCODE_RESINFO 154
|
#define TGSI_OPCODE_SVIEWINFO 154
|
||||||
#define TGSI_OPCODE_SAMPLE_POS 155
|
#define TGSI_OPCODE_SAMPLE_POS 155
|
||||||
#define TGSI_OPCODE_SAMPLE_INFO 156
|
#define TGSI_OPCODE_SAMPLE_INFO 156
|
||||||
|
|
||||||
@@ -390,7 +396,9 @@ struct tgsi_property_data {
|
|||||||
#define TGSI_OPCODE_IABS 159
|
#define TGSI_OPCODE_IABS 159
|
||||||
#define TGSI_OPCODE_ISSG 160
|
#define TGSI_OPCODE_ISSG 160
|
||||||
|
|
||||||
#define TGSI_OPCODE_LAST 161
|
#define TGSI_OPCODE_LOAD 161
|
||||||
|
|
||||||
|
#define TGSI_OPCODE_LAST 162
|
||||||
|
|
||||||
#define TGSI_SAT_NONE 0 /* do not saturate */
|
#define TGSI_SAT_NONE 0 /* do not saturate */
|
||||||
#define TGSI_SAT_ZERO_ONE 1 /* clamp to [0,1] */
|
#define TGSI_SAT_ZERO_ONE 1 /* clamp to [0,1] */
|
||||||
|
@@ -446,7 +446,7 @@ struct sm4_to_tgsi_converter
|
|||||||
break;
|
break;
|
||||||
case SM4_OPCODE_RESINFO:
|
case SM4_OPCODE_RESINFO:
|
||||||
// TODO: return type
|
// TODO: return type
|
||||||
ureg_RESINFO(ureg, _dst(), _src(1), resources[_idx(SM4_FILE_RESOURCE, 2)]);
|
ureg_SVIEWINFO(ureg, _dst(), _src(1), resources[_idx(SM4_FILE_RESOURCE, 2)]);
|
||||||
break;
|
break;
|
||||||
// TODO: sample index, texture offset
|
// TODO: sample index, texture offset
|
||||||
case SM4_OPCODE_LD: // dst, coord_int, res; mipmap level in last coord_int arg
|
case SM4_OPCODE_LD: // dst, coord_int, res; mipmap level in last coord_int arg
|
||||||
@@ -750,11 +750,12 @@ next:;
|
|||||||
}
|
}
|
||||||
if(resources.size() <= (unsigned)idx)
|
if(resources.size() <= (unsigned)idx)
|
||||||
resources.resize(idx + 1);
|
resources.resize(idx + 1);
|
||||||
resources[idx] = ureg_DECL_resource(ureg, idx, targets[idx].first,
|
resources[idx] = ureg_DECL_sampler_view(
|
||||||
res_return_type(dcl.rrt.x),
|
ureg, idx, targets[idx].first,
|
||||||
res_return_type(dcl.rrt.y),
|
res_return_type(dcl.rrt.x),
|
||||||
res_return_type(dcl.rrt.z),
|
res_return_type(dcl.rrt.y),
|
||||||
res_return_type(dcl.rrt.w));
|
res_return_type(dcl.rrt.z),
|
||||||
|
res_return_type(dcl.rrt.w));
|
||||||
break;
|
break;
|
||||||
case SM4_OPCODE_DCL_SAMPLER:
|
case SM4_OPCODE_DCL_SAMPLER:
|
||||||
check(idx >= 0);
|
check(idx >= 0);
|
||||||
|
Reference in New Issue
Block a user