mirror of
https://github.com/KhronosGroup/SPIRV-Cross.git
synced 2024-11-16 00:40:08 +00:00
Merge pull request #663 from KhronosGroup/fix-660
Use GL_NV_gpu_shader5 as a fallback for AMD_gpu_shader_half_float.
This commit is contained in:
commit
a7697446b1
@ -1,5 +1,11 @@
|
||||
#version 450
|
||||
#if defined(GL_AMD_gpu_shader_half_float)
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
#elif defined(GL_NV_gpu_shader5)
|
||||
#extension GL_NV_gpu_shader5 : require
|
||||
#else
|
||||
#error No extension available for FP16.
|
||||
#endif
|
||||
|
||||
layout(location = 3) in f16vec4 v4;
|
||||
|
||||
|
@ -1,5 +1,11 @@
|
||||
#version 450
|
||||
#if defined(GL_AMD_gpu_shader_half_float)
|
||||
#extension GL_AMD_gpu_shader_half_float : require
|
||||
#elif defined(GL_NV_gpu_shader5)
|
||||
#extension GL_NV_gpu_shader5 : require
|
||||
#else
|
||||
#error No extension available for FP16.
|
||||
#endif
|
||||
|
||||
struct ResType
|
||||
{
|
||||
|
@ -479,7 +479,22 @@ void CompilerGLSL::emit_header()
|
||||
}
|
||||
|
||||
for (auto &ext : forced_extensions)
|
||||
statement("#extension ", ext, " : require");
|
||||
{
|
||||
if (ext == "GL_AMD_gpu_shader_half_float" && !options.vulkan_semantics)
|
||||
{
|
||||
// Special case, this extension has a potential fallback to another vendor extension in normal GLSL.
|
||||
// GL_AMD_gpu_shader_half_float is a superset, so try that first.
|
||||
statement("#if defined(GL_AMD_gpu_shader_half_float)");
|
||||
statement("#extension GL_AMD_gpu_shader_half_float : require");
|
||||
statement("#elif defined(GL_NV_gpu_shader5)");
|
||||
statement("#extension GL_NV_gpu_shader5 : require");
|
||||
statement("#else");
|
||||
statement("#error No extension available for FP16.");
|
||||
statement("#endif");
|
||||
}
|
||||
else
|
||||
statement("#extension ", ext, " : require");
|
||||
}
|
||||
|
||||
for (auto &header : header_lines)
|
||||
statement(header);
|
||||
|
Loading…
Reference in New Issue
Block a user