diff --git a/source/renderer/backend/Format.h b/source/renderer/backend/Format.h index 8a797e700c..b8b9cb3aed 100644 --- a/source/renderer/backend/Format.h +++ b/source/renderer/backend/Format.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -56,6 +56,8 @@ enum class Format R32G32B32_SFLOAT, R32G32B32A32_SFLOAT, + B10G11R11_UFLOAT, + D16_UNORM, D24_UNORM, D24_UNORM_S8_UINT, diff --git a/source/renderer/backend/gl/Device.cpp b/source/renderer/backend/gl/Device.cpp index dcfca796d5..4d59696db0 100644 --- a/source/renderer/backend/gl/Device.cpp +++ b/source/renderer/backend/gl/Device.cpp @@ -943,7 +943,6 @@ bool CDevice::IsTextureFormatSupported(const Format format) const case Format::R32_SFLOAT: case Format::R32G32_SFLOAT: case Format::R32G32B32_SFLOAT: - case Format::R32G32B32A32_SFLOAT: break; case Format::D16_UNORM: @@ -967,6 +966,11 @@ bool CDevice::IsTextureFormatSupported(const Format format) const supported = m_Capabilities.S3TC; break; + case Format::R16G16B16A16_SFLOAT: + case Format::R32G32B32A32_SFLOAT: + supported = m_Capabilities.computeShaders && m_Capabilities.storage && ogl_HaveExtension("GL_ARB_texture_float"); + break; + default: break; } @@ -984,6 +988,10 @@ bool CDevice::IsFramebufferFormatSupported(const Format format) const case Format::R8_UNORM: supported = ogl_HaveVersion(3, 0); break; + case Format::R16G16B16A16_SFLOAT: + case Format::R32G32B32A32_SFLOAT: + supported = m_Capabilities.computeShaders && m_Capabilities.storage && GLAD_GL_ARB_texture_float; + break; #endif case Format::R8G8B8A8_UNORM: supported = true; diff --git a/source/renderer/backend/gl/Texture.cpp b/source/renderer/backend/gl/Texture.cpp index 19c9e5980a..85f6f19cde 100644 --- a/source/renderer/backend/gl/Texture.cpp +++ b/source/renderer/backend/gl/Texture.cpp @@ -244,6 +244,16 @@ std::unique_ptr CTexture::Create( pixelFormat = GL_DEPTH_STENCIL_EXT; pixelType = GL_UNSIGNED_INT_24_8_EXT; break; + case Format::R16G16B16A16_SFLOAT: + internalFormat = GL_RGBA16F_ARB; + pixelFormat = GL_RGBA; + pixelType = GL_HALF_FLOAT; + break; + case Format::R32G32B32A32_SFLOAT: + internalFormat = GL_RGBA32F_ARB; + pixelFormat = GL_RGBA; + pixelType = GL_FLOAT; + break; #endif case Format::BC1_RGB_UNORM: case Format::BC1_RGBA_UNORM: @@ -273,6 +283,14 @@ std::unique_ptr CTexture::Create( { glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, sampleCount, GL_RGBA8, width, height, GL_TRUE); } + else if (format == Format::R16G16B16A16_SFLOAT) + { + glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, sampleCount, GL_RGBA16F_ARB, width, height, GL_TRUE); + } + else if (format == Format::R32G32B32A32_SFLOAT) + { + glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, sampleCount, GL_RGBA32F_ARB, width, height, GL_TRUE); + } else if (format == Format::D24_UNORM_S8_UINT) { glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, sampleCount, GL_DEPTH24_STENCIL8_EXT, width, height, GL_TRUE); diff --git a/source/renderer/backend/vulkan/Mapping.cpp b/source/renderer/backend/vulkan/Mapping.cpp index 6fd82fe1b4..06843111a7 100644 --- a/source/renderer/backend/vulkan/Mapping.cpp +++ b/source/renderer/backend/vulkan/Mapping.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -195,6 +195,8 @@ VkFormat FromFormat(const Format format) CASE(R32G32B32_SFLOAT) CASE(R32G32B32A32_SFLOAT) + CASE2(B10G11R11_UFLOAT, B10G11R11_UFLOAT_PACK32) + CASE(D16_UNORM) CASE2(D24_UNORM, X8_D24_UNORM_PACK32) CASE(D24_UNORM_S8_UINT)