luboslenco 1 năm trước cách đây
mục cha
commit
e114a207b4

+ 3 - 4
armorlab/Sources/arm/shader/MakeMesh.hx

@@ -162,8 +162,7 @@ class MakeMesh {
 				frag.write('vec3 wreflect = reflect(-vVec, n);');
 				frag.write('float envlod = roughness * float(envmapNumMipmaps);');
 				frag.add_function(ShaderFunctions.str_envMapEquirect);
-				frag.write('vec4 envmapDataLocal = envmapData;'); // TODO: spirv workaround
-				frag.write('vec3 prefilteredColor = textureLod(senvmapRadiance, envMapEquirect(wreflect, envmapDataLocal.x), envlod).rgb;');
+				frag.write('vec3 prefilteredColor = textureLod(senvmapRadiance, envMapEquirect(wreflect, envmapData.x), envlod).rgb;');
 				frag.add_uniform('vec3 lightArea0', '_lightArea0');
 				frag.add_uniform('vec3 lightArea1', '_lightArea1');
 				frag.add_uniform('vec3 lightArea2', '_lightArea2');
@@ -189,9 +188,9 @@ class MakeMesh {
 
 				frag.add_uniform('vec4 shirr[7]', '_envmapIrradiance');
 				frag.add_function(ShaderFunctions.str_shIrradiance);
-				frag.write('vec3 indirect = albedo * (shIrradiance(vec3(n.x * envmapDataLocal.z - n.y * envmapDataLocal.y, n.x * envmapDataLocal.y + n.y * envmapDataLocal.z, n.z), shirr) / 3.14159265);');
+				frag.write('vec3 indirect = albedo * (shIrradiance(vec3(n.x * envmapData.z - n.y * envmapData.y, n.x * envmapData.y + n.y * envmapData.z, n.z), shirr) / 3.14159265);');
 				frag.write('indirect += prefilteredColor * (f0 * envBRDF.x + envBRDF.y) * 1.5;');
-				frag.write('indirect *= envmapDataLocal.w * occlusion;');
+				frag.write('indirect *= envmapData.w * occlusion;');
 				frag.write('fragColor[1] = vec4(direct + indirect, 1.0);');
 			}
 			else { // Deferred, Pathtraced

+ 15 - 23
armorlab/Sources/arm/shader/MakePaint.hx

@@ -38,13 +38,11 @@ class MakePaint {
 			frag.add_uniform('sampler2D gbuffer2');
 			frag.add_uniform('vec2 gbufferSize', '_gbufferSize');
 			frag.add_uniform('vec4 inp', '_inputBrush');
-			frag.write('vec4 inpLocal = inp;'); // TODO: spirv workaround
-			frag.write('vec2 gbufferSizeLocal = gbufferSize;'); // TODO: spirv workaround
 
 			#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-			frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(inpLocal.x * gbufferSizeLocal.x, inpLocal.y * gbufferSizeLocal.y), 0).ba;');
+			frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(inp.x * gbufferSize.x, inp.y * gbufferSize.y), 0).ba;');
 			#else
-			frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(inpLocal.x * gbufferSizeLocal.x, (1.0 - inpLocal.y) * gbufferSizeLocal.y), 0).ba;');
+			frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(inp.x * gbufferSize.x, (1.0 - inp.y) * gbufferSize.y), 0).ba;');
 			#end
 
 			frag.add_out('vec4 fragColor[4]');
