Add support for HDR canvas textures

Vulkan only.
This commit is contained in:
Cacodemon345 2023-08-12 16:36:42 +06:00 committed by Rachael Alexanderson
parent b695e845e1
commit fe7beaaf17
3 changed files with 21 additions and 1 deletions

View file

@ -113,7 +113,7 @@ void VkHardwareTexture::CreateImage(FTexture *tex, int translation, int flags)
}
else
{
VkFormat format = VK_FORMAT_R8G8B8A8_UNORM;
VkFormat format = tex->IsHDR() ? VK_FORMAT_R32G32B32A32_SFLOAT : VK_FORMAT_R8G8B8A8_UNORM;
int w = tex->GetWidth();
int h = tex->GetHeight();

View file

@ -217,6 +217,7 @@ protected:
bool Masked = false; // Texture (might) have holes
bool bHasCanvas = false;
bool bHdr = false; // only canvas textures for now.
int8_t bTranslucent = -1;
int8_t areacount = 0; // this is capped at 4 sections.
@ -253,6 +254,8 @@ public:
bool isHardwareCanvas() const { return bHasCanvas; } // There's two here so that this can deal with software canvases in the hardware renderer later.
bool isCanvas() const { return bHasCanvas; }
bool IsHDR() const { return bHdr; }
int GetSourceLump() { return SourceLump; } // needed by the scripted GetName method.
void SetSourceLump(int sl) { SourceLump = sl; }
bool FindHoles(const unsigned char * buffer, int w, int h);
@ -345,6 +348,12 @@ public:
float aspectRatio;
friend struct FCanvasTextureInfo;
friend class FTextureAnimator;
private:
void SetHDR(bool hdr) {
bHdr = hdr;
}
};

View file

@ -742,6 +742,17 @@ void FTextureAnimator::ParseCameraTexture(FScanner &sc)
TexMan.AddGameTexture (viewer);
}
if (sc.GetString())
{
if (sc.Compare ("hdr"))
{
canvas->SetHDR(true);
}
else
{
sc.UnGet();
}
}
if (sc.GetString())
{
if (sc.Compare ("fit"))
{