mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/ir: Do not store the vkd3d-shader configuration flags in struct vkd3d_shader_parser.
This commit is contained in:
parent
19b552ce1b
commit
efe9dfd73a
Notes:
Alexandre Julliard
2024-05-16 23:13:19 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/869
@ -1322,7 +1322,7 @@ static uint32_t get_external_constant_count(struct vkd3d_shader_sm1_parser *sm1,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vkd3d_shader_sm1_parser_create(const struct vkd3d_shader_compile_info *compile_info,
|
||||
int vkd3d_shader_sm1_parser_create(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags,
|
||||
struct vkd3d_shader_message_context *message_context, struct vkd3d_shader_parser **parser)
|
||||
{
|
||||
struct vkd3d_shader_instruction_array *instructions;
|
||||
@ -1372,7 +1372,7 @@ int vkd3d_shader_sm1_parser_create(const struct vkd3d_shader_compile_info *compi
|
||||
program->flat_constant_count[i] = get_external_constant_count(sm1, i);
|
||||
|
||||
if (!sm1->p.failed)
|
||||
ret = vkd3d_shader_parser_validate(&sm1->p);
|
||||
ret = vkd3d_shader_parser_validate(&sm1->p, config_flags);
|
||||
|
||||
if (sm1->p.failed && ret >= 0)
|
||||
ret = VKD3D_ERROR_INVALID_SHADER;
|
||||
|
@ -10474,7 +10474,7 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const char *sou
|
||||
return VKD3D_OK;
|
||||
}
|
||||
|
||||
int vkd3d_shader_sm6_parser_create(const struct vkd3d_shader_compile_info *compile_info,
|
||||
int vkd3d_shader_sm6_parser_create(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags,
|
||||
struct vkd3d_shader_message_context *message_context, struct vkd3d_shader_parser **parser)
|
||||
{
|
||||
struct dxbc_shader_desc dxbc_desc = {0};
|
||||
@ -10520,7 +10520,7 @@ int vkd3d_shader_sm6_parser_create(const struct vkd3d_shader_compile_info *compi
|
||||
vkd3d_free(byte_code);
|
||||
|
||||
if (!sm6->p.failed && ret >= 0)
|
||||
ret = vkd3d_shader_parser_validate(&sm6->p);
|
||||
ret = vkd3d_shader_parser_validate(&sm6->p, config_flags);
|
||||
|
||||
if (sm6->p.failed && ret >= 0)
|
||||
ret = VKD3D_ERROR_INVALID_SHADER;
|
||||
|
@ -3991,6 +3991,7 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
|
||||
|| target_type == VKD3D_SHADER_TARGET_SPIRV_TEXT
|
||||
|| target_type == VKD3D_SHADER_TARGET_D3D_ASM)
|
||||
{
|
||||
uint64_t config_flags = vkd3d_shader_init_config_flags();
|
||||
struct vkd3d_shader_compile_info info = *compile_info;
|
||||
struct vkd3d_shader_parser *parser;
|
||||
|
||||
@ -3999,18 +4000,18 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
|
||||
if ((ret = hlsl_emit_bytecode(&ctx, entry_func, VKD3D_SHADER_TARGET_D3D_BYTECODE, &info.source)) < 0)
|
||||
goto done;
|
||||
info.source_type = VKD3D_SHADER_SOURCE_D3D_BYTECODE;
|
||||
ret = vkd3d_shader_sm1_parser_create(&info, message_context, &parser);
|
||||
ret = vkd3d_shader_sm1_parser_create(&info, config_flags, message_context, &parser);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ret = hlsl_emit_bytecode(&ctx, entry_func, VKD3D_SHADER_TARGET_DXBC_TPF, &info.source)) < 0)
|
||||
goto done;
|
||||
info.source_type = VKD3D_SHADER_SOURCE_DXBC_TPF;
|
||||
ret = vkd3d_shader_sm4_parser_create(&info, message_context, &parser);
|
||||
ret = vkd3d_shader_sm4_parser_create(&info, config_flags, message_context, &parser);
|
||||
}
|
||||
if (ret >= 0)
|
||||
{
|
||||
ret = vsir_program_compile(parser->program, parser->config_flags, &info, out, message_context);
|
||||
ret = vsir_program_compile(parser->program, config_flags, &info, out, message_context);
|
||||
vkd3d_shader_parser_destroy(parser);
|
||||
}
|
||||
vkd3d_shader_free_shader_code(&info.source);
|
||||
|
@ -2658,7 +2658,7 @@ static void shader_sm4_validate_default_phase_index_ranges(struct vkd3d_shader_s
|
||||
return;
|
||||
}
|
||||
|
||||
int vkd3d_shader_sm4_parser_create(const struct vkd3d_shader_compile_info *compile_info,
|
||||
int vkd3d_shader_sm4_parser_create(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags,
|
||||
struct vkd3d_shader_message_context *message_context, struct vkd3d_shader_parser **parser)
|
||||
{
|
||||
struct vkd3d_shader_instruction_array *instructions;
|
||||
@ -2741,7 +2741,7 @@ int vkd3d_shader_sm4_parser_create(const struct vkd3d_shader_compile_info *compi
|
||||
shader_sm4_validate_default_phase_index_ranges(sm4);
|
||||
|
||||
if (!sm4->p.failed)
|
||||
vkd3d_shader_parser_validate(&sm4->p);
|
||||
vkd3d_shader_parser_validate(&sm4->p, config_flags);
|
||||
|
||||
if (sm4->p.failed)
|
||||
{
|
||||
|
@ -540,7 +540,7 @@ static const struct vkd3d_debug_option vkd3d_shader_config_options[] =
|
||||
{"force_validation", VKD3D_SHADER_CONFIG_FLAG_FORCE_VALIDATION}, /* force validation of internal shader representations */
|
||||
};
|
||||
|
||||
static uint64_t vkd3d_shader_init_config_flags(void)
|
||||
uint64_t vkd3d_shader_init_config_flags(void)
|
||||
{
|
||||
uint64_t config_flags;
|
||||
const char *config;
|
||||
@ -563,7 +563,6 @@ void vkd3d_shader_parser_init(struct vkd3d_shader_parser *parser, struct vsir_pr
|
||||
parser->location.line = 1;
|
||||
parser->location.column = 0;
|
||||
parser->ops = ops;
|
||||
parser->config_flags = vkd3d_shader_init_config_flags();
|
||||
parser->program = program;
|
||||
}
|
||||
|
||||
@ -1515,20 +1514,21 @@ int vkd3d_shader_scan(const struct vkd3d_shader_compile_info *compile_info, char
|
||||
}
|
||||
else
|
||||
{
|
||||
uint64_t config_flags = vkd3d_shader_init_config_flags();
|
||||
struct vkd3d_shader_parser *parser;
|
||||
|
||||
switch (compile_info->source_type)
|
||||
{
|
||||
case VKD3D_SHADER_SOURCE_D3D_BYTECODE:
|
||||
ret = vkd3d_shader_sm1_parser_create(compile_info, &message_context, &parser);
|
||||
ret = vkd3d_shader_sm1_parser_create(compile_info, config_flags, &message_context, &parser);
|
||||
break;
|
||||
|
||||
case VKD3D_SHADER_SOURCE_DXBC_TPF:
|
||||
ret = vkd3d_shader_sm4_parser_create(compile_info, &message_context, &parser);
|
||||
ret = vkd3d_shader_sm4_parser_create(compile_info, config_flags, &message_context, &parser);
|
||||
break;
|
||||
|
||||
case VKD3D_SHADER_SOURCE_DXBC_DXIL:
|
||||
ret = vkd3d_shader_sm6_parser_create(compile_info, &message_context, &parser);
|
||||
ret = vkd3d_shader_sm6_parser_create(compile_info, config_flags, &message_context, &parser);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1636,20 +1636,21 @@ int vkd3d_shader_compile(const struct vkd3d_shader_compile_info *compile_info,
|
||||
}
|
||||
else
|
||||
{
|
||||
uint64_t config_flags = vkd3d_shader_init_config_flags();
|
||||
struct vkd3d_shader_parser *parser;
|
||||
|
||||
switch (compile_info->source_type)
|
||||
{
|
||||
case VKD3D_SHADER_SOURCE_D3D_BYTECODE:
|
||||
ret = vkd3d_shader_sm1_parser_create(compile_info, &message_context, &parser);
|
||||
ret = vkd3d_shader_sm1_parser_create(compile_info, config_flags, &message_context, &parser);
|
||||
break;
|
||||
|
||||
case VKD3D_SHADER_SOURCE_DXBC_TPF:
|
||||
ret = vkd3d_shader_sm4_parser_create(compile_info, &message_context, &parser);
|
||||
ret = vkd3d_shader_sm4_parser_create(compile_info, config_flags, &message_context, &parser);
|
||||
break;
|
||||
|
||||
case VKD3D_SHADER_SOURCE_DXBC_DXIL:
|
||||
ret = vkd3d_shader_sm6_parser_create(compile_info, &message_context, &parser);
|
||||
ret = vkd3d_shader_sm6_parser_create(compile_info, config_flags, &message_context, &parser);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1664,7 +1665,7 @@ int vkd3d_shader_compile(const struct vkd3d_shader_compile_info *compile_info,
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = vsir_program_compile(parser->program, parser->config_flags, compile_info, out, &message_context);
|
||||
ret = vsir_program_compile(parser->program, config_flags, compile_info, out, &message_context);
|
||||
vkd3d_shader_parser_destroy(parser);
|
||||
}
|
||||
}
|
||||
|
@ -1396,8 +1396,6 @@ struct vkd3d_shader_parser
|
||||
bool failed;
|
||||
|
||||
const struct vkd3d_shader_parser_ops *ops;
|
||||
|
||||
uint64_t config_flags;
|
||||
};
|
||||
|
||||
struct vkd3d_shader_parser_ops
|
||||
@ -1418,9 +1416,9 @@ static inline void vkd3d_shader_parser_destroy(struct vkd3d_shader_parser *parse
|
||||
parser->ops->parser_destroy(parser);
|
||||
}
|
||||
|
||||
static inline enum vkd3d_result vkd3d_shader_parser_validate(struct vkd3d_shader_parser *parser)
|
||||
static inline enum vkd3d_result vkd3d_shader_parser_validate(struct vkd3d_shader_parser *parser, uint64_t config_flags)
|
||||
{
|
||||
return vsir_program_validate(parser->program, parser->config_flags,
|
||||
return vsir_program_validate(parser->program, config_flags,
|
||||
parser->location.source_name, parser->message_context);
|
||||
}
|
||||
|
||||
@ -1551,15 +1549,16 @@ void vkd3d_shader_vwarning(struct vkd3d_shader_message_context *context, const s
|
||||
enum vkd3d_shader_error error, const char *format, va_list args);
|
||||
|
||||
void vkd3d_shader_dump_shader(const struct vkd3d_shader_compile_info *compile_info);
|
||||
uint64_t vkd3d_shader_init_config_flags(void);
|
||||
void vkd3d_shader_trace_text_(const char *text, size_t size, const char *function);
|
||||
#define vkd3d_shader_trace_text(text, size) \
|
||||
vkd3d_shader_trace_text_(text, size, __FUNCTION__)
|
||||
|
||||
int vkd3d_shader_sm1_parser_create(const struct vkd3d_shader_compile_info *compile_info,
|
||||
int vkd3d_shader_sm1_parser_create(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags,
|
||||
struct vkd3d_shader_message_context *message_context, struct vkd3d_shader_parser **parser);
|
||||
int vkd3d_shader_sm4_parser_create(const struct vkd3d_shader_compile_info *compile_info,
|
||||
int vkd3d_shader_sm4_parser_create(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags,
|
||||
struct vkd3d_shader_message_context *message_context, struct vkd3d_shader_parser **parser);
|
||||
int vkd3d_shader_sm6_parser_create(const struct vkd3d_shader_compile_info *compile_info,
|
||||
int vkd3d_shader_sm6_parser_create(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags,
|
||||
struct vkd3d_shader_message_context *message_context, struct vkd3d_shader_parser **parser);
|
||||
|
||||
void free_dxbc_shader_desc(struct dxbc_shader_desc *desc);
|
||||
|
Loading…
Reference in New Issue
Block a user