Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 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" |
Alex Sakhartchouk | fb6b614 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 21 | #include "rsStream.h" |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 22 | |
| 23 | // --------------------------------------------------------------------------- |
| 24 | namespace android { |
| 25 | namespace renderscript { |
| 26 | |
Jason Sams | ccc010b | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 27 | class ProgramStoreState; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 28 | |
Jason Sams | ccc010b | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 29 | class ProgramStore : public Program |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 30 | { |
| 31 | public: |
Jason Sams | ccc010b | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 32 | ProgramStore(Context *); |
| 33 | virtual ~ProgramStore(); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 34 | |
Jason Sams | ccc010b | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 35 | virtual void setupGL2(const Context *, ProgramStoreState *); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 36 | |
| 37 | void setDepthFunc(RsDepthFunc); |
| 38 | void setDepthMask(bool); |
| 39 | |
| 40 | void setBlendFunc(RsBlendSrcFunc src, RsBlendDstFunc dst); |
| 41 | void setColorMask(bool, bool, bool, bool); |
| 42 | |
| 43 | void setDitherEnable(bool); |
| 44 | |
Alex Sakhartchouk | fb6b614 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 45 | virtual void serialize(OStream *stream) const; |
Alex Sakhartchouk | b825f67 | 2010-06-04 10:06:50 -0700 | [diff] [blame] | 46 | virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_STORE; } |
Alex Sakhartchouk | fb6b614 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 47 | static ProgramStore *createFromStream(Context *rsc, IStream *stream); |
| 48 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 49 | protected: |
| 50 | bool mDitherEnable; |
| 51 | |
| 52 | bool mBlendEnable; |
| 53 | bool mColorRWriteEnable; |
| 54 | bool mColorGWriteEnable; |
| 55 | bool mColorBWriteEnable; |
| 56 | bool mColorAWriteEnable; |
| 57 | int32_t mBlendSrc; |
| 58 | int32_t mBlendDst; |
| 59 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 60 | bool mDepthTestEnable; |
| 61 | bool mDepthWriteEnable; |
| 62 | int32_t mDepthFunc; |
| 63 | |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 64 | bool mStencilTestEnable; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 65 | }; |
| 66 | |
Jason Sams | ccc010b | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 67 | class ProgramStoreState |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 68 | { |
| 69 | public: |
Jason Sams | ccc010b | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 70 | ProgramStoreState(); |
| 71 | ~ProgramStoreState(); |
Jason Sams | 771565f | 2010-05-14 15:30:29 -0700 | [diff] [blame] | 72 | void init(Context *rsc); |
Jason Sams | f2649a9 | 2009-09-25 16:37:33 -0700 | [diff] [blame] | 73 | void deinit(Context *rsc); |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 74 | |
Jason Sams | ccc010b | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 75 | ObjectBaseRef<ProgramStore> mDefault; |
| 76 | ObjectBaseRef<ProgramStore> mLast; |
Jason Sams | cfb1d11 | 2009-08-05 13:57:03 -0700 | [diff] [blame] | 77 | |
| 78 | |
Jason Sams | ccc010b | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 79 | ProgramStore *mPFS; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | |
| 83 | } |
| 84 | } |
| 85 | #endif |
| 86 | |
| 87 | |
| 88 | |