diff --git a/MonoGame.Framework/Graphics/.BlazorGL/ConcreteTextureCollection.cs b/MonoGame.Framework/Graphics/.BlazorGL/ConcreteTextureCollection.cs index 4c9a19ef013..f35f44d8ea2 100644 --- a/MonoGame.Framework/Graphics/.BlazorGL/ConcreteTextureCollection.cs +++ b/MonoGame.Framework/Graphics/.BlazorGL/ConcreteTextureCollection.cs @@ -55,8 +55,9 @@ internal void PlatformApply() { GL.ActiveTexture(WebGLTextureUnit.TEXTURE0 + i); GL.CheckGLError(); - _targets[i] = ((IPlatformTexture)texture).GetTextureStrategy()._glTarget; - GL.BindTexture(((IPlatformTexture)texture).GetTextureStrategy()._glTarget, ((IPlatformTexture)texture).GetTextureStrategy()._glTexture); + ConcreteTexture ctexture = ((IPlatformTexture)texture).GetTextureStrategy(); + _targets[i] = ctexture._glTarget; + GL.BindTexture(ctexture._glTarget, ctexture._glTexture); GL.CheckGLError(); _contextStrategy.Metrics_AddTextureCount(); diff --git a/MonoGame.Framework/Graphics/.DX11/ConcreteTextureCollection.cs b/MonoGame.Framework/Graphics/.DX11/ConcreteTextureCollection.cs index bf05bec3588..0d40dd61b1c 100644 --- a/MonoGame.Framework/Graphics/.DX11/ConcreteTextureCollection.cs +++ b/MonoGame.Framework/Graphics/.DX11/ConcreteTextureCollection.cs @@ -67,7 +67,8 @@ internal void PlatformApply(D3D11.CommonShaderStage shaderStage) if (texture != null && !texture.IsDisposed) { - shaderStage.SetShaderResource(i, ((IPlatformTexture)texture).GetTextureStrategy().GetShaderResourceView()); + ConcreteTexture ctexture = ((IPlatformTexture)texture).GetTextureStrategy(); + shaderStage.SetShaderResource(i, ctexture.GetShaderResourceView()); _contextStrategy.Metrics_AddTextureCount(); } diff --git a/MonoGame.Framework/Graphics/.GL/ConcreteTextureCollection.cs b/MonoGame.Framework/Graphics/.GL/ConcreteTextureCollection.cs index d74987b2adf..393b7cee7af 100644 --- a/MonoGame.Framework/Graphics/.GL/ConcreteTextureCollection.cs +++ b/MonoGame.Framework/Graphics/.GL/ConcreteTextureCollection.cs @@ -59,8 +59,9 @@ internal void PlatformApply() { GL.ActiveTexture(TextureUnit.Texture0 + i); GL.CheckGLError(); - _targets[i] = ((IPlatformTexture)texture).GetTextureStrategy()._glTarget; - GL.BindTexture(((IPlatformTexture)texture).GetTextureStrategy()._glTarget, ((IPlatformTexture)texture).GetTextureStrategy()._glTexture); + ConcreteTexture ctexture = ((IPlatformTexture)texture).GetTextureStrategy(); + _targets[i] = ctexture._glTarget; + GL.BindTexture(ctexture._glTarget, ctexture._glTexture); GL.CheckGLError(); _contextStrategy.Metrics_AddTextureCount();