Merge "Remove unused fields in ProgramRaster"
This commit is contained in:
@@ -84,14 +84,10 @@ public class ProgramRaster extends BaseObj {
|
||||
public static class Builder {
|
||||
RenderScript mRS;
|
||||
boolean mPointSprite;
|
||||
boolean mPointSmooth;
|
||||
boolean mLineSmooth;
|
||||
CullMode mCullMode;
|
||||
|
||||
public Builder(RenderScript rs) {
|
||||
mRS = rs;
|
||||
mPointSmooth = false;
|
||||
mLineSmooth = false;
|
||||
mPointSprite = false;
|
||||
mCullMode = CullMode.BACK;
|
||||
}
|
||||
@@ -108,8 +104,7 @@ public class ProgramRaster extends BaseObj {
|
||||
|
||||
public ProgramRaster create() {
|
||||
mRS.validate();
|
||||
int id = mRS.nProgramRasterCreate(mPointSmooth, mLineSmooth, mPointSprite,
|
||||
1.f, mCullMode.mID);
|
||||
int id = mRS.nProgramRasterCreate(mPointSprite, mCullMode.mID);
|
||||
return new ProgramRaster(id, mRS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -522,13 +522,10 @@ public class RenderScript {
|
||||
dstMode, depthFunc);
|
||||
}
|
||||
|
||||
native int rsnProgramRasterCreate(int con, boolean pointSmooth, boolean lineSmooth,
|
||||
boolean pointSprite, float lineWidth, int cullMode);
|
||||
synchronized int nProgramRasterCreate(boolean pointSmooth, boolean lineSmooth,
|
||||
boolean pointSprite, float lineWidth, int cullMode) {
|
||||
native int rsnProgramRasterCreate(int con, boolean pointSprite, int cullMode);
|
||||
synchronized int nProgramRasterCreate(boolean pointSprite, int cullMode) {
|
||||
validate();
|
||||
return rsnProgramRasterCreate(mContext, pointSmooth, lineSmooth, pointSprite, lineWidth,
|
||||
cullMode);
|
||||
return rsnProgramRasterCreate(mContext, pointSprite, cullMode);
|
||||
}
|
||||
|
||||
native void rsnProgramBindConstants(int con, int pv, int slot, int mID);
|
||||
|
||||
@@ -1053,12 +1053,10 @@ nProgramVertexCreate(JNIEnv *_env, jobject _this, RsContext con, jstring shader,
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
static jint
|
||||
nProgramRasterCreate(JNIEnv *_env, jobject _this, RsContext con, jboolean pointSmooth,
|
||||
jboolean lineSmooth, jboolean pointSprite, jfloat lineWidth, jint cull)
|
||||
nProgramRasterCreate(JNIEnv *_env, jobject _this, RsContext con, jboolean pointSprite, jint cull)
|
||||
{
|
||||
LOG_API("nProgramRasterCreate, con(%p), pointSmooth(%i), lineSmooth(%i), pointSprite(%i)",
|
||||
con, pointSmooth, lineSmooth, pointSprite);
|
||||
return (jint)rsProgramRasterCreate(con, pointSmooth, lineSmooth, pointSprite, lineWidth, (RsCullMode)cull);
|
||||
LOG_API("nProgramRasterCreate, con(%p), pointSprite(%i), cull(%i)", con, pointSprite, cull);
|
||||
return (jint)rsProgramRasterCreate(con, pointSprite, (RsCullMode)cull);
|
||||
}
|
||||
|
||||
|
||||
@@ -1295,7 +1293,7 @@ static JNINativeMethod methods[] = {
|
||||
{"rsnProgramBindSampler", "(IIII)V", (void*)nProgramBindSampler },
|
||||
|
||||
{"rsnProgramFragmentCreate", "(ILjava/lang/String;[I)I", (void*)nProgramFragmentCreate },
|
||||
{"rsnProgramRasterCreate", "(IZZZFI)I", (void*)nProgramRasterCreate },
|
||||
{"rsnProgramRasterCreate", "(IZI)I", (void*)nProgramRasterCreate },
|
||||
{"rsnProgramVertexCreate", "(ILjava/lang/String;[I)I", (void*)nProgramVertexCreate },
|
||||
|
||||
{"rsnContextBindRootScript", "(II)V", (void*)nContextBindRootScript },
|
||||
|
||||
@@ -329,10 +329,7 @@ ProgramStoreCreate {
|
||||
|
||||
ProgramRasterCreate {
|
||||
direct
|
||||
param bool pointSmooth
|
||||
param bool lineSmooth
|
||||
param bool pointSprite
|
||||
param float lineWidth
|
||||
param RsCullMode cull
|
||||
ret RsProgramRaster
|
||||
}
|
||||
|
||||
@@ -21,19 +21,12 @@ using namespace android;
|
||||
using namespace android::renderscript;
|
||||
|
||||
|
||||
ProgramRaster::ProgramRaster(Context *rsc, bool pointSmooth,
|
||||
bool lineSmooth, bool pointSprite,
|
||||
float lineWidth, RsCullMode cull)
|
||||
ProgramRaster::ProgramRaster(Context *rsc, bool pointSprite, RsCullMode cull)
|
||||
: ProgramBase(rsc) {
|
||||
|
||||
memset(&mHal, 0, sizeof(mHal));
|
||||
|
||||
mHal.state.pointSmooth = pointSmooth;
|
||||
mHal.state.lineSmooth = lineSmooth;
|
||||
mHal.state.pointSprite = pointSprite;
|
||||
mHal.state.lineWidth = lineWidth;
|
||||
mHal.state.cull = cull;
|
||||
|
||||
rsc->mHal.funcs.raster.init(rsc, this);
|
||||
}
|
||||
|
||||
@@ -74,8 +67,7 @@ ProgramRasterState::~ProgramRasterState() {
|
||||
}
|
||||
|
||||
void ProgramRasterState::init(Context *rsc) {
|
||||
mDefault.set(ProgramRaster::getProgramRaster(rsc, false, false,
|
||||
false, 1.f, RS_CULL_BACK).get());
|
||||
mDefault.set(ProgramRaster::getProgramRaster(rsc, false, RS_CULL_BACK).get());
|
||||
}
|
||||
|
||||
void ProgramRasterState::deinit(Context *rsc) {
|
||||
@@ -84,19 +76,13 @@ void ProgramRasterState::deinit(Context *rsc) {
|
||||
}
|
||||
|
||||
ObjectBaseRef<ProgramRaster> ProgramRaster::getProgramRaster(Context *rsc,
|
||||
bool pointSmooth,
|
||||
bool lineSmooth,
|
||||
bool pointSprite,
|
||||
float lineWidth,
|
||||
RsCullMode cull) {
|
||||
ObjectBaseRef<ProgramRaster> returnRef;
|
||||
ObjectBase::asyncLock();
|
||||
for (uint32_t ct = 0; ct < rsc->mStateRaster.mRasterPrograms.size(); ct++) {
|
||||
ProgramRaster *existing = rsc->mStateRaster.mRasterPrograms[ct];
|
||||
if (existing->mHal.state.pointSmooth != pointSmooth) continue;
|
||||
if (existing->mHal.state.lineSmooth != lineSmooth) continue;
|
||||
if (existing->mHal.state.pointSprite != pointSprite) continue;
|
||||
if (existing->mHal.state.lineWidth != lineWidth) continue;
|
||||
if (existing->mHal.state.cull != cull) continue;
|
||||
returnRef.set(existing);
|
||||
ObjectBase::asyncUnlock();
|
||||
@@ -104,8 +90,7 @@ ObjectBaseRef<ProgramRaster> ProgramRaster::getProgramRaster(Context *rsc,
|
||||
}
|
||||
ObjectBase::asyncUnlock();
|
||||
|
||||
ProgramRaster *pr = new ProgramRaster(rsc, pointSmooth,
|
||||
lineSmooth, pointSprite, lineWidth, cull);
|
||||
ProgramRaster *pr = new ProgramRaster(rsc, pointSprite, cull);
|
||||
returnRef.set(pr);
|
||||
|
||||
ObjectBase::asyncLock();
|
||||
@@ -118,10 +103,8 @@ ObjectBaseRef<ProgramRaster> ProgramRaster::getProgramRaster(Context *rsc,
|
||||
namespace android {
|
||||
namespace renderscript {
|
||||
|
||||
RsProgramRaster rsi_ProgramRasterCreate(Context * rsc, bool pointSmooth, bool lineSmooth,
|
||||
bool pointSprite, float lineWidth, RsCullMode cull) {
|
||||
ObjectBaseRef<ProgramRaster> pr = ProgramRaster::getProgramRaster(rsc, pointSmooth, lineSmooth,
|
||||
pointSprite, lineWidth, cull);
|
||||
RsProgramRaster rsi_ProgramRasterCreate(Context * rsc, bool pointSprite, RsCullMode cull) {
|
||||
ObjectBaseRef<ProgramRaster> pr = ProgramRaster::getProgramRaster(rsc, pointSprite, cull);
|
||||
pr->incUserRef();
|
||||
return pr.get();
|
||||
}
|
||||
|
||||
@@ -33,19 +33,13 @@ public:
|
||||
static ProgramRaster *createFromStream(Context *rsc, IStream *stream);
|
||||
|
||||
static ObjectBaseRef<ProgramRaster> getProgramRaster(Context *rsc,
|
||||
bool pointSmooth,
|
||||
bool lineSmooth,
|
||||
bool pointSprite,
|
||||
float lineWidth,
|
||||
RsCullMode cull);
|
||||
struct Hal {
|
||||
mutable void *drv;
|
||||
|
||||
struct State {
|
||||
bool pointSmooth;
|
||||
bool lineSmooth;
|
||||
bool pointSprite;
|
||||
float lineWidth;
|
||||
RsCullMode cull;
|
||||
};
|
||||
State state;
|
||||
@@ -58,10 +52,7 @@ protected:
|
||||
|
||||
private:
|
||||
ProgramRaster(Context *rsc,
|
||||
bool pointSmooth,
|
||||
bool lineSmooth,
|
||||
bool pointSprite,
|
||||
float lineWidth,
|
||||
RsCullMode cull);
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user