assert(type == GL_FLOAT || type == GL_HALF_FLOAT || type == GL_UNSIGNED_SHORT || type == GL_UNSIGNED_BYTE);
register_int("output_linear_gamma", &output_linear_gamma);
register_int("needs_mipmaps", &needs_mipmaps);
+ register_uniform_sampler2d("tex", &uniform_tex);
// Some types are not supported in all GL versions (e.g. GLES),
// and will corrected into the right format in the shader.
}
} else if (output_linear_gamma) {
assert(type == GL_UNSIGNED_BYTE);
- internal_format = GL_SRGB8_ALPHA8;
+ if (pixel_format == FORMAT_RGB) {
+ internal_format = GL_SRGB8;
+ } else if (pixel_format == FORMAT_RGBA_POSTMULTIPLIED_ALPHA) {
+ internal_format = GL_SRGB8_ALPHA8;
+ } else {
+ assert(false);
+ }
} else {
assert(type == GL_UNSIGNED_BYTE);
if (pixel_format == FORMAT_R) {
}
// Bind it to a sampler.
- set_uniform_int(glsl_program_num, prefix, "tex", *sampler_num);
+ uniform_tex = *sampler_num;
++*sampler_num;
}