Re: [osg-users] Memory issues when using uniform shader variables on Intel HD graphics

2012-10-16 Thread Clemens Spencer
Hi,

thanks for your response.

The memory usage only increases if I add a uniform variable to the stateset and 
use it in the shader. I also noticed that the memory increases just once per 
osg::Program, so I can use the same program in multiple statsets, even with 
different uniform parameters.

So, for now, I'm limiting the number of different shaders I use and try to 
reuse the same program as often as possible. It's not perfect but works for me.

... 

Thank you!

Cheers,
Clemens

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50631#50631





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


Re: [osg-users] Memory issues when using uniform shader variables on Intel HD graphics

2012-10-16 Thread Bradley Baker Searles
Hi Clemens-

What version of the OSG are you using?

There was a bug fixed in OSG r13015 that would cause out of memory issues for 
our application. It still seems like the Intel driver uses more memory than the 
other drivers (AMD/nVidia), but it's workable now.

http://www.openscenegraph.org/projects/osg/changeset/13015

As an aside, the other fix I needed to do for the Intel drivers was to manually 
compute the half-vector, as gl_LightSource[].halfVector was not being provided 
with the latest drivers.

With those two fixes we're running quite nicely on the HD 4000 graphics we have 
here.

Take care,
Baker

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50633#50633





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


Re: [osg-users] Memory issues when using uniform shader variables on Intel HD graphics

2012-10-09 Thread Sergey Polischuk
Hi

What exactly makes memory usage increase? What if you attach shader without 
uniform, or without adding uniform to stateset? Try to add #version 110 
directive as first line of your shaders, does it make any difference?
I think you'd better send bugreport to intel, best if you can reproduce this 
with pure opengl.

Cheers.

09.10.2012, 09:28, Clemens Spencer clemens-m...@gmx.de:
 Hi,

 I'm trying to use shaders on an Intel HD 3000 graphics chip (Windows7 x64, 
 latest graphics driver).

 As soon as I pass a uniform variable to the shader (regardless of the type), 
 the memory of my process increases by about 400MB. Other than that, the 
 shader works fine.
 The size of the object the shader is attached to or the complexity of the 
 shader do not make a difference. Every additional shader (containing at least 
 one uniform variable) I use, increases the memory usage by another 400MB.

 The problem does not occur on another machine with some NVidia graphics card.

 Has anyone encountered a similar problem or does someone have an idea what 
 could cause a problem like this?

 Code:

 osg::Program *program = new osg::Program;
 osg::Shader *frag = new osg::Shader( osg::Shader::FRAGMENT, fragSource.str() 
 );
 osg::Shader *vert = new osg::Shader( osg::Shader::VERTEX, vertSource.str() );
 program-addShader( frag );
 program-addShader( vert );
 // add shader to stateSet
 sset-setAttributeAndModes( program, osg::StateAttribute::ON );
 // add uniform variable
 osg::Uniform *var = new osg::Uniform(MATERIAL_COLOR, 
 osg::Vec4(1.0f,1.0f,0.0f,1.0f));
 sset-addUniform(var);

 Code:

 // Vertex Shader

 void main()
 {
 gl_Position = ftransform();
 gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
 }

 // Fragment Shader

 uniform vec4 MATERIAL_COLOR;

 void main()
 {
 gl_FragColor = MATERIAL_COLOR;
 }

 By the way, I know I'm not using reference pointers :? but this shouldn't be 
 a problem in this little example.

 ...

 Thank you!

 Cheers,
 Clemens[/code]

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=50349#50349

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


[osg-users] Memory issues when using uniform shader variables on Intel HD graphics

2012-10-08 Thread Clemens Spencer
Hi,

I'm trying to use shaders on an Intel HD 3000 graphics chip (Windows7 x64, 
latest graphics driver).

As soon as I pass a uniform variable to the shader (regardless of the type), 
the memory of my process increases by about 400MB. Other than that, the shader 
works fine.
The size of the object the shader is attached to or the complexity of the 
shader do not make a difference. Every additional shader (containing at least 
one uniform variable) I use, increases the memory usage by another 400MB.

The problem does not occur on another machine with some NVidia graphics card.

Has anyone encountered a similar problem or does someone have an idea what 
could cause a problem like this?


Code:

osg::Program *program = new osg::Program;
osg::Shader *frag = new osg::Shader( osg::Shader::FRAGMENT, fragSource.str() );
osg::Shader *vert = new osg::Shader( osg::Shader::VERTEX, vertSource.str() );
program-addShader( frag );
program-addShader( vert );
// add shader to stateSet
sset-setAttributeAndModes( program, osg::StateAttribute::ON );
// add uniform variable
osg::Uniform *var = new osg::Uniform(MATERIAL_COLOR, 
osg::Vec4(1.0f,1.0f,0.0f,1.0f));
sset-addUniform(var);





Code:

// Vertex Shader

void main()
{
gl_Position = ftransform();
gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
}


// Fragment Shader

uniform vec4 MATERIAL_COLOR;

void main()
{
gl_FragColor = MATERIAL_COLOR;
}




By the way, I know I'm not using reference pointers :? but this shouldn't be a 
problem in this little example.

... 

Thank you!

Cheers,
Clemens[/code]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=50349#50349





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