LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: OpenGL ES 3.1 Profile Extension issue  (Read 760 times)

darkyellow

  • Newbie
  • *
  • Offline Offline
  • Posts: 25
OpenGL ES 3.1 Profile Extension issue
« on: May 10, 2017, 06:32:45 »

Hi

This maybe a case of me understanding things wrong but I am having issues with some opengl es 3 specific glsl functionality.

I have a basic vertex shader (see below) that users interface blocks.

Code: [Select]
#version 310 es

layout(location = 0) in vec3 vertex;
layout(location = 1) in vec3 normal;
layout(location = 2) in vec2 textureCoordinates;

uniform mat4 model;

// the data to be sent to the fragment shader
out  vertexData   {
    vec3 normal;
    vec2 textureCoordinates;
} outData;

void main() {
    // pass through variables
    outData.textureCoordinates = textureCoordinates;

    vec4 position;
    position = model * vec4(vertex,1.0);
    gl_Position = position;
}

When I compile the shader I get the following error

Error on compile stage [0:10(1): error: GL_OES_shader_io_blocks or #version 320 required for using interface blocks

I am running this on linux and the partial results of my glxinfo has the below, notice that GL_OES_shader_io_blocks is supported.

Code: [Select]
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 17.1.0-rc4
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:
    GL_ANGLE_texture_compression_dxt3, GL_ANGLE_texture_compression_dxt5,
    GL_APPLE_texture_max_level, GL_EXT_blend_func_extended,
    GL_EXT_blend_minmax, GL_EXT_buffer_storage, GL_EXT_clip_cull_distance,
    GL_EXT_color_buffer_float, GL_EXT_compressed_ETC1_RGB8_sub_texture,
    GL_EXT_discard_framebuffer, GL_EXT_draw_buffers,
    GL_EXT_draw_buffers_indexed, GL_EXT_draw_elements_base_vertex,
    GL_EXT_frag_depth, GL_EXT_geometry_point_size, GL_EXT_geometry_shader,
    GL_EXT_gpu_shader5, GL_EXT_map_buffer_range, GL_EXT_multi_draw_arrays,
    GL_EXT_polygon_offset_clamp, GL_EXT_primitive_bounding_box,
    GL_EXT_read_format_bgra, GL_EXT_robustness,
    GL_EXT_separate_shader_objects, GL_EXT_shader_integer_mix,
    GL_EXT_shader_io_blocks, GL_EXT_shader_samples_identical,
    GL_EXT_tessellation_point_size, GL_EXT_tessellation_shader,
    GL_EXT_texture_border_clamp, GL_EXT_texture_buffer,
    GL_EXT_texture_compression_dxt1, GL_EXT_texture_cube_map_array,
    GL_EXT_texture_filter_anisotropic, GL_EXT_texture_format_BGRA8888,
    GL_EXT_texture_rg, GL_EXT_texture_sRGB_decode,
    GL_EXT_texture_type_2_10_10_10_REV, GL_EXT_unpack_subimage,
    GL_INTEL_performance_query, GL_KHR_blend_equation_advanced,
    GL_KHR_context_flush_control, GL_KHR_debug,
    GL_KHR_robust_buffer_access_behavior, GL_KHR_robustness,
    GL_MESA_shader_integer_functions, GL_NV_draw_buffers,
    GL_NV_fbo_color_attachments, GL_NV_image_formats, GL_NV_read_buffer,
    GL_NV_read_depth, GL_NV_read_depth_stencil, GL_NV_read_stencil,
    GL_OES_EGL_image, GL_OES_EGL_image_external, GL_OES_EGL_sync,
    GL_OES_compressed_ETC1_RGB8_texture, GL_OES_depth24, GL_OES_depth_texture,
    GL_OES_depth_texture_cube_map, GL_OES_draw_buffers_indexed,
    GL_OES_draw_elements_base_vertex, GL_OES_element_index_uint,
    GL_OES_fbo_render_mipmap, GL_OES_geometry_point_size,
    GL_OES_geometry_shader, GL_OES_get_program_binary, GL_OES_gpu_shader5,
    GL_OES_mapbuffer, GL_OES_packed_depth_stencil,
    GL_OES_primitive_bounding_box, GL_OES_rgb8_rgba8, GL_OES_sample_shading,
    GL_OES_sample_variables, GL_OES_shader_image_atomic,
    GL_OES_shader_io_blocks, GL_OES_shader_multisample_interpolation,
    GL_OES_standard_derivatives, GL_OES_stencil8, GL_OES_surfaceless_context,
    GL_OES_tessellation_point_size, GL_OES_tessellation_shader,
    GL_OES_texture_3D, GL_OES_texture_border_clamp, GL_OES_texture_buffer,
    GL_OES_texture_cube_map_array, GL_OES_texture_float,
    GL_OES_texture_float_linear, GL_OES_texture_half_float,
    GL_OES_texture_half_float_linear, GL_OES_texture_npot,
    GL_OES_texture_stencil8, GL_OES_texture_storage_multisample_2d_array,
    GL_OES_vertex_array_object, GL_OES_vertex_half_float,
    GL_OES_viewport_array

When I run this code to see the supported extensions though I only get the opengl core extensions, not the opengl es profile extensions.

Code: [Select]
        int num = GLES20.glGetInteger(GLES30.GL_NUM_EXTENSIONS);
        for (int i = 0; i < num; i++) {
            Log.debug(GLES30.glGetStringi(GLES20.GL_EXTENSIONS,i));
        }

results :

GL_3DFX_texture_compression_FXT1
GL_AMD_conservative_depth
GL_AMD_draw_buffers_blend
GL_AMD_seamless_cubemap_per_texture
GL_AMD_shader_trinary_minmax
GL_AMD_vertex_shader_layer
GL_AMD_vertex_shader_viewport_index
GL_ANGLE_texture_compression_dxt3
GL_ANGLE_texture_compression_dxt5
GL_APPLE_object_purgeable
GL_ARB_ES2_compatibility
GL_ARB_ES3_1_compatibility
GL_ARB_ES3_compatibility
GL_ARB_arrays_of_arrays
GL_ARB_base_instance
GL_ARB_blend_func_extended
GL_ARB_buffer_storage
GL_ARB_clear_buffer_object
GL_ARB_clear_texture
GL_ARB_clip_control
GL_ARB_compressed_texture_pixel_storage
GL_ARB_compute_shader
GL_ARB_conditional_render_inverted
GL_ARB_conservative_depth
GL_ARB_copy_buffer
GL_ARB_copy_image
GL_ARB_cull_distance
GL_ARB_debug_output
GL_ARB_depth_buffer_float
GL_ARB_depth_clamp
GL_ARB_derivative_control
GL_ARB_direct_state_access
GL_ARB_draw_buffers
GL_ARB_draw_buffers_blend
GL_ARB_draw_elements_base_vertex
GL_ARB_draw_indirect
GL_ARB_draw_instanced
GL_ARB_enhanced_layouts
GL_ARB_explicit_attrib_location
GL_ARB_explicit_uniform_location
GL_ARB_fragment_coord_conventions
GL_ARB_fragment_layer_viewport
GL_ARB_fragment_shader
GL_ARB_framebuffer_no_attachments
GL_ARB_framebuffer_object
GL_ARB_framebuffer_sRGB
GL_ARB_get_program_binary
GL_ARB_get_texture_sub_image
GL_ARB_gpu_shader5
GL_ARB_gpu_shader_fp64
GL_ARB_half_float_pixel
GL_ARB_half_float_vertex
GL_ARB_instanced_arrays
GL_ARB_internalformat_query
GL_ARB_internalformat_query2
GL_ARB_invalidate_subdata
GL_ARB_map_buffer_alignment
GL_ARB_map_buffer_range
GL_ARB_multi_bind
GL_ARB_multi_draw_indirect
GL_ARB_occlusion_query2
GL_ARB_pipeline_statistics_query
GL_ARB_pixel_buffer_object
GL_ARB_point_sprite
GL_ARB_program_interface_query
GL_ARB_provoking_vertex
GL_ARB_robust_buffer_access_behavior
GL_ARB_robustness
GL_ARB_sample_shading
GL_ARB_sampler_objects
GL_ARB_seamless_cube_map
GL_ARB_seamless_cubemap_per_texture
GL_ARB_separate_shader_objects
GL_ARB_shader_atomic_counter_ops
GL_ARB_shader_atomic_counters
GL_ARB_shader_bit_encoding
GL_ARB_shader_clock
GL_ARB_shader_draw_parameters
GL_ARB_shader_image_load_store
GL_ARB_shader_image_size
GL_ARB_shader_objects
GL_ARB_shader_precision
GL_ARB_shader_storage_buffer_object
GL_ARB_shader_subroutine
GL_ARB_shader_texture_image_samples
GL_ARB_shader_texture_lod
GL_ARB_shader_viewport_layer_array
GL_ARB_shading_language_420pack
GL_ARB_shading_language_packing
GL_ARB_stencil_texturing
GL_ARB_sync
GL_ARB_tessellation_shader
GL_ARB_texture_barrier
GL_ARB_texture_buffer_object
GL_ARB_texture_buffer_object_rgb32
GL_ARB_texture_buffer_range
GL_ARB_texture_compression_bptc
GL_ARB_texture_compression_rgtc
GL_ARB_texture_cube_map_array
GL_ARB_texture_float
GL_ARB_texture_gather
GL_ARB_texture_mirror_clamp_to_edge
GL_ARB_texture_multisample
GL_ARB_texture_non_power_of_two
GL_ARB_texture_query_levels
GL_ARB_texture_query_lod
GL_ARB_texture_rectangle
GL_ARB_texture_rg
GL_ARB_texture_rgb10_a2ui
GL_ARB_texture_stencil8
GL_ARB_texture_storage
GL_ARB_texture_storage_multisample
GL_ARB_texture_swizzle
GL_ARB_texture_view
GL_ARB_timer_query
GL_ARB_transform_feedback2
GL_ARB_transform_feedback3
GL_ARB_transform_feedback_instanced
GL_ARB_transform_feedback_overflow_query
GL_ARB_uniform_buffer_object
GL_ARB_vertex_array_bgra
GL_ARB_vertex_array_object
GL_ARB_vertex_attrib_64bit
GL_ARB_vertex_attrib_binding
GL_ARB_vertex_shader
GL_ARB_vertex_type_10f_11f_11f_rev
GL_ARB_vertex_type_2_10_10_10_rev
GL_ARB_viewport_array
GL_ATI_blend_equation_separate
GL_ATI_texture_float
GL_EXT_abgr
GL_EXT_blend_equation_separate
GL_EXT_draw_buffers2
GL_EXT_draw_instanced
GL_EXT_framebuffer_blit
GL_EXT_framebuffer_multisample
GL_EXT_framebuffer_multisample_blit_scaled
GL_EXT_framebuffer_sRGB
GL_EXT_packed_depth_stencil
GL_EXT_packed_float
GL_EXT_pixel_buffer_object
GL_EXT_polygon_offset_clamp
GL_EXT_provoking_vertex
GL_EXT_shader_integer_mix
GL_EXT_shader_samples_identical
GL_EXT_texture_array
GL_EXT_texture_compression_dxt1
GL_EXT_texture_compression_rgtc
GL_EXT_texture_compression_s3tc
GL_EXT_texture_filter_anisotropic
GL_EXT_texture_integer
GL_EXT_texture_sRGB
GL_EXT_texture_sRGB_decode
GL_EXT_texture_shared_exponent
GL_EXT_texture_snorm
GL_EXT_texture_swizzle
GL_EXT_timer_query
GL_EXT_transform_feedback
GL_EXT_vertex_array_bgra
GL_IBM_multimode_draw_arrays
GL_INTEL_performance_query
GL_KHR_blend_equation_advanced
GL_KHR_context_flush_control
GL_KHR_debug
GL_KHR_robust_buffer_access_behavior
GL_KHR_robustness
GL_MESA_pack_invert
GL_MESA_shader_integer_functions
GL_MESA_texture_signed_rgba
GL_NV_conditional_render
GL_NV_depth_clamp
GL_NV_packed_depth_stencil
GL_NV_texture_barrier
GL_OES_EGL_image
GL_S3_s3tc

Is there a place where I can print out the opengl es extensions, in my code, to help debug my problem further?
Logged

spasi

  • Administrator
  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 1908
Re: OpenGL ES 3.1 Profile Extension issue
« Reply #1 on: May 10, 2017, 07:10:20 »

When I compile the shader I get the following error

Error on compile stage [0:10(1): error: GL_OES_shader_io_blocks or #version 320 required for using interface blocks

Have you tried adding:

Code: [Select]
#extension GL_OES_shader_io_blocks: requireunder the #version directive?

When I run this code to see the supported extensions though I only get the opengl core extensions, not the opengl es profile extensions.

How is the OpenGL ES context created? Have you used glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API)?

Is there a place where I can print out the opengl es extensions, in my code, to help debug my problem further?

The GLESCapabilities instance returned by GLES.createCapabilities() contains flags for all extensions, but it's not suitable for iteration. The glGetStringi loop you used is fine.
Logged

darkyellow

  • Newbie
  • *
  • Offline Offline
  • Posts: 25
Re: OpenGL ES 3.1 Profile Extension issue
« Reply #2 on: May 10, 2017, 07:55:09 »

Spasi

Thanks for the quick response

Adding this

Code: [Select]
#extension GL_OES_shader_io_blocks: require
Fixed the error so thanks for the help on how to add it ( I wasn't aware of that syntax)

I tried this too

Code: [Select]
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API)
but got this error

Code: [Select]
[LWJGL] GLFW_VERSION_UNAVAILABLE error
Description : GLX: Failed to create context: GLXBadFBConfig
Stacktrace  :
org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:1484)
org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1637)

This is the entire block so it could be something else I have defined that is not required for opengles

Code: [Select]
        GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_CORE_PROFILE);
        GLFW.glfwWindowHint(GLFW.GLFW_CLIENT_API,GLFW.GLFW_OPENGL_ES_API);
        GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MAJOR, 3);
        GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MINOR, 3);
Logged

spasi

  • Administrator
  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 1908
Re: OpenGL ES 3.1 Profile Extension issue
« Reply #3 on: May 10, 2017, 08:07:10 »

GLFW_CONTEXT_VERSION_MINOR is wrong, try 1 instead of 3.
Logged

darkyellow

  • Newbie
  • *
  • Offline Offline
  • Posts: 25
Re: OpenGL ES 3.1 Profile Extension issue
« Reply #4 on: May 10, 2017, 09:06:40 »

That fixed the client api issue! The GLES profile extensions now print out correctly too.
Logged