Skip to content

Commit f1637c0

Browse files
committed
Remove texcoord packing
1 parent ad3b6ba commit f1637c0

3 files changed

Lines changed: 9 additions & 29 deletions

File tree

src/core/utility/packing.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ ShaderVertex packShaderVertex(const Vertex* vertex) {
149149
packed.packedNormal = packOctNormal32(vertex->normal);
150150
packed.packedTangent = packTangent32(vertex->tangent);
151151
packed.packedColor = packColorRGBA8(vertex->color);
152-
packed.texcoord0 = packHalf2(vertex->texcoord0);
153-
packed.texcoord1 = packHalf2(vertex->texcoord1);
152+
memcpy(packed.texcoord0, vertex->texcoord0, sizeof(packed.texcoord0));
153+
memcpy(packed.texcoord1, vertex->texcoord1, sizeof(packed.texcoord1));
154154

155155
return packed;
156156
}

src/shaders/geometry/surface.slang

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,8 @@ SurfaceTextureData evaluateSurfaceTextureData(MeshInfo mesh, uint primitiveIndex
140140
unpackColorRGBA8(vertex2.packedColor),
141141
barycentrics
142142
),
143-
interpolateTriangleFloat2(
144-
unpackHalf2(vertex0.texcoord0),
145-
unpackHalf2(vertex1.texcoord0),
146-
unpackHalf2(vertex2.texcoord0),
147-
barycentrics
148-
),
149-
interpolateTriangleFloat2(
150-
unpackHalf2(vertex0.texcoord1),
151-
unpackHalf2(vertex1.texcoord1),
152-
unpackHalf2(vertex2.texcoord1),
153-
barycentrics
154-
)
143+
interpolateTriangleFloat2(vertex0.texcoord0, vertex1.texcoord0, vertex2.texcoord0, barycentrics),
144+
interpolateTriangleFloat2(vertex0.texcoord1, vertex1.texcoord1, vertex2.texcoord1, barycentrics)
155145
);
156146
}
157147

@@ -214,18 +204,8 @@ SurfaceShadingData reconstructSurfaceShading(
214204
unpackColorRGBA8(vertex2.packedColor),
215205
barycentrics
216206
),
217-
interpolateTriangleFloat2(
218-
unpackHalf2(vertex0.texcoord0),
219-
unpackHalf2(vertex1.texcoord0),
220-
unpackHalf2(vertex2.texcoord0),
221-
barycentrics
222-
),
223-
interpolateTriangleFloat2(
224-
unpackHalf2(vertex0.texcoord1),
225-
unpackHalf2(vertex1.texcoord1),
226-
unpackHalf2(vertex2.texcoord1),
227-
barycentrics
228-
)
207+
interpolateTriangleFloat2(vertex0.texcoord0, vertex1.texcoord0, vertex2.texcoord0, barycentrics),
208+
interpolateTriangleFloat2(vertex0.texcoord1, vertex1.texcoord1, vertex2.texcoord1, barycentrics)
229209
);
230210

231211
return hit;

src/shared/types.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ VKRT_SHARED_STRUCT(Vertex, {
3232
})
3333

3434
VKRT_SHARED_STRUCT(ShaderVertex, {
35-
float3 position;
35+
float4 position;
36+
float2 texcoord0;
37+
float2 texcoord1;
3638
uint packedNormal;
3739
uint packedTangent;
3840
uint packedColor;
39-
uint texcoord0;
40-
uint texcoord1;
4141
})
4242

4343
VKRT_SHARED_STRUCT(MeshInfo, {

0 commit comments

Comments
 (0)