Ejemplo n.º 1
0
 public DX11IndexBuffer(DX11RenderContext context, IntPtr ptr, int indicescount)
 {
     this.context      = context;
     format            = SlimDX.DXGI.Format.R32_UInt;
     this.Buffer       = SlimDX.Direct3D11.Buffer.FromPointer(ptr);
     this.IndicesCount = indicescount;
 }
Ejemplo n.º 2
0
        public DX11IndexBuffer(DX11RenderContext context, DataStream initial, bool dynamic, bool dispose)
        {
            this.context = context;
            format       = SlimDX.DXGI.Format.R32_UInt;

            BindFlags flags = BindFlags.IndexBuffer;

            if (context.ComputeShaderSupport)
            {
                flags |= BindFlags.ShaderResource;
            }

            BufferDescription bd = new BufferDescription()
            {
                BindFlags      = flags,
                CpuAccessFlags = dynamic ? CpuAccessFlags.Write : CpuAccessFlags.None,
                OptionFlags    = context.IsFeatureLevel11 ? ResourceOptionFlags.RawBuffer : ResourceOptionFlags.None,
                SizeInBytes    = (int)initial.Length,
                Usage          = dynamic ? ResourceUsage.Dynamic : ResourceUsage.Default,
            };

            initial.Position  = 0;
            this.IndicesCount = (int)initial.Length / 4;
            this.Buffer       = new SlimDX.Direct3D11.Buffer(context.Device, initial, bd);

            this.CreateSRV();

            if (dispose)
            {
                initial.Dispose();
            }
        }
Ejemplo n.º 3
0
        public void Apply(DX11Texture2D texture, int w, int h, int d, SlimDX.DXGI.Format format, int slice)
        {
            format = format == SlimDX.DXGI.Format.Unknown ? texture.Format : format;

            if (this.rtarr != null)
            {
                if (this.rtarr.ElemCnt != d || this.rtarr.Width != w || this.rtarr.Height != h ||
                    this.rtarr.Format != format)
                {
                    this.rtarr.Dispose(); this.rtarr = null;
                }
            }

            if (this.rtarr == null)
            {
                this.rtarr = new DX11RenderTextureArray(this.context, w, h, d, format, true, 1);
            }

            this.shader.SelectTechnique("Render");
            this.quad.Bind(this.layout);

            int idx = VMath.Zmod(slice, d);

            //Push specific slice as render target
            this.context.RenderTargetStack.Push(this.rtarr.SliceRTV[idx]);

            //Call simple shader (could use full screen triangle instead)
            this.shader.SetBySemantic("TEXTURE", texture.SRV);
            this.shader.ApplyPass(0);
            this.quad.Draw();
            this.context.RenderTargetStack.Pop();
        }
Ejemplo n.º 4
0
        public Texture3DAndViews(Device device, SlimDX.DXGI.Format format, ItemCount <Pixel> width, ItemCount <Pixel> height, ItemCount <Pixel> depth, DataBox[] data = null)
        {
            Width  = width;
            Height = height;
            Depth  = depth;

            var texDesc = new Texture3DDescription()
            {
                BindFlags      = BindFlags.ShaderResource | BindFlags.UnorderedAccess,
                CpuAccessFlags = CpuAccessFlags.None,
                Depth          = depth.Count,
                Format         = format,
                Height         = height.Count,
                Width          = width.Count,
                MipLevels      = 1,
                OptionFlags    = ResourceOptionFlags.None,
                Usage          = ResourceUsage.Default
            };

            if (data != null)
            {
                _data = new Texture3D(device, texDesc, data);
            }
            else
            {
                _data = new Texture3D(device, texDesc);
            }

            SRV = new ShaderResourceView(device, _data);
            UAV = new UnorderedAccessView(device, _data);
        }
Ejemplo n.º 5
0
        public DX11IndexBuffer(DX11RenderContext context, DataStream initial,bool dynamic, bool dispose)
        {
            this.context = context;
            format = SlimDX.DXGI.Format.R32_UInt;

            BindFlags flags = BindFlags.IndexBuffer;

            if (context.IsFeatureLevel11) { flags |= BindFlags.ShaderResource; }

            BufferDescription bd = new BufferDescription()
            {
                BindFlags = flags,
                CpuAccessFlags = dynamic ? CpuAccessFlags.Write : CpuAccessFlags.None,
                OptionFlags = context.IsFeatureLevel11 ? ResourceOptionFlags.RawBuffer : ResourceOptionFlags.None,
                SizeInBytes = (int)initial.Length,
                Usage = dynamic ? ResourceUsage.Dynamic : ResourceUsage.Default,
            };

            initial.Position = 0;
            this.IndicesCount = (int)initial.Length / 4;
            this.Buffer = new SlimDX.Direct3D11.Buffer(context.Device, initial, bd);

            this.CreateSRV();

            if (dispose) { initial.Dispose(); }
        }
