summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-02-14 04:05:05 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-02-14 04:05:05 +0000
commit5fbed684686170ee282e7f2967dcf00dea895fe5 (patch)
tree35853b14875dc6ce9b930aeeb00aa072107b23c6 /Graphics/GraphicsEngineVulkan
parentFixed issue in D3D12 backend: generate mips PSO was released while being used... (diff)
downloadDiligentCore-5fbed684686170ee282e7f2967dcf00dea895fe5.tar.gz
DiligentCore-5fbed684686170ee282e7f2967dcf00dea895fe5.zip
Updated GenerateMipsCS.csh to compile on GLES
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/shaders/GenerateMipsCS.csh40
-rw-r--r--Graphics/GraphicsEngineVulkan/shaders/GenerateMipsCS_inc.h40
2 files changed, 40 insertions, 40 deletions
diff --git a/Graphics/GraphicsEngineVulkan/shaders/GenerateMipsCS.csh b/Graphics/GraphicsEngineVulkan/shaders/GenerateMipsCS.csh
index b85e0bf2..4dd756ea 100644
--- a/Graphics/GraphicsEngineVulkan/shaders/GenerateMipsCS.csh
+++ b/Graphics/GraphicsEngineVulkan/shaders/GenerateMipsCS.csh
@@ -89,12 +89,12 @@ void main()
uvec3 GlobalInd = gl_GlobalInvocationID;
ivec3 SrcMipSize = textureSize(SrcMip, 0); // SrcMip is the view of the source mip level
- bool IsValidThread = GlobalInd.x < SrcMipSize.x && GlobalInd.y < SrcMipSize.y;
+ bool IsValidThread = GlobalInd.x < uint(SrcMipSize.x) && GlobalInd.y < uint(SrcMipSize.y);
int ArraySlice = FirstArraySlice + int(GlobalInd.z);
vec4 Src1 = vec4(0.0, 0.0, 0.0, 0.0);
float fSrcMipLevel = 0.0; // SrcMip is the view of the source mip level
- if( IsValidThread )
+ if (IsValidThread)
{
// One bilinear sample is insufficient when scaling down by more than 2x.
// You will slightly undersample in the case where the source dimension
@@ -103,7 +103,7 @@ void main()
// will force this shader to be slower and more complicated as it will
// have to take more source texture samples.
#if NON_POWER_OF_TWO == 0
- vec2 UV = TexelSize * (vec2(GlobalInd.xy) + 0.5);
+ vec2 UV = TexelSize * (vec2(GlobalInd.xy) + vec2(0.5, 0.5));
Src1 = textureLod(SrcMip, vec3(UV, ArraySlice), fSrcMipLevel);
#elif NON_POWER_OF_TWO == 1
// > 2:1 in X dimension
@@ -141,7 +141,7 @@ void main()
if (NumMipLevels == 1)
return;
- if( IsValidThread )
+ if (IsValidThread)
{
// Without lane swizzle operations, the only way to share data with other
// threads is through LDS.
@@ -153,18 +153,18 @@ void main()
// write instructions.)
GroupMemoryBarrierWithGroupSync();
- if( IsValidThread )
+ if (IsValidThread)
{
// With low three bits for X and high three bits for Y, this bit mask
// (binary: 001001) checks that X and Y are even.
- if ((LocalInd & 0x9) == 0)
+ if ((LocalInd & 0x9u) == 0u)
{
- vec4 Src2 = LoadColor(LocalInd + 0x01);
- vec4 Src3 = LoadColor(LocalInd + 0x08);
- vec4 Src4 = LoadColor(LocalInd + 0x09);
+ vec4 Src2 = LoadColor(LocalInd + 0x01u);
+ vec4 Src3 = LoadColor(LocalInd + 0x08u);
+ vec4 Src4 = LoadColor(LocalInd + 0x09u);
Src1 = 0.25 * (Src1 + Src2 + Src3 + Src4);
- imageStore(OutMip[1], ivec3(GlobalInd.xy / 2, ArraySlice), PackColor(Src1));
+ imageStore(OutMip[1], ivec3(GlobalInd.xy / 2u, ArraySlice), PackColor(Src1));
StoreColor(LocalInd, Src1);
}
}
@@ -177,14 +177,14 @@ void main()
if( IsValidThread )
{
// This bit mask (binary: 011011) checks that X and Y are multiples of four.
- if ((LocalInd & 0x1B) == 0)
+ if ((LocalInd & 0x1Bu) == 0u)
{
- vec4 Src2 = LoadColor(LocalInd + 0x02);
- vec4 Src3 = LoadColor(LocalInd + 0x10);
- vec4 Src4 = LoadColor(LocalInd + 0x12);
+ vec4 Src2 = LoadColor(LocalInd + 0x02u);
+ vec4 Src3 = LoadColor(LocalInd + 0x10u);
+ vec4 Src4 = LoadColor(LocalInd + 0x12u);
Src1 = 0.25 * (Src1 + Src2 + Src3 + Src4);
- imageStore(OutMip[2], ivec3(GlobalInd.xy / 4, ArraySlice), PackColor(Src1));
+ imageStore(OutMip[2], ivec3(GlobalInd.xy / 4u, ArraySlice), PackColor(Src1));
StoreColor(LocalInd, Src1);
}
}
@@ -198,14 +198,14 @@ void main()
{
// This bit mask would be 111111 (X & Y multiples of 8), but only one
// thread fits that criteria.
- if (LocalInd == 0)
+ if (LocalInd == 0u)
{
- vec4 Src2 = LoadColor(LocalInd + 0x04);
- vec4 Src3 = LoadColor(LocalInd + 0x20);
- vec4 Src4 = LoadColor(LocalInd + 0x24);
+ vec4 Src2 = LoadColor(LocalInd + 0x04u);
+ vec4 Src3 = LoadColor(LocalInd + 0x20u);
+ vec4 Src4 = LoadColor(LocalInd + 0x24u);
Src1 = 0.25 * (Src1 + Src2 + Src3 + Src4);
- imageStore(OutMip[3], ivec3(GlobalInd.xy / 8, ArraySlice), PackColor(Src1));
+ imageStore(OutMip[3], ivec3(GlobalInd.xy / 8u, ArraySlice), PackColor(Src1));
}
}
}
diff --git a/Graphics/GraphicsEngineVulkan/shaders/GenerateMipsCS_inc.h b/Graphics/GraphicsEngineVulkan/shaders/GenerateMipsCS_inc.h
index 8d02d782..48c24265 100644
--- a/Graphics/GraphicsEngineVulkan/shaders/GenerateMipsCS_inc.h
+++ b/Graphics/GraphicsEngineVulkan/shaders/GenerateMipsCS_inc.h
@@ -89,12 +89,12 @@
" uvec3 GlobalInd = gl_GlobalInvocationID;\n"
" \n"
" ivec3 SrcMipSize = textureSize(SrcMip, 0); // SrcMip is the view of the source mip level\n"
-" bool IsValidThread = GlobalInd.x < SrcMipSize.x && GlobalInd.y < SrcMipSize.y;\n"
+" bool IsValidThread = GlobalInd.x < uint(SrcMipSize.x) && GlobalInd.y < uint(SrcMipSize.y);\n"
" int ArraySlice = FirstArraySlice + int(GlobalInd.z);\n"
"\n"
" vec4 Src1 = vec4(0.0, 0.0, 0.0, 0.0);\n"
" float fSrcMipLevel = 0.0; // SrcMip is the view of the source mip level\n"
-" if( IsValidThread )\n"
+" if (IsValidThread)\n"
" {\n"
" // One bilinear sample is insufficient when scaling down by more than 2x.\n"
" // You will slightly undersample in the case where the source dimension\n"
@@ -103,7 +103,7 @@
" // will force this shader to be slower and more complicated as it will\n"
" // have to take more source texture samples.\n"
"#if NON_POWER_OF_TWO == 0\n"
-" vec2 UV = TexelSize * (vec2(GlobalInd.xy) + 0.5);\n"
+" vec2 UV = TexelSize * (vec2(GlobalInd.xy) + vec2(0.5, 0.5));\n"
" Src1 = textureLod(SrcMip, vec3(UV, ArraySlice), fSrcMipLevel);\n"
"#elif NON_POWER_OF_TWO == 1\n"
" // > 2:1 in X dimension\n"
@@ -141,7 +141,7 @@
" if (NumMipLevels == 1)\n"
" return;\n"
"\n"
-" if( IsValidThread )\n"
+" if (IsValidThread)\n"
" {\n"
" // Without lane swizzle operations, the only way to share data with other\n"
" // threads is through LDS.\n"
@@ -153,18 +153,18 @@
" // write instructions.)\n"
" GroupMemoryBarrierWithGroupSync();\n"
"\n"
-" if( IsValidThread )\n"
+" if (IsValidThread)\n"
" {\n"
" // With low three bits for X and high three bits for Y, this bit mask\n"
" // (binary: 001001) checks that X and Y are even.\n"
-" if ((LocalInd & 0x9) == 0)\n"
+" if ((LocalInd & 0x9u) == 0u)\n"
" {\n"
-" vec4 Src2 = LoadColor(LocalInd + 0x01);\n"
-" vec4 Src3 = LoadColor(LocalInd + 0x08);\n"
-" vec4 Src4 = LoadColor(LocalInd + 0x09);\n"
+" vec4 Src2 = LoadColor(LocalInd + 0x01u);\n"
+" vec4 Src3 = LoadColor(LocalInd + 0x08u);\n"
+" vec4 Src4 = LoadColor(LocalInd + 0x09u);\n"
" Src1 = 0.25 * (Src1 + Src2 + Src3 + Src4);\n"
"\n"
-" imageStore(OutMip[1], ivec3(GlobalInd.xy / 2, ArraySlice), PackColor(Src1));\n"
+" imageStore(OutMip[1], ivec3(GlobalInd.xy / 2u, ArraySlice), PackColor(Src1));\n"
" StoreColor(LocalInd, Src1);\n"
" }\n"
" }\n"
@@ -177,14 +177,14 @@
" if( IsValidThread )\n"
" {\n"
" // This bit mask (binary: 011011) checks that X and Y are multiples of four.\n"
-" if ((LocalInd & 0x1B) == 0)\n"
+" if ((LocalInd & 0x1Bu) == 0u)\n"
" {\n"
-" vec4 Src2 = LoadColor(LocalInd + 0x02);\n"
-" vec4 Src3 = LoadColor(LocalInd + 0x10);\n"
-" vec4 Src4 = LoadColor(LocalInd + 0x12);\n"
+" vec4 Src2 = LoadColor(LocalInd + 0x02u);\n"
+" vec4 Src3 = LoadColor(LocalInd + 0x10u);\n"
+" vec4 Src4 = LoadColor(LocalInd + 0x12u);\n"
" Src1 = 0.25 * (Src1 + Src2 + Src3 + Src4);\n"
"\n"
-" imageStore(OutMip[2], ivec3(GlobalInd.xy / 4, ArraySlice), PackColor(Src1));\n"
+" imageStore(OutMip[2], ivec3(GlobalInd.xy / 4u, ArraySlice), PackColor(Src1));\n"
" StoreColor(LocalInd, Src1);\n"
" }\n"
" }\n"
@@ -198,14 +198,14 @@
" {\n"
" // This bit mask would be 111111 (X & Y multiples of 8), but only one\n"
" // thread fits that criteria.\n"
-" if (LocalInd == 0)\n"
+" if (LocalInd == 0u)\n"
" {\n"
-" vec4 Src2 = LoadColor(LocalInd + 0x04);\n"
-" vec4 Src3 = LoadColor(LocalInd + 0x20);\n"
-" vec4 Src4 = LoadColor(LocalInd + 0x24);\n"
+" vec4 Src2 = LoadColor(LocalInd + 0x04u);\n"
+" vec4 Src3 = LoadColor(LocalInd + 0x20u);\n"
+" vec4 Src4 = LoadColor(LocalInd + 0x24u);\n"
" Src1 = 0.25 * (Src1 + Src2 + Src3 + Src4);\n"
"\n"
-" imageStore(OutMip[3], ivec3(GlobalInd.xy / 8, ArraySlice), PackColor(Src1));\n"
+" imageStore(OutMip[3], ivec3(GlobalInd.xy / 8u, ArraySlice), PackColor(Src1));\n"
" }\n"
" }\n"
"}\n"