1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-21 13:54:18 +01:00

[tests] Removed dxvk dependency for d3d11 and dxgi tests

This commit is contained in:
Philip Rebohle 2017-12-06 19:06:23 +01:00
parent dece62c70a
commit 5944410d2c
8 changed files with 51 additions and 25 deletions

View File

@ -11,3 +11,6 @@ util_src = files([
util_lib = static_library('util', util_src, util_lib = static_library('util', util_src,
include_directories : [ dxvk_include_path ]) include_directories : [ dxvk_include_path ])
util_dep = declare_dependency(
link_with : [ util_lib ])

View File

@ -1,4 +1,4 @@
test_d3d11_deps = [ dxvk_dep, dxgi_dep, d3d11_dep ] test_d3d11_deps = [ util_dep, lib_dxgi, lib_d3d11 ]
executable('d3d11-compute', files('test_d3d11_compute.cpp'), dependencies : test_d3d11_deps, install : true) executable('d3d11-compute', files('test_d3d11_compute.cpp'), dependencies : test_d3d11_deps, install : true)
executable('d3d11-triangle', files('test_d3d11_triangle.cpp'), dependencies : test_d3d11_deps, install : true) executable('d3d11-triangle', files('test_d3d11_triangle.cpp'), dependencies : test_d3d11_deps, install : true)

View File

@ -1,8 +1,10 @@
#include <d3d11_include.h> #include <d3d11.h>
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
#include "../test_utils.h"
using namespace dxvk; using namespace dxvk;
int WINAPI WinMain(HINSTANCE hInstance, int WINAPI WinMain(HINSTANCE hInstance,
@ -15,7 +17,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
if (FAILED(D3D11CreateDevice(nullptr, if (FAILED(D3D11CreateDevice(nullptr,
D3D_DRIVER_TYPE_HARDWARE, nullptr, 0, D3D_DRIVER_TYPE_HARDWARE, nullptr, 0,
nullptr, 0, 0, &device, nullptr, &context))) { nullptr, 0, 0, &device, nullptr, &context))) {
Logger::err("Failed to create D3D11 device"); std::cerr << "Failed to create D3D11 device" << std::endl;
return 1; return 1;
} }

View File

@ -1,8 +1,10 @@
#include <d3d11_include.h> #include <d3d11.h>
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
#include "../test_utils.h"
using namespace dxvk; using namespace dxvk;
class TriangleApp { class TriangleApp {
@ -138,7 +140,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
} }
} }
} catch (const dxvk::DxvkError& e) { } catch (const dxvk::DxvkError& e) {
Logger::err(e.message()); std::cerr << e.message() << std::endl;
return msg.wParam; return msg.wParam;
} }
} }

View File

