OpenGL: Refactor integration test and enable CTest framework
- Simplify OpenGL integration test structure - Enable CTest registration for OpenGL tests - Refactor test fixtures and device enumeration - Minor code cleanup and improvements
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include "../RHIBuffer.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace XCEngine {
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include "../RHIDevice.h"
|
||||
#include "../RHICapabilities.h"
|
||||
|
||||
struct HWND__;
|
||||
struct HDC__;
|
||||
struct HGLRC__;
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
using HWND = HWND__*;
|
||||
using HDC = HDC__*;
|
||||
using HGLRC = HGLRC__*;
|
||||
|
||||
class OpenGLDevice : public RHIDevice {
|
||||
public:
|
||||
OpenGLDevice();
|
||||
@@ -18,9 +25,11 @@ public:
|
||||
void Shutdown() override;
|
||||
|
||||
bool CreateRenderWindow(int width, int height, const char* title, bool enableDebug = false);
|
||||
bool InitializeWithExistingWindow(GLFWwindow* window);
|
||||
bool InitializeWithExistingWindow(HWND hwnd);
|
||||
|
||||
GLFWwindow* GetWindow() const { return m_window; }
|
||||
HWND GetWindow() const { return m_hwnd; }
|
||||
HDC GetDC() const { return m_hdc; }
|
||||
HGLRC GetContext() const { return m_hglrc; }
|
||||
const RHIDeviceInfo& GetDeviceInfoImpl() const { return m_deviceInfo; }
|
||||
|
||||
void SwapBuffers();
|
||||
@@ -45,12 +54,15 @@ public:
|
||||
void* GetNativeHandle() const;
|
||||
|
||||
private:
|
||||
GLFWwindow* m_window;
|
||||
HWND m_hwnd;
|
||||
HDC m_hdc;
|
||||
HGLRC m_hglrc;
|
||||
RHIDeviceInfo m_deviceInfo;
|
||||
RHICapabilities m_capabilities;
|
||||
bool m_initialized;
|
||||
bool m_ownsWindow;
|
||||
bool m_shouldClose;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
} // namespace XCEngine
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <cstdint>
|
||||
|
||||
#include "../RHIFence.h"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include "../RHISampler.h"
|
||||
#include "../RHITypes.h"
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <vector>
|
||||
|
||||
#include "../RHIShader.h"
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <cstdint>
|
||||
|
||||
#include "../RHISwapChain.h"
|
||||
|
||||
struct HWND__;
|
||||
struct HDC__;
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
using HWND = HWND__*;
|
||||
using HDC = HDC__*;
|
||||
|
||||
enum class PresentMode {
|
||||
Immediate,
|
||||
VSync,
|
||||
@@ -27,8 +32,8 @@ public:
|
||||
OpenGLSwapChain();
|
||||
~OpenGLSwapChain() override;
|
||||
|
||||
bool Initialize(GLFWwindow* window, bool vsync = true);
|
||||
bool Initialize(GLFWwindow* window, int width, int height, PresentMode mode = PresentMode::VSync);
|
||||
bool Initialize(HWND window, bool vsync = true);
|
||||
bool Initialize(HWND window, int width, int height, PresentMode mode = PresentMode::VSync);
|
||||
void Shutdown() override;
|
||||
|
||||
void Present(uint32_t syncInterval = 1, uint32_t flags = 0) override;
|
||||
@@ -45,7 +50,8 @@ public:
|
||||
int GetFramebufferWidth() const { return m_framebufferWidth; }
|
||||
int GetFramebufferHeight() const { return m_framebufferHeight; }
|
||||
|
||||
GLFWwindow* GetWindow() const { return m_window; }
|
||||
HWND GetWindow() const { return m_hwnd; }
|
||||
HDC GetDC() const { return m_hdc; }
|
||||
|
||||
bool ShouldClose() const override;
|
||||
void SetShouldClose(bool shouldClose) override;
|
||||
@@ -56,14 +62,16 @@ public:
|
||||
void* GetNativeHandle() override;
|
||||
|
||||
private:
|
||||
GLFWwindow* m_window;
|
||||
HWND m_hwnd;
|
||||
HDC m_hdc;
|
||||
int m_width;
|
||||
int m_height;
|
||||
int m_framebufferWidth;
|
||||
int m_framebufferHeight;
|
||||
bool m_vsync;
|
||||
bool m_shouldClose;
|
||||
PresentMode m_presentMode;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
} // namespace XCEngine
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <vector>
|
||||
|
||||
#include "../RHITexture.h"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine {
|
||||
|
||||
Reference in New Issue
Block a user