| 48 | {} |
| 49 | |
| 50 | void PixelDebug::beginFrame(RenderContext* pRenderContext, const uint2& frameDim) |
| 51 | { |
| 52 | FALCOR_CHECK(!mRunning, "Logging is already running, did you forget to call endFrame()?"); |
| 53 | |
| 54 | mFrameDim = frameDim; |
| 55 | mRunning = true; |
| 56 | |
| 57 | // Reset previous data. |
| 58 | mPrintData.clear(); |
| 59 | mAssertData.clear(); |
| 60 | mDataValid = false; |
| 61 | mWaitingForData = false; |
| 62 | |
| 63 | if (mEnabled) |
| 64 | { |
| 65 | // Prepare buffers. |
| 66 | if (!mpPrintBuffer) |
| 67 | { |
| 68 | // Allocate GPU buffers. |
| 69 | const ref<Device>& pDevice = pRenderContext->getDevice(); |
| 70 | mpCounterBuffer = pDevice->createBuffer(sizeof(uint32_t) * 2); |
| 71 | mpPrintBuffer = pDevice->createStructuredBuffer(sizeof(PrintRecord), mPrintCapacity); |
| 72 | mpAssertBuffer = pDevice->createStructuredBuffer(sizeof(AssertRecord), mAssertCapacity); |
| 73 | |
| 74 | // Allocate readback buffer. This buffer is shared for copying all the above buffers to the CPU |
| 75 | mpReadbackBuffer = pDevice->createBuffer( |
| 76 | mpCounterBuffer->getSize() + mpPrintBuffer->getSize() + mpAssertBuffer->getSize(), |
| 77 | ResourceBindFlags::None, |
| 78 | MemoryType::ReadBack |
| 79 | ); |
| 80 | } |
| 81 | |
| 82 | pRenderContext->clearUAV(mpCounterBuffer->getUAV().get(), uint4(0)); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | void PixelDebug::endFrame(RenderContext* pRenderContext) |
| 87 | { |
nothing calls this directly
no test coverage detected