don't click here

GL_ATI_text_fragment_shader on Mac OS X / PowerPC

Discussion in 'Engineering & Reverse Engineering' started by GerbilSoft, Feb 14, 2011.

  1. GerbilSoft

    GerbilSoft

    RickRotate'd. Administrator
    2,971
    76
    28
    USA
    rom-properties
    So my test platform for Mac OS X is a Power Mac G4 (MDD) running OS X 10.5.7 with 2x G4 CPUs running at 1.25 GHz. Its video card is a Radeon 9000, which doesn't support GL_ARB_fragment_program; however, it does support GL_ATI_text_fragment_shader. I attempted to port the paused shader to GL_ATI_text_fragment_shader, but it seems something didn't work right.

    (Note: Before anyone says anything, these screenshots are showing savestates, not actual emulation. The CPU emulation cores are still written in x86 assembler, but the VDP core [C++] works fine on PPC.)

    First, the S3&K title screen when using the software-rendered pause tint: (left == unpaused, right == paused)
    [​IMG][​IMG]

    Next, the S3&K title screen when using the GL_ATI_text_fragment_shader version: (left == no-op; right == pause tint)
    [​IMG][​IMG]

    (The no-op version is effectively a shader that does nothing. I included a screenshot of it to make it easier to see what's going on.)

    Here's the relevant source code.

    GL_ARB_fragment_program version (works correctly):

    Code (Text):
    1. !!ARBfp1.0
    2. OPTION ARB_precision_hint_fastest;
    3. PARAM grayscale = {0.299, 0.587, 0.114, 0.0};
    4. TEMP t0, color;
    5. TEX t0, fragment.texcoord[0], texture[0], 2D;
    6. DP3 color, t0, grayscale;
    7. ADD_SAT color.z, color.z, color.z;
    8. MOV result.color, color;
    9. END
    GL_ATI_text_fragment_shader version (fails horribly):

    Code (Text):
    1. !!ATIfs1.0
    2. StartConstants;
    3.   CONSTANT c0 = {0.299, 0.587, 0.114};
    4. EndConstants;
    5. StartOutputPass;
    6.   SampleMap r0, t0.str;
    7.   DOT3 r0.rgb, r0, c0;
    8.   ADD r0.b.sat, r0.b, r0.b;
    9. EndPass;
    Any ideas as to why the GL_ATI_text_fragment_shader version isn't working correctly?

    EDIT: But wait, there's more: Ubuntu 9.10 / PowerPC apparently has GL_ATI_fragment_shader, which is the same thing, except instead of having a textual representation of the shader, you have to build it with multiple function calls. I'll try porting the shader to GL_ATI_fragment_shader later and see if that works. If it does, then it's fairly obvious that OS X's Radeon driver is broken.