Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

better GLES3 support

  • Loading branch information...
commit 1ef702c88eed56a3f7c7cd643933e7f8fa6709ce 1 parent 042b953
@krogue2 krogue2 authored
View
2  demos/text_viewer/TextViewer.cpp
@@ -907,7 +907,7 @@ TextViewer(cmd_line_type &cmd_line):
m_load_font_in_thread(cmd_line.m_load_font_in_thread.m_value),
m_need_to_update_culling(true)
{
-
+
WRATHImage::texture_atlas_dimension(cmd_line.m_atlas_size.m_value);
FilePacket::Loader fetcher;
View
11 inc/WRATH/gl/WRATHgluniform_implement.tcc
@@ -27,9 +27,12 @@
#if defined(WRATH_GL_VERSION) || WRATH_GLES_VERSION>=3
#define WRATH_GL_SUPPORT_NON_SQUARE_MATRICES
-#define WRATH_GL_SUPPORT_DOUBLE_AND_UINT_UNIFORMS
+#define WRATH_GL_SUPPORT_UINT_UNIFORMS
#endif
+#if defined(WRATH_GL_VERSION)
+#define WRATH_GL_SUPPORT_DOUBLE_UNIFORMS
+#endif
/*
Implement WRATHglUniform{1,2,3,4}v overloads to correct
@@ -153,12 +156,16 @@
WRATH_GL_UNIFORM_NON_SQUARE_MATRIX_IMPL(GLFN, TYPE)
-#ifdef WRATH_GL_SUPPORT_DOUBLE_AND_UINT_UNIFORMS
+#ifdef WRATH_GL_SUPPORT_UINT_UNIFORMS
WRATH_GL_UNIFORM_IMPL(ui, GLuint)
+#endif
+
+#ifdef WRATH_GL_SUPPORT_DOUBLE_UNIFORMS
WRATH_GL_UNIFORM_IMPL(d, GLdouble)
WRATH_GL_UNIFORM_MATRIX_IMPL(d, GLdouble)
#endif
+
WRATH_GL_UNIFORM_IMPL(f, GLfloat)
WRATH_GL_UNIFORM_IMPL(i, GLint)
WRATH_GL_UNIFORM_MATRIX_IMPL(f, GLfloat)
View
5 ngl/.gitignore
@@ -1,8 +1,13 @@
ngl_gles2detailed_output.txt
ngl_gles2function_list_output.txt
+ngl_gles3detailed_output.txt
+ngl_gles3function_list_output.txt
ngl_gldetailed_output.txt
ngl_glfunction_list_output.txt
ngl_gl.cpp
ngl_gl.hpp
ngl_gles2.cpp
ngl_gles2.hpp
+ngl_gles3.cpp
+ngl_gles3.hpp
+
View
8 ngl/Rules.mk
@@ -10,10 +10,10 @@ INCLUDES += -I$(d) -I$(GL_INCLUDEPATH)
GL_RAW_HEADER_FILES=GL/gl.h GL/glext.h
GLES2_RAW_HEADER_FILES=GLES2/gl2platform.h GLES2/gl2.h GLES2/gl2ext.h
-GLES3_RAW_HEADER_FILES=GLES3/gl3platform.h GLES3/gl3.h GLES3/gl3ext.h
+GLES3_RAW_HEADER_FILES=GLES3/gl3platform.h GLES3/gl3.h GLES3/gl3ext.h GLES2/gl2ext.h
GL_HEADER_FILES=$(GL_RAW_HEADER_FILES:%.h=$(GL_INCLUDEPATH)/%.h)
-GLES3_HEADER_FILES=$(GLES2_RAW_HEADER_FILES:%.h=$(GL_INCLUDEPATH)/%.h)
+GLES2_HEADER_FILES=$(GLES2_RAW_HEADER_FILES:%.h=$(GL_INCLUDEPATH)/%.h)
GLES3_HEADER_FILES=$(GLES3_RAW_HEADER_FILES:%.h=$(GL_INCLUDEPATH)/%.h)
NGL_DIR := $(d)
@@ -26,10 +26,6 @@ $(call filelist, ngl_gles2.cpp ngl_gles2.hpp): $(NGL_FILTER) $(NGL_EXTRACTOR)
$(NGL_FILTER) $(GLES2_HEADER_FILES) \
| $(NGL_EXTRACTOR) name=ngl_gles2 path=$(GL_INCLUDEPATH) outputpath=$(NGL_DIR) $(GLES2_RAW_HEADER_FILES)
-$(call filelist, ngl_gl.cpp ngl_gl.hpp): $(NGL_FILTER) $(NGL_EXTRACTOR)
- $(NGL_FILTER) $(GL_HEADER_FILES) \
- | $(NGL_EXTRACTOR) name=ngl_gl path=$(GL_INCLUDEPATH) outputpath=$(NGL_DIR) $(GL_RAW_HEADER_FILES)
-
$(call filelist, ngl_gles3.cpp ngl_gles3.hpp): $(NGL_FILTER) $(NGL_EXTRACTOR)
$(NGL_FILTER) $(GLES3_HEADER_FILES) \
| $(NGL_EXTRACTOR) name=ngl_gles3 path=$(GL_INCLUDEPATH) outputpath=$(NGL_DIR) $(GLES3_RAW_HEADER_FILES)
View
38 src/WRATH/gl/WRATHGLProgram.cpp
@@ -54,6 +54,20 @@ namespace
S;
}
+ void
+ emit_source_line(std::ostream &output_stream,
+ const std::string &source,
+ int line_number, const std::string &label)
+ {
+ std::string S;
+ S=strip_leading_white_spaces(source);
+ output_stream << S
+ << std::setw(80-S.length()) << " //LOCATION("
+ << std::setw(3) << line_number
+ << ", " << label
+ << ")\n";
+ }
+
std::pair<bool, std::string>
includes_file(const std::string &S, const std::string &path)
{
@@ -142,12 +156,7 @@ namespace
}
else
{
-
- output_stream << strip_leading_white_spaces(S)
- << std::setw(80-S.length()) << " //LOCATION("
- << std::setw(3) << line_number
- << ", " << label
- << ")\n";
+ emit_source_line(output_stream, S, line_number, label);
}
++line_number;
@@ -199,11 +208,7 @@ namespace
}
else
{
- output_stream << strip_leading_white_spaces(S)
- << std::setw(80-S.length()) << " //LOCATION("
- << std::setw(3) << line_number
- << ", " << label
- << ")\n";
+ emit_source_line(output_stream, S, line_number, label);
}
++line_number;
@@ -648,10 +653,17 @@ build_source_code(std::ostream &output_glsl_source_code, GLenum shader_type) con
for(std::list< source_code_type>::const_iterator
iter=m_values.begin(), end=m_values.end(); iter!=end; ++iter)
- {
-
+ {
add_source_entry(*iter, output_glsl_source_code);
}
+
+ /*
+ some GLSL pre-processors do not like to end on a
+ comment or other certain tokens, to make them
+ less grouchy, we emit a few extra \n's
+ */
+ output_glsl_source_code << "\n\n\n"
+ << "#define WRATH_GL_SOURCE_END\n\n";
}
WRATHGLShader::shader_source&
View
2  src/WRATH/gl/WRATHGPUConfig.cpp
@@ -76,7 +76,7 @@ WRATHGPUConfig::
default_shader_version(void)
{
#if defined(WRATH_GLES_VERSION) && WRATH_GLES_VERSION>=3
- return "300";
+ return "300 es";
#elif defined(WRATH_GL_VERSION) && WRATH_GL_VERSION>=3
return "330 core";
#endif
View
2  src/WRATH/gl/WRATHRawDrawData.cpp
@@ -113,7 +113,7 @@ namespace
indices[i]=indx_source->offset_pointer(draw_ranges[i].m_location);
}
- #ifdef WRATH_GL_VERSION
+ #if defined(WRATH_GL_VERSION)
{
glMultiDrawElements(primitive_type, counts.c_ptr(),
index_type, indices.c_ptr(),
View
2  src/WRATH/text/WRATHFontShaderSpecifier.cpp
@@ -259,7 +259,7 @@ fetch_texture_font_drawer(const WRATHTextureFont::GlyphGLSL *fs_source,
const char *struct_def=
"\nstruct wrath_font_custom_data_t"
"\n{"
- "\n\tfloat highp values[WRATH_FONT_CUSTOM_DATA];"
+ "\n\thighp float values[WRATH_FONT_CUSTOM_DATA];"
"\n};\n";
cst
View
2  src/WRATH/text/WRATHTextureFontFreeType_Analytic.cpp
@@ -146,7 +146,7 @@ namespace
}
#else
{
- return GL_HALF_FLOAT_ARB;
+ return GL_HALF_FLOAT;
}
#endif
}
View
4 src/WRATH/text/shaders/analytic/font_analytic_base.frag.wrath-shader.glsl
@@ -38,8 +38,8 @@ uniform mediump sampler2D wrath_AnalyticPositionTexture;
prelative_coord= relative_coord attribute
*/
mediump float
-wrath_analytic_font_compute_distance(in vec2 GlyphTextureCoordinate,
- in vec2 GlyphCoordinate)
+wrath_analytic_font_compute_distance(in mediump vec2 GlyphTextureCoordinate,
+ in mediump vec2 GlyphCoordinate)
{
mediump vec4 tex_v, X_Y;
mediump vec2 p, Cv, dL_dM;
View
4 src/WRATH/text/shaders/analytic/font_analytic_linear.vert.wrath-shader.glsl
@@ -20,8 +20,8 @@
shader_out mediump vec4 wrath_AnalyticTexCoord_Position;
void wrath_pre_compute_glyph(in vec2 glyph_position,
- in vec2 glyph_bottom_left,
- in vec2 glyph_size)
+ in vec2 glyph_bottom_left,
+ in vec2 glyph_size)
{
mediump vec2 pp, glyph_texture_reciprocal_size;
View
6 src/WRATH/text/shaders/curve_analytic/font_curve_analytic_base.frag.wrath-shader.glsl
@@ -132,9 +132,9 @@
mediump float
-wrath_curve_analytic_compute_quasi_distance(in vec2 GlyphCoordinate,
- in vec2 GlyphTextureCoordinate,
- in float GlyphIndex)
+wrath_curve_analytic_compute_quasi_distance(in mediump vec2 GlyphCoordinate,
+ in mediump vec2 GlyphTextureCoordinate,
+ in mediump float GlyphIndex)
{
mediump vec2 pp;
mediump vec4 pa_pb;
View
2  src/WRATH/text/shaders/distance/font_distance_base.frag.glsl
@@ -1,7 +1,7 @@
#define WRATH_FONT_IMPLEMENT_SIGNED_DISTANCE
mediump float
-wrath_font_distance_compute_signed_distance(float rr)
+wrath_font_distance_compute_signed_distance(in mediump float rr)
{
return wrath_font_page_data(2)*(2.0*rr - 1.0);
}
View
6 src/WRATH/text/shaders/distance/font_distance_nonlinear.frag.wrath-shader.glsl
@@ -26,7 +26,7 @@ uniform mediump sampler2D wrath_DistanceField;
shader_in mediump vec2 wrath_DistanceFieldBottomLeft;
mediump float
-wrath_glyph_is_covered(in vec2 glyph_position)
+wrath_glyph_is_covered(in mediump vec2 glyph_position)
{
mediump float rr;
mediump vec2 tt, glyph_texture_reciprocal_size;
@@ -40,7 +40,7 @@ wrath_glyph_is_covered(in vec2 glyph_position)
}
mediump float
-wrath_glyph_compute_coverage(in vec2 glyph_position)
+wrath_glyph_compute_coverage(in mediump vec2 glyph_position)
{
mediump float rr;
mediump vec2 tt, glyph_texture_reciprocal_size;
@@ -74,7 +74,7 @@ wrath_glyph_compute_coverage(in vec2 glyph_position)
mediump float
-wrath_glyph_signed_distance(in vec2 glyph_position)
+wrath_glyph_signed_distance(in mediump vec2 glyph_position)
{
mediump float rr;
mediump vec2 tt, glyph_texture_reciprocal_size;
Please sign in to comment.
Something went wrong with that request. Please try again.