Merge "docs: fixing bug 5942573" into ics-mr1
This commit is contained in:
@ -142,7 +142,7 @@ href="{@docRoot}resources/samples/RenderScript/MiscSamples/index.html">Misc Samp
|
||||
|
||||
<p class="note"><strong>Note:</strong> The Renderscript runtime makes its best effort to
|
||||
refresh the frame at the specified rate. For example, if you are creating a live wallpaper
|
||||
and set the return value to 20, the Renderscript runtime renders the wallpaper at 20fps if it has just
|
||||
and set the return value to 20, the Renderscript runtime renders the wallpaper at 50fps if it has just
|
||||
enough or more resources to do so. It renders as fast as it can if not enough resources
|
||||
are available.</p>
|
||||
|
||||
@ -570,7 +570,7 @@ point if this is your first time using Renderscript.</p>
|
||||
vertex 0, 1, and 2 (the vertices are drawn counter-clockwise).</p>
|
||||
<pre>
|
||||
int float2VtxSize = 2;
|
||||
Mesh.TriangleMeshBuilder triangle = new Mesh.TriangleMeshBuilder(renderscriptGL,
|
||||
Mesh.TriangleMeshBuilder triangles = new Mesh.TriangleMeshBuilder(renderscriptGL,
|
||||
float2VtxSize, Mesh.TriangleMeshBuilder.COLOR);
|
||||
triangles.addVertex(300.f, 300.f);
|
||||
triangles.addVertex(150.f, 450.f);
|
||||
|
@ -231,7 +231,8 @@ would block until the value was returned.</p>
|
||||
|
||||
<p>
|
||||
If you want the Renderscript code to send a value back to the Android framework, use the
|
||||
<code>rsSendToClient()</code> function.
|
||||
<a href="{@docRoot}reference/renderscript/rs__core_8rsh.html"><code>rsSendToClient()</code></a>
|
||||
function.
|
||||
</p>
|
||||
|
||||
<h3 id="var">Variables</h3>
|
||||
@ -256,53 +257,6 @@ public long get_unsignedInteger(){
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h3 id="pointer">Pointers</h3>
|
||||
<p>Pointers are reflected into the script class itself, located in
|
||||
<code>project_root/gen/package/name/ScriptC_renderscript_filename</code>. You
|
||||
can declare pointers to a <code>struct</code> or any of the supported Renderscript types, but a
|
||||
<code>struct</code> cannot contain pointers or nested arrays. For example, if you declare the
|
||||
following pointers to a <code>struct</code> and <code>int32_t</code></p>
|
||||
|
||||
<pre>
|
||||
typedef struct Point {
|
||||
float2 point;
|
||||
} Point_t;
|
||||
|
||||
Point_t *touchPoints;
|
||||
int32_t *intPointer;
|
||||
</pre>
|
||||
<p>then the following code is generated in:</p>
|
||||
|
||||
<pre>
|
||||
private ScriptField_Point mExportVar_touchPoints;
|
||||
public void bind_touchPoints(ScriptField_Point v) {
|
||||
mExportVar_touchPoints = v;
|
||||
if (v == null) bindAllocation(null, mExportVarIdx_touchPoints);
|
||||
else bindAllocation(v.getAllocation(), mExportVarIdx_touchPoints);
|
||||
}
|
||||
|
||||
public ScriptField_Point get_touchPoints() {
|
||||
return mExportVar_touchPoints;
|
||||
}
|
||||
|
||||
private Allocation mExportVar_intPointer;
|
||||
public void bind_intPointer(Allocation v) {
|
||||
mExportVar_intPointer = v;
|
||||
if (v == null) bindAllocation(null, mExportVarIdx_intPointer);
|
||||
else bindAllocation(v, mExportVarIdx_intPointer);
|
||||
}
|
||||
|
||||
public Allocation get_intPointer() {
|
||||
return mExportVar_intPointer;
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>A <code>get</code> method and a special method named <code>bind_<em>pointer_name</em></code>
|
||||
(instead of a <code>set()</code> method) is generated. This method allows you to bind the memory
|
||||
that is allocated in the Android VM to the Renderscript runtime (you cannot allocate
|
||||
memory in your <code>.rs</code> file). For more information, see <a href="#memory">Working
|
||||
with Allocated Memory</a>.
|
||||
</p>
|
||||
|
||||
<h3 id="struct">Structs</h3>
|
||||
<p>Structs are reflected into their own classes, located in
|
||||
@ -311,7 +265,8 @@ with Allocated Memory</a>.
|
||||
specified number of <code>struct</code>s. For example, if you declare the following struct:</p>
|
||||
<pre>
|
||||
typedef struct Point {
|
||||
float2 point;
|
||||
float2 position;
|
||||
float size;
|
||||
} Point_t;
|
||||
</pre>
|
||||
|
||||
@ -478,7 +433,8 @@ in memory. Each <code>struct</code>'s class defines the following methods and co
|
||||
</pre>
|
||||
|
||||
<p>If you modify the memory in one memory space and want to push the updates to the rest of
|
||||
the memory spaces, call <code>rsgAllocationSyncAll()</code> in your Renderscript code to
|
||||
the memory spaces, call <a href="{@docRoot}reference/renderscript/rs__graphics_8rsh.html">
|
||||
<code>rsgAllocationSyncAll()</code></a> in your Renderscript code to
|
||||
synchronize the memory.</p>
|
||||
</li>
|
||||
|
||||
@ -511,6 +467,56 @@ Renderscript runtime. When you call a set accessor method on a member, there is
|
||||
properties that are not yet synchronized.</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="pointer">Pointers</h3>
|
||||
<p>Pointers are reflected into the script class itself, located in
|
||||
<code>project_root/gen/package/name/ScriptC_renderscript_filename</code>. You
|
||||
can declare pointers to a <code>struct</code> or any of the supported Renderscript types, but a
|
||||
<code>struct</code> cannot contain pointers or nested arrays. For example, if you declare the
|
||||
following pointers to a <code>struct</code> and <code>int32_t</code></p>
|
||||
|
||||
<pre>
|
||||
typedef struct Point {
|
||||
float2 position;
|
||||
float size;
|
||||
} Point_t;
|
||||
|
||||
Point_t *touchPoints;
|
||||
int32_t *intPointer;
|
||||
</pre>
|
||||
<p>then the following code is generated in:</p>
|
||||
|
||||
<pre>
|
||||
private ScriptField_Point mExportVar_touchPoints;
|
||||
public void bind_touchPoints(ScriptField_Point v) {
|
||||
mExportVar_touchPoints = v;
|
||||
if (v == null) bindAllocation(null, mExportVarIdx_touchPoints);
|
||||
else bindAllocation(v.getAllocation(), mExportVarIdx_touchPoints);
|
||||
}
|
||||
|
||||
public ScriptField_Point get_touchPoints() {
|
||||
return mExportVar_touchPoints;
|
||||
}
|
||||
|
||||
private Allocation mExportVar_intPointer;
|
||||
public void bind_intPointer(Allocation v) {
|
||||
mExportVar_intPointer = v;
|
||||
if (v == null) bindAllocation(null, mExportVarIdx_intPointer);
|
||||
else bindAllocation(v, mExportVarIdx_intPointer);
|
||||
}
|
||||
|
||||
public Allocation get_intPointer() {
|
||||
return mExportVar_intPointer;
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>A <code>get</code> method and a special method named <code>bind_<em>pointer_name</em></code>
|
||||
(instead of a <code>set()</code> method) is generated. This method allows you to bind the memory
|
||||
that is allocated in the Android VM to the Renderscript runtime (you cannot allocate
|
||||
memory in your <code>.rs</code> file). For more information, see <a href="#memory">Working
|
||||
with Allocated Memory</a>.
|
||||
</p>
|
||||
|
||||
|
||||
<h2 id="mem-allocation">Memory Allocation APIs</h2>
|
||||
|
||||
<p>Applications that use Renderscript still run in the Android VM. The actual Renderscript code, however, runs natively and
|
||||
@ -693,7 +699,8 @@ communicated back to the Android framework layer for efficiency purposes. The la
|
||||
that is set from the Android framework is always returned during a call to a <code>get</code>
|
||||
method. However, when Android framework code modifies a variable, that change can be communicated to
|
||||
the Renderscript runtime automatically or synchronized at a later time. If you need to send data
|
||||
from the Renderscript runtime to the Android framework layer, you can use the <code>rsSendToClient()</code> function
|
||||
from the Renderscript runtime to the Android framework layer, you can use the
|
||||
<a href="{@docRoot}reference/renderscript/rs__core_8rsh.html"><code>rsSendToClient()</code></a> function
|
||||
to overcome this limitation.
|
||||
</p>
|
||||
<p>When working with dynamically allocated memory, any changes at the Renderscript runtime layer are propagated
|
||||
|
@ -631,7 +631,7 @@ public class Mesh extends BaseObj {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the texture coordinate for the last added vertex
|
||||
* Sets the texture coordinate for the vertices that are added after this method call.
|
||||
*
|
||||
* @param s texture coordinate s
|
||||
* @param t texture coordinate t
|
||||
@ -648,7 +648,7 @@ public class Mesh extends BaseObj {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the normal vector for the last added vertex
|
||||
* Sets the normal vector for the vertices that are added after this method call.
|
||||
*
|
||||
* @param x normal vector x
|
||||
* @param y normal vector y
|
||||
@ -667,7 +667,7 @@ public class Mesh extends BaseObj {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color for the last added vertex
|
||||
* Sets the color for the vertices that are added after this method call.
|
||||
*
|
||||
* @param r red component
|
||||
* @param g green component
|
||||
|
Reference in New Issue
Block a user