radv: copy viewport/scissor when initializing radv_viewport_info

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16672>
This commit is contained in:
Samuel Pitoiset
2022-05-20 16:07:13 +02:00
committed by Marge Bot
parent 0f46a8fbfe
commit 1f8db57023
2 changed files with 18 additions and 8 deletions

View File

@@ -1694,6 +1694,16 @@ radv_pipeline_init_viewport_info(struct radv_graphics_pipeline *pipeline,
struct radv_viewport_info info = {0}; struct radv_viewport_info info = {0};
if (radv_is_raster_enabled(pipeline, pCreateInfo)) { if (radv_is_raster_enabled(pipeline, pCreateInfo)) {
if (!(pipeline->dynamic_states & RADV_DYNAMIC_VIEWPORT)) {
typed_memcpy(info.viewports, vp->pViewports, vp->viewportCount);
}
info.viewport_count = vp->viewportCount;
if (!(pipeline->dynamic_states & RADV_DYNAMIC_SCISSOR)) {
typed_memcpy(info.scissors, vp->pScissors, vp->scissorCount);
}
info.scissor_count = vp->scissorCount;
const VkPipelineViewportDepthClipControlCreateInfoEXT *depth_clip_control = const VkPipelineViewportDepthClipControlCreateInfoEXT *depth_clip_control =
vk_find_struct_const(vp->pNext, PIPELINE_VIEWPORT_DEPTH_CLIP_CONTROL_CREATE_INFO_EXT); vk_find_struct_const(vp->pNext, PIPELINE_VIEWPORT_DEPTH_CLIP_CONTROL_CREATE_INFO_EXT);
if (depth_clip_control) { if (depth_clip_control) {
@@ -1817,12 +1827,9 @@ radv_pipeline_init_dynamic_state(struct radv_graphics_pipeline *pipeline,
struct radv_dynamic_state *dynamic = &pipeline->dynamic_state; struct radv_dynamic_state *dynamic = &pipeline->dynamic_state;
if (needed_states & RADV_DYNAMIC_VIEWPORT) { if (needed_states & RADV_DYNAMIC_VIEWPORT) {
assert(pCreateInfo->pViewportState); dynamic->viewport.count = info->vp.viewport_count;
dynamic->viewport.count = pCreateInfo->pViewportState->viewportCount;
if (states & RADV_DYNAMIC_VIEWPORT) { if (states & RADV_DYNAMIC_VIEWPORT) {
typed_memcpy(dynamic->viewport.viewports, pCreateInfo->pViewportState->pViewports, typed_memcpy(dynamic->viewport.viewports, info->vp.viewports, info->vp.viewport_count);
pCreateInfo->pViewportState->viewportCount);
for (unsigned i = 0; i < dynamic->viewport.count; i++) for (unsigned i = 0; i < dynamic->viewport.count; i++)
radv_get_viewport_xform(&dynamic->viewport.viewports[i], radv_get_viewport_xform(&dynamic->viewport.viewports[i],
dynamic->viewport.xform[i].scale, dynamic->viewport.xform[i].translate); dynamic->viewport.xform[i].scale, dynamic->viewport.xform[i].translate);
@@ -1830,10 +1837,9 @@ radv_pipeline_init_dynamic_state(struct radv_graphics_pipeline *pipeline,
} }
if (needed_states & RADV_DYNAMIC_SCISSOR) { if (needed_states & RADV_DYNAMIC_SCISSOR) {
dynamic->scissor.count = pCreateInfo->pViewportState->scissorCount; dynamic->scissor.count = info->vp.scissor_count;
if (states & RADV_DYNAMIC_SCISSOR) { if (states & RADV_DYNAMIC_SCISSOR) {
typed_memcpy(dynamic->scissor.scissors, pCreateInfo->pViewportState->pScissors, typed_memcpy(dynamic->scissor.scissors, info->vp.scissors, info->vp.scissor_count);
pCreateInfo->pViewportState->scissorCount);
} }
} }

View File

@@ -1893,6 +1893,10 @@ struct radv_tessellation_info {
struct radv_viewport_info { struct radv_viewport_info {
bool negative_one_to_one; bool negative_one_to_one;
uint8_t viewport_count;
uint8_t scissor_count;
VkRect2D scissors[MAX_SCISSORS];
VkViewport viewports[MAX_VIEWPORTS];
}; };
struct radv_rasterization_info { struct radv_rasterization_info {