blob: efdb9487419746e4c8ca450cc409359281ee009f [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 Samse514b452009-09-25 14:51:22 -070030 ProgramRaster(Context *rsc,
Jason Sams5fd09d82009-09-23 13:57:02 -070031 bool pointSmooth,
32 bool lineSmooth,
Jason Sams721acc42011-04-06 11:23:54 -070033 bool pointSprite,
34 float lineWidth,
35 RsCullMode cull);
Jason Sams5fd09d82009-09-23 13:57:02 -070036 virtual ~ProgramRaster();
37
Jason Sams721acc42011-04-06 11:23:54 -070038 virtual void setup(const Context *, ProgramRasterState *);
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070039 virtual void serialize(OStream *stream) const;
Alex Sakhartchoukb825f672010-06-04 10:06:50 -070040 virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_RASTER; }
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070041 static ProgramRaster *createFromStream(Context *rsc, IStream *stream);
Jason Sams5fd09d82009-09-23 13:57:02 -070042
Jason Sams721acc42011-04-06 11:23:54 -070043 struct Hal {
44 mutable void *drv;
45
46 struct State {
47 bool pointSmooth;
48 bool lineSmooth;
49 bool pointSprite;
50 float lineWidth;
51 RsCullMode cull;
52 };
53 State state;
54 };
55 Hal mHal;
Jason Sams5fd09d82009-09-23 13:57:02 -070056
57protected:
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;
69};
70
71
72}
73}
74#endif
75
76
77
78