Skip to content

Commit

Permalink
Small clean on shader node
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvux committed Nov 23, 2016
1 parent 3a5e50c commit ffe598b
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions Core/VVVV.DX11.Lib/Effects/DX11ShaderNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ public void Destroy(DX11RenderContext context, bool force)
}
#endregion

#region Collect
private void Collect(DX11RenderContext context, DX11RenderSettings settings)
{
if (settings.RenderHint == eRenderHint.Collector)
Expand Down Expand Up @@ -351,6 +352,30 @@ private void Collect(DX11RenderContext context, DX11RenderSettings settings)
return;
}
}
#endregion

private void ApplyOnly(DX11RenderContext context, DX11RenderSettings settings)
{
Device device = context.Device;
DeviceContext ctx = context.CurrentDeviceContext;

var variableCache = this.shaderVariableCache[context];
DX11ShaderData sdata = this.deviceshaderdata[context];
this.varmanager.SetGlobalSettings(sdata.ShaderInstance, settings);
variableCache.ApplyGlobals(settings);

DX11ObjectRenderSettings oset = new DX11ObjectRenderSettings();
oset.DrawCallIndex = 0;
oset.Geometry = null;
oset.IterationCount = 1;
oset.IterationIndex = 0;
oset.WorldTransform = this.mworld[0 % this.mworldcount];
variableCache.ApplySlice(oset, 0);
sdata.ApplyPass(ctx);

this.FInLayer.RenderAll(context, settings);

}

#region Render
public void Render(DX11RenderContext context, DX11RenderSettings settings)
Expand All @@ -368,26 +393,7 @@ public void Render(DX11RenderContext context, DX11RenderSettings settings)
//In that case we do not care about geometry, but only apply pass for globals
if (settings.RenderHint == eRenderHint.ApplyOnly)
{
var variableCache = this.shaderVariableCache[context];
DX11ShaderData sdata = this.deviceshaderdata[context];
this.varmanager.SetGlobalSettings(sdata.ShaderInstance, settings);
variableCache.ApplyGlobals(settings);

DX11ObjectRenderSettings oset = new DX11ObjectRenderSettings();
oset.DrawCallIndex = 0;
oset.Geometry = null;
oset.IterationCount = 1;
oset.IterationIndex = 0;
oset.WorldTransform = this.mworld[0 % this.mworldcount];
variableCache.ApplySlice(oset, 0);
sdata.ApplyPass(ctx);


if (this.FInLayer.IsConnected)
{
this.FInLayer[0][context].Render(context, settings);
}

this.ApplyOnly(context, settings);
return;
}

Expand Down

0 comments on commit ffe598b

Please sign in to comment.