vurtun / nuklear

A single-header ANSI C gui library
13.68k stars 1.1k forks source link

uint64_t in glsl with glfw and openGL 4 don't work. #794

Open Cewein opened 5 years ago

Cewein commented 5 years ago

I am using a GTX 1050 on a laptop, lastest NVidia driver 417, and using OpenGL glad with the spec

Language/Generator: C/C++
Specification: gl
APIs: gl=4.5
Profile: core
Extensions:
    GL_ARB_bindless_texture,
    GL_ARB_gpu_shader_int64
Loader: True
Local files: False
Omit khrplatform: False
Reproducible: False

it compile but when glsl is running it fail. I have try with all the add-on for glad, still compile but no shader.

It's with Nuklear GUI where in the creation part the is this shader :

static const GLchar *fragment_shader =
        NK_SHADER_VERSION
        NK_SHADER_BINDLESS
        NK_SHADER_64BIT
        "precision mediump float;\n"
        "uniform uint64_t Texture;\n"
        "in vec2 Frag_UV;\n"
        "in vec4 Frag_Color;\n"
        "out vec4 Out_Color;\n"
        "void main(){\n"
        "   sampler2D smp = sampler2D(Texture);\n"
        "   Out_Color = Frag_Color * texture(smp, Frag_UV.st);\n"
        "}\n";

with the define :

#define NK_SHADER_VERSION "#version 450 core\n"
#define NK_SHADER_BINDLESS "#extension GL_ARB_bindless_texture : require\n"
#define NK_SHADER_64BIT "#extension GL_ARB_gpu_shader_int64 : require\n"

the error output is 'GL_ARB_gpu_shader_int64' is not supported

it don't know why ? it's been tested on a AMD same error.

Cewein commented 5 years ago

The error is more clear, there is many hardware error with the usage of uint64_t so it might be better to stick with sample2D or doing a check is it's enable on the hardware. because uint64_t work with a GTX 1070ti but not with a 1050.

lumonix commented 5 years ago

Hey @Cewein

I use a 1050 (Surface book 2) and this works ok for me if I ensure opengl is actually using the 1050 and not the integrated Intel chip.

If you use GLAD, make sure to add the following extensions:

    GL_ARB_bindless_texture,
    GL_ARB_gpu_shader_int64,

If you want to stick with regular Sample2D (non bindless) then you can just use the Opengl3 backend of Nuklear. (The point of the GL4 sample was to show bindless with Nuklear)

letarg0 commented 5 years ago

@lumonix can You help me ? Please look this https://github.com/vurtun/nuklear/issues/799 how add things to canvas/main window