예제 #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
 public void SetResource(ShaderType usage, int slot, AbstractShaderResourceBuffer buffer)
 {
     if (usage.HasFlag(ShaderType.Vertex))
     {
         _vsBuffers[slot] = buffer;
         if (_isBound)
         {
             var view = buffer?.ViewPtr ?? IntPtr.Zero;
             DeviceContext.VSSetShaderResources(_device.ContextPtr, (uint)slot, 1, ref view);
         }
     }
     if (usage.HasFlag(ShaderType.Geometry))
     {
         _gsBuffers[slot] = buffer;
         if (_isBound)
         {
             var view = buffer?.ViewPtr ?? IntPtr.Zero;
             DeviceContext.GSSetShaderResources(_device.ContextPtr, (uint)slot, 1, ref view);
         }
     }
     if (usage.HasFlag(ShaderType.Pixel))
     {
         _resources.Remove(slot);
         _psBuffers[slot] = buffer;
         if (_isBound)
         {
             var view = buffer?.ViewPtr ?? IntPtr.Zero;
             DeviceContext.PSSetShaderResources(_device.ContextPtr, (uint)slot, 1, ref view);
         }
     }
 }