summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/iris/iris_state.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-12-04 22:19:33 -0800
committerKenneth Graunke <[email protected]>2019-02-21 10:26:11 -0800
commit5307ff6a5fdb4f76e80da42795f1970f06e4e3b6 (patch)
tree400a0744dff699f73046803eccdbba9318794f89 /src/gallium/drivers/iris/iris_state.c
parent2e103fff63404916de1b2c4039cbeccb196117df (diff)
iris: Implement DrawTransformFeedback()
We get the count by dividing the offset by the stride.
Diffstat (limited to 'src/gallium/drivers/iris/iris_state.c')
-rw-r--r--src/gallium/drivers/iris/iris_state.c47
1 files changed, 35 insertions, 12 deletions
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 5012ffd996e..09e8b2fb5e5 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -101,6 +101,7 @@
#include "intel/common/gen_sample_positions.h"
#include "iris_batch.h"
#include "iris_context.h"
+#include "iris_defines.h"
#include "iris_pipe.h"
#include "iris_resource.h"
@@ -4583,28 +4584,50 @@ iris_upload_render_state(struct iris_context *ice,
lri.DataDWord = 0;
}
}
+ } else if (draw->count_from_stream_output) {
+ struct iris_stream_output_target *so =
+ (void *) draw->count_from_stream_output;
+
+ // XXX: avoid if possible
+ iris_emit_pipe_control_flush(batch, PIPE_CONTROL_CS_STALL);
+
+ iris_emit_cmd(batch, GENX(MI_LOAD_REGISTER_MEM), lrm) {
+ lrm.RegisterAddress = CS_GPR(0);
+ lrm.MemoryAddress =
+ ro_bo(iris_resource_bo(so->offset.res), so->offset.offset);
+ }
+ iris_math_div32_gpr0(ice, batch, so->stride);
+ _iris_emit_lrr(batch, _3DPRIM_VERTEX_COUNT, CS_GPR(0));
+
+ _iris_emit_lri(batch, _3DPRIM_START_VERTEX, 0);
+ _iris_emit_lri(batch, _3DPRIM_BASE_VERTEX, 0);
+ _iris_emit_lri(batch, _3DPRIM_START_INSTANCE, 0);
+ _iris_emit_lri(batch, _3DPRIM_INSTANCE_COUNT, draw->instance_count);
}
iris_emit_cmd(batch, GENX(3DPRIMITIVE), prim) {
- prim.StartInstanceLocation = draw->start_instance;
- prim.InstanceCount = draw->instance_count;
- prim.VertexCountPerInstance = draw->count;
prim.VertexAccessType = draw->index_size > 0 ? RANDOM : SEQUENTIAL;
prim.PredicateEnable =
ice->state.predicate == IRIS_PREDICATE_STATE_USE_BIT;
- // XXX: this is probably bonkers.
- prim.StartVertexLocation = draw->start;
+ if (draw->indirect || draw->count_from_stream_output) {
+ prim.IndirectParameterEnable = true;
+ } else {
+ prim.StartInstanceLocation = draw->start_instance;
+ prim.InstanceCount = draw->instance_count;
+ prim.VertexCountPerInstance = draw->count;
- prim.IndirectParameterEnable = draw->indirect != NULL;
+ // XXX: this is probably bonkers.
+ prim.StartVertexLocation = draw->start;
- if (draw->index_size) {
- prim.BaseVertexLocation += draw->index_bias;
- } else {
- prim.StartVertexLocation += draw->index_bias;
- }
+ if (draw->index_size) {
+ prim.BaseVertexLocation += draw->index_bias;
+ } else {
+ prim.StartVertexLocation += draw->index_bias;
+ }
- //prim.BaseVertexLocation = ...;
+ //prim.BaseVertexLocation = ...;
+ }
}
}