Renderscript Source Compilation

As I mentioned in my previous post ( Compiling renderscript code at runtime ), I am trying to compile renderscript code at runtime. As Kietz suggested, I need to change the ScriptC class from which all generated Java classes are derived. Creating my own class that extends Script fails because I cannot call the constructor of this superclass.

This piece of code

public class RuntimeScriptC extends Script {
       private static final String TAG = "RuntimeScriptC";

   protected RuntimeScriptC(int id, RenderScript rs) {            
       super(id, rs);       

   }

gives me this error:

The constructor Script(int, RenderScript) is undefined

My next idea was to add my own class to the renderscript source code and compile it to create a new .jar. I found the git source code , but have no idea how to create a renderscript package only.

: , Script.java . . renderscript, .

: renderscript ?

+1
1

RenderScript android.googlesource.com, Android. Android , , , .

. ScriptC, . , , ScriptC, . , HackedScriptC, , ScriptC():

package com.example.android.rs.extremehax;

import android.content.res.Resources;
import android.renderscript.RenderScript;
import android.renderscript.ScriptC;

public class HackedScriptC extends ScriptC {

    public HackedScriptC(RenderScript rs, Resources resources, int id) {
        // simple passthru to the only constructor that ScriptC_mono uses
        super(rs, resources, id);
    }

}

ScriptC :

package com.example.android.rs.extremehax;
// ...     
public class ScriptC_mono extends HackedScriptC { 
    // otherwise identical glue class...

ScriptC(RenderScript,Resources,int), internalCreate, . ScriptC(int,RenderScript).

+3

Source: https://habr.com/ru/post/1533346/


All Articles