aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-05-10 16:17:35 +0200
committerMarek Olšák <[email protected]>2015-06-05 19:44:32 +0200
commit1fa6c99e24890359e9cee2a9da02f21ea77b9f15 (patch)
tree83cd3a4a629c4ac38dfefaeb75291632bba9a9f8 /src
parentd3fbc659868ecdbfe14600a75eafe28174f7d99e (diff)
tgsi/ureg: add support for GS input array declarations
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.c37
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ureg.h4
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp2
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c2
4 files changed, 30 insertions, 15 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index ad13f64c586..b1aebfa1cb9 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -302,11 +302,13 @@ ureg_DECL_vs_input( struct ureg_program *ureg,
struct ureg_src
ureg_DECL_input(struct ureg_program *ureg,
- unsigned semantic_name,
- unsigned semantic_index)
+ unsigned semantic_name,
+ unsigned semantic_index,
+ unsigned array_id,
+ unsigned array_size)
{
return ureg_DECL_fs_input_cyl_centroid(ureg, semantic_name, semantic_index,
- 0, 0, 0, 0, 1);
+ 0, 0, 0, array_id, array_size);
}
@@ -1252,12 +1254,14 @@ ureg_label_insn(struct ureg_program *ureg,
static void
emit_decl_semantic(struct ureg_program *ureg,
unsigned file,
- unsigned index,
+ unsigned first,
+ unsigned last,
unsigned semantic_name,
unsigned semantic_index,
- unsigned usage_mask)
+ unsigned usage_mask,
+ unsigned array_id)
{
- union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 3);
+ union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, array_id ? 4 : 3);
out[0].value = 0;
out[0].decl.Type = TGSI_TOKEN_TYPE_DECLARATION;
@@ -1265,14 +1269,20 @@ emit_decl_semantic(struct ureg_program *ureg,
out[0].decl.File = file;
out[0].decl.UsageMask = usage_mask;
out[0].decl.Semantic = 1;
+ out[0].decl.Array = array_id != 0;
out[1].value = 0;
- out[1].decl_range.First = index;
- out[1].decl_range.Last = index;
+ out[1].decl_range.First = first;
+ out[1].decl_range.Last = last;
out[2].value = 0;
out[2].decl_semantic.Name = semantic_name;
out[2].decl_semantic.Index = semantic_index;
+
+ if (array_id) {
+ out[3].value = 0;
+ out[3].array.ArrayID = array_id;
+ }
}
@@ -1485,9 +1495,11 @@ static void emit_decls( struct ureg_program *ureg )
emit_decl_semantic(ureg,
TGSI_FILE_INPUT,
ureg->input[i].first,
+ ureg->input[i].last,
ureg->input[i].semantic_name,
ureg->input[i].semantic_index,
- TGSI_WRITEMASK_XYZW);
+ TGSI_WRITEMASK_XYZW,
+ ureg->input[i].array_id);
}
}
@@ -1495,18 +1507,19 @@ static void emit_decls( struct ureg_program *ureg )
emit_decl_semantic(ureg,
TGSI_FILE_SYSTEM_VALUE,
ureg->system_value[i].index,
+ ureg->system_value[i].index,
ureg->system_value[i].semantic_name,
ureg->system_value[i].semantic_index,
- TGSI_WRITEMASK_XYZW);
+ TGSI_WRITEMASK_XYZW, 0);
}
for (i = 0; i < ureg->nr_outputs; i++) {
emit_decl_semantic(ureg,
TGSI_FILE_OUTPUT,
- i,
+ i, i,
ureg->output[i].semantic_name,
ureg->output[i].semantic_index,
- ureg->output[i].usage_mask);
+ ureg->output[i].usage_mask, 0);
}
for (i = 0; i < ureg->nr_samplers; i++) {
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
index 7ad4c93981c..e6304697938 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h
@@ -211,7 +211,9 @@ ureg_DECL_vs_input( struct ureg_program *,
struct ureg_src
ureg_DECL_input(struct ureg_program *,
unsigned semantic_name,
- unsigned semantic_index);
+ unsigned semantic_index,
+ unsigned array_id,
+ unsigned array_size);
struct ureg_src
ureg_DECL_system_value(struct ureg_program *,
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index c1810b69247..95968120730 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -5203,7 +5203,7 @@ st_translate_program(
for (i = 0; i < numInputs; i++) {
t->inputs[i] = ureg_DECL_input(ureg,
inputSemanticName[i],
- inputSemanticIndex[i]);
+ inputSemanticIndex[i], 0, 1);
}
for (i = 0; i < numOutputs; i++) {
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 8efbc6fd69e..896e239ee68 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -1097,7 +1097,7 @@ st_translate_mesa_program(
for (i = 0; i < numInputs; i++) {
t->inputs[i] = ureg_DECL_input(ureg,
inputSemanticName[i],
- inputSemanticIndex[i]);
+ inputSemanticIndex[i], 0, 1);
}
for (i = 0; i < numOutputs; i++) {