From 131c9a2db62a7d26dbd9c11febe98cdde56df3b8 Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Sun, 16 Nov 2025 02:19:16 +0800 Subject: [PATCH] [Improvement] (MG_Impl/Sampler): Create sampler object even when not bound. --- MobileGL/MG_Impl/GLImpl/Sampler/GL_Sampler.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MobileGL/MG_Impl/GLImpl/Sampler/GL_Sampler.cpp b/MobileGL/MG_Impl/GLImpl/Sampler/GL_Sampler.cpp index ad4eb704..beca9c5f 100644 --- a/MobileGL/MG_Impl/GLImpl/Sampler/GL_Sampler.cpp +++ b/MobileGL/MG_Impl/GLImpl/Sampler/GL_Sampler.cpp @@ -10,6 +10,9 @@ namespace MobileGL { if (!SamplerImpl::ValidateSamplerName(sampler)) return; auto samplerObj = MG_State::pGLContext->GetSamplerObject(sampler); + if (!samplerObj) { + samplerObj = MG_State::pGLContext->CreateSamplerObject(sampler); // for compatibility + } if (!SamplerImpl::ValidateSamplerObject(sampler)) return; using namespace MG_Util; @@ -55,6 +58,9 @@ namespace MobileGL { if (!SamplerImpl::ValidateSamplerName(sampler)) return; auto samplerObj = MG_State::pGLContext->GetSamplerObject(sampler); + if (!samplerObj) { + samplerObj = MG_State::pGLContext->CreateSamplerObject(sampler); // for compatibility + } if (!SamplerImpl::ValidateSamplerObject(sampler)) return; using namespace MG_Util;