[Mesa-dev] [PATCH 1/3] d3d10: allow indexable temporaries as relative registers
Zack Rusin
zackr at vmware.com
Tue Feb 4 03:52:50 CET 2014
Indexable temporaries are 2d (the index of the array and the index
within the array) and can be used both as outputs, inputs and relative
addressing registers. This fixes parsing of indexable temporaries
and fixes their parsing in relative addressing.
Signed-off-by: Zack Rusin <zackr at vmware.com>
---
src/gallium/state_trackers/d3d10/ShaderParse.c | 14 ++++++++++----
src/gallium/state_trackers/d3d10/ShaderParse.h | 2 +-
src/gallium/state_trackers/d3d10/ShaderTGSI.c | 8 +++++++-
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/gallium/state_trackers/d3d10/ShaderParse.c b/src/gallium/state_trackers/d3d10/ShaderParse.c
index 38ec2fe..7cec385 100644
--- a/src/gallium/state_trackers/d3d10/ShaderParse.c
+++ b/src/gallium/state_trackers/d3d10/ShaderParse.c
@@ -207,13 +207,19 @@ parse_relative_operand(const unsigned **curr,
assert(operand->type != D3D10_SB_OPERAND_TYPE_IMMEDIATE32);
/* Index dimension. */
- assert(DECODE_D3D10_SB_OPERAND_INDEX_DIMENSION(**curr) == D3D10_SB_OPERAND_INDEX_1D);
assert(DECODE_D3D10_SB_OPERAND_INDEX_REPRESENTATION(0, **curr) == D3D10_SB_OPERAND_INDEX_IMMEDIATE32);
- (*curr)++;
-
- operand->index[0].imm = **curr;
+ if (DECODE_D3D10_SB_OPERAND_INDEX_DIMENSION(**curr) == D3D10_SB_OPERAND_INDEX_1D) {
+ (*curr)++;
+ operand->index[0].imm = **curr;
+ } else {
+ assert(DECODE_D3D10_SB_OPERAND_INDEX_DIMENSION(**curr) == D3D10_SB_OPERAND_INDEX_2D);
+ (*curr)++;
+ operand->index[0].imm = **curr;
+ (*curr)++;
+ operand->index[1].imm = **curr;
+ }
(*curr)++;
}
diff --git a/src/gallium/state_trackers/d3d10/ShaderParse.h b/src/gallium/state_trackers/d3d10/ShaderParse.h
index 64f177c..5971864 100644
--- a/src/gallium/state_trackers/d3d10/ShaderParse.h
+++ b/src/gallium/state_trackers/d3d10/ShaderParse.h
@@ -54,7 +54,7 @@ struct Shader_relative_index {
struct Shader_relative_operand {
D3D10_SB_OPERAND_TYPE type;
- struct Shader_relative_index index[1];
+ struct Shader_relative_index index[2];
D3D10_SB_4_COMPONENT_NAME comp;
};
diff --git a/src/gallium/state_trackers/d3d10/ShaderTGSI.c b/src/gallium/state_trackers/d3d10/ShaderTGSI.c
index 9fb6b1d..2e42b8b 100644
--- a/src/gallium/state_trackers/d3d10/ShaderTGSI.c
+++ b/src/gallium/state_trackers/d3d10/ShaderTGSI.c
@@ -637,9 +637,15 @@ translate_relative_operand(struct Shader_xlate *sx,
reg = sx->prim_id;
break;
+ case D3D10_SB_OPERAND_TYPE_INDEXABLE_TEMP:
+ assert(operand->index[1].imm < SHADER_MAX_TEMPS);
+
+ reg = ureg_src(sx->temps[sx->indexable_temp_offsets[operand->index[0].imm] +
+ operand->index[1].imm]);
+ break;
+
case D3D10_SB_OPERAND_TYPE_INPUT:
case D3D10_SB_OPERAND_TYPE_OUTPUT:
- case D3D10_SB_OPERAND_TYPE_INDEXABLE_TEMP:
case D3D10_SB_OPERAND_TYPE_IMMEDIATE32:
case D3D10_SB_OPERAND_TYPE_IMMEDIATE64:
case D3D10_SB_OPERAND_TYPE_SAMPLER:
--
1.8.3.2
More information about the mesa-dev
mailing list