blob: c9ae1dc409c17b321e22e26b89ca1838da2b3b1d [file] [log] [blame]
Alex Sakhartchouk8e90f2b2011-04-01 14:19:01 -07001/*
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_FRAME_BUFFER_OBJECT_CACHE_H
18#define ANDROID_FRAME_BUFFER_OBJECT_CACHE_H
19
20#include "rsObjectBase.h"
21
22// ---------------------------------------------------------------------------
23namespace android {
24namespace renderscript {
25
26class Allocation;
27
28class FBOCache {
29public:
30 FBOCache();
31 ~FBOCache();
32
33 void bindColorTarget(Context *rsc, Allocation *a, uint32_t slot);
34 void bindDepthTarget(Context *, Allocation *a);
35 void resetAll(Context *);
36
Alex Sakhartchouk407cae92011-05-06 14:59:45 -070037 void setup(Context *);
Alex Sakhartchouk8e90f2b2011-04-01 14:19:01 -070038
39protected:
40
41 bool mDirty;
42 uint32_t mMaxTargets;
43 void checkError(Context *);
44 void setColorAttachment(Context *rsc);
45 void setDepthAttachment(Context *rsc);
46 bool renderToFramebuffer();
47 ObjectBaseRef<Allocation> *mColorTargets;
48 ObjectBaseRef<Allocation> mDepthTarget;
49
50 uint32_t mFBOId;
51
52};
53
54} // renderscript
55} // android
56
57#endif //ANDROID_FRAME_BUFFER_OBJECT_CACHE_H