blob: fe8d78ec96bbe1acaba2854731cd2fd2ff074f21 [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
Jason Samsccc010b2010-05-13 18:30:11 -070029class ProgramStore : public Program
Jason Sams326e0dd2009-05-22 14:03:28 -070030{
31public:
Jason Samsccc010b2010-05-13 18:30:11 -070032 ProgramStore(Context *);
33 virtual ~ProgramStore();
Jason Sams326e0dd2009-05-22 14:03:28 -070034
Jason Samsccc010b2010-05-13 18:30:11 -070035 virtual void setupGL(const Context *, ProgramStoreState *);
36 virtual void setupGL2(const Context *, ProgramStoreState *);
Jason Sams326e0dd2009-05-22 14:03:28 -070037
38 void setDepthFunc(RsDepthFunc);
39 void setDepthMask(bool);
40
41 void setBlendFunc(RsBlendSrcFunc src, RsBlendDstFunc dst);
42 void setColorMask(bool, bool, bool, bool);
43
44 void setDitherEnable(bool);
45
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070046 virtual void serialize(OStream *stream) const;
Alex Sakhartchoukb825f672010-06-04 10:06:50 -070047 virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_STORE; }
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070048 static ProgramStore *createFromStream(Context *rsc, IStream *stream);
49
Jason Sams326e0dd2009-05-22 14:03:28 -070050protected:
51 bool mDitherEnable;
52
53 bool mBlendEnable;
54 bool mColorRWriteEnable;
55 bool mColorGWriteEnable;
56 bool mColorBWriteEnable;
57 bool mColorAWriteEnable;
58 int32_t mBlendSrc;
59 int32_t mBlendDst;
60
Jason Sams326e0dd2009-05-22 14:03:28 -070061 bool mDepthTestEnable;
62 bool mDepthWriteEnable;
63 int32_t mDepthFunc;
64
Jason Sams326e0dd2009-05-22 14:03:28 -070065 bool mStencilTestEnable;
Jason Sams326e0dd2009-05-22 14:03:28 -070066};
67
Jason Samsccc010b2010-05-13 18:30:11 -070068class ProgramStoreState
Jason Sams326e0dd2009-05-22 14:03:28 -070069{
70public:
Jason Samsccc010b2010-05-13 18:30:11 -070071 ProgramStoreState();
72 ~ProgramStoreState();
Jason Sams771565f2010-05-14 15:30:29 -070073 void init(Context *rsc);
Jason Samsf2649a92009-09-25 16:37:33 -070074 void deinit(Context *rsc);
Jason Sams326e0dd2009-05-22 14:03:28 -070075
Jason Samsccc010b2010-05-13 18:30:11 -070076 ObjectBaseRef<ProgramStore> mDefault;
77 ObjectBaseRef<ProgramStore> mLast;
Jason Samscfb1d112009-08-05 13:57:03 -070078
79
Jason Samsccc010b2010-05-13 18:30:11 -070080 ProgramStore *mPFS;
Jason Sams326e0dd2009-05-22 14:03:28 -070081};
82
83
84}
85}
86#endif
87
88
89