Merge pull request #256 from KhronosGroup/multiview
Add support for SPV_KHR_multiview.
This commit is contained in:
commit
b0985b6a93
15
reference/shaders/vulkan/vert/multiview.nocompat.vk.vert
Normal file
15
reference/shaders/vulkan/vert/multiview.nocompat.vk.vert
Normal file
@ -0,0 +1,15 @@
|
||||
#version 310 es
|
||||
#extension GL_OVR_multiview2 : require
|
||||
|
||||
layout(binding = 0, std140) uniform MVPs
|
||||
{
|
||||
mat4 MVP[2];
|
||||
} _19;
|
||||
|
||||
layout(location = 0) in vec4 Position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = _19.MVP[gl_ViewID_OVR] * Position;
|
||||
}
|
||||
|
15
reference/shaders/vulkan/vert/multiview.nocompat.vk.vert.vk
Normal file
15
reference/shaders/vulkan/vert/multiview.nocompat.vk.vert.vk
Normal file
@ -0,0 +1,15 @@
|
||||
#version 310 es
|
||||
#extension GL_EXT_multiview : require
|
||||
|
||||
layout(set = 0, binding = 0, std140) uniform MVPs
|
||||
{
|
||||
mat4 MVP[2];
|
||||
} _19;
|
||||
|
||||
layout(location = 0) in vec4 Position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = _19.MVP[gl_ViewIndex] * Position;
|
||||
}
|
||||
|
14
shaders/vulkan/vert/multiview.nocompat.vk.vert
Normal file
14
shaders/vulkan/vert/multiview.nocompat.vk.vert
Normal file
@ -0,0 +1,14 @@
|
||||
#version 310 es
|
||||
#extension GL_EXT_multiview : require
|
||||
|
||||
layout(std140, binding = 0) uniform MVPs
|
||||
{
|
||||
mat4 MVP[2];
|
||||
};
|
||||
|
||||
layout(location = 0) in vec4 Position;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = MVP[gl_ViewIndex] * Position;
|
||||
}
|
@ -3619,6 +3619,18 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage)
|
||||
SPIRV_CROSS_THROW("gl_SamplePosition not supported before GLSL 400.");
|
||||
return "gl_SamplePosition";
|
||||
|
||||
case BuiltInViewIndex:
|
||||
if (options.vulkan_semantics)
|
||||
{
|
||||
require_extension("GL_EXT_multiview");
|
||||
return "gl_ViewIndex";
|
||||
}
|
||||
else
|
||||
{
|
||||
require_extension("GL_OVR_multiview2");
|
||||
return "gl_ViewID_OVR";
|
||||
}
|
||||
|
||||
default:
|
||||
return join("gl_BuiltIn_", convert_to_string(builtin));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user