Double EDIT: I have updated my renderer with a prototype to test this feature. and glMakeTextureHandleNonResident seems to not do anything.
I used the following code as a test to see how much memory i have (at the end of my Renderer::Draw() before unbinding the GLContext):
GLint currentAvailableVideoMemory = -1;
glGetIntegerv(GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, ¤tAvailableVideoMemory);
GLint totalAvailableVideoMemory = -1;
glGetIntegerv(GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &totalAvailableVideoMemory);
float percent = (float)currentAvailableVideoMemory/(float)totalAvailableVideoMemory * 100.0f;
fprintf(stdout, "VRAM (%d MB) Usage: %f%% \n", totalAvailableVideoMemory/1024, 100.0f - percent);
fflush(stdout);
which reports 95.xxx% always...
And in gDebugger i always have the same number of texture objects.
when i add 100 images. i get a couple of frames and then the renderer dies, asummingly because the textures are not actually made NonResident.
Is there something i need to be doing to ensure that non resident calls are executed? Could this be a bug in the nvidia linux driver?
EDIT: stupid shader in/out blocks didnt match... thanks compiler!
Here is the output for my program, i also checked in gDebugger and the texture loads just fine.
Vendor: 4.4.0 NVIDIA 343.36
Supported GLSL version is 4.40 NVIDIA via Cg compiler.
Aspect Ratio: 2.400000
vbo: 1
index buffer: 2
Shader Source: #version 440
layout (location = 0) in vec3 VertexPosition;
layout (location = 1) in vec2 TexCoords;
uniform mat4 worldMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
out block
{
vec2 Texcoord;
} Out;
void main()
{
mat4 mvp = projectionMatrix * viewMatrix * worldMatrix;
Out.Texcoord = vec2(TexCoords.x, 1.0-TexCoords.y);
gl_Position = mvp * vec4(VertexPosition, 1.0);
}
../shaders/simpleTexture.vert Compilation Successful
Shader Source: #version 440
//#extension GL_NV_gpu_shader5 : require // for 64-bit integer types
#extension GL_ARB_bindless_texture : require
in block
{
vec2 texCoords;
} In;
layout (bindless_sampler) uniform sampler2D textureID;
layout (location = 0) out vec4 FragColor;
void main()
{
FragColor = texture(textureID, In.texCoords);
}
../shaders/simpleTexture.frag Compilation Successful
Linking Shader Program: simpleTexture.vert
Shader Link Successful
GL_ACTIVE_UNIFORMS = 4
0) type:mat4 name:projectionMatrix location:0
1) type:sampler2D name:textureID location:1
2) type:mat4 name:viewMatrix location:2
3) type:mat4 name:worldMatrix location:3
width: 500, height 331:
Done Loading Texture...
SOIL loading error: 'Image loaded'
texture handle pointer: 4294969856
My question is, given those shaders and the fact that glGetTextureHandleARB returns non 0, should it work? (of course given the correct geometry and uvs)