Test that out variables still work in leaf functions with capture on.
This commit is contained in:
Родитель
c51e5b7911
Коммит
546f1ccbb5
|
@ -0,0 +1,35 @@
|
|||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct UBO
|
||||
{
|
||||
float4x4 uMVP;
|
||||
};
|
||||
|
||||
struct spvAux
|
||||
{
|
||||
uint vertexCount;
|
||||
uint swizzleConst[1];
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float3 vNormal [[user(locn0)]];
|
||||
float4 gl_Position [[position]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float4 aVertex [[attribute(0)]];
|
||||
float3 aNormal [[attribute(1)]];
|
||||
};
|
||||
|
||||
vertex void main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]], constant spvAux& spvAuxBuffer [[buffer(30)]], uint gl_VertexIndex [[vertex_id]], uint gl_BaseVertex [[base_vertex]], uint gl_InstanceIndex [[instance_id]], uint gl_BaseInstance [[base_instance]], device main0_out* spvOut [[buffer(29)]])
|
||||
{
|
||||
device main0_out& out = spvOut[(gl_InstanceIndex - gl_BaseInstance) * spvAuxBuffer.vertexCount + gl_VertexIndex - gl_BaseVertex];
|
||||
out.gl_Position = _18.uMVP * in.aVertex;
|
||||
out.vNormal = in.aNormal;
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct UBO
|
||||
{
|
||||
float4x4 uMVP;
|
||||
};
|
||||
|
||||
struct spvAux
|
||||
{
|
||||
uint vertexCount;
|
||||
uint swizzleConst[1];
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float3 vNormal [[user(locn0)]];
|
||||
float4 gl_Position [[position]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float4 aVertex [[attribute(0)]];
|
||||
float3 aNormal [[attribute(1)]];
|
||||
};
|
||||
|
||||
void set_output(device float4& gl_Position, constant UBO& v_18, thread float4& aVertex, device float3& vNormal, thread float3& aNormal)
|
||||
{
|
||||
gl_Position = v_18.uMVP * aVertex;
|
||||
vNormal = aNormal;
|
||||
}
|
||||
|
||||
vertex void main0(main0_in in [[stage_in]], constant UBO& v_18 [[buffer(0)]], constant spvAux& spvAuxBuffer [[buffer(30)]], uint gl_VertexIndex [[vertex_id]], uint gl_BaseVertex [[base_vertex]], uint gl_InstanceIndex [[instance_id]], uint gl_BaseInstance [[base_instance]], device main0_out* spvOut [[buffer(29)]])
|
||||
{
|
||||
device main0_out& out = spvOut[(gl_InstanceIndex - gl_BaseInstance) * spvAuxBuffer.vertexCount + gl_VertexIndex - gl_BaseVertex];
|
||||
set_output(out.gl_Position, v_18, in.aVertex, out.vNormal, in.aNormal);
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#version 310 es
|
||||
|
||||
layout(std140) uniform UBO
|
||||
{
|
||||
uniform mat4 uMVP;
|
||||
};
|
||||
|
||||
layout(location = 0) in vec4 aVertex;
|
||||
layout(location = 1) in vec3 aNormal;
|
||||
|
||||
layout(location = 0) out vec3 vNormal;
|
||||
|
||||
void set_output()
|
||||
{
|
||||
gl_Position = uMVP * aVertex;
|
||||
vNormal = aNormal;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
set_output();
|
||||
}
|
Загрузка…
Ссылка в новой задаче