summaryrefslogtreecommitdiff
path: root/libs/rs/rsProgramRaster.cpp
diff options
context:
space:
mode:
author Jason Sams <rjsams@android.com> 2011-04-06 11:23:54 -0700
committer Jason Sams <rjsams@android.com> 2011-04-06 11:23:54 -0700
commit331bf9b14b1c5c1e88f5c4092b6e24fae887fb3b (patch)
treea9472a72e2d08c45deb03741a0ff6ad3b33c0583 /libs/rs/rsProgramRaster.cpp
parent48f505657adba4d9156856e7d5593f23af5d5d5a (diff)
Seperate ProgramRaster.
Cleanup ProgramRaster and ProgramStore creation. Change-Id: If25ea74355238d405340f0ccfb8117ad6e1307b7
Diffstat (limited to 'libs/rs/rsProgramRaster.cpp')
-rw-r--r--libs/rs/rsProgramRaster.cpp69
1 files changed, 18 insertions, 51 deletions
diff --git a/libs/rs/rsProgramRaster.cpp b/libs/rs/rsProgramRaster.cpp
index ace1572f4010..9617c4defe4c 100644
--- a/libs/rs/rsProgramRaster.cpp
+++ b/libs/rs/rsProgramRaster.cpp
@@ -15,11 +15,6 @@
*/
#include "rsContext.h"
-#ifndef ANDROID_RS_SERIALIZE
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-#endif //ANDROID_RS_SERIALIZE
-
#include "rsProgramRaster.h"
using namespace android;
@@ -27,49 +22,33 @@ using namespace android::renderscript;
ProgramRaster::ProgramRaster(Context *rsc, bool pointSmooth,
- bool lineSmooth, bool pointSprite)
+ bool lineSmooth, bool pointSprite,
+ float lineWidth, RsCullMode cull)
: Program(rsc) {
- mPointSmooth = pointSmooth;
- mLineSmooth = lineSmooth;
- mPointSprite = pointSprite;
- mLineWidth = 1.0f;
- mCull = RS_CULL_BACK;
-}
+ memset(&mHal, 0, sizeof(mHal));
-ProgramRaster::~ProgramRaster() {
-}
+ mHal.state.pointSmooth = pointSmooth;
+ mHal.state.lineSmooth = lineSmooth;
+ mHal.state.pointSprite = pointSprite;
+ mHal.state.lineWidth = lineWidth;
+ mHal.state.cull = cull;
-void ProgramRaster::setLineWidth(float s) {
- mLineWidth = s;
- mDirty = true;
+ rsc->mHal.funcs.raster.init(rsc, this);
}
-void ProgramRaster::setCullMode(RsCullMode mode) {
- mCull = mode;
- mDirty = true;
+ProgramRaster::~ProgramRaster() {
+ mRSC->mHal.funcs.raster.destroy(mRSC, this);
}
-void ProgramRaster::setupGL2(const Context *rsc, ProgramRasterState *state) {
+void ProgramRaster::setup(const Context *rsc, ProgramRasterState *state) {
if (state->mLast.get() == this && !mDirty) {
return;
}
state->mLast.set(this);
mDirty = false;
- switch (mCull) {
- case RS_CULL_BACK:
- glEnable(GL_CULL_FACE);
- glCullFace(GL_BACK);
- break;
- case RS_CULL_FRONT:
- glEnable(GL_CULL_FACE);
- glCullFace(GL_FRONT);
- break;
- case RS_CULL_NONE:
- glDisable(GL_CULL_FACE);
- break;
- }
+ rsc->mHal.funcs.raster.setActive(rsc, this);
}
void ProgramRaster::serialize(OStream *stream) const {
@@ -86,7 +65,7 @@ ProgramRasterState::~ProgramRasterState() {
}
void ProgramRasterState::init(Context *rsc) {
- ProgramRaster *pr = new ProgramRaster(rsc, false, false, false);
+ ProgramRaster *pr = new ProgramRaster(rsc, false, false, false, 1.f, RS_CULL_BACK);
mDefault.set(pr);
}
@@ -101,27 +80,15 @@ namespace renderscript {
RsProgramRaster rsi_ProgramRasterCreate(Context * rsc,
bool pointSmooth,
bool lineSmooth,
- bool pointSprite) {
+ bool pointSprite,
+ float lineWidth,
+ RsCullMode cull) {
ProgramRaster *pr = new ProgramRaster(rsc, pointSmooth,
- lineSmooth, pointSprite);
+ lineSmooth, pointSprite, lineWidth, cull);
pr->incUserRef();
return pr;
}
-void rsi_ProgramRasterSetLineWidth(Context * rsc,
- RsProgramRaster vpr,
- float s) {
- ProgramRaster *pr = static_cast<ProgramRaster *>(vpr);
- pr->setLineWidth(s);
-}
-
-void rsi_ProgramRasterSetCullMode(Context * rsc,
- RsProgramRaster vpr,
- RsCullMode mode) {
- ProgramRaster *pr = static_cast<ProgramRaster *>(vpr);
- pr->setCullMode(mode);
-}
-
}
}