gpu,gpu/internal,internal/gl: replace BlitFramebuffer with CopyTexture

OpenGL ES 2.0 doesn't support glBlitFramebuffer, but does support
glCopyTexSubImage2D. Fortunately, we don't need the extra features of
glBlitFramebuffer anyway.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-08-21 11:11:38 +02:00
parent 44adf01768
commit c9970cb8e3
8 changed files with 32 additions and 20 deletions
+10
View File
@@ -51,6 +51,7 @@ typedef struct {
void (*glClearColor)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
void (*glClearDepthf)(GLfloat d);
void (*glCompileShader)(GLuint shader);
void (*glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
GLuint (*glCreateProgram)(void);
GLuint (*glCreateShader)(GLenum type);
void (*glDeleteBuffers)(GLsizei n, const GLuint *buffers);
@@ -199,6 +200,10 @@ static void glCompileShader(glFunctions *f, GLuint shader) {
f->glCompileShader(shader);
}
static void glCopyTexSubImage2D(glFunctions *f, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) {
f->glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}
static GLuint glCreateProgram(glFunctions *f) {
return f->glCreateProgram();
}
@@ -606,6 +611,7 @@ func (f *Functions) load(forceES bool) error {
f.f.glClearColor = must("glClearColor")
f.f.glClearDepthf = must("glClearDepthf")
f.f.glCompileShader = must("glCompileShader")
f.f.glCopyTexSubImage2D = must("glCopyTexSubImage2D")
f.f.glCreateProgram = must("glCreateProgram")
f.f.glCreateShader = must("glCreateShader")
f.f.glDeleteBuffers = must("glDeleteBuffers")
@@ -808,6 +814,10 @@ func (f *Functions) CompileShader(s Shader) {
C.glCompileShader(&f.f, C.GLuint(s.V))
}
func (f *Functions) CopyTexSubImage2D(target Enum, level, xoffset, yoffset, x, y, width, height int) {
C.glCopyTexSubImage2D(&f.f, C.GLenum(target), C.GLint(level), C.GLint(xoffset), C.GLint(yoffset), C.GLint(x), C.GLint(y), C.GLsizei(width), C.GLsizei(height))
}
func (f *Functions) CreateBuffer() Buffer {
C.glGenBuffers(&f.f, 1, &f.uints[0])
return Buffer{uint(f.uints[0])}