mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 05:08:08 +02:00
spirv/tests: initialize compiler options in constructor
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33866>
This commit is contained in:
parent
f2eb31b1a2
commit
c9eb0a2db5
1 changed files with 14 additions and 12 deletions
|
|
@ -34,22 +34,12 @@ protected:
|
|||
: shader(NULL), break_on_failure(false)
|
||||
{
|
||||
glsl_type_singleton_init_or_ref();
|
||||
}
|
||||
|
||||
~spirv_test()
|
||||
{
|
||||
ralloc_free(shader);
|
||||
glsl_type_singleton_decref();
|
||||
}
|
||||
|
||||
void get_nir(size_t num_words, const uint32_t *words, gl_shader_stage stage = MESA_SHADER_COMPUTE)
|
||||
{
|
||||
spirv_capabilities spirv_caps = {};
|
||||
memset(&spirv_caps, 0, sizeof(spirv_caps));
|
||||
spirv_caps.Shader = true;
|
||||
spirv_caps.VulkanMemoryModel = true;
|
||||
spirv_caps.VulkanMemoryModelDeviceScope = true;
|
||||
|
||||
spirv_to_nir_options spirv_options;
|
||||
memset(&spirv_options, 0, sizeof(spirv_options));
|
||||
spirv_options.environment = NIR_SPIRV_VULKAN;
|
||||
spirv_options.capabilities = &spirv_caps;
|
||||
|
|
@ -61,9 +51,17 @@ protected:
|
|||
spirv_options.task_payload_addr_format = nir_address_format_32bit_offset;
|
||||
spirv_options.skip_os_break_in_debug_build = !break_on_failure;
|
||||
|
||||
nir_shader_compiler_options nir_options;
|
||||
memset(&nir_options, 0, sizeof(nir_options));
|
||||
}
|
||||
|
||||
~spirv_test()
|
||||
{
|
||||
ralloc_free(shader);
|
||||
glsl_type_singleton_decref();
|
||||
}
|
||||
|
||||
void get_nir(size_t num_words, const uint32_t *words, gl_shader_stage stage = MESA_SHADER_COMPUTE)
|
||||
{
|
||||
shader = spirv_to_nir(words, num_words, NULL, 0,
|
||||
stage, "main", &spirv_options, &nir_options);
|
||||
}
|
||||
|
|
@ -86,6 +84,10 @@ protected:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
spirv_capabilities spirv_caps;
|
||||
spirv_to_nir_options spirv_options;
|
||||
nir_shader_compiler_options nir_options;
|
||||
|
||||
nir_shader *shader;
|
||||
bool break_on_failure;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue