blob: 5cfdd8be355ded0b4157c8778f3a0851dec0319f [file] [log] [blame]
Jason Sams326e0dd2009-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 Samscfb1d112009-08-05 13:57:03 -070026class ProgramVertexState;
Jason Sams326e0dd2009-05-22 14:03:28 -070027
Alex Sakhartchoukafb743a2010-11-09 17:00:54 -080028class ProgramVertex : public Program {
Jason Sams326e0dd2009-05-22 14:03:28 -070029public:
Jason Sams4815c0d2009-12-15 12:58:36 -080030 ProgramVertex(Context *,const char * shaderText, uint32_t shaderLength,
31 const uint32_t * params, uint32_t paramLength);
Jason Sams326e0dd2009-05-22 14:03:28 -070032 virtual ~ProgramVertex();
33
Alex Sakhartchoukc19ff012011-05-06 14:59:45 -070034 virtual void setup(Context *rsc, ProgramVertexState *state);
Jason Sams326e0dd2009-05-22 14:03:28 -070035
Alex Sakhartchouk383e5b12010-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 Sams326e0dd2009-05-22 14:03:28 -070040
Alex Sakhartchouk383e5b12010-09-23 16:16:33 -070041 void transformToScreen(Context *, float *v4out, const float *v3in) const;
Jason Sams3a97c592009-09-30 17:36:20 -070042
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070043 virtual void serialize(OStream *stream) const;
Alex Sakhartchoukb825f672010-06-04 10:06:50 -070044 virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_PROGRAM_VERTEX; }
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070045 static ProgramVertex *createFromStream(Context *rsc, IStream *stream);
Jason Sams326e0dd2009-05-22 14:03:28 -070046};
47
Alex Sakhartchoukafb743a2010-11-09 17:00:54 -080048class ProgramVertexState {
Jason Sams326e0dd2009-05-22 14:03:28 -070049public:
50 ProgramVertexState();
51 ~ProgramVertexState();
52
Jason Sams771565f2010-05-14 15:30:29 -070053 void init(Context *rsc);
Jason Samsf2649a92009-09-25 16:37:33 -070054 void deinit(Context *rsc);
Jason Sams771565f2010-05-14 15:30:29 -070055 void updateSize(Context *rsc);
Jason Sams8ce125b2009-06-17 16:52:59 -070056
57 ObjectBaseRef<ProgramVertex> mDefault;
Jason Samscfb1d112009-08-05 13:57:03 -070058 ObjectBaseRef<ProgramVertex> mLast;
Jason Sams8ce125b2009-06-17 16:52:59 -070059 ObjectBaseRef<Allocation> mDefaultAlloc;
Jason Sams326e0dd2009-05-22 14:03:28 -070060};
61
Jason Sams326e0dd2009-05-22 14:03:28 -070062}
63}
64#endif
65
66