Skip to content

Commit d559bc7

Browse files
Robert LyAndroid Git Automerger
authored andcommitted
am e5e11fd: Merge "docs: fixing bug 5942573" into ics-mr1
* commit 'e5e11fd666d242b099466017c6d9bd23e6d2896d': docs: fixing bug 5942573
2 parents 921e830 + e5e11fd commit d559bc7

File tree

3 files changed

+63
-56
lines changed

3 files changed

+63
-56
lines changed

docs/html/guide/topics/renderscript/graphics.jd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ href="{@docRoot}resources/samples/RenderScript/MiscSamples/index.html">Misc Samp
142142

143143
<p class="note"><strong>Note:</strong> The Renderscript runtime makes its best effort to
144144
refresh the frame at the specified rate. For example, if you are creating a live wallpaper
145-
and set the return value to 20, the Renderscript runtime renders the wallpaper at 20fps if it has just
145+
and set the return value to 20, the Renderscript runtime renders the wallpaper at 50fps if it has just
146146
enough or more resources to do so. It renders as fast as it can if not enough resources
147147
are available.</p>
148148

@@ -570,7 +570,7 @@ point if this is your first time using Renderscript.</p>
570570
vertex 0, 1, and 2 (the vertices are drawn counter-clockwise).</p>
571571
<pre>
572572
int float2VtxSize = 2;
573-
Mesh.TriangleMeshBuilder triangle = new Mesh.TriangleMeshBuilder(renderscriptGL,
573+
Mesh.TriangleMeshBuilder triangles = new Mesh.TriangleMeshBuilder(renderscriptGL,
574574
float2VtxSize, Mesh.TriangleMeshBuilder.COLOR);
575575
triangles.addVertex(300.f, 300.f);
576576
triangles.addVertex(150.f, 450.f);

docs/html/guide/topics/renderscript/index.jd

Lines changed: 58 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ would block until the value was returned.</p>
231231

232232
<p>
233233
If you want the Renderscript code to send a value back to the Android framework, use the
234-
<code>rsSendToClient()</code> function.
234+
<a href="{@docRoot}reference/renderscript/rs__core_8rsh.html"><code>rsSendToClient()</code></a>
235+
function.
235236
</p>
236237

237238
<h3 id="var">Variables</h3>
@@ -256,53 +257,6 @@ public long get_unsignedInteger(){
256257
}
257258
</pre>
258259

259-
<h3 id="pointer">Pointers</h3>
260-
<p>Pointers are reflected into the script class itself, located in
261-
<code>project_root/gen/package/name/ScriptC_renderscript_filename</code>. You
262-
can declare pointers to a <code>struct</code> or any of the supported Renderscript types, but a
263-
<code>struct</code> cannot contain pointers or nested arrays. For example, if you declare the
264-
following pointers to a <code>struct</code> and <code>int32_t</code></p>
265-
266-
<pre>
267-
typedef struct Point {
268-
float2 point;
269-
} Point_t;
270-
271-
Point_t *touchPoints;
272-
int32_t *intPointer;
273-
</pre>
274-
<p>then the following code is generated in:</p>
275-
276-
<pre>
277-
private ScriptField_Point mExportVar_touchPoints;
278-
public void bind_touchPoints(ScriptField_Point v) {
279-
mExportVar_touchPoints = v;
280-
if (v == null) bindAllocation(null, mExportVarIdx_touchPoints);
281-
else bindAllocation(v.getAllocation(), mExportVarIdx_touchPoints);
282-
}
283-
284-
public ScriptField_Point get_touchPoints() {
285-
return mExportVar_touchPoints;
286-
}
287-
288-
private Allocation mExportVar_intPointer;
289-
public void bind_intPointer(Allocation v) {
290-
mExportVar_intPointer = v;
291-
if (v == null) bindAllocation(null, mExportVarIdx_intPointer);
292-
else bindAllocation(v, mExportVarIdx_intPointer);
293-
}
294-
295-
public Allocation get_intPointer() {
296-
return mExportVar_intPointer;
297-
}
298-
</pre>
299-
300-
<p>A <code>get</code> method and a special method named <code>bind_<em>pointer_name</em></code>
301-
(instead of a <code>set()</code> method) is generated. This method allows you to bind the memory
302-
that is allocated in the Android VM to the Renderscript runtime (you cannot allocate
303-
memory in your <code>.rs</code> file). For more information, see <a href="#memory">Working
304-
with Allocated Memory</a>.
305-
</p>
306260

307261
<h3 id="struct">Structs</h3>
308262
<p>Structs are reflected into their own classes, located in
@@ -311,7 +265,8 @@ with Allocated Memory</a>.
311265
specified number of <code>struct</code>s. For example, if you declare the following struct:</p>
312266
<pre>
313267
typedef struct Point {
314-
float2 point;
268+
float2 position;
269+
float size;
315270
} Point_t;
316271
</pre>
317272

@@ -478,7 +433,8 @@ in memory. Each <code>struct</code>'s class defines the following methods and co
478433
</pre>
479434

480435
<p>If you modify the memory in one memory space and want to push the updates to the rest of
481-
the memory spaces, call <code>rsgAllocationSyncAll()</code> in your Renderscript code to
436+
the memory spaces, call <a href="{@docRoot}reference/renderscript/rs__graphics_8rsh.html">
437+
<code>rsgAllocationSyncAll()</code></a> in your Renderscript code to
482438
synchronize the memory.</p>
483439
</li>
484440

@@ -511,6 +467,56 @@ Renderscript runtime. When you call a set accessor method on a member, there is
511467
properties that are not yet synchronized.</li>
512468
</ul>
513469

470+
<h3 id="pointer">Pointers</h3>
471+
<p>Pointers are reflected into the script class itself, located in
472+
<code>project_root/gen/package/name/ScriptC_renderscript_filename</code>. You
473+
can declare pointers to a <code>struct</code> or any of the supported Renderscript types, but a
474+
<code>struct</code> cannot contain pointers or nested arrays. For example, if you declare the
475+
following pointers to a <code>struct</code> and <code>int32_t</code></p>
476+
477+
<pre>
478+
typedef struct Point {
479+
float2 position;
480+
float size;
481+
} Point_t;
482+
483+
Point_t *touchPoints;
484+
int32_t *intPointer;
485+
</pre>
486+
<p>then the following code is generated in:</p>
487+
488+
<pre>
489+
private ScriptField_Point mExportVar_touchPoints;
490+
public void bind_touchPoints(ScriptField_Point v) {
491+
mExportVar_touchPoints = v;
492+
if (v == null) bindAllocation(null, mExportVarIdx_touchPoints);
493+
else bindAllocation(v.getAllocation(), mExportVarIdx_touchPoints);
494+
}
495+
496+
public ScriptField_Point get_touchPoints() {
497+
return mExportVar_touchPoints;
498+
}
499+
500+
private Allocation mExportVar_intPointer;
501+
public void bind_intPointer(Allocation v) {
502+
mExportVar_intPointer = v;
503+
if (v == null) bindAllocation(null, mExportVarIdx_intPointer);
504+
else bindAllocation(v, mExportVarIdx_intPointer);
505+
}
506+
507+
public Allocation get_intPointer() {
508+
return mExportVar_intPointer;
509+
}
510+
</pre>
511+
512+
<p>A <code>get</code> method and a special method named <code>bind_<em>pointer_name</em></code>
513+
(instead of a <code>set()</code> method) is generated. This method allows you to bind the memory
514+
that is allocated in the Android VM to the Renderscript runtime (you cannot allocate
515+
memory in your <code>.rs</code> file). For more information, see <a href="#memory">Working
516+
with Allocated Memory</a>.
517+
</p>
518+
519+
514520
<h2 id="mem-allocation">Memory Allocation APIs</h2>
515521

516522
<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
693699
that is set from the Android framework is always returned during a call to a <code>get</code>
694700
method. However, when Android framework code modifies a variable, that change can be communicated to
695701
the Renderscript runtime automatically or synchronized at a later time. If you need to send data
696-
from the Renderscript runtime to the Android framework layer, you can use the <code>rsSendToClient()</code> function
702+
from the Renderscript runtime to the Android framework layer, you can use the
703+
<a href="{@docRoot}reference/renderscript/rs__core_8rsh.html"><code>rsSendToClient()</code></a> function
697704
to overcome this limitation.
698705
</p>
699706
<p>When working with dynamically allocated memory, any changes at the Renderscript runtime layer are propagated

graphics/java/android/renderscript/Mesh.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ public TriangleMeshBuilder addVertex(float x, float y, float z) {
631631
}
632632

633633
/**
634-
* Sets the texture coordinate for the last added vertex
634+
* Sets the texture coordinate for the vertices that are added after this method call.
635635
*
636636
* @param s texture coordinate s
637637
* @param t texture coordinate t
@@ -648,7 +648,7 @@ public TriangleMeshBuilder setTexture(float s, float t) {
648648
}
649649

650650
/**
651-
* Sets the normal vector for the last added vertex
651+
* Sets the normal vector for the vertices that are added after this method call.
652652
*
653653
* @param x normal vector x
654654
* @param y normal vector y
@@ -667,7 +667,7 @@ public TriangleMeshBuilder setNormal(float x, float y, float z) {
667667
}
668668

669669
/**
670-
* Sets the color for the last added vertex
670+
* Sets the color for the vertices that are added after this method call.
671671
*
672672
* @param r red component
673673
* @param g green component

0 commit comments

Comments
 (0)