VirtualBox

Ignore:
Timestamp:
May 30, 2019 11:39:41 AM (6 years ago)
Author:
vboxsync
Message:

HostServices/SharedOpenGL/unpacker/unpack_texture.cpp: Fix crUnpackTexSubImage3D(), crUnpackTexSubImage2D() and crUnpackTexSubImage1D and calculate the proper texture size for crUnpackTexImage3DEXT() and crUnpackTexImage3D()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/unpacker/unpack_texture.cpp

    r78820 r78875  
    3838    else
    3939    {
    40         size_t cbImg = crImageSize(format, type, width, height);
     40        size_t cbImg = crTextureSize(format, type, width, height, depth);
    4141        if (RT_UNLIKELY(cbImg == 0))
    4242        {
     
    7777    else
    7878    {
    79         size_t cbImg = crImageSize(format, type, width, height);
     79        size_t cbImg = crTextureSize(format, type, width, height, depth);
    8080        if (RT_UNLIKELY(cbImg == 0))
    8181        {
     
    322322    else
    323323    {
    324         size_t cbImg = crImageSize(format, type, width, height);
    325         if (RT_UNLIKELY(cbImg == 0))
     324        /*
     325         * Specifying a sub texture with zero width, height or depth is not an
     326         * error but has no effect.
     327         * See: https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glTexSubImage3D.xml
     328         */
     329        size_t cbImg = crTextureSize(format, type, width, height, depth);
     330        if (RT_UNLIKELY(   cbImg == 0
     331                        && width != 0
     332                        && height != 0
     333                        && depth != 0))
    326334        {
    327335            pState->rcUnpack = VERR_INVALID_PARAMETER;
     
    366374    else
    367375    {
     376        /*
     377         * Specifying a sub texture with zero width, height or depth is not an
     378         * error but has no effect.
     379         * See: https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glTexSubImage2D.xml
     380         */
    368381        size_t cbImg = crImageSize(format, type, width, height);
    369         if (RT_UNLIKELY(cbImg == 0))
     382        if (RT_UNLIKELY(   cbImg == 0
     383                        && width != 0
     384                        && height != 0))
    370385        {
    371386            pState->rcUnpack = VERR_INVALID_PARAMETER;
     
    404419    else
    405420    {
     421        /*
     422         * Specifying a sub texture with zero width, height or depth is not an
     423         * error but has no effect.
     424         * See: https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glTexSubImage1D.xml
     425         */
    406426        size_t cbImg = crImageSize(format, type, width, 1);
    407         if (RT_UNLIKELY(cbImg == 0))
     427        if (RT_UNLIKELY(   cbImg == 0
     428                        && width != 0))
    408429        {
    409430            pState->rcUnpack = VERR_INVALID_PARAMETER;
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