Improve exception docs in Bizware.*

This commit is contained in:
YoshiRulz 2020-01-01 21:38:41 +10:00
parent 89b475661a
commit 3bab282e8d
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
7 changed files with 28 additions and 9 deletions

View File

@ -30,7 +30,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.GdiPlus
CornerColors[which] = color;
}
/// <exception cref="ArgumentException"><paramref name="colors"/> does not have exactly <c>4</c> elements</exception>
public void SetCornerColors(OpenTK.Graphics.Color4[] colors)
{
Flush(); //dont really need to flush with current implementation. we might as well roll modulate color into it too.
@ -142,7 +142,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.GdiPlus
//no batching, nothing to do here yet
}
/// <exception cref="InvalidOperationException"><see cref="IsActive"/> is <see langword="false"/></exception>
public void End()
{
if (!IsActive)

View File

@ -178,6 +178,10 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
public List<int> SamplerLocs;
}
/// <exception cref="InvalidOperationException">
/// <paramref name="required"/> is <see langword="true"/> and either <paramref name="vertexShader"/> or <paramref name="fragmentShader"/> is unavailable (their <see cref="Shader.Available"/> property is <see langword="false"/>), or
/// <c>glLinkProgram</c> call did not produce expected result
/// </exception>
public Pipeline CreatePipeline(VertexLayout vertexLayout, Shader vertexShader, Shader fragmentShader, bool required, string memo)
{
//if the shaders arent available, the pipeline isn't either
@ -362,6 +366,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
GL.DeleteShader(sw.sid);
}
/// <exception cref="InvalidOperationException"><paramref name="pipeline"/>.<see cref="Pipeline.Available"/> is <see langword="false"/></exception>
public void BindPipeline(Pipeline pipeline)
{
_CurrPipeline = pipeline;
@ -525,6 +530,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
GL.Ext.DeleteFramebuffer((int)rt.Opaque);
}
/// <exception cref="InvalidOperationException">framebuffer creation unsuccessful</exception>
public unsafe RenderTarget CreateRenderTarget(int w, int h)
{
//create a texture for it

View File

@ -173,6 +173,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX
public Dictionary<string, string> MapNativeToCode;
}
/// <exception cref="InvalidOperationException"><paramref name="required"/> is <see langword="true"/> and compilation error occurred</exception>
public Shader CreateFragmentShader(bool cg, string source, string entry, bool required)
{
try
@ -231,6 +232,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX
}
}
/// <exception cref="InvalidOperationException"><paramref name="required"/> is <see langword="true"/> and compilation error occurred</exception>
public Shader CreateVertexShader(bool cg, string source, string entry, bool required)
{
try
@ -371,6 +373,10 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX
public IBlendState BlendNoneOpaque { get { return _rsBlendNoneOpaque; } }
public IBlendState BlendNormal { get { return _rsBlendNormal; } }
/// <exception cref="InvalidOperationException">
/// <paramref name="required"/> is <see langword="true"/> and either <paramref name="vertexShader"/> or <paramref name="fragmentShader"/> is unavailable (their <see cref="Shader.Available"/> property is <see langword="false"/>), or
/// one of <paramref name="vertexLayout"/>'s items has an unsupported value in <see cref="LayoutItem.AttribType"/>, <see cref="LayoutItem.Components"/>, or <see cref="LayoutItem.Usage"/>
/// </exception>
public Pipeline CreatePipeline(VertexLayout vertexLayout, Shader vertexShader, Shader fragmentShader, bool required, string memo)
{
if (!vertexShader.Available || !fragmentShader.Available)
@ -712,6 +718,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX
return null;
}
/// <exception cref="InvalidOperationException">GDI+ call returned unexpected data</exception>
public unsafe void LoadTextureData(Texture2d tex, BitmapBuffer bmp)
{
sdi.BitmapData bmp_data = bmp.LockBits();
@ -739,6 +746,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX
return ret;
}
/// <exception cref="InvalidOperationException">SlimDX call returned unexpected data</exception>
public unsafe BitmapBuffer ResolveTexture2d(Texture2d tex)
{
//TODO - lazy create and cache resolving target in RT
@ -824,6 +832,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX
surface.Dispose();
}
/// <exception cref="InvalidOperationException"><paramref name="control"/> does not match control passed to <see cref="BeginControl"/></exception>
public void EndControl(GLControlWrapper_SlimDX9 control)
{
if (control != _CurrentControl)
@ -949,6 +958,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX
return ret;
}
/// <exception cref="NotSupportedException"><paramref name="mode"/> is <see cref="gl.PrimitiveType.TriangleStrip"/></exception>
public unsafe void DrawArrays(gl.PrimitiveType mode, int first, int count)
{
PrimitiveType pt = PrimitiveType.TriangleStrip;

View File

@ -33,7 +33,9 @@ namespace BizHawk.Bizware.BizwareGL
private GCHandle CurrLockHandle;
private BitmapData CurrLock;
public BitmapData LockBits() //TODO - add read/write semantic, for wraps
/// <exception cref="InvalidOperationException">already locked</exception>
/// <remarks>TODO add read/write semantic, for wraps</remarks>
public BitmapData LockBits()
{
if(CurrLock != null)
throw new InvalidOperationException($"{nameof(BitmapBuffer)} can only be locked once!");

View File

@ -63,7 +63,7 @@ namespace BizHawk.Bizware.BizwareGL
CornerColors[which] = color;
}
/// <exception cref="ArgumentException"><paramref name="colors"/> does not have exactly <c>4</c> elements</exception>
public void SetCornerColors(OpenTK.Graphics.Color4[] colors)
{
Flush(); //dont really need to flush with current implementation. we might as well roll modulate color into it too.
@ -77,6 +77,7 @@ namespace BizHawk.Bizware.BizwareGL
DefaultPipeline.Dispose();
}
/// <exception cref="InvalidOperationException"><see cref="IsActive"/> is <see langword="true"/></exception>
public void SetPipeline(Pipeline pipeline)
{
if (IsActive)
@ -147,7 +148,7 @@ namespace BizHawk.Bizware.BizwareGL
Owner.SetViewport(width, height);
}
/// <exception cref="InvalidOperationException">no pipeline set (need to call <see cref="SetPipeline"/>)</exception>
public void Begin()
{
//uhhmmm I want to throw an exception if its already active, but its annoying.
@ -176,7 +177,7 @@ namespace BizHawk.Bizware.BizwareGL
//no batching, nothing to do here yet
}
/// <exception cref="InvalidOperationException"><see cref="IsActive"/> is <see langword="false"/></exception>
public void End()
{
if (!IsActive)

View File

@ -26,9 +26,8 @@ namespace BizHawk.Bizware.BizwareGL
public IEnumerable<UniformInfo> UniformInfos { get { return _UniformInfos; } }
List<UniformInfo> _UniformInfos = new List<UniformInfo>();
/// <summary>
/// Returns the sole UniformInfo or throws an exception if there's more than one
/// </summary>
/// <returns>the first and only <see cref="UniformInfo"/></returns>
/// <exception cref="InvalidOperationException">more than one <see cref="UniformInfo"/> exists</exception>
public UniformInfo Sole
{
get

View File

@ -43,6 +43,7 @@ namespace BizHawk.Bizware.BizwareGL
RefCount++;
}
/// <exception cref="InvalidOperationException">already closed (by call to <see cref="Close"/>)</exception>
public void DefineVertexAttribute(string name, int index, int components, VertexAttribPointerType attribType, AttributeUsage usage, bool normalized, int stride, int offset = 0)
{
if (Closed)