Ejemplo n.º 6
0
 public DX11IndexBuffer(DX11RenderContext context, IntPtr ptr, int indicescount)
 {
     this.context = context;
     format = SlimDX.DXGI.Format.R32_UInt;
     this.Buffer = SlimDX.Direct3D11.Buffer.FromPointer(ptr);
     this.IndicesCount = indicescount;
 }
Ejemplo n.º 7
0
        private void InitBuffers()
        {
            this.format = SlimDX.DXGI.Format.R8G8B8A8_UNorm;
            this.width  = 1920;
            this.height = 1080;

            this.depthread  = Marshal.AllocHGlobal(1920 * 1080 * 4);
            this.depthwrite = Marshal.AllocHGlobal(1920 * 1080 * 4);
        }
Ejemplo n.º 8
0
        private void InitBuffers()
        {
            this.format = SlimDX.DXGI.Format.R16_UInt;
            this.width  = 512;
            this.height = 424;

            this.depthread  = Marshal.AllocHGlobal(512 * 424 * 2);
            this.depthwrite = Marshal.AllocHGlobal(512 * 424 * 2);
        }
Ejemplo n.º 9
0
        private void InitBuffers()
        {
            this.format = SlimDX.DXGI.Format.R32G32_Float;
            this.width  = 512;
            this.height = 424;

            this.depthread  = new ushort[512 * 424];
            this.depthwrite = new ushort[512 * 424];
            this.points     = new ColorSpacePoint[512 * 424];
        }
Ejemplo n.º 10
0
        public static SlimDX.DXGI.Format DefaultOutputForCompressed(this SlimDX.DXGI.Format fmt)
        {
            string s = fmt.ToString();

            if (s.StartsWith("BC"))
            {
                return(SlimDX.DXGI.Format.R8G8B8A8_UNorm);
            }
            return(fmt);
        }
Ejemplo n.º 11
0
        private void InitBuffers()
        {
            this.format = SlimDX.DXGI.Format.R16_UInt;
            this.width  = 512;
            this.height = 424;

            this.colorread   = new Vector4[512 * 424];
            this.colorwrite  = new Vector4[512 * 424];
            this.camerawrite = new CameraSpacePoint[512 * 424];
            this.depthwrite  = new ushort[512 * 424];
        }
        public unsafe void Update(DX11RenderContext context)
        {
            if (this.FInvalidate || !this.FTextureOutput[0].Contains(context))
            {
                SlimDX.DXGI.Format fmt = SlimDX.DXGI.Format.R32G32B32A32_Float;

                Texture2DDescription desc;

                if (this.FTextureOutput[0].Contains(context))
                {
                    desc = this.FTextureOutput[0][context].Resource.Description;

                    if (desc.Width != this.FInWidth[0] || desc.Height != this.FInHeight[0] || desc.Format != fmt)
                    {
                        this.FTextureOutput[0].Dispose(context);
                        this.FTextureOutput[0][context] = new DX11DynamicTexture2D(context, this.FInWidth[0], this.FInHeight[0], fmt);
                    }
                }
                else
                {
                    this.FTextureOutput[0][context] = new DX11DynamicTexture2D(context, this.FInWidth[0], this.FInHeight[0], fmt);
                }

                desc = this.FTextureOutput[0][context].Resource.Description;

                if (data.Length != desc.Width * desc.Height)
                {
                    data = new Color4[desc.Width * desc.Height];
                }

                for (int i = 0; i < data.Length; i++)
                {
                    data[i] = this.FInData[i];
                }

                var t = this.FTextureOutput[0][context];
                fixed(Color4 *cp = &data[0])
                {
                    IntPtr ptr = new IntPtr(cp);

                    if (t.GetRowPitch() == desc.Width * 16)
                    {
                        t.WriteData(ptr, desc.Width * desc.Height * 16);
                    }
                    else
                    {
                        t.WriteDataPitch(ptr, desc.Width * desc.Height * 16, 16);
                    }
                }

                this.FInvalidate = false;
            }
        }
