blob: 77b3881fc8ee22bb54dc2c1d48aafb3eaf10e4fa [file] [log] [blame]
Jason Samsd19f10d2009-05-22 14:03:28 -07001/*
Alex Sakhartchouk4a36b452011-04-29 16:49:08 -07002 * Copyright (C) 2011 The Android Open Source Project
Jason Samsd19f10d2009-05-22 14:03:28 -07003 *
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
Alex Sakhartchouk43850542011-05-05 16:56:27 -070020#include "rsProgramBase.h"
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -070021#include "rsStream.h"
Jason Samsd19f10d2009-05-22 14:03:28 -070022
23// ---------------------------------------------------------------------------
24namespace android {
25namespace renderscript {
26
Jason Sams54db59c2010-05-13 18:30:11 -070027class ProgramStoreState;
Jason Samsd19f10d2009-05-22 14:03:28 -070028
Alex Sakhartchouk43850542011-05-05 16:56:27 -070029class ProgramStore : public ProgramBase {
Jason Samsd19f10d2009-05-22 14:03:28 -070030public:
Jason Sams331bf9b2011-04-06 11:23:54 -070031 ProgramStore(Context *,
32 bool colorMaskR, bool colorMaskG, bool colorMaskB, bool colorMaskA,
33 bool depthMask, bool ditherEnable,
34 RsBlendSrcFunc srcFunc, RsBlendDstFunc destFunc,
35 RsDepthFunc depthFunc);
Jason Sams54db59c2010-05-13 18:30:11 -070036 virtual ~ProgramStore();
Jason Samsd19f10d2009-05-22 14:03:28 -070037
Jason Sams331bf9b2011-04-06 11:23:54 -070038 virtual void setup(const Context *, ProgramStoreState *);
Jason Samsd19f10d2009-05-22 14:03:28 -070039
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -070040 virtual void serialize(OStream *stream) const;
Alex Sakhartchoukaae74ad2010-06-04 10:06:50 -070041 virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_STORE; }
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -070042 static ProgramStore *createFromStream(Context *rsc, IStream *stream);
43
Jason Sams48f50562011-03-18 15:03:25 -070044 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;
Jason Sams48f50562011-03-18 15:03:25 -070065 };
66 Hal mHal;
67
Jason Samsd19f10d2009-05-22 14:03:28 -070068protected:
Jason Samsd19f10d2009-05-22 14:03:28 -070069};
70
Alex Sakhartchouked9f2102010-11-09 17:00:54 -080071class ProgramStoreState {
Jason Samsd19f10d2009-05-22 14:03:28 -070072public:
Jason Sams54db59c2010-05-13 18:30:11 -070073 ProgramStoreState();
74 ~ProgramStoreState();
Jason Samsf603d212010-05-14 15:30:29 -070075 void init(Context *rsc);
Jason Sams61f08d62009-09-25 16:37:33 -070076 void deinit(Context *rsc);
Jason Samsd19f10d2009-05-22 14:03:28 -070077
Jason Sams54db59c2010-05-13 18:30:11 -070078 ObjectBaseRef<ProgramStore> mDefault;
79 ObjectBaseRef<ProgramStore> mLast;
Jason Samsd19f10d2009-05-22 14:03:28 -070080};
81
Jason Samsd19f10d2009-05-22 14:03:28 -070082}
83}
84#endif
85
86
87