@ -1,15 +1,14 @@
#include <iterator> #include <cstring>
#include <fstream> #include <fstream>
#include <d3dcompiler.h> #include <d3dcompiler.h>
#include <dxbc_module.h>
#include <dxvk_shader.h>
#include <shellapi.h> #include <shellapi.h>
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
#include "../test_utils.h"
using namespace dxvk; using namespace dxvk;
int WINAPI WinMain(HINSTANCE hInstance, int WINAPI WinMain(HINSTANCE hInstance,

View File

@ -1,3 +1,3 @@
test_dxgi_deps = [ dxvk_dep, dxgi_dep ] test_dxgi_deps = [ util_dep, lib_dxgi ]
executable('dxgi-factory', files('test_dxgi_factory.cpp'), dependencies : test_dxgi_deps, install: true) executable('dxgi-factory', files('test_dxgi_factory.cpp'), dependencies : test_dxgi_deps, install: true)

View File

@ -1,10 +1,12 @@
#include <vector> #include <vector>
#include <dxgi_include.h> #include <dxgi.h>
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
#include "../test_utils.h"
using namespace dxvk; using namespace dxvk;
int WINAPI WinMain(HINSTANCE hInstance, int WINAPI WinMain(HINSTANCE hInstance,
@ -15,7 +17,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
if (CreateDXGIFactory(__uuidof(IDXGIFactory), if (CreateDXGIFactory(__uuidof(IDXGIFactory),
reinterpret_cast<void**>(&factory)) != S_OK) { reinterpret_cast<void**>(&factory)) != S_OK) {
Logger::err("Failed to create DXGI factory"); std::cerr << "Failed to create DXGI factory" << std::endl;
return 1; return 1;
} }
@ -25,7 +27,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
DXGI_ADAPTER_DESC adapterDesc; DXGI_ADAPTER_DESC adapterDesc;
if (adapter->GetDesc(&adapterDesc) != S_OK) { if (adapter->GetDesc(&adapterDesc) != S_OK) {
Logger::err("Failed to get DXGI adapter info"); std::cerr << "Failed to get DXGI adapter info" << std::endl;
return 1; return 1;
} }
@ -37,29 +39,30 @@ int WINAPI WinMain(HINSTANCE hInstance,
HRESULT status = S_OK; HRESULT status = S_OK;
UINT displayModeCount = 0; UINT displayModeCount = 0;
Logger::info(str::format("Adapter ", i, ":")); std::cout << str::format("Adapter ", i, ":") << std::endl;
DXGI_ADAPTER_DESC desc; DXGI_ADAPTER_DESC desc;
if (adapter->GetDesc(&desc) != S_OK) { if (adapter->GetDesc(&desc) != S_OK) {
Logger::err("Failed to get DXGI adapter info"); std::cerr << "Failed to get DXGI adapter info" << std::endl;
return 1; return 1;
} }
std::array<char, 257> chars; std::array<char, 257> chars;
std::wcstombs(chars.data(), desc.Description, chars.size() - 1); std::wcstombs(chars.data(), desc.Description, chars.size() - 1);
Logger::info(str::format(" ", chars.data()));
Logger::info(str::format(" Vendor: ", desc.VendorId)); std::cout << str::format(" ", chars.data()) << std::endl;
Logger::info(str::format(" Device: ", desc.DeviceId)); std::cout << str::format(" Vendor: ", desc.VendorId) << std::endl;
Logger::info(str::format(" Dedicated RAM: ", desc.DedicatedVideoMemory)); std::cout << str::format(" Device: ", desc.DeviceId) << std::endl;
Logger::info(str::format(" Shared RAM: ", desc.SharedSystemMemory)); std::cout << str::format(" Dedicated RAM: ", desc.DedicatedVideoMemory) << std::endl;
std::cout << str::format(" Shared RAM: ", desc.SharedSystemMemory) << std::endl;
do { do {
if (output->GetDisplayModeList( if (output->GetDisplayModeList(
DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM,
DXGI_ENUM_MODES_SCALING, DXGI_ENUM_MODES_SCALING,
&displayModeCount, nullptr) != S_OK) { &displayModeCount, nullptr) != S_OK) {
Logger::err("Failed to get DXGI output display mode count"); std::cerr << "Failed to get DXGI output display mode count" << std::endl;
return 1; return 1;
} }
@ -72,15 +75,15 @@ int WINAPI WinMain(HINSTANCE hInstance,
} while (status == DXGI_ERROR_MORE_DATA); } while (status == DXGI_ERROR_MORE_DATA);
if (status != S_OK) { if (status != S_OK) {
Logger::err("Failed to get DXGI output display mode list"); std::cerr << "Failed to get DXGI output display mode list" << std::endl;
return 1; return 1;
} }
Logger::info(str::format(" Output ", j, ":")); std::cout << str::format(" Output ", j, ":") << std::endl;
for (auto mode : modes) { for (auto mode : modes) {
Logger::info(str::format(" ", std::cout << str::format(" ",
mode.Width, "x", mode.Height, " @ ", mode.Width, "x", mode.Height, " @ ",
mode.RefreshRate.Numerator / mode.RefreshRate.Denominator)); mode.RefreshRate.Numerator / mode.RefreshRate.Denominator) << std::endl;
} }
} }
} }

17
tests/test_utils.h Normal file
View File

@ -0,0 +1,17 @@
#pragma once
#include <iostream>
#include "../src/util/com/com_guid.h"
#include "../src/util/com/com_object.h"
#include "../src/util/com/com_pointer.h"
#include "../src/util/log/log.h"
#include "../src/util/log/log_debug.h"
#include "../src/util/rc/util_rc.h"
#include "../src/util/rc/util_rc_ptr.h"
#include "../src/util/util_enum.h"
#include "../src/util/util_error.h"
#include "../src/util/util_string.h"