public void Destroy() { m_passNameContainer = null; if (m_templateProperties != null) { m_templateProperties.Destroy(); } m_templateProperties = null; if (m_modules != null) { m_modules.Destroy(); } m_modules = null; if (m_inputDataList != null) { m_inputDataList.Clear(); } m_inputDataList = null; if (m_inputDataDict != null) { m_inputDataDict.Clear(); } m_inputDataDict = null; m_vertexFunctionData = null; m_fragmentFunctionData = null; if (m_vertexDataContainer != null) { m_vertexDataContainer.Destroy(); } m_vertexDataContainer = null; if (m_interpolatorDataContainer != null) { m_interpolatorDataContainer.Destroy(); } if (m_localVarsList != null) { m_localVarsList.Clear(); m_localVarsList = null; } m_interpolatorDataContainer = null; if (m_availableShaderGlobals != null) { m_availableShaderGlobals.Clear(); } m_availableShaderGlobals = null; }
public void ConfigureCommonTag( TemplateTagData tagData, TemplatePropertyContainer propertyContainer, TemplateIdManager idManager, string uniquePrefix, int offsetIdx, string subBody ) { int id = subBody.IndexOf( tagData.Id ): if ( id >= 0 ) { tagData.StartIdx = offsetIdx + id: idManager.RegisterId( tagData.StartIdx, uniquePrefix + tagData.Id, tagData.Id ): propertyContainer.AddId( subBody, tagData.Id, tagData.SearchIndentation ): } }
public void Destroy() { m_passNameContainer = null: #if CUSTOM_OPTIONS_AVAILABLE m_customOptionsContainer = null: #endif if( m_templateProperties != null ) m_templateProperties.Destroy(): m_templateProperties = null: if( m_modules != null ) m_modules.Destroy(): m_modules = null: if( m_inputDataList != null ) m_inputDataList.Clear(): m_inputDataList = null: if( m_inputDataDict != null ) m_inputDataDict.Clear(): m_inputDataDict = null: m_vertexFunctionData = null: m_fragmentFunctionData = null: if( m_vertexDataContainer != null ) m_vertexDataContainer.Destroy(): m_vertexDataContainer = null: if( m_interpolatorDataContainer != null ) m_interpolatorDataContainer.Destroy(): if( m_localVarsList != null ) { m_localVarsList.Clear(): m_localVarsList = null: } m_interpolatorDataContainer = null: if( m_availableShaderGlobals != null ) m_availableShaderGlobals.Clear(): m_availableShaderGlobals = null: }
public void Destroy() { m_LODContainer = null; m_templateProperties.Destroy(); m_templateProperties = null; m_passes.Clear(); m_passes = null; m_modules.Destroy(); m_modules = null; m_availableShaderGlobals.Clear(); m_availableShaderGlobals = null; }
public void Destroy() { m_LODContainer = null: m_customOptionsContainer = null: m_templateProperties.Destroy(): m_templateProperties = null: m_passes.Clear(): m_passes = null: m_modules.Destroy(): m_modules = null: m_availableShaderGlobals.Clear(): m_availableShaderGlobals = null: }
public override void Destroy() { m_templateProperties.Destroy(): m_templateProperties = null: m_availableShaderProperties.Clear(): m_availableShaderProperties = null: int subShaderCount = m_subShaders.Count: for( int i = 0: i < subShaderCount: i++ ) { m_subShaders[ i ].Destroy(): } m_subShaders.Clear(): m_subShaders = null: m_templateIdManager.Destroy(): m_templateIdManager = null: }
public override void Destroy() { m_templateProperties.Destroy(); m_templateProperties = null; m_availableShaderProperties.Clear(); m_availableShaderProperties = null; int subShaderCount = m_subShaders.Count; for (int i = 0; i < subShaderCount; i++) { m_subShaders[i].Destroy(); } m_subShaders.Clear(); m_subShaders = null; m_templateIdManager.Destroy(); m_templateIdManager = null; }
public bool FillTemplateBody( int subShaderId, int passId, string id, ref string body, params string[] values ) { if( values.Length == 0 ) { if( id[ id.Length - 1] == '\n' ) body = "\n": return true: } TemplatePropertyContainer propertyContainer = null: if( subShaderId >= 0 ) { if( passId >= 0 ) { propertyContainer = SubShaders[ subShaderId ].Passes[ passId ].TemplateProperties: } else { propertyContainer = SubShaders[ subShaderId ].TemplateProperties: } } else { propertyContainer = m_templateProperties: } propertyContainer.BuildInfo(): if( propertyContainer.PropertyDict.ContainsKey( id ) ) { string finalValue = propertyContainer.PropertyDict[ id ].UseIndentationAtStart? propertyContainer.PropertyDict[ id ].Indentation:string.Empty: for( int i = 0: i < values.Length: i++ ) { if( propertyContainer.PropertyDict[ id ].AutoLineFeed ) { string[] valuesArr = values[ i ].Split( '\n' ): for( int j = 0: j < valuesArr.Length: j++ ) { //first value will be automatically indented by the string replace finalValue += ( ( i == 0 && j == 0 ) ? string.Empty : propertyContainer.PropertyDict[ id ].Indentation ) + valuesArr[ j ]: finalValue += TemplatesManager.TemplateNewLine: } } else { //first value will be automatically indented by the string replace finalValue += ( i == 0 ? string.Empty : propertyContainer.PropertyDict[ id ].Indentation ) + values[ i ]: } } body = finalValue: propertyContainer.PropertyDict[ id ].Used = true: return true: } if( values.Length > 1 || !string.IsNullOrEmpty( values[ 0 ] ) ) { UIUtils.ShowMessage( string.Format( "Attempting to write data into inexistant tag {0}. Please review the template {1} body and consider adding the missing tag.", id, m_defaultShaderName ), MessageSeverity.Error ): return false: } return true: }
public TemplateModulesData(TemplateIdManager idManager, TemplatePropertyContainer propertyContainer, string uniquePrefix, int offsetIdx, string subBody, bool isSubShader) { if (string.IsNullOrEmpty(subBody)) { return; } m_uniquePrefix = uniquePrefix; //PRAGMAS AND INCLUDES TemplateHelperFunctions.CreatePragmaIncludeList(subBody, m_includePragmaContainer); //COMMON TAGS ConfigureCommonTag(m_globalsTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_functionsTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_pragmaTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_passTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_inputsVertTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_inputsFragTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); //BlEND MODE { Match blendModeMatch = Regex.Match(subBody, TemplateHelperFunctions.BlendWholeWordPattern); if (blendModeMatch.Success) { int blendModeIdx = blendModeMatch.Index; int end = subBody.IndexOf(TemplatesManager.TemplateNewLine, blendModeIdx); string blendParams = subBody.Substring(blendModeIdx, end - blendModeIdx); m_blendData.BlendModeId = blendParams; m_blendData.BlendModeStartIndex = offsetIdx + blendModeIdx; idManager.RegisterId(m_blendData.BlendModeStartIndex, uniquePrefix + m_blendData.BlendModeId, m_blendData.BlendModeId); TemplateHelperFunctions.CreateBlendMode(blendParams, ref m_blendData); if (m_blendData.ValidBlendMode) { propertyContainer.AddId(subBody, blendParams, false); } } } //BLEND OP { Match blendOpMatch = Regex.Match(subBody, TemplateHelperFunctions.BlendOpWholeWordPattern); if (blendOpMatch.Success) { int blendOpIdx = blendOpMatch.Index; int end = subBody.IndexOf(TemplatesManager.TemplateNewLine, blendOpIdx); string blendOpParams = subBody.Substring(blendOpIdx, end - blendOpIdx); m_blendData.BlendOpId = blendOpParams; BlendData.BlendOpStartIndex = offsetIdx + blendOpIdx; idManager.RegisterId(m_blendData.BlendOpStartIndex, uniquePrefix + m_blendData.BlendOpId, m_blendData.BlendOpId); TemplateHelperFunctions.CreateBlendOp(blendOpParams, ref m_blendData); if (m_blendData.ValidBlendOp) { propertyContainer.AddId(subBody, blendOpParams, false); } } } //ALPHA TO MASK { Match alphaToMaskMatch = Regex.Match(subBody, TemplateHelperFunctions.ALphaToMaskPattern); if (alphaToMaskMatch.Success) { m_blendData.ValidAlphaToMask = true; m_blendData.AlphaToMaskId = alphaToMaskMatch.Groups[0].Value; if (alphaToMaskMatch.Groups.Count > 1) { m_blendData.AlphaToMaskValue = alphaToMaskMatch.Groups[1].Value.Equals("On") ? true : false; } m_blendData.IndependentAlphaToMask = true; idManager.RegisterId(offsetIdx + alphaToMaskMatch.Index, uniquePrefix + m_blendData.AlphaToMaskId, m_blendData.AlphaToMaskId); propertyContainer.AddId(subBody, m_blendData.AlphaToMaskId, false); } m_blendData.DataCheck = (m_blendData.ValidBlendMode || m_blendData.ValidBlendOp || m_blendData.ValidAlphaToMask) ? TemplateDataCheck.Valid : TemplateDataCheck.Invalid; } //CULL MODE { Match cullMatch = Regex.Match(subBody, TemplateHelperFunctions.CullWholeWordPattern); if (cullMatch.Success) { int cullIdx = cullMatch.Index; int end = subBody.IndexOf(TemplatesManager.TemplateNewLine, cullIdx); string cullParams = subBody.Substring(cullIdx, end - cullIdx); m_cullModeData.CullModeId = cullParams; m_cullModeData.StartIdx = offsetIdx + cullIdx; idManager.RegisterId(m_cullModeData.StartIdx, uniquePrefix + m_cullModeData.CullModeId, m_cullModeData.CullModeId); TemplateHelperFunctions.CreateCullMode(cullParams, ref m_cullModeData); if (m_cullModeData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, cullParams, false, string.Empty); } } } //COLOR MASK { Match colorMaskMatch = Regex.Match(subBody, TemplateHelperFunctions.ColorMaskWholeWordPattern); if (colorMaskMatch.Success) { int colorMaskIdx = colorMaskMatch.Index; int end = subBody.IndexOf(TemplatesManager.TemplateNewLine, colorMaskIdx); string colorMaskParams = subBody.Substring(colorMaskIdx, end - colorMaskIdx); m_colorMaskData.ColorMaskId = colorMaskParams; m_colorMaskData.StartIdx = offsetIdx + colorMaskIdx; idManager.RegisterId(m_colorMaskData.StartIdx, uniquePrefix + m_colorMaskData.ColorMaskId, m_colorMaskData.ColorMaskId); TemplateHelperFunctions.CreateColorMask(colorMaskParams, ref m_colorMaskData); if (m_colorMaskData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, colorMaskParams, false); } } } //STENCIL { Match stencilMatch = Regex.Match(subBody, TemplateHelperFunctions.StencilWholeWordPattern); if (stencilMatch.Success) { int stencilIdx = stencilMatch.Index; int stencilEndIdx = subBody.IndexOf("}", stencilIdx); if (stencilEndIdx > 0) { string stencilParams = subBody.Substring(stencilIdx, stencilEndIdx + 1 - stencilIdx); m_stencilData.StencilBufferId = stencilParams; m_stencilData.StartIdx = offsetIdx + stencilIdx; idManager.RegisterId(m_stencilData.StartIdx, uniquePrefix + m_stencilData.StencilBufferId, m_stencilData.StencilBufferId); TemplateHelperFunctions.CreateStencilOps(stencilParams, ref m_stencilData); if (m_stencilData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, stencilParams, true); } } } else { int stencilTagIdx = subBody.IndexOf(TemplatesManager.TemplateStencilTag); if (stencilTagIdx > -1) { m_stencilData.SetIndependentDefault(); m_stencilData.StencilBufferId = TemplatesManager.TemplateStencilTag; m_stencilData.StartIdx = offsetIdx + stencilTagIdx; idManager.RegisterId(m_stencilData.StartIdx, uniquePrefix + m_stencilData.StencilBufferId, m_stencilData.StencilBufferId); propertyContainer.AddId(subBody, m_stencilData.StencilBufferId, true); } } } //ZWRITE { Match zWriteMatch = Regex.Match(subBody, TemplateHelperFunctions.ZWriteWholeWordPattern); if (zWriteMatch.Success) { int zWriteOpIdx = zWriteMatch.Index; int zWriteEndIdx = subBody.IndexOf(TemplatesManager.TemplateNewLine, zWriteOpIdx); if (zWriteEndIdx > 0) { m_depthData.ZWriteModeId = subBody.Substring(zWriteOpIdx, zWriteEndIdx + 1 - zWriteOpIdx); m_depthData.ZWriteStartIndex = offsetIdx + zWriteOpIdx; idManager.RegisterId(m_depthData.ZWriteStartIndex, uniquePrefix + m_depthData.ZWriteModeId, m_depthData.ZWriteModeId); TemplateHelperFunctions.CreateZWriteMode(m_depthData.ZWriteModeId, ref m_depthData); if (m_depthData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, m_depthData.ZWriteModeId, true); } } } } //ZTEST { Match zTestMatch = Regex.Match(subBody, TemplateHelperFunctions.ZTestWholeWordPattern); if (zTestMatch.Success) { int zTestOpIdx = zTestMatch.Index; int zTestEndIdx = subBody.IndexOf(TemplatesManager.TemplateNewLine, zTestOpIdx); if (zTestEndIdx > 0) { m_depthData.ZTestModeId = subBody.Substring(zTestOpIdx, zTestEndIdx + 1 - zTestOpIdx); m_depthData.ZTestStartIndex = offsetIdx + zTestOpIdx; idManager.RegisterId(m_depthData.ZTestStartIndex, uniquePrefix + m_depthData.ZTestModeId, m_depthData.ZTestModeId); TemplateHelperFunctions.CreateZTestMode(m_depthData.ZTestModeId, ref m_depthData); if (m_depthData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, m_depthData.ZTestModeId, true); } } } } //ZOFFSET { Match zOffsetMatch = Regex.Match(subBody, TemplateHelperFunctions.ZOffsetWholeWordPattern); if (zOffsetMatch.Success) { int zOffsetIdx = zOffsetMatch.Index; int zOffsetEndIdx = subBody.IndexOf(TemplatesManager.TemplateNewLine, zOffsetIdx); if (zOffsetEndIdx > 0) { m_depthData.OffsetId = subBody.Substring(zOffsetIdx, zOffsetEndIdx + 1 - zOffsetIdx); m_depthData.OffsetStartIndex = offsetIdx + zOffsetIdx; idManager.RegisterId(m_depthData.OffsetStartIndex, uniquePrefix + m_depthData.OffsetId, m_depthData.OffsetId); TemplateHelperFunctions.CreateZOffsetMode(m_depthData.OffsetId, ref m_depthData); if (m_depthData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, m_depthData.OffsetId, true); } } } } //TAGS { Match tagsMatch = Regex.Match(subBody, TemplateHelperFunctions.TagsWholeWordPattern); if (tagsMatch.Success) { int tagsIdx = tagsMatch.Index; int tagsEndIdx = subBody.IndexOf("}", tagsIdx); if (tagsEndIdx > -1) { m_tagData.Reset(); m_tagData.TagsId = subBody.Substring(tagsIdx, tagsEndIdx + 1 - tagsIdx); m_tagData.StartIdx = offsetIdx + tagsIdx; idManager.RegisterId(m_tagData.StartIdx, uniquePrefix + m_tagData.TagsId, m_tagData.TagsId); m_srpType = TemplateHelperFunctions.CreateTags(ref m_tagData, isSubShader); propertyContainer.AddId(subBody, m_tagData.TagsId, false); m_tagData.DataCheck = TemplateDataCheck.Valid; } else { m_tagData.DataCheck = TemplateDataCheck.Invalid; } } else { m_tagData.DataCheck = TemplateDataCheck.Invalid; } } //SHADER MODEL { Match match = Regex.Match(subBody, TemplateHelperFunctions.ShaderModelPattern); if (match != null && match.Groups.Count > 1) { if (TemplateHelperFunctions.AvailableInterpolators.ContainsKey(match.Groups[1].Value)) { m_shaderModel.Id = match.Groups[0].Value; m_shaderModel.StartIdx = offsetIdx + match.Index; m_shaderModel.Value = match.Groups[1].Value; m_shaderModel.InterpolatorAmount = TemplateHelperFunctions.AvailableInterpolators[match.Groups[1].Value]; m_shaderModel.DataCheck = TemplateDataCheck.Valid; idManager.RegisterId(m_shaderModel.StartIdx, uniquePrefix + m_shaderModel.Id, m_shaderModel.Id); } else { m_shaderModel.DataCheck = TemplateDataCheck.Invalid; } } } // ALL MODULES int allModulesIndex = subBody.IndexOf(TemplatesManager.TemplateAllModulesTag); if (allModulesIndex > 0) { //ONLY REGISTER MISSING TAGS ConfigureCommonTag(m_allModulesTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); m_allModulesMode = true; m_blendData.SetAllModulesDefault(); if (!m_cullModeData.IsValid) { m_cullModeData.SetAllModulesDefault(); } if (!m_colorMaskData.IsValid) { m_colorMaskData.SetAllModulesDefault(); } if (!m_stencilData.IsValid) { m_stencilData.SetAllModulesDefault(); } if (!m_depthData.IsValid) { m_depthData.SetAllModulesDefault(); } if (!m_shaderModel.IsValid) { m_shaderModel.SetAllModulesDefault(); } } }
public TemplateModules(TemplateIdManager idManager, TemplatePropertyContainer propertyContainer, string uniquePrefix, int offsetIdx, string subBody, bool isSubShader) { if (string.IsNullOrEmpty(subBody)) { return; } m_uniquePrefix = uniquePrefix; //COMMON TAGS ConfigureCommonTag(m_globalsTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_functionsTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_pragmaTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_passTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_inputsVertTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_inputsFragTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); //BlEND MODE { int blendModeIdx = subBody.IndexOf("Blend"); if (blendModeIdx > 0) { int end = subBody.IndexOf(TemplatesManager.TemplateNewLine, blendModeIdx); string blendParams = subBody.Substring(blendModeIdx, end - blendModeIdx); m_blendData.BlendModeId = blendParams; m_blendData.BlendModeStartIndex = offsetIdx + blendModeIdx; idManager.RegisterId(m_blendData.BlendModeStartIndex, uniquePrefix + m_blendData.BlendModeId, m_blendData.BlendModeId); TemplateHelperFunctions.CreateBlendMode(blendParams, ref m_blendData); if (m_blendData.ValidBlendMode) { propertyContainer.AddId(subBody, blendParams, false); } } } //BLEND OP { int blendOpIdx = subBody.IndexOf("BlendOp"); if (blendOpIdx > 0) { int end = subBody.IndexOf(TemplatesManager.TemplateNewLine, blendOpIdx); string blendOpParams = subBody.Substring(blendOpIdx, end - blendOpIdx); m_blendData.BlendOpId = blendOpParams; BlendData.BlendOpStartIndex = offsetIdx + blendOpIdx; idManager.RegisterId(m_blendData.BlendOpStartIndex, uniquePrefix + m_blendData.BlendOpId, m_blendData.BlendOpId); TemplateHelperFunctions.CreateBlendOp(blendOpParams, ref m_blendData); if (m_blendData.ValidBlendOp) { propertyContainer.AddId(subBody, blendOpParams, false); } } m_blendData.DataCheck = (m_blendData.ValidBlendMode || m_blendData.ValidBlendOp) ? TemplateDataCheck.Valid : TemplateDataCheck.Invalid; } //CULL MODE { int cullIdx = subBody.IndexOf("Cull"); if (cullIdx > 0) { int end = subBody.IndexOf(TemplatesManager.TemplateNewLine, cullIdx); string cullParams = subBody.Substring(cullIdx, end - cullIdx); m_cullModeData.CullModeId = cullParams; m_cullModeData.StartIdx = offsetIdx + cullIdx; idManager.RegisterId(m_cullModeData.StartIdx, uniquePrefix + m_cullModeData.CullModeId, m_cullModeData.CullModeId); TemplateHelperFunctions.CreateCullMode(cullParams, ref m_cullModeData); if (m_cullModeData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, cullParams, false, string.Empty); } } } //COLOR MASK { int colorMaskIdx = subBody.IndexOf("ColorMask"); if (colorMaskIdx > 0) { int end = subBody.IndexOf(TemplatesManager.TemplateNewLine, colorMaskIdx); string colorMaskParams = subBody.Substring(colorMaskIdx, end - colorMaskIdx); m_colorMaskData.ColorMaskId = colorMaskParams; m_colorMaskData.StartIdx = offsetIdx + colorMaskIdx; idManager.RegisterId(m_colorMaskData.StartIdx, uniquePrefix + m_colorMaskData.ColorMaskId, m_colorMaskData.ColorMaskId); TemplateHelperFunctions.CreateColorMask(colorMaskParams, ref m_colorMaskData); if (m_colorMaskData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, colorMaskParams, false); } } } //STENCIL { int stencilIdx = subBody.IndexOf("Stencil"); if (stencilIdx > -1) { int stencilEndIdx = subBody.IndexOf("}", stencilIdx); if (stencilEndIdx > 0) { string stencilParams = subBody.Substring(stencilIdx, stencilEndIdx + 1 - stencilIdx); m_stencilData.StencilBufferId = stencilParams; m_stencilData.StartIdx = offsetIdx + stencilIdx; idManager.RegisterId(m_stencilData.StartIdx, uniquePrefix + m_stencilData.StencilBufferId, m_stencilData.StencilBufferId); TemplateHelperFunctions.CreateStencilOps(stencilParams, ref m_stencilData); if (m_stencilData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, stencilParams, true); } } } } //ZWRITE { int zWriteOpIdx = subBody.IndexOf("ZWrite"); if (zWriteOpIdx > -1) { int zWriteEndIdx = subBody.IndexOf(TemplatesManager.TemplateNewLine, zWriteOpIdx); if (zWriteEndIdx > 0) { m_depthData.ZWriteModeId = subBody.Substring(zWriteOpIdx, zWriteEndIdx + 1 - zWriteOpIdx); m_depthData.ZWriteStartIndex = offsetIdx + zWriteOpIdx; idManager.RegisterId(m_depthData.ZWriteStartIndex, uniquePrefix + m_depthData.ZWriteModeId, m_depthData.ZWriteModeId); TemplateHelperFunctions.CreateZWriteMode(m_depthData.ZWriteModeId, ref m_depthData); if (m_depthData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, m_depthData.ZWriteModeId, true); } } } } //ZTEST { int zTestOpIdx = subBody.IndexOf("ZTest"); if (zTestOpIdx > -1) { int zTestEndIdx = subBody.IndexOf(TemplatesManager.TemplateNewLine, zTestOpIdx); if (zTestEndIdx > 0) { m_depthData.ZTestModeId = subBody.Substring(zTestOpIdx, zTestEndIdx + 1 - zTestOpIdx); m_depthData.ZTestStartIndex = offsetIdx + zTestOpIdx; idManager.RegisterId(m_depthData.ZTestStartIndex, uniquePrefix + m_depthData.ZTestModeId, m_depthData.ZTestModeId); TemplateHelperFunctions.CreateZTestMode(m_depthData.ZTestModeId, ref m_depthData); if (m_depthData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, m_depthData.ZTestModeId, true); } } } } //ZOFFSET { int zOffsetIdx = subBody.IndexOf("Offset"); if (zOffsetIdx > -1) { int zOffsetEndIdx = subBody.IndexOf(TemplatesManager.TemplateNewLine, zOffsetIdx); if (zOffsetEndIdx > 0) { m_depthData.OffsetId = subBody.Substring(zOffsetIdx, zOffsetEndIdx + 1 - zOffsetIdx); m_depthData.OffsetStartIndex = offsetIdx + zOffsetIdx; idManager.RegisterId(m_depthData.OffsetStartIndex, uniquePrefix + m_depthData.OffsetId, m_depthData.OffsetId); TemplateHelperFunctions.CreateZOffsetMode(m_depthData.OffsetId, ref m_depthData); if (m_depthData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, m_depthData.OffsetId, true); } } } } //TAGS { int tagsIdx = subBody.IndexOf("Tags"); if (tagsIdx > -1) { int tagsEndIdx = subBody.IndexOf("}", tagsIdx); if (tagsEndIdx > -1) { m_tagData.Reset(); m_tagData.TagsId = subBody.Substring(tagsIdx, tagsEndIdx + 1 - tagsIdx); m_tagData.StartIdx = offsetIdx + tagsIdx; idManager.RegisterId(m_tagData.StartIdx, uniquePrefix + m_tagData.TagsId, m_tagData.TagsId); m_srpType = TemplateHelperFunctions.CreateTags(ref m_tagData, isSubShader); propertyContainer.AddId(subBody, m_tagData.TagsId, false); m_tagData.DataCheck = TemplateDataCheck.Valid; } else { m_tagData.DataCheck = TemplateDataCheck.Invalid; } } else { m_tagData.DataCheck = TemplateDataCheck.Invalid; } } //SHADER MODEL { Match match = Regex.Match(subBody, TemplateHelperFunctions.ShaderModelPattern); if (match != null && match.Groups.Count > 1) { if (TemplateHelperFunctions.AvailableInterpolators.ContainsKey(match.Groups[1].Value)) { m_shaderModel.Id = match.Groups[0].Value; m_shaderModel.StartIdx = offsetIdx + match.Index; m_shaderModel.Value = match.Groups[1].Value; m_shaderModel.InterpolatorAmount = TemplateHelperFunctions.AvailableInterpolators[match.Groups[1].Value]; m_shaderModel.DataCheck = TemplateDataCheck.Valid; idManager.RegisterId(m_shaderModel.StartIdx, uniquePrefix + m_shaderModel.Id, m_shaderModel.Id); } else { m_shaderModel.DataCheck = TemplateDataCheck.Invalid; } } } }
public TemplateModulesData(TemplateOptionsContainer optionsContainer, TemplateIdManager idManager, TemplatePropertyContainer propertyContainer, string uniquePrefix, int offsetIdx, string subBody, bool isSubShader) { if (string.IsNullOrEmpty(subBody)) { return; } m_uniquePrefix = uniquePrefix; //RENDERING PLATFORMS m_renderPlatformHelper = new TemplateRenderPlatformHelper(); TemplateHelperFunctions.FillRenderingPlatform(m_renderPlatformHelper, subBody); if (m_renderPlatformHelper.IsValid) { m_renderPlatformHelper.Index = offsetIdx + m_renderPlatformHelper.Index; idManager.RegisterId(m_renderPlatformHelper.Index, uniquePrefix + m_renderPlatformHelper.ID, m_renderPlatformHelper.ID); } //PRAGMAS AND INCLUDES TemplateHelperFunctions.CreatePragmaIncludeList(subBody, m_includePragmaContainer); //COMMON TAGS ConfigureCommonTag(m_globalsTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_srpBatcherTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_functionsTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_pragmaTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_pragmaBeforeTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); if (!TemplateHelperFunctions.GetPassUniqueId(m_passTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody, ref m_passUniqueName)) { ConfigureCommonTag(m_passTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); } ConfigureCommonTag(m_inputsVertTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); ConfigureCommonTag(m_inputsFragTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); // If Options are enabled then remove them so they won't influence Regex matches if (optionsContainer.Enabled && optionsContainer.EndIndex > 0) { offsetIdx += optionsContainer.EndIndex; subBody = subBody.Substring(optionsContainer.EndIndex); } //BlEND MODE { Match blendModeMatch = Regex.Match(subBody, TemplateHelperFunctions.BlendModePattern1); if (blendModeMatch.Success) { int blendModeIdx = blendModeMatch.Index; int end = blendModeMatch.Length + blendModeIdx; string blendParams = subBody.Substring(blendModeIdx, end - blendModeIdx); m_blendData1.BlendModeId = blendParams; m_blendData1.BlendModeStartIndex = offsetIdx + blendModeIdx; idManager.RegisterId(m_blendData1.BlendModeStartIndex, uniquePrefix + m_blendData1.BlendModeId, m_blendData1.BlendModeId); TemplateHelperFunctions.CreateBlendMode(blendParams, ref m_blendData1, TemplateHelperFunctions.BlendModePattern1); if (m_blendData1.ValidBlendMode) { propertyContainer.AddId(subBody, blendParams, false); } } } { Match blendModeMatch = Regex.Match(subBody, TemplateHelperFunctions.BlendModePattern2); if (blendModeMatch.Success) { int blendModeIdx = blendModeMatch.Index; int end = blendModeMatch.Length + blendModeIdx; string blendParams = subBody.Substring(blendModeIdx, end - blendModeIdx); m_blendData2.BlendModeId = blendParams; m_blendData2.BlendModeStartIndex = offsetIdx + blendModeIdx; idManager.RegisterId(m_blendData2.BlendModeStartIndex, uniquePrefix + m_blendData2.BlendModeId, m_blendData2.BlendModeId); TemplateHelperFunctions.CreateBlendMode(blendParams, ref m_blendData2, TemplateHelperFunctions.BlendModePattern2); if (m_blendData2.ValidBlendMode) { propertyContainer.AddId(subBody, blendParams, false); } } } { Match blendModeMatch = Regex.Match(subBody, TemplateHelperFunctions.BlendModePattern3); if (blendModeMatch.Success) { int blendModeIdx = blendModeMatch.Index; int end = blendModeMatch.Length + blendModeIdx; string blendParams = subBody.Substring(blendModeIdx, end - blendModeIdx); m_blendData3.BlendModeId = blendParams; m_blendData3.BlendModeStartIndex = offsetIdx + blendModeIdx; idManager.RegisterId(m_blendData3.BlendModeStartIndex, uniquePrefix + m_blendData3.BlendModeId, m_blendData3.BlendModeId); TemplateHelperFunctions.CreateBlendMode(blendParams, ref m_blendData3, TemplateHelperFunctions.BlendModePattern3); if (m_blendData3.ValidBlendMode) { propertyContainer.AddId(subBody, blendParams, false); } } } { string pattern = TemplateHelperFunctions.BlendModePattern; Match blendModeMatch = Regex.Match(subBody, pattern); if (!blendModeMatch.Success && !m_blendData1.ValidBlendMode && !m_blendData2.ValidBlendMode && !m_blendData3.ValidBlendMode) { pattern = TemplateHelperFunctions.BlendModePatternFirst; blendModeMatch = Regex.Match(subBody, pattern); } if (blendModeMatch.Success) { int blendModeIdx = blendModeMatch.Index; int end = blendModeMatch.Length + blendModeIdx; string blendParams = subBody.Substring(blendModeIdx, end - blendModeIdx); m_blendData.BlendModeId = blendParams; m_blendData.BlendModeStartIndex = offsetIdx + blendModeIdx; idManager.RegisterId(m_blendData.BlendModeStartIndex, uniquePrefix + m_blendData.BlendModeId, m_blendData.BlendModeId); TemplateHelperFunctions.CreateBlendMode(blendParams, ref m_blendData, pattern); if (m_blendData.ValidBlendMode) { propertyContainer.AddId(subBody, blendParams, false); } } } //BLEND OP { Match blendOpMatch = Regex.Match(subBody, TemplateHelperFunctions.BlendOpPattern1); if (blendOpMatch.Success) { int blendOpIdx = blendOpMatch.Index; int end = blendOpMatch.Length + blendOpIdx; string blendOpParams = subBody.Substring(blendOpIdx, end - blendOpIdx); m_blendData1.BlendOpId = blendOpParams; m_blendData1.BlendOpStartIndex = offsetIdx + blendOpIdx; idManager.RegisterId(m_blendData1.BlendOpStartIndex, uniquePrefix + m_blendData1.BlendOpId, m_blendData1.BlendOpId); TemplateHelperFunctions.CreateBlendOp(blendOpParams, ref m_blendData1, TemplateHelperFunctions.BlendOpPattern1); if (m_blendData1.ValidBlendOp) { propertyContainer.AddId(subBody, blendOpParams, false); } } m_blendData1.DataCheck = (m_blendData1.ValidBlendMode || m_blendData1.ValidBlendOp) ? TemplateDataCheck.Valid : TemplateDataCheck.Invalid; } { Match blendOpMatch = Regex.Match(subBody, TemplateHelperFunctions.BlendOpPattern2); if (blendOpMatch.Success) { int blendOpIdx = blendOpMatch.Index; int end = blendOpMatch.Length + blendOpIdx; string blendOpParams = subBody.Substring(blendOpIdx, end - blendOpIdx); m_blendData2.BlendOpId = blendOpParams; m_blendData2.BlendOpStartIndex = offsetIdx + blendOpIdx; idManager.RegisterId(m_blendData2.BlendOpStartIndex, uniquePrefix + m_blendData2.BlendOpId, m_blendData2.BlendOpId); TemplateHelperFunctions.CreateBlendOp(blendOpParams, ref m_blendData2, TemplateHelperFunctions.BlendOpPattern2); if (m_blendData2.ValidBlendOp) { propertyContainer.AddId(subBody, blendOpParams, false); } } m_blendData2.DataCheck = (m_blendData2.ValidBlendMode || m_blendData2.ValidBlendOp) ? TemplateDataCheck.Valid : TemplateDataCheck.Invalid; } { Match blendOpMatch = Regex.Match(subBody, TemplateHelperFunctions.BlendOpPattern3); if (blendOpMatch.Success) { int blendOpIdx = blendOpMatch.Index; int end = blendOpMatch.Length + blendOpIdx; string blendOpParams = subBody.Substring(blendOpIdx, end - blendOpIdx); m_blendData3.BlendOpId = blendOpParams; m_blendData3.BlendOpStartIndex = offsetIdx + blendOpIdx; idManager.RegisterId(m_blendData3.BlendOpStartIndex, uniquePrefix + m_blendData3.BlendOpId, m_blendData3.BlendOpId); TemplateHelperFunctions.CreateBlendOp(blendOpParams, ref m_blendData3, TemplateHelperFunctions.BlendOpPattern3); if (m_blendData3.ValidBlendOp) { propertyContainer.AddId(subBody, blendOpParams, false); } } m_blendData3.DataCheck = (m_blendData3.ValidBlendMode || m_blendData3.ValidBlendOp) ? TemplateDataCheck.Valid : TemplateDataCheck.Invalid; } { string pattern = TemplateHelperFunctions.BlendOpPattern; Match blendOpMatch = Regex.Match(subBody, pattern); if (!blendOpMatch.Success && !m_blendData1.ValidBlendOp && !m_blendData2.ValidBlendOp && !m_blendData3.ValidBlendOp) { pattern = TemplateHelperFunctions.BlendOpPatternFirst; blendOpMatch = Regex.Match(subBody, pattern); } if (blendOpMatch.Success) { int blendOpIdx = blendOpMatch.Index; int end = blendOpMatch.Length + blendOpIdx; string blendOpParams = subBody.Substring(blendOpIdx, end - blendOpIdx); m_blendData.BlendOpId = blendOpParams; m_blendData.BlendOpStartIndex = offsetIdx + blendOpIdx; idManager.RegisterId(m_blendData.BlendOpStartIndex, uniquePrefix + m_blendData.BlendOpId, m_blendData.BlendOpId); TemplateHelperFunctions.CreateBlendOp(blendOpParams, ref m_blendData, pattern); if (m_blendData.ValidBlendOp) { propertyContainer.AddId(subBody, blendOpParams, false); } } m_blendData.DataCheck = (m_blendData.ValidBlendMode || m_blendData.ValidBlendOp) ? TemplateDataCheck.Valid : TemplateDataCheck.Invalid; } //ALPHA TO MASK { Match alphaToMaskMatch = Regex.Match(subBody, TemplateHelperFunctions.AlphaToMaskPattern); if (alphaToMaskMatch.Success) { int alphaIdx = alphaToMaskMatch.Index; int end = subBody.IndexOf(TemplatesManager.TemplateNewLine, alphaIdx); string alphaParams = subBody.Substring(alphaIdx, end - alphaIdx); m_alphaToMaskData.AlphaToMaskId = alphaParams; m_alphaToMaskData.StartIdx = offsetIdx + alphaIdx; idManager.RegisterId(m_alphaToMaskData.StartIdx, uniquePrefix + m_alphaToMaskData.AlphaToMaskId, m_alphaToMaskData.AlphaToMaskId); TemplateHelperFunctions.CreateAlphaToMask(alphaParams, ref m_alphaToMaskData); if (m_alphaToMaskData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, alphaParams, false, string.Empty); } } } //CULL MODE { Match cullMatch = Regex.Match(subBody, TemplateHelperFunctions.CullWholeWordPattern); if (cullMatch.Success) { int cullIdx = cullMatch.Index; int end = subBody.IndexOf(TemplatesManager.TemplateNewLine, cullIdx); string cullParams = subBody.Substring(cullIdx, end - cullIdx); m_cullModeData.CullModeId = cullParams; m_cullModeData.StartIdx = offsetIdx + cullIdx; idManager.RegisterId(m_cullModeData.StartIdx, uniquePrefix + m_cullModeData.CullModeId, m_cullModeData.CullModeId); TemplateHelperFunctions.CreateCullMode(cullParams, ref m_cullModeData); if (m_cullModeData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, cullParams, false, string.Empty); } } } //COLOR MASK { Match colorMaskMatch = Regex.Match(subBody, TemplateHelperFunctions.ColorMask1Pattern); if (colorMaskMatch.Success) { int colorMaskIdx = colorMaskMatch.Index; int end = colorMaskMatch.Length + colorMaskIdx; // subBody.IndexOf( TemplatesManager.TemplateNewLine, colorMaskIdx ); string colorMaskParams = subBody.Substring(colorMaskIdx, end - colorMaskIdx); m_colorMaskData1.ColorMaskId = colorMaskParams; m_colorMaskData1.StartIdx = offsetIdx + colorMaskIdx; idManager.RegisterId(m_colorMaskData1.StartIdx, uniquePrefix + m_colorMaskData1.ColorMaskId, m_colorMaskData1.ColorMaskId); TemplateHelperFunctions.CreateColorMask(colorMaskParams, ref m_colorMaskData1, TemplateHelperFunctions.ColorMask1Pattern); if (m_colorMaskData1.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, colorMaskParams, false); } } } { Match colorMaskMatch = Regex.Match(subBody, TemplateHelperFunctions.ColorMask2Pattern); if (colorMaskMatch.Success) { int colorMaskIdx = colorMaskMatch.Index; int end = colorMaskMatch.Length + colorMaskIdx; // subBody.IndexOf( TemplatesManager.TemplateNewLine, colorMaskIdx ); string colorMaskParams = subBody.Substring(colorMaskIdx, end - colorMaskIdx); m_colorMaskData2.ColorMaskId = colorMaskParams; m_colorMaskData2.StartIdx = offsetIdx + colorMaskIdx; idManager.RegisterId(m_colorMaskData2.StartIdx, uniquePrefix + m_colorMaskData2.ColorMaskId, m_colorMaskData2.ColorMaskId); TemplateHelperFunctions.CreateColorMask(colorMaskParams, ref m_colorMaskData2, TemplateHelperFunctions.ColorMask2Pattern); if (m_colorMaskData2.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, colorMaskParams, false); } } } { Match colorMaskMatch = Regex.Match(subBody, TemplateHelperFunctions.ColorMask3Pattern); if (colorMaskMatch.Success) { int colorMaskIdx = colorMaskMatch.Index; int end = colorMaskMatch.Length + colorMaskIdx; // subBody.IndexOf( TemplatesManager.TemplateNewLine, colorMaskIdx ); string colorMaskParams = subBody.Substring(colorMaskIdx, end - colorMaskIdx); m_colorMaskData3.ColorMaskId = colorMaskParams; m_colorMaskData3.StartIdx = offsetIdx + colorMaskIdx; idManager.RegisterId(m_colorMaskData3.StartIdx, uniquePrefix + m_colorMaskData3.ColorMaskId, m_colorMaskData3.ColorMaskId); TemplateHelperFunctions.CreateColorMask(colorMaskParams, ref m_colorMaskData3, TemplateHelperFunctions.ColorMask3Pattern); if (m_colorMaskData3.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, colorMaskParams, false); } } } { string pattern = TemplateHelperFunctions.ColorMaskPattern; Match colorMaskMatch = Regex.Match(subBody, pattern); if (!colorMaskMatch.Success && m_colorMaskData1.DataCheck == TemplateDataCheck.Invalid && m_colorMaskData2.DataCheck == TemplateDataCheck.Invalid && m_colorMaskData3.DataCheck == TemplateDataCheck.Invalid) { pattern = TemplateHelperFunctions.ColorMaskPatternFirst; colorMaskMatch = Regex.Match(subBody, pattern); } if (colorMaskMatch.Success) { int colorMaskIdx = colorMaskMatch.Index; int end = colorMaskMatch.Length + colorMaskIdx; //subBody.IndexOf( TemplatesManager.TemplateNewLine, colorMaskIdx ); string colorMaskParams = subBody.Substring(colorMaskIdx, end - colorMaskIdx); m_colorMaskData.ColorMaskId = colorMaskParams; m_colorMaskData.StartIdx = offsetIdx + colorMaskIdx; idManager.RegisterId(m_colorMaskData.StartIdx, uniquePrefix + m_colorMaskData.ColorMaskId, m_colorMaskData.ColorMaskId); TemplateHelperFunctions.CreateColorMask(colorMaskParams, ref m_colorMaskData, pattern); if (m_colorMaskData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, colorMaskParams, false); } } } //STENCIL { Match stencilMatch = Regex.Match(subBody, TemplateHelperFunctions.StencilWholeWordPattern); if (stencilMatch.Success) { int stencilIdx = stencilMatch.Index; int stencilEndIdx = subBody.IndexOf("}", stencilIdx); if (stencilEndIdx > 0) { string stencilParams = subBody.Substring(stencilIdx, stencilEndIdx + 1 - stencilIdx); m_stencilData.StencilBufferId = stencilParams; m_stencilData.StartIdx = offsetIdx + stencilIdx; idManager.RegisterId(m_stencilData.StartIdx, uniquePrefix + m_stencilData.StencilBufferId, m_stencilData.StencilBufferId); TemplateHelperFunctions.CreateStencilOps(stencilParams, ref m_stencilData); if (m_stencilData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, stencilParams, true); } } } else { int stencilTagIdx = subBody.IndexOf(TemplatesManager.TemplateStencilTag); if (stencilTagIdx > -1) { m_stencilData.SetIndependentDefault(); m_stencilData.StencilBufferId = TemplatesManager.TemplateStencilTag; m_stencilData.StartIdx = offsetIdx + stencilTagIdx; idManager.RegisterId(m_stencilData.StartIdx, uniquePrefix + m_stencilData.StencilBufferId, m_stencilData.StencilBufferId); propertyContainer.AddId(subBody, m_stencilData.StencilBufferId, true); } } } //ZWRITE { Match zWriteMatch = Regex.Match(subBody, TemplateHelperFunctions.ZWriteWholeWordPattern); if (zWriteMatch.Success) { int zWriteOpIdx = zWriteMatch.Index; int zWriteEndIdx = subBody.IndexOf(TemplatesManager.TemplateNewLine, zWriteOpIdx); if (zWriteEndIdx > 0) { m_depthData.ZWriteModeId = subBody.Substring(zWriteOpIdx, zWriteEndIdx + 1 - zWriteOpIdx); m_depthData.ZWriteStartIndex = offsetIdx + zWriteOpIdx; idManager.RegisterId(m_depthData.ZWriteStartIndex, uniquePrefix + m_depthData.ZWriteModeId, m_depthData.ZWriteModeId); TemplateHelperFunctions.CreateZWriteMode(m_depthData.ZWriteModeId, ref m_depthData); if (m_depthData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, m_depthData.ZWriteModeId, true); } } } } //ZTEST { Match zTestMatch = Regex.Match(subBody, TemplateHelperFunctions.ZTestWholeWordPattern); if (zTestMatch.Success) { int zTestOpIdx = zTestMatch.Index; int zTestEndIdx = subBody.IndexOf(TemplatesManager.TemplateNewLine, zTestOpIdx); if (zTestEndIdx > 0) { m_depthData.ZTestModeId = subBody.Substring(zTestOpIdx, zTestEndIdx + 1 - zTestOpIdx); m_depthData.ZTestStartIndex = offsetIdx + zTestOpIdx; idManager.RegisterId(m_depthData.ZTestStartIndex, uniquePrefix + m_depthData.ZTestModeId, m_depthData.ZTestModeId); TemplateHelperFunctions.CreateZTestMode(m_depthData.ZTestModeId, ref m_depthData); if (m_depthData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, m_depthData.ZTestModeId, true); } } } } //ZOFFSET { Match zOffsetMatch = Regex.Match(subBody, TemplateHelperFunctions.ZOffsetWholeWordPattern); if (zOffsetMatch.Success) { int zOffsetIdx = zOffsetMatch.Index; int zOffsetEndIdx = subBody.IndexOf(TemplatesManager.TemplateNewLine, zOffsetIdx); if (zOffsetEndIdx > 0) { m_depthData.OffsetId = subBody.Substring(zOffsetIdx, zOffsetEndIdx + 1 - zOffsetIdx); m_depthData.OffsetStartIndex = offsetIdx + zOffsetIdx; idManager.RegisterId(m_depthData.OffsetStartIndex, uniquePrefix + m_depthData.OffsetId, m_depthData.OffsetId); TemplateHelperFunctions.CreateZOffsetMode(m_depthData.OffsetId, ref m_depthData); if (m_depthData.DataCheck == TemplateDataCheck.Valid) { propertyContainer.AddId(subBody, m_depthData.OffsetId, true); } } } m_depthData.SetDataCheck(); } //TAGS { Match tagsMatch = Regex.Match(subBody, TemplateHelperFunctions.TagsWholeWordPattern); if (tagsMatch.Success) { int tagsIdx = tagsMatch.Index; int tagsEndIdx = subBody.IndexOf("}", tagsIdx); if (tagsEndIdx > -1) { m_tagData.Reset(); m_tagData.TagsId = subBody.Substring(tagsIdx, tagsEndIdx + 1 - tagsIdx); m_tagData.StartIdx = offsetIdx + tagsIdx; idManager.RegisterId(m_tagData.StartIdx, uniquePrefix + m_tagData.TagsId, m_tagData.TagsId); m_srpType = TemplateHelperFunctions.CreateTags(ref m_tagData, isSubShader); propertyContainer.AddId(subBody, m_tagData.TagsId, false); m_tagData.DataCheck = TemplateDataCheck.Valid; } else { m_tagData.DataCheck = TemplateDataCheck.Invalid; } } else { m_tagData.DataCheck = TemplateDataCheck.Invalid; } } //SHADER MODEL { Match match = Regex.Match(subBody, TemplateHelperFunctions.ShaderModelPattern); if (match != null && match.Groups.Count > 1) { if (TemplateHelperFunctions.AvailableInterpolators.ContainsKey(match.Groups[1].Value)) { m_shaderModel.Id = match.Groups[0].Value; m_shaderModel.StartIdx = offsetIdx + match.Index; m_shaderModel.Value = match.Groups[1].Value; m_shaderModel.InterpolatorAmount = TemplateHelperFunctions.AvailableInterpolators[match.Groups[1].Value]; m_shaderModel.DataCheck = TemplateDataCheck.Valid; idManager.RegisterId(m_shaderModel.StartIdx, uniquePrefix + m_shaderModel.Id, m_shaderModel.Id); } else { m_shaderModel.DataCheck = TemplateDataCheck.Invalid; } } } // ALL MODULES int allModulesIndex = subBody.IndexOf(TemplatesManager.TemplateAllModulesTag); if (allModulesIndex > 0) { //ONLY REGISTER MISSING TAGS ConfigureCommonTag(m_allModulesTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody); m_allModulesMode = true; m_blendData.SetAllModulesDefault(); if (!m_alphaToMaskData.IsValid) { m_alphaToMaskData.SetAllModulesDefault(); } if (!m_cullModeData.IsValid) { m_cullModeData.SetAllModulesDefault(); } if (!m_colorMaskData.IsValid) { m_colorMaskData.SetAllModulesDefault(); } if (!m_stencilData.IsValid) { m_stencilData.SetAllModulesDefault(); } if (!m_depthData.IsValid) { m_depthData.SetAllModulesDefault(); } if (!m_shaderModel.IsValid) { m_shaderModel.SetAllModulesDefault(); } } }