[Fix] (MG_Impl/GLImpl, MG_Backend): avoid image uniform piglit traps [skip ci]

This commit is contained in:
2026-07-03 00:02:11 +08:00
parent ac43c0224c
commit fb1da4bbd0
3 changed files with 49 additions and 9 deletions
@@ -637,8 +637,11 @@ namespace MobileGL::MG_Backend::DirectVulkan {
}
void DispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ) {
MOBILEGL_ASSERT(pVulkanRenderer, "DirectVulkan::DispatchCompute called with null VulkanRenderer");
MOBILEGL_ASSERT(MG_State::pGLContext, "DirectVulkan::DispatchCompute called with null GL context");
if (!pVulkanRenderer || !MG_State::pGLContext) {
// TODO: Keep DirectVulkan renderer/context lifetime valid across failed compute image-load-store programs.
MGLOG_E("DirectVulkan::DispatchCompute skipped: renderer or GL context is null");
return;
}
pVulkanRenderer->DispatchCompute(numGroupsX, numGroupsY, numGroupsZ);
}
@@ -649,7 +652,11 @@ namespace MobileGL::MG_Backend::DirectVulkan {
}
void MemoryBarrier(GLbitfield barriers) {
MOBILEGL_ASSERT(pVulkanRenderer, "DirectVulkan::MemoryBarrier called with null VulkanRenderer");
if (!pVulkanRenderer || !MG_State::pGLContext) {
// TODO: Preserve or replay memory barriers when DirectVulkan renderer/context recovery is implemented.
MGLOG_E("DirectVulkan::MemoryBarrier skipped: renderer or GL context is null");
return;
}
pVulkanRenderer->MemoryBarrier(barriers);
}
@@ -1168,8 +1175,12 @@ namespace MobileGL::MG_Backend::DirectVulkan {
pVulkanRenderer->ReadPixels(x, y, width, height, format, type, pixels);
}
void GetTexImage(GLenum target, GLint level, GLenum format, GLenum type, GLvoid* pixels) {
MOBILEGL_ASSERT(pVulkanRenderer, "DirectVulkan::GetTexImage called with null VulkanRenderer");
MOBILEGL_ASSERT(MG_State::pGLContext, "DirectVulkan::GetTexImage called with null GL context");
if (!pVulkanRenderer || !MG_State::pGLContext) {
// TODO: Keep DirectVulkan renderer/context lifetime valid across failed image-load-store readbacks.
ClearReadPixelsOutput(1, 1, format, type, pixels);
MGLOG_E("DirectVulkan::GetTexImage skipped: renderer or GL context is null");
return;
}
pVulkanRenderer->GetTexImage(target, level, format, type, pixels);
}
void GetTextureImage(const SharedPtr<MG_State::GLState::ITextureObject>& texture, TextureUploadTarget uploadTarget,
@@ -1188,8 +1199,11 @@ namespace MobileGL::MG_Backend::DirectVulkan {
}
void DrawArrays(GLenum mode, GLint first, GLsizei count) {
MOBILEGL_ASSERT(pVulkanRenderer, "DirectVulkan::DrawArrays called with null VulkanRenderer");
MOBILEGL_ASSERT(MG_State::pGLContext, "DirectVulkan::DrawArrays called with null GL context");
if (!pVulkanRenderer || !MG_State::pGLContext) {
// TODO: Keep DirectVulkan renderer/context lifetime valid across failed image-load-store programs.
MGLOG_E("DirectVulkan::DrawArrays skipped: renderer or GL context is null");
return;
}
DrawCmd payload{};
payload.mode = mode;