Merge pull request #2874 from mbechard/master

fix cases where symbols in the tree didn't get updated during block merging
This commit is contained in:
Greg Fischer 2022-02-01 15:46:25 -07:00 committed by GitHub
commit 3005da6e6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 12078 additions and 35 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,139 @@
#version 460
uniform int uTDInstanceIDOffset;
uniform int uTDNumInstances;
uniform float uTDAlphaTestVal;
#define TD_NUM_COLOR_BUFFERS 1
#define TD_NUM_LIGHTS 0
#define TD_NUM_SHADOWED_LIGHTS 0
#define TD_NUM_ENV_LIGHTS 0
#define TD_LIGHTS_ARRAY_SIZE 1
#define TD_ENV_LIGHTS_ARRAY_SIZE 1
#define TD_NUM_CAMERAS 1
struct TDPhongResult
{
vec3 diffuse;
vec3 specular;
vec3 specular2;
float shadowStrength;
};
struct TDPBRResult
{
vec3 diffuse;
vec3 specular;
float shadowStrength;
};
struct TDMatrix
{
mat4 world;
mat4 worldInverse;
mat4 worldCam;
mat4 worldCamInverse;
mat4 cam;
mat4 camInverse;
mat4 camProj;
mat4 camProjInverse;
mat4 proj;
mat4 projInverse;
mat4 worldCamProj;
mat4 worldCamProjInverse;
mat4 quadReproject;
mat3 worldForNormals;
mat3 camForNormals;
mat3 worldCamForNormals;
};
layout(std140) uniform TDMatricesBlock {
TDMatrix uTDMats[TD_NUM_CAMERAS];
};
struct TDCameraInfo
{
vec4 nearFar;
vec4 fog;
vec4 fogColor;
int renderTOPCameraIndex;
};
layout(std140) uniform TDCameraInfoBlock {
TDCameraInfo uTDCamInfos[TD_NUM_CAMERAS];
};
struct TDGeneral
{
vec4 ambientColor;
vec4 nearFar;
vec4 viewport;
vec4 viewportRes;
vec4 fog;
vec4 fogColor;
};
layout(std140) uniform TDGeneralBlock {
TDGeneral uTDGeneral;
};
void TDAlphaTest(float alpha);
vec4 TDDither(vec4 color);
vec4 TDOutputSwizzle(vec4 v);
uvec4 TDOutputSwizzle(uvec4 v);
void TDCheckOrderIndTrans();
void TDCheckDiscard();
uniform vec3 uConstant;
uniform float uShadowStrength;
uniform vec3 uShadowColor;
uniform vec4 uDiffuseColor;
uniform vec4 uAmbientColor;
uniform sampler2DArray sColorMap;
in Vertex
{
vec4 color;
vec3 worldSpacePos;
vec3 texCoord0;
flat int cameraIndex;
flat int instance;
} iVert;
// Output variable for the color
layout(location = 0) out vec4 oFragColor[TD_NUM_COLOR_BUFFERS];
void main()
{
// This allows things such as order independent transparency
// and Dual-Paraboloid rendering to work properly
TDCheckDiscard();
vec4 outcol = vec4(0.0, 0.0, 0.0, 0.0);
vec3 texCoord0 = iVert.texCoord0.stp;
float actualTexZ = mod(int(texCoord0.z),2048);
float instanceLoop = floor(int(texCoord0.z)/2048);
texCoord0.z = actualTexZ;
vec4 colorMapColor = texture(sColorMap, texCoord0.stp);
float red = colorMapColor[int(instanceLoop)];
colorMapColor = vec4(red);
// Constant Light Contribution
outcol.rgb += uConstant * iVert.color.rgb;
outcol *= colorMapColor;
// Alpha Calculation
float alpha = iVert.color.a * colorMapColor.a ;
// Dithering, does nothing if dithering is disabled
outcol = TDDither(outcol);
outcol.rgb *= alpha;
// Modern GL removed the implicit alpha test, so we need to apply
// it manually here. This function does nothing if alpha test is disabled.
TDAlphaTest(alpha);
outcol.a = alpha;
oFragColor[0] = TDOutputSwizzle(outcol);
// TD_NUM_COLOR_BUFFERS will be set to the number of color buffers
// active in the render. By default we want to output zero to every
// buffer except the first one.
for (int i = 1; i < TD_NUM_COLOR_BUFFERS; i++)
{
oFragColor[i] = vec4(0.0);
}
}

View File

@ -0,0 +1,126 @@
#version 460
uniform int uTDInstanceIDOffset;
uniform int uTDNumInstances;
uniform float uTDAlphaTestVal;
#define TD_NUM_COLOR_BUFFERS 1
#define TD_NUM_LIGHTS 0
#define TD_NUM_SHADOWED_LIGHTS 0
#define TD_NUM_ENV_LIGHTS 0
#define TD_LIGHTS_ARRAY_SIZE 1
#define TD_ENV_LIGHTS_ARRAY_SIZE 1
#define TD_NUM_CAMERAS 1
struct TDPhongResult
{
vec3 diffuse;
vec3 specular;
vec3 specular2;
float shadowStrength;
};
struct TDPBRResult
{
vec3 diffuse;
vec3 specular;
float shadowStrength;
};
struct TDMatrix
{
mat4 world;
mat4 worldInverse;
mat4 worldCam;
mat4 worldCamInverse;
mat4 cam;
mat4 camInverse;
mat4 camProj;
mat4 camProjInverse;
mat4 proj;
mat4 projInverse;
mat4 worldCamProj;
mat4 worldCamProjInverse;
mat4 quadReproject;
mat3 worldForNormals;
mat3 camForNormals;
mat3 worldCamForNormals;
};
layout(std140) uniform TDMatricesBlock {
TDMatrix uTDMats[TD_NUM_CAMERAS];
};
struct TDCameraInfo
{
vec4 nearFar;
vec4 fog;
vec4 fogColor;
int renderTOPCameraIndex;
};
layout(std140) uniform TDCameraInfoBlock {
TDCameraInfo uTDCamInfos[TD_NUM_CAMERAS];
};
struct TDGeneral
{
vec4 ambientColor;
vec4 nearFar;
vec4 viewport;
vec4 viewportRes;
vec4 fog;
vec4 fogColor;
};
layout(std140) uniform TDGeneralBlock {
TDGeneral uTDGeneral;
};
layout(location = 0) in vec3 P;
layout(location = 1) in vec3 N;
layout(location = 2) in vec4 Cd;
layout(location = 3) in vec3 uv[8];
vec4 TDWorldToProj(vec4 v);
vec4 TDWorldToProj(vec3 v);
vec4 TDWorldToProj(vec4 v, vec3 uv);
vec4 TDWorldToProj(vec3 v, vec3 uv);
int TDInstanceID();
int TDCameraIndex();
vec3 TDUVUnwrapCoord();
/*********TOUCHDEFORMPREFIX**********/
#define TD_NUM_BONES 0
vec3 TDInstanceTexCoord(int instanceID, vec3 t);
vec4 TDInstanceColor(int instanceID, vec4 curColor);
vec4 TDDeform(vec4 pos);
vec4 TDDeform(vec3 pos);
vec3 TDInstanceTexCoord(vec3 t);
vec4 TDInstanceColor(vec4 curColor);
#line 1
out Vertex
{
vec4 color;
vec3 worldSpacePos;
vec3 texCoord0;
flat int cameraIndex;
flat int instance;
} oVert;
void main()
{
{ // Avoid duplicate variable defs
vec3 texcoord = TDInstanceTexCoord(uv[0]);
oVert.texCoord0.stp = texcoord.stp;
}
// First deform the vertex and normal
// TDDeform always returns values in world space
oVert.instance = TDInstanceID();
vec4 worldSpacePos = TDDeform(P);
vec3 uvUnwrapCoord = TDInstanceTexCoord(TDUVUnwrapCoord());
gl_Position = TDWorldToProj(worldSpacePos, uvUnwrapCoord);
// This is here to ensure we only execute lighting etc. code
// when we need it. If picking is active we don't need lighting, so
// this entire block of code will be ommited from the compile.
// The TD_PICKING_ACTIVE define will be set automatically when
// picking is active.
int cameraIndex = TDCameraIndex();
oVert.cameraIndex = cameraIndex;
oVert.worldSpacePos.xyz = worldSpacePos.xyz;
oVert.color = TDInstanceColor(Cd);
}

