initial commit

This commit is contained in:
Jo 2025-01-07 02:06:59 +01:00
parent 6715289efe
commit 788c3389af
37645 changed files with 2526849 additions and 80 deletions

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 95d4f3eaeba344017b164174ed877b77
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,15 @@
using System;
namespace UnityEditor.ShaderGraph
{
[AttributeUsage(AttributeTargets.Struct)]
class GenerateBlocksAttribute : Attribute
{
internal string path { get; set; }
public GenerateBlocksAttribute(string path = "")
{
this.path = path;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8192fc2e63c354dff92db5dde0c564b7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d6d4496479c324d29acc5c0d0a40d1b9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class AdditionalCommandCollection : IEnumerable<AdditionalCommandCollection.Item>
{
public class Item
{
public AdditionalCommandDescriptor field { get; }
public Item(AdditionalCommandDescriptor field)
{
this.field = field;
}
}
readonly List<AdditionalCommandCollection.Item> m_Items;
public AdditionalCommandCollection()
{
m_Items = new List<AdditionalCommandCollection.Item>();
}
public AdditionalCommandCollection Add(AdditionalCommandCollection fields)
{
foreach (AdditionalCommandCollection.Item item in fields)
{
m_Items.Add(item);
}
return this;
}
public AdditionalCommandCollection Add(AdditionalCommandDescriptor field)
{
m_Items.Add(new Item(field));
return this;
}
public IEnumerator<AdditionalCommandCollection.Item> GetEnumerator()
{
return m_Items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bb1187e3c30c4233ae250a361c54f26b
timeCreated: 1607707593

View file

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
// this class is used to track asset dependencies in shadergraphs and subgraphs
// that is: it tracks files that the shadergraph or subgraph must access to generate the shader
// this data is used to automatically re-import the shadergraphs or subgraphs when any of the tracked files change
[GenerationAPI]
internal class AssetCollection
{
[Flags]
public enum Flags
{
SourceDependency = 1 << 0, // ShaderGraph directly reads the source file in the Assets directory
ArtifactDependency = 1 << 1, // ShaderGraph reads the import result artifact (i.e. subgraph import)
IsSubGraph = 1 << 2, // This asset is a SubGraph (used when we need to get multiple levels of dependencies)
IncludeInExportPackage = 1 << 3 // This asset should be pulled into any .unitypackages built via "Export Package.."
}
internal Dictionary<GUID, Flags> assets = new Dictionary<GUID, Flags>();
internal IEnumerable<GUID> assetGUIDs { get { return assets.Keys; } }
public AssetCollection()
{
}
internal void Clear()
{
assets.Clear();
}
// these are assets that we read the source files directly (directly reading the file out of the Assets directory)
public void AddAssetDependency(GUID assetGUID, Flags flags)
{
if (assets.TryGetValue(assetGUID, out Flags existingFlags))
{
assets[assetGUID] = existingFlags | flags;
}
else
{
assets.Add(assetGUID, flags);
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 08492a28bc5e6d34e866bd3805598835
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,81 @@
using System.Collections;
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class DefineCollection : IEnumerable<DefineCollection.Item>
{
public class Item : IConditional
{
public KeywordDescriptor descriptor { get; }
public FieldCondition[] fieldConditions { get; }
public string value => descriptor.ToDefineString(index);
// KeywordType.Boolean, index 0: disable, 1: enable
// KeywordType.Enum, index into enum entries
public int index { get; }
public Item(KeywordDescriptor descriptor, int index, FieldCondition[] fieldConditions)
{
this.descriptor = descriptor;
this.fieldConditions = fieldConditions;
this.index = index;
}
}
readonly List<Item> m_Items;
public DefineCollection()
{
m_Items = new List<Item>();
}
public DefineCollection(DefineCollection defines)
{
m_Items = new List<Item>();
foreach (DefineCollection.Item item in defines)
{
m_Items.Add(item);
}
}
public DefineCollection Add(DefineCollection defines)
{
foreach (DefineCollection.Item item in defines)
{
m_Items.Add(item);
}
return this;
}
public DefineCollection Add(KeywordDescriptor descriptor, int index)
{
m_Items.Add(new Item(descriptor, index, null));
return this;
}
public DefineCollection Add(KeywordDescriptor descriptor, int index, FieldCondition fieldCondition)
{
m_Items.Add(new Item(descriptor, index, new FieldCondition[] { fieldCondition }));
return this;
}
public DefineCollection Add(KeywordDescriptor descriptor, int index, FieldCondition[] fieldConditions)
{
m_Items.Add(new Item(descriptor, index, fieldConditions));
return this;
}
public IEnumerator<Item> GetEnumerator()
{
return m_Items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 22d07a5bc43d34f468679d4f73e89485
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,51 @@
using System.Collections;
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class DependencyCollection : IEnumerable<DependencyCollection.Item>
{
public class Item
{
public FieldDependency dependency { get; }
public Item(FieldDependency dependency)
{
this.dependency = dependency;
}
}
readonly List<DependencyCollection.Item> m_Items;
public DependencyCollection()
{
m_Items = new List<DependencyCollection.Item>();
}
public DependencyCollection Add(DependencyCollection dependencies)
{
foreach (DependencyCollection.Item item in dependencies)
{
m_Items.Add(item);
}
return this;
}
public DependencyCollection Add(FieldDependency dependency)
{
m_Items.Add(new Item(dependency));
return this;
}
public IEnumerator<DependencyCollection.Item> GetEnumerator()
{
return m_Items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: df0a9e9f6e86147bfb6586e2784afce1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class FieldCollection : IEnumerable<FieldCollection.Item>
{
public class Item
{
public FieldDescriptor field { get; }
public Item(FieldDescriptor field)
{
this.field = field;
}
}
readonly List<FieldCollection.Item> m_Items;
public FieldCollection()
{
m_Items = new List<FieldCollection.Item>();
}
public FieldCollection Add(FieldCollection fields)
{
foreach (FieldCollection.Item item in fields)
{
m_Items.Add(item);
}
return this;
}
public FieldCollection Add(FieldDescriptor field)
{
m_Items.Add(new Item(field));
return this;
}
public IEnumerator<FieldCollection.Item> GetEnumerator()
{
return m_Items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ac41755acee97d247a7121e25babbb6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,90 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
[Serializable]
internal class IncludeCollection : IEnumerable<IncludeDescriptor>
{
[SerializeField]
List<IncludeDescriptor> includes;
public IncludeCollection()
{
includes = new List<IncludeDescriptor>();
}
public IncludeCollection Add(IncludeCollection includes)
{
if (includes != null)
{
foreach (var include in includes)
{
AddInternal(include.guid, include.path, include.location, include.fieldConditions);
}
}
return this;
}
public IncludeCollection Add(string includePath, IncludeLocation location)
{
var guid = AssetDatabase.AssetPathToGUID(includePath);
return AddInternal(guid, includePath, location);
}
public IncludeCollection Add(string includePath, IncludeLocation location, FieldCondition fieldCondition)
{
var guid = AssetDatabase.AssetPathToGUID(includePath);
return AddInternal(guid, includePath, location, new FieldCondition[] { fieldCondition });
}
public IncludeCollection Add(string includePath, IncludeLocation location, FieldCondition[] fieldConditions)
{
var guid = AssetDatabase.AssetPathToGUID(includePath);
return AddInternal(guid, includePath, location, fieldConditions);
}
public IncludeCollection AddInternal(string includeGUID, string includePath, IncludeLocation location, FieldCondition[] fieldConditions = null)
{
if (string.IsNullOrEmpty(includeGUID))
{
// either the file doesn't exist, or this is a placeholder
// de-duplicate by path
int existing = includes.FindIndex(i => i.path == includePath);
if (existing < 0)
includes.Add(new IncludeDescriptor(null, includePath, location, fieldConditions));
return this;
}
else
{
// de-duplicate by GUID
int existing = includes.FindIndex(i => i.guid == includeGUID);
if (existing < 0)
{
// no duplicates, just add it
includes.Add(new IncludeDescriptor(includeGUID, includePath, location, fieldConditions));
}
else
{
// duplicate file -- we could double check they are the same...
// they might have different field conditions that require merging, for example.
// But for now we'll just assume they are the same and drop the new one
}
}
return this;
}
public IEnumerator<IncludeDescriptor> GetEnumerator()
{
return includes.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1f40793f6012b40af9d512ae612819f0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,66 @@
using System.Collections;
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class KeywordCollection : IEnumerable<KeywordCollection.Item>
{
public class Item : IConditional
{
public KeywordDescriptor descriptor { get; }
public FieldCondition[] fieldConditions { get; }
public Item(KeywordDescriptor descriptor, FieldCondition[] fieldConditions)
{
this.descriptor = descriptor;
this.fieldConditions = fieldConditions;
}
}
readonly List<Item> m_Items;
public KeywordCollection()
{
m_Items = new List<Item>();
}
public KeywordCollection Add(KeywordCollection keywords)
{
foreach (KeywordCollection.Item item in keywords)
{
m_Items.Add(item);
}
return this;
}
public KeywordCollection Add(KeywordDescriptor descriptor)
{
m_Items.Add(new Item(descriptor, null));
return this;
}
public KeywordCollection Add(KeywordDescriptor descriptor, FieldCondition fieldCondition)
{
m_Items.Add(new Item(descriptor, new FieldCondition[] { fieldCondition }));
return this;
}
public KeywordCollection Add(KeywordDescriptor descriptor, FieldCondition[] fieldConditions)
{
m_Items.Add(new Item(descriptor, fieldConditions));
return this;
}
public IEnumerator<Item> GetEnumerator()
{
return m_Items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 657c4c9b7ac7f46f8931f7d44835ed37
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,66 @@
using System.Collections;
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class PassCollection : IEnumerable<PassCollection.Item>
{
public class Item : IConditional
{
public PassDescriptor descriptor { get; }
public FieldCondition[] fieldConditions { get; }
public Item(PassDescriptor descriptor, FieldCondition[] fieldConditions)
{
this.descriptor = descriptor;
this.fieldConditions = fieldConditions;
}
}
readonly List<Item> m_Items;
public PassCollection()
{
m_Items = new List<Item>();
}
public PassCollection Add(PassCollection passes)
{
foreach (PassCollection.Item item in passes)
{
m_Items.Add(item);
}
return this;
}
public PassCollection Add(PassDescriptor descriptor)
{
m_Items.Add(new Item(descriptor, null));
return this;
}
public PassCollection Add(PassDescriptor descriptor, FieldCondition fieldCondition)
{
m_Items.Add(new Item(descriptor, new FieldCondition[] { fieldCondition }));
return this;
}
public PassCollection Add(PassDescriptor descriptor, FieldCondition[] fieldConditions)
{
m_Items.Add(new Item(descriptor, fieldConditions));
return this;
}
public IEnumerator<Item> GetEnumerator()
{
return m_Items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: db334d8d6638d482fa8537623d00034a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,67 @@
using System.Collections;
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class PragmaCollection : IEnumerable<PragmaCollection.Item>
{
public class Item : IConditional
{
public PragmaDescriptor descriptor { get; }
public FieldCondition[] fieldConditions { get; }
public string value => $"#pragma {descriptor.value}";
public Item(PragmaDescriptor descriptor, FieldCondition[] fieldConditions)
{
this.descriptor = descriptor;
this.fieldConditions = fieldConditions;
}
}
readonly List<Item> m_Items;
public PragmaCollection()
{
m_Items = new List<Item>();
}
public PragmaCollection Add(PragmaCollection pragmas)
{
foreach (PragmaCollection.Item item in pragmas)
{
m_Items.Add(item);
}
return this;
}
public PragmaCollection Add(PragmaDescriptor descriptor)
{
m_Items.Add(new Item(descriptor, null));
return this;
}
public PragmaCollection Add(PragmaDescriptor descriptor, FieldCondition fieldCondition)
{
m_Items.Add(new Item(descriptor, new FieldCondition[] { fieldCondition }));
return this;
}
public PragmaCollection Add(PragmaDescriptor descriptor, FieldCondition[] fieldConditions)
{
m_Items.Add(new Item(descriptor, fieldConditions));
return this;
}
public IEnumerator<Item> GetEnumerator()
{
return m_Items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b6fd360d8ee574e7d85d34a382a182f0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,67 @@
using System.Collections;
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class RenderStateCollection : IEnumerable<RenderStateCollection.Item>
{
public class Item : IConditional
{
public RenderStateDescriptor descriptor { get; }
public FieldCondition[] fieldConditions { get; }
public string value => descriptor.value;
public Item(RenderStateDescriptor descriptor, FieldCondition[] fieldConditions)
{
this.descriptor = descriptor;
this.fieldConditions = fieldConditions;
}
}
readonly List<Item> m_Items;
public RenderStateCollection()
{
m_Items = new List<Item>();
}
public RenderStateCollection Add(RenderStateCollection renderStates)
{
foreach (RenderStateCollection.Item item in renderStates)
{
m_Items.Add(item);
}
return this;
}
public RenderStateCollection Add(RenderStateDescriptor descriptor)
{
m_Items.Add(new Item(descriptor, null));
return this;
}
public RenderStateCollection Add(RenderStateDescriptor descriptor, FieldCondition fieldCondition)
{
m_Items.Add(new Item(descriptor, new FieldCondition[] { fieldCondition }));
return this;
}
public RenderStateCollection Add(RenderStateDescriptor descriptor, FieldCondition[] fieldConditions)
{
m_Items.Add(new Item(descriptor, fieldConditions));
return this;
}
public IEnumerator<Item> GetEnumerator()
{
return m_Items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e36bca8c61396497dbd25f2091daa9c6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,66 @@
using System.Collections;
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class StructCollection : IEnumerable<StructCollection.Item>
{
public class Item : IConditional
{
public StructDescriptor descriptor { get; }
public FieldCondition[] fieldConditions { get; }
public Item(StructDescriptor descriptor, FieldCondition[] fieldConditions)
{
this.descriptor = descriptor;
this.fieldConditions = fieldConditions;
}
}
readonly List<StructCollection.Item> m_Items;
public StructCollection()
{
m_Items = new List<StructCollection.Item>();
}
public StructCollection Add(StructCollection structs)
{
foreach (StructCollection.Item item in structs)
{
m_Items.Add(item);
}
return this;
}
public StructCollection Add(StructDescriptor descriptor)
{
m_Items.Add(new StructCollection.Item(descriptor, null));
return this;
}
public StructCollection Add(StructDescriptor descriptor, FieldCondition fieldCondition)
{
m_Items.Add(new StructCollection.Item(descriptor, new FieldCondition[] { fieldCondition }));
return this;
}
public StructCollection Add(StructDescriptor descriptor, FieldCondition[] fieldConditions)
{
m_Items.Add(new StructCollection.Item(descriptor, fieldConditions));
return this;
}
public IEnumerator<StructCollection.Item> GetEnumerator()
{
return m_Items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 22719ef12eb4042bfb2c5268c688f4bf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e7109562d81c04d45be09c804dc1b8ae
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,27 @@
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class TargetActiveBlockContext
{
public List<BlockFieldDescriptor> activeBlocks { get; private set; }
public List<BlockFieldDescriptor> currentBlocks { get; private set; }
public PassDescriptor? pass { get; private set; }
public TargetActiveBlockContext(List<BlockFieldDescriptor> currentBlocks, PassDescriptor? pass)
{
activeBlocks = new List<BlockFieldDescriptor>();
this.currentBlocks = currentBlocks;
this.pass = pass;
}
public void AddBlock(BlockFieldDescriptor block, bool conditional = true)
{
if (conditional == true)
{
activeBlocks.Add(block);
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 860eceef9d9eeb64789007e44a1935fe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,29 @@
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class TargetFieldContext
{
public List<ConditionalField> conditionalFields { get; private set; }
public PassDescriptor pass { get; private set; }
public List<(BlockFieldDescriptor descriptor, bool isDefaultValue)> blocks { get; private set; }
public List<BlockFieldDescriptor> connectedBlocks { get; private set; }
public bool hasDotsProperties { get; private set; }
// NOTE: active blocks (and connectedBlocks) do not include temporarily added default blocks
public TargetFieldContext(PassDescriptor pass, List<(BlockFieldDescriptor descriptor, bool isDefaultValue)> activeBlocks, List<BlockFieldDescriptor> connectedBlocks, bool hasDotsProperties)
{
conditionalFields = new List<ConditionalField>();
this.pass = pass;
this.blocks = activeBlocks;
this.connectedBlocks = connectedBlocks;
this.hasDotsProperties = hasDotsProperties;
}
public void AddField(FieldDescriptor field, bool conditional = true)
{
conditionalFields.Add(new ConditionalField(field, conditional));
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1b72eab244c7bf14cabec1afc06beebb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
using UnityEditor.Graphing.Util;
using UnityEditor.ShaderGraph.Drawing;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class TargetPropertyGUIContext : VisualElement
{
const int kIndentWidthInPixel = 15;
public int globalIndentLevel { get; set; } = 0;
public TargetPropertyGUIContext()
{
}
public void AddProperty<T>(string label, BaseField<T> field, bool condition, EventCallback<ChangeEvent<T>> evt)
{
if (condition == true)
{
AddProperty<T>(label, field, evt);
}
}
public void AddProperty<T>(string label, int indentLevel, BaseField<T> field, bool condition, EventCallback<ChangeEvent<T>> evt)
{
if (condition == true)
{
AddProperty<T>(label, indentLevel, field, evt);
}
}
public void AddProperty<T>(string label, BaseField<T> field, EventCallback<ChangeEvent<T>> evt)
{
AddProperty<T>(label, 0, field, evt);
}
public void AddProperty<T>(string label, int indentLevel, BaseField<T> field, EventCallback<ChangeEvent<T>> evt)
{
AddProperty<T>(label, string.Empty, indentLevel, field, evt);
}
public void AddProperty<T>(string label, string tooltip, int indentLevel, BaseField<T> field, EventCallback<ChangeEvent<T>> evt)
{
if (field is INotifyValueChanged<T> notifyValueChanged)
{
notifyValueChanged.RegisterValueChangedCallback(evt);
}
var propertyLabel = new Label(label);
propertyLabel.tooltip = tooltip;
var propertyRow = new PropertyRow(propertyLabel);
ApplyPadding(propertyRow, indentLevel);
propertyRow.Add(field);
this.hierarchy.Add(propertyRow);
}
public void AddLabel(string label, int indentLevel)
{
var propertyRow = new PropertyRow(new Label(label));
ApplyPadding(propertyRow, indentLevel);
this.hierarchy.Add(propertyRow);
}
public void AddHelpBox(MessageType messageType, string messageText)
{
var helpBox = new HelpBoxRow(messageType);
helpBox.Add(new Label(messageText));
this.hierarchy.Add(helpBox);
}
void ApplyPadding(PropertyRow row, int indentLevel)
{
row.Q(className: "unity-label").style.marginLeft = (globalIndentLevel + indentLevel) * kIndentWidthInPixel;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5b0e9f1f7df8dc34a984c30b56cf998b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,46 @@
using System;
using System.Linq;
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class TargetSetupContext
{
public List<SubShaderDescriptor> subShaders { get; private set; }
public List<(string shaderGUI, string renderPipelineAssetType)> customEditorForRenderPipelines { get; private set; }
public AssetCollection assetCollection { get; private set; }
public string defaultShaderGUI { get; private set; }
// pass a HashSet to the constructor to have it gather asset dependency GUIDs
public TargetSetupContext(AssetCollection assetCollection = null)
{
subShaders = new List<SubShaderDescriptor>();
this.customEditorForRenderPipelines = new List<(string shaderGUI, string renderPipelineAssetType)>();
this.assetCollection = assetCollection;
}
public void AddSubShader(SubShaderDescriptor subShader)
{
subShaders.Add(subShader);
}
public void AddAssetDependency(GUID guid, AssetCollection.Flags flags)
{
assetCollection?.AddAssetDependency(guid, flags);
}
public void SetDefaultShaderGUI(string defaultShaderGUI)
{
this.defaultShaderGUI = defaultShaderGUI;
}
public void AddCustomEditorForRenderPipeline(string shaderGUI, Type renderPipelineAssetType)
{
this.customEditorForRenderPipelines.Add((shaderGUI, renderPipelineAssetType.FullName));
}
public bool HasCustomEditorForRenderPipeline(Type renderPipelineAssetType)
=> this.customEditorForRenderPipelines.Any(c => c.renderPipelineAssetType == renderPipelineAssetType.FullName);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b681d2c61f5433e4e9be20bfb43db249
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,168 @@
using UnityEngine;
using UnityEditor.ShaderGraph.Internal;
namespace UnityEditor.ShaderGraph
{
// This whole file is regrettable.
// However, right now we need an abstraction for MaterialSlot for use with BlockFieldDescriptors.
// MaterialSlot is very leaky, so we cant make it public but we need BlockFieldDescriptor to be public.
// All MaterialSlot types required by a BlockFieldDescriptor need a matching Control here.
// We also need a corresponding case in BlockNode.AddSlot for each control.
public interface IControl
{
ShaderGraphRequirements GetRequirements();
}
public class PositionControl : IControl
{
public CoordinateSpace space { get; private set; }
public PositionControl(CoordinateSpace space)
{
this.space = space;
}
public ShaderGraphRequirements GetRequirements()
{
return new ShaderGraphRequirements() { requiresPosition = space.ToNeededCoordinateSpace() };
}
}
public class NormalControl : IControl
{
public CoordinateSpace space { get; private set; }
public NormalControl(CoordinateSpace space)
{
this.space = space;
}
public ShaderGraphRequirements GetRequirements()
{
return new ShaderGraphRequirements() { requiresNormal = space.ToNeededCoordinateSpace() };
}
}
public class TangentControl : IControl
{
public CoordinateSpace space { get; private set; }
public TangentControl(CoordinateSpace space)
{
this.space = space;
}
public ShaderGraphRequirements GetRequirements()
{
return new ShaderGraphRequirements() { requiresTangent = space.ToNeededCoordinateSpace() };
}
}
public class ColorControl : IControl
{
public Color value { get; private set; }
public bool hdr { get; private set; }
public ColorControl(Color value, bool hdr)
{
this.value = value;
this.hdr = hdr;
}
public ShaderGraphRequirements GetRequirements()
{
return ShaderGraphRequirements.none;
}
}
public class ColorRGBAControl : IControl
{
public Color value { get; private set; }
public ColorRGBAControl(Color value)
{
this.value = value;
}
public ShaderGraphRequirements GetRequirements()
{
return ShaderGraphRequirements.none;
}
}
public class FloatControl : IControl
{
public float value { get; private set; }
public FloatControl(float value)
{
this.value = value;
}
public ShaderGraphRequirements GetRequirements()
{
return ShaderGraphRequirements.none;
}
}
public class Vector2Control : IControl
{
public Vector2 value { get; private set; }
public Vector2Control(Vector2 value)
{
this.value = value;
}
public ShaderGraphRequirements GetRequirements()
{
return ShaderGraphRequirements.none;
}
}
public class Vector3Control : IControl
{
public Vector3 value { get; private set; }
public Vector3Control(Vector3 value)
{
this.value = value;
}
public ShaderGraphRequirements GetRequirements()
{
return ShaderGraphRequirements.none;
}
}
public class Vector4Control : IControl
{
public Vector4 value { get; private set; }
public Vector4Control(Vector4 value)
{
this.value = value;
}
public ShaderGraphRequirements GetRequirements()
{
return ShaderGraphRequirements.none;
}
}
public class VertexColorControl : IControl
{
public Color value { get; private set; }
public VertexColorControl(Color value)
{
this.value = value;
}
public ShaderGraphRequirements GetRequirements()
{
return new ShaderGraphRequirements() { requiresVertexColor = true };
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4f3470767c2eef44f845b47f9ae5538d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f78c50a65bb1b22409719a84b48ff794
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,15 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal struct ConditionalField
{
public FieldDescriptor field { get; }
public bool condition { get; }
public ConditionalField(FieldDescriptor field, bool condition)
{
this.field = field;
this.condition = condition;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: add11c9e8698ab44895f9c5a116eb4d3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,26 @@
using System;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Serializable]
[GenerationAPI]
internal struct DropdownEntry
{
public int id; // Used to determine what MaterialSlot an entry belongs to
public string displayName;
// In this case, we will handle the actual IDs later
public DropdownEntry(string displayName)
{
this.id = -1;
this.displayName = displayName;
}
internal DropdownEntry(int id, string displayName)
{
this.id = id;
this.displayName = displayName;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: df5618ff481ae324cb444e2dda9674e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,15 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class FieldCondition
{
public FieldDescriptor field { get; }
public bool condition { get; }
public FieldCondition(FieldDescriptor field, bool condition)
{
this.field = field;
this.condition = condition;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c68ce9e6274103943b0a6bfd15f48618
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,15 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal struct FieldDependency
{
public FieldDescriptor field;
public FieldDescriptor dependsOn;
public FieldDependency(FieldDescriptor field, FieldDescriptor dependsOn)
{
this.field = field;
this.dependsOn = dependsOn;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4a4c68fff9ff9cf4f9e9cf4d4077485b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,28 @@
using System;
namespace UnityEditor.ShaderGraph
{
[Serializable]
[GenerationAPI]
internal struct KeywordEntry
{
public int id; // Used to determine what MaterialSlot an entry belongs to
public string displayName;
public string referenceName;
// In this case, we will handle the actual IDs later
public KeywordEntry(string displayName, string referenceName)
{
this.id = -1;
this.displayName = displayName;
this.referenceName = referenceName;
}
internal KeywordEntry(int id, string displayName, string referenceName)
{
this.id = id;
this.displayName = displayName;
this.referenceName = referenceName;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 504b2aecb2ac66e4c97ffc7df1df2c71
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e5779cc2c32bb4c90b671ed2e6629e3d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,16 @@
using System.Collections.Generic;
namespace UnityEditor.ShaderGraph
{
internal class AdditionalCommandDescriptor
{
public string token { get; }
public string content { get; }
public AdditionalCommandDescriptor(string token, string content)
{
this.token = token;
this.content = content;
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 443389252e1f464fb537873630611201
timeCreated: 1607706972

View file

@ -0,0 +1,56 @@
using System;
namespace UnityEditor.ShaderGraph
{
internal class BlockFieldDescriptor : FieldDescriptor
{
public string displayName { get; }
public IControl control { get; }
public ShaderStage shaderStage { get; }
public bool isHidden { get; }
public bool isUnknown { get; }
public bool isCustom { get; }
internal string path { get; set; }
public BlockFieldDescriptor(string tag, string referenceName, string define, IControl control, ShaderStage shaderStage, bool isHidden = false, bool isUnknown = false, bool isCustom = false)
: base(tag, referenceName, define)
{
this.displayName = referenceName;
this.control = control;
this.shaderStage = shaderStage;
this.isHidden = isHidden;
this.isUnknown = isUnknown;
this.isCustom = isCustom;
}
public BlockFieldDescriptor(string tag, string referenceName, string displayName, string define, IControl control, ShaderStage shaderStage, bool isHidden = false, bool isUnknown = false, bool isCustom = false)
: base(tag, referenceName, define)
{
this.displayName = displayName;
this.control = control;
this.shaderStage = shaderStage;
this.isHidden = isHidden;
this.isUnknown = isUnknown;
this.isCustom = isCustom;
}
}
// TODO: This exposes the MaterialSlot API
// TODO: This needs to be removed but is currently required by HDRP for DiffusionProfileInputMaterialSlot
internal class CustomSlotBlockFieldDescriptor : BlockFieldDescriptor
{
public Func<MaterialSlot> createSlot;
public CustomSlotBlockFieldDescriptor(string tag, string referenceName, string define, Func<MaterialSlot> createSlot)
: base(tag, referenceName, define, null, ShaderStage.Fragment)
{
this.createSlot = createSlot;
}
public CustomSlotBlockFieldDescriptor(string tag, string referenceName, string displayName, string define, Func<MaterialSlot> createSlot)
: base(tag, referenceName, displayName, define, null, ShaderStage.Fragment)
{
this.createSlot = createSlot;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 82f47029c21684be390696599c52fb76
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,54 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal class FieldDescriptor
{
// Default
public string tag { get; }
public string name { get; }
public string define { get; }
public string interpolation { get; }
// StructField
public string type { get; }
public int vectorCount { get; }
public string semantic { get; }
public string preprocessor { get; }
public StructFieldOptions subscriptOptions { get; }
public FieldDescriptor(string tag, string name, string define)
{
this.tag = tag;
this.name = name;
this.define = define;
}
public FieldDescriptor(string tag, string name, string define, ShaderValueType type,
string semantic = "", string preprocessor = "", StructFieldOptions subscriptOptions = StructFieldOptions.Static, string interpolation = "")
{
this.tag = tag;
this.name = name;
this.define = define;
this.type = type.ToShaderString();
this.vectorCount = type.GetVectorCount();
this.semantic = semantic;
this.preprocessor = preprocessor;
this.interpolation = interpolation;
this.subscriptOptions = subscriptOptions;
}
public FieldDescriptor(string tag, string name, string define, string type,
string semantic = "", string preprocessor = "", StructFieldOptions subscriptOptions = StructFieldOptions.Static, string interpolation = "")
{
this.tag = tag;
this.name = name;
this.define = define;
this.type = type;
this.vectorCount = 0;
this.semantic = semantic;
this.preprocessor = preprocessor;
this.interpolation = interpolation;
this.subscriptOptions = subscriptOptions;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f5db19d167675764da0c07a0fb031d9b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,49 @@
using System;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
[Serializable]
internal class IncludeDescriptor : IConditional
{
public IncludeDescriptor(string guid, string path, IncludeLocation location, FieldCondition[] fieldConditions)
{
_guid = guid;
_path = path;
_location = location;
this.fieldConditions = fieldConditions;
}
[SerializeField]
string _guid;
public string guid => _guid;
// NOTE: this path is NOT guaranteed to be correct -- it's only the path that was given to us when this descriptor was constructed.
// if the file was moved, it may not be correct. use the GUID to get the current REAL path via AssetDatabase.GUIDToAssetPath
[SerializeField]
string _path;
public string path => _path;
[SerializeField]
IncludeLocation _location;
public IncludeLocation location => _location;
// NOTE: this is not serialized at the moment.. as it's not needed.
// (serialization only used for subgraph includes, coming from nodes, which can't have conditions)
public FieldCondition[] fieldConditions { get; }
public string value
{
get
{
// we must get the path from asset database to ensure it is correct after file moves
var realPath = AssetDatabase.GUIDToAssetPath(guid);
if (string.IsNullOrEmpty(realPath))
return $"// missing include file: {path} ({guid})";
else
return $"#include \"{realPath}\"";
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5c3e582d15e186547aa916699e3bfb34
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,26 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal struct KeywordDescriptor
{
public string displayName;
public string referenceName;
public KeywordType type;
public KeywordDefinition definition;
public KeywordScope scope;
public KeywordShaderStage stages;
public int value;
public KeywordEntry[] entries;
public void AppendKeywordDeclarationStrings(ShaderStringBuilder builder)
{
if (definition != KeywordDefinition.Predefined)
{
if (type == KeywordType.Boolean)
KeywordUtil.GenerateBooleanKeywordPragmaStrings(referenceName, definition, scope, stages, str => builder.AppendLine(str));
else
KeywordUtil.GenerateEnumKeywordPragmaStrings(referenceName, definition, scope, stages, entries, str => builder.AppendLine(str));
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: be7dc61bbad850044be1020424c0d22c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,39 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal struct PassDescriptor
{
// Definition
public string displayName;
public string referenceName;
public string lightMode;
public bool useInPreview;
public bool virtualTextureFeedback;
// Templates
public string passTemplatePath;
public string[] sharedTemplateDirectories;
// Port mask
public BlockFieldDescriptor[] validVertexBlocks;
public BlockFieldDescriptor[] validPixelBlocks;
// Collections
public StructCollection structs;
public FieldCollection requiredFields;
public DependencyCollection fieldDependencies;
public RenderStateCollection renderStates;
public PragmaCollection pragmas;
public DefineCollection defines;
public KeywordCollection keywords;
public IncludeCollection includes;
public AdditionalCommandCollection additionalCommands;
public CustomInterpSubGen.Collection customInterpolators;
// Methods
public bool Equals(PassDescriptor other)
{
return referenceName == other.referenceName;
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6ff52c01a22cf93409b31a2bf5a73fea
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,42 @@
using System.Linq;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal struct PragmaDescriptor
{
public string value;
}
[GenerationAPI]
internal static class Pragma
{
static string GetPlatformList(Platform[] platforms)
{
var rendererStrings = platforms.Select(x => x.ToShaderString());
return string.Join(" ", rendererStrings);
}
public static PragmaDescriptor Target(ShaderModel value) => new PragmaDescriptor { value = $"target {value.ToShaderString()}" };
public static PragmaDescriptor Vertex(string value) => new PragmaDescriptor { value = $"vertex {value}" };
public static PragmaDescriptor Fragment(string value) => new PragmaDescriptor { value = $"fragment {value}" };
public static PragmaDescriptor Geometry(string value) => new PragmaDescriptor { value = $"geometry {value}" };
public static PragmaDescriptor Hull(string value) => new PragmaDescriptor { value = $"hull {value}" };
public static PragmaDescriptor Domain(string value) => new PragmaDescriptor { value = $"domain {value}" };
public static PragmaDescriptor Raytracing(string value) => new PragmaDescriptor { value = $"raytracing {value}" };
public static PragmaDescriptor OnlyRenderers(Platform[] renderers) => new PragmaDescriptor { value = $"only_renderers {GetPlatformList(renderers)}" };
public static PragmaDescriptor NeverUseDXC(Platform[] renderers) => new PragmaDescriptor { value = $"never_use_dxc {GetPlatformList(renderers)}" };
public static PragmaDescriptor ExcludeRenderers(Platform[] renderers) => new PragmaDescriptor { value = $"exclude_renderers {GetPlatformList(renderers)}" };
public static PragmaDescriptor PreferHlslCC(Platform[] renderers) => new PragmaDescriptor { value = $"prefer_hlslcc {GetPlatformList(renderers)}" };
public static PragmaDescriptor InstancingOptions(InstancingOptions value) => new PragmaDescriptor { value = $"instancing_options {value.ToShaderString()}" };
public static PragmaDescriptor MultiCompileInstancing => new PragmaDescriptor { value = "multi_compile_instancing" };
public static PragmaDescriptor MultiCompileForwardBase => new PragmaDescriptor { value = "multi_compile_fwdbase" };
public static PragmaDescriptor MultiCompileForwardAddFullShadowsBase => new PragmaDescriptor { value = "multi_compile_fwdadd_fullshadows" };
public static PragmaDescriptor MultiCompilePrePassFinal => new PragmaDescriptor { value = "multi_compile_prepassfinal" };
public static PragmaDescriptor MultiCompileShadowCaster => new PragmaDescriptor { value = "multi_compile_shadowcaster" };
public static PragmaDescriptor DOTSInstancing => new PragmaDescriptor { value = "multi_compile _ DOTS_INSTANCING_ON" };
public static PragmaDescriptor MultiCompileFog => new PragmaDescriptor { value = "multi_compile_fog" };
public static PragmaDescriptor EditorSyncCompilation => new PragmaDescriptor { value = "editor_sync_compilation" };
public static PragmaDescriptor SkipVariants(string[] variants) => new PragmaDescriptor { value = $"skip_variants {string.Join(" ", variants)}" };
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a6b8a24ec57997b4096041c3ee80b679
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,47 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal enum RenderStateType
{
Cull,
Blend,
BlendOp,
ZTest,
ZWrite,
ColorMask,
ZClip,
Stencil,
AlphaToMask,
}
[GenerationAPI]
internal struct RenderStateDescriptor
{
public string value;
public RenderStateType type;
}
[GenerationAPI]
internal static class RenderState
{
public static RenderStateDescriptor Cull(Cull value) => new RenderStateDescriptor { type = RenderStateType.Cull, value = $"Cull {value}" };
public static RenderStateDescriptor Cull(string value) => new RenderStateDescriptor { type = RenderStateType.Cull, value = $"Cull {value}" };
public static RenderStateDescriptor Blend(Blend src, Blend dst) => new RenderStateDescriptor { type = RenderStateType.Blend, value = $"Blend {src} {dst}" };
public static RenderStateDescriptor Blend(string src, string dst) => new RenderStateDescriptor { type = RenderStateType.Blend, value = $"Blend {src} {dst}" };
public static RenderStateDescriptor Blend(Blend src, Blend dst, Blend alphaSrc, Blend alphaDst) => new RenderStateDescriptor { type = RenderStateType.Blend, value = $"Blend {src} {dst}, {alphaSrc} {alphaDst}" };
public static RenderStateDescriptor Blend(string src, string dst, string alphaSrc, string alphaDst) => new RenderStateDescriptor { type = RenderStateType.Blend, value = $"Blend {src} {dst}, {alphaSrc} {alphaDst}" };
public static RenderStateDescriptor Blend(string value) => new RenderStateDescriptor { type = RenderStateType.Blend, value = value };
public static RenderStateDescriptor BlendOp(BlendOp op) => new RenderStateDescriptor { type = RenderStateType.BlendOp, value = $"BlendOp {op}" };
public static RenderStateDescriptor BlendOp(string op) => new RenderStateDescriptor { type = RenderStateType.BlendOp, value = $"BlendOp {op}" };
public static RenderStateDescriptor BlendOp(BlendOp op, BlendOp opAlpha) => new RenderStateDescriptor { type = RenderStateType.BlendOp, value = $"BlendOp {op}, {opAlpha}" };
public static RenderStateDescriptor BlendOp(string op, string opAlpha) => new RenderStateDescriptor { type = RenderStateType.BlendOp, value = $"BlendOp {op}, {opAlpha}" };
public static RenderStateDescriptor ZTest(ZTest value) => new RenderStateDescriptor { type = RenderStateType.ZTest, value = $"ZTest {value}" };
public static RenderStateDescriptor ZTest(string value) => new RenderStateDescriptor { type = RenderStateType.ZTest, value = $"ZTest {value}" };
public static RenderStateDescriptor ZWrite(ZWrite value) => new RenderStateDescriptor { type = RenderStateType.ZWrite, value = $"ZWrite {value}" };
public static RenderStateDescriptor ZWrite(string value) => new RenderStateDescriptor { type = RenderStateType.ZWrite, value = $"ZWrite {value}" };
public static RenderStateDescriptor ZClip(string value) => new RenderStateDescriptor { type = RenderStateType.ZClip, value = $"ZClip {value}" };
public static RenderStateDescriptor ColorMask(string value) => new RenderStateDescriptor { type = RenderStateType.ColorMask, value = $"{value}" };
public static RenderStateDescriptor AlphaToMask(string value) => new RenderStateDescriptor { type = RenderStateType.AlphaToMask, value = $"AlphaToMask {value}" };
public static RenderStateDescriptor Stencil(StencilDescriptor value) => new RenderStateDescriptor { type = RenderStateType.Stencil, value = value.ToShaderString() };
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 490eb33c72bded5438bc8d55900ad68f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,17 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal struct StencilDescriptor
{
public string WriteMask;
public string Ref;
public string Comp;
public string ZFail;
public string Fail;
public string Pass;
public string CompBack;
public string ZFailBack;
public string FailBack;
public string PassBack;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: be68c990e95a1654e9642087a2c0d2f8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,11 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal struct StructDescriptor
{
public string name;
public bool packFields;
public bool populateWithCustomInterpolators;
public FieldDescriptor[] fields;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a36f03009b35b47a3ad4cc28a7f43cfe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,13 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal struct SubShaderDescriptor
{
public string pipelineTag;
public string customTags;
public string renderType;
public string renderQueue;
public bool generatesPreview;
public PassCollection passes;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: aff9190e7c4f0f2418d0b551cdfac094
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d0cb1fc17ee65684592babcd1dba61b9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,17 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal enum Blend
{
One,
Zero,
SrcColor,
SrcAlpha,
DstColor,
DstAlpha,
OneMinusSrcColor,
OneMinusSrcAlpha,
OneMinusDstColor,
OneMinusDstAlpha,
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 33b35111bec577a4f87a215814291d59
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,12 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal enum BlendOp
{
Add,
Sub,
RevSub,
Min,
Max,
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f37bd1bb1cb123a409370c2cc1eefef4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,10 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal enum Cull
{
Back,
Front,
Off,
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1d9ef2c068925ac42b1a5793f3706b87
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,13 @@
using System;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
[Serializable]
internal enum IncludeLocation
{
Pregraph,
Graph,
Postgraph
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7e093d7ce84934ae4b8f634c4a13b244
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,31 @@
using System;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal enum InstancingOptions
{
RenderingLayer,
NoLightProbe,
NoLodFade,
}
[GenerationAPI]
internal static class InstancingOptionsExtensions
{
public static string ToShaderString(this InstancingOptions options)
{
switch (options)
{
case InstancingOptions.RenderingLayer:
return "renderinglayer";
case InstancingOptions.NoLightProbe:
return "nolightprobe";
case InstancingOptions.NoLodFade:
return "nolodfade";
default:
throw new ArgumentOutOfRangeException();
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8b80934453d594a42bb23876834a3d34
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,10 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal enum KeywordDefinition
{
ShaderFeature, // adds #pragma shaderfeature for the keyword
MultiCompile, // adds #pragma multicompile for the keyword
Predefined // does not add ShaderFeature or MultiCompile pragmas, and is forced to be !exposed
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0dbbf8506ff43e241954711690ea8fde
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal enum KeywordScope
{
Local,
Global
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 24ba7ffe7e34c774a8c8c76d67b6bf23
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,20 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal enum KeywordShaderStage
{
Default = 0, // equivalent to ALL
Vertex = (1 << 0),
Fragment = (1 << 1),
Geometry = (1 << 2),
Hull = (1 << 3),
Domain = (1 << 4),
RayTracing = (1 << 5),
// Common aggregates
FragmentAndRaytracing = (Fragment | RayTracing),
VertexFragmentAndRaytracing = (Vertex | Fragment | RayTracing),
All = (Vertex | Fragment | Geometry | Hull | Domain | RayTracing)
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eebb07dc513b2c443817955c36dbcf1b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal enum KeywordType
{
Boolean,
Enum
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6373167f768c6a34d9a24af8b0ead19d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,12 @@
using System;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal enum NormalDropOffSpace
{
Tangent,
Object,
World
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6fd001e2a845e514ebb19d4d11f3e0a9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,76 @@
using System;
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal enum Platform
{
D3D11,
GLCore,
GLES,
GLES3,
Metal,
Vulkan,
D3D9,
XboxOne,
GameCoreXboxOne,
GameCoreXboxSeries,
Playstation,
Switch,
PS5,
}
[GenerationAPI]
internal static class PlatformExtensions
{
public static string ToShaderString(this Platform platform)
{
switch (platform)
{
case Platform.D3D11:
return "d3d11";
case Platform.GLCore:
return "glcore";
case Platform.GLES:
return "gles";
case Platform.GLES3:
return "gles3";
case Platform.Metal:
return "metal";
case Platform.Vulkan:
return "vulkan";
case Platform.D3D9:
return "d3d11_9x";
case Platform.XboxOne:
return "xboxone";
case Platform.GameCoreXboxOne:
return "xboxone";
case Platform.GameCoreXboxSeries:
return "xboxseries";
case Platform.Playstation:
return "playstation";
case Platform.Switch:
return "switch";
case Platform.PS5:
return "ps5";
default:
throw new ArgumentOutOfRangeException();
}
}
}
internal static class PragmaRenderers
{
// Return high end platform list for the only renderer directive (The list use by HDRP)
internal static Platform[] GetHighEndPlatformArray()
{
return new Platform[] { Platform.D3D11, Platform.Playstation, Platform.XboxOne, Platform.GameCoreXboxSeries, Platform.Vulkan, Platform.Metal, Platform.Switch };
}
// Return platform list not compatible with DXC (The list use by HDRP)
internal static Platform[] GetNeverUseDXCPlatformArray()
{
return new Platform[] { Platform.Metal };
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3400fb009338a904db10884910a88500
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,24 @@
namespace UnityEditor.ShaderGraph.Internal
{
[GenerationAPI]
public enum PropertyType
{
Color,
Texture2D,
Texture2DArray,
Texture3D,
Cubemap,
Gradient,
Boolean,
Float,
Vector2,
Vector3,
Vector4,
Matrix2,
Matrix3,
Matrix4,
SamplerState,
VirtualTexture,
PropertyConnectionState
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 899473813cd13ff4c9a8c057d1bae8a1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,12 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal enum RenderQueue
{
Background,
Geometry,
Transparent,
Overlay,
AlphaTest
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1aa36b6100be7dc4792b1129c202f42e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,12 @@
namespace UnityEditor.ShaderGraph
{
[GenerationAPI]
internal enum RenderType
{
Opaque,
Transparent,
TransparentCutout,
Background,
Overlay
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 13ef64afcd6045a448744a1633363679
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show more