diff --git a/Source/Shaders/BitonicSort.shader b/Source/Shaders/BitonicSort.shader index 129f58de7..a72ee59b7 100644 --- a/Source/Shaders/BitonicSort.shader +++ b/Source/Shaders/BitonicSort.shader @@ -62,7 +62,7 @@ void CS_IndirectArgs(uint groupIndex : SV_GroupIndex) return; uint count = CounterBuffer.Load(CounterOffset); - uint k = 2048 << groupIndex; + uint k = 2048u << groupIndex; // We need one more iteration every time the number of thread groups doubles if (k > NextPow2((count + 2047) & ~2047)) diff --git a/Source/Shaders/Common.hlsl b/Source/Shaders/Common.hlsl index e8ad9a586..2a92d4088 100644 --- a/Source/Shaders/Common.hlsl +++ b/Source/Shaders/Common.hlsl @@ -115,6 +115,7 @@ // Avoids flow control constructs. #define UNROLL [unroll] +#define UNROLL_N(n) [unroll(n)] // Gives preference to flow control constructs. #define LOOP [loop] @@ -139,6 +140,7 @@ // Compiler attribute fallback #ifndef UNROLL #define UNROLL +#define UNROLL_N(n) #endif #ifndef LOOP #define LOOP diff --git a/Source/Shaders/DepthOfField.shader b/Source/Shaders/DepthOfField.shader index 4fc3b21c0..eab802bd3 100644 --- a/Source/Shaders/DepthOfField.shader +++ b/Source/Shaders/DepthOfField.shader @@ -185,7 +185,7 @@ void CS_DepthOfField(uint3 groupID : SV_GroupID, uint3 groupThreadID : SV_GroupT GroupMemoryBarrierWithGroupSync(); // Don't continue for threads in the apron, and threads outside the render target size - if (grid >= 0 && grid < DOF_GRID_SIZE && samplePos.DOF_COMP >= 0 && samplePos.DOF_COMP < textureSize.DOF_COMP) + if (grid >= 0 && grid < DOF_GRID_SIZE && samplePos.DOF_COMP >= 0 && samplePos.DOF_COMP < (int)textureSize.DOF_COMP) { BRANCH if (cocSize > 0.0f) diff --git a/Source/Shaders/Editor/Grid.shader b/Source/Shaders/Editor/Grid.shader index 45bb1ed90..e18cfef90 100644 --- a/Source/Shaders/Editor/Grid.shader +++ b/Source/Shaders/Editor/Grid.shader @@ -26,7 +26,6 @@ struct ModelInput struct VertexOutput { float4 Position : SV_Position; - float2 TexCoord : TEXCOORD0; float3 WorldPosition : TEXCOORD1; }; @@ -34,7 +33,6 @@ struct VertexOutput struct PixelInput { float4 Position : SV_Position; - noperspective float2 TexCoord : TEXCOORD0; float3 WorldPosition : TEXCOORD1; }; diff --git a/Source/Shaders/GUICommon.hlsl b/Source/Shaders/GUICommon.hlsl index a96d2c7de..83a814f89 100644 --- a/Source/Shaders/GUICommon.hlsl +++ b/Source/Shaders/GUICommon.hlsl @@ -90,7 +90,7 @@ float GetFontMSDFPixelRange(Texture2D font, float2 uv) uint width, height; font.GetDimensions(width, height); float pxRange = 4.0f; // Must match C++ code - float unitRange = float2(pxRange, pxRange) / float2(width, height); + float2 unitRange = float2(pxRange, pxRange) / float2(width, height); float2 dx = ddx(uv); float2 dy = ddy(uv); diff --git a/Source/Shaders/GlobalSignDistanceField.shader b/Source/Shaders/GlobalSignDistanceField.shader index 2ac25a851..307ea9c61 100644 --- a/Source/Shaders/GlobalSignDistanceField.shader +++ b/Source/Shaders/GlobalSignDistanceField.shader @@ -136,6 +136,7 @@ void CS_RasterizeModel(uint3 DispatchThreadId : SV_DispatchThreadID) #if READ_SDF minDistance *= GlobalSDFTex[voxelCoord]; #endif + UNROLL_N(GLOBAL_SDF_RASTERIZE_MODEL_MAX_COUNT) for (uint i = 0; i < ObjectsCount; i++) { ObjectRasterizeData objectData = ObjectsBuffer[Objects[i / 4][i % 4]]; @@ -164,6 +165,7 @@ void CS_RasterizeHeightfield(uint3 DispatchThreadId : SV_DispatchThreadID) voxelCoord.x += CascadeIndex * CascadeResolution; float minDistance = MaxDistance * GlobalSDFTex[voxelCoord]; float thickness = -300.0f; + UNROLL_N(GLOBAL_SDF_RASTERIZE_HEIGHTFIELD_MAX_COUNT) for (uint i = 0; i < ObjectsCount; i++) { ObjectRasterizeData objectData = ObjectsBuffer[Objects[i / 4][i % 4]]; diff --git a/Source/Shaders/Lights.shader b/Source/Shaders/Lights.shader index 4fe47dba8..7ce544fa7 100644 --- a/Source/Shaders/Lights.shader +++ b/Source/Shaders/Lights.shader @@ -153,7 +153,7 @@ float4 PS_Complexity(Quad_VS2PS input) : SV_Target0 float outline = DepthOutline(Depth, input.TexCoord); // Sample accumulated complexity - float complexity = SAMPLE_RT(GBuffer0, input.TexCoord); + float complexity = SAMPLE_RT(GBuffer0, input.TexCoord).r; // Custom coloring const uint colorsCount = 9;