Skip to content
Permalink
Browse files

Resetting shader key scope for multi pass materials (#456)

* resetting shader key scope for multi pass materials

* upped version of asset compiler to 4
  • Loading branch information
tebjan authored and xen2 committed May 22, 2019
1 parent e8eb8dd commit 7af2c14ce63e7892d1e87c8b723936a0270eaaa7
@@ -53,7 +53,7 @@ private class MaterialCompileCommand : AssetCommand<MaterialAsset>
public MaterialCompileCommand(string url, AssetItem assetItem, MaterialAsset value, AssetCompilerContext context)
: base(url, value, assetItem.Package)
{
Version = 3;
Version = 4;
this.assetItem = assetItem;
colorSpace = context.GetColorSpace();
assetUrl = new UFile(url);
@@ -142,6 +142,8 @@ public ShaderSource GetStreamFinalModifier<T>(MaterialShaderStage stage)

public MaterialPass PushPass()
{
ResetParameterKeys();

var materialPass = new MaterialPass { PassIndex = PassIndex };
Material.Passes.Add(materialPass);

@@ -170,6 +170,12 @@ public ObjectParameterKey<SamplerState> GetSamplerKey(ComputeColorParameterSampl
return GetSamplerKey(samplerStateDesc, graphicsDevice);
}

protected void ResetParameterKeys()
{
parameterKeyIndices.Clear();
declaredSamplerStates.Clear();
}

public void PushOverrides(MaterialOverrides overrides)
{
if (overrides == null) throw new ArgumentNullException("overrides");

0 comments on commit 7af2c14

Please sign in to comment.
You can’t perform that action at this time.