Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert action #2199

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion Platforms/Graphics/.GL/ConcreteGraphicsCapabilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ internal void PlatformInitialize(ConcreteGraphicsContextGL cgraphicsContext, Gra
SupportsSeparateBlendStates = version >= new GLVersion(4,0) || GL.Extensions.Contains("GL_ARB_draw_buffers_blend");
#endif

SupportsBaseVertex = version >= new GLVersion(3,2) || GL.Extensions.Contains("GL_ARB_framebuffer_object");
SupportsBaseVertex = version >= new GLVersion(3,2) || GL.Extensions.Contains("GL_ARB_draw_elements_base_vertex");
SupportsDrawRangeElements = (GL.BoundApi == OGL.RenderApi.GL && version >= new GLVersion(2, 0))
|| (GL.BoundApi == OGL.RenderApi.ES && version >= new GLVersion(3, 0));

Expand Down
14 changes: 6 additions & 8 deletions Platforms/Graphics/.GL/ConcreteGraphicsContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,17 @@ public override void PlatformSetup()
{
this._newEnabledVertexAttributes = new bool[base.Capabilities.MaxVertexBufferSlots];

if (((ConcreteGraphicsCapabilities)base.Capabilities).SupportsFramebufferObjectARB
|| ((ConcreteGraphicsCapabilities)base.Capabilities).SupportsFramebufferObjectEXT)
{
this._supportsBlitFramebuffer = GL.BlitFramebuffer != null;
this._supportsInvalidateFramebuffer = GL.InvalidateFramebuffer != null;
}
else
if (!((ConcreteGraphicsCapabilities)base.Capabilities).SupportsFramebufferObjectARB
&& !((ConcreteGraphicsCapabilities)base.Capabilities).SupportsFramebufferObjectEXT)
{
throw new PlatformNotSupportedException(
"GraphicsDevice requires either ARB_framebuffer_object or EXT_framebuffer_object." +
"Try updating your graphics drivers.");
}

this._supportsBlitFramebuffer = GL.BlitFramebuffer != null;
this._supportsInvalidateFramebuffer = GL.InvalidateFramebuffer != null;

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 @@ -840,7 +838,7 @@ public override void DrawIndexedPrimitives(PrimitiveType primitiveType, int base
int indexElementCount = GraphicsContextStrategy.GetElementCountArray(primitiveType, primitiveCount);
GLPrimitiveType target = ConcreteGraphicsContext.PrimitiveTypeGL(primitiveType);

if (GL.DrawElementsBaseVertex != null)
if (((ConcreteGraphicsCapabilities)this.Capabilities).SupportsBaseVertex)
{
PlatformApplyVertexBuffers(0);

Expand Down
4 changes: 2 additions & 2 deletions Platforms/Kni.Platform.Android.GL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<BaseOutputPath>..\Artifacts\Platforms\Android</BaseOutputPath>
<AppendTargetFrameworkToOutputPath>True</AppendTargetFrameworkToOutputPath>

<Version>4.0.9001.0</Version>
<AssemblyVersion>4.0.9001.0</AssemblyVersion>
<Version>4.0.9001.1</Version>
<AssemblyVersion>4.0.9001.1</AssemblyVersion>

</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions Platforms/Kni.Platform.Blazor.GL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

<DefineConstants>BLAZORGL;STBSHARP_INTERNAL</DefineConstants>

<Version>4.0.9001.0</Version>
<AssemblyVersion>4.0.9001.0</AssemblyVersion>
<Version>4.0.9001.1</Version>
<AssemblyVersion>4.0.9001.1</AssemblyVersion>

</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions Platforms/Kni.Platform.Cardboard.GL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<BaseOutputPath>..\Artifacts\Platforms\Cardboard</BaseOutputPath>
<AppendTargetFrameworkToOutputPath>True</AppendTargetFrameworkToOutputPath>

<Version>4.0.9001.0</Version>
<AssemblyVersion>4.0.9001.0</AssemblyVersion>
<Version>4.0.9001.1</Version>
<AssemblyVersion>4.0.9001.1</AssemblyVersion>

</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions Platforms/Kni.Platform.Oculus.GL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<BaseOutputPath>..\Artifacts\Platforms\Oculus</BaseOutputPath>
<AppendTargetFrameworkToOutputPath>True</AppendTargetFrameworkToOutputPath>

<Version>4.0.9001.0</Version>
<AssemblyVersion>4.0.9001.0</AssemblyVersion>
<Version>4.0.9001.1</Version>
<AssemblyVersion>4.0.9001.1</AssemblyVersion>

</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions Platforms/Kni.Platform.SDL2.GL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<Import Project="..\kniPackage.props" />
<PropertyGroup>
<Version>4.0.9001.0</Version>
<AssemblyVersion>4.0.9001.0</AssemblyVersion>
<Version>4.0.9001.1</Version>
<AssemblyVersion>4.0.9001.1</AssemblyVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions Platforms/Kni.Platform.iOS.GL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<BaseOutputPath>..\Artifacts\Platforms\iOS</BaseOutputPath>
<AppendTargetFrameworkToOutputPath>True</AppendTargetFrameworkToOutputPath>

<Version>4.0.9001.0</Version>
<AssemblyVersion>4.0.9001.0</AssemblyVersion>
<Version>4.0.9001.1</Version>
<AssemblyVersion>4.0.9001.1</AssemblyVersion>

</PropertyGroup>

Expand Down