Removing changes not meant for MR1
Change-Id: I75136be33f12a87c2b5f21b064c06065a4145d70
This commit is contained in:
@ -22,56 +22,6 @@
|
||||
*/
|
||||
#ifndef __RS_GRAPHICS_RSH__
|
||||
#define __RS_GRAPHICS_RSH__
|
||||
|
||||
// These are API 15 once it get official
|
||||
typedef enum {
|
||||
RS_DEPTH_FUNC_ALWAYS,
|
||||
RS_DEPTH_FUNC_LESS,
|
||||
RS_DEPTH_FUNC_LEQUAL,
|
||||
RS_DEPTH_FUNC_GREATER,
|
||||
RS_DEPTH_FUNC_GEQUAL,
|
||||
RS_DEPTH_FUNC_EQUAL,
|
||||
RS_DEPTH_FUNC_NOTEQUAL
|
||||
} rs_depth_func;
|
||||
|
||||
typedef enum {
|
||||
RS_BLEND_SRC_ZERO, // 0
|
||||
RS_BLEND_SRC_ONE, // 1
|
||||
RS_BLEND_SRC_DST_COLOR, // 2
|
||||
RS_BLEND_SRC_ONE_MINUS_DST_COLOR, // 3
|
||||
RS_BLEND_SRC_SRC_ALPHA, // 4
|
||||
RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA, // 5
|
||||
RS_BLEND_SRC_DST_ALPHA, // 6
|
||||
RS_BLEND_SRC_ONE_MINUS_DST_ALPHA, // 7
|
||||
RS_BLEND_SRC_SRC_ALPHA_SATURATE // 8
|
||||
} rs_blend_src_func;
|
||||
|
||||
typedef enum {
|
||||
RS_BLEND_DST_ZERO, // 0
|
||||
RS_BLEND_DST_ONE, // 1
|
||||
RS_BLEND_DST_SRC_COLOR, // 2
|
||||
RS_BLEND_DST_ONE_MINUS_SRC_COLOR, // 3
|
||||
RS_BLEND_DST_SRC_ALPHA, // 4
|
||||
RS_BLEND_DST_ONE_MINUS_SRC_ALPHA, // 5
|
||||
RS_BLEND_DST_DST_ALPHA, // 6
|
||||
RS_BLEND_DST_ONE_MINUS_DST_ALPHA // 7
|
||||
} rs_blend_dst_func;
|
||||
|
||||
typedef enum {
|
||||
RS_CULL_BACK,
|
||||
RS_CULL_FRONT,
|
||||
RS_CULL_NONE
|
||||
} rs_cull_mode;
|
||||
|
||||
typedef enum {
|
||||
RS_SAMPLER_NEAREST,
|
||||
RS_SAMPLER_LINEAR,
|
||||
RS_SAMPLER_LINEAR_MIP_LINEAR,
|
||||
RS_SAMPLER_WRAP,
|
||||
RS_SAMPLER_CLAMP,
|
||||
RS_SAMPLER_LINEAR_MIP_NEAREST,
|
||||
} rs_sampler_value;
|
||||
|
||||
#if (defined(RS_VERSION) && (RS_VERSION >= 14))
|
||||
/**
|
||||
* Set the color target used for all subsequent rendering calls
|
||||
@ -132,88 +82,6 @@ extern void __attribute__((overloadable))
|
||||
extern void __attribute__((overloadable))
|
||||
rsgBindProgramStore(rs_program_store ps);
|
||||
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get program store depth function
|
||||
*
|
||||
* @param ps
|
||||
*/
|
||||
extern rs_depth_func __attribute__((overloadable))
|
||||
rsgProgramStoreGetDepthFunc(rs_program_store ps);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get program store depth mask
|
||||
*
|
||||
* @param ps
|
||||
*/
|
||||
extern bool __attribute__((overloadable))
|
||||
rsgProgramStoreGetDepthMask(rs_program_store ps);
|
||||
/**
|
||||
* @hide
|
||||
* Get program store red component color mask
|
||||
*
|
||||
* @param ps
|
||||
*/
|
||||
extern bool __attribute__((overloadable))
|
||||
rsgProgramStoreGetColorMaskR(rs_program_store ps);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get program store green component color mask
|
||||
*
|
||||
* @param ps
|
||||
*/
|
||||
extern bool __attribute__((overloadable))
|
||||
rsgProgramStoreGetColorMaskG(rs_program_store ps);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get program store blur component color mask
|
||||
*
|
||||
* @param ps
|
||||
*/
|
||||
extern bool __attribute__((overloadable))
|
||||
rsgProgramStoreGetColorMaskB(rs_program_store ps);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get program store alpha component color mask
|
||||
*
|
||||
* @param ps
|
||||
*/
|
||||
extern bool __attribute__((overloadable))
|
||||
rsgProgramStoreGetColorMaskA(rs_program_store ps);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get program store blend source function
|
||||
*
|
||||
* @param ps
|
||||
*/
|
||||
extern rs_blend_src_func __attribute__((overloadable))
|
||||
rsgProgramStoreGetBlendSrcFunc(rs_program_store ps);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get program store blend destination function
|
||||
*
|
||||
* @param ps
|
||||
*/
|
||||
extern rs_blend_dst_func __attribute__((overloadable))
|
||||
rsgProgramStoreGetBlendDstFunc(rs_program_store ps);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get program store dither state
|
||||
*
|
||||
* @param ps
|
||||
*/
|
||||
extern bool __attribute__((overloadable))
|
||||
rsgProgramStoreGetDitherEnabled(rs_program_store ps);
|
||||
|
||||
|
||||
/**
|
||||
* Bind a new ProgramVertex to the rendering context.
|
||||
*
|
||||
@ -230,24 +98,6 @@ extern void __attribute__((overloadable))
|
||||
extern void __attribute__((overloadable))
|
||||
rsgBindProgramRaster(rs_program_raster pr);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get program raster point sprite state
|
||||
*
|
||||
* @param pr
|
||||
*/
|
||||
extern bool __attribute__((overloadable))
|
||||
rsgProgramRasterGetPointSpriteEnabled(rs_program_raster pr);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get program raster cull mode
|
||||
*
|
||||
* @param pr
|
||||
*/
|
||||
extern rs_cull_mode __attribute__((overloadable))
|
||||
rsgProgramRasterGetCullMode(rs_program_raster pr);
|
||||
|
||||
/**
|
||||
* Bind a new Sampler object to a ProgramFragment. The sampler will
|
||||
* operate on the texture bound at the matching slot.
|
||||
@ -257,51 +107,6 @@ extern rs_cull_mode __attribute__((overloadable))
|
||||
extern void __attribute__((overloadable))
|
||||
rsgBindSampler(rs_program_fragment, uint slot, rs_sampler);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get sampler minification value
|
||||
*
|
||||
* @param pr
|
||||
*/
|
||||
extern rs_sampler_value __attribute__((overloadable))
|
||||
rsgSamplerGetMinification(rs_sampler s);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get sampler magnification value
|
||||
*
|
||||
* @param pr
|
||||
*/
|
||||
extern rs_sampler_value __attribute__((overloadable))
|
||||
rsgSamplerGetMagnification(rs_sampler s);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get sampler wrap S value
|
||||
*
|
||||
* @param pr
|
||||
*/
|
||||
extern rs_sampler_value __attribute__((overloadable))
|
||||
rsgSamplerGetWrapS(rs_sampler s);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get sampler wrap T value
|
||||
*
|
||||
* @param pr
|
||||
*/
|
||||
extern rs_sampler_value __attribute__((overloadable))
|
||||
rsgSamplerGetWrapT(rs_sampler s);
|
||||
|
||||
/**
|
||||
* @hide
|
||||
* Get sampler anisotropy
|
||||
*
|
||||
* @param pr
|
||||
*/
|
||||
extern float __attribute__((overloadable))
|
||||
rsgSamplerGetAnisotropy(rs_sampler s);
|
||||
|
||||
/**
|
||||
* Bind a new Allocation object to a ProgramFragment. The
|
||||
* Allocation must be a valid texture for the Program. The sampling
|
||||
|
@ -64,9 +64,6 @@ public class RSTestCore {
|
||||
|
||||
unitTests = new ArrayList<UnitTest>();
|
||||
|
||||
unitTests.add(new UT_sampler(this, mRes, mCtx));
|
||||
unitTests.add(new UT_program_store(this, mRes, mCtx));
|
||||
unitTests.add(new UT_program_raster(this, mRes, mCtx));
|
||||
unitTests.add(new UT_primitives(this, mRes, mCtx));
|
||||
unitTests.add(new UT_vector(this, mRes, mCtx));
|
||||
unitTests.add(new UT_rsdebug(this, mRes, mCtx));
|
||||
|
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.rs.test;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.renderscript.*;
|
||||
import android.renderscript.ProgramRaster;
|
||||
import android.renderscript.ProgramRaster.CullMode;
|
||||
|
||||
public class UT_program_raster extends UnitTest {
|
||||
private Resources mRes;
|
||||
|
||||
ProgramRaster pointSpriteEnabled;
|
||||
ProgramRaster cullMode;
|
||||
|
||||
protected UT_program_raster(RSTestCore rstc, Resources res, Context ctx) {
|
||||
super(rstc, "ProgramRaster", ctx);
|
||||
mRes = res;
|
||||
}
|
||||
|
||||
private ProgramRaster.Builder getDefaultBuilder(RenderScript RS) {
|
||||
ProgramRaster.Builder b = new ProgramRaster.Builder(RS);
|
||||
b.setCullMode(CullMode.BACK);
|
||||
b.setPointSpriteEnabled(false);
|
||||
return b;
|
||||
}
|
||||
|
||||
private void initializeGlobals(RenderScript RS, ScriptC_program_raster s) {
|
||||
ProgramRaster.Builder b = getDefaultBuilder(RS);
|
||||
pointSpriteEnabled = b.setPointSpriteEnabled(true).create();
|
||||
b = getDefaultBuilder(RS);
|
||||
cullMode = b.setCullMode(CullMode.FRONT).create();
|
||||
|
||||
s.set_pointSpriteEnabled(pointSpriteEnabled);
|
||||
s.set_cullMode(cullMode);
|
||||
}
|
||||
|
||||
private void testScriptSide(RenderScript pRS) {
|
||||
ScriptC_program_raster s = new ScriptC_program_raster(pRS, mRes, R.raw.program_raster);
|
||||
pRS.setMessageHandler(mRsMessage);
|
||||
initializeGlobals(pRS, s);
|
||||
s.invoke_program_raster_test();
|
||||
pRS.finish();
|
||||
waitForMessage();
|
||||
}
|
||||
|
||||
private void testJavaSide(RenderScript RS) {
|
||||
_RS_ASSERT("pointSpriteEnabled.getPointSpriteEnabled() == true",
|
||||
pointSpriteEnabled.getPointSpriteEnabled() == true);
|
||||
_RS_ASSERT("pointSpriteEnabled.getCullMode() == ProgramRaster.CullMode.BACK",
|
||||
pointSpriteEnabled.getCullMode() == ProgramRaster.CullMode.BACK);
|
||||
|
||||
_RS_ASSERT("cullMode.getPointSpriteEnabled() == false",
|
||||
cullMode.getPointSpriteEnabled() == false);
|
||||
_RS_ASSERT("cullMode.getCullMode() == ProgramRaster.CullMode.FRONT",
|
||||
cullMode.getCullMode() == ProgramRaster.CullMode.FRONT);
|
||||
|
||||
updateUI();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
RenderScript pRS = RenderScript.create(mCtx);
|
||||
testScriptSide(pRS);
|
||||
testJavaSide(pRS);
|
||||
pRS.destroy();
|
||||
}
|
||||
}
|
@ -1,175 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.rs.test;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.renderscript.*;
|
||||
import android.renderscript.ProgramStore.BlendDstFunc;
|
||||
import android.renderscript.ProgramStore.BlendSrcFunc;
|
||||
import android.renderscript.ProgramStore.Builder;
|
||||
import android.renderscript.ProgramStore.DepthFunc;
|
||||
|
||||
public class UT_program_store extends UnitTest {
|
||||
private Resources mRes;
|
||||
|
||||
ProgramStore ditherEnable;
|
||||
ProgramStore colorRWriteEnable;
|
||||
ProgramStore colorGWriteEnable;
|
||||
ProgramStore colorBWriteEnable;
|
||||
ProgramStore colorAWriteEnable;
|
||||
ProgramStore blendSrc;
|
||||
ProgramStore blendDst;
|
||||
ProgramStore depthWriteEnable;
|
||||
ProgramStore depthFunc;
|
||||
|
||||
protected UT_program_store(RSTestCore rstc, Resources res, Context ctx) {
|
||||
super(rstc, "ProgramStore", ctx);
|
||||
mRes = res;
|
||||
}
|
||||
|
||||
private ProgramStore.Builder getDefaultBuilder(RenderScript RS) {
|
||||
ProgramStore.Builder b = new ProgramStore.Builder(RS);
|
||||
b.setBlendFunc(ProgramStore.BlendSrcFunc.ZERO, ProgramStore.BlendDstFunc.ZERO);
|
||||
b.setColorMaskEnabled(false, false, false, false);
|
||||
b.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
|
||||
b.setDepthMaskEnabled(false);
|
||||
b.setDitherEnabled(false);
|
||||
return b;
|
||||
}
|
||||
|
||||
private void initializeGlobals(RenderScript RS, ScriptC_program_store s) {
|
||||
ProgramStore.Builder b = getDefaultBuilder(RS);
|
||||
ditherEnable = b.setDitherEnabled(true).create();
|
||||
|
||||
b = getDefaultBuilder(RS);
|
||||
colorRWriteEnable = b.setColorMaskEnabled(true, false, false, false).create();
|
||||
|
||||
b = getDefaultBuilder(RS);
|
||||
colorGWriteEnable = b.setColorMaskEnabled(false, true, false, false).create();
|
||||
|
||||
b = getDefaultBuilder(RS);
|
||||
colorBWriteEnable = b.setColorMaskEnabled(false, false, true, false).create();
|
||||
|
||||
b = getDefaultBuilder(RS);
|
||||
colorAWriteEnable = b.setColorMaskEnabled(false, false, false, true).create();
|
||||
|
||||
b = getDefaultBuilder(RS);
|
||||
blendSrc = b.setBlendFunc(ProgramStore.BlendSrcFunc.DST_COLOR,
|
||||
ProgramStore.BlendDstFunc.ZERO).create();
|
||||
|
||||
b = getDefaultBuilder(RS);
|
||||
blendDst = b.setBlendFunc(ProgramStore.BlendSrcFunc.ZERO,
|
||||
ProgramStore.BlendDstFunc.DST_ALPHA).create();
|
||||
|
||||
b = getDefaultBuilder(RS);
|
||||
depthWriteEnable = b.setDepthMaskEnabled(true).create();
|
||||
|
||||
b = getDefaultBuilder(RS);
|
||||
depthFunc = b.setDepthFunc(ProgramStore.DepthFunc.GREATER).create();
|
||||
|
||||
s.set_ditherEnable(ditherEnable);
|
||||
s.set_colorRWriteEnable(colorRWriteEnable);
|
||||
s.set_colorGWriteEnable(colorGWriteEnable);
|
||||
s.set_colorBWriteEnable(colorBWriteEnable);
|
||||
s.set_colorAWriteEnable(colorAWriteEnable);
|
||||
s.set_blendSrc(blendSrc);
|
||||
s.set_blendDst(blendDst);
|
||||
s.set_depthWriteEnable(depthWriteEnable);
|
||||
s.set_depthFunc(depthFunc);
|
||||
}
|
||||
|
||||
private void testScriptSide(RenderScript pRS) {
|
||||
ScriptC_program_store s = new ScriptC_program_store(pRS, mRes, R.raw.program_store);
|
||||
pRS.setMessageHandler(mRsMessage);
|
||||
initializeGlobals(pRS, s);
|
||||
s.invoke_program_store_test();
|
||||
pRS.finish();
|
||||
waitForMessage();
|
||||
}
|
||||
|
||||
void checkObject(ProgramStore ps,
|
||||
boolean depthMask,
|
||||
DepthFunc df,
|
||||
BlendSrcFunc bsf,
|
||||
BlendDstFunc bdf,
|
||||
boolean R,
|
||||
boolean G,
|
||||
boolean B,
|
||||
boolean A,
|
||||
boolean dither) {
|
||||
_RS_ASSERT("ps.getDepthMaskEnabled() == depthMask", ps.getDepthMaskEnabled() == depthMask);
|
||||
_RS_ASSERT("ps.getDepthFunc() == df", ps.getDepthFunc() == df);
|
||||
_RS_ASSERT("ps.getBlendSrcFunc() == bsf", ps.getBlendSrcFunc() == bsf);
|
||||
_RS_ASSERT("ps.getBlendDstFunc() == bdf", ps.getBlendDstFunc() == bdf);
|
||||
_RS_ASSERT("ps.getColorMaskREnabled() == R", ps.getColorMaskREnabled() == R);
|
||||
_RS_ASSERT("ps.getColorMaskGEnabled() == G", ps.getColorMaskGEnabled() == G);
|
||||
_RS_ASSERT("ps.getColorMaskBEnabled() == B", ps.getColorMaskBEnabled() == B);
|
||||
_RS_ASSERT("ps.getColorMaskAEnabled() == A", ps.getColorMaskAEnabled() == A);
|
||||
_RS_ASSERT("ps.getDitherEnabled() == dither", ps.getDitherEnabled() == dither);
|
||||
}
|
||||
|
||||
void varyBuilderColorAndDither(ProgramStore.Builder pb,
|
||||
boolean depthMask,
|
||||
DepthFunc df,
|
||||
BlendSrcFunc bsf,
|
||||
BlendDstFunc bdf) {
|
||||
for (int r = 0; r <= 1; r++) {
|
||||
boolean isR = (r == 1);
|
||||
for (int g = 0; g <= 1; g++) {
|
||||
boolean isG = (g == 1);
|
||||
for (int b = 0; b <= 1; b++) {
|
||||
boolean isB = (b == 1);
|
||||
for (int a = 0; a <= 1; a++) {
|
||||
boolean isA = (a == 1);
|
||||
for (int dither = 0; dither <= 1; dither++) {
|
||||
boolean isDither = (dither == 1);
|
||||
pb.setDitherEnabled(isDither);
|
||||
pb.setColorMaskEnabled(isR, isG, isB, isA);
|
||||
ProgramStore ps = pb.create();
|
||||
checkObject(ps, depthMask, df, bsf, bdf, isR, isG, isB, isA, isDither);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testJavaSide(RenderScript RS) {
|
||||
for (int depth = 0; depth <= 1; depth++) {
|
||||
boolean depthMask = (depth == 1);
|
||||
for (DepthFunc df : DepthFunc.values()) {
|
||||
for (BlendSrcFunc bsf : BlendSrcFunc.values()) {
|
||||
for (BlendDstFunc bdf : BlendDstFunc.values()) {
|
||||
ProgramStore.Builder b = new ProgramStore.Builder(RS);
|
||||
b.setDepthFunc(df);
|
||||
b.setDepthMaskEnabled(depthMask);
|
||||
b.setBlendFunc(bsf, bdf);
|
||||
varyBuilderColorAndDither(b, depthMask, df, bsf, bdf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
RenderScript pRS = RenderScript.create(mCtx);
|
||||
testJavaSide(pRS);
|
||||
testScriptSide(pRS);
|
||||
pRS.destroy();
|
||||
}
|
||||
}
|
@ -1,151 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.rs.test;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.renderscript.*;
|
||||
import android.renderscript.Sampler;
|
||||
import android.renderscript.Sampler.Value;
|
||||
|
||||
public class UT_sampler extends UnitTest {
|
||||
private Resources mRes;
|
||||
|
||||
Sampler minification;
|
||||
Sampler magnification;
|
||||
Sampler wrapS;
|
||||
Sampler wrapT;
|
||||
Sampler anisotropy;
|
||||
|
||||
protected UT_sampler(RSTestCore rstc, Resources res, Context ctx) {
|
||||
super(rstc, "Sampler", ctx);
|
||||
mRes = res;
|
||||
}
|
||||
|
||||
private Sampler.Builder getDefaultBuilder(RenderScript RS) {
|
||||
Sampler.Builder b = new Sampler.Builder(RS);
|
||||
b.setMinification(Value.NEAREST);
|
||||
b.setMagnification(Value.NEAREST);
|
||||
b.setWrapS(Value.CLAMP);
|
||||
b.setWrapT(Value.CLAMP);
|
||||
b.setAnisotropy(1.0f);
|
||||
return b;
|
||||
}
|
||||
|
||||
private void initializeGlobals(RenderScript RS, ScriptC_sampler s) {
|
||||
Sampler.Builder b = getDefaultBuilder(RS);
|
||||
b.setMinification(Value.LINEAR_MIP_LINEAR);
|
||||
minification = b.create();
|
||||
|
||||
b = getDefaultBuilder(RS);
|
||||
b.setMagnification(Value.LINEAR);
|
||||
magnification = b.create();
|
||||
|
||||
b = getDefaultBuilder(RS);
|
||||
b.setWrapS(Value.WRAP);
|
||||
wrapS = b.create();
|
||||
|
||||
b = getDefaultBuilder(RS);
|
||||
b.setWrapT(Value.WRAP);
|
||||
wrapT = b.create();
|
||||
|
||||
b = getDefaultBuilder(RS);
|
||||
b.setAnisotropy(8.0f);
|
||||
anisotropy = b.create();
|
||||
|
||||
s.set_minification(minification);
|
||||
s.set_magnification(magnification);
|
||||
s.set_wrapS(wrapS);
|
||||
s.set_wrapT(wrapT);
|
||||
s.set_anisotropy(anisotropy);
|
||||
}
|
||||
|
||||
private void testScriptSide(RenderScript pRS) {
|
||||
ScriptC_sampler s = new ScriptC_sampler(pRS, mRes, R.raw.sampler);
|
||||
pRS.setMessageHandler(mRsMessage);
|
||||
initializeGlobals(pRS, s);
|
||||
s.invoke_sampler_test();
|
||||
pRS.finish();
|
||||
waitForMessage();
|
||||
}
|
||||
|
||||
private void testJavaSide(RenderScript RS) {
|
||||
_RS_ASSERT("minification.getMagnification() == Sampler.Value.NEAREST",
|
||||
minification.getMagnification() == Sampler.Value.NEAREST);
|
||||
_RS_ASSERT("minification.getMinification() == Sampler.Value.LINEAR_MIP_LINEAR",
|
||||
minification.getMinification() == Sampler.Value.LINEAR_MIP_LINEAR);
|
||||
_RS_ASSERT("minification.getWrapS() == Sampler.Value.CLAMP",
|
||||
minification.getWrapS() == Sampler.Value.CLAMP);
|
||||
_RS_ASSERT("minification.getWrapT() == Sampler.Value.CLAMP",
|
||||
minification.getWrapT() == Sampler.Value.CLAMP);
|
||||
_RS_ASSERT("minification.getAnisotropy() == 1.0f",
|
||||
minification.getAnisotropy() == 1.0f);
|
||||
|
||||
_RS_ASSERT("magnification.getMagnification() == Sampler.Value.LINEAR",
|
||||
magnification.getMagnification() == Sampler.Value.LINEAR);
|
||||
_RS_ASSERT("magnification.getMinification() == Sampler.Value.NEAREST",
|
||||
magnification.getMinification() == Sampler.Value.NEAREST);
|
||||
_RS_ASSERT("magnification.getWrapS() == Sampler.Value.CLAMP",
|
||||
magnification.getWrapS() == Sampler.Value.CLAMP);
|
||||
_RS_ASSERT("magnification.getWrapT() == Sampler.Value.CLAMP",
|
||||
magnification.getWrapT() == Sampler.Value.CLAMP);
|
||||
_RS_ASSERT("magnification.getAnisotropy() == 1.0f",
|
||||
magnification.getAnisotropy() == 1.0f);
|
||||
|
||||
_RS_ASSERT("wrapS.getMagnification() == Sampler.Value.NEAREST",
|
||||
wrapS.getMagnification() == Sampler.Value.NEAREST);
|
||||
_RS_ASSERT("wrapS.getMinification() == Sampler.Value.NEAREST",
|
||||
wrapS.getMinification() == Sampler.Value.NEAREST);
|
||||
_RS_ASSERT("wrapS.getWrapS() == Sampler.Value.WRAP",
|
||||
wrapS.getWrapS() == Sampler.Value.WRAP);
|
||||
_RS_ASSERT("wrapS.getWrapT() == Sampler.Value.CLAMP",
|
||||
wrapS.getWrapT() == Sampler.Value.CLAMP);
|
||||
_RS_ASSERT("wrapS.getAnisotropy() == 1.0f",
|
||||
wrapS.getAnisotropy() == 1.0f);
|
||||
|
||||
_RS_ASSERT("wrapT.getMagnification() == Sampler.Value.NEAREST",
|
||||
wrapT.getMagnification() == Sampler.Value.NEAREST);
|
||||
_RS_ASSERT("wrapT.getMinification() == Sampler.Value.NEAREST",
|
||||
wrapT.getMinification() == Sampler.Value.NEAREST);
|
||||
_RS_ASSERT("wrapT.getWrapS() == Sampler.Value.CLAMP",
|
||||
wrapT.getWrapS() == Sampler.Value.CLAMP);
|
||||
_RS_ASSERT("wrapT.getWrapT() == Sampler.Value.WRAP",
|
||||
wrapT.getWrapT() == Sampler.Value.WRAP);
|
||||
_RS_ASSERT("wrapT.getAnisotropy() == 1.0f",
|
||||
wrapT.getAnisotropy() == 1.0f);
|
||||
|
||||
_RS_ASSERT("anisotropy.getMagnification() == Sampler.Value.NEAREST",
|
||||
anisotropy.getMagnification() == Sampler.Value.NEAREST);
|
||||
_RS_ASSERT("anisotropy.getMinification() == Sampler.Value.NEAREST",
|
||||
anisotropy.getMinification() == Sampler.Value.NEAREST);
|
||||
_RS_ASSERT("anisotropy.getWrapS() == Sampler.Value.CLAMP",
|
||||
anisotropy.getWrapS() == Sampler.Value.CLAMP);
|
||||
_RS_ASSERT("anisotropy.getWrapT() == Sampler.Value.CLAMP",
|
||||
anisotropy.getWrapT() == Sampler.Value.CLAMP);
|
||||
_RS_ASSERT("anisotropy.getAnisotropy() == 1.0f",
|
||||
anisotropy.getAnisotropy() == 8.0f);
|
||||
|
||||
updateUI();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
RenderScript pRS = RenderScript.create(mCtx);
|
||||
testScriptSide(pRS);
|
||||
testJavaSide(pRS);
|
||||
pRS.destroy();
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
#include "shared.rsh"
|
||||
#include "rs_graphics.rsh"
|
||||
|
||||
rs_program_raster pointSpriteEnabled;
|
||||
rs_program_raster cullMode;
|
||||
|
||||
static bool test_program_raster_getters() {
|
||||
bool failed = false;
|
||||
|
||||
_RS_ASSERT(rsgProgramRasterGetPointSpriteEnabled(pointSpriteEnabled) == true);
|
||||
_RS_ASSERT(rsgProgramRasterGetCullMode(pointSpriteEnabled) == RS_CULL_BACK);
|
||||
|
||||
_RS_ASSERT(rsgProgramRasterGetPointSpriteEnabled(cullMode) == false);
|
||||
_RS_ASSERT(rsgProgramRasterGetCullMode(cullMode) == RS_CULL_FRONT);
|
||||
|
||||
if (failed) {
|
||||
rsDebug("test_program_raster_getters FAILED", 0);
|
||||
}
|
||||
else {
|
||||
rsDebug("test_program_raster_getters PASSED", 0);
|
||||
}
|
||||
|
||||
return failed;
|
||||
}
|
||||
|
||||
void program_raster_test() {
|
||||
bool failed = false;
|
||||
failed |= test_program_raster_getters();
|
||||
|
||||
if (failed) {
|
||||
rsSendToClientBlocking(RS_MSG_TEST_FAILED);
|
||||
}
|
||||
else {
|
||||
rsSendToClientBlocking(RS_MSG_TEST_PASSED);
|
||||
}
|
||||
}
|
||||
|
@ -1,128 +0,0 @@
|
||||
#include "shared.rsh"
|
||||
#include "rs_graphics.rsh"
|
||||
|
||||
rs_program_store ditherEnable;
|
||||
rs_program_store colorRWriteEnable;
|
||||
rs_program_store colorGWriteEnable;
|
||||
rs_program_store colorBWriteEnable;
|
||||
rs_program_store colorAWriteEnable;
|
||||
rs_program_store blendSrc;
|
||||
rs_program_store blendDst;
|
||||
rs_program_store depthWriteEnable;
|
||||
rs_program_store depthFunc;
|
||||
|
||||
static bool test_program_store_getters() {
|
||||
bool failed = false;
|
||||
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthFunc(depthFunc) == RS_DEPTH_FUNC_GREATER);
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthMask(depthFunc) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskR(depthFunc) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskG(depthFunc) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskB(depthFunc) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskA(depthFunc) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetDitherEnabled(depthFunc) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(depthFunc) == RS_BLEND_SRC_ZERO);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendDstFunc(depthFunc) == RS_BLEND_DST_ZERO);
|
||||
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthFunc(depthWriteEnable) == RS_DEPTH_FUNC_ALWAYS);
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthMask(depthWriteEnable) == true);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskR(depthWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskG(depthWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskB(depthWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskA(depthWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetDitherEnabled(depthWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(depthWriteEnable) == RS_BLEND_SRC_ZERO);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendDstFunc(depthWriteEnable) == RS_BLEND_DST_ZERO);
|
||||
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthFunc(colorRWriteEnable) == RS_DEPTH_FUNC_ALWAYS);
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthMask(colorRWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskR(colorRWriteEnable) == true);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskG(colorRWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskB(colorRWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskA(colorRWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetDitherEnabled(colorRWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(colorRWriteEnable) == RS_BLEND_SRC_ZERO);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendDstFunc(colorRWriteEnable) == RS_BLEND_DST_ZERO);
|
||||
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthFunc(colorGWriteEnable) == RS_DEPTH_FUNC_ALWAYS);
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthMask(colorGWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskR(colorGWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskG(colorGWriteEnable) == true);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskB(colorGWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskA(colorGWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetDitherEnabled(colorGWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(colorGWriteEnable) == RS_BLEND_SRC_ZERO);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendDstFunc(colorGWriteEnable) == RS_BLEND_DST_ZERO);
|
||||
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthFunc(colorBWriteEnable) == RS_DEPTH_FUNC_ALWAYS);
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthMask(colorBWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskR(colorBWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskG(colorBWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskB(colorBWriteEnable) == true);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskA(colorBWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetDitherEnabled(colorBWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(colorBWriteEnable) == RS_BLEND_SRC_ZERO);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendDstFunc(colorBWriteEnable) == RS_BLEND_DST_ZERO);
|
||||
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthFunc(colorAWriteEnable) == RS_DEPTH_FUNC_ALWAYS);
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthMask(colorAWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskR(colorAWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskG(colorAWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskB(colorAWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskA(colorAWriteEnable) == true);
|
||||
_RS_ASSERT(rsgProgramStoreGetDitherEnabled(colorAWriteEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(colorAWriteEnable) == RS_BLEND_SRC_ZERO);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendDstFunc(colorAWriteEnable) == RS_BLEND_DST_ZERO);
|
||||
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthFunc(ditherEnable) == RS_DEPTH_FUNC_ALWAYS);
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthMask(ditherEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskR(ditherEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskG(ditherEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskB(ditherEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskA(ditherEnable) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetDitherEnabled(ditherEnable) == true);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(ditherEnable) == RS_BLEND_SRC_ZERO);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendDstFunc(ditherEnable) == RS_BLEND_DST_ZERO);
|
||||
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthFunc(blendSrc) == RS_DEPTH_FUNC_ALWAYS);
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthMask(blendSrc) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskR(blendSrc) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskG(blendSrc) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskB(blendSrc) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskA(blendSrc) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetDitherEnabled(blendSrc) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(blendSrc) == RS_BLEND_SRC_DST_COLOR);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendDstFunc(blendSrc) == RS_BLEND_DST_ZERO);
|
||||
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthFunc(blendDst) == RS_DEPTH_FUNC_ALWAYS);
|
||||
_RS_ASSERT(rsgProgramStoreGetDepthMask(blendDst) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskR(blendDst) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskG(blendDst) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskB(blendDst) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetColorMaskA(blendDst) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetDitherEnabled(blendDst) == false);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendSrcFunc(blendDst) == RS_BLEND_SRC_ZERO);
|
||||
_RS_ASSERT(rsgProgramStoreGetBlendDstFunc(blendDst) == RS_BLEND_DST_DST_ALPHA);
|
||||
|
||||
if (failed) {
|
||||
rsDebug("test_program_store_getters FAILED", 0);
|
||||
}
|
||||
else {
|
||||
rsDebug("test_program_store_getters PASSED", 0);
|
||||
}
|
||||
|
||||
return failed;
|
||||
}
|
||||
|
||||
void program_store_test() {
|
||||
bool failed = false;
|
||||
failed |= test_program_store_getters();
|
||||
|
||||
if (failed) {
|
||||
rsSendToClientBlocking(RS_MSG_TEST_FAILED);
|
||||
}
|
||||
else {
|
||||
rsSendToClientBlocking(RS_MSG_TEST_PASSED);
|
||||
}
|
||||
}
|
||||
|
@ -1,63 +0,0 @@
|
||||
#include "shared.rsh"
|
||||
#include "rs_graphics.rsh"
|
||||
rs_sampler minification;
|
||||
rs_sampler magnification;
|
||||
rs_sampler wrapS;
|
||||
rs_sampler wrapT;
|
||||
rs_sampler anisotropy;
|
||||
|
||||
static bool test_sampler_getters() {
|
||||
bool failed = false;
|
||||
|
||||
_RS_ASSERT(rsgSamplerGetMagnification(minification) == RS_SAMPLER_NEAREST);
|
||||
_RS_ASSERT(rsgSamplerGetMinification(minification) == RS_SAMPLER_LINEAR_MIP_LINEAR);
|
||||
_RS_ASSERT(rsgSamplerGetWrapS(minification) == RS_SAMPLER_CLAMP);
|
||||
_RS_ASSERT(rsgSamplerGetWrapT(minification) == RS_SAMPLER_CLAMP);
|
||||
_RS_ASSERT(rsgSamplerGetAnisotropy(minification) == 1.0f);
|
||||
|
||||
_RS_ASSERT(rsgSamplerGetMagnification(magnification) == RS_SAMPLER_LINEAR);
|
||||
_RS_ASSERT(rsgSamplerGetMinification(magnification) == RS_SAMPLER_NEAREST);
|
||||
_RS_ASSERT(rsgSamplerGetWrapS(magnification) == RS_SAMPLER_CLAMP);
|
||||
_RS_ASSERT(rsgSamplerGetWrapT(magnification) == RS_SAMPLER_CLAMP);
|
||||
_RS_ASSERT(rsgSamplerGetAnisotropy(magnification) == 1.0f);
|
||||
|
||||
_RS_ASSERT(rsgSamplerGetMagnification(wrapS) == RS_SAMPLER_NEAREST);
|
||||
_RS_ASSERT(rsgSamplerGetMinification(wrapS) == RS_SAMPLER_NEAREST);
|
||||
_RS_ASSERT(rsgSamplerGetWrapS(wrapS) == RS_SAMPLER_WRAP);
|
||||
_RS_ASSERT(rsgSamplerGetWrapT(wrapS) == RS_SAMPLER_CLAMP);
|
||||
_RS_ASSERT(rsgSamplerGetAnisotropy(wrapS) == 1.0f);
|
||||
|
||||
_RS_ASSERT(rsgSamplerGetMagnification(wrapT) == RS_SAMPLER_NEAREST);
|
||||
_RS_ASSERT(rsgSamplerGetMinification(wrapT) == RS_SAMPLER_NEAREST);
|
||||
_RS_ASSERT(rsgSamplerGetWrapS(wrapT) == RS_SAMPLER_CLAMP);
|
||||
_RS_ASSERT(rsgSamplerGetWrapT(wrapT) == RS_SAMPLER_WRAP);
|
||||
_RS_ASSERT(rsgSamplerGetAnisotropy(wrapT) == 1.0f);
|
||||
|
||||
_RS_ASSERT(rsgSamplerGetMagnification(anisotropy) == RS_SAMPLER_NEAREST);
|
||||
_RS_ASSERT(rsgSamplerGetMinification(anisotropy) == RS_SAMPLER_NEAREST);
|
||||
_RS_ASSERT(rsgSamplerGetWrapS(anisotropy) == RS_SAMPLER_CLAMP);
|
||||
_RS_ASSERT(rsgSamplerGetWrapT(anisotropy) == RS_SAMPLER_CLAMP);
|
||||
_RS_ASSERT(rsgSamplerGetAnisotropy(anisotropy) == 8.0f);
|
||||
|
||||
if (failed) {
|
||||
rsDebug("test_sampler_getters FAILED", 0);
|
||||
}
|
||||
else {
|
||||
rsDebug("test_sampler_getters PASSED", 0);
|
||||
}
|
||||
|
||||
return failed;
|
||||
}
|
||||
|
||||
void sampler_test() {
|
||||
bool failed = false;
|
||||
failed |= test_sampler_getters();
|
||||
|
||||
if (failed) {
|
||||
rsSendToClientBlocking(RS_MSG_TEST_FAILED);
|
||||
}
|
||||
else {
|
||||
rsSendToClientBlocking(RS_MSG_TEST_PASSED);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user