View File

@ -0,0 +1,504 @@
#version 460
uniform sampler2D sTDNoiseMap;
uniform sampler1D sTDSineLookup;
uniform sampler2D sTDWhite2D;
uniform sampler3D sTDWhite3D;
uniform sampler2DArray sTDWhite2DArray;
uniform samplerCube sTDWhiteCube;
uniform int uTDInstanceIDOffset;
uniform int uTDNumInstances;
uniform float uTDAlphaTestVal;
#define TD_NUM_COLOR_BUFFERS 1
#define TD_NUM_LIGHTS 0
#define TD_NUM_SHADOWED_LIGHTS 0
#define TD_NUM_ENV_LIGHTS 0
#define TD_LIGHTS_ARRAY_SIZE 1
#define TD_ENV_LIGHTS_ARRAY_SIZE 1
#define TD_NUM_CAMERAS 1
struct TDLight
{
vec4 position;
vec3 direction;
vec3 diffuse;
vec4 nearFar;
vec4 lightSize;
vec4 misc;
vec4 coneLookupScaleBias;
vec4 attenScaleBiasRoll;
mat4 shadowMapMatrix;
mat4 shadowMapCamMatrix;
vec4 shadowMapRes;
mat4 projMapMatrix;
};
struct TDEnvLight
{
vec3 color;
mat3 rotate;
};
layout(std140) uniform TDLightBlock
{
TDLight uTDLights[TD_LIGHTS_ARRAY_SIZE];
};
layout(std140) uniform TDEnvLightBlock
{
TDEnvLight uTDEnvLights[TD_ENV_LIGHTS_ARRAY_SIZE];
};
layout(std430) readonly restrict buffer TDEnvLightBuffer
{
vec3 shCoeffs[9];
} uTDEnvLightBuffers[TD_ENV_LIGHTS_ARRAY_SIZE];
struct TDPhongResult
{
vec3 diffuse;
vec3 specular;
vec3 specular2;
float shadowStrength;
};
struct TDPBRResult
{
vec3 diffuse;
vec3 specular;
float shadowStrength;
};
struct TDMatrix
{
mat4 world;
mat4 worldInverse;
mat4 worldCam;
mat4 worldCamInverse;
mat4 cam;
mat4 camInverse;
mat4 camProj;
mat4 camProjInverse;
mat4 proj;
mat4 projInverse;
mat4 worldCamProj;
mat4 worldCamProjInverse;
mat4 quadReproject;
mat3 worldForNormals;
mat3 camForNormals;
mat3 worldCamForNormals;
};
layout(std140) uniform TDMatricesBlock {
TDMatrix uTDMats[TD_NUM_CAMERAS];
};
struct TDCameraInfo
{
vec4 nearFar;
vec4 fog;
vec4 fogColor;
int renderTOPCameraIndex;
};
layout(std140) uniform TDCameraInfoBlock {
TDCameraInfo uTDCamInfos[TD_NUM_CAMERAS];
};
struct TDGeneral
{
vec4 ambientColor;
vec4 nearFar;
vec4 viewport;
vec4 viewportRes;
vec4 fog;
vec4 fogColor;
};
layout(std140) uniform TDGeneralBlock {
TDGeneral uTDGeneral;
};
layout(binding = 15) uniform samplerBuffer sTDInstanceT;
layout(binding = 16) uniform samplerBuffer sTDInstanceTexCoord;
layout(binding = 17) uniform samplerBuffer sTDInstanceColor;
vec4 TDDither(vec4 color);
vec3 TDHSVToRGB(vec3 c);
vec3 TDRGBToHSV(vec3 c);
#define PI 3.14159265
vec4 TDColor(vec4 color) { return color; }
void TDCheckOrderIndTrans() {
}
void TDCheckDiscard() {
TDCheckOrderIndTrans();
}
vec4 TDDither(vec4 color)
{
float d = texture(sTDNoiseMap,
gl_FragCoord.xy / 256.0).r;
d -= 0.5;
d /= 256.0;
return vec4(color.rgb + d, color.a);
}
bool TDFrontFacing(vec3 pos, vec3 normal)
{
return gl_FrontFacing;
}
float TDAttenuateLight(int index, float lightDist)
{
return 1.0;
}
void TDAlphaTest(float alpha) {
}
float TDHardShadow(int lightIndex, vec3 worldSpacePos)
{ return 0.0; }
float TDSoftShadow(int lightIndex, vec3 worldSpacePos, int samples, int steps)
{ return 0.0; }
float TDSoftShadow(int lightIndex, vec3 worldSpacePos)
{ return 0.0; }
float TDShadow(int lightIndex, vec3 worldSpacePos)
{ return 0.0; }
vec3 TDEquirectangularToCubeMap(vec2 mapCoord);
vec2 TDCubeMapToEquirectangular(vec3 envMapCoord);
vec2 TDCubeMapToEquirectangular(vec3 envMapCoord, out float mipMapBias);
vec2 TDTexGenSphere(vec3 envMapCoord);
float iTDRadicalInverse_VdC(uint bits)
{
bits = (bits << 16u) | (bits >> 16u);
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
}
vec2 iTDHammersley(uint i, uint N)
{
return vec2(float(i) / float(N), iTDRadicalInverse_VdC(i));
}
vec3 iTDImportanceSampleGGX(vec2 Xi, float roughness2, vec3 N)
{
float a = roughness2;
float phi = 2 * 3.14159265 * Xi.x;
float cosTheta = sqrt( (1 - Xi.y) / (1 + (a*a - 1) * Xi.y) );
float sinTheta = sqrt( 1 - cosTheta * cosTheta );
vec3 H;
H.x = sinTheta * cos(phi);
H.y = sinTheta * sin(phi);
H.z = cosTheta;
vec3 upVector = abs(N.z) < 0.999 ? vec3(0, 0, 1) : vec3(1, 0, 0);
vec3 tangentX = normalize(cross(upVector, N));
vec3 tangentY = cross(N, tangentX);
// Tangent to world space
vec3 worldResult = tangentX * H.x + tangentY * H.y + N * H.z;
return worldResult;
}
float iTDDistributionGGX(vec3 normal, vec3 half_vector, float roughness2)
{
const float Epsilon = 0.000001;
float NdotH = clamp(dot(normal, half_vector), Epsilon, 1.0);
float alpha2 = roughness2 * roughness2;
float denom = NdotH * NdotH * (alpha2 - 1.0) + 1.0;
denom = max(1e-8, denom);
return alpha2 / (PI * denom * denom);
}
vec3 iTDCalcF(vec3 F0, float VdotH) {
return F0 + (vec3(1.0) - F0) * pow(2.0, (-5.55473*VdotH - 6.98316) * VdotH);
}
float iTDCalcG(float NdotL, float NdotV, float k) {
float Gl = 1.0 / (NdotL * (1.0 - k) + k);
float Gv = 1.0 / (NdotV * (1.0 - k) + k);
return Gl * Gv;
}
// 0 - All options
TDPBRResult TDLightingPBR(int index,vec3 diffuseColor,vec3 specularColor,vec3 worldSpacePos,vec3 normal,float shadowStrength,vec3 shadowColor,vec3 camVector,float roughness)
{
TDPBRResult res;
return res;
}
// 0 - All options
void TDLightingPBR(inout vec3 diffuseContrib,inout vec3 specularContrib,inout float shadowStrengthOut,int index,vec3 diffuseColor,vec3 specularColor,vec3 worldSpacePos,vec3 normal,float shadowStrength,vec3 shadowColor,vec3 camVector,float roughness)
{
TDPBRResult res = TDLightingPBR(index,diffuseColor,specularColor,worldSpacePos,normal,shadowStrength,shadowColor,camVector,roughness); diffuseContrib = res.diffuse;
specularContrib = res.specular;
shadowStrengthOut = res.shadowStrength;
}
// 0 - All options
void TDLightingPBR(inout vec3 diffuseContrib,inout vec3 specularContrib,int index,vec3 diffuseColor,vec3 specularColor,vec3 worldSpacePos,vec3 normal,float shadowStrength,vec3 shadowColor,vec3 camVector,float roughness)
{
TDPBRResult res = TDLightingPBR(index,diffuseColor,specularColor,worldSpacePos,normal,shadowStrength,shadowColor,camVector,roughness); diffuseContrib = res.diffuse;
specularContrib = res.specular;
}
// 0 - All options
TDPBRResult TDEnvLightingPBR(int index,vec3 diffuseColor,vec3 specularColor,vec3 normal,vec3 camVector,float roughness,float ambientOcclusion)
{
TDPBRResult res;
return res;
}
// 0 - All options
void TDEnvLightingPBR(inout vec3 diffuseContrib,inout vec3 specularContrib,int index,vec3 diffuseColor,vec3 specularColor,vec3 normal,vec3 camVector,float roughness,float ambientOcclusion)
{
TDPBRResult res = TDEnvLightingPBR(index, diffuseColor, specularColor, normal, camVector, roughness, ambientOcclusion);
diffuseContrib = res.diffuse;
specularContrib = res.specular;
}
// 0 - All options
TDPhongResult TDLighting(int index,vec3 worldSpacePos,vec3 normal,float shadowStrength,vec3 shadowColor,vec3 camVector,float shininess,float shininess2)
{
TDPhongResult res;
switch (index)
{
default:
res.diffuse = vec3(0.0);
res.specular = vec3(0.0);
res.specular2 = vec3(0.0);
res.shadowStrength = 0.0;
break;
}
return res;
}
// 0 - Legacy
void TDLighting(inout vec3 diffuseContrib,inout vec3 specularContrib,inout vec3 specularContrib2,inout float shadowStrengthOut,int index,vec3 worldSpacePos,vec3 normal,float shadowStrength,vec3 shadowColor,vec3 camVector,float shininess,float shininess2)
{
TDPhongResult res;
switch (index)
{
default:
res.diffuse = vec3(0.0);
res.specular = vec3(0.0);
res.specular2 = vec3(0.0);
res.shadowStrength = 0.0;
break;
}
diffuseContrib = res.diffuse;
specularContrib = res.specular;
specularContrib2 = res.specular2;
shadowStrengthOut = res.shadowStrength;
}
// 0 - Legacy
void TDLighting(inout vec3 diffuseContrib,inout vec3 specularContrib,inout vec3 specularContrib2,int index,vec3 worldSpacePos,vec3 normal,float shadowStrength,vec3 shadowColor,vec3 camVector,float shininess,float shininess2)
{
TDPhongResult res;
switch (index)
{
default:
res.diffuse = vec3(0.0);
res.specular = vec3(0.0);
res.specular2 = vec3(0.0);
res.shadowStrength = 0.0;
break;
}
diffuseContrib = res.diffuse;
specularContrib = res.specular;
specularContrib2 = res.specular2;
}
// 1 - Without specular2
void TDLighting(inout vec3 diffuseContrib,inout vec3 specularContrib,int index,vec3 worldSpacePos,vec3 normal,float shadowStrength,vec3 shadowColor,vec3 camVector,float shininess)
{
TDPhongResult res;
switch (index)
{
default:
res.diffuse = vec3(0.0);
res.specular = vec3(0.0);
res.specular2 = vec3(0.0);
res.shadowStrength = 0.0;
break;
}
diffuseContrib = res.diffuse;
specularContrib = res.specular;
}
// 2 - Without shadows
void TDLighting(inout vec3 diffuseContrib,inout vec3 specularContrib,inout vec3 specularContrib2,int index,vec3 worldSpacePos,vec3 normal,vec3 camVector,float shininess,float shininess2)
{
TDPhongResult res;
switch (index)
{
default:
res.diffuse = vec3(0.0);
res.specular = vec3(0.0);
res.specular2 = vec3(0.0);
res.shadowStrength = 0.0;
break;
}
diffuseContrib = res.diffuse;
specularContrib = res.specular;
specularContrib2 = res.specular2;
}
// 3 - diffuse and specular only
void TDLighting(inout vec3 diffuseContrib,inout vec3 specularContrib,int index,vec3 worldSpacePos,vec3 normal,vec3 camVector,float shininess)
{
TDPhongResult res;
switch (index)
{
default:
res.diffuse = vec3(0.0);
res.specular = vec3(0.0);
res.specular2 = vec3(0.0);
res.shadowStrength = 0.0;
break;
}
diffuseContrib = res.diffuse;
specularContrib = res.specular;
}
// 4 - Diffuse only
void TDLighting(inout vec3 diffuseContrib,int index, vec3 worldSpacePos, vec3 normal)
{
TDPhongResult res;
switch (index)
{
default:
res.diffuse = vec3(0.0);
res.specular = vec3(0.0);
res.specular2 = vec3(0.0);
res.shadowStrength = 0.0;
break;
}
diffuseContrib = res.diffuse;
}
// 5 - diffuse only with shadows
void TDLighting(inout vec3 diffuseContrib,int index,vec3 worldSpacePos,vec3 normal,float shadowStrength,vec3 shadowColor)
{
TDPhongResult res;
switch (index)
{
default:
res.diffuse = vec3(0.0);
res.specular = vec3(0.0);
res.specular2 = vec3(0.0);
res.shadowStrength = 0.0;
break;
}
diffuseContrib = res.diffuse;
}
vec4 TDProjMap(int index, vec3 worldSpacePos, vec4 defaultColor) {
switch (index)
{
default: return defaultColor;
}
}
vec4 TDFog(vec4 color, vec3 lightingSpacePosition, int cameraIndex) {
switch (cameraIndex) {
default:
case 0:
{
return color;
}
}
}
vec4 TDFog(vec4 color, vec3 lightingSpacePosition)
{
return TDFog(color, lightingSpacePosition, 0);
}
vec3 TDInstanceTexCoord(int index, vec3 t) {
vec3 v;
int coord = index;
vec4 samp = texelFetch(sTDInstanceTexCoord, coord);
v[0] = t.s;
v[1] = t.t;
v[2] = samp[0];
t.stp = v.stp;
return t;
}
bool TDInstanceActive(int index) {
index -= uTDInstanceIDOffset;
float v;
int coord = index;
vec4 samp = texelFetch(sTDInstanceT, coord);
v = samp[0];
return v != 0.0;
}
vec3 iTDInstanceTranslate(int index, out bool instanceActive) {
int origIndex = index;
index -= uTDInstanceIDOffset;
vec3 v;
int coord = index;
vec4 samp = texelFetch(sTDInstanceT, coord);
v[0] = samp[1];
v[1] = samp[2];
v[2] = samp[3];
instanceActive = samp[0] != 0.0;
return v;
}
vec3 TDInstanceTranslate(int index) {
index -= uTDInstanceIDOffset;
vec3 v;
int coord = index;
vec4 samp = texelFetch(sTDInstanceT, coord);
v[0] = samp[1];
v[1] = samp[2];
v[2] = samp[3];
return v;
}
mat3 TDInstanceRotateMat(int index) {
index -= uTDInstanceIDOffset;
vec3 v = vec3(0.0, 0.0, 0.0);
mat3 m = mat3(1.0);
{
mat3 r;
}
return m;
}
vec3 TDInstanceScale(int index) {
index -= uTDInstanceIDOffset;
vec3 v = vec3(1.0, 1.0, 1.0);
return v;
}
vec3 TDInstancePivot(int index) {
index -= uTDInstanceIDOffset;
vec3 v = vec3(0.0, 0.0, 0.0);
return v;
}
vec3 TDInstanceRotTo(int index) {
index -= uTDInstanceIDOffset;
vec3 v = vec3(0.0, 0.0, 1.0);
return v;
}
vec3 TDInstanceRotUp(int index) {
index -= uTDInstanceIDOffset;
vec3 v = vec3(0.0, 1.0, 0.0);
return v;
}
mat4 TDInstanceMat(int id) {
bool instanceActive = true;
vec3 t = iTDInstanceTranslate(id, instanceActive);
if (!instanceActive)
{
return mat4(0.0);
}
mat4 m = mat4(1.0);
{
vec3 tt = t;
m[3][0] += m[0][0]*tt.x;
m[3][1] += m[0][1]*tt.x;
m[3][2] += m[0][2]*tt.x;
m[3][3] += m[0][3]*tt.x;
m[3][0] += m[1][0]*tt.y;
m[3][1] += m[1][1]*tt.y;
m[3][2] += m[1][2]*tt.y;
m[3][3] += m[1][3]*tt.y;
m[3][0] += m[2][0]*tt.z;
m[3][1] += m[2][1]*tt.z;
m[3][2] += m[2][2]*tt.z;
m[3][3] += m[2][3]*tt.z;
}
return m;
}
mat3 TDInstanceMat3(int id) {
mat3 m = mat3(1.0);
return m;
}
mat3 TDInstanceMat3ForNorm(int id) {
mat3 m = TDInstanceMat3(id);
return m;
}
vec4 TDInstanceColor(int index, vec4 curColor) {
index -= uTDInstanceIDOffset;
vec4 v;
int coord = index;
vec4 samp = texelFetch(sTDInstanceColor, coord);
v[0] = samp[0];
v[1] = samp[1];
v[2] = samp[2];
v[3] = 1.0;
curColor[0] = v[0];
;
curColor[1] = v[1];
;
curColor[2] = v[2];
;
return curColor;
}