Ejemplo n.º 13
0
        public static SlimDX.DXGI.Format GetSingleChannelEquivalent(this SlimDX.DXGI.Format fmt)
        {
            string s = fmt.ToString();

            //Default a few compressed
            if (fmt == SlimDX.DXGI.Format.BC1_UNorm || fmt == SlimDX.DXGI.Format.BC3_UNorm || fmt == SlimDX.DXGI.Format.BC7_UNorm)
            {
                return(SlimDX.DXGI.Format.R8_UNorm);
            }

            if (s.StartsWith("R32"))
            {
                if (fmt.IsSignedInt())
                {
                    return(SlimDX.DXGI.Format.R32_SInt);
                }
                if (fmt.IsUnsignedInt())
                {
                    return(SlimDX.DXGI.Format.R32_UInt);
                }

                return(SlimDX.DXGI.Format.R32_Float);
            }
            else if (s.StartsWith("R16"))
            {
                if (fmt.IsSignedInt())
                {
                    return(SlimDX.DXGI.Format.R16_SInt);
                }
                if (fmt.IsUnsignedInt())
                {
                    return(SlimDX.DXGI.Format.R16_UInt);
                }

                return(SlimDX.DXGI.Format.R16_Float);
            }
            else if (s.StartsWith("R8"))
            {
                if (fmt.IsSignedInt())
                {
                    return(SlimDX.DXGI.Format.R8_SInt);
                }
                if (fmt.IsUnsignedInt())
                {
                    return(SlimDX.DXGI.Format.R8_UInt);
                }

                return(SlimDX.DXGI.Format.R8_UNorm);
            }

            return(SlimDX.DXGI.Format.Unknown);
        }
Ejemplo n.º 14
0
        public unsafe void Update(DX11RenderContext context)
        {
            FLogger.Log(LogType.Debug, "1");
            if (!this.invalidate)
            {
                return;
            }
            FLogger.Log(LogType.Debug, "2");


            FLogger.Log(LogType.Debug, "3");

            if (this.marginalTexture[0].Contains(context))
            {
                FLogger.Log(LogType.Debug, "dispose");
                this.marginalTexture[0].Dispose(context);
            }

            var data = this.hdrDataIn[0];

            if (this.hdrDataIn.IsConnected && data != null)
            {
                FLogger.Log(LogType.Debug, "yep");
                SlimDX.DXGI.Format fmt = SlimDX.DXGI.Format.R32G32B32A32_Float;
                int pixelSize          = 16;

                int stride = 128;
                FLogger.Log(LogType.Debug, "4");
                FLogger.Log(LogType.Debug, data.Length.ToString());
                byteSpread.SliceCount = stride * pixelSize * this.inHeight[0];
                FLogger.Log(LogType.Debug, "5");

                data.Read(byteSpread.Stream.Buffer, 0, stride * this.inHeight[0]);
                FLogger.Log(LogType.Debug, "6");
                data.Position = 0;

                using (SlimDX.DataStream dataStream = new DataStream(byteSpread.Stream.Buffer,
                                                                     true, true))
                {
                    DX11Texture2D texture = DX11Texture2D.CreateImmutable(context,
                                                                          this.inWidth[0], this.inHeight[0], fmt, stride, dataStream);

                    this.marginalTexture[0][context] = texture;
                }
            }

            this.invalidate = false;
        }
Ejemplo n.º 15
0
        public DX11IndexBuffer(DX11RenderContext context, int elementcount, bool uav = false, bool streamout = false)
        {
            this.context = context;
            this.IndicesCount = elementcount;
            format =SlimDX.DXGI.Format.R32_UInt;


            BufferDescription bd = new BufferDescription()
            {
                BindFlags = BindFlags.IndexBuffer,
                CpuAccessFlags = CpuAccessFlags.None,
                OptionFlags =ResourceOptionFlags.None,
                SizeInBytes = elementcount * sizeof(int),
                Usage = ResourceUsage.Default,
            };

            if (streamout)
            {

                bd.BindFlags |= BindFlags.StreamOutput;
            }

            if (uav && context.IsFeatureLevel11)
            {
                bd.BindFlags |= BindFlags.UnorderedAccess;
                bd.BindFlags |= BindFlags.ShaderResource;
                bd.OptionFlags |= ResourceOptionFlags.RawBuffer;
            }

            this.Buffer = new SlimDX.Direct3D11.Buffer(context.Device, bd);

            if (uav)
            {
                UnorderedAccessViewDescription uavd = new UnorderedAccessViewDescription()
                {
                    Format = SlimDX.DXGI.Format.R32_Typeless,
                    Dimension = UnorderedAccessViewDimension.Buffer,
                    Flags = UnorderedAccessViewBufferFlags.RawData,
                    ElementCount = elementcount
                };

                this.uav = new UnorderedAccessView(context.Device, this.Buffer, uavd);
                this.CreateSRV();
            }

            
        }
