|
@@ -21,7 +21,7 @@ pub fn new_compute_pipeline(device: &wgpu::Device)-> (ComputePipeline,BindGroup,
|
|
|
let output_texture_size = wgpu::Extent3d{
|
|
let output_texture_size = wgpu::Extent3d{
|
|
|
width: SIZE,
|
|
width: SIZE,
|
|
|
height: SIZE,
|
|
height: SIZE,
|
|
|
- depth_or_array_layers: 0
|
|
|
|
|
|
|
+ depth_or_array_layers: 1
|
|
|
};
|
|
};
|
|
|
let output_texture = device.create_texture(&wgpu::TextureDescriptor{
|
|
let output_texture = device.create_texture(&wgpu::TextureDescriptor{
|
|
|
label: Some("Output Heightmap Texture"),
|
|
label: Some("Output Heightmap Texture"),
|
|
@@ -29,7 +29,7 @@ pub fn new_compute_pipeline(device: &wgpu::Device)-> (ComputePipeline,BindGroup,
|
|
|
mip_level_count: 1,
|
|
mip_level_count: 1,
|
|
|
sample_count: 1,
|
|
sample_count: 1,
|
|
|
dimension: wgpu::TextureDimension::D2,
|
|
dimension: wgpu::TextureDimension::D2,
|
|
|
- format: wgpu::TextureFormat::Rgba8UnormSrgb,
|
|
|
|
|
|
|
+ format: wgpu::TextureFormat::R32Float,
|
|
|
usage: wgpu::TextureUsages::STORAGE_BINDING | wgpu::TextureUsages::COPY_DST | wgpu::TextureUsages::COPY_SRC,
|
|
usage: wgpu::TextureUsages::STORAGE_BINDING | wgpu::TextureUsages::COPY_DST | wgpu::TextureUsages::COPY_SRC,
|
|
|
view_formats: &[]
|
|
view_formats: &[]
|
|
|
});
|
|
});
|
|
@@ -45,8 +45,8 @@ pub fn new_compute_pipeline(device: &wgpu::Device)-> (ComputePipeline,BindGroup,
|
|
|
binding: 0,
|
|
binding: 0,
|
|
|
visibility: wgpu::ShaderStages::COMPUTE | wgpu::ShaderStages::VERTEX,
|
|
visibility: wgpu::ShaderStages::COMPUTE | wgpu::ShaderStages::VERTEX,
|
|
|
ty: wgpu::BindingType::StorageTexture{
|
|
ty: wgpu::BindingType::StorageTexture{
|
|
|
- access: wgpu::StorageTextureAccess::ReadWrite,
|
|
|
|
|
- format: wgpu::TextureFormat::Rgba8UnormSrgb,
|
|
|
|
|
|
|
+ access: wgpu::StorageTextureAccess::WriteOnly,
|
|
|
|
|
+ format: wgpu::TextureFormat::R32Float,
|
|
|
view_dimension: wgpu::TextureViewDimension::D2
|
|
view_dimension: wgpu::TextureViewDimension::D2
|
|
|
},
|
|
},
|
|
|
count: None
|
|
count: None
|
|
@@ -77,7 +77,7 @@ pub fn new_compute_pipeline(device: &wgpu::Device)-> (ComputePipeline,BindGroup,
|
|
|
label: Some("Compute Pipeline 1"),
|
|
label: Some("Compute Pipeline 1"),
|
|
|
layout: Some(&compute_pipeline_layout),
|
|
layout: Some(&compute_pipeline_layout),
|
|
|
module: &compute_shader,
|
|
module: &compute_shader,
|
|
|
- entry_point: "@compute"
|
|
|
|
|
|
|
+ entry_point: "compute_main"
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
let dispatch = compute_work_group_count((SIZE,SIZE), (16,16));
|
|
let dispatch = compute_work_group_count((SIZE,SIZE), (16,16));
|