Esempio n. 1
0
        public void Test2DStagingFail()
        {
            GorgonTexture2D texture = null;

            try
            {
                texture = _framework.Graphics.Textures.CreateTexture("Test2D",
                                                                     new GorgonTexture2DSettings
                {
                    Width      = 256,
                    Height     = 256,
                    ArrayCount = 1,
                    Format     = BufferFormat.R8G8B8A8,
                    MipCount   = 1,
                    AllowUnorderedAccessViews = false,
                    Usage = BufferUsage.Staging
                });

                texture.GetShaderView(BufferFormat.R8G8B8A8_Int);
            }
            finally
            {
                if (texture != null)
                {
                    texture.Dispose();
                }
            }
        }
Esempio n. 2
0
        public void Test2ViewsSameShaderStage()
        {
            GorgonTexture2D texture = null;

            _framework.CreateTestScene(Shaders, Shaders, true);

            try
            {
                using (var data = new GorgonImageData(new GorgonTexture2DSettings
                {
                    Width = 256,
                    Height = 256,
                    ArrayCount = 1,
                    Format = BufferFormat.R8G8B8A8,
                    MipCount = 1,
                    ShaderViewFormat = BufferFormat.R8G8B8A8_Int,
                    AllowUnorderedAccessViews = false,
                    Usage = BufferUsage.Default
                }))
                {
                    for (int i = 0; i < 5000; i++)
                    {
                        data.Buffers[0].Data.Position = ((GorgonRandom.RandomInt32(0, 256) * data.Buffers[0].PitchInformation.RowPitch)
                                                         + GorgonRandom.RandomInt32(0, 256) * 4);
                        data.Buffers[0].Data.Write((int)((GorgonRandom.RandomSingle() * 2.0f - 1.0f) * (Int32.MaxValue - 2)));
                    }

                    texture = _framework.Graphics.Textures.CreateTexture <GorgonTexture2D>("Test2D", data);
                }

                GorgonTextureShaderView view = texture.GetShaderView(BufferFormat.R8G8B8A8_UIntNormal);

                _framework.Graphics.Shaders.PixelShader.Resources[0] = texture;
                _framework.Graphics.Shaders.PixelShader.Resources[1] = view;

                Assert.IsTrue(_framework.Run() == DialogResult.Yes);
            }
            finally
            {
                if (texture != null)
                {
                    texture.Dispose();
                }
            }
        }