Re: [osg-users] PBOs for images and textures

2010-01-04 Thread Guy
Hi J.P.

 First of all, I haven't tried anything yet. It seems to me more than a
minor change so I didn't want to start messig up OSG code with my own
gibrish :)

 Second, I've looked at the screen capture examples, but it's not a
generic solution (no offense, it's only my opinion).

 Third, about gaining performance, what is the format of RTT you are
using? I remember I once implemented DMA access to textures in an OpenGL
application. For RGB images it was slower than the glReadPixel, but for
RGBA images it was faster. I assume it depends on the driver.

I wonder if I should try and code the DMA access to the draw callback
after you already have done it. I trust you did a good job and if it
didn't gain performance I doubt I could do something better.

Currently the read-back is THE slowest section of my application.

Thanks for the answer, if I'll have time I'll try it also and share the
results with the forum.

Guy. 

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of J.P.
Delport
Sent: Monday, January 04, 2010 9:20 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] PBOs for images and textures

Hi,

I've been fiddling with some of this at the end of last year for fast 
GPU to CPU. You could insert your code into the draw callback. Have you 
tried it? How is the performance? I could not make anything faster than 
the default readimage. You could also look at osgscreencapture for
examples.

jp

Guy wrote:
> Hi all,
> 
>  I was wondering why when there is an image attached to an FBO camera 
> buffer, the data transfer is made by glReadImage from the READ_BUFFER 
> and not by glMapBuffer after copying the READ_BUFFER to PBO?
> 
>  
> 
> The same question goes in the other direction for updating textures
with 
> glTexSubImage.
> 
>  
> 
> Wouldn't that be faster (using the DMA)? Is there a scenario which it 
> wouldn't be better that I miss.
> 
> If it is the best way I don't mind trying to help doing so, but I
guess 
> I'd need help designing it.
> 
> My initial approach is:
> 
> 1. Add PBO object to image. (could be null)
> 
> 2. Change image readpixels function to the following:
> 
> If( PBO )
> 
> {
> 
> Copy pixels from READ_BUFFER to PBO
> 
> Get PBO address
> 
> Memcopy(data, address)
> 
> }
> 
> Else
> 
>OldImageReadPixels
> 
> 3. When attaching image to camera buffer automatically allocate PBO to

> that image.
> 
>  
> 
> That way there will be no change in render stage or any other part of
OSG.
> 
>  
> 
> For textures there can be something similar. The Texture has PBO
object, 
> the function apply will check for the PBO if exists then copy data to 
> the PBO address, then bind it and use glTexSumImage and in similar way

> change the copyTex to copy to the PBO and then from it's mapped
address 
> to a CPU address.
> 
> In textures maybe part of it could be implemented in subload callback.
> 
>  
> 
> Is it the correct path?
> 
> Does it already exists and I missed it? If so I'm sorry for the
noise... :)
> 
>  
> 
> Thanks,
> 
>  Guy.
> 
>  
> 
>  
> 
> 
>

> 
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g

-- 
This message is subject to the CSIR's copyright terms and conditions,
e-mail legal notice, and implemented Open Document Format (ODF)
standard. 
The full disclaimer details can be found at
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by
MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for
their support.

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PBOs for images and textures

2010-01-03 Thread J.P. Delport

Hi,

I've been fiddling with some of this at the end of last year for fast 
GPU to CPU. You could insert your code into the draw callback. Have you 
tried it? How is the performance? I could not make anything faster than 
the default readimage. You could also look at osgscreencapture for examples.


jp

Guy wrote:

Hi all,

 I was wondering why when there is an image attached to an FBO camera 
buffer, the data transfer is made by glReadImage from the READ_BUFFER 
and not by glMapBuffer after copying the READ_BUFFER to PBO?


 

The same question goes in the other direction for updating textures with 
glTexSubImage.


 

Wouldn't that be faster (using the DMA)? Is there a scenario which it 
wouldn't be better that I miss.


If it is the best way I don't mind trying to help doing so, but I guess 
I'd need help designing it.


My initial approach is:

1. Add PBO object to image. (could be null)

2. Change image readpixels function to the following:

If( PBO )

{

Copy pixels from READ_BUFFER to PBO

Get PBO address

Memcopy(data, address)

}

Else

   OldImageReadPixels

3. When attaching image to camera buffer automatically allocate PBO to 
that image.


 


That way there will be no change in render stage or any other part of OSG.

 

For textures there can be something similar. The Texture has PBO object, 
the function apply will check for the PBO if exists then copy data to 
the PBO address, then bind it and use glTexSumImage and in similar way 
change the copyTex to copy to the PBO and then from it's mapped address 
to a CPU address.


In textures maybe part of it could be implemented in subload callback.

 


Is it the correct path?

Does it already exists and I missed it? If so I'm sorry for the noise… :)

 


Thanks,

 Guy.

 

 





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] PBOs for images and textures

2009-12-25 Thread Guy
Hi all,

 I was wondering why when there is an image attached to an FBO camera
buffer, the data transfer is made by glReadImage from the READ_BUFFER
and not by glMapBuffer after copying the READ_BUFFER to PBO?

 

The same question goes in the other direction for updating textures with
glTexSubImage.

 

Wouldn't that be faster (using the DMA)? Is there a scenario which it
wouldn't be better that I miss.

If it is the best way I don't mind trying to help doing so, but I guess
I'd need help designing it.

My initial approach is:

1. Add PBO object to image. (could be null)

2. Change image readpixels function to the following:

If( PBO )

{

Copy pixels from READ_BUFFER to PBO

Get PBO address

Memcopy(data, address)

}

Else

   OldImageReadPixels

3. When attaching image to camera buffer automatically allocate PBO to
that image.

 

That way there will be no change in render stage or any other part of
OSG.

 

For textures there can be something similar. The Texture has PBO object,
the function apply will check for the PBO if exists then copy data to
the PBO address, then bind it and use glTexSumImage and in similar way
change the copyTex to copy to the PBO and then from it's mapped address
to a CPU address.

In textures maybe part of it could be implemented in subload callback.

 

Is it the correct path? 

Does it already exists and I missed it? If so I'm sorry for the noise...
:)

 

Thanks,

 Guy.

 

 

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org