Fix: Vulkan: Volume Workbench Tests

Due to an incorrect assumption float buffers were converted to sRGB
values when uploading to an sRGBA8 texture. This is done when rendering
flames in workbench and resulted in to bright renders.

This PR removes sRGB encoding when uploading float values to sRGBA8 textures.

Fixes:
- render/openvdb/fire
- render/openvdb/principled_blackbody
- render/openvdb/smoke_fire

Pull Request: https://projects.blender.org/blender/blender/pulls/146636
This commit is contained in:
Jeroen Bakker
2025-09-23 14:44:42 +02:00
parent 52c028e0b0
commit e0a056574d
2 changed files with 3 additions and 25 deletions

View File

@@ -59,9 +59,6 @@ enum class ConversionType {
HALF_TO_FLOAT,
FLOAT_TO_HALF,
FLOAT_TO_SRGBA8,
SRGBA8_TO_FLOAT,
FLOAT_TO_B10F_G11F_R11F,
B10F_G11F_R11F_TO_FLOAT,
@@ -113,6 +110,7 @@ static ConversionType type_of_conversion_float(const TextureFormat host_format,
case TextureFormat::SFLOAT_16_16_16:
return ConversionType::FLOAT_TO_HALF;
case TextureFormat::SRGBA_8_8_8_8:
case TextureFormat::UNORM_8_8_8_8:
case TextureFormat::UNORM_8_8:
case TextureFormat::UNORM_8:
@@ -135,9 +133,6 @@ static ConversionType type_of_conversion_float(const TextureFormat host_format,
case TextureFormat::SNORM_16:
return ConversionType::FLOAT_TO_SNORM16;
case TextureFormat::SRGBA_8_8_8_8:
return ConversionType::FLOAT_TO_SRGBA8;
case TextureFormat::UFLOAT_11_11_10:
return ConversionType::FLOAT_TO_B10F_G11F_R11F;
@@ -662,7 +657,6 @@ static ConversionType reversed(ConversionType type)
CASE_PAIR(UI32, UI8)
CASE_PAIR(I32, I8)
CASE_PAIR(FLOAT, HALF)
CASE_PAIR(FLOAT, SRGBA8)
CASE_PAIR(FLOAT, B10F_G11F_R11F)
CASE_PAIR(FLOAT3, HALF4)
CASE_PAIR(FLOAT3, FLOAT4)
@@ -720,7 +714,6 @@ using I16 = ComponentValue<int16_t>;
using I32 = ComponentValue<int32_t>;
using F16 = ComponentValue<uint16_t>;
using F32 = ComponentValue<float>;
using SRGBA8 = PixelValue<ColorSceneLinearByteEncoded4b<eAlpha::Premultiplied>>;
using FLOAT3 = PixelValue<float3>;
using FLOAT4 = PixelValue<ColorSceneLinear4f<eAlpha::Premultiplied>>;
/* NOTE: Vulkan stores R11_G11_B10 in reverse component order. */
@@ -863,16 +856,6 @@ void convert(DestinationType &dst, const SourceType &src)
dst.value = src.value;
}
static void convert(SRGBA8 &dst, const FLOAT4 &src)
{
dst.value = color::encode(src.value);
}
static void convert(FLOAT4 &dst, const SRGBA8 &src)
{
dst.value = color::decode(src.value);
}
static void convert(FLOAT3 &dst, const HALF4 &src)
{
dst.value.x = math::half_to_float(src.get_r());
@@ -1105,13 +1088,6 @@ static void convert_buffer(void *dst_memory,
to_component_len(device_format) * buffer_size);
break;
case ConversionType::FLOAT_TO_SRGBA8:
convert_per_pixel<SRGBA8, FLOAT4>(dst_memory, src_memory, buffer_size);
break;
case ConversionType::SRGBA8_TO_FLOAT:
convert_per_pixel<FLOAT4, SRGBA8>(dst_memory, src_memory, buffer_size);
break;
case ConversionType::FLOAT_TO_B10F_G11F_R11F:
convert_per_pixel<B10F_G11G_R11F, FLOAT3>(dst_memory, src_memory, buffer_size);
break;

View File

@@ -101,6 +101,8 @@ def main():
test_dir_name = Path(args.testdir).name
if test_dir_name.startswith('hair') and platform.system() == "Darwin":
report.set_fail_threshold(0.050)
if test_dir_name.startswith('openvdb'):
report.set_fail_threshold(0.04)
ok = report.run(args.testdir, args.blender, get_arguments, batch=args.batch)