add PCDX11DeviceManager::AdapterInfo, fill with dummy data

This commit is contained in:
Adam Jensen 2023-04-12 01:00:31 +01:00
parent 54f556438c
commit a654874a4d
3 changed files with 33 additions and 4 deletions

View File

@ -7,7 +7,8 @@ namespace cdc {
PCDX11DeviceManager::PCDX11DeviceManager(HMODULE d3d11, HMODULE dxgi) :
d3d11(d3d11),
dxgi(dxgi)
dxgi(dxgi),
currentAdapter(nullptr)
{
}
@ -33,6 +34,13 @@ PCDX11DeviceManager::PCDX11DeviceManager(
dxgiDevice->GetAdapter(&adapter);
adapter->GetParent(__uuidof(IDXGIFactory), (void**)&dxgiFactory);
#endif
// HACK
adapters.push_back(AdapterInfo {
/*backBufferFormat=*/ DXGI_FORMAT_B8G8R8A8_UNORM_SRGB,
/*depthTextureFormat=*/ DXGI_FORMAT_R24G8_TYPELESS
});
currentAdapter = &adapters[0];
}
void PCDX11DeviceManager::method_00() {

View File

@ -1,5 +1,7 @@
#pragma once
#include <windows.h>
#include <vector>
#include <dxgiformat.h>
#include "IPCDeviceManager.h"
#include "shaders/PCDX11ShaderManager.h"
@ -14,6 +16,22 @@ class PCDX11StateManager;
class PCDX11DeviceManager :
public IPCDeviceManager
{
public:
struct AdapterInfo {
// uint32_t ordinal; // 0
// wchar_t name[512]; // 4
// IDXGIAdapter *pD3DAdapter; // 404
// DXGI_FORMAT displayFormat; // 408
DXGI_FORMAT backBufferFormat; // 40C
DXGI_FORMAT depthTextureFormat; // 410
// std::vector<PCDX11Output> outputs; // 414
// std::vector<PCDisplayMode> stereoDisplayModes; // 420
// uint32_t dword424;
// DXGI_ADAPTER_DESC *adapterDesc;
// uint32_t featureLevel;
};
private:
HMODULE d3d11; // 1C
HMODULE dxgi; // 20
ID3D11Device *device; // 24
@ -22,8 +40,11 @@ class PCDX11DeviceManager :
DisplayConfig config1; // 34
DisplayConfig config2; // BC
PCDX11ShaderManager shaderManager; // 14C, actually a pointer
public:
PCDX11StateManager *stateManager; // 150
std::vector<AdapterInfo> adapters; // 154
AdapterInfo *currentAdapter; // 160
PCDX11DeviceManager(HMODULE d3d11, HMODULE dxgi);
PCDX11DeviceManager(HMODULE d3d11, HMODULE dxgi, ID3D11Device*, ID3D11DeviceContext*);

View File

@ -13,7 +13,7 @@ void PCDX11RenderContext::fillModeDesc(DXGI_MODE_DESC& modeDesc) {
modeDesc.Height = 0;
modeDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
modeDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
modeDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; // TODO
modeDesc.Format = deviceManager->currentAdapter->backBufferFormat;
modeDesc.RefreshRate.Numerator = displayConfig->fullscreenRefreshRate;
modeDesc.RefreshRate.Denominator = 1;
if (displayConfig->fullscreen) {
@ -35,11 +35,11 @@ bool PCDX11RenderContext::createRenderTargets() {
// TODO
uint32_t width = this->width; // TODO
uint32_t height = this->height; // TODO
uint32_t format = DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; // TODO
uint32_t format = deviceManager->currentAdapter->backBufferFormat; // TODO
renderTarget2C = new PCDX11DefaultRenderTarget(
width, height, /*flags=*/ 4 /*HACK*/ | 1, format, renderDevice, frameBuffer, 0);
// TODO
uint32_t depthFormat = DXGI_FORMAT_R24G8_TYPELESS; // as initialized in PCDX11DeviceManager::EnumAdapters
uint32_t depthFormat = deviceManager->currentAdapter->depthTextureFormat;
depthBuffer = new PCDX11DepthBuffer(
width, height, /*flags=*/ 4 /*HACK*/ |1, depthFormat, renderDevice);
return true;