Пример #1
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var context = RenderContext.GetShared(Services);
            renderHammersley = new ComputeEffectShader(context) { ShaderSourceName = "HammersleyTest" };

            output = Texture.New2D(GraphicsDevice, OutputSize, OutputSize, PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.UnorderedAccess | TextureFlags.RenderTarget).DisposeBy(this);
        }
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            CreateBufferData();

            inputBuffer = Buffer.Typed.New(GraphicsDevice, inputBufferData, PixelFormat.R32G32B32A32_Float, true);
            outputBuffer = Buffer.Typed.New(GraphicsDevice, NbOfCoeffs * nbOfGroups.X * nbOfGroups.Y, PixelFormat.R32G32B32A32_Float, true);

            var context = RenderContext.GetShared(Services);
            pass2 = new ComputeEffectShader(context) { ShaderSourceName = "LambertianPrefilteringSHEffectPass2", };
        }
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            spriteBatch = new SpriteBatch(GraphicsDevice);
            
            inputTexture = Content.Load<Texture>("uv");
            var groupCounts = new Int3(inputTexture.Width / ReductionRatio, inputTexture.Height / ReductionRatio, 1);
            outputTexture = Texture.New2D(GraphicsDevice, groupCounts.X, groupCounts.Y, 1, PixelFormat.R8G8B8A8_UNorm, TextureFlags.UnorderedAccess | TextureFlags.ShaderResource);
            displayedTexture = outputTexture;

            drawEffectContext = RenderContext.GetShared(Services);
            computeShaderEffect = new ComputeEffectShader(drawEffectContext) { ShaderSourceName = "ComputeShaderTestEffect", ThreadGroupCounts = groupCounts };
        }