summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-03-15 15:24:48 -0700
committerJason Ekstrand <[email protected]>2017-03-17 12:12:50 -0700
commitc773ae88dfbf206dbcbe656e0c8697fc7dea38fc (patch)
tree2832165bb597c30fdf9de43854cd5d7137906d93 /src
parent7de73f0c943a0d1f84bd8df835280ce323f16c13 (diff)
anv/query: Break GPU query calculation into a helper
Reviewed-By: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/intel/vulkan/genX_query.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/intel/vulkan/genX_query.c b/src/intel/vulkan/genX_query.c
index ecd6a7a695b..48058ce9d71 100644
--- a/src/intel/vulkan/genX_query.c
+++ b/src/intel/vulkan/genX_query.c
@@ -417,6 +417,22 @@ store_query_result(struct anv_batch *batch, uint32_t reg,
}
}
+static void
+compute_query_result(struct anv_batch *batch, uint32_t dst_reg,
+ struct anv_bo *bo, uint32_t offset)
+{
+ emit_load_alu_reg_u64(batch, CS_GPR(0), bo, offset);
+ emit_load_alu_reg_u64(batch, CS_GPR(1), bo, offset + 8);
+
+ /* FIXME: We need to clamp the result for 32 bit. */
+
+ uint32_t *dw = anv_batch_emitn(batch, 5, GENX(MI_MATH));
+ dw[1] = alu(OPCODE_LOAD, OPERAND_SRCA, OPERAND_R1);
+ dw[2] = alu(OPCODE_LOAD, OPERAND_SRCB, OPERAND_R0);
+ dw[3] = alu(OPCODE_SUB, 0, 0);
+ dw[4] = alu(OPCODE_STORE, dst_reg, OPERAND_ACCU);
+}
+
void genX(CmdCopyQueryPoolResults)(
VkCommandBuffer commandBuffer,
VkQueryPool queryPool,
@@ -445,18 +461,8 @@ void genX(CmdCopyQueryPoolResults)(
slot_offset = (firstQuery + i) * pool->stride;
switch (pool->type) {
case VK_QUERY_TYPE_OCCLUSION:
- emit_load_alu_reg_u64(&cmd_buffer->batch,
- CS_GPR(0), &pool->bo, slot_offset + 8);
- emit_load_alu_reg_u64(&cmd_buffer->batch,
- CS_GPR(1), &pool->bo, slot_offset + 16);
-
- /* FIXME: We need to clamp the result for 32 bit. */
-
- uint32_t *dw = anv_batch_emitn(&cmd_buffer->batch, 5, GENX(MI_MATH));
- dw[1] = alu(OPCODE_LOAD, OPERAND_SRCA, OPERAND_R1);
- dw[2] = alu(OPCODE_LOAD, OPERAND_SRCB, OPERAND_R0);
- dw[3] = alu(OPCODE_SUB, 0, 0);
- dw[4] = alu(OPCODE_STORE, OPERAND_R2, OPERAND_ACCU);
+ compute_query_result(&cmd_buffer->batch, OPERAND_R2,
+ &pool->bo, slot_offset + 8);
break;
case VK_QUERY_TYPE_TIMESTAMP: