From ab9c1d4dc052dac4e26e9f96ffa62f5a7f956390 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sat, 21 Jan 2017 20:42:40 +0100 Subject: [PATCH] Centralize the spline/bezier/bbox execute functions into GPUCommon --- GPU/Directx9/GPU_DX9.cpp | 118 +------------------------------------- GPU/Directx9/GPU_DX9.h | 3 - GPU/GLES/GPU_GLES.cpp | 116 +------------------------------------ GPU/GLES/GPU_GLES.h | 3 - GPU/GPUCommon.cpp | 118 ++++++++++++++++++++++++++++++++++++++ GPU/GPUCommon.h | 6 ++ GPU/Vulkan/GPU_Vulkan.cpp | 116 +------------------------------------ GPU/Vulkan/GPU_Vulkan.h | 3 - 8 files changed, 127 insertions(+), 356 deletions(-) diff --git a/GPU/Directx9/GPU_DX9.cpp b/GPU/Directx9/GPU_DX9.cpp index 1c2165abad..629cb787f5 100644 --- a/GPU/Directx9/GPU_DX9.cpp +++ b/GPU/Directx9/GPU_DX9.cpp @@ -402,6 +402,7 @@ GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx) framebufferManager_ = framebufferManagerDX9_; textureCacheDX9_ = new TextureCacheDX9(); textureCache_ = textureCacheDX9_; + drawEngineCommon_ = &drawEngine_; shaderManager_ = new ShaderManagerDX9(); drawEngine_.SetShaderManager(shaderManager_); @@ -796,95 +797,6 @@ void GPU_DX9::Execute_Prim(u32 op, u32 diff) { AdvanceVerts(vertexType, count, bytesRead); } -void GPU_DX9::Execute_Bezier(u32 op, u32 diff) { - // This also make skipping drawing very effective. - framebufferManagerDX9_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason); - if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) { - // TODO: Should this eat some cycles? Probably yes. Not sure if important. - return; - } - - if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); - return; - } - - void *control_points = Memory::GetPointerUnchecked(gstate_c.vertexAddr); - void *indices = NULL; - if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { - if (!Memory::IsValidAddress(gstate_c.indexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad index address %08x!", gstate_c.indexAddr); - return; - } - indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); - } - - if (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) { - DEBUG_LOG_REPORT(G3D, "Bezier + morph: %i", (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT); - } - if (vertTypeIsSkinningEnabled(gstate.vertType)) { - DEBUG_LOG_REPORT(G3D, "Bezier + skinning: %i", vertTypeGetNumBoneWeights(gstate.vertType)); - } - - GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType(); - int bz_ucount = op & 0xFF; - int bz_vcount = (op >> 8) & 0xFF; - bool computeNormals = gstate.isLightingEnabled(); - bool patchFacing = gstate.patchfacing & 1; - int bytesRead = 0; - drawEngine_.SubmitBezier(control_points, indices, gstate.getPatchDivisionU(), gstate.getPatchDivisionV(), bz_ucount, bz_vcount, patchPrim, computeNormals, patchFacing, gstate.vertType, &bytesRead); - - // After drawing, we advance pointers - see SubmitPrim which does the same. - int count = bz_ucount * bz_vcount; - AdvanceVerts(gstate.vertType, count, bytesRead); -} - -void GPU_DX9::Execute_Spline(u32 op, u32 diff) { - // This also make skipping drawing very effective. - framebufferManagerDX9_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason); - if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) { - // TODO: Should this eat some cycles? Probably yes. Not sure if important. - return; - } - - if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); - return; - } - - void *control_points = Memory::GetPointerUnchecked(gstate_c.vertexAddr); - void *indices = NULL; - if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { - if (!Memory::IsValidAddress(gstate_c.indexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad index address %08x!", gstate_c.indexAddr); - return; - } - indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); - } - - if (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) { - DEBUG_LOG_REPORT(G3D, "Spline + morph: %i", (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT); - } - if (vertTypeIsSkinningEnabled(gstate.vertType)) { - DEBUG_LOG_REPORT(G3D, "Spline + skinning: %i", vertTypeGetNumBoneWeights(gstate.vertType)); - } - - int sp_ucount = op & 0xFF; - int sp_vcount = (op >> 8) & 0xFF; - int sp_utype = (op >> 16) & 0x3; - int sp_vtype = (op >> 18) & 0x3; - GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType(); - bool computeNormals = gstate.isLightingEnabled(); - bool patchFacing = gstate.patchfacing & 1; - u32 vertType = gstate.vertType; - int bytesRead = 0; - drawEngine_.SubmitSpline(control_points, indices, gstate.getPatchDivisionU(), gstate.getPatchDivisionV(), sp_ucount, sp_vcount, sp_utype, sp_vtype, patchPrim, computeNormals, patchFacing, vertType, &bytesRead); - - // After drawing, we advance pointers - see SubmitPrim which does the same. - int count = sp_ucount * sp_vcount; - AdvanceVerts(gstate.vertType, count, bytesRead); -} - void GPU_DX9::Execute_ViewportType(u32 op, u32 diff) { gstate_c.framebufChanged = true; gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY; @@ -896,34 +808,6 @@ void GPU_DX9::Execute_ViewportType(u32 op, u32 diff) { } } -void GPU_DX9::Execute_BoundingBox(u32 op, u32 diff) { - // Just resetting, nothing to bound. - const u32 data = op & 0x00FFFFFF; - if (data == 0) { - // TODO: Should this set the bboxResult? Let's set it true for now. - currentList->bboxResult = true; - return; - } - if (((data & 7) == 0) && data <= 64) { // Sanity check - void *control_points = Memory::GetPointer(gstate_c.vertexAddr); - if (gstate.vertType & GE_VTYPE_IDX_MASK) { - ERROR_LOG_REPORT_ONCE(boundingbox, G3D, "Indexed bounding box data not supported."); - // Data seems invalid. Let's assume the box test passed. - currentList->bboxResult = true; - return; - } - - // Test if the bounding box is within the drawing region. - if (control_points) { - currentList->bboxResult = drawEngine_.TestBoundingBox(control_points, data, gstate.vertType); - } - } else { - ERROR_LOG_REPORT_ONCE(boundingbox, G3D, "Bad bounding box data: %06x", data); - // Data seems invalid. Let's assume the box test passed. - currentList->bboxResult = true; - } -} - void GPU_DX9::Execute_Region(u32 op, u32 diff) { gstate_c.framebufChanged = true; gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY; diff --git a/GPU/Directx9/GPU_DX9.h b/GPU/Directx9/GPU_DX9.h index a1bf7ac22a..ff9704cd31 100644 --- a/GPU/Directx9/GPU_DX9.h +++ b/GPU/Directx9/GPU_DX9.h @@ -84,9 +84,6 @@ public: void Execute_Vaddr(u32 op, u32 diff); void Execute_Iaddr(u32 op, u32 diff); void Execute_Prim(u32 op, u32 diff); - void Execute_Bezier(u32 op, u32 diff); - void Execute_Spline(u32 op, u32 diff); - void Execute_BoundingBox(u32 op, u32 diff); void Execute_VertexType(u32 op, u32 diff); void Execute_VertexTypeSkinning(u32 op, u32 diff); void Execute_Region(u32 op, u32 diff); diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index 5a1215a7bc..06660fae55 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -406,6 +406,7 @@ GPU_GLES::GPU_GLES(GraphicsContext *ctx) framebufferManager_ = framebufferManagerGL_; textureCacheGL_ = new TextureCache(); textureCache_ = textureCacheGL_; + drawEngineCommon_ = &drawEngine_; drawEngine_.SetShaderManager(shaderManager_); drawEngine_.SetTextureCache(textureCacheGL_); @@ -985,121 +986,6 @@ void GPU_GLES::Execute_VertexTypeSkinning(u32 op, u32 diff) { } } -void GPU_GLES::Execute_Bezier(u32 op, u32 diff) { - // This also make skipping drawing very effective. - framebufferManagerGL_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason); - if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) { - // TODO: Should this eat some cycles? Probably yes. Not sure if important. - return; - } - - if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); - return; - } - - void *control_points = Memory::GetPointerUnchecked(gstate_c.vertexAddr); - void *indices = NULL; - if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { - if (!Memory::IsValidAddress(gstate_c.indexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad index address %08x!", gstate_c.indexAddr); - return; - } - indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); - } - - if (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) { - DEBUG_LOG_REPORT(G3D, "Bezier + morph: %i", (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT); - } - if (vertTypeIsSkinningEnabled(gstate.vertType)) { - DEBUG_LOG_REPORT(G3D, "Bezier + skinning: %i", vertTypeGetNumBoneWeights(gstate.vertType)); - } - - GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType(); - int bz_ucount = op & 0xFF; - int bz_vcount = (op >> 8) & 0xFF; - bool computeNormals = gstate.isLightingEnabled(); - bool patchFacing = gstate.patchfacing & 1; - int bytesRead = 0; - drawEngine_.SubmitBezier(control_points, indices, gstate.getPatchDivisionU(), gstate.getPatchDivisionV(), bz_ucount, bz_vcount, patchPrim, computeNormals, patchFacing, gstate.vertType, &bytesRead); - - // After drawing, we advance pointers - see SubmitPrim which does the same. - int count = bz_ucount * bz_vcount; - AdvanceVerts(gstate.vertType, count, bytesRead); -} - -void GPU_GLES::Execute_Spline(u32 op, u32 diff) { - // This also make skipping drawing very effective. - framebufferManagerGL_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason); - if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) { - // TODO: Should this eat some cycles? Probably yes. Not sure if important. - return; - } - - if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); - return; - } - - void *control_points = Memory::GetPointerUnchecked(gstate_c.vertexAddr); - void *indices = NULL; - if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { - if (!Memory::IsValidAddress(gstate_c.indexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad index address %08x!", gstate_c.indexAddr); - return; - } - indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); - } - - if (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) { - DEBUG_LOG_REPORT(G3D, "Spline + morph: %i", (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT); - } - if (vertTypeIsSkinningEnabled(gstate.vertType)) { - DEBUG_LOG_REPORT(G3D, "Spline + skinning: %i", vertTypeGetNumBoneWeights(gstate.vertType)); - } - - int sp_ucount = op & 0xFF; - int sp_vcount = (op >> 8) & 0xFF; - int sp_utype = (op >> 16) & 0x3; - int sp_vtype = (op >> 18) & 0x3; - GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType(); - bool computeNormals = gstate.isLightingEnabled(); - bool patchFacing = gstate.patchfacing & 1; - u32 vertType = gstate.vertType; - int bytesRead = 0; - drawEngine_.SubmitSpline(control_points, indices, gstate.getPatchDivisionU(), gstate.getPatchDivisionV(), sp_ucount, sp_vcount, sp_utype, sp_vtype, patchPrim, computeNormals, patchFacing, vertType, &bytesRead); - - // After drawing, we advance pointers - see SubmitPrim which does the same. - int count = sp_ucount * sp_vcount; - AdvanceVerts(gstate.vertType, count, bytesRead); -} - -void GPU_GLES::Execute_BoundingBox(u32 op, u32 diff) { - // Just resetting, nothing to bound. - const u32 data = op & 0x00FFFFFF; - if (data == 0) { - // TODO: Should this set the bboxResult? Let's set it true for now. - currentList->bboxResult = true; - return; - } - if (((data & 7) == 0) && data <= 64) { // Sanity check - void *control_points = Memory::GetPointer(gstate_c.vertexAddr); - if (gstate.vertType & GE_VTYPE_IDX_MASK) { - ERROR_LOG_REPORT_ONCE(boundingbox, G3D, "Indexed bounding box data not supported."); - // Data seems invalid. Let's assume the box test passed. - currentList->bboxResult = true; - return; - } - - // Test if the bounding box is within the drawing region. - currentList->bboxResult = drawEngine_.TestBoundingBox(control_points, data, gstate.vertType); - } else { - ERROR_LOG_REPORT_ONCE(boundingbox, G3D, "Bad bounding box data: %06x", data); - // Data seems invalid. Let's assume the box test passed. - currentList->bboxResult = true; - } -} - void GPU_GLES::Execute_Region(u32 op, u32 diff) { gstate_c.framebufChanged = true; gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY; diff --git a/GPU/GLES/GPU_GLES.h b/GPU/GLES/GPU_GLES.h index 774f6ba208..2a362a7d5e 100644 --- a/GPU/GLES/GPU_GLES.h +++ b/GPU/GLES/GPU_GLES.h @@ -89,9 +89,6 @@ public: void Execute_Vaddr(u32 op, u32 diff); void Execute_Iaddr(u32 op, u32 diff); void Execute_Prim(u32 op, u32 diff); - void Execute_Bezier(u32 op, u32 diff); - void Execute_Spline(u32 op, u32 diff); - void Execute_BoundingBox(u32 op, u32 diff); void Execute_VertexType(u32 op, u32 diff); void Execute_VertexTypeSkinning(u32 op, u32 diff); void Execute_Region(u32 op, u32 diff); diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 7e8bb73202..f0c7492b2d 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -23,6 +23,7 @@ #include "Core/MemMapHelpers.h" #include "GPU/Common/FramebufferCommon.h" #include "GPU/Common/TextureCacheCommon.h" +#include "GPU/Common/DrawEngineCommon.h" GPUCommon::GPUCommon() : dumpNextFrame_(false), @@ -1035,6 +1036,123 @@ void GPUCommon::Execute_End(u32 op, u32 diff) { } } +void GPUCommon::Execute_Bezier(u32 op, u32 diff) { + // This also make skipping drawing very effective. + framebufferManager_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason); + if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) { + // TODO: Should this eat some cycles? Probably yes. Not sure if important. + return; + } + + if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { + ERROR_LOG_REPORT(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); + return; + } + + void *control_points = Memory::GetPointerUnchecked(gstate_c.vertexAddr); + void *indices = NULL; + if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { + if (!Memory::IsValidAddress(gstate_c.indexAddr)) { + ERROR_LOG_REPORT(G3D, "Bad index address %08x!", gstate_c.indexAddr); + return; + } + indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); + } + + if (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) { + DEBUG_LOG_REPORT(G3D, "Bezier + morph: %i", (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT); + } + if (vertTypeIsSkinningEnabled(gstate.vertType)) { + DEBUG_LOG_REPORT(G3D, "Bezier + skinning: %i", vertTypeGetNumBoneWeights(gstate.vertType)); + } + + GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType(); + int bz_ucount = op & 0xFF; + int bz_vcount = (op >> 8) & 0xFF; + bool computeNormals = gstate.isLightingEnabled(); + bool patchFacing = gstate.patchfacing & 1; + int bytesRead = 0; + drawEngineCommon_->SubmitBezier(control_points, indices, gstate.getPatchDivisionU(), gstate.getPatchDivisionV(), bz_ucount, bz_vcount, patchPrim, computeNormals, patchFacing, gstate.vertType, &bytesRead); + + // After drawing, we advance pointers - see SubmitPrim which does the same. + int count = bz_ucount * bz_vcount; + AdvanceVerts(gstate.vertType, count, bytesRead); +} + +void GPUCommon::Execute_Spline(u32 op, u32 diff) { + // This also make skipping drawing very effective. + framebufferManager_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason); + if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) { + // TODO: Should this eat some cycles? Probably yes. Not sure if important. + return; + } + + if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { + ERROR_LOG_REPORT(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); + return; + } + + void *control_points = Memory::GetPointerUnchecked(gstate_c.vertexAddr); + void *indices = NULL; + if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { + if (!Memory::IsValidAddress(gstate_c.indexAddr)) { + ERROR_LOG_REPORT(G3D, "Bad index address %08x!", gstate_c.indexAddr); + return; + } + indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); + } + + if (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) { + DEBUG_LOG_REPORT(G3D, "Spline + morph: %i", (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT); + } + if (vertTypeIsSkinningEnabled(gstate.vertType)) { + DEBUG_LOG_REPORT(G3D, "Spline + skinning: %i", vertTypeGetNumBoneWeights(gstate.vertType)); + } + + int sp_ucount = op & 0xFF; + int sp_vcount = (op >> 8) & 0xFF; + int sp_utype = (op >> 16) & 0x3; + int sp_vtype = (op >> 18) & 0x3; + GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType(); + bool computeNormals = gstate.isLightingEnabled(); + bool patchFacing = gstate.patchfacing & 1; + u32 vertType = gstate.vertType; + 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); + + // After drawing, we advance pointers - see SubmitPrim which does the same. + int count = sp_ucount * sp_vcount; + AdvanceVerts(gstate.vertType, count, bytesRead); +} + +void GPUCommon::Execute_BoundingBox(u32 op, u32 diff) { + // Just resetting, nothing to check bounds for. + const u32 data = op & 0x00FFFFFF; + if (data == 0) { + // TODO: Should this set the bboxResult? Let's set it true for now. + currentList->bboxResult = true; + return; + } + if (((data & 7) == 0) && data <= 64) { // Sanity check + void *control_points = Memory::GetPointer(gstate_c.vertexAddr); + if (gstate.vertType & GE_VTYPE_IDX_MASK) { + ERROR_LOG_REPORT_ONCE(boundingbox, G3D, "Indexed bounding box data not supported."); + // Data seems invalid. Let's assume the box test passed. + currentList->bboxResult = true; + return; + } + + // Test if the bounding box is within the drawing region. + if (control_points) { + currentList->bboxResult = drawEngineCommon_->TestBoundingBox(control_points, data, gstate.vertType); + } + } else { + ERROR_LOG_REPORT_ONCE(boundingbox, G3D, "Bad bounding box data: %06x", data); + // Data seems invalid. Let's assume the box test passed. + currentList->bboxResult = true; + } +} + void GPUCommon::ExecuteOp(u32 op, u32 diff) { const u32 cmd = op >> 24; diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 271373f5a9..6f03cf693a 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -16,6 +16,7 @@ typedef ThreadEventQueue DisplayListQueue; diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index f26cacb090..dde2855e45 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -403,6 +403,7 @@ GPU_Vulkan::GPU_Vulkan(GraphicsContext *ctx) framebufferManager_ = framebufferManagerVulkan_; textureCacheVulkan_ = new TextureCacheVulkan(vulkan_); textureCache_ = textureCacheVulkan_; + drawEngineCommon_ = &drawEngine_; drawEngine_.SetTextureCache(textureCacheVulkan_); drawEngine_.SetFramebufferManager(framebufferManagerVulkan_); @@ -827,121 +828,6 @@ void GPU_Vulkan::Execute_VertexType(u32 op, u32 diff) { } } -void GPU_Vulkan::Execute_Bezier(u32 op, u32 diff) { - // This also make skipping drawing very effective. - framebufferManager_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason); - if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) { - // TODO: Should this eat some cycles? Probably yes. Not sure if important. - return; - } - - if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); - return; - } - - void *control_points = Memory::GetPointerUnchecked(gstate_c.vertexAddr); - void *indices = NULL; - if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { - if (!Memory::IsValidAddress(gstate_c.indexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad index address %08x!", gstate_c.indexAddr); - return; - } - indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); - } - - if (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) { - DEBUG_LOG_REPORT(G3D, "Bezier + morph: %i", (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT); - } - if (vertTypeIsSkinningEnabled(gstate.vertType)) { - DEBUG_LOG_REPORT(G3D, "Bezier + skinning: %i", vertTypeGetNumBoneWeights(gstate.vertType)); - } - - GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType(); - int bz_ucount = op & 0xFF; - int bz_vcount = (op >> 8) & 0xFF; - bool computeNormals = gstate.isLightingEnabled(); - bool patchFacing = gstate.patchfacing & 1; - int bytesRead = 0; - drawEngine_.SubmitBezier(control_points, indices, gstate.getPatchDivisionU(), gstate.getPatchDivisionV(), bz_ucount, bz_vcount, patchPrim, computeNormals, patchFacing, gstate.vertType, &bytesRead); - - // After drawing, we advance pointers - see SubmitPrim which does the same. - int count = bz_ucount * bz_vcount; - AdvanceVerts(gstate.vertType, count, bytesRead); -} - -void GPU_Vulkan::Execute_Spline(u32 op, u32 diff) { - // This also make skipping drawing very effective. - framebufferManager_->SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason); - if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) { - // TODO: Should this eat some cycles? Probably yes. Not sure if important. - return; - } - - if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); - return; - } - - void *control_points = Memory::GetPointerUnchecked(gstate_c.vertexAddr); - void *indices = NULL; - if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { - if (!Memory::IsValidAddress(gstate_c.indexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad index address %08x!", gstate_c.indexAddr); - return; - } - indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); - } - - if (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) { - DEBUG_LOG_REPORT(G3D, "Spline + morph: %i", (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT); - } - if (vertTypeIsSkinningEnabled(gstate.vertType)) { - DEBUG_LOG_REPORT(G3D, "Spline + skinning: %i", vertTypeGetNumBoneWeights(gstate.vertType)); - } - - int sp_ucount = op & 0xFF; - int sp_vcount = (op >> 8) & 0xFF; - int sp_utype = (op >> 16) & 0x3; - int sp_vtype = (op >> 18) & 0x3; - GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType(); - bool computeNormals = gstate.isLightingEnabled(); - bool patchFacing = gstate.patchfacing & 1; - u32 vertType = gstate.vertType; - int bytesRead = 0; - drawEngine_.SubmitSpline(control_points, indices, gstate.getPatchDivisionU(), gstate.getPatchDivisionV(), sp_ucount, sp_vcount, sp_utype, sp_vtype, patchPrim, computeNormals, patchFacing, vertType, &bytesRead); - - // After drawing, we advance pointers - see SubmitPrim which does the same. - int count = sp_ucount * sp_vcount; - AdvanceVerts(gstate.vertType, count, bytesRead); -} - -void GPU_Vulkan::Execute_BoundingBox(u32 op, u32 diff) { - // Just resetting, nothing to bound. - const u32 data = op & 0x00FFFFFF; - if (data == 0) { - // TODO: Should this set the bboxResult? Let's set it true for now. - currentList->bboxResult = true; - return; - } - if (((data & 7) == 0) && data <= 64) { // Sanity check - void *control_points = Memory::GetPointer(gstate_c.vertexAddr); - if (gstate.vertType & GE_VTYPE_IDX_MASK) { - ERROR_LOG_REPORT_ONCE(boundingbox, G3D, "Indexed bounding box data not supported."); - // Data seems invalid. Let's assume the box test passed. - currentList->bboxResult = true; - return; - } - - // Test if the bounding box is within the drawing region. - currentList->bboxResult = drawEngine_.TestBoundingBox(control_points, data, gstate.vertType); - } else { - ERROR_LOG_REPORT_ONCE(boundingbox, G3D, "Bad bounding box data: %06x", data); - // Data seems invalid. Let's assume the box test passed. - currentList->bboxResult = true; - } -} - void GPU_Vulkan::Execute_Region(u32 op, u32 diff) { gstate_c.framebufChanged = true; gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY; diff --git a/GPU/Vulkan/GPU_Vulkan.h b/GPU/Vulkan/GPU_Vulkan.h index 837b066f90..6161251161 100644 --- a/GPU/Vulkan/GPU_Vulkan.h +++ b/GPU/Vulkan/GPU_Vulkan.h @@ -77,9 +77,6 @@ public: void Execute_Vaddr(u32 op, u32 diff); void Execute_Iaddr(u32 op, u32 diff); void Execute_Prim(u32 op, u32 diff); - void Execute_Bezier(u32 op, u32 diff); - void Execute_Spline(u32 op, u32 diff); - void Execute_BoundingBox(u32 op, u32 diff); void Execute_VertexType(u32 op, u32 diff); void Execute_Region(u32 op, u32 diff); void Execute_Scissor(u32 op, u32 diff);