···58585959option(SDL_gpu_USE_SYSTEM_GLEW "Attempt to use the system GLEW library (may not support GL 3+)" OFF)
60606161+option(SDL_gpu_USE_BUFFER_RESET "Upload VBOs by requesting a new one each time (default). This is often the best for driver optimization)" ON)
6262+option(SDL_gpu_USE_BUFFER_UPDATE "Upload VBOs by updating only the needed portion" OFF)
6363+option(SDL_gpu_USE_BUFFER_MAPPING "Upload VBOs by mapping to client memory" OFF)
6464+6565+6166if(APPLE)
6267 if(IOS)
6368 # iOS 8 may need the framework option
···267272endif(DOXYGEN_FOUND)
268273269274add_definitions("-Wall -std=c99 -pedantic")
275275+276276+if (SDL_gpu_USE_BUFFER_RESET)
277277+ add_definitions("-DSDL_GPU_USE_BUFFER_RESET")
278278+endif (SDL_gpu_USE_BUFFER_RESET)
279279+if (SDL_gpu_USE_BUFFER_UPDATE)
280280+ add_definitions("-DSDL_GPU_USE_BUFFER_UPDATE")
281281+endif (SDL_gpu_USE_BUFFER_UPDATE)
282282+if (SDL_gpu_USE_BUFFER_MAPPING)
283283+ add_definitions("-DSDL_GPU_USE_BUFFER_MAPPING")
284284+endif (SDL_gpu_USE_BUFFER_MAPPING)
270285271286# Build the SDL_gpu library.
272287add_subdirectory(src)
+8-6
src/renderer_GL_common.inl
···44524452static_inline void submit_buffer_data(int bytes, float* values, int bytes_indices, unsigned short* indices)
44534453{
44544454 #ifdef SDL_GPU_USE_BUFFER_PIPELINE
44554455- #ifdef SDL_GPU_USE_BUFFER_MAPPING
44554455+ #if defined(SDL_GPU_USE_BUFFER_RESET)
44564456+ glBufferData(GL_ARRAY_BUFFER, bytes, values, GL_STREAM_DRAW);
44574457+ if(indices != NULL)
44584458+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, bytes_indices, indices, GL_DYNAMIC_DRAW);
44594459+ #elif defined(SDL_GPU_USE_BUFFER_MAPPING)
44564460 // NOTE: On the Raspberry Pi, you may have to use GL_DYNAMIC_DRAW instead of GL_STREAM_DRAW for buffers to work with glMapBuffer().
44574461 float* data = (float*)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
44584462 unsigned short* data_i = (indices == NULL? NULL : (unsigned short*)glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY));
···44664470 memcpy(data_i, indices, bytes_indices);
44674471 glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
44684472 }
44694469- #elif defined(SDL_GPU_USE_BUFFER_RESET)
44704470- glBufferData(GL_ARRAY_BUFFER, bytes, values, GL_STREAM_DRAW);
44714471- if(indices != NULL)
44724472- glBufferData(GL_ELEMENT_ARRAY_BUFFER, bytes_indices, indices, GL_DYNAMIC_DRAW);
44734473- #else
44734473+ #elif defined(SDL_GPU_USE_BUFFER_UPDATE)
44744474 glBufferSubData(GL_ARRAY_BUFFER, 0, bytes, values);
44754475 if(indices != NULL)
44764476 glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, bytes_indices, indices);
44774477+ #else
44784478+ #error SDL_gpu's VBO upload needs to choose SDL_GPU_USE_BUFFER_RESET, SDL_GPU_USE_BUFFER_MAPPING, or SDL_GPU_USE_BUFFER_UPDATE and none is defined!
44774479 #endif
44784480 #endif
44794481}