summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-06-26 13:32:19 -0700
committerKenneth Graunke <[email protected]>2019-02-21 10:26:07 -0800
commit01483c79331d6f1a1447758b094a2a840700fcff (patch)
treec34228b5a2e350c6ab92c4c5a4d69b5706d8da96 /src
parent4c9067ae1d1d8d1a18a9c0a74e3cc2cafed8c2fb (diff)
iris: fix 3DSTATE_VERTEX_ELEMENTS / VF_INSTANCING for 0 elements
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/iris/iris_state.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 3f25737703d..49486c44322 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -1502,7 +1502,7 @@ iris_create_vertex_elements(struct pipe_context *ctx,
struct iris_vertex_element_state *cso =
malloc(sizeof(struct iris_vertex_element_state));
- cso->count = count;
+ cso->count = MAX2(count, 1);
/* TODO:
* - create edge flag one
@@ -1510,13 +1510,26 @@ iris_create_vertex_elements(struct pipe_context *ctx,
* - if those are necessary, use count + 1/2/3... OR in the length
*/
iris_pack_command(GENX(3DSTATE_VERTEX_ELEMENTS), cso->vertex_elements, ve) {
- ve.DWordLength =
- 1 + GENX(VERTEX_ELEMENT_STATE_length) * MAX2(count, 1) - 2;
+ ve.DWordLength = 1 + GENX(VERTEX_ELEMENT_STATE_length) * cso->count - 2;
}
uint32_t *ve_pack_dest = &cso->vertex_elements[1];
uint32_t *vfi_pack_dest = cso->vf_instancing;
+ if (count == 0) {
+ iris_pack_state(GENX(VERTEX_ELEMENT_STATE), ve_pack_dest, ve) {
+ ve.Valid = true;
+ ve.SourceElementFormat = ISL_FORMAT_R32G32B32A32_FLOAT;
+ ve.Component0Control = VFCOMP_STORE_0;
+ ve.Component1Control = VFCOMP_STORE_0;
+ ve.Component2Control = VFCOMP_STORE_0;
+ ve.Component3Control = VFCOMP_STORE_1_FP;
+ }
+
+ iris_pack_command(GENX(3DSTATE_VF_INSTANCING), vfi_pack_dest, vi) {
+ }
+ }
+
for (int i = 0; i < count; i++) {
enum isl_format isl_format =
iris_isl_format_for_pipe_format(state[i].src_format);