diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index e8ef3012648..93cc2996080 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -5147,9 +5147,9 @@ namespace dxvk { if (CanSWVP()) return UploadSoftwareConstantSet(m_state.vsConsts, m_vsLayout); else - return UploadConstantSet(m_state.vsConsts, m_vsLayout, m_state.vertexShader); + return UploadConstantSet(m_state.vsConsts.get(), m_vsLayout, m_state.vertexShader); } else { - return UploadConstantSet (m_state.psConsts, m_psLayout, m_state.pixelShader); + return UploadConstantSet (m_state.psConsts.get(), m_psLayout, m_state.pixelShader); } } @@ -6257,7 +6257,7 @@ namespace dxvk { if (likely(!CanSWVP())) { UpdateVertexBoolSpec( - m_state.vsConsts.bConsts[0] & + m_state.vsConsts->bConsts[0] & m_consts[DxsoProgramType::VertexShader].meta.boolConstantMask); } else UpdateVertexBoolSpec(0); @@ -6285,7 +6285,7 @@ namespace dxvk { UpdatePixelShaderSamplerSpec(m_textureTypes, programInfo.minorVersion() >= 4 ? 0u : projected, fetch4); // For implicit samplers... UpdatePixelBoolSpec( - m_state.psConsts.bConsts[0] & + m_state.psConsts->bConsts[0] & m_consts[DxsoProgramType::PixelShader].meta.boolConstantMask); } else { @@ -6526,16 +6526,16 @@ namespace dxvk { void D3D9DeviceEx::SetVertexBoolBitfield(uint32_t idx, uint32_t mask, uint32_t bits) { - m_state.vsConsts.bConsts[idx] &= ~mask; - m_state.vsConsts.bConsts[idx] |= bits & mask; + m_state.vsConsts->bConsts[idx] &= ~mask; + m_state.vsConsts->bConsts[idx] |= bits & mask; m_consts[DxsoProgramTypes::VertexShader].dirty = true; } void D3D9DeviceEx::SetPixelBoolBitfield(uint32_t idx, uint32_t mask, uint32_t bits) { - m_state.psConsts.bConsts[idx] &= ~mask; - m_state.psConsts.bConsts[idx] |= bits & mask; + m_state.psConsts->bConsts[idx] &= ~mask; + m_state.psConsts->bConsts[idx] |= bits & mask; m_consts[DxsoProgramTypes::PixelShader].dirty = true; } @@ -7246,11 +7246,11 @@ namespace dxvk { for (uint32_t i = 0; i < caps::MaxStreams; i++) m_state.streamFreq[i] = 1; - for (uint32_t i = 0; i < m_state.textures.size(); i++) + for (uint32_t i = 0; i < m_state.textures->size(); i++) SetStateTexture(i, nullptr); EmitCs([ - cSize = m_state.textures.size() + cSize = m_state.textures->size() ](DxvkContext* ctx) { VkShaderStageFlags stage = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT; @@ -7265,7 +7265,7 @@ namespace dxvk { m_depthTextures = 0; m_cubeTextures = 0; - auto& ss = m_state.samplerStates; + auto& ss = m_state.samplerStates.get(); for (uint32_t i = 0; i < ss.size(); i++) { auto& state = ss[i]; state[D3DSAMP_ADDRESSU] = D3DTADDRESS_WRAP; diff --git a/src/d3d9/d3d9_device.h b/src/d3d9/d3d9_device.h index 63e9fd476fe..bd379266de8 100644 --- a/src/d3d9/d3d9_device.h +++ b/src/d3d9/d3d9_device.h @@ -1093,13 +1093,13 @@ namespace dxvk { return D3DERR_INVALIDCALL; if constexpr (ConstantType == D3D9ConstantType::Float) { - const float* source = set.fConsts[StartRegister].data; + const float* source = set->fConsts[StartRegister].data; const size_t size = Count * sizeof(Vector4); std::memcpy(pConstantData, source, size); } else if constexpr (ConstantType == D3D9ConstantType::Int) { - const int* source = set.iConsts[StartRegister].data; + const int* source = set->iConsts[StartRegister].data; const size_t size = Count * sizeof(Vector4i); std::memcpy(pConstantData, source, size); @@ -1112,7 +1112,7 @@ namespace dxvk { const uint32_t bit = (1u << bitIdx); - bool constValue = set.bConsts[arrayIdx] & bit; + bool constValue = set->bConsts[arrayIdx] & bit; pConstantData[i] = constValue ? TRUE : FALSE; } } diff --git a/src/d3d9/d3d9_state.cpp b/src/d3d9/d3d9_state.cpp index 2c32bef45d9..af749cf765e 100644 --- a/src/d3d9/d3d9_state.cpp +++ b/src/d3d9/d3d9_state.cpp @@ -4,17 +4,25 @@ namespace dxvk { - D3D9CapturableState::D3D9CapturableState() { - for (uint32_t i = 0; i < streamFreq.size(); i++) - streamFreq[i] = 1; - - for (uint32_t i = 0; i < enabledLightIndices.size(); i++) - enabledLightIndices[i] = UINT32_MAX; - } - - D3D9CapturableState::~D3D9CapturableState() { - for (uint32_t i = 0; i < textures.size(); i++) - TextureChangePrivate(textures[i], nullptr); - } + template