mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
libs/vkd3d-shader: Get rid of VKD3D_SHADER_FLIP_Y compiler option.
We use negative viewport height to flip Y.
This commit is contained in:
parent
0afe0032b0
commit
8f6af1125d
@ -27,8 +27,7 @@ extern "C" {
|
||||
|
||||
enum vkd3d_shader_compiler_option
|
||||
{
|
||||
VKD3D_SHADER_FLIP_Y = 0x00000001,
|
||||
VKD3D_SHADER_STRIP_DEBUG = 0x00000002,
|
||||
VKD3D_SHADER_STRIP_DEBUG = 0x00000001,
|
||||
|
||||
VKD3D_SHADER_COMPILER_OPTIONS_FORCE_32_BIT = 0x7fffffff,
|
||||
};
|
||||
|
@ -970,7 +970,6 @@ struct vkd3d_dxbc_compiler
|
||||
struct rb_tree symbol_table;
|
||||
uint32_t temp_id;
|
||||
unsigned int temp_count;
|
||||
uint32_t position_id;
|
||||
|
||||
enum vkd3d_shader_type shader_type;
|
||||
|
||||
@ -1705,11 +1704,8 @@ static void vkd3d_dxbc_compiler_emit_dcl_output(struct vkd3d_dxbc_compiler *comp
|
||||
static void vkd3d_dxbc_compiler_emit_dcl_output_siv(struct vkd3d_dxbc_compiler *compiler,
|
||||
const struct vkd3d_shader_instruction *instruction)
|
||||
{
|
||||
uint32_t id = vkd3d_dxbc_compiler_emit_output(compiler, &instruction->declaration.register_semantic.reg,
|
||||
vkd3d_dxbc_compiler_emit_output(compiler, &instruction->declaration.register_semantic.reg,
|
||||
instruction->declaration.register_semantic.sysval_semantic);
|
||||
|
||||
if (instruction->declaration.register_semantic.sysval_semantic == VKD3D_SIV_POSITION)
|
||||
compiler->position_id = id;
|
||||
}
|
||||
|
||||
static void vkd3d_dxbc_compiler_emit_dcl_thread_group(struct vkd3d_dxbc_compiler *compiler,
|
||||
@ -2005,24 +2001,10 @@ static void vkd3d_dxbc_compiler_emit_comparison_instruction(struct vkd3d_dxbc_co
|
||||
vkd3d_dxbc_compiler_emit_store_reg(compiler, &dst->reg, dst->write_mask, result_id);
|
||||
}
|
||||
|
||||
static void vkd3d_dxbc_compiler_emit_shader_epilogue(struct vkd3d_dxbc_compiler *compiler)
|
||||
static void vkd3d_dxbc_compiler_emit_return(struct vkd3d_dxbc_compiler *compiler,
|
||||
const struct vkd3d_shader_instruction *instruction)
|
||||
{
|
||||
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
|
||||
|
||||
if ((compiler->options & VKD3D_SHADER_FLIP_Y) && compiler->position_id)
|
||||
{
|
||||
uint32_t float_id, ptr_type_id, index, chain_id, val_id;
|
||||
|
||||
float_id = vkd3d_spirv_get_type_id(builder, VKD3D_TYPE_FLOAT, 1);
|
||||
ptr_type_id = vkd3d_dxbc_compiler_get_pointer_type(compiler, float_id, SpvStorageClassOutput);
|
||||
index = vkd3d_dxbc_compiler_get_constant_uint(compiler, 1);
|
||||
chain_id = vkd3d_spirv_build_op_in_bounds_access_chain(builder,
|
||||
ptr_type_id, compiler->position_id, &index, 1);
|
||||
|
||||
val_id = vkd3d_spirv_build_op_load(builder, float_id, chain_id, SpvMemoryAccessMaskNone);
|
||||
val_id = vkd3d_spirv_build_op_f_negate(builder, float_id, val_id);
|
||||
vkd3d_spirv_build_op_store(builder, chain_id, val_id, SpvMemoryAccessMaskNone);
|
||||
}
|
||||
vkd3d_spirv_build_op_return(&compiler->spirv_builder);
|
||||
}
|
||||
|
||||
static void vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_compiler *compiler,
|
||||
@ -2092,13 +2074,6 @@ static void vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_
|
||||
}
|
||||
}
|
||||
|
||||
static void vkd3d_dxbc_compiler_emit_return(struct vkd3d_dxbc_compiler *compiler,
|
||||
const struct vkd3d_shader_instruction *instruction)
|
||||
{
|
||||
vkd3d_dxbc_compiler_emit_shader_epilogue(compiler);
|
||||
vkd3d_spirv_build_op_return(&compiler->spirv_builder);
|
||||
}
|
||||
|
||||
void vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler,
|
||||
const struct vkd3d_shader_instruction *instruction)
|
||||
{
|
||||
|
@ -89,7 +89,6 @@ static const struct
|
||||
}
|
||||
compiler_options[] =
|
||||
{
|
||||
{"--flip-y", VKD3D_SHADER_FLIP_Y},
|
||||
{"--strip-debug", VKD3D_SHADER_STRIP_DEBUG},
|
||||
};
|
||||
|
||||
@ -144,7 +143,7 @@ int main(int argc, char **argv)
|
||||
if (!parse_command_line(argc, argv, &options))
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: %s [--strip-degug] [--flip-y] [-o <out_spirv_filename>] <dxbc_filename>\n",
|
||||
"usage: %s [--strip-degug] [-o <out_spirv_filename>] <dxbc_filename>\n",
|
||||
argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user