2026-03-17 02:51:34 +08:00
|
|
|
#include "fixtures/D3D12TestFixture.h"
|
refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
test discovery (math, core, containers, memory, threading, debug,
components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00
|
|
|
#include "XCEngine/RHI/RHIEnums.h"
|
|
|
|
|
#include "XCEngine/RHI/RHITexture.h"
|
|
|
|
|
|
|
|
|
|
using namespace XCEngine::RHI;
|
2026-03-17 02:51:34 +08:00
|
|
|
|
2026-03-20 03:18:30 +08:00
|
|
|
TEST_F(D3D12TestFixture, Texture_Create_2D) {
|
refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
test discovery (math, core, containers, memory, threading, debug,
components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00
|
|
|
TextureDesc desc = {};
|
|
|
|
|
desc.width = 256;
|
|
|
|
|
desc.height = 256;
|
|
|
|
|
desc.depth = 1;
|
|
|
|
|
desc.mipLevels = 1;
|
|
|
|
|
desc.arraySize = 1;
|
|
|
|
|
desc.format = static_cast<uint32_t>(Format::R8G8B8A8_UNorm);
|
|
|
|
|
desc.textureType = static_cast<uint32_t>(TextureType::Texture2D);
|
|
|
|
|
desc.sampleCount = 1;
|
|
|
|
|
desc.sampleQuality = 0;
|
|
|
|
|
desc.flags = 0;
|
|
|
|
|
|
|
|
|
|
RHITexture* texture = GetDevice()->CreateTexture(desc);
|
|
|
|
|
ASSERT_NE(texture, nullptr);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(texture->GetWidth(), 256);
|
|
|
|
|
EXPECT_EQ(texture->GetHeight(), 256);
|
|
|
|
|
EXPECT_EQ(texture->GetFormat(), Format::R8G8B8A8_UNorm);
|
|
|
|
|
|
|
|
|
|
texture->Shutdown();
|
|
|
|
|
delete texture;
|
2026-03-17 04:02:35 +08:00
|
|
|
}
|
|
|
|
|
|
2026-03-20 03:18:30 +08:00
|
|
|
TEST_F(D3D12TestFixture, Texture_Create_3D) {
|
refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
test discovery (math, core, containers, memory, threading, debug,
components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00
|
|
|
TextureDesc desc = {};
|
|
|
|
|
desc.width = 64;
|
|
|
|
|
desc.height = 64;
|
|
|
|
|
desc.depth = 64;
|
|
|
|
|
desc.mipLevels = 1;
|
|
|
|
|
desc.arraySize = 1;
|
|
|
|
|
desc.format = static_cast<uint32_t>(Format::R8G8B8A8_UNorm);
|
|
|
|
|
desc.textureType = static_cast<uint32_t>(TextureType::Texture3D);
|
|
|
|
|
desc.sampleCount = 1;
|
|
|
|
|
desc.sampleQuality = 0;
|
|
|
|
|
desc.flags = 0;
|
|
|
|
|
|
|
|
|
|
RHITexture* texture = GetDevice()->CreateTexture(desc);
|
|
|
|
|
ASSERT_NE(texture, nullptr);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(texture->GetDepth(), 64);
|
|
|
|
|
|
|
|
|
|
texture->Shutdown();
|
|
|
|
|
delete texture;
|
2026-03-17 04:02:35 +08:00
|
|
|
}
|
|
|
|
|
|
2026-03-20 03:18:30 +08:00
|
|
|
TEST_F(D3D12TestFixture, Texture_Create_MultipleMips) {
|
refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
test discovery (math, core, containers, memory, threading, debug,
components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00
|
|
|
TextureDesc desc = {};
|
|
|
|
|
desc.width = 512;
|
|
|
|
|
desc.height = 512;
|
|
|
|
|
desc.depth = 1;
|
|
|
|
|
desc.mipLevels = 5;
|
|
|
|
|
desc.arraySize = 1;
|
|
|
|
|
desc.format = static_cast<uint32_t>(Format::R8G8B8A8_UNorm);
|
|
|
|
|
desc.textureType = static_cast<uint32_t>(TextureType::Texture2D);
|
|
|
|
|
desc.sampleCount = 1;
|
|
|
|
|
desc.sampleQuality = 0;
|
|
|
|
|
desc.flags = 0;
|
|
|
|
|
|
|
|
|
|
RHITexture* texture = GetDevice()->CreateTexture(desc);
|
|
|
|
|
ASSERT_NE(texture, nullptr);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(texture->GetMipLevels(), 5);
|
|
|
|
|
|
|
|
|
|
texture->Shutdown();
|
|
|
|
|
delete texture;
|
2026-03-17 04:02:35 +08:00
|
|
|
}
|
|
|
|
|
|
2026-03-20 03:18:30 +08:00
|
|
|
TEST_F(D3D12TestFixture, Texture_Create_Array) {
|
refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
test discovery (math, core, containers, memory, threading, debug,
components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00
|
|
|
TextureDesc desc = {};
|
|
|
|
|
desc.width = 128;
|
|
|
|
|
desc.height = 128;
|
|
|
|
|
desc.depth = 1;
|
|
|
|
|
desc.mipLevels = 1;
|
|
|
|
|
desc.arraySize = 4;
|
|
|
|
|
desc.format = static_cast<uint32_t>(Format::R8G8B8A8_UNorm);
|
|
|
|
|
desc.textureType = static_cast<uint32_t>(TextureType::Texture2DArray);
|
|
|
|
|
desc.sampleCount = 1;
|
|
|
|
|
desc.sampleQuality = 0;
|
|
|
|
|
desc.flags = 0;
|
|
|
|
|
|
|
|
|
|
RHITexture* texture = GetDevice()->CreateTexture(desc);
|
|
|
|
|
ASSERT_NE(texture, nullptr);
|
|
|
|
|
|
|
|
|
|
texture->Shutdown();
|
|
|
|
|
delete texture;
|
|
|
|
|
}
|