diff options
| author | Samuel Kogler <skogler@users.noreply.github.com> | 2023-03-16 19:05:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-16 11:05:33 -0700 |
| commit | b92f2805855282cb717c21345dab8ffdc3f1fdd2 (patch) | |
| tree | 94eb39cf53114fa971917625d398eb03e1629b63 /tests | |
| parent | e960534a5b5a26a2b6d6c27586fc2dad88594b93 (diff) | |
Support GL_EXT_fragment_shader_barycentric (#2704)
* Support GL_EXT_fragment_shader_barycentric
* Support pervertex with GL_EXT_fragment_shader_barycentric
Diffstat (limited to 'tests')
7 files changed, 73 insertions, 5 deletions
diff --git a/tests/cross-compile/barycentrics-nv.slang b/tests/cross-compile/barycentrics-nv.slang new file mode 100644 index 000000000..fb0272679 --- /dev/null +++ b/tests/cross-compile/barycentrics-nv.slang @@ -0,0 +1,6 @@ +//TEST:CROSS_COMPILE: -target spirv-assembly -capability GL_NV_fragment_shader_barycentric -entry main -stage fragment + +float4 main(float3 bary : SV_Barycentrics) : SV_Target +{ + return float4(bary, 0); +} diff --git a/tests/cross-compile/barycentrics-nv.slang.glsl b/tests/cross-compile/barycentrics-nv.slang.glsl new file mode 100644 index 000000000..ca37a14e8 --- /dev/null +++ b/tests/cross-compile/barycentrics-nv.slang.glsl @@ -0,0 +1,12 @@ +#version 450 + +#extension GL_NV_fragment_shader_barycentric : enable + +layout(location = 0) +out vec4 _S1; + +void main() +{ + _S1 = vec4(gl_BaryCoordNV, float(0)); + return; +} diff --git a/tests/cross-compile/barycentrics.slang.glsl b/tests/cross-compile/barycentrics.slang.glsl index ca37a14e8..963316b53 100644 --- a/tests/cross-compile/barycentrics.slang.glsl +++ b/tests/cross-compile/barycentrics.slang.glsl @@ -1,12 +1,12 @@ #version 450 -#extension GL_NV_fragment_shader_barycentric : enable +#extension GL_EXT_fragment_shader_barycentric : enable layout(location = 0) out vec4 _S1; void main() { - _S1 = vec4(gl_BaryCoordNV, float(0)); + _S1 = vec4(gl_BaryCoordEXT, float(0)); return; } diff --git a/tests/pipeline/rasterization/get-attribute-at-vertex-nv.slang b/tests/pipeline/rasterization/get-attribute-at-vertex-nv.slang new file mode 100644 index 000000000..d7bdbc69c --- /dev/null +++ b/tests/pipeline/rasterization/get-attribute-at-vertex-nv.slang @@ -0,0 +1,17 @@ +// get-attribute-at-vertex.slang + +// Basic test for `GetAttributeAtVertex` function + +//TEST:CROSS_COMPILE:-target dxil -capability GL_NV_fragment_shader_barycentric -entry main -stage fragment -profile sm_6_1 +//TEST:CROSS_COMPILE:-target spirv -capability GL_NV_fragment_shader_barycentric -entry main -stage fragment -profile glsl_450 + +[shader("fragment")] +void main( + pervertex float4 color : COLOR, + float3 bary : SV_Barycentrics, + out float4 result : SV_Target) +{ + result = bary.x * GetAttributeAtVertex(color, 0) + + bary.y * GetAttributeAtVertex(color, 1) + + bary.z * GetAttributeAtVertex(color, 2); +} diff --git a/tests/pipeline/rasterization/get-attribute-at-vertex-nv.slang.glsl b/tests/pipeline/rasterization/get-attribute-at-vertex-nv.slang.glsl new file mode 100644 index 000000000..1da5f4f8a --- /dev/null +++ b/tests/pipeline/rasterization/get-attribute-at-vertex-nv.slang.glsl @@ -0,0 +1,19 @@ +// get-attribute-at-vertex.slang.glsl +//TEST_IGNORE_FILE: + +#version 450 +#extension GL_NV_fragment_shader_barycentric : require +layout(row_major) uniform; +layout(row_major) buffer; + +pervertexNV layout(location = 0) +in vec4 _S1[3]; + +layout(location = 0) +out vec4 _S2; + +void main() +{ + _S2 = gl_BaryCoordNV.x * ((_S1)[(0U)]) + gl_BaryCoordNV.y * ((_S1)[(1U)]) + gl_BaryCoordNV.z * ((_S1)[(2U)]); + return; +} diff --git a/tests/pipeline/rasterization/get-attribute-at-vertex-nv.slang.hlsl b/tests/pipeline/rasterization/get-attribute-at-vertex-nv.slang.hlsl new file mode 100644 index 000000000..ce23492c9 --- /dev/null +++ b/tests/pipeline/rasterization/get-attribute-at-vertex-nv.slang.hlsl @@ -0,0 +1,14 @@ +// get-attribute-at-vertex.slang.hlsl + +//TEST_IGNORE_FILE: + +[shader("pixel")] +void main( + nointerpolation vector<float,4> color_0 : COLOR, + vector<float,3> bary_0 : SV_BARYCENTRICS, + out vector<float,4> result_0 : SV_TARGET) +{ + result_0 = bary_0.x * GetAttributeAtVertex(color_0, 0U) + + bary_0.y * GetAttributeAtVertex(color_0, 1U) + + bary_0.z * GetAttributeAtVertex(color_0, 2U); +} diff --git a/tests/pipeline/rasterization/get-attribute-at-vertex.slang.glsl b/tests/pipeline/rasterization/get-attribute-at-vertex.slang.glsl index 1da5f4f8a..d8710eed0 100644 --- a/tests/pipeline/rasterization/get-attribute-at-vertex.slang.glsl +++ b/tests/pipeline/rasterization/get-attribute-at-vertex.slang.glsl @@ -2,11 +2,11 @@ //TEST_IGNORE_FILE: #version 450 -#extension GL_NV_fragment_shader_barycentric : require +#extension GL_EXT_fragment_shader_barycentric : require layout(row_major) uniform; layout(row_major) buffer; -pervertexNV layout(location = 0) +pervertexEXT layout(location = 0) in vec4 _S1[3]; layout(location = 0) @@ -14,6 +14,6 @@ out vec4 _S2; void main() { - _S2 = gl_BaryCoordNV.x * ((_S1)[(0U)]) + gl_BaryCoordNV.y * ((_S1)[(1U)]) + gl_BaryCoordNV.z * ((_S1)[(2U)]); + _S2 = gl_BaryCoordEXT.x * ((_S1)[(0U)]) + gl_BaryCoordEXT.y * ((_S1)[(1U)]) + gl_BaryCoordEXT.z * ((_S1)[(2U)]); return; } |
