Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 1 | /* |
Alex Sakhartchouk | 4a36b45 | 2011-04-29 16:49:08 -0700 | [diff] [blame] | 2 | * Copyright (C) 2011 The Android Open Source Project |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 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 | |
Alex Sakhartchouk | 4385054 | 2011-05-05 16:56:27 -0700 | [diff] [blame] | 20 | #include "rsProgramBase.h" |
Alex Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 21 | #include "rsStream.h" |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 22 | |
| 23 | // --------------------------------------------------------------------------- |
| 24 | namespace android { |
| 25 | namespace renderscript { |
| 26 | |
Jason Sams | 54db59c | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 27 | class ProgramStoreState; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 28 | |
Alex Sakhartchouk | 4385054 | 2011-05-05 16:56:27 -0700 | [diff] [blame] | 29 | class ProgramStore : public ProgramBase { |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 30 | public: |
Jason Sams | 331bf9b | 2011-04-06 11:23:54 -0700 | [diff] [blame] | 31 | 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 Sams | 54db59c | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 36 | virtual ~ProgramStore(); |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 37 | |
Jason Sams | 331bf9b | 2011-04-06 11:23:54 -0700 | [diff] [blame] | 38 | virtual void setup(const Context *, ProgramStoreState *); |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 39 | |
Alex Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 40 | virtual void serialize(OStream *stream) const; |
Alex Sakhartchouk | aae74ad | 2010-06-04 10:06:50 -0700 | [diff] [blame] | 41 | virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_STORE; } |
Alex Sakhartchouk | aa7d288 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 42 | static ProgramStore *createFromStream(Context *rsc, IStream *stream); |
| 43 | |
Jason Sams | 48f5056 | 2011-03-18 15:03:25 -0700 | [diff] [blame] | 44 | 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 Sams | 48f5056 | 2011-03-18 15:03:25 -0700 | [diff] [blame] | 65 | }; |
| 66 | Hal mHal; |
| 67 | |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 68 | protected: |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 69 | }; |
| 70 | |
Alex Sakhartchouk | ed9f210 | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 71 | class ProgramStoreState { |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 72 | public: |
Jason Sams | 54db59c | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 73 | ProgramStoreState(); |
| 74 | ~ProgramStoreState(); |
Jason Sams | f603d21 | 2010-05-14 15:30:29 -0700 | [diff] [blame] | 75 | void init(Context *rsc); |
Jason Sams | 61f08d6 | 2009-09-25 16:37:33 -0700 | [diff] [blame] | 76 | void deinit(Context *rsc); |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 77 | |
Jason Sams | 54db59c | 2010-05-13 18:30:11 -0700 | [diff] [blame] | 78 | ObjectBaseRef<ProgramStore> mDefault; |
| 79 | ObjectBaseRef<ProgramStore> mLast; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 80 | }; |
| 81 | |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 82 | } |
| 83 | } |
| 84 | #endif |
| 85 | |
| 86 | |
| 87 | |