2010/2/12 Ian Romanick <[email protected]>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Kristian Høgsberg wrote:
>> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
>> index 0e6f69f..475aeab 100644
>> --- a/src/mesa/main/fbobject.c
>> +++ b/src/mesa/main/fbobject.c
>> @@ -1008,6 +1008,30 @@ renderbuffer_storage(GLenum target, GLenum
>> internalFormat,
>> */
>> }
>>
>> +#if FEATURE_OES_EGL_image
>> +void GLAPIENTRY
>> +_mesa_EGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES
>> image)
>> +{
>> + GET_CURRENT_CONTEXT(ctx);
>> + ASSERT_OUTSIDE_BEGIN_END(ctx);
>> + struct gl_renderbuffer *rb;
>> +
>> + if (target != GL_RENDERBUFFER_EXT) {
>
> New uses of these enums should use the undecorated versions.
That means GL_RENDERBUFFER, right?
>> + _mesa_error(ctx, GL_INVALID_ENUM,
>> "EGLImageTargetRenderbufferStorageOES");
>> + return;
>> + }
>> +
>> + rb = ctx->CurrentRenderbuffer;
>> + if (!rb) {
>> + _mesa_error(ctx, GL_INVALID_OPERATION,
>> "EGLImageTargetRenderbufferStorageOES");
>> + return;
>> + }
>> +
>
> Is there any sort of generic validation of the image that could be done
> here? I suspect not, but I'd hate to see the same validation code
> duplicated in every driver. Maybe that would better belong in a utility
> function in src/mesa/drivers/dri/common. Hmm...
I know what you're saying, but there isn't. The EGLImage is an EGL
type and in our implementation it's a struct _egl_image, but we don't
know anything about that here. However, when the driver looks up the
EGLImage to get the __DRIimage, we do some basic validation in the
lookup function. When the driver finally gets the __DRIimage in hand,
there isn't a lot of checking to do; it's just a struct intel_region.
I don't worry that this will lead to a lot of code duplication.
>> + FLUSH_VERTICES(ctx, _NEW_BUFFERS);
>> +
>> + ctx->Driver.EGLImageTargetRenderbufferStorage(ctx, rb, image);
>> +}
>> +#endif
>>
>> /**
>> * Helper function for _mesa_GetRenderbufferParameterivEXT() and
>> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
>> index da3c6f9..6b15c40 100644
>> --- a/src/mesa/main/teximage.c
>> +++ b/src/mesa/main/teximage.c
>> @@ -2448,6 +2448,47 @@ _mesa_TexImage3DEXT( GLenum target, GLint level,
>> GLenum internalFormat,
>> }
>>
>>
>> +#if FEATURE_OES_EGL_image
>> +void GLAPIENTRY
>> +_mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
>> +{
>> + GET_CURRENT_CONTEXT(ctx);
>> + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
>> + struct gl_texture_object *texObj;
>> + struct gl_texture_image *texImage;
>> +
>> + if (target != GL_TEXTURE_2D) {
>> + _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage1D(target)");
>
> That's probably the wrong error message. :) Cut-and-paste for the lose.
Oops, fiedx.
>> + return;
>> + }
>> +
>> + if (ctx->NewState & _MESA_NEW_TRANSFER_STATE)
>> + _mesa_update_state(ctx);
>> +
>> + texObj = _mesa_get_current_tex_object(ctx, target);
>> + _mesa_lock_texture(ctx, texObj);
>> +
>> + texImage = _mesa_get_tex_image(ctx, texObj, target, 0);
>> + if (!texImage) {
>> + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
>
> That's probably the wrong error message. :) Cut-and-paste for the lose.
Oops, fiedx.
>> + } else {
>> + if (texImage->Data)
>> + ctx->Driver.FreeTexImageData( ctx, texImage );
>> +
>> + ASSERT(texImage->Data == NULL);
>> + //clear_teximage_fields(texImage); /* not really needed, but helpful
>> */
>> + ctx->Driver.EGLImageTargetTexture2D(ctx, target,
>> + texObj, texImage, image);
>> +
>> + /* state update */
>> + texObj->_Complete = GL_FALSE;
>> + ctx->NewState |= _NEW_TEXTURE;
>> + }
>> + _mesa_unlock_texture(ctx, texObj);
>> +
>> +}
>> +#endif
>> +
>>
>> void GLAPIENTRY
>> _mesa_TexSubImage1D( GLenum target, GLint level,
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkt191oACgkQX1gOwKyEAw9VdgCePyOrp2dqrYdU3l8Dgh+7/5YE
> mu4Amwd/D9vDVG+jEIoPt5EYRTPqgEXi
> =Hq4M
> -----END PGP SIGNATURE-----
>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev