Revision: 58733
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58733
Author: jwilkins
Date: 2013-07-30 04:55:39 +0000 (Tue, 30 Jul 2013)
Log Message:
-----------
Blender now runs on OpenGL 3.2 Core profile without crashing. It does seem to
have problems with the TRIPLE refresh method, however.
Immediate mode converted to use vertex array and vertex buffer objects. ES
might be broken now.
Modified Paths:
--------------
branches/soc-2013-viewport_fx/CMakeLists.txt
branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c
branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_ContextWGL.cpp
branches/soc-2013-viewport_fx/source/blender/blenfont/intern/blf_glyph.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extension_wrapper.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extension_wrapper.h
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.h
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate_glsl.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate_inline.h
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate_internal.h
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_object_gles.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_object_gles.h
Modified: branches/soc-2013-viewport_fx/CMakeLists.txt
===================================================================
--- branches/soc-2013-viewport_fx/CMakeLists.txt 2013-07-29 23:31:46 UTC
(rev 58732)
+++ branches/soc-2013-viewport_fx/CMakeLists.txt 2013-07-30 04:55:39 UTC
(rev 58733)
@@ -1946,10 +1946,10 @@
if(WITH_GL_SYSTEM_DESKTOP)
find_package(OpenGL)
- set(GL_LIBRARIES "${OPENGL_GL_LIBRARY}")
+ set(GL_LIBRARIES "${OPENGL_gl_LIBRARY}")
if(WITH_GLU)
- list(APPEND GL_LIBRARIES "${OPENGL_GLU_LIBRARY}")
+ list(APPEND GL_LIBRARIES "${OPENGL_glu_LIBRARY}")
endif()
elseif(WITH_GL_SYSTEM_EMBEDDED)
Modified: branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c
===================================================================
--- branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c 2013-07-29
23:31:46 UTC (rev 58732)
+++ branches/soc-2013-viewport_fx/extern/glew-es/src/glew.c 2013-07-30
04:55:39 UTC (rev 58733)
@@ -423,7 +423,6 @@
}
#ifndef GLEW_ES_ONLY
else { // XXX jwilkins: unified extension string is deprecated
- typedef const GLubyte* (GLAPIENTRY * PFNGLGETSTRINGIPROC)
(GLenum, GLuint);
GLEW_FUN_EXPORT PFNGLGETSTRINGIPROC pglGetStringi =
(PFNGLGETSTRINGIPROC)glewGetProcAddress("glGetStringi");
if (pglGetStringi != NULL) {
Modified: branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_ContextWGL.cpp
===================================================================
--- branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_ContextWGL.cpp
2013-07-29 23:31:46 UTC (rev 58732)
+++ branches/soc-2013-viewport_fx/intern/ghost/intern/GHOST_ContextWGL.cpp
2013-07-30 04:55:39 UTC (rev 58733)
@@ -1004,7 +1004,7 @@
if (!WIN32_CHK(::wglMakeCurrent(m_hDC, m_hGLRC)))
goto error;
- initGlew();
+ initContextGLEW();
#ifndef NDEBUG
reportContextString("Vendor", m_dummyVendor, reinterpret_cast<const
char*>(glGetString(GL_VENDOR)));
Modified:
branches/soc-2013-viewport_fx/source/blender/blenfont/intern/blf_glyph.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/blenfont/intern/blf_glyph.c
2013-07-29 23:31:46 UTC (rev 58732)
+++ branches/soc-2013-viewport_fx/source/blender/blenfont/intern/blf_glyph.c
2013-07-30 04:55:39 UTC (rev 58733)
@@ -187,12 +187,23 @@
glGenTextures(1, &gc->textures[gc->cur_tex]);
gpuBindTexture(GL_TEXTURE_2D, (font->tex_bind_state =
gc->textures[gc->cur_tex]));
+GPU_CHECK_NO_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+GPU_CHECK_NO_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+GPU_CHECK_NO_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+GPU_CHECK_NO_ERROR();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+GPU_CHECK_NO_ERROR();
+#if defined(WITH_GL_PROFILE_CORE)
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, gc->p2_width, gc->p2_height, 0,
GL_RED, GL_UNSIGNED_BYTE, buf);
+#elif defined(WITH_GL_PROFILE_COMPAT || WITH_GL_PROFILE_ES20)
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, gc->p2_width, gc->p2_height,
0, GL_ALPHA, GL_UNSIGNED_BYTE, buf);
+#endif
+
+GPU_CHECK_NO_ERROR();
MEM_freeN((void *)buf);
}
@@ -412,14 +423,17 @@
*needs_end = FALSE;
}
+GPU_CHECK_NO_ERROR();
if (font->max_tex_size == -1)
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint
*)&font->max_tex_size);
+GPU_CHECK_NO_ERROR();
if (gc->cur_tex == -1) {
blf_glyph_cache_texture(font, gc);
gc->x_offs = gc->pad;
gc->y_offs = 0;
}
+GPU_CHECK_NO_ERROR();
if (gc->x_offs > (gc->p2_width - gc->max_glyph_width)) {
gc->x_offs = gc->pad;
@@ -448,11 +462,15 @@
}
+GPU_CHECK_NO_ERROR();
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
+GPU_CHECK_NO_ERROR();
gpuBindTexture(GL_TEXTURE_2D, g->tex);
+#if defined(WITH_GL_PROFILE_CORE)
+ glTexSubImage2D(GL_TEXTURE_2D, 0, g->xoff, g->yoff, g->width,
g->height, GL_RED, GL_UNSIGNED_BYTE, g->bitmap);
+#else
glTexSubImage2D(GL_TEXTURE_2D, 0, g->xoff, g->yoff, g->width,
g->height, GL_ALPHA, GL_UNSIGNED_BYTE, g->bitmap);
-
+#endif
glPixelStorei(GL_UNPACK_ALIGNMENT, 4); /* restore default value
*/ //-V112
g->uv[0][0] = ((float)g->xoff) / ((float)gc->p2_width);
Modified:
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.c
2013-07-29 23:31:46 UTC (rev 58732)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspectfuncs.c
2013-07-30 04:55:39 UTC (rev 58733)
@@ -40,8 +40,15 @@
static GLboolean begin_font(GLvoid* UNUSED(param), const GLvoid*
UNUSED(object))
{
-#if defined(WITH_GL_PROFILE_CORE) || defined(WITH_GL_PROFILE_ES20)
+#if defined(WITH_GL_PROFILE_CORE)
if (GPU_PROFILE_CORE || GPU_PROFILE_ES20) {
+ gpu_set_shader_es(&shader_redtexture_info, 0);
+ gpu_glUseProgram(shader_redtexture);
+ }
+#endif
+
+#if defined(WITH_GL_PROFILE_ES20)
+ if (GPU_PROFILE_CORE || GPU_PROFILE_ES20) {
gpu_set_shader_es(&shader_alphatexture_info, 0);
gpu_glUseProgram(shader_alphatexture);
}
Modified:
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extension_wrapper.c
===================================================================
---
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extension_wrapper.c
2013-07-29 23:31:46 UTC (rev 58732)
+++
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extension_wrapper.c
2013-07-30 04:55:39 UTC (rev 58733)
@@ -336,26 +336,50 @@
}
}
-static const void* GLAPIENTRY GPU_buffer_start_update_buffer(GLenum target,
GLsizeiptr size, const GLvoid* data, GLenum usage)
+static void* GLAPIENTRY GPU_buffer_start_update_client(GLenum target,
GLsizeiptr size, GLvoid* data, GLenum usage)
{
+ return data;
+}
+
+static void* GLAPIENTRY GPU_buffer_start_update_buffer(GLenum target,
GLsizeiptr size, GLvoid* data, GLenum usage)
+{
+GPU_CHECK_NO_ERROR();
gpu_glBufferData(target, 0, NULL, usage);
+GPU_CHECK_NO_ERROR();
return data;
}
-static const void* GLAPIENTRY GPU_buffer_start_update_map(GLenum target,
GLsizeiptr size, const GLvoid* data, GLenum usage)
+static void* GLAPIENTRY GPU_buffer_start_update_map(GLenum target, GLsizeiptr
size, GLvoid* data, GLenum usage)
{
+ void* mapped;
+GPU_CHECK_NO_ERROR();
gpu_glBufferData(target, size, NULL, usage);
- return gpu_glMapBuffer(target, GL_WRITE_ONLY);
+GPU_CHECK_NO_ERROR();
+ mapped = gpu_glMapBuffer(target, GL_WRITE_ONLY);
+GPU_CHECK_NO_ERROR();
+GPU_ASSERT(mapped != NULL);
+ return mapped;
}
-static void GLAPIENTRY GPU_buffer_finish_update_buffer(GLenum target,
GLsizeiptr size, const GLvoid* data, GLenum usage)
+static const void* GLAPIENTRY GPU_buffer_finish_update_client(GLenum target,
GLsizeiptr size, const GLvoid* data, GLenum usage)
{
+ return data;
+}
+
+static const void* GLAPIENTRY GPU_buffer_finish_update_buffer(GLenum target,
GLsizeiptr size, const GLvoid* data, GLenum usage)
+{
+GPU_CHECK_NO_ERROR();
gpu_glBufferData(target, size, data, usage);
+GPU_CHECK_NO_ERROR();
+ return NULL;
}
-static void GLAPIENTRY GPU_buffer_finish_update_map(GLenum target, GLsizeiptr
size, const GLvoid* data, GLenum usage)
+static const void* GLAPIENTRY GPU_buffer_finish_update_map(GLenum target,
GLsizeiptr size, const GLvoid* data, GLenum usage)
{
+GPU_CHECK_NO_ERROR();
gpu_glUnmapBuffer(target);
+GPU_CHECK_NO_ERROR();
+ return NULL;
}
void GPU_wrap_extensions(GLboolean* glslsupport_out, GLboolean*
framebuffersupport_out)
@@ -373,12 +397,16 @@
init_generate_mipmap();
- if(gpu_glMapBuffer) {
+ if (gpu_glBufferData != NULL && gpu_glMapBuffer != NULL) {
GPU_buffer_start_update = GPU_buffer_start_update_map;
GPU_buffer_finish_update = GPU_buffer_finish_update_map;
}
- else {
+ else if (gpu_glBufferData != NULL) {
GPU_buffer_start_update = GPU_buffer_start_update_buffer;
GPU_buffer_finish_update = GPU_buffer_finish_update_buffer;
}
+ else {
+ GPU_buffer_start_update = GPU_buffer_start_update_client;
+ GPU_buffer_finish_update = GPU_buffer_finish_update_client;
+ }
}
Modified:
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extension_wrapper.h
===================================================================
---
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extension_wrapper.h
2013-07-29 23:31:46 UTC (rev 58732)
+++
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_extension_wrapper.h
2013-07-30 04:55:39 UTC (rev 58733)
@@ -255,8 +255,8 @@
GPUFUNC void * (GLAPIENTRY* gpu_glMapBuffer)(GLenum target, GLenum access);
GPUFUNC GLboolean (GLAPIENTRY* gpu_glUnmapBuffer)(GLenum target);
-GPUFUNC const void * (GLAPIENTRY* GPU_buffer_start_update)(GLenum target,
GLsizeiptr size, const GLvoid * data, GLenum usage);
-GPUFUNC void (GLAPIENTRY* GPU_buffer_finish_update)(GLenum target, GLsizeiptr
size, const GLvoid * data, GLenum usage);
+GPUFUNC void* (GLAPIENTRY* GPU_buffer_start_update )(GLenum target,
GLsizeiptr size, GLvoid* data, GLenum usage);
+GPUFUNC const void* (GLAPIENTRY* GPU_buffer_finish_update)(GLenum target,
GLsizeiptr size, const GLvoid* data, GLenum usage);
void GPU_wrap_extensions(GLboolean* glslsupport_out, GLboolean*
framebuffersupport_out);
Modified:
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.c
2013-07-29 23:31:46 UTC (rev 58732)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_immediate.c
2013-07-30 04:55:39 UTC (rev 58733)
@@ -157,8 +157,6 @@
GPUimmediate* immediate =
(GPUimmediate*)MEM_callocN(sizeof(GPUimmediate),
"GPUimmediate");
- GPU_ASSERT(immediate);
-
immediate->format.vertexSize = 3;
immediate->copyVertex = gpu_copy_vertex;
@@ -430,9 +428,9 @@
if (GPU_IMMEDIATE->mode != GL_NOOP) {
GPU_IMMEDIATE->endBuffer();
- GPU_IMMEDIATE->buffer = NULL;
- GPU_IMMEDIATE->offset = 0;
- GPU_IMMEDIATE->count = 1; /* count the vertex that triggered
this */
+ GPU_IMMEDIATE->mappedBuffer = NULL;
+ GPU_IMMEDIATE->offset = 0;
+ GPU_IMMEDIATE->count = 1; /* count the vertex that
triggered this */
GPU_IMMEDIATE->beginBuffer();
@@ -450,7 +448,7 @@
size_t i;
size_t size;
size_t offset;
- char *restrict buffer;
+ GLubyte *restrict mappedBuffer;
#if GPU_SAFETY
{
@@ -474,20 +472,20 @@
@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs