コード例 #1
0
 // default values (for 'null') is only for triggering generations for mesh material shader types! , don't use default constructor!
 public H1BasePassPixelShader(byte[] compiledByteCode = null, H1ShaderParameterMap shaderParameterMap = null, Boolean isCreateShaderType = false)
     : base(H1Global <H1ManagedRenderer> .Instance.ShaderManager.CacheShaderType(
                new H1MeshMaterialShaderType("H1BasePassPixelShader", "SGDBasePassPS.hlsl", "Main", new H1ShaderTarget() { Freqency = H1ShaderFrequency.PixelShader, Platform = H1ShaderPlatform.SM5_1 }, ModifyCompilationEnvironment, ShouldCache)),
            compiledByteCode,
            shaderParameterMap,
            isCreateShaderType)
 {
 }
コード例 #2
0
        public H1Shader(H1ShaderType type, byte[] compiledByteCode, H1ShaderParameterMap shaderParameterMap, Boolean isCreateShaderType = false)
        {
            if (isCreateShaderType)
            {
                return; // triggered by just shader type creation, skip it
            }
            // assign new H1ShaderId
            m_Id = new H1ShaderId();

            m_CompiledByteCode = compiledByteCode;
            m_ShaderTypeRef    = type;
            m_ParameterMap     = shaderParameterMap;

            Direct3D12.H1ResourceRanges resourceRanges = new Direct3D12.H1ResourceRanges();
            foreach (KeyValuePair <String, H1ParameterAllocation> parameter in shaderParameterMap.ParameterMap)
            {
                String parameterName             = parameter.Key;
                H1ParameterAllocation allocation = parameter.Value;

                // 1. constant buffer
                if (allocation.Type == H1ParameterType.ConstantBuffer)
                {
                    // insert the new range to the constant buffers
                    Direct3D12.H1BindRanges.H1Range range = new Direct3D12.H1BindRanges.H1Range();
                    range.Start  = Convert.ToByte(allocation.BufferIndex);
                    range.Length = Convert.ToByte(1);
                    resourceRanges.ConstantBuffers.AddRange(range);
                    continue;
                }

                // handling textures, samplers,...
            }

            // 2. create new shader instance
            m_DX12Shader = new Direct3D12.H1Shader(compiledByteCode, resourceRanges);
        }
コード例 #3
0
 public H1MeshMaterialShader(H1ShaderType type, byte[] compiledByteCode, H1ShaderParameterMap shaderParameterMap, Boolean isCreateShaderType = false)
     : base(type, compiledByteCode, shaderParameterMap, isCreateShaderType)
 {
 }
コード例 #4
0
 public H1GlobalShader(H1ShaderType type, byte[] compiledByteCode, H1ShaderParameterMap shaderParameterMap)
     : base(type, compiledByteCode, shaderParameterMap)
 {
 }