Skip to content

Commit

Permalink
[TextureFX] Check for auto mip support + uav support before to create…
Browse files Browse the repository at this point in the history
… new texture, otherwise target lock might fail
  • Loading branch information
mrvux committed Jun 28, 2018
1 parent 368aabd commit 5f1b9de
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Core/VVVV.DX11.Lib/Effects/TextureFX/DX11ImageShaderNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,17 @@ public void Update(DX11RenderContext context)
if (initial.Width > 1 && initial.Height > 1 && initial.Resource.Description.MipLevels == 1)
{
//Texture might now be an allowed render target format, so we at least need to check that, and default to rgba8 unorm
//also check for auto mip map gen
var mipTargetFmt = initial.Format;
if (!context.IsSupported(FormatSupport.RenderTarget, mipTargetFmt))
if (!context.IsSupported(FormatSupport.RenderTarget, mipTargetFmt) ||
!context.IsSupported(FormatSupport.MipMapAutoGeneration, mipTargetFmt) ||
!context.IsSupported(FormatSupport.UnorderedAccessView, mipTargetFmt))
{
mipTargetFmt = Format.R8G8B8A8_UNorm;

//BGR does not allow uav, and we often create with it
if (mipTargetFmt == Format.B8G8R8A8_UNorm) { mipTargetFmt = Format.R8G8B8A8_UNorm; }
}



DX11ResourcePoolEntry<DX11RenderTarget2D> mipTarget = context.ResourcePool.LockRenderTarget(initial.Width, initial.Height, mipTargetFmt, new SampleDescription(1, 0), true, 0);
locktargets.Add(mipTarget);

Expand Down

0 comments on commit 5f1b9de

Please sign in to comment.