Merge lp:~mc-return/compiz/compiz.merge-opengl-cleanup into lp:compiz/0.9.11
- compiz.merge-opengl-cleanup
- Merge into 0.9.11
Status: | Work in progress |
---|---|
Proposed branch: | lp:~mc-return/compiz/compiz.merge-opengl-cleanup |
Merge into: | lp:compiz/0.9.11 |
Diff against target: |
6177 lines (+1581/-1449) 26 files modified
plugins/opengl/include/opengl/doublebuffer.h (+14/-8) plugins/opengl/include/opengl/opengl.h (+136/-133) plugins/opengl/include/opengl/program.h (+38/-16) plugins/opengl/include/opengl/programcache.h (+2/-1) plugins/opengl/include/opengl/texture.h (+11/-5) plugins/opengl/include/opengl/vector.h (+6/-2) plugins/opengl/src/blacklist/blacklist.cpp (+8/-6) plugins/opengl/src/blacklist/blacklist.h (+4/-2) plugins/opengl/src/doublebuffer/src/double-buffer.cpp (+2/-4) plugins/opengl/src/framebufferobject.cpp (+26/-21) plugins/opengl/src/fsregion/fsregion.cpp (+9/-11) plugins/opengl/src/fsregion/fsregion.h (+10/-4) plugins/opengl/src/matrix.cpp (+24/-22) plugins/opengl/src/opengl.cpp (+12/-10) plugins/opengl/src/paint.cpp (+242/-260) plugins/opengl/src/privates.h (+99/-85) plugins/opengl/src/privatetexture.h (+17/-6) plugins/opengl/src/privatevertexbuffer.h (+47/-39) plugins/opengl/src/program.cpp (+46/-36) plugins/opengl/src/programcache.cpp (+29/-34) plugins/opengl/src/screen.cpp (+484/-453) plugins/opengl/src/shadercache.cpp (+53/-47) plugins/opengl/src/texture.cpp (+70/-61) plugins/opengl/src/vector.cpp (+35/-33) plugins/opengl/src/vertexbuffer.cpp (+108/-106) plugins/opengl/src/window.cpp (+49/-44) |
To merge this branch: | bzr merge lp:~mc-return/compiz/compiz.merge-opengl-cleanup |
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Compiz Maintainers | Pending | ||
Review via email: mp+176724@code.launchpad.net |
Commit message
*OpenGL plugin, cleanup:
Bail out of functions ASAP, do not calculate stuff you might not need.
Merged if condition checks.
Use pre- instead of postfix de- and increments.
Declare variables outside of loops.
Declarations and assignment of local variables in one line.
Removed redundant brackets.
Removed and added newlines for better readability.
Fixed indentation.
Fixed a few typos in comments and debug-messages.
Added TODO comment.
*OpenGL plugin, fixes:
framebufferobje
Also initialize the non-static struct member "rbStencilId" in the
PrivateGLFrameb
(LP: #1101410)
screen.cpp:
Initialize all the non-static class member fields (glxPixmapFBCon
lastViewport) and members (filter, saveWindow) in the PrivateGLScreen::
PrivateGLScreen (GLScreen *) constructor.
(LP: #1101408)
texture.cpp:
Also initialize the non-static class members "x11Pixmap" and "source" in
the TfpTexture:
(LP: #1101594)
vertexbuffer.cpp:
Also initialize the non-static class members "color", "primitiveType" and
"usage" in the PrivateVertexBu
(LP: #1101493)
Description of the change
Unmerged revisions
- 3688. By MC Return
-
Merged latest lp:compiz
- 3687. By MC Return
-
Merged latest lp:compiz and fixed conflict in plugins/
opengl/ src/paint. cpp - 3686. By MC Return
-
framebufferobje
ct.cpp:
Also initialize the non-static struct member "rbStencilId" in the
PrivateGLFramebufferObject: :PrivateGLFrame bufferObject () constructor
(LP: #1101410)Removed alignment in the ctor
- 3685. By MC Return
-
screen.cpp:
Initialize all the non-static class member fields (glxPixmapFBConfigs,
lastViewport) and members (filter, saveWindow) in the PrivateGLScreen::
PrivateGLScreen (GLScreen *) constructor
(LP: #1101408)Reverted alignment in the constructor
- 3684. By MC Return
-
Also initialize the non-static class members "color", "primitiveType" and
"usage" in the PrivateVertexBuffer::PrivateVe rtexBuffer () constructor
(LP: #1101493) - 3683. By MC Return
-
texture.cpp:
Also initialize the non-static class members "x11Pixmap" and "source" in
the TfpTexture::TfpTexture () ctor (LP: #1101594) - 3682. By MC Return
-
Indentation fixes
Re-added "lost" code in paint.cpp - 3681. By MC Return
-
Removed bracket (typo)
- 3680. By MC Return
-
Merged latest lp:compiz and fixed conflict in plugins/
opengl/ src/window. cpp - 3679. By MC Return
-
Added missing " | NoOcclusionDete
ction"
Preview Diff
1 | === modified file 'plugins/opengl/include/opengl/doublebuffer.h' | |||
2 | --- plugins/opengl/include/opengl/doublebuffer.h 2012-11-08 09:17:39 +0000 | |||
3 | +++ plugins/opengl/include/opengl/doublebuffer.h 2013-07-24 16:05:45 +0000 | |||
4 | @@ -18,16 +18,17 @@ | |||
5 | 18 | class DoubleBuffer | 18 | class DoubleBuffer |
6 | 19 | { | 19 | { |
7 | 20 | public: | 20 | public: |
8 | 21 | |||
9 | 21 | DoubleBuffer (const impl::GLXSwapIntervalEXTFunc &swapIntervalFunc, | 22 | DoubleBuffer (const impl::GLXSwapIntervalEXTFunc &swapIntervalFunc, |
10 | 22 | const impl::GLXWaitVideoSyncSGIFunc &waitVideoSyncFunc); | 23 | const impl::GLXWaitVideoSyncSGIFunc &waitVideoSyncFunc); |
11 | 23 | virtual ~DoubleBuffer (); | 24 | virtual ~DoubleBuffer (); |
12 | 24 | 25 | ||
17 | 25 | virtual void swap () const = 0; | 26 | virtual void swap () const = 0; |
18 | 26 | virtual bool blitAvailable () const = 0; | 27 | virtual bool blitAvailable () const = 0; |
19 | 27 | virtual void blit (const CompRegion ®ion) const = 0; | 28 | virtual void blit (const CompRegion ®ion) const = 0; |
20 | 28 | virtual bool fallbackBlitAvailable () const = 0; | 29 | virtual bool fallbackBlitAvailable () const = 0; |
21 | 29 | virtual void fallbackBlit (const CompRegion ®ion) const = 0; | 30 | virtual void fallbackBlit (const CompRegion ®ion) const = 0; |
23 | 30 | virtual void copyFrontToBack () const = 0; | 31 | virtual void copyFrontToBack () const = 0; |
24 | 31 | 32 | ||
25 | 32 | typedef enum | 33 | typedef enum |
26 | 33 | { | 34 | { |
27 | @@ -56,13 +57,18 @@ | |||
28 | 56 | FrameThrottledInternally | 57 | FrameThrottledInternally |
29 | 57 | } FrameThrottleState; | 58 | } FrameThrottleState; |
30 | 58 | 59 | ||
33 | 59 | void set (Setting name, bool value); | 60 | void set (Setting name, |
34 | 60 | void render (const CompRegion ®ion, bool fullscreen); | 61 | bool value); |
35 | 62 | |||
36 | 63 | void render (const CompRegion ®ion, | ||
37 | 64 | bool fullscreen); | ||
38 | 65 | |||
39 | 61 | void vsync (FrontbufferRedrawType redrawType); | 66 | void vsync (FrontbufferRedrawType redrawType); |
40 | 62 | 67 | ||
41 | 63 | bool hardwareVSyncFunctional (); | 68 | bool hardwareVSyncFunctional (); |
42 | 64 | 69 | ||
43 | 65 | protected: | 70 | protected: |
44 | 71 | |||
45 | 66 | bool setting[_NSETTINGS]; | 72 | bool setting[_NSETTINGS]; |
46 | 67 | 73 | ||
47 | 68 | private: | 74 | private: |
48 | @@ -72,7 +78,7 @@ | |||
49 | 72 | virtual bool enableBlockingVideoSync (FrontbufferRedrawType, FrameThrottleState &); | 78 | virtual bool enableBlockingVideoSync (FrontbufferRedrawType, FrameThrottleState &); |
50 | 73 | virtual void disableBlockingVideoSync (); | 79 | virtual void disableBlockingVideoSync (); |
51 | 74 | 80 | ||
53 | 75 | SyncType syncType; | 81 | SyncType syncType; |
54 | 76 | 82 | ||
55 | 77 | FrameThrottleState bufferFrameThrottleState; | 83 | FrameThrottleState bufferFrameThrottleState; |
56 | 78 | unsigned int blockingVSyncUnthrottledFrames; | 84 | unsigned int blockingVSyncUnthrottledFrames; |
57 | 79 | 85 | ||
58 | === modified file 'plugins/opengl/include/opengl/opengl.h' | |||
59 | --- plugins/opengl/include/opengl/opengl.h 2013-04-27 05:54:57 +0000 | |||
60 | +++ plugins/opengl/include/opengl/opengl.h 2013-07-24 16:05:45 +0000 | |||
61 | @@ -87,77 +87,79 @@ | |||
62 | 87 | class PrivateGLScreen; | 87 | class PrivateGLScreen; |
63 | 88 | class PrivateGLWindow; | 88 | class PrivateGLWindow; |
64 | 89 | 89 | ||
66 | 90 | extern GLushort defaultColor[4]; | 90 | extern GLushort defaultColor[4]; |
67 | 91 | 91 | ||
68 | 92 | #ifndef GLX_EXT_texture_from_pixmap | 92 | #ifndef GLX_EXT_texture_from_pixmap |
87 | 93 | #define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 | 93 | #define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 |
88 | 94 | #define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 | 94 | #define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 |
89 | 95 | #define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 | 95 | #define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 |
90 | 96 | #define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 | 96 | #define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 |
91 | 97 | #define GLX_Y_INVERTED_EXT 0x20D4 | 97 | #define GLX_Y_INVERTED_EXT 0x20D4 |
92 | 98 | #define GLX_TEXTURE_FORMAT_EXT 0x20D5 | 98 | #define GLX_TEXTURE_FORMAT_EXT 0x20D5 |
93 | 99 | #define GLX_TEXTURE_TARGET_EXT 0x20D6 | 99 | #define GLX_TEXTURE_TARGET_EXT 0x20D6 |
94 | 100 | #define GLX_MIPMAP_TEXTURE_EXT 0x20D7 | 100 | #define GLX_MIPMAP_TEXTURE_EXT 0x20D7 |
95 | 101 | #define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 | 101 | #define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 |
96 | 102 | #define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 | 102 | #define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 |
97 | 103 | #define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA | 103 | #define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA |
98 | 104 | #define GLX_TEXTURE_1D_BIT_EXT 0x00000001 | 104 | #define GLX_TEXTURE_1D_BIT_EXT 0x00000001 |
99 | 105 | #define GLX_TEXTURE_2D_BIT_EXT 0x00000002 | 105 | #define GLX_TEXTURE_2D_BIT_EXT 0x00000002 |
100 | 106 | #define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 | 106 | #define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 |
101 | 107 | #define GLX_TEXTURE_1D_EXT 0x20DB | 107 | #define GLX_TEXTURE_1D_EXT 0x20DB |
102 | 108 | #define GLX_TEXTURE_2D_EXT 0x20DC | 108 | #define GLX_TEXTURE_2D_EXT 0x20DC |
103 | 109 | #define GLX_TEXTURE_RECTANGLE_EXT 0x20DD | 109 | #define GLX_TEXTURE_RECTANGLE_EXT 0x20DD |
104 | 110 | #define GLX_FRONT_LEFT_EXT 0x20DE | 110 | #define GLX_FRONT_LEFT_EXT 0x20DE |
105 | 111 | #endif | 111 | #endif |
106 | 112 | 112 | ||
108 | 113 | namespace GL { | 113 | namespace GL |
109 | 114 | { | ||
110 | 114 | #ifdef USE_GLES | 115 | #ifdef USE_GLES |
127 | 115 | typedef EGLImageKHR (*EGLCreateImageKHRProc) (EGLDisplay dpy, | 116 | typedef EGLImageKHR (*EGLCreateImageKHRProc) (EGLDisplay dpy, |
128 | 116 | EGLContext ctx, | 117 | EGLContext ctx, |
129 | 117 | EGLenum target, | 118 | EGLenum target, |
130 | 118 | EGLClientBuffer buffer, | 119 | EGLClientBuffer buffer, |
131 | 119 | const EGLint *attrib_list); | 120 | const EGLint *attrib_list); |
132 | 120 | typedef EGLBoolean (*EGLDestroyImageKHRProc) (EGLDisplay dpy, | 121 | |
133 | 121 | EGLImageKHR image); | 122 | typedef EGLBoolean (*EGLDestroyImageKHRProc) (EGLDisplay dpy, |
134 | 122 | 123 | EGLImageKHR image); | |
135 | 123 | typedef void (*GLEGLImageTargetTexture2DOESProc) (GLenum target, | 124 | |
136 | 124 | GLeglImageOES image); | 125 | typedef void (*GLEGLImageTargetTexture2DOESProc) (GLenum target, |
137 | 125 | 126 | GLeglImageOES image); | |
138 | 126 | typedef EGLBoolean (*EGLPostSubBufferNVProc) (EGLDisplay dpy, | 127 | |
139 | 127 | EGLSurface surface, | 128 | typedef EGLBoolean (*EGLPostSubBufferNVProc) (EGLDisplay dpy, |
140 | 128 | EGLint x, EGLint y, | 129 | EGLSurface surface, |
141 | 129 | EGLint width, EGLint height); | 130 | EGLint x, |
142 | 130 | 131 | EGLint y, | |
143 | 132 | EGLint width, | ||
144 | 133 | EGLint height); | ||
145 | 131 | #else | 134 | #else |
146 | 132 | typedef void (*FuncPtr) (void); | 135 | typedef void (*FuncPtr) (void); |
147 | 133 | 136 | ||
148 | 134 | typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName); | 137 | typedef FuncPtr (*GLXGetProcAddressProc) (const GLubyte *procName); |
149 | 135 | 138 | ||
175 | 136 | typedef void (*GLXBindTexImageProc) (Display *display, | 139 | typedef void (*GLXBindTexImageProc) (Display *display, |
176 | 137 | GLXDrawable drawable, | 140 | GLXDrawable drawable, |
177 | 138 | int buffer, | 141 | int buffer, |
178 | 139 | int *attribList); | 142 | int *attribList); |
179 | 140 | typedef void (*GLXReleaseTexImageProc) (Display *display, | 143 | typedef void (*GLXReleaseTexImageProc) (Display *display, |
180 | 141 | GLXDrawable drawable, | 144 | GLXDrawable drawable, |
181 | 142 | int buffer); | 145 | int buffer); |
182 | 143 | typedef void (*GLXQueryDrawableProc) (Display *display, | 146 | typedef void (*GLXQueryDrawableProc) (Display *display, |
183 | 144 | GLXDrawable drawable, | 147 | GLXDrawable drawable, |
184 | 145 | int attribute, | 148 | int attribute, |
185 | 146 | unsigned int *value); | 149 | unsigned int *value); |
186 | 147 | 150 | ||
187 | 148 | typedef void (*GLXCopySubBufferProc) (Display *display, | 151 | typedef void (*GLXCopySubBufferProc) (Display *display, |
188 | 149 | GLXDrawable drawable, | 152 | GLXDrawable drawable, |
189 | 150 | int x, | 153 | int x, |
190 | 151 | int y, | 154 | int y, |
191 | 152 | int width, | 155 | int width, |
192 | 153 | int height); | 156 | int height); |
193 | 154 | 157 | ||
194 | 155 | typedef int (*GLXGetVideoSyncProc) (unsigned int *count); | 158 | typedef int (*GLXGetVideoSyncProc) (unsigned int *count); |
195 | 156 | typedef int (*GLXWaitVideoSyncProc) (int divisor, | 159 | typedef int (*GLXWaitVideoSyncProc) (int divisor, |
196 | 157 | int remainder, | 160 | int remainder, |
197 | 158 | unsigned int *count); | 161 | unsigned int *count); |
198 | 159 | typedef int (*GLXSwapIntervalProc) (int interval); | 162 | typedef int (*GLXSwapIntervalProc) (int interval); |
174 | 160 | |||
199 | 161 | 163 | ||
200 | 162 | #ifndef GLX_VERSION_1_3 | 164 | #ifndef GLX_VERSION_1_3 |
201 | 163 | typedef struct __GLXFBConfigRec *GLXFBConfig; | 165 | typedef struct __GLXFBConfigRec *GLXFBConfig; |
202 | @@ -413,102 +415,102 @@ | |||
203 | 413 | extern GLDisableVertexAttribArrayProc disableVertexAttribArray; | 415 | extern GLDisableVertexAttribArrayProc disableVertexAttribArray; |
204 | 414 | extern GLVertexAttribPointerProc vertexAttribPointer; | 416 | extern GLVertexAttribPointerProc vertexAttribPointer; |
205 | 415 | 417 | ||
209 | 416 | extern GLGenRenderbuffersProc genRenderbuffers; | 418 | extern GLGenRenderbuffersProc genRenderbuffers; |
210 | 417 | extern GLDeleteRenderbuffersProc deleteRenderbuffers; | 419 | extern GLDeleteRenderbuffersProc deleteRenderbuffers; |
211 | 418 | extern GLBindRenderbufferProc bindRenderbuffer; | 420 | extern GLBindRenderbufferProc bindRenderbuffer; |
212 | 419 | extern GLFramebufferRenderbufferProc framebufferRenderbuffer; | 421 | extern GLFramebufferRenderbufferProc framebufferRenderbuffer; |
214 | 420 | extern GLRenderbufferStorageProc renderbufferStorage; | 422 | extern GLRenderbufferStorageProc renderbufferStorage; |
215 | 421 | 423 | ||
216 | 422 | #ifndef USE_GLES | 424 | #ifndef USE_GLES |
218 | 423 | extern GLCreateShaderObjectARBProc createShaderObjectARB; | 425 | extern GLCreateShaderObjectARBProc createShaderObjectARB; |
219 | 424 | extern GLCreateProgramObjectARBProc createProgramObjectARB; | 426 | extern GLCreateProgramObjectARBProc createProgramObjectARB; |
229 | 425 | extern GLShaderSourceARBProc shaderSourceARB; | 427 | extern GLShaderSourceARBProc shaderSourceARB; |
230 | 426 | extern GLCompileShaderARBProc compileShaderARB; | 428 | extern GLCompileShaderARBProc compileShaderARB; |
231 | 427 | extern GLValidateProgramARBProc validateProgramARB; | 429 | extern GLValidateProgramARBProc validateProgramARB; |
232 | 428 | extern GLDeleteObjectARBProc deleteObjectARB; | 430 | extern GLDeleteObjectARBProc deleteObjectARB; |
233 | 429 | extern GLAttachObjectARBProc attachObjectARB; | 431 | extern GLAttachObjectARBProc attachObjectARB; |
234 | 430 | extern GLLinkProgramARBProc linkProgramARB; | 432 | extern GLLinkProgramARBProc linkProgramARB; |
235 | 431 | extern GLUseProgramObjectARBProc useProgramObjectARB; | 433 | extern GLUseProgramObjectARBProc useProgramObjectARB; |
236 | 432 | extern GLGetUniformLocationARBProc getUniformLocationARB; | 434 | extern GLGetUniformLocationARBProc getUniformLocationARB; |
237 | 433 | extern GLGetAttribLocationARBProc getAttribLocationARB; | 435 | extern GLGetAttribLocationARBProc getAttribLocationARB; |
238 | 434 | 436 | ||
239 | 435 | extern GLGetObjectParameterivProc getObjectParameteriv; | 437 | extern GLGetObjectParameterivProc getObjectParameteriv; |
241 | 436 | extern GLGetInfoLogProc getInfoLog; | 438 | extern GLGetInfoLogProc getInfoLog; |
242 | 437 | #endif | 439 | #endif |
243 | 438 | 440 | ||
244 | 439 | #ifdef USE_GLES | 441 | #ifdef USE_GLES |
245 | 440 | 442 | ||
246 | 441 | static const GLenum FRAMEBUFFER_BINDING = GL_FRAMEBUFFER_BINDING; | 443 | static const GLenum FRAMEBUFFER_BINDING = GL_FRAMEBUFFER_BINDING; |
253 | 442 | static const GLenum FRAMEBUFFER = GL_FRAMEBUFFER; | 444 | static const GLenum FRAMEBUFFER = GL_FRAMEBUFFER; |
254 | 443 | static const GLenum RENDERBUFFER = GL_RENDERBUFFER; | 445 | static const GLenum RENDERBUFFER = GL_RENDERBUFFER; |
255 | 444 | static const GLenum COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0; | 446 | static const GLenum COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0; |
256 | 445 | static const GLenum DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT; | 447 | static const GLenum DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT; |
257 | 446 | static const GLenum STENCIL_ATTACHMENT = GL_STENCIL_ATTACHMENT; | 448 | static const GLenum STENCIL_ATTACHMENT = GL_STENCIL_ATTACHMENT; |
258 | 447 | static const GLenum DEPTH24_STENCIL8 = GL_DEPTH24_STENCIL8_OES; | 449 | static const GLenum DEPTH24_STENCIL8 = GL_DEPTH24_STENCIL8_OES; |
259 | 448 | 450 | ||
260 | 449 | /* OpenGL|ES does not support different draw/read framebuffers */ | 451 | /* OpenGL|ES does not support different draw/read framebuffers */ |
265 | 450 | static const GLenum DRAW_FRAMEBUFFER = GL_FRAMEBUFFER; | 452 | static const GLenum DRAW_FRAMEBUFFER = GL_FRAMEBUFFER; |
266 | 451 | static const GLenum READ_FRAMEBUFFER = GL_FRAMEBUFFER; | 453 | static const GLenum READ_FRAMEBUFFER = GL_FRAMEBUFFER; |
267 | 452 | static const GLenum DRAW_FRAMEBUFFER_BINDING = FRAMEBUFFER_BINDING; | 454 | static const GLenum DRAW_FRAMEBUFFER_BINDING = FRAMEBUFFER_BINDING; |
268 | 453 | static const GLenum READ_FRAMEBUFFER_BINDING = FRAMEBUFFER_BINDING; | 455 | static const GLenum READ_FRAMEBUFFER_BINDING = FRAMEBUFFER_BINDING; |
269 | 454 | 456 | ||
273 | 455 | static const GLenum FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE; | 457 | static const GLenum FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE; |
274 | 456 | static const GLenum FRAMEBUFFER_UNDEFINED = 0; | 458 | static const GLenum FRAMEBUFFER_UNDEFINED = 0; |
275 | 457 | static const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; | 459 | static const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; |
276 | 458 | static const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; | 460 | static const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; |
283 | 459 | static const GLenum FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0; | 461 | static const GLenum FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0; |
284 | 460 | static const GLenum FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0; | 462 | static const GLenum FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0; |
285 | 461 | static const GLenum FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED; | 463 | static const GLenum FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED; |
286 | 462 | static const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0; | 464 | static const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0; |
287 | 463 | static const GLenum FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0; | 465 | static const GLenum FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 0; |
288 | 464 | static const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; | 466 | static const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS; |
289 | 465 | 467 | ||
290 | 466 | static const GLenum ARRAY_BUFFER = GL_ARRAY_BUFFER; | 468 | static const GLenum ARRAY_BUFFER = GL_ARRAY_BUFFER; |
293 | 467 | static const GLenum STATIC_DRAW = GL_STATIC_DRAW; | 469 | static const GLenum STATIC_DRAW = GL_STATIC_DRAW; |
294 | 468 | static const GLenum STREAM_DRAW = GL_STREAM_DRAW; | 470 | static const GLenum STREAM_DRAW = GL_STREAM_DRAW; |
295 | 469 | static const GLenum DYNAMIC_DRAW = GL_DYNAMIC_DRAW; | 471 | static const GLenum DYNAMIC_DRAW = GL_DYNAMIC_DRAW; |
296 | 470 | 472 | ||
297 | 471 | static const GLenum INFO_LOG_LENGTH = GL_INFO_LOG_LENGTH; | 473 | static const GLenum INFO_LOG_LENGTH = GL_INFO_LOG_LENGTH; |
300 | 472 | static const GLenum COMPILE_STATUS = GL_COMPILE_STATUS; | 474 | static const GLenum COMPILE_STATUS = GL_COMPILE_STATUS; |
301 | 473 | static const GLenum LINK_STATUS = GL_LINK_STATUS; | 475 | static const GLenum LINK_STATUS = GL_LINK_STATUS; |
302 | 474 | static const GLenum FRAGMENT_SHADER = GL_FRAGMENT_SHADER; | 476 | static const GLenum FRAGMENT_SHADER = GL_FRAGMENT_SHADER; |
304 | 475 | static const GLenum VERTEX_SHADER = GL_VERTEX_SHADER; | 477 | static const GLenum VERTEX_SHADER = GL_VERTEX_SHADER; |
305 | 476 | 478 | ||
306 | 477 | #else | 479 | #else |
307 | 478 | 480 | ||
308 | 479 | static const GLenum FRAMEBUFFER_BINDING = GL_FRAMEBUFFER_BINDING_EXT; | 481 | static const GLenum FRAMEBUFFER_BINDING = GL_FRAMEBUFFER_BINDING_EXT; |
315 | 480 | static const GLenum FRAMEBUFFER = GL_FRAMEBUFFER_EXT; | 482 | static const GLenum FRAMEBUFFER = GL_FRAMEBUFFER_EXT; |
316 | 481 | static const GLenum RENDERBUFFER = GL_RENDERBUFFER; | 483 | static const GLenum RENDERBUFFER = GL_RENDERBUFFER; |
317 | 482 | static const GLenum COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0_EXT; | 484 | static const GLenum COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0_EXT; |
318 | 483 | static const GLenum DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT_EXT; | 485 | static const GLenum DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT_EXT; |
319 | 484 | static const GLenum STENCIL_ATTACHMENT = GL_STENCIL_ATTACHMENT_EXT; | 486 | static const GLenum STENCIL_ATTACHMENT = GL_STENCIL_ATTACHMENT_EXT; |
320 | 485 | static const GLenum DEPTH24_STENCIL8 = GL_DEPTH24_STENCIL8_EXT; | 487 | static const GLenum DEPTH24_STENCIL8 = GL_DEPTH24_STENCIL8_EXT; |
321 | 486 | 488 | ||
329 | 487 | static const GLenum DRAW_FRAMEBUFFER = GL_DRAW_FRAMEBUFFER_EXT; | 489 | static const GLenum DRAW_FRAMEBUFFER = GL_DRAW_FRAMEBUFFER_EXT; |
330 | 488 | static const GLenum READ_FRAMEBUFFER = GL_READ_FRAMEBUFFER_EXT; | 490 | static const GLenum READ_FRAMEBUFFER = GL_READ_FRAMEBUFFER_EXT; |
331 | 489 | static const GLenum DRAW_FRAMEBUFFER_BINDING = GL_DRAW_FRAMEBUFFER_BINDING_EXT; | 491 | static const GLenum DRAW_FRAMEBUFFER_BINDING = GL_DRAW_FRAMEBUFFER_BINDING_EXT; |
332 | 490 | static const GLenum READ_FRAMEBUFFER_BINDING = GL_READ_FRAMEBUFFER_BINDING_EXT; | 492 | static const GLenum READ_FRAMEBUFFER_BINDING = GL_READ_FRAMEBUFFER_BINDING_EXT; |
333 | 491 | static const GLenum FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE_EXT; | 493 | static const GLenum FRAMEBUFFER_COMPLETE = GL_FRAMEBUFFER_COMPLETE_EXT; |
334 | 492 | static const GLenum FRAMEBUFFER_UNDEFINED = GL_FRAMEBUFFER_UNDEFINED; | 494 | static const GLenum FRAMEBUFFER_UNDEFINED = GL_FRAMEBUFFER_UNDEFINED; |
335 | 493 | static const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT; | 495 | static const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT; |
336 | 494 | static const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT; | 496 | static const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT; |
343 | 495 | static const GLenum FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT; | 497 | static const GLenum FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT; |
344 | 496 | static const GLenum FRAMEBUFFER_INCOMPLETE_READ_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT; | 498 | static const GLenum FRAMEBUFFER_INCOMPLETE_READ_BUFFER = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT; |
345 | 497 | static const GLenum FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED_EXT; | 499 | static const GLenum FRAMEBUFFER_UNSUPPORTED = GL_FRAMEBUFFER_UNSUPPORTED_EXT; |
346 | 498 | static const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT; | 500 | static const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT; |
347 | 499 | static const GLenum FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT; | 501 | static const GLenum FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT; |
348 | 500 | static const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0; | 502 | static const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0; |
349 | 501 | 503 | ||
350 | 502 | static const GLenum ARRAY_BUFFER = GL_ARRAY_BUFFER_ARB; | 504 | static const GLenum ARRAY_BUFFER = GL_ARRAY_BUFFER_ARB; |
353 | 503 | static const GLenum STATIC_DRAW = GL_STATIC_DRAW_ARB; | 505 | static const GLenum STATIC_DRAW = GL_STATIC_DRAW_ARB; |
354 | 504 | static const GLenum STREAM_DRAW = GL_STREAM_DRAW_ARB; | 506 | static const GLenum STREAM_DRAW = GL_STREAM_DRAW_ARB; |
355 | 505 | static const GLenum DYNAMIC_DRAW = GL_DYNAMIC_DRAW_ARB; | 507 | static const GLenum DYNAMIC_DRAW = GL_DYNAMIC_DRAW_ARB; |
356 | 506 | 508 | ||
357 | 507 | static const GLenum INFO_LOG_LENGTH = GL_OBJECT_INFO_LOG_LENGTH_ARB; | 509 | static const GLenum INFO_LOG_LENGTH = GL_OBJECT_INFO_LOG_LENGTH_ARB; |
360 | 508 | static const GLenum COMPILE_STATUS = GL_OBJECT_COMPILE_STATUS_ARB; | 510 | static const GLenum COMPILE_STATUS = GL_OBJECT_COMPILE_STATUS_ARB; |
361 | 509 | static const GLenum LINK_STATUS = GL_OBJECT_LINK_STATUS_ARB; | 511 | static const GLenum LINK_STATUS = GL_OBJECT_LINK_STATUS_ARB; |
362 | 510 | static const GLenum FRAGMENT_SHADER = GL_FRAGMENT_SHADER_ARB; | 512 | static const GLenum FRAGMENT_SHADER = GL_FRAGMENT_SHADER_ARB; |
364 | 511 | static const GLenum VERTEX_SHADER = GL_VERTEX_SHADER_ARB; | 513 | static const GLenum VERTEX_SHADER = GL_VERTEX_SHADER_ARB; |
365 | 512 | 514 | ||
366 | 513 | #endif | 515 | #endif |
367 | 514 | 516 | ||
368 | @@ -553,7 +555,8 @@ | |||
369 | 553 | #endif | 555 | #endif |
370 | 554 | }; | 556 | }; |
371 | 555 | 557 | ||
373 | 556 | struct GLScreenPaintAttrib { | 558 | struct GLScreenPaintAttrib |
374 | 559 | { | ||
375 | 557 | GLfloat xRotate; | 560 | GLfloat xRotate; |
376 | 558 | GLfloat yRotate; | 561 | GLfloat yRotate; |
377 | 559 | GLfloat vRotate; | 562 | GLfloat vRotate; |
378 | @@ -566,7 +569,8 @@ | |||
379 | 566 | #define MAX_DEPTH 32 | 569 | #define MAX_DEPTH 32 |
380 | 567 | 570 | ||
381 | 568 | #ifndef USE_GLES | 571 | #ifndef USE_GLES |
383 | 569 | struct GLFBConfig { | 572 | struct GLFBConfig |
384 | 573 | { | ||
385 | 570 | GLXFBConfig fbConfig; | 574 | GLXFBConfig fbConfig; |
386 | 571 | int yInverted; | 575 | int yInverted; |
387 | 572 | int mipmap; | 576 | int mipmap; |
388 | @@ -647,9 +651,9 @@ | |||
389 | 647 | CompOutput *output, | 651 | CompOutput *output, |
390 | 648 | GLMatrix *mask); | 652 | GLMatrix *mask); |
391 | 649 | 653 | ||
393 | 650 | virtual void glEnableOutputClipping (const GLMatrix &, | 654 | virtual void glEnableOutputClipping (const GLMatrix &, |
394 | 651 | const CompRegion &, | 655 | const CompRegion &, |
396 | 652 | CompOutput *); | 656 | CompOutput *); |
397 | 653 | virtual void glDisableOutputClipping (); | 657 | virtual void glDisableOutputClipping (); |
398 | 654 | 658 | ||
399 | 655 | virtual GLMatrix *projectionMatrix (); | 659 | virtual GLMatrix *projectionMatrix (); |
400 | @@ -669,9 +673,9 @@ | |||
401 | 669 | /** | 673 | /** |
402 | 670 | * Hookable function used by plugins to determine stenciling mask | 674 | * Hookable function used by plugins to determine stenciling mask |
403 | 671 | */ | 675 | */ |
407 | 672 | virtual void glBufferStencil (const GLMatrix &matrix, | 676 | virtual void glBufferStencil (const GLMatrix &matrix, |
408 | 673 | GLVertexBuffer &vertexBuffer, | 677 | GLVertexBuffer &vertexBuffer, |
409 | 674 | CompOutput *output); | 678 | CompOutput *output); |
410 | 675 | 679 | ||
411 | 676 | }; | 680 | }; |
412 | 677 | 681 | ||
413 | @@ -925,7 +929,7 @@ | |||
414 | 925 | const GLTexture::List & textures () const; | 929 | const GLTexture::List & textures () const; |
415 | 926 | 930 | ||
416 | 927 | /** | 931 | /** |
418 | 928 | * Returns the matrices for the tiled textures for this windwo | 932 | * Returns the matrices for the tiled textures for this window |
419 | 929 | */ | 933 | */ |
420 | 930 | const GLTexture::MatrixList & matrices () const; | 934 | const GLTexture::MatrixList & matrices () const; |
421 | 931 | 935 | ||
422 | @@ -971,4 +975,3 @@ | |||
423 | 971 | }; | 975 | }; |
424 | 972 | 976 | ||
425 | 973 | #endif | 977 | #endif |
426 | 974 | |||
427 | 975 | 978 | ||
428 | === modified file 'plugins/opengl/include/opengl/program.h' | |||
429 | --- plugins/opengl/include/opengl/program.h 2012-05-17 10:41:21 +0000 | |||
430 | +++ plugins/opengl/include/opengl/program.h 2013-07-24 16:05:45 +0000 | |||
431 | @@ -40,6 +40,7 @@ | |||
432 | 40 | class GLProgram | 40 | class GLProgram |
433 | 41 | { | 41 | { |
434 | 42 | public: | 42 | public: |
435 | 43 | |||
436 | 43 | GLProgram (CompString &vertexShader, CompString &fragmentShader); | 44 | GLProgram (CompString &vertexShader, CompString &fragmentShader); |
437 | 44 | ~GLProgram (); | 45 | ~GLProgram (); |
438 | 45 | 46 | ||
439 | @@ -47,29 +48,50 @@ | |||
440 | 47 | void bind (); | 48 | void bind (); |
441 | 48 | void unbind (); | 49 | void unbind (); |
442 | 49 | 50 | ||
448 | 50 | bool setUniform (const char *name, GLfloat value); | 51 | bool setUniform (const char *name, |
449 | 51 | bool setUniform (const char *name, GLint value); | 52 | GLfloat value); |
450 | 52 | bool setUniform (const char *name, const GLMatrix &value); | 53 | |
451 | 53 | bool setUniform2f (const char *name, GLfloat x, GLfloat y); | 54 | bool setUniform (const char *name, |
452 | 54 | bool setUniform3f (const char *name, GLfloat x, GLfloat y, GLfloat z); | 55 | GLint value); |
453 | 56 | |||
454 | 57 | bool setUniform (const char *name, | ||
455 | 58 | const GLMatrix &value); | ||
456 | 59 | |||
457 | 60 | bool setUniform2f (const char *name, | ||
458 | 61 | GLfloat x, | ||
459 | 62 | GLfloat y); | ||
460 | 63 | |||
461 | 64 | bool setUniform3f (const char *name, | ||
462 | 65 | GLfloat x, | ||
463 | 66 | GLfloat y, | ||
464 | 67 | GLfloat z); | ||
465 | 68 | |||
466 | 55 | bool setUniform4f (const char *name, | 69 | bool setUniform4f (const char *name, |
473 | 56 | GLfloat x, | 70 | GLfloat x, |
474 | 57 | GLfloat y, | 71 | GLfloat y, |
475 | 58 | GLfloat z, | 72 | GLfloat z, |
476 | 59 | GLfloat w); | 73 | GLfloat w); |
477 | 60 | bool setUniform2i (const char *name, GLint x, GLint y); | 74 | |
478 | 61 | bool setUniform3i (const char *name, GLint x, GLint y, GLint z); | 75 | bool setUniform2i (const char *name, |
479 | 76 | GLint x, | ||
480 | 77 | GLint y); | ||
481 | 78 | |||
482 | 79 | bool setUniform3i (const char *name, | ||
483 | 80 | GLint x, | ||
484 | 81 | GLint y, | ||
485 | 82 | GLint z); | ||
486 | 83 | |||
487 | 62 | bool setUniform4i (const char *name, | 84 | bool setUniform4i (const char *name, |
492 | 63 | GLint x, | 85 | GLint x, |
493 | 64 | GLint y, | 86 | GLint y, |
494 | 65 | GLint z, | 87 | GLint z, |
495 | 66 | GLint w); | 88 | GLint w); |
496 | 67 | 89 | ||
497 | 68 | GLuint attributeLocation (const char *name); | 90 | GLuint attributeLocation (const char *name); |
498 | 69 | 91 | ||
499 | 70 | private: | 92 | private: |
500 | 93 | |||
501 | 71 | PrivateProgram *priv; | 94 | PrivateProgram *priv; |
502 | 72 | }; | 95 | }; |
503 | 73 | 96 | ||
504 | 74 | #endif // _COMPIZ_GLPROGRAM_H | 97 | #endif // _COMPIZ_GLPROGRAM_H |
505 | 75 | |||
506 | 76 | 98 | ||
507 | === modified file 'plugins/opengl/include/opengl/programcache.h' | |||
508 | --- plugins/opengl/include/opengl/programcache.h 2012-05-17 10:41:21 +0000 | |||
509 | +++ plugins/opengl/include/opengl/programcache.h 2013-07-24 16:05:45 +0000 | |||
510 | @@ -38,9 +38,11 @@ | |||
511 | 38 | class GLProgramCache | 38 | class GLProgramCache |
512 | 39 | { | 39 | { |
513 | 40 | private: | 40 | private: |
514 | 41 | |||
515 | 41 | PrivateProgramCache *priv; | 42 | PrivateProgramCache *priv; |
516 | 42 | 43 | ||
517 | 43 | public: | 44 | public: |
518 | 45 | |||
519 | 44 | GLProgramCache (size_t); | 46 | GLProgramCache (size_t); |
520 | 45 | ~GLProgramCache (); | 47 | ~GLProgramCache (); |
521 | 46 | 48 | ||
522 | @@ -48,4 +50,3 @@ | |||
523 | 48 | }; | 50 | }; |
524 | 49 | 51 | ||
525 | 50 | #endif // _COMPIZ_GLPROGRAMCACHE_H | 52 | #endif // _COMPIZ_GLPROGRAMCACHE_H |
526 | 51 | |||
527 | 52 | 53 | ||
528 | === modified file 'plugins/opengl/include/opengl/texture.h' | |||
529 | --- plugins/opengl/include/opengl/texture.h 2012-09-18 11:32:20 +0000 | |||
530 | +++ plugins/opengl/include/opengl/texture.h 2013-07-24 16:05:45 +0000 | |||
531 | @@ -73,15 +73,18 @@ | |||
532 | 73 | /** | 73 | /** |
533 | 74 | * Class which represents an openGL texture | 74 | * Class which represents an openGL texture |
534 | 75 | */ | 75 | */ |
536 | 76 | class GLTexture : public CompRect { | 76 | class GLTexture : public CompRect |
537 | 77 | { | ||
538 | 77 | public: | 78 | public: |
539 | 78 | 79 | ||
541 | 79 | typedef enum { | 80 | typedef enum |
542 | 81 | { | ||
543 | 80 | Fast, | 82 | Fast, |
544 | 81 | Good | 83 | Good |
545 | 82 | } Filter; | 84 | } Filter; |
546 | 83 | 85 | ||
548 | 84 | typedef struct { | 86 | typedef struct |
549 | 87 | { | ||
550 | 85 | float xx; float yx; | 88 | float xx; float yx; |
551 | 86 | float xy; float yy; | 89 | float xy; float yy; |
552 | 87 | float x0; float y0; | 90 | float x0; float y0; |
553 | @@ -93,9 +96,10 @@ | |||
554 | 93 | * Class which represents a list of openGL textures, | 96 | * Class which represents a list of openGL textures, |
555 | 94 | * usually used for texture tiling | 97 | * usually used for texture tiling |
556 | 95 | */ | 98 | */ |
559 | 96 | class List : public std::vector <GLTexture *> { | 99 | class List : public std::vector <GLTexture *> |
560 | 97 | 100 | { | |
561 | 98 | public: | 101 | public: |
562 | 102 | |||
563 | 99 | List (); | 103 | List (); |
564 | 100 | List (unsigned int); | 104 | List (unsigned int); |
565 | 101 | List (const List &); | 105 | List (const List &); |
566 | @@ -224,12 +228,14 @@ | |||
567 | 224 | friend class PrivateTexture; | 228 | friend class PrivateTexture; |
568 | 225 | 229 | ||
569 | 226 | protected: | 230 | protected: |
570 | 231 | |||
571 | 227 | GLTexture (); | 232 | GLTexture (); |
572 | 228 | virtual ~GLTexture (); | 233 | virtual ~GLTexture (); |
573 | 229 | 234 | ||
574 | 230 | void setData (GLenum target, Matrix &m, bool mipmap); | 235 | void setData (GLenum target, Matrix &m, bool mipmap); |
575 | 231 | 236 | ||
576 | 232 | private: | 237 | private: |
577 | 238 | |||
578 | 233 | PrivateTexture *priv; | 239 | PrivateTexture *priv; |
579 | 234 | }; | 240 | }; |
580 | 235 | 241 | ||
581 | 236 | 242 | ||
582 | === modified file 'plugins/opengl/include/opengl/vector.h' | |||
583 | --- plugins/opengl/include/opengl/vector.h 2012-05-17 10:41:21 +0000 | |||
584 | +++ plugins/opengl/include/opengl/vector.h 2013-07-24 16:05:45 +0000 | |||
585 | @@ -30,9 +30,12 @@ | |||
586 | 30 | * Class which describes a point or vector | 30 | * Class which describes a point or vector |
587 | 31 | * in 3D space | 31 | * in 3D space |
588 | 32 | */ | 32 | */ |
590 | 33 | class GLVector { | 33 | class GLVector |
591 | 34 | { | ||
592 | 34 | public: | 35 | public: |
594 | 35 | typedef enum { | 36 | |
595 | 37 | typedef enum | ||
596 | 38 | { | ||
597 | 36 | x, | 39 | x, |
598 | 37 | y, | 40 | y, |
599 | 38 | z, | 41 | z, |
600 | @@ -105,6 +108,7 @@ | |||
601 | 105 | GLVector& homogenize (); | 108 | GLVector& homogenize (); |
602 | 106 | 109 | ||
603 | 107 | private: | 110 | private: |
604 | 111 | |||
605 | 108 | friend GLVector operator+ (const GLVector& lhs, | 112 | friend GLVector operator+ (const GLVector& lhs, |
606 | 109 | const GLVector& rhs); | 113 | const GLVector& rhs); |
607 | 110 | friend GLVector operator- (const GLVector& lhs, | 114 | friend GLVector operator- (const GLVector& lhs, |
608 | 111 | 115 | ||
609 | === modified file 'plugins/opengl/src/blacklist/blacklist.cpp' | |||
610 | --- plugins/opengl/src/blacklist/blacklist.cpp 2012-12-12 07:24:34 +0000 | |||
611 | +++ plugins/opengl/src/blacklist/blacklist.cpp 2013-07-24 16:05:45 +0000 | |||
612 | @@ -30,8 +30,10 @@ | |||
613 | 30 | namespace compiz { | 30 | namespace compiz { |
614 | 31 | namespace opengl { | 31 | namespace opengl { |
615 | 32 | 32 | ||
618 | 33 | bool blacklisted (const char *blacklistRegex, const char *glVendor, | 33 | bool blacklisted (const char *blacklistRegex, |
619 | 34 | const char *glRenderer, const char *glVersion) | 34 | const char *glVendor, |
620 | 35 | const char *glRenderer, | ||
621 | 36 | const char *glVersion) | ||
622 | 35 | { | 37 | { |
623 | 36 | bool matches = false; | 38 | bool matches = false; |
624 | 37 | 39 | ||
625 | @@ -42,16 +44,16 @@ | |||
626 | 42 | // Ensure the regex contains something other than spaces, or ignore. | 44 | // Ensure the regex contains something other than spaces, or ignore. |
627 | 43 | const char *p = blacklistRegex; | 45 | const char *p = blacklistRegex; |
628 | 44 | while (*p == ' ') | 46 | while (*p == ' ') |
630 | 45 | p++; | 47 | ++p; |
631 | 46 | 48 | ||
632 | 47 | if (*p && !regcomp (&re, blacklistRegex, REG_EXTENDED)) | 49 | if (*p && !regcomp (&re, blacklistRegex, REG_EXTENDED)) |
633 | 48 | { | 50 | { |
634 | 49 | char driver[1024]; | 51 | char driver[1024]; |
635 | 50 | 52 | ||
636 | 51 | snprintf (driver, sizeof driver, "%s\n%s\n%s", | 53 | snprintf (driver, sizeof driver, "%s\n%s\n%s", |
640 | 52 | glVendor ? glVendor : "", | 54 | glVendor ? glVendor : "", |
641 | 53 | glRenderer ? glRenderer : "", | 55 | glRenderer ? glRenderer : "", |
642 | 54 | glVersion ? glVersion : ""); | 56 | glVersion ? glVersion : ""); |
643 | 55 | 57 | ||
644 | 56 | if (!regexec (&re, driver, 0, NULL, 0)) | 58 | if (!regexec (&re, driver, 0, NULL, 0)) |
645 | 57 | matches = true; | 59 | matches = true; |
646 | 58 | 60 | ||
647 | === modified file 'plugins/opengl/src/blacklist/blacklist.h' | |||
648 | --- plugins/opengl/src/blacklist/blacklist.h 2012-12-12 07:24:34 +0000 | |||
649 | +++ plugins/opengl/src/blacklist/blacklist.h 2013-07-24 16:05:45 +0000 | |||
650 | @@ -29,8 +29,10 @@ | |||
651 | 29 | namespace compiz { | 29 | namespace compiz { |
652 | 30 | namespace opengl { | 30 | namespace opengl { |
653 | 31 | 31 | ||
656 | 32 | bool blacklisted (const char *blacklistRegex, const char *glVendor, | 32 | bool blacklisted (const char *blacklistRegex, |
657 | 33 | const char *glRenderer, const char *glVersion); | 33 | const char *glVendor, |
658 | 34 | const char *glRenderer, | ||
659 | 35 | const char *glVersion); | ||
660 | 34 | 36 | ||
661 | 35 | } // namespace opengl | 37 | } // namespace opengl |
662 | 36 | } // namespace compiz | 38 | } // namespace compiz |
663 | 37 | 39 | ||
664 | === modified file 'plugins/opengl/src/doublebuffer/src/double-buffer.cpp' | |||
665 | --- plugins/opengl/src/doublebuffer/src/double-buffer.cpp 2012-11-09 06:13:00 +0000 | |||
666 | +++ plugins/opengl/src/doublebuffer/src/double-buffer.cpp 2013-07-24 16:05:45 +0000 | |||
667 | @@ -66,7 +66,7 @@ | |||
668 | 66 | 66 | ||
669 | 67 | void | 67 | void |
670 | 68 | DoubleBuffer::render (const CompRegion ®ion, | 68 | DoubleBuffer::render (const CompRegion ®ion, |
672 | 69 | bool fullscreen) | 69 | bool fullscreen) |
673 | 70 | { | 70 | { |
674 | 71 | if (fullscreen) | 71 | if (fullscreen) |
675 | 72 | { | 72 | { |
676 | @@ -77,9 +77,7 @@ | |||
677 | 77 | 77 | ||
678 | 78 | if (setting[NEED_PERSISTENT_BACK_BUFFER] && | 78 | if (setting[NEED_PERSISTENT_BACK_BUFFER] && |
679 | 79 | !setting[HAVE_PERSISTENT_BACK_BUFFER]) | 79 | !setting[HAVE_PERSISTENT_BACK_BUFFER]) |
680 | 80 | { | ||
681 | 81 | copyFrontToBack (); | 80 | copyFrontToBack (); |
682 | 82 | } | ||
683 | 83 | } | 81 | } |
684 | 84 | else | 82 | else |
685 | 85 | { | 83 | { |
686 | @@ -124,7 +122,7 @@ | |||
687 | 124 | 122 | ||
688 | 125 | /* Accumulate throttle */ | 123 | /* Accumulate throttle */ |
689 | 126 | if (throttleState == ExternalFrameThrottlingRequired) | 124 | if (throttleState == ExternalFrameThrottlingRequired) |
691 | 127 | blockingVSyncUnthrottledFrames++; | 125 | ++blockingVSyncUnthrottledFrames; |
692 | 128 | else | 126 | else |
693 | 129 | blockingVSyncUnthrottledFrames = 0; | 127 | blockingVSyncUnthrottledFrames = 0; |
694 | 130 | 128 | ||
695 | 131 | 129 | ||
696 | === modified file 'plugins/opengl/src/framebufferobject.cpp' | |||
697 | --- plugins/opengl/src/framebufferobject.cpp 2012-08-06 09:44:49 +0000 | |||
698 | +++ plugins/opengl/src/framebufferobject.cpp 2013-07-24 16:05:45 +0000 | |||
699 | @@ -32,6 +32,7 @@ | |||
700 | 32 | PrivateGLFramebufferObject () : | 32 | PrivateGLFramebufferObject () : |
701 | 33 | fboId (0), | 33 | fboId (0), |
702 | 34 | pushedId (0), | 34 | pushedId (0), |
703 | 35 | rbStencilId (0), | ||
704 | 35 | glTex (NULL), | 36 | glTex (NULL), |
705 | 36 | status (-1) | 37 | status (-1) |
706 | 37 | { | 38 | { |
707 | @@ -40,14 +41,14 @@ | |||
708 | 40 | void pushFBO (); | 41 | void pushFBO (); |
709 | 41 | void popFBO (); | 42 | void popFBO (); |
710 | 42 | 43 | ||
719 | 43 | GLuint fboId; | 44 | GLuint fboId; |
720 | 44 | GLuint pushedId; | 45 | GLuint pushedId; |
721 | 45 | GLuint rbStencilId; | 46 | GLuint rbStencilId; |
722 | 46 | GLTexture *glTex; | 47 | GLTexture *glTex; |
723 | 47 | 48 | ||
724 | 48 | GLint status; | 49 | GLint status; |
725 | 49 | 50 | ||
726 | 50 | static GLuint boundId; | 51 | static GLuint boundId; |
727 | 51 | static std::map<GLuint, GLFramebufferObject *> idMap; | 52 | static std::map<GLuint, GLFramebufferObject *> idMap; |
728 | 52 | }; | 53 | }; |
729 | 53 | 54 | ||
730 | @@ -58,6 +59,7 @@ | |||
731 | 58 | PrivateGLFramebufferObject::pushFBO () | 59 | PrivateGLFramebufferObject::pushFBO () |
732 | 59 | { | 60 | { |
733 | 60 | pushedId = boundId; | 61 | pushedId = boundId; |
734 | 62 | |||
735 | 61 | if (boundId != fboId) | 63 | if (boundId != fboId) |
736 | 62 | { | 64 | { |
737 | 63 | (*GL::bindFramebuffer) (GL::FRAMEBUFFER, fboId); | 65 | (*GL::bindFramebuffer) (GL::FRAMEBUFFER, fboId); |
738 | @@ -94,22 +96,24 @@ | |||
739 | 94 | (*GL::deleteFramebuffers) (1, &priv->fboId); | 96 | (*GL::deleteFramebuffers) (1, &priv->fboId); |
740 | 95 | (*GL::deleteRenderbuffers) (1, &priv->rbStencilId); | 97 | (*GL::deleteRenderbuffers) (1, &priv->rbStencilId); |
741 | 96 | 98 | ||
742 | 97 | |||
743 | 98 | delete priv; | 99 | delete priv; |
744 | 99 | } | 100 | } |
745 | 100 | 101 | ||
746 | 101 | bool | 102 | bool |
749 | 102 | GLFramebufferObject::allocate (const CompSize &size, const char *image, | 103 | GLFramebufferObject::allocate (const CompSize &size, |
750 | 103 | GLenum format, GLenum type) | 104 | const char *image, |
751 | 105 | GLenum format, | ||
752 | 106 | GLenum type) | ||
753 | 104 | { | 107 | { |
754 | 105 | priv->status = -1; | 108 | priv->status = -1; |
755 | 106 | 109 | ||
759 | 107 | if (!priv->glTex || | 110 | if (!priv->glTex || |
760 | 108 | size.width () != priv->glTex->width () || | 111 | size.width () != priv->glTex->width () || |
761 | 109 | size.height () != priv->glTex->height ()) | 112 | size.height () != priv->glTex->height ()) |
762 | 110 | { | 113 | { |
763 | 111 | if (priv->glTex) | 114 | if (priv->glTex) |
764 | 112 | GLTexture::decRef (priv->glTex); | 115 | GLTexture::decRef (priv->glTex); |
765 | 116 | |||
766 | 113 | priv->glTex = NULL; | 117 | priv->glTex = NULL; |
767 | 114 | 118 | ||
768 | 115 | GLTexture::List list = GLTexture::imageDataToTexture (image, size, | 119 | GLTexture::List list = GLTexture::imageDataToTexture (image, size, |
769 | @@ -130,12 +134,12 @@ | |||
770 | 130 | priv->pushFBO (); | 134 | priv->pushFBO (); |
771 | 131 | 135 | ||
772 | 132 | (*GL::framebufferTexture2D) (GL::FRAMEBUFFER, GL::COLOR_ATTACHMENT0, | 136 | (*GL::framebufferTexture2D) (GL::FRAMEBUFFER, GL::COLOR_ATTACHMENT0, |
775 | 133 | priv->glTex->target (), | 137 | priv->glTex->target (), |
776 | 134 | priv->glTex->name (), 0); | 138 | priv->glTex->name (), 0); |
777 | 135 | 139 | ||
778 | 136 | priv->status = (*GL::checkFramebufferStatus) (GL::DRAW_FRAMEBUFFER); | 140 | priv->status = (*GL::checkFramebufferStatus) (GL::DRAW_FRAMEBUFFER); |
779 | 141 | priv->popFBO (); | ||
780 | 137 | 142 | ||
781 | 138 | priv->popFBO (); | ||
782 | 139 | return true; | 143 | return true; |
783 | 140 | } | 144 | } |
784 | 141 | 145 | ||
785 | @@ -146,8 +150,8 @@ | |||
786 | 146 | 150 | ||
787 | 147 | if (priv->boundId != 0) | 151 | if (priv->boundId != 0) |
788 | 148 | { | 152 | { |
791 | 149 | std::map<GLuint, GLFramebufferObject *>::iterator it; | 153 | std::map<GLuint, GLFramebufferObject *>::iterator it = |
792 | 150 | it = PrivateGLFramebufferObject::idMap.find (priv->boundId); | 154 | PrivateGLFramebufferObject::idMap.find (priv->boundId); |
793 | 151 | 155 | ||
794 | 152 | if (it != PrivateGLFramebufferObject::idMap.end ()) | 156 | if (it != PrivateGLFramebufferObject::idMap.end ()) |
795 | 153 | old = it->second; | 157 | old = it->second; |
796 | @@ -209,8 +213,9 @@ | |||
797 | 209 | return true; | 213 | return true; |
798 | 210 | 214 | ||
799 | 211 | compLogMessage ("opengl", CompLogLevelError, | 215 | compLogMessage ("opengl", CompLogLevelError, |
802 | 212 | "FBO is incomplete: %s (0x%04x)", | 216 | "FBO is incomplete: %s (0x%04x)", |
803 | 213 | getFboErrorString (priv->status), priv->status); | 217 | getFboErrorString (priv->status), priv->status); |
804 | 218 | |||
805 | 214 | return false; | 219 | return false; |
806 | 215 | } | 220 | } |
807 | 216 | 221 | ||
808 | 217 | 222 | ||
809 | === modified file 'plugins/opengl/src/fsregion/fsregion.cpp' | |||
810 | --- plugins/opengl/src/fsregion/fsregion.cpp 2013-05-08 15:04:46 +0000 | |||
811 | +++ plugins/opengl/src/fsregion/fsregion.cpp 2013-07-24 16:05:45 +0000 | |||
812 | @@ -29,16 +29,16 @@ | |||
813 | 29 | namespace opengl { | 29 | namespace opengl { |
814 | 30 | 30 | ||
815 | 31 | FullscreenRegion::FullscreenRegion (const CompRect &output) : | 31 | FullscreenRegion::FullscreenRegion (const CompRect &output) : |
818 | 32 | untouched (output), | 32 | untouched (output), |
819 | 33 | orig (output), | 33 | orig (output), |
820 | 34 | allOutputs (output) | 34 | allOutputs (output) |
821 | 35 | { | 35 | { |
822 | 36 | } | 36 | } |
823 | 37 | 37 | ||
828 | 38 | FullscreenRegion::FullscreenRegion (const CompRect &output, | 38 | FullscreenRegion::FullscreenRegion (const CompRect &output, |
829 | 39 | const CompRegion &all) : | 39 | const CompRegion &all) : |
830 | 40 | untouched (output), | 40 | untouched (output), |
831 | 41 | orig (output), | 41 | orig (output), |
832 | 42 | allOutputs (all) | 42 | allOutputs (all) |
833 | 43 | { | 43 | { |
834 | 44 | } | 44 | } |
835 | @@ -48,12 +48,10 @@ | |||
836 | 48 | { | 48 | { |
837 | 49 | bool fullscreen = false; | 49 | bool fullscreen = false; |
838 | 50 | 50 | ||
843 | 51 | if (!(flags & (Desktop | Alpha | NoOcclusionDetection)) && | 51 | if (!(flags & (Desktop | Alpha | NoOcclusionDetection)) && |
844 | 52 | region == untouched && | 52 | region == untouched && |
845 | 53 | region == orig) | 53 | region == orig) |
842 | 54 | { | ||
846 | 55 | fullscreen = true; | 54 | fullscreen = true; |
847 | 56 | } | ||
848 | 57 | 55 | ||
849 | 58 | untouched -= region; | 56 | untouched -= region; |
850 | 59 | 57 | ||
851 | 60 | 58 | ||
852 | === modified file 'plugins/opengl/src/fsregion/fsregion.h' | |||
853 | --- plugins/opengl/src/fsregion/fsregion.h 2013-05-08 15:04:46 +0000 | |||
854 | +++ plugins/opengl/src/fsregion/fsregion.h 2013-07-24 16:05:45 +0000 | |||
855 | @@ -34,23 +34,29 @@ | |||
856 | 34 | class FullscreenRegion | 34 | class FullscreenRegion |
857 | 35 | { | 35 | { |
858 | 36 | public: | 36 | public: |
859 | 37 | |||
860 | 37 | typedef enum | 38 | typedef enum |
861 | 38 | { | 39 | { |
864 | 39 | Desktop = 1, | 40 | Desktop = 1, |
865 | 40 | Alpha = 2, | 41 | Alpha = 2, |
866 | 41 | NoOcclusionDetection = 3 | 42 | NoOcclusionDetection = 3 |
867 | 42 | } WinFlag; | 43 | } WinFlag; |
868 | 43 | 44 | ||
869 | 44 | typedef unsigned int WinFlags; | 45 | typedef unsigned int WinFlags; |
870 | 45 | 46 | ||
871 | 46 | FullscreenRegion (const CompRect &output); | 47 | FullscreenRegion (const CompRect &output); |
873 | 47 | FullscreenRegion (const CompRect &output, const CompRegion &all); | 48 | |
874 | 49 | FullscreenRegion (const CompRect &output, | ||
875 | 50 | const CompRegion &all); | ||
876 | 48 | 51 | ||
877 | 49 | // isCoveredBy is called for windows from TOP to BOTTOM | 52 | // isCoveredBy is called for windows from TOP to BOTTOM |
879 | 50 | bool isCoveredBy (const CompRegion ®ion, WinFlags flags = 0); | 53 | bool isCoveredBy (const CompRegion ®ion, |
880 | 54 | WinFlags flags = 0); | ||
881 | 55 | |||
882 | 51 | bool allowRedirection (const CompRegion ®ion); | 56 | bool allowRedirection (const CompRegion ®ion); |
883 | 52 | 57 | ||
884 | 53 | private: | 58 | private: |
885 | 59 | |||
886 | 54 | CompRegion untouched; | 60 | CompRegion untouched; |
887 | 55 | CompRegion orig; | 61 | CompRegion orig; |
888 | 56 | CompRegion allOutputs; | 62 | CompRegion allOutputs; |
889 | 57 | 63 | ||
890 | === modified file 'plugins/opengl/src/matrix.cpp' | |||
891 | --- plugins/opengl/src/matrix.cpp 2012-12-04 15:28:56 +0000 | |||
892 | +++ plugins/opengl/src/matrix.cpp 2013-07-24 16:05:45 +0000 | |||
893 | @@ -59,7 +59,8 @@ | |||
894 | 59 | /** | 59 | /** |
895 | 60 | * Identity matrix. | 60 | * Identity matrix. |
896 | 61 | */ | 61 | */ |
898 | 62 | static const float identity[16] = { | 62 | static const float identity[16] = |
899 | 63 | { | ||
900 | 63 | 1.0, 0.0, 0.0, 0.0, | 64 | 1.0, 0.0, 0.0, 0.0, |
901 | 64 | 0.0, 1.0, 0.0, 0.0, | 65 | 0.0, 1.0, 0.0, 0.0, |
902 | 65 | 0.0, 0.0, 1.0, 0.0, | 66 | 0.0, 0.0, 1.0, 0.0, |
903 | @@ -88,7 +89,7 @@ | |||
904 | 88 | const float *a, | 89 | const float *a, |
905 | 89 | const float *b) | 90 | const float *b) |
906 | 90 | { | 91 | { |
908 | 91 | for (int i = 0; i < 4; i++) | 92 | for (int i = 0; i < 4; ++i) |
909 | 92 | { | 93 | { |
910 | 93 | const float ai0 = A(i,0), ai1 = A(i,1), ai2 = A(i,2), ai3 = A(i,3); | 94 | const float ai0 = A(i,0), ai1 = A(i,1), ai2 = A(i,2), ai3 = A(i,3); |
911 | 94 | 95 | ||
912 | @@ -144,10 +145,10 @@ | |||
913 | 144 | operator* (const GLMatrix& lhs, | 145 | operator* (const GLMatrix& lhs, |
914 | 145 | const GLVector& rhs) | 146 | const GLVector& rhs) |
915 | 146 | { | 147 | { |
917 | 147 | GLVector result; | 148 | GLVector result; |
918 | 148 | const float *a = lhs.m; | 149 | const float *a = lhs.m; |
919 | 149 | 150 | ||
921 | 150 | for (int i = 0; i < 4; i++) | 151 | for (int i = 0; i < 4; ++i) |
922 | 151 | { | 152 | { |
923 | 152 | result[i] = A(i,0) * rhs[0] + A(i,1) * rhs[1] + | 153 | result[i] = A(i,0) * rhs[0] + A(i,1) * rhs[1] + |
924 | 153 | A(i,2) * rhs[2] + A(i,3) * rhs[3]; | 154 | A(i,2) * rhs[2] + A(i,3) * rhs[3]; |
925 | @@ -202,13 +203,14 @@ | |||
926 | 202 | + m[4]*m[2]*m[9] + m[8]*m[1]*m[6] - m[8]*m[2]*m[5]; | 203 | + m[4]*m[2]*m[9] + m[8]*m[1]*m[6] - m[8]*m[2]*m[5]; |
927 | 203 | 204 | ||
928 | 204 | det = m[0]*inv[0] + m[1]*inv[4] + m[2]*inv[8] + m[3]*inv[12]; | 205 | det = m[0]*inv[0] + m[1]*inv[4] + m[2]*inv[8] + m[3]*inv[12]; |
929 | 206 | |||
930 | 205 | if (det == 0) | 207 | if (det == 0) |
932 | 206 | return false; | 208 | return false; |
933 | 207 | 209 | ||
934 | 208 | det = 1.0f / det; | 210 | det = 1.0f / det; |
935 | 209 | 211 | ||
938 | 210 | for (int i = 0; i < 16; i++) | 212 | for (int i = 0; i < 16; ++i) |
939 | 211 | m[i] = inv[i] * det; | 213 | m[i] = inv[i] * det; |
940 | 212 | 214 | ||
941 | 213 | return true; | 215 | return true; |
942 | 214 | } | 216 | } |
943 | @@ -223,20 +225,18 @@ | |||
944 | 223 | */ | 225 | */ |
945 | 224 | void | 226 | void |
946 | 225 | GLMatrix::rotate (const float angle, | 227 | GLMatrix::rotate (const float angle, |
950 | 226 | const float xRot, | 228 | const float xRot, |
951 | 227 | const float yRot, | 229 | const float yRot, |
952 | 228 | const float zRot) | 230 | const float zRot) |
953 | 229 | { | 231 | { |
954 | 230 | float x = xRot, y = yRot, z = zRot; | 232 | float x = xRot, y = yRot, z = zRot; |
955 | 231 | float s, c; | ||
956 | 232 | float matrix[16]; | 233 | float matrix[16]; |
957 | 233 | bool optimized; | ||
958 | 234 | 234 | ||
961 | 235 | s = (float) sin (angle * DEG2RAD); | 235 | float s = (float) sin (angle * DEG2RAD); |
962 | 236 | c = (float) cos (angle * DEG2RAD); | 236 | float c = (float) cos (angle * DEG2RAD); |
963 | 237 | 237 | ||
964 | 238 | memcpy (matrix, identity, sizeof (matrix)); | 238 | memcpy (matrix, identity, sizeof (matrix)); |
966 | 239 | optimized = false; | 239 | bool optimized = false; |
967 | 240 | 240 | ||
968 | 241 | #define M(row, col) matrix[col * 4 + row] | 241 | #define M(row, col) matrix[col * 4 + row] |
969 | 242 | 242 | ||
970 | @@ -250,6 +250,7 @@ | |||
971 | 250 | /* rotate only around z-axis */ | 250 | /* rotate only around z-axis */ |
972 | 251 | M(0,0) = c; | 251 | M(0,0) = c; |
973 | 252 | M(1,1) = c; | 252 | M(1,1) = c; |
974 | 253 | |||
975 | 253 | if (z < 0.0f) | 254 | if (z < 0.0f) |
976 | 254 | { | 255 | { |
977 | 255 | M(0,1) = s; | 256 | M(0,1) = s; |
978 | @@ -268,6 +269,7 @@ | |||
979 | 268 | /* rotate only around y-axis */ | 269 | /* rotate only around y-axis */ |
980 | 269 | M(0,0) = c; | 270 | M(0,0) = c; |
981 | 270 | M(2,2) = c; | 271 | M(2,2) = c; |
982 | 272 | |||
983 | 271 | if (y < 0.0f) | 273 | if (y < 0.0f) |
984 | 272 | { | 274 | { |
985 | 273 | M(0,2) = -s; | 275 | M(0,2) = -s; |
986 | @@ -288,6 +290,7 @@ | |||
987 | 288 | /* rotate only around x-axis */ | 290 | /* rotate only around x-axis */ |
988 | 289 | M(1,1) = c; | 291 | M(1,1) = c; |
989 | 290 | M(2,2) = c; | 292 | M(2,2) = c; |
990 | 293 | |||
991 | 291 | if (x < 0.0f) | 294 | if (x < 0.0f) |
992 | 292 | { | 295 | { |
993 | 293 | M(1,2) = s; | 296 | M(1,2) = s; |
994 | @@ -316,7 +319,6 @@ | |||
995 | 316 | y /= mag; | 319 | y /= mag; |
996 | 317 | z /= mag; | 320 | z /= mag; |
997 | 318 | 321 | ||
998 | 319 | |||
999 | 320 | /* | 322 | /* |
1000 | 321 | * Arbitrary axis rotation matrix. | 323 | * Arbitrary axis rotation matrix. |
1001 | 322 | * | 324 | * |
1002 | @@ -410,8 +412,8 @@ | |||
1003 | 410 | } | 412 | } |
1004 | 411 | 413 | ||
1005 | 412 | void | 414 | void |
1008 | 413 | GLMatrix::rotate (const float angle, | 415 | GLMatrix::rotate (const float angle, |
1009 | 414 | const GLVector& vector) | 416 | const GLVector& vector) |
1010 | 415 | { | 417 | { |
1011 | 416 | rotate (angle, | 418 | rotate (angle, |
1012 | 417 | vector[GLVector::x], | 419 | vector[GLVector::x], |
1013 | @@ -431,8 +433,8 @@ | |||
1014 | 431 | */ | 433 | */ |
1015 | 432 | void | 434 | void |
1016 | 433 | GLMatrix::scale (const float x, | 435 | GLMatrix::scale (const float x, |
1019 | 434 | const float y, | 436 | const float y, |
1020 | 435 | const float z) | 437 | const float z) |
1021 | 436 | { | 438 | { |
1022 | 437 | m[0] *= x; m[4] *= y; m[8] *= z; | 439 | m[0] *= x; m[4] *= y; m[8] *= z; |
1023 | 438 | m[1] *= x; m[5] *= y; m[9] *= z; | 440 | m[1] *= x; m[5] *= y; m[9] *= z; |
1024 | @@ -460,8 +462,8 @@ | |||
1025 | 460 | */ | 462 | */ |
1026 | 461 | void | 463 | void |
1027 | 462 | GLMatrix::translate (const float x, | 464 | GLMatrix::translate (const float x, |
1030 | 463 | const float y, | 465 | const float y, |
1031 | 464 | const float z) | 466 | const float z) |
1032 | 465 | { | 467 | { |
1033 | 466 | m[12] = m[0] * x + m[4] * y + m[8] * z + m[12]; | 468 | m[12] = m[0] * x + m[4] * y + m[8] * z + m[12]; |
1034 | 467 | m[13] = m[1] * x + m[5] * y + m[9] * z + m[13]; | 469 | m[13] = m[1] * x + m[5] * y + m[9] * z + m[13]; |
1035 | 468 | 470 | ||
1036 | === modified file 'plugins/opengl/src/opengl.cpp' | |||
1037 | --- plugins/opengl/src/opengl.cpp 2013-05-26 06:15:47 +0000 | |||
1038 | +++ plugins/opengl/src/opengl.cpp 2013-07-24 16:05:45 +0000 | |||
1039 | @@ -28,15 +28,15 @@ | |||
1040 | 28 | #include <core/pluginclasshandler.h> | 28 | #include <core/pluginclasshandler.h> |
1041 | 29 | #include "privates.h" | 29 | #include "privates.h" |
1042 | 30 | 30 | ||
1052 | 31 | const float DEFAULT_Z_CAMERA = 0.866025404f; | 31 | const float DEFAULT_Z_CAMERA = 0.866025404f; |
1053 | 32 | 32 | ||
1054 | 33 | const float RED_SATURATION_WEIGHT = 0.30f; | 33 | const float RED_SATURATION_WEIGHT = 0.30f; |
1055 | 34 | const float GREEN_SATURATION_WEIGHT = 0.59f; | 34 | const float GREEN_SATURATION_WEIGHT = 0.59f; |
1056 | 35 | const float BLUE_SATURATION_WEIGHT = 0.11f; | 35 | const float BLUE_SATURATION_WEIGHT = 0.11f; |
1057 | 36 | 36 | ||
1058 | 37 | const unsigned short NOTHING_TRANS_FILTER = 0; | 37 | const unsigned short NOTHING_TRANS_FILTER = 0; |
1059 | 38 | const unsigned short SCREEN_TRANS_FILTER = 1; | 38 | const unsigned short SCREEN_TRANS_FILTER = 1; |
1060 | 39 | const unsigned short WINDOW_TRANS_FILTER = 2; | 39 | const unsigned short WINDOW_TRANS_FILTER = 2; |
1061 | 40 | 40 | ||
1062 | 41 | CompOption::Vector & | 41 | CompOption::Vector & |
1063 | 42 | GLScreen::getOptions () | 42 | GLScreen::getOptions () |
1064 | @@ -62,7 +62,8 @@ | |||
1065 | 62 | if (!rv || !CompOption::findOption (getOptions (), name, &index)) | 62 | if (!rv || !CompOption::findOption (getOptions (), name, &index)) |
1066 | 63 | return false; | 63 | return false; |
1067 | 64 | 64 | ||
1069 | 65 | switch (index) { | 65 | switch (index) |
1070 | 66 | { | ||
1071 | 66 | case OpenglOptions::TextureFilter: | 67 | case OpenglOptions::TextureFilter: |
1072 | 67 | cScreen->damageScreen (); | 68 | cScreen->damageScreen (); |
1073 | 68 | 69 | ||
1074 | @@ -71,6 +72,7 @@ | |||
1075 | 71 | else | 72 | else |
1076 | 72 | textureFilter = GL_LINEAR; | 73 | textureFilter = GL_LINEAR; |
1077 | 73 | break; | 74 | break; |
1078 | 75 | |||
1079 | 74 | default: | 76 | default: |
1080 | 75 | break; | 77 | break; |
1081 | 76 | } | 78 | } |
1082 | 77 | 79 | ||
1083 | === modified file 'plugins/opengl/src/paint.cpp' | |||
1084 | --- plugins/opengl/src/paint.cpp 2013-06-28 01:10:57 +0000 | |||
1085 | +++ plugins/opengl/src/paint.cpp 2013-07-24 16:05:45 +0000 | |||
1086 | @@ -45,11 +45,13 @@ | |||
1087 | 45 | 45 | ||
1088 | 46 | using namespace compiz::opengl; | 46 | using namespace compiz::opengl; |
1089 | 47 | 47 | ||
1091 | 48 | GLScreenPaintAttrib defaultScreenPaintAttrib = { | 48 | GLScreenPaintAttrib defaultScreenPaintAttrib = |
1092 | 49 | { | ||
1093 | 49 | 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -DEFAULT_Z_CAMERA | 50 | 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -DEFAULT_Z_CAMERA |
1094 | 50 | }; | 51 | }; |
1095 | 51 | 52 | ||
1097 | 52 | GLWindowPaintAttrib GLWindow::defaultPaintAttrib = { | 53 | GLWindowPaintAttrib GLWindow::defaultPaintAttrib = |
1098 | 54 | { | ||
1099 | 53 | OPAQUE, BRIGHT, COLOR, 1.0f, 1.0f, 0.0f, 0.0f | 55 | OPAQUE, BRIGHT, COLOR, 1.0f, 1.0f, 0.0f, 0.0f |
1100 | 54 | }; | 56 | }; |
1101 | 55 | 57 | ||
1102 | @@ -76,12 +78,7 @@ | |||
1103 | 76 | const CompRegion ®ion, | 78 | const CompRegion ®ion, |
1104 | 77 | bool transformed) | 79 | bool transformed) |
1105 | 78 | { | 80 | { |
1112 | 79 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); | 81 | int nBox = const_cast <Region> (region.handle ())->numRects; |
1107 | 80 | GLfloat vertexData[18]; | ||
1108 | 81 | GLushort colorData[4]; | ||
1109 | 82 | |||
1110 | 83 | BoxPtr pBox = const_cast <Region> (region.handle ())->rects; | ||
1111 | 84 | int n, nBox = const_cast <Region> (region.handle ())->numRects; | ||
1113 | 85 | 82 | ||
1114 | 86 | if (!nBox) | 83 | if (!nBox) |
1115 | 87 | return; | 84 | return; |
1116 | @@ -89,9 +86,7 @@ | |||
1117 | 89 | if (screen->desktopWindowCount ()) | 86 | if (screen->desktopWindowCount ()) |
1118 | 90 | { | 87 | { |
1119 | 91 | if (!backgroundTextures.empty ()) | 88 | if (!backgroundTextures.empty ()) |
1120 | 92 | { | ||
1121 | 93 | backgroundTextures.clear (); | 89 | backgroundTextures.clear (); |
1122 | 94 | } | ||
1123 | 95 | 90 | ||
1124 | 96 | backgroundLoaded = false; | 91 | backgroundLoaded = false; |
1125 | 97 | 92 | ||
1126 | @@ -105,10 +100,15 @@ | |||
1127 | 105 | backgroundLoaded = true; | 100 | backgroundLoaded = true; |
1128 | 106 | } | 101 | } |
1129 | 107 | 102 | ||
1130 | 103 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); | ||
1131 | 104 | GLfloat vertexData[18]; | ||
1132 | 105 | GLushort colorData[4]; | ||
1133 | 106 | BoxPtr pBox = const_cast <Region> (region.handle ())->rects; | ||
1134 | 107 | int n = nBox; | ||
1135 | 108 | |||
1136 | 108 | if (backgroundTextures.empty ()) | 109 | if (backgroundTextures.empty ()) |
1137 | 109 | { | 110 | { |
1138 | 110 | streamingBuffer->begin (GL_TRIANGLES); | 111 | streamingBuffer->begin (GL_TRIANGLES); |
1139 | 111 | n = nBox; | ||
1140 | 112 | 112 | ||
1141 | 113 | while (n--) | 113 | while (n--) |
1142 | 114 | { | 114 | { |
1143 | @@ -134,7 +134,7 @@ | |||
1144 | 134 | 134 | ||
1145 | 135 | streamingBuffer->addVertices (6, vertexData); | 135 | streamingBuffer->addVertices (6, vertexData); |
1146 | 136 | 136 | ||
1148 | 137 | pBox++; | 137 | ++pBox; |
1149 | 138 | } | 138 | } |
1150 | 139 | 139 | ||
1151 | 140 | colorData[0] = colorData[1] = colorData[2] = 0; | 140 | colorData[0] = colorData[1] = colorData[2] = 0; |
1152 | @@ -146,9 +146,7 @@ | |||
1153 | 146 | } | 146 | } |
1154 | 147 | else | 147 | else |
1155 | 148 | { | 148 | { |
1159 | 149 | n = nBox; | 149 | for (unsigned int i = 0; i < backgroundTextures.size (); ++i) |
1157 | 150 | |||
1158 | 151 | for (unsigned int i = 0; i < backgroundTextures.size (); i++) | ||
1160 | 152 | { | 150 | { |
1161 | 153 | GLfloat textureData[12]; | 151 | GLfloat textureData[12]; |
1162 | 154 | GLTexture *bg = backgroundTextures[i]; | 152 | GLTexture *bg = backgroundTextures[i]; |
1163 | @@ -208,7 +206,7 @@ | |||
1164 | 208 | streamingBuffer->addVertices (6, vertexData); | 206 | streamingBuffer->addVertices (6, vertexData); |
1165 | 209 | streamingBuffer->addTexCoords (0, 6, textureData); | 207 | streamingBuffer->addTexCoords (0, 6, textureData); |
1166 | 210 | 208 | ||
1168 | 211 | pBox++; | 209 | ++pBox; |
1169 | 212 | } | 210 | } |
1170 | 213 | 211 | ||
1171 | 214 | streamingBuffer->end (); | 212 | streamingBuffer->end (); |
1172 | @@ -230,10 +228,10 @@ | |||
1173 | 230 | 228 | ||
1174 | 231 | 229 | ||
1175 | 232 | /* This function currently always performs occlusion detection to | 230 | /* This function currently always performs occlusion detection to |
1178 | 233 | minimize paint regions. OpenGL precision requirements are no good | 231 | minimize paint regions. OpenGL precision requirements are not good |
1179 | 234 | enough to guarantee that the results from using occlusion detection | 232 | enough to guarantee that the result from using occlusion detection |
1180 | 235 | is the same as without. It's likely not possible to see any | 233 | is the same as without. It's likely not possible to see any |
1182 | 236 | difference with most hardware but occlusion detection in the | 234 | difference with most hardware, but occlusion detection in the |
1183 | 237 | transformed screen case should be made optional for those who do | 235 | transformed screen case should be made optional for those who do |
1184 | 238 | see a difference. */ | 236 | see a difference. */ |
1185 | 239 | void | 237 | void |
1186 | @@ -242,19 +240,17 @@ | |||
1187 | 242 | CompOutput *output, | 240 | CompOutput *output, |
1188 | 243 | unsigned int mask) | 241 | unsigned int mask) |
1189 | 244 | { | 242 | { |
1198 | 245 | CompRegion tmpRegion (region); | 243 | CompRegion tmpRegion (region); |
1199 | 246 | CompWindow *w; | 244 | CompWindow *w; |
1200 | 247 | GLWindow *gw; | 245 | GLWindow *gw; |
1201 | 248 | int windowMask, odMask; | 246 | int odMask; |
1202 | 249 | bool status, unredirectFS; | 247 | int windowMask = 0; |
1203 | 250 | bool withOffset = false; | 248 | bool status, unredirectFS; |
1204 | 251 | GLMatrix vTransform; | 249 | bool withOffset = false; |
1205 | 252 | CompPoint offXY; | 250 | GLMatrix vTransform; |
1206 | 251 | CompPoint offXY; | ||
1207 | 253 | std::set<CompWindow*> unredirected; | 252 | std::set<CompWindow*> unredirected; |
1208 | 254 | 253 | ||
1209 | 255 | CompWindowList pl; | ||
1210 | 256 | CompWindowList::reverse_iterator rit; | ||
1211 | 257 | |||
1212 | 258 | unredirectFS = CompositeScreen::get (screen)-> | 254 | unredirectFS = CompositeScreen::get (screen)-> |
1213 | 259 | getOption ("unredirect_fullscreen_windows")->value ().b (); | 255 | getOption ("unredirect_fullscreen_windows")->value ().b (); |
1214 | 260 | 256 | ||
1215 | @@ -267,29 +263,24 @@ | |||
1216 | 267 | bool blacklisted = driverIsBlacklisted (blacklist.c_str ()); | 263 | bool blacklisted = driverIsBlacklisted (blacklist.c_str ()); |
1217 | 268 | 264 | ||
1218 | 269 | if (mask & PAINT_SCREEN_TRANSFORMED_MASK) | 265 | if (mask & PAINT_SCREEN_TRANSFORMED_MASK) |
1226 | 270 | { | 266 | windowMask = PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK; |
1220 | 271 | windowMask = PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK; | ||
1221 | 272 | } | ||
1222 | 273 | else | ||
1223 | 274 | { | ||
1224 | 275 | windowMask = 0; | ||
1225 | 276 | } | ||
1227 | 277 | 267 | ||
1228 | 278 | /* | 268 | /* |
1229 | 279 | * We need to COPY the PaintList for now because there seem to be some | 269 | * We need to COPY the PaintList for now because there seem to be some |
1230 | 280 | * odd cases where the master list might change during the below loops. | 270 | * odd cases where the master list might change during the below loops. |
1231 | 281 | * (LP: #958540) | 271 | * (LP: #958540) |
1232 | 282 | */ | 272 | */ |
1234 | 283 | pl = cScreen->getWindowPaintList (); | 273 | CompWindowList pl = cScreen->getWindowPaintList (); |
1235 | 284 | 274 | ||
1236 | 285 | if (!(mask & PAINT_SCREEN_NO_OCCLUSION_DETECTION_MASK)) | 275 | if (!(mask & PAINT_SCREEN_NO_OCCLUSION_DETECTION_MASK)) |
1237 | 286 | { | 276 | { |
1238 | 287 | FullscreenRegion fs (*output, screen->region ()); | 277 | FullscreenRegion fs (*output, screen->region ()); |
1239 | 288 | 278 | ||
1240 | 289 | /* detect occlusions */ | 279 | /* detect occlusions */ |
1242 | 290 | for (rit = pl.rbegin (); rit != pl.rend (); ++rit) | 280 | for (CompWindowList::reverse_iterator rit = pl.rbegin (); |
1243 | 281 | rit != pl.rend (); ++rit) | ||
1244 | 291 | { | 282 | { |
1246 | 292 | w = (*rit); | 283 | w = (*rit); |
1247 | 293 | gw = GLWindow::get (w); | 284 | gw = GLWindow::get (w); |
1248 | 294 | 285 | ||
1249 | 295 | if (w->destroyed ()) | 286 | if (w->destroyed ()) |
1250 | @@ -305,6 +296,7 @@ | |||
1251 | 305 | gw->priv->clip = region; | 296 | gw->priv->clip = region; |
1252 | 306 | continue; | 297 | continue; |
1253 | 307 | } | 298 | } |
1254 | 299 | |||
1255 | 308 | if (!w->isViewable ()) | 300 | if (!w->isViewable ()) |
1256 | 309 | continue; | 301 | continue; |
1257 | 310 | } | 302 | } |
1258 | @@ -319,8 +311,7 @@ | |||
1259 | 319 | !w->onAllViewports ()) | 311 | !w->onAllViewports ()) |
1260 | 320 | { | 312 | { |
1261 | 321 | withOffset = true; | 313 | withOffset = true; |
1264 | 322 | 314 | offXY = w->getMovementForOffset (cScreen->windowPaintOffset ()); | |
1263 | 323 | offXY = w->getMovementForOffset (cScreen->windowPaintOffset ()); | ||
1265 | 324 | 315 | ||
1266 | 325 | vTransform = transform; | 316 | vTransform = transform; |
1267 | 326 | vTransform.translate (offXY.x (), offXY.y (), 0); | 317 | vTransform.translate (offXY.x (), offXY.y (), 0); |
1268 | @@ -328,32 +319,32 @@ | |||
1269 | 328 | gw->priv->clip.translate (-offXY.x (), -offXY. y ()); | 319 | gw->priv->clip.translate (-offXY.x (), -offXY. y ()); |
1270 | 329 | 320 | ||
1271 | 330 | odMask |= PAINT_WINDOW_WITH_OFFSET_MASK; | 321 | odMask |= PAINT_WINDOW_WITH_OFFSET_MASK; |
1274 | 331 | status = gw->glPaint (gw->paintAttrib (), vTransform, | 322 | status = gw->glPaint (gw->paintAttrib (), vTransform, |
1275 | 332 | tmpRegion, odMask); | 323 | tmpRegion, odMask); |
1276 | 333 | } | 324 | } |
1277 | 334 | else | 325 | else |
1278 | 335 | { | 326 | { |
1279 | 336 | withOffset = false; | 327 | withOffset = false; |
1282 | 337 | status = gw->glPaint (gw->paintAttrib (), transform, tmpRegion, | 328 | status = gw->glPaint (gw->paintAttrib (), transform, tmpRegion, |
1283 | 338 | odMask); | 329 | odMask); |
1284 | 339 | } | 330 | } |
1285 | 340 | 331 | ||
1286 | 341 | if (status) | 332 | if (status) |
1287 | 342 | { | 333 | { |
1288 | 343 | if (withOffset) | 334 | if (withOffset) |
1289 | 344 | { | ||
1290 | 345 | tmpRegion -= w->region ().translated (offXY); | 335 | tmpRegion -= w->region ().translated (offXY); |
1291 | 346 | } | ||
1292 | 347 | else | 336 | else |
1293 | 348 | tmpRegion -= w->region (); | 337 | tmpRegion -= w->region (); |
1294 | 349 | } | 338 | } |
1295 | 350 | 339 | ||
1296 | 351 | FullscreenRegion::WinFlags flags = 0; | 340 | FullscreenRegion::WinFlags flags = 0; |
1297 | 341 | |||
1298 | 352 | if (w->type () & CompWindowTypeDesktopMask) | 342 | if (w->type () & CompWindowTypeDesktopMask) |
1300 | 353 | flags |= FullscreenRegion::Desktop; | 343 | flags |= FullscreenRegion::Desktop; |
1301 | 344 | |||
1302 | 354 | if (w->alpha ()) | 345 | if (w->alpha ()) |
1303 | 355 | flags |= FullscreenRegion::Alpha; | 346 | flags |= FullscreenRegion::Alpha; |
1305 | 356 | 347 | ||
1306 | 357 | /* Anything which was not occlusion detected is not a suitable | 348 | /* Anything which was not occlusion detected is not a suitable |
1307 | 358 | * candidate for unredirection either */ | 349 | * candidate for unredirection either */ |
1308 | 359 | if (!status) | 350 | if (!status) |
1309 | @@ -373,37 +364,31 @@ | |||
1310 | 373 | * take effect until it is un-fullscreened again. But that's better | 364 | * take effect until it is un-fullscreened again. But that's better |
1311 | 374 | * than the high price of regex matching on every frame. | 365 | * than the high price of regex matching on every frame. |
1312 | 375 | */ | 366 | */ |
1318 | 376 | if (unredirectFS && | 367 | if (unredirectFS && |
1319 | 377 | !blacklisted && | 368 | !blacklisted && |
1320 | 378 | !(mask & PAINT_SCREEN_TRANSFORMED_MASK) && | 369 | !(mask & PAINT_SCREEN_TRANSFORMED_MASK) && |
1321 | 379 | !(mask & PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK) && | 370 | !(mask & PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK) && |
1322 | 380 | fs.isCoveredBy (w->region (), flags) && | 371 | fs.isCoveredBy (w->region (), flags) && |
1323 | 381 | (!cw->redirected () || unredirectable.evaluate (w))) | 372 | (!cw->redirected () || unredirectable.evaluate (w))) |
1324 | 382 | { | ||
1325 | 383 | unredirected.insert (w); | 373 | unredirected.insert (w); |
1328 | 384 | } | 374 | |
1329 | 385 | else | 375 | else if (!cw->redirected ()) |
1330 | 386 | { | 376 | { |
1332 | 387 | if (!cw->redirected ()) | 377 | if (fs.allowRedirection (w->region ())) |
1333 | 388 | { | 378 | { |
1351 | 389 | if (fs.allowRedirection (w->region ())) | 379 | // 1. GLWindow::release to force gw->priv->needsRebind |
1352 | 390 | { | 380 | gw->release (); |
1353 | 391 | // 1. GLWindow::release to force gw->priv->needsRebind | 381 | |
1354 | 392 | gw->release (); | 382 | // 2. GLWindow::bind, which redirects the window, |
1355 | 393 | 383 | // rebinds the pixmap, and then rebinds the pixmap | |
1356 | 394 | // 2. GLWindow::bind, which redirects the window, | 384 | // to a texture. |
1357 | 395 | // rebinds the pixmap, and then rebinds the pixmap | 385 | gw->bind (); |
1358 | 396 | // to a texture. | 386 | |
1359 | 397 | gw->bind (); | 387 | // 3. Your window is now redirected again with the |
1360 | 398 | 388 | // latest pixmap contents. | |
1344 | 399 | // 3. Your window is now redirected again with the | ||
1345 | 400 | // latest pixmap contents. | ||
1346 | 401 | } | ||
1347 | 402 | else | ||
1348 | 403 | { | ||
1349 | 404 | unredirected.insert (w); | ||
1350 | 405 | } | ||
1361 | 406 | } | 389 | } |
1362 | 390 | else | ||
1363 | 391 | unredirected.insert (w); | ||
1364 | 407 | } | 392 | } |
1365 | 408 | } | 393 | } |
1366 | 409 | } | 394 | } |
1367 | @@ -414,8 +399,8 @@ | |||
1368 | 414 | 399 | ||
1369 | 415 | if (!(mask & PAINT_SCREEN_NO_BACKGROUND_MASK)) | 400 | if (!(mask & PAINT_SCREEN_NO_BACKGROUND_MASK)) |
1370 | 416 | paintBackground (transform, | 401 | paintBackground (transform, |
1373 | 417 | tmpRegion, | 402 | tmpRegion, |
1374 | 418 | (mask & PAINT_SCREEN_TRANSFORMED_MASK)); | 403 | (mask & PAINT_SCREEN_TRANSFORMED_MASK)); |
1375 | 419 | 404 | ||
1376 | 420 | /* paint all windows from bottom to top */ | 405 | /* paint all windows from bottom to top */ |
1377 | 421 | foreach (w, pl) | 406 | foreach (w, pl) |
1378 | @@ -423,26 +408,25 @@ | |||
1379 | 423 | if (w->destroyed ()) | 408 | if (w->destroyed ()) |
1380 | 424 | continue; | 409 | continue; |
1381 | 425 | 410 | ||
1385 | 426 | gw = GLWindow::get (w); | 411 | gw = GLWindow::get (w); |
1386 | 427 | 412 | ||
1387 | 428 | /* Release any queued ConfigureWindow requests now */ | 413 | /* Release any queued ConfigureWindow requests now */ |
1388 | 414 | |||
1389 | 429 | gw->priv->configureLock->release (); | 415 | gw->priv->configureLock->release (); |
1390 | 430 | 416 | ||
1391 | 431 | if (unredirected.find (w) != unredirected.end ()) | 417 | if (unredirected.find (w) != unredirected.end ()) |
1392 | 432 | continue; | 418 | continue; |
1393 | 433 | 419 | ||
1399 | 434 | if (!w->shaded ()) | 420 | if (!w->shaded () && |
1400 | 435 | { | 421 | !w->isViewable ()) |
1401 | 436 | if (!w->isViewable ()) | 422 | continue; |
1397 | 437 | continue; | ||
1398 | 438 | } | ||
1402 | 439 | 423 | ||
1403 | 440 | const CompRegion &clip = | 424 | const CompRegion &clip = |
1404 | 441 | (!(mask & PAINT_SCREEN_NO_OCCLUSION_DETECTION_MASK)) ? | 425 | (!(mask & PAINT_SCREEN_NO_OCCLUSION_DETECTION_MASK)) ? |
1405 | 442 | gw->clip () : region; | 426 | gw->clip () : region; |
1406 | 443 | 427 | ||
1407 | 444 | if ((cScreen->windowPaintOffset ().x () != 0 || | 428 | if ((cScreen->windowPaintOffset ().x () != 0 || |
1409 | 445 | cScreen->windowPaintOffset ().y () != 0) && | 429 | cScreen->windowPaintOffset ().y () != 0 ) && |
1410 | 446 | !w->onAllViewports ()) | 430 | !w->onAllViewports ()) |
1411 | 447 | { | 431 | { |
1412 | 448 | offXY = w->getMovementForOffset (cScreen->windowPaintOffset ()); | 432 | offXY = w->getMovementForOffset (cScreen->windowPaintOffset ()); |
1413 | @@ -450,12 +434,10 @@ | |||
1414 | 450 | vTransform = transform; | 434 | vTransform = transform; |
1415 | 451 | vTransform.translate (offXY.x (), offXY.y (), 0); | 435 | vTransform.translate (offXY.x (), offXY.y (), 0); |
1416 | 452 | gw->glPaint (gw->paintAttrib (), vTransform, clip, | 436 | gw->glPaint (gw->paintAttrib (), vTransform, clip, |
1418 | 453 | windowMask | PAINT_WINDOW_WITH_OFFSET_MASK); | 437 | windowMask | PAINT_WINDOW_WITH_OFFSET_MASK); |
1419 | 454 | } | 438 | } |
1420 | 455 | else | 439 | else |
1421 | 456 | { | ||
1422 | 457 | gw->glPaint (gw->paintAttrib (), transform, clip, windowMask); | 440 | gw->glPaint (gw->paintAttrib (), transform, clip, windowMask); |
1423 | 458 | } | ||
1424 | 459 | } | 441 | } |
1425 | 460 | } | 442 | } |
1426 | 461 | 443 | ||
1427 | @@ -488,20 +470,20 @@ | |||
1428 | 488 | WRAPABLE_HND_FUNCTN (glEnableOutputClipping, transform, region, output) | 470 | WRAPABLE_HND_FUNCTN (glEnableOutputClipping, transform, region, output) |
1429 | 489 | 471 | ||
1430 | 490 | // Bottom-left corner of the output: | 472 | // Bottom-left corner of the output: |
1435 | 491 | const GLint x = output->x1 (); | 473 | const GLint x = output->x1 (); |
1436 | 492 | const GLint y = screen->height () - output->y2 (); | 474 | const GLint y = screen->height () - output->y2 (); |
1437 | 493 | const GLsizei w = output->width (); | 475 | const GLsizei w = output->width (); |
1438 | 494 | const GLsizei h = output->height (); | 476 | const GLsizei h = output->height (); |
1439 | 495 | 477 | ||
1440 | 496 | // Transformed (only scale and translation is supported!) | 478 | // Transformed (only scale and translation is supported!) |
1443 | 497 | const float *t = transform.getMatrix (); | 479 | const float *t = transform.getMatrix (); |
1444 | 498 | const GLfloat scalex = t[0], scaley = t[5], transx = t[12], transy = t[13]; | 480 | const GLfloat scalex = t[0], scaley = t[5], transx = t[12], transy = t[13]; |
1445 | 499 | const GLfloat centrex = x + w / 2.0f; | 481 | const GLfloat centrex = x + w / 2.0f; |
1446 | 500 | const GLfloat centrey = y + h / 2.0f; | 482 | const GLfloat centrey = y + h / 2.0f; |
1451 | 501 | GLfloat scaledw = fabs (w * scalex); | 483 | GLfloat scaledw = fabs (w * scalex); |
1452 | 502 | GLfloat scaledh = fabs (h * scaley); | 484 | GLfloat scaledh = fabs (h * scaley); |
1453 | 503 | GLfloat tx = centrex - (scaledw / 2.0f) + transx * w; | 485 | GLfloat tx = centrex - (scaledw / 2.0f) + transx * w; |
1454 | 504 | GLfloat ty = centrey - (scaledh / 2.0f) + transy * h; | 486 | GLfloat ty = centrey - (scaledh / 2.0f) + transy * h; |
1455 | 505 | 487 | ||
1456 | 506 | glScissor (tx, ty, roundf (scaledw), roundf (scaledh)); | 488 | glScissor (tx, ty, roundf (scaledw), roundf (scaledh)); |
1457 | 507 | glEnable (GL_SCISSOR_TEST); | 489 | glEnable (GL_SCISSOR_TEST); |
1458 | @@ -516,22 +498,22 @@ | |||
1459 | 516 | } | 498 | } |
1460 | 517 | 499 | ||
1461 | 518 | void | 500 | void |
1465 | 519 | GLScreen::glBufferStencil (const GLMatrix &matrix, | 501 | GLScreen::glBufferStencil (const GLMatrix &matrix, |
1466 | 520 | GLVertexBuffer &vertexBuffer, | 502 | GLVertexBuffer &vertexBuffer, |
1467 | 521 | CompOutput *output) | 503 | CompOutput *output) |
1468 | 522 | { | 504 | { |
1469 | 523 | WRAPABLE_HND_FUNCTN (glBufferStencil, matrix, vertexBuffer, output); | 505 | WRAPABLE_HND_FUNCTN (glBufferStencil, matrix, vertexBuffer, output); |
1470 | 524 | 506 | ||
1473 | 525 | GLfloat x = output->x (); | 507 | GLfloat x = output->x (); |
1474 | 526 | GLfloat y = screen->height () - output->y2 (); | 508 | GLfloat y = screen->height () - output->y2 (); |
1475 | 527 | GLfloat x2 = output->x () + output->width (); | 509 | GLfloat x2 = output->x () + output->width (); |
1476 | 528 | GLfloat y2 = screen->height () - output->y2 () + output->height (); | 510 | GLfloat y2 = screen->height () - output->y2 () + output->height (); |
1477 | 529 | 511 | ||
1478 | 530 | GLfloat vertices[] = | 512 | GLfloat vertices[] = |
1479 | 531 | { | 513 | { |
1483 | 532 | x, y, 0, | 514 | x, y, 0, |
1484 | 533 | x, y2, 0, | 515 | x, y2, 0, |
1485 | 534 | x2, y, 0, | 516 | x2, y, 0, |
1486 | 535 | x2, y2, 0 | 517 | x2, y2, 0 |
1487 | 536 | }; | 518 | }; |
1488 | 537 | 519 | ||
1489 | @@ -576,8 +558,8 @@ | |||
1490 | 576 | priv->paintOutputRegion (sTransform, region, output, mask); | 558 | priv->paintOutputRegion (sTransform, region, output, mask); |
1491 | 577 | glDisableOutputClipping (); | 559 | glDisableOutputClipping (); |
1492 | 578 | } | 560 | } |
1495 | 579 | else if ( (GL::fboEnabled && GL::fboStencilSupported) || | 561 | else if ((GL::fboEnabled && GL::fboStencilSupported) || |
1496 | 580 | GL::stencilBuffer ) | 562 | GL::stencilBuffer ) |
1497 | 581 | { | 563 | { |
1498 | 582 | sTransform.toScreenSpace (output, -sAttrib.zTranslate); | 564 | sTransform.toScreenSpace (output, -sAttrib.zTranslate); |
1499 | 583 | 565 | ||
1500 | @@ -656,7 +638,7 @@ | |||
1501 | 656 | * windows are getting transformed (and so the unredirected window | 638 | * windows are getting transformed (and so the unredirected window |
1502 | 657 | * needs to be redirected again). | 639 | * needs to be redirected again). |
1503 | 658 | */ | 640 | */ |
1505 | 659 | if (!region.isEmpty () || | 641 | if (!region.isEmpty () || |
1506 | 660 | (mask & PAINT_SCREEN_FULL_MASK) || | 642 | (mask & PAINT_SCREEN_FULL_MASK) || |
1507 | 661 | (mask & PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK)) | 643 | (mask & PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK)) |
1508 | 662 | priv->paintOutputRegion (sTransform, region, output, mask); | 644 | priv->paintOutputRegion (sTransform, region, output, mask); |
1509 | @@ -671,9 +653,7 @@ | |||
1510 | 671 | return true; | 653 | return true; |
1511 | 672 | } | 654 | } |
1512 | 673 | else | 655 | else |
1513 | 674 | { | ||
1514 | 675 | return false; | 656 | return false; |
1515 | 676 | } | ||
1516 | 677 | } | 657 | } |
1517 | 678 | 658 | ||
1518 | 679 | void | 659 | void |
1519 | @@ -683,9 +663,9 @@ | |||
1520 | 683 | { | 663 | { |
1521 | 684 | WRAPABLE_HND_FUNCTN (glPaintCompositedOutput, region, fbo, mask) | 664 | WRAPABLE_HND_FUNCTN (glPaintCompositedOutput, region, fbo, mask) |
1522 | 685 | 665 | ||
1526 | 686 | GLMatrix sTransform; | 666 | GLMatrix sTransform; |
1527 | 687 | const GLTexture::Matrix & texmatrix = fbo->tex ()->matrix (); | 667 | const GLTexture::Matrix &texmatrix = fbo->tex ()->matrix (); |
1528 | 688 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); | 668 | GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); |
1529 | 689 | 669 | ||
1530 | 690 | streamingBuffer->begin (GL_TRIANGLES); | 670 | streamingBuffer->begin (GL_TRIANGLES); |
1531 | 691 | 671 | ||
1532 | @@ -696,7 +676,8 @@ | |||
1533 | 696 | GLfloat ty1 = 1.0 - COMP_TEX_COORD_Y (texmatrix, 0.0f); | 676 | GLfloat ty1 = 1.0 - COMP_TEX_COORD_Y (texmatrix, 0.0f); |
1534 | 697 | GLfloat ty2 = 1.0 - COMP_TEX_COORD_Y (texmatrix, screen->height ()); | 677 | GLfloat ty2 = 1.0 - COMP_TEX_COORD_Y (texmatrix, screen->height ()); |
1535 | 698 | 678 | ||
1537 | 699 | const GLfloat vertexData[] = { | 679 | const GLfloat vertexData[] = |
1538 | 680 | { | ||
1539 | 700 | 0.0f, 0.0f, 0.0f, | 681 | 0.0f, 0.0f, 0.0f, |
1540 | 701 | 0.0f, (float)screen->height (), 0.0f, | 682 | 0.0f, (float)screen->height (), 0.0f, |
1541 | 702 | (float)screen->width (), 0.0f, 0.0f, | 683 | (float)screen->width (), 0.0f, 0.0f, |
1542 | @@ -706,7 +687,8 @@ | |||
1543 | 706 | (float)screen->width (), 0.0f, 0.0f, | 687 | (float)screen->width (), 0.0f, 0.0f, |
1544 | 707 | }; | 688 | }; |
1545 | 708 | 689 | ||
1547 | 709 | const GLfloat textureData[] = { | 690 | const GLfloat textureData[] = |
1548 | 691 | { | ||
1549 | 710 | tx1, ty1, | 692 | tx1, ty1, |
1550 | 711 | tx1, ty2, | 693 | tx1, ty2, |
1551 | 712 | tx2, ty1, | 694 | tx2, ty1, |
1552 | @@ -721,7 +703,7 @@ | |||
1553 | 721 | else | 703 | else |
1554 | 722 | { | 704 | { |
1555 | 723 | BoxPtr pBox = const_cast <Region> (region.handle ())->rects; | 705 | BoxPtr pBox = const_cast <Region> (region.handle ())->rects; |
1557 | 724 | int nBox = const_cast <Region> (region.handle ())->numRects; | 706 | int nBox = const_cast <Region> (region.handle ())->numRects; |
1558 | 725 | 707 | ||
1559 | 726 | while (nBox--) | 708 | while (nBox--) |
1560 | 727 | { | 709 | { |
1561 | @@ -730,7 +712,8 @@ | |||
1562 | 730 | GLfloat ty1 = 1.0 - COMP_TEX_COORD_Y (texmatrix, pBox->y1); | 712 | GLfloat ty1 = 1.0 - COMP_TEX_COORD_Y (texmatrix, pBox->y1); |
1563 | 731 | GLfloat ty2 = 1.0 - COMP_TEX_COORD_Y (texmatrix, pBox->y2); | 713 | GLfloat ty2 = 1.0 - COMP_TEX_COORD_Y (texmatrix, pBox->y2); |
1564 | 732 | 714 | ||
1566 | 733 | const GLfloat vertexData[] = { | 715 | const GLfloat vertexData[] = |
1567 | 716 | { | ||
1568 | 734 | (float)pBox->x1, (float)pBox->y1, 0.0f, | 717 | (float)pBox->x1, (float)pBox->y1, 0.0f, |
1569 | 735 | (float)pBox->x1, (float)pBox->y2, 0.0f, | 718 | (float)pBox->x1, (float)pBox->y2, 0.0f, |
1570 | 736 | (float)pBox->x2, (float)pBox->y1, 0.0f, | 719 | (float)pBox->x2, (float)pBox->y1, 0.0f, |
1571 | @@ -740,7 +723,8 @@ | |||
1572 | 740 | (float)pBox->x2, (float)pBox->y1, 0.0f, | 723 | (float)pBox->x2, (float)pBox->y1, 0.0f, |
1573 | 741 | }; | 724 | }; |
1574 | 742 | 725 | ||
1576 | 743 | const GLfloat textureData[] = { | 726 | const GLfloat textureData[] = |
1577 | 727 | { | ||
1578 | 744 | tx1, ty1, | 728 | tx1, ty1, |
1579 | 745 | tx1, ty2, | 729 | tx1, ty2, |
1580 | 746 | tx2, ty1, | 730 | tx2, ty1, |
1581 | @@ -751,7 +735,8 @@ | |||
1582 | 751 | 735 | ||
1583 | 752 | streamingBuffer->addVertices (6, &vertexData[0]); | 736 | streamingBuffer->addVertices (6, &vertexData[0]); |
1584 | 753 | streamingBuffer->addTexCoords (0, 6, &textureData[0]); | 737 | streamingBuffer->addTexCoords (0, 6, &textureData[0]); |
1586 | 754 | pBox++; | 738 | |
1587 | 739 | ++pBox; | ||
1588 | 755 | } | 740 | } |
1589 | 756 | } | 741 | } |
1590 | 757 | 742 | ||
1591 | @@ -763,16 +748,17 @@ | |||
1592 | 763 | } | 748 | } |
1593 | 764 | 749 | ||
1594 | 765 | static void | 750 | static void |
1603 | 766 | addSingleQuad (GLVertexBuffer *vertexBuffer, | 751 | addSingleQuad (GLVertexBuffer *vertexBuffer, |
1604 | 767 | const GLTexture::MatrixList &matrix, | 752 | const GLTexture::MatrixList &matrix, |
1605 | 768 | unsigned int nMatrix, | 753 | unsigned int nMatrix, |
1606 | 769 | int x1, | 754 | int x1, |
1607 | 770 | int y1, | 755 | int y1, |
1608 | 771 | int x2, | 756 | int x2, |
1609 | 772 | int y2, | 757 | int y2, |
1610 | 773 | bool rect) | 758 | bool rect) |
1611 | 774 | { | 759 | { |
1613 | 775 | GLfloat vertexData[18] = { | 760 | GLfloat vertexData[18] = |
1614 | 761 | { | ||
1615 | 776 | (float)x1, (float)y1, 0.0, | 762 | (float)x1, (float)y1, 0.0, |
1616 | 777 | (float)x1, (float)y2, 0.0, | 763 | (float)x1, (float)y2, 0.0, |
1617 | 778 | (float)x2, (float)y1, 0.0, | 764 | (float)x2, (float)y1, 0.0, |
1618 | @@ -780,52 +766,58 @@ | |||
1619 | 780 | (float)x1, (float)y2, 0.0, | 766 | (float)x1, (float)y2, 0.0, |
1620 | 781 | (float)x2, (float)y2, 0.0 | 767 | (float)x2, (float)y2, 0.0 |
1621 | 782 | }; | 768 | }; |
1622 | 769 | |||
1623 | 783 | vertexBuffer->addVertices (6, vertexData); | 770 | vertexBuffer->addVertices (6, vertexData); |
1624 | 771 | unsigned int it; | ||
1625 | 784 | 772 | ||
1626 | 785 | if (rect) | 773 | if (rect) |
1627 | 786 | { | 774 | { |
1670 | 787 | unsigned int it; | 775 | for (it = 0; it < nMatrix; ++it) |
1671 | 788 | for (it = 0; it < nMatrix; it++) | 776 | { |
1672 | 789 | { | 777 | GLfloat data[2]; |
1673 | 790 | GLfloat data[2]; | 778 | const GLTexture::Matrix &mat = matrix[it]; |
1674 | 791 | const GLTexture::Matrix &mat = matrix[it]; | 779 | data[0] = COMP_TEX_COORD_X (mat, x1); |
1675 | 792 | data[0] = COMP_TEX_COORD_X (mat, x1); | 780 | data[1] = COMP_TEX_COORD_Y (mat, y1); |
1676 | 793 | data[1] = COMP_TEX_COORD_Y (mat, y1); | 781 | vertexBuffer->addTexCoords (it, 1, data); |
1677 | 794 | vertexBuffer->addTexCoords (it, 1, data); | 782 | } |
1678 | 795 | } | 783 | |
1679 | 796 | for (it = 0; it < nMatrix; it++) | 784 | for (it = 0; it < nMatrix; ++it) |
1680 | 797 | { | 785 | { |
1681 | 798 | GLfloat data[2]; | 786 | GLfloat data[2]; |
1682 | 799 | const GLTexture::Matrix &mat = matrix[it]; | 787 | const GLTexture::Matrix &mat = matrix[it]; |
1683 | 800 | data[0] = COMP_TEX_COORD_X (mat, x1); | 788 | data[0] = COMP_TEX_COORD_X (mat, x1); |
1684 | 801 | data[1] = COMP_TEX_COORD_Y (mat, y2); | 789 | data[1] = COMP_TEX_COORD_Y (mat, y2); |
1685 | 802 | vertexBuffer->addTexCoords (it, 1, data); | 790 | vertexBuffer->addTexCoords (it, 1, data); |
1686 | 803 | } | 791 | } |
1687 | 804 | for (it = 0; it < nMatrix; it++) | 792 | |
1688 | 805 | { | 793 | for (it = 0; it < nMatrix; ++it) |
1689 | 806 | GLfloat data[2]; | 794 | { |
1690 | 807 | const GLTexture::Matrix &mat = matrix[it]; | 795 | GLfloat data[2]; |
1691 | 808 | data[0] = COMP_TEX_COORD_X (mat, x2); | 796 | const GLTexture::Matrix &mat = matrix[it]; |
1692 | 809 | data[1] = COMP_TEX_COORD_Y (mat, y1); | 797 | data[0] = COMP_TEX_COORD_X (mat, x2); |
1693 | 810 | vertexBuffer->addTexCoords (it, 1, data); | 798 | data[1] = COMP_TEX_COORD_Y (mat, y1); |
1694 | 811 | } | 799 | vertexBuffer->addTexCoords (it, 1, data); |
1695 | 812 | for (it = 0; it < nMatrix; it++) | 800 | } |
1696 | 813 | { | 801 | |
1697 | 814 | GLfloat data[2]; | 802 | for (it = 0; it < nMatrix; ++it) |
1698 | 815 | const GLTexture::Matrix &mat = matrix[it]; | 803 | { |
1699 | 816 | data[0] = COMP_TEX_COORD_X (mat, x2); | 804 | GLfloat data[2]; |
1700 | 817 | data[1] = COMP_TEX_COORD_Y (mat, y1); | 805 | const GLTexture::Matrix &mat = matrix[it]; |
1701 | 818 | vertexBuffer->addTexCoords (it, 1, data); | 806 | data[0] = COMP_TEX_COORD_X (mat, x2); |
1702 | 819 | } | 807 | data[1] = COMP_TEX_COORD_Y (mat, y1); |
1703 | 820 | for (it = 0; it < nMatrix; it++) | 808 | vertexBuffer->addTexCoords (it, 1, data); |
1704 | 821 | { | 809 | } |
1705 | 822 | GLfloat data[2]; | 810 | |
1706 | 823 | const GLTexture::Matrix &mat = matrix[it]; | 811 | for (it = 0; it < nMatrix; ++it) |
1707 | 824 | data[0] = COMP_TEX_COORD_X (mat, x1); | 812 | { |
1708 | 825 | data[1] = COMP_TEX_COORD_Y (mat, y2); | 813 | GLfloat data[2]; |
1709 | 826 | vertexBuffer->addTexCoords (it, 1, data); | 814 | const GLTexture::Matrix &mat = matrix[it]; |
1710 | 827 | } | 815 | data[0] = COMP_TEX_COORD_X (mat, x1); |
1711 | 828 | for (it = 0; it < nMatrix; it++) | 816 | data[1] = COMP_TEX_COORD_Y (mat, y2); |
1712 | 817 | vertexBuffer->addTexCoords (it, 1, data); | ||
1713 | 818 | } | ||
1714 | 819 | |||
1715 | 820 | for (it = 0; it < nMatrix; ++it) | ||
1716 | 829 | { | 821 | { |
1717 | 830 | GLfloat data[2]; | 822 | GLfloat data[2]; |
1718 | 831 | const GLTexture::Matrix &mat = matrix[it]; | 823 | const GLTexture::Matrix &mat = matrix[it]; |
1719 | @@ -836,8 +828,7 @@ | |||
1720 | 836 | } | 828 | } |
1721 | 837 | else | 829 | else |
1722 | 838 | { | 830 | { |
1725 | 839 | unsigned int it; | 831 | for (it = 0; it < nMatrix; ++it) |
1724 | 840 | for (it = 0; it < nMatrix; it++) | ||
1726 | 841 | { | 832 | { |
1727 | 842 | GLfloat data[2]; | 833 | GLfloat data[2]; |
1728 | 843 | const GLTexture::Matrix &mat = matrix[it]; | 834 | const GLTexture::Matrix &mat = matrix[it]; |
1729 | @@ -845,39 +836,44 @@ | |||
1730 | 845 | data[1] = COMP_TEX_COORD_YX (mat, x1, y1); | 836 | data[1] = COMP_TEX_COORD_YX (mat, x1, y1); |
1731 | 846 | vertexBuffer->addTexCoords (it, 1, data); | 837 | vertexBuffer->addTexCoords (it, 1, data); |
1732 | 847 | } | 838 | } |
1766 | 848 | for (it = 0; it < nMatrix; it++) | 839 | |
1767 | 849 | { | 840 | for (it = 0; it < nMatrix; ++it) |
1768 | 850 | GLfloat data[2]; | 841 | { |
1769 | 851 | const GLTexture::Matrix &mat = matrix[it]; | 842 | GLfloat data[2]; |
1770 | 852 | data[0] = COMP_TEX_COORD_XY (mat, x1, y2); | 843 | const GLTexture::Matrix &mat = matrix[it]; |
1771 | 853 | data[1] = COMP_TEX_COORD_YX (mat, x1, y2); | 844 | data[0] = COMP_TEX_COORD_XY (mat, x1, y2); |
1772 | 854 | vertexBuffer->addTexCoords (it, 1, data); | 845 | data[1] = COMP_TEX_COORD_YX (mat, x1, y2); |
1773 | 855 | } | 846 | vertexBuffer->addTexCoords (it, 1, data); |
1774 | 856 | for (it = 0; it < nMatrix; it++) | 847 | } |
1775 | 857 | { | 848 | |
1776 | 858 | GLfloat data[2]; | 849 | for (it = 0; it < nMatrix; ++it) |
1777 | 859 | const GLTexture::Matrix &mat = matrix[it]; | 850 | { |
1778 | 860 | data[0] = COMP_TEX_COORD_XY (mat, x2, y1); | 851 | GLfloat data[2]; |
1779 | 861 | data[1] = COMP_TEX_COORD_YX (mat, x2, y1); | 852 | const GLTexture::Matrix &mat = matrix[it]; |
1780 | 862 | vertexBuffer->addTexCoords (it, 1, data); | 853 | data[0] = COMP_TEX_COORD_XY (mat, x2, y1); |
1781 | 863 | } | 854 | data[1] = COMP_TEX_COORD_YX (mat, x2, y1); |
1782 | 864 | for (it = 0; it < nMatrix; it++) | 855 | vertexBuffer->addTexCoords (it, 1, data); |
1783 | 865 | { | 856 | } |
1784 | 866 | GLfloat data[2]; | 857 | |
1785 | 867 | const GLTexture::Matrix &mat = matrix[it]; | 858 | for (it = 0; it < nMatrix; ++it) |
1786 | 868 | data[0] = COMP_TEX_COORD_XY (mat, x2, y1); | 859 | { |
1787 | 869 | data[1] = COMP_TEX_COORD_YX (mat, x2, y1); | 860 | GLfloat data[2]; |
1788 | 870 | vertexBuffer->addTexCoords (it, 1, data); | 861 | const GLTexture::Matrix &mat = matrix[it]; |
1789 | 871 | } | 862 | data[0] = COMP_TEX_COORD_XY (mat, x2, y1); |
1790 | 872 | for (it = 0; it < nMatrix; it++) | 863 | data[1] = COMP_TEX_COORD_YX (mat, x2, y1); |
1791 | 873 | { | 864 | vertexBuffer->addTexCoords (it, 1, data); |
1792 | 874 | GLfloat data[2]; | 865 | } |
1793 | 875 | const GLTexture::Matrix &mat = matrix[it]; | 866 | |
1794 | 876 | data[0] = COMP_TEX_COORD_XY (mat, x1, y2); | 867 | for (it = 0; it < nMatrix; ++it) |
1795 | 877 | data[1] = COMP_TEX_COORD_YX (mat, x1, y2); | 868 | { |
1796 | 878 | vertexBuffer->addTexCoords (it, 1, data); | 869 | GLfloat data[2]; |
1797 | 879 | } | 870 | const GLTexture::Matrix &mat = matrix[it]; |
1798 | 880 | for (it = 0; it < nMatrix; it++) | 871 | data[0] = COMP_TEX_COORD_XY (mat, x1, y2); |
1799 | 872 | data[1] = COMP_TEX_COORD_YX (mat, x1, y2); | ||
1800 | 873 | vertexBuffer->addTexCoords (it, 1, data); | ||
1801 | 874 | } | ||
1802 | 875 | |||
1803 | 876 | for (it = 0; it < nMatrix; ++it) | ||
1804 | 881 | { | 877 | { |
1805 | 882 | GLfloat data[2]; | 878 | GLfloat data[2]; |
1806 | 883 | const GLTexture::Matrix &mat = matrix[it]; | 879 | const GLTexture::Matrix &mat = matrix[it]; |
1807 | @@ -889,16 +885,16 @@ | |||
1808 | 889 | } | 885 | } |
1809 | 890 | 886 | ||
1810 | 891 | static void | 887 | static void |
1821 | 892 | addQuads (GLVertexBuffer *vertexBuffer, | 888 | addQuads (GLVertexBuffer *vertexBuffer, |
1822 | 893 | const GLTexture::MatrixList &matrix, | 889 | const GLTexture::MatrixList &matrix, |
1823 | 894 | unsigned int nMatrix, | 890 | unsigned int nMatrix, |
1824 | 895 | int x1, | 891 | int x1, |
1825 | 896 | int y1, | 892 | int y1, |
1826 | 897 | int x2, | 893 | int x2, |
1827 | 898 | int y2, | 894 | int y2, |
1828 | 899 | bool rect, | 895 | bool rect, |
1829 | 900 | unsigned int maxGridWidth, | 896 | unsigned int maxGridWidth, |
1830 | 901 | unsigned int maxGridHeight) | 897 | unsigned int maxGridHeight) |
1831 | 902 | { | 898 | { |
1832 | 903 | if (maxGridWidth == 0 || maxGridHeight == 0) | 899 | if (maxGridWidth == 0 || maxGridHeight == 0) |
1833 | 904 | return; | 900 | return; |
1834 | @@ -909,9 +905,7 @@ | |||
1835 | 909 | 1 + (y2 - y1 - 1) / (int) maxGridHeight; | 905 | 1 + (y2 - y1 - 1) / (int) maxGridHeight; |
1836 | 910 | 906 | ||
1837 | 911 | if (nQuadsX == 1 && nQuadsY == 1) | 907 | if (nQuadsX == 1 && nQuadsY == 1) |
1838 | 912 | { | ||
1839 | 913 | addSingleQuad (vertexBuffer, matrix, nMatrix, x1, y1, x2, y2, rect); | 908 | addSingleQuad (vertexBuffer, matrix, nMatrix, x1, y1, x2, y2, rect); |
1840 | 914 | } | ||
1841 | 915 | else | 909 | else |
1842 | 916 | { | 910 | { |
1843 | 917 | int quadWidth = 1 + (x2 - x1 - 1) / nQuadsX; // ceil. division | 911 | int quadWidth = 1 + (x2 - x1 - 1) / nQuadsX; // ceil. division |
1844 | @@ -942,30 +936,30 @@ | |||
1845 | 942 | { | 936 | { |
1846 | 943 | WRAPABLE_HND_FUNCTN (glAddGeometry, matrix, region, clip) | 937 | WRAPABLE_HND_FUNCTN (glAddGeometry, matrix, region, clip) |
1847 | 944 | 938 | ||
1848 | 945 | BoxRec full; | ||
1849 | 946 | int nMatrix = matrix.size (); | 939 | int nMatrix = matrix.size (); |
1850 | 940 | BoxRec full = clip.handle ()->extents; | ||
1851 | 947 | 941 | ||
1852 | 948 | full = clip.handle ()->extents; | ||
1853 | 949 | if (region.handle ()->extents.x1 > full.x1) | 942 | if (region.handle ()->extents.x1 > full.x1) |
1854 | 950 | full.x1 = region.handle ()->extents.x1; | 943 | full.x1 = region.handle ()->extents.x1; |
1855 | 944 | |||
1856 | 951 | if (region.handle ()->extents.y1 > full.y1) | 945 | if (region.handle ()->extents.y1 > full.y1) |
1857 | 952 | full.y1 = region.handle ()->extents.y1; | 946 | full.y1 = region.handle ()->extents.y1; |
1858 | 947 | |||
1859 | 953 | if (region.handle ()->extents.x2 < full.x2) | 948 | if (region.handle ()->extents.x2 < full.x2) |
1860 | 954 | full.x2 = region.handle ()->extents.x2; | 949 | full.x2 = region.handle ()->extents.x2; |
1861 | 950 | |||
1862 | 955 | if (region.handle ()->extents.y2 < full.y2) | 951 | if (region.handle ()->extents.y2 < full.y2) |
1863 | 956 | full.y2 = region.handle ()->extents.y2; | 952 | full.y2 = region.handle ()->extents.y2; |
1864 | 957 | 953 | ||
1865 | 958 | if (full.x1 < full.x2 && full.y1 < full.y2) | 954 | if (full.x1 < full.x2 && full.y1 < full.y2) |
1866 | 959 | { | 955 | { |
1867 | 960 | BoxPtr pBox; | ||
1868 | 961 | int nBox; | ||
1869 | 962 | BoxPtr pClip; | 956 | BoxPtr pClip; |
1870 | 963 | int nClip; | 957 | int nClip; |
1871 | 964 | BoxRec cbox; | 958 | BoxRec cbox; |
1872 | 965 | int it, x1, y1, x2, y2; | 959 | int it, x1, y1, x2, y2; |
1873 | 966 | bool rect = true; | 960 | bool rect = true; |
1874 | 967 | 961 | ||
1876 | 968 | for (it = 0; it < nMatrix; it++) | 962 | for (it = 0; it < nMatrix; ++it) |
1877 | 969 | { | 963 | { |
1878 | 970 | if (matrix[it].xy != 0.0f || matrix[it].yx != 0.0f) | 964 | if (matrix[it].xy != 0.0f || matrix[it].yx != 0.0f) |
1879 | 971 | { | 965 | { |
1880 | @@ -974,8 +968,8 @@ | |||
1881 | 974 | } | 968 | } |
1882 | 975 | } | 969 | } |
1883 | 976 | 970 | ||
1886 | 977 | pBox = const_cast <Region> (region.handle ())->rects; | 971 | BoxPtr pBox = const_cast <Region> (region.handle ())->rects; |
1887 | 978 | nBox = const_cast <Region> (region.handle ())->numRects; | 972 | int nBox = const_cast <Region> (region.handle ())->numRects; |
1888 | 979 | 973 | ||
1889 | 980 | while (nBox--) | 974 | while (nBox--) |
1890 | 981 | { | 975 | { |
1891 | @@ -984,7 +978,7 @@ | |||
1892 | 984 | x2 = pBox->x2; | 978 | x2 = pBox->x2; |
1893 | 985 | y2 = pBox->y2; | 979 | y2 = pBox->y2; |
1894 | 986 | 980 | ||
1896 | 987 | pBox++; | 981 | ++pBox; |
1897 | 988 | 982 | ||
1898 | 989 | if (x1 < full.x1) | 983 | if (x1 < full.x1) |
1899 | 990 | x1 = full.x1; | 984 | x1 = full.x1; |
1900 | @@ -1014,14 +1008,17 @@ | |||
1901 | 1014 | { | 1008 | { |
1902 | 1015 | cbox = *pClip; | 1009 | cbox = *pClip; |
1903 | 1016 | 1010 | ||
1905 | 1017 | pClip++; | 1011 | ++pClip; |
1906 | 1018 | 1012 | ||
1907 | 1019 | if (cbox.x1 < x1) | 1013 | if (cbox.x1 < x1) |
1908 | 1020 | cbox.x1 = x1; | 1014 | cbox.x1 = x1; |
1909 | 1015 | |||
1910 | 1021 | if (cbox.y1 < y1) | 1016 | if (cbox.y1 < y1) |
1911 | 1022 | cbox.y1 = y1; | 1017 | cbox.y1 = y1; |
1912 | 1018 | |||
1913 | 1023 | if (cbox.x2 > x2) | 1019 | if (cbox.x2 > x2) |
1914 | 1024 | cbox.x2 = x2; | 1020 | cbox.x2 = x2; |
1915 | 1021 | |||
1916 | 1025 | if (cbox.y2 > y2) | 1022 | if (cbox.y2 > y2) |
1917 | 1026 | cbox.y2 = y2; | 1023 | cbox.y2 = y2; |
1918 | 1027 | 1024 | ||
1919 | @@ -1157,9 +1154,7 @@ | |||
1920 | 1157 | GL::activeTexture (GL_TEXTURE2_ARB); | 1154 | GL::activeTexture (GL_TEXTURE2_ARB); |
1921 | 1158 | } | 1155 | } |
1922 | 1159 | else | 1156 | else |
1923 | 1160 | { | ||
1924 | 1161 | w->vertexBuffer ()->render (transform, attrib); | 1157 | w->vertexBuffer ()->render (transform, attrib); |
1925 | 1162 | } | ||
1926 | 1163 | 1158 | ||
1927 | 1164 | texture->disable (); | 1159 | texture->disable (); |
1928 | 1165 | 1160 | ||
1929 | @@ -1221,9 +1216,7 @@ | |||
1930 | 1221 | gs->setTexEnvMode (GL_REPLACE); | 1216 | gs->setTexEnvMode (GL_REPLACE); |
1931 | 1222 | } | 1217 | } |
1932 | 1223 | else | 1218 | else |
1933 | 1224 | { | ||
1934 | 1225 | w->vertexBuffer ()->render (transform, attrib); | 1219 | w->vertexBuffer ()->render (transform, attrib); |
1935 | 1226 | } | ||
1936 | 1227 | } | 1220 | } |
1937 | 1228 | else if (attrib.brightness != BRIGHT) | 1221 | else if (attrib.brightness != BRIGHT) |
1938 | 1229 | { | 1222 | { |
1939 | @@ -1237,9 +1230,7 @@ | |||
1940 | 1237 | gs->setTexEnvMode (GL_REPLACE); | 1230 | gs->setTexEnvMode (GL_REPLACE); |
1941 | 1238 | } | 1231 | } |
1942 | 1239 | else | 1232 | else |
1943 | 1240 | { | ||
1944 | 1241 | w->vertexBuffer ()->render (transform, attrib); | 1233 | w->vertexBuffer ()->render (transform, attrib); |
1945 | 1242 | } | ||
1946 | 1243 | 1234 | ||
1947 | 1244 | texture->disable (); | 1235 | texture->disable (); |
1948 | 1245 | } | 1236 | } |
1949 | @@ -1247,10 +1238,10 @@ | |||
1950 | 1247 | #endif | 1238 | #endif |
1951 | 1248 | 1239 | ||
1952 | 1249 | void | 1240 | void |
1954 | 1250 | GLWindow::glDrawTexture (GLTexture *texture, | 1241 | GLWindow::glDrawTexture (GLTexture *texture, |
1955 | 1251 | const GLMatrix &transform, | 1242 | const GLMatrix &transform, |
1956 | 1252 | const GLWindowPaintAttrib &attrib, | 1243 | const GLWindowPaintAttrib &attrib, |
1958 | 1253 | unsigned int mask) | 1244 | unsigned int mask) |
1959 | 1254 | { | 1245 | { |
1960 | 1255 | WRAPABLE_HND_FUNCTN (glDrawTexture, texture, transform, attrib, mask) | 1246 | WRAPABLE_HND_FUNCTN (glDrawTexture, texture, transform, attrib, mask) |
1961 | 1256 | 1247 | ||
1962 | @@ -1287,21 +1278,19 @@ | |||
1963 | 1287 | } | 1278 | } |
1964 | 1288 | 1279 | ||
1965 | 1289 | bool | 1280 | bool |
1967 | 1290 | GLWindow::glDraw (const GLMatrix &transform, | 1281 | GLWindow::glDraw (const GLMatrix &transform, |
1968 | 1291 | const GLWindowPaintAttrib &attrib, | 1282 | const GLWindowPaintAttrib &attrib, |
1971 | 1292 | const CompRegion ®ion, | 1283 | const CompRegion ®ion, |
1972 | 1293 | unsigned int mask) | 1284 | unsigned int mask) |
1973 | 1294 | { | 1285 | { |
1974 | 1295 | WRAPABLE_HND_FUNCTN_RETURN (bool, glDraw, transform, | 1286 | WRAPABLE_HND_FUNCTN_RETURN (bool, glDraw, transform, |
1975 | 1296 | attrib, region, mask) | 1287 | attrib, region, mask) |
1976 | 1297 | 1288 | ||
1977 | 1298 | const CompRegion ® = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ? | 1289 | const CompRegion ® = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ? |
1984 | 1299 | infiniteRegion : region; | 1290 | infiniteRegion : region; |
1985 | 1300 | 1291 | ||
1986 | 1301 | if (reg.isEmpty ()) | 1292 | if (reg.isEmpty () || |
1987 | 1302 | return true; | 1293 | !priv->window->isViewable () || |
1982 | 1303 | |||
1983 | 1304 | if (!priv->window->isViewable () || | ||
1988 | 1305 | !priv->cWindow->damaged ()) | 1294 | !priv->cWindow->damaged ()) |
1989 | 1306 | return true; | 1295 | return true; |
1990 | 1307 | 1296 | ||
1991 | @@ -1327,11 +1316,12 @@ | |||
1992 | 1327 | if (priv->updateState & PrivateGLWindow::UpdateRegion) | 1316 | if (priv->updateState & PrivateGLWindow::UpdateRegion) |
1993 | 1328 | priv->updateWindowRegions (); | 1317 | priv->updateWindowRegions (); |
1994 | 1329 | 1318 | ||
1996 | 1330 | for (unsigned int i = 0; i < priv->textures.size (); i++) | 1319 | for (unsigned int i = 0; i < priv->textures.size (); ++i) |
1997 | 1331 | { | 1320 | { |
1998 | 1332 | ml[0] = priv->matrices[i]; | 1321 | ml[0] = priv->matrices[i]; |
1999 | 1333 | priv->vertexBuffer->begin (); | 1322 | priv->vertexBuffer->begin (); |
2000 | 1334 | glAddGeometry (ml, priv->regions[i], reg); | 1323 | glAddGeometry (ml, priv->regions[i], reg); |
2001 | 1324 | |||
2002 | 1335 | if (priv->vertexBuffer->end ()) | 1325 | if (priv->vertexBuffer->end ()) |
2003 | 1336 | glDrawTexture (priv->textures[i], transform, attrib, mask); | 1326 | glDrawTexture (priv->textures[i], transform, attrib, mask); |
2004 | 1337 | } | 1327 | } |
2005 | @@ -1347,8 +1337,6 @@ | |||
2006 | 1347 | { | 1337 | { |
2007 | 1348 | WRAPABLE_HND_FUNCTN_RETURN (bool, glPaint, attrib, transform, region, mask) | 1338 | WRAPABLE_HND_FUNCTN_RETURN (bool, glPaint, attrib, transform, region, mask) |
2008 | 1349 | 1339 | ||
2009 | 1350 | bool status; | ||
2010 | 1351 | |||
2011 | 1352 | priv->lastPaint = attrib; | 1340 | priv->lastPaint = attrib; |
2012 | 1353 | 1341 | ||
2013 | 1354 | if (priv->window->alpha () || attrib.opacity != OPAQUE) | 1342 | if (priv->window->alpha () || attrib.opacity != OPAQUE) |
2014 | @@ -1358,16 +1346,10 @@ | |||
2015 | 1358 | 1346 | ||
2016 | 1359 | if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK) | 1347 | if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK) |
2017 | 1360 | { | 1348 | { |
2028 | 1361 | if (mask & PAINT_WINDOW_TRANSFORMED_MASK) | 1349 | if (mask & PAINT_WINDOW_TRANSFORMED_MASK || |
2029 | 1362 | return false; | 1350 | mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK || |
2030 | 1363 | 1351 | mask & PAINT_WINDOW_TRANSLUCENT_MASK || | |
2031 | 1364 | if (mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK) | 1352 | priv->window->shaded ()) |
2022 | 1365 | return false; | ||
2023 | 1366 | |||
2024 | 1367 | if (mask & PAINT_WINDOW_TRANSLUCENT_MASK) | ||
2025 | 1368 | return false; | ||
2026 | 1369 | |||
2027 | 1370 | if (priv->window->shaded ()) | ||
2032 | 1371 | return false; | 1353 | return false; |
2033 | 1372 | 1354 | ||
2034 | 1373 | return true; | 1355 | return true; |
2035 | @@ -1376,7 +1358,7 @@ | |||
2036 | 1376 | if (mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK) | 1358 | if (mask & PAINT_WINDOW_NO_CORE_INSTANCE_MASK) |
2037 | 1377 | return true; | 1359 | return true; |
2038 | 1378 | 1360 | ||
2040 | 1379 | status = glDraw (transform, attrib, region, mask); | 1361 | bool status = glDraw (transform, attrib, region, mask); |
2041 | 1380 | 1362 | ||
2042 | 1381 | return status; | 1363 | return status; |
2043 | 1382 | } | 1364 | } |
2044 | 1383 | 1365 | ||
2045 | === modified file 'plugins/opengl/src/privates.h' | |||
2046 | --- plugins/opengl/src/privates.h 2013-01-03 16:05:26 +0000 | |||
2047 | +++ plugins/opengl/src/privates.h 2013-07-24 16:05:45 +0000 | |||
2048 | @@ -59,7 +59,7 @@ | |||
2049 | 59 | 59 | ||
2050 | 60 | protected: | 60 | protected: |
2051 | 61 | 61 | ||
2053 | 62 | Display *mDpy; | 62 | Display *mDpy; |
2054 | 63 | const CompSize &mSize; | 63 | const CompSize &mSize; |
2055 | 64 | }; | 64 | }; |
2056 | 65 | 65 | ||
2057 | @@ -70,9 +70,9 @@ | |||
2058 | 70 | { | 70 | { |
2059 | 71 | public: | 71 | public: |
2060 | 72 | 72 | ||
2064 | 73 | GLXDoubleBuffer (Display *, | 73 | GLXDoubleBuffer (Display *, |
2065 | 74 | const CompSize &, | 74 | const CompSize &, |
2066 | 75 | Window); | 75 | Window ); |
2067 | 76 | 76 | ||
2068 | 77 | void swap () const; | 77 | void swap () const; |
2069 | 78 | bool blitAvailable () const; | 78 | bool blitAvailable () const; |
2070 | @@ -93,9 +93,9 @@ | |||
2071 | 93 | { | 93 | { |
2072 | 94 | public: | 94 | public: |
2073 | 95 | 95 | ||
2077 | 96 | EGLDoubleBuffer (Display *, | 96 | EGLDoubleBuffer (Display *, |
2078 | 97 | const CompSize &, | 97 | const CompSize &, |
2079 | 98 | EGLSurface const &); | 98 | EGLSurface const &); |
2080 | 99 | 99 | ||
2081 | 100 | void swap () const; | 100 | void swap () const; |
2082 | 101 | bool blitAvailable () const; | 101 | bool blitAvailable () const; |
2083 | @@ -106,7 +106,7 @@ | |||
2084 | 106 | 106 | ||
2085 | 107 | private: | 107 | private: |
2086 | 108 | 108 | ||
2088 | 109 | EGLSurface const & mSurface; | 109 | EGLSurface const &mSurface; |
2089 | 110 | }; | 110 | }; |
2090 | 111 | 111 | ||
2091 | 112 | #endif | 112 | #endif |
2092 | @@ -114,6 +114,7 @@ | |||
2093 | 114 | class GLIcon | 114 | class GLIcon |
2094 | 115 | { | 115 | { |
2095 | 116 | public: | 116 | public: |
2096 | 117 | |||
2097 | 117 | GLIcon () : icon (NULL) {} | 118 | GLIcon () : icon (NULL) {} |
2098 | 118 | 119 | ||
2099 | 119 | CompIcon *icon; | 120 | CompIcon *icon; |
2100 | @@ -126,10 +127,12 @@ | |||
2101 | 126 | public OpenglOptions | 127 | public OpenglOptions |
2102 | 127 | { | 128 | { |
2103 | 128 | public: | 129 | public: |
2104 | 130 | |||
2105 | 129 | PrivateGLScreen (GLScreen *gs); | 131 | PrivateGLScreen (GLScreen *gs); |
2106 | 130 | ~PrivateGLScreen (); | 132 | ~PrivateGLScreen (); |
2107 | 131 | 133 | ||
2109 | 132 | bool setOption (const CompString &name, CompOption::Value &value); | 134 | bool setOption (const CompString &name, |
2110 | 135 | CompOption::Value &value); | ||
2111 | 133 | 136 | ||
2112 | 134 | void handleEvent (XEvent *event); | 137 | void handleEvent (XEvent *event); |
2113 | 135 | 138 | ||
2114 | @@ -149,7 +152,7 @@ | |||
2115 | 149 | bool compositingActive (); | 152 | bool compositingActive (); |
2116 | 150 | 153 | ||
2117 | 151 | void paintBackground (const GLMatrix &transform, | 154 | void paintBackground (const GLMatrix &transform, |
2119 | 152 | const CompRegion ®ion, | 155 | const CompRegion ®ion, |
2120 | 153 | bool transformed); | 156 | bool transformed); |
2121 | 154 | 157 | ||
2122 | 155 | void paintOutputRegion (const GLMatrix &transform, | 158 | void paintOutputRegion (const GLMatrix &transform, |
2123 | @@ -165,67 +168,69 @@ | |||
2124 | 165 | 168 | ||
2125 | 166 | public: | 169 | public: |
2126 | 167 | 170 | ||
2129 | 168 | GLScreen *gScreen; | 171 | GLScreen *gScreen; |
2130 | 169 | CompositeScreen *cScreen; | 172 | CompositeScreen *cScreen; |
2131 | 170 | 173 | ||
2133 | 171 | GLenum textureFilter; | 174 | GLenum textureFilter; |
2134 | 172 | 175 | ||
2135 | 173 | #ifndef USE_GLES | 176 | #ifndef USE_GLES |
2137 | 174 | GLFBConfig glxPixmapFBConfigs[MAX_DEPTH + 1]; | 177 | GLFBConfig glxPixmapFBConfigs[MAX_DEPTH + 1]; |
2138 | 175 | #endif | 178 | #endif |
2139 | 176 | 179 | ||
2151 | 177 | GLTexture::List backgroundTextures; | 180 | GLTexture::List backgroundTextures; |
2152 | 178 | bool backgroundLoaded; | 181 | bool backgroundLoaded; |
2153 | 179 | 182 | ||
2154 | 180 | GLTexture::Filter filter[3]; | 183 | GLTexture::Filter filter[3]; |
2155 | 181 | 184 | ||
2156 | 182 | CompPoint rasterPos; | 185 | CompPoint rasterPos; |
2157 | 183 | 186 | ||
2158 | 184 | GLMatrix *projection; | 187 | GLMatrix *projection; |
2159 | 185 | 188 | ||
2160 | 186 | bool clearBuffers; | 189 | bool clearBuffers; |
2161 | 187 | bool lighting; | 190 | bool lighting; |
2162 | 188 | 191 | ||
2163 | 189 | #ifdef USE_GLES | 192 | #ifdef USE_GLES |
2167 | 190 | EGLContext ctx; | 193 | EGLContext ctx; |
2168 | 191 | EGLSurface surface; | 194 | EGLSurface surface; |
2169 | 192 | EGLDoubleBuffer doubleBuffer; | 195 | EGLDoubleBuffer doubleBuffer; |
2170 | 193 | #else | 196 | #else |
2172 | 194 | GLXContext ctx; | 197 | GLXContext ctx; |
2173 | 195 | 198 | ||
2176 | 196 | GL::GLXGetProcAddressProc getProcAddress; | 199 | GL::GLXGetProcAddressProc getProcAddress; |
2177 | 197 | GLXDoubleBuffer doubleBuffer; | 200 | GLXDoubleBuffer doubleBuffer; |
2178 | 198 | #endif | 201 | #endif |
2179 | 199 | 202 | ||
2182 | 200 | GLFramebufferObject *scratchFbo; | 203 | GLFramebufferObject *scratchFbo; |
2183 | 201 | CompRegion outputRegion; | 204 | CompRegion outputRegion; |
2184 | 202 | 205 | ||
2188 | 203 | XRectangle lastViewport; | 206 | XRectangle lastViewport; |
2189 | 204 | bool refreshSubBuffer; | 207 | bool refreshSubBuffer; |
2190 | 205 | unsigned int lastMask; | 208 | unsigned int lastMask; |
2191 | 206 | 209 | ||
2192 | 207 | std::vector<GLTexture::BindPixmapProc> bindPixmap; | 210 | std::vector<GLTexture::BindPixmapProc> bindPixmap; |
2197 | 208 | bool hasCompositing; | 211 | bool hasCompositing; |
2198 | 209 | bool commonFrontbuffer; | 212 | bool commonFrontbuffer; |
2199 | 210 | bool incorrectRefreshRate; // hack for NVIDIA specifying an incorrect | 213 | bool incorrectRefreshRate; // hack for NVIDIA specifying an incorrect |
2200 | 211 | // refresh rate, causing us to miss vblanks | 214 | // refresh rate, causing us to miss vblanks |
2201 | 212 | 215 | ||
2202 | 213 | GLIcon defaultIcon; | 216 | GLIcon defaultIcon; |
2203 | 214 | 217 | ||
2218 | 215 | Window saveWindow; // hack for broken applications, see: | 218 | Window saveWindow; // hack for broken applications, see: |
2219 | 216 | // https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/807487 | 219 | // https://bugs.launchpad.net/ubuntu/+source/compiz/+bug/807487 |
2220 | 217 | 220 | ||
2221 | 218 | GLProgramCache *programCache; | 221 | GLProgramCache *programCache; |
2222 | 219 | GLShaderCache shaderCache; | 222 | GLShaderCache shaderCache; |
2223 | 220 | GLVertexBuffer::AutoProgram *autoProgram; | 223 | GLVertexBuffer::AutoProgram *autoProgram; |
2224 | 221 | 224 | ||
2225 | 222 | Pixmap rootPixmapCopy; | 225 | Pixmap rootPixmapCopy; |
2226 | 223 | CompSize rootPixmapSize; | 226 | CompSize rootPixmapSize; |
2227 | 224 | 227 | ||
2228 | 225 | const char *glVendor, *glRenderer, *glVersion; | 228 | const char *glVendor; |
2229 | 226 | 229 | const char *glRenderer; | |
2230 | 227 | mutable CompString prevRegex; | 230 | const char *glVersion; |
2231 | 228 | mutable bool prevBlacklisted; | 231 | |
2232 | 232 | mutable CompString prevRegex; | ||
2233 | 233 | mutable bool prevBlacklisted; | ||
2234 | 229 | }; | 234 | }; |
2235 | 230 | 235 | ||
2236 | 231 | class PrivateGLWindow : | 236 | class PrivateGLWindow : |
2237 | @@ -238,55 +243,64 @@ | |||
2238 | 238 | static const unsigned int UpdateMatrix = 1 << 1; | 243 | static const unsigned int UpdateMatrix = 1 << 1; |
2239 | 239 | 244 | ||
2240 | 240 | public: | 245 | public: |
2241 | 246 | |||
2242 | 241 | PrivateGLWindow (CompWindow *w, GLWindow *gw); | 247 | PrivateGLWindow (CompWindow *w, GLWindow *gw); |
2243 | 242 | ~PrivateGLWindow (); | 248 | ~PrivateGLWindow (); |
2244 | 243 | 249 | ||
2245 | 244 | void windowNotify (CompWindowNotify n); | 250 | void windowNotify (CompWindowNotify n); |
2248 | 245 | void resizeNotify (int dx, int dy, int dwidth, int dheight); | 251 | |
2249 | 246 | void moveNotify (int dx, int dy, bool now); | 252 | void resizeNotify (int dx, |
2250 | 253 | int dy, | ||
2251 | 254 | int dwidth, | ||
2252 | 255 | int dheight); | ||
2253 | 256 | |||
2254 | 257 | void moveNotify (int dx, | ||
2255 | 258 | int dy, | ||
2256 | 259 | bool now); | ||
2257 | 260 | |||
2258 | 247 | void updateFrameRegion (CompRegion ®ion); | 261 | void updateFrameRegion (CompRegion ®ion); |
2259 | 248 | 262 | ||
2260 | 249 | void setWindowMatrix (); | 263 | void setWindowMatrix (); |
2261 | 264 | |||
2262 | 250 | void updateWindowRegions (); | 265 | void updateWindowRegions (); |
2263 | 251 | 266 | ||
2264 | 252 | void clearTextures (); | 267 | void clearTextures (); |
2265 | 253 | 268 | ||
2292 | 254 | CompWindow *window; | 269 | CompWindow *window; |
2293 | 255 | GLWindow *gWindow; | 270 | GLWindow *gWindow; |
2294 | 256 | CompositeWindow *cWindow; | 271 | CompositeWindow *cWindow; |
2295 | 257 | GLScreen *gScreen; | 272 | GLScreen *gScreen; |
2296 | 258 | 273 | ||
2297 | 259 | GLTexture::List textures; | 274 | GLTexture::List textures; |
2298 | 260 | GLTexture::MatrixList matrices; | 275 | GLTexture::MatrixList matrices; |
2299 | 261 | CompRegion::Vector regions; | 276 | CompRegion::Vector regions; |
2300 | 262 | unsigned int updateState; | 277 | unsigned int updateState; |
2301 | 263 | bool needsRebind; | 278 | bool needsRebind; |
2302 | 264 | 279 | ||
2303 | 265 | CompRegion clip; | 280 | CompRegion clip; |
2304 | 266 | 281 | ||
2305 | 267 | bool bindFailed; | 282 | bool bindFailed; |
2306 | 268 | bool overlayWindow; | 283 | bool overlayWindow; |
2307 | 269 | 284 | ||
2308 | 270 | GLushort opacity; | 285 | GLushort opacity; |
2309 | 271 | GLushort brightness; | 286 | GLushort brightness; |
2310 | 272 | GLushort saturation; | 287 | GLushort saturation; |
2311 | 273 | 288 | ||
2312 | 274 | GLWindowPaintAttrib paint; | 289 | GLWindowPaintAttrib paint; |
2313 | 275 | GLWindowPaintAttrib lastPaint; | 290 | GLWindowPaintAttrib lastPaint; |
2314 | 276 | 291 | ||
2315 | 277 | unsigned int lastMask; | 292 | unsigned int lastMask; |
2316 | 278 | 293 | ||
2317 | 279 | GLVertexBuffer *vertexBuffer; | 294 | GLVertexBuffer *vertexBuffer; |
2318 | 280 | 295 | ||
2319 | 281 | // map of shaders, plugin name is key, pair of vertex and fragment | 296 | // map of shaders, plugin name is key, pair of vertex and fragment |
2320 | 282 | // shader source code is value | 297 | // shader source code is value |
2321 | 283 | std::list<const GLShaderData*> shaders; | 298 | std::list<const GLShaderData*> shaders; |
2323 | 284 | GLVertexBuffer::AutoProgram *autoProgram; | 299 | GLVertexBuffer::AutoProgram *autoProgram; |
2324 | 285 | 300 | ||
2326 | 286 | std::list<GLIcon> icons; | 301 | std::list<GLIcon> icons; |
2327 | 287 | 302 | ||
2328 | 288 | compiz::window::configure_buffers::Releasable::Ptr configureLock; | 303 | compiz::window::configure_buffers::Releasable::Ptr configureLock; |
2329 | 289 | }; | 304 | }; |
2330 | 290 | 305 | ||
2331 | 291 | #endif | 306 | #endif |
2332 | 292 | |||
2333 | 293 | 307 | ||
2334 | === modified file 'plugins/opengl/src/privatetexture.h' | |||
2335 | --- plugins/opengl/src/privatetexture.h 2012-09-18 11:32:20 +0000 | |||
2336 | +++ plugins/opengl/src/privatetexture.h 2013-07-24 16:05:45 +0000 | |||
2337 | @@ -47,8 +47,10 @@ | |||
2338 | 47 | class GLScreen; | 47 | class GLScreen; |
2339 | 48 | class GLDisplay; | 48 | class GLDisplay; |
2340 | 49 | 49 | ||
2342 | 50 | class PrivateTexture { | 50 | class PrivateTexture |
2343 | 51 | { | ||
2344 | 51 | public: | 52 | public: |
2345 | 53 | |||
2346 | 52 | PrivateTexture (GLTexture *); | 54 | PrivateTexture (GLTexture *); |
2347 | 53 | ~PrivateTexture (); | 55 | ~PrivateTexture (); |
2348 | 54 | 56 | ||
2349 | @@ -59,6 +61,7 @@ | |||
2350 | 59 | GLenum type); | 61 | GLenum type); |
2351 | 60 | 62 | ||
2352 | 61 | public: | 63 | public: |
2353 | 64 | |||
2354 | 62 | GLTexture *texture; | 65 | GLTexture *texture; |
2355 | 63 | GLuint name; | 66 | GLuint name; |
2356 | 64 | GLenum target; | 67 | GLenum target; |
2357 | @@ -72,8 +75,10 @@ | |||
2358 | 72 | }; | 75 | }; |
2359 | 73 | 76 | ||
2360 | 74 | #ifdef USE_GLES | 77 | #ifdef USE_GLES |
2362 | 75 | class EglTexture : public GLTexture { | 78 | class EglTexture : public GLTexture |
2363 | 79 | { | ||
2364 | 76 | public: | 80 | public: |
2365 | 81 | |||
2366 | 77 | EglTexture (); | 82 | EglTexture (); |
2367 | 78 | ~EglTexture (); | 83 | ~EglTexture (); |
2368 | 79 | 84 | ||
2369 | @@ -86,21 +91,26 @@ | |||
2370 | 86 | compiz::opengl::PixmapSource source); | 91 | compiz::opengl::PixmapSource source); |
2371 | 87 | 92 | ||
2372 | 88 | public: | 93 | public: |
2376 | 89 | bool damaged; | 94 | |
2377 | 90 | Damage damage; | 95 | bool damaged; |
2378 | 91 | bool updateMipMap; | 96 | Damage damage; |
2379 | 97 | bool updateMipMap; | ||
2380 | 92 | }; | 98 | }; |
2381 | 93 | 99 | ||
2382 | 94 | extern std::map<Damage, EglTexture*> boundPixmapTex; | 100 | extern std::map<Damage, EglTexture*> boundPixmapTex; |
2383 | 95 | #else | 101 | #else |
2384 | 96 | 102 | ||
2386 | 97 | class TfpTexture : public GLTexture { | 103 | class TfpTexture : public GLTexture |
2387 | 104 | { | ||
2388 | 98 | public: | 105 | public: |
2389 | 106 | |||
2390 | 99 | TfpTexture (); | 107 | TfpTexture (); |
2391 | 100 | ~TfpTexture (); | 108 | ~TfpTexture (); |
2392 | 101 | 109 | ||
2393 | 102 | void enable (Filter filter); | 110 | void enable (Filter filter); |
2394 | 111 | |||
2395 | 103 | bool bindTexImage (const GLXPixmap &); | 112 | bool bindTexImage (const GLXPixmap &); |
2396 | 113 | |||
2397 | 104 | void releaseTexImage (); | 114 | void releaseTexImage (); |
2398 | 105 | 115 | ||
2399 | 106 | static List bindPixmapToTexture (Pixmap pixmap, | 116 | static List bindPixmapToTexture (Pixmap pixmap, |
2400 | @@ -110,6 +120,7 @@ | |||
2401 | 110 | compiz::opengl::PixmapSource source); | 120 | compiz::opengl::PixmapSource source); |
2402 | 111 | 121 | ||
2403 | 112 | public: | 122 | public: |
2404 | 123 | |||
2405 | 113 | Pixmap x11Pixmap; | 124 | Pixmap x11Pixmap; |
2406 | 114 | GLXPixmap pixmap; | 125 | GLXPixmap pixmap; |
2407 | 115 | bool damaged; | 126 | bool damaged; |
2408 | 116 | 127 | ||
2409 | === modified file 'plugins/opengl/src/privatevertexbuffer.h' | |||
2410 | --- plugins/opengl/src/privatevertexbuffer.h 2012-07-25 09:46:54 +0000 | |||
2411 | +++ plugins/opengl/src/privatevertexbuffer.h 2013-07-24 16:05:45 +0000 | |||
2412 | @@ -41,17 +41,20 @@ | |||
2413 | 41 | class AbstractUniform | 41 | class AbstractUniform |
2414 | 42 | { | 42 | { |
2415 | 43 | public: | 43 | public: |
2417 | 44 | void virtual set(GLProgram* program) = 0; | 44 | |
2418 | 45 | void virtual set (GLProgram *program) = 0; | ||
2419 | 45 | }; | 46 | }; |
2420 | 46 | 47 | ||
2421 | 47 | template < typename T, int C > | 48 | template < typename T, int C > |
2422 | 48 | class Uniform: public AbstractUniform | 49 | class Uniform: public AbstractUniform |
2423 | 49 | { | 50 | { |
2424 | 50 | public: | 51 | public: |
2427 | 51 | Uniform(const char *_name, ... ); | 52 | |
2428 | 52 | void set(GLProgram* program); | 53 | Uniform (const char *_name, ... ); |
2429 | 54 | void set (GLProgram* program); | ||
2430 | 53 | 55 | ||
2431 | 54 | public: | 56 | public: |
2432 | 57 | |||
2433 | 55 | T a[C]; | 58 | T a[C]; |
2434 | 56 | std::string name; | 59 | std::string name; |
2435 | 57 | }; | 60 | }; |
2436 | @@ -60,15 +63,17 @@ | |||
2437 | 60 | Uniform< T, C >::Uniform(const char *_name, ... ) | 63 | Uniform< T, C >::Uniform(const char *_name, ... ) |
2438 | 61 | { | 64 | { |
2439 | 62 | va_list arg_list; | 65 | va_list arg_list; |
2441 | 63 | va_start( arg_list, _name ); | 66 | va_start (arg_list, _name); |
2442 | 64 | name = _name; | 67 | name = _name; |
2444 | 65 | for( int i = 0; i < C; i++ ) | 68 | |
2445 | 69 | for (int i = 0; i < C; ++i) | ||
2446 | 66 | a[i] = va_arg( arg_list, T ); | 70 | a[i] = va_arg( arg_list, T ); |
2447 | 71 | |||
2448 | 67 | va_end( arg_list ); | 72 | va_end( arg_list ); |
2449 | 68 | } | 73 | } |
2450 | 69 | 74 | ||
2451 | 70 | template < typename T, int C > | 75 | template < typename T, int C > |
2453 | 71 | void Uniform< T, C >::set(GLProgram* prog) | 76 | void Uniform< T, C >::set (GLProgram *prog) |
2454 | 72 | { | 77 | { |
2455 | 73 | const char* n = name.c_str(); | 78 | const char* n = name.c_str(); |
2456 | 74 | 79 | ||
2457 | @@ -78,24 +83,24 @@ | |||
2458 | 78 | { | 83 | { |
2459 | 79 | switch (C) | 84 | switch (C) |
2460 | 80 | { | 85 | { |
2464 | 81 | case 1: prog->setUniform (n, (GLfloat) a[0]); break; | 86 | case 1: prog->setUniform (n, (GLfloat) a[0]); break; |
2465 | 82 | case 2: prog->setUniform2f (n, a[0], a[1]); break; | 87 | case 2: prog->setUniform2f (n, a[0], a[1]); break; |
2466 | 83 | case 3: prog->setUniform3f (n, a[0], a[1], a[2]); break; | 88 | case 3: prog->setUniform3f (n, a[0], a[1], a[2]); break; |
2467 | 84 | case 4: prog->setUniform4f (n, a[0], a[1], a[2], a[3]); break; | 89 | case 4: prog->setUniform4f (n, a[0], a[1], a[2], a[3]); break; |
2468 | 85 | } | 90 | } |
2470 | 86 | } else if (typeid(a[0]) == typeid(int)) | 91 | } |
2471 | 92 | else if (typeid(a[0]) == typeid(int)) | ||
2472 | 87 | { | 93 | { |
2473 | 88 | switch (C) | 94 | switch (C) |
2474 | 89 | { | 95 | { |
2478 | 90 | case 1: prog->setUniform (n, (GLint) a[0]); break; | 96 | case 1: prog->setUniform (n, (GLint) a[0]); break; |
2479 | 91 | case 2: prog->setUniform2i (n, a[0], a[1]); break; | 97 | case 2: prog->setUniform2i (n, a[0], a[1]); break; |
2480 | 92 | case 3: prog->setUniform3i (n, a[0], a[1], a[2]); break; | 98 | case 3: prog->setUniform3i (n, a[0], a[1], a[2]); break; |
2481 | 93 | case 4: prog->setUniform4i (n, a[0], a[1], a[2], a[3]); break; | 99 | case 4: prog->setUniform4i (n, a[0], a[1], a[2], a[3]); break; |
2482 | 94 | } | 100 | } |
2485 | 95 | } else | 101 | } |
2486 | 96 | { | 102 | else |
2487 | 97 | compLogMessage ("opengl", CompLogLevelError, "Unknown uniform type!"); | 103 | compLogMessage ("opengl", CompLogLevelError, "Unknown uniform type!"); |
2488 | 98 | } | ||
2489 | 99 | } | 104 | } |
2490 | 100 | 105 | ||
2491 | 101 | class GLVertexBuffer; | 106 | class GLVertexBuffer; |
2492 | @@ -103,47 +108,50 @@ | |||
2493 | 103 | class PrivateVertexBuffer | 108 | class PrivateVertexBuffer |
2494 | 104 | { | 109 | { |
2495 | 105 | public: | 110 | public: |
2496 | 111 | |||
2497 | 106 | PrivateVertexBuffer (); | 112 | PrivateVertexBuffer (); |
2498 | 107 | ~PrivateVertexBuffer (); | 113 | ~PrivateVertexBuffer (); |
2499 | 108 | 114 | ||
2500 | 109 | int render (const GLMatrix *projection, | 115 | int render (const GLMatrix *projection, |
2501 | 110 | const GLMatrix *modelview, | 116 | const GLMatrix *modelview, |
2502 | 111 | const GLWindowPaintAttrib *attrib); | 117 | const GLWindowPaintAttrib *attrib); |
2503 | 118 | |||
2504 | 112 | int legacyRender (const GLMatrix &projection, | 119 | int legacyRender (const GLMatrix &projection, |
2505 | 113 | const GLMatrix &modelview, | 120 | const GLMatrix &modelview, |
2506 | 114 | const GLWindowPaintAttrib &attrib); | 121 | const GLWindowPaintAttrib &attrib); |
2507 | 115 | 122 | ||
2508 | 116 | public: | 123 | public: |
2514 | 117 | static GLVertexBuffer *streamingBuffer; | 124 | |
2515 | 118 | 125 | static GLVertexBuffer *streamingBuffer; | |
2516 | 119 | std::vector<GLfloat> vertexData; | 126 | |
2517 | 120 | std::vector<GLfloat> normalData; | 127 | std::vector<GLfloat> vertexData; |
2518 | 121 | std::vector<GLfloat> colorData; | 128 | std::vector<GLfloat> normalData; |
2519 | 129 | std::vector<GLfloat> colorData; | ||
2520 | 122 | 130 | ||
2521 | 123 | enum | 131 | enum |
2522 | 124 | { | 132 | { |
2523 | 125 | MAX_TEXTURES = 4 | 133 | MAX_TEXTURES = 4 |
2524 | 126 | }; | 134 | }; |
2541 | 127 | std::vector<GLfloat> textureData[MAX_TEXTURES]; | 135 | |
2542 | 128 | GLuint nTextures; | 136 | std::vector<GLfloat> textureData[MAX_TEXTURES]; |
2543 | 129 | 137 | GLuint nTextures; | |
2544 | 130 | GLfloat color[4]; | 138 | |
2545 | 131 | 139 | GLfloat color[4]; | |
2546 | 132 | GLuint vertexOffset; | 140 | |
2547 | 133 | GLint maxVertices; | 141 | GLuint vertexOffset; |
2548 | 134 | 142 | GLint maxVertices; | |
2549 | 135 | GLProgram *program; | 143 | |
2550 | 136 | GLenum primitiveType; | 144 | GLProgram *program; |
2551 | 137 | GLenum usage; | 145 | GLenum primitiveType; |
2552 | 138 | 146 | GLenum usage; | |
2553 | 139 | GLuint vertexBuffer; | 147 | |
2554 | 140 | GLuint normalBuffer; | 148 | GLuint vertexBuffer; |
2555 | 141 | GLuint colorBuffer; | 149 | GLuint normalBuffer; |
2556 | 142 | GLuint textureBuffers[4]; | 150 | GLuint colorBuffer; |
2557 | 151 | GLuint textureBuffers[4]; | ||
2558 | 143 | std::vector<AbstractUniform*> uniforms; | 152 | std::vector<AbstractUniform*> uniforms; |
2559 | 144 | 153 | ||
2561 | 145 | GLVertexBuffer::AutoProgram *autoProgram; | 154 | GLVertexBuffer::AutoProgram *autoProgram; |
2562 | 146 | }; | 155 | }; |
2563 | 147 | 156 | ||
2564 | 148 | #endif //_VERTEXBUFFER_PRIVATE_H | 157 | #endif //_VERTEXBUFFER_PRIVATE_H |
2565 | 149 | |||
2566 | 150 | 158 | ||
2567 | === modified file 'plugins/opengl/src/program.cpp' | |||
2568 | --- plugins/opengl/src/program.cpp 2012-12-04 12:15:34 +0000 | |||
2569 | +++ plugins/opengl/src/program.cpp 2013-07-24 16:05:45 +0000 | |||
2570 | @@ -37,15 +37,14 @@ | |||
2571 | 37 | 37 | ||
2572 | 38 | void printShaderInfoLog (GLuint shader) | 38 | void printShaderInfoLog (GLuint shader) |
2573 | 39 | { | 39 | { |
2576 | 40 | GLint length = 0; | 40 | GLint length = 0; |
2577 | 41 | GLint chars = 0; | 41 | GLint chars = 0; |
2578 | 42 | 42 | ||
2579 | 43 | (*GL::getShaderiv) (shader, GL::INFO_LOG_LENGTH, &length); | 43 | (*GL::getShaderiv) (shader, GL::INFO_LOG_LENGTH, &length); |
2580 | 44 | 44 | ||
2581 | 45 | if (length > 0) | 45 | if (length > 0) |
2582 | 46 | { | 46 | { |
2585 | 47 | GLchar *infoLog; | 47 | GLchar *infoLog = new GLchar[length]; |
2584 | 48 | infoLog = new GLchar[length]; | ||
2586 | 49 | (*GL::getShaderInfoLog) (shader, length, &chars, infoLog); | 48 | (*GL::getShaderInfoLog) (shader, length, &chars, infoLog); |
2587 | 50 | std::cout << infoLog << std::endl; | 49 | std::cout << infoLog << std::endl; |
2588 | 51 | delete[] infoLog; | 50 | delete[] infoLog; |
2589 | @@ -54,27 +53,26 @@ | |||
2590 | 54 | 53 | ||
2591 | 55 | void printProgramInfoLog(GLuint program) | 54 | void printProgramInfoLog(GLuint program) |
2592 | 56 | { | 55 | { |
2595 | 57 | GLint length = 0; | 56 | GLint length = 0; |
2596 | 58 | GLint chars = 0; | 57 | GLint chars = 0; |
2597 | 59 | 58 | ||
2598 | 60 | (*GL::getProgramiv) (program, GL::INFO_LOG_LENGTH, &length); | 59 | (*GL::getProgramiv) (program, GL::INFO_LOG_LENGTH, &length); |
2599 | 61 | 60 | ||
2600 | 62 | if (length > 0) | 61 | if (length > 0) |
2601 | 63 | { | 62 | { |
2604 | 64 | GLchar *infoLog; | 63 | GLchar *infoLog = new GLchar[length]; |
2603 | 65 | infoLog = new GLchar[length]; | ||
2605 | 66 | (*GL::getProgramInfoLog) (program, length, &chars, infoLog); | 64 | (*GL::getProgramInfoLog) (program, length, &chars, infoLog); |
2606 | 67 | std::cout << infoLog << std::endl; | 65 | std::cout << infoLog << std::endl; |
2607 | 68 | delete[] infoLog; | 66 | delete[] infoLog; |
2608 | 69 | } | 67 | } |
2609 | 70 | } | 68 | } |
2610 | 71 | 69 | ||
2612 | 72 | static bool compileShader (GLuint *shader, GLenum type, CompString &source) | 70 | static bool compileShader (GLuint *shader, |
2613 | 71 | GLenum type, | ||
2614 | 72 | CompString &source) | ||
2615 | 73 | { | 73 | { |
2616 | 74 | const GLchar *data; | ||
2617 | 75 | GLint status; | 74 | GLint status; |
2620 | 76 | 75 | const GLchar *data = (GLchar *)source.c_str (); | |
2619 | 77 | data = (GLchar *)source.c_str (); | ||
2621 | 78 | 76 | ||
2622 | 79 | *shader = (*GL::createShader) (type); | 77 | *shader = (*GL::createShader) (type); |
2623 | 80 | (*GL::shaderSource) (*shader, 1, &data, NULL); | 78 | (*GL::shaderSource) (*shader, 1, &data, NULL); |
2624 | @@ -88,9 +86,9 @@ | |||
2625 | 88 | priv (new PrivateProgram ()) | 86 | priv (new PrivateProgram ()) |
2626 | 89 | { | 87 | { |
2627 | 90 | GLuint vertex, fragment; | 88 | GLuint vertex, fragment; |
2629 | 91 | GLint status; | 89 | GLint status; |
2630 | 92 | 90 | ||
2632 | 93 | priv->valid = false; | 91 | priv->valid = false; |
2633 | 94 | priv->program = (*GL::createProgram) (); | 92 | priv->program = (*GL::createProgram) (); |
2634 | 95 | 93 | ||
2635 | 96 | if (!compileShader (&vertex, GL::VERTEX_SHADER, vertexShader)) | 94 | if (!compileShader (&vertex, GL::VERTEX_SHADER, vertexShader)) |
2636 | @@ -114,6 +112,7 @@ | |||
2637 | 114 | (*GL::validateProgram) (priv->program); | 112 | (*GL::validateProgram) (priv->program); |
2638 | 115 | 113 | ||
2639 | 116 | (*GL::getProgramiv) (priv->program, GL::LINK_STATUS, &status); | 114 | (*GL::getProgramiv) (priv->program, GL::LINK_STATUS, &status); |
2640 | 115 | |||
2641 | 117 | if (status == GL_FALSE) | 116 | if (status == GL_FALSE) |
2642 | 118 | { | 117 | { |
2643 | 119 | printProgramInfoLog (priv->program); | 118 | printProgramInfoLog (priv->program); |
2644 | @@ -147,9 +146,11 @@ | |||
2645 | 147 | (*GL::useProgram) (0); | 146 | (*GL::useProgram) (0); |
2646 | 148 | } | 147 | } |
2647 | 149 | 148 | ||
2649 | 150 | bool GLProgram::setUniform (const char *name, GLfloat value) | 149 | bool GLProgram::setUniform (const char *name, |
2650 | 150 | GLfloat value) | ||
2651 | 151 | { | 151 | { |
2652 | 152 | GLint location = (*GL::getUniformLocation) (priv->program, name); | 152 | GLint location = (*GL::getUniformLocation) (priv->program, name); |
2653 | 153 | |||
2654 | 153 | if (location == -1) | 154 | if (location == -1) |
2655 | 154 | return false; | 155 | return false; |
2656 | 155 | 156 | ||
2657 | @@ -157,9 +158,11 @@ | |||
2658 | 157 | return true; | 158 | return true; |
2659 | 158 | } | 159 | } |
2660 | 159 | 160 | ||
2662 | 160 | bool GLProgram::setUniform (const char *name, GLint value) | 161 | bool GLProgram::setUniform (const char *name, |
2663 | 162 | GLint value) | ||
2664 | 161 | { | 163 | { |
2665 | 162 | GLint location = (*GL::getUniformLocation) (priv->program, name); | 164 | GLint location = (*GL::getUniformLocation) (priv->program, name); |
2666 | 165 | |||
2667 | 163 | if (location == -1) | 166 | if (location == -1) |
2668 | 164 | return false; | 167 | return false; |
2669 | 165 | 168 | ||
2670 | @@ -167,9 +170,11 @@ | |||
2671 | 167 | return true; | 170 | return true; |
2672 | 168 | } | 171 | } |
2673 | 169 | 172 | ||
2675 | 170 | bool GLProgram::setUniform (const char *name, const GLMatrix &value) | 173 | bool GLProgram::setUniform (const char *name, |
2676 | 174 | const GLMatrix &value) | ||
2677 | 171 | { | 175 | { |
2678 | 172 | GLint location = (*GL::getUniformLocation) (priv->program, name); | 176 | GLint location = (*GL::getUniformLocation) (priv->program, name); |
2679 | 177 | |||
2680 | 173 | if (location == -1) | 178 | if (location == -1) |
2681 | 174 | return false; | 179 | return false; |
2682 | 175 | 180 | ||
2683 | @@ -178,10 +183,11 @@ | |||
2684 | 178 | } | 183 | } |
2685 | 179 | 184 | ||
2686 | 180 | bool GLProgram::setUniform2f (const char *name, | 185 | bool GLProgram::setUniform2f (const char *name, |
2689 | 181 | GLfloat x, | 186 | GLfloat x, |
2690 | 182 | GLfloat y) | 187 | GLfloat y) |
2691 | 183 | { | 188 | { |
2692 | 184 | GLint location = (*GL::getUniformLocation) (priv->program, name); | 189 | GLint location = (*GL::getUniformLocation) (priv->program, name); |
2693 | 190 | |||
2694 | 185 | if (location == -1) | 191 | if (location == -1) |
2695 | 186 | return false; | 192 | return false; |
2696 | 187 | 193 | ||
2697 | @@ -190,11 +196,12 @@ | |||
2698 | 190 | } | 196 | } |
2699 | 191 | 197 | ||
2700 | 192 | bool GLProgram::setUniform3f (const char *name, | 198 | bool GLProgram::setUniform3f (const char *name, |
2704 | 193 | GLfloat x, | 199 | GLfloat x, |
2705 | 194 | GLfloat y, | 200 | GLfloat y, |
2706 | 195 | GLfloat z) | 201 | GLfloat z) |
2707 | 196 | { | 202 | { |
2708 | 197 | GLint location = (*GL::getUniformLocation) (priv->program, name); | 203 | GLint location = (*GL::getUniformLocation) (priv->program, name); |
2709 | 204 | |||
2710 | 198 | if (location == -1) | 205 | if (location == -1) |
2711 | 199 | return false; | 206 | return false; |
2712 | 200 | 207 | ||
2713 | @@ -203,12 +210,13 @@ | |||
2714 | 203 | } | 210 | } |
2715 | 204 | 211 | ||
2716 | 205 | bool GLProgram::setUniform4f (const char *name, | 212 | bool GLProgram::setUniform4f (const char *name, |
2721 | 206 | GLfloat x, | 213 | GLfloat x, |
2722 | 207 | GLfloat y, | 214 | GLfloat y, |
2723 | 208 | GLfloat z, | 215 | GLfloat z, |
2724 | 209 | GLfloat w) | 216 | GLfloat w) |
2725 | 210 | { | 217 | { |
2726 | 211 | GLint location = (*GL::getUniformLocation) (priv->program, name); | 218 | GLint location = (*GL::getUniformLocation) (priv->program, name); |
2727 | 219 | |||
2728 | 212 | if (location == -1) | 220 | if (location == -1) |
2729 | 213 | return false; | 221 | return false; |
2730 | 214 | 222 | ||
2731 | @@ -217,10 +225,11 @@ | |||
2732 | 217 | } | 225 | } |
2733 | 218 | 226 | ||
2734 | 219 | bool GLProgram::setUniform2i (const char *name, | 227 | bool GLProgram::setUniform2i (const char *name, |
2737 | 220 | GLint x, | 228 | GLint x, |
2738 | 221 | GLint y) | 229 | GLint y) |
2739 | 222 | { | 230 | { |
2740 | 223 | GLint location = (*GL::getUniformLocation) (priv->program, name); | 231 | GLint location = (*GL::getUniformLocation) (priv->program, name); |
2741 | 232 | |||
2742 | 224 | if (location == -1) | 233 | if (location == -1) |
2743 | 225 | return false; | 234 | return false; |
2744 | 226 | 235 | ||
2745 | @@ -229,11 +238,12 @@ | |||
2746 | 229 | } | 238 | } |
2747 | 230 | 239 | ||
2748 | 231 | bool GLProgram::setUniform3i (const char *name, | 240 | bool GLProgram::setUniform3i (const char *name, |
2752 | 232 | GLint x, | 241 | GLint x, |
2753 | 233 | GLint y, | 242 | GLint y, |
2754 | 234 | GLint z) | 243 | GLint z) |
2755 | 235 | { | 244 | { |
2756 | 236 | GLint location = (*GL::getUniformLocation) (priv->program, name); | 245 | GLint location = (*GL::getUniformLocation) (priv->program, name); |
2757 | 246 | |||
2758 | 237 | if (location == -1) | 247 | if (location == -1) |
2759 | 238 | return false; | 248 | return false; |
2760 | 239 | 249 | ||
2761 | @@ -242,12 +252,13 @@ | |||
2762 | 242 | } | 252 | } |
2763 | 243 | 253 | ||
2764 | 244 | bool GLProgram::setUniform4i (const char *name, | 254 | bool GLProgram::setUniform4i (const char *name, |
2769 | 245 | GLint x, | 255 | GLint x, |
2770 | 246 | GLint y, | 256 | GLint y, |
2771 | 247 | GLint z, | 257 | GLint z, |
2772 | 248 | GLint w) | 258 | GLint w) |
2773 | 249 | { | 259 | { |
2774 | 250 | GLint location = (*GL::getUniformLocation) (priv->program, name); | 260 | GLint location = (*GL::getUniformLocation) (priv->program, name); |
2775 | 261 | |||
2776 | 251 | if (location == -1) | 262 | if (location == -1) |
2777 | 252 | return false; | 263 | return false; |
2778 | 253 | 264 | ||
2779 | @@ -259,4 +270,3 @@ | |||
2780 | 259 | { | 270 | { |
2781 | 260 | return (*GL::getAttribLocation) (priv->program, name); | 271 | return (*GL::getAttribLocation) (priv->program, name); |
2782 | 261 | } | 272 | } |
2783 | 262 | |||
2784 | 263 | 273 | ||
2785 | === modified file 'plugins/opengl/src/programcache.cpp' | |||
2786 | --- plugins/opengl/src/programcache.cpp 2013-01-10 08:19:56 +0000 | |||
2787 | +++ plugins/opengl/src/programcache.cpp 2013-07-24 16:05:45 +0000 | |||
2788 | @@ -31,58 +31,50 @@ | |||
2789 | 31 | typedef std::pair<boost::shared_ptr<GLProgram>, access_history_t::iterator> value; | 31 | typedef std::pair<boost::shared_ptr<GLProgram>, access_history_t::iterator> value; |
2790 | 32 | 32 | ||
2791 | 33 | static GLProgram * | 33 | static GLProgram * |
2793 | 34 | compileProgram (std::string name, std::list<const GLShaderData*> shaders) | 34 | compileProgram (std::string name, |
2794 | 35 | std::list<const GLShaderData*> shaders) | ||
2795 | 35 | { | 36 | { |
2796 | 36 | std::list<const GLShaderData*>::const_iterator it; | ||
2797 | 37 | std::string vertex_shader; | 37 | std::string vertex_shader; |
2798 | 38 | std::string fragment_shader; | 38 | std::string fragment_shader; |
2802 | 39 | std::string vertex_functions = ""; | 39 | std::string vertex_functions = ""; |
2803 | 40 | std::string vertex_function_calls = ""; | 40 | std::string vertex_function_calls = ""; |
2804 | 41 | std::string fragment_functions = ""; | 41 | std::string fragment_functions = ""; |
2805 | 42 | std::string fragment_function_calls = ""; | 42 | std::string fragment_function_calls = ""; |
2806 | 43 | int vpos, vcallpos, fpos, fcallpos; | ||
2807 | 44 | 43 | ||
2809 | 45 | for (it = shaders.begin (); it != shaders.end (); ++it) | 44 | for (std::list<const GLShaderData*>::const_iterator it = shaders.begin (); |
2810 | 45 | it != shaders.end (); ++it) | ||
2811 | 46 | { | 46 | { |
2812 | 47 | //find the special shaders to put the rest in | 47 | //find the special shaders to put the rest in |
2813 | 48 | if ((*it)->vertexShader.find ("@VERTEX_FUNCTIONS@") != std::string::npos) | 48 | if ((*it)->vertexShader.find ("@VERTEX_FUNCTIONS@") != std::string::npos) |
2814 | 49 | { | ||
2815 | 50 | vertex_shader = (*it)->vertexShader; | 49 | vertex_shader = (*it)->vertexShader; |
2818 | 51 | } | 50 | |
2819 | 52 | else | 51 | else if ((*it)->vertexShader.length ()) |
2820 | 53 | { | 52 | { |
2826 | 54 | if ((*it)->vertexShader.length ()) | 53 | vertex_functions += (*it)->vertexShader; |
2827 | 55 | { | 54 | vertex_function_calls += (*it)->name + "_vertex();\n"; |
2823 | 56 | vertex_functions += (*it)->vertexShader; | ||
2824 | 57 | vertex_function_calls += (*it)->name + "_vertex();\n"; | ||
2825 | 58 | } | ||
2828 | 59 | } | 55 | } |
2829 | 60 | 56 | ||
2830 | 61 | if ((*it)->fragmentShader.find ("@FRAGMENT_FUNCTIONS@") != std::string::npos) | 57 | if ((*it)->fragmentShader.find ("@FRAGMENT_FUNCTIONS@") != std::string::npos) |
2831 | 62 | { | ||
2832 | 63 | fragment_shader = (*it)->fragmentShader; | 58 | fragment_shader = (*it)->fragmentShader; |
2835 | 64 | } | 59 | |
2836 | 65 | else | 60 | else if ((*it)->fragmentShader.length ()) |
2837 | 66 | { | 61 | { |
2843 | 67 | if ((*it)->fragmentShader.length ()) | 62 | fragment_functions += (*it)->fragmentShader; |
2844 | 68 | { | 63 | fragment_function_calls += (*it)->name + "_fragment();\n"; |
2840 | 69 | fragment_functions += (*it)->fragmentShader; | ||
2841 | 70 | fragment_function_calls += (*it)->name + "_fragment();\n"; | ||
2842 | 71 | } | ||
2845 | 72 | } | 64 | } |
2846 | 73 | } | 65 | } |
2847 | 74 | 66 | ||
2848 | 75 | // put shader functions and function calls into the main shader | 67 | // put shader functions and function calls into the main shader |
2850 | 76 | vpos = vertex_shader.find ("@VERTEX_FUNCTIONS@"); | 68 | int vpos = vertex_shader.find ("@VERTEX_FUNCTIONS@"); |
2851 | 77 | vertex_shader.replace (vpos, 18, vertex_functions); | 69 | vertex_shader.replace (vpos, 18, vertex_functions); |
2852 | 78 | 70 | ||
2854 | 79 | vcallpos = vertex_shader.find ("@VERTEX_FUNCTION_CALLS@"); | 71 | int vcallpos = vertex_shader.find ("@VERTEX_FUNCTION_CALLS@"); |
2855 | 80 | vertex_shader.replace (vcallpos, 23, vertex_function_calls); | 72 | vertex_shader.replace (vcallpos, 23, vertex_function_calls); |
2856 | 81 | 73 | ||
2858 | 82 | fpos = fragment_shader.find ("@FRAGMENT_FUNCTIONS@"); | 74 | int fpos = fragment_shader.find ("@FRAGMENT_FUNCTIONS@"); |
2859 | 83 | fragment_shader.replace (fpos, 20, fragment_functions); | 75 | fragment_shader.replace (fpos, 20, fragment_functions); |
2860 | 84 | 76 | ||
2862 | 85 | fcallpos = fragment_shader.find ("@FRAGMENT_FUNCTION_CALLS@"); | 77 | int fcallpos = fragment_shader.find ("@FRAGMENT_FUNCTION_CALLS@"); |
2863 | 86 | fragment_shader.replace (fcallpos, 25, fragment_function_calls); | 78 | fragment_shader.replace (fcallpos, 25, fragment_function_calls); |
2864 | 87 | 79 | ||
2865 | 88 | return new GLProgram (vertex_shader, fragment_shader); | 80 | return new GLProgram (vertex_shader, fragment_shader); |
2866 | @@ -91,13 +83,16 @@ | |||
2867 | 91 | class PrivateProgramCache | 83 | class PrivateProgramCache |
2868 | 92 | { | 84 | { |
2869 | 93 | public: | 85 | public: |
2870 | 86 | |||
2871 | 94 | PrivateProgramCache (size_t); | 87 | PrivateProgramCache (size_t); |
2872 | 95 | 88 | ||
2873 | 96 | const size_t capacity; | 89 | const size_t capacity; |
2874 | 97 | access_history_t access_history; | 90 | access_history_t access_history; |
2875 | 98 | std::map<std::string, value> cache; | 91 | std::map<std::string, value> cache; |
2876 | 99 | 92 | ||
2878 | 100 | void insert (std::string, GLProgram *); | 93 | void insert (std::string , |
2879 | 94 | GLProgram *); | ||
2880 | 95 | |||
2881 | 101 | void evict (); | 96 | void evict (); |
2882 | 102 | }; | 97 | }; |
2883 | 103 | 98 | ||
2884 | @@ -114,10 +109,10 @@ | |||
2885 | 114 | 109 | ||
2886 | 115 | GLProgram* GLProgramCache::operator () (std::list<const GLShaderData*> shaders) | 110 | GLProgram* GLProgramCache::operator () (std::list<const GLShaderData*> shaders) |
2887 | 116 | { | 111 | { |
2888 | 117 | std::list<const GLShaderData*>::const_iterator name_it; | ||
2889 | 118 | std::string name; | 112 | std::string name; |
2890 | 119 | 113 | ||
2892 | 120 | for (name_it = shaders.begin(); name_it != shaders.end(); ++name_it) | 114 | for (std::list<const GLShaderData*>::const_iterator name_it = shaders.begin(); |
2893 | 115 | name_it != shaders.end(); ++name_it) | ||
2894 | 121 | { | 116 | { |
2895 | 122 | if (name.length () == 0) | 117 | if (name.length () == 0) |
2896 | 123 | name += (*name_it)->name; | 118 | name += (*name_it)->name; |
2897 | @@ -136,8 +131,8 @@ | |||
2898 | 136 | else | 131 | else |
2899 | 137 | { | 132 | { |
2900 | 138 | priv->access_history.splice (priv->access_history.end (), | 133 | priv->access_history.splice (priv->access_history.end (), |
2903 | 139 | priv->access_history, | 134 | priv->access_history, |
2904 | 140 | (*it).second.second); | 135 | (*it).second.second); |
2905 | 141 | (*it).second.second = priv->access_history.rbegin ().base (); | 136 | (*it).second.second = priv->access_history.rbegin ().base (); |
2906 | 142 | 137 | ||
2907 | 143 | return (*it).second.first.get (); | 138 | return (*it).second.first.get (); |
2908 | @@ -149,7 +144,8 @@ | |||
2909 | 149 | { | 144 | { |
2910 | 150 | } | 145 | } |
2911 | 151 | 146 | ||
2913 | 152 | void PrivateProgramCache::insert (std::string name, GLProgram *program) | 147 | void PrivateProgramCache::insert (std::string name, |
2914 | 148 | GLProgram *program) | ||
2915 | 153 | { | 149 | { |
2916 | 154 | assert (cache.find (name) == cache.end ()); | 150 | assert (cache.find (name) == cache.end ()); |
2917 | 155 | 151 | ||
2918 | @@ -173,4 +169,3 @@ | |||
2919 | 173 | cache.erase (it); | 169 | cache.erase (it); |
2920 | 174 | access_history.pop_front (); | 170 | access_history.pop_front (); |
2921 | 175 | } | 171 | } |
2922 | 176 | |||
2923 | 177 | 172 | ||
2924 | === modified file 'plugins/opengl/src/screen.cpp' | |||
2925 | --- plugins/opengl/src/screen.cpp 2013-05-15 10:47:42 +0000 | |||
2926 | +++ plugins/opengl/src/screen.cpp 2013-07-24 16:05:45 +0000 | |||
2927 | @@ -54,18 +54,18 @@ | |||
2928 | 54 | class DetectionWorkaround | 54 | class DetectionWorkaround |
2929 | 55 | { | 55 | { |
2930 | 56 | public: | 56 | public: |
2939 | 57 | DetectionWorkaround () | 57 | |
2940 | 58 | { | 58 | DetectionWorkaround () |
2941 | 59 | program_invocation_short_name[0] = 'C'; | 59 | { |
2942 | 60 | } | 60 | program_invocation_short_name[0] = 'C'; |
2943 | 61 | ~DetectionWorkaround () | 61 | } |
2944 | 62 | { | 62 | ~DetectionWorkaround () |
2945 | 63 | program_invocation_short_name[0] = 'c'; | 63 | { |
2946 | 64 | } | 64 | program_invocation_short_name[0] = 'c'; |
2947 | 65 | } | ||
2948 | 65 | }; | 66 | }; |
2949 | 66 | #endif | 67 | #endif |
2950 | 67 | 68 | ||
2951 | 68 | |||
2952 | 69 | using namespace compiz::opengl; | 69 | using namespace compiz::opengl; |
2953 | 70 | 70 | ||
2954 | 71 | namespace GL { | 71 | namespace GL { |
2955 | @@ -75,124 +75,124 @@ | |||
2956 | 75 | 75 | ||
2957 | 76 | GLEGLImageTargetTexture2DOESProc eglImageTargetTexture; | 76 | GLEGLImageTargetTexture2DOESProc eglImageTargetTexture; |
2958 | 77 | 77 | ||
2960 | 78 | EGLPostSubBufferNVProc postSubBuffer = NULL; | 78 | EGLPostSubBufferNVProc postSubBuffer = NULL; |
2961 | 79 | #else | 79 | #else |
2962 | 80 | 80 | ||
2963 | 81 | typedef int (*GLXSwapIntervalProc) (int interval); | 81 | typedef int (*GLXSwapIntervalProc) (int interval); |
2964 | 82 | 82 | ||
2982 | 83 | GLXBindTexImageProc bindTexImage = NULL; | 83 | GLXBindTexImageProc bindTexImage = NULL; |
2983 | 84 | GLXReleaseTexImageProc releaseTexImage = NULL; | 84 | GLXReleaseTexImageProc releaseTexImage = NULL; |
2984 | 85 | GLXQueryDrawableProc queryDrawable = NULL; | 85 | GLXQueryDrawableProc queryDrawable = NULL; |
2985 | 86 | GLXCopySubBufferProc copySubBuffer = NULL; | 86 | GLXCopySubBufferProc copySubBuffer = NULL; |
2986 | 87 | GLXGetVideoSyncProc getVideoSync = NULL; | 87 | GLXGetVideoSyncProc getVideoSync = NULL; |
2987 | 88 | GLXWaitVideoSyncProc waitVideoSync = NULL; | 88 | GLXWaitVideoSyncProc waitVideoSync = NULL; |
2988 | 89 | GLXSwapIntervalProc swapInterval = NULL; | 89 | GLXSwapIntervalProc swapInterval = NULL; |
2989 | 90 | GLXGetFBConfigsProc getFBConfigs = NULL; | 90 | GLXGetFBConfigsProc getFBConfigs = NULL; |
2990 | 91 | GLXGetFBConfigAttribProc getFBConfigAttrib = NULL; | 91 | GLXGetFBConfigAttribProc getFBConfigAttrib = NULL; |
2991 | 92 | GLXCreatePixmapProc createPixmap = NULL; | 92 | GLXCreatePixmapProc createPixmap = NULL; |
2992 | 93 | GLXDestroyPixmapProc destroyPixmap = NULL; | 93 | GLXDestroyPixmapProc destroyPixmap = NULL; |
2993 | 94 | GLGenProgramsProc genPrograms = NULL; | 94 | GLGenProgramsProc genPrograms = NULL; |
2994 | 95 | GLDeleteProgramsProc deletePrograms = NULL; | 95 | GLDeleteProgramsProc deletePrograms = NULL; |
2995 | 96 | GLBindProgramProc bindProgram = NULL; | 96 | GLBindProgramProc bindProgram = NULL; |
2996 | 97 | GLProgramStringProc programString = NULL; | 97 | GLProgramStringProc programString = NULL; |
2997 | 98 | GLProgramParameter4fProc programEnvParameter4f = NULL; | 98 | GLProgramParameter4fProc programEnvParameter4f = NULL; |
2998 | 99 | GLProgramParameter4fProc programLocalParameter4f = NULL; | 99 | GLProgramParameter4fProc programLocalParameter4f = NULL; |
2999 | 100 | #endif | 100 | #endif |
3000 | 101 | 101 | ||
3043 | 102 | GLActiveTextureProc activeTexture = NULL; | 102 | GLActiveTextureProc activeTexture = NULL; |
3044 | 103 | GLClientActiveTextureProc clientActiveTexture = NULL; | 103 | GLClientActiveTextureProc clientActiveTexture = NULL; |
3045 | 104 | GLMultiTexCoord2fProc multiTexCoord2f = NULL; | 104 | GLMultiTexCoord2fProc multiTexCoord2f = NULL; |
3046 | 105 | 105 | ||
3047 | 106 | GLGenFramebuffersProc genFramebuffers = NULL; | 106 | GLGenFramebuffersProc genFramebuffers = NULL; |
3048 | 107 | GLDeleteFramebuffersProc deleteFramebuffers = NULL; | 107 | GLDeleteFramebuffersProc deleteFramebuffers = NULL; |
3049 | 108 | GLBindFramebufferProc bindFramebuffer = NULL; | 108 | GLBindFramebufferProc bindFramebuffer = NULL; |
3050 | 109 | GLCheckFramebufferStatusProc checkFramebufferStatus = NULL; | 109 | GLCheckFramebufferStatusProc checkFramebufferStatus = NULL; |
3051 | 110 | GLFramebufferTexture2DProc framebufferTexture2D = NULL; | 110 | GLFramebufferTexture2DProc framebufferTexture2D = NULL; |
3052 | 111 | GLGenerateMipmapProc generateMipmap = NULL; | 111 | GLGenerateMipmapProc generateMipmap = NULL; |
3053 | 112 | 112 | ||
3054 | 113 | GLBindBufferProc bindBuffer = NULL; | 113 | GLBindBufferProc bindBuffer = NULL; |
3055 | 114 | GLDeleteBuffersProc deleteBuffers = NULL; | 114 | GLDeleteBuffersProc deleteBuffers = NULL; |
3056 | 115 | GLGenBuffersProc genBuffers = NULL; | 115 | GLGenBuffersProc genBuffers = NULL; |
3057 | 116 | GLBufferDataProc bufferData = NULL; | 116 | GLBufferDataProc bufferData = NULL; |
3058 | 117 | GLBufferSubDataProc bufferSubData = NULL; | 117 | GLBufferSubDataProc bufferSubData = NULL; |
3059 | 118 | 118 | ||
3060 | 119 | GLGetShaderivProc getShaderiv = NULL; | 119 | GLGetShaderivProc getShaderiv = NULL; |
3061 | 120 | GLGetShaderInfoLogProc getShaderInfoLog = NULL; | 120 | GLGetShaderInfoLogProc getShaderInfoLog = NULL; |
3062 | 121 | GLGetProgramivProc getProgramiv = NULL; | 121 | GLGetProgramivProc getProgramiv = NULL; |
3063 | 122 | GLGetProgramInfoLogProc getProgramInfoLog = NULL; | 122 | GLGetProgramInfoLogProc getProgramInfoLog = NULL; |
3064 | 123 | GLCreateShaderProc createShader = NULL; | 123 | GLCreateShaderProc createShader = NULL; |
3065 | 124 | GLShaderSourceProc shaderSource = NULL; | 124 | GLShaderSourceProc shaderSource = NULL; |
3066 | 125 | GLCompileShaderProc compileShader = NULL; | 125 | GLCompileShaderProc compileShader = NULL; |
3067 | 126 | GLCreateProgramProc createProgram = NULL; | 126 | GLCreateProgramProc createProgram = NULL; |
3068 | 127 | GLAttachShaderProc attachShader = NULL; | 127 | GLAttachShaderProc attachShader = NULL; |
3069 | 128 | GLLinkProgramProc linkProgram = NULL; | 128 | GLLinkProgramProc linkProgram = NULL; |
3070 | 129 | GLValidateProgramProc validateProgram = NULL; | 129 | GLValidateProgramProc validateProgram = NULL; |
3071 | 130 | GLDeleteShaderProc deleteShader = NULL; | 130 | GLDeleteShaderProc deleteShader = NULL; |
3072 | 131 | GLDeleteProgramProc deleteProgram = NULL; | 131 | GLDeleteProgramProc deleteProgram = NULL; |
3073 | 132 | GLUseProgramProc useProgram = NULL; | 132 | GLUseProgramProc useProgram = NULL; |
3074 | 133 | GLGetUniformLocationProc getUniformLocation = NULL; | 133 | GLGetUniformLocationProc getUniformLocation = NULL; |
3075 | 134 | GLUniform1fProc uniform1f = NULL; | 134 | GLUniform1fProc uniform1f = NULL; |
3076 | 135 | GLUniform1iProc uniform1i = NULL; | 135 | GLUniform1iProc uniform1i = NULL; |
3077 | 136 | GLUniform2fProc uniform2f = NULL; | 136 | GLUniform2fProc uniform2f = NULL; |
3078 | 137 | GLUniform2iProc uniform2i = NULL; | 137 | GLUniform2iProc uniform2i = NULL; |
3079 | 138 | GLUniform3fProc uniform3f = NULL; | 138 | GLUniform3fProc uniform3f = NULL; |
3080 | 139 | GLUniform3iProc uniform3i = NULL; | 139 | GLUniform3iProc uniform3i = NULL; |
3081 | 140 | GLUniform4fProc uniform4f = NULL; | 140 | GLUniform4fProc uniform4f = NULL; |
3082 | 141 | GLUniform4iProc uniform4i = NULL; | 141 | GLUniform4iProc uniform4i = NULL; |
3083 | 142 | GLUniformMatrix4fvProc uniformMatrix4fv = NULL; | 142 | GLUniformMatrix4fvProc uniformMatrix4fv = NULL; |
3084 | 143 | GLGetAttribLocationProc getAttribLocation = NULL; | 143 | GLGetAttribLocationProc getAttribLocation = NULL; |
3085 | 144 | 144 | ||
3086 | 145 | #ifndef USE_GLES | 145 | #ifndef USE_GLES |
3087 | 146 | 146 | ||
3101 | 147 | GLCreateShaderObjectARBProc createShaderObjectARB = NULL; | 147 | GLCreateShaderObjectARBProc createShaderObjectARB = NULL; |
3102 | 148 | GLCreateProgramObjectARBProc createProgramObjectARB = NULL; | 148 | GLCreateProgramObjectARBProc createProgramObjectARB = NULL; |
3103 | 149 | GLCompileShaderARBProc compileShaderARB = NULL; | 149 | GLCompileShaderARBProc compileShaderARB = NULL; |
3104 | 150 | GLShaderSourceARBProc shaderSourceARB = NULL; | 150 | GLShaderSourceARBProc shaderSourceARB = NULL; |
3105 | 151 | GLValidateProgramARBProc validateProgramARB = NULL; | 151 | GLValidateProgramARBProc validateProgramARB = NULL; |
3106 | 152 | GLDeleteObjectARBProc deleteObjectARB = NULL; | 152 | GLDeleteObjectARBProc deleteObjectARB = NULL; |
3107 | 153 | GLAttachObjectARBProc attachObjectARB = NULL; | 153 | GLAttachObjectARBProc attachObjectARB = NULL; |
3108 | 154 | GLLinkProgramARBProc linkProgramARB = NULL; | 154 | GLLinkProgramARBProc linkProgramARB = NULL; |
3109 | 155 | GLUseProgramObjectARBProc useProgramObjectARB = NULL; | 155 | GLUseProgramObjectARBProc useProgramObjectARB = NULL; |
3110 | 156 | GLGetUniformLocationARBProc getUniformLocationARB = NULL; | 156 | GLGetUniformLocationARBProc getUniformLocationARB = NULL; |
3111 | 157 | GLGetAttribLocationARBProc getAttribLocationARB = NULL; | 157 | GLGetAttribLocationARBProc getAttribLocationARB = NULL; |
3112 | 158 | GLGetObjectParameterivProc getObjectParameteriv = NULL; | 158 | GLGetObjectParameterivProc getObjectParameteriv = NULL; |
3113 | 159 | GLGetInfoLogProc getInfoLog = NULL; | 159 | GLGetInfoLogProc getInfoLog = NULL; |
3114 | 160 | 160 | ||
3115 | 161 | #endif | 161 | #endif |
3116 | 162 | 162 | ||
3118 | 163 | GLEnableVertexAttribArrayProc enableVertexAttribArray = NULL; | 163 | GLEnableVertexAttribArrayProc enableVertexAttribArray = NULL; |
3119 | 164 | GLDisableVertexAttribArrayProc disableVertexAttribArray = NULL; | 164 | GLDisableVertexAttribArrayProc disableVertexAttribArray = NULL; |
3151 | 165 | GLVertexAttribPointerProc vertexAttribPointer = NULL; | 165 | GLVertexAttribPointerProc vertexAttribPointer = NULL; |
3152 | 166 | 166 | ||
3153 | 167 | GLGenRenderbuffersProc genRenderbuffers = NULL; | 167 | GLGenRenderbuffersProc genRenderbuffers = NULL; |
3154 | 168 | GLDeleteRenderbuffersProc deleteRenderbuffers = NULL; | 168 | GLDeleteRenderbuffersProc deleteRenderbuffers = NULL; |
3155 | 169 | GLFramebufferRenderbufferProc framebufferRenderbuffer = NULL; | 169 | GLFramebufferRenderbufferProc framebufferRenderbuffer = NULL; |
3156 | 170 | GLBindRenderbufferProc bindRenderbuffer = NULL; | 170 | GLBindRenderbufferProc bindRenderbuffer = NULL; |
3157 | 171 | GLRenderbufferStorageProc renderbufferStorage = NULL; | 171 | GLRenderbufferStorageProc renderbufferStorage = NULL; |
3158 | 172 | 172 | ||
3159 | 173 | bool textureFromPixmap = true; | 173 | bool textureFromPixmap = true; |
3160 | 174 | bool textureRectangle = false; | 174 | bool textureRectangle = false; |
3161 | 175 | bool textureNonPowerOfTwo = false; | 175 | bool textureNonPowerOfTwo = false; |
3162 | 176 | bool textureNonPowerOfTwoMipmap = false; | 176 | bool textureNonPowerOfTwoMipmap = false; |
3163 | 177 | bool textureEnvCombine = false; | 177 | bool textureEnvCombine = false; |
3164 | 178 | bool textureEnvCrossbar = false; | 178 | bool textureEnvCrossbar = false; |
3165 | 179 | bool textureBorderClamp = false; | 179 | bool textureBorderClamp = false; |
3166 | 180 | bool textureCompression = false; | 180 | bool textureCompression = false; |
3167 | 181 | GLint maxTextureSize = 0; | 181 | GLint maxTextureSize = 0; |
3168 | 182 | bool fboSupported = false; | 182 | bool fboSupported = false; |
3169 | 183 | bool fboEnabled = false; | 183 | bool fboEnabled = false; |
3170 | 184 | bool fboStencilSupported = false; | 184 | bool fboStencilSupported = false; |
3171 | 185 | bool vboSupported = false; | 185 | bool vboSupported = false; |
3172 | 186 | bool vboEnabled = false; | 186 | bool vboEnabled = false; |
3173 | 187 | bool shaders = false; | 187 | bool shaders = false; |
3174 | 188 | GLint maxTextureUnits = 1; | 188 | GLint maxTextureUnits = 1; |
3175 | 189 | 189 | ||
3176 | 190 | bool canDoSaturated = false; | 190 | bool canDoSaturated = false; |
3177 | 191 | bool canDoSlightlySaturated = false; | 191 | bool canDoSlightlySaturated = false; |
3178 | 192 | 192 | ||
3179 | 193 | unsigned int vsyncCount = 0; | 193 | unsigned int vsyncCount = 0; |
3180 | 194 | 194 | ||
3181 | 195 | bool stencilBuffer = false; | 195 | bool stencilBuffer = false; |
3182 | 196 | #ifndef USE_GLES | 196 | #ifndef USE_GLES |
3183 | 197 | 197 | ||
3184 | 198 | GLuint createShaderARBWrapper (GLenum type) | 198 | GLuint createShaderARBWrapper (GLenum type) |
3185 | @@ -205,7 +205,10 @@ | |||
3186 | 205 | return static_cast <GLuint> ((GL::createProgramObjectARB) ()); | 205 | return static_cast <GLuint> ((GL::createProgramObjectARB) ()); |
3187 | 206 | } | 206 | } |
3188 | 207 | 207 | ||
3190 | 208 | void shaderSourceARBWrapper (GLuint shader, GLsizei count, const GLchar **string, const GLint *length) | 208 | void shaderSourceARBWrapper (GLuint shader, |
3191 | 209 | GLsizei count, | ||
3192 | 210 | const GLchar **string, | ||
3193 | 211 | const GLint *length) | ||
3194 | 209 | { | 212 | { |
3195 | 210 | (GL::shaderSourceARB) (static_cast <GLhandleARB> (shader), count, string, length); | 213 | (GL::shaderSourceARB) (static_cast <GLhandleARB> (shader), count, string, length); |
3196 | 211 | } | 214 | } |
3197 | @@ -230,7 +233,8 @@ | |||
3198 | 230 | (GL::deleteObjectARB) (static_cast <GLhandleARB> (program)); | 233 | (GL::deleteObjectARB) (static_cast <GLhandleARB> (program)); |
3199 | 231 | } | 234 | } |
3200 | 232 | 235 | ||
3202 | 233 | void attachShaderARBWrapper (GLuint program, GLuint shader) | 236 | void attachShaderARBWrapper (GLuint program, |
3203 | 237 | GLuint shader) | ||
3204 | 234 | { | 238 | { |
3205 | 235 | (GL::attachObjectARB) (static_cast <GLhandleARB> (program), static_cast <GLhandleARB> (shader)); | 239 | (GL::attachObjectARB) (static_cast <GLhandleARB> (program), static_cast <GLhandleARB> (shader)); |
3206 | 236 | } | 240 | } |
3207 | @@ -245,32 +249,44 @@ | |||
3208 | 245 | (GL::useProgramObjectARB) (static_cast <GLhandleARB> (program)); | 249 | (GL::useProgramObjectARB) (static_cast <GLhandleARB> (program)); |
3209 | 246 | } | 250 | } |
3210 | 247 | 251 | ||
3212 | 248 | int getUniformLocationARBWrapper (GLuint program, const GLchar *name) | 252 | int getUniformLocationARBWrapper (GLuint program, |
3213 | 253 | const GLchar *name) | ||
3214 | 249 | { | 254 | { |
3215 | 250 | return (GL::getUniformLocationARB) (static_cast <GLhandleARB> (program), name); | 255 | return (GL::getUniformLocationARB) (static_cast <GLhandleARB> (program), name); |
3216 | 251 | } | 256 | } |
3217 | 252 | 257 | ||
3219 | 253 | int getAttribLocationARBWrapper (GLuint program, const GLchar *name) | 258 | int getAttribLocationARBWrapper (GLuint program, |
3220 | 259 | const GLchar *name) | ||
3221 | 254 | { | 260 | { |
3222 | 255 | return (GL::getAttribLocationARB) (static_cast <GLhandleARB> (program), name); | 261 | return (GL::getAttribLocationARB) (static_cast <GLhandleARB> (program), name); |
3223 | 256 | } | 262 | } |
3224 | 257 | 263 | ||
3236 | 258 | void getProgramInfoLogARBWrapper (GLuint object, int maxLen, int *len, char *log) | 264 | void getProgramInfoLogARBWrapper (GLuint object, |
3237 | 259 | { | 265 | int maxLen, |
3238 | 260 | (GL::getInfoLog) (static_cast <GLhandleARB> (object), maxLen, len, log); | 266 | int *len, |
3239 | 261 | } | 267 | char *log) |
3240 | 262 | 268 | { | |
3241 | 263 | void getShaderInfoLogARBWrapper (GLuint object, int maxLen, int *len, char *log) | 269 | (GL::getInfoLog) (static_cast <GLhandleARB> (object), maxLen, len, log); |
3242 | 264 | { | 270 | } |
3243 | 265 | (GL::getInfoLog) (static_cast <GLhandleARB> (object), maxLen, len, log); | 271 | |
3244 | 266 | } | 272 | void getShaderInfoLogARBWrapper (GLuint object, |
3245 | 267 | 273 | int maxLen, | |
3246 | 268 | void getShaderivARBWrapper (GLuint object, GLenum type, int *param) | 274 | int *len, |
3247 | 275 | char *log) | ||
3248 | 276 | { | ||
3249 | 277 | (GL::getInfoLog) (static_cast <GLhandleARB> (object), maxLen, len, log); | ||
3250 | 278 | } | ||
3251 | 279 | |||
3252 | 280 | void getShaderivARBWrapper (GLuint object, | ||
3253 | 281 | GLenum type, | ||
3254 | 282 | int *param) | ||
3255 | 269 | { | 283 | { |
3256 | 270 | (GL::getObjectParameteriv) (static_cast <GLhandleARB> (object), type, param); | 284 | (GL::getObjectParameteriv) (static_cast <GLhandleARB> (object), type, param); |
3257 | 271 | } | 285 | } |
3258 | 272 | 286 | ||
3260 | 273 | void getProgramivARBWrapper (GLuint object, GLenum type, int *param) | 287 | void getProgramivARBWrapper (GLuint object, |
3261 | 288 | GLenum type, | ||
3262 | 289 | int *param) | ||
3263 | 274 | { | 290 | { |
3264 | 275 | (GL::getObjectParameteriv) (static_cast <GLhandleARB> (object), type, param); | 291 | (GL::getObjectParameteriv) (static_cast <GLhandleARB> (object), type, param); |
3265 | 276 | } | 292 | } |
3266 | @@ -286,14 +302,15 @@ | |||
3267 | 286 | class GLScreenAutoProgram : public GLVertexBuffer::AutoProgram | 302 | class GLScreenAutoProgram : public GLVertexBuffer::AutoProgram |
3268 | 287 | { | 303 | { |
3269 | 288 | public: | 304 | public: |
3270 | 305 | |||
3271 | 289 | GLScreenAutoProgram (GLScreen *gScreen) : gScreen(gScreen) {} | 306 | GLScreenAutoProgram (GLScreen *gScreen) : gScreen(gScreen) {} |
3272 | 290 | 307 | ||
3273 | 291 | GLProgram *getProgram (GLShaderParameters ¶ms) | 308 | GLProgram *getProgram (GLShaderParameters ¶ms) |
3274 | 292 | { | 309 | { |
3279 | 293 | const GLShaderData *shaderData = gScreen->getShaderData (params); | 310 | const GLShaderData *shaderData = gScreen->getShaderData (params); |
3280 | 294 | std::list<const GLShaderData *> tempShaders; | 311 | std::list<const GLShaderData *> tempShaders; |
3281 | 295 | tempShaders.push_back (shaderData); | 312 | tempShaders.push_back (shaderData); |
3282 | 296 | return gScreen->getProgram (tempShaders); | 313 | return gScreen->getProgram (tempShaders); |
3283 | 297 | } | 314 | } |
3284 | 298 | 315 | ||
3285 | 299 | GLScreen *gScreen; | 316 | GLScreen *gScreen; |
3286 | @@ -341,13 +358,14 @@ | |||
3287 | 341 | { | 358 | { |
3288 | 342 | namespace opengl | 359 | namespace opengl |
3289 | 343 | { | 360 | { |
3291 | 344 | void swapIntervalEGL (Display *display, int interval) | 361 | void swapIntervalEGL (Display *display, |
3292 | 362 | int interval) | ||
3293 | 345 | { | 363 | { |
3294 | 346 | eglSwapInterval (eglGetDisplay (display), interval); | 364 | eglSwapInterval (eglGetDisplay (display), interval); |
3295 | 347 | } | 365 | } |
3296 | 348 | 366 | ||
3299 | 349 | int waitVSyncEGL (int wait, | 367 | int waitVSyncEGL (int wait, |
3300 | 350 | int remainder, | 368 | int remainder, |
3301 | 351 | unsigned int *count) | 369 | unsigned int *count) |
3302 | 352 | { | 370 | { |
3303 | 353 | /* not supported */ | 371 | /* not supported */ |
3304 | @@ -365,37 +383,37 @@ | |||
3305 | 365 | DetectionWorkaround workaround; | 383 | DetectionWorkaround workaround; |
3306 | 366 | #endif | 384 | #endif |
3307 | 367 | 385 | ||
3339 | 368 | #ifdef USE_GLES | 386 | #ifdef USE_GLES |
3340 | 369 | Display *xdpy; | 387 | Window overlay; |
3341 | 370 | Window overlay; | 388 | EGLint major, minor; |
3342 | 371 | EGLDisplay dpy; | 389 | const char *eglExtensions, *glExtensions; |
3343 | 372 | EGLConfig config; | 390 | XWindowAttributes attr; |
3344 | 373 | EGLint major, minor; | 391 | EGLint count; |
3345 | 374 | const char *eglExtensions, *glExtensions; | 392 | EGLConfig configs[1024]; |
3346 | 375 | XWindowAttributes attr; | 393 | CompOption::Vector o (0); |
3347 | 376 | EGLint count, visualid; | 394 | |
3348 | 377 | EGLConfig configs[1024]; | 395 | const EGLint config_attribs[] = |
3349 | 378 | CompOption::Vector o (0); | 396 | { |
3350 | 379 | 397 | EGL_SURFACE_TYPE, EGL_WINDOW_BIT, | |
3351 | 380 | const EGLint config_attribs[] = { | 398 | EGL_RED_SIZE, 1, |
3352 | 381 | EGL_SURFACE_TYPE, EGL_WINDOW_BIT, | 399 | EGL_GREEN_SIZE, 1, |
3353 | 382 | EGL_RED_SIZE, 1, | 400 | EGL_BLUE_SIZE, 1, |
3354 | 383 | EGL_GREEN_SIZE, 1, | 401 | EGL_ALPHA_SIZE, 0, |
3355 | 384 | EGL_BLUE_SIZE, 1, | 402 | EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, |
3356 | 385 | EGL_ALPHA_SIZE, 0, | 403 | EGL_CONFIG_CAVEAT, EGL_NONE, |
3357 | 386 | EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, | 404 | EGL_STENCIL_SIZE, 1, |
3358 | 387 | EGL_CONFIG_CAVEAT, EGL_NONE, | 405 | EGL_NONE |
3359 | 388 | EGL_STENCIL_SIZE, 1, | 406 | }; |
3360 | 389 | EGL_NONE | 407 | |
3361 | 390 | }; | 408 | const EGLint context_attribs[] = |
3362 | 391 | 409 | { | |
3363 | 392 | const EGLint context_attribs[] = { | 410 | EGL_CONTEXT_CLIENT_VERSION, 2, |
3364 | 393 | EGL_CONTEXT_CLIENT_VERSION, 2, | 411 | EGL_NONE |
3365 | 394 | EGL_NONE | 412 | }; |
3366 | 395 | }; | 413 | |
3367 | 396 | 414 | Display *xdpy = screen->dpy (); | |
3368 | 397 | xdpy = screen->dpy (); | 415 | EGLDisplay dpy = eglGetDisplay ((EGLNativeDisplayType)xdpy); |
3369 | 398 | dpy = eglGetDisplay ((EGLNativeDisplayType)xdpy); | 416 | |
3370 | 399 | if (!eglInitialize (dpy, &major, &minor)) | 417 | if (!eglInitialize (dpy, &major, &minor)) |
3371 | 400 | { | 418 | { |
3372 | 401 | screen->handleCompizEvent ("opengl", "fatal_fallback", o); | 419 | screen->handleCompizEvent ("opengl", "fatal_fallback", o); |
3373 | @@ -416,27 +434,30 @@ | |||
3374 | 416 | return false; | 434 | return false; |
3375 | 417 | } | 435 | } |
3376 | 418 | 436 | ||
3382 | 419 | EGLint val; | 437 | EGLint val; |
3383 | 420 | int msaaBuffers = MAXSHORT; | 438 | int msaaBuffers = MAXSHORT; |
3384 | 421 | int msaaSamples = MAXSHORT; | 439 | int msaaSamples = MAXSHORT; |
3385 | 422 | visualid = XVisualIDFromVisual (attr.visual); | 440 | EGLint visualid = XVisualIDFromVisual (attr.visual); |
3386 | 423 | config = configs[0]; | 441 | EGLConfig config = configs[0]; |
3387 | 424 | 442 | ||
3388 | 425 | for (int i = 0; i < count; ++i) | 443 | for (int i = 0; i < count; ++i) |
3389 | 426 | { | 444 | { |
3390 | 427 | eglGetConfigAttrib (dpy, configs[i], EGL_SAMPLE_BUFFERS, &val); | 445 | eglGetConfigAttrib (dpy, configs[i], EGL_SAMPLE_BUFFERS, &val); |
3391 | 446 | |||
3392 | 428 | if (val > msaaBuffers) | 447 | if (val > msaaBuffers) |
3394 | 429 | continue; | 448 | continue; |
3395 | 430 | 449 | ||
3396 | 431 | msaaBuffers = val; | 450 | msaaBuffers = val; |
3397 | 432 | 451 | ||
3398 | 433 | eglGetConfigAttrib (dpy, configs[i], EGL_SAMPLES, &val); | 452 | eglGetConfigAttrib (dpy, configs[i], EGL_SAMPLES, &val); |
3399 | 453 | |||
3400 | 434 | if (val > msaaSamples) | 454 | if (val > msaaSamples) |
3401 | 435 | continue; | 455 | continue; |
3402 | 436 | 456 | ||
3403 | 437 | msaaSamples = val; | 457 | msaaSamples = val; |
3404 | 438 | 458 | ||
3405 | 439 | eglGetConfigAttrib (dpy, configs[i], EGL_NATIVE_VISUAL_ID, &val); | 459 | eglGetConfigAttrib (dpy, configs[i], EGL_NATIVE_VISUAL_ID, &val); |
3406 | 460 | |||
3407 | 440 | if (val != visualid) | 461 | if (val != visualid) |
3408 | 441 | continue; | 462 | continue; |
3409 | 442 | 463 | ||
3410 | @@ -446,10 +467,11 @@ | |||
3411 | 446 | 467 | ||
3412 | 447 | overlay = CompositeScreen::get (screen)->overlay (); | 468 | overlay = CompositeScreen::get (screen)->overlay (); |
3413 | 448 | priv->surface = eglCreateWindowSurface (dpy, config, overlay, 0); | 469 | priv->surface = eglCreateWindowSurface (dpy, config, overlay, 0); |
3414 | 470 | |||
3415 | 449 | if (priv->surface == EGL_NO_SURFACE) | 471 | if (priv->surface == EGL_NO_SURFACE) |
3416 | 450 | { | 472 | { |
3417 | 451 | compLogMessage ("opengl", CompLogLevelFatal, | 473 | compLogMessage ("opengl", CompLogLevelFatal, |
3419 | 452 | "eglCreateWindowSurface failed"); | 474 | "eglCreateWindowSurface failed"); |
3420 | 453 | screen->handleCompizEvent ("opengl", "fatal_fallback", o); | 475 | screen->handleCompizEvent ("opengl", "fatal_fallback", o); |
3421 | 454 | return false; | 476 | return false; |
3422 | 455 | } | 477 | } |
3423 | @@ -458,6 +480,7 @@ | |||
3424 | 458 | eglSurfaceAttrib (dpy, priv->surface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); | 480 | eglSurfaceAttrib (dpy, priv->surface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); |
3425 | 459 | 481 | ||
3426 | 460 | priv->ctx = eglCreateContext (dpy, config, EGL_NO_CONTEXT, context_attribs); | 482 | priv->ctx = eglCreateContext (dpy, config, EGL_NO_CONTEXT, context_attribs); |
3427 | 483 | |||
3428 | 461 | if (priv->ctx == EGL_NO_CONTEXT) | 484 | if (priv->ctx == EGL_NO_CONTEXT) |
3429 | 462 | { | 485 | { |
3430 | 463 | compLogMessage ("opengl", CompLogLevelFatal, "eglCreateContext failed"); | 486 | compLogMessage ("opengl", CompLogLevelFatal, "eglCreateContext failed"); |
3431 | @@ -474,7 +497,7 @@ | |||
3432 | 474 | } | 497 | } |
3433 | 475 | 498 | ||
3434 | 476 | eglExtensions = (const char *) eglQueryString (dpy, EGL_EXTENSIONS); | 499 | eglExtensions = (const char *) eglQueryString (dpy, EGL_EXTENSIONS); |
3436 | 477 | glExtensions = (const char *) glGetString (GL_EXTENSIONS); | 500 | glExtensions = (const char *) glGetString (GL_EXTENSIONS); |
3437 | 478 | 501 | ||
3438 | 479 | if (!glExtensions || !eglExtensions) | 502 | if (!glExtensions || !eglExtensions) |
3439 | 480 | { | 503 | { |
3440 | @@ -484,15 +507,15 @@ | |||
3441 | 484 | return false; | 507 | return false; |
3442 | 485 | } | 508 | } |
3443 | 486 | 509 | ||
3445 | 487 | GL::textureFromPixmap = true; | 510 | GL::textureFromPixmap = true; |
3446 | 488 | GL::textureNonPowerOfTwo = true; | 511 | GL::textureNonPowerOfTwo = true; |
3454 | 489 | GL::fboSupported = true; | 512 | GL::fboSupported = true; |
3455 | 490 | GL::fboEnabled = true; | 513 | GL::fboEnabled = true; |
3456 | 491 | GL::vboSupported = true; | 514 | GL::vboSupported = true; |
3457 | 492 | GL::vboEnabled = true; | 515 | GL::vboEnabled = true; |
3458 | 493 | GL::shaders = true; | 516 | GL::shaders = true; |
3459 | 494 | GL::stencilBuffer = true; | 517 | GL::stencilBuffer = true; |
3460 | 495 | GL::maxTextureUnits = 4; | 518 | GL::maxTextureUnits = 4; |
3461 | 496 | glGetIntegerv (GL_MAX_TEXTURE_SIZE, &GL::maxTextureSize); | 519 | glGetIntegerv (GL_MAX_TEXTURE_SIZE, &GL::maxTextureSize); |
3462 | 497 | 520 | ||
3463 | 498 | GL::createImage = (GL::EGLCreateImageKHRProc) | 521 | GL::createImage = (GL::EGLCreateImageKHRProc) |
3464 | @@ -503,7 +526,7 @@ | |||
3465 | 503 | eglGetProcAddress ("glEGLImageTargetTexture2DOES"); | 526 | eglGetProcAddress ("glEGLImageTargetTexture2DOES"); |
3466 | 504 | 527 | ||
3467 | 505 | if (!strstr (eglExtensions, "EGL_KHR_image_pixmap") || | 528 | if (!strstr (eglExtensions, "EGL_KHR_image_pixmap") || |
3469 | 506 | !strstr (glExtensions, "GL_OES_EGL_image") || | 529 | !strstr (glExtensions, "GL_OES_EGL_image") || |
3470 | 507 | !GL::createImage || !GL::destroyImage || !GL::eglImageTargetTexture) | 530 | !GL::createImage || !GL::destroyImage || !GL::eglImageTargetTexture) |
3471 | 508 | { | 531 | { |
3472 | 509 | compLogMessage ("opengl", CompLogLevelFatal, | 532 | compLogMessage ("opengl", CompLogLevelFatal, |
3473 | @@ -531,7 +554,7 @@ | |||
3474 | 531 | eglGetProcAddress ("eglPostSubBufferNV"); | 554 | eglGetProcAddress ("eglPostSubBufferNV"); |
3475 | 532 | 555 | ||
3476 | 533 | GL::fboStencilSupported = GL::fboSupported && | 556 | GL::fboStencilSupported = GL::fboSupported && |
3478 | 534 | strstr (glExtensions, "GL_OES_packed_depth_stencil"); | 557 | strstr (glExtensions, "GL_OES_packed_depth_stencil"); |
3479 | 535 | 558 | ||
3480 | 536 | if (!GL::fboSupported && | 559 | if (!GL::fboSupported && |
3481 | 537 | !GL::postSubBuffer) | 560 | !GL::postSubBuffer) |
3482 | @@ -542,59 +565,64 @@ | |||
3483 | 542 | return false; | 565 | return false; |
3484 | 543 | } | 566 | } |
3485 | 544 | 567 | ||
3527 | 545 | GL::activeTexture = glActiveTexture; | 568 | GL::activeTexture = glActiveTexture; |
3528 | 546 | GL::genFramebuffers = glGenFramebuffers; | 569 | GL::genFramebuffers = glGenFramebuffers; |
3529 | 547 | GL::deleteFramebuffers = glDeleteFramebuffers; | 570 | GL::deleteFramebuffers = glDeleteFramebuffers; |
3530 | 548 | GL::bindFramebuffer = glBindFramebuffer; | 571 | GL::bindFramebuffer = glBindFramebuffer; |
3531 | 549 | GL::checkFramebufferStatus = glCheckFramebufferStatus; | 572 | GL::checkFramebufferStatus = glCheckFramebufferStatus; |
3532 | 550 | GL::framebufferTexture2D = glFramebufferTexture2D; | 573 | GL::framebufferTexture2D = glFramebufferTexture2D; |
3533 | 551 | GL::generateMipmap = glGenerateMipmap; | 574 | GL::generateMipmap = glGenerateMipmap; |
3534 | 552 | 575 | ||
3535 | 553 | GL::bindBuffer = glBindBuffer; | 576 | GL::bindBuffer = glBindBuffer; |
3536 | 554 | GL::deleteBuffers = glDeleteBuffers; | 577 | GL::deleteBuffers = glDeleteBuffers; |
3537 | 555 | GL::genBuffers = glGenBuffers; | 578 | GL::genBuffers = glGenBuffers; |
3538 | 556 | GL::bufferData = glBufferData; | 579 | GL::bufferData = glBufferData; |
3539 | 557 | GL::bufferSubData = glBufferSubData; | 580 | GL::bufferSubData = glBufferSubData; |
3540 | 558 | 581 | ||
3541 | 559 | GL::getShaderiv = glGetShaderiv; | 582 | GL::getShaderiv = glGetShaderiv; |
3542 | 560 | GL::getShaderInfoLog = glGetShaderInfoLog; | 583 | GL::getShaderInfoLog = glGetShaderInfoLog; |
3543 | 561 | GL::getProgramiv = glGetProgramiv; | 584 | GL::getProgramiv = glGetProgramiv; |
3544 | 562 | GL::getProgramInfoLog = glGetProgramInfoLog; | 585 | GL::getProgramInfoLog = glGetProgramInfoLog; |
3545 | 563 | GL::createShader = glCreateShader; | 586 | GL::createShader = glCreateShader; |
3546 | 564 | GL::shaderSource = (GL::GLShaderSourceProc) glShaderSource; | 587 | GL::shaderSource = (GL::GLShaderSourceProc) glShaderSource; |
3547 | 565 | GL::compileShader = glCompileShader; | 588 | GL::compileShader = glCompileShader; |
3548 | 566 | GL::createProgram = glCreateProgram; | 589 | GL::createProgram = glCreateProgram; |
3549 | 567 | GL::attachShader = glAttachShader; | 590 | GL::attachShader = glAttachShader; |
3550 | 568 | GL::linkProgram = glLinkProgram; | 591 | GL::linkProgram = glLinkProgram; |
3551 | 569 | GL::validateProgram = glValidateProgram; | 592 | GL::validateProgram = glValidateProgram; |
3552 | 570 | GL::deleteShader = glDeleteShader; | 593 | GL::deleteShader = glDeleteShader; |
3553 | 571 | GL::deleteProgram = glDeleteProgram; | 594 | GL::deleteProgram = glDeleteProgram; |
3554 | 572 | GL::useProgram = glUseProgram; | 595 | GL::useProgram = glUseProgram; |
3555 | 573 | GL::getUniformLocation = glGetUniformLocation; | 596 | GL::getUniformLocation = glGetUniformLocation; |
3556 | 574 | GL::uniform1f = glUniform1f; | 597 | GL::uniform1f = glUniform1f; |
3557 | 575 | GL::uniform1i = glUniform1i; | 598 | GL::uniform1i = glUniform1i; |
3558 | 576 | GL::uniform2f = glUniform2f; | 599 | GL::uniform2f = glUniform2f; |
3559 | 577 | GL::uniform2i = glUniform2i; | 600 | GL::uniform2i = glUniform2i; |
3560 | 578 | GL::uniform3f = glUniform3f; | 601 | GL::uniform3f = glUniform3f; |
3561 | 579 | GL::uniform3i = glUniform3i; | 602 | GL::uniform3i = glUniform3i; |
3562 | 580 | GL::uniform4f = glUniform4f; | 603 | GL::uniform4f = glUniform4f; |
3563 | 581 | GL::uniform4i = glUniform4i; | 604 | GL::uniform4i = glUniform4i; |
3564 | 582 | GL::uniformMatrix4fv = glUniformMatrix4fv; | 605 | GL::uniformMatrix4fv = glUniformMatrix4fv; |
3565 | 583 | GL::getAttribLocation = glGetAttribLocation; | 606 | GL::getAttribLocation = glGetAttribLocation; |
3566 | 584 | 607 | ||
3567 | 585 | GL::enableVertexAttribArray = glEnableVertexAttribArray; | 608 | GL::enableVertexAttribArray = glEnableVertexAttribArray; |
3568 | 586 | GL::disableVertexAttribArray = glDisableVertexAttribArray; | 609 | GL::disableVertexAttribArray = glDisableVertexAttribArray; |
3570 | 587 | GL::vertexAttribPointer = glVertexAttribPointer; | 610 | GL::vertexAttribPointer = glVertexAttribPointer; |
3571 | 588 | 611 | ||
3577 | 589 | GL::genRenderbuffers = glGenRenderbuffers; | 612 | GL::genRenderbuffers = glGenRenderbuffers; |
3578 | 590 | GL::deleteRenderbuffers = glDeleteRenderbuffers; | 613 | GL::deleteRenderbuffers = glDeleteRenderbuffers; |
3579 | 591 | GL::bindRenderbuffer = glBindRenderbuffer; | 614 | GL::bindRenderbuffer = glBindRenderbuffer; |
3580 | 592 | GL::framebufferRenderbuffer = glFramebufferRenderbuffer; | 615 | GL::framebufferRenderbuffer = glFramebufferRenderbuffer; |
3581 | 593 | GL::renderbufferStorage = glRenderbufferStorage; | 616 | GL::renderbufferStorage = glRenderbufferStorage; |
3582 | 594 | 617 | ||
3583 | 595 | glClearColor (0.0, 0.0, 0.0, 1.0); | 618 | glClearColor (0.0, 0.0, 0.0, 1.0); |
3584 | 596 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | 619 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
3586 | 597 | glEnable (GL_BLEND); | 620 | |
3587 | 621 | GLboolean glBlendEnabled = glIsEnabled (GL_BLEND); | ||
3588 | 622 | |||
3589 | 623 | if (!glBlendEnabled) | ||
3590 | 624 | glEnable (GL_BLEND); | ||
3591 | 625 | |||
3592 | 598 | glEnable (GL_CULL_FACE); | 626 | glEnable (GL_CULL_FACE); |
3593 | 599 | 627 | ||
3594 | 600 | priv->updateView (); | 628 | priv->updateView (); |
3595 | @@ -612,15 +640,16 @@ | |||
3596 | 612 | 640 | ||
3597 | 613 | #else | 641 | #else |
3598 | 614 | 642 | ||
3605 | 615 | Display *dpy = screen->dpy (); | 643 | Display *dpy = screen->dpy (); |
3606 | 616 | const char *glExtensions; | 644 | const char *glExtensions; |
3607 | 617 | GLfloat globalAmbient[] = { 0.1f, 0.1f, 0.1f, 0.1f }; | 645 | GLfloat globalAmbient[] = { 0.1f, 0.1f, 0.1f, 0.1f }; |
3608 | 618 | GLfloat ambientLight[] = { 0.0f, 0.0f, 0.0f, 0.0f }; | 646 | GLfloat ambientLight[] = { 0.0f, 0.0f, 0.0f, 0.0f }; |
3609 | 619 | GLfloat diffuseLight[] = { 0.9f, 0.9f, 0.9f, 0.9f }; | 647 | GLfloat diffuseLight[] = { 0.9f, 0.9f, 0.9f, 0.9f }; |
3610 | 620 | GLfloat light0Position[] = { -0.5f, 0.5f, -9.0f, 1.0f }; | 648 | GLfloat light0Position[] = { -0.5f, 0.5f, -9.0f, 1.0f }; |
3611 | 621 | CompOption::Vector o (0); | 649 | CompOption::Vector o (0); |
3612 | 622 | 650 | ||
3613 | 623 | priv->ctx = glXCreateContext (dpy, visinfo, NULL, True); | 651 | priv->ctx = glXCreateContext (dpy, visinfo, NULL, True); |
3614 | 652 | |||
3615 | 624 | if (!priv->ctx) | 653 | if (!priv->ctx) |
3616 | 625 | { | 654 | { |
3617 | 626 | compLogMessage ("opengl", CompLogLevelWarn, | 655 | compLogMessage ("opengl", CompLogLevelWarn, |
3618 | @@ -648,6 +677,7 @@ | |||
3619 | 648 | glXMakeCurrent (dpy, CompositeScreen::get (screen)->output (), priv->ctx); | 677 | glXMakeCurrent (dpy, CompositeScreen::get (screen)->output (), priv->ctx); |
3620 | 649 | 678 | ||
3621 | 650 | glExtensions = (const char *) glGetString (GL_EXTENSIONS); | 679 | glExtensions = (const char *) glGetString (GL_EXTENSIONS); |
3622 | 680 | |||
3623 | 651 | if (!glExtensions) | 681 | if (!glExtensions) |
3624 | 652 | { | 682 | { |
3625 | 653 | compLogMessage ("opengl", CompLogLevelFatal, | 683 | compLogMessage ("opengl", CompLogLevelFatal, |
3626 | @@ -656,13 +686,13 @@ | |||
3627 | 656 | return false; | 686 | return false; |
3628 | 657 | } | 687 | } |
3629 | 658 | 688 | ||
3631 | 659 | const char *glVendor = (const char *) glGetString (GL_VENDOR); | 689 | const char *glVendor = (const char *) glGetString (GL_VENDOR); |
3632 | 660 | const char *glRenderer = (const char *) glGetString (GL_RENDERER); | 690 | const char *glRenderer = (const char *) glGetString (GL_RENDERER); |
3634 | 661 | const char *glVersion = (const char *) glGetString (GL_VERSION); | 691 | const char *glVersion = (const char *) glGetString (GL_VERSION); |
3635 | 662 | 692 | ||
3637 | 663 | priv->glVendor = glVendor; | 693 | priv->glVendor = glVendor; |
3638 | 664 | priv->glRenderer = glRenderer; | 694 | priv->glRenderer = glRenderer; |
3640 | 665 | priv->glVersion = glVersion; | 695 | priv->glVersion = glVersion; |
3641 | 666 | 696 | ||
3642 | 667 | if (glRenderer != NULL && | 697 | if (glRenderer != NULL && |
3643 | 668 | (strcmp (glRenderer, "Software Rasterizer") == 0 || | 698 | (strcmp (glRenderer, "Software Rasterizer") == 0 || |
3644 | @@ -675,8 +705,9 @@ | |||
3645 | 675 | return false; | 705 | return false; |
3646 | 676 | } | 706 | } |
3647 | 677 | 707 | ||
3649 | 678 | priv->commonFrontbuffer = true; | 708 | priv->commonFrontbuffer = true; |
3650 | 679 | priv->incorrectRefreshRate = false; | 709 | priv->incorrectRefreshRate = false; |
3651 | 710 | |||
3652 | 680 | if (glRenderer != NULL && strstr (glRenderer, "on llvmpipe")) | 711 | if (glRenderer != NULL && strstr (glRenderer, "on llvmpipe")) |
3653 | 681 | { | 712 | { |
3654 | 682 | /* | 713 | /* |
3655 | @@ -691,7 +722,7 @@ | |||
3656 | 691 | 722 | ||
3657 | 692 | if (glVendor != NULL && strstr (glVendor, "NVIDIA")) | 723 | if (glVendor != NULL && strstr (glVendor, "NVIDIA")) |
3658 | 693 | { | 724 | { |
3660 | 694 | /* | 725 | /* TODO: Check if this is still necessary: |
3661 | 695 | * NVIDIA provides an incorrect refresh rate, we need to | 726 | * NVIDIA provides an incorrect refresh rate, we need to |
3662 | 696 | * force 60Hz */ | 727 | * force 60Hz */ |
3663 | 697 | priv->incorrectRefreshRate = true; | 728 | priv->incorrectRefreshRate = true; |
3664 | @@ -699,6 +730,7 @@ | |||
3665 | 699 | 730 | ||
3666 | 700 | if (strstr (glExtensions, "GL_ARB_texture_non_power_of_two")) | 731 | if (strstr (glExtensions, "GL_ARB_texture_non_power_of_two")) |
3667 | 701 | GL::textureNonPowerOfTwo = true; | 732 | GL::textureNonPowerOfTwo = true; |
3668 | 733 | |||
3669 | 702 | GL::textureNonPowerOfTwoMipmap = GL::textureNonPowerOfTwo; | 734 | GL::textureNonPowerOfTwoMipmap = GL::textureNonPowerOfTwo; |
3670 | 703 | 735 | ||
3671 | 704 | glGetIntegerv (GL_MAX_TEXTURE_SIZE, &GL::maxTextureSize); | 736 | glGetIntegerv (GL_MAX_TEXTURE_SIZE, &GL::maxTextureSize); |
3672 | @@ -714,6 +746,7 @@ | |||
3673 | 714 | GLint maxTextureSize; | 746 | GLint maxTextureSize; |
3674 | 715 | 747 | ||
3675 | 716 | glGetIntegerv (GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, &maxTextureSize); | 748 | glGetIntegerv (GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, &maxTextureSize); |
3676 | 749 | |||
3677 | 717 | if (maxTextureSize > GL::maxTextureSize) | 750 | if (maxTextureSize > GL::maxTextureSize) |
3678 | 718 | GL::maxTextureSize = maxTextureSize; | 751 | GL::maxTextureSize = maxTextureSize; |
3679 | 719 | } | 752 | } |
3680 | @@ -731,7 +764,7 @@ | |||
3681 | 731 | { | 764 | { |
3682 | 732 | GL::textureEnvCombine = true; | 765 | GL::textureEnvCombine = true; |
3683 | 733 | 766 | ||
3685 | 734 | /* XXX: GL_NV_texture_env_combine4 need special code but it seams to | 767 | /* XXX: GL_NV_texture_env_combine4 need special code but it seems to |
3686 | 735 | be working anyway for now... */ | 768 | be working anyway for now... */ |
3687 | 736 | if (strstr (glExtensions, "GL_ARB_texture_env_crossbar") || | 769 | if (strstr (glExtensions, "GL_ARB_texture_env_crossbar") || |
3688 | 737 | strstr (glExtensions, "GL_NV_texture_env_combine4")) | 770 | strstr (glExtensions, "GL_NV_texture_env_combine4")) |
3689 | @@ -743,6 +776,7 @@ | |||
3690 | 743 | GL::textureBorderClamp = true; | 776 | GL::textureBorderClamp = true; |
3691 | 744 | 777 | ||
3692 | 745 | GL::maxTextureUnits = 1; | 778 | GL::maxTextureUnits = 1; |
3693 | 779 | |||
3694 | 746 | if (strstr (glExtensions, "GL_ARB_multitexture")) | 780 | if (strstr (glExtensions, "GL_ARB_multitexture")) |
3695 | 747 | { | 781 | { |
3696 | 748 | GL::activeTexture = (GL::GLActiveTextureProc) | 782 | GL::activeTexture = (GL::GLActiveTextureProc) |
3697 | @@ -781,18 +815,17 @@ | |||
3698 | 781 | GL::renderbufferStorage = (GL::GLRenderbufferStorageProc) | 815 | GL::renderbufferStorage = (GL::GLRenderbufferStorageProc) |
3699 | 782 | getProcAddress ("glRenderbufferStorageEXT"); | 816 | getProcAddress ("glRenderbufferStorageEXT"); |
3700 | 783 | 817 | ||
3713 | 784 | if (GL::genFramebuffers && | 818 | if (GL::genFramebuffers && |
3714 | 785 | GL::deleteFramebuffers && | 819 | GL::deleteFramebuffers && |
3715 | 786 | GL::bindFramebuffer && | 820 | GL::bindFramebuffer && |
3716 | 787 | GL::checkFramebufferStatus && | 821 | GL::checkFramebufferStatus && |
3717 | 788 | GL::framebufferTexture2D && | 822 | GL::framebufferTexture2D && |
3718 | 789 | GL::generateMipmap && | 823 | GL::generateMipmap && |
3719 | 790 | GL::genRenderbuffers && | 824 | GL::genRenderbuffers && |
3720 | 791 | GL::deleteRenderbuffers && | 825 | GL::deleteRenderbuffers && |
3721 | 792 | GL::bindRenderbuffer && | 826 | GL::bindRenderbuffer && |
3722 | 793 | GL::framebufferRenderbuffer && | 827 | GL::framebufferRenderbuffer && |
3723 | 794 | GL::renderbufferStorage | 828 | GL::renderbufferStorage) |
3712 | 795 | ) | ||
3724 | 796 | GL::fboSupported = true; | 829 | GL::fboSupported = true; |
3725 | 797 | } | 830 | } |
3726 | 798 | 831 | ||
3727 | @@ -822,53 +855,53 @@ | |||
3728 | 822 | 855 | ||
3729 | 823 | priv->updateRenderMode (); | 856 | priv->updateRenderMode (); |
3730 | 824 | 857 | ||
3734 | 825 | if (strstr (glExtensions, "GL_ARB_fragment_shader") && | 858 | if (strstr (glExtensions, "GL_ARB_fragment_shader") && |
3735 | 826 | strstr (glExtensions, "GL_ARB_vertex_shader") && | 859 | strstr (glExtensions, "GL_ARB_vertex_shader") && |
3736 | 827 | strstr (glExtensions, "GL_ARB_shader_objects") && | 860 | strstr (glExtensions, "GL_ARB_shader_objects") && |
3737 | 828 | strstr (glExtensions, "GL_ARB_shading_language_100")) | 861 | strstr (glExtensions, "GL_ARB_shading_language_100")) |
3738 | 829 | { | 862 | { |
3777 | 830 | GL::getShaderiv = (GL::GLGetShaderivProc) GL::getShaderivARBWrapper; | 863 | GL::getShaderiv = (GL::GLGetShaderivProc) GL::getShaderivARBWrapper; |
3778 | 831 | GL::getShaderInfoLog = (GL::GLGetShaderInfoLogProc) GL::getShaderInfoLogARBWrapper; | 864 | GL::getShaderInfoLog = (GL::GLGetShaderInfoLogProc) GL::getShaderInfoLogARBWrapper; |
3779 | 832 | GL::getProgramiv = (GL::GLGetProgramivProc) GL::getProgramivARBWrapper; | 865 | GL::getProgramiv = (GL::GLGetProgramivProc) GL::getProgramivARBWrapper; |
3780 | 833 | GL::getProgramInfoLog = (GL::GLGetProgramInfoLogProc) GL::getProgramInfoLogARBWrapper; | 866 | GL::getProgramInfoLog = (GL::GLGetProgramInfoLogProc) GL::getProgramInfoLogARBWrapper; |
3781 | 834 | GL::getObjectParameteriv = (GL::GLGetObjectParameterivProc) getProcAddress ("glGetObjectParameterivARB"); | 867 | GL::getObjectParameteriv = (GL::GLGetObjectParameterivProc) getProcAddress ("glGetObjectParameterivARB"); |
3782 | 835 | GL::getInfoLog = (GL::GLGetInfoLogProc) getProcAddress ("glGetInfoLogARB"); | 868 | GL::getInfoLog = (GL::GLGetInfoLogProc) getProcAddress ("glGetInfoLogARB"); |
3783 | 836 | GL::createShader = (GL::GLCreateShaderProc) GL::createShaderARBWrapper; | 869 | GL::createShader = (GL::GLCreateShaderProc) GL::createShaderARBWrapper; |
3784 | 837 | GL::createShaderObjectARB = (GL::GLCreateShaderObjectARBProc) getProcAddress ("glCreateShaderObjectARB"); | 870 | GL::createShaderObjectARB = (GL::GLCreateShaderObjectARBProc) getProcAddress ("glCreateShaderObjectARB"); |
3785 | 838 | GL::shaderSource = (GL::GLShaderSourceProc) GL::shaderSourceARBWrapper; | 871 | GL::shaderSource = (GL::GLShaderSourceProc) GL::shaderSourceARBWrapper; |
3786 | 839 | GL::shaderSourceARB = (GL::GLShaderSourceARBProc) getProcAddress ("glShaderSourceARB"); | 872 | GL::shaderSourceARB = (GL::GLShaderSourceARBProc) getProcAddress ("glShaderSourceARB"); |
3787 | 840 | GL::compileShader = (GL::GLCompileShaderProc) GL::compileShaderARBWrapper; | 873 | GL::compileShader = (GL::GLCompileShaderProc) GL::compileShaderARBWrapper; |
3788 | 841 | GL::compileShaderARB = (GL::GLCompileShaderARBProc) getProcAddress ("glCompileShaderARB"); | 874 | GL::compileShaderARB = (GL::GLCompileShaderARBProc) getProcAddress ("glCompileShaderARB"); |
3789 | 842 | GL::createProgram = (GL::GLCreateProgramProc) GL::createProgramARBWrapper; | 875 | GL::createProgram = (GL::GLCreateProgramProc) GL::createProgramARBWrapper; |
3790 | 843 | GL::createProgramObjectARB = (GL::GLCreateProgramObjectARBProc) getProcAddress ("glCreateProgramObjectARB"); | 876 | GL::createProgramObjectARB = (GL::GLCreateProgramObjectARBProc) getProcAddress ("glCreateProgramObjectARB"); |
3791 | 844 | GL::attachShader = GL::attachShaderARBWrapper; | 877 | GL::attachShader = GL::attachShaderARBWrapper; |
3792 | 845 | GL::attachObjectARB = (GL::GLAttachObjectARBProc) getProcAddress ("glAttachObjectARB"); | 878 | GL::attachObjectARB = (GL::GLAttachObjectARBProc) getProcAddress ("glAttachObjectARB"); |
3793 | 846 | GL::linkProgram = GL::linkProgramARBWrapper; | 879 | GL::linkProgram = GL::linkProgramARBWrapper; |
3794 | 847 | GL::linkProgramARB = (GL::GLLinkProgramARBProc) getProcAddress ("glLinkProgramARB"); | 880 | GL::linkProgramARB = (GL::GLLinkProgramARBProc) getProcAddress ("glLinkProgramARB"); |
3795 | 848 | GL::validateProgram = GL::validateProgramARBWrapper; | 881 | GL::validateProgram = GL::validateProgramARBWrapper; |
3796 | 849 | GL::validateProgramARB = (GL::GLValidateProgramARBProc) getProcAddress ("glValidateProgramARB"); | 882 | GL::validateProgramARB = (GL::GLValidateProgramARBProc) getProcAddress ("glValidateProgramARB"); |
3797 | 850 | GL::deleteShader = GL::deleteShaderARBWrapper; | 883 | GL::deleteShader = GL::deleteShaderARBWrapper; |
3798 | 851 | GL::deleteProgram = GL::deleteProgramARBWrapper; | 884 | GL::deleteProgram = GL::deleteProgramARBWrapper; |
3799 | 852 | GL::deleteObjectARB = (GL::GLDeleteObjectARBProc) getProcAddress ("glDeleteObjectARB"); | 885 | GL::deleteObjectARB = (GL::GLDeleteObjectARBProc) getProcAddress ("glDeleteObjectARB"); |
3800 | 853 | GL::useProgram = GL::useProgramARBWrapper; | 886 | GL::useProgram = GL::useProgramARBWrapper; |
3801 | 854 | GL::useProgramObjectARB = (GL::GLUseProgramObjectARBProc) getProcAddress ("glUseProgramObjectARB"); | 887 | GL::useProgramObjectARB = (GL::GLUseProgramObjectARBProc) getProcAddress ("glUseProgramObjectARB"); |
3802 | 855 | GL::getUniformLocation = GL::getUniformLocationARBWrapper; | 888 | GL::getUniformLocation = GL::getUniformLocationARBWrapper; |
3803 | 856 | GL::getUniformLocationARB = (GL::GLGetUniformLocationARBProc) getProcAddress ("glGetUniformLocationARB"); | 889 | GL::getUniformLocationARB = (GL::GLGetUniformLocationARBProc) getProcAddress ("glGetUniformLocationARB"); |
3804 | 857 | GL::uniform1f = (GL::GLUniform1fProc) getProcAddress ("glUniform1fARB"); | 890 | GL::uniform1f = (GL::GLUniform1fProc) getProcAddress ("glUniform1fARB"); |
3805 | 858 | GL::uniform1i = (GL::GLUniform1iProc) getProcAddress ("glUniform1iARB"); | 891 | GL::uniform1i = (GL::GLUniform1iProc) getProcAddress ("glUniform1iARB"); |
3806 | 859 | GL::uniform2f = (GL::GLUniform2fProc) getProcAddress ("glUniform2fARB"); | 892 | GL::uniform2f = (GL::GLUniform2fProc) getProcAddress ("glUniform2fARB"); |
3807 | 860 | GL::uniform2i = (GL::GLUniform2iProc) getProcAddress ("glUniform2iARB"); | 893 | GL::uniform2i = (GL::GLUniform2iProc) getProcAddress ("glUniform2iARB"); |
3808 | 861 | GL::uniform3f = (GL::GLUniform3fProc) getProcAddress ("glUniform3fARB"); | 894 | GL::uniform3f = (GL::GLUniform3fProc) getProcAddress ("glUniform3fARB"); |
3809 | 862 | GL::uniform3i = (GL::GLUniform3iProc) getProcAddress ("glUniform3iARB"); | 895 | GL::uniform3i = (GL::GLUniform3iProc) getProcAddress ("glUniform3iARB"); |
3810 | 863 | GL::uniform4f = (GL::GLUniform4fProc) getProcAddress ("glUniform4fARB"); | 896 | GL::uniform4f = (GL::GLUniform4fProc) getProcAddress ("glUniform4fARB"); |
3811 | 864 | GL::uniform4i = (GL::GLUniform4iProc) getProcAddress ("glUniform4iARB"); | 897 | GL::uniform4i = (GL::GLUniform4iProc) getProcAddress ("glUniform4iARB"); |
3812 | 865 | GL::uniformMatrix4fv = (GL::GLUniformMatrix4fvProc) getProcAddress ("glUniformMatrix4fvARB"); | 898 | GL::uniformMatrix4fv = (GL::GLUniformMatrix4fvProc) getProcAddress ("glUniformMatrix4fvARB"); |
3813 | 866 | GL::getAttribLocation = (GL::GLGetAttribLocationProc) GL::getAttribLocationARBWrapper; | 899 | GL::getAttribLocation = (GL::GLGetAttribLocationProc) GL::getAttribLocationARBWrapper; |
3814 | 867 | GL::getAttribLocationARB = (GL::GLGetAttribLocationARBProc) getProcAddress ("glGetAttribLocationARB"); | 900 | GL::getAttribLocationARB = (GL::GLGetAttribLocationARBProc) getProcAddress ("glGetAttribLocationARB"); |
3815 | 868 | 901 | ||
3817 | 869 | GL::enableVertexAttribArray = (GL::GLEnableVertexAttribArrayProc) getProcAddress ("glEnableVertexAttribArrayARB"); | 902 | GL::enableVertexAttribArray = (GL::GLEnableVertexAttribArrayProc) getProcAddress ("glEnableVertexAttribArrayARB"); |
3818 | 870 | GL::disableVertexAttribArray = (GL::GLDisableVertexAttribArrayProc) getProcAddress ("glDisableVertexAttribArrayARB"); | 903 | GL::disableVertexAttribArray = (GL::GLDisableVertexAttribArrayProc) getProcAddress ("glDisableVertexAttribArrayARB"); |
3820 | 871 | GL::vertexAttribPointer = (GL::GLVertexAttribPointerProc) getProcAddress ("glVertexAttribPointerARB"); | 904 | GL::vertexAttribPointer = (GL::GLVertexAttribPointerProc) getProcAddress ("glVertexAttribPointerARB"); |
3821 | 872 | 905 | ||
3822 | 873 | GL::shaders = true; | 906 | GL::shaders = true; |
3823 | 874 | } | 907 | } |
3824 | @@ -886,6 +919,7 @@ | |||
3825 | 886 | if (GL::textureEnvCombine && GL::maxTextureUnits >= 2) | 919 | if (GL::textureEnvCombine && GL::maxTextureUnits >= 2) |
3826 | 887 | { | 920 | { |
3827 | 888 | GL::canDoSaturated = true; | 921 | GL::canDoSaturated = true; |
3828 | 922 | |||
3829 | 889 | if (GL::textureEnvCrossbar && GL::maxTextureUnits >= 4) | 923 | if (GL::textureEnvCrossbar && GL::maxTextureUnits >= 4) |
3830 | 890 | GL::canDoSlightlySaturated = true; | 924 | GL::canDoSlightlySaturated = true; |
3831 | 891 | } | 925 | } |
3832 | @@ -905,7 +939,6 @@ | |||
3833 | 905 | 939 | ||
3834 | 906 | priv->lighting = false; | 940 | priv->lighting = false; |
3835 | 907 | 941 | ||
3836 | 908 | |||
3837 | 909 | priv->filter[NOTHING_TRANS_FILTER] = GLTexture::Fast; | 942 | priv->filter[NOTHING_TRANS_FILTER] = GLTexture::Fast; |
3838 | 910 | priv->filter[SCREEN_TRANS_FILTER] = GLTexture::Good; | 943 | priv->filter[SCREEN_TRANS_FILTER] = GLTexture::Good; |
3839 | 911 | priv->filter[WINDOW_TRANS_FILTER] = GLTexture::Good; | 944 | priv->filter[WINDOW_TRANS_FILTER] = GLTexture::Good; |
3840 | @@ -936,13 +969,13 @@ | |||
3841 | 936 | DetectionWorkaround workaround; | 969 | DetectionWorkaround workaround; |
3842 | 937 | #endif | 970 | #endif |
3843 | 938 | 971 | ||
3845 | 939 | XVisualInfo *visinfo = NULL; | 972 | XVisualInfo *visinfo = NULL; |
3846 | 940 | #ifndef USE_GLES | 973 | #ifndef USE_GLES |
3852 | 941 | Display *dpy = s->dpy (); | 974 | Display *dpy = s->dpy (); |
3853 | 942 | XVisualInfo templ; | 975 | XVisualInfo templ; |
3854 | 943 | GLXFBConfig *fbConfigs; | 976 | GLXFBConfig *fbConfigs; |
3855 | 944 | int defaultDepth, nvisinfo, nElements, value, i; | 977 | int defaultDepth, nvisinfo, nElements, value; |
3856 | 945 | const char *glxExtensions; | 978 | const char *glxExtensions; |
3857 | 946 | XWindowAttributes attr; | 979 | XWindowAttributes attr; |
3858 | 947 | CompOption::Vector o (0); | 980 | CompOption::Vector o (0); |
3859 | 948 | 981 | ||
3860 | @@ -956,6 +989,7 @@ | |||
3861 | 956 | templ.visualid = XVisualIDFromVisual (attr.visual); | 989 | templ.visualid = XVisualIDFromVisual (attr.visual); |
3862 | 957 | 990 | ||
3863 | 958 | visinfo = XGetVisualInfo (dpy, VisualIDMask, &templ, &nvisinfo); | 991 | visinfo = XGetVisualInfo (dpy, VisualIDMask, &templ, &nvisinfo); |
3864 | 992 | |||
3865 | 959 | if (!nvisinfo) | 993 | if (!nvisinfo) |
3866 | 960 | { | 994 | { |
3867 | 961 | compLogMessage ("opengl", CompLogLevelFatal, | 995 | compLogMessage ("opengl", CompLogLevelFatal, |
3868 | @@ -968,6 +1002,7 @@ | |||
3869 | 968 | defaultDepth = visinfo->depth; | 1002 | defaultDepth = visinfo->depth; |
3870 | 969 | 1003 | ||
3871 | 970 | glXGetConfig (dpy, visinfo, GLX_USE_GL, &value); | 1004 | glXGetConfig (dpy, visinfo, GLX_USE_GL, &value); |
3872 | 1005 | |||
3873 | 971 | if (!value) | 1006 | if (!value) |
3874 | 972 | { | 1007 | { |
3875 | 973 | compLogMessage ("opengl", CompLogLevelFatal, | 1008 | compLogMessage ("opengl", CompLogLevelFatal, |
3876 | @@ -979,6 +1014,7 @@ | |||
3877 | 979 | } | 1014 | } |
3878 | 980 | 1015 | ||
3879 | 981 | glXGetConfig (dpy, visinfo, GLX_DOUBLEBUFFER, &value); | 1016 | glXGetConfig (dpy, visinfo, GLX_DOUBLEBUFFER, &value); |
3880 | 1017 | |||
3881 | 982 | if (!value) | 1018 | if (!value) |
3882 | 983 | { | 1019 | { |
3883 | 984 | compLogMessage ("opengl", CompLogLevelFatal, | 1020 | compLogMessage ("opengl", CompLogLevelFatal, |
3884 | @@ -994,8 +1030,8 @@ | |||
3885 | 994 | if (glxExtensions == NULL) | 1030 | if (glxExtensions == NULL) |
3886 | 995 | { | 1031 | { |
3887 | 996 | compLogMessage ("opengl", CompLogLevelFatal, | 1032 | compLogMessage ("opengl", CompLogLevelFatal, |
3890 | 997 | "glXQueryExtensionsString is NULL for screen %d", | 1033 | "glXQueryExtensionsString is NULL for screen %d", |
3891 | 998 | s->screenNum ()); | 1034 | s->screenNum ()); |
3892 | 999 | screen->handleCompizEvent ("opengl", "fatal_fallback", o); | 1035 | screen->handleCompizEvent ("opengl", "fatal_fallback", o); |
3893 | 1000 | setFailed (); | 1036 | setFailed (); |
3894 | 1001 | return; | 1037 | return; |
3895 | @@ -1010,25 +1046,17 @@ | |||
3896 | 1010 | return; | 1046 | return; |
3897 | 1011 | } | 1047 | } |
3898 | 1012 | 1048 | ||
3915 | 1013 | priv->getProcAddress = (GL::GLXGetProcAddressProc) | 1049 | priv->getProcAddress = (GL::GLXGetProcAddressProc) getProcAddress ("glXGetProcAddressARB"); |
3916 | 1014 | getProcAddress ("glXGetProcAddressARB"); | 1050 | GL::bindTexImage = (GL::GLXBindTexImageProc) getProcAddress ("glXBindTexImageEXT"); |
3917 | 1015 | GL::bindTexImage = (GL::GLXBindTexImageProc) | 1051 | GL::releaseTexImage = (GL::GLXReleaseTexImageProc) getProcAddress ("glXReleaseTexImageEXT"); |
3918 | 1016 | getProcAddress ("glXBindTexImageEXT"); | 1052 | GL::queryDrawable = (GL::GLXQueryDrawableProc) getProcAddress ("glXQueryDrawable"); |
3919 | 1017 | GL::releaseTexImage = (GL::GLXReleaseTexImageProc) | 1053 | GL::getFBConfigs = (GL::GLXGetFBConfigsProc) getProcAddress ("glXGetFBConfigs"); |
3920 | 1018 | getProcAddress ("glXReleaseTexImageEXT"); | 1054 | GL::getFBConfigAttrib = (GL::GLXGetFBConfigAttribProc) getProcAddress ("glXGetFBConfigAttrib"); |
3921 | 1019 | GL::queryDrawable = (GL::GLXQueryDrawableProc) | 1055 | GL::createPixmap = (GL::GLXCreatePixmapProc) getProcAddress ("glXCreatePixmap"); |
3922 | 1020 | getProcAddress ("glXQueryDrawable"); | 1056 | GL::destroyPixmap = (GL::GLXDestroyPixmapProc) getProcAddress ("glXDestroyPixmap"); |
3907 | 1021 | GL::getFBConfigs = (GL::GLXGetFBConfigsProc) | ||
3908 | 1022 | getProcAddress ("glXGetFBConfigs"); | ||
3909 | 1023 | GL::getFBConfigAttrib = (GL::GLXGetFBConfigAttribProc) | ||
3910 | 1024 | getProcAddress ("glXGetFBConfigAttrib"); | ||
3911 | 1025 | GL::createPixmap = (GL::GLXCreatePixmapProc) | ||
3912 | 1026 | getProcAddress ("glXCreatePixmap"); | ||
3913 | 1027 | GL::destroyPixmap = (GL::GLXDestroyPixmapProc) | ||
3914 | 1028 | getProcAddress ("glXDestroyPixmap"); | ||
3923 | 1029 | 1057 | ||
3924 | 1030 | if (!strstr (glxExtensions, "GLX_EXT_texture_from_pixmap") || | 1058 | if (!strstr (glxExtensions, "GLX_EXT_texture_from_pixmap") || |
3926 | 1031 | !GL::bindTexImage || !GL::releaseTexImage) | 1059 | !GL::bindTexImage || !GL::releaseTexImage) |
3927 | 1032 | { | 1060 | { |
3928 | 1033 | compLogMessage ("opengl", CompLogLevelFatal, | 1061 | compLogMessage ("opengl", CompLogLevelFatal, |
3929 | 1034 | "GLX_EXT_texture_from_pixmap is missing"); | 1062 | "GLX_EXT_texture_from_pixmap is missing"); |
3930 | @@ -1051,52 +1079,46 @@ | |||
3931 | 1051 | } | 1079 | } |
3932 | 1052 | 1080 | ||
3933 | 1053 | if (strstr (glxExtensions, "GLX_MESA_copy_sub_buffer")) | 1081 | if (strstr (glxExtensions, "GLX_MESA_copy_sub_buffer")) |
3936 | 1054 | GL::copySubBuffer = (GL::GLXCopySubBufferProc) | 1082 | GL::copySubBuffer = (GL::GLXCopySubBufferProc) getProcAddress ("glXCopySubBufferMESA"); |
3935 | 1055 | getProcAddress ("glXCopySubBufferMESA"); | ||
3937 | 1056 | 1083 | ||
3938 | 1057 | if (strstr (glxExtensions, "GLX_SGI_video_sync")) | 1084 | if (strstr (glxExtensions, "GLX_SGI_video_sync")) |
3939 | 1058 | { | 1085 | { |
3945 | 1059 | GL::getVideoSync = (GL::GLXGetVideoSyncProc) | 1086 | GL::getVideoSync = (GL::GLXGetVideoSyncProc) getProcAddress ("glXGetVideoSyncSGI"); |
3946 | 1060 | getProcAddress ("glXGetVideoSyncSGI"); | 1087 | GL::waitVideoSync = (GL::GLXWaitVideoSyncProc) getProcAddress ("glXWaitVideoSyncSGI"); |
3942 | 1061 | |||
3943 | 1062 | GL::waitVideoSync = (GL::GLXWaitVideoSyncProc) | ||
3944 | 1063 | getProcAddress ("glXWaitVideoSyncSGI"); | ||
3947 | 1064 | } | 1088 | } |
3948 | 1065 | 1089 | ||
3949 | 1066 | if (strstr (glxExtensions, "GLX_SGI_swap_control")) | 1090 | if (strstr (glxExtensions, "GLX_SGI_swap_control")) |
3950 | 1067 | { | 1091 | { |
3953 | 1068 | GL::swapInterval = (GL::GLXSwapIntervalProc) | 1092 | GL::swapInterval = (GL::GLXSwapIntervalProc) getProcAddress ("glXSwapIntervalSGI"); |
3952 | 1069 | getProcAddress ("glXSwapIntervalSGI"); | ||
3954 | 1070 | } | 1093 | } |
3955 | 1071 | 1094 | ||
3956 | 1072 | fbConfigs = (*GL::getFBConfigs) (dpy, s->screenNum (), &nElements); | 1095 | fbConfigs = (*GL::getFBConfigs) (dpy, s->screenNum (), &nElements); |
3957 | 1073 | 1096 | ||
3958 | 1074 | GL::stencilBuffer = false; | 1097 | GL::stencilBuffer = false; |
3959 | 1075 | 1098 | ||
3961 | 1076 | for (i = 0; i <= MAX_DEPTH; i++) | 1099 | int alpha; |
3962 | 1100 | int db = MAXSHORT; | ||
3963 | 1101 | int stencil = MAXSHORT; | ||
3964 | 1102 | int depth = MAXSHORT; | ||
3965 | 1103 | int msaaBuffers = MAXSHORT; | ||
3966 | 1104 | int msaaSamples = MAXSHORT; | ||
3967 | 1105 | int mipmap = 0; | ||
3968 | 1106 | int rgba = 0; | ||
3969 | 1107 | int visualDepth; | ||
3970 | 1108 | XVisualInfo *vi; | ||
3971 | 1109 | |||
3972 | 1110 | for (int i = 0; i <= MAX_DEPTH; ++i) | ||
3973 | 1077 | { | 1111 | { |
3974 | 1078 | int j, db, stencil, depth, alpha, mipmap, msaaBuffers, msaaSamples, rgba; | ||
3975 | 1079 | |||
3976 | 1080 | priv->glxPixmapFBConfigs[i].fbConfig = NULL; | 1112 | priv->glxPixmapFBConfigs[i].fbConfig = NULL; |
3977 | 1081 | priv->glxPixmapFBConfigs[i].mipmap = 0; | 1113 | priv->glxPixmapFBConfigs[i].mipmap = 0; |
3978 | 1082 | priv->glxPixmapFBConfigs[i].yInverted = 0; | 1114 | priv->glxPixmapFBConfigs[i].yInverted = 0; |
3979 | 1083 | priv->glxPixmapFBConfigs[i].textureFormat = 0; | 1115 | priv->glxPixmapFBConfigs[i].textureFormat = 0; |
3980 | 1084 | priv->glxPixmapFBConfigs[i].textureTargets = 0; | 1116 | priv->glxPixmapFBConfigs[i].textureTargets = 0; |
3981 | 1085 | 1117 | ||
3991 | 1086 | db = MAXSHORT; | 1118 | for (int j = 0; j < nElements; ++j) |
3983 | 1087 | stencil = MAXSHORT; | ||
3984 | 1088 | depth = MAXSHORT; | ||
3985 | 1089 | msaaBuffers = MAXSHORT; | ||
3986 | 1090 | msaaSamples = MAXSHORT; | ||
3987 | 1091 | mipmap = 0; | ||
3988 | 1092 | rgba = 0; | ||
3989 | 1093 | |||
3990 | 1094 | for (j = 0; j < nElements; j++) | ||
3992 | 1095 | { | 1119 | { |
3993 | 1096 | XVisualInfo *vi; | ||
3994 | 1097 | int visualDepth; | ||
3995 | 1098 | |||
3996 | 1099 | vi = glXGetVisualFromFBConfig (dpy, fbConfigs[j]); | 1120 | vi = glXGetVisualFromFBConfig (dpy, fbConfigs[j]); |
3997 | 1121 | |||
3998 | 1100 | if (vi == NULL) | 1122 | if (vi == NULL) |
3999 | 1101 | continue; | 1123 | continue; |
4000 | 1102 | 1124 | ||
4001 | @@ -1107,14 +1129,14 @@ | |||
4002 | 1107 | if (visualDepth != i) | 1129 | if (visualDepth != i) |
4003 | 1108 | continue; | 1130 | continue; |
4004 | 1109 | 1131 | ||
4009 | 1110 | (*GL::getFBConfigAttrib) (dpy, fbConfigs[j], | 1132 | (*GL::getFBConfigAttrib) (dpy, fbConfigs[j], GLX_ALPHA_SIZE, &alpha); |
4010 | 1111 | GLX_ALPHA_SIZE, &alpha); | 1133 | (*GL::getFBConfigAttrib) (dpy, fbConfigs[j], GLX_BUFFER_SIZE, &value); |
4011 | 1112 | (*GL::getFBConfigAttrib) (dpy, fbConfigs[j], | 1134 | |
4008 | 1113 | GLX_BUFFER_SIZE, &value); | ||
4012 | 1114 | if (value != i && (value - alpha) != i) | 1135 | if (value != i && (value - alpha) != i) |
4013 | 1115 | continue; | 1136 | continue; |
4014 | 1116 | 1137 | ||
4015 | 1117 | value = 0; | 1138 | value = 0; |
4016 | 1139 | |||
4017 | 1118 | if (i == 32) | 1140 | if (i == 32) |
4018 | 1119 | { | 1141 | { |
4019 | 1120 | (*GL::getFBConfigAttrib) (dpy, fbConfigs[j], | 1142 | (*GL::getFBConfigAttrib) (dpy, fbConfigs[j], |
4020 | @@ -1167,14 +1189,14 @@ | |||
4021 | 1167 | (*GL::getFBConfigAttrib) (dpy, fbConfigs[j], | 1189 | (*GL::getFBConfigAttrib) (dpy, fbConfigs[j], |
4022 | 1168 | GLX_SAMPLE_BUFFERS, &value); | 1190 | GLX_SAMPLE_BUFFERS, &value); |
4023 | 1169 | if (value > msaaBuffers) | 1191 | if (value > msaaBuffers) |
4025 | 1170 | continue; | 1192 | continue; |
4026 | 1171 | 1193 | ||
4027 | 1172 | msaaBuffers = value; | 1194 | msaaBuffers = value; |
4028 | 1173 | 1195 | ||
4029 | 1174 | (*GL::getFBConfigAttrib) (dpy, fbConfigs[j], | 1196 | (*GL::getFBConfigAttrib) (dpy, fbConfigs[j], |
4030 | 1175 | GLX_SAMPLES, &value); | 1197 | GLX_SAMPLES, &value); |
4031 | 1176 | if (value > msaaSamples) | 1198 | if (value > msaaSamples) |
4033 | 1177 | continue; | 1199 | continue; |
4034 | 1178 | 1200 | ||
4035 | 1179 | msaaSamples = value; | 1201 | msaaSamples = value; |
4036 | 1180 | 1202 | ||
4037 | @@ -1194,14 +1216,12 @@ | |||
4038 | 1194 | GLX_BIND_TO_TEXTURE_TARGETS_EXT, &value); | 1216 | GLX_BIND_TO_TEXTURE_TARGETS_EXT, &value); |
4039 | 1195 | 1217 | ||
4040 | 1196 | priv->glxPixmapFBConfigs[i].textureTargets = value; | 1218 | priv->glxPixmapFBConfigs[i].textureTargets = value; |
4044 | 1197 | 1219 | priv->glxPixmapFBConfigs[i].fbConfig = fbConfigs[j]; | |
4045 | 1198 | priv->glxPixmapFBConfigs[i].fbConfig = fbConfigs[j]; | 1220 | priv->glxPixmapFBConfigs[i].mipmap = mipmap; |
4043 | 1199 | priv->glxPixmapFBConfigs[i].mipmap = mipmap; | ||
4046 | 1200 | } | 1221 | } |
4047 | 1201 | 1222 | ||
4051 | 1202 | if (i == defaultDepth) | 1223 | if (i == defaultDepth && stencil != MAXSHORT) |
4052 | 1203 | if (stencil != MAXSHORT) | 1224 | GL::stencilBuffer = true; |
4050 | 1204 | GL::stencilBuffer = true; | ||
4053 | 1205 | } | 1225 | } |
4054 | 1206 | 1226 | ||
4055 | 1207 | if (nElements) | 1227 | if (nElements) |
4056 | @@ -1227,12 +1247,14 @@ | |||
4057 | 1227 | CompositeScreen::get (screen)->unregisterPaintHandler (); | 1247 | CompositeScreen::get (screen)->unregisterPaintHandler (); |
4058 | 1228 | 1248 | ||
4059 | 1229 | #ifdef USE_GLES | 1249 | #ifdef USE_GLES |
4062 | 1230 | Display *xdpy = screen->dpy (); | 1250 | Display *xdpy = screen->dpy (); |
4063 | 1231 | EGLDisplay dpy = eglGetDisplay (xdpy); | 1251 | EGLDisplay dpy = eglGetDisplay (xdpy); |
4064 | 1232 | 1252 | ||
4065 | 1233 | eglMakeCurrent (dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); | 1253 | eglMakeCurrent (dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); |
4066 | 1254 | |||
4067 | 1234 | if (priv->ctx != EGL_NO_CONTEXT) | 1255 | if (priv->ctx != EGL_NO_CONTEXT) |
4068 | 1235 | eglDestroyContext (dpy, priv->ctx); | 1256 | eglDestroyContext (dpy, priv->ctx); |
4069 | 1257 | |||
4070 | 1236 | eglDestroySurface (dpy, priv->surface); | 1258 | eglDestroySurface (dpy, priv->surface); |
4071 | 1237 | eglTerminate (dpy); | 1259 | eglTerminate (dpy); |
4072 | 1238 | eglReleaseThread (); | 1260 | eglReleaseThread (); |
4073 | @@ -1248,12 +1270,14 @@ | |||
4074 | 1248 | delete priv; | 1270 | delete priv; |
4075 | 1249 | } | 1271 | } |
4076 | 1250 | 1272 | ||
4078 | 1251 | PrivateGLScreen::PrivateGLScreen (GLScreen *gs) : | 1273 | PrivateGLScreen::PrivateGLScreen (GLScreen *gs) : |
4079 | 1252 | gScreen (gs), | 1274 | gScreen (gs), |
4080 | 1253 | cScreen (CompositeScreen::get (screen)), | 1275 | cScreen (CompositeScreen::get (screen)), |
4081 | 1254 | textureFilter (GL_LINEAR), | 1276 | textureFilter (GL_LINEAR), |
4082 | 1277 | glxPixmapFBConfigs (), | ||
4083 | 1255 | backgroundTextures (), | 1278 | backgroundTextures (), |
4084 | 1256 | backgroundLoaded (false), | 1279 | backgroundLoaded (false), |
4085 | 1280 | filter (), | ||
4086 | 1257 | rasterPos (0, 0), | 1281 | rasterPos (0, 0), |
4087 | 1258 | projection (NULL), | 1282 | projection (NULL), |
4088 | 1259 | clearBuffers (true), | 1283 | clearBuffers (true), |
4089 | @@ -1268,15 +1292,17 @@ | |||
4090 | 1268 | #endif | 1292 | #endif |
4091 | 1269 | scratchFbo (NULL), | 1293 | scratchFbo (NULL), |
4092 | 1270 | outputRegion (), | 1294 | outputRegion (), |
4093 | 1295 | lastViewport (), | ||
4094 | 1271 | refreshSubBuffer (false), | 1296 | refreshSubBuffer (false), |
4095 | 1272 | lastMask (0), | 1297 | lastMask (0), |
4096 | 1273 | bindPixmap (), | 1298 | bindPixmap (), |
4097 | 1274 | hasCompositing (false), | 1299 | hasCompositing (false), |
4098 | 1275 | commonFrontbuffer (true), | 1300 | commonFrontbuffer (true), |
4099 | 1276 | incorrectRefreshRate (false), | 1301 | incorrectRefreshRate (false), |
4100 | 1302 | saveWindow (), | ||
4101 | 1277 | programCache (new GLProgramCache (30)), | 1303 | programCache (new GLProgramCache (30)), |
4102 | 1278 | shaderCache (), | 1304 | shaderCache (), |
4104 | 1279 | autoProgram (new GLScreenAutoProgram(gs)), | 1305 | autoProgram (new GLScreenAutoProgram (gs)), |
4105 | 1280 | rootPixmapCopy (None), | 1306 | rootPixmapCopy (None), |
4106 | 1281 | rootPixmapSize (), | 1307 | rootPixmapSize (), |
4107 | 1282 | glVendor (NULL), | 1308 | glVendor (NULL), |
4108 | @@ -1293,15 +1319,13 @@ | |||
4109 | 1293 | delete projection; | 1319 | delete projection; |
4110 | 1294 | delete programCache; | 1320 | delete programCache; |
4111 | 1295 | delete autoProgram; | 1321 | delete autoProgram; |
4112 | 1322 | |||
4113 | 1296 | if (rootPixmapCopy) | 1323 | if (rootPixmapCopy) |
4114 | 1297 | XFreePixmap (screen->dpy (), rootPixmapCopy); | 1324 | XFreePixmap (screen->dpy (), rootPixmapCopy); |
4115 | 1298 | |||
4116 | 1299 | } | 1325 | } |
4117 | 1300 | 1326 | ||
4118 | 1301 | GLushort defaultColor[4] = { 0xffff, 0xffff, 0xffff, 0xffff }; | 1327 | GLushort defaultColor[4] = { 0xffff, 0xffff, 0xffff, 0xffff }; |
4119 | 1302 | 1328 | ||
4120 | 1303 | |||
4121 | 1304 | |||
4122 | 1305 | GLenum | 1329 | GLenum |
4123 | 1306 | GLScreen::textureFilter () | 1330 | GLScreen::textureFilter () |
4124 | 1307 | { | 1331 | { |
4125 | @@ -1321,11 +1345,14 @@ | |||
4126 | 1321 | 1345 | ||
4127 | 1322 | screen->handleEvent (event); | 1346 | screen->handleEvent (event); |
4128 | 1323 | 1347 | ||
4130 | 1324 | switch (event->type) { | 1348 | switch (event->type) |
4131 | 1349 | { | ||
4132 | 1325 | case ConfigureNotify: | 1350 | case ConfigureNotify: |
4133 | 1326 | if (event->xconfigure.window == screen->root ()) | 1351 | if (event->xconfigure.window == screen->root ()) |
4134 | 1327 | updateScreenBackground (); | 1352 | updateScreenBackground (); |
4135 | 1353 | |||
4136 | 1328 | break; | 1354 | break; |
4137 | 1355 | |||
4138 | 1329 | case PropertyNotify: | 1356 | case PropertyNotify: |
4139 | 1330 | if (event->xproperty.atom == Atoms::xBackground[0] || | 1357 | if (event->xproperty.atom == Atoms::xBackground[0] || |
4140 | 1331 | event->xproperty.atom == Atoms::xBackground[1]) | 1358 | event->xproperty.atom == Atoms::xBackground[1]) |
4141 | @@ -1338,15 +1365,18 @@ | |||
4142 | 1338 | event->xproperty.atom == Atoms::winSaturation) | 1365 | event->xproperty.atom == Atoms::winSaturation) |
4143 | 1339 | { | 1366 | { |
4144 | 1340 | w = screen->findWindow (event->xproperty.window); | 1367 | w = screen->findWindow (event->xproperty.window); |
4145 | 1368 | |||
4146 | 1341 | if (w) | 1369 | if (w) |
4147 | 1342 | GLWindow::get (w)->updatePaintAttribs (); | 1370 | GLWindow::get (w)->updatePaintAttribs (); |
4148 | 1343 | } | 1371 | } |
4149 | 1344 | else if (event->xproperty.atom == Atoms::wmIcon) | 1372 | else if (event->xproperty.atom == Atoms::wmIcon) |
4150 | 1345 | { | 1373 | { |
4151 | 1346 | w = screen->findWindow (event->xproperty.window); | 1374 | w = screen->findWindow (event->xproperty.window); |
4152 | 1375 | |||
4153 | 1347 | if (w) | 1376 | if (w) |
4154 | 1348 | GLWindow::get (w)->priv->icons.clear (); | 1377 | GLWindow::get (w)->priv->icons.clear (); |
4155 | 1349 | } | 1378 | } |
4156 | 1379 | |||
4157 | 1350 | break; | 1380 | break; |
4158 | 1351 | 1381 | ||
4159 | 1352 | default: | 1382 | default: |
4160 | @@ -1362,9 +1392,7 @@ | |||
4161 | 1362 | boundPixmapTex.find (de->damage); | 1392 | boundPixmapTex.find (de->damage); |
4162 | 1363 | #endif | 1393 | #endif |
4163 | 1364 | if (it != boundPixmapTex.end ()) | 1394 | if (it != boundPixmapTex.end ()) |
4164 | 1365 | { | ||
4165 | 1366 | it->second->damaged = true; | 1395 | it->second->damaged = true; |
4166 | 1367 | } | ||
4167 | 1368 | 1396 | ||
4168 | 1369 | /* XXX: It would be nice if we could also update | 1397 | /* XXX: It would be nice if we could also update |
4169 | 1370 | * the background of the root window when the root | 1398 | * the background of the root window when the root |
4170 | @@ -1374,6 +1402,7 @@ | |||
4171 | 1374 | * be recopying the root window pixmap all the time | 1402 | * be recopying the root window pixmap all the time |
4172 | 1375 | * which is no good, so don't do that */ | 1403 | * which is no good, so don't do that */ |
4173 | 1376 | } | 1404 | } |
4174 | 1405 | |||
4175 | 1377 | break; | 1406 | break; |
4176 | 1378 | } | 1407 | } |
4177 | 1379 | } | 1408 | } |
4178 | @@ -1384,7 +1413,6 @@ | |||
4179 | 1384 | clearOutput (targetOutput, mask); | 1413 | clearOutput (targetOutput, mask); |
4180 | 1385 | } | 1414 | } |
4181 | 1386 | 1415 | ||
4182 | 1387 | |||
4183 | 1388 | static void | 1416 | static void |
4184 | 1389 | frustum (GLfloat *m, | 1417 | frustum (GLfloat *m, |
4185 | 1390 | GLfloat left, | 1418 | GLfloat left, |
4186 | @@ -1394,14 +1422,12 @@ | |||
4187 | 1394 | GLfloat nearval, | 1422 | GLfloat nearval, |
4188 | 1395 | GLfloat farval) | 1423 | GLfloat farval) |
4189 | 1396 | { | 1424 | { |
4198 | 1397 | GLfloat x, y, a, b, c, d; | 1425 | GLfloat x = (2.0 * nearval) / (right - left); |
4199 | 1398 | 1426 | GLfloat y = (2.0 * nearval) / (top - bottom); | |
4200 | 1399 | x = (2.0 * nearval) / (right - left); | 1427 | GLfloat a = (right + left) / (right - left); |
4201 | 1400 | y = (2.0 * nearval) / (top - bottom); | 1428 | GLfloat b = (top + bottom) / (top - bottom); |
4202 | 1401 | a = (right + left) / (right - left); | 1429 | GLfloat c = -(farval + nearval) / (farval - nearval); |
4203 | 1402 | b = (top + bottom) / (top - bottom); | 1430 | GLfloat d = -(2.0 * farval * nearval) / (farval - nearval); |
4196 | 1403 | c = -(farval + nearval) / ( farval - nearval); | ||
4197 | 1404 | d = -(2.0 * farval * nearval) / (farval - nearval); | ||
4204 | 1405 | 1431 | ||
4205 | 1406 | #define M(row,col) m[col * 4 + row] | 1432 | #define M(row,col) m[col * 4 + row] |
4206 | 1407 | M(0,0) = x; M(0,1) = 0.0f; M(0,2) = a; M(0,3) = 0.0f; | 1433 | M(0,0) = x; M(0,1) = 0.0f; M(0,2) = a; M(0,3) = 0.0f; |
4207 | @@ -1419,12 +1445,10 @@ | |||
4208 | 1419 | GLfloat zNear, | 1445 | GLfloat zNear, |
4209 | 1420 | GLfloat zFar) | 1446 | GLfloat zFar) |
4210 | 1421 | { | 1447 | { |
4217 | 1422 | GLfloat xmin, xmax, ymin, ymax; | 1448 | GLfloat ymax = zNear * tan (fovy * M_PI / 360.0); |
4218 | 1423 | 1449 | GLfloat ymin = -ymax; | |
4219 | 1424 | ymax = zNear * tan (fovy * M_PI / 360.0); | 1450 | GLfloat xmin = ymin * aspect; |
4220 | 1425 | ymin = -ymax; | 1451 | GLfloat xmax = ymax * aspect; |
4215 | 1426 | xmin = ymin * aspect; | ||
4216 | 1427 | xmax = ymax * aspect; | ||
4221 | 1428 | 1452 | ||
4222 | 1429 | frustum (m, xmin, xmax, ymin, ymax, zNear, zFar); | 1453 | frustum (m, xmin, xmax, ymin, ymax, zNear, zFar); |
4223 | 1430 | } | 1454 | } |
4224 | @@ -1450,6 +1474,7 @@ | |||
4225 | 1450 | 1474 | ||
4226 | 1451 | if (projection != NULL) | 1475 | if (projection != NULL) |
4227 | 1452 | delete projection; | 1476 | delete projection; |
4228 | 1477 | |||
4229 | 1453 | projection = new GLMatrix (projection_array); | 1478 | projection = new GLMatrix (projection_array); |
4230 | 1454 | 1479 | ||
4231 | 1455 | #ifndef USE_GLES | 1480 | #ifndef USE_GLES |
4232 | @@ -1478,6 +1503,7 @@ | |||
4233 | 1478 | 1503 | ||
4234 | 1479 | if (scratchFbo) | 1504 | if (scratchFbo) |
4235 | 1480 | scratchFbo->allocate (*screen, NULL, GL_BGRA); | 1505 | scratchFbo->allocate (*screen, NULL, GL_BGRA); |
4236 | 1506 | |||
4237 | 1481 | updateView (); | 1507 | updateView (); |
4238 | 1482 | } | 1508 | } |
4239 | 1483 | 1509 | ||
4240 | @@ -1500,6 +1526,7 @@ | |||
4241 | 1500 | { | 1526 | { |
4242 | 1501 | dlerror (); | 1527 | dlerror (); |
4243 | 1502 | funcPtr = (GL::FuncPtr) dlsym (dlhand, name); | 1528 | funcPtr = (GL::FuncPtr) dlsym (dlhand, name); |
4244 | 1529 | |||
4245 | 1503 | if (dlerror () != NULL) | 1530 | if (dlerror () != NULL) |
4246 | 1504 | funcPtr = NULL; | 1531 | funcPtr = NULL; |
4247 | 1505 | } | 1532 | } |
4248 | @@ -1512,18 +1539,18 @@ | |||
4249 | 1512 | void | 1539 | void |
4250 | 1513 | PrivateGLScreen::updateScreenBackground () | 1540 | PrivateGLScreen::updateScreenBackground () |
4251 | 1514 | { | 1541 | { |
4255 | 1515 | Display *dpy = screen->dpy (); | 1542 | Display *dpy = screen->dpy (); |
4256 | 1516 | Atom pixmapAtom, actualType; | 1543 | Atom actualType; |
4257 | 1517 | int actualFormat, i, status; | 1544 | int actualFormat, status; |
4258 | 1518 | unsigned int width = 1, height = 1, depth = 0; | 1545 | unsigned int width = 1, height = 1, depth = 0; |
4259 | 1519 | unsigned long nItems; | 1546 | unsigned long nItems; |
4260 | 1520 | unsigned long bytesAfter; | 1547 | unsigned long bytesAfter; |
4261 | 1521 | unsigned char *prop; | 1548 | unsigned char *prop; |
4267 | 1522 | Pixmap pixmap = None; | 1549 | Pixmap pixmap = None; |
4268 | 1523 | 1550 | ||
4269 | 1524 | pixmapAtom = XInternAtom (dpy, "PIXMAP", false); | 1551 | Atom pixmapAtom = XInternAtom (dpy, "PIXMAP", false); |
4270 | 1525 | 1552 | ||
4271 | 1526 | for (i = 0; pixmap == 0 && i < 2; i++) | 1553 | for (int i = 0; pixmap == 0 && i < 2; ++i) |
4272 | 1527 | { | 1554 | { |
4273 | 1528 | status = XGetWindowProperty (dpy, screen->root (), | 1555 | status = XGetWindowProperty (dpy, screen->root (), |
4274 | 1529 | Atoms::xBackground[i], | 1556 | Atoms::xBackground[i], |
4275 | @@ -1544,15 +1571,13 @@ | |||
4276 | 1544 | if (p) | 1571 | if (p) |
4277 | 1545 | { | 1572 | { |
4278 | 1546 | unsigned int ui; | 1573 | unsigned int ui; |
4281 | 1547 | int i; | 1574 | int i; |
4282 | 1548 | Window w; | 1575 | Window w; |
4283 | 1549 | 1576 | ||
4284 | 1550 | if (XGetGeometry (dpy, p, &w, &i, &i, | 1577 | if (XGetGeometry (dpy, p, &w, &i, &i, |
4290 | 1551 | &width, &height, &ui, &depth)) | 1578 | &width, &height, &ui, &depth) && |
4291 | 1552 | { | 1579 | (int) depth == screen->attrib ().depth) |
4292 | 1553 | if ((int) depth == screen->attrib ().depth) | 1580 | pixmap = p; |
4288 | 1554 | pixmap = p; | ||
4289 | 1555 | } | ||
4293 | 1556 | } | 1581 | } |
4294 | 1557 | } | 1582 | } |
4295 | 1558 | 1583 | ||
4296 | @@ -1564,17 +1589,14 @@ | |||
4297 | 1564 | { | 1589 | { |
4298 | 1565 | backgroundTextures = | 1590 | backgroundTextures = |
4299 | 1566 | GLTexture::bindPixmapToTexture (pixmap, width, height, depth); | 1591 | GLTexture::bindPixmapToTexture (pixmap, width, height, depth); |
4300 | 1592 | |||
4301 | 1567 | if (backgroundTextures.empty ()) | 1593 | if (backgroundTextures.empty ()) |
4302 | 1568 | { | ||
4303 | 1569 | compLogMessage ("core", CompLogLevelWarn, | 1594 | compLogMessage ("core", CompLogLevelWarn, |
4304 | 1570 | "Couldn't bind background pixmap 0x%x to " | 1595 | "Couldn't bind background pixmap 0x%x to " |
4305 | 1571 | "texture", (int) pixmap); | 1596 | "texture", (int) pixmap); |
4306 | 1572 | } | ||
4307 | 1573 | } | 1597 | } |
4308 | 1574 | else | 1598 | else |
4309 | 1575 | { | ||
4310 | 1576 | backgroundTextures.clear (); | 1599 | backgroundTextures.clear (); |
4311 | 1577 | } | ||
4312 | 1578 | 1600 | ||
4313 | 1579 | if (backgroundTextures.empty ()) | 1601 | if (backgroundTextures.empty ()) |
4314 | 1580 | { | 1602 | { |
4315 | @@ -1584,7 +1606,7 @@ | |||
4316 | 1584 | GC gc; | 1606 | GC gc; |
4317 | 1585 | 1607 | ||
4318 | 1586 | gcv.graphics_exposures = false; | 1608 | gcv.graphics_exposures = false; |
4320 | 1587 | gcv.subwindow_mode = IncludeInferiors; | 1609 | gcv.subwindow_mode = IncludeInferiors; |
4321 | 1588 | gc = XCreateGC (screen->dpy (), screen->root (), | 1610 | gc = XCreateGC (screen->dpy (), screen->root (), |
4322 | 1589 | GCGraphicsExposures | GCSubwindowMode, &gcv); | 1611 | GCGraphicsExposures | GCSubwindowMode, &gcv); |
4323 | 1590 | 1612 | ||
4324 | @@ -1605,11 +1627,9 @@ | |||
4325 | 1605 | DefaultDepth (screen->dpy (), DefaultScreen (screen->dpy ()))); | 1627 | DefaultDepth (screen->dpy (), DefaultScreen (screen->dpy ()))); |
4326 | 1606 | 1628 | ||
4327 | 1607 | if (backgroundTextures.empty ()) | 1629 | if (backgroundTextures.empty ()) |
4328 | 1608 | { | ||
4329 | 1609 | compLogMessage ("core", CompLogLevelWarn, | 1630 | compLogMessage ("core", CompLogLevelWarn, |
4330 | 1610 | "Couldn't bind background pixmap 0x%x to " | 1631 | "Couldn't bind background pixmap 0x%x to " |
4331 | 1611 | "texture", (int) screen->width ()); | 1632 | "texture", (int) screen->width ()); |
4332 | 1612 | } | ||
4333 | 1613 | } | 1633 | } |
4334 | 1614 | 1634 | ||
4335 | 1615 | if (rootPixmapCopy) | 1635 | if (rootPixmapCopy) |
4336 | @@ -1619,9 +1639,7 @@ | |||
4337 | 1619 | XSync (screen->dpy (), false); | 1639 | XSync (screen->dpy (), false); |
4338 | 1620 | } | 1640 | } |
4339 | 1621 | else | 1641 | else |
4340 | 1622 | { | ||
4341 | 1623 | backgroundTextures.clear (); | 1642 | backgroundTextures.clear (); |
4342 | 1624 | } | ||
4343 | 1625 | 1643 | ||
4344 | 1626 | XFreeGC(dpy, gc); | 1644 | XFreeGC(dpy, gc); |
4345 | 1627 | } | 1645 | } |
4346 | @@ -1711,7 +1729,7 @@ | |||
4347 | 1711 | void | 1729 | void |
4348 | 1712 | GLScreenInterface::glBufferStencil(const GLMatrix &matrix, | 1730 | GLScreenInterface::glBufferStencil(const GLMatrix &matrix, |
4349 | 1713 | GLVertexBuffer &vertexBuffer, | 1731 | GLVertexBuffer &vertexBuffer, |
4351 | 1714 | CompOutput *output) | 1732 | CompOutput *output) |
4352 | 1715 | WRAPABLE_DEF (glBufferStencil, matrix, vertexBuffer, output) | 1733 | WRAPABLE_DEF (glBufferStencil, matrix, vertexBuffer, output) |
4353 | 1716 | 1734 | ||
4354 | 1717 | GLMatrix * | 1735 | GLMatrix * |
4355 | @@ -1747,7 +1765,8 @@ | |||
4356 | 1747 | } | 1765 | } |
4357 | 1748 | 1766 | ||
4358 | 1749 | void | 1767 | void |
4360 | 1750 | GLScreen::setFilter (int num, GLTexture::Filter filter) | 1768 | GLScreen::setFilter (int num, |
4361 | 1769 | GLTexture::Filter filter) | ||
4362 | 1751 | { | 1770 | { |
4363 | 1752 | priv->filter[num] = filter; | 1771 | priv->filter[num] = filter; |
4364 | 1753 | } | 1772 | } |
4365 | @@ -1766,9 +1785,9 @@ | |||
4366 | 1766 | { | 1785 | { |
4367 | 1767 | BoxPtr pBox = &output->region ()->extents; | 1786 | BoxPtr pBox = &output->region ()->extents; |
4368 | 1768 | 1787 | ||
4372 | 1769 | if (pBox->x1 != 0 || | 1788 | if (pBox->x1 != 0 || |
4373 | 1770 | pBox->y1 != 0 || | 1789 | pBox->y1 != 0 || |
4374 | 1771 | pBox->x2 != (int) screen->width () || | 1790 | pBox->x2 != (int) screen->width () || |
4375 | 1772 | pBox->y2 != (int) screen->height ()) | 1791 | pBox->y2 != (int) screen->height ()) |
4376 | 1773 | { | 1792 | { |
4377 | 1774 | glEnable (GL_SCISSOR_TEST); | 1793 | glEnable (GL_SCISSOR_TEST); |
4378 | @@ -1780,9 +1799,7 @@ | |||
4379 | 1780 | glDisable (GL_SCISSOR_TEST); | 1799 | glDisable (GL_SCISSOR_TEST); |
4380 | 1781 | } | 1800 | } |
4381 | 1782 | else | 1801 | else |
4382 | 1783 | { | ||
4383 | 1784 | glClear (mask); | 1802 | glClear (mask); |
4384 | 1785 | } | ||
4385 | 1786 | } | 1803 | } |
4386 | 1787 | 1804 | ||
4387 | 1788 | void | 1805 | void |
4388 | @@ -1825,7 +1842,7 @@ | |||
4389 | 1825 | const compiz::opengl::impl::GLXSwapIntervalEXTFunc &swapIntervalFunc, | 1842 | const compiz::opengl::impl::GLXSwapIntervalEXTFunc &swapIntervalFunc, |
4390 | 1826 | const compiz::opengl::impl::GLXWaitVideoSyncSGIFunc &waitVideoSyncFunc) : | 1843 | const compiz::opengl::impl::GLXWaitVideoSyncSGIFunc &waitVideoSyncFunc) : |
4391 | 1827 | compiz::opengl::DoubleBuffer (swapIntervalFunc, waitVideoSyncFunc), | 1844 | compiz::opengl::DoubleBuffer (swapIntervalFunc, waitVideoSyncFunc), |
4393 | 1828 | mDpy (d), | 1845 | mDpy (d), |
4394 | 1829 | mSize (s) | 1846 | mSize (s) |
4395 | 1830 | { | 1847 | { |
4396 | 1831 | } | 1848 | } |
4397 | @@ -1914,6 +1931,7 @@ | |||
4398 | 1914 | glLoadIdentity (); | 1931 | glLoadIdentity (); |
4399 | 1915 | 1932 | ||
4400 | 1916 | glDrawBuffer (GL_FRONT); | 1933 | glDrawBuffer (GL_FRONT); |
4401 | 1934 | |||
4402 | 1917 | foreach (const CompRect &r, blitRects) | 1935 | foreach (const CompRect &r, blitRects) |
4403 | 1918 | { | 1936 | { |
4404 | 1919 | int x = r.x1 (); | 1937 | int x = r.x1 (); |
4405 | @@ -1921,6 +1939,7 @@ | |||
4406 | 1921 | glRasterPos2i (x, y); | 1939 | glRasterPos2i (x, y); |
4407 | 1922 | glCopyPixels (x, y, w, h, GL_COLOR); | 1940 | glCopyPixels (x, y, w, h, GL_COLOR); |
4408 | 1923 | } | 1941 | } |
4409 | 1942 | |||
4410 | 1924 | glDrawBuffer (GL_BACK); | 1943 | glDrawBuffer (GL_BACK); |
4411 | 1925 | 1944 | ||
4412 | 1926 | glPopMatrix (); | 1945 | glPopMatrix (); |
4413 | @@ -1929,7 +1948,6 @@ | |||
4414 | 1929 | glMatrixMode (GL_MODELVIEW); | 1948 | glMatrixMode (GL_MODELVIEW); |
4415 | 1930 | 1949 | ||
4416 | 1931 | glFlush (); | 1950 | glFlush (); |
4417 | 1932 | |||
4418 | 1933 | } | 1951 | } |
4419 | 1934 | 1952 | ||
4420 | 1935 | #else | 1953 | #else |
4421 | @@ -1960,7 +1978,7 @@ | |||
4422 | 1960 | EGLDoubleBuffer::blit (const CompRegion ®ion) const | 1978 | EGLDoubleBuffer::blit (const CompRegion ®ion) const |
4423 | 1961 | { | 1979 | { |
4424 | 1962 | CompRect::vector blitRects (region.rects ()); | 1980 | CompRect::vector blitRects (region.rects ()); |
4426 | 1963 | int y = 0; | 1981 | int y = 0; |
4427 | 1964 | 1982 | ||
4428 | 1965 | foreach (const CompRect &r, blitRects) | 1983 | foreach (const CompRect &r, blitRects) |
4429 | 1966 | { | 1984 | { |
4430 | @@ -1997,35 +2015,45 @@ | |||
4431 | 1997 | unsigned int mask, | 2015 | unsigned int mask, |
4432 | 1998 | const CompRegion ®ion) | 2016 | const CompRegion ®ion) |
4433 | 1999 | { | 2017 | { |
4439 | 2000 | if (clearBuffers) | 2018 | if (clearBuffers && |
4440 | 2001 | { | 2019 | mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) |
4441 | 2002 | if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) | 2020 | glClear (GL_COLOR_BUFFER_BIT); |
4437 | 2003 | glClear (GL_COLOR_BUFFER_BIT); | ||
4438 | 2004 | } | ||
4442 | 2005 | 2021 | ||
4443 | 2006 | // Disable everything that we don't usually need and could slow us down | 2022 | // Disable everything that we don't usually need and could slow us down |
4447 | 2007 | glDisable (GL_BLEND); | 2023 | GLboolean glBlendEnabled = glIsEnabled (GL_BLEND); |
4448 | 2008 | glDisable (GL_STENCIL_TEST); | 2024 | GLboolean glStencilEnabled = glIsEnabled (GL_STENCIL_TEST); |
4449 | 2009 | glDisable (GL_DEPTH_TEST); | 2025 | GLboolean glDepthEnabled = glIsEnabled (GL_DEPTH_TEST); |
4450 | 2026 | |||
4451 | 2027 | // just disable global states if they are enabled | ||
4452 | 2028 | if (glBlendEnabled) | ||
4453 | 2029 | glDisable (GL_BLEND); | ||
4454 | 2030 | |||
4455 | 2031 | if (glStencilEnabled) | ||
4456 | 2032 | glDisable (GL_STENCIL_TEST); | ||
4457 | 2033 | |||
4458 | 2034 | if (glDepthEnabled) | ||
4459 | 2035 | glDisable (GL_DEPTH_TEST); | ||
4460 | 2036 | |||
4461 | 2010 | glDepthMask (GL_FALSE); | 2037 | glDepthMask (GL_FALSE); |
4462 | 2011 | glStencilMask (0); | 2038 | glStencilMask (0); |
4463 | 2012 | 2039 | ||
4464 | 2013 | GLFramebufferObject *oldFbo = NULL; | 2040 | GLFramebufferObject *oldFbo = NULL; |
4466 | 2014 | bool useFbo = false; | 2041 | bool useFbo = false; |
4467 | 2015 | 2042 | ||
4468 | 2016 | /* Clear the color buffer where appropriate */ | 2043 | /* Clear the color buffer where appropriate */ |
4469 | 2017 | if (GL::fboEnabled && scratchFbo) | 2044 | if (GL::fboEnabled && scratchFbo) |
4470 | 2018 | { | 2045 | { |
4471 | 2019 | oldFbo = scratchFbo->bind (); | 2046 | oldFbo = scratchFbo->bind (); |
4472 | 2020 | useFbo = scratchFbo->checkStatus () && scratchFbo->tex (); | 2047 | useFbo = scratchFbo->checkStatus () && scratchFbo->tex (); |
4473 | 2048 | |||
4474 | 2021 | if (!useFbo) | 2049 | if (!useFbo) |
4475 | 2022 | GLFramebufferObject::rebind (oldFbo); | 2050 | GLFramebufferObject::rebind (oldFbo); |
4476 | 2023 | } | 2051 | } |
4477 | 2024 | 2052 | ||
4478 | 2025 | #ifdef UNSAFE_ARM_SGX_FIXME | 2053 | #ifdef UNSAFE_ARM_SGX_FIXME |
4482 | 2026 | refreshSubBuffer = ((lastMask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) && | 2054 | refreshSubBuffer = ((lastMask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) && |
4483 | 2027 | !(mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) && | 2055 | !(mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) && |
4484 | 2028 | (mask & COMPOSITE_SCREEN_DAMAGE_REGION_MASK)); | 2056 | (mask & COMPOSITE_SCREEN_DAMAGE_REGION_MASK)); |
4485 | 2029 | 2057 | ||
4486 | 2030 | if (refreshSubBuffer) | 2058 | if (refreshSubBuffer) |
4487 | 2031 | { | 2059 | { |
4488 | @@ -2035,16 +2063,18 @@ | |||
4489 | 2035 | // Posting a fullscreen damage region to the SGX seems to reset the | 2063 | // Posting a fullscreen damage region to the SGX seems to reset the |
4490 | 2036 | // framebuffer, causing the screen to blackout. | 2064 | // framebuffer, causing the screen to blackout. |
4491 | 2037 | cScreen->damageRegion (CompRegion (screen->fullscreenOutput ()) - | 2065 | cScreen->damageRegion (CompRegion (screen->fullscreenOutput ()) - |
4493 | 2038 | CompRegion (CompRect(0, 0, 1, 1))); | 2066 | CompRegion (CompRect(0, 0, 1, 1))); |
4494 | 2039 | } | 2067 | } |
4495 | 2040 | #endif | 2068 | #endif |
4496 | 2041 | 2069 | ||
4497 | 2042 | CompRegion tmpRegion = (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) ? | 2070 | CompRegion tmpRegion = (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) ? |
4499 | 2043 | screen->region () : region; | 2071 | screen->region () : region; |
4500 | 2072 | |||
4501 | 2073 | XRectangle r; | ||
4502 | 2074 | GLMatrix identity; | ||
4503 | 2044 | 2075 | ||
4504 | 2045 | foreach (CompOutput *output, outputs) | 2076 | foreach (CompOutput *output, outputs) |
4505 | 2046 | { | 2077 | { |
4506 | 2047 | XRectangle r; | ||
4507 | 2048 | targetOutput = output; | 2078 | targetOutput = output; |
4508 | 2049 | 2079 | ||
4509 | 2050 | r.x = output->x1 (); | 2080 | r.x = output->x1 (); |
4510 | @@ -2063,8 +2093,6 @@ | |||
4511 | 2063 | 2093 | ||
4512 | 2064 | if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) | 2094 | if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) |
4513 | 2065 | { | 2095 | { |
4514 | 2066 | GLMatrix identity; | ||
4515 | 2067 | |||
4516 | 2068 | gScreen->glPaintOutput (defaultScreenPaintAttrib, | 2096 | gScreen->glPaintOutput (defaultScreenPaintAttrib, |
4517 | 2069 | identity, | 2097 | identity, |
4518 | 2070 | CompRegion (*output), output, | 2098 | CompRegion (*output), output, |
4519 | @@ -2073,8 +2101,6 @@ | |||
4520 | 2073 | } | 2101 | } |
4521 | 2074 | else if (mask & COMPOSITE_SCREEN_DAMAGE_REGION_MASK) | 2102 | else if (mask & COMPOSITE_SCREEN_DAMAGE_REGION_MASK) |
4522 | 2075 | { | 2103 | { |
4523 | 2076 | GLMatrix identity; | ||
4524 | 2077 | |||
4525 | 2078 | #ifdef UNSAFE_ARM_SGX_FIXME | 2104 | #ifdef UNSAFE_ARM_SGX_FIXME |
4526 | 2079 | /* | 2105 | /* |
4527 | 2080 | * FIXME: | 2106 | * FIXME: |
4528 | @@ -2134,10 +2160,10 @@ | |||
4529 | 2134 | } | 2160 | } |
4530 | 2135 | 2161 | ||
4531 | 2136 | bool alwaysSwap = optionGetAlwaysSwapBuffers (); | 2162 | bool alwaysSwap = optionGetAlwaysSwapBuffers (); |
4536 | 2137 | bool fullscreen = useFbo || | 2163 | bool fullscreen = useFbo || |
4537 | 2138 | alwaysSwap || | 2164 | alwaysSwap || |
4538 | 2139 | ((mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) && | 2165 | ((mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) && |
4539 | 2140 | commonFrontbuffer); | 2166 | commonFrontbuffer); |
4540 | 2141 | 2167 | ||
4541 | 2142 | doubleBuffer.set (DoubleBuffer::VSYNC, optionGetSyncToVblank ()); | 2168 | doubleBuffer.set (DoubleBuffer::VSYNC, optionGetSyncToVblank ()); |
4542 | 2143 | doubleBuffer.set (DoubleBuffer::HAVE_PERSISTENT_BACK_BUFFER, useFbo); | 2169 | doubleBuffer.set (DoubleBuffer::HAVE_PERSISTENT_BACK_BUFFER, useFbo); |
4543 | @@ -2184,6 +2210,7 @@ | |||
4544 | 2184 | { | 2210 | { |
4545 | 2185 | bool wasFboEnabled = GL::fboEnabled; | 2211 | bool wasFboEnabled = GL::fboEnabled; |
4546 | 2186 | updateRenderMode (); | 2212 | updateRenderMode (); |
4547 | 2213 | |||
4548 | 2187 | if (wasFboEnabled != GL::fboEnabled) | 2214 | if (wasFboEnabled != GL::fboEnabled) |
4549 | 2188 | CompositeScreen::get (screen)->damageScreen (); | 2215 | CompositeScreen::get (screen)->damageScreen (); |
4550 | 2189 | } | 2216 | } |
4551 | @@ -2198,8 +2225,9 @@ | |||
4552 | 2198 | if (prevRegex != regex) | 2225 | if (prevRegex != regex) |
4553 | 2199 | { | 2226 | { |
4554 | 2200 | prevBlacklisted = blacklisted (regex, glVendor, glRenderer, glVersion); | 2227 | prevBlacklisted = blacklisted (regex, glVendor, glRenderer, glVersion); |
4556 | 2201 | prevRegex = regex; | 2228 | prevRegex = regex; |
4557 | 2202 | } | 2229 | } |
4558 | 2230 | |||
4559 | 2203 | return prevBlacklisted; | 2231 | return prevBlacklisted; |
4560 | 2204 | } | 2232 | } |
4561 | 2205 | 2233 | ||
4562 | @@ -2207,9 +2235,11 @@ | |||
4563 | 2207 | GLScreen::registerBindPixmap (GLTexture::BindPixmapProc proc) | 2235 | GLScreen::registerBindPixmap (GLTexture::BindPixmapProc proc) |
4564 | 2208 | { | 2236 | { |
4565 | 2209 | priv->bindPixmap.push_back (proc); | 2237 | priv->bindPixmap.push_back (proc); |
4566 | 2238 | |||
4567 | 2210 | if (!priv->hasCompositing && | 2239 | if (!priv->hasCompositing && |
4568 | 2211 | CompositeScreen::get (screen)->registerPaintHandler (priv)) | 2240 | CompositeScreen::get (screen)->registerPaintHandler (priv)) |
4569 | 2212 | priv->hasCompositing = true; | 2241 | priv->hasCompositing = true; |
4570 | 2242 | |||
4571 | 2213 | return priv->bindPixmap.size () - 1; | 2243 | return priv->bindPixmap.size () - 1; |
4572 | 2214 | } | 2244 | } |
4573 | 2215 | 2245 | ||
4574 | @@ -2217,10 +2247,13 @@ | |||
4575 | 2217 | GLScreen::unregisterBindPixmap (GLTexture::BindPixmapHandle hnd) | 2247 | GLScreen::unregisterBindPixmap (GLTexture::BindPixmapHandle hnd) |
4576 | 2218 | { | 2248 | { |
4577 | 2219 | bool hasBP = false; | 2249 | bool hasBP = false; |
4578 | 2250 | |||
4579 | 2220 | priv->bindPixmap[hnd].clear (); | 2251 | priv->bindPixmap[hnd].clear (); |
4581 | 2221 | for (unsigned int i = 0; i < priv->bindPixmap.size (); i++) | 2252 | |
4582 | 2253 | for (unsigned int i = 0; i < priv->bindPixmap.size (); ++i) | ||
4583 | 2222 | if (!priv->bindPixmap[i].empty ()) | 2254 | if (!priv->bindPixmap[i].empty ()) |
4584 | 2223 | hasBP = true; | 2255 | hasBP = true; |
4585 | 2256 | |||
4586 | 2224 | if (!hasBP && priv->hasCompositing) | 2257 | if (!hasBP && priv->hasCompositing) |
4587 | 2225 | { | 2258 | { |
4588 | 2226 | CompositeScreen::get (screen)->unregisterPaintHandler (); | 2259 | CompositeScreen::get (screen)->unregisterPaintHandler (); |
4589 | @@ -2240,10 +2273,9 @@ | |||
4590 | 2240 | CompIcon *i = screen->defaultIcon (); | 2273 | CompIcon *i = screen->defaultIcon (); |
4591 | 2241 | CompSize size; | 2274 | CompSize size; |
4592 | 2242 | 2275 | ||
4597 | 2243 | if (!i) | 2276 | if (!i || |
4598 | 2244 | return NULL; | 2277 | !i->width () || |
4599 | 2245 | 2278 | !i->height ()) | |
4596 | 2246 | if (!i->width () || !i->height ()) | ||
4600 | 2247 | return NULL; | 2279 | return NULL; |
4601 | 2248 | 2280 | ||
4602 | 2249 | if (priv->defaultIcon.icon == i) | 2281 | if (priv->defaultIcon.icon == i) |
4603 | @@ -2272,4 +2304,3 @@ | |||
4604 | 2272 | priv->rasterPos.setX (0); | 2304 | priv->rasterPos.setX (0); |
4605 | 2273 | priv->rasterPos.setY (0); | 2305 | priv->rasterPos.setY (0); |
4606 | 2274 | } | 2306 | } |
4607 | 2275 | |||
4608 | 2276 | 2307 | ||
4609 | === modified file 'plugins/opengl/src/shadercache.cpp' | |||
4610 | --- plugins/opengl/src/shadercache.cpp 2013-01-09 10:45:16 +0000 | |||
4611 | +++ plugins/opengl/src/shadercache.cpp 2013-07-24 16:05:45 +0000 | |||
4612 | @@ -33,9 +33,10 @@ | |||
4613 | 33 | class GLShaderParametersComparer | 33 | class GLShaderParametersComparer |
4614 | 34 | { | 34 | { |
4615 | 35 | public: | 35 | public: |
4616 | 36 | |||
4617 | 36 | bool operator()(const GLShaderParameters &left, const GLShaderParameters &right) const | 37 | bool operator()(const GLShaderParameters &left, const GLShaderParameters &right) const |
4618 | 37 | { | 38 | { |
4620 | 38 | return left.hash() < right.hash(); | 39 | return left.hash() < right.hash(); |
4621 | 39 | } | 40 | } |
4622 | 40 | 41 | ||
4623 | 41 | }; | 42 | }; |
4624 | @@ -48,6 +49,7 @@ | |||
4625 | 48 | class PrivateShaderCache | 49 | class PrivateShaderCache |
4626 | 49 | { | 50 | { |
4627 | 50 | public: | 51 | public: |
4628 | 52 | |||
4629 | 51 | PrivateShaderCache() {} | 53 | PrivateShaderCache() {} |
4630 | 52 | 54 | ||
4631 | 53 | ShaderMapType::const_iterator addShaderData(const GLShaderParameters ¶ms); | 55 | ShaderMapType::const_iterator addShaderData(const GLShaderParameters ¶ms); |
4632 | @@ -65,12 +67,12 @@ | |||
4633 | 65 | int | 67 | int |
4634 | 66 | GLShaderParameters::hash() const | 68 | GLShaderParameters::hash() const |
4635 | 67 | { | 69 | { |
4642 | 68 | return static_cast<int>(opacity) | | 70 | return static_cast<int>(opacity) | |
4643 | 69 | (static_cast<int>(brightness) << 1) | | 71 | (static_cast<int>(brightness) << 1) | |
4644 | 70 | (static_cast<int>(saturation) << 2) | | 72 | (static_cast<int>(saturation) << 2) | |
4645 | 71 | (static_cast<int>(color) << 3) | | 73 | (static_cast<int>(color) << 3) | |
4646 | 72 | (static_cast<int>(normal) << 5) | | 74 | (static_cast<int>(normal) << 5) | |
4647 | 73 | (static_cast<int>(numTextures) << 8); | 75 | (static_cast<int>(numTextures) << 8); |
4648 | 74 | } | 76 | } |
4649 | 75 | 77 | ||
4650 | 76 | std::string | 78 | std::string |
4651 | @@ -78,14 +80,15 @@ | |||
4652 | 78 | { | 80 | { |
4653 | 79 | std::stringstream ss; | 81 | std::stringstream ss; |
4654 | 80 | 82 | ||
4656 | 81 | ss << (opacity ? "t" : "f"); | 83 | ss << (opacity ? "t" : "f"); |
4657 | 82 | ss << (brightness ? "t" : "f"); | 84 | ss << (brightness ? "t" : "f"); |
4658 | 83 | ss << (saturation ? "t" : "f"); | 85 | ss << (saturation ? "t" : "f"); |
4664 | 84 | ss << (color == GLShaderVariableNone ? "n" : | 86 | ss << (color == GLShaderVariableNone ? |
4665 | 85 | color == GLShaderVariableUniform ? "u" : "v"); | 87 | "n" : color == GLShaderVariableUniform ? "u" : "v"); |
4666 | 86 | 88 | ||
4667 | 87 | ss << (normal == GLShaderVariableNone ? "n" : | 89 | ss << (normal == GLShaderVariableNone ? |
4668 | 88 | normal == GLShaderVariableUniform ? "u" : "v"); | 90 | "n" : normal == GLShaderVariableUniform ? "u" : "v"); |
4669 | 91 | |||
4670 | 89 | ss << numTextures; | 92 | ss << numTextures; |
4671 | 90 | 93 | ||
4672 | 91 | return ss.str(); | 94 | return ss.str(); |
4673 | @@ -113,7 +116,7 @@ | |||
4674 | 113 | // Try to find a cached shader pair that matches the parameters. | 116 | // Try to find a cached shader pair that matches the parameters. |
4675 | 114 | // If we don't have it cached, create it. | 117 | // If we don't have it cached, create it. |
4676 | 115 | if ((iter = priv->shaderMap.find (params)) == priv->shaderMap.end ()) | 118 | if ((iter = priv->shaderMap.find (params)) == priv->shaderMap.end ()) |
4678 | 116 | iter = priv->addShaderData (params); | 119 | iter = priv->addShaderData (params); |
4679 | 117 | 120 | ||
4680 | 118 | return iter->second; | 121 | return iter->second; |
4681 | 119 | } | 122 | } |
4682 | @@ -127,12 +130,13 @@ | |||
4683 | 127 | { | 130 | { |
4684 | 128 | GLShaderData shaderData; | 131 | GLShaderData shaderData; |
4685 | 129 | 132 | ||
4687 | 130 | shaderData.name = params.id (); | 133 | shaderData.name = params.id (); |
4688 | 131 | shaderData.fragmentShader = createFragmentShader (params); | 134 | shaderData.fragmentShader = createFragmentShader (params); |
4690 | 132 | shaderData.vertexShader = createVertexShader (params); | 135 | shaderData.vertexShader = createVertexShader (params); |
4691 | 133 | 136 | ||
4692 | 134 | std::pair<ShaderMapType::iterator, bool> ret = | 137 | std::pair<ShaderMapType::iterator, bool> ret = |
4694 | 135 | shaderMap.insert(std::pair<GLShaderParameters, GLShaderData>(params,shaderData)); | 138 | shaderMap.insert(std::pair<GLShaderParameters, |
4695 | 139 | GLShaderData>(params,shaderData)); | ||
4696 | 136 | 140 | ||
4697 | 137 | return ret.first; | 141 | return ret.first; |
4698 | 138 | } | 142 | } |
4699 | @@ -150,35 +154,35 @@ | |||
4700 | 150 | std::stringstream ss; | 154 | std::stringstream ss; |
4701 | 151 | 155 | ||
4702 | 152 | ss << "#ifdef GL_ES\n" << | 156 | ss << "#ifdef GL_ES\n" << |
4705 | 153 | "precision mediump float;\n" << | 157 | "precision mediump float;\n" << |
4706 | 154 | "#endif\n"; | 158 | "#endif\n"; |
4707 | 155 | 159 | ||
4708 | 156 | ss << "uniform mat4 modelview;\n" << | 160 | ss << "uniform mat4 modelview;\n" << |
4710 | 157 | "uniform mat4 projection;\n"; | 161 | "uniform mat4 projection;\n"; |
4711 | 158 | 162 | ||
4712 | 159 | ss << "attribute vec3 position;\n" << | 163 | ss << "attribute vec3 position;\n" << |
4719 | 160 | "attribute vec3 normal;\n" << | 164 | "attribute vec3 normal;\n" << |
4720 | 161 | "attribute vec4 color;\n" << | 165 | "attribute vec4 color;\n" << |
4721 | 162 | "attribute vec2 texCoord0;\n" << | 166 | "attribute vec2 texCoord0;\n" << |
4722 | 163 | "attribute vec2 texCoord1;\n" << | 167 | "attribute vec2 texCoord1;\n" << |
4723 | 164 | "attribute vec2 texCoord2;\n" << | 168 | "attribute vec2 texCoord2;\n" << |
4724 | 165 | "attribute vec2 texCoord3;\n"; | 169 | "attribute vec2 texCoord3;\n"; |
4725 | 166 | 170 | ||
4726 | 167 | ss << "@VERTEX_FUNCTIONS@\n"; | 171 | ss << "@VERTEX_FUNCTIONS@\n"; |
4727 | 168 | 172 | ||
4728 | 169 | if (params.color == GLShaderVariableVarying) | 173 | if (params.color == GLShaderVariableVarying) |
4730 | 170 | ss << "varying vec4 vColor;\n"; | 174 | ss << "varying vec4 vColor;\n"; |
4731 | 171 | 175 | ||
4734 | 172 | for (int i = 0; i < params.numTextures; i++) | 176 | for (int i = 0; i < params.numTextures; ++i) |
4735 | 173 | ss << "varying vec2 vTexCoord" << i << ";\n"; | 177 | ss << "varying vec2 vTexCoord" << i << ";\n"; |
4736 | 174 | 178 | ||
4737 | 175 | ss << "void main() {\n"; | 179 | ss << "void main() {\n"; |
4738 | 176 | 180 | ||
4741 | 177 | for (int i = 0; i < params.numTextures; i++) | 181 | for (int i = 0; i < params.numTextures; ++i) |
4742 | 178 | ss << "vTexCoord" << i << " = texCoord" << i <<";\n"; | 182 | ss << "vTexCoord" << i << " = texCoord" << i <<";\n"; |
4743 | 179 | 183 | ||
4744 | 180 | if (params.color == GLShaderVariableVarying) | 184 | if (params.color == GLShaderVariableVarying) |
4746 | 181 | ss << "vColor = color;\n"; | 185 | ss << "vColor = color;\n"; |
4747 | 182 | 186 | ||
4748 | 183 | ss << "gl_Position = projection * modelview * vec4(position, 1.0);\n"; | 187 | ss << "gl_Position = projection * modelview * vec4(position, 1.0);\n"; |
4749 | 184 | 188 | ||
4750 | @@ -199,50 +203,52 @@ | |||
4751 | 199 | { | 203 | { |
4752 | 200 | std::stringstream ss; | 204 | std::stringstream ss; |
4753 | 201 | ss << "#ifdef GL_ES\n" << | 205 | ss << "#ifdef GL_ES\n" << |
4756 | 202 | "precision mediump float;\n" << | 206 | "precision mediump float;\n" << |
4757 | 203 | "#endif\n"; | 207 | "#endif\n"; |
4758 | 204 | 208 | ||
4759 | 205 | ss << "uniform vec3 paintAttrib;\n"; | 209 | ss << "uniform vec3 paintAttrib;\n"; |
4760 | 206 | 210 | ||
4764 | 207 | for (int i = 0; i < params.numTextures; i++) { | 211 | for (int i = 0; i < params.numTextures; ++i) |
4765 | 208 | ss << "uniform sampler2D texture" << i << ";\n"; | 212 | { |
4766 | 209 | ss << "varying vec2 vTexCoord" << i << ";\n"; | 213 | ss << "uniform sampler2D texture" << i << ";\n"; |
4767 | 214 | ss << "varying vec2 vTexCoord" << i << ";\n"; | ||
4768 | 210 | } | 215 | } |
4769 | 211 | 216 | ||
4770 | 212 | if (params.color == GLShaderVariableUniform) | 217 | if (params.color == GLShaderVariableUniform) |
4772 | 213 | ss << "uniform vec4 singleColor;\n"; | 218 | ss << "uniform vec4 singleColor;\n"; |
4773 | 214 | else if (params.color == GLShaderVariableVarying) | 219 | else if (params.color == GLShaderVariableVarying) |
4775 | 215 | ss << "varying vec4 vColor;\n"; | 220 | ss << "varying vec4 vColor;\n"; |
4776 | 216 | 221 | ||
4777 | 217 | ss << "@FRAGMENT_FUNCTIONS@\n"; | 222 | ss << "@FRAGMENT_FUNCTIONS@\n"; |
4778 | 218 | 223 | ||
4779 | 219 | ss << "void main() {\n vec4 color = "; | 224 | ss << "void main() {\n vec4 color = "; |
4780 | 220 | 225 | ||
4781 | 221 | if (params.color == GLShaderVariableUniform) | 226 | if (params.color == GLShaderVariableUniform) |
4783 | 222 | ss << "singleColor *"; | 227 | ss << "singleColor *"; |
4784 | 223 | else if (params.color == GLShaderVariableVarying) | 228 | else if (params.color == GLShaderVariableVarying) |
4786 | 224 | ss << "vColor *"; | 229 | ss << "vColor *"; |
4787 | 225 | 230 | ||
4790 | 226 | for (int i = 0; i < params.numTextures; i++) | 231 | for (int i = 0; i < params.numTextures; ++i) |
4791 | 227 | ss << " texture2D(texture" << i << ", vTexCoord" << i << ") *"; | 232 | ss << " texture2D(texture" << i << ", vTexCoord" << i << ") *"; |
4792 | 228 | 233 | ||
4793 | 229 | ss << " 1.0;\n"; | 234 | ss << " 1.0;\n"; |
4794 | 230 | 235 | ||
4796 | 231 | if (params.saturation) { | 236 | if (params.saturation) |
4797 | 237 | { | ||
4798 | 232 | ss << "vec3 desaturated = color.rgb * vec3 (0.30, 0.59, 0.11);\n" << | 238 | ss << "vec3 desaturated = color.rgb * vec3 (0.30, 0.59, 0.11);\n" << |
4799 | 233 | "desaturated = vec3 (dot (desaturated, color.rgb));\n" << | 239 | "desaturated = vec3 (dot (desaturated, color.rgb));\n" << |
4800 | 234 | "color.rgb = color.rgb * vec3 (paintAttrib.z) + desaturated *\n" << | 240 | "color.rgb = color.rgb * vec3 (paintAttrib.z) + desaturated *\n" << |
4801 | 235 | " vec3 (1.0 - paintAttrib.z);\n"; | 241 | " vec3 (1.0 - paintAttrib.z);\n"; |
4802 | 236 | } | 242 | } |
4803 | 237 | 243 | ||
4805 | 238 | if (params.brightness) { | 244 | if (params.brightness) |
4806 | 245 | { | ||
4807 | 239 | ss << "color.rgb = color.rgb * paintAttrib.y" << | 246 | ss << "color.rgb = color.rgb * paintAttrib.y" << |
4808 | 240 | (params.opacity ? " * paintAttrib.x;\n" : ";\n") << | 247 | (params.opacity ? " * paintAttrib.x;\n" : ";\n") << |
4809 | 241 | (params.opacity ? "color.a = color.a * paintAttrib.x;\n" : ""); | 248 | (params.opacity ? "color.a = color.a * paintAttrib.x;\n" : ""); |
4810 | 242 | } | 249 | } |
4812 | 243 | else if (params.opacity) { | 250 | else if (params.opacity) |
4813 | 244 | ss << "color = color * paintAttrib.x;\n"; | 251 | ss << "color = color * paintAttrib.x;\n"; |
4814 | 245 | } | ||
4815 | 246 | 252 | ||
4816 | 247 | ss << "gl_FragColor = color;\n"; | 253 | ss << "gl_FragColor = color;\n"; |
4817 | 248 | ss << "@FRAGMENT_FUNCTION_CALLS@\n}"; | 254 | ss << "@FRAGMENT_FUNCTION_CALLS@\n}"; |
4818 | 249 | 255 | ||
4819 | === modified file 'plugins/opengl/src/texture.cpp' | |||
4820 | --- plugins/opengl/src/texture.cpp 2012-09-19 12:18:34 +0000 | |||
4821 | +++ plugins/opengl/src/texture.cpp 2013-07-24 16:05:45 +0000 | |||
4822 | @@ -48,7 +48,8 @@ | |||
4823 | 48 | std::map<Damage, TfpTexture*> boundPixmapTex; | 48 | std::map<Damage, TfpTexture*> boundPixmapTex; |
4824 | 49 | #endif | 49 | #endif |
4825 | 50 | 50 | ||
4827 | 51 | static GLTexture::Matrix _identity_matrix = { | 51 | static GLTexture::Matrix _identity_matrix = |
4828 | 52 | { | ||
4829 | 52 | 1.0f, 0.0f, | 53 | 1.0f, 0.0f, |
4830 | 53 | 0.0f, 1.0f, | 54 | 0.0f, 1.0f, |
4831 | 54 | 0.0f, 0.0f | 55 | 0.0f, 0.0f |
4832 | @@ -62,14 +63,14 @@ | |||
4833 | 62 | GLTexture::List::List (unsigned int size) : | 63 | GLTexture::List::List (unsigned int size) : |
4834 | 63 | std::vector<GLTexture *> (size) | 64 | std::vector<GLTexture *> (size) |
4835 | 64 | { | 65 | { |
4837 | 65 | for (unsigned int i = 0; i < size; i++) | 66 | for (unsigned int i = 0; i < size; ++i) |
4838 | 66 | at (i) = NULL; | 67 | at (i) = NULL; |
4839 | 67 | } | 68 | } |
4840 | 68 | 69 | ||
4841 | 69 | GLTexture::List::List (const GLTexture::List &c) : | 70 | GLTexture::List::List (const GLTexture::List &c) : |
4842 | 70 | std::vector<GLTexture *> (c.size ()) | 71 | std::vector<GLTexture *> (c.size ()) |
4843 | 71 | { | 72 | { |
4845 | 72 | for (unsigned int i = 0; i < c.size (); i++) | 73 | for (unsigned int i = 0; i < c.size (); ++i) |
4846 | 73 | { | 74 | { |
4847 | 74 | at (i) = c[i]; | 75 | at (i) = c[i]; |
4848 | 75 | GLTexture::incRef (c[i]); | 76 | GLTexture::incRef (c[i]); |
4849 | @@ -88,11 +89,13 @@ | |||
4850 | 88 | { | 89 | { |
4851 | 89 | this->clear (); | 90 | this->clear (); |
4852 | 90 | resize (c.size ()); | 91 | resize (c.size ()); |
4854 | 91 | for (unsigned int i = 0; i < c.size (); i++) | 92 | |
4855 | 93 | for (unsigned int i = 0; i < c.size (); ++i) | ||
4856 | 92 | { | 94 | { |
4857 | 93 | at (i) = c[i]; | 95 | at (i) = c[i]; |
4858 | 94 | GLTexture::incRef (c[i]); | 96 | GLTexture::incRef (c[i]); |
4859 | 95 | } | 97 | } |
4860 | 98 | |||
4861 | 96 | return *this; | 99 | return *this; |
4862 | 97 | } | 100 | } |
4863 | 98 | 101 | ||
4864 | @@ -102,6 +105,7 @@ | |||
4865 | 102 | foreach (GLTexture *t, *this) | 105 | foreach (GLTexture *t, *this) |
4866 | 103 | if (t) | 106 | if (t) |
4867 | 104 | GLTexture::decRef (t); | 107 | GLTexture::decRef (t); |
4868 | 108 | |||
4869 | 105 | std::vector <GLTexture *>::clear (); | 109 | std::vector <GLTexture *>::clear (); |
4870 | 106 | } | 110 | } |
4871 | 107 | 111 | ||
4872 | @@ -119,15 +123,15 @@ | |||
4873 | 119 | 123 | ||
4874 | 120 | PrivateTexture::PrivateTexture (GLTexture *texture) : | 124 | PrivateTexture::PrivateTexture (GLTexture *texture) : |
4875 | 121 | texture (texture), | 125 | texture (texture), |
4882 | 122 | name (0), | 126 | name (0), |
4883 | 123 | target (GL_TEXTURE_2D), | 127 | target (GL_TEXTURE_2D), |
4884 | 124 | filter (GL_NEAREST), | 128 | filter (GL_NEAREST), |
4885 | 125 | wrap (GL_CLAMP_TO_EDGE), | 129 | wrap (GL_CLAMP_TO_EDGE), |
4886 | 126 | matrix (_identity_matrix), | 130 | matrix (_identity_matrix), |
4887 | 127 | mipmap (true), | 131 | mipmap (true), |
4888 | 128 | mipmapSupport (false), | 132 | mipmapSupport (false), |
4891 | 129 | initial (true), | 133 | initial (true), |
4892 | 130 | refCount (1) | 134 | refCount (1) |
4893 | 131 | { | 135 | { |
4894 | 132 | glGenTextures (1, &name); | 136 | glGenTextures (1, &name); |
4895 | 133 | } | 137 | } |
4896 | @@ -135,9 +139,7 @@ | |||
4897 | 135 | PrivateTexture::~PrivateTexture () | 139 | PrivateTexture::~PrivateTexture () |
4898 | 136 | { | 140 | { |
4899 | 137 | if (name) | 141 | if (name) |
4900 | 138 | { | ||
4901 | 139 | glDeleteTextures (1, &name); | 142 | glDeleteTextures (1, &name); |
4902 | 140 | } | ||
4903 | 141 | } | 143 | } |
4904 | 142 | 144 | ||
4905 | 143 | GLuint | 145 | GLuint |
4906 | @@ -235,13 +237,11 @@ | |||
4907 | 235 | } | 237 | } |
4908 | 236 | } | 238 | } |
4909 | 237 | 239 | ||
4911 | 238 | if (priv->filter == GL_LINEAR_MIPMAP_LINEAR) | 240 | if (priv->filter == GL_LINEAR_MIPMAP_LINEAR && |
4912 | 241 | priv->initial) | ||
4913 | 239 | { | 242 | { |
4919 | 240 | if (priv->initial) | 243 | GL::generateMipmap (priv->target); |
4920 | 241 | { | 244 | priv->initial = false; |
4916 | 242 | GL::generateMipmap (priv->target); | ||
4917 | 243 | priv->initial = false; | ||
4918 | 244 | } | ||
4921 | 245 | } | 245 | } |
4922 | 246 | } | 246 | } |
4923 | 247 | 247 | ||
4924 | @@ -255,10 +255,12 @@ | |||
4925 | 255 | } | 255 | } |
4926 | 256 | 256 | ||
4927 | 257 | void | 257 | void |
4929 | 258 | GLTexture::setData (GLenum target, Matrix &m, bool mipmap) | 258 | GLTexture::setData (GLenum target, |
4930 | 259 | Matrix &m, | ||
4931 | 260 | bool mipmap) | ||
4932 | 259 | { | 261 | { |
4935 | 260 | priv->target = target; | 262 | priv->target = target; |
4936 | 261 | priv->matrix = m; | 263 | priv->matrix = m; |
4937 | 262 | priv->mipmapSupport = mipmap; | 264 | priv->mipmapSupport = mipmap; |
4938 | 263 | } | 265 | } |
4939 | 264 | 266 | ||
4940 | @@ -307,37 +309,36 @@ | |||
4941 | 307 | 309 | ||
4942 | 308 | GLTexture::List rv (1); | 310 | GLTexture::List rv (1); |
4943 | 309 | GLTexture *t = new GLTexture (); | 311 | GLTexture *t = new GLTexture (); |
4945 | 310 | rv[0] = t; | 312 | rv[0] = t; |
4946 | 311 | 313 | ||
4947 | 312 | GLTexture::Matrix matrix = _identity_matrix; | 314 | GLTexture::Matrix matrix = _identity_matrix; |
4948 | 313 | GLint internalFormat; | ||
4949 | 314 | GLenum target; | 315 | GLenum target; |
4950 | 315 | bool mipmap; | 316 | bool mipmap; |
4951 | 316 | bool pot = POWER_OF_TWO (width) && POWER_OF_TWO (height); | 317 | bool pot = POWER_OF_TWO (width) && POWER_OF_TWO (height); |
4952 | 317 | 318 | ||
4953 | 318 | #ifdef USE_GLES | 319 | #ifdef USE_GLES |
4955 | 319 | target = GL_TEXTURE_2D; | 320 | target = GL_TEXTURE_2D; |
4956 | 320 | matrix.xx = 1.0f / width; | 321 | matrix.xx = 1.0f / width; |
4957 | 321 | matrix.yy = 1.0f / height; | 322 | matrix.yy = 1.0f / height; |
4958 | 322 | matrix.y0 = 0.0f; | 323 | matrix.y0 = 0.0f; |
4960 | 323 | mipmap = GL::textureNonPowerOfTwoMipmap || pot; | 324 | mipmap = GL::textureNonPowerOfTwoMipmap || pot; |
4961 | 324 | #else | 325 | #else |
4962 | 325 | 326 | ||
4963 | 326 | if (GL::textureNonPowerOfTwo || pot) | 327 | if (GL::textureNonPowerOfTwo || pot) |
4964 | 327 | { | 328 | { |
4966 | 328 | target = GL_TEXTURE_2D; | 329 | target = GL_TEXTURE_2D; |
4967 | 329 | matrix.xx = 1.0f / width; | 330 | matrix.xx = 1.0f / width; |
4968 | 330 | matrix.yy = 1.0f / height; | 331 | matrix.yy = 1.0f / height; |
4969 | 331 | matrix.y0 = 0.0f; | 332 | matrix.y0 = 0.0f; |
4971 | 332 | mipmap = GL::generateMipmap && (GL::textureNonPowerOfTwoMipmap || pot); | 333 | mipmap = GL::generateMipmap && (GL::textureNonPowerOfTwoMipmap || pot); |
4972 | 333 | } | 334 | } |
4973 | 334 | else | 335 | else |
4974 | 335 | { | 336 | { |
4976 | 336 | target = GL_TEXTURE_RECTANGLE_NV; | 337 | target = GL_TEXTURE_RECTANGLE_NV; |
4977 | 337 | matrix.xx = 1.0f; | 338 | matrix.xx = 1.0f; |
4978 | 338 | matrix.yy = 1.0f; | 339 | matrix.yy = 1.0f; |
4979 | 339 | matrix.y0 = 0.0f; | 340 | matrix.y0 = 0.0f; |
4981 | 340 | mipmap = false; | 341 | mipmap = false; |
4982 | 341 | } | 342 | } |
4983 | 342 | #endif | 343 | #endif |
4984 | 343 | 344 | ||
4985 | @@ -348,22 +349,21 @@ | |||
4986 | 348 | 349 | ||
4987 | 349 | #ifdef USE_GLES | 350 | #ifdef USE_GLES |
4988 | 350 | // For GLES2 no format conversion is allowed, i.e., format must equal internalFormat | 351 | // For GLES2 no format conversion is allowed, i.e., format must equal internalFormat |
4990 | 351 | internalFormat = format; | 352 | GLint internalFormat = format; |
4991 | 352 | #else | 353 | #else |
4993 | 353 | internalFormat = GL_RGBA; | 354 | GLint internalFormat = GL_RGBA; |
4994 | 354 | #endif | 355 | #endif |
4995 | 355 | 356 | ||
4996 | 356 | #ifndef USE_GLES | 357 | #ifndef USE_GLES |
4999 | 357 | CompOption *opt; | 358 | CompOption *opt = GLScreen::get (screen)->getOption ("texture_compression"); |
5000 | 358 | opt = GLScreen::get (screen)->getOption ("texture_compression"); | 359 |