1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-21 13:54:18 +01:00

[d3d9] Flush format converter in device after init

Otherwise we can be overwritten if its a new resource we just created by the initializer.
This commit is contained in:
Joshua Ashton 2020-02-29 14:00:15 +00:00
parent 58316ebe4c
commit 077f48b4ef
3 changed files with 22 additions and 2 deletions

View File

@ -4682,6 +4682,7 @@ namespace dxvk {
D3D9DeviceLock lock = LockDevice(); D3D9DeviceLock lock = LockDevice();
m_initializer->Flush(); m_initializer->Flush();
m_converter->Flush();
if (m_csIsBusy || !m_csChunk->empty()) { if (m_csIsBusy || !m_csChunk->empty()) {
// Add commands to flush the threaded // Add commands to flush the threaded

View File

@ -14,6 +14,12 @@ namespace dxvk {
} }
void D3D9FormatHelper::Flush() {
if (m_transferCommands != 0)
FlushInternal();
}
void D3D9FormatHelper::ConvertFormat( void D3D9FormatHelper::ConvertFormat(
D3D9_CONVERSION_FORMAT_INFO conversionFormat, D3D9_CONVERSION_FORMAT_INFO conversionFormat,
const Rc<DxvkImage>& dstImage, const Rc<DxvkImage>& dstImage,
@ -67,7 +73,7 @@ namespace dxvk {
(imageExtent.height / 8) + (imageExtent.height % 8), (imageExtent.height / 8) + (imageExtent.height % 8),
1); 1);
m_context->flushCommandList(); m_transferCommands += 1;
} }
@ -112,7 +118,7 @@ namespace dxvk {
// Reset the spec constants used... // Reset the spec constants used...
m_context->setSpecConstant(VK_PIPELINE_BIND_POINT_COMPUTE, 0, 0); m_context->setSpecConstant(VK_PIPELINE_BIND_POINT_COMPUTE, 0, 0);
m_context->flushCommandList(); m_transferCommands += 1;
} }
@ -135,4 +141,11 @@ namespace dxvk {
{ 0u, 0u, 0u, sizeof(VkExtent2D) }, code); { 0u, 0u, 0u, sizeof(VkExtent2D) }, code);
} }
void D3D9FormatHelper::FlushInternal() {
m_context->flushCommandList();
m_transferCommands = 0;
}
} }

View File

@ -13,6 +13,8 @@ namespace dxvk {
D3D9FormatHelper(const Rc<DxvkDevice>& device); D3D9FormatHelper(const Rc<DxvkDevice>& device);
void Flush();
void ConvertFormat( void ConvertFormat(
D3D9_CONVERSION_FORMAT_INFO conversionFormat, D3D9_CONVERSION_FORMAT_INFO conversionFormat,
const Rc<DxvkImage>& dstImage, const Rc<DxvkImage>& dstImage,
@ -43,9 +45,13 @@ namespace dxvk {
Rc<DxvkShader> InitShader(SpirvCodeBuffer code); Rc<DxvkShader> InitShader(SpirvCodeBuffer code);
void FlushInternal();
Rc<DxvkDevice> m_device; Rc<DxvkDevice> m_device;
Rc<DxvkContext> m_context; Rc<DxvkContext> m_context;
size_t m_transferCommands = 0;
std::array<Rc<DxvkShader>, D3D9ConversionFormat_Count> m_shaders; std::array<Rc<DxvkShader>, D3D9ConversionFormat_Count> m_shaders;
}; };