mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 22:10:10 +01:00
spirv2nir: Add --opengl (-g) argument for OpenGL SPIR-V
Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8156>
This commit is contained in:
parent
e550ca8888
commit
f41ae4d592
1 changed files with 13 additions and 2 deletions
|
|
@ -76,6 +76,8 @@ print_usage(char *exec_name, FILE *f)
|
||||||
" vertex, tess-ctrl, tess-eval, geometry, fragment,\n"
|
" vertex, tess-ctrl, tess-eval, geometry, fragment,\n"
|
||||||
" compute, and kernel (OpenCL-style compute).\n"
|
" compute, and kernel (OpenCL-style compute).\n"
|
||||||
" -e, --entry <name> Specify the entry-point name.\n"
|
" -e, --entry <name> Specify the entry-point name.\n"
|
||||||
|
" -g, --opengl Use OpenGL environment instead of Vulkan for\n"
|
||||||
|
" graphics stages.\n"
|
||||||
, exec_name);
|
, exec_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -84,16 +86,18 @@ int main(int argc, char **argv)
|
||||||
gl_shader_stage shader_stage = MESA_SHADER_FRAGMENT;
|
gl_shader_stage shader_stage = MESA_SHADER_FRAGMENT;
|
||||||
char *entry_point = "main";
|
char *entry_point = "main";
|
||||||
int ch;
|
int ch;
|
||||||
|
enum nir_spirv_execution_environment env = NIR_SPIRV_VULKAN;
|
||||||
|
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
{"help", no_argument, 0, 'h'},
|
{"help", no_argument, 0, 'h'},
|
||||||
{"stage", required_argument, 0, 's'},
|
{"stage", required_argument, 0, 's'},
|
||||||
{"entry", required_argument, 0, 'e'},
|
{"entry", required_argument, 0, 'e'},
|
||||||
|
{"opengl", no_argument, 0, 'g'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
while ((ch = getopt_long(argc, argv, "hs:e:", long_options, NULL)) != -1)
|
while ((ch = getopt_long(argc, argv, "hs:e:g", long_options, NULL)) != -1)
|
||||||
{
|
{
|
||||||
switch (ch)
|
switch (ch)
|
||||||
{
|
{
|
||||||
|
|
@ -112,6 +116,9 @@ int main(int argc, char **argv)
|
||||||
case 'e':
|
case 'e':
|
||||||
entry_point = optarg;
|
entry_point = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'g':
|
||||||
|
env = NIR_SPIRV_OPENGL;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unrecognized option \"%s\".\n", optarg);
|
fprintf(stderr, "Unrecognized option \"%s\".\n", optarg);
|
||||||
print_usage(argv[0], stderr);
|
print_usage(argv[0], stderr);
|
||||||
|
|
@ -149,7 +156,11 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
glsl_type_singleton_init_or_ref();
|
glsl_type_singleton_init_or_ref();
|
||||||
|
|
||||||
struct spirv_to_nir_options spirv_opts = {0};
|
struct spirv_to_nir_options spirv_opts = {
|
||||||
|
.environment = env,
|
||||||
|
.use_deref_buffer_array_length = env == NIR_SPIRV_OPENGL,
|
||||||
|
};
|
||||||
|
|
||||||
if (shader_stage == MESA_SHADER_KERNEL) {
|
if (shader_stage == MESA_SHADER_KERNEL) {
|
||||||
spirv_opts.environment = NIR_SPIRV_OPENCL;
|
spirv_opts.environment = NIR_SPIRV_OPENCL;
|
||||||
spirv_opts.caps.address = true;
|
spirv_opts.caps.address = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue