2018-04-12 16:08:48 +02:00
|
|
|
/*
|
|
|
|
* This software is licensed under the terms of the MIT-License
|
|
|
|
* See COPYING for further information.
|
|
|
|
* ---
|
|
|
|
* Copyright (c) 2011-2018, Lukas Weber <laochailan@web.de>.
|
|
|
|
* Copyright (c) 2012-2018, Andrei Alexeyev <akari@alienslab.net>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "taisei.h"
|
|
|
|
|
|
|
|
#include "util.h"
|
|
|
|
#include "hashtable.h"
|
|
|
|
#include "../api.h"
|
|
|
|
#include "opengl.h"
|
|
|
|
#include "resource/resource.h"
|
|
|
|
#include "resource/shader_program.h"
|
|
|
|
|
|
|
|
struct ShaderProgram {
|
|
|
|
GLuint gl_handle;
|
2018-06-29 23:36:51 +02:00
|
|
|
ht_str2ptr_t uniforms;
|
2018-04-12 16:08:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Uniform {
|
|
|
|
ShaderProgram *prog;
|
|
|
|
uint location;
|
|
|
|
UniformType type;
|
2018-08-24 13:01:50 +02:00
|
|
|
size_t array_size;
|
|
|
|
size_t buffer_size;
|
2018-04-12 16:08:48 +02:00
|
|
|
|
|
|
|
struct {
|
2018-08-24 13:01:50 +02:00
|
|
|
void *pending;
|
|
|
|
void *commited;
|
2018-04-12 16:08:48 +02:00
|
|
|
size_t update_size;
|
|
|
|
} cache;
|
|
|
|
};
|
|
|
|
|
|
|
|
void gl33_sync_uniforms(ShaderProgram *prog);
|
|
|
|
|
|
|
|
Uniform* gl33_shader_uniform(ShaderProgram *prog, const char *uniform_name);
|
|
|
|
UniformType gl33_uniform_type(Uniform *uniform);
|
|
|
|
void gl33_uniform(Uniform *uniform, uint count, const void *data);
|
|
|
|
|
|
|
|
extern ResourceHandler gl33_shader_program_res_handler;
|