mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 10:54:16 +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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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
|
||||
* 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; }
|
||||
|
||||
const Rc<DxvkImageView>& GetSampleView(bool srgb) const {
|
||||
return m_sampleView.Pick(srgb);
|
||||
return m_sampleView.Pick(srgb && IsSrgbCompatible());
|
||||
}
|
||||
|
||||
VkImageLayout DetermineRenderTargetLayout() const {
|
||||
|
@ -20,7 +20,8 @@ namespace dxvk {
|
||||
, m_container ( pContainer )
|
||||
, m_texture ( pTexture )
|
||||
, m_face ( Face )
|
||||
, m_mipLevel ( MipLevel ) { }
|
||||
, m_mipLevel ( MipLevel )
|
||||
, m_isSrgbCompatible ( pTexture->IsSrgbCompatible() ) { }
|
||||
|
||||
~D3D9Subresource() {
|
||||
// We own the texture!
|
||||
@ -66,6 +67,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
Rc<DxvkImageView> GetImageView(bool Srgb) {
|
||||
Srgb &= m_isSrgbCompatible;
|
||||
Rc<DxvkImageView>& view = m_sampleView.Pick(Srgb);
|
||||
|
||||
if (unlikely(view == nullptr && !IsNull()))
|
||||
@ -75,6 +77,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
Rc<DxvkImageView> GetRenderTargetView(bool Srgb) {
|
||||
Srgb &= m_isSrgbCompatible;
|
||||
Rc<DxvkImageView>& view = m_renderTargetView.Pick(Srgb);
|
||||
|
||||
if (unlikely(view == nullptr && !IsNull()))
|
||||
@ -116,6 +119,7 @@ namespace dxvk {
|
||||
UINT m_face;
|
||||
UINT m_mipLevel;
|
||||
|
||||
bool m_isSrgbCompatible;
|
||||
D3D9ColorView m_sampleView;
|
||||
D3D9ColorView m_renderTargetView;
|
||||
Rc<DxvkImageView> m_depthStencilView;
|
||||
|
Loading…
x
Reference in New Issue
Block a user