From 1e78642a7b0e449b6271b5ecdc00e79652a4f04e Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 15 Apr 2017 21:04:11 -0700 Subject: [PATCH] SoftGPU: Remove old spline handling code. --- GPU/Software/SoftGpu.cpp | 25 --------- GPU/Software/TransformUnit.cpp | 92 ---------------------------------- GPU/Software/TransformUnit.h | 4 -- 3 files changed, 121 deletions(-) diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index a9ae7e57a6..718ae3f3a4 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -434,20 +434,10 @@ void SoftGPU::ExecuteOp(u32 op, u32 diff) { bool computeNormals = gstate.isLightingEnabled(); bool patchFacing = gstate.patchfacing & 1; - if (g_Config.bHardwareTessellation && g_Config.bHardwareTransform && !g_Config.bSoftwareRendering) { - gstate_c.bezier = true; - if (gstate_c.spline_count_u != bz_ucount) { - gstate_c.Dirty(DIRTY_BEZIERSPLINE); - gstate_c.spline_count_u = bz_ucount; - } - } - int bytesRead = 0; drawEngineCommon_->SubmitBezier(control_points, indices, gstate.getPatchDivisionU(), gstate.getPatchDivisionV(), bz_ucount, bz_vcount, patchPrim, computeNormals, patchFacing, gstate.vertType, &bytesRead); framebufferDirty_ = true; - gstate_c.bezier = false; - // After drawing, we advance pointers - see SubmitPrim which does the same. int count = bz_ucount * bz_vcount; AdvanceVerts(gstate.vertType, count, bytesRead); @@ -497,25 +487,10 @@ void SoftGPU::ExecuteOp(u32 op, u32 diff) { bool patchFacing = gstate.patchfacing & 1; u32 vertType = gstate.vertType; - if (g_Config.bHardwareTessellation && g_Config.bHardwareTransform && !g_Config.bSoftwareRendering) { - gstate_c.spline = true; - bool countsChanged = gstate_c.spline_count_u != sp_ucount || gstate_c.spline_count_v != sp_vcount; - bool typesChanged = gstate_c.spline_type_u != sp_utype || gstate_c.spline_type_v != sp_vtype; - if (countsChanged || typesChanged) { - gstate_c.Dirty(DIRTY_BEZIERSPLINE); - gstate_c.spline_count_u = sp_ucount; - gstate_c.spline_count_v = sp_vcount; - gstate_c.spline_type_u = sp_utype; - gstate_c.spline_type_v = sp_vtype; - } - } - int bytesRead = 0; drawEngineCommon_->SubmitSpline(control_points, indices, gstate.getPatchDivisionU(), gstate.getPatchDivisionV(), sp_ucount, sp_vcount, sp_utype, sp_vtype, patchPrim, computeNormals, patchFacing, vertType, &bytesRead); framebufferDirty_ = true; - gstate_c.spline = false; - // After drawing, we advance pointers - see SubmitPrim which does the same. int count = sp_ucount * sp_vcount; AdvanceVerts(gstate.vertType, count, bytesRead); diff --git a/GPU/Software/TransformUnit.cpp b/GPU/Software/TransformUnit.cpp index 4c6724c52e..d227e635d9 100644 --- a/GPU/Software/TransformUnit.cpp +++ b/GPU/Software/TransformUnit.cpp @@ -212,98 +212,6 @@ struct SplinePatch { int pad[3]; }; -SplinePatch *TransformUnit::patchBuffer_ = 0; -int TransformUnit::patchBufferSize_ = 0; - -void TransformUnit::SubmitSpline(void* control_points, void* indices, int count_u, int count_v, int type_u, int type_v, GEPatchPrimType prim_type, u32 vertex_type) { - VertexDecoder vdecoder; - VertexDecoderOptions options{}; - vdecoder.SetVertexType(vertex_type, options); - const DecVtxFormat& vtxfmt = vdecoder.GetDecVtxFmt(); - - static u8 buf[65536 * 48]; // yolo - u16 index_lower_bound = 0; - u16 index_upper_bound = count_u * count_v - 1; - bool indices_16bit = (vertex_type & GE_VTYPE_IDX_MASK) == GE_VTYPE_IDX_16BIT; - bool indices_32bit = (vertex_type & GE_VTYPE_IDX_MASK) == GE_VTYPE_IDX_32BIT; - u8 *indices8 = (u8 *)indices; - u16 *indices16 = (u16 *)indices; - u32 *indices32 = (u32 *)indices; - if (indices) - GetIndexBounds(indices, count_u*count_v, vertex_type, &index_lower_bound, &index_upper_bound); - vdecoder.DecodeVerts(buf, control_points, index_lower_bound, index_upper_bound); - - VertexReader vreader(buf, vtxfmt, vertex_type); - - int num_patches_u = count_u - 3; - int num_patches_v = count_v - 3; - - if (patchBufferSize_ < num_patches_u * num_patches_v) { - if (patchBuffer_) { - FreeAlignedMemory(patchBuffer_); - } - patchBuffer_ = (SplinePatch *)AllocateAlignedMemory(num_patches_u * num_patches_v, 16); - patchBufferSize_ = num_patches_u * num_patches_v; - } - SplinePatch *patches = patchBuffer_; - - for (int patch_u = 0; patch_u < num_patches_u; ++patch_u) { - for (int patch_v = 0; patch_v < num_patches_v; ++patch_v) { - SplinePatch& patch = patches[patch_u + patch_v * num_patches_u]; - - for (int point = 0; point < 16; ++point) { - int idx = (patch_u + point%4) + (patch_v + point/4) * count_u; - if (indices) { - if (indices_32bit) { - vreader.Goto(indices32[idx]); - } else if (indices_16bit) { - vreader.Goto(indices16[idx]); - } else { - vreader.Goto(indices8[idx]); - } - } else { - vreader.Goto(idx); - } - - patch.points[point] = ReadVertex(vreader); - } - patch.type = (type_u | (type_v<<2)); - if (patch_u != 0) patch.type &= ~START_OPEN_U; - if (patch_v != 0) patch.type &= ~START_OPEN_V; - if (patch_u != num_patches_u-1) patch.type &= ~END_OPEN_U; - if (patch_v != num_patches_v-1) patch.type &= ~END_OPEN_V; - } - } - - for (int patch_idx = 0; patch_idx < num_patches_u*num_patches_v; ++patch_idx) { - SplinePatch& patch = patches[patch_idx]; - - // TODO: Should do actual patch subdivision instead of just drawing the control points! - const int tile_min_u = (patch.type & START_OPEN_U) ? 0 : 1; - const int tile_min_v = (patch.type & START_OPEN_V) ? 0 : 1; - const int tile_max_u = (patch.type & END_OPEN_U) ? 3 : 2; - const int tile_max_v = (patch.type & END_OPEN_V) ? 3 : 2; - for (int tile_u = tile_min_u; tile_u < tile_max_u; ++tile_u) { - for (int tile_v = tile_min_v; tile_v < tile_max_v; ++tile_v) { - int point_index = tile_u + tile_v*4; - - VertexData v0 = patch.points[point_index]; - VertexData v1 = patch.points[point_index+1]; - VertexData v2 = patch.points[point_index+4]; - VertexData v3 = patch.points[point_index+5]; - - // TODO: Backface culling etc - Clipper::ProcessTriangle(v0, v1, v2); - Clipper::ProcessTriangle(v2, v1, v0); - Clipper::ProcessTriangle(v2, v1, v3); - Clipper::ProcessTriangle(v3, v1, v2); - } - } - } - - host->GPUNotifyDraw(); -} - void TransformUnit::SubmitPrimitive(void* vertices, void* indices, u32 prim_type, int vertex_count, u32 vertex_type, int *bytesRead) { // TODO: Cache VertexDecoder objects diff --git a/GPU/Software/TransformUnit.h b/GPU/Software/TransformUnit.h index b0b77833e1..40e964cc8c 100644 --- a/GPU/Software/TransformUnit.h +++ b/GPU/Software/TransformUnit.h @@ -126,14 +126,10 @@ public: static DrawingCoords ScreenToDrawing(const ScreenCoords& coords); static ScreenCoords DrawingToScreen(const DrawingCoords& coords); - static void SubmitSpline(void* control_points, void* indices, int count_u, int count_v, int type_u, int type_v, GEPatchPrimType prim_type, u32 vertex_type); static void SubmitPrimitive(void* vertices, void* indices, u32 prim_type, int vertex_count, u32 vertex_type, int *bytesRead); static bool GetCurrentSimpleVertices(int count, std::vector &vertices, std::vector &indices); static VertexData ReadVertex(VertexReader& vreader); - static SplinePatch *patchBuffer_; - static int patchBufferSize_; - static bool outside_range_flag; };