| SKIP: FAILED | |
| ../../src/tint/lang/msl/writer/printer/printer.cc:500 internal compiler error: Camera = struct @align(16) { | |
| projection:mat4x4<f32> @offset(0) | |
| inverseProjection:mat4x4<f32> @offset(64) | |
| view:mat4x4<f32> @offset(128) | |
| position:vec3<f32> @offset(192) | |
| time:f32 @offset(204) | |
| outputSize:vec2<f32> @offset(208) | |
| zNear:f32 @offset(216) | |
| zFar:f32 @offset(220) | |
| } | |
| ClusterLights = struct @align(4) { | |
| offset:u32 @offset(0) | |
| count:u32 @offset(4) | |
| } | |
| ClusterLightGroup = struct @align(4) { | |
| offset:u32 @offset(0) | |
| lights:array<ClusterLights, 27648> @offset(4) | |
| indices:array<u32, 1769472> @offset(221188) | |
| } | |
| Light = struct @align(16) { | |
| position:vec3<f32> @offset(0) | |
| range:f32 @offset(12) | |
| color:vec3<f32> @offset(16) | |
| intensity:f32 @offset(28) | |
| } | |
| GlobalLights = struct @align(16) { | |
| ambient:vec3<f32> @offset(0) | |
| dirColor:vec3<f32> @offset(16) | |
| dirIntensity:f32 @offset(28) | |
| dirDirection:vec3<f32> @offset(32) | |
| lightCount:u32 @offset(44) | |
| lights:array<Light> @offset(48) | |
| } | |
| LightShadowTable = struct @align(4) { | |
| light:array<i32> @offset(0) | |
| } | |
| ShadowProperties = struct @align(16) { | |
| viewport:vec4<f32> @offset(0) | |
| viewProj:mat4x4<f32> @offset(16) | |
| } | |
| LightShadows = struct @align(16) { | |
| properties:array<ShadowProperties> @offset(0) | |
| } | |
| Material = struct @align(16) { | |
| baseColorFactor:vec4<f32> @offset(0) | |
| emissiveFactor:vec3<f32> @offset(16) | |
| occlusionStrength:f32 @offset(28) | |
| metallicRoughnessFactor:vec2<f32> @offset(32) | |
| alphaCutoff:f32 @offset(40) | |
| } | |
| SurfaceInfo = struct @align(16) { | |
| baseColor:vec4<f32> @offset(0) | |
| albedo:vec3<f32> @offset(16) | |
| metallic:f32 @offset(28) | |
| roughness:f32 @offset(32) | |
| normal:vec3<f32> @offset(48) | |
| f0:vec3<f32> @offset(64) | |
| ao:f32 @offset(76) | |
| emissive:vec3<f32> @offset(80) | |
| v:vec3<f32> @offset(96) | |
| } | |
| VertexOutput = struct @align(16) { | |
| position:vec4<f32> @offset(0), @builtin(position) | |
| worldPos:vec3<f32> @offset(16), @location(0) | |
| view:vec3<f32> @offset(32), @location(1) | |
| texcoord:vec2<f32> @offset(48), @location(2) | |
| texcoord2:vec2<f32> @offset(56), @location(3) | |
| color:vec4<f32> @offset(64), @location(4) | |
| instanceColor:vec4<f32> @offset(80), @location(5) | |
| normal:vec3<f32> @offset(96), @location(6) | |
| tangent:vec3<f32> @offset(112), @location(7) | |
| bitangent:vec3<f32> @offset(128), @location(8) | |
| } | |
| PuctualLight = struct @align(16) { | |
| lightType:u32 @offset(0) | |
| pointToLight:vec3<f32> @offset(16) | |
| range:f32 @offset(28) | |
| color:vec3<f32> @offset(32) | |
| intensity:f32 @offset(44) | |
| } | |
| FragmentOutput = struct @align(16) { | |
| color:vec4<f32> @offset(0), @location(0) | |
| emissive:vec4<f32> @offset(16), @location(1) | |
| } | |
| $B1: { # root | |
| %camera:ptr<uniform, Camera, read> = var @binding_point(0, 0) | |
| %clusterLights:ptr<storage, ClusterLightGroup, read> = var @binding_point(0, 1) | |
| %globalLights:ptr<storage, GlobalLights, read> = var @binding_point(0, 2) | |
| %defaultSampler:ptr<handle, sampler, read> = var @binding_point(0, 3) | |
| %shadowTexture:ptr<handle, texture_depth_2d, read> = var @binding_point(0, 4) | |
| %shadowSampler:ptr<handle, sampler_comparison, read> = var @binding_point(0, 5) | |
| %lightShadowTable:ptr<storage, LightShadowTable, read> = var @binding_point(0, 6) | |
| %shadowSampleOffsets:ptr<private, array<vec2<f32>, 16>, read_write> = var, array<vec2<f32>, 16>(vec2<f32>(-1.5f), vec2<f32>(-1.5f, -0.5f), vec2<f32>(-1.5f, 0.5f), vec2<f32>(-1.5f, 1.5f), vec2<f32>(-0.5f, -1.5f), vec2<f32>(-0.5f), vec2<f32>(-0.5f, 0.5f), vec2<f32>(-0.5f, 1.5f), vec2<f32>(0.5f, -1.5f), vec2<f32>(0.5f, -0.5f), vec2<f32>(0.5f), vec2<f32>(0.5f, 1.5f), vec2<f32>(1.5f, -1.5f), vec2<f32>(1.5f, -0.5f), vec2<f32>(1.5f, 0.5f), vec2<f32>(1.5f)) | |
| %shadow:ptr<storage, LightShadows, read> = var @binding_point(0, 7) | |
| %material:ptr<uniform, Material, read> = var @binding_point(0, 8) | |
| %baseColorTexture:ptr<handle, texture_2d<f32>, read> = var @binding_point(0, 9) | |
| %baseColorSampler:ptr<handle, sampler, read> = var @binding_point(0, 10) | |
| %normalTexture:ptr<handle, texture_2d<f32>, read> = var @binding_point(0, 11) | |
| %normalSampler:ptr<handle, sampler, read> = var @binding_point(0, 12) | |
| %metallicRoughnessTexture:ptr<handle, texture_2d<f32>, read> = var @binding_point(0, 13) | |
| %metallicRoughnessSampler:ptr<handle, sampler, read> = var @binding_point(0, 14) | |
| %occlusionTexture:ptr<handle, texture_2d<f32>, read> = var @binding_point(0, 15) | |
| %occlusionSampler:ptr<handle, sampler, read> = var @binding_point(0, 16) | |
| %emissiveTexture:ptr<handle, texture_2d<f32>, read> = var @binding_point(0, 17) | |
| %emissiveSampler:ptr<handle, sampler, read> = var @binding_point(0, 18) | |
| %ssaoTexture:ptr<handle, texture_2d<f32>, read> = var @binding_point(0, 19) | |
| } | |
| %linearTosRGB = func(%linear:vec3<f32>):vec3<f32> { | |
| $B2: { | |
| %INV_GAMMA:f32 = let 0.45454543828964233398f | |
| %25:vec3<f32> = construct %INV_GAMMA | |
| %26:vec3<f32> = pow %linear, %25 | |
| ret %26 | |
| } | |
| } | |
| %sRGBToLinear = func(%srgb:vec3<f32>):vec3<f32> { | |
| $B3: { | |
| %29:vec3<f32> = pow %srgb, vec3<f32>(2.20000004768371582031f) | |
| ret %29 | |
| } | |
| } | |
| %linearDepth = func(%depthSample:f32):f32 { | |
| $B4: { | |
| %32:ptr<uniform, f32, read> = access %camera, 7u | |
| %33:f32 = load %32 | |
| %34:ptr<uniform, f32, read> = access %camera, 6u | |
| %35:f32 = load %34 | |
| %36:f32 = mul %33, %35 | |
| %37:f32 = let %36 | |
| %38:ptr<uniform, f32, read> = access %camera, 6u | |
| %39:f32 = load %38 | |
| %40:ptr<uniform, f32, read> = access %camera, 7u | |
| %41:f32 = load %40 | |
| %42:f32 = sub %39, %41 | |
| %43:ptr<uniform, f32, read> = access %camera, 7u | |
| %44:f32 = load %43 | |
| %45:f32 = fma %depthSample, %42, %44 | |
| %46:f32 = div %37, %45 | |
| ret %46 | |
| } | |
| } | |
| %getTile = func(%fragCoord:vec4<f32>):vec3<u32> { | |
| $B5: { | |
| %49:ptr<uniform, f32, read> = access %camera, 7u | |
| %50:f32 = load %49 | |
| %51:ptr<uniform, f32, read> = access %camera, 6u | |
| %52:f32 = load %51 | |
| %53:f32 = div %50, %52 | |
| %54:f32 = log2 %53 | |
| %55:f32 = div 48.0f, %54 | |
| %sliceScale:f32 = let %55 | |
| %57:ptr<uniform, f32, read> = access %camera, 6u | |
| %58:f32 = load %57 | |
| %59:f32 = log2 %58 | |
| %60:f32 = mul 48.0f, %59 | |
| %61:f32 = let %60 | |
| %62:ptr<uniform, f32, read> = access %camera, 7u | |
| %63:f32 = load %62 | |
| %64:ptr<uniform, f32, read> = access %camera, 6u | |
| %65:f32 = load %64 | |
| %66:f32 = div %63, %65 | |
| %67:f32 = log2 %66 | |
| %68:f32 = div %61, %67 | |
| %69:f32 = negation %68 | |
| %sliceBias:f32 = let %69 | |
| %71:f32 = access %fragCoord, 2u | |
| %72:f32 = call %linearDepth, %71 | |
| %73:f32 = log2 %72 | |
| %74:f32 = mul %73, %sliceScale | |
| %75:f32 = add %74, %sliceBias | |
| %76:f32 = max %75, 0.0f | |
| %77:u32 = call %tint_f32_to_u32, %76 | |
| %zTile:u32 = let %77 | |
| %80:f32 = access %fragCoord, 0u | |
| %81:ptr<uniform, vec2<f32>, read> = access %camera, 5u | |
| %82:f32 = load_vector_element %81, 0u | |
| %83:f32 = div %82, 32.0f | |
| %84:f32 = div %80, %83 | |
| %85:u32 = call %tint_f32_to_u32, %84 | |
| %86:u32 = let %85 | |
| %87:f32 = access %fragCoord, 1u | |
| %88:ptr<uniform, vec2<f32>, read> = access %camera, 5u | |
| %89:f32 = load_vector_element %88, 1u | |
| %90:f32 = div %89, 18.0f | |
| %91:f32 = div %87, %90 | |
| %92:u32 = call %tint_f32_to_u32, %91 | |
| %93:vec3<u32> = construct %86, %92, %zTile | |
| ret %93 | |
| } | |
| } | |
| %getClusterIndex = func(%fragCoord_1:vec4<f32>):u32 { # %fragCoord_1: 'fragCoord' | |
| $B6: { | |
| %96:vec3<u32> = call %getTile, %fragCoord_1 | |
| %tile:vec3<u32> = let %96 | |
| %98:u32 = access %tile, 0u | |
| %99:u32 = access %tile, 1u | |
| %100:u32 = mul %99, 32u | |
| %101:u32 = add %98, %100 | |
| %102:u32 = access %tile, 2u | |
| %103:u32 = mul %102, 32u | |
| %104:u32 = mul %103, 18u | |
| %105:u32 = add %101, %104 | |
| ret %105 | |
| } | |
| } | |
| %dirLightVisibility = func(%worldPos:vec3<f32>):f32 { | |
| $B7: { | |
| %108:ptr<storage, i32, read> = access %lightShadowTable, 0u, 0u | |
| %109:i32 = load %108 | |
| %shadowIndex:i32 = let %109 | |
| %111:bool = eq %shadowIndex, -1i | |
| if %111 [t: $B8] { # if_1 | |
| $B8: { # true | |
| ret 1.0f | |
| } | |
| } | |
| %112:ptr<storage, vec4<f32>, read> = access %shadow, 0u, %shadowIndex, 0u | |
| %113:vec4<f32> = load %112 | |
| %viewport:vec4<f32> = let %113 | |
| %115:ptr<storage, mat4x4<f32>, read> = access %shadow, 0u, %shadowIndex, 1u | |
| %116:mat4x4<f32> = load %115 | |
| %117:mat4x4<f32> = let %116 | |
| %118:vec4<f32> = construct %worldPos, 1.0f | |
| %119:vec4<f32> = mul %117, %118 | |
| %lightPos:vec4<f32> = let %119 | |
| %121:vec2<f32> = swizzle %lightPos, xy | |
| %122:f32 = access %lightPos, 3u | |
| %123:vec2<f32> = div %121, %122 | |
| %124:vec2<f32> = mul %123, vec2<f32>(0.5f, -0.5f) | |
| %125:vec2<f32> = add %124, vec2<f32>(0.5f) | |
| %126:f32 = access %lightPos, 2u | |
| %127:f32 = access %lightPos, 3u | |
| %128:f32 = div %126, %127 | |
| %129:vec3<f32> = construct %125, %128 | |
| %shadowPos:vec3<f32> = let %129 | |
| %131:vec2<f32> = swizzle %viewport, xy | |
| %132:vec2<f32> = swizzle %shadowPos, xy | |
| %133:vec2<f32> = swizzle %viewport, zw | |
| %134:vec2<f32> = mul %132, %133 | |
| %135:vec2<f32> = add %131, %134 | |
| %136:vec2<f32> = construct %135 | |
| %viewportPos:vec2<f32> = let %136 | |
| %138:texture_depth_2d = load %shadowTexture | |
| %139:vec2<u32> = textureDimensions %138, 0i | |
| %140:vec2<f32> = convert %139 | |
| %141:vec2<f32> = div 1.0f, %140 | |
| %texelSize:vec2<f32> = let %141 | |
| %143:vec2<f32> = swizzle %viewport, xy | |
| %144:vec2<f32> = sub %143, %texelSize | |
| %145:vec2<f32> = swizzle %viewport, xy | |
| %146:vec2<f32> = swizzle %viewport, zw | |
| %147:vec2<f32> = add %145, %146 | |
| %148:vec2<f32> = add %147, %texelSize | |
| %149:vec4<f32> = construct %144, %148 | |
| %clampRect:vec4<f32> = let %149 | |
| %visibility:ptr<function, f32, read_write> = var, 0.0f | |
| loop [i: $B9, b: $B10, c: $B11] { # loop_1 | |
| $B9: { # initializer | |
| %i:ptr<function, u32, read_write> = var, 0u | |
| next_iteration # -> $B10 | |
| } | |
| $B10: { # body | |
| %153:u32 = load %i | |
| %154:bool = lt %153, 16u | |
| if %154 [t: $B12, f: $B13] { # if_2 | |
| $B12: { # true | |
| exit_if # if_2 | |
| } | |
| $B13: { # false | |
| exit_loop # loop_1 | |
| } | |
| } | |
| %155:f32 = load %visibility | |
| %156:f32 = let %155 | |
| %157:texture_depth_2d = load %shadowTexture | |
| %158:texture_depth_2d = let %157 | |
| %159:sampler_comparison = load %shadowSampler | |
| %160:sampler_comparison = let %159 | |
| %161:u32 = load %i | |
| %162:ptr<private, vec2<f32>, read_write> = access %shadowSampleOffsets, %161 | |
| %163:vec2<f32> = load %162 | |
| %164:vec2<f32> = mul %163, %texelSize | |
| %165:vec2<f32> = add %viewportPos, %164 | |
| %166:vec2<f32> = swizzle %clampRect, xy | |
| %167:vec2<f32> = swizzle %clampRect, zw | |
| %168:vec2<f32> = clamp %165, %166, %167 | |
| %169:f32 = access %shadowPos, 2u | |
| %170:f32 = sub %169, 0.00300000002607703209f | |
| %171:f32 = textureSampleCompareLevel %158, %160, %168, %170 | |
| %172:f32 = add %156, %171 | |
| store %visibility, %172 | |
| continue # -> $B11 | |
| } | |
| $B11: { # continuing | |
| %173:u32 = load %i | |
| %174:u32 = add %173, 1u | |
| store %i, %174 | |
| next_iteration # -> $B10 | |
| } | |
| } | |
| %175:f32 = load %visibility | |
| %176:f32 = div %175, 16.0f | |
| ret %176 | |
| } | |
| } | |
| %getCubeFace = func(%v:vec3<f32>):i32 { | |
| $B14: { | |
| %179:vec3<f32> = abs %v | |
| %vAbs:vec3<f32> = let %179 | |
| %181:f32 = access %vAbs, 2u | |
| %182:f32 = access %vAbs, 0u | |
| %183:bool = gte %181, %182 | |
| %184:bool = if %183 [t: $B15, f: $B16] { # if_3 | |
| $B15: { # true | |
| %185:f32 = access %vAbs, 2u | |
| %186:f32 = access %vAbs, 1u | |
| %187:bool = gte %185, %186 | |
| exit_if %187 # if_3 | |
| } | |
| $B16: { # false | |
| exit_if false # if_3 | |
| } | |
| } | |
| if %184 [t: $B17] { # if_4 | |
| $B17: { # true | |
| %188:f32 = access %v, 2u | |
| %189:bool = lt %188, 0.0f | |
| if %189 [t: $B18] { # if_5 | |
| $B18: { # true | |
| ret 5i | |
| } | |
| } | |
| ret 4i | |
| } | |
| } | |
| %190:f32 = access %vAbs, 1u | |
| %191:f32 = access %vAbs, 0u | |
| %192:bool = gte %190, %191 | |
| if %192 [t: $B19] { # if_6 | |
| $B19: { # true | |
| %193:f32 = access %v, 1u | |
| %194:bool = lt %193, 0.0f | |
| if %194 [t: $B20] { # if_7 | |
| $B20: { # true | |
| ret 3i | |
| } | |
| } | |
| ret 2i | |
| } | |
| } | |
| %195:f32 = access %v, 0u | |
| %196:bool = lt %195, 0.0f | |
| if %196 [t: $B21] { # if_8 | |
| $B21: { # true | |
| ret 1i | |
| } | |
| } | |
| ret 0i | |
| } | |
| } | |
| %pointLightVisibility = func(%lightIndex:u32, %worldPos_1:vec3<f32>, %pointToLight:vec3<f32>):f32 { # %worldPos_1: 'worldPos' | |
| $B22: { | |
| %201:u32 = add %lightIndex, 1u | |
| %202:ptr<storage, i32, read> = access %lightShadowTable, 0u, %201 | |
| %203:i32 = load %202 | |
| %shadowIndex_1:ptr<function, i32, read_write> = var, %203 # %shadowIndex_1: 'shadowIndex' | |
| %205:i32 = load %shadowIndex_1 | |
| %206:bool = eq %205, -1i | |
| if %206 [t: $B23] { # if_9 | |
| $B23: { # true | |
| ret 1.0f | |
| } | |
| } | |
| %207:i32 = load %shadowIndex_1 | |
| %208:i32 = let %207 | |
| %209:vec3<f32> = mul %pointToLight, -1.0f | |
| %210:i32 = call %getCubeFace, %209 | |
| %211:i32 = add %208, %210 | |
| store %shadowIndex_1, %211 | |
| %212:i32 = load %shadowIndex_1 | |
| %213:ptr<storage, vec4<f32>, read> = access %shadow, 0u, %212, 0u | |
| %214:vec4<f32> = load %213 | |
| %viewport_1:vec4<f32> = let %214 # %viewport_1: 'viewport' | |
| %216:i32 = load %shadowIndex_1 | |
| %217:ptr<storage, mat4x4<f32>, read> = access %shadow, 0u, %216, 1u | |
| %218:mat4x4<f32> = load %217 | |
| %219:mat4x4<f32> = let %218 | |
| %220:vec4<f32> = construct %worldPos_1, 1.0f | |
| %221:vec4<f32> = mul %219, %220 | |
| %lightPos_1:vec4<f32> = let %221 # %lightPos_1: 'lightPos' | |
| %223:vec2<f32> = swizzle %lightPos_1, xy | |
| %224:f32 = access %lightPos_1, 3u | |
| %225:vec2<f32> = div %223, %224 | |
| %226:vec2<f32> = mul %225, vec2<f32>(0.5f, -0.5f) | |
| %227:vec2<f32> = add %226, vec2<f32>(0.5f) | |
| %228:f32 = access %lightPos_1, 2u | |
| %229:f32 = access %lightPos_1, 3u | |
| %230:f32 = div %228, %229 | |
| %231:vec3<f32> = construct %227, %230 | |
| %shadowPos_1:vec3<f32> = let %231 # %shadowPos_1: 'shadowPos' | |
| %233:vec2<f32> = swizzle %viewport_1, xy | |
| %234:vec2<f32> = swizzle %shadowPos_1, xy | |
| %235:vec2<f32> = swizzle %viewport_1, zw | |
| %236:vec2<f32> = mul %234, %235 | |
| %237:vec2<f32> = add %233, %236 | |
| %238:vec2<f32> = construct %237 | |
| %viewportPos_1:vec2<f32> = let %238 # %viewportPos_1: 'viewportPos' | |
| %240:texture_depth_2d = load %shadowTexture | |
| %241:vec2<u32> = textureDimensions %240, 0i | |
| %242:vec2<f32> = convert %241 | |
| %243:vec2<f32> = div 1.0f, %242 | |
| %texelSize_1:vec2<f32> = let %243 # %texelSize_1: 'texelSize' | |
| %245:vec2<f32> = swizzle %viewport_1, xy | |
| %246:vec2<f32> = swizzle %viewport_1, xy | |
| %247:vec2<f32> = swizzle %viewport_1, zw | |
| %248:vec2<f32> = add %246, %247 | |
| %249:vec4<f32> = construct %245, %248 | |
| %clampRect_1:vec4<f32> = let %249 # %clampRect_1: 'clampRect' | |
| %visibility_1:ptr<function, f32, read_write> = var, 0.0f # %visibility_1: 'visibility' | |
| loop [i: $B24, b: $B25, c: $B26] { # loop_2 | |
| $B24: { # initializer | |
| %i_1:ptr<function, u32, read_write> = var, 0u # %i_1: 'i' | |
| next_iteration # -> $B25 | |
| } | |
| $B25: { # body | |
| %253:u32 = load %i_1 | |
| %254:bool = lt %253, 16u | |
| if %254 [t: $B27, f: $B28] { # if_10 | |
| $B27: { # true | |
| exit_if # if_10 | |
| } | |
| $B28: { # false | |
| exit_loop # loop_2 | |
| } | |
| } | |
| %255:f32 = load %visibility_1 | |
| %256:f32 = let %255 | |
| %257:texture_depth_2d = load %shadowTexture | |
| %258:texture_depth_2d = let %257 | |
| %259:sampler_comparison = load %shadowSampler | |
| %260:sampler_comparison = let %259 | |
| %261:u32 = load %i_1 | |
| %262:ptr<private, vec2<f32>, read_write> = access %shadowSampleOffsets, %261 | |
| %263:vec2<f32> = load %262 | |
| %264:vec2<f32> = mul %263, %texelSize_1 | |
| %265:vec2<f32> = add %viewportPos_1, %264 | |
| %266:vec2<f32> = swizzle %clampRect_1, xy | |
| %267:vec2<f32> = swizzle %clampRect_1, zw | |
| %268:vec2<f32> = clamp %265, %266, %267 | |
| %269:f32 = access %shadowPos_1, 2u | |
| %270:f32 = sub %269, 0.00999999977648258209f | |
| %271:f32 = textureSampleCompareLevel %258, %260, %268, %270 | |
| %272:f32 = add %256, %271 | |
| store %visibility_1, %272 | |
| continue # -> $B26 | |
| } | |
| $B26: { # continuing | |
| %273:u32 = load %i_1 | |
| %274:u32 = add %273, 1u | |
| store %i_1, %274 | |
| next_iteration # -> $B25 | |
| } | |
| } | |
| %275:f32 = load %visibility_1 | |
| %276:f32 = div %275, 16.0f | |
| ret %276 | |
| } | |
| } | |
| %GetSurfaceInfo = func(%input:VertexOutput):SurfaceInfo { | |
| $B29: { | |
| %surface:ptr<function, SurfaceInfo, read_write> = var | |
| %280:ptr<function, vec3<f32>, read_write> = access %surface, 8u | |
| %281:vec3<f32> = access %input, 2u | |
| %282:vec3<f32> = normalize %281 | |
| store %280, %282 | |
| %283:vec3<f32> = access %input, 8u | |
| %284:vec3<f32> = access %input, 9u | |
| %285:vec3<f32> = access %input, 7u | |
| %286:mat3x3<f32> = construct %283, %284, %285 | |
| %tbn:mat3x3<f32> = let %286 | |
| %288:texture_2d<f32> = load %normalTexture | |
| %289:sampler = load %normalSampler | |
| %290:vec2<f32> = access %input, 3u | |
| %291:vec4<f32> = textureSample %288, %289, %290 | |
| %292:vec3<f32> = swizzle %291, xyz | |
| %normalMap:vec3<f32> = let %292 | |
| %294:ptr<function, vec3<f32>, read_write> = access %surface, 4u | |
| %295:vec3<f32> = mul 2.0f, %normalMap | |
| %296:vec3<f32> = sub %295, vec3<f32>(1.0f) | |
| %297:vec3<f32> = mul %tbn, %296 | |
| %298:vec3<f32> = normalize %297 | |
| store %294, %298 | |
| %299:texture_2d<f32> = load %baseColorTexture | |
| %300:sampler = load %baseColorSampler | |
| %301:vec2<f32> = access %input, 3u | |
| %302:vec4<f32> = textureSample %299, %300, %301 | |
| %baseColorMap:vec4<f32> = let %302 | |
| %304:ptr<function, vec4<f32>, read_write> = access %surface, 0u | |
| %305:vec4<f32> = access %input, 5u | |
| %306:ptr<uniform, vec4<f32>, read> = access %material, 0u | |
| %307:vec4<f32> = load %306 | |
| %308:vec4<f32> = mul %305, %307 | |
| %309:vec4<f32> = mul %308, %baseColorMap | |
| store %304, %309 | |
| %310:ptr<function, vec4<f32>, read_write> = access %surface, 0u | |
| %311:f32 = load_vector_element %310, 3u | |
| %312:ptr<uniform, f32, read> = access %material, 4u | |
| %313:f32 = load %312 | |
| %314:bool = lt %311, %313 | |
| if %314 [t: $B30] { # if_11 | |
| $B30: { # true | |
| exit_if # if_11 | |
| } | |
| } | |
| %315:ptr<function, vec3<f32>, read_write> = access %surface, 1u | |
| %316:ptr<function, vec4<f32>, read_write> = access %surface, 0u | |
| %317:vec4<f32> = load %316 | |
| %318:vec3<f32> = swizzle %317, xyz | |
| store %315, %318 | |
| %319:texture_2d<f32> = load %metallicRoughnessTexture | |
| %320:sampler = load %metallicRoughnessSampler | |
| %321:vec2<f32> = access %input, 3u | |
| %322:vec4<f32> = textureSample %319, %320, %321 | |
| %metallicRoughnessMap:vec4<f32> = let %322 | |
| %324:ptr<function, f32, read_write> = access %surface, 2u | |
| %325:ptr<uniform, vec2<f32>, read> = access %material, 3u | |
| %326:f32 = load_vector_element %325, 0u | |
| %327:f32 = access %metallicRoughnessMap, 2u | |
| %328:f32 = mul %326, %327 | |
| store %324, %328 | |
| %329:ptr<function, f32, read_write> = access %surface, 3u | |
| %330:ptr<uniform, vec2<f32>, read> = access %material, 3u | |
| %331:f32 = load_vector_element %330, 1u | |
| %332:f32 = access %metallicRoughnessMap, 1u | |
| %333:f32 = mul %331, %332 | |
| store %329, %333 | |
| %dielectricSpec:vec3<f32> = let vec3<f32>(0.03999999910593032837f) | |
| %335:ptr<function, vec3<f32>, read_write> = access %surface, 5u | |
| %336:ptr<function, vec3<f32>, read_write> = access %surface, 1u | |
| %337:vec3<f32> = load %336 | |
| %338:vec3<f32> = let %337 | |
| %339:ptr<function, f32, read_write> = access %surface, 2u | |
| %340:f32 = load %339 | |
| %341:vec3<f32> = construct %340 | |
| %342:vec3<f32> = mix %dielectricSpec, %338, %341 | |
| store %335, %342 | |
| %343:texture_2d<f32> = load %occlusionTexture | |
| %344:sampler = load %occlusionSampler | |
| %345:vec2<f32> = access %input, 3u | |
| %346:vec4<f32> = textureSample %343, %344, %345 | |
| %occlusionMap:vec4<f32> = let %346 | |
| %348:ptr<function, f32, read_write> = access %surface, 6u | |
| %349:ptr<uniform, f32, read> = access %material, 2u | |
| %350:f32 = load %349 | |
| %351:f32 = access %occlusionMap, 0u | |
| %352:f32 = mul %350, %351 | |
| store %348, %352 | |
| %353:texture_2d<f32> = load %emissiveTexture | |
| %354:sampler = load %emissiveSampler | |
| %355:vec2<f32> = access %input, 3u | |
| %356:vec4<f32> = textureSample %353, %354, %355 | |
| %emissiveMap:vec4<f32> = let %356 | |
| %358:ptr<function, vec3<f32>, read_write> = access %surface, 7u | |
| %359:ptr<uniform, vec3<f32>, read> = access %material, 1u | |
| %360:vec3<f32> = load %359 | |
| %361:vec3<f32> = swizzle %emissiveMap, xyz | |
| %362:vec3<f32> = mul %360, %361 | |
| store %358, %362 | |
| %363:f32 = access %input, 6u, 3u | |
| %364:bool = eq %363, 0.0f | |
| if %364 [t: $B31, f: $B32] { # if_12 | |
| $B31: { # true | |
| %365:ptr<function, vec3<f32>, read_write> = access %surface, 1u | |
| %366:ptr<function, vec3<f32>, read_write> = access %surface, 1u | |
| %367:vec3<f32> = load %366 | |
| %368:vec4<f32> = access %input, 6u | |
| %369:vec3<f32> = swizzle %368, xyz | |
| %370:vec3<f32> = add %367, %369 | |
| store %365, %370 | |
| exit_if # if_12 | |
| } | |
| $B32: { # false | |
| %371:ptr<function, vec3<f32>, read_write> = access %surface, 1u | |
| %372:ptr<function, vec3<f32>, read_write> = access %surface, 1u | |
| %373:vec3<f32> = load %372 | |
| %374:vec4<f32> = access %input, 6u | |
| %375:vec3<f32> = swizzle %374, xyz | |
| %376:vec3<f32> = mul %373, %375 | |
| store %371, %376 | |
| exit_if # if_12 | |
| } | |
| } | |
| %377:SurfaceInfo = load %surface | |
| ret %377 | |
| } | |
| } | |
| %FresnelSchlick = func(%cosTheta:f32, %F0:vec3<f32>):vec3<f32> { | |
| $B33: { | |
| %381:vec3<f32> = sub vec3<f32>(1.0f), %F0 | |
| %382:f32 = sub 1.0f, %cosTheta | |
| %383:f32 = pow %382, 5.0f | |
| %384:vec3<f32> = mul %381, %383 | |
| %385:vec3<f32> = add %F0, %384 | |
| ret %385 | |
| } | |
| } | |
| %DistributionGGX = func(%N:vec3<f32>, %H:vec3<f32>, %roughness:f32):f32 { | |
| $B34: { | |
| %390:f32 = mul %roughness, %roughness | |
| %a:f32 = let %390 | |
| %392:f32 = mul %a, %a | |
| %a2:f32 = let %392 | |
| %394:f32 = dot %N, %H | |
| %395:f32 = max %394, 0.0f | |
| %NdotH:f32 = let %395 | |
| %397:f32 = mul %NdotH, %NdotH | |
| %NdotH2:f32 = let %397 | |
| %num:f32 = let %a2 | |
| %400:f32 = sub %a2, 1.0f | |
| %401:f32 = mul %NdotH2, %400 | |
| %402:f32 = add %401, 1.0f | |
| %denom:f32 = let %402 | |
| %404:f32 = mul 3.14159274101257324219f, %denom | |
| %405:f32 = mul %404, %denom | |
| %406:f32 = div %num, %405 | |
| ret %406 | |
| } | |
| } | |
| %GeometrySchlickGGX = func(%NdotV:f32, %roughness_1:f32):f32 { # %roughness_1: 'roughness' | |
| $B35: { | |
| %410:f32 = add %roughness_1, 1.0f | |
| %r:f32 = let %410 | |
| %412:f32 = mul %r, %r | |
| %413:f32 = div %412, 8.0f | |
| %k:f32 = let %413 | |
| %num_1:f32 = let %NdotV # %num_1: 'num' | |
| %416:f32 = sub 1.0f, %k | |
| %417:f32 = mul %NdotV, %416 | |
| %418:f32 = add %417, %k | |
| %denom_1:f32 = let %418 # %denom_1: 'denom' | |
| %420:f32 = div %num_1, %denom_1 | |
| ret %420 | |
| } | |
| } | |
| %GeometrySmith = func(%N_1:vec3<f32>, %V:vec3<f32>, %L:vec3<f32>, %roughness_2:f32):f32 { # %N_1: 'N', %roughness_2: 'roughness' | |
| $B36: { | |
| %426:f32 = dot %N_1, %V | |
| %427:f32 = max %426, 0.0f | |
| %NdotV_1:f32 = let %427 # %NdotV_1: 'NdotV' | |
| %429:f32 = dot %N_1, %L | |
| %430:f32 = max %429, 0.0f | |
| %NdotL:f32 = let %430 | |
| %432:f32 = call %GeometrySchlickGGX, %NdotV_1, %roughness_2 | |
| %ggx2:f32 = let %432 | |
| %434:f32 = call %GeometrySchlickGGX, %NdotL, %roughness_2 | |
| %ggx1:f32 = let %434 | |
| %436:f32 = mul %ggx1, %ggx2 | |
| ret %436 | |
| } | |
| } | |
| %lightAttenuation = func(%light:PuctualLight):f32 { | |
| $B37: { | |
| %439:u32 = access %light, 0u | |
| %440:bool = eq %439, 2u | |
| if %440 [t: $B38] { # if_13 | |
| $B38: { # true | |
| ret 1.0f | |
| } | |
| } | |
| %441:vec3<f32> = access %light, 1u | |
| %442:f32 = length %441 | |
| %distance:f32 = let %442 | |
| %444:f32 = access %light, 2u | |
| %445:bool = lte %444, 0.0f | |
| if %445 [t: $B39] { # if_14 | |
| $B39: { # true | |
| %446:f32 = pow %distance, 2.0f | |
| %447:f32 = div 1.0f, %446 | |
| ret %447 | |
| } | |
| } | |
| %448:f32 = access %light, 2u | |
| %449:f32 = div %distance, %448 | |
| %450:f32 = pow %449, 4.0f | |
| %451:f32 = sub 1.0f, %450 | |
| %452:f32 = clamp %451, 0.0f, 1.0f | |
| %453:f32 = let %452 | |
| %454:f32 = pow %distance, 2.0f | |
| %455:f32 = div %453, %454 | |
| ret %455 | |
| } | |
| } | |
| %lightRadiance = func(%light_1:PuctualLight, %surface_1:SurfaceInfo):vec3<f32> { # %light_1: 'light', %surface_1: 'surface' | |
| $B40: { | |
| %459:vec3<f32> = access %light_1, 1u | |
| %460:vec3<f32> = normalize %459 | |
| %L_1:vec3<f32> = let %460 # %L_1: 'L' | |
| %462:vec3<f32> = access %surface_1, 8u | |
| %463:vec3<f32> = add %462, %L_1 | |
| %464:vec3<f32> = normalize %463 | |
| %H_1:vec3<f32> = let %464 # %H_1: 'H' | |
| %466:vec3<f32> = access %surface_1, 4u | |
| %467:f32 = access %surface_1, 3u | |
| %468:f32 = call %DistributionGGX, %466, %H_1, %467 | |
| %NDF:f32 = let %468 | |
| %470:vec3<f32> = access %surface_1, 4u | |
| %471:vec3<f32> = access %surface_1, 8u | |
| %472:f32 = access %surface_1, 3u | |
| %473:f32 = call %GeometrySmith, %470, %471, %L_1, %472 | |
| %G:f32 = let %473 | |
| %475:vec3<f32> = access %surface_1, 8u | |
| %476:f32 = dot %H_1, %475 | |
| %477:f32 = max %476, 0.0f | |
| %478:vec3<f32> = access %surface_1, 5u | |
| %479:vec3<f32> = call %FresnelSchlick, %477, %478 | |
| %F:vec3<f32> = let %479 | |
| %481:vec3<f32> = sub vec3<f32>(1.0f), %F | |
| %482:f32 = access %surface_1, 2u | |
| %483:f32 = sub 1.0f, %482 | |
| %484:vec3<f32> = mul %481, %483 | |
| %kD:vec3<f32> = let %484 | |
| %486:vec3<f32> = access %surface_1, 4u | |
| %487:f32 = dot %486, %L_1 | |
| %488:f32 = max %487, 0.0f | |
| %NdotL_1:f32 = let %488 # %NdotL_1: 'NdotL' | |
| %490:f32 = mul %NDF, %G | |
| %491:vec3<f32> = mul %490, %F | |
| %numerator:vec3<f32> = let %491 | |
| %493:vec3<f32> = access %surface_1, 4u | |
| %494:vec3<f32> = access %surface_1, 8u | |
| %495:f32 = dot %493, %494 | |
| %496:f32 = max %495, 0.0f | |
| %497:f32 = mul 4.0f, %496 | |
| %498:f32 = mul %497, %NdotL_1 | |
| %499:f32 = max %498, 0.00100000004749745131f | |
| %denominator:f32 = let %499 | |
| %501:vec3<f32> = construct %denominator | |
| %502:vec3<f32> = div %numerator, %501 | |
| %specular:vec3<f32> = let %502 | |
| %504:vec3<f32> = access %light_1, 3u | |
| %505:f32 = access %light_1, 4u | |
| %506:vec3<f32> = mul %504, %505 | |
| %507:f32 = call %lightAttenuation, %light_1 | |
| %508:vec3<f32> = mul %506, %507 | |
| %radiance:vec3<f32> = let %508 | |
| %510:vec3<f32> = access %surface_1, 1u | |
| %511:vec3<f32> = mul %kD, %510 | |
| %512:vec3<f32> = div %511, vec3<f32>(3.14159274101257324219f) | |
| %513:vec3<f32> = add %512, %specular | |
| %514:vec3<f32> = mul %513, %radiance | |
| %515:vec3<f32> = mul %514, %NdotL_1 | |
| ret %515 | |
| } | |
| } | |
| %fragmentMain = @fragment func(%input_1:VertexOutput):FragmentOutput { # %input_1: 'input' | |
| $B41: { | |
| %518:SurfaceInfo = call %GetSurfaceInfo, %input_1 | |
| %surface_2:SurfaceInfo = let %518 # %surface_2: 'surface' | |
| %Lo:ptr<function, vec3<f32>, read_write> = var, vec3<f32>(0.0f) | |
| %521:ptr<storage, f32, read> = access %globalLights, 2u | |
| %522:f32 = load %521 | |
| %523:bool = gt %522, 0.0f | |
| if %523 [t: $B42] { # if_15 | |
| $B42: { # true | |
| %light_2:ptr<function, PuctualLight, read_write> = var # %light_2: 'light' | |
| %525:ptr<function, u32, read_write> = access %light_2, 0u | |
| store %525, 2u | |
| %526:ptr<function, vec3<f32>, read_write> = access %light_2, 1u | |
| %527:ptr<storage, vec3<f32>, read> = access %globalLights, 3u | |
| %528:vec3<f32> = load %527 | |
| store %526, %528 | |
| %529:ptr<function, vec3<f32>, read_write> = access %light_2, 3u | |
| %530:ptr<storage, vec3<f32>, read> = access %globalLights, 1u | |
| %531:vec3<f32> = load %530 | |
| store %529, %531 | |
| %532:ptr<function, f32, read_write> = access %light_2, 4u | |
| %533:ptr<storage, f32, read> = access %globalLights, 2u | |
| %534:f32 = load %533 | |
| store %532, %534 | |
| %535:vec3<f32> = access %input_1, 1u | |
| %536:f32 = call %dirLightVisibility, %535 | |
| %lightVis:f32 = let %536 | |
| %538:vec3<f32> = load %Lo | |
| %539:vec3<f32> = let %538 | |
| %540:PuctualLight = load %light_2 | |
| %541:vec3<f32> = call %lightRadiance, %540, %surface_2 | |
| %542:vec3<f32> = mul %541, %lightVis | |
| %543:vec3<f32> = add %539, %542 | |
| store %Lo, %543 | |
| exit_if # if_15 | |
| } | |
| } | |
| %544:vec4<f32> = access %input_1, 0u | |
| %545:u32 = call %getClusterIndex, %544 | |
| %clusterIndex:u32 = let %545 | |
| %547:ptr<storage, u32, read> = access %clusterLights, 1u, %clusterIndex, 0u | |
| %548:u32 = load %547 | |
| %lightOffset:u32 = let %548 | |
| %550:ptr<storage, u32, read> = access %clusterLights, 1u, %clusterIndex, 1u | |
| %551:u32 = load %550 | |
| %lightCount:u32 = let %551 | |
| loop [i: $B43, b: $B44, c: $B45] { # loop_3 | |
| $B43: { # initializer | |
| %lightIndex_1:ptr<function, u32, read_write> = var, 0u # %lightIndex_1: 'lightIndex' | |
| next_iteration # -> $B44 | |
| } | |
| $B44: { # body | |
| %554:u32 = load %lightIndex_1 | |
| %555:bool = lt %554, %lightCount | |
| if %555 [t: $B46, f: $B47] { # if_16 | |
| $B46: { # true | |
| exit_if # if_16 | |
| } | |
| $B47: { # false | |
| exit_loop # loop_3 | |
| } | |
| } | |
| %556:u32 = load %lightIndex_1 | |
| %557:u32 = add %lightOffset, %556 | |
| %558:ptr<storage, u32, read> = access %clusterLights, 2u, %557 | |
| %559:u32 = load %558 | |
| %i_2:u32 = let %559 # %i_2: 'i' | |
| %light_3:ptr<function, PuctualLight, read_write> = var # %light_3: 'light' | |
| %562:ptr<function, u32, read_write> = access %light_3, 0u | |
| store %562, 0u | |
| %563:ptr<function, vec3<f32>, read_write> = access %light_3, 1u | |
| %564:ptr<storage, vec3<f32>, read> = access %globalLights, 5u, %i_2, 0u | |
| %565:vec3<f32> = load %564 | |
| %566:vec3<f32> = swizzle %565, xyz | |
| %567:vec3<f32> = access %input_1, 1u | |
| %568:vec3<f32> = sub %566, %567 | |
| store %563, %568 | |
| %569:ptr<function, f32, read_write> = access %light_3, 2u | |
| %570:ptr<storage, f32, read> = access %globalLights, 5u, %i_2, 1u | |
| %571:f32 = load %570 | |
| store %569, %571 | |
| %572:ptr<function, vec3<f32>, read_write> = access %light_3, 3u | |
| %573:ptr<storage, vec3<f32>, read> = access %globalLights, 5u, %i_2, 2u | |
| %574:vec3<f32> = load %573 | |
| store %572, %574 | |
| %575:ptr<function, f32, read_write> = access %light_3, 4u | |
| %576:ptr<storage, f32, read> = access %globalLights, 5u, %i_2, 3u | |
| %577:f32 = load %576 | |
| store %575, %577 | |
| %578:vec3<f32> = access %input_1, 1u | |
| %579:ptr<function, vec3<f32>, read_write> = access %light_3, 1u | |
| %580:vec3<f32> = load %579 | |
| %581:f32 = call %pointLightVisibility, %i_2, %578, %580 | |
| %lightVis_1:f32 = let %581 # %lightVis_1: 'lightVis' | |
| %583:vec3<f32> = load %Lo | |
| %584:vec3<f32> = let %583 | |
| %585:PuctualLight = load %light_3 | |
| %586:vec3<f32> = call %lightRadiance, %585, %surface_2 | |
| %587:vec3<f32> = mul %586, %lightVis_1 | |
| %588:vec3<f32> = add %584, %587 | |
| store %Lo, %588 | |
| continue # -> $B45 | |
| } | |
| $B45: { # continuing | |
| %589:u32 = load %lightIndex_1 | |
| %590:u32 = add %589, 1u | |
| store %lightIndex_1, %590 | |
| next_iteration # -> $B44 | |
| } | |
| } | |
| %591:vec4<f32> = access %input_1, 0u | |
| %592:vec2<f32> = swizzle %591, xy | |
| %593:texture_2d<f32> = load %ssaoTexture | |
| %594:vec2<u32> = textureDimensions %593 | |
| %595:vec2<u32> = swizzle %594, xy | |
| %596:vec2<f32> = convert %595 | |
| %597:vec2<f32> = div %592, %596 | |
| %ssaoCoord:vec2<f32> = let %597 | |
| %599:texture_2d<f32> = load %ssaoTexture | |
| %600:sampler = load %defaultSampler | |
| %601:vec4<f32> = textureSample %599, %600, %ssaoCoord | |
| %602:f32 = access %601, 0u | |
| %ssaoFactor:f32 = let %602 | |
| %604:ptr<storage, vec3<f32>, read> = access %globalLights, 0u | |
| %605:vec3<f32> = load %604 | |
| %606:vec3<f32> = access %surface_2, 1u | |
| %607:vec3<f32> = mul %605, %606 | |
| %608:f32 = access %surface_2, 6u | |
| %609:vec3<f32> = mul %607, %608 | |
| %610:vec3<f32> = mul %609, %ssaoFactor | |
| %ambient:vec3<f32> = let %610 | |
| %612:vec3<f32> = load %Lo | |
| %613:vec3<f32> = add %612, %ambient | |
| %614:vec3<f32> = access %surface_2, 7u | |
| %615:vec3<f32> = add %613, %614 | |
| %616:vec3<f32> = call %linearTosRGB, %615 | |
| %color:vec3<f32> = let %616 | |
| %out:ptr<function, FragmentOutput, read_write> = var | |
| %619:ptr<function, vec4<f32>, read_write> = access %out, 0u | |
| %620:f32 = access %surface_2, 0u, 3u | |
| %621:vec4<f32> = construct %color, %620 | |
| store %619, %621 | |
| %622:ptr<function, vec4<f32>, read_write> = access %out, 1u | |
| %623:vec3<f32> = access %surface_2, 7u | |
| %624:f32 = access %surface_2, 0u, 3u | |
| %625:vec4<f32> = construct %623, %624 | |
| store %622, %625 | |
| %626:FragmentOutput = load %out | |
| ret %626 | |
| } | |
| } | |
| %tint_f32_to_u32 = func(%value:f32):u32 { | |
| $B48: { | |
| %628:u32 = convert %value | |
| %629:bool = gte %value, 0.0f | |
| %630:u32 = select 0u, %628, %629 | |
| %631:bool = lte %value, 4294967040.0f | |
| %632:u32 = select 4294967295u, %630, %631 | |
| ret %632 | |
| } | |
| } | |
| unhandled variable address space | |
| ******************************************************************** | |
| * The tint shader compiler has encountered an unexpected error. * | |
| * * | |
| * Please help us fix this issue by submitting a bug report at * | |
| * crbug.com/tint with the source program that triggered the bug. * | |
| ******************************************************************** |