Merge pull request #182 from toolness/cfg-debug-assertions
Define ck() based on cfg(debug_assertions)
This commit is contained in:
commit
412d35ae57
|
@ -901,17 +901,28 @@ impl GLVersion {
|
||||||
|
|
||||||
// Error checking
|
// Error checking
|
||||||
|
|
||||||
#[cfg(debug)]
|
#[cfg(debug_assertions)]
|
||||||
fn ck() {
|
fn ck() {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
// Note that ideally we should be calling gl::GetError() in a loop until it
|
||||||
|
// returns gl::NO_ERROR, but for now we'll just report the first one we find.
|
||||||
let err = gl::GetError();
|
let err = gl::GetError();
|
||||||
if err != 0 {
|
if err != gl::NO_ERROR {
|
||||||
panic!("GL error: 0x{:x}", err);
|
panic!("GL error: 0x{:x} ({})", err, match err {
|
||||||
|
gl::INVALID_ENUM => "INVALID_ENUM",
|
||||||
|
gl::INVALID_VALUE => "INVALID_VALUE",
|
||||||
|
gl::INVALID_OPERATION => "INVALID_OPERATION",
|
||||||
|
gl::INVALID_FRAMEBUFFER_OPERATION => "INVALID_FRAMEBUFFER_OPERATION",
|
||||||
|
gl::OUT_OF_MEMORY => "OUT_OF_MEMORY",
|
||||||
|
gl::STACK_UNDERFLOW => "STACK_UNDERFLOW",
|
||||||
|
gl::STACK_OVERFLOW => "STACK_OVERFLOW",
|
||||||
|
_ => "Unknown"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(debug))]
|
#[cfg(not(debug_assertions))]
|
||||||
fn ck() {}
|
fn ck() {}
|
||||||
|
|
||||||
// Shader preprocessing
|
// Shader preprocessing
|
||||||
|
|
Loading…
Reference in New Issue