Loading libs/rs/scriptc/rs_graphics.rsh +0 −195 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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. * Loading @@ -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. Loading @@ -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 Loading tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java +0 −3 Original line number Diff line number Diff line Loading @@ -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)); Loading tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.javadeleted 100644 → 0 +0 −82 Original line number Diff line number Diff line /* * 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(); } } tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.javadeleted 100644 → 0 +0 −175 Original line number Diff line number Diff line /* * 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(); } } tests/RenderScriptTests/tests/src/com/android/rs/test/UT_sampler.javadeleted 100644 → 0 +0 −151 Original line number Diff line number Diff line /* * 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(); } } Loading
libs/rs/scriptc/rs_graphics.rsh +0 −195 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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. * Loading @@ -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. Loading @@ -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 Loading
tests/RenderScriptTests/tests/src/com/android/rs/test/RSTestCore.java +0 −3 Original line number Diff line number Diff line Loading @@ -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)); Loading
tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.javadeleted 100644 → 0 +0 −82 Original line number Diff line number Diff line /* * 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(); } }
tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.javadeleted 100644 → 0 +0 −175 Original line number Diff line number Diff line /* * 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(); } }
tests/RenderScriptTests/tests/src/com/android/rs/test/UT_sampler.javadeleted 100644 → 0 +0 −151 Original line number Diff line number Diff line /* * 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(); } }