VirtualBox

Ignore:
Timestamp:
Sep 5, 2013 7:25:47 AM (11 years ago)
Author:
vboxsync
Message:

crOpenGL: fix OSX win8.1 rendering

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/util/blitter.cpp

    r48275 r48291  
    841841#define CR_GLSL_STR_V_120 "#version 120\n"
    842842#define CR_GLSL_STR_EXT_TR "#extension GL_ARB_texture_rectangle : enable\n"
    843 #define CR_GLSL_STR_TEX2D "texture2D"
    844 #define CR_GLSL_STR_TEX2DRECT "texture2DRect"
     843#define CR_GLSL_STR_2D "2D"
     844#define CR_GLSL_STR_2DRECT "2DRect"
    845845
    846846#define CR_GLSL_PATTERN_FS_NOALPHA(_ver, _ext, _tex) \
    847847        _ver \
    848848        _ext \
     849        "uniform sampler" _tex " sampler0;\n" \
    849850        "void main()\n" \
    850851        "{\n" \
    851852            "vec2 srcCoord = vec2(gl_TexCoord[0]);\n" \
    852             "gl_FragData[0].xyz = (" _tex "(0, srcCoord).xyz);\n" \
     853            "gl_FragData[0].xyz = (texture" _tex "(sampler0, srcCoord).xyz);\n" \
    853854            "gl_FragData[0].w = 1.0;\n" \
    854855        "}\n"
     
    865866    {
    866867        if (enmTexTarget == GL_TEXTURE_2D)
    867             return CR_GLSL_PATTERN_FS_NOALPHA(CR_GLSL_STR_V_120, "", CR_GLSL_STR_TEX2D);
     868            return CR_GLSL_PATTERN_FS_NOALPHA(CR_GLSL_STR_V_120, "", CR_GLSL_STR_2D);
    868869        else if (enmTexTarget == GL_TEXTURE_RECTANGLE_ARB)
    869             return CR_GLSL_PATTERN_FS_NOALPHA(CR_GLSL_STR_V_120, CR_GLSL_STR_EXT_TR, CR_GLSL_STR_TEX2DRECT);
     870            return CR_GLSL_PATTERN_FS_NOALPHA(CR_GLSL_STR_V_120, CR_GLSL_STR_EXT_TR, CR_GLSL_STR_2DRECT);
    870871
    871872        crWarning("invalid enmTexTarget %#x", enmTexTarget);
     
    875876    {
    876877        if (enmTexTarget == GL_TEXTURE_2D)
    877             return CR_GLSL_PATTERN_FS_NOALPHA("", "", CR_GLSL_STR_TEX2D);
     878            return CR_GLSL_PATTERN_FS_NOALPHA("", "", CR_GLSL_STR_2D);
    878879        else if (enmTexTarget == GL_TEXTURE_RECTANGLE_ARB)
    879             return CR_GLSL_PATTERN_FS_NOALPHA("", CR_GLSL_STR_EXT_TR, CR_GLSL_STR_TEX2DRECT);
     880            return CR_GLSL_PATTERN_FS_NOALPHA("", CR_GLSL_STR_EXT_TR, CR_GLSL_STR_2DRECT);
    880881
    881882        crWarning("invalid enmTexTarget %#x", enmTexTarget);
     
    901902    GLchar * pBuf = NULL;
    902903    GLuint uiProgram = 0;
     904    GLint iUniform = -1;
    903905    GLuint uiShader = pCache->pDispatch->CreateShader(GL_FRAGMENT_SHADER);
    904906    if (!uiShader)
     
    924926#ifdef DEBUG_misha
    925927        if (compiled)
    926             crDebug("compile success:\n-------------------\n%d\n--------\n", pBuf);
     928            crDebug("compile success:\n-------------------\n%s\n--------\n", pBuf);
    927929        else
    928930#endif
    929931        {
    930             crWarning("compile FAILURE:\n-------------------\n%d\n--------\n", pBuf);
     932            Assert(0);
     933            crWarning("compile FAILURE:\n-------------------\n%s\n--------\n", pBuf);
    931934            rc = VERR_NOT_SUPPORTED;
    932935            goto end;
     
    958961#ifdef DEBUG_misha
    959962        if (linked)
    960             crDebug("link success:\n-------------------\n%d\n--------\n", pBuf);
     963            crDebug("link success:\n-------------------\n%s\n--------\n", pBuf);
    961964        else
    962965#endif
    963966        {
    964             crWarning("link FAILURE:\n-------------------\n%d\n--------\n", pBuf);
     967            Assert(0);
     968            crWarning("link FAILURE:\n-------------------\n%s\n--------\n", pBuf);
    965969            rc = VERR_NOT_SUPPORTED;
    966970            goto end;
     
    969973
    970974    Assert(linked);
     975
     976    iUniform = pCache->pDispatch->GetUniformLocation(uiProgram, "sampler0");
     977    if (iUniform == -1)
     978    {
     979        crWarning("GetUniformLocation failed for sampler0");
     980    }
     981    else
     982    {
     983        pCache->pDispatch->Uniform1i(iUniform, 0);
     984    }
    971985
    972986    *puiProgram = uiProgram;
     
    10881102}
    10891103
    1090 VBOXBLITTERDECL(bool) CrGlslNeedsCleanup(CR_GLSL_CACHE *pCache)
     1104VBOXBLITTERDECL(bool) CrGlslNeedsCleanup(const CR_GLSL_CACHE *pCache)
    10911105{
    10921106    return pCache->uNoAlpha2DProg || pCache->uNoAlpha2DRectProg;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette