From 8526e89f0db9fb7a2704c4a6c00efa038e0c9d78 Mon Sep 17 00:00:00 2001 From: skallweitNV <64953474+skallweitNV@users.noreply.github.com> Date: Tue, 24 Oct 2023 09:59:11 +0200 Subject: [PATCH] Automatic update (#398) - Remove Buffer::MapType enum. - Fix RenderContext::resolveResource. --- Source/Falcor/Core/API/Buffer.cpp | 18 +++++------- Source/Falcor/Core/API/Buffer.h | 28 +------------------ Source/Falcor/Core/API/CopyContext.cpp | 2 +- Source/Falcor/Core/API/GpuTimer.cpp | 2 +- Source/Falcor/Core/API/RenderContext.cpp | 18 ++++++++++++ .../Rendering/Materials/BSDFIntegrator.cpp | 2 +- Source/Falcor/Rendering/Utils/PixelStats.cpp | 2 +- .../Falcor/Scene/Lights/LightCollection.cpp | 2 +- .../Falcor/Scene/Material/MaterialSystem.cpp | 2 +- .../Scene/SDFs/SparseBrickSet/SDFSBS.cpp | 2 +- .../Scene/SDFs/SparseVoxelOctree/SDFSVO.cpp | 4 +-- Source/Falcor/Utils/Debug/PixelDebug.cpp | 2 +- Source/Falcor/Utils/Debug/WarpProfiler.cpp | 2 +- Source/Falcor/Utils/UI/Gui.cpp | 4 +-- Source/Falcor/Utils/UI/TextRenderer.cpp | 2 +- Source/RenderPasses/BSDFViewer/BSDFViewer.cpp | 2 +- .../DebugPasses/ColorMapPass/ColorMapPass.cpp | 2 +- Source/RenderPasses/SDFEditor/SDFEditor.cpp | 2 +- .../TestPasses/TestPyTorchPass.cpp | 2 +- .../Samples/MultiSampling/MultiSampling.cpp | 14 +++++++++- Source/Samples/MultiSampling/MultiSampling.h | 2 ++ .../Tests/Core/BufferAccessTests.cpp | 4 +-- .../FalcorTest/Tests/Core/BufferTests.cpp | 4 +-- .../Tools/FalcorTest/Tests/Core/CoreTests.cpp | 2 +- .../FalcorTest/Tests/Core/LargeBuffer.cpp | 2 +- 25 files changed, 65 insertions(+), 63 deletions(-) diff --git a/Source/Falcor/Core/API/Buffer.cpp b/Source/Falcor/Core/API/Buffer.cpp index e073e7b2a..e89bf27ba 100644 --- a/Source/Falcor/Core/API/Buffer.cpp +++ b/Source/Falcor/Core/API/Buffer.cpp @@ -262,7 +262,7 @@ void Buffer::setBlob(const void* pData, size_t offset, size_t size) if (mMemoryType == MemoryType::Upload) { bool wasMapped = mMappedPtr != nullptr; - uint8_t* pDst = (uint8_t*)map(MapType::Write) + offset; + uint8_t* pDst = (uint8_t*)map() + offset; std::memcpy(pDst, pData, size); if (!wasMapped) unmap(); @@ -286,7 +286,7 @@ void Buffer::getBlob(void* pData, size_t offset, size_t size) const if (mMemoryType == MemoryType::ReadBack) { bool wasMapped = mMappedPtr != nullptr; - const uint8_t* pSrc = (const uint8_t*)map(MapType::Read) + offset; + const uint8_t* pSrc = (const uint8_t*)map() + offset; std::memcpy(pData, pSrc, size); if (!wasMapped) unmap(); @@ -301,16 +301,12 @@ void Buffer::getBlob(void* pData, size_t offset, size_t size) const } } -void* Buffer::map(MapType type) const +void* Buffer::map() const { - if (type == MapType::WriteDiscard) - FALCOR_THROW("MapType::WriteDiscard not supported anymore"); - - if (type == MapType::Write && mMemoryType != MemoryType::Upload) - FALCOR_THROW("Trying to map a buffer for writing, but it wasn't created with the write permissions."); - - if (type == MapType::Read && mMemoryType != MemoryType::ReadBack) - FALCOR_THROW("Trying to map a buffer for reading, but it wasn't created with the read permissions."); + FALCOR_CHECK( + mMemoryType == MemoryType::Upload || mMemoryType == MemoryType::ReadBack, + "Trying to map a buffer that wasn't created with the upload or readback flags." + ); if (!mMappedPtr) FALCOR_GFX_CALL(mGfxBufferResource->map(nullptr, &mMappedPtr)); diff --git a/Source/Falcor/Core/API/Buffer.h b/Source/Falcor/Core/API/Buffer.h index 4e9a449c1..83c1d5bd3 100644 --- a/Source/Falcor/Core/API/Buffer.h +++ b/Source/Falcor/Core/API/Buffer.h @@ -145,13 +145,6 @@ class FALCOR_API Buffer : public Resource { FALCOR_OBJECT(Buffer) public: - enum class MapType - { - Read, ///< Map the buffer for read access. - Write, ///< Map the buffer for write access. - WriteDiscard, ///< Deprecated and not supported. - }; - /// Constructor for raw buffer. Buffer(ref pDevice, size_t size, ResourceBindFlags bindFlags, MemoryType memoryType, const void* pInitData); @@ -272,11 +265,8 @@ class FALCOR_API Buffer : public Resource /** * Map the buffer. - * Only buffers with MemoryType::Upload or MemoryType::ReadBack can be mapped. - * To map a buffer with MemoryType::Upload, use MapType::Write. - * To map a buffer with MemoryType::ReadBack, use MapType::Read. */ - void* map(MapType Type) const; + void* map() const; /** * Unmap the buffer @@ -364,20 +354,4 @@ inline std::string to_string(MemoryType c) #undef a2s } -inline std::string to_string(Buffer::MapType mt) -{ -#define t2s(t_) \ - case Buffer::MapType::t_: \ - return #t_; - switch (mt) - { - t2s(Read); - t2s(Write); - t2s(WriteDiscard); - default: - FALCOR_UNREACHABLE(); - return ""; - } -#undef t2s -} } // namespace Falcor diff --git a/Source/Falcor/Core/API/CopyContext.cpp b/Source/Falcor/Core/API/CopyContext.cpp index 25f5d5b83..92bac4c1e 100644 --- a/Source/Falcor/Core/API/CopyContext.cpp +++ b/Source/Falcor/Core/API/CopyContext.cpp @@ -383,7 +383,7 @@ void CopyContext::ReadTextureTask::getData(void* pData, size_t size) const mpFence->wait(); uint8_t* pDst = reinterpret_cast(pData); - const uint8_t* pSrc = reinterpret_cast(mpBuffer->map(Buffer::MapType::Read)); + const uint8_t* pSrc = reinterpret_cast(mpBuffer->map()); for (uint32_t z = 0; z < mDepth; z++) { diff --git a/Source/Falcor/Core/API/GpuTimer.cpp b/Source/Falcor/Core/API/GpuTimer.cpp index 6e829f05a..f10ed075d 100644 --- a/Source/Falcor/Core/API/GpuTimer.cpp +++ b/Source/Falcor/Core/API/GpuTimer.cpp @@ -154,7 +154,7 @@ double GpuTimer::getElapsedTime() if (mDataPending) { uint64_t result[2]; - uint64_t* pRes = (uint64_t*)mpResolveStagingBuffer->map(Buffer::MapType::Read); + uint64_t* pRes = (uint64_t*)mpResolveStagingBuffer->map(); result[0] = pRes[0]; result[1] = pRes[1]; mpResolveStagingBuffer->unmap(); diff --git a/Source/Falcor/Core/API/RenderContext.cpp b/Source/Falcor/Core/API/RenderContext.cpp index 34bf1fafb..a473eba40 100644 --- a/Source/Falcor/Core/API/RenderContext.cpp +++ b/Source/Falcor/Core/API/RenderContext.cpp @@ -544,6 +544,10 @@ void RenderContext::raytrace(Program* pProgram, RtProgramVars* pVars, uint32_t w void RenderContext::resolveSubresource(const ref& pSrc, uint32_t srcSubresource, const ref& pDst, uint32_t dstSubresource) { + // TODO it would be better to just use barriers on the subresources. + resourceBarrier(pSrc.get(), Resource::State::ResolveSource); + resourceBarrier(pDst.get(), Resource::State::ResolveDest); + auto resourceEncoder = getLowLevelData()->getResourceCommandEncoder(); gfx::SubresourceRange srcRange = {}; srcRange.baseArrayLayer = pSrc->getSubresourceArraySlice(srcSubresource); @@ -570,13 +574,27 @@ void RenderContext::resolveSubresource(const ref& pSrc, uint32_t srcSub void RenderContext::resolveResource(const ref& pSrc, const ref& pDst) { + FALCOR_CHECK(pSrc->getType() == Resource::Type::Texture2DMultisample, "Source texture must be multi-sampled."); + FALCOR_CHECK(pDst->getType() == Resource::Type::Texture2D, "Destination texture must not be multi-sampled."); + FALCOR_CHECK(pSrc->getFormat() == pDst->getFormat(), "Source and destination textures must have the same format."); + FALCOR_CHECK( + pSrc->getWidth() == pDst->getWidth() && pSrc->getHeight() == pDst->getHeight(), + "Source and destination textures must have the same dimensions." + ); + FALCOR_CHECK(pSrc->getArraySize() == pDst->getArraySize(), "Source and destination textures must have the same array size."); + FALCOR_CHECK(pSrc->getMipCount() == pDst->getMipCount(), "Source and destination textures must have the same mip count."); + resourceBarrier(pSrc.get(), Resource::State::ResolveSource); resourceBarrier(pDst.get(), Resource::State::ResolveDest); auto resourceEncoder = getLowLevelData()->getResourceCommandEncoder(); gfx::SubresourceRange srcRange = {}; + srcRange.layerCount = pSrc->getArraySize(); + srcRange.mipLevelCount = pSrc->getMipCount(); gfx::SubresourceRange dstRange = {}; + dstRange.layerCount = pDst->getArraySize(); + dstRange.mipLevelCount = pDst->getMipCount(); resourceEncoder->resolveResource( pSrc->getGfxTextureResource(), diff --git a/Source/Falcor/Rendering/Materials/BSDFIntegrator.cpp b/Source/Falcor/Rendering/Materials/BSDFIntegrator.cpp index badd44be4..2ee1150ef 100644 --- a/Source/Falcor/Rendering/Materials/BSDFIntegrator.cpp +++ b/Source/Falcor/Rendering/Materials/BSDFIntegrator.cpp @@ -129,7 +129,7 @@ namespace Falcor pRenderContext->submit(true); // Read back final results. - const float3* finalResults = reinterpret_cast(mpStagingBuffer->map(Buffer::MapType::Read)); + const float3* finalResults = reinterpret_cast(mpStagingBuffer->map()); std::vector output(finalResults, finalResults + gridCount); mpStagingBuffer->unmap(); diff --git a/Source/Falcor/Rendering/Utils/PixelStats.cpp b/Source/Falcor/Rendering/Utils/PixelStats.cpp index 90264febb..66cf5883e 100644 --- a/Source/Falcor/Rendering/Utils/PixelStats.cpp +++ b/Source/Falcor/Rendering/Utils/PixelStats.cpp @@ -272,7 +272,7 @@ namespace Falcor if (mEnabled) { // Map the stats buffer. - const uint4* result = static_cast(mpReductionResult->map(Buffer::MapType::Read)); + const uint4* result = static_cast(mpReductionResult->map()); FALCOR_ASSERT(result); const uint32_t totalPathLength = result[kRayTypeCount].x; diff --git a/Source/Falcor/Scene/Lights/LightCollection.cpp b/Source/Falcor/Scene/Lights/LightCollection.cpp index c13a53280..aac81b3a4 100644 --- a/Source/Falcor/Scene/Lights/LightCollection.cpp +++ b/Source/Falcor/Scene/Lights/LightCollection.cpp @@ -660,7 +660,7 @@ namespace Falcor FALCOR_ASSERT(mStagingBufferValid); FALCOR_ASSERT(mpTriangleData && mpFluxData); - const void* mappedData = mpStagingBuffer->map(Buffer::MapType::Read); + const void* mappedData = mpStagingBuffer->map(); uint64_t offset = 0; const PackedEmissiveTriangle* triangleData = reinterpret_cast(reinterpret_cast(mappedData) + offset); diff --git a/Source/Falcor/Scene/Material/MaterialSystem.cpp b/Source/Falcor/Scene/Material/MaterialSystem.cpp index 14000540a..00645005a 100644 --- a/Source/Falcor/Scene/Material/MaterialSystem.cpp +++ b/Source/Falcor/Scene/Material/MaterialSystem.cpp @@ -391,7 +391,7 @@ namespace Falcor // Wait for results to become available. Then optimize the materials. mpFence->wait(); - const TextureAnalyzer::Result* results = static_cast(pResultsStaging->map(Buffer::MapType::Read)); + const TextureAnalyzer::Result* results = static_cast(pResultsStaging->map()); Material::TextureOptimizationStats stats = {}; for (size_t i = 0; i < textures.size(); i++) diff --git a/Source/Falcor/Scene/SDFs/SparseBrickSet/SDFSBS.cpp b/Source/Falcor/Scene/SDFs/SparseBrickSet/SDFSBS.cpp index d4d4961bf..2f40e573c 100644 --- a/Source/Falcor/Scene/SDFs/SparseBrickSet/SDFSBS.cpp +++ b/Source/Falcor/Scene/SDFs/SparseBrickSet/SDFSBS.cpp @@ -1019,7 +1019,7 @@ namespace Falcor pRenderContext->submit(true); // Read back final results. - uint32_t finalResults = *reinterpret_cast(mpCountStagingBuffer->map(Buffer::MapType::Read)); + uint32_t finalResults = *reinterpret_cast(mpCountStagingBuffer->map()); mpCountStagingBuffer->unmap(); return finalResults; } diff --git a/Source/Falcor/Scene/SDFs/SparseVoxelOctree/SDFSVO.cpp b/Source/Falcor/Scene/SDFs/SparseVoxelOctree/SDFSVO.cpp index 1d18c679b..fbab9bbe5 100644 --- a/Source/Falcor/Scene/SDFs/SparseVoxelOctree/SDFSVO.cpp +++ b/Source/Falcor/Scene/SDFs/SparseVoxelOctree/SDFSVO.cpp @@ -144,7 +144,7 @@ namespace Falcor // Copy surface containing voxels count from staging buffer to CPU. mpReadbackFence->wait(); - const uint32_t* pSurfaceContainingVoxels = reinterpret_cast(mpSurfaceVoxelCounterStagingBuffer->map(Buffer::MapType::Read)); + const uint32_t* pSurfaceContainingVoxels = reinterpret_cast(mpSurfaceVoxelCounterStagingBuffer->map()); std::memcpy(&finestLevelVoxelCount, pSurfaceContainingVoxels, sizeof(uint32_t)); mpSurfaceVoxelCounterStagingBuffer->unmap(); } @@ -310,7 +310,7 @@ namespace Falcor // Copy child count from staging buffer to CPU. mpReadbackFence->wait(); - const uint32_t* pVoxelCountPerLevel = reinterpret_cast(mpVoxelCountPerLevelStagingBuffer->map(Buffer::MapType::Read)); + const uint32_t* pVoxelCountPerLevel = reinterpret_cast(mpVoxelCountPerLevelStagingBuffer->map()); std::memcpy(voxelCountsPerLevel.data(), pVoxelCountPerLevel, sizeof(uint32_t) * (mLevelCount - 1)); mpVoxelCountPerLevelStagingBuffer->unmap(); diff --git a/Source/Falcor/Utils/Debug/PixelDebug.cpp b/Source/Falcor/Utils/Debug/PixelDebug.cpp index 00586a65a..63f1710b6 100644 --- a/Source/Falcor/Utils/Debug/PixelDebug.cpp +++ b/Source/Falcor/Utils/Debug/PixelDebug.cpp @@ -258,7 +258,7 @@ bool PixelDebug::copyDataToCPU() if (mEnabled) { // Copy data from readback buffer to CPU buffers. - const uint8_t* data = reinterpret_cast(mpReadbackBuffer->map(Buffer::MapType::Read)); + const uint8_t* data = reinterpret_cast(mpReadbackBuffer->map()); const uint32_t* counterData = reinterpret_cast(data); data += mpCounterBuffer->getSize(); const PrintRecord* printData = reinterpret_cast(data); diff --git a/Source/Falcor/Utils/Debug/WarpProfiler.cpp b/Source/Falcor/Utils/Debug/WarpProfiler.cpp index db06c594d..110c62cca 100644 --- a/Source/Falcor/Utils/Debug/WarpProfiler.cpp +++ b/Source/Falcor/Utils/Debug/WarpProfiler.cpp @@ -124,7 +124,7 @@ void WarpProfiler::readBackData() mpFence->wait(); mHistograms.resize(mBinCount * kWarpSize); - const uint32_t* data = reinterpret_cast(mpHistogramStagingBuffer->map(Buffer::MapType::Read)); + const uint32_t* data = reinterpret_cast(mpHistogramStagingBuffer->map()); std::memcpy(mHistograms.data(), data, mHistograms.size() * sizeof(uint32_t)); mpHistogramStagingBuffer->unmap(); diff --git a/Source/Falcor/Utils/UI/Gui.cpp b/Source/Falcor/Utils/UI/Gui.cpp index 3871af88f..8f7be1c68 100644 --- a/Source/Falcor/Utils/UI/Gui.cpp +++ b/Source/Falcor/Utils/UI/Gui.cpp @@ -1267,8 +1267,8 @@ void Gui::render(RenderContext* pContext, const ref& pFbo, float elapsedTim mpWrapper->mpPipelineState->setVao(pVao); // Upload the data - ImDrawVert* pVerts = (ImDrawVert*)pVao->getVertexBuffer(0)->map(Buffer::MapType::Write); - uint16_t* pIndices = (uint16_t*)pVao->getIndexBuffer()->map(Buffer::MapType::Write); + ImDrawVert* pVerts = (ImDrawVert*)pVao->getVertexBuffer(0)->map(); + uint16_t* pIndices = (uint16_t*)pVao->getIndexBuffer()->map(); for (int n = 0; n < pDrawData->CmdListsCount; n++) { diff --git a/Source/Falcor/Utils/UI/TextRenderer.cpp b/Source/Falcor/Utils/UI/TextRenderer.cpp index 592f8c152..3b14680ab 100644 --- a/Source/Falcor/Utils/UI/TextRenderer.cpp +++ b/Source/Falcor/Utils/UI/TextRenderer.cpp @@ -150,7 +150,7 @@ void TextRenderer::renderText(RenderContext* pRenderContext, const std::string& setCbData(pDstFbo); const auto& pVao = mpVaos[mVaoIndex]; const auto& pVb = pVao->getVertexBuffer(0); - Vertex* verts = reinterpret_cast(pVb->map(Buffer::MapType::Write)); + Vertex* verts = reinterpret_cast(pVb->map()); float startX = pos.x; uint32_t vertexCount = 0; // Not the same as text.size(), since some special characters are ignored diff --git a/Source/RenderPasses/BSDFViewer/BSDFViewer.cpp b/Source/RenderPasses/BSDFViewer/BSDFViewer.cpp index 461b02d94..cfb1522d6 100644 --- a/Source/RenderPasses/BSDFViewer/BSDFViewer.cpp +++ b/Source/RenderPasses/BSDFViewer/BSDFViewer.cpp @@ -244,7 +244,7 @@ void BSDFViewer::readPixelData() { mpFence->wait(); FALCOR_ASSERT(mpPixelStagingBuffer); - mPixelData = *static_cast(mpPixelStagingBuffer->map(Buffer::MapType::Read)); + mPixelData = *static_cast(mpPixelStagingBuffer->map()); mpPixelStagingBuffer->unmap(); mPixelDataAvailable = false; diff --git a/Source/RenderPasses/DebugPasses/ColorMapPass/ColorMapPass.cpp b/Source/RenderPasses/DebugPasses/ColorMapPass/ColorMapPass.cpp index e916cd30d..2cff3a92e 100644 --- a/Source/RenderPasses/DebugPasses/ColorMapPass/ColorMapPass.cpp +++ b/Source/RenderPasses/DebugPasses/ColorMapPass/ColorMapPass.cpp @@ -189,7 +189,7 @@ std::optional> ColorMapPass::AutoRanging::getMinMax( { mpFence->wait(); - const void* values = mpReductionResult->map(Buffer::MapType::Read); + const void* values = mpReductionResult->map(); switch (formatType) { diff --git a/Source/RenderPasses/SDFEditor/SDFEditor.cpp b/Source/RenderPasses/SDFEditor/SDFEditor.cpp index 8569945ac..2b751798f 100644 --- a/Source/RenderPasses/SDFEditor/SDFEditor.cpp +++ b/Source/RenderPasses/SDFEditor/SDFEditor.cpp @@ -1233,7 +1233,7 @@ void SDFEditor::execute(RenderContext* pRenderContext, const RenderData& renderD // Wait for the picking info from the previous frame. mpReadbackFence->wait(); - mPickingInfo = *reinterpret_cast(mpPickingInfoReadBack->map(Buffer::MapType::Read)); + mPickingInfo = *reinterpret_cast(mpPickingInfoReadBack->map()); mpPickingInfoReadBack->unmap(); setup2DGUI(); diff --git a/Source/RenderPasses/TestPasses/TestPyTorchPass.cpp b/Source/RenderPasses/TestPasses/TestPyTorchPass.cpp index bcf1faa4c..bbd555422 100644 --- a/Source/RenderPasses/TestPasses/TestPyTorchPass.cpp +++ b/Source/RenderPasses/TestPasses/TestPyTorchPass.cpp @@ -222,7 +222,7 @@ bool TestPyTorchPass::verifyData(const uint3 dim, const uint32_t offset, TestPyT // Wait for results to be available. pRenderContext->submit(true); - const uint32_t counter = *reinterpret_cast(mpCounterStagingBuffer->map(Buffer::MapType::Read)); + const uint32_t counter = *reinterpret_cast(mpCounterStagingBuffer->map()); mpCounterStagingBuffer->unmap(); FALCOR_ASSERT(counter <= elemCount); diff --git a/Source/Samples/MultiSampling/MultiSampling.cpp b/Source/Samples/MultiSampling/MultiSampling.cpp index 5f3d90f8f..60ea3095c 100644 --- a/Source/Samples/MultiSampling/MultiSampling.cpp +++ b/Source/Samples/MultiSampling/MultiSampling.cpp @@ -73,6 +73,8 @@ void MultiSampling::onLoad(RenderContext* pRenderContext) 128, 128, ResourceFormat::RGBA32Float, kSampleCount, 1, ResourceBindFlags::ShaderResource | ResourceBindFlags::RenderTarget ); mpFbo->attachColorTarget(tex, 0); + + mpResolvedTexture = getDevice()->createTexture2D(128, 128, ResourceFormat::RGBA32Float, 1, 1); } void MultiSampling::onFrameRender(RenderContext* pRenderContext, const ref& pTargetFbo) @@ -83,7 +85,17 @@ void MultiSampling::onFrameRender(RenderContext* pRenderContext, const ref& mpRasterPass->getState()->setVao(mpVao); mpRasterPass->draw(pRenderContext, kTriangleCount * 3, 0); - pRenderContext->blit(mpFbo->getColorTexture(0)->getSRV(), pTargetFbo->getRenderTargetView(0)); + if (mFrame++ % 2 == 0) + { + // For even frames, resolve to texture and then blit. + pRenderContext->resolveResource(mpFbo->getColorTexture(0), mpResolvedTexture); + pRenderContext->blit(mpResolvedTexture->getSRV(), pTargetFbo->getRenderTargetView(0)); + } + else + { + // For odd frames, blit directly. + pRenderContext->blit(mpFbo->getColorTexture(0)->getSRV(), pTargetFbo->getRenderTargetView(0)); + } } int runMain(int argc, char** argv) diff --git a/Source/Samples/MultiSampling/MultiSampling.h b/Source/Samples/MultiSampling/MultiSampling.h index f00e85433..19173cfe0 100644 --- a/Source/Samples/MultiSampling/MultiSampling.h +++ b/Source/Samples/MultiSampling/MultiSampling.h @@ -45,4 +45,6 @@ class MultiSampling : public SampleApp ref mpRasterPass; ref mpVao; ref mpFbo; + ref mpResolvedTexture; + uint32_t mFrame = 0; }; diff --git a/Source/Tools/FalcorTest/Tests/Core/BufferAccessTests.cpp b/Source/Tools/FalcorTest/Tests/Core/BufferAccessTests.cpp index 2d09f1107..f0993ca98 100644 --- a/Source/Tools/FalcorTest/Tests/Core/BufferAccessTests.cpp +++ b/Source/Tools/FalcorTest/Tests/Core/BufferAccessTests.cpp @@ -128,7 +128,7 @@ GPU_TEST(BufferUploadWrite) GPU_TEST(BufferUploadMap) { ref pBuffer = createTestBuffer(ctx, MemoryType::Upload, false); - uint32_t* pData = reinterpret_cast(pBuffer->map(Buffer::MapType::Write)); + uint32_t* pData = reinterpret_cast(pBuffer->map()); for (uint32_t i = 0; i < kElementCount; ++i) pData[i] = kTestData[i]; pBuffer->unmap(); @@ -150,7 +150,7 @@ GPU_TEST(BufferReadbackMap) ref pBuffer = createTestBuffer(ctx, MemoryType::ReadBack, false); initBufferIndirect(ctx, pBuffer); - const uint32_t* pData = reinterpret_cast(pBuffer->map(Buffer::MapType::Read)); + const uint32_t* pData = reinterpret_cast(pBuffer->map()); checkData(ctx, pData); pBuffer->unmap(); } diff --git a/Source/Tools/FalcorTest/Tests/Core/BufferTests.cpp b/Source/Tools/FalcorTest/Tests/Core/BufferTests.cpp index a14aeca08..55eb25b72 100644 --- a/Source/Tools/FalcorTest/Tests/Core/BufferTests.cpp +++ b/Source/Tools/FalcorTest/Tests/Core/BufferTests.cpp @@ -188,7 +188,7 @@ GPU_TEST(BufferWrite) if (!useInitData) { - uint4* data = reinterpret_cast(bufA->map(Buffer::MapType::Write)); + uint4* data = reinterpret_cast(bufA->map()); std::memcpy(data, &testData, 16); bufA->unmap(); } @@ -203,7 +203,7 @@ GPU_TEST(BufferWrite) uint4 testData2 = testData * 10u; { - uint4* data = reinterpret_cast(bufA->map(Buffer::MapType::Write)); + uint4* data = reinterpret_cast(bufA->map()); std::memcpy(data, &testData2, 16); bufA->unmap(); } diff --git a/Source/Tools/FalcorTest/Tests/Core/CoreTests.cpp b/Source/Tools/FalcorTest/Tests/Core/CoreTests.cpp index d4e315b51..8eb6bdf96 100644 --- a/Source/Tools/FalcorTest/Tests/Core/CoreTests.cpp +++ b/Source/Tools/FalcorTest/Tests/Core/CoreTests.cpp @@ -50,7 +50,7 @@ GPU_TEST(TransientHeapRecycling) // is missed. pRenderContext->copyBufferRegion(B.get(), 0, A.get(), 0, 4); pRenderContext->submit(true); - // A->map(Buffer::MapType::Read); + // A->map(); // A->unmap(); } } // namespace Falcor diff --git a/Source/Tools/FalcorTest/Tests/Core/LargeBuffer.cpp b/Source/Tools/FalcorTest/Tests/Core/LargeBuffer.cpp index 9a83e7769..4960a36cf 100644 --- a/Source/Tools/FalcorTest/Tests/Core/LargeBuffer.cpp +++ b/Source/Tools/FalcorTest/Tests/Core/LargeBuffer.cpp @@ -81,7 +81,7 @@ void testCopyRegion(GPUUnitTestContext& ctx, size_t bufferSize) ctx.getRenderContext()->submit(true); // Check the result. - const uint32_t* result = static_cast(pReadback->map(Buffer::MapType::Read)); + const uint32_t* result = static_cast(pReadback->map()); for (size_t i = 0; i < data.size(); i++) { EXPECT_EQ(result[i], data[i]) << "i = " << i;