Ejemplo n.º 16
0
        public DX11IndexBuffer(DX11RenderContext context, int elementcount, bool uav = false, bool streamout = false)
        {
            this.context      = context;
            this.IndicesCount = elementcount;
            format            = SlimDX.DXGI.Format.R32_UInt;


            BufferDescription bd = new BufferDescription()
            {
                BindFlags      = BindFlags.IndexBuffer,
                CpuAccessFlags = CpuAccessFlags.None,
                OptionFlags    = ResourceOptionFlags.None,
                SizeInBytes    = elementcount * sizeof(int),
                Usage          = ResourceUsage.Default,
            };

            if (streamout)
            {
                bd.BindFlags |= BindFlags.StreamOutput;
            }

            if (uav && context.IsFeatureLevel11)
            {
                bd.BindFlags   |= BindFlags.UnorderedAccess;
                bd.BindFlags   |= BindFlags.ShaderResource;
                bd.OptionFlags |= ResourceOptionFlags.RawBuffer;
            }

            this.Buffer = new SlimDX.Direct3D11.Buffer(context.Device, bd);

            if (uav)
            {
                UnorderedAccessViewDescription uavd = new UnorderedAccessViewDescription()
                {
                    Format       = SlimDX.DXGI.Format.R32_Typeless,
                    Dimension    = UnorderedAccessViewDimension.Buffer,
                    Flags        = UnorderedAccessViewBufferFlags.RawData,
                    ElementCount = elementcount
                };

                this.uav = new UnorderedAccessView(context.Device, this.Buffer, uavd);
                this.CreateSRV();
            }
        }
Ejemplo n.º 17
0
        public void Update(DX11RenderContext context)
        {
            if (!this.FInEnabled[0] || !this.initialized || this.image == null)
            {
                return;
            }

            if (this.FTextureOutput[0] == null)
            {
                return;
            }

            SlimDX.DXGI.Format fmt = SlimDX.DXGI.Format.B8G8R8A8_UNorm;

            if (!this.FTextureOutput[0].Contains(context))
            {
                this.FTextureOutput[0][context] = new DX11DynamicTexture2D(context, this.width, this.height, fmt);
            }

            if (this.invalidate)
            {
                lock (this.lockObj)
                {
                    var buffer = this.GetImageBuffer();

                    Texture2DDescription desc = this.FTextureOutput[0][context].Resource.Description;

                    if (this.isResized || desc.Width != this.width || desc.Height != this.height || desc.Format != fmt) // resized
                    {
                        this.FTextureOutput[0].Dispose(context);
                        this.FTextureOutput[0][context] = new DX11DynamicTexture2D(context, this.width, this.height, fmt);
                    }

                    if (buffer != null)
                    {
                        var t = this.FTextureOutput[0][context];
                        t.WriteData(buffer);
                        this.invalidate = false;
                    }
                }
            }
        }
        public unsafe void Update(DX11RenderContext context)
        {
            if (this.FInvalidate || !this.FTextureOutput[0].Contains(context))
            {
                SlimDX.DXGI.Format fmt = SlimDX.DXGI.Format.R32G32B32A32_Float;

                Texture1DDescription desc;

                if (this.FTextureOutput[0].Contains(context))
                {
                    desc = this.FTextureOutput[0][context].Resource.Description;

                    if (desc.Width != this.FInWidth[0] || desc.Format != fmt)
                    {
                        this.FTextureOutput[0].Dispose(context);
                        this.FTextureOutput[0][context] = new DX11DynamicTexture1D(context, this.FInWidth[0], fmt);
                    }
                }
                else
                {
                    this.FTextureOutput[0][context] = new DX11DynamicTexture1D(context, this.FInWidth[0], fmt);
                }

                desc = this.FTextureOutput[0][context].Resource.Description;

                if (data.Length != desc.Width)
                {
                    data = new Color4[desc.Width];
                }

                for (int i = 0; i < data.Length; i++)
                {
                    data[i] = this.FInData[i];
                }

                var t = this.FTextureOutput[0][context];
                t.WriteData(data);
                this.FInvalidate = false;
            }
        }
