summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRyan C. Gordon <icculus@icculus.org>2014-12-26 22:30:19 -0500
committerRyan C. Gordon <icculus@icculus.org>2014-12-26 22:30:19 -0500
commit3557a421920fb5c7108ae38866a91c014be9ad29 (patch)
tree15f29dc6c7b442e1e78ec1de794b9de45dcdc9d3 /src
parentdb05daf61e5fb0de617c9244cb03fdc69ee6b0ec (diff)
GLES2: Only use VBOs for Emscripten (for now).
This is causing a regression on actual iOS hardware, which we should revisit after 2.0.4 ships.
Diffstat (limited to 'src')
-rw-r--r--src/render/opengles2/SDL_render_gles2.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index 4c4d8a9942..71ee70810e 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -28,7 +28,20 @@
#include "../../video/SDL_blit.h"
#include "SDL_shaders_gles2.h"
-/* To prevent unnecessary window recreation,
+/* !!! FIXME: Emscripten makes these into WebGL calls, and WebGL doesn't offer
+ !!! FIXME: client-side arrays (without an Emscripten compatibility hack,
+ !!! FIXME: at least), but the current VBO code here is dramatically
+ !!! FIXME: slower on actual iOS devices, even though the iOS Simulator
+ !!! FIXME: is okay. Some time after 2.0.4 ships, we should revisit this,
+ !!! FIXME: fix the performance bottleneck, and make everything use VBOs.
+*/
+#ifdef __EMSCRIPTEN__
+#define SDL_GLES2_USE_VBOS 1
+#else
+#define SDL_GLES2_USE_VBOS 0
+#endif
+
+/* To prevent unnecessary window recreation,
* these should match the defaults selected in SDL_GL_ResetAttributes
*/
#define RENDERER_CONTEXT_MAJOR 2
@@ -181,8 +194,10 @@ typedef struct GLES2_DriverContext
GLES2_ProgramCacheEntry *current_program;
Uint8 clear_r, clear_g, clear_b, clear_a;
+#if SDL_GLES2_USE_VBOS
GLuint vertex_buffers[4];
GLsizeiptr vertex_buffer_size[4];
+#endif
} GLES2_DriverContext;
#define GLES2_MAX_CACHED_PROGRAMS 8
@@ -1393,10 +1408,10 @@ GLES2_UpdateVertexBuffer(SDL_Renderer *renderer, GLES2_Attribute attr,
const void *vertexData, size_t dataSizeInBytes)
{
GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
-#if 0
+
+#if !SDL_GLES2_USE_VBOS
data->glVertexAttribPointer(attr, attr == GLES2_ATTRIBUTE_ANGLE ? 1 : 2, GL_FLOAT, GL_FALSE, 0, vertexData);
#else
-
if (!data->vertex_buffers[attr])
data->glGenBuffers(1, &data->vertex_buffers[attr]);
@@ -1411,6 +1426,7 @@ GLES2_UpdateVertexBuffer(SDL_Renderer *renderer, GLES2_Attribute attr,
data->glVertexAttribPointer(attr, attr == GLES2_ATTRIBUTE_ANGLE ? 1 : 2, GL_FLOAT, GL_FALSE, 0, 0);
#endif
+
return 0;
}