Giter VIP home page Giter VIP logo

renderscript-samples's Introduction

Android Renderscript Samples

This repository contains a set of individual Android Studio projects:

Renderscript Support Status

Renderscript has been deprecated since Android 12, the samples here are part of the Renderscript deprecation toolkits which also includes:

Support

We highly recommend to use Stack Overflow to get help from the Andorid community.

If you've found an error in this sample, please file an issue: https://github.com/android/renderscript-samples

Patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub.

License

Copyright 2021 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

    https://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.

renderscript-samples's People

Contributors

codingjeremy avatar dagalpin avatar dburckh avatar kottsone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

renderscript-samples's Issues

Gradle dependency un-needed

Issue by corjohnson
Friday Dec 01, 2017 at 14:42 GMT
Originally opened as googlearchive/android-RenderScriptIntrinsic#2


Hello,

In downloading & running the example, I had gradle fail to sync due to the following dependency in the application gradle file:

compile files('renderscript-v8.jar')

Commenting out the dependency allowed the app to build and run. I didn't notice any side effects of that, so I think it might be useful to remove that dependency unless there's something I'm not realizing that went wrong by doing so. The repository doesn't have that file which is what creates the issue with the dependency.

Thanks,

Corey

Build failed with an exception

Issue by ezamelczyk
Thursday Aug 30, 2018 at 10:21 GMT
Originally opened as googlearchive/android-BasicRenderScript#6


Execution failed for task ':Application:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller than version 14 declared in library [com.android.support:support-v4:27.0.2] /Users/ernestzamelczyk/.gradle/caches/transforms-1/files-1.1/support-v4-27.0.2.aar/17ff0bf30fe04b2fb675ed82edfff8e4/AndroidManifest.xml as the library might be using APIs not available in 8
  	Suggestion: use a compatible library with a minSdk of at most 8,
  		or increase this project's minSdk version to at least 14,
  		or use tools:overrideLibrary="android.support.v4" to force usage (may lead to runtime failures)

how to reduce time when we use vulcan to blur

I find a bug in the demo, which compare renderscript , renderscriptInstrinct, Vulcan .
The way you calculate time, Only include render time 。
if we calculate time include render time and parpare time , I find that renderscriptInstrinct is the fastest way to blur。
Can we reduce the parpare time when we use Vulcan blur

Include renderscript-samples in Vulkan samples repo?

I'm working with the Khronos Vulkan samples team and there was a request for samples to show how to use external memory for cooperating with other APIs. It was suggested that we explore repurposing this sample as it is very relevant to the Vulkan audience. LMK if this is something we can consider pursuing. Would involve porting to the Vulkan Samples framework, but we could potentially find resources for that if needed. Thanks.

Gradle error

Issue by nickgtest
Wednesday Jan 24, 2018 at 22:59 GMT
Originally opened as googlearchive/android-BasicRenderScript#4


Cant compile "compile files('renderscript-v8.jar')" due to missing the file and you have two defaultConfig that will cause problem in the future In the build.gradle file. Please update the gradle file. Thanks

java.lang.OutOfMemoryError: Failed to allocate a 48771084 byte allocation with 16766176 free bytes and 33MB until OOM

Issue by krishna0808
Friday Apr 22, 2016 at 04:19 GMT
Originally opened as googlearchive/android-BasicRenderScript#2


To do some Renderscript performance benchmarking, i tried to run the sample on different devices like Nexus 6P & Samsung S7. I changed the default image to a 12 MP image takes from Nexus 6P camera. When i launch app, it crashes with OutOfMemory error. Why are we creating so many Bitmaps & Allocations? How can i make it run?

Sigserv in VulkanContext::pickPhysicalDeviceAndQueueFamily() on devices with mediatek cpu's

I've got sigserv exception in my play console which points to pickPhysicalDeviceAndQueueFamily() method. Problem persist on
different devices (Oppo, samsung, doogee, lge, lenovo, vivo etc) with specific mediatek cpu's.
List of CPUS: Mediatek MT6765, Mediatek MT8768T, Mediatek MT6765V/CB, Mediatek MT6761, Mediatek MT6762, Mediatek MT8768T, Mediatek MT6779p90, Mediatek MT6779p95.

