Skip to content

Instantly share code, notes, and snippets.

@nothings
Last active February 28, 2022 18:07
Show Gist options
  • Save nothings/e17f13713307f3ff149ac4cfe6da1f28 to your computer and use it in GitHub Desktop.
Save nothings/e17f13713307f3ff149ac4cfe6da1f28 to your computer and use it in GitHub Desktop.
// This appears to hang but actually just takes 50 seconds to link in glLinkProgram 32-bit
// if not in shader cache (on an old Skylake i7-6700K @ 4.00 Ghz) targeting a 980Ti
// on 32-bit Win7/8 drivers 473.04 (and an unknown previous driver version)
// Happens with compatibility or core profile, debug or non-debug profile
#version 430
layout(local_size_x = 64) in;
layout(std430, binding=4) buffer obj_format
{
uint shape[4096][16][16]; // slow
//uint shape[4096][16*16]; // not slow
//uint shape[4096*16*16]; // not slow
};
void main()
{
}
// This causes an error in OpenGL glLinkProgram targeting a 980Ti
// on 32-bit Win7/8 drivers 473.04 (and an unknown previous driver version).
// Happens with compatibility or core profile, debug or non-debug profile
#version 430
layout(local_size_x = 64) in;
// these variations both cause a link error in glLinkProgram 32-bit
// most consistent errors are listed below, but sometimes each gives
// the opposite error when making small changes
#if 0
// Link error:
// Compute info
// ------------
// -ogles
layout(std430, binding=5) buffer obj_desc
{
struct {
uint obj[32][2];
} objmap[512][512];
};
#else
// Link error:
// Compute info
// ------------
// (0) : fatal error C9999: out of memory - internal malloc failed
layout(std430, binding=5) buffer obj_desc
{
uint obj[512][512][32][2];
};
#endif
void main()
{
}
// for reference, here's the driver program, but most of its execution is hidden in the platform library;
// see compiled executables in http://nothings.org/remote/nv_compute_multidim.zip
#define STB_PLATFORM_IMPLEMENTATION
#define STBP_MATH_TYPES
#include "stb_platform.h"
#define STB_DEFINE
#include "stb.h"
typedef unsigned int uint;
void stbp_main(int argc, char **argv)
{
stbp_api api;
api.window.title = "test";
api.window.size = STBP_POINT(800,600);
api.opengl.version = STBP_GL_VERSION(4,3);
api.opengl.compatibility = 0;//1;
api.opengl.debug_context = 0;//2;
api.opengl.disable_vsync = 1;
api.sound.disable = 1;
stbp_init(&api);
{
GLuint generate_program;
char error[512];
char *compute_shader = stb_file("test2.glsl", NULL);
GLuint generate_shader = stbp_compile_shader(GL_COMPUTE_SHADER, &compute_shader, 1, error, sizeof(error));
if (generate_shader == 0)
stbp_fatal("%s", error);
generate_program = stbp_link_program(generate_shader, 0, NULL, 0, error, sizeof(error));
if (generate_program == 0)
stbp_fatal("%s", error);
glDeleteShader(generate_shader);
}
stbp_fatal("success");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment