mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-21 14:41:39 +00:00
softgpu: Add something like rectangle support. Doesn't seem to work :/
This commit is contained in:
parent
2aff3a8575
commit
55d6646fc3
@ -95,6 +95,17 @@ static inline int CalcClipMask(const ClipCoords& v)
|
||||
} \
|
||||
}
|
||||
|
||||
void ProcessQuad(VertexData* data)
|
||||
{
|
||||
// TODO: Clipping
|
||||
|
||||
VertexData verts[6] = { data[0], data[0], data[1], data[1], data[0], data[0] };
|
||||
verts[1].drawpos.x = data[1].drawpos.x;
|
||||
verts[4].drawpos.x = data[0].drawpos.x;
|
||||
Rasterizer::DrawTriangle(data);
|
||||
Rasterizer::DrawTriangle(data+3);
|
||||
}
|
||||
|
||||
void ProcessTriangle(VertexData* data)
|
||||
{
|
||||
enum { NUM_CLIPPED_VERTICES = 33, NUM_INDICES = NUM_CLIPPED_VERTICES + 3 };
|
||||
|
@ -22,5 +22,6 @@
|
||||
namespace Clipper {
|
||||
|
||||
void ProcessTriangle(VertexData* data);
|
||||
void ProcessQuad(VertexData* data);
|
||||
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ void SoftGPU::ExecuteOp(u32 op, u32 diff)
|
||||
"TRIANGLE_FAN=5,",
|
||||
"RECTANGLES=6,",
|
||||
};
|
||||
if (type != 3)
|
||||
if (type != GE_PRIM_TRIANGLES && type != GE_PRIM_RECTANGLES)
|
||||
break;
|
||||
|
||||
ERROR_LOG(G3D, "DL DrawPrim type: %s count: %i vaddr= %08x, iaddr= %08x", type<7 ? types[type] : "INVALID", count, gstate_c.vertexAddr, gstate_c.indexAddr);
|
||||
@ -269,6 +269,7 @@ void SoftGPU::ExecuteOp(u32 op, u32 diff)
|
||||
{
|
||||
// TODO: through mode support...
|
||||
ERROR_LOG(G3D, "Using through mode... fail");
|
||||
break;
|
||||
}
|
||||
|
||||
TransformUnit::SubmitPrimitive(verts, type, count, gstate.vertType);
|
||||
|
@ -72,17 +72,26 @@ void TransformUnit::SubmitPrimitive(void* vertices, u32 prim_type, int vertex_co
|
||||
vdecoder.SetVertexType(vertex_type);
|
||||
const DecVtxFormat& vtxfmt = vdecoder.GetDecVtxFmt();
|
||||
|
||||
static u8 buf[102400]; // yolo
|
||||
static u8 buf[1024000]; // yolo
|
||||
vdecoder.DecodeVerts(buf, vertices, 0, vertex_count - 1);
|
||||
|
||||
VertexReader vreader(buf, vtxfmt, vertex_type);
|
||||
|
||||
int vtcs_per_prim = 0;
|
||||
if (prim_type == GE_PRIM_POINTS) vtcs_per_prim = 1;
|
||||
else if (prim_type == GE_PRIM_LINES) vtcs_per_prim = 2;
|
||||
else if (prim_type == GE_PRIM_TRIANGLES) vtcs_per_prim = 3;
|
||||
else if (prim_type == GE_PRIM_RECTANGLES) vtcs_per_prim = 2;
|
||||
else {
|
||||
// TODO: Unsupported
|
||||
}
|
||||
|
||||
// We only support triangle lists, for now.
|
||||
for (int vtx = 0; vtx < vertex_count; vtx+=3)
|
||||
for (int vtx = 0; vtx < vertex_count; vtx += vtcs_per_prim)
|
||||
{
|
||||
VertexData data[3];
|
||||
|
||||
for (unsigned int i = 0; i < 3; ++i)
|
||||
for (unsigned int i = 0; i < vtcs_per_prim; ++i)
|
||||
{
|
||||
float pos[3];
|
||||
vreader.Goto(vtx+i);
|
||||
@ -102,6 +111,14 @@ void TransformUnit::SubmitPrimitive(void* vertices, u32 prim_type, int vertex_co
|
||||
|
||||
// TODO: Should do lighting here!
|
||||
|
||||
Clipper::ProcessTriangle(data);
|
||||
switch (prim_type) {
|
||||
case GE_PRIM_TRIANGLES:
|
||||
Clipper::ProcessTriangle(data);
|
||||
break;
|
||||
|
||||
case GE_PRIM_RECTANGLES:
|
||||
Clipper::ProcessQuad(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user