backtrace:
  #00  pc 0x000000000002ad00  /vendor/lib64/libsrv_um.so (PVRSRVGetMaxDevMemSize+16)
  #01  pc 0x0000000000051ec0  /vendor/lib64/hw/vulkan.mt6765.so
  #02  pc 0x0000000000020c38  /data/app/~~_fZO9i9_EHuuuEEKLn_F0A==/com.examplepackage-fbBDmyWUuiRo9hwjEdVDVQ==/split_config.arm64_v8a.apk!libvulkan.so (vulkan::VulkanContext::pickPhysicalDeviceAndQueueFamily()+696)
  #03  pc 0x0000000000020668  /data/app/~~_fZO9i9_EHuuuEEKLn_F0A==/com.examplepackage-fbBDmyWUuiRo9hwjEdVDVQ==/split_config.arm64_v8a.apk!libvulkan.so (vulkan::VulkanContext::create(bool)+112)
  #04  pc 0x000000000001e120  /data/app/~~_fZO9i9_EHuuuEEKLn_F0A==/com.examplepackage-fbBDmyWUuiRo9hwjEdVDVQ==/split_config.arm64_v8a.apk!libvulkan.so (vulkan::ImageProcessor::initialize(bool, AAssetManager*)+64)
  #05  pc 0x000000000001e07c  /data/app/~~_fZO9i9_EHuuuEEKLn_F0A==/com.examplepackage-fbBDmyWUuiRo9hwjEdVDVQ==/split_config.arm64_v8a.apk!libvulkan.so (vulkan::ImageProcessor::create(bool, AAssetManager*)+168)
  #06  pc 0x000000000001c994  /data/app/~~_fZO9i9_EHuuuEEKLn_F0A==/com.examplepackage-fbBDmyWUuiRo9hwjEdVDVQ==/split_config.arm64_v8a.apk!vulkan.so (Java_com_examplepackage_vulkan_VulkanImageProcessor_initVulkanProcessor+52)
  #07  pc 0x00000000003abf18  /data/app/~~_fZO9i9_EHuuuEEKLn_F0A==/com.examplepackage-fbBDmyWUuiRo9hwjEdVDVQ==/oat/arm64/base.odex (art_jni_trampoline+152)
 

Any ideas to fix?

Request: offer samples of using Vulkan, migrated from Renderscript of the old live wallpapers

In the past, we had some live wallpapers by Google, made using Renderscript.
Renderscript was put aside after some time, not being used for such purposes.
Now as I've noticed Vulkan should replace them:
https://android-developers.googleblog.com/2021/04/android-gpu-compute-going-forward.html

And here we got a sample of this migration, according to the same blog.

Can you please provide samples of using it on the same live wallpapers apps we used to have?

I think one of them looked like this:
https://youtu.be/K0i4PAXXBdQ?t=24

RenderScriptMigrationSample: target API level '29' is out of range ('11' - '24')

I'm getting this error when trying to install the RenderScriptMigrationSample app target API level '29' is out of range ('11' - '24')

