...
 
Commits (2)
......@@ -83,14 +83,16 @@ namespace dxup {
: Direct3DIndexBuffer9Base{ device, resource, d3d9Desc } {}
HRESULT STDMETHODCALLTYPE GetDesc(D3DINDEXBUFFER_DESC *pDesc) override {
D3D11_BUFFER_DESC desc;
this->GetDXUPResource()->GetResourceAs<ID3D11Buffer>()->GetDesc(&desc);
D3D11_BUFFER_DESC d3d11Desc;
this->GetDXUPResource()->GetResourceAs<ID3D11Buffer>()->GetDesc(&d3d11Desc);
pDesc->Format = this->GetD3D9Desc().Format;
pDesc->Pool = this->GetD3D9Desc().Pool;
pDesc->Size = desc.ByteWidth;
const D3D9ResourceDesc& d3d9Desc = this->GetD3D9Desc();
pDesc->Format = d3d9Desc.Format;
pDesc->Pool = d3d9Desc.Pool;
pDesc->Size = d3d11Desc.ByteWidth;
pDesc->Type = D3DRTYPE_INDEXBUFFER;
pDesc->Usage = this->GetD3D9Desc().Usage;
pDesc->Usage = d3d9Desc.Usage;
return D3D_OK;
}
......
......@@ -112,15 +112,16 @@ namespace dxup {
UINT subresource = D3D11CalcSubresource(mip, slice, m_mips);
m_device->GetContext()->Unmap(GetMapping(), D3D11CalcSubresource(mip, slice, m_mips));
ID3D11DeviceContext* context = m_device->GetContext();
context->Unmap(GetMapping(), D3D11CalcSubresource(mip, slice, m_mips));
SetMipUnmapped(slice, mip);
// We need to make this format an 8888. DXGI has no 888 type.
if (m_fixup8888 != nullptr) {
D3D11_MAPPED_SUBRESOURCE d3d9Res;
D3D11_MAPPED_SUBRESOURCE fixupRes;
m_device->GetContext()->Map(GetStaging(), subresource, D3D11_MAP_READ, 0, &d3d9Res);
m_device->GetContext()->Map(m_fixup8888.ptr(), subresource, D3D11_MAP_WRITE, 0, &fixupRes);
context->Map(GetStaging(), subresource, D3D11_MAP_READ, 0, &d3d9Res);
context->Map(m_fixup8888.ptr(), subresource, D3D11_MAP_WRITE, 0, &fixupRes);
D3D11_TEXTURE2D_DESC desc;
ID3D11Texture2D* texture = reinterpret_cast<ID3D11Texture2D*>(m_staging.ptr());
......@@ -142,8 +143,8 @@ namespace dxup {
}
}
m_device->GetContext()->Unmap(m_fixup8888.ptr(), subresource);
m_device->GetContext()->Unmap(GetStaging(), subresource);
context->Unmap(m_fixup8888.ptr(), subresource);
context->Unmap(GetStaging(), subresource);
}
if (HasStaging() && CanPushStaging())
......
......@@ -33,14 +33,14 @@ namespace dxup {
uint8_t flags
)
: m_adapterNum{ adapterNum }
, m_adapter(adapter)
, m_adapter{ adapter }
, m_window{ window }
, m_device(device)
, m_context(context)
, m_parent(parent)
, m_device{ device }
, m_context{ context }
, m_parent{ parent }
, m_behaviourFlags{ behaviourFlags }
, m_flags(flags)
, m_deviceType(deviceType)
, m_flags{ flags }
, m_deviceType{ deviceType }
, m_state{ new D3D9State(this, 0) }
, m_stateBlock{ nullptr } {
m_renderer = new D3D9ImmediateRenderer{ device, context, m_state };
......
......@@ -3,8 +3,7 @@
namespace dxup {
UINT bitsPerPixel(DXGI_FORMAT fmt)
{
UINT bitsPerPixel(DXGI_FORMAT fmt) {
switch (fmt) {
case DXGI_FORMAT_R32G32B32A32_TYPELESS:
case DXGI_FORMAT_R32G32B32A32_FLOAT:
......
......@@ -63,6 +63,7 @@ namespace dxup {
pIdentifier->DeviceId = desc.DeviceId;
pIdentifier->SubSysId = desc.SubSysId;
pIdentifier->Revision = desc.Revision;
std::memset(&pIdentifier->DeviceIdentifier, 0, sizeof(pIdentifier->DeviceIdentifier));
std::memcpy(&pIdentifier->DeviceIdentifier, &desc.AdapterLuid, sizeof(LUID));
}
else {
......@@ -907,11 +908,14 @@ namespace dxup {
result = output->GetDisplayModeList(dxgiFormat, 0, &ModeCount, nullptr);
if (FAILED(result))
return log::d3derr(D3DERR_INVALIDCALL, "UpdateDisplayModes: GetDisplayModeList failed to get mode count.");
m_displayModes.resize(ModeCount);
result = output->GetDisplayModeList(dxgiFormat, 0, &ModeCount, m_displayModes.data());
if (FAILED(result))
return log::d3derr(D3DERR_INVALIDCALL, "UpdateDisplayModes: GetDisplayModeList failed.");
return log::d3derr(D3DERR_INVALIDCALL, "UpdateDisplayModes: GetDisplayModeList failed to list modes.");
std::reverse(m_displayModes.begin(), m_displayModes.end());
......
......@@ -8,7 +8,7 @@ namespace dxup {
public:
Direct3D9Ex(IDXGIFactory1* dxgiFactory)
: m_dxgiFactory(dxgiFactory)
: m_dxgiFactory{ dxgiFactory }
{}
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, LPVOID* ppv) override;
......
......@@ -6,8 +6,8 @@
namespace dxup {
Direct3DQuery9::Direct3DQuery9(Direct3DDevice9Ex* device, D3DQUERYTYPE type)
: D3D9DeviceUnknown<IDirect3DQuery9>(device)
, m_type(type) {
: D3D9DeviceUnknown<IDirect3DQuery9>{ device }
, m_type{ type } {
bool doD3D11Query = true;
switch (m_type) {
case D3DQUERYTYPE_EVENT: m_d3d11Type = D3D11_QUERY_EVENT; break;
......@@ -61,7 +61,7 @@ namespace dxup {
case D3D11_QUERY_EVENT: return sizeof(BOOL);
default:
case D3D11_QUERY_OCCLUSION:
case D3DQUERYTYPE_TIMESTAMPDISJOINT:
case D3D11_QUERY_TIMESTAMP_DISJOINT:
case D3D11_QUERY_TIMESTAMP: return sizeof(UINT64);
}
}
......
......@@ -21,7 +21,7 @@ namespace dxup {
: m_shader { shader }
, m_shaderNum{ shaderNum }
, m_translation{ translation }
, D3D9DeviceUnknown<Base>(device) {
, D3D9DeviceUnknown<Base>{device} {
m_dx9asm.resize(dx9asm::byteCodeLength((const uint32_t*)code));
......
......@@ -12,8 +12,7 @@ namespace dxup {
// I am sorry. I feel like I let everyone down taking so long to make this piece of crap.
D3D9State::D3D9State(Direct3DDevice9Ex* device, uint32_t stateBlockType)
: stateBlockType{ stateBlockType }
, m_device{ device } {
: m_device{ device } {
dirtyFlags = 0;
dirtySamplers = 0;
......
......@@ -93,8 +93,6 @@ namespace dxup {
protected:
uint32_t stateBlockType;
friend class D3D9ImmediateRenderer;
uint32_t dirtyFlags;
......
......@@ -7,13 +7,13 @@
namespace dxup {
Direct3DSurface9::Direct3DSurface9(bool singletonSurface, UINT slice, UINT mip, Direct3DDevice9Ex* device, IUnknown* container, DXUPResource* resource, const D3D9ResourceDesc& desc)
: Direct3DSurface9Base(device, nullptr, desc)
, m_container(container)
, m_slice(slice)
, m_mip(mip)
, m_rtView(nullptr)
, m_rtViewSRGB(nullptr)
, m_singletonSurface(singletonSurface)
: Direct3DSurface9Base{ device, nullptr, desc }
, m_container{ container }
, m_slice{ slice }
, m_mip{ mip }
, m_rtView{ nullptr }
, m_rtViewSRGB{ nullptr }
, m_singletonSurface{ singletonSurface }
{
if (singletonSurface && m_container != nullptr)
m_container->AddRef();
......@@ -146,7 +146,7 @@ namespace dxup {
return m_slice;
}
UINT Direct3DSurface9::GetSubresource() {
return D3D11CalcSubresource(m_mip, m_slice, m_totalMips);
return D3D11CalcSubresource(m_mip, m_slice, this->GetDXUPResource()->GetMips());
}
void Direct3DSurface9::ClearResource() {
......
......@@ -51,12 +51,10 @@ namespace dxup {
Com<ID3D11RenderTargetView> m_rtViewSRGB;
Com<ID3D11DepthStencilView> m_dsView;
bool m_useRect;
bool m_singletonSurface;
UINT m_slice;
UINT m_mip;
UINT m_totalMips;
};
}
\ No newline at end of file
......@@ -7,8 +7,8 @@
namespace dxup {
Direct3DSwapChain9Ex::Direct3DSwapChain9Ex(Direct3DDevice9Ex* device, D3DPRESENT_PARAMETERS* presentationParameters, IDXGISwapChain1* swapchain)
: Direct3DSwapChain9ExBase(device)
, m_swapchain(swapchain)
: Direct3DSwapChain9ExBase{ device }
, m_swapchain{ swapchain }
, m_rtRequired{ false } {
this->Reset(presentationParameters);
}
......
......@@ -15,7 +15,7 @@ namespace dxup {
public:
Direct3DGeneric2DTexture9(bool singletonSurface, Direct3DDevice9Ex* device, DXUPResource* resource, const D3D9ResourceDesc& desc)
: Direct3DResource9<ResourceType, ID3D9BaseType>(device, resource, desc)
: Direct3DResource9<ResourceType, ID3D9BaseType>{ device, resource, desc }
, m_singletonSurface{ singletonSurface } {
m_surfaces.reserve(resource->GetSubresources());
......
......@@ -182,7 +182,7 @@ namespace dxup {
desc.MiscFlags = 0;
}
inline bool isRectDegenerate(RECT rect) {
inline bool isRectDegenerate(const RECT& rect) {
return rect.top == 0 && rect.right == 0 && rect.left == 0 && rect.bottom == 0;
}
......
......@@ -11,7 +11,7 @@ namespace dxup {
public:
Direct3DVertexDeclaration9(Direct3DDevice9Ex* device, std::vector<D3D11_INPUT_ELEMENT_DESC>& d3d11Descs, std::vector<D3DVERTEXELEMENT9>& d3d9Descs)
: D3D9DeviceUnknown<IDirect3DVertexDeclaration9>(device)
: D3D9DeviceUnknown<IDirect3DVertexDeclaration9>{ device }
, m_d3d11Descs{ d3d11Descs }
, m_d3d9Descs{ d3d9Descs } { }
......
......@@ -22,7 +22,7 @@ namespace dxup {
if (cachedWine == false) {
typedef const char*(*WineGetVersion)(void);
WineGetVersion wine_get_version = nullptr;
WineGetVersion wine_get_version;
HMODULE module = GetModuleHandleA("ntdll.dll");
......@@ -65,7 +65,7 @@ namespace dxup {
initVar(var::RespectPrecision, "DXUP_RESPECT_PRECISION", "1");
initVar(var::RespectVSync, "DXUP_RESPECT_VSYNC", "1");
initVar(var::UseFakes, "DXUP_USEFAKES", "0");
initVar(var::UseFakes, "DXUP_USEFAKES", "1");
initVar(var::FakeDriver, "DXUP_FAKE_DRIVER", "aticfx32.dll");
initVar(var::FakeDescription, "DXUP_FAKE_DESCRIPTION", "AMD Radeon R9 200 Series");
initVar(var::FakeDeviceName, "DXUP_FAKE_DEVICENAME", "\\\\.\\DISPLAY1");
......
......@@ -85,9 +85,8 @@ namespace dxup {
if (entry.data != nullptr) {
if (entry.flags & D3DSPD_IUNKNOWN) {
IUnknown* unknown = (IUnknown*)entry.data;
if (unknown != nullptr)
unknown->Release();
IUnknown* unknown = reinterpret_cast<IUnknown*>(entry.data);
unknown->Release();
}
uint8_t* data = reinterpret_cast<uint8_t*>(entry.data);
......