This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28e0299
commit 751768c
Showing
7 changed files
with
374 additions
and
363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 64 additions & 64 deletions
128
MonoGame/MonoGame.Framework/Platform/Graphics/OcclusionQuery.OpenGL.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,64 @@ | ||
// MonoGame - Copyright (C) The MonoGame Team | ||
// This file is subject to the terms and conditions defined in | ||
// file 'LICENSE.txt', which is part of this source code package. | ||
|
||
using MonoGame.OpenGL; | ||
|
||
namespace Microsoft.Xna.Framework.Graphics | ||
{ | ||
partial class OcclusionQuery | ||
{ | ||
private int glQueryId = -1; | ||
|
||
private void PlatformConstruct() | ||
{ | ||
GL.GenQueries(1, out glQueryId); | ||
GraphicsExtensions.CheckGLError(); | ||
} | ||
|
||
private void PlatformBegin() | ||
{ | ||
GL.BeginQuery(QueryTarget.SamplesPassed, glQueryId); | ||
GraphicsExtensions.CheckGLError(); | ||
} | ||
|
||
private void PlatformEnd() | ||
{ | ||
GL.EndQuery(QueryTarget.SamplesPassed); | ||
GraphicsExtensions.CheckGLError(); | ||
} | ||
|
||
private bool PlatformGetResult(out int pixelCount) | ||
{ | ||
int resultReady = 0; | ||
GL.GetQueryObject(glQueryId, GetQueryObjectParam.QueryResultAvailable, out resultReady); | ||
GraphicsExtensions.CheckGLError(); | ||
|
||
if (resultReady == 0) | ||
{ | ||
pixelCount = 0; | ||
return false; | ||
} | ||
|
||
GL.GetQueryObject(glQueryId, GetQueryObjectParam.QueryResult, out pixelCount); | ||
GraphicsExtensions.CheckGLError(); | ||
|
||
return true; | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
if (!IsDisposed) | ||
{ | ||
if (glQueryId > -1) | ||
{ | ||
GraphicsDevice.DisposeQuery(glQueryId); | ||
glQueryId = -1; | ||
} | ||
} | ||
|
||
base.Dispose(disposing); | ||
} | ||
} | ||
} | ||
|
||
// // MonoGame - Copyright (C) The MonoGame Team | ||
// // This file is subject to the terms and conditions defined in | ||
// // file 'LICENSE.txt', which is part of this source code package. | ||
// | ||
// using MonoGame.OpenGL; | ||
// | ||
// namespace Microsoft.Xna.Framework.Graphics | ||
// { | ||
// partial class OcclusionQuery | ||
// { | ||
// private int glQueryId = -1; | ||
// | ||
// private void PlatformConstruct() | ||
// { | ||
// GL.GenQueries(1, out glQueryId); | ||
// GraphicsExtensions.CheckGLError(); | ||
// } | ||
// | ||
// private void PlatformBegin() | ||
// { | ||
// GL.BeginQuery(QueryTarget.SamplesPassed, glQueryId); | ||
// GraphicsExtensions.CheckGLError(); | ||
// } | ||
// | ||
// private void PlatformEnd() | ||
// { | ||
// GL.EndQuery(QueryTarget.SamplesPassed); | ||
// GraphicsExtensions.CheckGLError(); | ||
// } | ||
// | ||
// private bool PlatformGetResult(out int pixelCount) | ||
// { | ||
// int resultReady = 0; | ||
// GL.GetQueryObject(glQueryId, GetQueryObjectParam.QueryResultAvailable, out resultReady); | ||
// GraphicsExtensions.CheckGLError(); | ||
// | ||
// if (resultReady == 0) | ||
// { | ||
// pixelCount = 0; | ||
// return false; | ||
// } | ||
// | ||
// GL.GetQueryObject(glQueryId, GetQueryObjectParam.QueryResult, out pixelCount); | ||
// GraphicsExtensions.CheckGLError(); | ||
// | ||
// return true; | ||
// } | ||
// | ||
// protected override void Dispose(bool disposing) | ||
// { | ||
// if (!IsDisposed) | ||
// { | ||
// if (glQueryId > -1) | ||
// { | ||
// GraphicsDevice.DisposeQuery(glQueryId); | ||
// glQueryId = -1; | ||
// } | ||
// } | ||
// | ||
// base.Dispose(disposing); | ||
// } | ||
// } | ||
// } | ||
// |
108 changes: 54 additions & 54 deletions
108
MonoGame/MonoGame.Framework/Platform/Graphics/RenderTargetCube.OpenGL.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
// MonoGame - Copyright (C) The MonoGame Team | ||
// This file is subject to the terms and conditions defined in | ||
// file 'LICENSE.txt', which is part of this source code package. | ||
|
||
using MonoGame.OpenGL; | ||
|
||
namespace Microsoft.Xna.Framework.Graphics | ||
{ | ||
public partial class RenderTargetCube | ||
{ | ||
int IRenderTarget.GLTexture | ||
{ | ||
get { return glTexture; } | ||
} | ||
|
||
TextureTarget IRenderTarget.GLTarget | ||
{ | ||
get { return glTarget; } | ||
} | ||
|
||
int IRenderTarget.GLColorBuffer { get; set; } | ||
int IRenderTarget.GLDepthBuffer { get; set; } | ||
int IRenderTarget.GLStencilBuffer { get; set; } | ||
|
||
TextureTarget IRenderTarget.GetFramebufferTarget(RenderTargetBinding renderTargetBinding) | ||
{ | ||
return TextureTarget.TextureCubeMapPositiveX + renderTargetBinding.ArraySlice; | ||
} | ||
|
||
private void PlatformConstruct(GraphicsDevice graphicsDevice, bool mipMap, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage) | ||
{ | ||
Threading.BlockOnUIThread(() => | ||
{ | ||
graphicsDevice.PlatformCreateRenderTarget(this, size, size, mipMap, this.Format, preferredDepthFormat, preferredMultiSampleCount, usage); | ||
}); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
if (!IsDisposed) | ||
{ | ||
if (GraphicsDevice != null) | ||
{ | ||
Threading.BlockOnUIThread(() => | ||
{ | ||
this.GraphicsDevice.PlatformDeleteRenderTarget(this); | ||
}); | ||
} | ||
} | ||
|
||
base.Dispose(disposing); | ||
} | ||
} | ||
} | ||
// // MonoGame - Copyright (C) The MonoGame Team | ||
// // This file is subject to the terms and conditions defined in | ||
// // file 'LICENSE.txt', which is part of this source code package. | ||
// | ||
// using MonoGame.OpenGL; | ||
// | ||
// namespace Microsoft.Xna.Framework.Graphics | ||
// { | ||
// public partial class RenderTargetCube | ||
// { | ||
// int IRenderTarget.GLTexture | ||
// { | ||
// get { return glTexture; } | ||
// } | ||
// | ||
// TextureTarget IRenderTarget.GLTarget | ||
// { | ||
// get { return glTarget; } | ||
// } | ||
// | ||
// int IRenderTarget.GLColorBuffer { get; set; } | ||
// int IRenderTarget.GLDepthBuffer { get; set; } | ||
// int IRenderTarget.GLStencilBuffer { get; set; } | ||
// | ||
// TextureTarget IRenderTarget.GetFramebufferTarget(RenderTargetBinding renderTargetBinding) | ||
// { | ||
// return TextureTarget.TextureCubeMapPositiveX + renderTargetBinding.ArraySlice; | ||
// } | ||
// | ||
// private void PlatformConstruct(GraphicsDevice graphicsDevice, bool mipMap, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage) | ||
// { | ||
// Threading.BlockOnUIThread(() => | ||
// { | ||
// graphicsDevice.PlatformCreateRenderTarget(this, size, size, mipMap, this.Format, preferredDepthFormat, preferredMultiSampleCount, usage); | ||
// }); | ||
// } | ||
// | ||
// protected override void Dispose(bool disposing) | ||
// { | ||
// if (!IsDisposed) | ||
// { | ||
// if (GraphicsDevice != null) | ||
// { | ||
// Threading.BlockOnUIThread(() => | ||
// { | ||
// this.GraphicsDevice.PlatformDeleteRenderTarget(this); | ||
// }); | ||
// } | ||
// } | ||
// | ||
// base.Dispose(disposing); | ||
// } | ||
// } | ||
// } |
Oops, something went wrong.