Fix OpenGL device initialization and file shaders
This commit is contained in:
@@ -11,21 +11,48 @@ TEST_P(RHITestFixture, Device_Initialize_Shutdown) {
|
||||
RHIDevice* device = RHIFactory::CreateRHIDevice(GetBackendType());
|
||||
ASSERT_NE(device, nullptr);
|
||||
|
||||
bool initResult = false;
|
||||
if (GetBackendType() == RHIType::D3D12) {
|
||||
RHIDeviceDesc desc = {};
|
||||
desc.enableDebugLayer = true;
|
||||
initResult = device->Initialize(desc);
|
||||
} else if (GetBackendType() == RHIType::OpenGL) {
|
||||
auto* oglDevice = static_cast<OpenGLDevice*>(device);
|
||||
initResult = oglDevice->InitializeWithExistingWindow(GetWindowHandle());
|
||||
}
|
||||
RHIDeviceDesc desc = {};
|
||||
desc.enableDebugLayer = true;
|
||||
const bool initResult = device->Initialize(desc);
|
||||
ASSERT_TRUE(initResult);
|
||||
|
||||
device->Shutdown();
|
||||
delete device;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, Device_Initialize_OpenGLUnifiedPath_CanCreateSwapChain) {
|
||||
if (GetBackendType() != RHIType::OpenGL) {
|
||||
GTEST_SKIP() << "OpenGL-specific unified initialization verification";
|
||||
}
|
||||
|
||||
auto* device = new OpenGLDevice();
|
||||
ASSERT_NE(device, nullptr);
|
||||
|
||||
RHIDeviceDesc deviceDesc = {};
|
||||
ASSERT_TRUE(device->Initialize(deviceDesc));
|
||||
|
||||
CommandQueueDesc queueDesc = {};
|
||||
queueDesc.queueType = static_cast<uint32_t>(CommandQueueType::Direct);
|
||||
RHICommandQueue* queue = device->CreateCommandQueue(queueDesc);
|
||||
ASSERT_NE(queue, nullptr);
|
||||
|
||||
SwapChainDesc swapDesc = {};
|
||||
swapDesc.windowHandle = GetWindowHandle();
|
||||
swapDesc.width = 320;
|
||||
swapDesc.height = 180;
|
||||
RHISwapChain* swapChain = device->CreateSwapChain(swapDesc, queue);
|
||||
ASSERT_NE(swapChain, nullptr);
|
||||
|
||||
swapChain->Present(0, 0);
|
||||
|
||||
swapChain->Shutdown();
|
||||
delete swapChain;
|
||||
queue->Shutdown();
|
||||
delete queue;
|
||||
device->Shutdown();
|
||||
delete device;
|
||||
}
|
||||
|
||||
TEST_P(RHITestFixture, Device_GetCapabilities_ReturnsValid) {
|
||||
const auto& caps = GetDevice()->GetCapabilities();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user