VirtualBox

Changeset 83176 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Feb 27, 2020 7:07:43 PM (5 years ago)
Author:
vboxsync
Message:

Devices/Graphics/shaderlib: workaround for NVidia GLSL compiler quirk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/shaderlib/glsl_shader.c

    r82700 r83176  
    10551055        if (map & 1) shader_addline(buffer, "void subroutine%u();\n", i);
    10561056    }
     1057
     1058#ifdef VBOX_WITH_VMSVGA
     1059    /* Declare texture samplers before the constants in order to workaround a NVidia driver quirk. */
     1060    for (i = 0; i < This->baseShader.limits.sampler; i++) {
     1061        if (reg_maps->sampler_type[i])
     1062        {
     1063            switch (reg_maps->sampler_type[i])
     1064            {
     1065                case WINED3DSTT_1D:
     1066                    shader_addline(buffer, "uniform sampler1D %csampler%u;\n", prefix, i);
     1067                    break;
     1068                case WINED3DSTT_2D:
     1069                    if(device->stateBlock->textures[i] &&
     1070                       IWineD3DBaseTexture_GetTextureDimensions(device->stateBlock->textures[i]) == GL_TEXTURE_RECTANGLE_ARB) {
     1071                        shader_addline(buffer, "uniform sampler2DRect %csampler%u;\n", prefix, i);
     1072                    } else {
     1073                        shader_addline(buffer, "uniform sampler2D %csampler%u;\n", prefix, i);
     1074                    }
     1075                    break;
     1076                case WINED3DSTT_CUBE:
     1077                    shader_addline(buffer, "uniform samplerCube %csampler%u;\n", prefix, i);
     1078                    break;
     1079                case WINED3DSTT_VOLUME:
     1080                    shader_addline(buffer, "uniform sampler3D %csampler%u;\n", prefix, i);
     1081                    break;
     1082                default:
     1083                    shader_addline(buffer, "uniform unsupported_sampler %csampler%u;\n", prefix, i);
     1084                    FIXME("Unrecognized sampler type: %#x\n", reg_maps->sampler_type[i]);
     1085                    break;
     1086            }
     1087        }
     1088    }
     1089#endif
    10571090
    10581091    /* Declare the constants (aka uniforms) */
     
    12161249    }
    12171250
     1251#ifdef VBOX_WITH_VMSVGA
     1252    /* Declare texture samplers before the constants in order to workaround a NVidia driver quirk. */
     1253#else
    12181254    /* Declare texture samplers */
    12191255    for (i = 0; i < This->baseShader.limits.sampler; i++) {
     
    12461282        }
    12471283    }
     1284#endif
    12481285
    12491286    /* Declare uniforms for NP2 texcoord fixup:
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