Nux

Merge lp:~nick-dedekind/nux/lp1066788.cached-texture-pointers into lp:nux

Proposed by Nick Dedekind
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 692
Merged at revision: 695
Proposed branch: lp:~nick-dedekind/nux/lp1066788.cached-texture-pointers
Merge into: lp:nux
Diff against target: 72 lines (+14/-2)
2 files modified
NuxGraphics/GLTextureResourceManager.cpp (+12/-0)
NuxGraphics/GpuDevice.h (+2/-2)
To merge this branch: bzr merge lp:~nick-dedekind/nux/lp1066788.cached-texture-pointers
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Brandon Schaefer (community) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+131172@code.launchpad.net

Commit message

Added pointer checks for invalid cached textures (LP: #1066788)

Description of the change

Added pointer checks for invalid cached textures (LP: #1066788)

To post a comment you must log in.
692. By Nick Dedekind

updated GpuInfo const functions.

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Looks good.

review: Approve
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) :
review: Approve
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

This one seems easy to replicate and add a test for not triggering the crash anymore, isn't it?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NuxGraphics/GLTextureResourceManager.cpp'
2--- NuxGraphics/GLTextureResourceManager.cpp 2012-09-26 06:44:12 +0000
3+++ NuxGraphics/GLTextureResourceManager.cpp 2012-10-25 07:16:22 +0000
4@@ -383,6 +383,8 @@
5
6 bool CachedBaseTexture::RecreateTexture(BaseTexture* Source)
7 {
8+ if (!m_Texture)
9+ return false;
10 int CurrentWidth = m_Texture->GetWidth();
11 int CurrentHeight = m_Texture->GetHeight();
12 int CurrentDepth = m_Texture->GetDepth();
13@@ -463,6 +465,8 @@
14 {
15 SURFACE_LOCKED_RECT LockedRect;
16 ObjectPtr < IOpenGLTexture2D > Texture2D = m_Texture; //m_Texture.CastRef<IOpenGLTexture2D>();
17+ if (!Texture2D)
18+ return;
19
20 OGL_CALL(Texture2D->LockRect(MipLevel, &LockedRect, NULL));
21 SourceTexture->GetData(LockedRect.pBits, MipLevel, LockedRect.Pitch);
22@@ -600,6 +604,8 @@
23 {
24 SURFACE_LOCKED_RECT LockedRect;
25 ObjectPtr <IOpenGLRectangleTexture> TextureRectangle = m_Texture; //m_Texture.CastRef<IOpenGLRectangleTexture>();
26+ if (!TextureRectangle)
27+ return;
28
29 OGL_CALL(TextureRectangle->LockRect( MipLevel, &LockedRect, NULL));
30 SourceTexture->GetData( LockedRect.pBits, MipLevel, LockedRect.Pitch );
31@@ -735,6 +741,8 @@
32 {
33 SURFACE_LOCKED_RECT LockedRect;
34 ObjectPtr <IOpenGLCubeTexture> CubemapTexture = m_Texture; //m_Texture.CastRef<IOpenGLCubeTexture>();
35+ if (!CubemapTexture)
36+ return;
37
38 for (int face = CUBEMAP_FACE_POSITIVE_X; face < GL_TEXTURE_CUBE_MAP_NEGATIVE_Z + 1; face++)
39 {
40@@ -898,6 +906,8 @@
41 {
42 VOLUME_LOCKED_BOX LockedBox;
43 ObjectPtr <IOpenGLVolumeTexture> VolumeTexture = m_Texture; //m_Texture.CastRef<IOpenGLVolumeTexture>();
44+ if (!VolumeTexture)
45+ return;
46 //TextureVolume* Source = UpCastResource<TextureVolume, BaseTexture>(SourceTexture);
47
48 //for(int slice = 0; slice < ImageSurface::GetLevelDim(Source->GetFormat(), Source->GetDepth(), MipLevel); slice++)
49@@ -1056,6 +1066,8 @@
50 {
51 SURFACE_LOCKED_RECT LockedRect;
52 ObjectPtr <IOpenGLAnimatedTexture> AnimatedTexture = m_Texture; //m_Texture.CastRef<IOpenGLAnimatedTexture>();
53+ if (!AnimatedTexture)
54+ return;
55 TextureFrameAnimation* Source = UpCastResource<TextureFrameAnimation, BaseTexture> (SourceTexture);
56
57 for (int frame = 0; frame < Source->GetDepth(); frame++)
58
59=== modified file 'NuxGraphics/GpuDevice.h'
60--- NuxGraphics/GpuDevice.h 2012-10-10 22:46:50 +0000
61+++ NuxGraphics/GpuDevice.h 2012-10-25 07:16:22 +0000
62@@ -113,8 +113,8 @@
63 bool Support_ARB_Framebuffer_sRGB() const {return _support_arb_framebuffer_srgb;}
64 #endif
65
66- int GetMaxFboAttachment() {return _opengl_max_fb_attachment;}
67- int GetMaxTextureSize() {return _opengl_max_texture_size;}
68+ int GetMaxFboAttachment() const {return _opengl_max_fb_attachment;}
69+ int GetMaxTextureSize() const {return _opengl_max_texture_size;}
70
71
72 private:

Subscribers

People subscribed via source and target branches