modes detection errors

This commit is contained in:
2018-11-03 03:19:15 +07:00
parent e7bebf935a
commit c5a5c41f26
6 changed files with 39 additions and 27 deletions

View File

@@ -137,7 +137,7 @@ set(E2D_LIBRARIES
${CMAKE_THREAD_LIBS_INIT}) ${CMAKE_THREAD_LIBS_INIT})
if(APPLE) if(APPLE)
list(APPEND ${E2D_LIBRARIES} list(APPEND E2D_LIBRARIES
${Cocoa} ${Cocoa}
${IOKit} ${IOKit}
${CoreVideo} ${CoreVideo}

View File

@@ -25,3 +25,7 @@
# define E2D_RENDER_MODE E2D_RENDER_MODE_OPENGL # define E2D_RENDER_MODE E2D_RENDER_MODE_OPENGL
# endif # endif
#endif #endif
#ifndef E2D_RENDER_MODE
# error E2D_RENDER_MODE not detected
#endif

View File

@@ -978,37 +978,37 @@ namespace e2d
case pixel_declaration::pixel_type::depth16: case pixel_declaration::pixel_type::depth16:
return true; return true;
case pixel_declaration::pixel_type::depth24: case pixel_declaration::pixel_type::depth24:
return __GLEW_OES_depth24; return GLEW_OES_depth24;
case pixel_declaration::pixel_type::depth32: case pixel_declaration::pixel_type::depth32:
return __GLEW_OES_depth32; return GLEW_OES_depth32;
case pixel_declaration::pixel_type::depth24_stencil8: case pixel_declaration::pixel_type::depth24_stencil8:
return __GLEW_OES_packed_depth_stencil return GLEW_OES_packed_depth_stencil
|| __GLEW_EXT_packed_depth_stencil; || GLEW_EXT_packed_depth_stencil;
case pixel_declaration::pixel_type::rgb8: case pixel_declaration::pixel_type::rgb8:
case pixel_declaration::pixel_type::rgba8: case pixel_declaration::pixel_type::rgba8:
return true; return true;
case pixel_declaration::pixel_type::rgb_dxt1: case pixel_declaration::pixel_type::rgb_dxt1:
case pixel_declaration::pixel_type::rgba_dxt1: case pixel_declaration::pixel_type::rgba_dxt1:
return __GLEW_ANGLE_texture_compression_dxt1 return GLEW_ANGLE_texture_compression_dxt1
|| __GLEW_EXT_texture_compression_dxt1 || GLEW_EXT_texture_compression_dxt1
|| __GLEW_EXT_texture_compression_s3tc || GLEW_EXT_texture_compression_s3tc
|| __GLEW_NV_texture_compression_s3tc; || GLEW_NV_texture_compression_s3tc;
case pixel_declaration::pixel_type::rgba_dxt3: case pixel_declaration::pixel_type::rgba_dxt3:
return __GLEW_ANGLE_texture_compression_dxt3 return GLEW_ANGLE_texture_compression_dxt3
|| __GLEW_EXT_texture_compression_s3tc || GLEW_EXT_texture_compression_s3tc
|| __GLEW_NV_texture_compression_s3tc; || GLEW_NV_texture_compression_s3tc;
case pixel_declaration::pixel_type::rgba_dxt5: case pixel_declaration::pixel_type::rgba_dxt5:
return __GLEW_ANGLE_texture_compression_dxt5 return GLEW_ANGLE_texture_compression_dxt5
|| __GLEW_EXT_texture_compression_s3tc || GLEW_EXT_texture_compression_s3tc
|| __GLEW_NV_texture_compression_s3tc; || GLEW_NV_texture_compression_s3tc;
case pixel_declaration::pixel_type::rgb_pvrtc2: case pixel_declaration::pixel_type::rgb_pvrtc2:
case pixel_declaration::pixel_type::rgb_pvrtc4: case pixel_declaration::pixel_type::rgb_pvrtc4:
case pixel_declaration::pixel_type::rgba_pvrtc2: case pixel_declaration::pixel_type::rgba_pvrtc2:
case pixel_declaration::pixel_type::rgba_pvrtc4: case pixel_declaration::pixel_type::rgba_pvrtc4:
return __GLEW_IMG_texture_compression_pvrtc; return GLEW_IMG_texture_compression_pvrtc;
case pixel_declaration::pixel_type::rgba_pvrtc2_v2: case pixel_declaration::pixel_type::rgba_pvrtc2_v2:
case pixel_declaration::pixel_type::rgba_pvrtc4_v2: case pixel_declaration::pixel_type::rgba_pvrtc4_v2:
return __GLEW_IMG_texture_compression_pvrtc2; return GLEW_IMG_texture_compression_pvrtc2;
default: default:
E2D_ASSERT_MSG(false, "unexpected pixel type"); E2D_ASSERT_MSG(false, "unexpected pixel type");
return false; return false;
@@ -1025,7 +1025,7 @@ namespace e2d
#if E2D_RENDER_MODE == E2D_RENDER_MODE_OPENGL #if E2D_RENDER_MODE == E2D_RENDER_MODE_OPENGL
return true; return true;
#elif E2D_RENDER_MODE == E2D_RENDER_MODE_OPENGLES #elif E2D_RENDER_MODE == E2D_RENDER_MODE_OPENGLES
return __GLEW_OES_element_index_uint; return GLEW_OES_element_index_uint;
#else #else
# error unknown render mode # error unknown render mode
#endif #endif

View File

@@ -1297,19 +1297,19 @@ namespace e2d { namespace opengl
caps.max_fragment_uniform_vectors = math::numeric_cast<u32>(max_fragment_uniform_vectors); caps.max_fragment_uniform_vectors = math::numeric_cast<u32>(max_fragment_uniform_vectors);
caps.npot_texture_supported = caps.npot_texture_supported =
__GLEW_OES_texture_npot || GLEW_OES_texture_npot ||
__GLEW_ARB_texture_non_power_of_two; GLEW_ARB_texture_non_power_of_two;
caps.depth_texture_supported = caps.depth_texture_supported =
__GLEW_OES_depth_texture || GLEW_OES_depth_texture ||
__GLEW_ARB_depth_texture || GLEW_ARB_depth_texture ||
__GLEW_ANGLE_depth_texture || GLEW_ANGLE_depth_texture ||
__GLEW_SGIX_depth_texture; GLEW_SGIX_depth_texture;
caps.render_target_supported = caps.render_target_supported =
__GLEW_OES_framebuffer_object || GLEW_OES_framebuffer_object ||
__GLEW_ARB_framebuffer_object || GLEW_ARB_framebuffer_object ||
__GLEW_EXT_framebuffer_object; GLEW_EXT_framebuffer_object;
} }
gl_shader_id gl_compile_shader(debug& debug, const str& source, GLenum type) noexcept { gl_shader_id gl_compile_shader(debug& debug, const str& source, GLenum type) noexcept {

View File

@@ -23,3 +23,7 @@
# define E2D_WINDOW_MODE E2D_WINDOW_MODE_GLFW # define E2D_WINDOW_MODE E2D_WINDOW_MODE_GLFW
# endif # endif
#endif #endif
#ifndef E2D_WINDOW_MODE
# error E2D_WINDOW_MODE not detected
#endif

View File

@@ -25,6 +25,10 @@
# endif # endif
#endif #endif
#ifndef E2D_FILES_MODE
# error E2D_FILES_MODE not detected
#endif
namespace e2d { namespace impl namespace e2d { namespace impl
{ {
read_file_uptr make_read_file(str_view path) noexcept; read_file_uptr make_read_file(str_view path) noexcept;