public void Apply(CommonShaderStage stage)
 {
     standardSamplers.Apply(stage);
     stage.SetConstantBuffer(ShaderSlots.EnvironmentParameters, constantBufferManager.Buffer);
     stage.SetShaderResource(ShaderSlots.DiffuseEnvironmentCube, diffuseEnvironmentCube);
     stage.SetShaderResource(ShaderSlots.GlossyEnvironmentCube, glossyEnvironmentCube);
 }
Beispiel #2
0
 private void SetConstantBuffer(CommonShaderStage stage, ShaderStageCache cache, int slot, Buffer buffer)
 {
     if (cache.Buffers[slot] != buffer)
     {
         stage.SetConstantBuffer(slot, buffer);
         cache.Buffers[slot] = buffer;
     }
 }
Beispiel #3
0
 /// <summary>
 /// Sets and gets sampler state to given shader stage.
 /// </summary>
 /// <param name="index"></param>
 /// <returns></returns>
 public ConstantBuffer this[int index] {
     set {
         buffers[index] = value;
         stage.SetConstantBuffer(index, (value == null) ? null : value.buffer);
     }
     get {
         return(buffers[index]);
     }
 }
Beispiel #4
0
        protected void Update()
        {
            DataStream dataStream;

            _deviceContext.MapSubresource(_buffer, MapMode.WriteDiscard, MapFlags.None,
                                          out dataStream);
            dataStream.Write(_data);
            _deviceContext.UnmapSubresource(_buffer, _subresource);
            _commonShaderStage.SetConstantBuffer(_slot, _buffer);
        }
 internal void SetConstantBuffer(int slot, Buffer constantBuffer)
 {
     if (constantBuffer == m_constantBuffers[slot])
     {
         return;
     }
     m_constantBuffers[slot] = constantBuffer;
     m_shaderStage.SetConstantBuffer(slot, constantBuffer);
     m_statistics.SetConstantBuffers++;
 }
Beispiel #6
0
        internal void SetConstantBuffer(int slot, IConstantBuffer constantBuffer)
        {
            Buffer buffer = null;

            if (constantBuffer != null)
            {
                buffer = constantBuffer.Buffer;
            }

            if (constantBuffer == m_constantBuffers[slot])
            {
                return;
            }
            m_constantBuffers[slot] = constantBuffer;
            m_shaderStage.SetConstantBuffer(slot, buffer);
            m_statistics.SetConstantBuffers++;
        }
Beispiel #7
0
        public static void SetConstantBufferToNextSlot(this CommonShaderStage shader, SharpDX.Direct3D11.Buffer constantBuffer, ConstantBufferSlotsCache cache)
        {
            var slot = cache.GetNext();

            shader.SetConstantBuffer(slot, constantBuffer);
        }
Beispiel #8
0
 public static void SetConstantBuffer(this CommonShaderStage shader, int slot, SharpDX.Direct3D11.Buffer constantBuffer, ConstantBufferSlotsCache cache)
 {
     cache.SetOccupied(slot);
     shader.SetConstantBuffer(slot, constantBuffer);
 }
Beispiel #9
0
 public void RegisterConstantBuffer(CommonShaderStage stage, int slot, SharpDX.Direct3D11.Buffer buff)
 {
     stage.SetConstantBuffer(slot, buff);
     resourseHash.RegisterResourseSlot(stage.GetHashCode(), slot);
 }