Skip to content

Commit 978c652

Browse files
jimblacklercorpDawn LUCI CQ
authored andcommitted
[Kotlin] Fix methods that return containers
The returnAllocation logic was not wired up to the args struct. I was also able to simplify the logic in the second call parameter loop. Bug: 375591466 Test: FeaturesTest Change-Id: I4da704dfec427fc96b0915fca4dd57c3d74cfcca Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/212414 Reviewed-by: Corentin Wallez <[email protected]> Auto-Submit: Jim Blackler <[email protected]> Commit-Queue: Jim Blackler <[email protected]>
1 parent a4bae3f commit 978c652

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

generator/templates/art/methods.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,14 @@ jobject toByteBuffer(JNIEnv *env, const void* address, jlong size) {
126126
{% endfor %}
127127
);
128128
//* Allocate the native container
129-
auto returnAllocation = std::make_unique<{{ as_cType(_kotlin_return.type.name) }}[]>(size);
129+
args.{{ as_varName(_kotlin_return.name) }} = c.AllocArray<{{ as_cType(_kotlin_return.type.name) }}>(size);
130130
if (env->ExceptionCheck()) { //* Early out if client (Kotlin) callback threw an exception.
131131
return nullptr;
132132
}
133133
//* Second call completes the native container
134134
wgpu{{ object.name.CamelCase() }}{{ method.name.CamelCase() }}(handle
135135
{% for arg in method.arguments -%}
136-
{{- ', ' if object or not loop.first -}}
137-
{{- 'returnAllocation.get()' if arg == _kotlin_return else "args." + as_varName(arg.name) -}}
136+
, {{- "args." + as_varName(arg.name) -}}
138137
{% endfor %}
139138
);
140139
if (env->ExceptionCheck()) { //* Early out if client (Kotlin) callback threw an exception.

0 commit comments

Comments
 (0)