summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_context.h
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2015-12-09 04:56:15 +0100
committerRoland Scheidegger <[email protected]>2015-12-12 01:59:15 +0100
commitaf7ba989fb5a39925a0a1261ed281fe7f48a16cf (patch)
treec3d27e4eb71b4199b960209a6082ec8a53c85c1e /src/gallium/drivers/llvmpipe/lp_context.h
parent27d5be0b8fafecefc4f0378ca940cea8c0415715 (diff)
llvmpipe: fix layer/vp input into fs when not written by prior stages
ARB_fragment_layer_viewport requires that if a fs reads layer or viewport index but it wasn't output by gs (or vs with other extensions), then it reads 0. This never worked for llvmpipe, and is surprisingly non-trivial to fix. The problem is the mechanism to handle non-existing outputs in draw is rather crude, it will simply redirect them to whatever is at output 0, thus later stages will just get garbage. So, rather than trying to fix this up (which looks non-trivial), fix this up in llvmpipe setup by detecting this case there and output a fixed zero directly. While here, also optimize the hw vertex layout a bit - previously if the gs outputted layer (or vp) and the fs read those inputs, we'd add them twice to the vertex layout, which is unnecessary. And do some minor cleanup, slots don't require that many bits, there was some bogus (but harmless) float/int mixup for psize slot too, make the slots all unsigned (we always put pos at pos zero thus everything else has to be positive if it exists), and make sure they are properly initialized (layer and vp index slot were not which looked fishy as they might not have got set back to zero when changing from a gs which outputs them to one which does not). This fixes the failures in piglit's arb_fragment_layer_viewport group (3 each for layer and vp). Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_context.h')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h
index c9a5d678244..9dcc102e758 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_context.h
@@ -108,22 +108,28 @@ struct llvmpipe_context {
struct vertex_info vertex_info;
/** Which vertex shader output slot contains color */
- int color_slot[2];
+ uint8_t color_slot[2];
/** Which vertex shader output slot contains bcolor */
- int bcolor_slot[2];
+ uint8_t bcolor_slot[2];
/** Which vertex shader output slot contains point size */
- int psize_slot;
+ uint8_t psize_slot;
/** Which vertex shader output slot contains viewport index */
- int viewport_index_slot;
+ uint8_t viewport_index_slot;
/** Which geometry shader output slot contains layer */
- int layer_slot;
+ uint8_t layer_slot;
/** A fake frontface output for unfilled primitives */
- int face_slot;
+ uint8_t face_slot;
+
+ /** Which output slot is used for the fake vp index info */
+ uint8_t fake_vpindex_slot;
+
+ /** Which output slot is used for the fake layer info */
+ uint8_t fake_layer_slot;
/** Depth format and bias settings. */
boolean floating_point_depth;