View File

@ -0,0 +1,242 @@
#version 460
layout(location = 0) in vec3 P;
layout(location = 1) in vec3 N;
layout(location = 2) in vec4 Cd;
layout(location = 3) in vec3 uv[8];
uniform int uTDInstanceIDOffset;
uniform int uTDNumInstances;
uniform float uTDAlphaTestVal;
#define TD_NUM_COLOR_BUFFERS 1
#define TD_NUM_LIGHTS 0
#define TD_NUM_SHADOWED_LIGHTS 0
#define TD_NUM_ENV_LIGHTS 0
#define TD_LIGHTS_ARRAY_SIZE 1
#define TD_ENV_LIGHTS_ARRAY_SIZE 1
#define TD_NUM_CAMERAS 1
struct TDLight
{
vec4 position;
vec3 direction;
vec3 diffuse;
vec4 nearFar;
vec4 lightSize;
vec4 misc;
vec4 coneLookupScaleBias;
vec4 attenScaleBiasRoll;
mat4 shadowMapMatrix;
mat4 shadowMapCamMatrix;
vec4 shadowMapRes;
mat4 projMapMatrix;
};
struct TDEnvLight
{
vec3 color;
mat3 rotate;
};
layout(std140) uniform TDLightBlock
{
TDLight uTDLights[TD_LIGHTS_ARRAY_SIZE];
};
layout(std140) uniform TDEnvLightBlock
{
TDEnvLight uTDEnvLights[TD_ENV_LIGHTS_ARRAY_SIZE];
};
layout(std430) readonly restrict buffer TDEnvLightBuffer
{
vec3 shCoeffs[9];
} uTDEnvLightBuffers[TD_ENV_LIGHTS_ARRAY_SIZE];
struct TDPhongResult
{
vec3 diffuse;
vec3 specular;
vec3 specular2;
float shadowStrength;
};
struct TDPBRResult
{
vec3 diffuse;
vec3 specular;
float shadowStrength;
};
struct TDMatrix
{
mat4 world;
mat4 worldInverse;
mat4 worldCam;
mat4 worldCamInverse;
mat4 cam;
mat4 camInverse;
mat4 camProj;
mat4 camProjInverse;
mat4 proj;
mat4 projInverse;
mat4 worldCamProj;
mat4 worldCamProjInverse;
mat4 quadReproject;
mat3 worldForNormals;
mat3 camForNormals;
mat3 worldCamForNormals;
};
layout(std140) uniform TDMatricesBlock {
TDMatrix uTDMats[TD_NUM_CAMERAS];
};
struct TDCameraInfo
{
vec4 nearFar;
vec4 fog;
vec4 fogColor;
int renderTOPCameraIndex;
};
layout(std140) uniform TDCameraInfoBlock {
TDCameraInfo uTDCamInfos[TD_NUM_CAMERAS];
};
struct TDGeneral
{
vec4 ambientColor;
vec4 nearFar;
vec4 viewport;
vec4 viewportRes;
vec4 fog;
vec4 fogColor;
};
layout(std140) uniform TDGeneralBlock {
TDGeneral uTDGeneral;
};
layout (rgba8) uniform image2D mTD2DImageOutputs[1];
layout (rgba8) uniform image2DArray mTD2DArrayImageOutputs[1];
layout (rgba8) uniform image3D mTD3DImageOutputs[1];
layout (rgba8) uniform imageCube mTDCubeImageOutputs[1];
mat4 TDInstanceMat(int instanceID);
mat3 TDInstanceMat3(int instanceID);
vec3 TDInstanceTranslate(int instanceID);
bool TDInstanceActive(int instanceID);
mat3 TDInstanceRotateMat(int instanceID);
vec3 TDInstanceScale(int instanceID);
vec3 TDInstanceTexCoord(int instanceID, vec3 t);
vec4 TDInstanceColor(int instanceID, vec4 curColor);
vec4 TDInstanceCustomAttrib0(int instanceID);
vec4 TDInstanceCustomAttrib1(int instanceID);
vec4 TDInstanceCustomAttrib2(int instanceID);
vec4 TDInstanceCustomAttrib3(int instanceID);
vec4 TDInstanceCustomAttrib4(int instanceID);
vec4 TDInstanceCustomAttrib5(int instanceID);
vec4 TDInstanceCustomAttrib6(int instanceID);
vec4 TDInstanceCustomAttrib7(int instanceID);
vec4 TDInstanceCustomAttrib8(int instanceID);
vec4 TDInstanceCustomAttrib9(int instanceID);
vec4 TDInstanceCustomAttrib10(int instanceID);
vec4 TDInstanceCustomAttrib11(int instanceID);
uint TDInstanceTextureIndex(int instanceIndex);
vec4 TDInstanceTexture(uint texIndex, vec3 uv);
vec4 TDInstanceTexture(uint texIndex, vec2 uv);
vec4 TDDeform(vec4 pos);
vec4 TDDeform(vec3 pos);
vec4 TDDeform(int instanceID, vec3 pos);
vec3 TDDeformVec(vec3 v);
vec3 TDDeformVec(int instanceID, vec3 v);
vec3 TDDeformNorm(vec3 v);
vec3 TDDeformNorm(int instanceID, vec3 v);
vec4 TDSkinnedDeform(vec4 pos);
vec3 TDSkinnedDeformVec(vec3 vec);
vec3 TDSkinnedDeformNorm(vec3 vec);
vec4 TDInstanceDeform(vec4 pos);
vec3 TDInstanceDeformVec(vec3 vec);
vec3 TDInstanceDeformNorm(vec3 vec);
vec4 TDInstanceDeform(int instanceID, vec4 pos);
vec3 TDInstanceDeformVec(int instanceID, vec3 vec);
vec3 TDInstanceDeformNorm(int instanceID, vec3 vec);
vec3 TDFastDeformTangent(vec3 oldNorm, vec4 oldTangent, vec3 deformedNorm);
mat4 TDBoneMat(int boneIndex);
mat4 TDInstanceMat();
mat3 TDInstanceMat3();
vec3 TDInstanceTranslate();
bool TDInstanceActive();
mat3 TDInstanceRotateMat();
vec3 TDInstanceScale();
vec3 TDInstanceTexCoord(vec3 t);
vec4 TDInstanceColor(vec4 curColor);
vec4 TDPointColor();
#ifdef TD_PICKING_ACTIVE
out TDPickVertex {
vec3 sopSpacePosition;
vec3 camSpacePosition;
vec3 worldSpacePosition;
vec3 sopSpaceNormal;
vec3 camSpaceNormal;
vec3 worldSpaceNormal;
vec3 uv[1];
flat int pickId;
flat int instanceId;
vec4 color;
} oTDPickVert;
#define vTDPickVert oTDPickVert
#endif
vec4 iTDCamToProj(vec4 v, vec3 uv, int cameraIndex, bool applyPickMod)
{
if (!TDInstanceActive())
return vec4(2, 2, 2, 0);
v = uTDMats[0].proj * v;
return v;
}
vec4 iTDWorldToProj(vec4 v, vec3 uv, int cameraIndex, bool applyPickMod) {
if (!TDInstanceActive())
return vec4(2, 2, 2, 0);
v = uTDMats[0].camProj * v;
return v;
}
vec4 TDDeform(vec4 pos);
vec4 TDDeform(vec3 pos);
vec4 TDInstanceColor(vec4 curColor);
vec3 TDInstanceTexCoord(vec3 t);
int TDInstanceID() {
return gl_InstanceID + uTDInstanceIDOffset;
}
int TDCameraIndex() {
return 0;
}
vec3 TDUVUnwrapCoord() {
return uv[0];
}
#ifdef TD_PICKING_ACTIVE
uniform int uTDPickId;
#endif
int TDPickID() {
#ifdef TD_PICKING_ACTIVE
return uTDPickId;
#else
return 0;
#endif
}
float iTDConvertPickId(int id) {
id |= 1073741824;
return intBitsToFloat(id);
}
void TDWritePickingValues() {
#ifdef TD_PICKING_ACTIVE
vec4 worldPos = TDDeform(P);
vec4 camPos = uTDMats[TDCameraIndex()].cam * worldPos;
oTDPickVert.pickId = TDPickID();
#endif
}
vec4 TDWorldToProj(vec4 v, vec3 uv)
{
return iTDWorldToProj(v, uv, TDCameraIndex(), true);
}
vec4 TDWorldToProj(vec3 v, vec3 uv)
{
return TDWorldToProj(vec4(v, 1.0), uv);
}
vec4 TDWorldToProj(vec4 v)
{
return TDWorldToProj(v, vec3(0.0));
}
vec4 TDWorldToProj(vec3 v)
{
return TDWorldToProj(vec4(v, 1.0));
}
vec4 TDPointColor() {
return Cd;
}

