Hello,
I was looking into compute shaders and Opengl 4.3 and I made a small project to try stuff out.
To my surprise I started experiencing a 100% crash on my home video card (6970 HD, a card that should have OpenGL 4.3 support).
On other (newer from the HD 7xxx series) cards everything works fine. On NVIDIA cards ( the one I tested ) I had no issues with this.
It is my first attempt at learning OpenGL so I might do something really wrong, but I can't figure out what .
Crash always happens here in glDispatchCompute ( at the first call ). I have gl debug callback set and I get no errors at all.
Here is the code near the crash:
//Bind the position and speed buffers |
glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 0, m_glPositionBuffer, 0, m_ParticleCount*sizeof(ParticlePos));
glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 1, m_glVelocityBuffer, 0, m_ParticleCount*sizeof(ParticleVelocity));
//Setup and execute the compute shader |
const int workgroups_count = 1024/32;
glDispatchCompute(workgroups_count, workgroups_count, 2);
glMemoryBarrier(GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT); |
Buffers are allocated with the usual glGenBuffers, glBind, glBufferData flow.
This always crashes in if I read AND write to the shader buffer objects in my compute shader. The callstack for this crash is:
atioglxx.dll!53492fce() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for atioglxx.dll]
atioglxx.dll!53492755() Unknown
atioglxx.dll!5348913e() Unknown
atioglxx.dll!52958bd1() Unknown
atioglxx.dll!52cf44e6() Unknown
atioglxx.dll!53035053() Unknown
Particles_d.exe!ParticleSystem::Update(float dt) Line 127 C++
Particles_d.exe!Update(float dt) Line 161 C++
Particles_d.exe!SDL_main(int argc, char * * argv) Line 238 C++
Particles_d.exe!main(int argc, char * * argv) Line 140 C
Particles_d.exe!__tmainCRTStartup() Line 536 C
Particles_d.exe!mainCRTStartup() Line 377 C
The exception that I get is :
First-chance exception at 0x53492FCE (atioglxx.dll) in Particles_d.exe: 0xC0000005: Access violation reading location 0x00000020.
Unhandled exception at 0x53492FCE (atioglxx.dll) in Particles_d.exe: 0xC0000005: Access violation reading location 0x00000020.
If I remove the 2 lines from the compute shader (ComputeShader.glsl) that write to the buffers, everything works fine. I can still read from them ok, without any problem.
These are the lines that should write back to the shader storage object buffers: ( by removing them everything will be ok ).
//Save the new possitions and velocities |
Pos[index] = particlePos;
Velocity[index] = newParticleVelocity; |
The project is on github if anybody wants to take a closer look at it : https://github.com/AlexEne/GL_Particles
Thank you,
Alexandru Ene
More info from Catalyst Control center:
Driver Packaging Version 13.251-131206a-166389C-ATI
Catalyst Version 13.12
Provider Advanced Micro Devices, Inc.
2D Driver Version 8.01.01.1360
2D Driver File Path /REGISTRY/MACHINE/SYSTEM/ControlSet001/Control/CLASS/{4D36E968-E325-11CE-BFC1-08002BE10318}/0000
Direct3D Version 9.14.10.01001
OpenGL Version 6.14.10.12618
AMD Catalyst Control Center Version 2013.1206.1603.28764