diff options
author | Stanislav Vorobiov <s.vorobiov@samsung.com> | 2014-01-31 13:12:56 +0400 |
---|---|---|
committer | Stanislav Vorobiov <s.vorobiov@samsung.com> | 2014-01-31 13:12:56 +0400 |
commit | 473a621cd072d9b6e11670f45c6167545ca10482 (patch) | |
tree | 20e0af0c9b8d93376e3545d42c445e0e1392d909 /GLESv2 | |
parent | 9c01a4d980c16b33375cc6c29dcef6863e49e05e (diff) | |
download | emulator-yagl-473a621cd072d9b6e11670f45c6167545ca10482.tar.gz emulator-yagl-473a621cd072d9b6e11670f45c6167545ca10482.tar.bz2 emulator-yagl-473a621cd072d9b6e11670f45c6167545ca10482.zip |
YaGL: glClearBuffer and glInvalidateSubFramebuffer implemented
glInvalidateSubFramebuffer is currently a no-op
Change-Id: Ic2fd7d5cf1872f69dca466016b2196b7e13c1cfe
Diffstat (limited to 'GLESv2')
-rw-r--r-- | GLESv2/dummy.c | 30 | ||||
-rw-r--r-- | GLESv2/yagl_gles3_calls.c | 133 | ||||
-rw-r--r-- | GLESv2/yagl_gles3_validate.c | 15 | ||||
-rw-r--r-- | GLESv2/yagl_gles3_validate.h | 2 |
4 files changed, 150 insertions, 30 deletions
diff --git a/GLESv2/dummy.c b/GLESv2/dummy.c index ba60a45..16eb945 100644 --- a/GLESv2/dummy.c +++ b/GLESv2/dummy.c @@ -11,24 +11,6 @@ YAGL_API void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, exit(5); } -YAGL_API void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value) -{ - assert(0); - exit(5); -} - -YAGL_API void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) -{ - assert(0); - exit(5); -} - -YAGL_API void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) -{ - assert(0); - exit(5); -} - YAGL_API GLint glGetFragDataLocation(GLuint program, const GLchar *name) { assert(0); @@ -54,18 +36,6 @@ YAGL_API void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean tran exit(5); } -YAGL_API void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value) -{ - assert(0); - exit(5); -} - -YAGL_API void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height) -{ - assert(0); - exit(5); -} - YAGL_API void glProgramParameteri(GLuint program, GLenum pname, GLint value) { assert(0); diff --git a/GLESv2/yagl_gles3_calls.c b/GLESv2/yagl_gles3_calls.c index 4e9ae4a..11accbe 100644 --- a/GLESv2/yagl_gles3_calls.c +++ b/GLESv2/yagl_gles3_calls.c @@ -50,6 +50,15 @@ YAGL_API void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, con YAGL_LOG_FUNC_EXIT(NULL); } +YAGL_API void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height) +{ + YAGL_LOG_FUNC_ENTER_SPLIT7(glInvalidateSubFramebuffer, GLenum, GLsizei, const GLenum*, GLint, GLint, GLsizei, GLsizei, target, numAttachments, attachments, x, y, width, height); + + YAGL_GET_CTX(); + + YAGL_LOG_FUNC_EXIT(NULL); +} + YAGL_API void glBindBufferBase(GLenum target, GLuint index, GLuint buffer) { struct yagl_gles_buffer *buffer_obj = NULL; @@ -2105,3 +2114,127 @@ YAGL_API void glUniform4uiv(GLint location, GLsizei count, const GLuint *value) out: YAGL_LOG_FUNC_EXIT(NULL); } + +YAGL_API void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) +{ + YAGL_LOG_FUNC_ENTER_SPLIT3(glClearBufferiv, GLenum, GLint, const GLint*, buffer, drawbuffer, value); + + YAGL_GET_CTX(); + + if (!yagl_gles3_is_buffer_valid(buffer)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + switch (buffer) { + case GL_DEPTH: + case GL_STENCIL: + if (drawbuffer != 0) { + YAGL_SET_ERR(GL_INVALID_VALUE); + goto out; + } + yagl_host_glClearBufferiv(buffer, drawbuffer, value, 1); + break; + default: + if ((drawbuffer < 0) || + (drawbuffer >= ctx->base.base.max_draw_buffers)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + goto out; + } + yagl_host_glClearBufferiv(buffer, drawbuffer, value, 4); + break; + } + +out: + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value) +{ + YAGL_LOG_FUNC_ENTER_SPLIT3(glClearBufferuiv, GLenum, GLint, const GLuint*, buffer, drawbuffer, value); + + YAGL_GET_CTX(); + + if (!yagl_gles3_is_buffer_valid(buffer)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + switch (buffer) { + case GL_DEPTH: + case GL_STENCIL: + if (drawbuffer != 0) { + YAGL_SET_ERR(GL_INVALID_VALUE); + goto out; + } + yagl_host_glClearBufferuiv(buffer, drawbuffer, value, 1); + break; + default: + if ((drawbuffer < 0) || + (drawbuffer >= ctx->base.base.max_draw_buffers)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + goto out; + } + yagl_host_glClearBufferuiv(buffer, drawbuffer, value, 4); + break; + } + +out: + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) +{ + YAGL_LOG_FUNC_ENTER_SPLIT4(glClearBufferfi, GLenum, GLint, GLfloat, GLint, buffer, drawbuffer, depth, stencil); + + YAGL_GET_CTX(); + + if (buffer != GL_DEPTH_STENCIL) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + if (drawbuffer != 0) { + YAGL_SET_ERR(GL_INVALID_VALUE); + goto out; + } + + yagl_host_glClearBufferfi(buffer, drawbuffer, depth, stencil); + +out: + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value) +{ + YAGL_LOG_FUNC_ENTER_SPLIT3(glClearBufferfv, GLenum, GLint, const GLfloat*, buffer, drawbuffer, value); + + YAGL_GET_CTX(); + + if (!yagl_gles3_is_buffer_valid(buffer)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + switch (buffer) { + case GL_DEPTH: + case GL_STENCIL: + if (drawbuffer != 0) { + YAGL_SET_ERR(GL_INVALID_VALUE); + goto out; + } + yagl_host_glClearBufferfv(buffer, drawbuffer, value, 1); + break; + default: + if ((drawbuffer < 0) || + (drawbuffer >= ctx->base.base.max_draw_buffers)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + goto out; + } + yagl_host_glClearBufferfv(buffer, drawbuffer, value, 4); + break; + } + +out: + YAGL_LOG_FUNC_EXIT(NULL); +} diff --git a/GLESv2/yagl_gles3_validate.c b/GLESv2/yagl_gles3_validate.c index d70311a..c11cb71 100644 --- a/GLESv2/yagl_gles3_validate.c +++ b/GLESv2/yagl_gles3_validate.c @@ -40,3 +40,18 @@ int yagl_gles3_is_primitive_mode_valid(GLenum primitive_mode) return 0; } } + +int yagl_gles3_is_buffer_valid(GLenum buffer) +{ + switch (buffer) { + case GL_COLOR: + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + case GL_DEPTH: + case GL_STENCIL: + return 1; + default: + return 0; + } +} diff --git a/GLESv2/yagl_gles3_validate.h b/GLESv2/yagl_gles3_validate.h index 2527f4f..3276757 100644 --- a/GLESv2/yagl_gles3_validate.h +++ b/GLESv2/yagl_gles3_validate.h @@ -9,4 +9,6 @@ int yagl_gles3_is_transform_feedback_buffer_mode_valid(GLenum buffer_mode); int yagl_gles3_is_primitive_mode_valid(GLenum primitive_mode); +int yagl_gles3_is_buffer_valid(GLenum buffer); + #endif |