diff options
author | Stanislav Vorobiov <s.vorobiov@samsung.com> | 2014-02-06 11:29:10 +0400 |
---|---|---|
committer | Stanislav Vorobiov <s.vorobiov@samsung.com> | 2014-02-06 11:30:13 +0400 |
commit | 702dc59a16591b3d834b0b2a9e8b787b4c572126 (patch) | |
tree | 187963d5b606af18717b651e1770b0a9133f664f | |
parent | 4427b40b0dec87aa393c0e1f32632aad28703d0a (diff) | |
download | emulator-yagl-702dc59a16591b3d834b0b2a9e8b787b4c572126.tar.gz emulator-yagl-702dc59a16591b3d834b0b2a9e8b787b4c572126.tar.bz2 emulator-yagl-702dc59a16591b3d834b0b2a9e8b787b4c572126.zip |
YaGL: Expose GLESv2 extensions in GLESv3 contexts
This sounds illogical, but adreno does this. Also, khronos CTS 3.0
attempts to test GLESv2 extensions with GLESv3 context, so
it's probably ok
Change-Id: Ie5f9940ce9fe7b57e6c5ec411d76942245607071
-rw-r--r-- | GLES_common/yagl_gles_context.c | 6 | ||||
-rw-r--r-- | GLESv2/yagl_gles2_context.c | 150 | ||||
-rw-r--r-- | GLESv2/yagl_gles2_context.h | 3 | ||||
-rw-r--r-- | GLESv2/yagl_gles3_context.c | 77 |
4 files changed, 86 insertions, 150 deletions
diff --git a/GLES_common/yagl_gles_context.c b/GLES_common/yagl_gles_context.c index 898d045..6e88a57 100644 --- a/GLES_common/yagl_gles_context.c +++ b/GLES_common/yagl_gles_context.c @@ -413,6 +413,12 @@ void yagl_gles_context_unbind_vertex_array(struct yagl_gles_context *ctx, yagl_gles_vertex_array_acquire(ctx->va_zero); yagl_gles_vertex_array_release(ctx->vao); ctx->vao = ctx->va_zero; + + /* + * And bind vertex array 0, otherwise we'll end up with no + * vertex array on host. + */ + yagl_gles_vertex_array_bind(ctx->vao); } } diff --git a/GLESv2/yagl_gles2_context.c b/GLESv2/yagl_gles2_context.c index b07e25f..7e55baf 100644 --- a/GLESv2/yagl_gles2_context.c +++ b/GLESv2/yagl_gles2_context.c @@ -65,81 +65,6 @@ static const GLchar *vertex_half_float_ext = "GL_OES_vertex_half_float"; static const GLchar *standard_derivatives_ext = "GL_OES_standard_derivatives"; static const GLchar *instanced_arrays_ext = "GL_EXT_instanced_arrays"; -static const GLchar **yagl_gles2_context_get_extensions(struct yagl_gles2_context *ctx, - int *num_extensions) -{ - const GLchar **extensions; - int i = 0; - - extensions = yagl_malloc(100 * sizeof(*extensions)); - - extensions[i++] = egl_image_ext; - extensions[i++] = depth24_ext; - extensions[i++] = depth32_ext; - extensions[i++] = texture_float_ext; - extensions[i++] = texture_float_linear_ext; - extensions[i++] = texture_format_bgra8888_ext; - extensions[i++] = depth_texture_ext; - extensions[i++] = framebuffer_blit_ext; - extensions[i++] = draw_buffers_ext; - extensions[i++] = mapbuffer_ext; - extensions[i++] = map_buffer_range_ext; - extensions[i++] = element_index_uint_ext; - extensions[i++] = texture_3d_ext; - extensions[i++] = blend_minmax_ext; - extensions[i++] = texture_storage_ext; - extensions[i++] = pbo_ext; - extensions[i++] = read_buffer_ext; - extensions[i++] = compressed_etc1_rgb8_texture_ext; - extensions[i++] = pack_subimage_ext; - extensions[i++] = unpack_subimage_ext; - - if (yagl_egl_fence_supported()) { - extensions[i++] = egl_sync_ext; - } - - if (ctx->base.packed_depth_stencil) { - extensions[i++] = packed_depth_stencil_ext; - } - - if (ctx->base.texture_npot) { - extensions[i++] = texture_npot_ext; - } - - if (ctx->base.texture_rectangle) { - extensions[i++] = texture_rectangle_ext; - } - - if (ctx->base.texture_filter_anisotropic) { - extensions[i++] = texture_filter_anisotropic_ext; - } - - if (ctx->base.vertex_arrays_supported) { - extensions[i++] = vertex_array_object_ext; - } - - if (ctx->texture_half_float) { - extensions[i++] = texture_half_float_ext; - extensions[i++] = texture_half_float_linear_ext; - } - - if (ctx->vertex_half_float) { - extensions[i++] = vertex_half_float_ext; - } - - if (ctx->standard_derivatives) { - extensions[i++] = standard_derivatives_ext; - } - - if (ctx->instanced_arrays) { - extensions[i++] = instanced_arrays_ext; - } - - *num_extensions = i; - - return extensions; -} - static void yagl_gles2_context_prepare_internal(struct yagl_client_context *ctx) { struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)ctx; @@ -354,6 +279,81 @@ void yagl_gles2_context_prepare(struct yagl_gles2_context *ctx) YAGL_LOG_FUNC_EXIT(NULL); } +const GLchar **yagl_gles2_context_get_extensions(struct yagl_gles2_context *ctx, + int *num_extensions) +{ + const GLchar **extensions; + int i = 0; + + extensions = yagl_malloc(100 * sizeof(*extensions)); + + extensions[i++] = egl_image_ext; + extensions[i++] = depth24_ext; + extensions[i++] = depth32_ext; + extensions[i++] = texture_float_ext; + extensions[i++] = texture_float_linear_ext; + extensions[i++] = texture_format_bgra8888_ext; + extensions[i++] = depth_texture_ext; + extensions[i++] = framebuffer_blit_ext; + extensions[i++] = draw_buffers_ext; + extensions[i++] = mapbuffer_ext; + extensions[i++] = map_buffer_range_ext; + extensions[i++] = element_index_uint_ext; + extensions[i++] = texture_3d_ext; + extensions[i++] = blend_minmax_ext; + extensions[i++] = texture_storage_ext; + extensions[i++] = pbo_ext; + extensions[i++] = read_buffer_ext; + extensions[i++] = compressed_etc1_rgb8_texture_ext; + extensions[i++] = pack_subimage_ext; + extensions[i++] = unpack_subimage_ext; + + if (yagl_egl_fence_supported()) { + extensions[i++] = egl_sync_ext; + } + + if (ctx->base.packed_depth_stencil) { + extensions[i++] = packed_depth_stencil_ext; + } + + if (ctx->base.texture_npot) { + extensions[i++] = texture_npot_ext; + } + + if (ctx->base.texture_rectangle) { + extensions[i++] = texture_rectangle_ext; + } + + if (ctx->base.texture_filter_anisotropic) { + extensions[i++] = texture_filter_anisotropic_ext; + } + + if (ctx->base.vertex_arrays_supported) { + extensions[i++] = vertex_array_object_ext; + } + + if (ctx->texture_half_float) { + extensions[i++] = texture_half_float_ext; + extensions[i++] = texture_half_float_linear_ext; + } + + if (ctx->vertex_half_float) { + extensions[i++] = vertex_half_float_ext; + } + + if (ctx->standard_derivatives) { + extensions[i++] = standard_derivatives_ext; + } + + if (ctx->instanced_arrays) { + extensions[i++] = instanced_arrays_ext; + } + + *num_extensions = i; + + return extensions; +} + struct yagl_gles_array *yagl_gles2_context_create_arrays(struct yagl_gles_context *ctx) { diff --git a/GLESv2/yagl_gles2_context.h b/GLESv2/yagl_gles2_context.h index 8981b63..7d9eb29 100644 --- a/GLESv2/yagl_gles2_context.h +++ b/GLESv2/yagl_gles2_context.h @@ -94,6 +94,9 @@ void yagl_gles2_context_cleanup(struct yagl_gles2_context *ctx); void yagl_gles2_context_prepare(struct yagl_gles2_context *ctx); +const GLchar **yagl_gles2_context_get_extensions(struct yagl_gles2_context *ctx, + int *num_extensions); + struct yagl_gles_array *yagl_gles2_context_create_arrays(struct yagl_gles_context *ctx); diff --git a/GLESv2/yagl_gles3_context.c b/GLESv2/yagl_gles3_context.c index 7f1ee51..aa0453d 100644 --- a/GLESv2/yagl_gles3_context.c +++ b/GLESv2/yagl_gles3_context.c @@ -23,85 +23,11 @@ * We can't include GLES2/gl2ext.h here */ #define GL_HALF_FLOAT_OES 0x8D61 -#define GL_BGRA_EXT 0x80E1 #define YAGL_SET_ERR(err) \ yagl_gles_context_set_error(&ctx->base.base, err); \ YAGL_LOG_ERROR("error = 0x%X", err) -static const GLchar *egl_image_ext = "GL_OES_EGL_image"; -static const GLchar *depth24_ext = "GL_OES_depth24"; -static const GLchar *depth32_ext = "GL_OES_depth32"; -static const GLchar *texture_float_ext = "GL_OES_texture_float"; -static const GLchar *texture_float_linear_ext = "GL_OES_texture_float_linear"; -static const GLchar *texture_format_bgra8888_ext = "GL_EXT_texture_format_BGRA8888"; -static const GLchar *depth_texture_ext = "GL_OES_depth_texture"; -static const GLchar *compressed_etc1_rgb8_texture_ext = "GL_OES_compressed_ETC1_RGB8_texture"; -static const GLchar *egl_sync_ext = "GL_OES_EGL_sync"; -static const GLchar *packed_depth_stencil_ext = "GL_OES_packed_depth_stencil"; -static const GLchar *texture_npot_ext = "GL_OES_texture_npot"; -static const GLchar *texture_rectangle_ext = "GL_ARB_texture_rectangle"; -static const GLchar *texture_filter_anisotropic_ext = "GL_EXT_texture_filter_anisotropic"; -static const GLchar *texture_half_float_ext = "GL_OES_texture_half_float"; -static const GLchar *texture_half_float_linear_ext = "GL_OES_texture_half_float_linear"; -static const GLchar *vertex_half_float_ext = "GL_OES_vertex_half_float"; -static const GLchar *standard_derivatives_ext = "GL_OES_standard_derivatives"; - -static const GLchar **yagl_gles3_context_get_extensions(struct yagl_gles3_context *ctx, - int *num_extensions) -{ - const GLchar **extensions; - int i = 0; - - extensions = yagl_malloc(100 * sizeof(*extensions)); - - extensions[i++] = egl_image_ext; - extensions[i++] = depth24_ext; - extensions[i++] = depth32_ext; - extensions[i++] = texture_float_ext; - extensions[i++] = texture_float_linear_ext; - extensions[i++] = texture_format_bgra8888_ext; - extensions[i++] = depth_texture_ext; - extensions[i++] = compressed_etc1_rgb8_texture_ext; - - if (yagl_egl_fence_supported()) { - extensions[i++] = egl_sync_ext; - } - - if (ctx->base.base.packed_depth_stencil) { - extensions[i++] = packed_depth_stencil_ext; - } - - if (ctx->base.base.texture_npot) { - extensions[i++] = texture_npot_ext; - } - - if (ctx->base.base.texture_rectangle) { - extensions[i++] = texture_rectangle_ext; - } - - if (ctx->base.base.texture_filter_anisotropic) { - extensions[i++] = texture_filter_anisotropic_ext; - } - - if (ctx->base.texture_half_float) { - extensions[i++] = texture_half_float_ext; - extensions[i++] = texture_half_float_linear_ext; - } - - if (ctx->base.vertex_half_float) { - extensions[i++] = vertex_half_float_ext; - } - - if (ctx->base.standard_derivatives) { - extensions[i++] = standard_derivatives_ext; - } - - *num_extensions = i; - - return extensions; -} - static inline void yagl_gles3_context_pre_draw(struct yagl_gles3_context *ctx) { struct yagl_gles3_buffer_binding *buffer_binding; @@ -173,7 +99,8 @@ static void yagl_gles3_context_prepare(struct yagl_client_context *ctx) yagl_gles3_transform_feedback_acquire(gles3_ctx->tf_zero); gles3_ctx->tfo = gles3_ctx->tf_zero; - extensions = yagl_gles3_context_get_extensions(gles3_ctx, &num_extensions); + extensions = yagl_gles2_context_get_extensions(&gles3_ctx->base, + &num_extensions); yagl_gles_context_prepare_end(&gles3_ctx->base.base, extensions, num_extensions); |