Changeset 65089 in webkit


Ignore:
Timestamp:
Aug 10, 2010 1:44:54 PM (14 years ago)
Author:
zmo@google.com
Message:

2010-08-06 Zhenyao Mo <zmo@google.com>

Reviewed by Dimitri Glazkov.

texture functions should gen INVALID_OPERATION if no texture is bound
https://bugs.webkit.org/show_bug.cgi?id=42907

  • html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::copyTexImage2D): Check if a texture is bound to target. (WebCore::WebGLRenderingContext::copyTexSubImage2D): Ditto. (WebCore::WebGLRenderingContext::generateMipmap): Ditto. (WebCore::WebGLRenderingContext::getTexParameter): Ditto. (WebCore::WebGLRenderingContext::texImage2DBase): Ditto. (WebCore::WebGLRenderingContext::texParameter): Ditto. (WebCore::WebGLRenderingContext::texSubImage2DBase): Ditto. (WebCore::WebGLRenderingContext::validateTextureBinding): Check if target is valid and if a texture is bound to it.
  • html/canvas/WebGLRenderingContext.h: Declare validateTextureBinding().

2010-08-06 Zhenyao Mo <zmo@google.com>

Reviewed by Dimitri Glazkov.

texture functions should gen INVALID_OPERATION if no texture is bound
https://bugs.webkit.org/show_bug.cgi?id=42907

  • fast/canvas/webgl/gl-enum-tests-expected.txt: Need to bind a texture before testing tex-functions.
  • fast/canvas/webgl/gl-enum-tests.html: Ditto.
  • fast/canvas/webgl/null-object-behaviour-expected.txt: Test tex-functions when no texture is bound.
  • fast/canvas/webgl/null-object-behaviour.html: Ditto.
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r65082 r65089  
     12010-08-06  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        texture functions should gen INVALID_OPERATION if no texture is bound
     6        https://bugs.webkit.org/show_bug.cgi?id=42907
     7
     8        * fast/canvas/webgl/gl-enum-tests-expected.txt: Need to bind a texture before testing tex-functions.
     9        * fast/canvas/webgl/gl-enum-tests.html: Ditto.
     10        * fast/canvas/webgl/null-object-behaviour-expected.txt: Test tex-functions when no texture is bound.
     11        * fast/canvas/webgl/null-object-behaviour.html: Ditto.
     12
    1132010-08-10  Johnny Ding  <jnd@chromium.org>
    214
  • trunk/LayoutTests/fast/canvas/webgl/gl-enum-tests-expected.txt

    r63444 r65089  
    2020PASS gl.disable(desktopGL['POINT_SPRITE']) should return INVALID_ENUM.
    2121PASS gl.getBufferParameter(gl.ARRAY_BUFFER, desktopGL['PIXEL_PACK_BUFFER']) should return INVALID_ENUM.
    22 PASS gl.getTexParameter(gl.TEXTURE_2D, desktopGL['GENERATE_MIPMAP']) should return INVALID_ENUM.
    23 PASS gl.getTexParameter(gl.TEXTURE_2D, desktopGL['GENERATE_MIPMAP']) should return INVALID_ENUM.
    2422PASS gl.hint(desktopGL['PERSPECTIVE_CORRECTION_HINT'], gl.FASTEST) should return INVALID_ENUM.
    2523PASS gl.isEnabled(desktopGL['CLIP_PLANE0']) should return INVALID_ENUM.
     
    2725PASS gl.pixelStorei(desktopGL['PACK_SWAP_BYTES'], 1) should return INVALID_ENUM.
    2826PASS gl.readPixels(0, 0, 1, 1, gl.ALPHA, gl.SHORT, buf) should return INVALID_ENUM.
     27PASS gl.getError() is gl.NO_ERROR
     28PASS gl.getTexParameter(gl.TEXTURE_2D, desktopGL['GENERATE_MIPMAP']) should return INVALID_ENUM.
    2929PASS gl.texParameteri(desktopGL['TEXTURE_3D'], gl.TEXTURE_MAG_FILTER, gl.NEAREST) should return INVALID_ENUM.
    3030PASS gl.texParameteri(gl.TEXTURE_2D, desktopGL['GENERATE_MIPMAP'], 1) should return INVALID_ENUM.
  • trunk/LayoutTests/fast/canvas/webgl/gl-enum-tests.html

    r63444 r65089  
    3434  gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer());
    3535  shouldBe("gl.getError()", "gl.NO_ERROR");
     36
    3637  var tests = [
    3738    "gl.bindTexture(desktopGL['TEXTURE_3D'], tex)",
     
    4647    "gl.disable(desktopGL['POINT_SPRITE'])",
    4748    "gl.getBufferParameter(gl.ARRAY_BUFFER, desktopGL['PIXEL_PACK_BUFFER'])",
    48     "gl.getTexParameter(gl.TEXTURE_2D, desktopGL['GENERATE_MIPMAP'])",
    49     "gl.getTexParameter(gl.TEXTURE_2D, desktopGL['GENERATE_MIPMAP'])",
    5049    "gl.hint(desktopGL['PERSPECTIVE_CORRECTION_HINT'], gl.FASTEST)",
    5150    "gl.isEnabled(desktopGL['CLIP_PLANE0'])",
     
    5352    "gl.pixelStorei(desktopGL['PACK_SWAP_BYTES'], 1)",
    5453    "gl.readPixels(0, 0, 1, 1, gl.ALPHA, gl.SHORT, buf)",
     54  ];
     55  for (var ii = 0; ii < tests.length; ++ii) {
     56    eval(tests[ii]);
     57    assertMsg(gl.getError() == gl.INVALID_ENUM,
     58              tests[ii] + " should return INVALID_ENUM.");
     59  }
     60
     61  gl.bindTexture(gl.TEXTURE_2D, tex);
     62  shouldBe("gl.getError()", "gl.NO_ERROR");
     63
     64  tests = [
     65    "gl.getTexParameter(gl.TEXTURE_2D, desktopGL['GENERATE_MIPMAP'])",
    5566    "gl.texParameteri(desktopGL['TEXTURE_3D'], gl.TEXTURE_MAG_FILTER, gl.NEAREST)",
    5667    "gl.texParameteri(gl.TEXTURE_2D, desktopGL['GENERATE_MIPMAP'], 1)"
    57    ];
    58    for (var ii = 0; ii < tests.length; ++ii) {
    59      eval(tests[ii]);
    60      assertMsg(gl.getError() == gl.INVALID_ENUM,
    61                tests[ii] + " should return INVALID_ENUM.");
    62    }
     68  ];
     69  for (var ii = 0; ii < tests.length; ++ii) {
     70    eval(tests[ii]);
     71    assertMsg(gl.getError() == gl.INVALID_ENUM,
     72              tests[ii] + " should return INVALID_ENUM.");
     73  }
    6374}
    6475
  • trunk/LayoutTests/fast/canvas/webgl/null-object-behaviour-expected.txt

    r63444 r65089  
    1919PASS context.bindRenderbuffer(context.RENDERBUFFER, 0) was expected value: NO_ERROR.
    2020PASS context.bindTexture(context.TEXTURE_2D, 0) was expected value: NO_ERROR.
     21PASS context.bindBuffer(context.ARRAY_BUFFER, null) was expected value: NO_ERROR.
     22PASS context.bindFramebuffer(context.FRAMEBUFFER, null) was expected value: NO_ERROR.
     23PASS context.bindRenderbuffer(context.RENDERBUFFER, null) was expected value: NO_ERROR.
     24PASS context.bindTexture(context.TEXTURE_2D, null) was expected value: NO_ERROR.
     25PASS context.bindBuffer(context.ARRAY_BUFFER, undefined) was expected value: NO_ERROR.
     26PASS context.bindFramebuffer(context.FRAMEBUFFER, undefined) was expected value: NO_ERROR.
     27PASS context.bindRenderbuffer(context.RENDERBUFFER, undefined) was expected value: NO_ERROR.
     28PASS context.bindTexture(context.TEXTURE_2D, undefined) was expected value: NO_ERROR.
    2129PASS context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0) was expected value: INVALID_OPERATION.
    2230PASS context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0) was expected value: INVALID_OPERATION.
     
    2836PASS context.getUniform(undefined, 0) was expected value: INVALID_VALUE.
    2937PASS context.getUniformLocation(undefined, 'foo') was expected value: INVALID_VALUE.
     38
     39check with bindings
     40PASS context.bufferData(context.ARRAY_BUFFER, 1, context.STATIC_DRAW) was expected value: NO_ERROR.
     41PASS context.getBufferParameter(context.ARRAY_BUFFER, context.BUFFER_SIZE) was expected value: NO_ERROR.
     42PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 1, 1, 0, context.RGBA, context.UNSIGNED_BYTE, new Uint8Array([0,0,0,0])) was expected value: NO_ERROR.
     43PASS context.texParameteri(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER, context.NEAREST) was expected value: NO_ERROR.
     44PASS context.getTexParameter(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER) was expected value: NO_ERROR.
     45
     46check without bindings
     47PASS context.bufferData(context.ARRAY_BUFFER, 1, context.STATIC_DRAW) was expected value: INVALID_OPERATION.
     48PASS context.getBufferParameter(context.ARRAY_BUFFER, context.BUFFER_SIZE) was expected value: INVALID_OPERATION.
     49PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 1, 1, 0, context.RGBA, context.UNSIGNED_BYTE, new Uint8Array([0,0,0,0])) was expected value: INVALID_OPERATION.
     50PASS context.texParameteri(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER, context.NEAREST) was expected value: INVALID_OPERATION.
     51PASS context.getTexParameter(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER) was expected value: INVALID_OPERATION.
    3052PASS successfullyParsed is true
    3153
  • trunk/LayoutTests/fast/canvas/webgl/null-object-behaviour.html

    r63444 r65089  
    3535shouldGenerateGLError(context, context.NO_ERROR, "context.bindRenderbuffer(context.RENDERBUFFER, 0)");
    3636shouldGenerateGLError(context, context.NO_ERROR, "context.bindTexture(context.TEXTURE_2D, 0)");
     37shouldGenerateGLError(context, context.NO_ERROR, "context.bindBuffer(context.ARRAY_BUFFER, null)");
     38shouldGenerateGLError(context, context.NO_ERROR, "context.bindFramebuffer(context.FRAMEBUFFER, null)");
     39shouldGenerateGLError(context, context.NO_ERROR, "context.bindRenderbuffer(context.RENDERBUFFER, null)");
     40shouldGenerateGLError(context, context.NO_ERROR, "context.bindTexture(context.TEXTURE_2D, null)");
     41shouldGenerateGLError(context, context.NO_ERROR, "context.bindBuffer(context.ARRAY_BUFFER, undefined)");
     42shouldGenerateGLError(context, context.NO_ERROR, "context.bindFramebuffer(context.FRAMEBUFFER, undefined)");
     43shouldGenerateGLError(context, context.NO_ERROR, "context.bindRenderbuffer(context.RENDERBUFFER, undefined)");
     44shouldGenerateGLError(context, context.NO_ERROR, "context.bindTexture(context.TEXTURE_2D, undefined)");
    3745shouldGenerateGLError(context, context.INVALID_OPERATION, "context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, 0)");
    3846shouldGenerateGLError(context, context.INVALID_OPERATION, "context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, 0, 0)");
     
    4553shouldGenerateGLError(context, context.INVALID_VALUE, "context.getUniformLocation(undefined, 'foo')");
    4654
     55debug("");
     56debug("check with bindings");
     57context.bindBuffer(context.ARRAY_BUFFER, context.createBuffer());
     58context.bindTexture(context.TEXTURE_2D, context.createTexture());
     59shouldGenerateGLError(context, context.NO_ERROR, "context.bufferData(context.ARRAY_BUFFER, 1, context.STATIC_DRAW)");
     60shouldGenerateGLError(context, context.NO_ERROR, "context.getBufferParameter(context.ARRAY_BUFFER, context.BUFFER_SIZE)");
     61shouldGenerateGLError(context, context.NO_ERROR, "context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 1, 1, 0, context.RGBA, context.UNSIGNED_BYTE, new Uint8Array([0,0,0,0]))");
     62shouldGenerateGLError(context, context.NO_ERROR, "context.texParameteri(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER, context.NEAREST)");
     63shouldGenerateGLError(context, context.NO_ERROR, "context.getTexParameter(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER)");
     64
     65debug("");
     66debug("check without bindings");
     67context.bindBuffer(context.ARRAY_BUFFER, 0);
     68context.bindTexture(context.TEXTURE_2D, 0);
     69shouldGenerateGLError(context, context.INVALID_OPERATION, "context.bufferData(context.ARRAY_BUFFER, 1, context.STATIC_DRAW)");
     70shouldGenerateGLError(context, context.INVALID_OPERATION, "context.getBufferParameter(context.ARRAY_BUFFER, context.BUFFER_SIZE)");
     71shouldGenerateGLError(context, context.INVALID_OPERATION, "context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 1, 1, 0, context.RGBA, context.UNSIGNED_BYTE, new Uint8Array([0,0,0,0]))");
     72shouldGenerateGLError(context, context.INVALID_OPERATION, "context.texParameteri(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER, context.NEAREST)");
     73shouldGenerateGLError(context, context.INVALID_OPERATION, "context.getTexParameter(context.TEXTURE_2D, context.TEXTURE_MIN_FILTER)");
     74
     75
    4776successfullyParsed = true;
    4877</script>
  • trunk/WebCore/ChangeLog

    r65087 r65089  
     12010-08-06  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        texture functions should gen INVALID_OPERATION if no texture is bound
     6        https://bugs.webkit.org/show_bug.cgi?id=42907
     7
     8        * html/canvas/WebGLRenderingContext.cpp:
     9        (WebCore::WebGLRenderingContext::copyTexImage2D): Check if a texture is bound to target.
     10        (WebCore::WebGLRenderingContext::copyTexSubImage2D): Ditto.
     11        (WebCore::WebGLRenderingContext::generateMipmap): Ditto.
     12        (WebCore::WebGLRenderingContext::getTexParameter): Ditto.
     13        (WebCore::WebGLRenderingContext::texImage2DBase): Ditto.
     14        (WebCore::WebGLRenderingContext::texParameter): Ditto.
     15        (WebCore::WebGLRenderingContext::texSubImage2DBase): Ditto.
     16        (WebCore::WebGLRenderingContext::validateTextureBinding): Check if target is valid and if a texture is bound to it.
     17        * html/canvas/WebGLRenderingContext.h: Declare validateTextureBinding().
     18
    1192010-08-10  Patrick Gansterer  <paroga@paroga.com>
    220
  • trunk/WebCore/html/canvas/WebGLRenderingContext.cpp

    r64998 r65089  
    522522    if (!validateTexFuncParameters(target, level, internalformat, width, height, border, internalformat, GraphicsContext3D::UNSIGNED_BYTE))
    523523        return;
     524    WebGLTexture* tex = validateTextureBinding(target, true);
     525    if (!tex)
     526        return;
    524527    if (!isGLES2Compliant()) {
    525528        if (m_framebufferBinding && m_framebufferBinding->object()
     
    536539    m_context->copyTexImage2D(target, level, internalformat, x, y, width, height, border);
    537540    // FIXME: if the framebuffer is not complete, none of the below should be executed.
    538     WebGLTexture* tex = getTextureBinding(target);
     541    if (!isGLES2Compliant())
     542        tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE);
     543    if (m_framebufferBinding)
     544        m_framebufferBinding->onAttachedObjectChange(tex);
     545    cleanupAfterGraphicsCall(false);
     546}
     547
     548void WebGLRenderingContext::copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height)
     549{
     550    WebGLTexture* tex = validateTextureBinding(target, true);
     551    if (!tex)
     552        return;
    539553    if (!isGLES2Compliant()) {
    540         if (tex)
    541             tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE);
    542     }
    543     if (m_framebufferBinding && tex)
    544         m_framebufferBinding->onAttachedObjectChange(tex);
    545     cleanupAfterGraphicsCall(false);
    546 }
    547 
    548 void WebGLRenderingContext::copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height)
    549 {
    550     if (!isGLES2Compliant()) {
    551         WebGLTexture* tex = getTextureBinding(target);
    552         if (m_framebufferBinding && m_framebufferBinding->object() && tex
     554        if (m_framebufferBinding && m_framebufferBinding->object()
    553555            && !isTexInternalFormatColorBufferCombinationValid(tex->getInternalFormat(),
    554556                                                               m_framebufferBinding->getColorBufferFormat())) {
     
    11111113void WebGLRenderingContext::generateMipmap(unsigned long target)
    11121114{
    1113     RefPtr<WebGLTexture> tex;
     1115    WebGLTexture* tex = validateTextureBinding(target, false);
     1116    if (!tex)
     1117        return;
    11141118    if (!isGLES2Compliant()) {
    1115         if (target == GraphicsContext3D::TEXTURE_2D)
    1116             tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding;
    1117         else if (target == GraphicsContext3D::TEXTURE_CUBE_MAP)
    1118             tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding;
    1119         if (tex && !tex->canGenerateMipmaps()) {
     1119        if (!tex->canGenerateMipmaps()) {
    11201120            m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
    11211121            return;
     
    11231123    }
    11241124    m_context->generateMipmap(target);
    1125     if (!isGLES2Compliant()) {
    1126         if (tex)
    1127             tex->generateMipmapLevelInfo();
    1128     }
     1125    if (!isGLES2Compliant())
     1126        tex->generateMipmapLevelInfo();
    11291127    cleanupAfterGraphicsCall(false);
    11301128}
     
    15751573{
    15761574    UNUSED_PARAM(ec);
    1577     if (target != GraphicsContext3D::TEXTURE_2D
    1578         && target != GraphicsContext3D::TEXTURE_CUBE_MAP) {
    1579         m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
     1575    WebGLTexture* tex = validateTextureBinding(target, false);
     1576    if (!tex)
    15801577        return WebGLGetInfo();
    1581     }
    15821578    WebGLStateRestorer(this, false);
    15831579    int value = 0;
     
    21012097    if (!validateTexFuncParameters(target, level, internalformat, width, height, border, format, type))
    21022098        return;
     2099    WebGLTexture* tex = validateTextureBinding(target, true);
     2100    if (!tex)
     2101        return;
    21032102    if (!isGLES2Compliant()) {
    21042103        if (level && WebGLTexture::isNPOT(width, height)) {
     
    21092108    m_context->texImage2D(target, level, internalformat, width, height,
    21102109                          border, format, type, pixels);
    2111     WebGLTexture* tex = getTextureBinding(target);
    2112     if (!isGLES2Compliant()) {
    2113         if (tex)
    2114             tex->setLevelInfo(target, level, internalformat, width, height, type);
    2115     }
    2116     if (m_framebufferBinding && tex)
     2110    if (!isGLES2Compliant())
     2111        tex->setLevelInfo(target, level, internalformat, width, height, type);
     2112    if (m_framebufferBinding)
    21172113        m_framebufferBinding->onAttachedObjectChange(tex);
    21182114    cleanupAfterGraphicsCall(false);
     
    23312327void WebGLRenderingContext::texParameter(unsigned long target, unsigned long pname, float paramf, int parami, bool isFloat)
    23322328{
     2329    WebGLTexture* tex = validateTextureBinding(target, false);
     2330    if (!tex)
     2331        return;
    23332332    if (!isGLES2Compliant()) {
    2334         RefPtr<WebGLTexture> tex = 0;
    2335         switch (target) {
    2336         case GraphicsContext3D::TEXTURE_2D:
    2337             tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding;
    2338             break;
    2339         case GraphicsContext3D::TEXTURE_CUBE_MAP:
    2340             tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding;
    2341             break;
    2342         default:
    2343             m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
    2344             return;
    2345         }
    23462333        switch (pname) {
    23472334        case GraphicsContext3D::TEXTURE_MIN_FILTER:
     
    23602347            return;
    23612348        }
    2362         if (tex) {
    2363             if (isFloat)
    2364                 tex->setParameterf(pname, paramf);
    2365             else
    2366                 tex->setParameteri(pname, parami);
    2367         }
     2349        if (isFloat)
     2350            tex->setParameterf(pname, paramf);
     2351        else
     2352            tex->setParameteri(pname, parami);
    23682353    }
    23692354    if (isFloat)
     
    23922377    if (!validateTexFuncFormatAndType(format, type))
    23932378        return;
    2394 
     2379    if (!validateTextureBinding(target, true))
     2380        return;
    23952381    m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
    23962382    cleanupAfterGraphicsCall(false);
     
    33103296}
    33113297
    3312 WebGLTexture* WebGLRenderingContext::getTextureBinding(unsigned long target)
    3313 {
    3314     RefPtr<WebGLTexture> tex = 0;
     3298WebGLTexture* WebGLRenderingContext::validateTextureBinding(unsigned long target, bool useSixEnumsForCubeMap)
     3299{
     3300    WebGLTexture* tex = 0;
    33153301    switch (target) {
    33163302    case GraphicsContext3D::TEXTURE_2D:
    3317         tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding;
     3303        tex = m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get();
    33183304        break;
    33193305    case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_X:
     
    33233309    case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z:
    33243310    case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z:
    3325         tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding;
     3311        if (!useSixEnumsForCubeMap) {
     3312            m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
     3313            return 0;
     3314        }
     3315        tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding.get();
    33263316        break;
    3327     }
    3328     if (tex && tex->object())
    3329         return tex.get();
    3330     return 0;
     3317    case GraphicsContext3D::TEXTURE_CUBE_MAP:
     3318        if (useSixEnumsForCubeMap) {
     3319            m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
     3320            return 0;
     3321        }
     3322        tex = m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding.get();
     3323        break;
     3324    default:
     3325        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
     3326        return 0;
     3327    }
     3328    if (!tex)
     3329        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
     3330    return tex;
    33313331}
    33323332
  • trunk/WebCore/html/canvas/WebGLRenderingContext.h

    r64998 r65089  
    461461                                                        unsigned long colorBufferFormat);
    462462
    463     // Helper function to get the current bound texture.
    464     WebGLTexture* getTextureBinding(unsigned long target);
     463    // Helper function to check target and texture bound to the target.
     464    // Generate GL errors and return 0 if target is invalid or texture bound is
     465    // null.  Otherwise, return the texture bound to the target.
     466    WebGLTexture* validateTextureBinding(unsigned long target, bool useSixEnumsForCubeMap);
    465467
    466468    // Helper function to check input format/type for functions {copy}Tex{Sub}Image.
Note: See TracChangeset for help on using the changeset viewer.