Warning fixes, minor cleanup

This commit is contained in:
Henrik Rydgård 2024-12-20 11:05:28 +01:00
parent bdb5f3a91b
commit bdf4b69207
5 changed files with 16 additions and 12 deletions

View file

@ -247,14 +247,6 @@ void DecodeAndTransformForDepthRaster(float *dest, GEPrimitiveType prim, const f
}
}
void DepthRasterConvertTransformed(DepthScreenVertex *screenVerts, const TransformedVertex *transformed, int count) {
for (int i = 0; i < count; i++) {
screenVerts[i].x = (int)transformed[i].pos[0];
screenVerts[i].y = (int)transformed[i].pos[1];
screenVerts[i].z = (u16)transformed[i].pos[2];
}
}
int DepthRasterClipIndexedTriangles(DepthScreenVertex *screenVerts, const float *transformed, const uint16_t *indexBuffer, int count) {
bool cullEnabled = gstate.isCullEnabled();
@ -312,6 +304,16 @@ int DepthRasterClipIndexedTriangles(DepthScreenVertex *screenVerts, const float
return outCount;
}
void DepthRasterConvertTransformed(DepthScreenVertex *screenVerts, GEPrimitiveType prim, const TransformedVertex *transformed, int count) {
_dbg_assert_(prim == GE_PRIM_RECTANGLES || prim == GE_PRIM_TRIANGLES);
for (int i = 0; i < count; i++) {
screenVerts[i].x = (int)transformed[i].pos[0];
screenVerts[i].y = (int)transformed[i].pos[1];
screenVerts[i].z = (u16)transformed[i].pos[2];
}
}
// Rasterizes screen-space vertices.
void DepthRasterScreenVerts(uint16_t *depth, int depthStride, GEPrimitiveType prim, int x1, int y1, int x2, int y2, const DepthScreenVertex *screenVerts, int count) {
// Prim should now be either TRIANGLES or RECTs.

View file

@ -19,5 +19,5 @@ struct TransformedVertex;
int DepthRasterClipIndexedTriangles(DepthScreenVertex *screenVerts, const float *transformed, const uint16_t *indexBuffer, int count);
void DecodeAndTransformForDepthRaster(float *dest, GEPrimitiveType prim, const float *worldviewproj, const void *vertexData, int count, VertexDecoder *dec, u32 vertTypeID);
void DepthRasterConvertTransformed(DepthScreenVertex *screenVerts, const TransformedVertex *transformed, int count);
void DepthRasterConvertTransformed(DepthScreenVertex *screenVerts, GEPrimitiveType prim, const TransformedVertex *transformed, int count);
void DepthRasterScreenVerts(uint16_t *depth, int depthStride, GEPrimitiveType prim, int x1, int y1, int x2, int y2, const DepthScreenVertex *screenVerts, int count);

View file

@ -953,7 +953,9 @@ void DrawEngineCommon::DepthRasterPretransformed(GEPrimitiveType prim, const Tra
break;
}
DepthRasterConvertTransformed(depthScreenVerts_, inVerts, count);
_dbg_assert_(prim != GE_PRIM_TRIANGLE_STRIP && prim != GE_PRIM_TRIANGLE_FAN);
DepthRasterConvertTransformed(depthScreenVerts_, prim, inVerts, count);
DepthRasterScreenVerts((uint16_t *)Memory::GetPointerWrite(gstate.getDepthBufRawAddress() | 0x04000000), gstate.DepthBufStride(),
prim, gstate.getScissorX1(), gstate.getScissorY1(), gstate.getScissorX2(), gstate.getScissorY2(),
depthScreenVerts_, count);

View file

@ -54,7 +54,7 @@ public:
void TranslatePrim(int prim, int numInds, const u32_le *inds, int indexOffset, bool clockwise);
// This is really the number of generated indices, or 3x the number of triangles.
int VertexCount() const { return inds_ - indsBase_; }
int VertexCount() const { return (int)(inds_ - indsBase_); }
private:
// Points (why index these? code simplicity)

View file

@ -1112,7 +1112,7 @@ bool TestSIMD() {
EXPECT_EQ_INT(testdata[1], 0);
__m128i a = _mm_set_epi16(0, 0x4444, 0, 0x3333, 0, 0x2222, 0, 0x1111);
__m128i b = _mm_set_epi16(0, 0x8888, 0, 0x7777, 0, 0x6666, 0, 0x5555);
__m128i b = _mm_set_epi16(0, (int16_t)0x8888, 0, 0x7777, 0, 0x6666, 0, 0x5555);
__m128i c = _mm_packu2_epi32_SSE2(a, b);
__m128i d = _mm_packus_epi32(a, b);