Ejemplo n.º 19
0
        public Texture2DAndViews(Device device, SlimDX.DXGI.Format format, ItemCount <Pixel> width, ItemCount <Pixel> height, DataRectangle data = null)
        {
            _device = device;
            _format = format;
            Width   = width;
            Height  = height;

            var texDesc = new Texture2DDescription()
            {
                ArraySize         = 1,
                BindFlags         = BindFlags.ShaderResource | BindFlags.UnorderedAccess,
                CpuAccessFlags    = CpuAccessFlags.None,
                Format            = format,
                Height            = height.Count,
                Width             = width.Count,
                MipLevels         = 1,
                OptionFlags       = ResourceOptionFlags.None,
                SampleDescription = new SlimDX.DXGI.SampleDescription()
                {
                    Count   = 1,
                    Quality = 0
                },
                Usage = ResourceUsage.Default
            };

            if (data != null)
            {
                _data = new Texture2D(device, texDesc, data);
            }
            else
            {
                _data = new Texture2D(device, texDesc);
            }

            SRV = new ShaderResourceView(device, _data);
            UAV = new UnorderedAccessView(device, _data);
        }
Ejemplo n.º 20
0
        public void Update(IPluginIO pin, DX11RenderContext context)
        {
            if (this.FInvalidate || !this.FTextureOutput[0].Contains(context))
            {
                SlimDX.DXGI.Format fmt = SlimDX.DXGI.Format.R32G32B32A32_Float;

                Texture2DDescription desc;

                if (this.FTextureOutput[0].Contains(context))
                {
                    desc = this.FTextureOutput[0][context].Resource.Description;

                    if (desc.Width != this.FInWidth[0] || desc.Height != this.FInHeight[0] || desc.Format != fmt)
                    {
                        this.FTextureOutput[0].Dispose(context);
                        this.FTextureOutput[0][context] = new DX11DynamicTexture2D(context, this.FInWidth[0], this.FInHeight[0], fmt);
                    }
                }
                else
                {
                    this.FTextureOutput[0][context] = new DX11DynamicTexture2D(context, this.FInWidth[0], this.FInHeight[0], fmt);
                }

                desc = this.FTextureOutput[0][context].Resource.Description;

                Color4[] data = new Color4[desc.Width * desc.Height];

                for (int i = 0; i < data.Length; i++)
                {
                    data[i] = this.FInData[i % data.Length];
                }

                this.FTextureOutput[0][context].WriteData <Color4>(data);
                this.FInvalidate = false;
            }
        }
Ejemplo n.º 21
0
        private void InitBuffers()
        {
            this.format = SlimDX.DXGI.Format.R16_UInt;
            this.width = 512;
            this.height = 424;

            this.colorread = new Vector4[512 * 424];
            this.colorwrite = new Vector4[512 * 424];
            this.camerawrite = new CameraSpacePoint[512 * 424];
            this.depthwrite = new ushort[512 * 424];
        }
        public void Init()
        {
            // Determine element and buffer size
            elementsize = Vector3.SizeInBytes;
            if (mesh.Normals != null) elementsize += Vector3.SizeInBytes;
            if (mesh.TextureCoordinates != null) elementsize += Vector2.SizeInBytes;
            if (mesh.Tangents != null) elementsize += Vector3.SizeInBytes;
            buffersize = elementsize * mesh.Positions.Length;

            // Determine input elements
            var inputelementslist = new List<InputElement>();
            int curoffset = 0;
            inputelementslist.Add(new InputElement("POSITION", 0, SlimDX.DXGI.Format.R32G32B32_Float, curoffset, 0));
            curoffset += Vector3.SizeInBytes;
            if (mesh.Normals != null)
            {
                inputelementslist.Add(new InputElement("NORMAL", 0, SlimDX.DXGI.Format.R32G32B32_Float, curoffset, 0));
                curoffset += Vector3.SizeInBytes;
            }
            if (mesh.TextureCoordinates != null)
            {
                inputelementslist.Add(new InputElement("TEXCOORD", 0, SlimDX.DXGI.Format.R32G32_Float, curoffset, 0));
                curoffset += Vector2.SizeInBytes;
            }
            if (mesh.Tangents != null)
            {
                inputelementslist.Add(new InputElement("TANGENT", 0, SlimDX.DXGI.Format.R32G32B32_Float, curoffset, 0));
                curoffset += Vector3.SizeInBytes;
            }
            inputelements = inputelementslist.ToArray();

            // Write the stream
            var strm = new DataStream(buffersize, true, true);
            for (int i = 0; i < mesh.Positions.Length; i++)
            {
                strm.Write(mesh.Positions[i]);
                if (mesh.Normals != null) strm.Write(mesh.Normals[i]);
                if (mesh.TextureCoordinates != null) strm.Write(mesh.TextureCoordinates[i]);
                if (mesh.Tangents != null) strm.Write(mesh.Tangents[i]);
            }
            strm.Position = 0;

            // Build the buffer
            vtxBuffer = new Buffer(device, strm, new BufferDescription((int)strm.Length, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0));
            bufferbinding = new VertexBufferBinding(vtxBuffer, elementsize, 0);

            // Build the indices buffer(s)
            indexformat = SlimDX.DXGI.Format.R32_UInt;
            submeshes = new Buffer[mesh.Submeshes.Length];
            for (int i = 0; i < submeshes.Length; i++ )
                submeshes[i] = ArrayToBuffer(mesh.Submeshes[i], ResourceUsage.Default);

            // Build the shader map
            shadermap = new Dictionary<Shader, InputLayout>();

            // Update iteration
            Iteration = mesh.Iteration;
        }
