blob: 5d58ba405416af03f83c213f09ab85130848fb80 [file] [log] [blame]
Alex Sakhartchouk7d9c5ff2011-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
Alex Sakhartchoukda6d34a2011-05-13 14:53:34 -070033 void init(Context *rsc);
34 void deinit(Context *rsc);
35
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070036 void bindColorTarget(Context *rsc, Allocation *a, uint32_t slot);
37 void bindDepthTarget(Context *, Allocation *a);
38 void resetAll(Context *);
39
Alex Sakhartchoukc19ff012011-05-06 14:59:45 -070040 void setup(Context *);
Alex Sakhartchouka544b632011-07-19 17:50:29 -070041 void updateSize() { mDirty = true; }
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070042
Alex Sakhartchoukda6d34a2011-05-13 14:53:34 -070043 struct Hal {
44 mutable void *drv;
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070045
Alex Sakhartchoukda6d34a2011-05-13 14:53:34 -070046 struct State {
47 ObjectBaseRef<Allocation> *colorTargets;
48 uint32_t colorTargetsCount;
49 ObjectBaseRef<Allocation> depthTarget;
50 };
51 State state;
52 };
53 Hal mHal;
54
55protected:
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070056 bool mDirty;
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070057 void checkError(Context *);
58 void setColorAttachment(Context *rsc);
59 void setDepthAttachment(Context *rsc);
60 bool renderToFramebuffer();
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070061
62};
63
64} // renderscript
65} // android
66
67#endif //ANDROID_FRAME_BUFFER_OBJECT_CACHE_H