rsProgramStore.h revision 771565f47fc44608444c00aa8fa3bda769ceaece
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
22// ---------------------------------------------------------------------------
23namespace android {
24namespace renderscript {
25
26class ProgramStoreState;
27
28class ProgramStore : public Program
29{
30public:
31    ProgramStore(Context *);
32    virtual ~ProgramStore();
33
34    virtual void setupGL(const Context *, ProgramStoreState *);
35    virtual void setupGL2(const Context *, ProgramStoreState *);
36
37    void setDepthFunc(RsDepthFunc);
38    void setDepthMask(bool);
39
40    void setBlendFunc(RsBlendSrcFunc src, RsBlendDstFunc dst);
41    void setColorMask(bool, bool, bool, bool);
42
43    void setDitherEnable(bool);
44
45protected:
46    bool mDitherEnable;
47
48    bool mBlendEnable;
49    bool mColorRWriteEnable;
50    bool mColorGWriteEnable;
51    bool mColorBWriteEnable;
52    bool mColorAWriteEnable;
53    int32_t mBlendSrc;
54    int32_t mBlendDst;
55
56    bool mDepthTestEnable;
57    bool mDepthWriteEnable;
58    int32_t mDepthFunc;
59
60    bool mStencilTestEnable;
61};
62
63class ProgramStoreState
64{
65public:
66    ProgramStoreState();
67    ~ProgramStoreState();
68    void init(Context *rsc);
69    void deinit(Context *rsc);
70
71    ObjectBaseRef<ProgramStore> mDefault;
72    ObjectBaseRef<ProgramStore> mLast;
73
74
75    ProgramStore *mPFS;
76};
77
78
79}
80}
81#endif
82
83
84
85