View File

@ -0,0 +1,9 @@
#version 460
vec4 TDOutputSwizzle(vec4 c)
{
return c.rgba;
}
uvec4 TDOutputSwizzle(uvec4 c)
{
return c.rgba;
}

View File

@ -0,0 +1,320 @@
#version 460
uniform int uTDInstanceIDOffset;
uniform int uTDNumInstances;
uniform float uTDAlphaTestVal;
#define TD_NUM_COLOR_BUFFERS 1
#define TD_NUM_LIGHTS 0
#define TD_NUM_SHADOWED_LIGHTS 0
#define TD_NUM_ENV_LIGHTS 0
#define TD_LIGHTS_ARRAY_SIZE 1
#define TD_ENV_LIGHTS_ARRAY_SIZE 1
#define TD_NUM_CAMERAS 1
struct TDLight
{
vec4 position;
vec3 direction;
vec3 diffuse;
vec4 nearFar;
vec4 lightSize;
vec4 misc;
vec4 coneLookupScaleBias;
vec4 attenScaleBiasRoll;
mat4 shadowMapMatrix;
mat4 shadowMapCamMatrix;
vec4 shadowMapRes;
mat4 projMapMatrix;
};
struct TDEnvLight
{
vec3 color;
mat3 rotate;
};
layout(std140) uniform TDLightBlock
{
TDLight uTDLights[TD_LIGHTS_ARRAY_SIZE];
};
layout(std140) uniform TDEnvLightBlock
{
TDEnvLight uTDEnvLights[TD_ENV_LIGHTS_ARRAY_SIZE];
};
layout(std430) readonly restrict buffer TDEnvLightBuffer
{
vec3 shCoeffs[9];
} uTDEnvLightBuffers[TD_ENV_LIGHTS_ARRAY_SIZE];
struct TDPhongResult
{
vec3 diffuse;
vec3 specular;
vec3 specular2;
float shadowStrength;
};
struct TDPBRResult
{
vec3 diffuse;
vec3 specular;
float shadowStrength;
};
struct TDMatrix
{
mat4 world;
mat4 worldInverse;
mat4 worldCam;
mat4 worldCamInverse;
mat4 cam;
mat4 camInverse;
mat4 camProj;
mat4 camProjInverse;
mat4 proj;
mat4 projInverse;
mat4 worldCamProj;
mat4 worldCamProjInverse;
mat4 quadReproject;
mat3 worldForNormals;
mat3 camForNormals;
mat3 worldCamForNormals;
};
layout(std140) uniform TDMatricesBlock {
TDMatrix uTDMats[TD_NUM_CAMERAS];
};
struct TDCameraInfo
{
vec4 nearFar;
vec4 fog;
vec4 fogColor;
int renderTOPCameraIndex;
};
layout(std140) uniform TDCameraInfoBlock {
TDCameraInfo uTDCamInfos[TD_NUM_CAMERAS];
};
struct TDGeneral
{
vec4 ambientColor;
vec4 nearFar;
vec4 viewport;
vec4 viewportRes;
vec4 fog;
vec4 fogColor;
};
layout(std140) uniform TDGeneralBlock {
TDGeneral uTDGeneral;
};
layout(binding = 15) uniform samplerBuffer sTDInstanceT;
layout(binding = 16) uniform samplerBuffer sTDInstanceTexCoord;
layout(binding = 17) uniform samplerBuffer sTDInstanceColor;
#define TD_NUM_BONES 0
vec4 TDWorldToProj(vec4 v);
vec4 TDWorldToProj(vec3 v);
vec4 TDWorldToProj(vec4 v, vec3 uv);
vec4 TDWorldToProj(vec3 v, vec3 uv);
int TDPickID();
int TDInstanceID();
int TDCameraIndex();
vec3 TDUVUnwrapCoord();
vec3 TDInstanceTexCoord(int index, vec3 t) {
vec3 v;
int coord = index;
vec4 samp = texelFetch(sTDInstanceTexCoord, coord);
v[0] = t.s;
v[1] = t.t;
v[2] = samp[0];
t.stp = v.stp;
return t;
}
bool TDInstanceActive(int index) {
index -= uTDInstanceIDOffset;
float v;
int coord = index;
vec4 samp = texelFetch(sTDInstanceT, coord);
v = samp[0];
return v != 0.0;
}
vec3 iTDInstanceTranslate(int index, out bool instanceActive) {
int origIndex = index;
index -= uTDInstanceIDOffset;
vec3 v;
int coord = index;
vec4 samp = texelFetch(sTDInstanceT, coord);
v[0] = samp[1];
v[1] = samp[2];
v[2] = samp[3];
instanceActive = samp[0] != 0.0;
return v;
}
vec3 TDInstanceTranslate(int index) {
index -= uTDInstanceIDOffset;
vec3 v;
int coord = index;
vec4 samp = texelFetch(sTDInstanceT, coord);
v[0] = samp[1];
v[1] = samp[2];
v[2] = samp[3];
return v;
}
mat3 TDInstanceRotateMat(int index) {
index -= uTDInstanceIDOffset;
vec3 v = vec3(0.0, 0.0, 0.0);
mat3 m = mat3(1.0);
{
mat3 r;
}
return m;
}
vec3 TDInstanceScale(int index) {
index -= uTDInstanceIDOffset;
vec3 v = vec3(1.0, 1.0, 1.0);
return v;
}
vec3 TDInstancePivot(int index) {
index -= uTDInstanceIDOffset;
vec3 v = vec3(0.0, 0.0, 0.0);
return v;
}
vec3 TDInstanceRotTo(int index) {
index -= uTDInstanceIDOffset;
vec3 v = vec3(0.0, 0.0, 1.0);
return v;
}
vec3 TDInstanceRotUp(int index) {
index -= uTDInstanceIDOffset;
vec3 v = vec3(0.0, 1.0, 0.0);
return v;
}
mat4 TDInstanceMat(int id) {
bool instanceActive = true;
vec3 t = iTDInstanceTranslate(id, instanceActive);
if (!instanceActive)
{
return mat4(0.0);
}
mat4 m = mat4(1.0);
{
vec3 tt = t;
m[3][0] += m[0][0]*tt.x;
m[3][1] += m[0][1]*tt.x;
m[3][2] += m[0][2]*tt.x;
m[3][3] += m[0][3]*tt.x;
m[3][0] += m[1][0]*tt.y;
m[3][1] += m[1][1]*tt.y;
m[3][2] += m[1][2]*tt.y;
m[3][3] += m[1][3]*tt.y;
m[3][0] += m[2][0]*tt.z;
m[3][1] += m[2][1]*tt.z;
m[3][2] += m[2][2]*tt.z;
m[3][3] += m[2][3]*tt.z;
}
return m;
}
mat3 TDInstanceMat3(int id) {
mat3 m = mat3(1.0);
return m;
}
mat3 TDInstanceMat3ForNorm(int id) {
mat3 m = TDInstanceMat3(id);
return m;
}
vec4 TDInstanceColor(int index, vec4 curColor) {
index -= uTDInstanceIDOffset;
vec4 v;
int coord = index;
vec4 samp = texelFetch(sTDInstanceColor, coord);
v[0] = samp[0];
v[1] = samp[1];
v[2] = samp[2];
v[3] = 1.0;
curColor[0] = v[0];
;
curColor[1] = v[1];
;
curColor[2] = v[2];
;
return curColor;
}
vec4 TDInstanceDeform(int id, vec4 pos) {
pos = TDInstanceMat(id) * pos;
return uTDMats[TDCameraIndex()].world * pos;
}
vec3 TDInstanceDeformVec(int id, vec3 vec)
{
mat3 m = TDInstanceMat3(id);
return mat3(uTDMats[TDCameraIndex()].world) * (m * vec);
}
vec3 TDInstanceDeformNorm(int id, vec3 vec)
{
mat3 m = TDInstanceMat3ForNorm(id);
return mat3(uTDMats[TDCameraIndex()].worldForNormals) * (m * vec);
}
vec4 TDInstanceDeform(vec4 pos) {
return TDInstanceDeform(TDInstanceID(), pos);
}
vec3 TDInstanceDeformVec(vec3 vec) {
return TDInstanceDeformVec(TDInstanceID(), vec);
}
vec3 TDInstanceDeformNorm(vec3 vec) {
return TDInstanceDeformNorm(TDInstanceID(), vec);
}
bool TDInstanceActive() { return TDInstanceActive(TDInstanceID()); }
vec3 TDInstanceTranslate() { return TDInstanceTranslate(TDInstanceID()); }
mat3 TDInstanceRotateMat() { return TDInstanceRotateMat(TDInstanceID()); }
vec3 TDInstanceScale() { return TDInstanceScale(TDInstanceID()); }
mat4 TDInstanceMat() { return TDInstanceMat(TDInstanceID());
}
mat3 TDInstanceMat3() { return TDInstanceMat3(TDInstanceID());
}
vec3 TDInstanceTexCoord(vec3 t) {
return TDInstanceTexCoord(TDInstanceID(), t);
}
vec4 TDInstanceColor(vec4 curColor) {
return TDInstanceColor(TDInstanceID(), curColor);
}
vec4 TDSkinnedDeform(vec4 pos) { return pos; }
vec3 TDSkinnedDeformVec(vec3 vec) { return vec; }
vec3 TDFastDeformTangent(vec3 oldNorm, vec4 oldTangent, vec3 deformedNorm)
{ return oldTangent.xyz; }
mat4 TDBoneMat(int index) {
return mat4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);
}
vec4 TDDeform(vec4 pos) {
pos = TDSkinnedDeform(pos);
pos = TDInstanceDeform(pos);
return pos;
}
vec4 TDDeform(int instanceID, vec3 p) {
vec4 pos = vec4(p, 1.0);
pos = TDSkinnedDeform(pos);
pos = TDInstanceDeform(instanceID, pos);
return pos;
}
vec4 TDDeform(vec3 pos) {
return TDDeform(TDInstanceID(), pos);
}
vec3 TDDeformVec(int instanceID, vec3 vec) {
vec = TDSkinnedDeformVec(vec);
vec = TDInstanceDeformVec(instanceID, vec);
return vec;
}
vec3 TDDeformVec(vec3 vec) {
return TDDeformVec(TDInstanceID(), vec);
}
vec3 TDDeformNorm(int instanceID, vec3 vec) {
vec = TDSkinnedDeformVec(vec);
vec = TDInstanceDeformNorm(instanceID, vec);
return vec;
}
vec3 TDDeformNorm(vec3 vec) {
return TDDeformNorm(TDInstanceID(), vec);
}
vec3 TDSkinnedDeformNorm(vec3 vec) {
vec = TDSkinnedDeformVec(vec);
return vec;
}

