1 /*
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 
28 using namespace android;
29 using namespace android::renderscript;
30 
rsdProgramRasterInit(const Context *,const ProgramRaster *)31 bool rsdProgramRasterInit(const Context *, const ProgramRaster *) {
32     return true;
33 }
34 
rsdProgramRasterSetActive(const Context * rsc,const ProgramRaster * pr)35 void rsdProgramRasterSetActive(const Context *rsc, const ProgramRaster *pr) {
36     switch (pr->mHal.state.cull) {
37         case RS_CULL_BACK:
38             RSD_CALL_GL(glEnable, GL_CULL_FACE);
39             RSD_CALL_GL(glCullFace, GL_BACK);
40             break;
41         case RS_CULL_FRONT:
42             RSD_CALL_GL(glEnable, GL_CULL_FACE);
43             RSD_CALL_GL(glCullFace, GL_FRONT);
44             break;
45         case RS_CULL_NONE:
46             RSD_CALL_GL(glDisable, GL_CULL_FACE);
47             break;
48         default:
49             rsc->setError(RS_ERROR_FATAL_DRIVER, "Invalid cull type");
50             break;
51     }
52 
53 }
54 
rsdProgramRasterDestroy(const Context *,const ProgramRaster *)55 void rsdProgramRasterDestroy(const Context *, const ProgramRaster *) {
56 }
57 
58 
59