19 "uniform vec2 fullscreen;\n"
22 "out vec2 texCoord_interp;\n"
24 "vec2 normalize_coordinates()\n"
26 " return (vec2(2.0) * (pos / fullscreen)) - vec2(1.0);\n"
31 " gl_Position = vec4(normalize_coordinates(), 0.0, 1.0);\n"
32 " texCoord_interp = texCoord;\n"
37 "uniform sampler2D image_texture;\n"
38 "in vec2 texCoord_interp;\n"
39 "out vec4 fragColor;\n"
43 " vec4 rgba = texture(image_texture, texCoord_interp);\n"
45 " fragColor = pow(rgba, vec4(0.45, 0.45, 0.45, 1.0));\n"
50 LOG(ERROR) <<
"Shader: " <<
task <<
" error:";
51 LOG(ERROR) <<
"===== shader string ====";
53 stringstream stream(code);
57 while (getline(stream, partial,
'\n')) {
59 LOG(ERROR) <<
" " << line <<
" " << partial;
62 LOG(ERROR) << line <<
" " << partial;
76 const GLuint
program = glCreateProgram();
78 for (
int i = 0; i < 2; i++) {
79 const GLuint shader = glCreateShader(
shaders[i].
type);
81 string source_str =
shaders[i].source;
82 const char *c_str = source_str.c_str();
84 glShaderSource(shader, 1, &c_str,
NULL);
85 glCompileShader(shader);
88 glGetShaderiv(shader, GL_COMPILE_STATUS, &compile_status);
90 if (!compile_status) {
98 glAttachShader(
program, shader);
102 glBindFragDataLocation(
program, 0,
"fragColor");
108 glGetProgramiv(
program, GL_LINK_STATUS, &link_status);
178 LOG(ERROR) <<
"Shader doesn't contain the 'image_texture' uniform.";
185 LOG(ERROR) <<
"Shader doesn't contain the 'fullscreen' uniform.";
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
static int compile_shader_program(void)
static CCL_NAMESPACE_BEGIN const char * VERTEX_SHADER
static const char * FRAGMENT_SHADER
static void shader_print_errors(const char *task, const char *log, const char *code)
uint get_shader_program()
void create_shader_if_needed()
int image_texture_location_
int get_position_attrib_location()
static constexpr const char * position_attribute_name
int position_attribute_location_
bool shader_compile_attempted_
void bind(int width, int height)
int get_tex_coord_attrib_location()
int tex_coord_attribute_location_
static constexpr const char * tex_coord_attribute_name
#define CCL_NAMESPACE_END
ccl_device_inline float3 log(float3 v)
struct blender::compositor::@179::@181 task
T length(const vec_base< T, Size > &a)