summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2017-11-18 10:44:36 +0100
committerChristian Gmeiner <[email protected]>2017-11-30 07:33:02 +0100
commit5cc36f9f2183ce17c38b19eea865ed742478e767 (patch)
tree47f6479f607228a19494e03404a04708eb936524 /src
parent3d09bb390a396ce89b6cb025d84e4076d8b27ae0 (diff)
etnaviv: GC7000: Make point sprites work on HALTI5
Track varying component offset of the point size output, as well as provide the offset of the point coord input. Signed-off-by: Wladimir J. van der Laan <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_compiler.c21
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_compiler.h1
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_shader.c8
3 files changed, 24 insertions, 6 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
index 41ab4031f6c..bbc61a59fc6 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
@@ -2550,12 +2550,14 @@ bool
etna_link_shader(struct etna_shader_link_info *info,
const struct etna_shader_variant *vs, const struct etna_shader_variant *fs)
{
+ int comp_ofs = 0;
/* For each fragment input we need to find the associated vertex shader
* output, which can be found by matching on semantic name and index. A
* binary search could be used because the vs outputs are sorted by their
* semantic index and grouped by semantic type by fill_in_vs_outputs.
*/
assert(fs->infile.num_reg < ETNA_NUM_INPUTS);
+ info->pcoord_varying_comp_ofs = -1;
for (int idx = 0; idx < fs->infile.num_reg; ++idx) {
const struct etna_shader_inout *fsio = &fs->infile.reg[idx];
@@ -2582,14 +2584,21 @@ etna_link_shader(struct etna_shader_link_info *info,
varying->use[3] = VARYING_COMPONENT_USE_USED;
- /* point coord is position output from VS, so has no dedicated reg */
- if (fsio->semantic.Name == TGSI_SEMANTIC_PCOORD)
- continue;
+ /* point coord is an input to the PS without matching VS output,
+ * so it gets a varying slot without being assigned a VS register.
+ */
+ if (fsio->semantic.Name == TGSI_SEMANTIC_PCOORD) {
+ info->pcoord_varying_comp_ofs = comp_ofs;
+ } else {
+ if (vsio == NULL) { /* not found -- link error */
+ BUG("Semantic %d value %d not found in vertex shader outputs\n", fsio->semantic.Name, fsio->semantic.Index);
+ return true;
+ }
- if (vsio == NULL)
- return true; /* not found -- link error */
+ varying->reg = vsio->reg;
+ }
- varying->reg = vsio->reg;
+ comp_ofs += varying->num_components;
}
assert(info->num_varyings == fs->infile.num_reg);
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.h b/src/gallium/drivers/etnaviv/etnaviv_compiler.h
index f5c16890a66..48b1b218750 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.h
@@ -118,6 +118,7 @@ struct etna_shader_link_info {
/* each PS input is annotated with the VS output reg */
unsigned num_varyings;
struct etna_varying varyings[ETNA_NUM_INPUTS];
+ int pcoord_varying_comp_ofs;
};
bool
diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c b/src/gallium/drivers/etnaviv/etnaviv_shader.c
index 6012680624b..04ababc801f 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_shader.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c
@@ -179,6 +179,14 @@ etna_link_shaders(struct etna_context *ctx, struct compiled_shader_state *cs,
cs->GL_VARYING_COMPONENT_USE[0] = component_use[0];
cs->GL_VARYING_COMPONENT_USE[1] = component_use[1];
+ cs->GL_HALTI5_SH_SPECIALS =
+ 0x7f7f0000 | /* unknown bits, probably other PS inputs */
+ /* pointsize is last (see above) */
+ VIVS_GL_HALTI5_SH_SPECIALS_VS_PSIZE_OUT((vs->vs_pointsize_out_reg != -1) ?
+ cs->VS_OUTPUT_COUNT * 4 : 0x00) |
+ VIVS_GL_HALTI5_SH_SPECIALS_PS_PCOORD_IN((link.pcoord_varying_comp_ofs != -1) ?
+ link.pcoord_varying_comp_ofs : 0x7f);
+
/* reference instruction memory */
cs->vs_inst_mem_size = vs->code_size;
cs->VS_INST_MEM = vs->code;