Here is the code from the glsl mat, which performs normally in TD2022 but encounters errors in TD2023: Vertex Shader Compile Results:
ERROR: /software/top/PixelMapEditor/logic/base_custom_fixture_assets/base_shader_compile_template_0/EMITTER_VERTEX_SHADER:799: ‘mTD2DImageOutputs’ : undeclared identifier
ERROR: 1 compilation error. No code generated.
=============
Pixel Shader Compile Results:
Compiled Successfully
=============
Linked Successfully. However, the render select operator can still read the image out correctly at this point. If I use #ifdef TD_RENDER_TOP
imageStore(…)
#endif to fix this error, the render select operator will no longer be able to read the image out correctly.
Thanks
uniform sampler2D DmxBuffer;
uniform sampler2DArray feedbackTop;
uniform bool feedbackOrigin;
#include <glslFuncs>
uniform float uFrame;
uniform float uRate;
uniform vec3 Parent_Translate;
uniform vec3 Parent_Rotate;
uniform vec3 Parent_Scale;
mat4 mats[7];
mat4 adjustMats[7];
in ivec2 AddressOffset;
in int BufferOffset;
in int primType;
in int geomID;
in int matID;
in vec3 v_AttenNearFarRolloff;
in ivec3 v_LightTypeShadowsProjection;
in vec3 v_coneAngleDeltaFalloff;
in vec3 v_goboIDRotateBlur;
in vec4 v_RgbAndBrightness;
out Vertex
{
flat vec4 DEBUG;
} oVert;
void main()
{
int cameraIndex = TDCameraIndex();
mat4 geoCompInverseMAT = uTDMats[cameraIndex].worldInverse;
mat4 MAT = mat4(1); // this matrix is used to hold POSITION matrix info specific to the matID of a vertex.
//mat4 MAT_N = mat4(0); // this matrix is used to hold NORMAL matrix info specific to the matID of a vertex.
mat4 MAT_G = mat4(1); // this matrix is used to hold GOBO matrix info specific to the matID of a vertex.
vec3 COLOR_EMIT = vec3(0,0,0); // this vec4 is used to hold the emit color of the vertex.
float Brightnessmultiplier = 0.0;
float AttenNear = 0.0;
float AttenFar = 0.0;
float AttenRolloff = 0.0;
int LightType = 0;
vec3 attenScaleBiasRollXYZ = vec3(0); // this is not written to directly, but calculated at end.
bool ShadowsEnabled = false;
bool ProjectionsEnabled = false;
float ConeAngle = 5.0;
float ConeDelta = 10.0;
float ConeFalloff = 2.2;
vec4 scaleBiasXYZW = vec4(0);
float GoboId = 0;
float GoboRotate = 0;
float GoboBlur = 0;
vec4 LightA = vec4(0,0,0,1);
vec4 LightB = vec4(0,0,1,1);
float ADJUSTMENTS[7][35];
for( int i=0; i<7; i++ ) // initialize with default vals
{
ADJUSTMENTS[i] = float[35](
0, // tx
0, // ty
0, // tz
0, // rx
0, // ry
0, // rz
1, // sx
1, // sy
1, // sz
v_RgbAndBrightness[3], // Brightnessmultiplier
v_AttenNearFarRolloff[0], // AttenNear
v_AttenNearFarRolloff[1], // AttenFar
v_AttenNearFarRolloff[2], // AttenRolloff
float(v_LightTypeShadowsProjection[0]), // LightType
0, // attenScaleBiasRollX
0, // attenScaleBiasRollY
0, // attenScaleBiasRollZ
float(v_LightTypeShadowsProjection[1]), // ShadowsEnabled
float(v_LightTypeShadowsProjection[2]), // ProjectionsEnabled
v_coneAngleDeltaFalloff[0], // coneAngle
v_coneAngleDeltaFalloff[1], // coneDelta
v_coneAngleDeltaFalloff[2], // coneFalloff
0, // scaleBiasX
0, // scaleBiasY
0, // scaleBiasZ
0, // scaleBiasW
v_goboIDRotateBlur[0], // goboID
v_goboIDRotateBlur[1], // goboRotate
v_goboIDRotateBlur[2], // goboBlur
0, // vx
0, // vy
0, // vz
v_RgbAndBrightness[0], // EmitR
v_RgbAndBrightness[1], // EmitG
v_RgbAndBrightness[2] // EmitB
);
}
mats[0] = Matrix( vec3(0.000000,0.000000,0.000000) , vec3(0.000000,0.000000,0.000000) , vec3(1.000000,1.000000,1.000000) ); // T_Base
mats[1] = Matrix( vec3(0.000000,-7.000000,0.000000) , vec3(0.000000,0.000000,0.000000) , vec3(1.000000,1.000000,1.000000) ); // T_Beam
mats[2] = Matrix( vec3(0.000000,0.000000,0.000000) , vec3(0.000000,0.000000,0.000000) , vec3(1.000000,1.000000,1.000000) ); // T_Display
mats[3] = Matrix( vec3(0.000000,7.000000,0.000000) , vec3(90.000000,0.000000,0.000000) , vec3(1.000000,1.000000,1.000000) ); // T_Emitter
mats[4] = Matrix( vec3(0.000000,15.000000,0.000000) , vec3(-90.000000,0.000000,0.000000) , vec3(1.000000,1.000000,1.000000) ); // T_Head
mats[5] = Matrix( vec3(0.000000,0.000000,0.000000) , vec3(0.000000,0.000000,0.000000) , vec3(1.000000,1.000000,1.000000) ); // T_Root
mats[6] = Matrix( vec3(0.000000,7.000000,0.000000) , vec3(0.000000,0.000000,0.000000) , vec3(1.000000,1.000000,1.000000) ); // T_Yoke
if (DMX_255(AddressOffset.x,AddressOffset.y+2) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+2) <= 255) {
ADJUSTMENTS[4][3] = map_( DMX_255(AddressOffset.x,AddressOffset.y+2) , 0.000000 , 255.000000 , 0.000000 , -180.000000 ); // [T_Head][Rx]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+3) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+3) <= 255) {
ADJUSTMENTS[4][3] += map_( DMX_255(AddressOffset.x,AddressOffset.y+3) , 0.000000 , 255.000000 , 0.000000 , -1.000000 ); // [T_Head][Rx]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+0) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+0) <= 255) {
ADJUSTMENTS[6][4] = map_( DMX_255(AddressOffset.x,AddressOffset.y+0) , 0.000000 , 255.000000 , 0.000000 , -540.000000 ); // [T_Yoke][Ry]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+1) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+1) <= 255) {
ADJUSTMENTS[6][4] += map_( DMX_255(AddressOffset.x,AddressOffset.y+1) , 0.000000 , 255.000000 , 0.000000 , -1.000000 ); // [T_Yoke][Ry]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+7) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+7) <= 255) {
ADJUSTMENTS[0][32] = map_( DMX_255(AddressOffset.x,AddressOffset.y+7) , 0.000000 , 255.000000 , 0.000000 , 1.000000 ); // [E_Emitter][EmitR]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+5) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+5) <= 255) {
ADJUSTMENTS[0][32] *= map_( DMX_255(AddressOffset.x,AddressOffset.y+5) , 0.000000 , 255.000000 , 0.000000 , 1.000000 ); // [E_Emitter][EmitR]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+10) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+10) <= 255) {
ADJUSTMENTS[0][32] += map_( DMX_255(AddressOffset.x,AddressOffset.y+10) , 0.000000 , 255.000000 , 0.000000 , 0.500000 ); // [E_Emitter][EmitR]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+6) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+6) <= 9) {
ADJUSTMENTS[0][32] = map_( DMX_255(AddressOffset.x,AddressOffset.y+6) , 0.000000 , 9.000000 , 0.000000 , 0.000000 ); // [E_Emitter][EmitR]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+6) >= 10 && DMX_255(AddressOffset.x,AddressOffset.y+6) <= 245) {
float cycleLength = map_( DMX_255(AddressOffset.x,AddressOffset.y+6), 10.000000, 245.000000, 0.500000, 0.100000 );
float cycleBias = map_( DMX_255(AddressOffset.x,AddressOffset.y+6), 10.000000, 245.000000, 0.100000, 0.500000 );
float timeInSeconds = mod( uFrame , ( uRate * cycleLength ) ) / ( uRate * cycleLength );
ADJUSTMENTS[0][32] *= timeInSeconds <= cycleBias ? 1 : 0;
}
if (DMX_255(AddressOffset.x,AddressOffset.y+8) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+8) <= 255) {
ADJUSTMENTS[0][33] += map_( DMX_255(AddressOffset.x,AddressOffset.y+8) , 0.000000 , 255.000000 , 0.000000 , 1.000000 ); // [E_Emitter][EmitG]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+5) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+5) <= 255) {
ADJUSTMENTS[0][33] *= map_( DMX_255(AddressOffset.x,AddressOffset.y+5) , 0.000000 , 255.000000 , 0.000000 , 1.000000 ); // [E_Emitter][EmitG]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+10) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+10) <= 255) {
ADJUSTMENTS[0][33] += map_( DMX_255(AddressOffset.x,AddressOffset.y+10) , 0.000000 , 255.000000 , 0.000000 , 0.500000 ); // [E_Emitter][EmitG]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+6) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+6) <= 9) {
ADJUSTMENTS[0][33] = map_( DMX_255(AddressOffset.x,AddressOffset.y+6) , 0.000000 , 9.000000 , 0.000000 , 0.000000 ); // [E_Emitter][EmitG]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+6) >= 10 && DMX_255(AddressOffset.x,AddressOffset.y+6) <= 245) {
float cycleLength = map_( DMX_255(AddressOffset.x,AddressOffset.y+6), 10.000000, 245.000000, 0.500000, 0.100000 );
float cycleBias = map_( DMX_255(AddressOffset.x,AddressOffset.y+6), 10.000000, 245.000000, 0.100000, 0.500000 );
float timeInSeconds = mod( uFrame , ( uRate * cycleLength ) ) / ( uRate * cycleLength );
ADJUSTMENTS[0][33] *= timeInSeconds <= cycleBias ? 1 : 0;
}
if (DMX_255(AddressOffset.x,AddressOffset.y+9) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+9) <= 255) {
ADJUSTMENTS[0][34] += map_( DMX_255(AddressOffset.x,AddressOffset.y+9) , 0.000000 , 255.000000 , 0.000000 , 1.000000 ); // [E_Emitter][EmitB]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+5) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+5) <= 255) {
ADJUSTMENTS[0][34] *= map_( DMX_255(AddressOffset.x,AddressOffset.y+5) , 0.000000 , 255.000000 , 0.000000 , 1.000000 ); // [E_Emitter][EmitB]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+10) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+10) <= 255) {
ADJUSTMENTS[0][34] += map_( DMX_255(AddressOffset.x,AddressOffset.y+10) , 0.000000 , 255.000000 , 0.000000 , 0.500000 ); // [E_Emitter][EmitB]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+6) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+6) <= 9) {
ADJUSTMENTS[0][34] = map_( DMX_255(AddressOffset.x,AddressOffset.y+6) , 0.000000 , 9.000000 , 0.000000 , 0.000000 ); // [E_Emitter][EmitB]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+6) >= 10 && DMX_255(AddressOffset.x,AddressOffset.y+6) <= 245) {
float cycleLength = map_( DMX_255(AddressOffset.x,AddressOffset.y+6), 10.000000, 245.000000, 0.500000, 0.100000 );
float cycleBias = map_( DMX_255(AddressOffset.x,AddressOffset.y+6), 10.000000, 245.000000, 0.100000, 0.500000 );
float timeInSeconds = mod( uFrame , ( uRate * cycleLength ) ) / ( uRate * cycleLength );
ADJUSTMENTS[0][34] *= timeInSeconds <= cycleBias ? 1 : 0;
}
if (DMX_255(AddressOffset.x,AddressOffset.y+15) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+15) <= 255) {
ADJUSTMENTS[0][19] = map_( DMX_255(AddressOffset.x,AddressOffset.y+15) , 0.000000 , 255.000000 , 2.500000 , 8.000000 ); // [E_Emitter][ConeAngle]
}
if (DMX_255(AddressOffset.x,AddressOffset.y+15) >= 0 && DMX_255(AddressOffset.x,AddressOffset.y+15) <= 255) {
ADJUSTMENTS[0][20] = map_( DMX_255(AddressOffset.x,AddressOffset.y+15) , 0.000000 , 255.000000 , 2.000000 , 10.000000 ); // [E_Emitter][ConeDelta]
}
if ( ADJUSTMENTS[0][26] >= 0 ){ ADJUSTMENTS[0][18] = 1.0; } // IF gobo ID is greater than -1, projection needs to be enabled.
adjustMats[0] = Matrix( vec3(ADJUSTMENTS[0][0],ADJUSTMENTS[0][1],ADJUSTMENTS[0][2]) , vec3(ADJUSTMENTS[0][3],ADJUSTMENTS[0][4],ADJUSTMENTS[0][5]) , vec3(ADJUSTMENTS[0][6],ADJUSTMENTS[0][7],ADJUSTMENTS[0][8]) ); // T_Base
adjustMats[1] = Matrix( vec3(ADJUSTMENTS[1][0],ADJUSTMENTS[1][1],ADJUSTMENTS[1][2]) , vec3(ADJUSTMENTS[1][3],ADJUSTMENTS[1][4],ADJUSTMENTS[1][5]) , vec3(ADJUSTMENTS[1][6],ADJUSTMENTS[1][7],ADJUSTMENTS[1][8]) ); // T_Beam
adjustMats[2] = Matrix( vec3(ADJUSTMENTS[2][0],ADJUSTMENTS[2][1],ADJUSTMENTS[2][2]) , vec3(ADJUSTMENTS[2][3],ADJUSTMENTS[2][4],ADJUSTMENTS[2][5]) , vec3(ADJUSTMENTS[2][6],ADJUSTMENTS[2][7],ADJUSTMENTS[2][8]) ); // T_Display
adjustMats[3] = Matrix( vec3(ADJUSTMENTS[3][0],ADJUSTMENTS[3][1],ADJUSTMENTS[3][2]) , vec3(ADJUSTMENTS[3][3],ADJUSTMENTS[3][4],ADJUSTMENTS[3][5]) , vec3(ADJUSTMENTS[3][6],ADJUSTMENTS[3][7],ADJUSTMENTS[3][8]) ); // T_Emitter
adjustMats[4] = Matrix( vec3(ADJUSTMENTS[4][0],ADJUSTMENTS[4][1],ADJUSTMENTS[4][2]) , vec3(ADJUSTMENTS[4][3],ADJUSTMENTS[4][4],ADJUSTMENTS[4][5]) , vec3(ADJUSTMENTS[4][6],ADJUSTMENTS[4][7],ADJUSTMENTS[4][8]) ); // T_Head
adjustMats[5] = Matrix( vec3(ADJUSTMENTS[5][0],ADJUSTMENTS[5][1],ADJUSTMENTS[5][2]) , vec3(ADJUSTMENTS[5][3],ADJUSTMENTS[5][4],ADJUSTMENTS[5][5]) , vec3(ADJUSTMENTS[5][6],ADJUSTMENTS[5][7],ADJUSTMENTS[5][8]) ); // T_Root
adjustMats[6] = Matrix( vec3(ADJUSTMENTS[6][0],ADJUSTMENTS[6][1],ADJUSTMENTS[6][2]) , vec3(ADJUSTMENTS[6][3],ADJUSTMENTS[6][4],ADJUSTMENTS[6][5]) , vec3(ADJUSTMENTS[6][6],ADJUSTMENTS[6][7],ADJUSTMENTS[6][8]) ); // T_Yoke
if( gl_VertexID == 0 ) // E_Emitter
{
MAT = mat4(1); // Start with default identity matrix
MAT *= mats[5] * adjustMats[5]; // T_Root
MAT *= mats[6] * adjustMats[6]; // T_Yoke
MAT *= mats[4] * adjustMats[4]; // T_Head
MAT *= mats[3] * adjustMats[3]; // T_Emitter
// MAT_N = mat4(1); // Start with default identity matrix
// MAT_N *= mats_N[5] * adjustMats_N[5]; // T_Root
// MAT_N *= mats_N[6] * adjustMats_N[6]; // T_Yoke
// MAT_N *= mats_N[4] * adjustMats_N[4]; // T_Head
// MAT_N *= mats_N[3] * adjustMats_N[3]; // T_Emitter
COLOR_EMIT.r = ADJUSTMENTS[0][32]; // set red emit color
COLOR_EMIT.g = ADJUSTMENTS[0][33]; // set green emit color
COLOR_EMIT.b = ADJUSTMENTS[0][34]; // set blue emit color
Brightnessmultiplier = ADJUSTMENTS[0][9]; // set overall emitter brightness
AttenNear = ADJUSTMENTS[0][10];
AttenFar = ADJUSTMENTS[0][11];
AttenRolloff = ADJUSTMENTS[0][12];
LightType = int(ADJUSTMENTS[0][13]);
ShadowsEnabled = bool(ADJUSTMENTS[0][17]);
ProjectionsEnabled = bool(ADJUSTMENTS[0][18]);
ConeAngle = ADJUSTMENTS[0][19];
ConeDelta = ADJUSTMENTS[0][20];
ConeFalloff = ADJUSTMENTS[0][21];
GoboId = ADJUSTMENTS[0][26];
GoboRotate = ADJUSTMENTS[0][27];
GoboBlur = ADJUSTMENTS[0][28];
}
mat4 Parent_GeoMat = uTDMats[TDCameraIndex()].world; // World matrix of the geo comp this resides in.
LightA = Parent_GeoMat * MAT * LightA;
LightB = Parent_GeoMat * MAT * LightB;
vec3 LightVec = normalize((LightB.xyz-LightA.xyz));
///////////////////////////////// NEED TO WORK ON THE GOBO MATRIX! ///////////////////////////////
mat4 GoboProjection_Matrix = PerspectiveProjectionMatrix( vec3( ConeAngle+ConeDelta , AttenNear , AttenFar ) );
mat4 GoboMat = mat4(1);
mat4 Parent_GeoMat_sansTranslation = Parent_GeoMat;
Parent_GeoMat_sansTranslation[3][0] = 0;
Parent_GeoMat_sansTranslation[3][1] = 0;
Parent_GeoMat_sansTranslation[3][2] = 0;
// projection matrix should not have any positional offset.
MAT_G = MAT;
MAT_G[3] = vec4(0,0,0,1);
// GoboMat = GoboProjection_Matrix * inverse(MAT) * inverse(Parent_GeoMat_sansTranslation);
GoboMat = GoboProjection_Matrix * inverse(MAT_G) * inverse(Parent_GeoMat_sansTranslation);
GoboRotate = radians(GoboRotate); // user specifies rotation amount in degrees (0-360) in json, we convert to radians here.
int BufferOffset2 = BufferOffset + gl_VertexID ;
imageStore(mTD2DImageOutputs[0], ivec2(BufferOffset2,0), vec4( COLOR_EMIT.rgb , Brightnessmultiplier ) ); // r/g/b/brightness
imageStore(mTD2DImageOutputs[0], ivec2(BufferOffset2,1), vec4( AttenNear , AttenFar , AttenRolloff , 0 ) ); // attenNear,attenFar,attenRolloff,NONE
imageStore(mTD2DImageOutputs[0], ivec2(BufferOffset2,2), vec4( LightType , ShadowsEnabled , ProjectionsEnabled , 0 ) ); // ShadowsEnabled/ProjectionsEnabled/LightType/NONE
imageStore(mTD2DImageOutputs[0], ivec2(BufferOffset2,3), vec4( ConeAngle , ConeDelta , ConeFalloff , 0 ) ); // coneAngle/coneDelta/coneFalloff/NONE
imageStore(mTD2DImageOutputs[0], ivec2(BufferOffset2,4), vec4( GoboId , GoboRotate , GoboBlur , 0 ) ); // goboID/goboRotate/goboBlur/NONE
imageStore(mTD2DImageOutputs[0], ivec2(BufferOffset2,5), vec4( LightVec.x , LightVec.y , LightVec.z , 0 ) ); // vx/vy/vz/NONE
imageStore(mTD2DImageOutputs[0], ivec2(BufferOffset2,6), vec4( LightA.x , LightA.y , LightA.z , 0 ) ); // tx/ty/tz/NONE
// GOBO matrix columns
imageStore(mTD2DImageOutputs[0], ivec2(BufferOffset2,7), GoboMat[0] ); // GoboMat Column 0
imageStore(mTD2DImageOutputs[0], ivec2(BufferOffset2,8), GoboMat[1] ); // GoboMat Column 1
imageStore(mTD2DImageOutputs[0], ivec2(BufferOffset2,9), GoboMat[2] ); // GoboMat Column 2
imageStore(mTD2DImageOutputs[0], ivec2(BufferOffset2,10), GoboMat[3] ); // GoboMat Column 3
gl_Position = UserWorldToProj(LightA , cameraIndex);
}