Files
XCEngine/tests/RHI/D3D12/unit/test_pipeline_state.cpp
ssdfasd f427699ac6 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

42 lines
1.3 KiB
C++

#include "fixtures/D3D12TestFixture.h"
#include <cstring>
using namespace XCEngine::RHI;
TEST_F(D3D12TestFixture, PipelineState_Get_GraphicsPipelineDescDefaults) {
D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {};
psoDesc.InputLayout = {};
psoDesc.pRootSignature = nullptr;
psoDesc.VS = {};
psoDesc.PS = {};
psoDesc.DS = {};
psoDesc.HS = {};
psoDesc.GS = {};
psoDesc.StreamOutput = {};
psoDesc.BlendState = {};
psoDesc.SampleMask = UINT_MAX;
psoDesc.RasterizerState = {};
psoDesc.DepthStencilState = {};
psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
psoDesc.NumRenderTargets = 1;
psoDesc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
psoDesc.DSVFormat = DXGI_FORMAT_D32_FLOAT;
psoDesc.SampleDesc.Count = 1;
psoDesc.SampleDesc.Quality = 0;
EXPECT_EQ(psoDesc.PrimitiveTopologyType, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE);
EXPECT_EQ(psoDesc.NumRenderTargets, 1);
}
TEST_F(D3D12TestFixture, PipelineState_Get_ComputePipelineDescDefaults) {
D3D12_COMPUTE_PIPELINE_STATE_DESC psoDesc = {};
psoDesc.pRootSignature = nullptr;
psoDesc.CS = {};
psoDesc.NodeMask = 0;
psoDesc.CachedPSO = {};
psoDesc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE;
EXPECT_EQ(psoDesc.NodeMask, 0);
EXPECT_EQ(psoDesc.Flags, D3D12_PIPELINE_STATE_FLAG_NONE);
}