Chia-I Wu wrote:
> On Thu, Jul 30, 2009 at 07:09:06PM +0800, Chia-I Wu wrote:
>> Since st_set_teximage changes a texture object, I want to mark the
>> texture object incomplete, and mark the core mesa context with
>> _NEW_TEXTURE.  I grepped the st source code, and no other functions
>> change the state of the core mesa context.  Am I allowed to modify the
>> state of core mesa context directly or is there a better way?
> For this issue, I want to add
> 
> void
> _mesa_notifyBindTexImage(GLcontext *ctx, struct gl_texture_object *texObj);

I think a better name would be _mesa_dirty_texobj() or similar, plus 
update the comment to make it more generic.  Basically, name the 
function and document it according to what it does, not what it might 
be used for.


> to mesa core.  It is called by driver and st to notify mesa that some
> pixmap/pbuffer is bound to or released from the texture object.  Mesa
> currently only marks the texture object incomplete and sets
> _NEW_TEXTURE.
> 
>> My understanding to these paragraphs is that, a texture object may
>> allocate private buffers or use the backing buffers of the bound
>> pbuffers for the texels.  But they can not be mixed!  A BindTexImage
>> causes the private buffers to be freed, and a TexImage* causes the bound
>> pbuffers to be released.  And both functions should mark _NEW_TEXTURE
>> and require the textre object in question to be tested for completeness.
>> Is my understanding correct?
>> If that's correct, I should make a texture object incomplete when a
>> bound pixmap/pbuffer is released.  Currently, I set the texture image to
>> have zero width and height so that it is tested incomplete when
>> validated.  Is this the suggested way?
> For these issues, I want to add _mesa_clear_texture_image and
> _mesa_clear_texture_object.  The former "clears" a texture image by
> freeing the texel buffer and reinitializes the texture image.  The
> latter is called to "clear" every image of a texture object.
> 
> With these functions, state tracker can clear the texture object before
> binding a pipe surface to it.  And it can notify mesa about the change.
> 
> The winsys api wants to create contexts/surfaces, make them current, and
> swap buffers.  These are the basic functions and mesa has api to support
> them.  What's lacking in mesa is a way to let winsys api bind a surface
> to a texture, and the functions I add try to fulfill the need.  This is
> the motivation.
> 
> The modifications can be found in the attachments.  I am still new to
> mesa and I would like to hear some feedbacks before sending them as
> patches.  Please let me know what you think, or let me know that I might
> be doing something stupid :)

I think this looks OK.  Just a few more thoughts about naming:

Rename st_set_teximage() -> st_bind_texture_surface(), plus add a more 
descriptive comment for the function (the current texture object's 
images are replaced, etc.

st_unset_teximage() -> st_unbind_texture_surface(), plus the comment.

Finally, add a comment on the GLboolean surface_based; field to 
explain what it means.

Thanks!

-Brian


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to