GLSL: Support pervertexNV in NV barycentric extension.
This commit is contained in:
parent
c5b8022e61
commit
206ee8f171
@ -1,19 +1,13 @@
|
||||
#version 450
|
||||
#extension GL_NV_fragment_shader_barycentric : require
|
||||
|
||||
layout(binding = 0, std430) readonly buffer Vertices
|
||||
{
|
||||
vec2 uvs[];
|
||||
} _19;
|
||||
|
||||
layout(location = 0) out vec2 value;
|
||||
layout(location = 0) pervertexNV in vec2 vUV[3];
|
||||
layout(location = 1) pervertexNV in vec2 vUV2[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
int _23 = 3 * gl_PrimitiveID;
|
||||
int _32 = _23 + 1;
|
||||
int _39 = _23 + 2;
|
||||
value = ((_19.uvs[_23] * gl_BaryCoordNV.x) + (_19.uvs[_32] * gl_BaryCoordNV.y)) + (_19.uvs[_39] * gl_BaryCoordNV.z);
|
||||
value += (((_19.uvs[_23] * gl_BaryCoordNoPerspNV.x) + (_19.uvs[_32] * gl_BaryCoordNoPerspNV.y)) + (_19.uvs[_39] * gl_BaryCoordNoPerspNV.z));
|
||||
value = ((vUV[0] * gl_BaryCoordNV.x) + (vUV[1] * gl_BaryCoordNV.y)) + (vUV[2] * gl_BaryCoordNV.z);
|
||||
value += (((vUV2[0] * gl_BaryCoordNoPerspNV.x) + (vUV2[1] * gl_BaryCoordNoPerspNV.y)) + (vUV2[2] * gl_BaryCoordNoPerspNV.z));
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#version 450
|
||||
#extension GL_AMD_shader_fragment_mask : require
|
||||
#extension GL_AMD_shader_explicit_vertex_parameter : require
|
||||
#extension GL_AMD_shader_fragment_mask : require
|
||||
|
||||
layout(binding = 0) uniform sampler2DMS texture1;
|
||||
|
||||
|
@ -1,20 +1,13 @@
|
||||
#version 450
|
||||
#extension GL_NV_fragment_shader_barycentric : require
|
||||
|
||||
layout(binding = 0, std430) readonly buffer Vertices
|
||||
{
|
||||
vec2 uvs[];
|
||||
} _19;
|
||||
|
||||
layout(location = 0) out vec2 value;
|
||||
layout(location = 0) pervertexNV in vec2 vUV[3];
|
||||
layout(location = 1) pervertexNV in vec2 vUV2[3];
|
||||
|
||||
void main()
|
||||
{
|
||||
int prim = gl_PrimitiveID;
|
||||
vec2 uv0 = _19.uvs[(3 * prim) + 0];
|
||||
vec2 uv1 = _19.uvs[(3 * prim) + 1];
|
||||
vec2 uv2 = _19.uvs[(3 * prim) + 2];
|
||||
value = ((uv0 * gl_BaryCoordNV.x) + (uv1 * gl_BaryCoordNV.y)) + (uv2 * gl_BaryCoordNV.z);
|
||||
value += (((uv0 * gl_BaryCoordNoPerspNV.x) + (uv1 * gl_BaryCoordNoPerspNV.y)) + (uv2 * gl_BaryCoordNoPerspNV.z));
|
||||
value = ((vUV[0] * gl_BaryCoordNV.x) + (vUV[1] * gl_BaryCoordNV.y)) + (vUV[2] * gl_BaryCoordNV.z);
|
||||
value += (((vUV2[0] * gl_BaryCoordNoPerspNV.x) + (vUV2[1] * gl_BaryCoordNoPerspNV.y)) + (vUV2[2] * gl_BaryCoordNoPerspNV.z));
|
||||
}
|
||||
|
||||
|
@ -2,17 +2,10 @@
|
||||
#extension GL_NV_fragment_shader_barycentric : require
|
||||
|
||||
layout(location = 0) out vec2 value;
|
||||
|
||||
layout(set = 0, binding = 0) readonly buffer Vertices
|
||||
{
|
||||
vec2 uvs[];
|
||||
};
|
||||
layout(location = 0) pervertexNV in vec2 vUV[3];
|
||||
layout(location = 1) pervertexNV in vec2 vUV2[3];
|
||||
|
||||
void main () {
|
||||
int prim = gl_PrimitiveID;
|
||||
vec2 uv0 = uvs[3 * prim + 0];
|
||||
vec2 uv1 = uvs[3 * prim + 1];
|
||||
vec2 uv2 = uvs[3 * prim + 2];
|
||||
value = gl_BaryCoordNV.x * uv0 + gl_BaryCoordNV.y * uv1 + gl_BaryCoordNV.z * uv2;
|
||||
value += gl_BaryCoordNoPerspNV.x * uv0 + gl_BaryCoordNoPerspNV.y * uv1 + gl_BaryCoordNoPerspNV.z * uv2;
|
||||
value = gl_BaryCoordNV.x * vUV[0] + gl_BaryCoordNV.y * vUV[1] + gl_BaryCoordNV.z * vUV[2];
|
||||
value += gl_BaryCoordNoPerspNV.x * vUV2[0] + gl_BaryCoordNoPerspNV.y * vUV2[1] + gl_BaryCoordNoPerspNV.z * vUV2[2];
|
||||
}
|
||||
|
@ -1136,8 +1136,22 @@ string CompilerGLSL::to_interpolation_qualifiers(const Bitset &flags)
|
||||
res += "sample ";
|
||||
if (flags.get(DecorationInvariant))
|
||||
res += "invariant ";
|
||||
|
||||
if (flags.get(DecorationExplicitInterpAMD))
|
||||
{
|
||||
require_extension_internal("GL_AMD_shader_explicit_vertex_parameter");
|
||||
res += "__explicitInterpAMD ";
|
||||
}
|
||||
|
||||
if (flags.get(DecorationPerVertexNV))
|
||||
{
|
||||
if (options.es && options.version < 320)
|
||||
SPIRV_CROSS_THROW("pervertexNV requires ESSL 320.");
|
||||
else if (!options.es && options.version < 450)
|
||||
SPIRV_CROSS_THROW("pervertexNV requires GLSL 450.");
|
||||
require_extension_internal("GL_NV_fragment_shader_barycentric");
|
||||
res += "pervertexNV ";
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user