rsProgramStore.h revision fb6b614bcea88a587a7ea4530be45ff0ffa0210e
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" 21#include "rsStream.h" 22 23// --------------------------------------------------------------------------- 24namespace android { 25namespace renderscript { 26 27class ProgramStoreState; 28 29class ProgramStore : public Program 30{ 31public: 32 ProgramStore(Context *); 33 virtual ~ProgramStore(); 34 35 virtual void setupGL(const Context *, ProgramStoreState *); 36 virtual void setupGL2(const Context *, ProgramStoreState *); 37 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 46 virtual void serialize(OStream *stream) const; 47 virtual A3DClassID getClassId() const { return A3D_CLASS_ID_PROGRAM_STORE; } 48 static ProgramStore *createFromStream(Context *rsc, IStream *stream); 49 50protected: 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 61 bool mDepthTestEnable; 62 bool mDepthWriteEnable; 63 int32_t mDepthFunc; 64 65 bool mStencilTestEnable; 66}; 67 68class ProgramStoreState 69{ 70public: 71 ProgramStoreState(); 72 ~ProgramStoreState(); 73 void init(Context *rsc); 74 void deinit(Context *rsc); 75 76 ObjectBaseRef<ProgramStore> mDefault; 77 ObjectBaseRef<ProgramStore> mLast; 78 79 80 ProgramStore *mPFS; 81}; 82 83 84} 85} 86#endif 87 88 89 90