mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Allow the name of the SPIR-V entry point to be specified.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7e4fc14a31
commit
25ef055062
@ -279,6 +279,8 @@ struct vkd3d_shader_spirv_target_info
|
|||||||
enum vkd3d_shader_structure_type type;
|
enum vkd3d_shader_structure_type type;
|
||||||
const void *next;
|
const void *next;
|
||||||
|
|
||||||
|
const char *entry_point; /* "main" if NULL. */
|
||||||
|
|
||||||
enum vkd3d_shader_spirv_environment environment;
|
enum vkd3d_shader_spirv_environment environment;
|
||||||
|
|
||||||
const enum vkd3d_shader_spirv_extension *extensions;
|
const enum vkd3d_shader_spirv_extension *extensions;
|
||||||
|
@ -1666,7 +1666,7 @@ static uint32_t vkd3d_spirv_get_type_id(struct vkd3d_spirv_builder *builder,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vkd3d_spirv_builder_init(struct vkd3d_spirv_builder *builder)
|
static void vkd3d_spirv_builder_init(struct vkd3d_spirv_builder *builder, const char *entry_point)
|
||||||
{
|
{
|
||||||
vkd3d_spirv_stream_init(&builder->debug_stream);
|
vkd3d_spirv_stream_init(&builder->debug_stream);
|
||||||
vkd3d_spirv_stream_init(&builder->annotation_stream);
|
vkd3d_spirv_stream_init(&builder->annotation_stream);
|
||||||
@ -1682,7 +1682,7 @@ static void vkd3d_spirv_builder_init(struct vkd3d_spirv_builder *builder)
|
|||||||
rb_init(&builder->declarations, vkd3d_spirv_declaration_compare);
|
rb_init(&builder->declarations, vkd3d_spirv_declaration_compare);
|
||||||
|
|
||||||
builder->main_function_id = vkd3d_spirv_alloc_id(builder);
|
builder->main_function_id = vkd3d_spirv_alloc_id(builder);
|
||||||
vkd3d_spirv_build_op_name(builder, builder->main_function_id, "main");
|
vkd3d_spirv_build_op_name(builder, builder->main_function_id, entry_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vkd3d_spirv_builder_begin_main_function(struct vkd3d_spirv_builder *builder)
|
static void vkd3d_spirv_builder_begin_main_function(struct vkd3d_spirv_builder *builder)
|
||||||
@ -1714,7 +1714,7 @@ static void vkd3d_spirv_builder_free(struct vkd3d_spirv_builder *builder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool vkd3d_spirv_compile_module(struct vkd3d_spirv_builder *builder,
|
static bool vkd3d_spirv_compile_module(struct vkd3d_spirv_builder *builder,
|
||||||
struct vkd3d_shader_code *spirv)
|
struct vkd3d_shader_code *spirv, const char *entry_point)
|
||||||
{
|
{
|
||||||
uint64_t capability_mask = builder->capability_mask;
|
uint64_t capability_mask = builder->capability_mask;
|
||||||
struct vkd3d_spirv_stream stream;
|
struct vkd3d_spirv_stream stream;
|
||||||
@ -1754,7 +1754,7 @@ static bool vkd3d_spirv_compile_module(struct vkd3d_spirv_builder *builder,
|
|||||||
/* entry point declarations */
|
/* entry point declarations */
|
||||||
vkd3d_spirv_build_op_memory_model(&stream, SpvAddressingModelLogical, SpvMemoryModelGLSL450);
|
vkd3d_spirv_build_op_memory_model(&stream, SpvAddressingModelLogical, SpvMemoryModelGLSL450);
|
||||||
vkd3d_spirv_build_op_entry_point(&stream, builder->execution_model, builder->main_function_id,
|
vkd3d_spirv_build_op_entry_point(&stream, builder->execution_model, builder->main_function_id,
|
||||||
"main", builder->iface, builder->iface_element_count);
|
entry_point, builder->iface, builder->iface_element_count);
|
||||||
|
|
||||||
/* execution mode declarations */
|
/* execution mode declarations */
|
||||||
if (builder->invocation_count)
|
if (builder->invocation_count)
|
||||||
@ -2122,6 +2122,13 @@ static bool is_control_point_phase(const struct vkd3d_shader_phase *phase)
|
|||||||
|
|
||||||
static void vkd3d_dxbc_compiler_emit_initial_declarations(struct vkd3d_dxbc_compiler *compiler);
|
static void vkd3d_dxbc_compiler_emit_initial_declarations(struct vkd3d_dxbc_compiler *compiler);
|
||||||
|
|
||||||
|
static const char *vkd3d_dxbc_compiler_get_entry_point_name(const struct vkd3d_dxbc_compiler *compiler)
|
||||||
|
{
|
||||||
|
const struct vkd3d_shader_spirv_target_info *info = compiler->spirv_target_info;
|
||||||
|
|
||||||
|
return info && info->entry_point ? info->entry_point : "main";
|
||||||
|
}
|
||||||
|
|
||||||
struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader_version *shader_version,
|
struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader_version *shader_version,
|
||||||
const struct vkd3d_shader_desc *shader_desc, const struct vkd3d_shader_compile_info *compile_info,
|
const struct vkd3d_shader_desc *shader_desc, const struct vkd3d_shader_compile_info *compile_info,
|
||||||
const struct vkd3d_shader_scan_info *scan_info)
|
const struct vkd3d_shader_scan_info *scan_info)
|
||||||
@ -2162,7 +2169,7 @@ struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
vkd3d_spirv_builder_init(&compiler->spirv_builder);
|
vkd3d_spirv_builder_init(&compiler->spirv_builder, vkd3d_dxbc_compiler_get_entry_point_name(compiler));
|
||||||
|
|
||||||
for (i = 0; i < compile_info->option_count; ++i)
|
for (i = 0; i < compile_info->option_count; ++i)
|
||||||
{
|
{
|
||||||
@ -8740,7 +8747,7 @@ int vkd3d_dxbc_compiler_generate_spirv(struct vkd3d_dxbc_compiler *compiler,
|
|||||||
if (compiler->strip_debug)
|
if (compiler->strip_debug)
|
||||||
vkd3d_spirv_stream_clear(&builder->debug_stream);
|
vkd3d_spirv_stream_clear(&builder->debug_stream);
|
||||||
|
|
||||||
if (!vkd3d_spirv_compile_module(builder, spirv))
|
if (!vkd3d_spirv_compile_module(builder, spirv, vkd3d_dxbc_compiler_get_entry_point_name(compiler)))
|
||||||
return VKD3D_ERROR;
|
return VKD3D_ERROR;
|
||||||
|
|
||||||
if (TRACE_ON())
|
if (TRACE_ON())
|
||||||
|
@ -2174,6 +2174,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
|
|||||||
|
|
||||||
ps_target_info.type = VKD3D_SHADER_STRUCTURE_TYPE_SPIRV_TARGET_INFO;
|
ps_target_info.type = VKD3D_SHADER_STRUCTURE_TYPE_SPIRV_TARGET_INFO;
|
||||||
ps_target_info.next = NULL;
|
ps_target_info.next = NULL;
|
||||||
|
ps_target_info.entry_point = "main";
|
||||||
ps_target_info.environment = VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_0;
|
ps_target_info.environment = VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_0;
|
||||||
ps_target_info.extensions = vk_info->shader_extensions;
|
ps_target_info.extensions = vk_info->shader_extensions;
|
||||||
ps_target_info.extension_count = vk_info->shader_extension_count;
|
ps_target_info.extension_count = vk_info->shader_extension_count;
|
||||||
|
Loading…
Reference in New Issue
Block a user