Prevents using R8G8B8_UNORM format for Vulkan textures as it can be supported as a native format only by workarounds.
This was SVN commit r27496.
This commit is contained in:
parent
840dbdd6d8
commit
cb5a0b6342
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -48,7 +48,8 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
Renderer::Backend::Format ChooseFormatAndTransformTextureDataIfNeeded(Tex& textureData, const bool hasS3TC)
|
||||
Renderer::Backend::Format ChooseFormatAndTransformTextureDataIfNeeded(
|
||||
Renderer::Backend::IDevice* device, Tex& textureData, const bool hasS3TC)
|
||||
{
|
||||
const bool alpha = (textureData.m_Flags & TEX_ALPHA) != 0;
|
||||
const bool grey = (textureData.m_Flags & TEX_GREY) != 0;
|
||||
@ -92,7 +93,14 @@ Renderer::Backend::Format ChooseFormatAndTransformTextureDataIfNeeded(Tex& textu
|
||||
return Renderer::Backend::Format::L8_UNORM;
|
||||
case 24:
|
||||
ENSURE(!alpha);
|
||||
return Renderer::Backend::Format::R8G8B8_UNORM;
|
||||
if (device->IsTextureFormatSupported(Renderer::Backend::Format::R8G8B8_UNORM))
|
||||
return Renderer::Backend::Format::R8G8B8_UNORM;
|
||||
else
|
||||
{
|
||||
LOGWARNING("Using slow path to convert unsupported RGB texture to RGBA.");
|
||||
textureData.transform_to(textureData.m_Flags & TEX_ALPHA);
|
||||
return Renderer::Backend::Format::R8G8B8A8_UNORM;
|
||||
}
|
||||
case 32:
|
||||
ENSURE(alpha);
|
||||
return Renderer::Backend::Format::R8G8B8A8_UNORM;
|
||||
@ -507,7 +515,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
format = ChooseFormatAndTransformTextureDataIfNeeded(textureData, m_HasS3TC);
|
||||
format = ChooseFormatAndTransformTextureDataIfNeeded(m_Device, textureData, m_HasS3TC);
|
||||
}
|
||||
|
||||
if (format == Renderer::Backend::Format::UNDEFINED)
|
||||
|
@ -801,6 +801,9 @@ bool CDevice::IsTextureFormatSupported(const Format format) const
|
||||
case Format::UNDEFINED:
|
||||
return false;
|
||||
|
||||
case Format::R8G8B8_UNORM:
|
||||
return false;
|
||||
|
||||
case Format::BC1_RGB_UNORM: FALLTHROUGH;
|
||||
case Format::BC1_RGBA_UNORM: FALLTHROUGH;
|
||||
case Format::BC2_UNORM: FALLTHROUGH;
|
||||
|
Loading…
Reference in New Issue
Block a user