[osg-users] OSG and NVX_gpu_memory_info
Garth D
garthy_gso at entropicsoftware.com
Wed Sep 30 04:24:59 PDT 2015
Hi Robert,
On 30/09/15 19:50, Robert Osfield wrote:> HI Garth,
> Sorry for the typo, the setRealizeOperation is what I was referring to.
Not a problem, thanks for the clarification.
> If you want to check periodically then just use a Camera::DrawCallback
> attached to the main camera attached to the GraphicsContext/Window of
> interest. This will be called every frame, but within this callback you
> could have your own check to see if the GL calls are required for that
> frame.
Thanks. This was one of the configurations I had tried (with
setInitialDrawCallback() and setFinalDrawCallback()), and the one I had
the best hopes for. Unfortunately the calls failed. I'm not certain, but
I seem to remember that other GL calls worked fine in this setup, and
that it was only the calls related to NVX_gpu_memory_info that were
failing. Perhaps this is all an oddity relating to NVX_gpu_memory_info
specifically?
I also want to try this the setup you describe here *exactly*, in case
this changes the result.
At this point I think I'm going to have to put something minimalistic
together and have an further experiment with it. I'll post a follow-up
when I've got some results.
Cheers,
Garth
> On 30 September 2015 at 10:56, Garth D <garthy_gso at entropicsoftware.com>
> wrote:
>> Thanks for having a look at things and for the suggestion.
>>
>> On 30/09/15 17:35, Robert Osfield wrote:> HI Garth,
>>> I'd use a RealizerOperation. Have a look at the osgvolume example
to an
>>> example of using a RealizerOperation to get information from the
graphics
>>> context.
>>
>> I was unfortunately unable to solve the problem. Here is what I tried:
>>
>> I checked the osgvolume.cpp source for 3.2.1 and 3.4.0, but did not
find a
>> RealizerOperation in either.
>>
>> I did notice that osgvolume does also use
viewer.setRealizeOperation() for
>> TestSupportOperation, defined earlier. Is this what you are
referring to?
>> Assuming yes: This is the way I was able to successfully query the
>> information once only at the start of the program. Unfortunately I
need to
>> query the information periodically, ie. over the course of the program,
>> rather than just at initialisation. Unless I am mistaken, the target of
>> setRealizeOperation is only called the one time, on viewer
realization. Is
>> this right? If so: Is there a corresponding call that I can use to
attach
>> an osg::Operation or similar to in order to make the required calls
>> periodically? If not: Is there a way to indicate that the operation
should
>> be repeatedly called?
>>
>> Or is there another part of osgvolume.cpp that I should be looking
at? The
>> only glGet* call in the file is in TestSupportOperation, which is
set using
>> setRealizeOperation(), so I think I am looking in the right place?
>>
>> I'll continue to experiment. Thanks again for the suggestion. Is there
>> anything else I should try?
>>
>>> On 30 September 2015 at 03:49, Garth D
<garthy_gso at entropicsoftware.com>
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I was wondering if anyone has been successful in using the
>>>> NVX_gpu_memory_info extension with OpenSceneGraph, and the best
place to
>>>> call glGetIntegerv to get the associated values.
>>>>
>>>> Details on the extension here:
>>>> https://www.opengl.org/registry/specs/NVX/gpu_memory_info.txt
>>>>
>>>> I'm using Linux, OSG 3.2.1, and a card that supports the
>>>> NVX_gpu_memory_info extension.
>>>>
>>>> I have tried querying the current and total memory using
>>>> GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX and
>>>> GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, and in each case but
one,
>> the
>>>> values reported back are zero.
>>>>
>>>> The only success I have had thus far has been querying the values
via an
>>>> osg::Operation set with ViewerBase::setRealizeOperation() on my viewer
>>>> (osg::Viewer). The values returned appear to be correct. This
allows me
>> to
>>>> get the correct values *once* at the start of the program.
>> Unfortunately I
>>>> need to query them periodically, and I have been unable to do this.
>>>>
>>>> So far, I have tried hooking the calls into:
>>>> - An osg::Camera::DrawHandler, set via
>>>> osg::Camera::setInitialDrawCallback().
>>>> - An osg::Node::NodeHandler, hooked into the root node via
>>>> osg::Node::setUpdateCallback.
>>>> - An osg::Drawable::DrawCallback, hooked into a dummy chain off
the root
>>>> of: osg::Node -> osg::Geode -> osg::Geometry (osg::Drawable), via
>>>> osg::Drawable::setDrawCallback.
>>>> - An osg::Drawable::CullCallback , hooked into a dummy chain off the
>> root
>>>> of: osg::Node -> osg::Geode -> osg::Geometry (osg::Drawable), via
>>>> osg::Drawable::setCullCallback.
>>>> - An osg::Camera::DrawHandler, set via
>>>> osg::Camera::setFinalDrawCallback(). Only partly-tested due to a
>>>> race-condition that occurs in my code, but appears to fail.
>>>>
>>>> I have experimented with osg::GraphicsContext::makeCurrent() with
each.
>>>>
>>>> Can anyone suggest a better place to hook these calls into? Or
>>>> alternatively confirm that they have the extension working with one of
>> the
>>>> above, so I can change or experiment with my existing setup to try to
>> make
>>>> it work?
More information about the osg-users
mailing list