blob: e5a029132d3ba91cb663a32f0c841292203e1d4c [file] [log] [blame]
Jason Sams721acc42011-04-06 11:23:54 -07001/*
2 * Copyright (C) 2011 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
18#include "rsdCore.h"
19#include "rsdProgramStore.h"
20
21#include "rsContext.h"
22#include "rsProgramStore.h"
23
24#include <GLES/gl.h>
25#include <GLES/glext.h>
26
27
28using namespace android;
29using namespace android::renderscript;
30
31bool rsdProgramRasterInit(const Context *, const ProgramRaster *) {
32 return true;
33}
34
Jason Sams2382aba2011-09-13 15:41:01 -070035void rsdProgramRasterSetActive(const Context *rsc, const ProgramRaster *pr) {
Jason Sams721acc42011-04-06 11:23:54 -070036 switch (pr->mHal.state.cull) {
37 case RS_CULL_BACK:
Jason Sams2382aba2011-09-13 15:41:01 -070038 RSD_CALL_GL(glEnable, GL_CULL_FACE);
39 RSD_CALL_GL(glCullFace, GL_BACK);
Jason Sams721acc42011-04-06 11:23:54 -070040 break;
41 case RS_CULL_FRONT:
Jason Sams2382aba2011-09-13 15:41:01 -070042 RSD_CALL_GL(glEnable, GL_CULL_FACE);
43 RSD_CALL_GL(glCullFace, GL_FRONT);
Jason Sams721acc42011-04-06 11:23:54 -070044 break;
45 case RS_CULL_NONE:
Jason Sams2382aba2011-09-13 15:41:01 -070046 RSD_CALL_GL(glDisable, GL_CULL_FACE);
Jason Sams721acc42011-04-06 11:23:54 -070047 break;
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -080048 default:
Alex Sakhartchoukc0a65422012-01-05 14:55:11 -080049 rsc->setError(RS_ERROR_FATAL_DRIVER, "Invalid cull type");
Alex Sakhartchouk25a59d02011-12-29 11:17:38 -080050 break;
Jason Sams721acc42011-04-06 11:23:54 -070051 }
52
53}
54
55void rsdProgramRasterDestroy(const Context *, const ProgramRaster *) {
56}
57
58