[Fix] (DiligentEngine): Fix some miscellaneous issues.

This commit is contained in:
BZLZHH
2025-06-08 01:57:13 +08:00
parent 979d31407f
commit 848f110658
3 changed files with 45 additions and 12 deletions
@@ -380,6 +380,14 @@ namespace MG_GL::GL {
}
void DrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) {
if (MG_Diligent::IsInRenderPass) {
MG_Util::Debug::LogD("Ending current render pass.");
MG_Diligent::g_pContext->EndRenderPass();
MG_Diligent::IsInRenderPass = false;
MG_Util::Debug::LogD("Current render pass ended.");
} else {
MG_Util::Debug::LogD("No active render pass to end.");
}
GLuint program = MG_State::GetCurrentProgram();
MG_Util::Debug::LogD("DrawElements called with mode: %d, count: %d, type: %d, program: %u", mode, count, type, program);
if (program == 0) {
@@ -499,7 +507,6 @@ namespace MG_GL::GL {
EnsureRenderPassActive();
MG_Diligent::g_pContext->DrawIndexed(drawAttrs);
MG_Diligent::g_pContext->EndRenderPass();
MG_Diligent::IsInRenderPass = false;
MG_Util::Debug::LogD("DrawIndexed completed.");
@@ -260,6 +260,8 @@ namespace MG_GL::GL {
if (MG_Diligent::g_ShaderMap.find(shaderId) == MG_Diligent::g_ShaderMap.end() || MG_Diligent::g_ShaderMap[shaderId] == nullptr) {
GLenum shaderType = shaderObj.type;
std::string sourceStr = shaderSources[shaderId];
MG_Util::Debug::LogD("Shader ID: %u, type: %s\nConverted source:\n%s",
shaderId, MG_Util::Debug::GLEnumToString(shaderType), sourceStr.c_str());
Diligent::ShaderCreateInfo ShaderCI;
ShaderCI.Source = sourceStr.c_str();