• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef _FRAMEBUFFER_DATA_H
17 #define _FRAMEBUFFER_DATA_H
18 
19 #include "objectNameManager.h"
20 #include <GLES/gl.h>
21 #include <GLES/glext.h>
22 
23 class RenderbufferData : public ObjectData
24 {
25 public:
26     RenderbufferData();
27     ~RenderbufferData();
28 
29     unsigned int sourceEGLImage;
30     void (*eglImageDetach)(unsigned int imageId);
31     GLuint attachedFB;
32     GLenum attachedPoint;
33     GLuint eglImageGlobalTexName;
34 
35 };
36 
37 const int MAX_ATTACH_POINTS = 3;
38 
39 class FramebufferData : public ObjectData
40 {
41 public:
42     explicit FramebufferData(GLuint name);
43     ~FramebufferData();
44 
45     void setAttachment(GLenum attachment,
46                        GLenum target,
47                        GLuint name,
48                        ObjectDataPtr obj,
49                        bool takeOwnership = false);
50 
51     GLuint getAttachment(GLenum attachment,
52                          GLenum *outTarget,
53                          ObjectDataPtr *outObj);
54 
55     void validate(class GLEScontext* ctx);
56 
57 private:
58     inline int attachmentPointIndex(GLenum attachment);
59     void detachObject(int idx);
60 
61 private:
62     GLuint m_fbName;
63     struct attachPoint {
64         GLenum target; // OGL if owned, GLES otherwise
65         GLuint name; // OGL if owned, GLES otherwise
66         ObjectDataPtr obj;
67         bool owned;
68     } m_attachPoints[MAX_ATTACH_POINTS+1];
69     bool m_dirty;
70 };
71 
72 #endif
73