示例#1
0
文件: Pipeline.cs 项目: acaly/LightDx
 public void SetConstant(ShaderType usage, int slot, AbstractConstantBuffer pipelineConstant)
 {
     if (usage.HasFlag(ShaderType.Vertex))
     {
         _vsConstants[slot] = pipelineConstant;
         if (_isBound)
         {
             ApplyVSConstantBuffer(slot, pipelineConstant);
         }
     }
     if (usage.HasFlag(ShaderType.Geometry))
     {
         _gsConstants[slot] = pipelineConstant;
         if (_isBound)
         {
             ApplyGSConstantBuffer(slot, pipelineConstant);
         }
     }
     if (usage.HasFlag(ShaderType.Pixel))
     {
         _psConstants[slot] = pipelineConstant;
         if (_isBound)
         {
             ApplyPSConstantBuffer(slot, pipelineConstant);
         }
     }
 }
示例#2
0
文件: Pipeline.cs 项目: acaly/LightDx
        private void ApplyPSConstantBuffer(int slot, AbstractConstantBuffer pipelineConstant)
        {
            var buffer = pipelineConstant?.BufferPtr ?? IntPtr.Zero;

            DeviceContext.PSSetConstantBuffers(_device.ContextPtr, (uint)slot, 1, ref buffer);
        }