コード例 #1
0
        private void Initialize()
        {
            constantBuffer = new Buffer(graphicsDevice, new BufferDescription()
            {
                BindFlags      = BindFlags.ConstantBuffer,
                CpuAccessFlags = CpuAccessFlags.Write,
                OptionFlags    = ResourceOptionFlags.None,
                SizeInBytes    = (int)Math.Ceiling(Marshal.SizeOf(typeof(DirectComputeConstantBuffer)) / 16.0) * 16,
                Usage          = ResourceUsage.Dynamic
            });

            computePositionWeightNoiseCube     = new ComputeShader(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\TerrainGenerator.hlsl", "PositionWeightNoiseCube", "cs_5_0", ShaderFlags.None, EffectFlags.None));
            computeNormalAmbient               = new ComputeShader(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\TerrainGenerator.hlsl", "NormalAmbient", "cs_5_0", ShaderFlags.None, EffectFlags.None));
            computeMarchingCubesCases          = new ComputeShader(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\TerrainGenerator.hlsl", "MarchingCubesCases", "cs_5_0", ShaderFlags.None, EffectFlags.None));
            computeMarchingCubesVertices       = new ComputeShader(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\TerrainGenerator.hlsl", "MarchingCubesVertices", "cs_5_0", ShaderFlags.None, EffectFlags.None));
            computePositionWeightNoiseCubeWarp = new ComputeShader(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\TerrainGenerator.hlsl", "PositionWeightNoiseCubeWarp", "cs_5_0", ShaderFlags.None, EffectFlags.None));
            computePositionWeightFormula       = new ComputeShader(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\TerrainGenerator.hlsl", "PositionWeightFormula", "cs_5_0", ShaderFlags.None, EffectFlags.None));

            prefixScan = new DirectComputePrefixScan(graphicsDevice);
        }
コード例 #2
0
        private void Initialize()
        {
            constantBuffer = new Buffer(graphicsDevice, new BufferDescription()
            {
                BindFlags = BindFlags.ConstantBuffer,
                CpuAccessFlags = CpuAccessFlags.Write,
                OptionFlags = ResourceOptionFlags.None,
                SizeInBytes = (int)Math.Ceiling(Marshal.SizeOf(typeof(DirectComputeConstantBuffer)) / 16.0) * 16,
                Usage = ResourceUsage.Dynamic
            });

            computePositionWeightNoiseCube = new ComputeShader(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\TerrainGenerator.hlsl", "PositionWeightNoiseCube", "cs_5_0", ShaderFlags.None, EffectFlags.None));
            computeNormalAmbient = new ComputeShader(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\TerrainGenerator.hlsl", "NormalAmbient", "cs_5_0", ShaderFlags.None, EffectFlags.None));
            computeMarchingCubesCases = new ComputeShader(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\TerrainGenerator.hlsl", "MarchingCubesCases", "cs_5_0", ShaderFlags.None, EffectFlags.None));
            computeMarchingCubesVertices = new ComputeShader(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\TerrainGenerator.hlsl", "MarchingCubesVertices", "cs_5_0", ShaderFlags.None, EffectFlags.None));
            computePositionWeightNoiseCubeWarp = new ComputeShader(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\TerrainGenerator.hlsl", "PositionWeightNoiseCubeWarp", "cs_5_0", ShaderFlags.None, EffectFlags.None));
            computePositionWeightFormula = new ComputeShader(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\TerrainGenerator.hlsl", "PositionWeightFormula", "cs_5_0", ShaderFlags.None, EffectFlags.None));

            prefixScan = new DirectComputePrefixScan(graphicsDevice);
        }