blob: 77b3881fc8ee22bb54dc2c1d48aafb3eaf10e4fa [file] [log] [blame]
Jason Sams326e0dd2009-05-22 14:03:28 -07001/*
Alex Sakhartchouka04e30d2011-04-29 16:49:08 -07002 * Copyright (C) 2011 The Android Open Source Project
Jason Sams326e0dd2009-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 Sakhartchouk7f126c72011-05-05 16:56:27 -070020#include "rsProgramBase.h"
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070021#include "rsStream.h"
Jason Sams326e0dd2009-05-22 14:03:28 -070022
23// ---------------------------------------------------------------------------
24namespace android {
25namespace renderscript {
26
Jason Samsccc010b2010-05-13 18:30:11 -070027class ProgramStoreState;
Jason Sams326e0dd2009-05-22 14:03:28 -070028
Alex Sakhartchouk7f126c72011-05-05 16:56:27 -070029class ProgramStore : public ProgramBase {
Jason Sams326e0dd2009-05-22 14:03:28 -070030public:
Jason Sams721acc42011-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 Samsccc010b2010-05-13 18:30:11 -070036 virtual ~ProgramStore();
Jason Sams326e0dd2009-05-22 14:03:28 -070037
Jason Sams721acc42011-04-06 11:23:54 -070038 virtual void setup(const Context *, ProgramStoreState *);
Jason Sams326e0dd2009-05-22 14:03:28 -070039
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070040 virtual void serialize(OStream *stream) const;
Alex Sakhartchoukb825f672010-06-04 10:06:50 -070041 virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_STORE; }
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070042 static ProgramStore *createFromStream(Context *rsc, IStream *stream);
43
Jason Sams8feea4e2011-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 Sams8feea4e2011-03-18 15:03:25 -070065 };
66 Hal mHal;
67
Jason Sams326e0dd2009-05-22 14:03:28 -070068protected:
Jason Sams326e0dd2009-05-22 14:03:28 -070069};
70
Alex Sakhartchoukafb743a2010-11-09 17:00:54 -080071class ProgramStoreState {
Jason Sams326e0dd2009-05-22 14:03:28 -070072public:
Jason Samsccc010b2010-05-13 18:30:11 -070073 ProgramStoreState();
74 ~ProgramStoreState();
Jason Sams771565f2010-05-14 15:30:29 -070075 void init(Context *rsc);
Jason Samsf2649a92009-09-25 16:37:33 -070076 void deinit(Context *rsc);
Jason Sams326e0dd2009-05-22 14:03:28 -070077
Jason Samsccc010b2010-05-13 18:30:11 -070078 ObjectBaseRef<ProgramStore> mDefault;
79 ObjectBaseRef<ProgramStore> mLast;
Jason Sams326e0dd2009-05-22 14:03:28 -070080};
81
Jason Sams326e0dd2009-05-22 14:03:28 -070082}
83}
84#endif
85
86
87