dzn: Use vk_to_mesa_shader_stage()

Use vk_to_mesa_shader_stage() to convert a VkShaderStageFlagBits into
its gl_shader_stage counterpart.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17140>
This commit is contained in:
Boris Brezillon 2022-06-20 03:33:32 -07:00 committed by Marge Bot
parent f4a96675ec
commit 84770a90bb

View File

@ -35,6 +35,7 @@
#include "vk_alloc.h"
#include "vk_util.h"
#include "vk_format.h"
#include "vk_pipeline.h"
#include "util/u_debug.h"
@ -296,33 +297,16 @@ dzn_graphics_pipeline_compile_shaders(struct dzn_device *device,
* order.
*/
for (uint32_t i = 0; i < info->stageCount; i++) {
gl_shader_stage stage;
gl_shader_stage stage =
vk_to_mesa_shader_stage(info->pStages[i].stage);
switch (info->pStages[i].stage) {
case VK_SHADER_STAGE_VERTEX_BIT:
stage = MESA_SHADER_VERTEX;
if (yz_flip_stage < stage)
yz_flip_stage = stage;
break;
case VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT:
stage = MESA_SHADER_TESS_CTRL;
break;
case VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT:
stage = MESA_SHADER_TESS_EVAL;
if (yz_flip_stage < stage)
yz_flip_stage = stage;
break;
case VK_SHADER_STAGE_GEOMETRY_BIT:
stage = MESA_SHADER_GEOMETRY;
if (yz_flip_stage < stage)
yz_flip_stage = stage;
break;
case VK_SHADER_STAGE_FRAGMENT_BIT:
stage = MESA_SHADER_FRAGMENT;
break;
default:
unreachable("Unsupported stage");
}
assert(stage <= MESA_SHADER_FRAGMENT);
if ((stage == MESA_SHADER_VERTEX ||
stage == MESA_SHADER_TESS_EVAL ||
stage == MESA_SHADER_GEOMETRY) &&
yz_flip_stage < stage)
yz_flip_stage = stage;
if (stage == MESA_SHADER_FRAGMENT &&
info->pRasterizationState &&