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

Issue359 #362

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 23 additions & 3 deletions Core/VVVV.DX11.Lib/Effects/TextureFX/DX11ImageShaderNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public unsafe class DX11ImageShaderNode : DX11BaseShaderNode,IPluginBase, IPlugi
private DX11RenderSettings renderSettings = new DX11RenderSettings();
private DX11ObjectRenderSettings objectSettings = new DX11ObjectRenderSettings();

private Boolean isevaluated = false;

#region Default Input Pins
[Input("Depth In",Visibility=PinVisibility.OnlyInspector)]
protected Pin<DX11Resource<DX11DepthStencil>> FDepthIn;
Expand Down Expand Up @@ -157,7 +159,6 @@ public void Evaluate(int SpreadMax)

this.previousFrameResults.Resize(this.spmax, () => null, rt => rt?.UnLock());


if (this.FInvalidate)
{
if (this.FShader.IsCompiled)
Expand All @@ -181,6 +182,7 @@ public void Evaluate(int SpreadMax)
this.varmanager.ApplyUpdates();

this.FOut.Stream.IsChanged = true;
this.isevaluated = true;
}
#endregion

Expand All @@ -206,6 +208,20 @@ private int CalculateSpreadMax()
#region Update
public void Update(DX11RenderContext context)
{
List<bool> enable = new List<bool>();

for (int slise = 0; slise < this.spmax; slise++)
{
if (this.FInEnabled != null && this.FInEnabled.SliceCount > 0 && this.isevaluated)
{
enable.Add(this.FInEnabled[slise]);
}
else
{
enable.Add(false);
}
}

Device device = context.Device;
DeviceContext ctx = context.CurrentDeviceContext;

Expand Down Expand Up @@ -235,7 +251,7 @@ public void Update(DX11RenderContext context)

for (int i = 0; i < this.previousFrameResults.SliceCount; i++)
{
if (this.FInEnabled[i] || this.FInPreserveOnDisable[i] == false)
if (enable[i] || this.FInPreserveOnDisable[i] == false)
{
this.previousFrameResults[i]?.UnLock();
this.previousFrameResults[i] = null;
Expand All @@ -262,7 +278,7 @@ public void Update(DX11RenderContext context)
{
int passcounter = 0;

if (this.FInEnabled[textureIndex])
if (enable[textureIndex])
{
List<DX11ResourcePoolEntry<DX11RenderTarget2D>> locktargets = new List<DX11ResourcePoolEntry<DX11RenderTarget2D>>();

Expand Down Expand Up @@ -590,10 +606,12 @@ public void Update(DX11RenderContext context)
if (this.FInPreserveOnDisable[textureIndex])
{
//We kept it locked on top
if (this.FOut[textureIndex] == null) this.FOut[textureIndex] = new DX11Resource<DX11Texture2D>();
this.FOut[textureIndex][context] = this.previousFrameResults[textureIndex] != null ? this.previousFrameResults[textureIndex].Element : null;
}
else
{
if (this.FOut[textureIndex] == null) this.FOut[textureIndex] = new DX11Resource<DX11Texture2D>();
this.FOut[textureIndex][context] = this.FIn[textureIndex][context];
}

Expand All @@ -603,6 +621,7 @@ public void Update(DX11RenderContext context)
context.RenderStateStack.Pop();

this.OnEndQuery(context);
this.isevaluated = false;
}

#endregion
Expand Down Expand Up @@ -633,6 +652,7 @@ public void Destroy(DX11RenderContext context, bool force)
}
}
this.previousFrameResults.SliceCount = 0;
this.isevaluated = false;
}
#endregion

Expand Down
9 changes: 9 additions & 0 deletions Nodes/VVVV.DX11.Nodes/Nodes/Generics/ConsNodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ namespace VVVV.DX11.Nodes
[PluginInfo(Name = "Cons", Category = "DX11.Geometry", Author = "vux")]
public class ConsGeometryNode : DX11ResourceConsNode<IDX11Geometry> { }

[PluginInfo(Name = "Cons", Category = "DX11.IndexedGeometry", Author = "vux")]
public class ConsIndexedGeometryNode : DX11ResourceConsNode<DX11IndexedGeometry> { }

[PluginInfo(Name = "Cons", Category = "DX11.Texture", Version = "3d", Author = "vux")]
public class ConsTexture3DNode : DX11ResourceConsNode<DX11Texture3D> { }

Expand All @@ -24,6 +27,12 @@ public class ConsTexture1DNode : DX11ResourceConsNode<DX11Texture1D> { }
[PluginInfo(Name = "Cons", Category = "DX11.Buffer", Version = "", Author = "vux")]
public class ConsBufferNode : DX11ResourceConsNode<IDX11ReadableStructureBuffer> { }

[PluginInfo(Name = "Cons", Category = "DX11.Buffer RedableResource", Version = "", Author = "vux")]
public class ConsBufferResourceNode : DX11ResourceConsNode<DX11RawBuffer> { }

[PluginInfo(Name = "Cons", Category = "DX11.BufferRAW", Version = "", Author = "vux")]
public class ConsBufferRAWNode : DX11ResourceConsNode<IDX11Buffer> { }

[PluginInfo(Name = "Cons", Category = "DX11.ResourceSemantic", Version = "", Author = "vux")]
public class ConsResourceSemanticNode : DX11ResourceConsNode<IDX11RenderSemantic> { }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class IndexIndirectDrawerBufferNode : IPluginEvaluate, IDX11ResourceHost
[Output("Geometry Out")]
protected ISpread<DX11Resource<DX11IndexedGeometry>> FOutGeom;

bool invalidate = false;
bool invalidate;

public void Evaluate(int SpreadMax)
{
Expand Down Expand Up @@ -82,8 +82,6 @@ public void Update(DX11RenderContext context)
geom.AssignDrawer(ind);

ind.Update(context, this.FInCnt[i]);

this.invalidate = false;
}
else
{
Expand Down Expand Up @@ -111,6 +109,8 @@ public void Update(DX11RenderContext context)
this.FOutGeom[i][context] = geom;
}

this.invalidate = false;

}

public void Destroy(DX11RenderContext OnDevice, bool force)
Expand Down