public class RenderScript extends Object
For more information about creating an application that uses RenderScript, read the RenderScript developer guide.
Modifier and Type | Class and Description |
---|---|
static class |
RenderScript.ContextType
ContextType specifies the specific type of context to be created.
|
static class |
RenderScript.Priority
RenderScript worker thread priority enumeration.
|
static class |
RenderScript.RSErrorHandler
The runtime error handler base class.
|
static class |
RenderScript.RSMessageHandler
The base class from which an application should derive in order
to receive RS messages from scripts.
|
Modifier and Type | Field and Description |
---|---|
static int |
CREATE_FLAG_NONE |
Modifier and Type | Method and Description |
---|---|
void |
contextDump()
Print the currently available debugging information about the state of
the RS context to the log.
|
static RenderScript |
create(Context ctx)
Create a RenderScript context.
|
static RenderScript |
create(Context ctx,
int sdkVersion)
calls create(ctx, sdkVersion, ContextType.NORMAL, CREATE_FLAG_NONE)
Used by the RenderScriptThunker to maintain backward compatibility.
|
static RenderScript |
create(Context ctx,
int sdkVersion,
RenderScript.ContextType ct)
calls create(ctx, sdkVersion, ct, CREATE_FLAG_NONE)
Create a RenderScript context.
|
static RenderScript |
create(Context ctx,
int sdkVersion,
RenderScript.ContextType ct,
int flags)
Gets or creates a RenderScript context of the specified type.
|
static RenderScript |
create(Context ctx,
RenderScript.ContextType ct)
calls create(ctx, ct, CREATE_FLAG_NONE)
See documentation for @create for details
|
static RenderScript |
create(Context ctx,
RenderScript.ContextType ct,
int flags)
Gets or creates a RenderScript context of the specified type.
|
static RenderScript |
createMultiContext(Context ctx,
RenderScript.ContextType ct,
int flags,
int API_number)
Create a RenderScript context.
|
void |
destroy()
Destroys this RenderScript context.
|
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
void |
finish()
Wait for any pending asynchronous opeations (such as copies to a RS
allocation or RS script executions) to complete.
|
static void |
forceCompat()
Force using support lib runtime.
|
Context |
getApplicationContext()
Gets the application context associated with the RenderScript context.
|
RenderScript.RSErrorHandler |
getErrorHandler() |
RenderScript.RSMessageHandler |
getMessageHandler() |
static void |
releaseAllContexts()
Releases all the process contexts.
|
void |
sendMessage(int id,
int[] data)
Place a message into the message queue to be sent back to the message
handler once all previous commands have been executed.
|
static void |
setBlackList(String blackList)
Sets the blackList of Models to only use support lib runtime.
|
void |
setErrorHandler(RenderScript.RSErrorHandler msg) |
void |
setMessageHandler(RenderScript.RSMessageHandler msg) |
void |
setPriority(RenderScript.Priority p)
Change the priority of the worker threads for this context.
|
static void |
setupDiskCache(File cacheDir)
Sets the directory to use as a persistent storage for the
renderscript object file cache.
|
public static final int CREATE_FLAG_NONE
public static void setBlackList(String blackList)
blackList
- User provided black list string.
Format: "(MANUFACTURER1:PRODUCT1:MODEL1), (MANUFACTURER2:PRODUCT2:MODEL2)..."
e.g. : To Blacklist Nexus 7(2013) and Nexus 5.
mBlackList = "(asus:razor:Nexus 7), (LGE:hammerhead:Nexus 5)";public static void forceCompat()
public static void setupDiskCache(File cacheDir)
cacheDir
- A directory the current process can write topublic void setMessageHandler(RenderScript.RSMessageHandler msg)
public RenderScript.RSMessageHandler getMessageHandler()
public void sendMessage(int id, int[] data)
id
- data
- public void setErrorHandler(RenderScript.RSErrorHandler msg)
public RenderScript.RSErrorHandler getErrorHandler()
public void setPriority(RenderScript.Priority p)
p
- New priority to be set.public final Context getApplicationContext()
public static RenderScript create(Context ctx)
ctx
- The context.public static RenderScript create(Context ctx, RenderScript.ContextType ct)
ctx
- The context.ct
- The type of context to be created.public static RenderScript create(Context ctx, RenderScript.ContextType ct, int flags)
ctx
- The context.ct
- The type of context to be created.flags
- The OR of the CREATE_FLAG_* options desiredpublic static RenderScript create(Context ctx, int sdkVersion)
ctx
- The context.sdkVersion
- The target SDK Version.public static RenderScript create(Context ctx, int sdkVersion, RenderScript.ContextType ct)
ctx
- The context.public static RenderScript create(Context ctx, int sdkVersion, RenderScript.ContextType ct, int flags)
ctx
- The context.ct
- The type of context to be created.sdkVersion
- The target SDK Version.flags
- The OR of the CREATE_FLAG_* options desiredpublic static void releaseAllContexts()
public static RenderScript createMultiContext(Context ctx, RenderScript.ContextType ct, int flags, int API_number)
ctx
- The context.public void contextDump()
public void finish()
protected void finalize() throws Throwable
Object
finalize
method to dispose of
system resources or to perform other cleanup.
The general contract of finalize
is that it is invoked
if and when the JavaTM virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The finalize
method may take any action, including
making this object available again to other threads; the usual purpose
of finalize
, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.
The finalize
method of class Object
performs no
special action; it simply returns normally. Subclasses of
Object
may override this definition.
The Java programming language does not guarantee which thread will
invoke the finalize
method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.
After the finalize
method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.
The finalize
method is never invoked more than once by a Java
virtual machine for any given object.
Any exception thrown by the finalize
method causes
the finalization of this object to be halted, but is otherwise
ignored.
public void destroy()