示例#1
0
        public static DX11Texture1D FromReference(DxDevice device, Texture1D texture, ShaderResourceView view)
        {
            DX11Texture1D result = new DX11Texture1D(device);

            result.description = texture.Description;
            result.ShaderView  = view;
            result.Texture     = texture;
            return(result);
        }
示例#2
0
        public static DX11Texture1D FromFile(DX11RenderContext context, string path)
        {
            DX11Texture1D res = new DX11Texture1D(context);

            try
            {
                res.Resource = Texture1D.FromFile(context.Device, path);

                res.SRV = new ShaderResourceView(context.Device, res.Resource);
            }
            catch
            {
            }
            return(res);
        }
示例#3
0
        public static DX11Texture1D LoadTexture1D(DxDevice device, string path)
        {
            IntPtr resource;
            long   retcode = NativeMethods.LoadTextureFromFile(device.Device.NativePointer, path, out resource, 1);

            if (retcode >= 0)
            {
                Resource r = Resource.FromPointer <Resource>(resource);
                if (r.Dimension != ResourceDimension.Texture1D)
                {
                    r.Dispose();
                    throw new Exception("Texture is not a 1D Texture");
                }

                Texture1D          texture = Texture1D.FromPointer <Texture1D>(resource);
                ShaderResourceView srv     = new ShaderResourceView(device, texture);
                return(DX11Texture1D.FromReference(device, texture, srv));
            }
            else
            {
                throw new Exception("Failed to load texture");
            }
        }