Jason Sams | 721acc4 | 2011-04-06 11:23:54 -0700 | [diff] [blame] | 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 | |
| 31 | bool rsdProgramRasterInit(const Context *, const ProgramRaster *) { |
| 32 | return true; |
| 33 | } |
| 34 | |
Jason Sams | 2382aba | 2011-09-13 15:41:01 -0700 | [diff] [blame] | 35 | void rsdProgramRasterSetActive(const Context *rsc, const ProgramRaster *pr) { |
Jason Sams | 721acc4 | 2011-04-06 11:23:54 -0700 | [diff] [blame] | 36 | switch (pr->mHal.state.cull) { |
| 37 | case RS_CULL_BACK: |
Jason Sams | 2382aba | 2011-09-13 15:41:01 -0700 | [diff] [blame] | 38 | RSD_CALL_GL(glEnable, GL_CULL_FACE); |
| 39 | RSD_CALL_GL(glCullFace, GL_BACK); |
Jason Sams | 721acc4 | 2011-04-06 11:23:54 -0700 | [diff] [blame] | 40 | break; |
| 41 | case RS_CULL_FRONT: |
Jason Sams | 2382aba | 2011-09-13 15:41:01 -0700 | [diff] [blame] | 42 | RSD_CALL_GL(glEnable, GL_CULL_FACE); |
| 43 | RSD_CALL_GL(glCullFace, GL_FRONT); |
Jason Sams | 721acc4 | 2011-04-06 11:23:54 -0700 | [diff] [blame] | 44 | break; |
| 45 | case RS_CULL_NONE: |
Jason Sams | 2382aba | 2011-09-13 15:41:01 -0700 | [diff] [blame] | 46 | RSD_CALL_GL(glDisable, GL_CULL_FACE); |
Jason Sams | 721acc4 | 2011-04-06 11:23:54 -0700 | [diff] [blame] | 47 | break; |
Alex Sakhartchouk | 25a59d0 | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 48 | default: |
Alex Sakhartchouk | c0a6542 | 2012-01-05 14:55:11 -0800 | [diff] [blame] | 49 | rsc->setError(RS_ERROR_FATAL_DRIVER, "Invalid cull type"); |
Alex Sakhartchouk | 25a59d0 | 2011-12-29 11:17:38 -0800 | [diff] [blame] | 50 | break; |
Jason Sams | 721acc4 | 2011-04-06 11:23:54 -0700 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | } |
| 54 | |
| 55 | void rsdProgramRasterDestroy(const Context *, const ProgramRaster *) { |
| 56 | } |
| 57 | |
| 58 | |