Example #1
0
        unsafe public static void UpdatePixelBuffer <T>(ID3D11DeviceContext context, ID3D11Buffer buffer, int slot, T data) where T : struct
        {
            MappedSubresource mappedResource = context.Map(buffer, MapMode.WriteDiscard, MapFlags.None);

            Unsafe.Write((void *)mappedResource.DataPointer, data);
            context.Unmap(buffer);
            context.PSSetConstantBuffer(slot, buffer);
        }