Skip to content

Invalid statement when no extension is loaded in Nim. #136

@krux02

Description

@krux02

When no extension is selected for loading glad generates an emtpy var section, which is illegal in Nim.
findExtensionsGL needs a discard statement when it is empty.

# Extensions
var
  # without a single entry this is illegal

#[...]#

proc findExtensionsGL() =
  discard

Alternatively if you do not want to treat no extensions as a special case, you can give each variable it's own var section and add a doc comment to findExtensionsGL.

var GLAD_GL_ARB_bindless_texture*: bool
var GL_UNSIGNED_INT64_ARB*: GLenum = GLenum(0x140F)
var GLAD_GL_ARB_direct_state_access*: bool
var GL_TEXTURE_TARGET*: GLenum = GLenum(0x1006)
var GL_QUERY_TARGET*: GLenum = GLenum(0x82EA)
var GL_TEXTURE_BINDING_CUBE_MAP_ARRAY*: GLenum = GLenum(0x900A)

#[...]#

proc findExtensionsGL() =
  ## Some doc comment to make this valid even when it is empty. But it is probably 
  ## better if you put a real meaningful doc comment here.
  GLAD_GL_ARB_bindless_texture = hasExt("GL_ARB_bindless_texture")
  GLAD_GL_ARB_direct_state_access = hasExt("GL_ARB_direct_state_access")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions