...
 
Commits (2)
......@@ -168,12 +168,10 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::GetDisplayMode(UINT iSwapChain, D3DDISPLAYMODE* pMode) {
D3D9DeviceLock lock = LockDevice();
auto* swapchain = GetInternalSwapchain(iSwapChain);
if (unlikely(swapchain == nullptr))
return D3DERR_INVALIDCALL;
if (auto* swapchain = GetInternalSwapchain(iSwapChain))
return swapchain->GetDisplayMode(pMode);
return swapchain->GetDisplayMode(pMode);
return D3DERR_INVALIDCALL;
}
......@@ -336,24 +334,20 @@ namespace dxvk {
InitReturnPtr(ppBackBuffer);
auto* swapchain = GetInternalSwapchain(iSwapChain);
if (unlikely(swapchain == nullptr))
return D3DERR_INVALIDCALL;
if (auto* swapchain = GetInternalSwapchain(iSwapChain))
return swapchain->GetBackBuffer(iBackBuffer, Type, ppBackBuffer);
return swapchain->GetBackBuffer(iBackBuffer, Type, ppBackBuffer);
return D3DERR_INVALIDCALL;
}
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::GetRasterStatus(UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) {
D3D9DeviceLock lock = LockDevice();
auto* swapchain = GetInternalSwapchain(iSwapChain);
if (unlikely(swapchain == nullptr))
return D3DERR_INVALIDCALL;
if (auto* swapchain = GetInternalSwapchain(iSwapChain))
return swapchain->GetRasterStatus(pRasterStatus);
return swapchain->GetRasterStatus(pRasterStatus);
return D3DERR_INVALIDCALL;
}
......@@ -375,24 +369,16 @@ namespace dxvk {
const D3DGAMMARAMP* pRamp) {
D3D9DeviceLock lock = LockDevice();
auto* swapchain = GetInternalSwapchain(iSwapChain);
if (unlikely(swapchain == nullptr))
return;
swapchain->SetGammaRamp(Flags, pRamp);
if (auto* swapchain = GetInternalSwapchain(iSwapChain))
swapchain->SetGammaRamp(Flags, pRamp);
}
void STDMETHODCALLTYPE D3D9DeviceEx::GetGammaRamp(UINT iSwapChain, D3DGAMMARAMP* pRamp) {
D3D9DeviceLock lock = LockDevice();
auto* swapchain = GetInternalSwapchain(iSwapChain);
if (unlikely(swapchain == nullptr))
return;
swapchain->GetGammaRamp(pRamp);
if (auto* swapchain = GetInternalSwapchain(iSwapChain))
swapchain->GetGammaRamp(pRamp);
}
......@@ -855,12 +841,10 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::GetFrontBufferData(UINT iSwapChain, IDirect3DSurface9* pDestSurface) {
D3D9DeviceLock lock = LockDevice();
auto* swapchain = GetInternalSwapchain(iSwapChain);
if (unlikely(swapchain == nullptr))
return D3DERR_INVALIDCALL;
if (auto* swapchain = GetInternalSwapchain(iSwapChain))
return swapchain->GetFrontBufferData(pDestSurface);
return swapchain->GetFrontBufferData(pDestSurface);
return D3DERR_INVALIDCALL;
}
......@@ -1290,8 +1274,8 @@ namespace dxvk {
const auto& vp = m_state.viewport;
const auto& sc = m_state.scissorRect;
bool srgb = m_state.renderStates[D3DRS_SRGBWRITEENABLE] != FALSE;
bool scissor = m_state.renderStates[D3DRS_SCISSORTESTENABLE] != FALSE;
bool srgb = m_state.renderStates[D3DRS_SRGBWRITEENABLE];
bool scissor = m_state.renderStates[D3DRS_SCISSORTESTENABLE];
VkOffset3D offset = { int32_t(vp.X), int32_t(vp.Y), 0 };
VkExtent3D extent = { vp.Width, vp.Height, 1u };
......@@ -3205,12 +3189,10 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE D3D9DeviceEx::WaitForVBlank(UINT iSwapChain) {
D3D9DeviceLock lock = LockDevice();
auto* swapchain = GetInternalSwapchain(iSwapChain);
if (swapchain == nullptr)
return D3DERR_INVALIDCALL;
if (auto* swapchain = GetInternalSwapchain(iSwapChain))
return swapchain->WaitForVBlank();
return swapchain->WaitForVBlank();
return D3DERR_INVALIDCALL;
}
......@@ -3424,12 +3406,10 @@ namespace dxvk {
D3DDISPLAYROTATION* pRotation) {
D3D9DeviceLock lock = LockDevice();
auto* swapchain = GetInternalSwapchain(iSwapChain);
if (auto* swapchain = GetInternalSwapchain(iSwapChain))
return swapchain->GetDisplayModeEx(pMode, pRotation);
if (unlikely(swapchain == nullptr))
return D3DERR_INVALIDCALL;
return swapchain->GetDisplayModeEx(pMode, pRotation);
return D3DERR_INVALIDCALL;
}
......@@ -4737,7 +4717,7 @@ namespace dxvk {
void D3D9DeviceEx::UpdateFog() {
auto& rs = m_state.renderStates;
bool fogEnabled = rs[D3DRS_FOGENABLE] != FALSE;
bool fogEnabled = rs[D3DRS_FOGENABLE];
bool pixelFog = rs[D3DRS_FOGTABLEMODE] != D3DFOG_NONE && fogEnabled;
bool vertexFog = rs[D3DRS_FOGVERTEXMODE] != D3DFOG_NONE && fogEnabled && !pixelFog;
......@@ -4819,7 +4799,7 @@ namespace dxvk {
DxvkRenderTargets attachments;
bool srgb = m_state.renderStates[D3DRS_SRGBWRITEENABLE] != FALSE;
bool srgb = m_state.renderStates[D3DRS_SRGBWRITEENABLE];
// D3D9 doesn't have the concept of a framebuffer object,
// so we'll just create a new one every time the render
......@@ -4891,7 +4871,7 @@ namespace dxvk {
// Scissor rectangles. Vulkan does not provide an easy way
// to disable the scissor test, so we'll have to set scissor
// rects that are at least as large as the framebuffer.
bool enableScissorTest = m_state.renderStates[D3DRS_SCISSORTESTENABLE] != FALSE;
bool enableScissorTest = m_state.renderStates[D3DRS_SCISSORTESTENABLE];
if (enableScissorTest) {
RECT sr = m_state.scissorRect;
......@@ -4932,7 +4912,7 @@ namespace dxvk {
m_flags.clr(D3D9DeviceFlag::DirtyMultiSampleState);
DxvkMultisampleState msState;
msState.sampleMask = m_flags.test(D3D9DeviceFlag::ValidSampleMask)
msState.sampleMask = m_flags.test(D3D9DeviceFlag::ValidSampleMask)
? m_state.renderStates[D3DRS_MULTISAMPLEMASK]
: 0xffffffff;
msState.enableAlphaToCoverage = IsAlphaToCoverageEnabled();
......@@ -4950,7 +4930,7 @@ namespace dxvk {
auto& state = m_state.renderStates;
bool separateAlpha = state[D3DRS_SEPARATEALPHABLENDENABLE] != FALSE;
bool separateAlpha = state[D3DRS_SEPARATEALPHABLENDENABLE];
DxvkBlendMode mode;
mode.enableBlending = state[D3DRS_ALPHABLENDENABLE] != FALSE;
......@@ -5038,8 +5018,8 @@ namespace dxvk {
auto& rs = m_state.renderStates;
bool stencil = rs[D3DRS_STENCILENABLE] != FALSE;
bool twoSidedStencil = stencil && (rs[D3DRS_TWOSIDEDSTENCILMODE] != FALSE);
bool stencil = rs[D3DRS_STENCILENABLE];
bool twoSidedStencil = stencil && rs[D3DRS_TWOSIDEDSTENCILMODE];
DxvkDepthStencilState state;
state.enableDepthTest = rs[D3DRS_ZENABLE] != FALSE;
......@@ -5254,7 +5234,7 @@ namespace dxvk {
DxsoBindingType::DepthImage, uint32_t(shaderSampler.second));
const bool srgb =
m_state.samplerStates[StateSampler][D3DSAMP_SRGBTEXTURE] != FALSE;
m_state.samplerStates[StateSampler][D3DSAMP_SRGBTEXTURE];
D3D9CommonTexture* commonTex =
GetCommonTexture(m_state.textures[StateSampler]);
......@@ -6257,7 +6237,7 @@ namespace dxvk {
rs[D3DRS_BLENDFACTOR] = 0xffffffff;
BindBlendFactor();
rs[D3DRS_ZENABLE] = pPresentationParameters->EnableAutoDepthStencil != FALSE
rs[D3DRS_ZENABLE] = pPresentationParameters->EnableAutoDepthStencil
? D3DZB_TRUE
: D3DZB_FALSE;
rs[D3DRS_ZFUNC] = D3DCMP_LESSEQUAL;
......