Fix auto-exposure in Vulkan
* I forgot to bind the shader buffer again :-p (maybe we should change this functionality under Vulkan to match Metal rules?)
This commit is contained in:
parent
d999485325
commit
e55a71402f
2 changed files with 10 additions and 12 deletions
|
@ -1115,7 +1115,7 @@ GFXPipeline* GFXVulkan::create_compute_pipeline(const GFXComputePipelineCreateIn
|
||||||
layoutBinding.binding = binding.binding;
|
layoutBinding.binding = binding.binding;
|
||||||
layoutBinding.descriptorType = descriptorType;
|
layoutBinding.descriptorType = descriptorType;
|
||||||
layoutBinding.descriptorCount = 1;
|
layoutBinding.descriptorCount = 1;
|
||||||
layoutBinding.stageFlags = VK_SHADER_STAGE_ALL;
|
layoutBinding.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT;
|
||||||
|
|
||||||
layoutBindings.push_back(layoutBinding);
|
layoutBindings.push_back(layoutBinding);
|
||||||
}
|
}
|
||||||
|
@ -2006,8 +2006,6 @@ void GFXVulkan::resetDescriptorState() {
|
||||||
void GFXVulkan::cacheDescriptorState(GFXVulkanPipeline* pipeline, VkDescriptorSetLayout layout) {
|
void GFXVulkan::cacheDescriptorState(GFXVulkanPipeline* pipeline, VkDescriptorSetLayout layout) {
|
||||||
uint64_t hash = getDescriptorHash(pipeline);
|
uint64_t hash = getDescriptorHash(pipeline);
|
||||||
|
|
||||||
vkDeviceWaitIdle(device);
|
|
||||||
|
|
||||||
// create set object
|
// create set object
|
||||||
VkDescriptorSet descriptorSet;
|
VkDescriptorSet descriptorSet;
|
||||||
|
|
||||||
|
@ -2018,18 +2016,14 @@ void GFXVulkan::cacheDescriptorState(GFXVulkanPipeline* pipeline, VkDescriptorSe
|
||||||
allocInfo.pSetLayouts = &layout;
|
allocInfo.pSetLayouts = &layout;
|
||||||
|
|
||||||
VkResult error = vkAllocateDescriptorSets(device, &allocInfo, &descriptorSet);
|
VkResult error = vkAllocateDescriptorSets(device, &allocInfo, &descriptorSet);
|
||||||
if(error == VK_ERROR_OUT_OF_POOL_MEMORY) {
|
if(error != VK_SUCCESS || descriptorSet == VK_NULL_HANDLE) {
|
||||||
prism::log::error(System::GFX, "ERROR: COULD NOT CACHE BECAUSE OUT OF DESCRIPTOR SETS.");
|
prism::log::error(System::GFX, "ERROR: COULD NOT CACHE BECAUSE OUT OF DESCRIPTOR SETS.");
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(error != VK_SUCCESS)
|
|
||||||
return;
|
|
||||||
|
|
||||||
name_object(device, VK_OBJECT_TYPE_DESCRIPTOR_SET, (uint64_t)descriptorSet, pipeline->label);
|
name_object(device, VK_OBJECT_TYPE_DESCRIPTOR_SET, (uint64_t)descriptorSet, pipeline->label);
|
||||||
|
|
||||||
if (descriptorSet == VK_NULL_HANDLE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// update set
|
// update set
|
||||||
for (auto [i, buffer] : utility::enumerate(boundShaderBuffers)) {
|
for (auto [i, buffer] : utility::enumerate(boundShaderBuffers)) {
|
||||||
if (buffer.buffer != nullptr) {
|
if (buffer.buffer != nullptr) {
|
||||||
|
|
|
@ -339,6 +339,8 @@ void renderer::render(GFXCommandBuffer* commandbuffer, Scene* scene, RenderTarge
|
||||||
|
|
||||||
commandbuffer->set_compute_pipeline(histogram_average_pipeline);
|
commandbuffer->set_compute_pipeline(histogram_average_pipeline);
|
||||||
|
|
||||||
|
commandbuffer->bind_shader_buffer(histogram_buffer, 0, 1, sizeof(uint32_t) * 256);
|
||||||
|
|
||||||
params = prism::float4(render_options.min_luminance,
|
params = prism::float4(render_options.min_luminance,
|
||||||
lum_range,
|
lum_range,
|
||||||
std::clamp(1.0f - std::exp(-(1.0f / 60.0f) * 1.1f), 0.0f, 1.0f),
|
std::clamp(1.0f - std::exp(-(1.0f / 60.0f) * 1.1f), 0.0f, 1.0f),
|
||||||
|
@ -1006,6 +1008,7 @@ void renderer::generate_brdf() {
|
||||||
|
|
||||||
void renderer::create_histogram_resources() {
|
void renderer::create_histogram_resources() {
|
||||||
GFXComputePipelineCreateInfo create_info = {};
|
GFXComputePipelineCreateInfo create_info = {};
|
||||||
|
create_info.label = "Histogram";
|
||||||
create_info.compute_src = ShaderSource(prism::path("histogram.comp"));
|
create_info.compute_src = ShaderSource(prism::path("histogram.comp"));
|
||||||
create_info.workgroup_size_x = 16;
|
create_info.workgroup_size_x = 16;
|
||||||
create_info.workgroup_size_y = 16;
|
create_info.workgroup_size_y = 16;
|
||||||
|
@ -1022,6 +1025,7 @@ void renderer::create_histogram_resources() {
|
||||||
|
|
||||||
histogram_pipeline = gfx->create_compute_pipeline(create_info);
|
histogram_pipeline = gfx->create_compute_pipeline(create_info);
|
||||||
|
|
||||||
|
create_info.label = "Histogram Average";
|
||||||
create_info.compute_src = ShaderSource(prism::path("histogram-average.comp"));
|
create_info.compute_src = ShaderSource(prism::path("histogram-average.comp"));
|
||||||
create_info.workgroup_size_x = 256;
|
create_info.workgroup_size_x = 256;
|
||||||
create_info.workgroup_size_y = 1;
|
create_info.workgroup_size_y = 1;
|
||||||
|
|
Reference in a new issue