Fix various shader warnings

This commit is contained in:
2026-06-25 09:33:36 +02:00
parent 16c4304ab4
commit be87583cb2
7 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -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))
+2
View File
@@ -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
+1 -1
View File
@@ -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)
-2
View File
@@ -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;
};
+1 -1
View File
@@ -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);
@@ -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]];
+1 -1
View File
@@ -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;