blob: f42e1f3a7f55cac84d78de3590630517f4a4f044 [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 Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070041
Alex Sakhartchoukda6d34a2011-05-13 14:53:34 -070042 struct Hal {
43 mutable void *drv;
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070044
Alex Sakhartchoukda6d34a2011-05-13 14:53:34 -070045 struct State {
46 ObjectBaseRef<Allocation> *colorTargets;
47 uint32_t colorTargetsCount;
48 ObjectBaseRef<Allocation> depthTarget;
49 };
50 State state;
51 };
52 Hal mHal;
53
54protected:
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070055 bool mDirty;
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070056 void checkError(Context *);
57 void setColorAttachment(Context *rsc);
58 void setDepthAttachment(Context *rsc);
59 bool renderToFramebuffer();
Alex Sakhartchouk7d9c5ff2011-04-01 14:19:01 -070060
61};
62
63} // renderscript
64} // android
65
66#endif //ANDROID_FRAME_BUFFER_OBJECT_CACHE_H