1. Add ALLOW_RENDER_TARGET flag for color textures in CreateTexture - This was the root cause of 5 failing RTV-related tests - Without this flag, creating RTV caused device removal 2. Add FromD3D12() reverse conversion for Format enum - GetFormat() was incorrectly casting DXGI_FORMAT to Format - DXGI_FORMAT_R8G8B8A8_UNORM=28 but Format::R8G8B8A8_UNorm=3 - Added FromD3D12() to properly convert back 3. Update RHITestFixture to pre-create CommandQueue and Fence - Prevents potential timing issues with GPU synchronization 4. Update RHITestFixture tests to pass correct format in ResourceViewDesc - Previously passed empty desc.format=0 which caused issues All 234 RHI unit tests now pass (117 D3D12 + 117 OpenGL)
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <gtest/gtest.h>
|
|
#include <string>
|
|
#include <windows.h>
|
|
|
|
#include "XCEngine/RHI/RHIFactory.h"
|
|
#include "XCEngine/RHI/RHIDevice.h"
|
|
#include "XCEngine/RHI/RHICommandQueue.h"
|
|
#include "XCEngine/RHI/RHICommandList.h"
|
|
#include "XCEngine/RHI/RHIBuffer.h"
|
|
#include "XCEngine/RHI/RHITexture.h"
|
|
#include "XCEngine/RHI/RHISwapChain.h"
|
|
#include "XCEngine/RHI/RHIShader.h"
|
|
#include "XCEngine/RHI/RHIFence.h"
|
|
#include "XCEngine/RHI/RHISampler.h"
|
|
#include "XCEngine/RHI/RHIDescriptorPool.h"
|
|
#include "XCEngine/RHI/RHIPipelineLayout.h"
|
|
#include "XCEngine/RHI/RHIEnums.h"
|
|
|
|
namespace XCEngine {
|
|
namespace RHI {
|
|
|
|
class RHITestFixture : public ::testing::TestWithParam<RHIType> {
|
|
protected:
|
|
void SetUp() override;
|
|
void TearDown() override;
|
|
|
|
static void SetUpTestSuite();
|
|
static void TearDownTestSuite();
|
|
void WaitForGPU();
|
|
|
|
RHIDevice* GetDevice() { return mDevice; }
|
|
RHIType GetBackendType() const { return GetParam(); }
|
|
HWND GetWindowHandle() const { return mWindow; }
|
|
|
|
private:
|
|
RHIDevice* mDevice = nullptr;
|
|
HWND mWindow = nullptr;
|
|
RHICommandQueue* mCommandQueue = nullptr;
|
|
RHIFence* mFence = nullptr;
|
|
uint64_t mFenceValue = 0;
|
|
};
|
|
|
|
} // namespace RHI
|
|
} // namespace XCEngine
|