From ff5bcc031c5f7ccc53baf000791d07d372b5a4af Mon Sep 17 00:00:00 2001 From: narzoul Date: Wed, 17 Jun 2020 23:44:04 +0200 Subject: [PATCH] Eliminate redundant device state changes --- DDrawCompat/D3dDdi/Device.cpp | 58 +----- DDrawCompat/D3dDdi/Device.h | 18 +- DDrawCompat/D3dDdi/DeviceFuncs.cpp | 46 +++-- DDrawCompat/D3dDdi/DeviceState.cpp | 240 ++++++++++++++++++++++ DDrawCompat/D3dDdi/DeviceState.h | 71 +++++++ DDrawCompat/D3dDdi/DrawPrimitive.cpp | 2 + DDrawCompat/D3dDdi/Log/DeviceFuncsLog.cpp | 14 ++ DDrawCompat/D3dDdi/Log/DeviceFuncsLog.h | 2 + DDrawCompat/DDrawCompat.vcxproj | 2 + DDrawCompat/DDrawCompat.vcxproj.filters | 6 + 10 files changed, 377 insertions(+), 82 deletions(-) create mode 100644 DDrawCompat/D3dDdi/DeviceState.cpp create mode 100644 DDrawCompat/D3dDdi/DeviceState.h diff --git a/DDrawCompat/D3dDdi/Device.cpp b/DDrawCompat/D3dDdi/Device.cpp index 3901878..e8d1c74 100644 --- a/DDrawCompat/D3dDdi/Device.cpp +++ b/DDrawCompat/D3dDdi/Device.cpp @@ -24,9 +24,8 @@ namespace D3dDdi , m_renderTarget(nullptr) , m_renderTargetSubResourceIndex(0) , m_sharedPrimary(nullptr) - , m_textures{} - , m_vertexShaderDecl(nullptr) , m_drawPrimitive(*this) + , m_state(*this) { } @@ -226,44 +225,6 @@ namespace D3dDdi return m_drawPrimitive.setStreamSourceUm(*data, umBuffer); } - HRESULT Device::setTexture(UINT stage, HANDLE texture) - { - if (stage < m_textures.size()) - { - if (texture == m_textures[stage]) - { - return S_OK; - } - - flushPrimitives(); - HRESULT result = m_origVtable.pfnSetTexture(m_device, stage, texture); - if (SUCCEEDED(result) && stage < m_textures.size()) - { - m_textures[stage] = texture; - } - return result; - } - - flushPrimitives(); - return m_origVtable.pfnSetTexture(m_device, stage, texture); - } - - HRESULT Device::setVertexShaderDecl(HANDLE shader) - { - if (shader == m_vertexShaderDecl) - { - return S_OK; - } - - flushPrimitives(); - HRESULT result = m_origVtable.pfnSetVertexShaderDecl(m_device, shader); - if (SUCCEEDED(result)) - { - m_vertexShaderDecl = shader; - } - return result; - } - HRESULT Device::unlock(const D3DDDIARG_UNLOCK* data) { flushPrimitives(); @@ -275,19 +236,6 @@ namespace D3dDdi return m_origVtable.pfnUnlock(m_device, data); } - HRESULT Device::updateWInfo(const D3DDDIARG_WINFO* data) - { - flushPrimitives(); - if (1.0f == data->WNear && 1.0f == data->WFar) - { - D3DDDIARG_WINFO wInfo = {}; - wInfo.WNear = 0.0f; - wInfo.WFar = 1.0f; - return m_origVtable.pfnUpdateWInfo(m_device, &wInfo); - } - return m_origVtable.pfnUpdateWInfo(m_device, data); - } - Resource* Device::getGdiResource() { return g_gdiResource; @@ -312,7 +260,7 @@ namespace D3dDdi void Device::add(HANDLE adapter, HANDLE device) { - s_devices.emplace(device, Device(adapter, device)); + s_devices.try_emplace(device, adapter, device); } Device& Device::get(HANDLE device) @@ -323,7 +271,7 @@ namespace D3dDdi return it->second; } - return s_devices.emplace(device, Device(nullptr, device)).first->second; + return s_devices.try_emplace(device, nullptr, device).first->second; } void Device::remove(HANDLE device) diff --git a/DDrawCompat/D3dDdi/Device.h b/DDrawCompat/D3dDdi/Device.h index 75ba4f1..0deec79 100644 --- a/DDrawCompat/D3dDdi/Device.h +++ b/DDrawCompat/D3dDdi/Device.h @@ -1,6 +1,5 @@ #pragma once -#include #include #include @@ -8,6 +7,7 @@ #include #include +#include #include namespace D3dDdi @@ -18,6 +18,13 @@ namespace D3dDdi class Device { public: + Device(HANDLE adapter, HANDLE device); + + Device(const Device&) = delete; + Device(Device&&) = delete; + Device& operator=(const Device&) = delete; + Device& operator=(Device&&) = delete; + operator HANDLE() const { return m_device; } HRESULT blt(const D3DDDIARG_BLT* data); @@ -38,14 +45,12 @@ namespace D3dDdi HRESULT setRenderTarget(const D3DDDIARG_SETRENDERTARGET* data); HRESULT setStreamSource(const D3DDDIARG_SETSTREAMSOURCE* data); HRESULT setStreamSourceUm(const D3DDDIARG_SETSTREAMSOURCEUM* data, const void* umBuffer); - HRESULT setTexture(UINT stage, HANDLE texture); - HRESULT setVertexShaderDecl(HANDLE shader); HRESULT unlock(const D3DDDIARG_UNLOCK* data); - HRESULT updateWInfo(const D3DDDIARG_WINFO* data); Adapter& getAdapter() const { return m_adapter; } const D3DDDI_DEVICEFUNCS& getOrigVtable() const { return m_origVtable; } Resource* getResource(HANDLE resource); + DeviceState& getState() { return m_state; } void flushPrimitives() { m_drawPrimitive.flushPrimitives(); } void prepareForRendering(HANDLE resource, UINT subResourceIndex, bool isReadOnly); @@ -62,8 +67,6 @@ namespace D3dDdi static void setReadOnlyGdiLock(bool enable); private: - Device(HANDLE adapter, HANDLE device); - template HRESULT createResourceImpl(Arg& data); @@ -74,9 +77,8 @@ namespace D3dDdi Resource* m_renderTarget; UINT m_renderTargetSubResourceIndex; HANDLE m_sharedPrimary; - std::array m_textures; - HANDLE m_vertexShaderDecl; DrawPrimitive m_drawPrimitive; + DeviceState m_state; static std::map s_devices; static bool s_isFlushEnabled; diff --git a/DDrawCompat/D3dDdi/DeviceFuncs.cpp b/DDrawCompat/D3dDdi/DeviceFuncs.cpp index 45fa948..0e2fbb8 100644 --- a/DDrawCompat/D3dDdi/DeviceFuncs.cpp +++ b/DDrawCompat/D3dDdi/DeviceFuncs.cpp @@ -3,12 +3,18 @@ namespace { - template + template HRESULT WINAPI deviceFunc(HANDLE device, Params... params) { return (D3dDdi::Device::get(device).*deviceMethod)(params...); } + template + HRESULT WINAPI deviceStateFunc(HANDLE device, Params... params) + { + return (D3dDdi::Device::get(device).getState().*deviceStateMethod)(params...); + } + HRESULT APIENTRY destroyDevice(HANDLE hDevice) { D3dDdi::Device::remove(hDevice); @@ -24,6 +30,7 @@ namespace } #define DEVICE_FUNC(func) deviceFunc +#define SET_DEVICE_STATE_FUNC(func) vtable.func = &deviceStateFunc namespace D3dDdi { @@ -31,7 +38,7 @@ namespace D3dDdi { Device::add(adapter, device); } - + void DeviceFuncs::setCompatVtable(D3DDDI_DEVICEFUNCS& vtable) { vtable.pfnBlt = &DEVICE_FUNC(blt); @@ -52,40 +59,41 @@ namespace D3dDdi vtable.pfnSetRenderTarget = &DEVICE_FUNC(setRenderTarget); vtable.pfnSetStreamSource = &DEVICE_FUNC(setStreamSource); vtable.pfnSetStreamSourceUm = &DEVICE_FUNC(setStreamSourceUm); - vtable.pfnSetTexture = &DEVICE_FUNC(setTexture); - vtable.pfnSetVertexShaderDecl = &DEVICE_FUNC(setVertexShaderDecl); vtable.pfnUnlock = &DEVICE_FUNC(unlock); - vtable.pfnUpdateWInfo = &DEVICE_FUNC(updateWInfo); + + SET_DEVICE_STATE_FUNC(pfnDeletePixelShader); + SET_DEVICE_STATE_FUNC(pfnDeleteVertexShaderDecl); + SET_DEVICE_STATE_FUNC(pfnDeleteVertexShaderFunc); + SET_DEVICE_STATE_FUNC(pfnSetPixelShader); + SET_DEVICE_STATE_FUNC(pfnSetPixelShaderConst); + SET_DEVICE_STATE_FUNC(pfnSetPixelShaderConstB); + SET_DEVICE_STATE_FUNC(pfnSetPixelShaderConstI); + SET_DEVICE_STATE_FUNC(pfnSetRenderState); + SET_DEVICE_STATE_FUNC(pfnSetTexture); + SET_DEVICE_STATE_FUNC(pfnSetTextureStageState); + SET_DEVICE_STATE_FUNC(pfnSetVertexShaderConst); + SET_DEVICE_STATE_FUNC(pfnSetVertexShaderConstB); + SET_DEVICE_STATE_FUNC(pfnSetVertexShaderConstI); + SET_DEVICE_STATE_FUNC(pfnSetVertexShaderDecl); + SET_DEVICE_STATE_FUNC(pfnSetVertexShaderFunc); + SET_DEVICE_STATE_FUNC(pfnSetZRange); + SET_DEVICE_STATE_FUNC(pfnUpdateWInfo); #define FLUSH_PRIMITIVES(func) vtable.func = &flushPrimitives FLUSH_PRIMITIVES(pfnBufBlt); FLUSH_PRIMITIVES(pfnBufBlt1); - FLUSH_PRIMITIVES(pfnDeletePixelShader); - FLUSH_PRIMITIVES(pfnDeleteVertexShaderDecl); - FLUSH_PRIMITIVES(pfnDeleteVertexShaderFunc); FLUSH_PRIMITIVES(pfnDepthFill); FLUSH_PRIMITIVES(pfnDiscard); FLUSH_PRIMITIVES(pfnGenerateMipSubLevels); FLUSH_PRIMITIVES(pfnSetClipPlane); FLUSH_PRIMITIVES(pfnSetDepthStencil); FLUSH_PRIMITIVES(pfnSetPalette); - FLUSH_PRIMITIVES(pfnSetPixelShader); - FLUSH_PRIMITIVES(pfnSetPixelShaderConst); - FLUSH_PRIMITIVES(pfnSetPixelShaderConstB); - FLUSH_PRIMITIVES(pfnSetPixelShaderConstI); - FLUSH_PRIMITIVES(pfnSetRenderState); FLUSH_PRIMITIVES(pfnSetScissorRect); - FLUSH_PRIMITIVES(pfnSetTextureStageState); - FLUSH_PRIMITIVES(pfnSetVertexShaderConst); - FLUSH_PRIMITIVES(pfnSetVertexShaderConstB); - FLUSH_PRIMITIVES(pfnSetVertexShaderConstI); - FLUSH_PRIMITIVES(pfnSetVertexShaderFunc); FLUSH_PRIMITIVES(pfnSetViewport); FLUSH_PRIMITIVES(pfnStateSet); FLUSH_PRIMITIVES(pfnTexBlt); FLUSH_PRIMITIVES(pfnTexBlt1); FLUSH_PRIMITIVES(pfnUpdatePalette); - FLUSH_PRIMITIVES(pfnSetZRange); #undef FLUSH_PRIMITIVES } } diff --git a/DDrawCompat/D3dDdi/DeviceState.cpp b/DDrawCompat/D3dDdi/DeviceState.cpp new file mode 100644 index 0000000..e8d4965 --- /dev/null +++ b/DDrawCompat/D3dDdi/DeviceState.cpp @@ -0,0 +1,240 @@ +#include +#include + +namespace +{ + bool operator==(const D3DDDIARG_ZRANGE& lhs, const D3DDDIARG_ZRANGE& rhs) + { + return lhs.MinZ == rhs.MinZ && lhs.MaxZ == rhs.MaxZ; + } + + bool operator==(const D3DDDIARG_WINFO& lhs, const D3DDDIARG_WINFO& rhs) + { + return lhs.WNear == rhs.WNear && lhs.WFar == rhs.WFar; + } +} + +namespace D3dDdi +{ + DeviceState::DeviceState(Device& device) + : m_device(device) + , m_pixelShader(nullptr) + , m_textures{} + , m_vertexShaderDecl(nullptr) + , m_vertexShaderFunc(nullptr) + , m_wInfo{ NAN, NAN } + , m_zRange{ NAN, NAN } + { + m_renderState.fill(0xBAADBAAD); + for (UINT i = 0; i < m_textureStageState.size(); ++i) + { + m_textureStageState[i].fill(0xBAADBAAD); + } + } + + HRESULT DeviceState::pfnDeletePixelShader(HANDLE shader) + { + return deleteShader(shader, m_pixelShader, m_device.getOrigVtable().pfnDeletePixelShader); + } + + HRESULT DeviceState::pfnDeleteVertexShaderDecl(HANDLE shader) + { + return deleteShader(shader, m_vertexShaderDecl, m_device.getOrigVtable().pfnDeleteVertexShaderDecl); + } + + HRESULT DeviceState::pfnDeleteVertexShaderFunc(HANDLE shader) + { + return deleteShader(shader, m_vertexShaderFunc, m_device.getOrigVtable().pfnDeleteVertexShaderFunc); + } + + HRESULT DeviceState::pfnSetPixelShader(HANDLE shader) + { + return setShader(shader, m_pixelShader, m_device.getOrigVtable().pfnSetPixelShader); + } + + HRESULT DeviceState::pfnSetPixelShaderConst(const D3DDDIARG_SETPIXELSHADERCONST* data, const FLOAT* registers) + { + return setShaderConst(data, registers, m_pixelShaderConst, m_device.getOrigVtable().pfnSetPixelShaderConst); + } + + HRESULT DeviceState::pfnSetPixelShaderConstB(const D3DDDIARG_SETPIXELSHADERCONSTB* data, const BOOL* registers) + { + return setShaderConst(data, registers, m_pixelShaderConstB, m_device.getOrigVtable().pfnSetPixelShaderConstB); + } + + HRESULT DeviceState::pfnSetPixelShaderConstI(const D3DDDIARG_SETPIXELSHADERCONSTI* data, const INT* registers) + { + return setShaderConst(data, registers, m_pixelShaderConstI, m_device.getOrigVtable().pfnSetPixelShaderConstI); + } + + HRESULT DeviceState::pfnSetRenderState(const D3DDDIARG_RENDERSTATE* data) + { + return setStateArray(data, m_renderState, m_device.getOrigVtable().pfnSetRenderState); + } + + HRESULT DeviceState::pfnSetTexture(UINT stage, HANDLE texture) + { + if (stage >= m_textures.size()) + { + m_device.flushPrimitives(); + return m_device.getOrigVtable().pfnSetTexture(m_device, stage, texture); + } + + if (texture == m_textures[stage]) + { + return S_OK; + } + + m_device.flushPrimitives(); + HRESULT result = m_device.getOrigVtable().pfnSetTexture(m_device, stage, texture); + if (SUCCEEDED(result)) + { + m_textures[stage] = texture; + } + return result; + } + + HRESULT DeviceState::pfnSetTextureStageState(const D3DDDIARG_TEXTURESTAGESTATE* data) + { + return setStateArray(data, m_textureStageState[data->Stage], m_device.getOrigVtable().pfnSetTextureStageState); + } + + HRESULT DeviceState::pfnSetVertexShaderConst(const D3DDDIARG_SETVERTEXSHADERCONST* data, const void* registers) + { + return setShaderConst(data, registers, m_vertexShaderConst, m_device.getOrigVtable().pfnSetVertexShaderConst); + } + + HRESULT DeviceState::pfnSetVertexShaderConstB(const D3DDDIARG_SETVERTEXSHADERCONSTB* data, const BOOL* registers) + { + return setShaderConst(data, registers, m_vertexShaderConstB, m_device.getOrigVtable().pfnSetVertexShaderConstB); + } + + HRESULT DeviceState::pfnSetVertexShaderConstI(const D3DDDIARG_SETVERTEXSHADERCONSTI* data, const INT* registers) + { + return setShaderConst(data, registers, m_vertexShaderConstI, m_device.getOrigVtable().pfnSetVertexShaderConstI); + } + + HRESULT DeviceState::pfnSetVertexShaderDecl(HANDLE shader) + { + return setShader(shader, m_vertexShaderDecl, m_device.getOrigVtable().pfnSetVertexShaderDecl); + } + + HRESULT DeviceState::pfnSetVertexShaderFunc(HANDLE shader) + { + return setShader(shader, m_vertexShaderFunc, m_device.getOrigVtable().pfnSetVertexShaderFunc); + } + + HRESULT DeviceState::pfnSetZRange(const D3DDDIARG_ZRANGE* data) + { + return setState(data, m_zRange, m_device.getOrigVtable().pfnSetZRange); + } + + HRESULT DeviceState::pfnUpdateWInfo(const D3DDDIARG_WINFO* data) + { + D3DDDIARG_WINFO wInfo = *data; + if (1.0f == wInfo.WNear && 1.0f == wInfo.WFar) + { + wInfo.WNear = 0.0f; + } + return setState(&wInfo, m_wInfo, m_device.getOrigVtable().pfnUpdateWInfo); + } + + HRESULT DeviceState::deleteShader(HANDLE shader, HANDLE& currentShader, + HRESULT(APIENTRY* origDeleteShaderFunc)(HANDLE, HANDLE)) + { + if (shader == currentShader) + { + m_device.flushPrimitives(); + } + + HRESULT result = origDeleteShaderFunc(m_device, shader); + if (SUCCEEDED(result) && shader == currentShader) + { + currentShader = nullptr; + } + return result; + } + + HRESULT DeviceState::setShader(HANDLE shader, HANDLE& currentShader, + HRESULT(APIENTRY* origSetShaderFunc)(HANDLE, HANDLE)) + { + if (shader == currentShader) + { + return S_OK; + } + + m_device.flushPrimitives(); + HRESULT result = origSetShaderFunc(m_device, shader); + if (SUCCEEDED(result)) + { + currentShader = shader; + } + return result; + } + + template + HRESULT DeviceState::setShaderConst(const SetShaderConstData* data, const Registers* registers, + std::vector& shaderConst, + HRESULT(APIENTRY* origSetShaderConstFunc)(HANDLE, const SetShaderConstData*, const Registers*)) + { + if (data->Register + data->Count > shaderConst.size()) + { + shaderConst.resize(data->Register + data->Count); + } + + if (0 == memcmp(&shaderConst[data->Register], registers, data->Count * sizeof(ShaderConst))) + { + return S_OK; + } + + m_device.flushPrimitives(); + HRESULT result = origSetShaderConstFunc(m_device, data, registers); + if (SUCCEEDED(result)) + { + memcpy(&shaderConst[data->Register], registers, data->Count * sizeof(ShaderConst)); + } + return result; + } + + template + HRESULT DeviceState::setState(const StateData* data, StateData& currentState, + HRESULT(APIENTRY* origSetState)(HANDLE, const StateData*)) + { + if (*data == currentState) + { + return S_OK; + } + + m_device.flushPrimitives(); + HRESULT result = origSetState(m_device, data); + if (SUCCEEDED(result)) + { + currentState = *data; + } + return result; + } + + template + HRESULT DeviceState::setStateArray(const StateData* data, std::array& currentState, + HRESULT(APIENTRY* origSetState)(HANDLE, const StateData*)) + { + if (data->State >= static_cast(currentState.size())) + { + m_device.flushPrimitives(); + return origSetState(m_device, data); + } + + if (data->Value == currentState[data->State]) + { + return S_OK; + } + + m_device.flushPrimitives(); + HRESULT result = origSetState(m_device, data); + if (SUCCEEDED(result)) + { + currentState[data->State] = data->Value; + } + return result; + } +} diff --git a/DDrawCompat/D3dDdi/DeviceState.h b/DDrawCompat/D3dDdi/DeviceState.h new file mode 100644 index 0000000..4a084f5 --- /dev/null +++ b/DDrawCompat/D3dDdi/DeviceState.h @@ -0,0 +1,71 @@ +#pragma once + +#include +#include + +namespace D3dDdi +{ + class Device; + + class DeviceState + { + public: + DeviceState(Device& device); + + HRESULT pfnDeletePixelShader(HANDLE shader); + HRESULT pfnDeleteVertexShaderDecl(HANDLE shader); + HRESULT pfnDeleteVertexShaderFunc(HANDLE shader); + HRESULT pfnSetPixelShader(HANDLE shader); + HRESULT pfnSetPixelShaderConst(const D3DDDIARG_SETPIXELSHADERCONST* data, const FLOAT* registers); + HRESULT pfnSetPixelShaderConstB(const D3DDDIARG_SETPIXELSHADERCONSTB* data, const BOOL* registers); + HRESULT pfnSetPixelShaderConstI(const D3DDDIARG_SETPIXELSHADERCONSTI* data, const INT* registers); + HRESULT pfnSetRenderState(const D3DDDIARG_RENDERSTATE* data); + HRESULT pfnSetTexture(UINT stage, HANDLE texture); + HRESULT pfnSetTextureStageState(const D3DDDIARG_TEXTURESTAGESTATE* data); + HRESULT pfnSetVertexShaderConst(const D3DDDIARG_SETVERTEXSHADERCONST* data, const void* registers); + HRESULT pfnSetVertexShaderConstB(const D3DDDIARG_SETVERTEXSHADERCONSTB* data, const BOOL* registers); + HRESULT pfnSetVertexShaderConstI(const D3DDDIARG_SETVERTEXSHADERCONSTI* data, const INT* registers); + HRESULT pfnSetVertexShaderDecl(HANDLE shader); + HRESULT pfnSetVertexShaderFunc(HANDLE shader); + HRESULT pfnSetZRange(const D3DDDIARG_ZRANGE* data); + HRESULT pfnUpdateWInfo(const D3DDDIARG_WINFO* data); + + private: + typedef std::tuple ShaderConstF; + typedef std::tuple ShaderConstI; + + HRESULT deleteShader(HANDLE shader, HANDLE& currentShader, + HRESULT(APIENTRY* origDeleteShaderFunc)(HANDLE, HANDLE)); + HRESULT setShader(HANDLE shader, HANDLE& currentShader, + HRESULT(APIENTRY* origSetShaderFunc)(HANDLE, HANDLE)); + + template + HRESULT setShaderConst(const SetShaderConstData* data, const Registers* registers, + std::vector& shaderConst, + HRESULT(APIENTRY* origSetShaderConstFunc)(HANDLE, const SetShaderConstData*, const Registers*)); + + template + HRESULT setState(const StateData* data, StateData& currentState, + HRESULT(APIENTRY* origSetState)(HANDLE, const StateData*)); + + template + HRESULT setStateArray(const StateData* data, std::array& currentState, + HRESULT(APIENTRY* origSetState)(HANDLE, const StateData*)); + + Device& m_device; + HANDLE m_pixelShader; + std::vector m_pixelShaderConst; + std::vector m_pixelShaderConstB; + std::vector m_pixelShaderConstI; + std::array m_renderState; + std::array m_textures; + std::array, 8> m_textureStageState; + std::vector m_vertexShaderConst; + std::vector m_vertexShaderConstB; + std::vector m_vertexShaderConstI; + HANDLE m_vertexShaderDecl; + HANDLE m_vertexShaderFunc; + D3DDDIARG_WINFO m_wInfo; + D3DDDIARG_ZRANGE m_zRange; + }; +} diff --git a/DDrawCompat/D3dDdi/DrawPrimitive.cpp b/DDrawCompat/D3dDdi/DrawPrimitive.cpp index b17d4ce..b7333ff 100644 --- a/DDrawCompat/D3dDdi/DrawPrimitive.cpp +++ b/DDrawCompat/D3dDdi/DrawPrimitive.cpp @@ -598,6 +598,8 @@ namespace D3dDdi { return S_OK; } + + LOG_DEBUG << "Flushing " << m_batched.primitiveCount << " primitives of type " << m_batched.primitiveType; return m_batched.indices.empty() ? flush(flagBuffer) : flushIndexed(flagBuffer); } diff --git a/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.cpp b/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.cpp index 18b18c9..895e190 100644 --- a/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.cpp +++ b/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.cpp @@ -197,6 +197,13 @@ std::ostream& operator<<(std::ostream& os, const D3DDDIARG_RENDERSTATE& val) << val.Value; } +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_SETPIXELSHADERCONST& val) +{ + return Compat::LogStruct(os) + << val.Register + << val.Count; +} + std::ostream& operator<<(std::ostream& os, const D3DDDIARG_SETRENDERTARGET& val) { return Compat::LogStruct(os) @@ -221,6 +228,13 @@ std::ostream& operator<<(std::ostream& os, const D3DDDIARG_SETSTREAMSOURCEUM& va << val.Stride; } +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_SETVERTEXSHADERCONST& val) +{ + return Compat::LogStruct(os) + << val.Register + << val.Count; +} + std::ostream& operator<<(std::ostream& os, const D3DDDIARG_TEXTURESTAGESTATE& val) { return Compat::LogStruct(os) diff --git a/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.h b/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.h index a188706..323eb83 100644 --- a/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.h +++ b/DDrawCompat/D3dDdi/Log/DeviceFuncsLog.h @@ -24,9 +24,11 @@ std::ostream& operator<<(std::ostream& os, const D3DDDIARG_PRESENT& val); std::ostream& operator<<(std::ostream& os, const D3DDDIARG_PRESENT1& val); std::ostream& operator<<(std::ostream& os, const D3DDDIARG_PRESENTSURFACE& val); std::ostream& operator<<(std::ostream& os, const D3DDDIARG_RENDERSTATE& val); +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_SETPIXELSHADERCONST& val); std::ostream& operator<<(std::ostream& os, const D3DDDIARG_SETRENDERTARGET& val); std::ostream& operator<<(std::ostream& os, const D3DDDIARG_SETSTREAMSOURCE& val); std::ostream& operator<<(std::ostream& os, const D3DDDIARG_SETSTREAMSOURCEUM& val); +std::ostream& operator<<(std::ostream& os, const D3DDDIARG_SETVERTEXSHADERCONST& val); std::ostream& operator<<(std::ostream& os, const D3DDDIARG_TEXTURESTAGESTATE& val); std::ostream& operator<<(std::ostream& os, const D3DDDIARG_UNLOCK& val); std::ostream& operator<<(std::ostream& os, const D3DDDIARG_WINFO& val); diff --git a/DDrawCompat/DDrawCompat.vcxproj b/DDrawCompat/DDrawCompat.vcxproj index f02aac6..b5e74e5 100644 --- a/DDrawCompat/DDrawCompat.vcxproj +++ b/DDrawCompat/DDrawCompat.vcxproj @@ -154,6 +154,7 @@ + @@ -244,6 +245,7 @@ + diff --git a/DDrawCompat/DDrawCompat.vcxproj.filters b/DDrawCompat/DDrawCompat.vcxproj.filters index 9f97a2b..d7d0a9b 100644 --- a/DDrawCompat/DDrawCompat.vcxproj.filters +++ b/DDrawCompat/DDrawCompat.vcxproj.filters @@ -390,6 +390,9 @@ Header Files\D3dDdi + + Header Files\D3dDdi + @@ -599,5 +602,8 @@ Source Files\D3dDdi + + Source Files\D3dDdi + \ No newline at end of file