Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
Merge branch 'main' of https://github.com/hanyangl5/horizon
Browse files Browse the repository at this point in the history
  • Loading branch information
hylu committed Aug 22, 2023
2 parents a992f92 + c18a0d3 commit 5d2f472
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions samples/renderer_v1/post_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ AutoExposure::AutoExposure(Backend::RHI *rhi) noexcept : mRhi(rhi) {
luminance_histogram_pass = rhi->CreateComputePipeline(ComputePipelineCreateInfo{});
luminance_average_pass = rhi->CreateComputePipeline(ComputePipelineCreateInfo{});

luminance_histogram_constants_buffer = rhi->CreateBuffer(
BufferCreateInfo{DescriptorType::DESCRIPTOR_TYPE_CONSTANT_BUFFER, ResourceState::RESOURCE_STATE_SHADER_RESOURCE,
sizeof(luminance_histogram_constants)});

luminance_histogram_constants_buffer =
rhi->CreateBuffer(BufferCreateInfo{DescriptorType::DESCRIPTOR_TYPE_CONSTANT_BUFFER,
ResourceState::RESOURCE_STATE_SHADER_RESOURCE, sizeof(luminance_histogram_constants)});

histogram_buffer = rhi->CreateBuffer(BufferCreateInfo{DescriptorType::DESCRIPTOR_TYPE_RW_BUFFER,
ResourceState::RESOURCE_STATE_SHADER_RESOURCE, 256 * sizeof(u32)});
histogram_buffer = rhi->CreateBuffer(BufferCreateInfo{
DescriptorType::DESCRIPTOR_TYPE_RW_BUFFER, ResourceState::RESOURCE_STATE_SHADER_RESOURCE, 256 * sizeof(u32)});

adapted_muminance_buffer = rhi->CreateBuffer(
BufferCreateInfo{DescriptorType::DESCRIPTOR_TYPE_RW_BUFFER, ResourceState::RESOURCE_STATE_SHADER_RESOURCE,
4});
BufferCreateInfo{DescriptorType::DESCRIPTOR_TYPE_RW_BUFFER, ResourceState::RESOURCE_STATE_SHADER_RESOURCE, 4});

luminance_histogram_pass->SetComputeShader(luminance_histogram_cs);
luminance_average_pass->SetComputeShader(luminance_average_cs);
Expand All @@ -30,7 +28,7 @@ AutoExposure::~AutoExposure() noexcept {

mRhi->DestroyShader(luminance_histogram_cs);
mRhi->DestroyShader(luminance_average_cs);

mRhi->DestroyBuffer(histogram_buffer);
mRhi->DestroyBuffer(luminance_histogram_constants_buffer);
mRhi->DestroyBuffer(adapted_muminance_buffer);
Expand Down

0 comments on commit 5d2f472

Please sign in to comment.