mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/msl: Generate the shader entry point prologue.
This commit is contained in:
parent
cd070f9995
commit
7c42da465a
Notes:
Henri Verbeet
2024-10-07 17:52:05 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1132
@ -464,6 +464,36 @@ static void msl_generate_output_struct_declarations(struct msl_generator *gen)
|
|||||||
vkd3d_string_buffer_printf(buffer, "};\n\n");
|
vkd3d_string_buffer_printf(buffer, "};\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void msl_generate_entrypoint_prologue(struct msl_generator *gen)
|
||||||
|
{
|
||||||
|
const struct shader_signature *signature = &gen->program->input_signature;
|
||||||
|
struct vkd3d_string_buffer *buffer = gen->buffer;
|
||||||
|
const struct signature_element *e;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < signature->element_count; ++i)
|
||||||
|
{
|
||||||
|
e = &signature->elements[i];
|
||||||
|
|
||||||
|
if (e->target_location == SIGNATURE_TARGET_LOCATION_UNUSED)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
vkd3d_string_buffer_printf(buffer, " %s_in[%u]", gen->prefix, e->register_index);
|
||||||
|
if (e->sysval_semantic == VKD3D_SHADER_SV_NONE)
|
||||||
|
{
|
||||||
|
msl_print_register_datatype(buffer, gen, vkd3d_data_type_from_component_type(e->component_type));
|
||||||
|
vkd3d_string_buffer_printf(buffer, " = input.shader_in_%u", i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vkd3d_string_buffer_printf(buffer, " = <unhandled sysval %#x>", e->sysval_semantic);
|
||||||
|
msl_compiler_error(gen, VKD3D_SHADER_ERROR_MSL_INTERNAL,
|
||||||
|
"Internal compiler error: Unhandled system value %#x input.", e->sysval_semantic);
|
||||||
|
}
|
||||||
|
vkd3d_string_buffer_printf(buffer, ";\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void msl_generate_entrypoint_epilogue(struct msl_generator *gen)
|
static void msl_generate_entrypoint_epilogue(struct msl_generator *gen)
|
||||||
{
|
{
|
||||||
const struct shader_signature *signature = &gen->program->output_signature;
|
const struct shader_signature *signature = &gen->program->output_signature;
|
||||||
@ -525,7 +555,7 @@ static void msl_generate_entrypoint(struct msl_generator *gen)
|
|||||||
vkd3d_string_buffer_printf(gen->buffer, " vkd3d_vec4 %s_out[%u];\n", gen->prefix, 32);
|
vkd3d_string_buffer_printf(gen->buffer, " vkd3d_vec4 %s_out[%u];\n", gen->prefix, 32);
|
||||||
vkd3d_string_buffer_printf(gen->buffer, " vkd3d_%s_out output;\n", gen->prefix);
|
vkd3d_string_buffer_printf(gen->buffer, " vkd3d_%s_out output;\n", gen->prefix);
|
||||||
|
|
||||||
/* TODO: prologue */
|
msl_generate_entrypoint_prologue(gen);
|
||||||
|
|
||||||
vkd3d_string_buffer_printf(gen->buffer, " %s_main(%s_in, %s_out);\n", gen->prefix, gen->prefix, gen->prefix);
|
vkd3d_string_buffer_printf(gen->buffer, " %s_main(%s_in, %s_out);\n", gen->prefix, gen->prefix, gen->prefix);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user