yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
5398d55e
main
1#version 460 2layout (location = 0 )in vec3 P ; 3layout (location = 1 )in vec3 N ; 4layout (location = 2 )in vec4 Cd ; 5layout (location = 3 )in vec3 uv [8 ]; 6uniform int uTDInstanceIDOffset ; 7uniform int uTDNumInstances ; 8uniform float uTDAlphaTestVal ; 9#define TD_NUM_COLOR_BUFFERS 1 10#define TD_NUM_LIGHTS 0 11#define TD_NUM_SHADOWED_LIGHTS 0 12#define TD_NUM_ENV_LIGHTS 0 13#define TD_LIGHTS_ARRAY_SIZE 1 14#define TD_ENV_LIGHTS_ARRAY_SIZE 1 15#define TD_NUM_CAMERAS 1 16struct TDLight 17{ 18vec4 position ; 19vec3 direction ; 20vec3 diffuse ; 21vec4 nearFar ; 22vec4 lightSize ; 23vec4 misc ; 24vec4 coneLookupScaleBias ; 25vec4 attenScaleBiasRoll ; 26mat4 shadowMapMatrix ; 27mat4 shadowMapCamMatrix ; 28vec4 shadowMapRes ; 29mat4 projMapMatrix ; 30}; 31struct TDEnvLight 32{ 33vec3 color ; 34mat3 rotate ; 35}; 36layout (std140 )uniform TDLightBlock 37{ 38TDLight uTDLights [TD_LIGHTS_ARRAY_SIZE ]; 39}; 40layout (std140 )uniform TDEnvLightBlock 41{ 42TDEnvLight uTDEnvLights [TD_ENV_LIGHTS_ARRAY_SIZE ]; 43}; 44layout (std430 )readonly restrictbuffer TDEnvLightBuffer 45{ 46vec3 shCoeffs [9 ]; 47}uTDEnvLightBuffers [TD_ENV_LIGHTS_ARRAY_SIZE ]; 48struct TDPhongResult 49{ 50vec3 diffuse ; 51vec3 specular ; 52vec3 specular2 ; 53float shadowStrength ; 54}; 55struct TDPBRResult 56{ 57vec3 diffuse ; 58vec3 specular ; 59float shadowStrength ; 60}; 61struct TDMatrix 62{ 63mat4 world ; 64mat4 worldInverse ; 65mat4 worldCam ; 66mat4 worldCamInverse ; 67mat4 cam ; 68mat4 camInverse ; 69mat4 camProj ; 70mat4 camProjInverse ; 71mat4 proj ; 72mat4 projInverse ; 73mat4 worldCamProj ; 74mat4 worldCamProjInverse ; 75mat4 quadReproject ; 76mat3 worldForNormals ; 77mat3 camForNormals ; 78mat3 worldCamForNormals ; 79}; 80layout (std140 )uniform TDMatricesBlock { 81TDMatrix uTDMats [TD_NUM_CAMERAS ]; 82}; 83struct TDCameraInfo 84{ 85vec4 nearFar ; 86vec4 fog ; 87vec4 fogColor ; 88int renderTOPCameraIndex ; 89}; 90layout (std140 )uniform TDCameraInfoBlock { 91TDCameraInfo uTDCamInfos [TD_NUM_CAMERAS ]; 92}; 93struct TDGeneral 94{ 95vec4 ambientColor ; 96vec4 nearFar ; 97vec4 viewport ; 98vec4 viewportRes ; 99vec4 fog ; 100vec4 fogColor ; 101}; 102layout (std140 )uniform TDGeneralBlock { 103TDGeneral uTDGeneral ; 104}; 105layout (rgba8 )uniform image2D mTD2DImageOutputs [1 ]; 106layout (rgba8 )uniform image2DArray mTD2DArrayImageOutputs [1 ]; 107layout (rgba8 )uniform image3D mTD3DImageOutputs [1 ]; 108layout (rgba8 )uniform imageCube mTDCubeImageOutputs [1 ]; 109 110mat4 TDInstanceMat (int instanceID ); 111mat3 TDInstanceMat3 (int instanceID ); 112vec3 TDInstanceTranslate (int instanceID ); 113bool TDInstanceActive (int instanceID ); 114mat3 TDInstanceRotateMat (int instanceID ); 115vec3 TDInstanceScale (int instanceID ); 116vec3 TDInstanceTexCoord (int instanceID ,vec3 t ); 117vec4 TDInstanceColor (int instanceID ,vec4 curColor ); 118vec4 TDInstanceCustomAttrib0 (int instanceID ); 119vec4 TDInstanceCustomAttrib1 (int instanceID ); 120vec4 TDInstanceCustomAttrib2 (int instanceID ); 121vec4 TDInstanceCustomAttrib3 (int instanceID ); 122vec4 TDInstanceCustomAttrib4 (int instanceID ); 123vec4 TDInstanceCustomAttrib5 (int instanceID ); 124vec4 TDInstanceCustomAttrib6 (int instanceID ); 125vec4 TDInstanceCustomAttrib7 (int instanceID ); 126vec4 TDInstanceCustomAttrib8 (int instanceID ); 127vec4 TDInstanceCustomAttrib9 (int instanceID ); 128vec4 TDInstanceCustomAttrib10 (int instanceID ); 129vec4 TDInstanceCustomAttrib11 (int instanceID ); 130uint TDInstanceTextureIndex (int instanceIndex ); 131vec4 TDInstanceTexture (uint texIndex ,vec3 uv ); 132vec4 TDInstanceTexture (uint texIndex ,vec2 uv ); 133 134vec4 TDDeform (vec4 pos ); 135vec4 TDDeform (vec3 pos ); 136vec4 TDDeform (int instanceID ,vec3 pos ); 137vec3 TDDeformVec (vec3 v ); 138vec3 TDDeformVec (int instanceID ,vec3 v ); 139vec3 TDDeformNorm (vec3 v ); 140vec3 TDDeformNorm (int instanceID ,vec3 v ); 141vec4 TDSkinnedDeform (vec4 pos ); 142vec3 TDSkinnedDeformVec (vec3 vec ); 143vec3 TDSkinnedDeformNorm (vec3 vec ); 144vec4 TDInstanceDeform (vec4 pos ); 145vec3 TDInstanceDeformVec (vec3 vec ); 146vec3 TDInstanceDeformNorm (vec3 vec ); 147vec4 TDInstanceDeform (int instanceID ,vec4 pos ); 148vec3 TDInstanceDeformVec (int instanceID ,vec3 vec ); 149vec3 TDInstanceDeformNorm (int instanceID ,vec3 vec ); 150vec3 TDFastDeformTangent (vec3 oldNorm ,vec4 oldTangent ,vec3 deformedNorm ); 151mat4 TDBoneMat (int boneIndex ); 152mat4 TDInstanceMat (); 153mat3 TDInstanceMat3 (); 154vec3 TDInstanceTranslate (); 155bool TDInstanceActive (); 156mat3 TDInstanceRotateMat (); 157vec3 TDInstanceScale (); 158vec3 TDInstanceTexCoord (vec3 t ); 159vec4 TDInstanceColor (vec4 curColor ); 160vec4 TDPointColor (); 161#ifdef TD_PICKING_ACTIVE 162out TDPickVertex { 163vec3 sopSpacePosition ; 164vec3 camSpacePosition ; 165vec3 worldSpacePosition ; 166vec3 sopSpaceNormal ; 167vec3 camSpaceNormal ; 168vec3 worldSpaceNormal ; 169vec3 uv [1 ]; 170flat int pickId ; 171flat int instanceId ; 172vec4 color ; 173}oTDPickVert ; 174#define vTDPickVert oTDPickVert 175#endif 176vec4 iTDCamToProj (vec4 v ,vec3 uv ,int cameraIndex ,bool applyPickMod ) 177{ 178if (!TDInstanceActive ()) 179return vec4 (2 ,2 ,2 ,0 ); 180v = uTDMats [0 ].proj * v ; 181return v ; 182} 183vec4 iTDWorldToProj (vec4 v ,vec3 uv ,int cameraIndex ,bool applyPickMod ) { 184if (!TDInstanceActive ()) 185return vec4 (2 ,2 ,2 ,0 ); 186v = uTDMats [0 ].camProj * v ; 187return v ; 188} 189vec4 TDDeform (vec4 pos ); 190vec4 TDDeform (vec3 pos ); 191vec4 TDInstanceColor (vec4 curColor ); 192vec3 TDInstanceTexCoord (vec3 t ); 193int TDInstanceID () { 194return gl_InstanceID + uTDInstanceIDOffset ; 195} 196int TDCameraIndex () { 197return 0 ; 198} 199vec3 TDUVUnwrapCoord () { 200return uv [0 ]; 201} 202#ifdef TD_PICKING_ACTIVE 203uniform int uTDPickId ; 204#endif 205int TDPickID () { 206#ifdef TD_PICKING_ACTIVE 207return uTDPickId ; 208#else 209return 0 ; 210#endif 211} 212float iTDConvertPickId (int id ) { 213id |=1073741824 ; 214return intBitsToFloat (id ); 215} 216 217void TDWritePickingValues () { 218#ifdef TD_PICKING_ACTIVE 219vec4 worldPos = TDDeform (P ); 220vec4 camPos = uTDMats [TDCameraIndex ()].cam * worldPos ; 221oTDPickVert .pickId = TDPickID (); 222#endif 223} 224vec4 TDWorldToProj (vec4 v ,vec3 uv ) 225{ 226return iTDWorldToProj (v ,uv ,TDCameraIndex (), true); 227} 228vec4 TDWorldToProj (vec3 v ,vec3 uv ) 229{ 230return TDWorldToProj (vec4 (v ,1.0 ),uv ); 231} 232vec4 TDWorldToProj (vec4 v ) 233{ 234return TDWorldToProj (v ,vec3 (0.0 )); 235} 236vec4 TDWorldToProj (vec3 v ) 237{ 238return TDWorldToProj (vec4 (v ,1.0 )); 239} 240vec4 TDPointColor () { 241return Cd ; 242}