mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-12-04 05:24:55 +00:00
libs/vkd3d-shader: Fix SV_Position in pixel shaders.
This commit is contained in:
parent
9880d78058
commit
f5e3b248df
@ -886,6 +886,8 @@ struct vkd3d_dxbc_compiler
|
||||
uint32_t temp_id;
|
||||
unsigned int temp_count;
|
||||
uint32_t position_id;
|
||||
|
||||
enum vkd3d_shader_type shader_type;
|
||||
};
|
||||
|
||||
struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader_version *shader_version,
|
||||
@ -926,6 +928,8 @@ struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader
|
||||
ERR("Invalid shader type %#x.\n", shader_version->type);
|
||||
}
|
||||
|
||||
compiler->shader_type = shader_version->type;
|
||||
|
||||
return compiler;
|
||||
}
|
||||
|
||||
@ -1321,15 +1325,19 @@ static void vkd3d_dxbc_compiler_emit_store_reg(struct vkd3d_dxbc_compiler *compi
|
||||
vkd3d_spirv_build_op_store(builder, reg_id, val_id, SpvMemoryAccessMaskNone);
|
||||
}
|
||||
|
||||
static void vkd3d_dxbc_compiler_decorate_sysval(struct vkd3d_spirv_builder *builder,
|
||||
static void vkd3d_dxbc_compiler_decorate_sysval(struct vkd3d_dxbc_compiler *compiler,
|
||||
uint32_t target_id, enum vkd3d_shader_input_sysval_semantic sysval)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
SpvBuiltIn builtin;
|
||||
|
||||
switch (sysval)
|
||||
{
|
||||
case VKD3D_SIV_POSITION:
|
||||
builtin = SpvBuiltInPosition;
|
||||
if (compiler->shader_type == VKD3D_SHADER_TYPE_PIXEL)
|
||||
builtin = SpvBuiltInFragCoord;
|
||||
else
|
||||
builtin = SpvBuiltInPosition;
|
||||
break;
|
||||
case VKD3D_SIV_VERTEX_ID:
|
||||
builtin = SpvBuiltInVertexIndex;
|
||||
@ -1357,7 +1365,7 @@ static void vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compiler,
|
||||
storage_class, component_type, component_count);
|
||||
vkd3d_spirv_add_iface_variable(builder, var_id);
|
||||
if (sysval)
|
||||
vkd3d_dxbc_compiler_decorate_sysval(builder, var_id, sysval);
|
||||
vkd3d_dxbc_compiler_decorate_sysval(compiler, var_id, sysval);
|
||||
else
|
||||
vkd3d_spirv_build_op_decorate1(builder, var_id, SpvDecorationLocation, dst->reg.idx[0].offset);
|
||||
|
||||
@ -1407,7 +1415,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_output(struct vkd3d_dxbc_compiler *comp
|
||||
storage_class, VKD3D_TYPE_FLOAT, VKD3D_VEC4_SIZE);
|
||||
vkd3d_spirv_add_iface_variable(builder, id);
|
||||
if (sysval)
|
||||
vkd3d_dxbc_compiler_decorate_sysval(builder, id, sysval);
|
||||
vkd3d_dxbc_compiler_decorate_sysval(compiler, id, sysval);
|
||||
else
|
||||
vkd3d_spirv_build_op_decorate1(builder, id, SpvDecorationLocation, reg->idx[0].offset);
|
||||
|
||||
|
@ -833,6 +833,7 @@ static inline enum vkd3d_component_type vkd3d_component_type_for_semantic(
|
||||
switch (sysval)
|
||||
{
|
||||
case VKD3D_SIV_NONE:
|
||||
case VKD3D_SIV_POSITION:
|
||||
return VKD3D_TYPE_FLOAT;
|
||||
case VKD3D_SIV_VERTEX_ID:
|
||||
return VKD3D_TYPE_INT;
|
||||
|
Loading…
Reference in New Issue
Block a user