DX11 removal, Surfel GI

version 0.57.0:
- DX11 removed, DX12 is default now on Windows
- graphics interfaces improved:
	- Bindless descriptor support is now assumed
	- GPU Buffers with USAGE_UPLOAD and USAGE_READBACK will be persistently mapped after creation
	- Removed Map/Unmap
	- added BindDynamicConstantBuffer helper function
	- improved AllocateGPU helper function
	- GPU Queries resolving can be done directly into GPUBuffer
	- UpdateBuffer now doesn't synchronize internally, this allows batching updates
	- removed support for bindless constant buffers (uniform buffers)
	- BindConstantBuffer will accept offset
	- RESOURCE_STATES refactor, they can be combined now in the barriers
	- many other refactors
- gbuffer normals removed, implemented visibility buffer
- bindless decals, bindless lightmaps, bindless hair particles, bindless software path tracing
- hair particles path tracing support
- path tracing eye adaption supported
- Surfel GI (experimental)
This commit is contained in:
Turánszki János
2021-09-05 18:59:03 +02:00
committed by GitHub
parent b549e6c597
commit f3687dbf4e
238 changed files with 7025 additions and 11690 deletions
+7 -29
View File
@@ -113,49 +113,28 @@ namespace wiHelper
Texture stagingTex;
TextureDesc staging_desc = desc;
staging_desc.Usage = USAGE_STAGING;
staging_desc.CPUAccessFlags = CPU_ACCESS_READ;
staging_desc.BindFlags = 0;
staging_desc.MiscFlags = 0;
staging_desc.Usage = USAGE_READBACK;
staging_desc.MipLevels = 1;
staging_desc.layout = IMAGE_LAYOUT_COPY_DST;
staging_desc.layout = RESOURCE_STATE_COPY_DST;
bool success = device->CreateTexture(&staging_desc, nullptr, &stagingTex);
assert(success);
CommandList cmd = device->BeginCommandList();
{
GPUBarrier barriers[] = {
GPUBarrier::Image(&texture, texture.desc.layout, IMAGE_LAYOUT_COPY_SRC, 0)
};
device->Barrier(barriers, arraysize(barriers), cmd);
}
device->CopyResource(&stagingTex, &texture, cmd);
{
GPUBarrier barriers[] = {
GPUBarrier::Image(&texture, IMAGE_LAYOUT_COPY_SRC, texture.desc.layout, 0)
};
device->Barrier(barriers, arraysize(barriers), cmd);
}
device->SubmitCommandLists();
device->WaitForGPU();
Mapping mapping;
mapping._flags = Mapping::FLAG_READ;
mapping.size = data_size;
device->Map(&stagingTex, &mapping);
if (mapping.data != nullptr)
if (stagingTex.mapped_data != nullptr)
{
if (mapping.rowpitch / data_stride != desc.Width)
if (stagingTex.mapped_rowpitch / data_stride != desc.Width)
{
// Copy padded texture row by row:
const uint32_t cpysize = desc.Width * data_stride;
for (uint32_t i = 0; i < desc.Height; ++i)
{
void* src = (void*)((size_t)mapping.data + size_t(i * mapping.rowpitch));
void* src = (void*)((size_t)stagingTex.mapped_data + size_t(i * stagingTex.mapped_rowpitch));
void* dst = (void*)((size_t)texturedata.data() + size_t(i * cpysize));
memcpy(dst, src, cpysize);
}
@@ -163,16 +142,15 @@ namespace wiHelper
else
{
// Copy whole
std::memcpy(texturedata.data(), mapping.data, texturedata.size());
std::memcpy(texturedata.data(), stagingTex.mapped_data, texturedata.size());
}
device->Unmap(&stagingTex);
}
else
{
assert(0);
}
return mapping.data != nullptr;
return stagingTex.mapped_data != nullptr;
}
bool saveTextureToMemoryFile(const wiGraphics::Texture& texture, const std::string& fileExtension, std::vector<uint8_t>& filedata)