Romain Guy | 08aa2cb | 2011-03-17 11:06:57 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_HWUI_DRAW_GL_INFO_H |
| 18 | #define ANDROID_HWUI_DRAW_GL_INFO_H |
| 19 | |
| 20 | namespace android { |
| 21 | namespace uirenderer { |
| 22 | |
| 23 | /** |
| 24 | * Structure used by OpenGLRenderer::callDrawGLFunction() to pass and |
| 25 | * receive data from OpenGL functors. |
| 26 | */ |
| 27 | struct DrawGlInfo { |
| 28 | // Input: current clip rect |
| 29 | int clipLeft; |
| 30 | int clipTop; |
| 31 | int clipRight; |
| 32 | int clipBottom; |
| 33 | |
Chet Haase | 7b6a758 | 2012-04-11 14:32:02 -0700 | [diff] [blame] | 34 | // Input: current width/height of destination surface |
| 35 | int width; |
| 36 | int height; |
| 37 | |
Romain Guy | 08aa2cb | 2011-03-17 11:06:57 -0700 | [diff] [blame] | 38 | // Input: is the render target an FBO |
| 39 | bool isLayer; |
| 40 | |
| 41 | // Input: current transform matrix, in OpenGL format |
| 42 | float transform[16]; |
| 43 | |
| 44 | // Output: dirty region to redraw |
| 45 | float dirtyLeft; |
| 46 | float dirtyTop; |
| 47 | float dirtyRight; |
| 48 | float dirtyBottom; |
Romain Guy | 6554943 | 2012-03-26 16:45:05 -0700 | [diff] [blame] | 49 | |
| 50 | /** |
Romain Guy | 8f3b8e3 | 2012-03-27 16:33:45 -0700 | [diff] [blame] | 51 | * Values used as the "what" parameter of the functor. |
| 52 | */ |
| 53 | enum Mode { |
| 54 | // Indicates that the functor is called to perform a draw |
| 55 | kModeDraw, |
| 56 | // Indicates the the functor is called only to perform |
| 57 | // processing and that no draw should be attempted |
John Reck | 0d1f634 | 2014-03-28 20:30:27 -0700 | [diff] [blame] | 58 | kModeProcess, |
| 59 | // Same as kModeProcess, however there is no GL context because it was |
| 60 | // lost or destroyed |
John Reck | 09d5cdd | 2014-07-24 10:36:08 -0700 | [diff] [blame^] | 61 | kModeProcessNoContext, |
| 62 | // Invoked every time the UI thread pushes over a frame to the render thread |
| 63 | // *and the owning view has a dirty display list*. This is a signal to sync |
| 64 | // any data that needs to be shared between the UI thread and the render thread. |
| 65 | // During this time the UI thread is blocked. |
| 66 | kModeSync |
Romain Guy | 8f3b8e3 | 2012-03-27 16:33:45 -0700 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | /** |
Romain Guy | 6554943 | 2012-03-26 16:45:05 -0700 | [diff] [blame] | 70 | * Values used by OpenGL functors to tell the framework |
| 71 | * what to do next. |
| 72 | */ |
| 73 | enum Status { |
| 74 | // The functor is done |
Romain Guy | 8f3b8e3 | 2012-03-27 16:33:45 -0700 | [diff] [blame] | 75 | kStatusDone = 0x0, |
Chet Haase | 4865909 | 2012-05-31 15:21:51 -0700 | [diff] [blame] | 76 | // DisplayList actually issued GL drawing commands. |
| 77 | // This is used to signal the HardwareRenderer that the |
| 78 | // buffers should be flipped - otherwise, there were no |
| 79 | // changes to the buffer, so no need to flip. Some hardware |
| 80 | // has issues with stale buffer contents when no GL |
| 81 | // commands are issued. |
| 82 | kStatusDrew = 0x4 |
Romain Guy | 6554943 | 2012-03-26 16:45:05 -0700 | [diff] [blame] | 83 | }; |
Romain Guy | 08aa2cb | 2011-03-17 11:06:57 -0700 | [diff] [blame] | 84 | }; // struct DrawGlInfo |
| 85 | |
| 86 | }; // namespace uirenderer |
| 87 | }; // namespace android |
| 88 | |
| 89 | #endif // ANDROID_HWUI_DRAW_GL_INFO_H |