mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-01 16:24:12 +01:00
[d3d9] Try to create offscreen surfaces with render target usage
This commit is contained in:
parent
1f5ddde411
commit
02c79d892c
@ -26,14 +26,19 @@ namespace dxvk {
|
||||
m_shadow = DetermineShadowState();
|
||||
|
||||
if (m_mapMode == D3D9_COMMON_TEXTURE_MAP_MODE_BACKED) {
|
||||
bool plainSurface = m_type == D3DRTYPE_SURFACE &&
|
||||
!(m_desc.Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL));
|
||||
|
||||
try {
|
||||
m_image = CreatePrimaryImage(ResourceType);
|
||||
m_image = CreatePrimaryImage(ResourceType, plainSurface);
|
||||
}
|
||||
catch (const DxvkError& e) {
|
||||
if (m_desc.Usage & D3DUSAGE_AUTOGENMIPMAP) {
|
||||
// D3DUSAGE_AUTOGENMIPMAP and offscreen plain is mutually exclusive
|
||||
// so we can combine their retry this way.
|
||||
if (m_desc.Usage & D3DUSAGE_AUTOGENMIPMAP || plainSurface) {
|
||||
m_desc.Usage &= ~D3DUSAGE_AUTOGENMIPMAP;
|
||||
m_desc.MipLevels = 1;
|
||||
m_image = CreatePrimaryImage(ResourceType);
|
||||
m_image = CreatePrimaryImage(ResourceType, false);
|
||||
}
|
||||
else
|
||||
throw e;
|
||||
@ -185,7 +190,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkImage> D3D9CommonTexture::CreatePrimaryImage(D3DRESOURCETYPE ResourceType) const {
|
||||
Rc<DxvkImage> D3D9CommonTexture::CreatePrimaryImage(D3DRESOURCETYPE ResourceType, bool TryOffscreenRT) const {
|
||||
DxvkImageCreateInfo imageInfo;
|
||||
imageInfo.type = GetImageTypeFromResourceType(ResourceType);
|
||||
imageInfo.format = m_mapping.ConversionFormatInfo.VulkanFormat != VK_FORMAT_UNDEFINED
|
||||
@ -231,7 +236,8 @@ namespace dxvk {
|
||||
imageInfo.viewFormats = m_mapping.Formats;
|
||||
}
|
||||
|
||||
if (m_desc.Usage & D3DUSAGE_RENDERTARGET || m_desc.Usage & D3DUSAGE_AUTOGENMIPMAP) {
|
||||
// Are we an RT, need to gen mips or an offscreen plain surface?
|
||||
if (m_desc.Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_AUTOGENMIPMAP) || TryOffscreenRT) {
|
||||
imageInfo.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
imageInfo.stages |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
||||
imageInfo.access |= VK_ACCESS_COLOR_ATTACHMENT_READ_BIT
|
||||
|
@ -382,7 +382,7 @@ namespace dxvk {
|
||||
*/
|
||||
VkDeviceSize GetMipSize(UINT Subresource) const;
|
||||
|
||||
Rc<DxvkImage> CreatePrimaryImage(D3DRESOURCETYPE ResourceType) const;
|
||||
Rc<DxvkImage> CreatePrimaryImage(D3DRESOURCETYPE ResourceType, bool TryOffscreenRT) const;
|
||||
|
||||
Rc<DxvkImage> CreateResolveImage() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user