545 lines
18 KiB
C++
545 lines
18 KiB
C++
#define NOMINMAX
|
|
#include <windows.h>
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "../RenderingIntegrationMain.h"
|
|
|
|
#include <XCEngine/Components/CameraComponent.h>
|
|
#include <XCEngine/Components/GameObject.h>
|
|
#include <XCEngine/Components/MeshFilterComponent.h>
|
|
#include <XCEngine/Components/MeshRendererComponent.h>
|
|
#include <XCEngine/Core/Asset/IResource.h>
|
|
#include <XCEngine/Core/Math/Color.h>
|
|
#include <XCEngine/Core/Math/Quaternion.h>
|
|
#include <XCEngine/Core/Math/Vector3.h>
|
|
#include <XCEngine/Core/Math/Vector4.h>
|
|
#include <XCEngine/Rendering/Execution/SceneRenderer.h>
|
|
#include <XCEngine/Rendering/RenderContext.h>
|
|
#include <XCEngine/Rendering/RenderSurface.h>
|
|
#include <XCEngine/Resources/BuiltinResources.h>
|
|
#include <XCEngine/Resources/Material/Material.h>
|
|
#include <XCEngine/Resources/Mesh/Mesh.h>
|
|
#include <XCEngine/Resources/Shader/Shader.h>
|
|
#include <XCEngine/Resources/Texture/Texture.h>
|
|
#include <XCEngine/Resources/Texture/TextureImportSettings.h>
|
|
#include <XCEngine/Resources/Texture/TextureLoader.h>
|
|
#include <XCEngine/RHI/RHITexture.h>
|
|
#include <XCEngine/Scene/Scene.h>
|
|
|
|
#include "../../../RHI/integration/fixtures/RHIIntegrationFixture.h"
|
|
|
|
#include <algorithm>
|
|
#include <cmath>
|
|
#include <filesystem>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
using namespace XCEngine::Components;
|
|
using namespace XCEngine::Math;
|
|
using namespace XCEngine::Rendering;
|
|
using namespace XCEngine::Resources;
|
|
using namespace XCEngine::RHI;
|
|
using namespace XCEngine::RHI::Integration;
|
|
|
|
namespace {
|
|
|
|
constexpr const char* kD3D12Screenshot = "skybox_scene_d3d12.ppm";
|
|
constexpr const char* kOpenGLScreenshot = "skybox_scene_opengl.ppm";
|
|
constexpr const char* kVulkanScreenshot = "skybox_scene_vulkan.ppm";
|
|
constexpr uint32_t kFrameWidth = 1280;
|
|
constexpr uint32_t kFrameHeight = 720;
|
|
constexpr uint32_t kSkyboxFaceSize = 256;
|
|
constexpr float kPi = 3.14159265358979323846f;
|
|
|
|
std::filesystem::path GetExecutableDirectory() {
|
|
char exePath[MAX_PATH] = {};
|
|
const DWORD length = GetModuleFileNameA(nullptr, exePath, MAX_PATH);
|
|
if (length == 0 || length >= MAX_PATH) {
|
|
return std::filesystem::current_path();
|
|
}
|
|
|
|
return std::filesystem::path(exePath).parent_path();
|
|
}
|
|
|
|
std::filesystem::path ResolveRuntimePath(const char* relativePath) {
|
|
return GetExecutableDirectory() / relativePath;
|
|
}
|
|
|
|
Vector3 ComputeCubemapDirection(uint32_t faceIndex, float s, float t) {
|
|
switch (faceIndex) {
|
|
case 0:
|
|
return Vector3(1.0f, -t, -s).Normalized();
|
|
case 1:
|
|
return Vector3(-1.0f, -t, s).Normalized();
|
|
case 2:
|
|
return Vector3(s, 1.0f, t).Normalized();
|
|
case 3:
|
|
return Vector3(s, -1.0f, -t).Normalized();
|
|
case 4:
|
|
return Vector3(s, -t, 1.0f).Normalized();
|
|
case 5:
|
|
default:
|
|
return Vector3(-s, -t, -1.0f).Normalized();
|
|
}
|
|
}
|
|
|
|
void SamplePanoramaNearest(
|
|
const Texture& panorama,
|
|
float u,
|
|
float v,
|
|
unsigned char outRgba[4]) {
|
|
const uint32_t width = panorama.GetWidth();
|
|
const uint32_t height = panorama.GetHeight();
|
|
const auto* pixels = static_cast<const unsigned char*>(panorama.GetPixelData());
|
|
if (pixels == nullptr || width == 0 || height == 0) {
|
|
outRgba[0] = 255;
|
|
outRgba[1] = 255;
|
|
outRgba[2] = 255;
|
|
outRgba[3] = 255;
|
|
return;
|
|
}
|
|
|
|
u = u - std::floor(u);
|
|
v = std::clamp(v, 0.0f, 1.0f);
|
|
|
|
const uint32_t x = std::min<uint32_t>(
|
|
static_cast<uint32_t>(u * static_cast<float>(width - 1) + 0.5f),
|
|
width - 1);
|
|
const uint32_t y = std::min<uint32_t>(
|
|
static_cast<uint32_t>(v * static_cast<float>(height - 1) + 0.5f),
|
|
height - 1);
|
|
const size_t pixelIndex = (static_cast<size_t>(y) * static_cast<size_t>(width) + x) * 4u;
|
|
outRgba[0] = pixels[pixelIndex + 0];
|
|
outRgba[1] = pixels[pixelIndex + 1];
|
|
outRgba[2] = pixels[pixelIndex + 2];
|
|
outRgba[3] = pixels[pixelIndex + 3];
|
|
}
|
|
|
|
Texture* CreateCubemapSkyboxTexture(const std::filesystem::path& panoramaPath) {
|
|
TextureLoader loader;
|
|
TextureImportSettings settings;
|
|
settings.SetSRGB(true);
|
|
|
|
LoadResult loadResult = loader.Load(panoramaPath.string().c_str(), &settings);
|
|
if (!loadResult || loadResult.resource == nullptr) {
|
|
return nullptr;
|
|
}
|
|
|
|
std::unique_ptr<Texture> panorama(static_cast<Texture*>(loadResult.resource));
|
|
if (!panorama || panorama->GetPixelData() == nullptr || panorama->GetWidth() == 0 || panorama->GetHeight() == 0) {
|
|
return nullptr;
|
|
}
|
|
|
|
auto* texture = new Texture();
|
|
IResource::ConstructParams params = {};
|
|
params.name = "SkyboxCubemapTexture";
|
|
params.path = "Tests/Rendering/SkyboxScene/skybox_cubemap.texture";
|
|
params.guid = ResourceGUID::Generate(params.path);
|
|
texture->Initialize(params);
|
|
|
|
std::vector<unsigned char> pixels(
|
|
static_cast<size_t>(kSkyboxFaceSize) * static_cast<size_t>(kSkyboxFaceSize) * 4u * 6u,
|
|
255u);
|
|
for (uint32_t faceIndex = 0; faceIndex < 6u; ++faceIndex) {
|
|
for (uint32_t y = 0; y < kSkyboxFaceSize; ++y) {
|
|
for (uint32_t x = 0; x < kSkyboxFaceSize; ++x) {
|
|
const float s = (2.0f * (static_cast<float>(x) + 0.5f) / static_cast<float>(kSkyboxFaceSize)) - 1.0f;
|
|
const float t = (2.0f * (static_cast<float>(y) + 0.5f) / static_cast<float>(kSkyboxFaceSize)) - 1.0f;
|
|
const Vector3 direction = ComputeCubemapDirection(faceIndex, s, t);
|
|
|
|
const float u = std::atan2(direction.z, direction.x) / (2.0f * kPi) + 0.5f;
|
|
const float v = std::acos(std::clamp(direction.y, -1.0f, 1.0f)) / kPi;
|
|
|
|
unsigned char rgba[4] = {};
|
|
SamplePanoramaNearest(*panorama, u, v, rgba);
|
|
|
|
const size_t pixelIndex =
|
|
((static_cast<size_t>(faceIndex) * static_cast<size_t>(kSkyboxFaceSize) *
|
|
static_cast<size_t>(kSkyboxFaceSize)) +
|
|
(static_cast<size_t>(y) * static_cast<size_t>(kSkyboxFaceSize) + x)) * 4u;
|
|
pixels[pixelIndex + 0] = rgba[0];
|
|
pixels[pixelIndex + 1] = rgba[1];
|
|
pixels[pixelIndex + 2] = rgba[2];
|
|
pixels[pixelIndex + 3] = 255u;
|
|
}
|
|
}
|
|
}
|
|
|
|
const size_t pixelDataSize = pixels.size();
|
|
if (!texture->Create(
|
|
kSkyboxFaceSize,
|
|
kSkyboxFaceSize,
|
|
1,
|
|
1,
|
|
XCEngine::Resources::TextureType::TextureCube,
|
|
panorama->GetFormat(),
|
|
pixels.data(),
|
|
pixelDataSize,
|
|
6)) {
|
|
delete texture;
|
|
return nullptr;
|
|
}
|
|
|
|
return texture;
|
|
}
|
|
|
|
Mesh* CreateQuadMesh() {
|
|
auto* mesh = new Mesh();
|
|
IResource::ConstructParams params = {};
|
|
params.name = "SkyboxSceneQuad";
|
|
params.path = "Tests/Rendering/SkyboxScene/quad.mesh";
|
|
params.guid = ResourceGUID::Generate(params.path);
|
|
mesh->Initialize(params);
|
|
|
|
StaticMeshVertex vertices[4] = {};
|
|
vertices[0].position = Vector3(-1.0f, -1.0f, 0.0f);
|
|
vertices[0].normal = Vector3::Back();
|
|
vertices[0].uv0 = Vector2(0.0f, 1.0f);
|
|
vertices[1].position = Vector3(-1.0f, 1.0f, 0.0f);
|
|
vertices[1].normal = Vector3::Back();
|
|
vertices[1].uv0 = Vector2(0.0f, 0.0f);
|
|
vertices[2].position = Vector3(1.0f, -1.0f, 0.0f);
|
|
vertices[2].normal = Vector3::Back();
|
|
vertices[2].uv0 = Vector2(1.0f, 1.0f);
|
|
vertices[3].position = Vector3(1.0f, 1.0f, 0.0f);
|
|
vertices[3].normal = Vector3::Back();
|
|
vertices[3].uv0 = Vector2(1.0f, 0.0f);
|
|
|
|
const uint32_t indices[6] = { 0, 1, 2, 2, 1, 3 };
|
|
mesh->SetVertexData(
|
|
vertices,
|
|
sizeof(vertices),
|
|
4,
|
|
sizeof(StaticMeshVertex),
|
|
VertexAttribute::Position | VertexAttribute::Normal | VertexAttribute::UV0);
|
|
mesh->SetIndexData(indices, sizeof(indices), 6, true);
|
|
|
|
MeshSection section = {};
|
|
section.baseVertex = 0;
|
|
section.vertexCount = 4;
|
|
section.startIndex = 0;
|
|
section.indexCount = 6;
|
|
section.materialID = 0;
|
|
mesh->AddSection(section);
|
|
return mesh;
|
|
}
|
|
|
|
Material* CreateMaterial(
|
|
const char* name,
|
|
const char* path,
|
|
const Vector4& baseColor,
|
|
MaterialRenderQueue renderQueue,
|
|
const MaterialRenderState& renderState) {
|
|
auto* material = new Material();
|
|
IResource::ConstructParams params = {};
|
|
params.name = name;
|
|
params.path = path;
|
|
params.guid = ResourceGUID::Generate(params.path);
|
|
material->Initialize(params);
|
|
material->SetShader(ResourceManager::Get().Load<Shader>(GetBuiltinUnlitShaderPath()));
|
|
material->SetRenderQueue(renderQueue);
|
|
material->SetRenderState(renderState);
|
|
material->SetFloat4("_BaseColor", baseColor);
|
|
return material;
|
|
}
|
|
|
|
Material* CreateSkyboxMaterial(Texture* texture) {
|
|
auto* material = new Material();
|
|
IResource::ConstructParams params = {};
|
|
params.name = "SkyboxCubemapMaterial";
|
|
params.path = "Tests/Rendering/SkyboxScene/skybox_cubemap.mat";
|
|
params.guid = ResourceGUID::Generate(params.path);
|
|
material->Initialize(params);
|
|
material->SetShader(ResourceManager::Get().Load<Shader>(GetBuiltinSkyboxShaderPath()));
|
|
material->SetTexture("_Tex", ResourceHandle<Texture>(texture));
|
|
material->SetFloat4("_Tint", Vector4(1.0f, 1.0f, 1.0f, 1.0f));
|
|
material->SetFloat("_Exposure", 1.0f);
|
|
material->SetFloat("_Rotation", 0.0f);
|
|
return material;
|
|
}
|
|
|
|
GameObject* CreateRenderableObject(
|
|
Scene& scene,
|
|
const char* name,
|
|
Mesh* mesh,
|
|
Material* material,
|
|
const Vector3& position,
|
|
const Vector3& scale,
|
|
const Quaternion& rotation = Quaternion::Identity()) {
|
|
GameObject* object = scene.CreateGameObject(name);
|
|
object->GetTransform()->SetLocalPosition(position);
|
|
object->GetTransform()->SetLocalScale(scale);
|
|
object->GetTransform()->SetLocalRotation(rotation);
|
|
|
|
auto* meshFilter = object->AddComponent<MeshFilterComponent>();
|
|
auto* meshRenderer = object->AddComponent<MeshRendererComponent>();
|
|
meshFilter->SetMesh(ResourceHandle<Mesh>(mesh));
|
|
meshRenderer->SetMaterial(0, ResourceHandle<Material>(material));
|
|
return object;
|
|
}
|
|
|
|
const char* GetScreenshotFilename(RHIType backendType) {
|
|
switch (backendType) {
|
|
case RHIType::D3D12:
|
|
return kD3D12Screenshot;
|
|
case RHIType::Vulkan:
|
|
return kVulkanScreenshot;
|
|
case RHIType::OpenGL:
|
|
default:
|
|
return kOpenGLScreenshot;
|
|
}
|
|
}
|
|
|
|
int GetComparisonThreshold(RHIType backendType) {
|
|
(void)backendType;
|
|
return 10;
|
|
}
|
|
|
|
class SkyboxSceneTest : public RHIIntegrationFixture {
|
|
protected:
|
|
void SetUp() override;
|
|
void TearDown() override;
|
|
void RenderFrame() override;
|
|
|
|
private:
|
|
void BuildScene();
|
|
RHIResourceView* GetCurrentBackBufferView();
|
|
|
|
std::unique_ptr<Scene> mScene;
|
|
std::unique_ptr<SceneRenderer> mSceneRenderer;
|
|
std::vector<RHIResourceView*> mBackBufferViews;
|
|
std::vector<Material*> mMaterials;
|
|
std::vector<Texture*> mTextures;
|
|
Mesh* mMesh = nullptr;
|
|
RHITexture* mDepthTexture = nullptr;
|
|
RHIResourceView* mDepthView = nullptr;
|
|
};
|
|
|
|
void SkyboxSceneTest::SetUp() {
|
|
RHIIntegrationFixture::SetUp();
|
|
|
|
mSceneRenderer = std::make_unique<SceneRenderer>();
|
|
mScene = std::make_unique<Scene>("SkyboxScene");
|
|
mMesh = CreateQuadMesh();
|
|
ASSERT_NE(mMesh, nullptr);
|
|
|
|
BuildScene();
|
|
|
|
TextureDesc depthDesc = {};
|
|
depthDesc.width = kFrameWidth;
|
|
depthDesc.height = kFrameHeight;
|
|
depthDesc.depth = 1;
|
|
depthDesc.mipLevels = 1;
|
|
depthDesc.arraySize = 1;
|
|
depthDesc.format = static_cast<uint32_t>(Format::D24_UNorm_S8_UInt);
|
|
depthDesc.textureType = static_cast<uint32_t>(XCEngine::RHI::TextureType::Texture2D);
|
|
depthDesc.sampleCount = 1;
|
|
depthDesc.sampleQuality = 0;
|
|
depthDesc.flags = 0;
|
|
mDepthTexture = GetDevice()->CreateTexture(depthDesc);
|
|
ASSERT_NE(mDepthTexture, nullptr);
|
|
|
|
ResourceViewDesc depthViewDesc = {};
|
|
depthViewDesc.format = static_cast<uint32_t>(Format::D24_UNorm_S8_UInt);
|
|
depthViewDesc.dimension = ResourceViewDimension::Texture2D;
|
|
depthViewDesc.mipLevel = 0;
|
|
mDepthView = GetDevice()->CreateDepthStencilView(mDepthTexture, depthViewDesc);
|
|
ASSERT_NE(mDepthView, nullptr);
|
|
|
|
mBackBufferViews.resize(2, nullptr);
|
|
}
|
|
|
|
void SkyboxSceneTest::TearDown() {
|
|
mSceneRenderer.reset();
|
|
|
|
if (mDepthView != nullptr) {
|
|
mDepthView->Shutdown();
|
|
delete mDepthView;
|
|
mDepthView = nullptr;
|
|
}
|
|
|
|
if (mDepthTexture != nullptr) {
|
|
mDepthTexture->Shutdown();
|
|
delete mDepthTexture;
|
|
mDepthTexture = nullptr;
|
|
}
|
|
|
|
for (RHIResourceView*& backBufferView : mBackBufferViews) {
|
|
if (backBufferView != nullptr) {
|
|
backBufferView->Shutdown();
|
|
delete backBufferView;
|
|
backBufferView = nullptr;
|
|
}
|
|
}
|
|
mBackBufferViews.clear();
|
|
|
|
mScene.reset();
|
|
|
|
for (Material* material : mMaterials) {
|
|
delete material;
|
|
}
|
|
mMaterials.clear();
|
|
|
|
for (Texture* texture : mTextures) {
|
|
delete texture;
|
|
}
|
|
mTextures.clear();
|
|
|
|
delete mMesh;
|
|
mMesh = nullptr;
|
|
|
|
RHIIntegrationFixture::TearDown();
|
|
}
|
|
|
|
void SkyboxSceneTest::BuildScene() {
|
|
ASSERT_NE(mScene, nullptr);
|
|
|
|
GameObject* cameraObject = mScene->CreateGameObject("MainCamera");
|
|
auto* camera = cameraObject->AddComponent<CameraComponent>();
|
|
camera->SetPrimary(true);
|
|
camera->SetProjectionType(CameraProjectionType::Perspective);
|
|
camera->SetFieldOfView(46.0f);
|
|
camera->SetNearClipPlane(0.1f);
|
|
camera->SetFarClipPlane(20.0f);
|
|
camera->SetClearColor(XCEngine::Math::Color(0.01f, 0.01f, 0.01f, 1.0f));
|
|
camera->SetSkyboxEnabled(true);
|
|
Texture* skyboxTexture = CreateCubemapSkyboxTexture(ResolveRuntimePath("Res/skyboxes/farm_field_puresky_1024.jpg"));
|
|
ASSERT_NE(skyboxTexture, nullptr);
|
|
Material* skyboxMaterial = CreateSkyboxMaterial(skyboxTexture);
|
|
ASSERT_NE(skyboxMaterial, nullptr);
|
|
camera->SetSkyboxMaterial(skyboxMaterial);
|
|
|
|
MaterialRenderState opaqueState = {};
|
|
opaqueState.cullMode = MaterialCullMode::Back;
|
|
|
|
MaterialRenderState transparentState = {};
|
|
transparentState.blendEnable = true;
|
|
transparentState.srcBlend = MaterialBlendFactor::SrcAlpha;
|
|
transparentState.dstBlend = MaterialBlendFactor::InvSrcAlpha;
|
|
transparentState.srcBlendAlpha = MaterialBlendFactor::One;
|
|
transparentState.dstBlendAlpha = MaterialBlendFactor::Zero;
|
|
transparentState.depthTestEnable = true;
|
|
transparentState.depthWriteEnable = false;
|
|
transparentState.depthFunc = MaterialComparisonFunc::LessEqual;
|
|
transparentState.cullMode = MaterialCullMode::None;
|
|
|
|
Material* cubeMaterial = CreateMaterial(
|
|
"SkyboxOpaqueCubeMaterial",
|
|
"Tests/Rendering/SkyboxScene/opaque_cube.mat",
|
|
Vector4(0.86f, 0.18f, 0.14f, 1.0f),
|
|
MaterialRenderQueue::Geometry,
|
|
opaqueState);
|
|
Material* transparentMaterial = CreateMaterial(
|
|
"SkyboxTransparentQuadMaterial",
|
|
"Tests/Rendering/SkyboxScene/transparent_quad.mat",
|
|
Vector4(0.12f, 0.88f, 0.74f, 0.56f),
|
|
MaterialRenderQueue::Transparent,
|
|
transparentState);
|
|
mMaterials = { skyboxMaterial, cubeMaterial, transparentMaterial };
|
|
mTextures = { skyboxTexture };
|
|
|
|
CreateRenderableObject(
|
|
*mScene,
|
|
"OpaqueQuad",
|
|
mMesh,
|
|
cubeMaterial,
|
|
Vector3(-0.54f, -0.10f, 3.25f),
|
|
Vector3(1.20f, 1.20f, 1.0f),
|
|
Quaternion::FromEulerAngles(0.0f, -0.38f, 0.0f));
|
|
|
|
CreateRenderableObject(
|
|
*mScene,
|
|
"TransparentQuad",
|
|
mMesh,
|
|
transparentMaterial,
|
|
Vector3(0.82f, 0.06f, 4.1f),
|
|
Vector3(1.48f, 1.48f, 1.0f),
|
|
Quaternion::FromEulerAngles(0.0f, -0.34f, 0.0f));
|
|
}
|
|
|
|
RHIResourceView* SkyboxSceneTest::GetCurrentBackBufferView() {
|
|
const int backBufferIndex = GetCurrentBackBufferIndex();
|
|
if (backBufferIndex < 0) {
|
|
return nullptr;
|
|
}
|
|
|
|
if (static_cast<size_t>(backBufferIndex) >= mBackBufferViews.size()) {
|
|
mBackBufferViews.resize(static_cast<size_t>(backBufferIndex) + 1, nullptr);
|
|
}
|
|
|
|
if (mBackBufferViews[backBufferIndex] == nullptr) {
|
|
ResourceViewDesc viewDesc = {};
|
|
viewDesc.format = static_cast<uint32_t>(Format::R8G8B8A8_UNorm);
|
|
viewDesc.dimension = ResourceViewDimension::Texture2D;
|
|
viewDesc.mipLevel = 0;
|
|
mBackBufferViews[backBufferIndex] = GetDevice()->CreateRenderTargetView(GetCurrentBackBuffer(), viewDesc);
|
|
}
|
|
|
|
return mBackBufferViews[backBufferIndex];
|
|
}
|
|
|
|
void SkyboxSceneTest::RenderFrame() {
|
|
ASSERT_NE(mScene, nullptr);
|
|
ASSERT_NE(mSceneRenderer, nullptr);
|
|
|
|
RHICommandList* commandList = GetCommandList();
|
|
ASSERT_NE(commandList, nullptr);
|
|
|
|
commandList->Reset();
|
|
|
|
RenderSurface surface(kFrameWidth, kFrameHeight);
|
|
surface.SetColorAttachment(GetCurrentBackBufferView());
|
|
surface.SetDepthAttachment(mDepthView);
|
|
|
|
RenderContext renderContext = {};
|
|
renderContext.device = GetDevice();
|
|
renderContext.commandList = commandList;
|
|
renderContext.commandQueue = GetCommandQueue();
|
|
renderContext.backendType = GetBackendType();
|
|
|
|
ASSERT_TRUE(mSceneRenderer->Render(*mScene, nullptr, renderContext, surface));
|
|
|
|
commandList->Close();
|
|
void* commandLists[] = { commandList };
|
|
GetCommandQueue()->ExecuteCommandLists(1, commandLists);
|
|
}
|
|
|
|
TEST_P(SkyboxSceneTest, RenderSkyboxScene) {
|
|
RHICommandQueue* commandQueue = GetCommandQueue();
|
|
RHISwapChain* swapChain = GetSwapChain();
|
|
const int targetFrameCount = 30;
|
|
const char* screenshotFilename = GetScreenshotFilename(GetBackendType());
|
|
const int comparisonThreshold = GetComparisonThreshold(GetBackendType());
|
|
|
|
for (int frameCount = 0; frameCount <= targetFrameCount; ++frameCount) {
|
|
if (frameCount > 0) {
|
|
commandQueue->WaitForPreviousFrame();
|
|
}
|
|
|
|
BeginRender();
|
|
RenderFrame();
|
|
|
|
if (frameCount >= targetFrameCount) {
|
|
commandQueue->WaitForIdle();
|
|
ASSERT_TRUE(TakeScreenshot(screenshotFilename));
|
|
ASSERT_TRUE(CompareWithGoldenTemplate(screenshotFilename, "GT.ppm", static_cast<float>(comparisonThreshold)));
|
|
break;
|
|
}
|
|
|
|
swapChain->Present(0, 0);
|
|
}
|
|
}
|
|
|
|
} // namespace
|
|
|
|
INSTANTIATE_TEST_SUITE_P(D3D12, SkyboxSceneTest, ::testing::Values(RHIType::D3D12));
|
|
INSTANTIATE_TEST_SUITE_P(OpenGL, SkyboxSceneTest, ::testing::Values(RHIType::OpenGL));
|
|
#if defined(XCENGINE_SUPPORT_VULKAN)
|
|
INSTANTIATE_TEST_SUITE_P(Vulkan, SkyboxSceneTest, ::testing::Values(RHIType::Vulkan));
|
|
#endif
|
|
|
|
GTEST_API_ int main(int argc, char** argv) {
|
|
return RunRenderingIntegrationTestMain(argc, argv);
|
|
}
|