mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
tint/test-runner: Split expectations for FXC and DXC
Change tint's `--fxc` flag to take the path of the FXC compiler DLL. Have tint attempt to validate with both FXC and DXC if `--validate` is passed. Fix the 'dirsWithNoPassExpectations' logic which looks like it got broken with the tint -> dawn merge. It also incorrectly applied filepath.FromSlash() on windows. Change-Id: I0f46aa5c21bc48a2abc48402c41f846aff4a8633 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96800 Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
0778d9a48f
commit
7d34de88f1
5
test/tint/bug/chromium/1221120.wgsl.expected.fxc.hlsl
Normal file
5
test/tint/bug/chromium/1221120.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,5 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
19
test/tint/bug/chromium/1236161.wgsl.expected.fxc.hlsl
Normal file
19
test/tint/bug/chromium/1236161.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,19 @@
|
||||
struct modf_result {
|
||||
float fract;
|
||||
float whole;
|
||||
};
|
||||
modf_result tint_modf(float param_0) {
|
||||
float whole;
|
||||
float fract = modf(param_0, whole);
|
||||
modf_result result = {fract, whole};
|
||||
return result;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
void i() {
|
||||
const float s = tint_modf(1.0f).whole;
|
||||
}
|
||||
33
test/tint/bug/chromium/1251009.wgsl.expected.fxc.hlsl
Normal file
33
test/tint/bug/chromium/1251009.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
struct VertexInputs0 {
|
||||
uint vertex_index;
|
||||
int loc0;
|
||||
};
|
||||
struct VertexInputs1 {
|
||||
uint loc1;
|
||||
float4 loc3;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
int loc0 : TEXCOORD0;
|
||||
uint loc1 : TEXCOORD1;
|
||||
uint loc1_1 : TEXCOORD2;
|
||||
float4 loc3 : TEXCOORD3;
|
||||
uint vertex_index : SV_VertexID;
|
||||
uint instance_index : SV_InstanceID;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 main_inner(VertexInputs0 inputs0, uint loc1, uint instance_index, VertexInputs1 inputs1) {
|
||||
const uint foo = (inputs0.vertex_index + instance_index);
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const VertexInputs0 tint_symbol_3 = {tint_symbol.vertex_index, tint_symbol.loc0};
|
||||
const VertexInputs1 tint_symbol_4 = {tint_symbol.loc1_1, tint_symbol.loc3};
|
||||
const float4 inner_result = main_inner(tint_symbol_3, tint_symbol.loc1, tint_symbol.instance_index, tint_symbol_4);
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
102
test/tint/bug/chromium/1273230.wgsl.expected.fxc.hlsl
Normal file
102
test/tint/bug/chromium/1273230.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,102 @@
|
||||
uint value_or_one_if_zero_uint(uint value) {
|
||||
return value == 0u ? 1u : value;
|
||||
}
|
||||
|
||||
void marg8uintin() {
|
||||
}
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b0, space0) {
|
||||
uint4 uniforms[3];
|
||||
};
|
||||
RWByteAddressBuffer indices : register(u10, space0);
|
||||
RWByteAddressBuffer positions : register(u11, space0);
|
||||
RWByteAddressBuffer counters : register(u20, space0);
|
||||
RWByteAddressBuffer LUT : register(u21, space0);
|
||||
RWByteAddressBuffer dbg : register(u50, space0);
|
||||
|
||||
float3 toVoxelPos(float3 position) {
|
||||
float3 bbMin = float3(asfloat(uniforms[1].x), asfloat(uniforms[1].y), asfloat(uniforms[1].z));
|
||||
float3 bbMax = float3(asfloat(uniforms[2].x), asfloat(uniforms[2].y), asfloat(uniforms[2].z));
|
||||
float3 bbSize = (bbMin - bbMin);
|
||||
float cubeSize = max(max(bbMax.x, bbMax.y), bbSize.z);
|
||||
float gridSize = float(uniforms[0].y);
|
||||
float gx = ((cubeSize * (position.x - asfloat(uniforms[1].x))) / cubeSize);
|
||||
float gy = ((gx * (position.y - asfloat(uniforms[1].y))) / gridSize);
|
||||
float gz = ((gridSize * (position.z - asfloat(uniforms[1].z))) / gridSize);
|
||||
return float3(gz, gz, gz);
|
||||
}
|
||||
|
||||
uint toIndex1D(uint gridSize, float3 voxelPos) {
|
||||
uint3 icoord = uint3(voxelPos);
|
||||
return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z));
|
||||
}
|
||||
|
||||
uint3 toIndex4D(uint gridSize, uint index) {
|
||||
uint z_1 = (gridSize / value_or_one_if_zero_uint((index * index)));
|
||||
uint y_1 = ((gridSize - ((gridSize * gridSize) * z_1)) / (gridSize == 0u ? 1u : gridSize));
|
||||
uint x_1 = (index % (gridSize == 0u ? 1u : gridSize));
|
||||
return uint3(z_1, y_1, y_1);
|
||||
}
|
||||
|
||||
float3 loadPosition(uint vertexIndex) {
|
||||
float3 position = float3(asfloat(positions.Load((4u * ((3u * vertexIndex) + 0u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 1u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 2u)))));
|
||||
return position;
|
||||
}
|
||||
|
||||
uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) {
|
||||
uint value = 0;
|
||||
buffer.InterlockedOr(offset, 0, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
int tint_atomicLoad_1(RWByteAddressBuffer buffer, uint offset) {
|
||||
int value = 0;
|
||||
buffer.InterlockedOr(offset, 0, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
void doIgnore() {
|
||||
uint g43 = uniforms[0].x;
|
||||
uint kj6 = dbg.Load(20u);
|
||||
uint b53 = tint_atomicLoad(counters, (4u * 0u));
|
||||
uint rwg = indices.Load((4u * 0u));
|
||||
float rb5 = asfloat(positions.Load((4u * 0u)));
|
||||
int g55 = tint_atomicLoad_1(LUT, (4u * 0u));
|
||||
}
|
||||
|
||||
struct tint_symbol_1 {
|
||||
uint3 GlobalInvocationID : SV_DispatchThreadID;
|
||||
};
|
||||
|
||||
int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) {
|
||||
int original_value = 0;
|
||||
buffer.InterlockedAdd(offset, value, original_value);
|
||||
return original_value;
|
||||
}
|
||||
|
||||
|
||||
void main_count_inner(uint3 GlobalInvocationID) {
|
||||
uint triangleIndex = GlobalInvocationID.x;
|
||||
if ((triangleIndex >= uniforms[0].x)) {
|
||||
return;
|
||||
}
|
||||
doIgnore();
|
||||
uint i0 = indices.Load((4u * ((3u * triangleIndex) + 0u)));
|
||||
uint i1 = indices.Load((4u * ((3u * i0) + 1u)));
|
||||
uint i2 = indices.Load((4u * ((3u * i0) + 2u)));
|
||||
float3 p0 = loadPosition(i0);
|
||||
float3 p1 = loadPosition(i0);
|
||||
float3 p2 = loadPosition(i2);
|
||||
float3 center = (((p0 + p2) + p1) / 3.0f);
|
||||
float3 voxelPos = toVoxelPos(p1);
|
||||
uint lIndex = toIndex1D(uniforms[0].y, p0);
|
||||
int triangleOffset = tint_atomicAdd(LUT, (4u * i1), 1);
|
||||
}
|
||||
|
||||
[numthreads(128, 1, 1)]
|
||||
void main_count(tint_symbol_1 tint_symbol) {
|
||||
main_count_inner(tint_symbol.GlobalInvocationID);
|
||||
return;
|
||||
}
|
||||
16
test/tint/bug/chromium/1273451.wgsl.expected.fxc.hlsl
Normal file
16
test/tint/bug/chromium/1273451.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,16 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
struct A {
|
||||
int a;
|
||||
};
|
||||
struct B {
|
||||
int b;
|
||||
};
|
||||
|
||||
B f(A a) {
|
||||
const B tint_symbol = (B)0;
|
||||
return tint_symbol;
|
||||
}
|
||||
10
test/tint/bug/chromium/1290107.wgsl.expected.fxc.hlsl
Normal file
10
test/tint/bug/chromium/1290107.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,10 @@
|
||||
ByteAddressBuffer arr : register(t0, space0);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
uint tint_symbol_1 = 0u;
|
||||
arr.GetDimensions(tint_symbol_1);
|
||||
const uint tint_symbol_2 = (tint_symbol_1 / 4u);
|
||||
const uint len = tint_symbol_2;
|
||||
return;
|
||||
}
|
||||
5
test/tint/bug/chromium/1341475.wgsl.expected.fxc.hlsl
Normal file
5
test/tint/bug/chromium/1341475.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,5 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
lerp(1.0f, 1.0f, 1.0f);
|
||||
return;
|
||||
}
|
||||
6
test/tint/bug/chromium/1343242.wgsl.expected.fxc.hlsl
Normal file
6
test/tint/bug/chromium/1343242.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,6 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
static bool o = true;
|
||||
10
test/tint/bug/chromium/1345468.wgsl.expected.fxc.hlsl
Normal file
10
test/tint/bug/chromium/1345468.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,10 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
void f() {
|
||||
int i = 1;
|
||||
float2 a = float4x2((0.0f).xx, (0.0f).xx, float2(4.0f, 0.0f), (0.0f).xx)[i];
|
||||
int b = int2(0, 1)[i];
|
||||
}
|
||||
86
test/tint/bug/dawn/947.wgsl.expected.fxc.hlsl
Normal file
86
test/tint/bug/dawn/947.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,86 @@
|
||||
bug/dawn/947.wgsl:59:20 warning: 'textureSample' must only be called from uniform control flow
|
||||
var srcColor = textureSample(myTexture, mySampler, texcoord);
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
bug/dawn/947.wgsl:55:5 note: control flow depends on non-uniform value
|
||||
if (!all(clampedTexcoord == texcoord)) {
|
||||
^^
|
||||
|
||||
bug/dawn/947.wgsl:55:33 note: reading from user-defined input 'texcoord' may result in a non-uniform value
|
||||
if (!all(clampedTexcoord == texcoord)) {
|
||||
^^^^^^^^
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b0, space0) {
|
||||
uint4 uniforms[1];
|
||||
};
|
||||
|
||||
struct VertexOutputs {
|
||||
float2 texcoords;
|
||||
float4 position;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
uint VertexIndex : SV_VertexID;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float2 texcoords : TEXCOORD0;
|
||||
float4 position : SV_Position;
|
||||
};
|
||||
|
||||
VertexOutputs vs_main_inner(uint VertexIndex) {
|
||||
float2 texcoord[3] = {float2(-0.5f, 0.0f), float2(1.5f, 0.0f), float2(0.5f, 2.0f)};
|
||||
VertexOutputs output = (VertexOutputs)0;
|
||||
output.position = float4(((texcoord[VertexIndex] * 2.0f) - (1.0f).xx), 0.0f, 1.0f);
|
||||
bool flipY = (asfloat(uniforms[0].y) < 0.0f);
|
||||
if (flipY) {
|
||||
output.texcoords = ((((texcoord[VertexIndex] * asfloat(uniforms[0].xy)) + asfloat(uniforms[0].zw)) * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f));
|
||||
} else {
|
||||
output.texcoords = ((((texcoord[VertexIndex] * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)) * asfloat(uniforms[0].xy)) + asfloat(uniforms[0].zw));
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
tint_symbol_2 vs_main(tint_symbol_1 tint_symbol) {
|
||||
const VertexOutputs inner_result = vs_main_inner(tint_symbol.VertexIndex);
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.texcoords = inner_result.texcoords;
|
||||
wrapper_result.position = inner_result.position;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
SamplerState mySampler : register(s1, space0);
|
||||
Texture2D<float4> myTexture : register(t2, space0);
|
||||
|
||||
struct tint_symbol_4 {
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
struct tint_symbol_5 {
|
||||
float4 value : SV_Target0;
|
||||
};
|
||||
|
||||
static bool tint_discard = false;
|
||||
|
||||
float4 fs_main_inner(float2 texcoord) {
|
||||
float2 clampedTexcoord = clamp(texcoord, (0.0f).xx, (1.0f).xx);
|
||||
if (!(all((clampedTexcoord == texcoord)))) {
|
||||
tint_discard = true;
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
float4 srcColor = myTexture.Sample(mySampler, texcoord);
|
||||
return srcColor;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
}
|
||||
|
||||
tint_symbol_5 fs_main(tint_symbol_4 tint_symbol_3) {
|
||||
const float4 inner_result_1 = fs_main_inner(tint_symbol_3.texcoord);
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
const tint_symbol_5 tint_symbol_8 = (tint_symbol_5)0;
|
||||
return tint_symbol_8;
|
||||
}
|
||||
tint_symbol_5 wrapper_result_1 = (tint_symbol_5)0;
|
||||
wrapper_result_1.value = inner_result_1;
|
||||
return wrapper_result_1;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
struct S {
|
||||
int data[64];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u1, space0);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
S s = (S)0;
|
||||
result.Store(0u, asuint(s.data[asint(ubo[0].x)]));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
struct S {
|
||||
int data[64];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u1, space0);
|
||||
static S s = (S)0;
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
result.Store(0u, asuint(s.data[asint(ubo[0].x)]));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u2, space0);
|
||||
|
||||
RWByteAddressBuffer ssbo : register(u1, space0);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
result.Store(0u, asuint(asint(ssbo.Load((4u * uint(asint(ubo[0].x)))))));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[5];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u2, space0);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const uint scalar_offset = ((16u * uint(asint(ubo[4].x)))) / 4;
|
||||
result.Store(0u, asuint(asint(ubo[scalar_offset / 4][scalar_offset % 4])));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
struct S {
|
||||
int data[64];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u1, space0);
|
||||
groupshared S s;
|
||||
|
||||
struct tint_symbol_2 {
|
||||
uint local_invocation_index : SV_GroupIndex;
|
||||
};
|
||||
|
||||
void f_inner(uint local_invocation_index) {
|
||||
{
|
||||
[loop] for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) {
|
||||
const uint i = idx;
|
||||
s.data[i] = 0;
|
||||
}
|
||||
}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
result.Store(0u, asuint(s.data[asint(ubo[0].x)]));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f(tint_symbol_2 tint_symbol_1) {
|
||||
f_inner(tint_symbol_1.local_invocation_index);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
struct S {
|
||||
int data[64];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u1, space0);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
S s = (S)0;
|
||||
{
|
||||
int tint_symbol_2[64] = s.data;
|
||||
tint_symbol_2[asint(ubo[0].x)] = 1;
|
||||
s.data = tint_symbol_2;
|
||||
}
|
||||
result.Store(0u, asuint(s.data[3]));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
struct S {
|
||||
int data[64];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u1, space0);
|
||||
|
||||
void x(inout S p) {
|
||||
{
|
||||
int tint_symbol_2[64] = p.data;
|
||||
tint_symbol_2[asint(ubo[0].x)] = 1;
|
||||
p.data = tint_symbol_2;
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
S s = (S)0;
|
||||
x(s);
|
||||
result.Store(0u, asuint(s.data[3]));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
struct S {
|
||||
int data[64];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u1, space0);
|
||||
static S s = (S)0;
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
{
|
||||
int tint_symbol_2[64] = s.data;
|
||||
tint_symbol_2[asint(ubo[0].x)] = 1;
|
||||
s.data = tint_symbol_2;
|
||||
}
|
||||
result.Store(0u, asuint(s.data[3]));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
struct S {
|
||||
int data[64];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u1, space0);
|
||||
static S s = (S)0;
|
||||
|
||||
void x(inout S p) {
|
||||
{
|
||||
int tint_symbol_2[64] = p.data;
|
||||
tint_symbol_2[asint(ubo[0].x)] = 1;
|
||||
p.data = tint_symbol_2;
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
x(s);
|
||||
result.Store(0u, asuint(s.data[3]));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u2, space0);
|
||||
|
||||
RWByteAddressBuffer ssbo : register(u1, space0);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
ssbo.Store((4u * uint(asint(ubo[0].x))), asuint(1));
|
||||
result.Store(0u, asuint(asint(ssbo.Load(12u))));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
cbuffer cbuffer_ubo : register(b0, space0) {
|
||||
uint4 ubo[1];
|
||||
};
|
||||
|
||||
struct S {
|
||||
int data[64];
|
||||
};
|
||||
|
||||
RWByteAddressBuffer result : register(u1, space0);
|
||||
groupshared S s;
|
||||
|
||||
struct tint_symbol_2 {
|
||||
uint local_invocation_index : SV_GroupIndex;
|
||||
};
|
||||
|
||||
void f_inner(uint local_invocation_index) {
|
||||
{
|
||||
[loop] for(uint idx = local_invocation_index; (idx < 64u); idx = (idx + 1u)) {
|
||||
const uint i = idx;
|
||||
s.data[i] = 0;
|
||||
}
|
||||
}
|
||||
GroupMemoryBarrierWithGroupSync();
|
||||
s.data[asint(ubo[0].x)] = 1;
|
||||
result.Store(0u, asuint(s.data[3]));
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void f(tint_symbol_2 tint_symbol_1) {
|
||||
f_inner(tint_symbol_1.local_invocation_index);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must only be called from uniform control flow
|
||||
let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r;
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
bug/fxc/gradient_in_varying_loop/1112.wgsl:18:28 note: control flow depends on non-uniform value
|
||||
if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) {
|
||||
^^
|
||||
|
||||
bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSample' may be non-uniform
|
||||
let random: vec3<f32> = textureSample(randomTexture, Sampler, vUV).rgb;
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
SamplerState tint_symbol : register(s0, space0);
|
||||
Texture2D<float4> randomTexture : register(t1, space0);
|
||||
Texture2D<float4> depthTexture : register(t2, space0);
|
||||
|
||||
struct tint_symbol_2 {
|
||||
float2 vUV : TEXCOORD0;
|
||||
};
|
||||
struct tint_symbol_3 {
|
||||
float4 value : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main_inner(float2 vUV) {
|
||||
const float3 random = randomTexture.Sample(tint_symbol, vUV).rgb;
|
||||
int i = 0;
|
||||
[loop] while (true) {
|
||||
if ((i < 1)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
const float3 offset = float3((random.x).xxx);
|
||||
bool tint_tmp_2 = (offset.x < 0.0f);
|
||||
if (!tint_tmp_2) {
|
||||
tint_tmp_2 = (offset.y < 0.0f);
|
||||
}
|
||||
bool tint_tmp_1 = (tint_tmp_2);
|
||||
if (!tint_tmp_1) {
|
||||
tint_tmp_1 = (offset.x > 1.0f);
|
||||
}
|
||||
bool tint_tmp = (tint_tmp_1);
|
||||
if (!tint_tmp) {
|
||||
tint_tmp = (offset.y > 1.0f);
|
||||
}
|
||||
if ((tint_tmp)) {
|
||||
i = (i + 1);
|
||||
continue;
|
||||
}
|
||||
const float sampleDepth = depthTexture.Sample(tint_symbol, offset.xy).r;
|
||||
i = (i + 1);
|
||||
}
|
||||
return (1.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol_3 main(tint_symbol_2 tint_symbol_1) {
|
||||
const float4 inner_result = main_inner(tint_symbol_1.vUV);
|
||||
tint_symbol_3 wrapper_result = (tint_symbol_3)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
struct Particle {
|
||||
float3 position[8];
|
||||
float lifetime;
|
||||
float4 color;
|
||||
float3 velocity;
|
||||
};
|
||||
|
||||
ByteAddressBuffer particles : register(t3, space1);
|
||||
cbuffer cbuffer_sim : register(b4, space1) {
|
||||
uint4 sim[1];
|
||||
};
|
||||
|
||||
typedef float3 tint_symbol_3_ret[8];
|
||||
tint_symbol_3_ret tint_symbol_3(ByteAddressBuffer buffer, uint offset) {
|
||||
float3 arr[8] = (float3[8])0;
|
||||
{
|
||||
[loop] for(uint i_1 = 0u; (i_1 < 8u); i_1 = (i_1 + 1u)) {
|
||||
arr[i_1] = asfloat(buffer.Load3((offset + (i_1 * 16u))));
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Particle tint_symbol_2(ByteAddressBuffer buffer, uint offset) {
|
||||
const Particle tint_symbol_8 = {tint_symbol_3(buffer, (offset + 0u)), asfloat(buffer.Load((offset + 128u))), asfloat(buffer.Load4((offset + 144u))), asfloat(buffer.Load3((offset + 160u)))};
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
Particle particle = tint_symbol_2(particles, (176u * 0u));
|
||||
{
|
||||
float3 tint_symbol_1[8] = particle.position;
|
||||
tint_symbol_1[sim[0].x] = particle.position[sim[0].x];
|
||||
particle.position = tint_symbol_1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0];
|
||||
break;
|
||||
case 1:
|
||||
mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b4, space1) {
|
||||
uint4 uniforms[1];
|
||||
};
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
set_scalar_float2x4(m1, 0, uniforms[0].x, 1.0f);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0];
|
||||
break;
|
||||
case 1:
|
||||
mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b4, space1) {
|
||||
uint4 uniforms[1];
|
||||
};
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
set_scalar_float2x4(m1, uniforms[0].y, uniforms[0].x, 1.0f);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
void set_vector_float2x4(inout float2x4 mat, int col, float4 val) {
|
||||
switch (col) {
|
||||
case 0: mat[0] = val; break;
|
||||
case 1: mat[1] = val; break;
|
||||
}
|
||||
}
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b4, space1) {
|
||||
uint4 uniforms[1];
|
||||
};
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
set_vector_float2x4(m1, uniforms[0].x, (1.0f).xxxx);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0];
|
||||
break;
|
||||
case 1:
|
||||
mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b4, space1) {
|
||||
uint4 uniforms[1];
|
||||
};
|
||||
static float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
set_scalar_float2x4(m1, 0, uniforms[0].x, 1.0f);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0];
|
||||
break;
|
||||
case 1:
|
||||
mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b4, space1) {
|
||||
uint4 uniforms[1];
|
||||
};
|
||||
static float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
set_scalar_float2x4(m1, uniforms[0].y, uniforms[0].x, 1.0f);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0];
|
||||
break;
|
||||
case 1:
|
||||
mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b4, space1) {
|
||||
uint4 uniforms[1];
|
||||
};
|
||||
static float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
set_scalar_float2x4(m1, uniforms[0].y, 0, 1.0f);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
void set_scalar_float2x4(inout float2x4 mat, int col, int row, float val) {
|
||||
switch (col) {
|
||||
case 0:
|
||||
mat[0] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[0];
|
||||
break;
|
||||
case 1:
|
||||
mat[1] = (row.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : mat[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b4, space1) {
|
||||
uint4 uniforms[1];
|
||||
};
|
||||
static float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
set_scalar_float2x4(m1, uniforms[0].y, 0, 1.0f);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
void set_vector_float2x4(inout float2x4 mat, int col, float4 val) {
|
||||
switch (col) {
|
||||
case 0: mat[0] = val; break;
|
||||
case 1: mat[1] = val; break;
|
||||
}
|
||||
}
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b4, space1) {
|
||||
uint4 uniforms[1];
|
||||
};
|
||||
static float2x4 m1 = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
set_vector_float2x4(m1, uniforms[0].x, (1.0f).xxxx);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
void set_float2(inout float2 vec, int idx, float val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_int3(inout int3 vec, int idx, int val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_uint4(inout uint4 vec, int idx, uint val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
void set_bool2(inout bool2 vec, int idx, bool val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
static float2 v2f = float2(0.0f, 0.0f);
|
||||
static int3 v3i = int3(0, 0, 0);
|
||||
static uint4 v4u = uint4(0u, 0u, 0u, 0u);
|
||||
static bool2 v2b = bool2(false, false);
|
||||
|
||||
void foo() {
|
||||
{
|
||||
[loop] for(int i = 0; (i < 2); i = (i + 1)) {
|
||||
set_float2(v2f, i, 1.0f);
|
||||
set_int3(v3i, i, 1);
|
||||
set_uint4(v4u, i, 1u);
|
||||
set_bool2(v2b, i, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
{
|
||||
[loop] for(int i = 0; (i < 2); i = (i + 1)) {
|
||||
foo();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
void set_float2(inout float2 vec, int idx, float val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_int3(inout int3 vec, int idx, int val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_uint4(inout uint4 vec, int idx, uint val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
void set_bool2(inout bool2 vec, int idx, bool val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
static float2 v2f = float2(0.0f, 0.0f);
|
||||
static int3 v3i = int3(0, 0, 0);
|
||||
static uint4 v4u = uint4(0u, 0u, 0u, 0u);
|
||||
static bool2 v2b = bool2(false, false);
|
||||
|
||||
void foo() {
|
||||
int i = 0;
|
||||
set_float2(v2f, i, 1.0f);
|
||||
set_int3(v3i, i, 1);
|
||||
set_uint4(v4u, i, 1u);
|
||||
set_bool2(v2b, i, true);
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
{
|
||||
[loop] for(int i = 0; (i < 2); i = (i + 1)) {
|
||||
foo();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
void set_float2(inout float2 vec, int idx, float val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_float3(inout float3 vec, int idx, float val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_float4(inout float4 vec, int idx, float val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
void set_int2(inout int2 vec, int idx, int val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_int3(inout int3 vec, int idx, int val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_int4(inout int4 vec, int idx, int val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
void set_uint2(inout uint2 vec, int idx, uint val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_uint3(inout uint3 vec, int idx, uint val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_uint4(inout uint4 vec, int idx, uint val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
void set_bool2(inout bool2 vec, int idx, bool val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_bool3(inout bool3 vec, int idx, bool val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_bool4(inout bool4 vec, int idx, bool val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
float2 v2f = float2(0.0f, 0.0f);
|
||||
float3 v3f = float3(0.0f, 0.0f, 0.0f);
|
||||
float4 v4f = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
int2 v2i = int2(0, 0);
|
||||
int3 v3i = int3(0, 0, 0);
|
||||
int4 v4i = int4(0, 0, 0, 0);
|
||||
uint2 v2u = uint2(0u, 0u);
|
||||
uint3 v3u = uint3(0u, 0u, 0u);
|
||||
uint4 v4u = uint4(0u, 0u, 0u, 0u);
|
||||
bool2 v2b = bool2(false, false);
|
||||
bool3 v3b = bool3(false, false, false);
|
||||
bool4 v4b = bool4(false, false, false, false);
|
||||
{
|
||||
[loop] for(int i = 0; (i < 2); i = (i + 1)) {
|
||||
set_float2(v2f, i, 1.0f);
|
||||
set_float3(v3f, i, 1.0f);
|
||||
set_float4(v4f, i, 1.0f);
|
||||
set_int2(v2i, i, 1);
|
||||
set_int3(v3i, i, 1);
|
||||
set_int4(v4i, i, 1);
|
||||
set_uint2(v2u, i, 1u);
|
||||
set_uint3(v3u, i, 1u);
|
||||
set_uint4(v4u, i, 1u);
|
||||
set_bool2(v2b, i, true);
|
||||
set_bool3(v3b, i, true);
|
||||
set_bool4(v4b, i, true);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
void set_float2(inout float2 vec, int idx, float val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_int3(inout int3 vec, int idx, int val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_uint4(inout uint4 vec, int idx, uint val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
void set_bool2(inout bool2 vec, int idx, bool val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
float2 v2f = float2(0.0f, 0.0f);
|
||||
float2 v2f_2 = float2(0.0f, 0.0f);
|
||||
int3 v3i = int3(0, 0, 0);
|
||||
int3 v3i_2 = int3(0, 0, 0);
|
||||
uint4 v4u = uint4(0u, 0u, 0u, 0u);
|
||||
uint4 v4u_2 = uint4(0u, 0u, 0u, 0u);
|
||||
bool2 v2b = bool2(false, false);
|
||||
bool2 v2b_2 = bool2(false, false);
|
||||
{
|
||||
[loop] for(int i = 0; (i < 2); i = (i + 1)) {
|
||||
set_float2(v2f, i, 1.0f);
|
||||
set_int3(v3i, i, 1);
|
||||
set_uint4(v4u, i, 1u);
|
||||
set_bool2(v2b, i, true);
|
||||
set_float2(v2f_2, i, 1.0f);
|
||||
set_int3(v3i_2, i, 1);
|
||||
set_uint4(v4u_2, i, 1u);
|
||||
set_bool2(v2b_2, i, true);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
void set_float2(inout float2 vec, int idx, float val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_int2(inout int2 vec, int idx, int val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_uint2(inout uint2 vec, int idx, uint val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_bool2(inout bool2 vec, int idx, bool val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_float3(inout float3 vec, int idx, float val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_float4(inout float4 vec, int idx, float val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
void set_int3(inout int3 vec, int idx, int val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_int4(inout int4 vec, int idx, int val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
void set_uint3(inout uint3 vec, int idx, uint val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_uint4(inout uint4 vec, int idx, uint val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
void set_bool3(inout bool3 vec, int idx, bool val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_bool4(inout bool4 vec, int idx, bool val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
float2 v2f = float2(0.0f, 0.0f);
|
||||
float3 v3f = float3(0.0f, 0.0f, 0.0f);
|
||||
float4 v4f = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
int2 v2i = int2(0, 0);
|
||||
int3 v3i = int3(0, 0, 0);
|
||||
int4 v4i = int4(0, 0, 0, 0);
|
||||
uint2 v2u = uint2(0u, 0u);
|
||||
uint3 v3u = uint3(0u, 0u, 0u);
|
||||
uint4 v4u = uint4(0u, 0u, 0u, 0u);
|
||||
bool2 v2b = bool2(false, false);
|
||||
bool3 v3b = bool3(false, false, false);
|
||||
bool4 v4b = bool4(false, false, false, false);
|
||||
{
|
||||
[loop] for(int i = 0; (i < 2); i = (i + 1)) {
|
||||
set_float2(v2f, i, 1.0f);
|
||||
set_int2(v2i, i, 1);
|
||||
set_uint2(v2u, i, 1u);
|
||||
set_bool2(v2b, i, true);
|
||||
}
|
||||
}
|
||||
int i = 0;
|
||||
set_float3(v3f, i, 1.0f);
|
||||
set_float4(v4f, i, 1.0f);
|
||||
set_int3(v3i, i, 1);
|
||||
set_int4(v4i, i, 1);
|
||||
set_uint3(v3u, i, 1u);
|
||||
set_uint4(v4u, i, 1u);
|
||||
set_bool3(v3b, i, true);
|
||||
set_bool4(v4b, i, true);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
void set_float2(inout float2 vec, int idx, float val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_float3(inout float3 vec, int idx, float val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_float4(inout float4 vec, int idx, float val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
void set_int2(inout int2 vec, int idx, int val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_int3(inout int3 vec, int idx, int val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_int4(inout int4 vec, int idx, int val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
void set_uint2(inout uint2 vec, int idx, uint val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_uint3(inout uint3 vec, int idx, uint val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_uint4(inout uint4 vec, int idx, uint val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
void set_bool2(inout bool2 vec, int idx, bool val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
void set_bool3(inout bool3 vec, int idx, bool val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
void set_bool4(inout bool4 vec, int idx, bool val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main() {
|
||||
float2 v2f = float2(0.0f, 0.0f);
|
||||
float3 v3f = float3(0.0f, 0.0f, 0.0f);
|
||||
float4 v4f = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
int2 v2i = int2(0, 0);
|
||||
int3 v3i = int3(0, 0, 0);
|
||||
int4 v4i = int4(0, 0, 0, 0);
|
||||
uint2 v2u = uint2(0u, 0u);
|
||||
uint3 v3u = uint3(0u, 0u, 0u);
|
||||
uint4 v4u = uint4(0u, 0u, 0u, 0u);
|
||||
bool2 v2b = bool2(false, false);
|
||||
bool3 v3b = bool3(false, false, false);
|
||||
bool4 v4b = bool4(false, false, false, false);
|
||||
int i = 0;
|
||||
set_float2(v2f, i, 1.0f);
|
||||
set_float3(v3f, i, 1.0f);
|
||||
set_float4(v4f, i, 1.0f);
|
||||
set_int2(v2i, i, 1);
|
||||
set_int3(v3i, i, 1);
|
||||
set_int4(v4i, i, 1);
|
||||
set_uint2(v2u, i, 1u);
|
||||
set_uint3(v3u, i, 1u);
|
||||
set_uint4(v4u, i, 1u);
|
||||
set_bool2(v2b, i, true);
|
||||
set_bool3(v3b, i, true);
|
||||
set_bool4(v4b, i, true);
|
||||
return;
|
||||
}
|
||||
63
test/tint/bug/tint/1046.wgsl.expected.fxc.hlsl
Normal file
63
test/tint/bug/tint/1046.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,63 @@
|
||||
cbuffer cbuffer_uniforms : register(b0, space0) {
|
||||
uint4 uniforms[10];
|
||||
};
|
||||
ByteAddressBuffer pointLights : register(t1, space0);
|
||||
SamplerState mySampler : register(s2, space0);
|
||||
Texture2D<float4> myTexture : register(t3, space0);
|
||||
|
||||
struct FragmentInput {
|
||||
float4 position;
|
||||
float4 view_position;
|
||||
float4 normal;
|
||||
float2 uv;
|
||||
float4 color;
|
||||
};
|
||||
struct FragmentOutput {
|
||||
float4 color;
|
||||
};
|
||||
|
||||
float4 getColor(FragmentInput fragment) {
|
||||
float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
if ((uniforms[8].y == 0u)) {
|
||||
color = fragment.color;
|
||||
} else {
|
||||
if ((uniforms[8].y == 1u)) {
|
||||
color = fragment.normal;
|
||||
color.a = 1.0f;
|
||||
} else {
|
||||
if ((uniforms[8].y == 2u)) {
|
||||
color = asfloat(uniforms[9]);
|
||||
} else {
|
||||
if ((uniforms[8].y == 3u)) {
|
||||
color = myTexture.Sample(mySampler, fragment.uv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float4 view_position : TEXCOORD0;
|
||||
float4 normal : TEXCOORD1;
|
||||
float2 uv : TEXCOORD2;
|
||||
float4 color : TEXCOORD3;
|
||||
float4 position : SV_Position;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 color : SV_Target0;
|
||||
};
|
||||
|
||||
FragmentOutput main_inner(FragmentInput fragment) {
|
||||
FragmentOutput output = (FragmentOutput)0;
|
||||
output.color = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
return output;
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const FragmentInput tint_symbol_5 = {tint_symbol.position, tint_symbol.view_position, tint_symbol.normal, tint_symbol.uv, tint_symbol.color};
|
||||
const FragmentOutput inner_result = main_inner(tint_symbol_5);
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.color = inner_result.color;
|
||||
return wrapper_result;
|
||||
}
|
||||
15
test/tint/bug/tint/1064.wgsl.expected.fxc.hlsl
Normal file
15
test/tint/bug/tint/1064.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,15 @@
|
||||
void main() {
|
||||
[loop] while (true) {
|
||||
if (false) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
{
|
||||
if (true) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
30
test/tint/bug/tint/1076.wgsl.expected.fxc.hlsl
Normal file
30
test/tint/bug/tint/1076.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,30 @@
|
||||
struct FragIn {
|
||||
float a;
|
||||
uint mask;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float a : TEXCOORD0;
|
||||
float b : TEXCOORD1;
|
||||
uint mask : SV_Coverage;
|
||||
};
|
||||
struct tint_symbol_3 {
|
||||
float a : SV_Target0;
|
||||
uint mask : SV_Coverage;
|
||||
};
|
||||
|
||||
FragIn main_inner(FragIn tint_symbol, float b) {
|
||||
if ((tint_symbol.mask == 0u)) {
|
||||
return tint_symbol;
|
||||
}
|
||||
const FragIn tint_symbol_4 = {b, 1u};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
|
||||
tint_symbol_3 main(tint_symbol_2 tint_symbol_1) {
|
||||
const FragIn tint_symbol_5 = {tint_symbol_1.a, tint_symbol_1.mask};
|
||||
const FragIn inner_result = main_inner(tint_symbol_5, tint_symbol_1.b);
|
||||
tint_symbol_3 wrapper_result = (tint_symbol_3)0;
|
||||
wrapper_result.a = inner_result.a;
|
||||
wrapper_result.mask = inner_result.mask;
|
||||
return wrapper_result;
|
||||
}
|
||||
46
test/tint/bug/tint/1081.wgsl.expected.fxc.hlsl
Normal file
46
test/tint/bug/tint/1081.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,46 @@
|
||||
static bool tint_discard = false;
|
||||
|
||||
int f(int x) {
|
||||
if ((x == 10)) {
|
||||
tint_discard = true;
|
||||
return 0;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
struct tint_symbol_1 {
|
||||
nointerpolation int3 x : TEXCOORD1;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
int value : SV_Target2;
|
||||
};
|
||||
|
||||
int main_inner(int3 x) {
|
||||
int y = x.x;
|
||||
[loop] while (true) {
|
||||
const int r = f(y);
|
||||
if (tint_discard) {
|
||||
return 0;
|
||||
}
|
||||
if ((r == 0)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const int inner_result = main_inner(tint_symbol.x);
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
const tint_symbol_2 tint_symbol_3 = (tint_symbol_2)0;
|
||||
return tint_symbol_3;
|
||||
}
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
5
test/tint/bug/tint/1083.wgsl.expected.fxc.hlsl
Normal file
5
test/tint/bug/tint/1083.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,5 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const int c = (1 / 1);
|
||||
return;
|
||||
}
|
||||
14
test/tint/bug/tint/1086.wgsl.expected.fxc.hlsl
Normal file
14
test/tint/bug/tint/1086.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,14 @@
|
||||
static float v = 0.0f;
|
||||
|
||||
void x(inout float p) {
|
||||
p = 0.0f;
|
||||
}
|
||||
|
||||
void g() {
|
||||
x(v);
|
||||
}
|
||||
|
||||
void f() {
|
||||
g();
|
||||
return;
|
||||
}
|
||||
72
test/tint/bug/tint/1088.spvasm.expected.fxc.hlsl
Normal file
72
test/tint/bug/tint/1088.spvasm.expected.fxc.hlsl
Normal file
@@ -0,0 +1,72 @@
|
||||
static float3 position = float3(0.0f, 0.0f, 0.0f);
|
||||
cbuffer cbuffer_x_14 : register(b2, space2) {
|
||||
uint4 x_14[17];
|
||||
};
|
||||
static float2 vUV = float2(0.0f, 0.0f);
|
||||
static float2 uv = float2(0.0f, 0.0f);
|
||||
static float3 normal = float3(0.0f, 0.0f, 0.0f);
|
||||
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
float4x4 tint_symbol_4(uint4 buffer[17], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_1 = ((offset + 16u)) / 4;
|
||||
const uint scalar_offset_2 = ((offset + 32u)) / 4;
|
||||
const uint scalar_offset_3 = ((offset + 48u)) / 4;
|
||||
return float4x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]), asfloat(buffer[scalar_offset_3 / 4]));
|
||||
}
|
||||
|
||||
void main_1() {
|
||||
float4 q = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float3 p = float3(0.0f, 0.0f, 0.0f);
|
||||
const float3 x_13 = position;
|
||||
q = float4(x_13.x, x_13.y, x_13.z, 1.0f);
|
||||
const float4 x_21 = q;
|
||||
p = float3(x_21.x, x_21.y, x_21.z);
|
||||
const float x_27 = p.x;
|
||||
const uint scalar_offset_4 = ((208u + (16u * 0u))) / 4;
|
||||
const float x_41 = asfloat(x_14[scalar_offset_4 / 4][scalar_offset_4 % 4]);
|
||||
const float x_45 = position.y;
|
||||
const float x_49 = asfloat(x_14[4].x);
|
||||
p.x = (x_27 + sin(((x_41 * x_45) + x_49)));
|
||||
const float x_55 = p.y;
|
||||
const float x_57 = asfloat(x_14[4].x);
|
||||
p.y = (x_55 + sin((x_57 + 4.0f)));
|
||||
const float4x4 x_69 = tint_symbol_4(x_14, 0u);
|
||||
const float3 x_70 = p;
|
||||
gl_Position = mul(float4(x_70.x, x_70.y, x_70.z, 1.0f), x_69);
|
||||
vUV = uv;
|
||||
const float x_87 = gl_Position.y;
|
||||
gl_Position.y = (x_87 * -1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
float4 gl_Position;
|
||||
float2 vUV_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float3 position_param : TEXCOORD0;
|
||||
float3 normal_param : TEXCOORD1;
|
||||
float2 uv_param : TEXCOORD2;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float2 vUV_1 : TEXCOORD0;
|
||||
float4 gl_Position : SV_Position;
|
||||
};
|
||||
|
||||
main_out main_inner(float3 position_param, float2 uv_param, float3 normal_param) {
|
||||
position = position_param;
|
||||
uv = uv_param;
|
||||
normal = normal_param;
|
||||
main_1();
|
||||
const main_out tint_symbol_6 = {gl_Position, vUV};
|
||||
return tint_symbol_6;
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const main_out inner_result = main_inner(tint_symbol.position_param, tint_symbol.uv_param, tint_symbol.normal_param);
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.gl_Position = inner_result.gl_Position;
|
||||
wrapper_result.vUV_1 = inner_result.vUV_1;
|
||||
return wrapper_result;
|
||||
}
|
||||
179
test/tint/bug/tint/1113.wgsl.expected.fxc.hlsl
Normal file
179
test/tint/bug/tint/1113.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,179 @@
|
||||
uint value_or_one_if_zero_uint(uint value) {
|
||||
return value == 0u ? 1u : value;
|
||||
}
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b0, space0) {
|
||||
uint4 uniforms[3];
|
||||
};
|
||||
RWByteAddressBuffer indices : register(u10, space0);
|
||||
RWByteAddressBuffer positions : register(u11, space0);
|
||||
RWByteAddressBuffer counters : register(u20, space0);
|
||||
RWByteAddressBuffer LUT : register(u21, space0);
|
||||
RWByteAddressBuffer dbg : register(u50, space0);
|
||||
|
||||
float3 toVoxelPos(float3 position) {
|
||||
float3 bbMin = float3(asfloat(uniforms[1].x), asfloat(uniforms[1].y), asfloat(uniforms[1].z));
|
||||
float3 bbMax = float3(asfloat(uniforms[2].x), asfloat(uniforms[2].y), asfloat(uniforms[2].z));
|
||||
float3 bbSize = (bbMax - bbMin);
|
||||
float cubeSize = max(max(bbSize.x, bbSize.y), bbSize.z);
|
||||
float gridSize = float(uniforms[0].y);
|
||||
float gx = ((gridSize * (position.x - asfloat(uniforms[1].x))) / cubeSize);
|
||||
float gy = ((gridSize * (position.y - asfloat(uniforms[1].y))) / cubeSize);
|
||||
float gz = ((gridSize * (position.z - asfloat(uniforms[1].z))) / cubeSize);
|
||||
return float3(gx, gy, gz);
|
||||
}
|
||||
|
||||
uint toIndex1D(uint gridSize, float3 voxelPos) {
|
||||
uint3 icoord = uint3(voxelPos);
|
||||
return ((icoord.x + (gridSize * icoord.y)) + ((gridSize * gridSize) * icoord.z));
|
||||
}
|
||||
|
||||
uint3 toIndex3D(uint gridSize, uint index) {
|
||||
uint z_1 = (index / value_or_one_if_zero_uint((gridSize * gridSize)));
|
||||
uint y_1 = ((index - ((gridSize * gridSize) * z_1)) / (gridSize == 0u ? 1u : gridSize));
|
||||
uint x_1 = (index % (gridSize == 0u ? 1u : gridSize));
|
||||
return uint3(x_1, y_1, z_1);
|
||||
}
|
||||
|
||||
float3 loadPosition(uint vertexIndex) {
|
||||
float3 position = float3(asfloat(positions.Load((4u * ((3u * vertexIndex) + 0u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 1u)))), asfloat(positions.Load((4u * ((3u * vertexIndex) + 2u)))));
|
||||
return position;
|
||||
}
|
||||
|
||||
uint tint_atomicLoad(RWByteAddressBuffer buffer, uint offset) {
|
||||
uint value = 0;
|
||||
buffer.InterlockedOr(offset, 0, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
int tint_atomicLoad_1(RWByteAddressBuffer buffer, uint offset) {
|
||||
int value = 0;
|
||||
buffer.InterlockedOr(offset, 0, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
void doIgnore() {
|
||||
uint g42 = uniforms[0].x;
|
||||
uint kj6 = dbg.Load(20u);
|
||||
uint b53 = tint_atomicLoad(counters, (4u * 0u));
|
||||
uint rwg = indices.Load((4u * 0u));
|
||||
float rb5 = asfloat(positions.Load((4u * 0u)));
|
||||
int g55 = tint_atomicLoad_1(LUT, (4u * 0u));
|
||||
}
|
||||
|
||||
struct tint_symbol_1 {
|
||||
uint3 GlobalInvocationID : SV_DispatchThreadID;
|
||||
};
|
||||
|
||||
uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) {
|
||||
uint original_value = 0;
|
||||
buffer.InterlockedAdd(offset, value, original_value);
|
||||
return original_value;
|
||||
}
|
||||
|
||||
|
||||
void main_count_inner(uint3 GlobalInvocationID) {
|
||||
uint triangleIndex = GlobalInvocationID.x;
|
||||
if ((triangleIndex >= uniforms[0].x)) {
|
||||
return;
|
||||
}
|
||||
doIgnore();
|
||||
uint i0 = indices.Load((4u * ((3u * triangleIndex) + 0u)));
|
||||
uint i1 = indices.Load((4u * ((3u * triangleIndex) + 1u)));
|
||||
uint i2 = indices.Load((4u * ((3u * triangleIndex) + 2u)));
|
||||
float3 p0 = loadPosition(i0);
|
||||
float3 p1 = loadPosition(i1);
|
||||
float3 p2 = loadPosition(i2);
|
||||
float3 center = (((p0 + p1) + p2) / 3.0f);
|
||||
float3 voxelPos = toVoxelPos(center);
|
||||
uint voxelIndex = toIndex1D(uniforms[0].y, voxelPos);
|
||||
uint acefg = tint_atomicAdd(counters, (4u * voxelIndex), 1u);
|
||||
if ((triangleIndex == 0u)) {
|
||||
dbg.Store(16u, asuint(uniforms[0].y));
|
||||
dbg.Store(32u, asuint(center.x));
|
||||
dbg.Store(36u, asuint(center.y));
|
||||
dbg.Store(40u, asuint(center.z));
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(128, 1, 1)]
|
||||
void main_count(tint_symbol_1 tint_symbol) {
|
||||
main_count_inner(tint_symbol.GlobalInvocationID);
|
||||
return;
|
||||
}
|
||||
|
||||
struct tint_symbol_3 {
|
||||
uint3 GlobalInvocationID : SV_DispatchThreadID;
|
||||
};
|
||||
|
||||
uint tint_atomicAdd_1(RWByteAddressBuffer buffer, uint offset, uint value) {
|
||||
uint original_value = 0;
|
||||
buffer.InterlockedAdd(offset, value, original_value);
|
||||
return original_value;
|
||||
}
|
||||
|
||||
|
||||
void tint_atomicStore(RWByteAddressBuffer buffer, uint offset, int value) {
|
||||
int ignored;
|
||||
buffer.InterlockedExchange(offset, value, ignored);
|
||||
}
|
||||
|
||||
|
||||
void main_create_lut_inner(uint3 GlobalInvocationID) {
|
||||
uint voxelIndex = GlobalInvocationID.x;
|
||||
doIgnore();
|
||||
uint maxVoxels = ((uniforms[0].y * uniforms[0].y) * uniforms[0].y);
|
||||
if ((voxelIndex >= maxVoxels)) {
|
||||
return;
|
||||
}
|
||||
uint numTriangles = tint_atomicLoad(counters, (4u * voxelIndex));
|
||||
int offset = -1;
|
||||
if ((numTriangles > 0u)) {
|
||||
const uint tint_symbol_6 = tint_atomicAdd_1(dbg, 0u, numTriangles);
|
||||
offset = int(tint_symbol_6);
|
||||
}
|
||||
tint_atomicStore(LUT, (4u * voxelIndex), offset);
|
||||
}
|
||||
|
||||
[numthreads(128, 1, 1)]
|
||||
void main_create_lut(tint_symbol_3 tint_symbol_2) {
|
||||
main_create_lut_inner(tint_symbol_2.GlobalInvocationID);
|
||||
return;
|
||||
}
|
||||
|
||||
struct tint_symbol_5 {
|
||||
uint3 GlobalInvocationID : SV_DispatchThreadID;
|
||||
};
|
||||
|
||||
int tint_atomicAdd_2(RWByteAddressBuffer buffer, uint offset, int value) {
|
||||
int original_value = 0;
|
||||
buffer.InterlockedAdd(offset, value, original_value);
|
||||
return original_value;
|
||||
}
|
||||
|
||||
|
||||
void main_sort_triangles_inner(uint3 GlobalInvocationID) {
|
||||
uint triangleIndex = GlobalInvocationID.x;
|
||||
doIgnore();
|
||||
if ((triangleIndex >= uniforms[0].x)) {
|
||||
return;
|
||||
}
|
||||
uint i0 = indices.Load((4u * ((3u * triangleIndex) + 0u)));
|
||||
uint i1 = indices.Load((4u * ((3u * triangleIndex) + 1u)));
|
||||
uint i2 = indices.Load((4u * ((3u * triangleIndex) + 2u)));
|
||||
float3 p0 = loadPosition(i0);
|
||||
float3 p1 = loadPosition(i1);
|
||||
float3 p2 = loadPosition(i2);
|
||||
float3 center = (((p0 + p1) + p2) / 3.0f);
|
||||
float3 voxelPos = toVoxelPos(center);
|
||||
uint voxelIndex = toIndex1D(uniforms[0].y, voxelPos);
|
||||
int triangleOffset = tint_atomicAdd_2(LUT, (4u * voxelIndex), 1);
|
||||
}
|
||||
|
||||
[numthreads(128, 1, 1)]
|
||||
void main_sort_triangles(tint_symbol_5 tint_symbol_4) {
|
||||
main_sort_triangles_inner(tint_symbol_4.GlobalInvocationID);
|
||||
return;
|
||||
}
|
||||
134
test/tint/bug/tint/1118.wgsl.expected.fxc.hlsl
Normal file
134
test/tint/bug/tint/1118.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,134 @@
|
||||
bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform control flow
|
||||
normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64))));
|
||||
^^^^
|
||||
|
||||
bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value
|
||||
if ((x_9 > 0.0)) {
|
||||
^^
|
||||
|
||||
bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value
|
||||
let x_9 : f32 = fClipDistance3;
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
static float fClipDistance3 = 0.0f;
|
||||
static float fClipDistance4 = 0.0f;
|
||||
cbuffer cbuffer_x_29 : register(b0, space0) {
|
||||
uint4 x_29[1];
|
||||
};
|
||||
cbuffer cbuffer_x_49 : register(b1, space0) {
|
||||
uint4 x_49[3];
|
||||
};
|
||||
cbuffer cbuffer_x_137 : register(b2, space0) {
|
||||
uint4 x_137[1];
|
||||
};
|
||||
static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
static bool tint_discard = false;
|
||||
|
||||
void main_1() {
|
||||
float3 viewDirectionW = float3(0.0f, 0.0f, 0.0f);
|
||||
float4 baseColor = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float3 diffuseColor = float3(0.0f, 0.0f, 0.0f);
|
||||
float alpha = 0.0f;
|
||||
float3 normalW = float3(0.0f, 0.0f, 0.0f);
|
||||
float2 uvOffset = float2(0.0f, 0.0f);
|
||||
float3 baseAmbientColor = float3(0.0f, 0.0f, 0.0f);
|
||||
float glossiness = 0.0f;
|
||||
float3 diffuseBase = float3(0.0f, 0.0f, 0.0f);
|
||||
float shadow = 0.0f;
|
||||
float4 refractionColor = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float4 reflectionColor = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float3 emissiveColor = float3(0.0f, 0.0f, 0.0f);
|
||||
float3 finalDiffuse = float3(0.0f, 0.0f, 0.0f);
|
||||
float3 finalSpecular = float3(0.0f, 0.0f, 0.0f);
|
||||
float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
if ((fClipDistance3 > 0.0f)) {
|
||||
tint_discard = true;
|
||||
return;
|
||||
}
|
||||
if ((fClipDistance4 > 0.0f)) {
|
||||
tint_discard = true;
|
||||
return;
|
||||
}
|
||||
const float4 x_34 = asfloat(x_29[0]);
|
||||
const float3 x_38 = (0.0f).xxx;
|
||||
viewDirectionW = normalize((float3(x_34.x, x_34.y, x_34.z) - x_38));
|
||||
baseColor = (1.0f).xxxx;
|
||||
const float4 x_52 = asfloat(x_49[0]);
|
||||
diffuseColor = float3(x_52.x, x_52.y, x_52.z);
|
||||
const float x_60 = asfloat(x_49[0].w);
|
||||
alpha = x_60;
|
||||
const float3 x_62 = (0.0f).xxx;
|
||||
const float3 x_64 = (0.0f).xxx;
|
||||
normalW = normalize(-(cross(ddx(x_62), ddy(x_64))));
|
||||
uvOffset = (0.0f).xx;
|
||||
const float4 x_74 = (0.0f).xxxx;
|
||||
const float4 x_76 = baseColor;
|
||||
const float3 x_78 = (float3(x_76.x, x_76.y, x_76.z) * float3(x_74.x, x_74.y, x_74.z));
|
||||
baseColor = float4(x_78.x, x_78.y, x_78.z, baseColor.w);
|
||||
baseAmbientColor = (1.0f).xxx;
|
||||
glossiness = 0.0f;
|
||||
diffuseBase = (0.0f).xxx;
|
||||
shadow = 1.0f;
|
||||
refractionColor = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
reflectionColor = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
const float3 x_94 = asfloat(x_49[2].xyz);
|
||||
emissiveColor = x_94;
|
||||
const float3 x_96 = diffuseBase;
|
||||
const float3 x_97 = diffuseColor;
|
||||
const float3 x_99 = emissiveColor;
|
||||
const float3 x_103 = asfloat(x_49[1].xyz);
|
||||
const float4 x_108 = baseColor;
|
||||
finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), (0.0f).xxx, (1.0f).xxx) * float3(x_108.x, x_108.y, x_108.z));
|
||||
finalSpecular = (0.0f).xxx;
|
||||
const float4 x_118 = reflectionColor;
|
||||
const float4 x_121 = refractionColor;
|
||||
const float3 x_123 = ((((finalDiffuse * baseAmbientColor) + finalSpecular) + float3(x_118.x, x_118.y, x_118.z)) + float3(x_121.x, x_121.y, x_121.z));
|
||||
color = float4(x_123.x, x_123.y, x_123.z, alpha);
|
||||
const float4 x_129 = color;
|
||||
const float3 x_132 = max(float3(x_129.x, x_129.y, x_129.z), (0.0f).xxx);
|
||||
color = float4(x_132.x, x_132.y, x_132.z, color.w);
|
||||
const float x_140 = asfloat(x_137[0].x);
|
||||
const float x_142 = color.w;
|
||||
color.w = (x_142 * x_140);
|
||||
glFragColor = color;
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
float4 glFragColor_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float fClipDistance3_param : TEXCOORD2;
|
||||
float fClipDistance4_param : TEXCOORD3;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 glFragColor_1 : SV_Target0;
|
||||
};
|
||||
|
||||
main_out main_inner(float fClipDistance3_param, float fClipDistance4_param) {
|
||||
fClipDistance3 = fClipDistance3_param;
|
||||
fClipDistance4 = fClipDistance4_param;
|
||||
main_1();
|
||||
if (tint_discard) {
|
||||
const main_out tint_symbol_8 = (main_out)0;
|
||||
return tint_symbol_8;
|
||||
}
|
||||
const main_out tint_symbol_9 = {glFragColor};
|
||||
return tint_symbol_9;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const main_out inner_result = main_inner(tint_symbol.fClipDistance3_param, tint_symbol.fClipDistance4_param);
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
const tint_symbol_2 tint_symbol_10 = (tint_symbol_2)0;
|
||||
return tint_symbol_10;
|
||||
}
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.glFragColor_1 = inner_result.glFragColor_1;
|
||||
return wrapper_result;
|
||||
}
|
||||
116
test/tint/bug/tint/1121.wgsl.expected.fxc.hlsl
Normal file
116
test/tint/bug/tint/1121.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,116 @@
|
||||
RWByteAddressBuffer lightsBuffer : register(u0, space0);
|
||||
|
||||
RWByteAddressBuffer tileLightId : register(u0, space1);
|
||||
|
||||
cbuffer cbuffer_config : register(b0, space2) {
|
||||
uint4 config[2];
|
||||
};
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b0, space3) {
|
||||
uint4 uniforms[11];
|
||||
};
|
||||
|
||||
struct tint_symbol_1 {
|
||||
uint3 GlobalInvocationID : SV_DispatchThreadID;
|
||||
};
|
||||
|
||||
float4x4 tint_symbol_6(uint4 buffer[11], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_1 = ((offset + 16u)) / 4;
|
||||
const uint scalar_offset_2 = ((offset + 32u)) / 4;
|
||||
const uint scalar_offset_3 = ((offset + 48u)) / 4;
|
||||
return float4x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]), asfloat(buffer[scalar_offset_3 / 4]));
|
||||
}
|
||||
|
||||
uint tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, uint value) {
|
||||
uint original_value = 0;
|
||||
buffer.InterlockedAdd(offset, value, original_value);
|
||||
return original_value;
|
||||
}
|
||||
|
||||
|
||||
void main_inner(uint3 GlobalInvocationID) {
|
||||
uint index = GlobalInvocationID.x;
|
||||
if ((index >= config[0].x)) {
|
||||
return;
|
||||
}
|
||||
lightsBuffer.Store(((32u * index) + 4u), asuint(((asfloat(lightsBuffer.Load(((32u * index) + 4u))) - 0.100000001f) + (0.001f * (float(index) - (64.0f * floor((float(index) / 64.0f))))))));
|
||||
if ((asfloat(lightsBuffer.Load(((32u * index) + 4u))) < asfloat(uniforms[0].y))) {
|
||||
lightsBuffer.Store(((32u * index) + 4u), asuint(asfloat(uniforms[1].y)));
|
||||
}
|
||||
float4x4 M = tint_symbol_6(uniforms, 96u);
|
||||
float viewNear = (-(M[3][2]) / (-1.0f + M[2][2]));
|
||||
float viewFar = (-(M[3][2]) / (1.0f + M[2][2]));
|
||||
float4 lightPos = asfloat(lightsBuffer.Load4((32u * index)));
|
||||
lightPos = mul(lightPos, tint_symbol_6(uniforms, 32u));
|
||||
lightPos = (lightPos / lightPos.w);
|
||||
float lightRadius = asfloat(lightsBuffer.Load(((32u * index) + 28u)));
|
||||
float4 boxMin = (lightPos - float4(float3((lightRadius).xxx), 0.0f));
|
||||
float4 boxMax = (lightPos + float4(float3((lightRadius).xxx), 0.0f));
|
||||
float4 frustumPlanes[6] = (float4[6])0;
|
||||
frustumPlanes[4] = float4(0.0f, 0.0f, -1.0f, viewNear);
|
||||
frustumPlanes[5] = float4(0.0f, 0.0f, 1.0f, -(viewFar));
|
||||
const int TILE_SIZE = 16;
|
||||
const int TILE_COUNT_X = 2;
|
||||
{
|
||||
[loop] for(int y_1 = 0; (y_1 < 2); y_1 = (y_1 + 1)) {
|
||||
{
|
||||
[loop] for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) {
|
||||
int2 tilePixel0Idx = int2((x_1 * TILE_SIZE), (y_1 * TILE_SIZE));
|
||||
float2 floorCoord = (((2.0f * float2(tilePixel0Idx)) / asfloat(uniforms[10]).xy) - (1.0f).xx);
|
||||
float2 ceilCoord = (((2.0f * float2((tilePixel0Idx + int2((TILE_SIZE).xx)))) / asfloat(uniforms[10]).xy) - (1.0f).xx);
|
||||
float2 viewFloorCoord = float2((((-(viewNear) * floorCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
|
||||
float2 viewCeilCoord = float2((((-(viewNear) * ceilCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
|
||||
frustumPlanes[0] = float4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f);
|
||||
frustumPlanes[1] = float4(-1.0f, 0.0f, (viewCeilCoord.x / viewNear), 0.0f);
|
||||
frustumPlanes[2] = float4(0.0f, 1.0f, (-(viewFloorCoord.y) / viewNear), 0.0f);
|
||||
frustumPlanes[3] = float4(0.0f, -1.0f, (viewCeilCoord.y / viewNear), 0.0f);
|
||||
float dp = 0.0f;
|
||||
{
|
||||
[loop] for(uint i = 0u; (i < 6u); i = (i + 1u)) {
|
||||
float4 p = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
if ((frustumPlanes[i].x > 0.0f)) {
|
||||
p.x = boxMax.x;
|
||||
} else {
|
||||
p.x = boxMin.x;
|
||||
}
|
||||
if ((frustumPlanes[i].y > 0.0f)) {
|
||||
p.y = boxMax.y;
|
||||
} else {
|
||||
p.y = boxMin.y;
|
||||
}
|
||||
if ((frustumPlanes[i].z > 0.0f)) {
|
||||
p.z = boxMax.z;
|
||||
} else {
|
||||
p.z = boxMin.z;
|
||||
}
|
||||
p.w = 1.0f;
|
||||
dp = (dp + min(0.0f, dot(p, frustumPlanes[i])));
|
||||
}
|
||||
}
|
||||
if ((dp >= 0.0f)) {
|
||||
uint tileId = uint((x_1 + (y_1 * TILE_COUNT_X)));
|
||||
bool tint_tmp = (tileId < 0u);
|
||||
if (!tint_tmp) {
|
||||
tint_tmp = (tileId >= config[0].y);
|
||||
}
|
||||
if ((tint_tmp)) {
|
||||
continue;
|
||||
}
|
||||
uint offset = tint_atomicAdd(tileLightId, (260u * tileId), 1u);
|
||||
if ((offset >= config[1].x)) {
|
||||
continue;
|
||||
}
|
||||
tileLightId.Store((((260u * tileId) + 4u) + (4u * offset)), asuint(GlobalInvocationID.x));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[numthreads(64, 1, 1)]
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.GlobalInvocationID);
|
||||
return;
|
||||
}
|
||||
10
test/tint/bug/tint/1136.wgsl.expected.fxc.hlsl
Normal file
10
test/tint/bug/tint/1136.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,10 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void unused_entry_point() {
|
||||
return;
|
||||
}
|
||||
|
||||
RWByteAddressBuffer buffer : register(u0, space0);
|
||||
|
||||
void main() {
|
||||
buffer.Store(0u, asuint((buffer.Load(0u) + 1u)));
|
||||
}
|
||||
15
test/tint/bug/tint/1321.wgsl.expected.fxc.hlsl
Normal file
15
test/tint/bug/tint/1321.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,15 @@
|
||||
int foo() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void main() {
|
||||
float arr[4] = (float[4])0;
|
||||
const int a_save = foo();
|
||||
{
|
||||
[loop] for(; ; ) {
|
||||
const float x = arr[a_save];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
5
test/tint/bug/tint/1332.wgsl.expected.fxc.hlsl
Normal file
5
test/tint/bug/tint/1332.wgsl.expected.fxc.hlsl
Normal file
@@ -0,0 +1,5 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
float b = max(1.230000019f, 1.17549435e-38f);
|
||||
return;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user