Maybe this bug from March 2017 is related to this (but that's 4 years now, so come on...) https://issuetracker.google.com/issues/37140083

Android Studio 4.1.3

Executing tasks: [:app:assembleDebug] in project /Users/.../renderscript-samples/RenderScriptMigrationSample

> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE

> Task :app:compileDebugRenderscript FAILED
error: target API level '29' is out of range ('11' - '24')


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugRenderscript'.
> com.android.ide.common.process.ProcessException: Error while executing process /Users/.../Library/Android/sdk/build-tools/30.0.3/llvm-rs-cc with arguments {-I /Users/.../Library/Android/sdk/build-tools/30.0.3/renderscript/include/ -I /Users/.../Library/Android/sdk/build-tools/30.0.3/renderscript/clang-include/ -p /Users/.../Documents/Apps/renderscript-samples/RenderScriptMigrationSample/app/build/generated/renderscript_source_output_dir/debug/out -target-api 29 /Users/.../Documents/Apps/renderscript-samples/RenderScriptMigrationSample/app/src/main/rs/colormatrix.rs /Users/.../Documents/Apps/renderscript-samples/RenderScriptMigrationSample/app/src/main/rs/blur.rs -O 3 -o /Users/.../Documents/Apps/renderscript-samples/RenderScriptMigrationSample/app/build/generated/res/rs/debug/raw}

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 442ms
1 actionable task: 1 executed

RenderScript 3 channel allocation 4/3 too big.

First of all, cool sample! But I'm here to complain. I modified your sample like so:

int w = mBitmapIn.getWidth();
int h = mBitmapIn.getHeight();
Allocation allocation4 = Allocation.createTyped(mRS,
    new Type.Builder(mRS, Element.F32_4(mRS)).setX(w).setY(h).create());
mScriptMatrix.forEach(inAllocation, allocation4);
float[] float4 = new float[w * h * 4];
allocation4.copyTo(float4); // Works! I get RGBA float pixels!

Allocation allocation1 = Allocation.createTyped(mRS,
        new Type.Builder(mRS, Element.F32(mRS)).setX(w).setY(h).create());
mScriptMatrix.forEach(inAllocation, allocation1);
float[] float1 = new float[w * h];
allocation1.copyTo(float1); // Works! I get R float pixels!

Allocation allocation2 = Allocation.createTyped(mRS,
        new Type.Builder(mRS, Element.F32_2(mRS)).setX(w).setY(h).create());
mScriptMatrix.forEach(inAllocation, allocation2);
float[] float2 = new float[w * h * 2];
allocation2.copyTo(float2); // Works! I get RG float pixels!

Allocation allocation = Allocation.createTyped(mRS,
        new Type.Builder(mRS, Element.F32_3(mRS)).setX(w).setY(h).create());
mScriptMatrix.forEach(inAllocation, allocation);
float[] float3 = new float[w * h * 3];
// allocation.copyTo(float3); // Fails! Want RGB float pixels but Allocation is 4/3 too big.

It looks like the issue is in Renderscript itself so maybe this isn't the right place; if so can you direct me? Thanks!
From https://android.googlesource.com/platform/frameworks/base/+/master/rs/java/android/renderscript/Element.java they are special casing 3 channels to 4--why oh why?

Element(long id, RenderScript rs, DataType dt, DataKind dk, boolean norm, int size) {
    super(id, rs);
    if ((dt != DataType.UNSIGNED_5_6_5) &&
            (dt != DataType.UNSIGNED_4_4_4_4) &&
            (dt != DataType.UNSIGNED_5_5_5_1)) {
        if (size == 3) {
            mSize = dt.mSize * 4;
        } else {
            mSize = dt.mSize * size;
        }
    } else {
        mSize = dt.mSize;
    }
    mType = dt;
    mKind = dk;
    mNormalized = norm;
    mVectorSize = size;
}

compile error using buildToolsVersion "23.0.1"

Issue by ss780217
Wednesday Sep 09, 2015 at 08:24 GMT
Originally opened as googlearchive/android-BasicRenderScript#1


logcat
Error:Execution failed for task ':Application:compileDebugRenderscript'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'D:\Android\sdk\build-tools\23.0.1\llvm-rs-cc.exe'' finished with non-zero exit value -1073741515

But using buildToolsVersion "21.1.2" can compile the project successfully.

Build failed

I failed to compile the script file saturation.rs. The error info. was

com.android.ide.common.process.ProcessException:
Error while executing process $mysdkroot/build-tools/28.0.3/llvm-rs-cc with arguments {
-I $mysdkroot/build-tools/28.0.3/renderscript/include/
-I $mysdkroot/build-tools/28.0.3/renderscript/clang-include/
-rs-package-name=androidx.renderscript
-p $myprojroot/renderscript-samples-main/BasicRenderScript/Application/build/generated/renderscript_source_output_dir/debug/out
-target-api 18 $myprojroot/renderscript-samples-main/BasicRenderScript/Application/src/main/rs/saturation.rs
-O 3
-o $myprojroot/renderscript-samples-main/BasicRenderScript/Application/build/generated/res/rs/debug/raw
}

I can't get any helpful info. from it. Any suggestions? Thanks!

RenderEffect Code

I've written an ImageProcessor that uses the new RenderEffect code from Android S. I would like to contribute it. Please allow me create a branch and a PR. I have already agreed to the Google CLA.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.