Skip to content

Commit

Permalink
[d3d8] Minor whitespace nits
Browse files Browse the repository at this point in the history
  • Loading branch information
AlpyneDreams committed Jul 7, 2024
1 parent eb7294f commit 6c1a29d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 37 deletions.
26 changes: 3 additions & 23 deletions src/d3d8/d3d8_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ namespace dxvk {
, m_deviceType(DeviceType)
, m_window(hFocusWindow)
, m_behaviorFlags(BehaviorFlags) {

// Get the bridge interface to D3D9.
if (FAILED(GetD3D9()->QueryInterface(__uuidof(IDxvkD3D8Bridge), (void**)&m_bridge))) {
throw DxvkError("D3D8Device: ERROR! Failed to get D3D9 Bridge. d3d9.dll might not be DXVK!");
Expand Down Expand Up @@ -173,10 +172,9 @@ namespace dxvk {
}

HRESULT STDMETHODCALLTYPE D3D8Device::SetCursorProperties(
UINT XHotSpot,
UINT YHotSpot,
IDirect3DSurface8* pCursorBitmap) {

UINT XHotSpot,
UINT YHotSpot,
IDirect3DSurface8* pCursorBitmap) {
D3D8Surface* surf = static_cast<D3D8Surface*>(pCursorBitmap);
return GetD3D9()->SetCursorProperties(XHotSpot, YHotSpot, D3D8Surface::GetD3D9Nullable(surf));
}
Expand Down Expand Up @@ -436,7 +434,6 @@ namespace dxvk {
}

HRESULT STDMETHODCALLTYPE D3D8Device::CreateImageSurface(UINT Width, UINT Height, D3DFORMAT Format, IDirect3DSurface8** ppSurface) {

Com<d3d9::IDirect3DSurface9> pSurf = nullptr;
HRESULT res = GetD3D9()->CreateOffscreenPlainSurface(
Width,
Expand Down Expand Up @@ -558,7 +555,6 @@ namespace dxvk {
UINT cRects,
IDirect3DSurface8* pDestinationSurface,
const POINT* pDestPointsArray) {

if (pSourceSurface == NULL || pDestinationSurface == NULL) {
return D3DERR_INVALIDCALL;
}
Expand Down Expand Up @@ -942,7 +938,6 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE D3D8Device::CreateStateBlock(
D3DSTATEBLOCKTYPE Type,
DWORD* pToken) {

Com<d3d9::IDirect3DStateBlock9> pStateBlock9;
HRESULT res = GetD3D9()->CreateStateBlock(d3d9::D3DSTATEBLOCKTYPE(Type), &pStateBlock9);

Expand Down Expand Up @@ -975,7 +970,6 @@ namespace dxvk {
}

HRESULT STDMETHODCALLTYPE D3D8Device::BeginStateBlock() {

if (unlikely(m_recorder != nullptr))
return D3DERR_INVALIDCALL;

Expand All @@ -986,7 +980,6 @@ namespace dxvk {
}

HRESULT STDMETHODCALLTYPE D3D8Device::EndStateBlock(DWORD* pToken) {

if (unlikely(pToken == nullptr || m_recorder == nullptr))
return D3DERR_INVALIDCALL;

Expand Down Expand Up @@ -1020,7 +1013,6 @@ namespace dxvk {
}

HRESULT STDMETHODCALLTYPE D3D8Device::SetTexture(DWORD Stage, IDirect3DBaseTexture8* pTexture) {

if (unlikely(Stage >= d8caps::MAX_TEXTURE_STAGES))
return D3DERR_INVALIDCALL;

Expand Down Expand Up @@ -1229,7 +1221,6 @@ namespace dxvk {
}

HRESULT STDMETHODCALLTYPE D3D8Device::SetIndices(IDirect3DIndexBuffer8* pIndexData, UINT BaseVertexIndex) {

if (unlikely(ShouldRecord()))
return m_recorder->SetIndices(pIndexData, BaseVertexIndex);

Expand Down Expand Up @@ -1399,8 +1390,6 @@ namespace dxvk {
const DWORD* pFunction,
DWORD* pHandle,
DWORD Usage ) {


D3D8VertexShaderInfo& info = m_vertexShaders.emplace_back();

// Store D3D8 bytecodes in the shader info
Expand Down Expand Up @@ -1452,7 +1441,6 @@ namespace dxvk {
}

HRESULT STDMETHODCALLTYPE D3D8Device::SetVertexShader( DWORD Handle ) {

if (unlikely(ShouldRecord())) {
return m_recorder->SetVertexShader(Handle);
}
Expand Down Expand Up @@ -1487,7 +1475,6 @@ namespace dxvk {
}

HRESULT STDMETHODCALLTYPE D3D8Device::GetVertexShader(DWORD* pHandle) {

// Return cached shader
*pHandle = m_currentVertexShader;

Expand Down Expand Up @@ -1517,9 +1504,7 @@ namespace dxvk {
}

HRESULT STDMETHODCALLTYPE D3D8Device::DeleteVertexShader(DWORD Handle) {

if (!isFVF(Handle)) {

D3D8VertexShaderInfo* info = getVertexShaderInfo(this, Handle);

if (!info)
Expand Down Expand Up @@ -1595,7 +1580,6 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE D3D8Device::CreatePixelShader(
const DWORD* pFunction,
DWORD* pHandle) {

d3d9::IDirect3DPixelShader9* pPixelShader;

HRESULT res = GetD3D9()->CreatePixelShader(pFunction, &pPixelShader);
Expand All @@ -1609,7 +1593,6 @@ namespace dxvk {
}

inline d3d9::IDirect3DPixelShader9* getPixelShaderPtr(D3D8Device* device, DWORD Handle) {

Handle = getShaderIndex(Handle);

if (unlikely(Handle >= device->m_pixelShaders.size())) {
Expand All @@ -1628,7 +1611,6 @@ namespace dxvk {
}

HRESULT STDMETHODCALLTYPE D3D8Device::SetPixelShader(DWORD Handle) {

if (unlikely(ShouldRecord())) {
return m_recorder->SetPixelShader(Handle);
}
Expand Down Expand Up @@ -1661,7 +1643,6 @@ namespace dxvk {
}

HRESULT STDMETHODCALLTYPE D3D8Device::DeletePixelShader(DWORD Handle) {

d3d9::IDirect3DPixelShader9* pPixelShader = getPixelShaderPtr(this, Handle);

if (unlikely(!pPixelShader)) {
Expand All @@ -1676,7 +1657,6 @@ namespace dxvk {
}

HRESULT STDMETHODCALLTYPE D3D8Device::GetPixelShaderFunction(DWORD Handle, void* pData, DWORD* pSizeOfData) {

d3d9::IDirect3DPixelShader9* pPixelShader = getPixelShaderPtr(this, Handle);

if (unlikely(!pPixelShader))
Expand Down
4 changes: 0 additions & 4 deletions src/d3d8/d3d8_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace dxvk
{
D3D8Interface::D3D8Interface() {

m_d3d9 = d3d9::Direct3DCreate9(D3D_SDK_VERSION);

// Get the bridge interface to D3D9.
Expand Down Expand Up @@ -62,7 +61,6 @@ namespace dxvk
UINT Adapter,
DWORD Flags,
D3DADAPTER_IDENTIFIER8* pIdentifier) {

// This flag now has the opposite effect.
// Either way, WHQLevel will be 1 with Direct3D9Ex
if (Flags & D3DENUM_NO_WHQL_LEVEL)
Expand Down Expand Up @@ -92,7 +90,6 @@ namespace dxvk
UINT Adapter,
UINT Mode,
D3DDISPLAYMODE* pMode) {

if (Adapter >= m_adapterCount || Mode >= m_adapterModeCounts[Adapter] || pMode == nullptr) {
return D3DERR_INVALIDCALL;
}
Expand All @@ -111,7 +108,6 @@ namespace dxvk
DWORD BehaviorFlags,
D3DPRESENT_PARAMETERS* pPresentationParameters,
IDirect3DDevice8** ppReturnedDeviceInterface) {

Com<d3d9::IDirect3DDevice9> pDevice9 = nullptr;
d3d9::D3DPRESENT_PARAMETERS params = ConvertPresentParameters9(pPresentationParameters);
HRESULT res = m_d3d9->CreateDevice(
Expand Down
11 changes: 5 additions & 6 deletions src/d3d8/d3d8_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,11 @@ namespace dxvk {
}

HRESULT STDMETHODCALLTYPE CheckDeviceMultiSampleType(
UINT Adapter,
D3DDEVTYPE DeviceType,
D3DFORMAT SurfaceFormat,
BOOL Windowed,
D3DMULTISAMPLE_TYPE MultiSampleType) {

UINT Adapter,
D3DDEVTYPE DeviceType,
D3DFORMAT SurfaceFormat,
BOOL Windowed,
D3DMULTISAMPLE_TYPE MultiSampleType) {
DWORD* pQualityLevels = nullptr;
return m_d3d9->CheckDeviceMultiSampleType(
Adapter,
Expand Down
3 changes: 0 additions & 3 deletions src/d3d8/d3d8_state_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "d3d8_state_block.h"

HRESULT dxvk::D3D8StateBlock::Capture() {

if (unlikely(m_stateBlock == nullptr)) return D3DERR_INVALIDCALL;

if (m_capture.vs) m_device->GetVertexShader(&m_vertexShader);
Expand All @@ -25,10 +24,8 @@ HRESULT dxvk::D3D8StateBlock::Capture() {
}

HRESULT dxvk::D3D8StateBlock::Apply() {

if (unlikely(m_stateBlock == nullptr)) return D3DERR_INVALIDCALL;


HRESULT res = m_stateBlock->Apply();

if (m_capture.vs) m_device->SetVertexShader(m_vertexShader);
Expand Down
1 change: 0 additions & 1 deletion src/d3d8/d3d8_state_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ namespace dxvk {
: m_device(pDevice)
, m_stateBlock(std::move(pStateBlock))
, m_type(Type) {

if (Type == D3DSBT_VERTEXSTATE || Type == D3DSBT_ALL) {
// Lights, D3DTSS_TEXCOORDINDEX and D3DTSS_TEXTURETRANSFORMFLAGS,
// vertex shader, VS constants, and various render states.
Expand Down

0 comments on commit 6c1a29d

Please sign in to comment.