mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
dzn: Fix pipeline creation when rasterization is disabled
We use some of the VkGraphicsPipelineCreateInfo fields that should be ignored when rasterization in disabled, assuming those who be set to NULL by the caller in that case, which is not mandated by the Vulkan specification. Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15698>
This commit is contained in:
parent
c59fc44114
commit
05b6c1ed84
1 changed files with 17 additions and 9 deletions
|
|
@ -352,7 +352,7 @@ dzn_graphics_pipeline_translate_rast(dzn_graphics_pipeline *pipeline,
|
|||
const VkPipelineRasterizationStateCreateInfo *in_rast =
|
||||
in->pRasterizationState;
|
||||
const VkPipelineViewportStateCreateInfo *in_vp =
|
||||
in->pViewportState;
|
||||
in_rast->rasterizerDiscardEnable ? NULL : in->pViewportState;
|
||||
|
||||
if (in_vp) {
|
||||
pipeline->vp.count = in_vp->viewportCount;
|
||||
|
|
@ -387,8 +387,10 @@ dzn_graphics_pipeline_translate_ms(dzn_graphics_pipeline *pipeline,
|
|||
D3D12_GRAPHICS_PIPELINE_STATE_DESC *out,
|
||||
const VkGraphicsPipelineCreateInfo *in)
|
||||
{
|
||||
const VkPipelineRasterizationStateCreateInfo *in_rast =
|
||||
in->pRasterizationState;
|
||||
const VkPipelineMultisampleStateCreateInfo *in_ms =
|
||||
in->pMultisampleState;
|
||||
in_rast->rasterizerDiscardEnable ? NULL : in->pMultisampleState;
|
||||
|
||||
/* TODO: sampleShadingEnable, minSampleShading,
|
||||
* alphaToOneEnable
|
||||
|
|
@ -532,8 +534,10 @@ dzn_graphics_pipeline_translate_zsa(dzn_graphics_pipeline *pipeline,
|
|||
D3D12_GRAPHICS_PIPELINE_STATE_DESC *out,
|
||||
const VkGraphicsPipelineCreateInfo *in)
|
||||
{
|
||||
const VkPipelineRasterizationStateCreateInfo *in_rast =
|
||||
in->pRasterizationState;
|
||||
const VkPipelineDepthStencilStateCreateInfo *in_zsa =
|
||||
in->pDepthStencilState;
|
||||
in_rast->rasterizerDiscardEnable ? NULL : in->pDepthStencilState;
|
||||
|
||||
if (!in_zsa)
|
||||
return;
|
||||
|
|
@ -649,10 +653,12 @@ dzn_graphics_pipeline_translate_blend(dzn_graphics_pipeline *pipeline,
|
|||
D3D12_GRAPHICS_PIPELINE_STATE_DESC *out,
|
||||
const VkGraphicsPipelineCreateInfo *in)
|
||||
{
|
||||
const VkPipelineRasterizationStateCreateInfo *in_rast =
|
||||
in->pRasterizationState;
|
||||
const VkPipelineColorBlendStateCreateInfo *in_blend =
|
||||
in->pColorBlendState;
|
||||
in_rast->rasterizerDiscardEnable ? NULL : in->pColorBlendState;
|
||||
const VkPipelineMultisampleStateCreateInfo *in_ms =
|
||||
in->pMultisampleState;
|
||||
in_rast->rasterizerDiscardEnable ? NULL : in->pMultisampleState;
|
||||
|
||||
if (!in_blend || !in_ms)
|
||||
return;
|
||||
|
|
@ -776,6 +782,11 @@ dzn_graphics_pipeline_create(dzn_device *device,
|
|||
.Flags = D3D12_PIPELINE_STATE_FLAG_NONE,
|
||||
};
|
||||
|
||||
const VkPipelineViewportStateCreateInfo *vp_info =
|
||||
pCreateInfo->pRasterizationState->rasterizerDiscardEnable ?
|
||||
NULL : pCreateInfo->pViewportState;
|
||||
|
||||
|
||||
ret = dzn_graphics_pipeline_translate_vi(pipeline, pAllocator, &desc, pCreateInfo, &inputs);
|
||||
if (ret != VK_SUCCESS)
|
||||
goto out;
|
||||
|
|
@ -861,10 +872,7 @@ dzn_graphics_pipeline_create(dzn_device *device,
|
|||
!(stage_mask & VK_SHADER_STAGE_GEOMETRY_BIT))) {
|
||||
if (pipeline->vp.dynamic) {
|
||||
yz_flip_mode = DXIL_SPIRV_YZ_FLIP_CONDITIONAL;
|
||||
} else if (pCreateInfo->pViewportState) {
|
||||
const VkPipelineViewportStateCreateInfo *vp_info =
|
||||
pCreateInfo->pViewportState;
|
||||
|
||||
} else if (vp_info) {
|
||||
for (uint32_t i = 0; vp_info->pViewports && i < vp_info->viewportCount; i++) {
|
||||
if (vp_info->pViewports[i].height > 0)
|
||||
y_flip_mask |= BITFIELD_BIT(i);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue