rsProgramStore.h revision 721acc495b859c6d884725a4f9b5523583dd11c7
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                 bool colorMaskR, bool colorMaskG, bool colorMaskB, bool colorMaskA,
33                 bool depthMask, bool ditherEnable,
34                 RsBlendSrcFunc srcFunc, RsBlendDstFunc destFunc,
35                 RsDepthFunc depthFunc);
36    virtual ~ProgramStore();
37
38    virtual void setup(const Context *, ProgramStoreState *);
39
40    virtual void serialize(OStream *stream) const;
41    virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_STORE; }
42    static ProgramStore *createFromStream(Context *rsc, IStream *stream);
43
44    void init();
45
46    struct Hal {
47        mutable void *drv;
48
49        struct State {
50            bool ditherEnable;
51
52            //bool blendEnable;
53            bool colorRWriteEnable;
54            bool colorGWriteEnable;
55            bool colorBWriteEnable;
56            bool colorAWriteEnable;
57            RsBlendSrcFunc blendSrc;
58            RsBlendDstFunc blendDst;
59
60            //bool depthTestEnable;
61            bool depthWriteEnable;
62            RsDepthFunc depthFunc;
63        };
64        State state;
65
66
67    };
68    Hal mHal;
69
70protected:
71};
72
73class ProgramStoreState {
74public:
75    ProgramStoreState();
76    ~ProgramStoreState();
77    void init(Context *rsc);
78    void deinit(Context *rsc);
79
80    ObjectBaseRef<ProgramStore> mDefault;
81    ObjectBaseRef<ProgramStore> mLast;
82};
83
84}
85}
86#endif
87
88
89
90