Jump to content


sRGB support


5 replies to this topic

#1 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1227 posts
  • LocationOttawa, Ontario, Canada

Posted 29 January 2008 - 03:14 PM

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

#2 Vilem Otte

    Valued Member

  • Members
  • PipPipPipPip
  • 345 posts

Posted 29 January 2008 - 04:45 PM

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

#3 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1227 posts
  • LocationOttawa, Ontario, Canada

Posted 29 January 2008 - 06:11 PM

Thanks a lot Vilém!

#4 roel

    Senior Member

  • Members
  • PipPipPipPip
  • 698 posts

Posted 30 January 2008 - 01:45 PM

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

#5 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1227 posts
  • LocationOttawa, Ontario, Canada

Posted 30 January 2008 - 02:17 PM

roel said:

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. ;)

#6 Kenneth Gorking

    Senior Member

  • Members
  • PipPipPipPip
  • 939 posts

Posted 31 January 2008 - 02:56 PM

Ran it on my Radeon Mobility 9700

Read sRGB:
21
22
26
50
51
Write sRGB:
21
22
26
"Stupid bug! You go squish now!!" - Homer Simpson





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users