clover: simplify image arguments
We don't care how many dimensions the image arg has, so drop it otherwise we would have to add a lot of variants for arrays, msaa and depth combinations. Yes, image2d_array_msaa_depth_t is a thing. Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Serge Martin <edb@sigluy.net> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9212>
This commit is contained in:
@@ -395,12 +395,10 @@ kernel::argument::create(const module::argument &marg) {
|
|||||||
case module::argument::constant:
|
case module::argument::constant:
|
||||||
return std::unique_ptr<kernel::argument>(new constant_argument);
|
return std::unique_ptr<kernel::argument>(new constant_argument);
|
||||||
|
|
||||||
case module::argument::image2d_rd:
|
case module::argument::image_rd:
|
||||||
case module::argument::image3d_rd:
|
|
||||||
return std::unique_ptr<kernel::argument>(new image_rd_argument);
|
return std::unique_ptr<kernel::argument>(new image_rd_argument);
|
||||||
|
|
||||||
case module::argument::image2d_wr:
|
case module::argument::image_wr:
|
||||||
case module::argument::image3d_wr:
|
|
||||||
return std::unique_ptr<kernel::argument>(new image_wr_argument);
|
return std::unique_ptr<kernel::argument>(new image_wr_argument);
|
||||||
|
|
||||||
case module::argument::sampler:
|
case module::argument::sampler:
|
||||||
|
@@ -85,10 +85,8 @@ namespace clover {
|
|||||||
constant,
|
constant,
|
||||||
global,
|
global,
|
||||||
local,
|
local,
|
||||||
image2d_rd,
|
image_rd,
|
||||||
image2d_wr,
|
image_wr,
|
||||||
image3d_rd,
|
|
||||||
image3d_wr,
|
|
||||||
sampler
|
sampler
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -57,16 +57,14 @@ namespace {
|
|||||||
enum module::argument::type
|
enum module::argument::type
|
||||||
get_image_type(const std::string &type,
|
get_image_type(const std::string &type,
|
||||||
const std::string &qual) {
|
const std::string &qual) {
|
||||||
if (type == "image2d_t" && qual == "read_only")
|
if (type == "image1d_t" || type == "image2d_t" || type == "image3d_t") {
|
||||||
return module::argument::image2d_rd;
|
if (qual == "read_only")
|
||||||
else if (type == "image2d_t" && qual == "write_only")
|
return module::argument::image_rd;
|
||||||
return module::argument::image2d_wr;
|
else if (qual == "write_only")
|
||||||
else if (type == "image3d_t" && qual == "read_only")
|
return module::argument::image_wr;
|
||||||
return module::argument::image3d_rd;
|
}
|
||||||
else if (type == "image3d_t" && qual == "write_only")
|
|
||||||
return module::argument::image3d_wr;
|
unreachable("Unsupported image type");
|
||||||
else
|
|
||||||
unreachable("Unknown image type");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module::arg_info create_arg_info(const std::string &arg_name,
|
module::arg_info create_arg_info(const std::string &arg_name,
|
||||||
|
@@ -90,17 +90,23 @@ namespace {
|
|||||||
enum module::argument::type
|
enum module::argument::type
|
||||||
convert_image_type(SpvId id, SpvDim dim, SpvAccessQualifier access,
|
convert_image_type(SpvId id, SpvDim dim, SpvAccessQualifier access,
|
||||||
std::string &err) {
|
std::string &err) {
|
||||||
if (dim == SpvDim2D && access == SpvAccessQualifierReadOnly)
|
switch (dim) {
|
||||||
return module::argument::image2d_rd;
|
case SpvDim1D:
|
||||||
else if (dim == SpvDim2D && access == SpvAccessQualifierWriteOnly)
|
case SpvDim2D:
|
||||||
return module::argument::image2d_wr;
|
case SpvDim3D:
|
||||||
else if (dim == SpvDim3D && access == SpvAccessQualifierReadOnly)
|
case SpvDimBuffer:
|
||||||
return module::argument::image3d_rd;
|
switch (access) {
|
||||||
else if (dim == SpvDim3D && access == SpvAccessQualifierWriteOnly)
|
case SpvAccessQualifierReadOnly:
|
||||||
return module::argument::image3d_wr;
|
return module::argument::image_rd;
|
||||||
else {
|
case SpvAccessQualifierWriteOnly:
|
||||||
err += "Unknown access qualifier " + std::to_string(access)
|
return module::argument::image_wr;
|
||||||
+ " or dimension " + std::to_string(dim) + " for image "
|
default:
|
||||||
|
err += "Unknown access qualifier " + std::to_string(access) + " for image "
|
||||||
|
+ std::to_string(id) + ".\n";
|
||||||
|
throw build_error();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
err += "Unknown dimension " + std::to_string(dim) + " for image "
|
||||||
+ std::to_string(id) + ".\n";
|
+ std::to_string(id) + ".\n";
|
||||||
throw build_error();
|
throw build_error();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user