v3dv: fix viewport state from pipeline

We were not computing viewport transform for static viewports provided with
the pipeline state. Also, we were not copying the transform into the command
buffer state when we bound the pipeline.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Iago Toral Quiroga
2020-02-03 12:55:25 +01:00
committed by Marge Bot
parent 8d143a0273
commit 72040f9182
3 changed files with 21 additions and 7 deletions
+11 -7
View File
@@ -1369,6 +1369,10 @@ bind_dynamic_state(struct v3dv_cmd_buffer *cmd_buffer,
typed_memcpy(dest->viewport.viewports,
src->viewport.viewports,
src->viewport.count);
typed_memcpy(dest->viewport.scale, src->viewport.scale,
src->viewport.count);
typed_memcpy(dest->viewport.translate, src->viewport.translate,
src->viewport.count);
dest_mask |= V3DV_DYNAMIC_VIEWPORT;
}
}
@@ -1416,10 +1420,10 @@ v3dv_CmdBindPipeline(VkCommandBuffer commandBuffer,
}
/* FIXME: C&P from radv. tu has similar code. Perhaps common place? */
static void
get_viewport_xform(const VkViewport *viewport,
float scale[3],
float translate[3])
void
v3dv_viewport_compute_xform(const VkViewport *viewport,
float scale[3],
float translate[3])
{
float x = viewport->x;
float y = viewport->y;
@@ -1468,9 +1472,9 @@ v3dv_CmdSetViewport(VkCommandBuffer commandBuffer,
viewportCount * sizeof(*pViewports));
for (uint32_t i = firstViewport; i < firstViewport + viewportCount; i++) {
get_viewport_xform(&state->dynamic.viewport.viewports[i],
state->dynamic.viewport.scale[i],
state->dynamic.viewport.translate[i]);
v3dv_viewport_compute_xform(&state->dynamic.viewport.viewports[i],
state->dynamic.viewport.scale[i],
state->dynamic.viewport.translate[i]);
}
cmd_buffer->state.dirty |= V3DV_CMD_DIRTY_DYNAMIC_VIEWPORT;
+6
View File
@@ -918,6 +918,12 @@ pipeline_init_dynamic_state(struct v3dv_pipeline *pipeline,
typed_memcpy(dynamic->viewport.viewports,
pCreateInfo->pViewportState->pViewports,
pCreateInfo->pViewportState->viewportCount);
for (uint32_t i = 0; i < dynamic->viewport.count; i++) {
v3dv_viewport_compute_xform(&dynamic->viewport.viewports[i],
dynamic->viewport.scale[i],
dynamic->viewport.translate[i]);
}
}
}
+4
View File
@@ -464,6 +464,10 @@ struct v3dv_dynamic_state {
extern const struct v3dv_dynamic_state default_dynamic_state;
void v3dv_viewport_compute_xform(const VkViewport *viewport,
float scale[3],
float translate[3]);
struct v3dv_job {
struct list_head list_link;