Skip to content

Commit

Permalink
fix Blazor.GL Reach profile (#2192)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkast authored Jan 17, 2025
1 parent a675591 commit 7fd9852
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions Platforms/Graphics/.BlazorGL/ConcreteGraphicsContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ internal sealed class ConcreteGraphicsContext : GraphicsContextStrategy

internal ShaderProgram _shaderProgram = null;

internal bool _supportsInvalidateFramebuffer;
internal bool _supportsBlitFramebuffer;

private Vector4 _posFixup;

internal BufferBindingInfo[] _bufferBindingInfos;
Expand Down Expand Up @@ -81,22 +78,6 @@ public override void PlatformSetup()

this._newEnabledVertexAttributes = new bool[base.Capabilities.MaxVertexBufferSlots];

// TODO: check for FramebufferObjectARB
if ((GL is IWebGL2RenderingContext)
//|| this.Capabilities.SupportsFramebufferObjectARB
//|| this.Capabilities.SupportsFramebufferObjectEXT
)
{
this._supportsBlitFramebuffer = true;
this._supportsInvalidateFramebuffer = true;
}
else
{
throw new PlatformNotSupportedException(
"GraphicsDevice requires either ARB_framebuffer_object or EXT_framebuffer_object." +
"Try updating your graphics drivers.");
}

this._bufferBindingInfos = new BufferBindingInfo[base.Capabilities.MaxVertexBufferSlots];
for (int i = 0; i < this._bufferBindingInfos.Length; i++)
this._bufferBindingInfos[i] = new BufferBindingInfo(null, null, IntPtr.Zero, 0);
Expand Down Expand Up @@ -1206,19 +1187,16 @@ protected override void PlatformResolveRenderTargets()
GL.CheckGLError();
((IWebGL2RenderingContext)GL).DrawBuffer(WebGL2DrawBufferAttachmentPoint.COLOR_ATTACHMENT0 + i);
GL.CheckGLError();
Debug.Assert(this._supportsBlitFramebuffer);
((IWebGL2RenderingContext)GL).BlitFramebuffer(
0, 0, renderTarget.Width, renderTarget.Height,
0, 0, renderTarget.Width, renderTarget.Height,
WebGLBufferBits.COLOR, WebGLTexParam.NEAREST);
GL.CheckGLError();

if (renderTarget.RenderTargetUsage == RenderTargetUsage.DiscardContents
&& this._supportsInvalidateFramebuffer)
if (renderTarget.RenderTargetUsage == RenderTargetUsage.DiscardContents)
{
if (i == 0)
{
Debug.Assert(this._supportsInvalidateFramebuffer);
((IWebGL2RenderingContext)GL).InvalidateFramebuffer(WebGL2FramebufferType.READ_FRAMEBUFFER, InvalidateFramebufferAttachements);
GL.CheckGLError();
}
Expand Down

0 comments on commit 7fd9852

Please sign in to comment.