rsdProgramRaster.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #include "rsdCore.h"
  17. #include "rsdProgramStore.h"
  18. #include "rsContext.h"
  19. #include "rsProgramStore.h"
  20. #include <GLES/gl.h>
  21. #include <GLES/glext.h>
  22. using android::renderscript::Context;
  23. using android::renderscript::ProgramRaster;
  24. bool rsdProgramRasterInit(const Context *, const ProgramRaster *) {
  25. return true;
  26. }
  27. void rsdProgramRasterSetActive(const Context *rsc, const ProgramRaster *pr) {
  28. switch (pr->mHal.state.cull) {
  29. case RS_CULL_BACK:
  30. RSD_CALL_GL(glEnable, GL_CULL_FACE);
  31. RSD_CALL_GL(glCullFace, GL_BACK);
  32. break;
  33. case RS_CULL_FRONT:
  34. RSD_CALL_GL(glEnable, GL_CULL_FACE);
  35. RSD_CALL_GL(glCullFace, GL_FRONT);
  36. break;
  37. case RS_CULL_NONE:
  38. RSD_CALL_GL(glDisable, GL_CULL_FACE);
  39. break;
  40. default:
  41. rsc->setError(RS_ERROR_FATAL_DRIVER, "Invalid cull type");
  42. break;
  43. }
  44. }
  45. void rsdProgramRasterDestroy(const Context *, const ProgramRaster *) {
  46. }