[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Specifying the behavior of bindXXX when passed a deleted resource



I think there are other relevant but smaller holes like this in the
current WebGL spec:

1. What should happen when

    var tex = gl.createTexture();
    gl.bindTexture(gl.TEXTURE_2D, tex);
    gl.deleteTexture(tex);

? ES says

  # If a texture that is currently bound to one of the targets
  # TEXTURE_2D, or TEXTURE_- CUBE_MAP is deleted, it is as though
  # BindTexture had been executed with the same target and texture zero.

and

  # If a texture object is deleted, it is as if all texture units which
  # are bound to that texture object are rebound to texture object zero.

, but there is no "texture zero" in WebGL. I believe all exising
implementations do the expected thing (i.e. unbound all the relevant
bindings), but this is worth clarifying under deleteTexture() or "6.3 No
Default Textures".

Also, the sentence "If no WebGLTexture is bound (e.g., passing null or 0
to bindTexture) then attempts to modify or query the texture object
shall generate an INVALID_OPERATION error." in "5.14.8 Texture objects"
is inacccurate in that 'gl.bindTexture(gl.TEXTURE_2D, 0)' throws
'TYPE_ERROR'.


2. 'null' as an argument to 'WebGLObject?' in a function call

If the intention is always to treat 'null' as '0' in underlining
implementation, this is worth a normative sentence. Currently, some of
the functions talk about 'null' in the correspoding description but most
don't.


3. gl.getParameter(gl.FRAMEBUFFER_BINDING)

It is actually quite amusing to me that all the implementations I played
with return 'null', while a valid WebGLFramebuffer seems more
conceptually correct. This should be specified too.


4. isXXX()

The descriptions all have prose like

  # Return true if the passed WebGLXXX is valid and false otherwise.
  #
  # Returns false if the buffer's invalidated flag is set.

but no prose says that deleteXXX() makes the WebGLXXX invalid and I
think there should be an "invalid flag" that are set when deleteXXX() is
called (except programs and shaders, which are special, but we can still
say the "invalid flag" is set if the underlining object is deleted).

(But why do we have these at the first place? They seem to be pretty
useless.)


given all these,

(2013/07/27 5:49), Kenneth Russell wrote:
> I don't believe this issue is a major problem for application
> developers, and am concerned that a poor decision may significantly
> impact compatibility and performance, so plan to defer work on this
> for the moment.

I agree that there is little point in changing the current
implementation (since the model is already quite quirky given point 3.
above), and we can specify the current behavior as something like "a
WebGLObject with the invalid flag set is treated as 'null'".




Cheers,
Kenny
-- 
Web Specialist, Opera Sphinx Game Force, Oupeng Browser, Beijing
Try Oupeng: http://www.oupeng.com/

-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------