protected virtual bool InitFinish(ref ShaderEffectDesc desc)
        {
            if (desc.constantBuffers != null)
            {
                constantBufferCount = desc.constantBuffers.Length;
            }
            if (desc.textures != null)
            {
                textureCount = desc.textures.Length;
            }
            if (desc.samplers != null)
            {
                samplerCount = desc.samplers.Length;
            }
            if (desc.randomAccessBuffers != null)
            {
                randomAccessBufferCount = desc.randomAccessBuffers.Length;
            }

            // calculate constant buffer variable mappings
            if (desc.constantBuffers != null && desc.constantBuffers.Length != 0)
            {
                var constantBufferVariables = new ShaderVariable[desc.constantBuffers.Length][];
                for (int i = 0; i != desc.constantBuffers.Length; ++i)
                {
                    constantBufferVariables[i] = desc.constantBuffers[i].variables;
                }
                ShaderBase.CalculateContantBufferVariableMappings(constantBufferVariables, out var mappings);
                constantBufferMappings = mappings;
            }

            return(true);
        }
Example #2
0
 public abstract ShaderEffectBase CreateShaderEffect(ShaderBase vs, ShaderBase ps, ShaderBase hs, ShaderBase ds, ShaderBase gs, ShaderEffectDesc desc, bool disposeShaders);
 public bool FindVariable(string name, out ShaderVariableMapping variable)
 {
     return(ShaderBase.FindVariable(constantBufferMappings, name, out variable));
 }