From 2208d5a68370e088aee8d25aff4b3f2e732b3a47 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 22 Mar 2019 00:42:56 -0700 Subject: [PATCH] iris: Fix DrawTransformFeedback math when there's a buffer offset We need to subtract the starting offset from the final offset before dividing by the stride. See src/intel/vulkan/genX_cmd_buffer.c:3142. Not known to fix anything. --- src/gallium/drivers/iris/iris_context.h | 3 +++ src/gallium/drivers/iris/iris_query.c | 9 +++++++++ src/gallium/drivers/iris/iris_state.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index ab70fc58718..f660c9ae251 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -782,6 +782,9 @@ bool iris_blorp_upload_shader(struct blorp_batch *blorp_batch, void iris_math_div32_gpr0(struct iris_context *ice, struct iris_batch *batch, uint32_t D); +void iris_math_add32_gpr0(struct iris_context *ice, + struct iris_batch *batch, + uint32_t x); uint64_t iris_timebase_scale(const struct gen_device_info *devinfo, uint64_t gpu_timestamp); diff --git a/src/gallium/drivers/iris/iris_query.c b/src/gallium/drivers/iris/iris_query.c index 904feba39cc..eace45c64ed 100644 --- a/src/gallium/drivers/iris/iris_query.c +++ b/src/gallium/drivers/iris/iris_query.c @@ -503,6 +503,15 @@ iris_math_div32_gpr0(struct iris_context *ice, } } +void +iris_math_add32_gpr0(struct iris_context *ice, + struct iris_batch *batch, + uint32_t x) +{ + emit_lri32(batch, CS_GPR(1), x); + emit_alu_add(batch, MI_ALU_R0, MI_ALU_R0, MI_ALU_R1); +} + /* * GPR0 = (GPR0 == 0) ? 0 : 1; */ diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 55ed7be647a..f4d7c698a6c 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -5203,6 +5203,8 @@ iris_upload_render_state(struct iris_context *ice, lrm.MemoryAddress = ro_bo(iris_resource_bo(so->offset.res), so->offset.offset); } + if (so->base.buffer_offset) + iris_math_add32_gpr0(ice, batch, -so->base.buffer_offset); iris_math_div32_gpr0(ice, batch, so->stride); _iris_emit_lrr(batch, _3DPRIM_VERTEX_COUNT, CS_GPR(0)); -- 2.30.2