blob: f8eb7cf92ccc8161815303447f5f51d8ca24d94d [file] [log] [blame]
Jason Sams326e0dd2009-05-22 14:03:28 -07001/*
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"
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 Sakhartchoukafb743a2010-11-09 17:00:54 -080029class ProgramStore : public Program {
Jason Sams326e0dd2009-05-22 14:03:28 -070030public:
Jason Samsccc010b2010-05-13 18:30:11 -070031 ProgramStore(Context *);
32 virtual ~ProgramStore();
Jason Sams326e0dd2009-05-22 14:03:28 -070033
Jason Samsccc010b2010-05-13 18:30:11 -070034 virtual void setupGL2(const Context *, ProgramStoreState *);
Jason Sams326e0dd2009-05-22 14:03:28 -070035
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
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070044 virtual void serialize(OStream *stream) const;
Alex Sakhartchoukb825f672010-06-04 10:06:50 -070045 virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_STORE; }
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070046 static ProgramStore *createFromStream(Context *rsc, IStream *stream);
47
Jason Sams326e0dd2009-05-22 14:03:28 -070048protected:
49 bool mDitherEnable;
50
51 bool mBlendEnable;
52 bool mColorRWriteEnable;
53 bool mColorGWriteEnable;
54 bool mColorBWriteEnable;
55 bool mColorAWriteEnable;
56 int32_t mBlendSrc;
57 int32_t mBlendDst;
58
Jason Sams326e0dd2009-05-22 14:03:28 -070059 bool mDepthTestEnable;
60 bool mDepthWriteEnable;
61 int32_t mDepthFunc;
62
Jason Sams326e0dd2009-05-22 14:03:28 -070063 bool mStencilTestEnable;
Jason Sams326e0dd2009-05-22 14:03:28 -070064};
65
Alex Sakhartchoukafb743a2010-11-09 17:00:54 -080066class ProgramStoreState {
Jason Sams326e0dd2009-05-22 14:03:28 -070067public:
Jason Samsccc010b2010-05-13 18:30:11 -070068 ProgramStoreState();
69 ~ProgramStoreState();
Jason Sams771565f2010-05-14 15:30:29 -070070 void init(Context *rsc);
Jason Samsf2649a92009-09-25 16:37:33 -070071 void deinit(Context *rsc);
Jason Sams326e0dd2009-05-22 14:03:28 -070072
Jason Samsccc010b2010-05-13 18:30:11 -070073 ObjectBaseRef<ProgramStore> mDefault;
74 ObjectBaseRef<ProgramStore> mLast;
Jason Samscfb1d112009-08-05 13:57:03 -070075
76
Jason Samsccc010b2010-05-13 18:30:11 -070077 ProgramStore *mPFS;
Jason Sams326e0dd2009-05-22 14:03:28 -070078};
79
Jason Sams326e0dd2009-05-22 14:03:28 -070080}
81}
82#endif
83
84
85