summaryrefslogtreecommitdiff
path: root/GLESv2
diff options
context:
space:
mode:
authorStanislav Vorobiov <s.vorobiov@samsung.com>2014-02-19 18:01:14 +0400
committerStanislav Vorobiov <s.vorobiov@samsung.com>2014-02-19 18:41:35 +0400
commitb27fd4d02f080fff3673b9fd2b6ee472df6efc65 (patch)
treecde4fc4a81dd60f839efc54510b921b0e2050a2d /GLESv2
parentb19aee1598955b824d56b18d38958a5022f7fb37 (diff)
downloademulator-yagl-b27fd4d02f080fff3673b9fd2b6ee472df6efc65.tar.gz
emulator-yagl-b27fd4d02f080fff3673b9fd2b6ee472df6efc65.tar.bz2
emulator-yagl-b27fd4d02f080fff3673b9fd2b6ee472df6efc65.zip
YaGL: Fix transform feedback checks
Some more transform feedback checks, we now pass khronos CTS 3.0 transform_feedback and transform_feedback2 tests (except for overflow tests, these will be fixed later) Change-Id: Ia3af2deac6e0cb75d33b3a35382e9119a5841b65
Diffstat (limited to 'GLESv2')
-rw-r--r--GLESv2/yagl_gles2_calls.c8
-rw-r--r--GLESv2/yagl_gles2_context.c14
-rw-r--r--GLESv2/yagl_gles2_context.h6
-rw-r--r--GLESv2/yagl_gles2_program.c7
-rw-r--r--GLESv2/yagl_gles3_calls.c9
-rw-r--r--GLESv2/yagl_gles3_context.c79
6 files changed, 111 insertions, 12 deletions
diff --git a/GLESv2/yagl_gles2_calls.c b/GLESv2/yagl_gles2_calls.c
index 143976e..6341fec 100644
--- a/GLESv2/yagl_gles2_calls.c
+++ b/GLESv2/yagl_gles2_calls.c
@@ -1162,6 +1162,10 @@ YAGL_API void glLinkProgram(GLuint program)
goto out;
}
+ if (!ctx->pre_link_program(ctx, program_obj)) {
+ goto out;
+ }
+
yagl_gles2_program_link(program_obj);
out:
@@ -1918,6 +1922,10 @@ YAGL_API void glUseProgram(GLuint program)
}
}
+ if (!ctx->pre_use_program(ctx, program_obj)) {
+ goto out;
+ }
+
yagl_gles2_context_use_program(ctx, program_obj);
out:
diff --git a/GLESv2/yagl_gles2_context.c b/GLESv2/yagl_gles2_context.c
index ef4215a..ee93700 100644
--- a/GLESv2/yagl_gles2_context.c
+++ b/GLESv2/yagl_gles2_context.c
@@ -192,6 +192,18 @@ static int yagl_gles2_context_acquire_binded_buffer(struct yagl_gles_context *ct
return 0;
}
+static int yagl_gles2_context_pre_use_program(struct yagl_gles2_context *ctx,
+ struct yagl_gles2_program *program)
+{
+ return 1;
+}
+
+static int yagl_gles2_context_pre_link_program(struct yagl_gles2_context *ctx,
+ struct yagl_gles2_program *program)
+{
+ return 1;
+}
+
void yagl_gles2_context_init(struct yagl_gles2_context *ctx,
yagl_client_api client_api,
struct yagl_sharegroup *sg)
@@ -1331,6 +1343,8 @@ struct yagl_client_context *yagl_gles2_context_create(struct yagl_sharegroup *sg
gles2_ctx->base.validate_renderbuffer_format = &yagl_gles2_context_validate_renderbuffer_format;
gles2_ctx->shader_patch = &yagl_gles2_context_shader_patch;
gles2_ctx->get_programiv = &yagl_gles2_context_get_programiv;
+ gles2_ctx->pre_use_program = &yagl_gles2_context_pre_use_program;
+ gles2_ctx->pre_link_program = &yagl_gles2_context_pre_link_program;
YAGL_LOG_FUNC_EXIT("%p", gles2_ctx);
diff --git a/GLESv2/yagl_gles2_context.h b/GLESv2/yagl_gles2_context.h
index 45b2ac9..466d260 100644
--- a/GLESv2/yagl_gles2_context.h
+++ b/GLESv2/yagl_gles2_context.h
@@ -19,6 +19,12 @@ struct yagl_gles2_context
GLenum /*pname*/,
GLint */*params*/);
+ int (*pre_use_program)(struct yagl_gles2_context */*ctx*/,
+ struct yagl_gles2_program */*program*/);
+
+ int (*pre_link_program)(struct yagl_gles2_context */*ctx*/,
+ struct yagl_gles2_program */*program*/);
+
/*
* From 'base.base.sg'.
*/
diff --git a/GLESv2/yagl_gles2_program.c b/GLESv2/yagl_gles2_program.c
index 47500d3..7f938aa 100644
--- a/GLESv2/yagl_gles2_program.c
+++ b/GLESv2/yagl_gles2_program.c
@@ -12,6 +12,11 @@
#include <stdlib.h>
#include <pthread.h>
+/*
+ * We don't want to include GLES3/gl3.h here
+ */
+#define GL_INTERLEAVED_ATTRIBS 0x8C8C
+
struct yagl_gles2_location_v
{
GLchar *name;
@@ -222,6 +227,8 @@ struct yagl_gles2_program *yagl_gles2_program_create(int gen_locations)
yagl_list_init(&program->attrib_locations);
yagl_list_init(&program->frag_data_locations);
+ program->transform_feedback_info.buffer_mode = GL_INTERLEAVED_ATTRIBS;
+
yagl_host_glCreateProgram(program->global_name);
return program;
diff --git a/GLESv2/yagl_gles3_calls.c b/GLESv2/yagl_gles3_calls.c
index 7e7d9c7..5c876a5 100644
--- a/GLESv2/yagl_gles3_calls.c
+++ b/GLESv2/yagl_gles3_calls.c
@@ -602,6 +602,15 @@ YAGL_API void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
}
if (ids) {
+ if (ctx->tfo->active) {
+ for (i = 0; i < n; ++i) {
+ if (ids[i] && (ctx->tfo->base.local_name == ids[i])) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ }
+ }
+
for (i = 0; i < n; ++i) {
yagl_namespace_remove(&ctx->transform_feedbacks, ids[i]);
}
diff --git a/GLESv2/yagl_gles3_context.c b/GLESv2/yagl_gles3_context.c
index 2ee2bb4..9d20a5e 100644
--- a/GLESv2/yagl_gles3_context.c
+++ b/GLESv2/yagl_gles3_context.c
@@ -339,22 +339,31 @@ static int yagl_gles3_context_get_integerv(struct yagl_gles_context *ctx,
return 1;
}
-static void yagl_gles3_context_draw_arrays(struct yagl_gles_context *ctx,
+static void yagl_gles3_context_draw_arrays(struct yagl_gles_context *gles_ctx,
GLenum mode,
GLint first,
GLsizei count,
GLsizei primcount)
{
- struct yagl_gles3_context *gles3_ctx = (struct yagl_gles3_context*)ctx;
+ struct yagl_gles3_context *ctx = (struct yagl_gles3_context*)gles_ctx;
+
+ YAGL_LOG_FUNC_SET(yagl_gles3_context_draw_arrays);
+
+ if (ctx->tfo->active &&
+ !ctx->tfo->paused &&
+ (mode != ctx->tf_primitive_mode)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
- yagl_gles3_context_pre_draw(gles3_ctx);
+ yagl_gles3_context_pre_draw(ctx);
- yagl_gles2_context_draw_arrays(ctx, mode, first, count, primcount);
+ yagl_gles2_context_draw_arrays(gles_ctx, mode, first, count, primcount);
- yagl_gles3_context_post_draw(gles3_ctx);
+ yagl_gles3_context_post_draw(ctx);
}
-static void yagl_gles3_context_draw_elements(struct yagl_gles_context *ctx,
+static void yagl_gles3_context_draw_elements(struct yagl_gles_context *gles_ctx,
GLenum mode,
GLsizei count,
GLenum type,
@@ -363,11 +372,18 @@ static void yagl_gles3_context_draw_elements(struct yagl_gles_context *ctx,
GLsizei primcount,
uint32_t max_idx)
{
- struct yagl_gles3_context *gles3_ctx = (struct yagl_gles3_context*)ctx;
+ struct yagl_gles3_context *ctx = (struct yagl_gles3_context*)gles_ctx;
- yagl_gles3_context_pre_draw(gles3_ctx);
+ YAGL_LOG_FUNC_SET(yagl_gles3_context_draw_elements);
- yagl_gles2_context_draw_elements(ctx,
+ if (ctx->tfo->active && !ctx->tfo->paused) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ yagl_gles3_context_pre_draw(ctx);
+
+ yagl_gles2_context_draw_elements(gles_ctx,
mode,
count,
type,
@@ -376,7 +392,7 @@ static void yagl_gles3_context_draw_elements(struct yagl_gles_context *ctx,
primcount,
max_idx);
- yagl_gles3_context_post_draw(gles3_ctx);
+ yagl_gles3_context_post_draw(ctx);
}
static int yagl_gles3_context_bind_buffer(struct yagl_gles_context *ctx,
@@ -1302,6 +1318,36 @@ static int yagl_gles3_context_get_programiv(struct yagl_gles2_context *ctx,
return 1;
}
+static int yagl_gles3_context_pre_use_program(struct yagl_gles2_context *gles_ctx,
+ struct yagl_gles2_program *program)
+{
+ struct yagl_gles3_context *ctx = (struct yagl_gles3_context*)gles_ctx;
+
+ YAGL_LOG_FUNC_SET(glUseProgram);
+
+ if (ctx->tfo->active && !ctx->tfo->paused) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+static int yagl_gles3_context_pre_link_program(struct yagl_gles2_context *gles_ctx,
+ struct yagl_gles2_program *program)
+{
+ struct yagl_gles3_context *ctx = (struct yagl_gles3_context*)gles_ctx;
+
+ YAGL_LOG_FUNC_SET(glLinkProgram);
+
+ if (ctx->tfo->active) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
struct yagl_client_context *yagl_gles3_context_create(struct yagl_sharegroup *sg)
{
struct yagl_gles3_context *gles3_ctx;
@@ -1340,6 +1386,8 @@ struct yagl_client_context *yagl_gles3_context_create(struct yagl_sharegroup *sg
gles3_ctx->base.base.validate_renderbuffer_format = &yagl_gles3_context_validate_renderbuffer_format;
gles3_ctx->base.shader_patch = &yagl_gles3_context_shader_patch;
gles3_ctx->base.get_programiv = &yagl_gles3_context_get_programiv;
+ gles3_ctx->base.pre_use_program = &yagl_gles3_context_pre_use_program;
+ gles3_ctx->base.pre_link_program = &yagl_gles3_context_pre_link_program;
YAGL_LOG_FUNC_EXIT("%p", gles3_ctx);
@@ -1690,7 +1738,7 @@ int yagl_gles3_context_get_integerv_indexed(struct yagl_gles3_context *ctx,
}
if (ctx->tfo->buffer_bindings[index].entire) {
- *params = ctx->tfo->buffer_bindings[index].buffer->size;
+ *params = 0;
} else {
*params = ctx->tfo->buffer_bindings[index].size;
}
@@ -1718,7 +1766,7 @@ int yagl_gles3_context_get_integerv_indexed(struct yagl_gles3_context *ctx,
}
if (ctx->uniform_buffer_bindings[index].entire) {
- *params = ctx->uniform_buffer_bindings[index].buffer->size;
+ *params = 0;
} else {
*params = ctx->uniform_buffer_bindings[index].size;
}
@@ -1772,6 +1820,13 @@ void yagl_gles3_context_draw_range_elements(struct yagl_gles3_context *ctx,
const GLvoid *indices,
int32_t indices_count)
{
+ YAGL_LOG_FUNC_SET(yagl_gles3_context_draw_range_elements);
+
+ if (ctx->tfo->active && !ctx->tfo->paused) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
yagl_gles3_context_pre_draw(ctx);
yagl_gles2_context_pre_draw(&ctx->base, mode, end + 1);