chore: sync workspace state
This commit is contained in:
@@ -82,6 +82,17 @@ LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
bool InitializeUploadBuffer(D3D12Buffer& buffer, ID3D12Device* device, const void* data, uint64_t size, uint32_t stride, BufferType type) {
|
||||
if (!buffer.Initialize(device, size, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_HEAP_TYPE_UPLOAD)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
buffer.SetData(data, static_cast<size_t>(size));
|
||||
buffer.SetStride(stride);
|
||||
buffer.SetBufferType(type);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InitD3D12() {
|
||||
RHIDeviceDesc deviceDesc;
|
||||
deviceDesc.adapterIndex = 0;
|
||||
@@ -197,12 +208,10 @@ bool InitD3D12() {
|
||||
{ { 0.5f, -0.5f, 0.0f, 1.0f }, { 0.0f, 0.0f, 1.0f, 1.0f } },
|
||||
};
|
||||
|
||||
if (!gVertexBuffer.InitializeWithData(device, gCommandList.GetCommandList(), vertices, sizeof(vertices), D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER)) {
|
||||
if (!InitializeUploadBuffer(gVertexBuffer, device, vertices, sizeof(vertices), sizeof(Vertex), BufferType::Vertex)) {
|
||||
Log("[ERROR] Failed to initialize vertex buffer");
|
||||
return false;
|
||||
}
|
||||
gVertexBuffer.SetStride(sizeof(Vertex));
|
||||
gVertexBuffer.SetBufferType(BufferType::Vertex);
|
||||
|
||||
Log("[INFO] D3D12 initialized successfully");
|
||||
return true;
|
||||
@@ -323,10 +332,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
frameCount++;
|
||||
|
||||
if (frameCount >= targetFrameCount) {
|
||||
Log("[INFO] Reached target frame count %d - taking screenshot!", targetFrameCount);
|
||||
ExecuteCommandList();
|
||||
if (RenderDocCapture::Get().EndCapture()) {
|
||||
Log("[INFO] RenderDoc capture ended");
|
||||
}
|
||||
Log("[INFO] Reached target frame count %d - taking screenshot!", targetFrameCount);
|
||||
WaitForGPU();
|
||||
Log("[INFO] GPU idle, taking screenshot...");
|
||||
bool screenshotResult = D3D12Screenshot::Capture(
|
||||
@@ -365,4 +375,4 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
|
||||
Log("[INFO] D3D12 Triangle Test Finished");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user