Ejemplo n.º 23
0
        public static UnorderedAccessView CreateUnorderedAccessView(Device device, int width, int height, SlimDX.DXGI.Format format, out Texture2D texture)
        {
            var desc = new UnorderedAccessViewDescription()
            {
                Dimension    = UnorderedAccessViewDimension.Texture2D,
                ArraySize    = 1,
                ElementCount = width * height,
                Format       = format
            };

            texture = new Texture2D(device, new Texture2DDescription()
            {
                ArraySize         = 1,
                MipLevels         = 1,
                OptionFlags       = ResourceOptionFlags.None,
                SampleDescription = new SlimDX.DXGI.SampleDescription(1, 0),
                Usage             = ResourceUsage.Default,
                CpuAccessFlags    = CpuAccessFlags.None,
                BindFlags         = BindFlags.ShaderResource | BindFlags.UnorderedAccess,
                Width             = width,
                Height            = height,
                Format            = format
            });

            return(new UnorderedAccessView(device, texture));
        }
Ejemplo n.º 24
0
        private void InitBuffers()
        {
            this.format = SlimDX.DXGI.Format.R16_UInt;
            this.width = 512;
            this.height = 424;

            this.depthread = Marshal.AllocHGlobal(512 * 424 * 2);
            this.depthwrite = Marshal.AllocHGlobal(512 * 424 * 2);
        }
Ejemplo n.º 25
0
 public static SharpDX.DXGI.Format ToSharpDX(this SlimDX.DXGI.Format slimfmt)
 {
     return((SharpDX.DXGI.Format)slimfmt);
 }
Ejemplo n.º 26
0
        private void InitBuffers()
        {
            this.format = SlimDX.DXGI.Format.R8G8B8A8_UNorm;
            this.width = 1920;
            this.height = 1080;

            this.depthread = Marshal.AllocHGlobal(1920*1080*4);
            this.depthwrite = Marshal.AllocHGlobal(1920 * 1080 * 4);
        }
Ejemplo n.º 27
0
        private void InitBuffers()
        {
            this.format = SlimDX.DXGI.Format.R32G32_Float;
            this.width = 512;
            this.height = 424;

            this.depthread = new ushort[512 * 424];
            this.depthwrite = new ushort[512 * 424];
            this.points = new ColorSpacePoint[512 * 424];
        }
