mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-07 23:31:13 +00:00
D3D12 Pixel History fix lack of integer clamping.
* When the shader outputs a value larger than the texture format supports, the use of a 32bit target for history targets resulted in the Tex After for fragments showing a value larger than possible. * The int/uint path for ConvertAndFillInColor was missing the clamping step that the other path includes.
This commit is contained in:
committed by
Jake Turner
parent
3cb8998841
commit
cd19c52aa5
@@ -3013,6 +3013,28 @@ void ConvertAndFillInColor(ResourceFormat srcFmt, ResourceFormat outFmt,
|
||||
if((outFmt.compType == CompType::UInt) || (outFmt.compType == CompType::SInt))
|
||||
{
|
||||
PixelHistoryDecode(srcFmt, value.color, mod.col);
|
||||
// Clamp values based on format
|
||||
if(outFmt.compType == CompType::UInt)
|
||||
{
|
||||
uint32_t limits[4] = {
|
||||
255,
|
||||
UINT16_MAX,
|
||||
0,
|
||||
UINT32_MAX,
|
||||
};
|
||||
int limit_idx = outFmt.compByteWidth - 1;
|
||||
for(size_t c = 0; c < outFmt.compCount; c++)
|
||||
mod.col.uintValue[c] = RDCMIN(limits[limit_idx], mod.col.uintValue[c]);
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t limits[8] = {
|
||||
INT8_MIN, INT8_MAX, INT16_MIN, INT16_MAX, 0, 0, INT32_MIN, INT32_MAX,
|
||||
};
|
||||
int limit_idx = 2 * (outFmt.compByteWidth - 1);
|
||||
for(size_t c = 0; c < outFmt.compCount; c++)
|
||||
mod.col.intValue[c] = RDCCLAMP(mod.col.intValue[c], limits[limit_idx], limits[limit_idx + 1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user