Skip to content

Commit

Permalink
Merge pull request #52 from vmx17/DevVmax
Browse files Browse the repository at this point in the history
Add geometry shader's API to ID3D11DeviceContextExtensions.cs
  • Loading branch information
smourier authored Mar 21, 2024
2 parents b9042d6 + 85382e7 commit 7e79685
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion DirectN/DirectN/Extensions/ID3D11DeviceContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,14 @@ public static void VSSetShader(this ID3D11DeviceContext context, ID3D11VertexSha

context.VSSetShader(vertexShader, classInstances, (classInstances?.Length).GetValueOrDefault());
}
public static void GSSetShader(this IComObject<ID3D11DeviceContext> context, IComObject<ID3D11GeometryShader> geometryShader, IComObject<ID3D11ClassInstance>[] classInstances = null) => GSSetShader(context?.Object, geometryShader?.Object, classInstances.ToArray());
public static void GSSetShader(this ID3D11DeviceContext context, ID3D11GeometryShader geometryShader, ID3D11ClassInstance[] classInstances = null)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

context.GSSetShader(geometryShader, classInstances, (classInstances?.Length).GetValueOrDefault());
}
public static void PSSetShader(this IComObject<ID3D11DeviceContext> context, IComObject<ID3D11PixelShader> pixelShader, IComObject<ID3D11ClassInstance>[] classInstances = null) => PSSetShader(context?.Object, pixelShader?.Object, classInstances.ToArray());
public static void PSSetShader(this ID3D11DeviceContext context, ID3D11PixelShader pixelShader, ID3D11ClassInstance[] classInstances = null)
{
Expand Down Expand Up @@ -407,7 +414,31 @@ public static void VSSetShaderResources(this ID3D11DeviceContext context, int st

context.VSSetShaderResources((uint)startSlot, (shaderResourceViews?.Length).GetValueOrDefault(), shaderResourceViews);
}
public static void GSSetShaderResource(this IComObject<ID3D11DeviceContext> context, int startSlot, IComObject<ID3D11ShaderResourceView> shaderResourceView)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

if (context.Object == null)
throw new ArgumentException(null, nameof(context));

if (shaderResourceView == null)
throw new ArgumentNullException(nameof(shaderResourceView));

if (shaderResourceView.Object == null)
throw new ArgumentException(null, nameof(shaderResourceView));

context.Object.GSSetShaderResources((uint)startSlot, 1, new[] { shaderResourceView.Object });
}

public static void GSSetShaderResources(this IComObject<ID3D11DeviceContext> context, int startSlot, IComObject<ID3D11ShaderResourceView>[] shaderResourceViews) => GSSetShaderResources(context?.Object, startSlot, shaderResourceViews.ToArray());
public static void GSSetShaderResources(this ID3D11DeviceContext context, int startSlot, ID3D11ShaderResourceView[] shaderResourceViews)
{
if (context == null)
throw new ArgumentNullException(nameof(context));

context.GSSetShaderResources((uint)startSlot, (shaderResourceViews?.Length).GetValueOrDefault(), shaderResourceViews);
}
public static void PSSetSampler(this IComObject<ID3D11DeviceContext> context, int startSlot, IComObject<ID3D11SamplerState> samplerState)
{
if (context == null)
Expand Down Expand Up @@ -451,7 +482,7 @@ public static void PSSetShaderResource(this IComObject<ID3D11DeviceContext> cont
context.Object.PSSetShaderResources((uint)startSlot, 1, new[] { shaderResourceView.Object });
}

public static void PSSetShaderResources(this IComObject<ID3D11DeviceContext> context, int startSlot, IComObject<ID3D11ShaderResourceView>[] shaderResourceViews) => PSSetShaderResources(context?.Object, startSlot, shaderResourceViews?.ToArray());
public static void PSSetShaderResources(this IComObject<ID3D11DeviceContext> context, int startSlot, IComObject<ID3D11ShaderResourceView>[] shaderResourceViews) => PSSetShaderResources(context?.Object, startSlot, shaderResourceViews.ToArray());
public static void PSSetShaderResources(this ID3D11DeviceContext context, int startSlot, ID3D11ShaderResourceView[] shaderResourceViews)
{
if (context == null)
Expand Down

0 comments on commit 7e79685

Please sign in to comment.