Skip to content

Commit 330d58f

Browse files
committed
solving warnings
1 parent 263e569 commit 330d58f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

62_CAD/common.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ struct CurveBox
119119
{
120120
// will get transformed in the vertex shader, and will be calculated on the cpu when generating these boxes
121121
float64_t2 aabbMin; // 16
122-
float64_t2 aabbMax; // 32
122+
float64_t2 aabbMax; // 32 , TODO: we know it's a square/box -> we save 8 bytes if we needed to store extra data
123123
float32_t2 curveMin[3]; // 56
124124
float32_t2 curveMax[3]; // 80
125125
};

62_CAD/vertex_shader.hlsl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,10 @@ PSInput main(uint vertexID : SV_VertexID)
379379
curveBox.curveMax[i] = vk::RawBufferLoad<float32_t2>(drawObj.geometryAddress + sizeof(double2) * 2 + sizeof(float32_t2) * (3 + i), 4u);
380380
}
381381

382-
// TODO: better name?
383-
// TODO: can we use floats instead of doubles for every dilation and ndc things except the main box values
384-
const double2 ndcBoxAxisX = transformVectorNdc(clipProjectionData.projectionToNDC, double2(curveBox.aabbMax.x, curveBox.aabbMin.y) - curveBox.aabbMin);
385-
const double2 ndcBoxAxisY = transformVectorNdc(clipProjectionData.projectionToNDC, double2(curveBox.aabbMin.x, curveBox.aabbMax.y) - curveBox.aabbMin);
382+
const float2 ndcBoxAxisX = (float2)transformVectorNdc(clipProjectionData.projectionToNDC, double2(curveBox.aabbMax.x, curveBox.aabbMin.y) - curveBox.aabbMin);
383+
const float2 ndcBoxAxisY = (float2)transformVectorNdc(clipProjectionData.projectionToNDC, double2(curveBox.aabbMin.x, curveBox.aabbMax.y) - curveBox.aabbMin);
386384

387-
const double2 screenSpaceAabbExtents = double2(length(ndcBoxAxisX * double2(globals.resolution)) / 2.0, length(ndcBoxAxisY * double2(globals.resolution)) / 2.0);
385+
const float2 screenSpaceAabbExtents = float2(length(ndcBoxAxisX * float2(globals.resolution)) / 2.0, length(ndcBoxAxisY * float2(globals.resolution)) / 2.0);
388386

389387
// we could use something like this to compute screen space change over minor/major change and avoid ddx(minor), ddy(major) in frag shader (the code below doesn't account for rotation)
390388
outV.setCurveBoxScreenSpaceSize(float2(screenSpaceAabbExtents));
@@ -474,7 +472,7 @@ PSInput main(uint vertexID : SV_VertexID)
474472
const float2 corner = float2(bool2(vertexIdx & 0x1u, vertexIdx >> 1)); // corners of square from (0, 0) to (1, 1)
475473
const float2 undilatedCornerNDC = corner * 2.0 - 1.0; // corners of square from (-1, -1) to (1, 1)
476474

477-
const double2 screenSpaceAabbExtents = double2(length(screenDirU * double2(globals.resolution)) / 2.0, length(screenDirV * double2(globals.resolution)) / 2.0);
475+
const float2 screenSpaceAabbExtents = float2(length(screenDirU * float2(globals.resolution)) / 2.0, length(screenDirV * float2(globals.resolution)) / 2.0);
478476
const float pixelsToIncreaseOnEachSide = globals.antiAliasingFactor + 1.0;
479477
const float2 dilateRate = (float2)(pixelsToIncreaseOnEachSide / screenSpaceAabbExtents);
480478

0 commit comments

Comments
 (0)