Skip to content

Commit e9aa0f4

Browse files
author
Petr Vesely
committed
[UR] Address Review Feedback
1 parent 7217fd7 commit e9aa0f4

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

scripts/templates/helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def get_array_length(cls, name):
236236
@classmethod
237237
def get_array_element_type(cls, name):
238238
if not cls.is_array(name):
239-
raise Exception("Cannot find array length of non-array type.")
239+
raise Exception("Cannot find array type of non-array type.")
240240

241241
match = re.match(cls.RE_ARRAY, name)
242242
return match.groups()[0]

scripts/templates/params.hpp.mako

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@ def findMemberType(_item):
8585
os << ".${iname} = ";
8686
${x}_params::serializeUnion(os, ${deref}(params${access}${item['name']}), params${access}${th.param_traits.tagged_member(item)});
8787
%elif th.type_traits.is_array(item['type']):
88-
os << ".${iname} = [";
88+
os << ".${iname} = {";
8989
for(auto i = 0; i < ${th.type_traits.get_array_length(item['type'])}; i++){
9090
if(i != 0){
9191
os << ", ";
9292
}
93-
os << ${deref}(params${access}${item['name']}[i]);
93+
<%call expr="member(iname, itype, True)">
94+
${deref}(params${access}${item['name']}[i])
95+
</%call>
9496
}
95-
os << "]";
97+
os << "}";
9698
%elif typename is not None:
9799
os << ".${iname} = ";
98100
${x}_params::serializeTagged(os, ${deref}(params${access}${pname}), ${deref}(params${access}${prefix}${typename}), ${deref}(params${access}${prefix}${typename_size}));

source/common/ur_params.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9905,14 +9905,15 @@ operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params) {
99059905
ur_params::serializeStruct(os, (params.pNext));
99069906

99079907
os << ", ";
9908-
os << ".addrModes = [";
9908+
os << ".addrModes = {";
99099909
for (auto i = 0; i < 3; i++) {
99109910
if (i != 0) {
99119911
os << ", ";
99129912
}
9913+
99139914
os << (params.addrModes[i]);
99149915
}
9915-
os << "]";
9916+
os << "}";
99169917

99179918
os << "}";
99189919
return os;

test/unit/utils/params.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,11 @@ struct UrSamplerAddressModesTest {
381381
"\\{"
382382
".stype = UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES, "
383383
".pNext = nullptr, "
384-
".addrModes = \\["
384+
".addrModes = \\{"
385385
"UR_SAMPLER_ADDRESSING_MODE_CLAMP, "
386386
"UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT, "
387387
"UR_SAMPLER_ADDRESSING_MODE_REPEAT"
388-
"\\]"
388+
"\\}"
389389
"\\}";
390390
}
391391

0 commit comments

Comments
 (0)