EXR: more standard RGBA channel name detection

Various EXR images especially from movie assets do not simply have "R"
etc as channel names; the convention seems to be to have "layer name",
".", "color channel name". For example, channels in EXR might be
"rgb.R", "rgb.G", "rgb.B", which RenderDoc was not detecting previously
and displaying an all-black image.
This commit is contained in:
Aras Pranckevicius
2024-10-30 16:23:37 +02:00
committed by Baldur Karlsson
parent 2357c26651
commit 0baf7b5f49
+5 -1
View File
@@ -758,10 +758,14 @@ void ImageViewer::RefreshFile()
return;
}
// Expect R/G/B/A channel names as first char of the string, or
// after the last '.' char.
int channels[4] = {-1, -1, -1, -1};
for(int i = 0; i < exrImage.num_channels; i++)
{
switch(exrHeader.channels[i].name[0])
const char *dotPos = strrchr(exrHeader.channels[i].name, '.');
const char *name = dotPos ? dotPos + 1 : exrHeader.channels[i].name;
switch(name[0])
{
case 'R': channels[0] = i; break;
case 'G': channels[1] = i; break;