sRGB support

99f6aeec9715bb034bba93ba2a7eb360
0
Nick 102 Jan 29, 2008 at 15:14

Hi all,

Could someone with an ATI graphics card test which Direct3D surface formats support sRGB reading and writing?

#include <stdio.h>
#include <d3d9.h>

int main()
{
    IDirect3D9 *d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
    printf("Read sRGB:\n");
    for(int format = 0; format < 1000; format++)
        if(d3d9->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_QUERY_SRGBREAD, D3DRTYPE_TEXTURE, (D3DFORMAT)format) == D3D_OK)
            printf("\t%d\n", format);
    printf("Write sRGB:\n");
    for(int format = 0; format < 1000; format++)
        if(d3d9->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_QUERY_SRGBWRITE, D3DRTYPE_TEXTURE, (D3DFORMAT)format) == D3D_OK)
            printf("\t%d\n", format);
}

Thanks!

Nicolas

5 Replies

Please log in or register to post a reply.

B20d81438814b6ba7da7ff8eb502d039
0
Vilem_Otte 117 Jan 29, 2008 at 16:45

It returns 21, 22 and 33 for both writing sRGB and reading sRGB.
Tested on Radeon HD 2900 XT, 6GB RAM, Pentium D 2*2.8 Ghz, Windows XP Professional

99f6aeec9715bb034bba93ba2a7eb360
0
Nick 102 Jan 29, 2008 at 18:11

Thanks a lot Vilém!

6aa952514ff4e5439df1e9e6d337b864
0
roel 101 Jan 30, 2008 at 13:45

Do you need information for other ATI cards too, Nick?

99f6aeec9715bb034bba93ba2a7eb360
0
Nick 102 Jan 30, 2008 at 14:17

@roel

Do you need information for other ATI cards too, Nick?

No, I was just trying to confirm the cause of a bug. NVIDIA cards also support sRGB for 16-bit surfaces, so you have to be careful no to do gamma correction in the shader as well…

But if you have some time to kill you’re always welcome to post more results of course. I assume they support sRGB for DXTn and ATIn formats, but maybe that assumption will cause my next bug. ;)

46407cc1bdfbd2db4f6e8876d74f990a
0
Kenneth_Gorking 101 Jan 31, 2008 at 14:56

Ran it on my Radeon Mobility 9700

Read sRGB:
21
22
26
50
51
Write sRGB:
21
22
26