mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
spirv_to_dxil: Convert out parameters to a single object
Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12707>
This commit is contained in:
parent
268158a758
commit
ada05759e1
2 changed files with 22 additions and 15 deletions
|
|
@ -45,7 +45,8 @@ bool
|
||||||
spirv_to_dxil(const uint32_t *words, size_t word_count,
|
spirv_to_dxil(const uint32_t *words, size_t word_count,
|
||||||
struct dxil_spirv_specialization *specializations,
|
struct dxil_spirv_specialization *specializations,
|
||||||
unsigned int num_specializations, dxil_spirv_shader_stage stage,
|
unsigned int num_specializations, dxil_spirv_shader_stage stage,
|
||||||
const char *entry_point_name, void **buffer, size_t *size)
|
const char *entry_point_name,
|
||||||
|
struct dxil_spirv_object *out_dxil)
|
||||||
{
|
{
|
||||||
if (stage == MESA_SHADER_NONE || stage == MESA_SHADER_KERNEL)
|
if (stage == MESA_SHADER_NONE || stage == MESA_SHADER_KERNEL)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -187,16 +188,17 @@ spirv_to_dxil(const uint32_t *words, size_t word_count,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
blob_finish_get_buffer(&dxil_blob, buffer, size);
|
blob_finish_get_buffer(&dxil_blob, &out_dxil->binary.buffer,
|
||||||
|
&out_dxil->binary.size);
|
||||||
|
|
||||||
glsl_type_singleton_decref();
|
glsl_type_singleton_decref();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spirv_to_dxil_free(void* buffer)
|
spirv_to_dxil_free(struct dxil_spirv_object *dxil)
|
||||||
{
|
{
|
||||||
free(buffer);
|
free(dxil->binary.buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
|
|
|
||||||
|
|
@ -69,31 +69,36 @@ struct dxil_spirv_specialization {
|
||||||
bool defined_on_module;
|
bool defined_on_module;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct dxil_spirv_object {
|
||||||
|
struct {
|
||||||
|
void *buffer;
|
||||||
|
size_t size;
|
||||||
|
} binary;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compile a SPIR-V module into DXIL.
|
* Compile a SPIR-V module into DXIL.
|
||||||
* \param words SPIR-V module to compile
|
* \param words SPIR-V module to compile
|
||||||
* \param word_count number of words in the SPIR-V module
|
* \param word_count number of words in the SPIR-V module
|
||||||
* \param specializations specialization constants to compile with the shader
|
* \param specializations specialization constants to compile with the shader
|
||||||
* \param num_specializations number of specialization constants
|
* \param num_specializations number of specialization constants
|
||||||
* \param buffer will contain the DXIL bytes on success. Needs to be freed()
|
* \param stage shader stage
|
||||||
* \param size length of returned buffer
|
* \param entry_point_name name of shader entrypoint
|
||||||
|
* \param out_dxil will contain the DXIL bytes on success (call spirv_to_dxil_free after use)
|
||||||
* \return true if compilation succeeded
|
* \return true if compilation succeeded
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
spirv_to_dxil(const uint32_t* words,
|
spirv_to_dxil(const uint32_t *words, size_t word_count,
|
||||||
size_t word_count,
|
struct dxil_spirv_specialization *specializations,
|
||||||
struct dxil_spirv_specialization* specializations,
|
unsigned int num_specializations, dxil_spirv_shader_stage stage,
|
||||||
unsigned int num_specializations,
|
const char *entry_point_name,
|
||||||
dxil_spirv_shader_stage stage,
|
struct dxil_spirv_object *out_dxil);
|
||||||
const char* entry_point_name,
|
|
||||||
void** buffer,
|
|
||||||
size_t* size);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free the buffer allocated by spirv_to_dxil.
|
* Free the buffer allocated by spirv_to_dxil.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
spirv_to_dxil_free(void* buffer);
|
spirv_to_dxil_free(struct dxil_spirv_object *dxil);
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
spirv_to_dxil_get_version(void);
|
spirv_to_dxil_get_version(void);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue