Closed Bug 982464 Opened 10 years ago Closed 10 years ago

WebGL Extension aren't neutered after context lost.

Categories

(Core :: Graphics: CanvasWebGL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: u480271, Assigned: u480271)

Details

Attachments

(1 file, 3 obsolete files)

      No description provided.
Assignee: nobody → dglastonbury
Status: NEW → ASSIGNED
Comment on attachment 8389593 [details] [diff] [review]
Disable extension functionality after a context lost happens.

Review of attachment 8389593 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/canvas/src/WebGLExtensionDebugShaders.cpp
@@ +26,5 @@
>  WebGLExtensionDebugShaders::GetTranslatedShaderSource(WebGLShader* shader,
>                                                        nsAString& retval)
>  {
> +    if (mIsLost)
> +        return;

This should be an INVALID_OPERATION. [1]

::: content/canvas/src/WebGLExtensionDrawBuffers.cpp
@@ +50,5 @@
>  
>  void WebGLExtensionDrawBuffers::DrawBuffersWEBGL(const dom::Sequence<GLenum>& buffers)
>  {
> +    if (mIsLost)
> +        return;

[1]

::: content/canvas/src/WebGLExtensionInstancedArrays.cpp
@@ +24,5 @@
>  void
>  WebGLExtensionInstancedArrays::DrawArraysInstancedANGLE(GLenum mode, GLint first,
>                                                          GLsizei count, GLsizei primcount)
>  {
> +    if (mIsLost) {

[1] here and below

::: content/canvas/src/WebGLExtensionVertexArray.cpp
@@ +25,5 @@
>  
>  already_AddRefed<WebGLVertexArray> WebGLExtensionVertexArray::CreateVertexArrayOES()
>  {
> +    if (mIsLost) {
> +        mContext->GenerateWarning("CreateVertexArrayOES: Extension is lost. Returning NULL.");

[1] here and below
Attachment #8389593 - Flags: review?(jgilbert) → review-
Address review from Jeff. Calls to lost extensions result in InvalidOperation.
Attachment #8389629 - Flags: review?(jgilbert)
Attachment #8389593 - Attachment is obsolete: true
Comment on attachment 8389629 [details] [diff] [review]
Disable extension functionality after a context lost happens.

Review of attachment 8389629 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/canvas/src/WebGLExtensionDebugShaders.cpp
@@ +27,5 @@
>                                                        nsAString& retval)
>  {
> +    if (mIsLost)
> +        return mContext->ErrorInvalidOperation("getTranslatedShaderSource: "
> +                                               "Extension is lost.");

Multi-line expression inside an if branch deserves {} brackets.

::: content/canvas/src/WebGLExtensionInstancedArrays.cpp
@@ +25,5 @@
>  WebGLExtensionInstancedArrays::DrawArraysInstancedANGLE(GLenum mode, GLint first,
>                                                          GLsizei count, GLsizei primcount)
>  {
> +    if (mIsLost)
> +        return mContext->ErrorInvalidOperation("DrawArraysInstancedANGLE: Extension is lost.");

This function name should be lowercase (what JS sees), here and below.

::: content/canvas/src/WebGLExtensionVertexArray.cpp
@@ +25,5 @@
>  
>  already_AddRefed<WebGLVertexArray> WebGLExtensionVertexArray::CreateVertexArrayOES()
>  {
> +    if (mIsLost) {
> +        mContext->ErrorInvalidOperation("CreateVertexArrayOES: Extension is lost. Returning NULL.");

This function name should be lowercase (what JS sees), here and below.
Attachment #8389629 - Flags: review?(jgilbert) → review+
Changed warnings to errors, as per review comments.
Attachment #8390287 - Flags: review?(jgilbert)
Attachment #8389629 - Attachment is obsolete: true
Review comments.
Attachment #8390288 - Flags: review?(jgilbert)
Attachment #8390287 - Attachment is obsolete: true
Attachment #8390287 - Flags: review?(jgilbert)
Attachment #8390288 - Flags: review?(jgilbert) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/cef5e3248787
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: