support nvidia prime gpu offloading

This commit is contained in:
ktyl 2021-07-31 18:59:41 +01:00
parent 5b55adfa6e
commit 4b8f28f70e
3 changed files with 17 additions and 2 deletions

12
launch Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
executable="$1"
prime="prime-run"
if command -v $prime &> /dev/null
then
echo "launching $executable with nvidia prime offloading"
$prime $executable
else
$executable
fi

View File

@ -17,6 +17,7 @@ SHADER_INCLUDES = $(shell find $(SHADER_INCLUDE_DIR) -name *.glsl)
SHADER_TARGETS = $(SHADERS:$(SHADER_ROOT_DIR)/%.glsl=$(SHADER_TARGET_DIR)/%.compute)
TARGET = $(BIN_DIR)/oglc
LAUNCH = "./launch"
CC = gcc
LIBS = `pkg-config --static --libs glew sdl2 cglm`
@ -47,6 +48,6 @@ clean:
-rm */*.o
run: $(TARGET)
$(TARGET)
$(LAUNCH) $(TARGET)
.PHONY: run clean

View File

@ -48,9 +48,11 @@ SDL_Window* gfxInit(int width, int height)
// intiliased opengl
printf("%s\n", glGetString(GL_RENDERER));
int availableAttributes;
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &availableAttributes);
//printf("max vertex attributes %d\n", availableAttributes);
printf("max vertex attributes %d\n", availableAttributes);
return sdlWindow;
}