mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[d3d9] Fix up unsupported sample counts
This commit is contained in:
parent
74a8bfb774
commit
9e110cd3e5
@ -134,7 +134,7 @@ namespace dxvk {
|
||||
if (pDesc->Width == 0 || pDesc->Height == 0 || pDesc->Depth == 0)
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
if (FAILED(DecodeMultiSampleType(pDesc->MultiSample, pDesc->MultisampleQuality, nullptr)))
|
||||
if (FAILED(DecodeMultiSampleType(pDevice->GetDXVKDevice(), pDesc->MultiSample, pDesc->MultisampleQuality, nullptr)))
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
// Using MANAGED pool with DYNAMIC usage is illegal
|
||||
@ -258,7 +258,7 @@ namespace dxvk {
|
||||
imageInfo.stages |= VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
||||
}
|
||||
|
||||
DecodeMultiSampleType(m_desc.MultiSample, m_desc.MultisampleQuality, &imageInfo.sampleCount);
|
||||
DecodeMultiSampleType(m_device->GetDXVKDevice(), m_desc.MultiSample, m_desc.MultisampleQuality, &imageInfo.sampleCount);
|
||||
|
||||
// The image must be marked as mutable if it can be reinterpreted
|
||||
// by a view with a different format. Depth-stencil formats cannot
|
||||
|
@ -6836,7 +6836,7 @@ namespace dxvk {
|
||||
const D3D9_COMMON_TEXTURE_DESC* dstDesc = dstTextureInfo->Desc();
|
||||
|
||||
VkSampleCountFlagBits dstSampleCount;
|
||||
DecodeMultiSampleType(dstDesc->MultiSample, dstDesc->MultisampleQuality, &dstSampleCount);
|
||||
DecodeMultiSampleType(m_dxvkDevice, dstDesc->MultiSample, dstDesc->MultisampleQuality, &dstSampleCount);
|
||||
|
||||
if (unlikely(dstSampleCount != VK_SAMPLE_COUNT_1_BIT)) {
|
||||
Logger::warn("D3D9DeviceEx::ResolveZ: dstSampleCount != 1. Discarding.");
|
||||
@ -6868,7 +6868,7 @@ namespace dxvk {
|
||||
srcSubresource.arrayLayer, 1 };
|
||||
|
||||
VkSampleCountFlagBits srcSampleCount;
|
||||
DecodeMultiSampleType(srcDesc->MultiSample, srcDesc->MultisampleQuality, &srcSampleCount);
|
||||
DecodeMultiSampleType(m_dxvkDevice, srcDesc->MultiSample, srcDesc->MultisampleQuality, &srcSampleCount);
|
||||
|
||||
if (srcSampleCount == VK_SAMPLE_COUNT_1_BIT) {
|
||||
EmitCs([
|
||||
|
@ -37,9 +37,10 @@ namespace dxvk {
|
||||
|
||||
|
||||
HRESULT DecodeMultiSampleType(
|
||||
const Rc<DxvkDevice>& pDevice,
|
||||
D3DMULTISAMPLE_TYPE MultiSample,
|
||||
DWORD MultisampleQuality,
|
||||
VkSampleCountFlagBits* pCount) {
|
||||
VkSampleCountFlagBits* pSampleCount) {
|
||||
uint32_t sampleCount = std::max<uint32_t>(MultiSample, 1u);
|
||||
|
||||
// Check if this is a power of two...
|
||||
@ -49,8 +50,14 @@ namespace dxvk {
|
||||
if (MultiSample == D3DMULTISAMPLE_NONMASKABLE)
|
||||
sampleCount = 1u << MultisampleQuality;
|
||||
|
||||
if (pCount != nullptr)
|
||||
*pCount = VkSampleCountFlagBits(sampleCount);
|
||||
const auto& limits = pDevice->properties().core.properties.limits;
|
||||
VkSampleCountFlags supportedSampleCounts = limits.framebufferColorSampleCounts & limits.framebufferDepthSampleCounts;
|
||||
|
||||
while (sampleCount > supportedSampleCounts)
|
||||
sampleCount >>= 1;
|
||||
|
||||
if (pSampleCount)
|
||||
*pSampleCount = VkSampleCountFlagBits(sampleCount);
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
@ -95,9 +95,10 @@ namespace dxvk {
|
||||
ID3DBlob** ppDisassembly);
|
||||
|
||||
HRESULT DecodeMultiSampleType(
|
||||
D3DMULTISAMPLE_TYPE MultiSample,
|
||||
DWORD MultisampleQuality,
|
||||
VkSampleCountFlagBits* pCount);
|
||||
const Rc<DxvkDevice>& pDevice,
|
||||
D3DMULTISAMPLE_TYPE MultiSample,
|
||||
DWORD MultisampleQuality,
|
||||
VkSampleCountFlagBits* pSampleCount);
|
||||
|
||||
VkFormat GetPackedDepthStencilFormat(D3D9Format Format);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user