Bug 214116

Summary: Implement uniform* and getUniform for WebGL 2 types
Product: WebKit Reporter: James Darpinian <jdarpinian>
Component: WebGLAssignee: James Darpinian <jdarpinian>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, changseok, dino, esprehn+autocc, ews-watchlist, graouts, gyuyoung.kim, justin_fan, kbr, kondapallykalyan, noam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 126404, 126938    
Attachments:
Description Flags
Patch
none
fix gtk build and rebaseline tests
none
rebase
none
review feedback none

Description James Darpinian 2020-07-08 17:59:52 PDT
Implement uniform* and getUniform for WebGL 2 types
Comment 1 James Darpinian 2020-07-08 18:01:10 PDT
Created attachment 403830 [details]
Patch
Comment 2 James Darpinian 2020-07-09 17:05:39 PDT
Created attachment 403933 [details]
fix gtk build and rebaseline tests
Comment 3 James Darpinian 2020-07-10 14:57:55 PDT
Created attachment 404005 [details]
rebase
Comment 4 Kenneth Russell 2020-07-10 15:08:07 PDT
Comment on attachment 404005 [details]
rebase

View in context: https://bugs.webkit.org/attachment.cgi?id=404005&action=review

Great work James. LGTM - I don't have reviewer privileges.

> Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:1285
> +    if (location->program() != m_currentProgram) {

Maybe we should add a bool validateUniformLocation(WebGLUniformLocation*, const char* functionName).
Comment 5 Dean Jackson 2020-07-10 18:05:27 PDT
Comment on attachment 404005 [details]
rebase

View in context: https://bugs.webkit.org/attachment.cgi?id=404005&action=review

>> Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:1285
>> +    if (location->program() != m_currentProgram) {
> 
> Maybe we should add a bool validateUniformLocation(WebGLUniformLocation*, const char* functionName).

Agreed.

> Source/WebCore/html/canvas/WebGL2RenderingContext.cpp:1329
> +    m_context->uniform1uiv(location->location(), value.data(), srcOffset, srcLength ? srcLength : (value.length() - srcOffset) / 1);

Maybe remove the "/1"?

Also, do we need to validate the case where srcLength is 0 and srcOffset is > value.length?

> Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3409
> +            // Can't handle this type

Nit: End with a .

> Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:3471
> +            // Can't handle this type

Nit: end with a .

> Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:6900
> +    GCGLsizei actualSize = size - srcOffset;
> +    if (srcLength > 0) {
> +        if (srcLength > static_cast<GCGLuint>(actualSize)) {
> +            synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "invalid srcOffset + srcLength");
> +            return false;
> +        }
> +        actualSize = srcLength;

Oh, you did it here :)

> Source/WebCore/platform/graphics/GraphicsContextGL.h:1026
> +    virtual void getUniformuiv(PlatformGLObject program, GCGLint location, GCGLuint* value) = 0;

Huh. I wonder how I missed this.
Comment 6 Kenneth Russell 2020-07-13 14:58:34 PDT
Comment on attachment 404005 [details]
rebase

View in context: https://bugs.webkit.org/attachment.cgi?id=404005&action=review

>> Source/WebCore/platform/graphics/GraphicsContextGL.h:1026
>> +    virtual void getUniformuiv(PlatformGLObject program, GCGLint location, GCGLuint* value) = 0;
> 
> Huh. I wonder how I missed this.

Unsigned integer uniforms are new in WebGL 2.0 and this patch is the first one referencing them.
Comment 7 James Darpinian 2020-07-13 17:38:40 PDT
Created attachment 404195 [details]
review feedback
Comment 8 James Darpinian 2020-07-13 22:54:11 PDT
Comment on attachment 404195 [details]
review feedback

All review feedback addressed. Thanks!
Comment 9 EWS 2020-07-14 12:59:05 PDT
Committed r264371: <https://trac.webkit.org/changeset/264371>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 404195 [details].
Comment 10 Radar WebKit Bug Importer 2020-07-14 13:00:18 PDT
<rdar://problem/65559641>