fixed issue with dedicated shadow and shadow atlas packing
This commit is contained in:
@@ -40,7 +40,7 @@ namespace wi::rectpacker
|
||||
// returns true for success, false for failure
|
||||
bool pack(int max_width)
|
||||
{
|
||||
while (width <= max_width || height <= max_width)
|
||||
while (width <= max_width && height <= max_width)
|
||||
{
|
||||
if (nodes.size() < width)
|
||||
{
|
||||
|
||||
@@ -2925,8 +2925,10 @@ inline void CreateDirLightShadowCams(const LightComponent& light, CameraComponen
|
||||
else
|
||||
{
|
||||
// Compute cascade bounds in light-view-space from the main frustum corners:
|
||||
const float split_near = cascade == 0 ? 0 : light.cascade_distances[cascade - 1 - dedicated_shadow_count] / farPlane;
|
||||
const float split_far = light.cascade_distances[cascade - dedicated_shadow_count] / farPlane;
|
||||
const int near_index = cascade - 1 - (int)dedicated_shadow_count;
|
||||
const int far_index = cascade - (int)dedicated_shadow_count;
|
||||
const float split_near = cascade == dedicated_shadow_count ? 0 : light.cascade_distances[near_index] / farPlane;
|
||||
const float split_far = light.cascade_distances[far_index] / farPlane;
|
||||
const XMVECTOR corners[] =
|
||||
{
|
||||
XMVector3Transform(XMVectorLerp(frustum_corners[0], frustum_corners[1], split_near), lightView),
|
||||
@@ -5049,7 +5051,7 @@ void UpdateRenderData(
|
||||
device->CopyBuffer(
|
||||
&vis.scene->instanceBuffer,
|
||||
0,
|
||||
&vis.scene->instanceUploadBuffer[device->GetBufferIndex()],
|
||||
&vis.scene->instanceUploadBuffer[vis.scene->cpu_gpu_mapped_resource_index],
|
||||
0,
|
||||
vis.scene->instanceArraySize * sizeof(ShaderMeshInstance),
|
||||
cmd
|
||||
@@ -5062,7 +5064,7 @@ void UpdateRenderData(
|
||||
device->CopyBuffer(
|
||||
&vis.scene->geometryBuffer,
|
||||
0,
|
||||
&vis.scene->geometryUploadBuffer[device->GetBufferIndex()],
|
||||
&vis.scene->geometryUploadBuffer[vis.scene->cpu_gpu_mapped_resource_index],
|
||||
0,
|
||||
vis.scene->geometryArraySize * sizeof(ShaderGeometry),
|
||||
cmd
|
||||
@@ -5075,7 +5077,7 @@ void UpdateRenderData(
|
||||
device->CopyBuffer(
|
||||
&vis.scene->materialBuffer,
|
||||
0,
|
||||
&vis.scene->materialUploadBuffer[device->GetBufferIndex()],
|
||||
&vis.scene->materialUploadBuffer[vis.scene->cpu_gpu_mapped_resource_index],
|
||||
0,
|
||||
vis.scene->materialArraySize * sizeof(ShaderMaterial),
|
||||
cmd
|
||||
@@ -5088,7 +5090,7 @@ void UpdateRenderData(
|
||||
device->CopyBuffer(
|
||||
&vis.scene->skinningBuffer,
|
||||
0,
|
||||
&vis.scene->skinningUploadBuffer[device->GetBufferIndex()],
|
||||
&vis.scene->skinningUploadBuffer[vis.scene->cpu_gpu_mapped_resource_index],
|
||||
0,
|
||||
vis.scene->skinningDataSize,
|
||||
cmd
|
||||
@@ -5161,10 +5163,10 @@ void UpdateRenderData(
|
||||
{
|
||||
descriptor_skinningbuffer = device->GetDescriptorIndex(&vis.scene->skinningBuffer, SubresourceType::SRV);
|
||||
}
|
||||
else if (vis.scene->skinningUploadBuffer[device->GetBufferIndex()].IsValid())
|
||||
else if (vis.scene->skinningUploadBuffer[vis.scene->cpu_gpu_mapped_resource_index].IsValid())
|
||||
{
|
||||
// In this case we use the upload buffer directly, this will be the case with UMA GPU:
|
||||
descriptor_skinningbuffer = device->GetDescriptorIndex(&vis.scene->skinningUploadBuffer[device->GetBufferIndex()], SubresourceType::SRV);
|
||||
descriptor_skinningbuffer = device->GetDescriptorIndex(&vis.scene->skinningUploadBuffer[vis.scene->cpu_gpu_mapped_resource_index], SubresourceType::SRV);
|
||||
}
|
||||
device->BindComputeShader(&shaders[CSTYPE_SKINNING], cmd);
|
||||
for (size_t i = 0; i < vis.scene->meshes.GetCount(); ++i)
|
||||
@@ -5554,7 +5556,7 @@ void TextureStreamingReadbackCopy(
|
||||
{
|
||||
device->Barrier(GPUBarrier::Buffer(&scene.textureStreamingFeedbackBuffer, ResourceState::UNORDERED_ACCESS, ResourceState::COPY_SRC), cmd);
|
||||
device->CopyResource(
|
||||
&scene.textureStreamingFeedbackBuffer_readback[device->GetBufferIndex()],
|
||||
&scene.textureStreamingFeedbackBuffer_readback[scene.cpu_gpu_mapped_resource_index],
|
||||
&scene.textureStreamingFeedbackBuffer,
|
||||
cmd
|
||||
);
|
||||
|
||||
@@ -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 = 839;
|
||||
const int revision = 840;
|
||||
|
||||
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user