diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 2a037118f..3fae30c09 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -38,18 +38,18 @@ namespace dxvk { HWND hFocusWindow, DWORD BehaviorFlags, Rc dxvkDevice) - : m_adapter ( pAdapter ) - , m_dxvkDevice ( dxvkDevice ) - , m_csThread ( dxvkDevice->createContext() ) - , m_csChunk ( AllocCsChunk() ) - , m_parent ( pParent ) + : m_parent ( pParent ) , m_deviceType ( DeviceType ) , m_window ( hFocusWindow ) , m_behaviorFlags ( BehaviorFlags ) - , m_multithread ( BehaviorFlags & D3DCREATE_MULTITHREADED ) + , m_adapter ( pAdapter ) + , m_dxvkDevice ( dxvkDevice ) , m_shaderModules ( new D3D9ShaderModuleSet ) , m_d3d9Options ( dxvkDevice, pParent->GetInstance()->config() ) - , m_isSWVP ( (BehaviorFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING) ? TRUE : FALSE ) { + , m_multithread ( BehaviorFlags & D3DCREATE_MULTITHREADED ) + , m_isSWVP ( (BehaviorFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING) ? true : false ) + , m_csThread ( dxvkDevice->createContext() ) + , m_csChunk ( AllocCsChunk() ) { // If we can SWVP, then we use an extended constant set // as SWVP has many more slots available than HWVP. bool canSWVP = CanSWVP(); diff --git a/src/d3d9/d3d9_device.h b/src/d3d9/d3d9_device.h index 2c70c00f9..05ae5b935 100644 --- a/src/d3d9/d3d9_device.h +++ b/src/d3d9/d3d9_device.h @@ -918,33 +918,6 @@ namespace dxvk { private: - D3D9DeviceFlags m_flags; - uint32_t m_dirtySamplerStates = 0; - uint32_t m_dirtyTextures = 0; - // Last state of depth textures. Doesn't update when NULL is bound. - // & with m_activeTextures to normalize. - uint32_t m_depthTextures = 0; - - D3D9Adapter* m_adapter; - Rc m_dxvkDevice; - - Rc m_updateBuffer; - DxvkCsChunkPool m_csChunkPool; - dxvk::high_resolution_clock::time_point m_lastFlush - = dxvk::high_resolution_clock::now(); - DxvkCsThread m_csThread; - bool m_csIsBusy = false; - - uint32_t m_frameLatency = DefaultFrameLatency; - - D3D9Initializer* m_initializer = nullptr; - D3D9FormatHelper* m_converter = nullptr; - - DxvkCsChunkRef m_csChunk; - - D3D9FFShaderModuleSet m_ffModules; - D3D9SWVPEmulator m_swvpEmulator; - DxvkCsChunkRef AllocCsChunk() { DxvkCsChunk* chunk = m_csChunkPool.allocChunk(DxvkCsChunkFlag::SingleUse); return DxvkCsChunkRef(chunk, &m_csChunkPool); @@ -984,102 +957,6 @@ namespace dxvk { return D3D9ShaderPermutations::None; } - Com m_parent; - D3DDEVTYPE m_deviceType; - HWND m_window; - - DWORD m_behaviorFlags; - Direct3DState9 m_state; - Com m_recorder; - D3D9Multithread m_multithread; - - Rc m_shaderModules; - - D3D9ConstantSets m_consts[DxsoProgramTypes::Count]; - - Rc m_vsClipPlanes; - - Rc m_vsFixedFunction; - Rc m_vsVertexBlend; - Rc m_psFixedFunction; - Rc m_psShared; - - D3D9BufferSlice m_upBuffer; - D3D9BufferSlice m_managedUploadBuffer; - - const D3D9Options m_d3d9Options; - DxsoOptions m_dxsoOptions; - - BOOL m_isSWVP; - - D3DPRESENT_PARAMETERS m_presentParams; - - D3D9Cursor m_cursor; - - Com m_autoDepthStencil; - - Com m_implicitSwapchain; - - std::unordered_map< - D3D9SamplerKey, - Rc, - D3D9SamplerKeyHash, - D3D9SamplerKeyEq> m_samplers; - - std::unordered_map< - DWORD, - Com> m_fvfTable; - - D3D9InputAssemblyState m_iaState; - - uint32_t m_instancedData = 0; - uint32_t m_lastSamplerTypeBitfield = 0; - uint32_t m_samplerTypeBitfield = 0; - uint32_t m_lastProjectionBitfield = 0; - uint32_t m_projectionBitfield = 0; - - uint32_t m_lastBoolSpecConstantVertex = 0; - uint32_t m_lastBoolSpecConstantPixel = 0; - - uint32_t m_lastPointMode = 0; - - uint32_t m_activeRTs = 0; - uint32_t m_activeRTTextures = 0; - uint32_t m_activeDSTextures = 0; - uint32_t m_activeHazardsRT = 0; - uint32_t m_alphaSwizzleRTs = 0; - uint32_t m_activeTextures = 0; - uint32_t m_activeTexturesToUpload = 0; - uint32_t m_activeTexturesToGen = 0; - uint32_t m_boundRTs = 0; - - uint32_t m_fetch4Enabled = 0; - uint32_t m_fetch4 = 0; - uint32_t m_lastFetch4 = 0; - - uint32_t m_activeHazardsDS = 0; - uint32_t m_lastHazardsDS = 0; - - uint32_t m_lastSamplerDepthMode = 0; - - D3D9ShaderMasks m_vsShaderMasks = D3D9ShaderMasks(); - D3D9ShaderMasks m_psShaderMasks = FixedFunctionMask; - - D3D9ViewportInfo m_viewportInfo; - - std::atomic m_availableMemory = 0; - std::atomic m_samplerCount = 0; - - bool m_amdATOC = false; - bool m_nvATOC = false; - bool m_ffZTest = false; - - float m_depthBiasScale = 0.0f; - - D3D9ConstantLayout m_vsLayout; - D3D9ConstantLayout m_psLayout; - void DetermineConstantLayouts(bool canSWVP); template @@ -1243,6 +1120,124 @@ namespace dxvk { void UpdateSamplerDepthModeSpecConstant(uint32_t value); + Com m_parent; + D3DDEVTYPE m_deviceType; + HWND m_window; + WORD m_behaviorFlags; + D3DPRESENT_PARAMETERS m_presentParams; + + D3D9Adapter* m_adapter; + Rc m_dxvkDevice; + + uint32_t m_frameLatency = DefaultFrameLatency; + + D3D9Initializer* m_initializer = nullptr; + D3D9FormatHelper* m_converter = nullptr; + + D3D9FFShaderModuleSet m_ffModules; + D3D9SWVPEmulator m_swvpEmulator; + + Com m_recorder; + + Rc m_shaderModules; + + Rc m_vsClipPlanes; + + Rc m_vsFixedFunction; + Rc m_vsVertexBlend; + Rc m_psFixedFunction; + Rc m_psShared; + + D3D9BufferSlice m_upBuffer; + D3D9BufferSlice m_managedUploadBuffer; + + D3D9Cursor m_cursor; + + Com m_autoDepthStencil; + + Com m_implicitSwapchain; + + const D3D9Options m_d3d9Options; + DxsoOptions m_dxsoOptions; + + std::unordered_map< + D3D9SamplerKey, + Rc, + D3D9SamplerKeyHash, + D3D9SamplerKeyEq> m_samplers; + + std::unordered_map< + DWORD, + Com> m_fvfTable; + + D3D9Multithread m_multithread; + D3D9InputAssemblyState m_iaState; + + D3D9DeviceFlags m_flags; + // Last state of depth textures. Doesn't update when NULL is bound. + // & with m_activeTextures to normalize. + uint32_t m_instancedData = 0; + + uint32_t m_depthTextures = 0; + uint32_t m_samplerTypeBitfield = 0; + uint32_t m_projectionBitfield = 0; + + uint32_t m_dirtySamplerStates = 0; + uint32_t m_dirtyTextures = 0; + + uint32_t m_boundRTs = 0; + + uint32_t m_activeRTs = 0; + uint32_t m_activeRTTextures = 0; + uint32_t m_activeDSTextures = 0; + uint32_t m_activeHazardsRT = 0; + uint32_t m_activeHazardsDS = 0; + uint32_t m_alphaSwizzleRTs = 0; + uint32_t m_activeTextures = 0; + uint32_t m_activeTexturesToUpload = 0; + uint32_t m_activeTexturesToGen = 0; + + uint32_t m_fetch4Enabled = 0; + uint32_t m_fetch4 = 0; + + uint32_t m_lastBoolSpecConstantVertex = 0; + uint32_t m_lastBoolSpecConstantPixel = 0; + uint32_t m_lastSamplerDepthMode = 0; + uint32_t m_lastProjectionBitfield = 0; + uint32_t m_lastSamplerTypeBitfield = 0; + uint32_t m_lastPointMode = 0; + uint32_t m_lastFetch4 = 0; + uint32_t m_lastHazardsDS = 0; + + D3D9ShaderMasks m_vsShaderMasks = D3D9ShaderMasks(); + D3D9ShaderMasks m_psShaderMasks = FixedFunctionMask; + + bool m_isSWVP; + bool m_amdATOC = false; + bool m_nvATOC = false; + bool m_ffZTest = false; + + float m_depthBiasScale = 0.0f; + + D3D9ConstantLayout m_vsLayout; + D3D9ConstantLayout m_psLayout; + D3D9ConstantSets m_consts[DxsoProgramTypes::Count]; + + D3D9ViewportInfo m_viewportInfo; + + DxvkCsChunkPool m_csChunkPool; + dxvk::high_resolution_clock::time_point m_lastFlush + = dxvk::high_resolution_clock::now(); + DxvkCsThread m_csThread; + DxvkCsChunkRef m_csChunk; + bool m_csIsBusy = false; + + std::atomic m_availableMemory = { 0 }; + std::atomic m_samplerCount = { 0 }; + + Direct3DState9 m_state; + }; }