rsProgramStore.h revision 8feea4e0dec48ea03bd6d32706d058b86dddc5ba
1/*
2 * Copyright (C) 2009 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_RS_PROGRAM_FRAGMENT_STORE_H
18#define ANDROID_RS_PROGRAM_FRAGMENT_STORE_H
19
20#include "rsProgram.h"
21#include "rsStream.h"
22
23// ---------------------------------------------------------------------------
24namespace android {
25namespace renderscript {
26
27class ProgramStoreState;
28
29class ProgramStore : public Program {
30public:
31    ProgramStore(Context *);
32    virtual ~ProgramStore();
33
34    virtual void setupGL2(const Context *, ProgramStoreState *);
35
36    void setDepthFunc(RsDepthFunc);
37    void setDepthMask(bool);
38
39    void setBlendFunc(RsBlendSrcFunc src, RsBlendDstFunc dst);
40    void setColorMask(bool, bool, bool, bool);
41
42    void setDitherEnable(bool);
43
44    virtual void serialize(OStream *stream) const;
45    virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_STORE; }
46    static ProgramStore *createFromStream(Context *rsc, IStream *stream);
47
48    void init();
49
50    struct Hal {
51        mutable void *drv;
52
53        struct State {
54            bool ditherEnable;
55
56            //bool blendEnable;
57            bool colorRWriteEnable;
58            bool colorGWriteEnable;
59            bool colorBWriteEnable;
60            bool colorAWriteEnable;
61            RsBlendSrcFunc blendSrc;
62            RsBlendDstFunc blendDst;
63
64            //bool depthTestEnable;
65            bool depthWriteEnable;
66            RsDepthFunc depthFunc;
67        };
68        State state;
69
70
71    };
72    Hal mHal;
73
74protected:
75};
76
77class ProgramStoreState {
78public:
79    ProgramStoreState();
80    ~ProgramStoreState();
81    void init(Context *rsc);
82    void deinit(Context *rsc);
83
84    ObjectBaseRef<ProgramStore> mDefault;
85    ObjectBaseRef<ProgramStore> mLast;
86
87
88    ProgramStore *mPFS;
89};
90
91}
92}
93#endif
94
95
96
97