View File

@ -580,9 +580,6 @@ void TIntermediate::mergeGlobalUniformBlocks(TInfoSink& infoSink, TIntermediate&
}
void TIntermediate::mergeBlockDefinitions(TInfoSink& infoSink, TIntermSymbol* block, TIntermSymbol* unitBlock, TIntermediate* unit) {
if (block->getType() == unitBlock->getType()) {
return;
}
if (block->getType().getTypeName() != unitBlock->getType().getTypeName() ||
block->getType().getBasicType() != unitBlock->getType().getBasicType() ||
@ -629,44 +626,42 @@ void TIntermediate::mergeBlockDefinitions(TInfoSink& infoSink, TIntermSymbol* bl
}
}
TType unitType;
unitType.shallowCopy(unitBlock->getType());
// update symbol node in unit tree,
// and other nodes that may reference it
class TMergeBlockTraverser : public TIntermTraverser {
public:
TMergeBlockTraverser(const glslang::TType &type, const glslang::TType& unitType,
glslang::TIntermediate& unit,
const std::map<unsigned int, unsigned int>& memberIdxUpdates) :
newType(type), unitType(unitType), unit(unit), memberIndexUpdates(memberIdxUpdates)
{ }
TMergeBlockTraverser(const TIntermSymbol* newSym)
: newSymbol(newSym), unitType(nullptr), unit(nullptr), memberIndexUpdates(nullptr)
{
}
TMergeBlockTraverser(const TIntermSymbol* newSym, const glslang::TType* unitType, glslang::TIntermediate* unit,
const std::map<unsigned int, unsigned int>* memberIdxUpdates)
: newSymbol(newSym), unitType(unitType), unit(unit), memberIndexUpdates(memberIdxUpdates)
{
}
virtual ~TMergeBlockTraverser() {}
const glslang::TType& newType; // type with modifications
const glslang::TType& unitType; // copy of original type
glslang::TIntermediate& unit; // intermediate that is being updated
const std::map<unsigned int, unsigned int>& memberIndexUpdates;
const TIntermSymbol* newSymbol;
const glslang::TType* unitType; // copy of original type
glslang::TIntermediate* unit; // intermediate that is being updated
const std::map<unsigned int, unsigned int>* memberIndexUpdates;
virtual void visitSymbol(TIntermSymbol* symbol)
{
glslang::TType& symType = symbol->getWritableType();
if (symType == unitType) {
// each symbol node has a local copy of the unitType
// if merging involves changing properties that aren't shared objects
// they should be updated in all instances
// e.g. the struct list is a ptr to an object, so it can be updated
// once, outside the traverser
//*symType.getWritableStruct() = *newType.getStruct();
if (newSymbol->getAccessName() == symbol->getAccessName() &&
newSymbol->getQualifier().getBlockStorage() == symbol->getQualifier().getBlockStorage()) {
// Each symbol node may have a local copy of the block structure.
// Update those structures to match the new one post-merge
*(symbol->getWritableType().getWritableStruct()) = *(newSymbol->getType().getStruct());
}
}
virtual bool visitBinary(TVisit, glslang::TIntermBinary* node)
{
if (node->getOp() == EOpIndexDirectStruct && node->getLeft()->getType() == unitType) {
if (!unit || !unitType || !memberIndexUpdates || memberIndexUpdates->empty())
return true;
if (node->getOp() == EOpIndexDirectStruct && node->getLeft()->getType() == *unitType) {
// this is a dereference to a member of the block since the
// member list changed, need to update this to point to the
// right index
@ -674,8 +669,8 @@ void TIntermediate::mergeBlockDefinitions(TInfoSink& infoSink, TIntermSymbol* bl
glslang::TIntermConstantUnion* constNode = node->getRight()->getAsConstantUnion();
unsigned int memberIdx = constNode->getConstArray()[0].getUConst();
unsigned int newIdx = memberIndexUpdates.at(memberIdx);
TIntermTyped* newConstNode = unit.addConstantUnion(newIdx, node->getRight()->getLoc());
unsigned int newIdx = memberIndexUpdates->at(memberIdx);
TIntermTyped* newConstNode = unit->addConstantUnion(newIdx, node->getRight()->getLoc());
node->setRight(newConstNode);
delete constNode;
@ -684,10 +679,20 @@ void TIntermediate::mergeBlockDefinitions(TInfoSink& infoSink, TIntermSymbol* bl
}
return true;
}
} finalLinkTraverser(block->getType(), unitType, *unit, memberIndexUpdates);
};
// update the tree to use the new type
unit->getTreeRoot()->traverse(&finalLinkTraverser);
// 'this' may have symbols that are using the old block structure, so traverse the tree to update those
// in 'visitSymbol'
TMergeBlockTraverser finalLinkTraverser(block);
getTreeRoot()->traverse(&finalLinkTraverser);
// The 'unit' intermediate needs the block structures update, but also structure entry indices
// may have changed from the old block to the new one that it was merged into, so update those
// in 'visitBinary'
TType unitType;
unitType.shallowCopy(unitBlock->getType());
TMergeBlockTraverser unitFinalLinkTraverser(block, &unitType, unit, &memberIndexUpdates);
unit->getTreeRoot()->traverse(&unitFinalLinkTraverser);
// update the member list
(*unitMemberList) = (*memberList);

View File

@ -107,8 +107,8 @@ bool verifyIOMapping(std::string& linkingError, glslang::TProgram& program) {
auto inQualifier = in.getType()->getQualifier();
auto outQualifier = out->second->getType()->getQualifier();
success &= outQualifier.layoutLocation == inQualifier.layoutLocation;
}
else {
// These are not part of a matched interface. Other cases still need to be added.
} else if (name != "gl_FrontFacing" && name != "gl_FragCoord") {
success &= false;
}
}
@ -293,6 +293,7 @@ INSTANTIATE_TEST_SUITE_P(
::testing::ValuesIn(std::vector<vkRelaxedData>({
{{"vk.relaxed.frag"}},
{{"vk.relaxed.link1.frag", "vk.relaxed.link2.frag"}},
{{"vk.relaxed.stagelink.0.0.vert", "vk.relaxed.stagelink.0.1.vert", "vk.relaxed.stagelink.0.2.vert", "vk.relaxed.stagelink.0.0.frag", "vk.relaxed.stagelink.0.1.frag", "vk.relaxed.stagelink.0.2.frag"}},
{{"vk.relaxed.stagelink.vert", "vk.relaxed.stagelink.frag"}},
{{"vk.relaxed.errorcheck.vert", "vk.relaxed.errorcheck.frag"}},
{{"vk.relaxed.changeSet.vert", "vk.relaxed.changeSet.frag" }, { {"0"}, {"1"} } },