コード例 #1
0
        // copy constructor
        public H1ResourceRanges(H1ResourceRanges ranges)
        {
            // constant buffers
            H1BindRanges bindRanges = ranges.ConstantBuffers;

            for (Int32 i = 0; i < bindRanges.Num; ++i)
            {
                m_ConstantBuffers.AddRange(bindRanges[i]);
            }

            // input resources
            bindRanges = ranges.InputResources;
            for (Int32 i = 0; i < bindRanges.Num; ++i)
            {
                m_InputResources.AddRange(bindRanges[i]);
            }

            // output resources
            bindRanges = ranges.OutputResources;
            for (Int32 i = 0; i < bindRanges.Num; ++i)
            {
                m_OutputResources.AddRange(bindRanges[i]);
            }

            // samplers
            bindRanges = ranges.Samplers;
            for (Int32 i = 0; i < bindRanges.Num; ++i)
            {
                m_Samplers.AddRange(bindRanges[i]);
            }
        }
コード例 #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 H1Shader(Byte[] shaderByteCode, H1ResourceRanges ranges)
 {
     m_Bytecode = new ShaderBytecode(shaderByteCode);
     m_Ranges   = new H1ResourceRanges(ranges);
 }