Changeset 62150 in webkit


Ignore:
Timestamp:
Jun 29, 2010 3:22:16 PM (14 years ago)
Author:
zmo@google.com
Message:

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

Reviewed by Dimitri Glazkov.

uniformmatrix* should generate INVALID_VALUE with transpose = true
https://bugs.webkit.org/show_bug.cgi?id=41235

  • fast/canvas/webgl/gl-uniformmatrix4fv-expected.txt: Added.
  • fast/canvas/webgl/gl-uniformmatrix4fv.html: Added.

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

Reviewed by Dimitri Glazkov.

uniformmatrix* should generate INVALID_VALUE with transpose = true
https://bugs.webkit.org/show_bug.cgi?id=41235

Test: fast/canvas/webgl/gl-uniformmatrix4fv.html

  • html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::uniformMatrix2fv): Call validateUniformMatrixParameters instead. (WebCore::WebGLRenderingContext::uniformMatrix3fv): Ditto. (WebCore::WebGLRenderingContext::uniformMatrix4fv): Ditto. (WebCore::WebGLRenderingContext::validateUniformMatrixParameters): Validate input parameters for uniformMatrix*().
  • html/canvas/WebGLRenderingContext.h: Declare validateUniformMatrixParameters().
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r62147 r62150  
     12010-06-29  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        uniformmatrix* should generate INVALID_VALUE with transpose = true
     6        https://bugs.webkit.org/show_bug.cgi?id=41235
     7
     8        * fast/canvas/webgl/gl-uniformmatrix4fv-expected.txt: Added.
     9        * fast/canvas/webgl/gl-uniformmatrix4fv.html: Added.
     10
    1112010-06-29  Robert Hogan  <robert@webkit.org>
    212
  • trunk/WebCore/ChangeLog

    r62145 r62150  
     12010-06-29  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        uniformmatrix* should generate INVALID_VALUE with transpose = true
     6        https://bugs.webkit.org/show_bug.cgi?id=41235
     7
     8        Test: fast/canvas/webgl/gl-uniformmatrix4fv.html
     9
     10        * html/canvas/WebGLRenderingContext.cpp:
     11        (WebCore::WebGLRenderingContext::uniformMatrix2fv): Call validateUniformMatrixParameters instead.
     12        (WebCore::WebGLRenderingContext::uniformMatrix3fv): Ditto.
     13        (WebCore::WebGLRenderingContext::uniformMatrix4fv): Ditto.
     14        (WebCore::WebGLRenderingContext::validateUniformMatrixParameters): Validate input parameters for uniformMatrix*().
     15        * html/canvas/WebGLRenderingContext.h: Declare validateUniformMatrixParameters().
     16
    1172010-06-29  Kenneth Russell  <kbr@google.com>
    218
  • trunk/WebCore/html/canvas/WebGLRenderingContext.cpp

    r62145 r62150  
    28922892{
    28932893    UNUSED_PARAM(ec);
    2894     if (!location)
    2895         return;
    2896 
    2897     if (location->program() != m_currentProgram) {
    2898         m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
    2899         return;
    2900     }
    2901 
    2902     if (!v) {
    2903         m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
    2904         return;
    2905     }
     2894    if (!validateUniformMatrixParameters(location, transpose, v))
     2895        return;
    29062896    // FIXME: length needs to be a multiple of 4
    29072897    m_context->uniformMatrix2fv(location->location(), transpose, v->data(), v->length() / 4);
     
    29122902{
    29132903    UNUSED_PARAM(ec);
    2914     if (!location)
    2915         return;
    2916 
    2917     if (location->program() != m_currentProgram) {
    2918         m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
    2919         return;
    2920     }
    2921 
    2922     if (!v) {
    2923         m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
    2924         return;
    2925     }
     2904    if (!validateUniformMatrixParameters(location, transpose, v))
     2905        return;
    29262906    // FIXME: length needs to be a multiple of 4
    29272907    m_context->uniformMatrix2fv(location->location(), transpose, v, size / 4);
     
    29322912{
    29332913    UNUSED_PARAM(ec);
    2934     if (!location)
    2935         return;
    2936 
    2937     if (location->program() != m_currentProgram) {
    2938         m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
    2939         return;
    2940     }
    2941 
    2942     if (!v) {
    2943         m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
    2944         return;
    2945     }
     2914    if (!validateUniformMatrixParameters(location, transpose, v))
     2915        return;
    29462916    // FIXME: length needs to be a multiple of 9
    29472917    m_context->uniformMatrix3fv(location->location(), transpose, v->data(), v->length() / 9);
     
    29522922{
    29532923    UNUSED_PARAM(ec);
    2954     if (!location)
    2955         return;
    2956 
    2957     if (location->program() != m_currentProgram) {
    2958         m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
    2959         return;
    2960     }
    2961 
    2962     if (!v) {
    2963         m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
    2964         return;
    2965     }
     2924    if (!validateUniformMatrixParameters(location, transpose, v))
     2925        return;
    29662926    // FIXME: length needs to be a multiple of 9
    29672927    m_context->uniformMatrix3fv(location->location(), transpose, v, size / 9);
     
    29722932{
    29732933    UNUSED_PARAM(ec);
    2974     if (!location)
    2975         return;
    2976 
    2977     if (location->program() != m_currentProgram) {
    2978         m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
    2979         return;
    2980     }
    2981 
    2982     if (!v) {
    2983         m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
    2984         return;
    2985     }
     2934    if (!validateUniformMatrixParameters(location, transpose, v))
     2935        return;
    29862936    // FIXME: length needs to be a multiple of 16
    29872937    m_context->uniformMatrix4fv(location->location(), transpose, v->data(), v->length() / 16);
     
    29922942{
    29932943    UNUSED_PARAM(ec);
    2994     if (!location)
    2995         return;
    2996 
    2997     if (location->program() != m_currentProgram) {
    2998         m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
    2999         return;
    3000     }
    3001 
    3002     if (!v) {
    3003         m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
    3004         return;
    3005     }
     2944    if (!validateUniformMatrixParameters(location, transpose, v))
     2945        return;
    30062946    // FIXME: length needs to be a multiple of 16
    30072947    m_context->uniformMatrix4fv(location->location(), transpose, v, size / 16);
     
    36473587}
    36483588
     3589bool WebGLRenderingContext::validateUniformMatrixParameters(const WebGLUniformLocation* location, bool transpose, void* v)
     3590{
     3591    if (!location)
     3592        return false;
     3593    if (location->program() != m_currentProgram) {
     3594        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
     3595        return false;
     3596    }
     3597    if (!v) {
     3598        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     3599        return false;
     3600    }
     3601    if (transpose) {
     3602        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     3603        return false;
     3604    }
     3605    return true;
     3606}
     3607
    36493608} // namespace WebCore
    36503609
  • trunk/WebCore/html/canvas/WebGLRenderingContext.h

    r62145 r62150  
    464464        bool validateCapability(unsigned long);
    465465
     466        // Helper function to validate input parameters for uniformMatrix functions.
     467        bool validateUniformMatrixParameters(const WebGLUniformLocation* location, bool transpose, void* v);
     468
    466469        friend class WebGLStateRestorer;
    467470    };
Note: See TracChangeset for help on using the changeset viewer.