mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
clc: Use kernel_arg_type_qual string to add const type qualifier to arg metadata
Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13759>
This commit is contained in:
parent
f384c763fc
commit
53d4dc7feb
1 changed files with 29 additions and 8 deletions
|
|
@ -232,8 +232,11 @@ public:
|
||||||
|
|
||||||
for (auto &kernel : kernels) {
|
for (auto &kernel : kernels) {
|
||||||
for (auto &arg : kernel.args) {
|
for (auto &arg : kernel.args) {
|
||||||
if (arg.typeId == typeId)
|
if (arg.typeId == typeId) {
|
||||||
arg.addrQualifier = addrQualifier;
|
arg.addrQualifier = addrQualifier;
|
||||||
|
if (addrQualifier == CLC_KERNEL_ARG_ADDRESS_CONSTANT)
|
||||||
|
arg.typeQualifier |= CLC_KERNEL_ARG_TYPE_CONST;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -249,10 +252,21 @@ public:
|
||||||
assert(op->type == SPV_OPERAND_TYPE_LITERAL_STRING);
|
assert(op->type == SPV_OPERAND_TYPE_LITERAL_STRING);
|
||||||
str = reinterpret_cast<const char *>(ins->words + op->offset);
|
str = reinterpret_cast<const char *>(ins->words + op->offset);
|
||||||
|
|
||||||
if (str.find("kernel_arg_type.") != 0)
|
size_t start = 0;
|
||||||
return;
|
enum class string_type {
|
||||||
|
arg_type,
|
||||||
|
arg_type_qual,
|
||||||
|
} str_type;
|
||||||
|
|
||||||
size_t start = sizeof("kernel_arg_type.") - 1;
|
if (str.find("kernel_arg_type.") == 0) {
|
||||||
|
start = sizeof("kernel_arg_type.") - 1;
|
||||||
|
str_type = string_type::arg_type;
|
||||||
|
} else if (str.find("kernel_arg_type_qual.") == 0) {
|
||||||
|
start = sizeof("kernel_arg_type_qual.") - 1;
|
||||||
|
str_type = string_type::arg_type_qual;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto &kernel : kernels) {
|
for (auto &kernel : kernels) {
|
||||||
size_t pos;
|
size_t pos;
|
||||||
|
|
@ -270,12 +284,19 @@ public:
|
||||||
if (arg.name.empty())
|
if (arg.name.empty())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
size_t typeEnd = str.find(',', pos);
|
size_t entryEnd = str.find(',', pos);
|
||||||
if (typeEnd == std::string::npos)
|
if (entryEnd == std::string::npos)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
arg.typeName = str.substr(pos, typeEnd - pos);
|
std::string entryVal = str.substr(pos, entryEnd - pos);
|
||||||
pos = typeEnd + 1;
|
pos = entryEnd + 1;
|
||||||
|
|
||||||
|
if (str_type == string_type::arg_type) {
|
||||||
|
arg.typeName = std::move(entryVal);
|
||||||
|
} else if (str_type == string_type::arg_type_qual) {
|
||||||
|
if (entryVal.find("const") != std::string::npos)
|
||||||
|
arg.typeQualifier |= CLC_KERNEL_ARG_TYPE_CONST;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue