blob: 5cfdd8be355ded0b4157c8778f3a0851dec0319f [file] [log] [blame]
Jason Samsd19f10d2009-05-22 14:03:28 -07001/*
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_VERTEX_H
18#define ANDROID_RS_PROGRAM_VERTEX_H
19
20#include "rsProgram.h"
21
22// ---------------------------------------------------------------------------
23namespace android {
24namespace renderscript {
25
Jason Sams9bee51c2009-08-05 13:57:03 -070026class ProgramVertexState;
Jason Samsd19f10d2009-05-22 14:03:28 -070027
Alex Sakhartchouked9f2102010-11-09 17:00:54 -080028class ProgramVertex : public Program {
Jason Samsd19f10d2009-05-22 14:03:28 -070029public:
Jason Sams0011bcf2009-12-15 12:58:36 -080030 ProgramVertex(Context *,const char * shaderText, uint32_t shaderLength,
31 const uint32_t * params, uint32_t paramLength);
Jason Samsd19f10d2009-05-22 14:03:28 -070032 virtual ~ProgramVertex();
33
Alex Sakhartchouk407cae92011-05-06 14:59:45 -070034 virtual void setup(Context *rsc, ProgramVertexState *state);
Jason Samsd19f10d2009-05-22 14:03:28 -070035
Alex Sakhartchoukb89aaac2010-09-23 16:16:33 -070036 void setProjectionMatrix(Context *, const rsc_Matrix *) const;
37 void getProjectionMatrix(Context *, rsc_Matrix *) const;
38 void setModelviewMatrix(Context *, const rsc_Matrix *) const;
39 void setTextureMatrix(Context *, const rsc_Matrix *) const;
Jason Samsd19f10d2009-05-22 14:03:28 -070040
Alex Sakhartchoukb89aaac2010-09-23 16:16:33 -070041 void transformToScreen(Context *, float *v4out, const float *v3in) const;
Jason Samse9ad9a72009-09-30 17:36:20 -070042
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -070043 virtual void serialize(OStream *stream) const;
Alex Sakhartchoukaae74ad2010-06-04 10:06:50 -070044 virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_VERTEX; }
Alex Sakhartchoukaa7d2882010-05-21 12:53:13 -070045 static ProgramVertex *createFromStream(Context *rsc, IStream *stream);
Jason Samsd19f10d2009-05-22 14:03:28 -070046};
47
Alex Sakhartchouked9f2102010-11-09 17:00:54 -080048class ProgramVertexState {
Jason Samsd19f10d2009-05-22 14:03:28 -070049public:
50 ProgramVertexState();
51 ~ProgramVertexState();
52
Jason Samsf603d212010-05-14 15:30:29 -070053 void init(Context *rsc);
Jason Sams61f08d62009-09-25 16:37:33 -070054 void deinit(Context *rsc);
Jason Samsf603d212010-05-14 15:30:29 -070055 void updateSize(Context *rsc);
Jason Sams9c54bdb2009-06-17 16:52:59 -070056
57 ObjectBaseRef<ProgramVertex> mDefault;
Jason Sams9bee51c2009-08-05 13:57:03 -070058 ObjectBaseRef<ProgramVertex> mLast;
Jason Sams9c54bdb2009-06-17 16:52:59 -070059 ObjectBaseRef<Allocation> mDefaultAlloc;
Jason Samsd19f10d2009-05-22 14:03:28 -070060};
61
Jason Samsd19f10d2009-05-22 14:03:28 -070062}
63}
64#endif
65
66