void FetchTessellationData(TemplateMultiPass template, TemplateModulesData subShaderModule, int offsetIdx, string body) { // Tessellation VControl Tag try { int vcontrolcodeBegin = body.IndexOf(TemplatesManager.TemplateTessVControlTag); if (vcontrolcodeBegin > -1) { m_tessVControlTag = new TemplateTessVControlTag(); m_tessVControlTag.Id = TemplatesManager.TemplateTessVControlTag; m_tessVControlTag.StartIdx = offsetIdx + vcontrolcodeBegin; m_templateProperties.AddId(body, m_tessVControlTag.Id); } } catch (Exception e) { Debug.LogException(e); } // Tessellation Control Data try { int controlCodeBegin = body.IndexOf(TemplatesManager.TemplateTessControlCodeArea); if (controlCodeBegin > -1) { int beginIdx = controlCodeBegin + TemplatesManager.TemplateTessControlCodeArea.Length; int endIdx = body.IndexOf(TemplatesManager.TemplateEndOfLine, beginIdx); int length = endIdx - beginIdx; string parameters = body.Substring(beginIdx, length); string[] parametersArr = parameters.Split(IOUtils.FIELD_SEPARATOR); string id = body.Substring(controlCodeBegin, endIdx + TemplatesManager.TemplateEndOfLine.Length - controlCodeBegin); string inParameters = parametersArr[0]; string outParameters = (parametersArr.Length > 1) ? parametersArr[1] : string.Empty; m_tessControlData = new TemplateTessControlData(offsetIdx + controlCodeBegin, id, inParameters, outParameters); m_templateProperties.AddId(body, id); } } catch (Exception e) { Debug.LogException(e); } // Tessellation Domain Data try { int domainCodeBegin = body.IndexOf(TemplatesManager.TemplateTessDomainCodeArea); if (domainCodeBegin > -1) { int beginIdx = domainCodeBegin + TemplatesManager.TemplateTessDomainCodeArea.Length; int endIdx = body.IndexOf(TemplatesManager.TemplateEndOfLine, beginIdx); int length = endIdx - beginIdx; string parameters = body.Substring(beginIdx, length); string[] parametersArr = parameters.Split(IOUtils.FIELD_SEPARATOR); string id = body.Substring(domainCodeBegin, endIdx + TemplatesManager.TemplateEndOfLine.Length - domainCodeBegin); string inParameters = (parametersArr.Length > 0) ? parametersArr[0] : string.Empty; string outParameters = (parametersArr.Length > 1) ? parametersArr[1] : string.Empty; string baryParameters = (parametersArr.Length > 2) ? parametersArr[2] : string.Empty; m_tessDomainData = new TemplateTessDomainData(offsetIdx + domainCodeBegin, id, inParameters, outParameters, baryParameters); m_templateProperties.AddId(body, id); } } catch (Exception e) { Debug.LogException(e); } }
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; m_tessVControlTag = null; m_tessControlData = null; m_tessDomainData = 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; }