Nux

Merge lp:~loic.molinari/nux/nux-make-sure-implementation-dependant-feature-are-not-used-in-init-paths into lp:nux

Proposed by Loïc Molinari on 2011-03-17
Status: Merged
Merged at revision: 282
Proposed branch: lp:~loic.molinari/nux/nux-make-sure-implementation-dependant-feature-are-not-used-in-init-paths
Merge into: lp:nux
Diff against target: 25 lines (+12/-3)
1 file modified
NuxGraphics/GraphicsEngine.cpp (+12/-3)
To merge this branch: bzr merge lp:~loic.molinari/nux/nux-make-sure-implementation-dependant-feature-are-not-used-in-init-paths
Reviewer Review Type Date Requested Status
Jay Taoko (community) 2011-03-17 Approve on 2011-03-17
Review via email: mp+53869@code.launchpad.net

Description of the change

unity_support_test uses DisplayAccessController::CreateGLWindow() to create the OpenGL context. The point of this tool is to check that the OpenGL implementation supports the features required by Unity. The problem is that this function implies the creation of vertex/fragment shaders and framebuffer objects with no check to prevent the creation of these implementation dependent resources. Depending on the OpenGL implementation, when these features are not available, the tool crashes because of that.

This branch fixes the issue by added the required checks.

To post a comment you must log in.
Tim Penhey (thumper) wrote :

On Fri, 18 Mar 2011 07:21:51 you wrote:
> + if ((gpu_info.Support_ARB_Vertex_Shader () &&
> gpu_info.Support_ARB_Fragment_Shader ()) + ||
> (gpu_info.Support_ARB_Vertex_Shader () &&
> gpu_info.Support_ARB_Fragment_Shader ()))

This statement checks the same things twice.

like: if ((a && b) || (a && b))

280. By Loïc Molinari on 2011-03-17

Fixed redundant caps check

Loïc Molinari (loic.molinari) wrote :

Oops, silly copy-paste typo. Thanks for the review Tim!

Jay Taoko (jaytaoko) wrote :

Approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NuxGraphics/GraphicsEngine.cpp'
2--- NuxGraphics/GraphicsEngine.cpp 2011-03-16 21:57:53 +0000
3+++ NuxGraphics/GraphicsEngine.cpp 2011-03-17 21:41:35 +0000
4@@ -272,9 +272,18 @@
5 fnt->UnReference ();
6 }
7 #endif
8- _font_renderer = new FontRenderer (*this);
9-
10- _offscreen_fbo = GetGpuDevice()->CreateFrameBufferObject ();
11+
12+ GpuInfo& gpu_info = _graphics_display.GetGpuDevice ()->GetGpuInfo ();
13+
14+ if ((gpu_info.Support_ARB_Vertex_Program () && gpu_info.Support_ARB_Fragment_Program ())
15+ || (gpu_info.Support_ARB_Vertex_Shader () && gpu_info.Support_ARB_Fragment_Shader ()))
16+ {
17+ _font_renderer = new FontRenderer (*this);
18+ }
19+
20+ if (gpu_info.Support_EXT_Framebuffer_Object ())
21+ _offscreen_fbo = GetGpuDevice()->CreateFrameBufferObject ();
22+
23 _offscreen_color_rt0 = GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8);
24 _offscreen_color_rt1 = GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8);
25 _offscreen_color_rt2 = GetGpuDevice()->CreateTexture(2, 2, 1, BITFMT_R8G8B8A8);

Subscribers

People subscribed via source and target branches