rsFBOCache.h revision 7d9c5ffccb7a5e682860f752403e5a03aed587be
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_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
37    void setupGL2(Context *);
38
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
58