nir: nir_lower_io_to_temporaries broken for arrays
As in #6845 (closed), there is a problem with this pass, namely for any scenario where an output is an array variable that is not completely written.
Here is the GS from the problem case:
#version 330 core
#define MAX_LIGHTS 256
#define MAX_CLIPPINGPLANES 8
#line 1
/*=============================================================================
Extension.incl, GL shader extensions to be loaded.
This data is added before any other shader data.
Revision history:
* Created by Smirftsch
=============================================================================*/
#ifdef BINDLESSTEXTURES
#extension GL_ARB_bindless_texture : require
#extension GL_ARB_gpu_shader_int64 : enable
#extension GL_ARB_shading_language_420pack : enable
#endif
#ifdef GL_ES
// The following extension appears not to be available on RaspberryPi4 at the moment.
#extension GL_EXT_clip_cull_distance : enable
precision mediump float;
precision mediump int;
#endif
// The following directive resets the line number to 1 to have the correct output logging for a possible error within the shader files.
#line 1
/*=============================================================================
Globals.incl, shader globals.
This data is added after loading extensions.
Note that #version is internally added before, depending on
if GL or GLES is being used:
if Core:
GL #version 330 core
or if UsingBindlessTextures || UsingPersistentBuffers
GL #version 450 core
if ES:
GLES #version 300 es
UsingBindlessTextures also sets #define BINDLESSTEXTURES
To see invalid or unused shader vars comment Suppress=Dev in game ini
or set UseOpenGLDebug=True and a DebugLevel>=2 (GL_DEBUG_SEVERITY_LOW)
Geometry shaders are only available in Core profile
Use #ifdef GL_ES in such cases
Using UED adds #define EDITOR
Revision history:
* Created by Smirftsch
=============================================================================*/
//Unreal 227 / UT PolyFlags. May require edits for other UE1 games.
const uint PF_None = 0x00000000u; // None.
const uint PF_Invisible = 0x00000001u; // Poly is invisible.
const uint PF_Masked = 0x00000002u; // Poly should be drawn masked.
const uint PF_Translucent = 0x00000004u; // Poly is transparent.
const uint PF_NotSolid = 0x00000008u; // Poly is not solid; doesn't block.
const uint PF_Environment = 0x00000010u; // Poly should be drawn environment mapped.
const uint PF_Semisolid = 0x00000020u; // Poly is semi-solid = collision solid; Csg nonsolid.
const uint PF_Modulated = 0x00000040u; // Modulation transparency.
const uint PF_FakeBackdrop = 0x00000080u; // Poly looks exactly like backdrop.
const uint PF_TwoSided = 0x00000100u; // Poly is visible from both sides.
const uint PF_AutoUPan = 0x00000200u; // Automatically pans in U direction.
const uint PF_AutoVPan = 0x00000400u; // Automatically pans in V direction.
const uint PF_NoSmooth = 0x00000800u; // Don't smooth textures.
const uint PF_BigWavy = 0x00001000u; // Poly has a big wavy pattern in it.
const uint PF_SpecialPoly = 0x00001000u; // Game-specific poly-level render control (reuse BigWavy flag)
const uint PF_HeightMap = 0x00001000u; // Use Macrotexture as HeightMap
const uint PF_SmallWavy = 0x00002000u; // Small wavy pattern (for water/enviro reflection).
const uint PF_Flat = 0x00004000u; // Flat surface.
const uint PF_ForceViewZone = 0x00004000u; // Force current iViewZone in OccludeBSP (reuse Flat flag)
const uint PF_LowShadowDetail = 0x00008000u; // Low detail shadows.
const uint PF_NoMerge = 0x00010000u; // Don't merge poly's nodes before lighting when rendering.
const uint PF_AlphaBlend = 0x00020000u; // This poly should be alpha blended. In UT PF_CloudWavy, but of little use without DXT3/DXT5 texture flags.
const uint PF_DirtyShadows = 0x00040000u; // Dirty shadows.
const uint PF_BrightCorners = 0x00080000u; // Brighten convex corners.
const uint PF_SpecialLit = 0x00100000u; // Only special lit lights apply to this poly.
const uint PF_Gouraud = 0x00200000u; // Gouraud shaded.
const uint PF_NoBoundRejection = 0x00200000u; // Disable bound rejection in OccludeBSP (reuse Gouraud flag)
const uint PF_Unlit = 0x00400000u; // Unlit.
const uint PF_HighShadowDetail = 0x00800000u; // High detail shadows.
const uint PF_Portal = 0x04000000u; // Portal between iZones.
const uint PF_Mirrored = 0x08000000u; // Reflective surface.
// Editor flags.
const uint PF_Memorized = 0x01000000u; // Editor: Poly is remembered.
const uint PF_Selected = 0x02000000u; // Editor: Poly is selected.
const uint PF_Highlighted = 0x10000000u; // Editor: Poly is highlighted.
const uint PF_FlatShaded = 0x40000000u; // FPoly has been split by SplitPolyWithPlane.
// Internal.
const uint PF_EdProcessed = 0x40000000u; // FPoly was already processed in editorBuildFPolys.
const uint PF_EdCut = 0x80000000u; // FPoly has been split by SplitPolyWithPlane.
const uint PF_RenderFog = 0x40000000u; // Render with fog mapping.
const uint PF_Occlude = 0x80000000u; // Occludes even if PF_NoOcclude.
const uint PF_RenderHint = 0x01000000u; // Rendering optimization hint.
#ifdef EDITOR
// enum ERenderType
const uint REN_None = 0u; // Hide completely.
const uint REN_Wire = 1u; // Wireframe of EdPolys.
const uint REN_Zones = 2u; // Show zones and zone portals.
const uint REN_Polys = 3u; // Flat-shaded Bsp.
const uint REN_PolyCuts = 4u; // Flat-shaded Bsp with normals displayed.
const uint REN_DynLight = 5u; // Illuminated texture mapping.
const uint REN_PlainTex = 6u; // Plain texture mapping.
const uint REN_OrthXY = 13u; // Orthogonal overhead (XY) view.
const uint REN_OrthXZ = 14u; // Orthogonal XZ view.
const uint REN_OrthYZ = 15u; // Orthogonal YZ view.
const uint REN_TexView = 16u; // Viewing a texture (no actor).
const uint REN_TexBrowser = 17u; // Viewing a texture browser (no actor).
const uint REN_MeshView = 18u; // Viewing a mesh.
const uint REN_LightingOnly = 19u; // Render only lights on plain white texture.
const uint REN_Normals = 20u; // Render normals only.
const uint REN_MAX = 21u;
#endif
// Spatial Lighting
const uint LE_None=0u;
const uint LE_TorchWaver=1u;
const uint LE_FireWaver=2u;
const uint LE_WateryShimmer=3u;
const uint LE_Searchlight=4u;
const uint LE_SlowWave=5u;
const uint LE_FastWave=6u;
const uint LE_CloudCast=7u;
const uint LE_StaticSpot=8u;
const uint LE_Shock=9u;
const uint LE_Disco=10u;
const uint LE_Warp=11u;
const uint LE_Spotlight=12u;
const uint LE_NonIncidence=13u;
const uint LE_Shell=14u;
const uint LE_OmniBumpMap=15u;
const uint LE_Interference=16u;
const uint LE_Cylinder=17u;
const uint LE_Rotor=18u;
const uint LE_Sunlight=19u;
const uint LE_MAX=20u;
// Light modulation
const uint LT_None=0u;
const uint LT_Steady=1u;
const uint LT_Pulse=2u;
const uint LT_Blink=3u;
const uint LT_Flicker=4u;
const uint LT_Strobe=5u;
const uint LT_BackdropLight=6u;
const uint LT_SubtlePulse=7u;
const uint LT_TexturePaletteOnce=8u;
const uint LT_TexturePaletteLoop=9u;
const uint LT_RandomPulse=10u; //using random LightPeriod.
const uint LT_RandomSubtlePulse=11u; //using random LightPeriod.
// Texture Formats
const uint TEXF_P8 = 0x00u;
const uint TEXF_BGRA8_LM = 0x01u;
const uint TEXF_R5G6B5 = 0x02u;
const uint TEXF_BC1 = 0x03u;
const uint TEXF_RGB8 = 0x04u;
const uint TEXF_BGRA8 = 0x05u;
const uint TEXF_BC2 = 0x06u;
const uint TEXF_BC3 = 0x07u;
const uint TEXF_BC4 = 0x08u;
const uint TEXF_BC4_S = 0x09u;
const uint TEXF_BC5 = 0x0au;
const uint TEXF_BC5_S = 0x0bu;
const uint TEXF_BC7 = 0x0cu;
const uint TEXF_BC6H_S = 0x0du;
const uint TEXF_BC6H = 0x0eu;
const uint TEXF_RGBA16 = 0x0fu;
const uint TEXF_RGBA16_S = 0x10u;
const uint TEXF_RGBA32 = 0x11u;
const uint TEXF_RGBA32_S = 0x12u;
const uint TEXF_MONO = 0x13u;
const uint TEXF_UNCOMPRESSED = 0x14u;
const uint TEXF_UNCOMPRESSED_LOW = 0x15u;
const uint TEXF_UNCOMPRESSED_HIGH = 0x16u;
const uint TEXF_COMPRESSED = 0x17u;
const uint TEXF_COMPRESSED_LOW = 0x18u;
const uint TEXF_COMPRESSED_HIGH = 0x19u;
const uint TEXF_BC1_PA = 0x1au;
const uint TEXF_R8 = 0x1bu;
const uint TEXF_R8_S = 0x1cu;
const uint TEXF_R16 = 0x1du;
const uint TEXF_R16_S = 0x1eu;
const uint TEXF_R32 = 0x1fu;
const uint TEXF_R32_S = 0x20u;
const uint TEXF_RG8 = 0x21u;
const uint TEXF_RG8_S = 0x22u;
const uint TEXF_RG16 = 0x23u;
const uint TEXF_RG16_S = 0x24u;
const uint TEXF_RG32 = 0x25u;
const uint TEXF_RG32_S = 0x26u;
const uint TEXF_RGB8_S = 0x27u;
const uint TEXF_RGB16_ = 0x28u;
const uint TEXF_RGB16_S = 0x29u;
const uint TEXF_RGB32 = 0x2au;
const uint TEXF_RGB32_S = 0x2bu;
const uint TEXF_RGBA8_ = 0x2cu;
const uint TEXF_RGBA8_S = 0x2du;
const uint TEXF_R16_F = 0x2eu;
const uint TEXF_R32_F = 0x2fu;
const uint TEXF_RG16_F = 0x30u;
const uint TEXF_RG32_F = 0x31u;
const uint TEXF_RGB16_F = 0x32u;
const uint TEXF_RGB32_F = 0x33u;
const uint TEXF_RGBA16_F = 0x34u;
const uint TEXF_RGBA32_F = 0x35u;
const uint TEXF_ETC1 = 0x36u;
const uint TEXF_ETC2 = 0x37u;
const uint TEXF_ETC2_PA = 0x38u;
const uint TEXF_ETC2_RGB_EAC_A = 0x39u;
const uint TEXF_EAC_R = 0x40u;
const uint TEXF_EAC_R_S = 0x41u;
const uint TEXF_EAC_RG = 0x42u;
const uint TEXF_EAC_RG_S = 0x43u;
const uint TEXF_ASTC_4x4 = 0x44u;
const uint TEXF_ASTC_5x4 = 0x45u;
const uint TEXF_ASTC_5x5 = 0x46u;
const uint TEXF_ASTC_6x5 = 0x47u;
const uint TEXF_ASTC_6x6 = 0x48u;
const uint TEXF_ASTC_8x5 = 0x49u;
const uint TEXF_ASTC_8x6 = 0x4au;
const uint TEXF_ASTC_8x8 = 0x4bu;
const uint TEXF_ASTC_10x5 = 0x4cu;
const uint TEXF_ASTC_10x6 = 0x4du;
const uint TEXF_ASTC_10x8 = 0x4eu;
const uint TEXF_ASTC_10x10 = 0x4fu;
const uint TEXF_ASTC_12x10 = 0x50u;
const uint TEXF_ASTC_12x12 = 0x51u;
const uint TEXF_ASTC_3x3x3 = 0x52u;
const uint TEXF_ASTC_4x3x3 = 0x53u;
const uint TEXF_ASTC_4x4x3 = 0x54u;
const uint TEXF_ASTC_4x4x4 = 0x55u;
const uint TEXF_ASTC_5x4x4 = 0x56u;
const uint TEXF_ASTC_5x5x4 = 0x57u;
const uint TEXF_ASTC_5x5x5 = 0x58u;
const uint TEXF_ASTC_6x5x5 = 0x59u;
const uint TEXF_ASTC_6x6x5 = 0x60u;
const uint TEXF_ASTC_6x6x6 = 0x6au;
const uint TEXF_PVRTC1_2BPP = 0x6bu;
const uint TEXF_PVRTC1_4BPP = 0x6cu;
const uint TEXF_PVRTC2_2BPP = 0x6du;
const uint TEXF_PVRTC2_4BPP = 0x6eu;
const uint TEXF_R8_UI = 0x6fu;
const uint TEXF_R8_I = 0x70u;
const uint TEXF_R16_UI = 0x71u;
const uint TEXF_R16_I = 0x72u;
const uint TEXF_R32_UI = 0x73u;
const uint TEXF_R32_I = 0x74u;
const uint TEXF_RG8_UI = 0x75u;
const uint TEXF_RG8_I = 0x76u;
const uint TEXF_RG16_UI = 0x77u;
const uint TEXF_RG16_I = 0x78u;
const uint TEXF_RG32_UI = 0x79u;
const uint TEXF_RG32_I = 0x7au;
const uint TEXF_RGB8_UI = 0x7bu;
const uint TEXF_RGB8_I = 0x7cu;
const uint TEXF_RGB16_UI = 0x7du;
const uint TEXF_RGB16_I = 0x7eu;
const uint TEXF_RGB32_UI = 0x7fu;
const uint TEXF_RGB32_I = 0x80u;
const uint TEXF_RGBA8_UI = 0x81u;
const uint TEXF_RGBA8_I = 0x82u;
const uint TEXF_RGBA16_UI = 0x83u;
const uint TEXF_RGBA16_I = 0x84u;
const uint TEXF_RGBA32_UI = 0x85u;
const uint TEXF_RGBA32_I = 0x86u;
const uint TEXF_ARGB8 = 0x87u;
const uint TEXF_ABGR8 = 0x88u;
const uint TEXF_RGB10A2 = 0x89u;
const uint TEXF_RGB10A2_UI = 0x8au;
const uint TEXF_RGB10A2_LM = 0x8bu;
const uint TEXF_RGB9E5 = 0x8cu;
const uint TEXF_P8_RGB9E5 = 0x8du;
const uint TEXF_R1 = 0x8eu;
const uint TEXF_NODATA = 0xfeu;
const uint TEXF_MAX = 0xffu;
// DrawFlags
const uint DF_DiffuseTexture = 0x00000001u;
const uint DF_DetailTexture = 0x00000002u;
const uint DF_MacroTexture = 0x00000004u;
const uint DF_BumpMap = 0x00000008u;
const uint DF_LightMap = 0x00000010u;
const uint DF_FogMap = 0x00000020u;
const uint DF_EnvironmentMap = 0x00000040u;
layout(std140) uniform GlobalMatrices
{
mat4 modelMat;
mat4 viewMat;
mat4 projMat;
mat4 lightSpaceMat;
};
layout(std140) uniform ClipPlaneParams
{
vec4 ClipParams; // Clipping params, ClipIndex,0,0,0
vec4 ClipPlane; // Clipping planes. Plane.X, Plane.Y, Plane.Z, Plane.W
};
// Light information.
layout(std140) uniform StaticLightInfo
{
vec4 LightPos[MAX_LIGHTS];
vec4 LightData1[MAX_LIGHTS]; // LightBrightness, LightHue, LightSaturation, LightCone
vec4 LightData2[MAX_LIGHTS]; // LightEffect, LightPeriod, LightPhase, LightRadius
vec4 LightData3[MAX_LIGHTS]; // LightType, VolumeBrightness, VolumeFog, VolumeRadius
vec4 LightData4[MAX_LIGHTS]; // WorldLightRadius, NumLights, ZoneNumber, CameraRegion->ZoneNumber
vec4 LightData5[MAX_LIGHTS]; // NormalLightRadius, bZoneNormalLight, unused, unused
};
layout(std140) uniform DistanceFogParams
{
vec4 DistanceFogColor; // Fog color
vec4 DistanceFogValues;
};
layout(std140) uniform GlobalCoords
{
mat4 FrameCoords;
mat4 FrameUncoords;
};
#ifdef BINDLESSTEXTURES
layout(std140) uniform TextureHandles
{
sampler2D Textures[NUMTEXTURES];
};
#endif
//DistanceFog
struct FogParameters
{
vec4 FogColor; // Fog color
float FogStart; // Only for linear fog
float FogEnd; // Only for linear fog
float FogDensity; // For exp and exp2 equation
float FogCoord;
int FogMode; // 0 = linear, 1 = exp, 2 = exp2
};
float getFogFactor(FogParameters DistanceFog)
{
// DistanceFogValues.x = FogStart
// DistanceFogValues.y = FogEnd
// DistanceFogValues.z = FogDensity
// DistanceFogValues.w = FogMode
//FogResult = (Values.y-FogCoord)/(Values.y-Values.x);
float FogResult = 1.0;
if(DistanceFog.FogMode == 0 )
FogResult = ((DistanceFog.FogEnd-DistanceFog.FogCoord)/(DistanceFog.FogEnd-DistanceFog.FogStart));
else if(DistanceFog.FogMode == 1)
FogResult = exp(-DistanceFog.FogDensity*DistanceFog.FogCoord);
else if(DistanceFog.FogMode == 2)
FogResult = exp(-pow(DistanceFog.FogDensity*DistanceFog.FogCoord, 2.0));
FogResult = 1.0-clamp(FogResult, 0.0, 1.0);
return FogResult;
}
float PlaneDot( vec4 Plane, vec3 Point )
{
return dot(Plane.xyz,Point)-Plane.w;
}
// The following directive resets the line number to 1 to have the correct output logging for a possible error within the shader files.
#line 1
/*=============================================================================
Geometryshader for DrawGouraud
For BumpMap (normal map), tangent and bitangent calculation.
Read https://wiki.delphigl.com/index.php/TBN_Matrix
Revision history:
* Created by Smirftsch
=============================================================================*/
layout(triangles) in;
layout(triangle_strip, max_vertices=3) out;
flat in uint vTexNum[];
flat in uint vDetailTexNum[];
flat in uint vBumpTexNum[];
flat in uint vDrawFlags[];
flat in uint vTextureFormat[];
in vec4 vTexUV[];
in vec2 vTexCoords[];
in vec3 vCoords[];
in vec4 vNormals[];
in vec4 vEyeSpacePos[];
in vec4 vLightColor[];
in vec4 vFogColor[];
in vec4 vDistanceFogColor[];
in vec2 vDetailTexUV[];
in vec4 vLightSpacePos[];
in vec4 vTextureInfo[];
flat out uint gTexNum;
flat out uint gDetailTexNum;
flat out uint gBumpTexNum;
flat out uint gDrawFlags;
flat out uint gTextureFormat;
out vec4 gTexUV;
out vec2 gTexCoords;
out vec3 gCoords;
out vec4 gNormals;
out vec4 gEyeSpacePos;
out vec4 gLightColor;
out vec4 gFogColor;
out vec2 gDetailTexUV;
out vec4 gLightSpacePos;
out vec4 gTextureInfo;
out mat3 TBNMat;
out float gl_ClipDistance[MAX_CLIPPINGPLANES];
vec3 GetTangent(vec3 A, vec3 B, vec3 C, vec2 Auv, vec2 Buv, vec2 Cuv)
{
float Bv_Cv = Buv.y - Cuv.y;
if(Bv_Cv == 0.0)
return (B-C)/(Buv.x-Cuv.x);
float Quotient = (Auv.y - Cuv.y)/(Bv_Cv);
vec3 D = C + (B -C) * Quotient;
vec2 Duv = Cuv + (Buv-Cuv) * Quotient;
return (D-A)/(Duv.x - Auv.x);
}
vec3 GetBitangent(vec3 A, vec3 B, vec3 C, vec2 Auv, vec2 Buv, vec2 Cuv)
{
return GetTangent(A, C, B, Auv.yx, Cuv.yx, Buv.yx);
}
void main(void)
{
vec3 Tangent = GetTangent(vCoords[0], vCoords[1], vCoords[2], vTexCoords[0], vTexCoords[1], vTexCoords[2]);
vec3 Bitangent = GetBitangent(vCoords[0], vCoords[1], vCoords[2], vTexCoords[0], vTexCoords[1], vTexCoords[2]);
uint ClipIndex = uint(ClipParams.x);
for(int i=0; i<3; ++i)
{
mat4 vmodelviewprojMat = projMat * viewMat * modelMat;
vec3 T = normalize(vec3(modelMat[i] * vec4(Tangent,0.0)));
vec3 B = normalize(vec3(modelMat[i] * vec4(Bitangent,0.0)));
vec3 N = normalize(vec3(modelMat[i] * vNormals[i]));
// TBN must have right handed coord system.
if (dot(cross(N, T), B) < 0.0)
T = T * -1.0;
TBNMat = mat3(T, B, N);
gEyeSpacePos = vEyeSpacePos[i];
gLightColor = vLightColor[i];
gFogColor = vFogColor[i];
gTexUV = vTexUV[i];
gDetailTexUV = vDetailTexUV[i];
gNormals = vNormals[i];
gTexCoords = vTexCoords[i];
gCoords = vCoords[i];
gTexNum = vTexNum[i];
gDetailTexNum = vDetailTexNum[i];
gBumpTexNum = vBumpTexNum[i];
gLightSpacePos = vLightSpacePos[i];
gTextureInfo = vTextureInfo[i];
gDrawFlags = vDrawFlags[i];
gTextureFormat = vTextureFormat[i];
gl_Position = vmodelviewprojMat * gl_in[i].gl_Position;
gl_ClipDistance[ClipIndex] = PlaneDot(ClipPlane,vCoords[i]);//
EmitVertex();
}
}
Note that gl_ClipDistance
is only ever indexed indirectly, which leads to:
shader: MESA_SHADER_GEOMETRY
source_sha1: {0x206be23e, 0xbc857f66, 0xebb24ceb, 0x5f126969, 0x4f43b8de}
name: GLSL12
inputs: 0
outputs: 0
uniforms: 0
ubos: 5
shared: 0
ray queries: 0
invocations: 1
vertices in: 3
vertices out: 6
input primitive: TRIANGLES
output primitive: TRIANGLE_STRIP
active_stream_mask: 0x1
uses_end_primitive: 1
decl_var ubo INTERP_MODE_NONE mat4x16a0B FrameUncoords (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE mat4x16a0B FrameCoords (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE vec4 DistanceFogValues (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE vec4 DistanceFogColor (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE vec4[256] LightData5 (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE vec4[256] LightData4 (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE vec4[256] LightData3 (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE vec4[256] LightData2 (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE vec4[256] LightData1 (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE vec4[256] LightPos (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE vec4 ClipPlane (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE vec4 ClipParams (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE mat4x16a0B lightSpaceMat (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE mat4x16a0B projMat (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE mat4x16a0B viewMat (~0, 0, 0)
decl_var ubo INTERP_MODE_NONE mat4x16a0B modelMat (~0, 0, 0)
decl_var INTERP_MODE_NONE vec4[3] in@gl_Position-temp
decl_var INTERP_MODE_FLAT uint[3] in@vTexNum-temp
decl_var INTERP_MODE_NONE vec4[3] in@vTexCoords0-temp
decl_var INTERP_MODE_NONE vec4[3] in@vTexCoords1-temp
decl_var INTERP_MODE_NONE vec4[3] in@vTexCoords2-temp
decl_var INTERP_MODE_NONE vec4[3] in@vDrawColor-temp
decl_var INTERP_MODE_NONE vec3[3] in@vCoords-temp
decl_var INTERP_MODE_NONE float[8] out@gl_ClipDistance-temp
decl_var INTERP_MODE_NONE vec4 out@gl_Position-temp
decl_var INTERP_MODE_NONE vec2 out@gTexCoords-temp
decl_var INTERP_MODE_NONE vec4 out@gDrawColor-temp
decl_var INTERP_MODE_FLAT uint out@gTexNum-temp
decl_var INTERP_MODE_SMOOTH float out@gl_PointSizeMESA-temp
decl_var shader_in INTERP_MODE_NONE vec4[3] gl_Position (VARYING_SLOT_POS.xyzw, 0, 0)
decl_var shader_in INTERP_MODE_FLAT uint[3] vTexNum (UNKNOWN.x, 0, 0)
decl_var shader_in INTERP_MODE_NONE vec4[3] vTexCoords0 (UNKNOWN.xyzw, 0, 0)
decl_var shader_in INTERP_MODE_NONE vec4[3] vTexCoords1 (UNKNOWN.xyzw, 0, 0)
decl_var shader_in INTERP_MODE_NONE vec4[3] vTexCoords2 (UNKNOWN.xyzw, 0, 0)
decl_var shader_in INTERP_MODE_NONE vec4[3] vDrawColor (UNKNOWN.xyzw, 0, 0)
decl_var shader_in INTERP_MODE_NONE vec3[3] vCoords (UNKNOWN.xyz, 0, 0)
decl_var shader_out INTERP_MODE_NONE float[8] gl_ClipDistance (VARYING_SLOT_CLIP_DIST0.x, 0, 0) compact
decl_var shader_out INTERP_MODE_NONE vec4 gl_Position@0 (VARYING_SLOT_POS.xyzw, 0, 0)
decl_var shader_out INTERP_MODE_NONE vec2 gTexCoords (UNKNOWN.xy, 0, 0)
decl_var shader_out INTERP_MODE_NONE vec4 gDrawColor (UNKNOWN.xyzw, 0, 0)
decl_var shader_out INTERP_MODE_FLAT uint gTexNum (UNKNOWN.x, 0, 0)
decl_var shader_out INTERP_MODE_SMOOTH float gl_PointSizeMESA (VARYING_SLOT_PSIZ.x, 0, 0)
decl_function main (0 params)
impl main {
<snip>
vec1 32 ssa_1289 = deref_var &ClipIndex (function_temp uint)
vec1 32 ssa_1290 = intrinsic load_deref (ssa_1289) (access=0)
vec1 32 ssa_1291 = deref_var &out@gl_ClipDistance-temp (shader_temp float[8])
vec1 32 ssa_1292 = deref_array &(*ssa_1291)[ssa_1290] (shader_temp float) /* &out@gl_ClipDistance-temp[ssa_1290] */
vec1 32 ssa_1293 = deref_var &ClipPlane (ubo vec4)
vec4 32 ssa_1294 = intrinsic load_deref (ssa_1293) (access=0)
vec3 32 ssa_1295 = mov ssa_1294.xyz
vec1 32 ssa_1296 = deref_var &const_temp@162 (function_temp int)
vec1 32 ssa_1297 = intrinsic load_deref (ssa_1296) (access=0)
vec1 32 ssa_1298 = deref_var &in@vCoords-temp (shader_temp vec3[3])
vec1 32 ssa_1299 = deref_array &(*ssa_1298)[ssa_1297] (shader_temp vec3) /* &in@vCoords-temp[ssa_1297] */
vec3 32 ssa_1300 = intrinsic load_deref (ssa_1299) (access=0)
vec1 32 ssa_1301 = fdot3 ssa_1295, ssa_1300
vec1 32 ssa_1302 = deref_var &ClipPlane (ubo vec4)
vec4 32 ssa_1303 = intrinsic load_deref (ssa_1302) (access=0)
vec1 32 ssa_1304 = mov ssa_1303.w
vec1 32 ssa_1305 = fneg ssa_1304
vec1 32 ssa_1306 = fadd ssa_1301, ssa_1305
intrinsic store_deref (ssa_1292, ssa_1306) (wrmask=x /*1*/, access=0)
vec1 32 ssa_1913 = deref_var &out@gl_ClipDistance-temp (shader_temp float[8])
vec1 32 ssa_1914 = deref_var &gl_ClipDistance (shader_out float[8])
intrinsic copy_deref (ssa_1914, ssa_1913) (dst_access=0, src_access=0)
vec1 32 ssa_1915 = deref_var &out@gl_Position-temp (shader_temp vec4)
vec1 32 ssa_1916 = deref_var &gl_Position@0 (shader_out vec4)
intrinsic copy_deref (ssa_1916, ssa_1915) (dst_access=0, src_access=0)
vec1 32 ssa_1917 = deref_var &out@gTexCoords-temp (shader_temp vec2)
vec1 32 ssa_1918 = deref_var &gTexCoords (shader_out vec2)
intrinsic copy_deref (ssa_1918, ssa_1917) (dst_access=0, src_access=0)
vec1 32 ssa_1919 = deref_var &out@gDrawColor-temp (shader_temp vec4)
vec1 32 ssa_1920 = deref_var &gDrawColor (shader_out vec4)
intrinsic copy_deref (ssa_1920, ssa_1919) (dst_access=0, src_access=0)
vec1 32 ssa_1921 = deref_var &out@gTexNum-temp (shader_temp uint)
vec1 32 ssa_1922 = deref_var &gTexNum (shader_out uint)
intrinsic copy_deref (ssa_1922, ssa_1921) (dst_access=0, src_access=0)
vec1 32 ssa_1923 = deref_var &out@gl_PointSizeMESA-temp (shader_temp float)
vec1 32 ssa_1924 = deref_var &gl_PointSizeMESA (shader_out float)
intrinsic copy_deref (ssa_1924, ssa_1923) (dst_access=0, src_access=0)
intrinsic emit_vertex () (stream_id=0)
intrinsic end_primitive () (stream_id=0)
/* succs: block_1 */
block block_1:
}
Note here that the full array of out@gl_ClipDistance-temp
is copied to gl_ClipDistance
even though only one component is written, meaning the other 7 components have garbage data.
Edited by Mike Blumenkrantz