blob: 20af30a1b90bdb3a94ba01088a14e37723fcbaf1 [file] [log] [blame]
Jason Sams5fd09d82009-09-23 13:57:02 -07001/*
Alex Sakhartchouk7f126c72011-05-05 16:56:27 -07002 * Copyright (C) 2009-2011 The Android Open Source Project
Jason Sams5fd09d82009-09-23 13:57:02 -07003 *
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_RASTER_H
18#define ANDROID_RS_PROGRAM_RASTER_H
19
Alex Sakhartchouk7f126c72011-05-05 16:56:27 -070020#include "rsProgramBase.h"
Jason Sams5fd09d82009-09-23 13:57:02 -070021
22// ---------------------------------------------------------------------------
23namespace android {
24namespace renderscript {
25
26class ProgramRasterState;
27
Alex Sakhartchouk7f126c72011-05-05 16:56:27 -070028class ProgramRaster : public ProgramBase {
Jason Sams5fd09d82009-09-23 13:57:02 -070029public:
Jason Sams721acc42011-04-06 11:23:54 -070030 virtual void setup(const Context *, ProgramRasterState *);
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070031 virtual void serialize(OStream *stream) const;
Alex Sakhartchoukb825f672010-06-04 10:06:50 -070032 virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_RASTER; }
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070033 static ProgramRaster *createFromStream(Context *rsc, IStream *stream);
Jason Sams5fd09d82009-09-23 13:57:02 -070034
Alex Sakhartchoukc700e642011-08-16 13:09:46 -070035 static ObjectBaseRef<ProgramRaster> getProgramRaster(Context *rsc,
Alex Sakhartchoukc700e642011-08-16 13:09:46 -070036 bool pointSprite,
Alex Sakhartchoukc700e642011-08-16 13:09:46 -070037 RsCullMode cull);
Jason Sams721acc42011-04-06 11:23:54 -070038 struct Hal {
39 mutable void *drv;
40
41 struct State {
Jason Sams721acc42011-04-06 11:23:54 -070042 bool pointSprite;
Jason Sams721acc42011-04-06 11:23:54 -070043 RsCullMode cull;
44 };
45 State state;
46 };
47 Hal mHal;
Jason Sams5fd09d82009-09-23 13:57:02 -070048
49protected:
Alex Sakhartchoukc700e642011-08-16 13:09:46 -070050 virtual void preDestroy() const;
51 virtual ~ProgramRaster();
52
53private:
54 ProgramRaster(Context *rsc,
Alex Sakhartchoukc700e642011-08-16 13:09:46 -070055 bool pointSprite,
Alex Sakhartchoukc700e642011-08-16 13:09:46 -070056 RsCullMode cull);
57
Jason Sams5fd09d82009-09-23 13:57:02 -070058};
59
Alex Sakhartchoukafb743a2010-11-09 17:00:54 -080060class ProgramRasterState {
Jason Sams5fd09d82009-09-23 13:57:02 -070061public:
62 ProgramRasterState();
63 ~ProgramRasterState();
Jason Sams771565f2010-05-14 15:30:29 -070064 void init(Context *rsc);
Jason Samsf2649a92009-09-25 16:37:33 -070065 void deinit(Context *rsc);
Jason Sams5fd09d82009-09-23 13:57:02 -070066
67 ObjectBaseRef<ProgramRaster> mDefault;
68 ObjectBaseRef<ProgramRaster> mLast;
Alex Sakhartchoukc700e642011-08-16 13:09:46 -070069
70 // Cache of all existing raster programs.
71 Vector<ProgramRaster *> mRasterPrograms;
Jason Sams5fd09d82009-09-23 13:57:02 -070072};
73
74
75}
76}
77#endif
78
79
80
81