Re: [Mesa-dev] [PATCH 2/3] mesa: Fix the error for glCopyBufferSubData() with a buffer of 0.

2012-01-26 Thread Brian Paul
On Wed, Jan 25, 2012 at 8:51 PM, Eric Anholt e...@anholt.net wrote:
 The INVALID_ENUM here may have been trying to catch someone passing
 something bogus as the target rather than having a non-buffer bound.
 The extension spec and the GL 3.2 specs doesn't say anything specific
 for error results for either bad target enums or things that aren't
 buffer objects other than 0.  Given that, provide at least correct
 behavior for the specified case.
 ---
  src/mesa/main/bufferobj.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


Reviewed-by: Brian Paul bri...@vmware.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/3] mesa: Fix the error for glCopyBufferSubData() with a buffer of 0.

2012-01-26 Thread Ian Romanick

On 01/25/2012 05:51 PM, Eric Anholt wrote:

The INVALID_ENUM here may have been trying to catch someone passing
something bogus as the target rather than having a non-buffer bound.
The extension spec and the GL 3.2 specs doesn't say anything specific
for error results for either bad target enums or things that aren't
buffer objects other than 0.  Given that, provide at least correct
behavior for the specified case.


Page 16 (page 32 of the PDF) of the OpenGL 3.0 spec says:

If a command that requires an enumerated value is passed a
symbolic constant that is not one of those specified as
allowable for that command, the error INVALID ENUM is
generated. This is the case even if the argument is a
pointer to a symbolic constant, if the value pointed to is
not allowable for the given command.


---
  src/mesa/main/bufferobj.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index e4f964f..471442c 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1311,14 +1311,14 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum 
writeTarget,

 src = get_buffer(ctx, readTarget);


I think putting

   if (src == NULL) {
  _mesa_error(ctx, GL_INVALID_ENUM,
  glCopyBuffserSubData(readTarget = 0x%x),
  readTarget);
  return;
   }

and a similar block after the next get_buffer maintains all the correct 
error generation behavior.



 if (!_mesa_is_bufferobj(src)) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
+  _mesa_error(ctx, GL_INVALID_OPERATION,
glCopyBuffserSubData(readTarget = 0x%x), readTarget);
return;
 }

 dst = get_buffer(ctx, writeTarget);
 if (!_mesa_is_bufferobj(dst)) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
+  _mesa_error(ctx, GL_INVALID_OPERATION,
glCopyBuffserSubData(writeTarget = 0x%x), writeTarget);
return;
 }


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/3] mesa: Fix the error for glCopyBufferSubData() with a buffer of 0.

2012-01-25 Thread Eric Anholt
The INVALID_ENUM here may have been trying to catch someone passing
something bogus as the target rather than having a non-buffer bound.
The extension spec and the GL 3.2 specs doesn't say anything specific
for error results for either bad target enums or things that aren't
buffer objects other than 0.  Given that, provide at least correct
behavior for the specified case.
---
 src/mesa/main/bufferobj.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index e4f964f..471442c 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1311,14 +1311,14 @@ _mesa_CopyBufferSubData(GLenum readTarget, GLenum 
writeTarget,
 
src = get_buffer(ctx, readTarget);
if (!_mesa_is_bufferobj(src)) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
+  _mesa_error(ctx, GL_INVALID_OPERATION,
   glCopyBuffserSubData(readTarget = 0x%x), readTarget);
   return;
}
 
dst = get_buffer(ctx, writeTarget);
if (!_mesa_is_bufferobj(dst)) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
+  _mesa_error(ctx, GL_INVALID_OPERATION,
   glCopyBuffserSubData(writeTarget = 0x%x), writeTarget);
   return;
}
-- 
1.7.7.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev