mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[d3d9] Don't create sRGB views for non-sRGB compatible textures
Otherwise we end up creating views with VK_IMAGE_FORMAT_UNDEFINED.
This commit is contained in:
parent
296aacb23e
commit
f20a3c07fb
@ -455,7 +455,9 @@ namespace dxvk {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_sampleView.Color = CreateView(AllLayers, Lod, VK_IMAGE_USAGE_SAMPLED_BIT, false);
|
m_sampleView.Color = CreateView(AllLayers, Lod, VK_IMAGE_USAGE_SAMPLED_BIT, false);
|
||||||
m_sampleView.Srgb = CreateView(AllLayers, Lod, VK_IMAGE_USAGE_SAMPLED_BIT, true);
|
|
||||||
|
if (IsSrgbCompatible())
|
||||||
|
m_sampleView.Srgb = CreateView(AllLayers, Lod, VK_IMAGE_USAGE_SAMPLED_BIT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -292,6 +292,14 @@ namespace dxvk {
|
|||||||
return m_desc.Usage & D3DUSAGE_AUTOGENMIPMAP;
|
return m_desc.Usage & D3DUSAGE_AUTOGENMIPMAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Checks whether sRGB views can be created
|
||||||
|
* \returns Whether the format is sRGB compatible.
|
||||||
|
*/
|
||||||
|
bool IsSrgbCompatible() const {
|
||||||
|
return m_mapping.FormatSrgb;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Recreate main image view
|
* \brief Recreate main image view
|
||||||
* Recreates the main view of the sampler w/ a specific LOD.
|
* Recreates the main view of the sampler w/ a specific LOD.
|
||||||
@ -332,7 +340,7 @@ namespace dxvk {
|
|||||||
void MarkAllDirty() { for (uint32_t i = 0; i < m_dirty.size(); i++) m_dirty[i] = true; }
|
void MarkAllDirty() { for (uint32_t i = 0; i < m_dirty.size(); i++) m_dirty[i] = true; }
|
||||||
|
|
||||||
const Rc<DxvkImageView>& GetSampleView(bool srgb) const {
|
const Rc<DxvkImageView>& GetSampleView(bool srgb) const {
|
||||||
return m_sampleView.Pick(srgb);
|
return m_sampleView.Pick(srgb && IsSrgbCompatible());
|
||||||
}
|
}
|
||||||
|
|
||||||
VkImageLayout DetermineRenderTargetLayout() const {
|
VkImageLayout DetermineRenderTargetLayout() const {
|
||||||
|
@ -20,7 +20,8 @@ namespace dxvk {
|
|||||||
, m_container ( pContainer )
|
, m_container ( pContainer )
|
||||||
, m_texture ( pTexture )
|
, m_texture ( pTexture )
|
||||||
, m_face ( Face )
|
, m_face ( Face )
|
||||||
, m_mipLevel ( MipLevel ) { }
|
, m_mipLevel ( MipLevel )
|
||||||
|
, m_isSrgbCompatible ( pTexture->IsSrgbCompatible() ) { }
|
||||||
|
|
||||||
~D3D9Subresource() {
|
~D3D9Subresource() {
|
||||||
// We own the texture!
|
// We own the texture!
|
||||||
@ -66,6 +67,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rc<DxvkImageView> GetImageView(bool Srgb) {
|
Rc<DxvkImageView> GetImageView(bool Srgb) {
|
||||||
|
Srgb &= m_isSrgbCompatible;
|
||||||
Rc<DxvkImageView>& view = m_sampleView.Pick(Srgb);
|
Rc<DxvkImageView>& view = m_sampleView.Pick(Srgb);
|
||||||
|
|
||||||
if (unlikely(view == nullptr && !IsNull()))
|
if (unlikely(view == nullptr && !IsNull()))
|
||||||
@ -75,6 +77,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rc<DxvkImageView> GetRenderTargetView(bool Srgb) {
|
Rc<DxvkImageView> GetRenderTargetView(bool Srgb) {
|
||||||
|
Srgb &= m_isSrgbCompatible;
|
||||||
Rc<DxvkImageView>& view = m_renderTargetView.Pick(Srgb);
|
Rc<DxvkImageView>& view = m_renderTargetView.Pick(Srgb);
|
||||||
|
|
||||||
if (unlikely(view == nullptr && !IsNull()))
|
if (unlikely(view == nullptr && !IsNull()))
|
||||||
@ -116,6 +119,7 @@ namespace dxvk {
|
|||||||
UINT m_face;
|
UINT m_face;
|
||||||
UINT m_mipLevel;
|
UINT m_mipLevel;
|
||||||
|
|
||||||
|
bool m_isSrgbCompatible;
|
||||||
D3D9ColorView m_sampleView;
|
D3D9ColorView m_sampleView;
|
||||||
D3D9ColorView m_renderTargetView;
|
D3D9ColorView m_renderTargetView;
|
||||||
Rc<DxvkImageView> m_depthStencilView;
|
Rc<DxvkImageView> m_depthStencilView;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user