I’m sporadically getting this error and I’m wondering what could be the possible explanations :
You hardware configuration does not meet minimum specifications
needed to run the application. The application must close.
Error code: 6
Would you like to visit
http://nvidia.custhelp.com/cgi-bin/nvidia.cfg/php/enduser/std_adp.php?p_faqid=3008 for help?
The webpage talks about large chunks of memory but in the OpenGL doc, glTexImage2D is supposed to raise a GLError in that case, which I don’t have.
My best guess is that I was calling glTexImage2D repeatedly instead of glTexSubImage2D to update the content of my texture. But I can’t tell for sure since the problem arises sporadically.
I’m using gDEbugger but it does not know what’s going on. I tried glslDevil but it crashes whenever I try to use it.
I’m using the latest drivers ( 320.86 ).
Is it possible that the NVidia driver crashes instead of raising a glError when it cannot allocate a buffer or a texture? Btw my textures sizes are RGBA32UI(128-bits) from 512512to 20482048. And the Quadro 600 has 1Gigs on the graphic card and my pc has 24 gigs on a 64-bit windows 7 system. GPU caps tells me that I should be able to allocate 16384*16384 textures, which I can, so I don’t think that’s a out-of-mem issue.
It works well most of the time. Anyone knows any tool to help me diagnose that problem?
Thank you
Jean-Simon Brochu
EDIT
I’ve modified the Chapter 11-oit(order-independent transparency) example that comes with the opengl red book 8th edition to reallocate texture buffers when the window is resized and the problem occurs systematically upon resetting the atomic counter just after reallocating the linked list and head pointer buffers.
This is very similar to what I get in my application.
Can anyone point me in the right direction?
/* $URL$
$Rev$
$Author$
$Date$
$Id$
*/
#include "vapp.h"
#include "vutils.h"
#include "vmath.h"
#include "vbm.h"
#include "LoadShaders.h"
#include <stdio.h>
#include <string>
#define MAX_FRAMEBUFFER_WIDTH 2048
#define MAX_FRAMEBUFFER_HEIGHT 2048
namespace vtarga
{
extern unsigned char * load_targa(const char * filename, GLenum &format, int &width, int &height);
};
using namespace vmath;
#define FRUSTUM_DEPTH 2000.0f
BEGIN_APP_DECLARATION(OITDemo)
// Override functions from base class
void GenBuffers();
void ReallocateBuffers();
virtual void Initialize(const char * title);
virtual void Display(bool auto_redraw);
virtual void Finalize(void);
virtual void Reshape(int width, int height);
virtual void Keyboard(unsigned char key, int x, int y);
// Member variables
float aspect;
// Program to construct the linked list (renders the transparent objects)
GLuint list_build_program;
// Head pointer image and PBO for clearing it
GLuint head_pointer_texture;
GLuint head_pointer_clear_buffer;
// Atomic counter buffer
GLuint atomic_counter_buffer;
// Linked list buffer
GLuint linked_list_buffer;
GLuint linked_list_texture;
// Program to render the scene
GLuint render_scene_prog;
struct
{
GLint aspect;
GLint time;
GLint model_matrix;
GLint view_matrix;
GLint projection_matrix;
} render_scene_uniforms;
// Program to resolve
GLuint resolve_program;
// Full Screen Quad
GLuint quad_vbo;
GLuint quad_vao;
GLint current_width;
GLint current_height;
VBObject object;
void DrawScene(void);
void InitPrograms(void);
END_APP_DECLARATION()
DEFINE_APP(OITDemo, "Order Independent Transparency")
void OITDemo::GenBuffers()
{
int texUnitOffset = 0;
glActiveTexture(GL_TEXTURE0+texUnitOffset);
glGenTextures(1, &head_pointer_texture);
glGenBuffers(1, &head_pointer_clear_buffer);
glGenBuffers(1, &atomic_counter_buffer);
glGenBuffers(1, &linked_list_buffer);
glGenTextures(1, &linked_list_texture);
glGenVertexArrays(1, &quad_vao);
glBindVertexArray(quad_vao);
static const GLfloat quad_verts[] =
{
-1.0f, -1.0f,
1.0f, -1.0f,
-1.0f, 1.0f,
1.0f, 1.0f,
};
glGenBuffers(1, &quad_vbo);
glBindBuffer(GL_ARRAY_BUFFER, quad_vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(quad_verts), quad_verts, GL_STATIC_DRAW);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, NULL);
glEnableVertexAttribArray(0);
}
void OITDemo::Initialize(const char * title)
{
render_scene_prog = -1;
base::Initialize(title);
InitPrograms();
GenBuffers();
glClearDepth(1.0f);
object.LoadFromVBM("unit_pipe.vbm", 0, 1, 2);
}
void OITDemo::InitPrograms()
{
// Create the program for rendering the scene from the viewer's position
ShaderInfo scene_shaders[] =
{
{ GL_VERTEX_SHADER, "build_lists.vs.glsl" },
{ GL_FRAGMENT_SHADER, "build_lists.fs.glsl" },
{ GL_NONE }
};
if (render_scene_prog != -1)
glDeleteProgram(render_scene_prog);
render_scene_prog = LoadShaders(scene_shaders);
render_scene_uniforms.model_matrix = glGetUniformLocation(render_scene_prog, "model_matrix");
render_scene_uniforms.view_matrix = glGetUniformLocation(render_scene_prog, "view_matrix");
render_scene_uniforms.projection_matrix = glGetUniformLocation(render_scene_prog, "projection_matrix");
render_scene_uniforms.aspect = glGetUniformLocation(render_scene_prog, "aspect");
render_scene_uniforms.time = glGetUniformLocation(render_scene_prog, "time");
ShaderInfo resolve_shaders[] =
{
{ GL_VERTEX_SHADER, "resolve_lists.vs.glsl" },
{ GL_FRAGMENT_SHADER, "resolve_lists.fs.glsl" },
{ GL_NONE }
};
resolve_program = LoadShaders(resolve_shaders);
}
void OITDemo::ReallocateBuffers()
{
GLuint * data;
// Create head pointer texture
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
glBindTexture(GL_TEXTURE_2D, head_pointer_texture);
glBindImageTexture(0, 0, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R32UI);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R32UI, current_width, current_height, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, NULL);
glBindTexture(GL_TEXTURE_2D, 0);
//glBindImageTexture(0, head_pointer_texture, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R32UI);
glBindImageTexture(0, head_pointer_texture, 0, GL_TRUE, 0, GL_READ_WRITE, GL_R32UI);
// Create buffer for clearing the head pointer texture
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, head_pointer_clear_buffer);
glBufferData(GL_PIXEL_UNPACK_BUFFER, current_width * current_height * sizeof(GLuint), NULL, GL_STREAM_COPY);
data = (GLuint *)glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);
memset(data, 0x00, current_width * current_height * sizeof(GLuint));
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
// Create the atomic counter buffer
glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, atomic_counter_buffer);
glBufferData(GL_ATOMIC_COUNTER_BUFFER, sizeof(GLuint), NULL, GL_STREAM_COPY);
// Create the linked list storage buffer
glBindBuffer(GL_TEXTURE_BUFFER, linked_list_buffer);
glBufferData(GL_TEXTURE_BUFFER, current_width * current_height * 5 * sizeof(vec4), NULL, GL_STREAM_COPY);
glBindBuffer(GL_TEXTURE_BUFFER, 0);
// Bind it to a texture (for use as a TBO)
glBindTexture(GL_TEXTURE_BUFFER, linked_list_texture);
glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA32UI, linked_list_buffer);
glBindTexture(GL_TEXTURE_BUFFER, 0);
glBindImageTexture(1, linked_list_texture, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA32UI);
}
void OITDemo::Display(bool auto_redraw)
{
float t;
unsigned int current_time = GetTickCount();
t = (float)(current_time & 0xFFFFF) / (float)0x3FFF;
GLuint * data;
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glUseProgram(0);
vmath::mat4 projection_matrix = vmath::frustum(-1.0f, 1.0f, aspect, -aspect, 1.0f, 40.f);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glDepthMask(0);
// Reset atomic counter
glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, atomic_counter_buffer);
// DRIVER CRASH OCCURS HERE
// DRIVER CRASH OCCURS HERE
// DRIVER CRASH OCCURS HERE
data = (GLuint *)glMapBuffer(GL_ATOMIC_COUNTER_BUFFER, GL_WRITE_ONLY);
// DRIVER CRASH OCCURS HERE
// DRIVER CRASH OCCURS HERE
// DRIVER CRASH OCCURS HERE
data[0] = 0;
glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
// Clear head-pointer image
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, head_pointer_clear_buffer);
glBindTexture(GL_TEXTURE_2D, head_pointer_texture);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, current_width, current_height, GL_RED_INTEGER, GL_UNSIGNED_INT, NULL);
glBindTexture(GL_TEXTURE_2D, 0);
// Bind head-pointer image for read-write
int texUnitOffset = 0;
glBindImageTexture(texUnitOffset+0, head_pointer_texture, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R32UI);
// Bind linked-list buffer for write
glBindImageTexture(texUnitOffset+1, linked_list_texture, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA32UI);
glUseProgram(render_scene_prog);
vmath::mat4 model_matrix = vmath::translate(0.0f, 0.0f, -20.0f) *
vmath::rotate(t * 360.0f, 0.0f, 0.0f, 1.0f) *
vmath::rotate(t * 435.0f, 0.0f, 1.0f, 0.0f) *
vmath::rotate(t * 275.0f, 1.0f, 0.0f, 0.0f);
vmath::mat4 view_matrix = vmath::mat4::identity();
glUniformMatrix4fv(render_scene_uniforms.model_matrix, 1, GL_FALSE, model_matrix);
glUniformMatrix4fv(render_scene_uniforms.view_matrix, 1, GL_FALSE, view_matrix);
glUniformMatrix4fv(render_scene_uniforms.projection_matrix, 1, GL_FALSE, projection_matrix);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
object.Render(0, 8 * 8 * 8);
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glBindVertexArray(quad_vao);
// tracing a full-screen quad with the "resolve list" program
glUseProgram(resolve_program);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
// Done
base::Display();
}
void OITDemo::DrawScene(void)
{
// Draw the object
glBindVertexArray(quad_vao);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
void OITDemo::Finalize(void)
{
glUseProgram(0);
glDeleteProgram(render_scene_prog);
glDeleteBuffers(1, &quad_vbo);
glDeleteVertexArrays(1, &quad_vao);
}
void OITDemo::Reshape(int width, int height)
{
current_width = width;
current_height = height;
aspect = float(height) / float(width);
glViewport(0, 0, current_width, current_height);
ReallocateBuffers();
}
void OITDemo::Keyboard(unsigned char key, int x, int y)
{
switch (key)
{
case 'r': InitPrograms();
break;
default:
break;
}
}
In my real application I only reallocate in chunks of 512 to speed things up. But to reproduce the problem more often, I just need to do the reallocation every time the screen changes size.
It seems to be a bug with the driver, but maybe I’m doing something illegal.
Thank you,
Jean-Simon Brochu