Ejemplo n.º 28
0
        public static int getByteCountOf(SlimDX.DXGI.Format format)
        {
            switch (format)
            {
            case SlimDX.DXGI.Format.A8_UNorm:
                return(1);

            case SlimDX.DXGI.Format.B5G5R5A1_UNorm:
            case SlimDX.DXGI.Format.B5G6R5_UNorm:
                return(2);


            case SlimDX.DXGI.Format.B8G8R8A8_Typeless:
            case SlimDX.DXGI.Format.B8G8R8A8_UNorm:
            case SlimDX.DXGI.Format.B8G8R8A8_UNorm_SRGB:
            case SlimDX.DXGI.Format.B8G8R8X8_Typeless:
            case SlimDX.DXGI.Format.B8G8R8X8_UNorm:
            case SlimDX.DXGI.Format.B8G8R8X8_UNorm_SRGB:
                return(4);


            case SlimDX.DXGI.Format.BC1_Typeless:
                break;

            case SlimDX.DXGI.Format.BC1_UNorm:
                break;

            case SlimDX.DXGI.Format.BC1_UNorm_SRGB:
                break;

            case SlimDX.DXGI.Format.BC2_Typeless:
                break;

            case SlimDX.DXGI.Format.BC2_UNorm:
                break;

            case SlimDX.DXGI.Format.BC2_UNorm_SRGB:
                break;

            case SlimDX.DXGI.Format.BC3_Typeless:
                break;

            case SlimDX.DXGI.Format.BC3_UNorm:
                break;

            case SlimDX.DXGI.Format.BC3_UNorm_SRGB:
                break;

            case SlimDX.DXGI.Format.BC4_SNorm:
                break;

            case SlimDX.DXGI.Format.BC4_Typeless:
                break;

            case SlimDX.DXGI.Format.BC4_UNorm:
                break;

            case SlimDX.DXGI.Format.BC5_SNorm:
                break;

            case SlimDX.DXGI.Format.BC5_Typeless:
                break;

            case SlimDX.DXGI.Format.BC5_UNorm:
                break;

            case SlimDX.DXGI.Format.BC6_SFloat16:
                break;

            case SlimDX.DXGI.Format.BC6_Typeless:
                break;

            case SlimDX.DXGI.Format.BC6_UFloat16:
                break;

            case SlimDX.DXGI.Format.BC7_Typeless:
                break;

            case SlimDX.DXGI.Format.BC7_UNorm:
                break;

            case SlimDX.DXGI.Format.BC7_UNorm_SRGB:
                break;

            case SlimDX.DXGI.Format.D16_UNorm:
                return(2);

            case SlimDX.DXGI.Format.D24_UNorm_S8_UInt:
            case SlimDX.DXGI.Format.D32_Float:
                return(4);

            case SlimDX.DXGI.Format.D32_Float_S8X24_UInt:
                return(8);


            case SlimDX.DXGI.Format.G8R8_G8B8_UNorm:
            case SlimDX.DXGI.Format.R10G10B10A2_Typeless:
            case SlimDX.DXGI.Format.R10G10B10A2_UInt:
            case SlimDX.DXGI.Format.R10G10B10A2_UNorm:
            case SlimDX.DXGI.Format.R10G10B10_XR_Bias_A2_UNorm:
            case SlimDX.DXGI.Format.R11G11B10_Float:
                return(4);


            case SlimDX.DXGI.Format.R16G16B16A16_Float:
            case SlimDX.DXGI.Format.R16G16B16A16_SInt:
            case SlimDX.DXGI.Format.R16G16B16A16_SNorm:
            case SlimDX.DXGI.Format.R16G16B16A16_Typeless:
            case SlimDX.DXGI.Format.R16G16B16A16_UInt:
            case SlimDX.DXGI.Format.R16G16B16A16_UNorm:
                return(8);

            case SlimDX.DXGI.Format.R16G16_Float:
            case SlimDX.DXGI.Format.R16G16_SInt:
            case SlimDX.DXGI.Format.R16G16_SNorm:
            case SlimDX.DXGI.Format.R16G16_Typeless:
            case SlimDX.DXGI.Format.R16G16_UInt:
            case SlimDX.DXGI.Format.R16G16_UNorm:
                return(4);

            case SlimDX.DXGI.Format.R16_Float:
            case SlimDX.DXGI.Format.R16_SInt:
            case SlimDX.DXGI.Format.R16_SNorm:
            case SlimDX.DXGI.Format.R16_Typeless:
            case SlimDX.DXGI.Format.R16_UInt:
            case SlimDX.DXGI.Format.R16_UNorm:
                return(2);


            case SlimDX.DXGI.Format.R1_UNorm:
                break;

            case SlimDX.DXGI.Format.R24G8_Typeless:
            case SlimDX.DXGI.Format.R24_UNorm_X8_Typeless:
                return(4);

            case SlimDX.DXGI.Format.R32G32B32A32_Float:
            case SlimDX.DXGI.Format.R32G32B32A32_SInt:
            case SlimDX.DXGI.Format.R32G32B32A32_Typeless:
            case SlimDX.DXGI.Format.R32G32B32A32_UInt:
                return(16);


            case SlimDX.DXGI.Format.R32G32B32_Float:
            case SlimDX.DXGI.Format.R32G32B32_SInt:
            case SlimDX.DXGI.Format.R32G32B32_Typeless:
            case SlimDX.DXGI.Format.R32G32B32_UInt:
                return(12);


            case SlimDX.DXGI.Format.R32G32_Float:
            case SlimDX.DXGI.Format.R32G32_SInt:
            case SlimDX.DXGI.Format.R32G32_Typeless:
            case SlimDX.DXGI.Format.R32G32_UInt:
            case SlimDX.DXGI.Format.R32G8X24_Typeless:
                return(8);


            case SlimDX.DXGI.Format.R32_Float:
            case SlimDX.DXGI.Format.R32_Float_X8X24_Typeless:
            case SlimDX.DXGI.Format.R32_SInt:
            case SlimDX.DXGI.Format.R32_Typeless:
            case SlimDX.DXGI.Format.R32_UInt:
            case SlimDX.DXGI.Format.R8G8B8A8_SInt:
            case SlimDX.DXGI.Format.R8G8B8A8_SNorm:
            case SlimDX.DXGI.Format.R8G8B8A8_Typeless:
            case SlimDX.DXGI.Format.R8G8B8A8_UInt:
            case SlimDX.DXGI.Format.R8G8B8A8_UNorm:
            case SlimDX.DXGI.Format.R8G8B8A8_UNorm_SRGB:
            case SlimDX.DXGI.Format.R8G8_B8G8_UNorm:
                return(4);

            case SlimDX.DXGI.Format.R8G8_SInt:
            case SlimDX.DXGI.Format.R8G8_SNorm:
            case SlimDX.DXGI.Format.R8G8_Typeless:
            case SlimDX.DXGI.Format.R8G8_UInt:
            case SlimDX.DXGI.Format.R8G8_UNorm:
                return(2);

            case SlimDX.DXGI.Format.R8_SInt:
            case SlimDX.DXGI.Format.R8_SNorm:
            case SlimDX.DXGI.Format.R8_Typeless:
            case SlimDX.DXGI.Format.R8_UInt:
            case SlimDX.DXGI.Format.R8_UNorm:
                return(1);

            case SlimDX.DXGI.Format.R9G9B9E5_SharedExp:
                break;

            case SlimDX.DXGI.Format.Unknown:
                break;

            case SlimDX.DXGI.Format.X24_Typeless_G8_UInt:
                return(4);

            case SlimDX.DXGI.Format.X32_Typeless_G8X24_UInt:
                return(8);

            default:
                break;
            }
            throw new NotImplementedException();
        }
