From c18320326475c1dbae8e891d992cd23556f2e679 Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Sun, 8 Jun 2025 18:17:05 +0800 Subject: [PATCH] [Fix] (Diligent/Drawing): Use real type for IBO. --- MG/MG_GL/Implementations/GL/Drawing/GL_Drawing.cpp | 5 ++--- MG/MG_GL/Implementations/GL/Program/GL_Program.cpp | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/MG/MG_GL/Implementations/GL/Drawing/GL_Drawing.cpp b/MG/MG_GL/Implementations/GL/Drawing/GL_Drawing.cpp index 2912bb3a..85a3c704 100644 --- a/MG/MG_GL/Implementations/GL/Drawing/GL_Drawing.cpp +++ b/MG/MG_GL/Implementations/GL/Drawing/GL_Drawing.cpp @@ -461,7 +461,7 @@ namespace MG_GL::GL { BuffDesc.Usage = Diligent::USAGE_DYNAMIC; BuffDesc.BindFlags = Diligent::BIND_VERTEX_BUFFER; BuffDesc.CPUAccessFlags = Diligent::CPU_ACCESS_WRITE; - + if (pBuffer) { pBuffer->Release(); } @@ -600,10 +600,9 @@ namespace MG_GL::GL { MG_Util::Debug::LogD("Preparing to draw indexed for program %u", program); Diligent::DrawIndexedAttribs drawAttrs; - drawAttrs.IndexType = ConvertGLTypeToDiligent(type); drawAttrs.NumIndices = count; drawAttrs.Flags = Diligent::DRAW_FLAG_VERIFY_ALL; - drawAttrs.IndexType = Diligent::VT_UINT32; + drawAttrs.IndexType = ConvertGLTypeToDiligent(type); MG_Util::Debug::LogD("DrawIndexedAttribs Dump:"); MG_Util::Debug::LogD(" NumIndices: %u", drawAttrs.NumIndices); MG_Util::Debug::LogD(" IndexType: %d", drawAttrs.IndexType); diff --git a/MG/MG_GL/Implementations/GL/Program/GL_Program.cpp b/MG/MG_GL/Implementations/GL/Program/GL_Program.cpp index e42fda35..f7bd197e 100644 --- a/MG/MG_GL/Implementations/GL/Program/GL_Program.cpp +++ b/MG/MG_GL/Implementations/GL/Program/GL_Program.cpp @@ -105,6 +105,10 @@ namespace MG_GL::GL { case GL_FLOAT_VEC2: return Diligent::VT_FLOAT32; case GL_FLOAT_VEC3: return Diligent::VT_FLOAT32; case GL_FLOAT_VEC4: return Diligent::VT_FLOAT32; + case GL_SHORT: return Diligent::VT_INT16; + case GL_UNSIGNED_SHORT: return Diligent::VT_UINT16; + case GL_BYTE: return Diligent::VT_INT8; + case GL_UNSIGNED_BYTE: return Diligent::VT_UINT8; case GL_INT: return Diligent::VT_INT32; case GL_INT_VEC2: return Diligent::VT_INT32; case GL_INT_VEC3: return Diligent::VT_INT32;