Install shader files
parent
a8d49f3022
commit
c274c81fa3
12
meson.build
12
meson.build
|
@ -9,6 +9,7 @@ project(
|
|||
)
|
||||
|
||||
buildtype = get_option('buildtype')
|
||||
prefix = get_option('prefix')
|
||||
|
||||
c_args = [
|
||||
'-D_GNU_SOURCE',
|
||||
|
@ -74,6 +75,17 @@ dependencies = [
|
|||
client_protos,
|
||||
]
|
||||
|
||||
config = configuration_data()
|
||||
|
||||
config.set('PREFIX', '"' + prefix + '"')
|
||||
|
||||
configure_file(
|
||||
output: 'config.h',
|
||||
configuration: config,
|
||||
)
|
||||
|
||||
install_subdir('shaders', install_dir: 'share/wayvnc')
|
||||
|
||||
executable(
|
||||
'wayvnc',
|
||||
sources,
|
||||
|
|
30
src/render.c
30
src/render.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Andri Yngvason
|
||||
* Copyright (c) 2019 - 2020 Andri Yngvason
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -31,9 +31,12 @@
|
|||
#include "logging.h"
|
||||
#include "render.h"
|
||||
#include "dmabuf.h"
|
||||
#include "config.h"
|
||||
|
||||
#define MAYBE_UNUSED __attribute__((unused))
|
||||
|
||||
#define SHADER_PATH PREFIX "share/wayvnc/shaders"
|
||||
|
||||
enum {
|
||||
ATTR_INDEX_POS = 0,
|
||||
ATTR_INDEX_TEXTURE,
|
||||
|
@ -216,9 +219,22 @@ alloc_failure:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int gl_load_shader_from_file(GLuint* dst, const char* path, GLenum type)
|
||||
static char* read_file_at_path(const char* prefix, const char* file)
|
||||
{
|
||||
char* source = read_file(path);
|
||||
char path[256];
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s", prefix, file);
|
||||
path[sizeof(path) - 1] = '\0';
|
||||
|
||||
return read_file(path);
|
||||
}
|
||||
|
||||
static int gl_load_shader_from_file(GLuint* dst, const char* file, GLenum type)
|
||||
{
|
||||
char* source = read_file_at_path("shaders", file);
|
||||
if (!source)
|
||||
source = read_file_at_path(SHADER_PATH, file);
|
||||
|
||||
if (!source)
|
||||
return -1;
|
||||
|
||||
|
@ -381,13 +397,13 @@ int renderer_init(struct renderer* self, uint32_t width, uint32_t height)
|
|||
goto late_extension_failure;
|
||||
|
||||
if (gl_compile_shader_program(&self->dmabuf_shader_program,
|
||||
"shaders/dmabuf-vertex.glsl",
|
||||
"shaders/dmabuf-fragment.glsl") < 0)
|
||||
"dmabuf-vertex.glsl",
|
||||
"dmabuf-fragment.glsl") < 0)
|
||||
goto shader_failure;
|
||||
|
||||
if (gl_compile_shader_program(&self->texture_shader_program,
|
||||
"shaders/texture-vertex.glsl",
|
||||
"shaders/texture-fragment.glsl") < 0)
|
||||
"texture-vertex.glsl",
|
||||
"texture-fragment.glsl") < 0)
|
||||
goto shader_failure;
|
||||
|
||||
self->width = width;
|
||||
|
|
Loading…
Reference in New Issue