From ab0eeb18f37dd360f4abf6fdc00606ed3dfc7e17 Mon Sep 17 00:00:00 2001 From: xebra Date: Tue, 25 Nov 2014 22:32:50 +0900 Subject: [PATCH] [spline/bezier]Support drawing primitives lines and points. --- GPU/GLES/GLES_GPU.cpp | 4 ++-- GPU/GLES/Spline.cpp | 16 ++++------------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/GPU/GLES/GLES_GPU.cpp b/GPU/GLES/GLES_GPU.cpp index 46fc4909d2..6e1dc3f623 100644 --- a/GPU/GLES/GLES_GPU.cpp +++ b/GPU/GLES/GLES_GPU.cpp @@ -877,7 +877,7 @@ void GLES_GPU::Execute_Bezier(u32 op, u32 diff) { indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); } - if (gstate.getPatchPrimitiveType() != GE_PATCHPRIM_TRIANGLES) { + if (gstate.getPatchPrimitiveType() == GE_PATCHPRIM_UNKNOWN) { ERROR_LOG_REPORT(G3D, "Unsupported patch primitive %x", gstate.getPatchPrimitiveType()); return; } @@ -918,7 +918,7 @@ void GLES_GPU::Execute_Spline(u32 op, u32 diff) { indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); } - if (gstate.getPatchPrimitiveType() != GE_PATCHPRIM_TRIANGLES) { + if (gstate.getPatchPrimitiveType() == GE_PATCHPRIM_UNKNOWN) { ERROR_LOG_REPORT(G3D, "Unsupported patch primitive %x", gstate.getPatchPrimitiveType()); return; } diff --git a/GPU/GLES/Spline.cpp b/GPU/GLES/Spline.cpp index 434683ed6c..8707c8a1be 100644 --- a/GPU/GLES/Spline.cpp +++ b/GPU/GLES/Spline.cpp @@ -31,14 +31,11 @@ u32 TransformDrawEngine::NormalizeVertices(u8 *outPtr, u8 *bufPtr, const u8 *inP return DrawEngineCommon::NormalizeVertices(outPtr, bufPtr, inPtr, dec, lowerBound, upperBound, vertType); } +const GEPrimitiveType primType[] = { GE_PRIM_TRIANGLES, GE_PRIM_LINES, GE_PRIM_POINTS }; + void TransformDrawEngine::SubmitSpline(void* control_points, void* indices, int count_u, int count_v, int type_u, int type_v, GEPatchPrimType prim_type, u32 vertType) { Flush(); - if (prim_type != GE_PATCHPRIM_TRIANGLES) { - // Only triangles supported! - return; - } - u16 index_lower_bound = 0; u16 index_upper_bound = count_u * count_v - 1; bool indices_16bit = (vertType & GE_VTYPE_IDX_MASK) == GE_VTYPE_IDX_16BIT; @@ -101,7 +98,7 @@ void TransformDrawEngine::SubmitSpline(void* control_points, void* indices, int gstate_c.uv.vOff = 0; } int bytesRead; - SubmitPrim(decoded2, quadIndices_, GE_PRIM_TRIANGLES, count, vertTypeWithIndex16, &bytesRead); + SubmitPrim(decoded2, quadIndices_, primType[prim_type], count, vertTypeWithIndex16, &bytesRead); Flush(); @@ -113,11 +110,6 @@ void TransformDrawEngine::SubmitSpline(void* control_points, void* indices, int void TransformDrawEngine::SubmitBezier(void* control_points, void* indices, int count_u, int count_v, GEPatchPrimType prim_type, u32 vertType) { Flush(); - if (prim_type != GE_PATCHPRIM_TRIANGLES) { - // Only triangles supported! - return; - } - u16 index_lower_bound = 0; u16 index_upper_bound = count_u * count_v - 1; bool indices_16bit = (vertType & GE_VTYPE_IDX_MASK) == GE_VTYPE_IDX_16BIT; @@ -194,7 +186,7 @@ void TransformDrawEngine::SubmitBezier(void* control_points, void* indices, int } int bytesRead; - SubmitPrim(decoded2, quadIndices_, GE_PRIM_TRIANGLES, count, vertTypeWithIndex16, &bytesRead); + SubmitPrim(decoded2, quadIndices_, primType[prim_type], count, vertTypeWithIndex16, &bytesRead); Flush(); if (g_Config.bPrescaleUV) {