summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc5/vc5_state.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2017-10-19 15:22:13 -0700
committerEric Anholt <[email protected]>2017-10-20 15:59:41 -0700
commit34690536a7fb792492fdedc9377a298827b8c1b7 (patch)
tree2bf997d7eb679fc6604e9a6af5ad52b49a0e2c84 /src/gallium/drivers/vc5/vc5_state.c
parentfb15168919613fd913addc5d2d90673e506ae0cc (diff)
broadcom/vc5: Move default attribute value setup to the CSO and fix them.
I was generating some stub values to bring the driver up, but fill them in properly now. We now set 1.0 or 1u as appropriate, and thanks to being in their own BO it fixes piglit failures on the 7268 (where our 4-byte alignment was insufficient). Fixes const-packHalf2x16.shader_test
Diffstat (limited to 'src/gallium/drivers/vc5/vc5_state.c')
-rw-r--r--src/gallium/drivers/vc5/vc5_state.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc5/vc5_state.c b/src/gallium/drivers/vc5/vc5_state.c
index 98426de977b..eebf94b4b9c 100644
--- a/src/gallium/drivers/vc5/vc5_state.c
+++ b/src/gallium/drivers/vc5/vc5_state.c
@@ -238,6 +238,7 @@ static void *
vc5_vertex_state_create(struct pipe_context *pctx, unsigned num_elements,
const struct pipe_vertex_element *elements)
{
+ struct vc5_context *vc5 = vc5_context(pctx);
struct vc5_vertex_stateobj *so = CALLOC_STRUCT(vc5_vertex_stateobj);
if (!so)
@@ -311,6 +312,25 @@ vc5_vertex_state_create(struct pipe_context *pctx, unsigned num_elements,
&attr_unpacked);
}
+ /* Set up the default attribute values in case any of the vertex
+ * elements use them.
+ */
+ so->default_attribute_values = vc5_bo_alloc(vc5->screen,
+ VC5_MAX_ATTRIBUTES *
+ 4 * sizeof(float),
+ "default attributes");
+ uint32_t *attrs = vc5_bo_map(so->default_attribute_values);
+ for (int i = 0; i < VC5_MAX_ATTRIBUTES; i++) {
+ attrs[i * 4 + 0] = 0;
+ attrs[i * 4 + 1] = 0;
+ attrs[i * 4 + 2] = 0;
+ if (i < so->num_elements &&
+ util_format_is_pure_integer(so->pipe[i].src_format)) {
+ attrs[i * 4 + 3] = 1;
+ } else {
+ attrs[i * 4 + 3] = fui(1.0);
+ }
+ }
return so;
}