Fix BC6H GPU compressor handling of negative pixel values (#328)

This commit is contained in:
Chuck Walbourn 2023-03-11 02:39:33 -08:00 committed by GitHub
parent a4df1415f8
commit 93182cac68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,6 +173,7 @@ void TryModeG10CS(uint GI : SV_GroupIndex, uint3 groupID : SV_GroupID)
if (threadInBlock < 16)
{
shared_temp[GI].pixel = g_Input.Load(uint3(base_x + threadInBlock % 4, base_y + threadInBlock / 4, 0)).rgb;
shared_temp[GI].pixel = max(shared_temp[GI].pixel, float3(0,0,0));
uint3 pixel_h = float2half(shared_temp[GI].pixel);
shared_temp[GI].pixel_hr = half2float(pixel_h);
shared_temp[GI].pixel_lum = dot(shared_temp[GI].pixel_hr, RGB2LUM);
@ -379,6 +380,7 @@ void TryModeLE10CS(uint GI : SV_GroupIndex, uint3 groupID : SV_GroupID)
if (threadInBlock < 16)
{
shared_temp[GI].pixel = g_Input.Load(uint3(base_x + threadInBlock % 4, base_y + threadInBlock / 4, 0)).rgb;
shared_temp[GI].pixel = max(shared_temp[GI].pixel, float3(0,0,0));
uint3 pixel_h = float2half(shared_temp[GI].pixel);
shared_temp[GI].pixel_hr = half2float(pixel_h);
shared_temp[GI].pixel_lum = dot(shared_temp[GI].pixel_hr, RGB2LUM);
@ -603,6 +605,7 @@ void EncodeBlockCS(uint GI : SV_GroupIndex, uint3 groupID : SV_GroupID)
if (threadInBlock < 16)
{
shared_temp[GI].pixel = g_Input.Load(uint3(base_x + threadInBlock % 4, base_y + threadInBlock / 4, 0)).rgb;
shared_temp[GI].pixel = max(shared_temp[GI].pixel, float3(0,0,0));
shared_temp[GI].pixel_lum = dot(shared_temp[GI].pixel, RGB2LUM);
uint3 pixel_h = float2half(shared_temp[GI].pixel);
shared_temp[GI].pixel_ph = start_quantize(pixel_h);