@@ -101,27 +99,25 @@ class MakePaint {
 
 			frag.write('float dist = 0.0;');
 
-			frag.write('vec4 inpLocal = inp;'); // TODO: spirv workaround
-			frag.write('vec4 inplastLocal = inplast;'); // TODO: spirv workaround
 			#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-			frag.write('float depth = textureLod(gbufferD, inpLocal.xy, 0.0).r;');
+			frag.write('float depth = textureLod(gbufferD, inp.xy, 0.0).r;');
 			#else
-			frag.write('float depth = textureLod(gbufferD, vec2(inpLocal.x, 1.0 - inpLocal.y), 0.0).r;');
+			frag.write('float depth = textureLod(gbufferD, vec2(inp.x, 1.0 - inp.y), 0.0).r;');
 			#end
 
 			frag.add_uniform('mat4 invVP', '_inverseViewProjectionMatrix');
-			frag.write('vec4 winp = vec4(vec2(inpLocal.x, 1.0 - inpLocal.y) * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);');
+			frag.write('vec4 winp = vec4(vec2(inp.x, 1.0 - inp.y) * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);');
 			frag.write('winp = mul(winp, invVP);');
 			frag.write('winp.xyz /= winp.w;');
 			frag.wposition = true;
 
 			#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-			frag.write('float depthlast = textureLod(gbufferD, inplastLocal.xy, 0.0).r;');
+			frag.write('float depthlast = textureLod(gbufferD, inplast.xy, 0.0).r;');
 			#else
-			frag.write('float depthlast = textureLod(gbufferD, vec2(inplastLocal.x, 1.0 - inplastLocal.y), 0.0).r;');
+			frag.write('float depthlast = textureLod(gbufferD, vec2(inplast.x, 1.0 - inplast.y), 0.0).r;');
 			#end
 
-			frag.write('vec4 winplast = vec4(vec2(inplastLocal.x, 1.0 - inplastLocal.y) * 2.0 - 1.0, depthlast * 2.0 - 1.0, 1.0);');
+			frag.write('vec4 winplast = vec4(vec2(inplast.x, 1.0 - inplast.y) * 2.0 - 1.0, depthlast * 2.0 - 1.0, 1.0);');
 			frag.write('winplast = mul(winplast, invVP);');
 			frag.write('winplast.xyz /= winplast.w;');
 
@@ -149,12 +145,10 @@ class MakePaint {
 
 			if (Context.raw.tool == ToolClone) {
 				// frag.add_uniform('vec2 cloneDelta', '_cloneDelta');
-				// frag.write('vec2 cloneDeltaLocal = cloneDelta;'); // TODO: spirv workaround
-				// frag.write('vec2 gbufferSizeLocal = gbufferSize;'); // TODO: spirv workaround
 				// #if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-				// frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2((sp.xy + cloneDeltaLocal) * gbufferSizeLocal), 0).ba;');
+				// frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2((sp.xy + cloneDelta) * gbufferSize), 0).ba;');
 				// #else
-				// frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2((sp.x + cloneDeltaLocal.x) * gbufferSizeLocal.x, (1.0 - (sp.y + cloneDeltaLocal.y)) * gbufferSizeLocal.y), 0).ba;');
+				// frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2((sp.x + cloneDelta.x) * gbufferSize.x, (1.0 - (sp.y + cloneDelta.y)) * gbufferSize.y), 0).ba;');
 				// #end
 
 				// frag.write('vec3 texpaint_pack_sample = textureLod(texpaint_pack_undo, texCoordInp, 0.0).rgb;');
@@ -175,11 +169,10 @@ class MakePaint {
 				// frag.write('float opacity = mat_opacity * brushOpacity;');
 			}
 			else { // Blur
-				// frag.write('vec2 gbufferSizeLocal = gbufferSize;'); // TODO: spirv workaround
 				// #if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-				// frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(sp.x * gbufferSizeLocal.x, sp.y * gbufferSizeLocal.y), 0).ba;');
+				// frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(sp.x * gbufferSize.x, sp.y * gbufferSize.y), 0).ba;');
 				// #else
-				// frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(sp.x * gbufferSizeLocal.x, (1.0 - sp.y) * gbufferSizeLocal.y), 0).ba;');
+				// frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(sp.x * gbufferSize.x, (1.0 - sp.y) * gbufferSize.y), 0).ba;');
 				// #end
 
 				// frag.write('vec3 basecol = vec3(0.0, 0.0, 0.0);');
@@ -192,8 +185,7 @@ class MakePaint {
 				// frag.write('float opacity = 0.0;');
 
 				// frag.add_uniform('vec2 texpaintSize', '_texpaintSize');
-				// frag.write('vec2 texpaintSizeLocal = texpaintSize;'); // TODO: spirv workaround
-				// frag.write('float blur_step = 1.0 / texpaintSizeLocal.x;');
+				// frag.write('float blur_step = 1.0 / texpaintSize.x;');
 				// if (Context.raw.blurDirectional) {
 				// 	#if (kha_direct3d11 || kha_direct3d12 || kha_metal)
 				// 	frag.write('const float blur_weight[7] = {1.0 / 28.0, 2.0 / 28.0, 3.0 / 28.0, 4.0 / 28.0, 5.0 / 28.0, 6.0 / 28.0, 7.0 / 28.0};');
@@ -204,9 +196,9 @@ class MakePaint {
 				// 	frag.write('vec2 blur_direction = brushDirection.yx;');
 				// 	frag.write('for (int i = 0; i < 7; ++i) {');
 				// 	#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-				// 	frag.write('vec2 texCoordInp2 = texelFetch(gbuffer2, ivec2((sp.x + blur_direction.x * blur_step * float(i)) * gbufferSizeLocal.x, (sp.y + blur_direction.y * blur_step * float(i)) * gbufferSizeLocal.y), 0).ba;');
+				// 	frag.write('vec2 texCoordInp2 = texelFetch(gbuffer2, ivec2((sp.x + blur_direction.x * blur_step * float(i)) * gbufferSize.x, (sp.y + blur_direction.y * blur_step * float(i)) * gbufferSize.y), 0).ba;');
 				// 	#else
-				// 	frag.write('vec2 texCoordInp2 = texelFetch(gbuffer2, ivec2((sp.x + blur_direction.x * blur_step * float(i)) * gbufferSizeLocal.x, (1.0 - (sp.y + blur_direction.y * blur_step * float(i))) * gbufferSizeLocal.y), 0).ba;');
+				// 	frag.write('vec2 texCoordInp2 = texelFetch(gbuffer2, ivec2((sp.x + blur_direction.x * blur_step * float(i)) * gbufferSize.x, (1.0 - (sp.y + blur_direction.y * blur_step * float(i))) * gbufferSize.y), 0).ba;');
 				// 	#end
 				// 	frag.write('vec4 texpaint_sample = texture(texpaint_undo, texCoordInp2);');
 				// 	frag.write('opacity += texpaint_sample.a * blur_weight[i];');

+ 5 - 7
armorpaint/Sources/arm/shader/MakeBlur.hx

@@ -5,11 +5,10 @@ import arm.shader.NodeShader;
 class MakeBlur {
 
 	public static function run(vert: NodeShader, frag: NodeShader) {
-		frag.write('vec2 gbufferSizeLocal = gbufferSize;'); // TODO: spirv workaround
 		#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-		frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(sp.x * gbufferSizeLocal.x, sp.y * gbufferSizeLocal.y), 0).ba;');
+		frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(sp.x * gbufferSize.x, sp.y * gbufferSize.y), 0).ba;');
 		#else
-		frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(sp.x * gbufferSizeLocal.x, (1.0 - sp.y) * gbufferSizeLocal.y), 0).ba;');
+		frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(sp.x * gbufferSize.x, (1.0 - sp.y) * gbufferSize.y), 0).ba;');
 		#end
 
 		frag.write('vec3 basecol = vec3(0.0, 0.0, 0.0);');
@@ -34,8 +33,7 @@ class MakeBlur {
 		}
 
 		frag.add_uniform('vec2 texpaintSize', '_texpaintSize');
-		frag.write('vec2 texpaintSizeLocal = texpaintSize;'); // TODO: spirv workaround
-		frag.write('float blur_step = 1.0 / texpaintSizeLocal.x;');
+		frag.write('float blur_step = 1.0 / texpaintSize.x;');
 		if (Context.raw.tool == ToolSmudge) {
 			#if (kha_direct3d11 || kha_direct3d12 || kha_metal)
 			frag.write('const float blur_weight[7] = {1.0 / 28.0, 2.0 / 28.0, 3.0 / 28.0, 4.0 / 28.0, 5.0 / 28.0, 6.0 / 28.0, 7.0 / 28.0};');
@@ -46,9 +44,9 @@ class MakeBlur {
 			frag.write('vec2 blur_direction = brushDirection.yx;');
 			frag.write('for (int i = 0; i < 7; ++i) {');
 			#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-			frag.write('vec2 texCoordInp2 = texelFetch(gbuffer2, ivec2((sp.x + blur_direction.x * blur_step * float(i)) * gbufferSizeLocal.x, (sp.y + blur_direction.y * blur_step * float(i)) * gbufferSizeLocal.y), 0).ba;');
+			frag.write('vec2 texCoordInp2 = texelFetch(gbuffer2, ivec2((sp.x + blur_direction.x * blur_step * float(i)) * gbufferSize.x, (sp.y + blur_direction.y * blur_step * float(i)) * gbufferSize.y), 0).ba;');
 			#else
-			frag.write('vec2 texCoordInp2 = texelFetch(gbuffer2, ivec2((sp.x + blur_direction.x * blur_step * float(i)) * gbufferSizeLocal.x, (1.0 - (sp.y + blur_direction.y * blur_step * float(i))) * gbufferSizeLocal.y), 0).ba;');
+			frag.write('vec2 texCoordInp2 = texelFetch(gbuffer2, ivec2((sp.x + blur_direction.x * blur_step * float(i)) * gbufferSize.x, (1.0 - (sp.y + blur_direction.y * blur_step * float(i))) * gbufferSize.y), 0).ba;');
 			#end
 			frag.write('vec4 texpaint_sample = texture(texpaint_undo, texCoordInp2);');
 			frag.write('opacity += texpaint_sample.a * blur_weight[i];');

+ 9 - 11
armorpaint/Sources/arm/shader/MakeBrush.hx

@@ -13,19 +13,17 @@ class MakeBrush {
 
 		var fillLayer = Context.raw.layer.fill_layer != null;
 		var decal = Context.raw.tool == ToolDecal || Context.raw.tool == ToolText;
-		if (decal && !fillLayer) frag.write('if (decalMaskLocal.z > 0.0) {');
+		if (decal && !fillLayer) frag.write('if (decalMask.z > 0.0) {');
 
 		if (Config.raw.brush_3d) {
-			frag.write('vec4 inpLocal = inp;'); // TODO: spirv workaround
-			frag.write('vec4 inplastLocal = inplast;'); // TODO: spirv workaround
 			#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-			frag.write('float depth = textureLod(gbufferD, inpLocal.xy, 0.0).r;');
+			frag.write('float depth = textureLod(gbufferD, inp.xy, 0.0).r;');
 			#else
-			frag.write('float depth = textureLod(gbufferD, vec2(inpLocal.x, 1.0 - inpLocal.y), 0.0).r;');
+			frag.write('float depth = textureLod(gbufferD, vec2(inp.x, 1.0 - inp.y), 0.0).r;');
 			#end
 
 			frag.add_uniform('mat4 invVP', '_inverseViewProjectionMatrix');
-			frag.write('vec4 winp = vec4(vec2(inpLocal.x, 1.0 - inpLocal.y) * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);');
+			frag.write('vec4 winp = vec4(vec2(inp.x, 1.0 - inp.y) * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);');
 			frag.write('winp = mul(winp, invVP);');
 			frag.write('winp.xyz /= winp.w;');
 			frag.wposition = true;
@@ -34,9 +32,9 @@ class MakeBrush {
 				frag.add_function(ShaderFunctions.str_octahedronWrap);
 				frag.add_uniform('sampler2D gbuffer0');
 				#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-				frag.write('vec2 g0 = textureLod(gbuffer0, inpLocal.xy, 0.0).rg;');
+				frag.write('vec2 g0 = textureLod(gbuffer0, inp.xy, 0.0).rg;');
 				#else
-				frag.write('vec2 g0 = textureLod(gbuffer0, vec2(inpLocal.x, 1.0 - inpLocal.y), 0.0).rg;');
+				frag.write('vec2 g0 = textureLod(gbuffer0, vec2(inp.x, 1.0 - inp.y), 0.0).rg;');
 				#end
 				frag.write('vec3 wn;');
 				frag.write('wn.z = 1.0 - abs(g0.x) - abs(g0.y);');
@@ -53,12 +51,12 @@ class MakeBrush {
 			}
 
 			#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-			frag.write('float depthlast = textureLod(gbufferD, inplastLocal.xy, 0.0).r;');
+			frag.write('float depthlast = textureLod(gbufferD, inplast.xy, 0.0).r;');
 			#else
-			frag.write('float depthlast = textureLod(gbufferD, vec2(inplastLocal.x, 1.0 - inplastLocal.y), 0.0).r;');
+			frag.write('float depthlast = textureLod(gbufferD, vec2(inplast.x, 1.0 - inplast.y), 0.0).r;');
 			#end
 
-			frag.write('vec4 winplast = vec4(vec2(inplastLocal.x, 1.0 - inplastLocal.y) * 2.0 - 1.0, depthlast * 2.0 - 1.0, 1.0);');
+			frag.write('vec4 winplast = vec4(vec2(inplast.x, 1.0 - inplast.y) * 2.0 - 1.0, depthlast * 2.0 - 1.0, 1.0);');
 			frag.write('winplast = mul(winplast, invVP);');
 			frag.write('winplast.xyz /= winplast.w;');
 

+ 2 - 4
armorpaint/Sources/arm/shader/MakeClone.hx

@@ -6,12 +6,10 @@ class MakeClone {
 
 	public static function run(vert: NodeShader, frag: NodeShader) {
 		frag.add_uniform('vec2 cloneDelta', '_cloneDelta');
-		frag.write('vec2 cloneDeltaLocal = cloneDelta;'); // TODO: spirv workaround
-		frag.write('vec2 gbufferSizeLocal = gbufferSize;'); // TODO: spirv workaround
 		#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-		frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2((sp.xy + cloneDeltaLocal) * gbufferSizeLocal), 0).ba;');
+		frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2((sp.xy + cloneDelta) * gbufferSize), 0).ba;');
 		#else
-		frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2((sp.x + cloneDeltaLocal.x) * gbufferSizeLocal.x, (1.0 - (sp.y + cloneDeltaLocal.y)) * gbufferSizeLocal.y), 0).ba;');
+		frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2((sp.x + cloneDelta.x) * gbufferSize.x, (1.0 - (sp.y + cloneDelta.y)) * gbufferSize.y), 0).ba;');
 		#end
 
 		frag.write('vec3 texpaint_pack_sample = textureLod(texpaint_pack_undo, texCoordInp, 0.0).rgb;');

+ 4 - 6
armorpaint/Sources/arm/shader/MakeColorIdPicker.hx

@@ -12,13 +12,11 @@ class MakeColorIdPicker {
 		frag.add_uniform('sampler2D gbuffer2');
 		frag.add_uniform('vec2 gbufferSize', '_gbufferSize');
 		frag.add_uniform('vec4 inp', '_inputBrush');
-		frag.write('vec4 inpLocal = inp;'); // TODO: spirv workaround
-		frag.write('vec2 gbufferSizeLocal = gbufferSize;'); // TODO: spirv workaround
 
 		#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-		frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(inpLocal.x * gbufferSizeLocal.x, inpLocal.y * gbufferSizeLocal.y), 0).ba;');
+		frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(inp.x * gbufferSize.x, inp.y * gbufferSize.y), 0).ba;');
 		#else
-		frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(inpLocal.x * gbufferSizeLocal.x, (1.0 - inpLocal.y) * gbufferSizeLocal.y), 0).ba;');
+		frag.write('vec2 texCoordInp = texelFetch(gbuffer2, ivec2(inp.x * gbufferSize.x, (1.0 - inp.y) * gbufferSize.y), 0).ba;');
 		#end
 
 		if (Context.raw.tool == ToolColorId) {
@@ -34,8 +32,8 @@ class MakeColorIdPicker {
 				frag.add_uniform('mat4 invVP', '_inverseViewProjectionMatrix');
 				frag.add_function(ShaderFunctions.str_get_pos_from_depth);
 				frag.add_function(ShaderFunctions.str_get_nor_from_depth);
-				frag.write('fragColor[0] = vec4(get_pos_from_depth(vec2(inpLocal.x, 1.0 - inpLocal.y), invVP, texturePass(gbufferD)), texCoordInp.x);');
-				frag.write('fragColor[1] = vec4(get_nor_from_depth(fragColor[0].rgb, vec2(inpLocal.x, 1.0 - inpLocal.y), invVP, vec2(1.0, 1.0) / gbufferSize, texturePass(gbufferD)), texCoordInp.y);');
+				frag.write('fragColor[0] = vec4(get_pos_from_depth(vec2(inp.x, 1.0 - inp.y), invVP, texturePass(gbufferD)), texCoordInp.x);');
+				frag.write('fragColor[1] = vec4(get_nor_from_depth(fragColor[0].rgb, vec2(inp.x, 1.0 - inp.y), invVP, vec2(1.0, 1.0) / gbufferSize, texturePass(gbufferD)), texCoordInp.y);');
 			}
 			else {
 				frag.add_out('vec4 fragColor[4]');

+ 3 - 4
armorpaint/Sources/arm/shader/MakeMesh.hx

@@ -356,8 +356,7 @@ class MakeMesh {
 					frag.write('vec3 wreflect = reflect(-vVec, n);');
 					frag.write('float envlod = roughness * float(envmapNumMipmaps);');
 					frag.add_function(ShaderFunctions.str_envMapEquirect);
-					frag.write('vec4 envmapDataLocal = envmapData;'); // TODO: spirv workaround
-					frag.write('vec3 prefilteredColor = textureLod(senvmapRadiance, envMapEquirect(wreflect, envmapDataLocal.x), envlod).rgb;');
+					frag.write('vec3 prefilteredColor = textureLod(senvmapRadiance, envMapEquirect(wreflect, envmapData.x), envlod).rgb;');
 					frag.add_uniform('vec3 lightArea0', '_lightArea0');
 					frag.add_uniform('vec3 lightArea1', '_lightArea1');
 					frag.add_uniform('vec3 lightArea2', '_lightArea2');
@@ -385,9 +384,9 @@ class MakeMesh {
 
 					frag.add_uniform('vec4 shirr[7]', '_envmapIrradiance');
 					frag.add_function(ShaderFunctions.str_shIrradiance);
-					frag.write('vec3 indirect = albedo * (shIrradiance(vec3(n.x * envmapDataLocal.z - n.y * envmapDataLocal.y, n.x * envmapDataLocal.y + n.y * envmapDataLocal.z, n.z), shirr) / 3.14159265);');
+					frag.write('vec3 indirect = albedo * (shIrradiance(vec3(n.x * envmapData.z - n.y * envmapData.y, n.x * envmapData.y + n.y * envmapData.z, n.z), shirr) / 3.14159265);');
 					frag.write('indirect += prefilteredColor * (f0 * envBRDF.x + envBRDF.y) * 1.5;');
-					frag.write('indirect *= envmapDataLocal.w * occlusion;');
+					frag.write('indirect *= envmapData.w * occlusion;');
 					frag.write('fragColor[1] = vec4(direct + indirect, 1.0);');
 				}
 				else { // Deferred, Pathtraced

+ 2 - 3
armorpaint/Sources/arm/shader/MakeTexcoord.hx

@@ -36,10 +36,9 @@ class MakeTexcoord {
 			}
 			else if (decal) {
 				frag.add_uniform('vec4 decalMask', '_decalMask');
-				frag.write_attrib('vec4 decalMaskLocal = decalMask;'); // TODO: spirv workaround
-				frag.write_attrib('uvsp -= decalMaskLocal.xy;');
+				frag.write_attrib('uvsp -= decalMask.xy;');
 				frag.write_attrib('uvsp.x *= aspectRatio;');
-				frag.write_attrib('uvsp *= 0.21 / (decalMaskLocal.w * 0.9);'); // Decal radius
+				frag.write_attrib('uvsp *= 0.21 / (decalMask.w * 0.9);'); // Decal radius
 
 				if (Context.raw.brushDirectional) {
 					frag.add_uniform('vec3 brushDirection', '_brushDirection');

+ 6 - 8
armorsculpt/Sources/arm/shader/MakeBrush.hx

@@ -9,16 +9,14 @@ class MakeBrush {
 		frag.write('float dist = 0.0;');
 
 		if (Config.raw.brush_3d) {
-			frag.write('vec4 inpLocal = inp;'); // TODO: spirv workaround
-			frag.write('vec4 inplastLocal = inplast;'); // TODO: spirv workaround
 			#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-			frag.write('float depth = textureLod(gbufferD, inpLocal.xy, 0.0).r;');
+			frag.write('float depth = textureLod(gbufferD, inp.xy, 0.0).r;');
 			#else
-			frag.write('float depth = textureLod(gbufferD, vec2(inpLocal.x, 1.0 - inpLocal.y), 0.0).r;');
+			frag.write('float depth = textureLod(gbufferD, vec2(inp.x, 1.0 - inp.y), 0.0).r;');
 			#end
 
 			frag.add_uniform('mat4 invVP', '_inverseViewProjectionMatrix');
-			frag.write('vec4 winp = vec4(vec2(inpLocal.x, 1.0 - inpLocal.y) * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);');
+			frag.write('vec4 winp = vec4(vec2(inp.x, 1.0 - inp.y) * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);');
 			frag.write('winp = mul(winp, invVP);');
 			frag.write('winp.xyz /= winp.w;');
 
@@ -27,12 +25,12 @@ class MakeBrush {
 			frag.write_attrib('vec3 wposition = mul(texelFetch(texpaint_undo, ivec2(texCoord.x * textureSize(texpaint_undo, 0).x, texCoord.y * textureSize(texpaint_undo, 0).y), 0), W).xyz;');
 
 			#if (kha_direct3d11 || kha_direct3d12 || kha_metal || kha_vulkan)
-			frag.write('float depthlast = textureLod(gbufferD, inplastLocal.xy, 0.0).r;');
+			frag.write('float depthlast = textureLod(gbufferD, inplast.xy, 0.0).r;');
 			#else
-			frag.write('float depthlast = textureLod(gbufferD, vec2(inplastLocal.x, 1.0 - inplastLocal.y), 0.0).r;');
+			frag.write('float depthlast = textureLod(gbufferD, vec2(inplast.x, 1.0 - inplast.y), 0.0).r;');
 			#end
 
-			frag.write('vec4 winplast = vec4(vec2(inplastLocal.x, 1.0 - inplastLocal.y) * 2.0 - 1.0, depthlast * 2.0 - 1.0, 1.0);');
+			frag.write('vec4 winplast = vec4(vec2(inplast.x, 1.0 - inplast.y) * 2.0 - 1.0, depthlast * 2.0 - 1.0, 1.0);');
 			frag.write('winplast = mul(winplast, invVP);');
 			frag.write('winplast.xyz /= winplast.w;');
 

+ 3 - 4
armorsculpt/Sources/arm/shader/MakeMesh.hx

@@ -263,8 +263,7 @@ class MakeMesh {
 					frag.write('vec3 wreflect = reflect(-vVec, n);');
 					frag.write('float envlod = roughness * float(envmapNumMipmaps);');
 					frag.add_function(ShaderFunctions.str_envMapEquirect);
-					frag.write('vec4 envmapDataLocal = envmapData;'); // TODO: spirv workaround
-					frag.write('vec3 prefilteredColor = textureLod(senvmapRadiance, envMapEquirect(wreflect, envmapDataLocal.x), envlod).rgb;');
+					frag.write('vec3 prefilteredColor = textureLod(senvmapRadiance, envMapEquirect(wreflect, envmapData.x), envlod).rgb;');
 					frag.add_uniform('vec3 lightArea0', '_lightArea0');
 					frag.add_uniform('vec3 lightArea1', '_lightArea1');
 					frag.add_uniform('vec3 lightArea2', '_lightArea2');
@@ -290,9 +289,9 @@ class MakeMesh {
 
 					frag.add_uniform('vec4 shirr[7]', '_envmapIrradiance');
 					frag.add_function(ShaderFunctions.str_shIrradiance);
-					frag.write('vec3 indirect = albedo * (shIrradiance(vec3(n.x * envmapDataLocal.z - n.y * envmapDataLocal.y, n.x * envmapDataLocal.y + n.y * envmapDataLocal.z, n.z), shirr) / 3.14159265);');
+					frag.write('vec3 indirect = albedo * (shIrradiance(vec3(n.x * envmapData.z - n.y * envmapData.y, n.x * envmapData.y + n.y * envmapData.z, n.z), shirr) / 3.14159265);');
 					frag.write('indirect += prefilteredColor * (f0 * envBRDF.x + envBRDF.y) * 1.5;');
-					frag.write('indirect *= envmapDataLocal.w * occlusion;');
+					frag.write('indirect *= envmapData.w * occlusion;');
 					frag.write('fragColor[1] = vec4(direct + indirect, 1.0);');
 				}
 				else { // Deferred, Pathtraced