Add test shader for simple case of interlocked callstack.

This commit is contained in:
Hans-Kristian Arntzen 2019-09-04 11:55:17 +02:00
parent 36c433bd92
commit 63a770ed5c
6 changed files with 194 additions and 0 deletions

View File

@ -0,0 +1,32 @@
RasterizerOrderedByteAddressBuffer _14 : register(u1, space0);
RasterizerOrderedByteAddressBuffer _35 : register(u0, space0);
static float4 gl_FragCoord;
struct SPIRV_Cross_Input
{
float4 gl_FragCoord : SV_Position;
};
void callee2()
{
int _25 = int(gl_FragCoord.x);
_14.Store(_25 * 4 + 0, _14.Load(_25 * 4 + 0) + 1u);
}
void callee()
{
int _38 = int(gl_FragCoord.x);
_35.Store(_38 * 4 + 0, _35.Load(_38 * 4 + 0) + 1u);
callee2();
}
void frag_main()
{
callee();
}
void main(SPIRV_Cross_Input stage_input)
{
gl_FragCoord = stage_input.gl_FragCoord;
frag_main();
}

View File

@ -0,0 +1,35 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct SSBO1
{
uint values1[1];
};
struct SSBO0
{
uint values0[1];
};
inline void callee2(device SSBO1& v_14, thread float4& gl_FragCoord)
{
int _25 = int(gl_FragCoord.x);
v_14.values1[_25]++;
}
inline void callee(device SSBO1& v_14, thread float4& gl_FragCoord, device SSBO0& v_35)
{
int _38 = int(gl_FragCoord.x);
v_35.values0[_38]++;
callee2(v_14, gl_FragCoord);
}
fragment void main0(device SSBO1& v_14 [[buffer(0), raster_order_group(0)]], device SSBO0& v_35 [[buffer(1), raster_order_group(0)]], float4 gl_FragCoord [[position]])
{
callee(v_14, gl_FragCoord, v_35);
}

View File

@ -0,0 +1,34 @@
#version 450
#extension GL_ARB_fragment_shader_interlock : require
layout(pixel_interlock_ordered) in;
layout(binding = 1, std430) buffer SSBO1
{
uint values1[];
} _14;
layout(binding = 0, std430) buffer SSBO0
{
uint values0[];
} _35;
void callee2()
{
int _25 = int(gl_FragCoord.x);
_14.values1[_25]++;
}
void callee()
{
int _38 = int(gl_FragCoord.x);
_35.values0[_38]++;
callee2();
}
void main()
{
beginInvocationInterlockARB();
callee();
endInvocationInterlockARB();
}

View File

@ -0,0 +1,31 @@
#version 450
#extension GL_ARB_fragment_shader_interlock : require
layout(pixel_interlock_ordered) in;
layout(set = 0, binding = 0, std430) buffer SSBO0
{
uint values0[];
};
layout(set = 0, binding = 1, std430) buffer SSBO1
{
uint values1[];
};
void callee2()
{
values1[int(gl_FragCoord.x)] += 1;
}
void callee()
{
values0[int(gl_FragCoord.x)] += 1;
callee2();
}
void main()
{
beginInvocationInterlockARB();
callee();
endInvocationInterlockARB();
}

View File

@ -0,0 +1,31 @@
#version 450
#extension GL_ARB_fragment_shader_interlock : require
layout(pixel_interlock_ordered) in;
layout(set = 0, binding = 0, std430) buffer SSBO0
{
uint values0[];
};
layout(set = 0, binding = 1, std430) buffer SSBO1
{
uint values1[];
};
void callee2()
{
values1[int(gl_FragCoord.x)] += 1;
}
void callee()
{
values0[int(gl_FragCoord.x)] += 1;
callee2();
}
void main()
{
beginInvocationInterlockARB();
callee();
endInvocationInterlockARB();
}

View File

@ -0,0 +1,31 @@
#version 450
#extension GL_ARB_fragment_shader_interlock : require
layout(pixel_interlock_ordered) in;
layout(set = 0, binding = 0, std430) buffer SSBO0
{
uint values0[];
};
layout(set = 0, binding = 1, std430) buffer SSBO1
{
uint values1[];
};
void callee2()
{
values1[int(gl_FragCoord.x)] += 1;
}
void callee()
{
values0[int(gl_FragCoord.x)] += 1;
callee2();
}
void main()
{
beginInvocationInterlockARB();
callee();
endInvocationInterlockARB();
}