impostor fixes, dds loader fix

This commit is contained in:
Turánszki János
2024-10-24 09:57:44 +02:00
parent 0eeeab611b
commit 0700c42431
4 changed files with 14 additions and 7 deletions
+6 -5
View File
@@ -807,14 +807,15 @@ namespace dds
// returns the size of a specific slice at a specific mip level in bytes
constexpr unsigned slice_pitch(unsigned mip) const
{
const unsigned long long bpe = bits_per_element();
const unsigned long long blocksize = block_size();
unsigned long long num_blocks_y = (width() + blocksize - 1) / blocksize;
unsigned long long num_elements_z = depth();
unsigned long long num_blocks_x = (width() + blocksize - 1) / blocksize;
unsigned long long num_blocks_y = (height() + blocksize - 1) / blocksize;
num_blocks_x >>= mip;
num_blocks_y >>= mip;
num_elements_z >>= mip;
num_blocks_x = num_blocks_x < 1 ? 1 : num_blocks_x;
num_blocks_y = num_blocks_y < 1 ? 1 : num_blocks_y;
num_elements_z = num_elements_z < 1 ? 1 : num_elements_z;
return unsigned(row_pitch(mip) * num_blocks_y * num_elements_z);
return unsigned(num_blocks_x * num_blocks_y * bpe / 8ull);
}
};
+6
View File
@@ -4899,6 +4899,12 @@ void UpdateRenderData(
wi::profiler::EndRange(range);
device->EventEnd(cmd);
}
else if(vis.scene->impostors.GetCount() > 0 && vis.scene->objects.GetCount() == 0 && vis.scene->impostorBuffer.IsValid())
{
device->ClearUAV(&vis.scene->impostorBuffer, 0, cmd);
barrier_stack.push_back(GPUBarrier::Buffer(&vis.scene->impostorBuffer, ResourceState::UNORDERED_ACCESS, ResourceState::SHADER_RESOURCE | ResourceState::INDIRECT_ARGUMENT));
barrier_stack_flush(cmd);
}
// Meshlets:
if(vis.scene->instanceArraySize > 0 && vis.scene->meshletBuffer.IsValid())
+1 -1
View File
@@ -4109,7 +4109,7 @@ namespace wi::scene
}
void Scene::RunImpostorUpdateSystem(wi::jobsystem::context& ctx)
{
if (dt == 0)
if (instanceArrayMapped == nullptr)
return;
if (impostors.GetCount() > 0 && !impostorArray.IsValid())
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wi::version
// minor features, major updates, breaking compatibility changes
const int minor = 71;
// minor bug fixes, alterations, refactors, updates
const int revision = 602;
const int revision = 603;
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);