Ejemplo n.º 29
0
        public static bool IsUnsignedInt(this SlimDX.DXGI.Format fmt)
        {
            string s = fmt.ToString();

            return(s.EndsWith("UInt"));
        }
Ejemplo n.º 30
0
 public void Reset(DX11Texture2D texture, int w, int h, int d, SlimDX.DXGI.Format format)
 {
     format = format == SlimDX.DXGI.Format.Unknown ? texture.Format : format;
     this.rtarr.Dispose();
     this.rtarr = new DX11RenderTextureArray(this.context, w, h, d, format, true, 1);
 }
Ejemplo n.º 31
0
        public static UnorderedAccessView CreateUnorderedAccessView <T>(Device device, T[] data, int width, int height, SlimDX.DXGI.Format format, out Texture2D texture)
            where T : struct
        {
            throw new NotImplementedException();

            texture = new Texture2D(device, new Texture2DDescription()
            {
                ArraySize         = 1,
                MipLevels         = 1,
                OptionFlags       = ResourceOptionFlags.None,
                SampleDescription = new SlimDX.DXGI.SampleDescription(1, 0),
                Usage             = ResourceUsage.Dynamic,
                CpuAccessFlags    = CpuAccessFlags.Write,
                BindFlags         = BindFlags.ShaderResource | BindFlags.UnorderedAccess,
                Width             = width,
                Height            = height,
                Format            = format
            });

            var     context = device.ImmediateContext;
            DataBox box     = context.MapSubresource(texture, 0, 0, MapMode.WriteDiscard, MapFlags.None);

            box.Data.WriteRange(data);
            context.UnmapSubresource(texture, 0);

            return(new UnorderedAccessView(device, texture));
        }
Ejemplo n.º 32
0
 private DX11IndexBuffer(DX11RenderContext context)
 {
     this.context = context;
     format       = SlimDX.DXGI.Format.R32_UInt;
 }