Thread overview | ||||||
---|---|---|---|---|---|---|
|
January 20, 2017 @nogc and opengl errors check | ||||
---|---|---|---|---|
| ||||
Hi, I am writing some code with opengl commands that I want to check in debug, so I am using the function checkgl (from glamour lib). The issue is that checkgl throw exception and can't be @nogc, I had try to use std.experimental.logger in place of exceptions, but it doesn't work either. I mostly want to be able to check the opengl errors only in debug in a way that can make the debugger breaks. On an other part as I will certainly have to log some events (even in release) I would appreciate that the logger be able to be used in @nogc functions, maybe with allocators? |
January 20, 2017 Re: @nogc and opengl errors check | ||||
---|---|---|---|---|
| ||||
Posted in reply to Xavier Bigand | On Friday, 20 January 2017 at 22:47:17 UTC, Xavier Bigand wrote:
> Hi,
>
> I am writing some code with opengl commands that I want to check in debug, so I am using the function checkgl (from glamour lib).
>
> The issue is that checkgl throw exception and can't be @nogc, I had try to use std.experimental.logger in place of exceptions, but it doesn't work either.
>
> I mostly want to be able to check the opengl errors only in debug in a way that can make the debugger breaks.
>
> On an other part as I will certainly have to log some events (even in release) I would appreciate that the logger be able to be used in @nogc functions, maybe with allocators?
If you want to break on a condition in checkgl IN DEBUG ONLY, try modifying checkgl to call a function (preferably one that is opaque to any optimisations you use in debug mode) and then set a breakpoint a that function. Then if it hits use the usual investigation tools (bt, etc...).
|
January 21, 2017 Re: @nogc and opengl errors check | ||||
---|---|---|---|---|
| ||||
Posted in reply to Xavier Bigand | On Friday, 20 January 2017 at 22:47:17 UTC, Xavier Bigand wrote: > Hi, > > I am writing some code with opengl commands that I want to check in debug, so I am using the function checkgl (from glamour lib). > > The issue is that checkgl throw exception and can't be @nogc, I had try to use std.experimental.logger in place of exceptions, but it doesn't work either. > > I mostly want to be able to check the opengl errors only in debug in a way that can make the debugger breaks. > > On an other part as I will certainly have to log some events (even in release) I would appreciate that the logger be able to be used in @nogc functions, maybe with allocators? Don't use checkgl, it just bloats you code and there's an actual debug feature in OpenGL now. It provides more information than just an enum as well. So when a function has multiple errors that use the same enum, you can actually know what the error was rather than guessing. https://www.khronos.org/opengl/wiki/Debug_Output |
January 21, 2017 Re: @nogc and opengl errors check | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jerry | Le 21/01/2017 à 13:24, Jerry a écrit :
> On Friday, 20 January 2017 at 22:47:17 UTC, Xavier Bigand wrote:
>> Hi,
>>
>> I am writing some code with opengl commands that I want to check in
>> debug, so I am using the function checkgl (from glamour lib).
>>
>> The issue is that checkgl throw exception and can't be @nogc, I had
>> try to use std.experimental.logger in place of exceptions, but it
>> doesn't work either.
>>
>> I mostly want to be able to check the opengl errors only in debug in a
>> way that can make the debugger breaks.
>>
>> On an other part as I will certainly have to log some events (even in
>> release) I would appreciate that the logger be able to be used in
>> @nogc functions, maybe with allocators?
>
> Don't use checkgl, it just bloats you code and there's an actual debug
> feature in OpenGL now. It provides more information than just an enum as
> well. So when a function has multiple errors that use the same enum, you
> can actually know what the error was rather than guessing.
>
> https://www.khronos.org/opengl/wiki/Debug_Output
I had never use these API as it is doesn't work on older devices, but I'll may try to use it when available instead of glGetError.
Thank you to remember me these API.
|
Copyright © 1999-2021 by the D Language Foundation