GPUShader: Rename createInfo storage Qualifiers
Using opt-in instead of opt-out to make code easier to read. Add combined flag enum. Making restrict an inverse flag option because it is so rare to use it.
This commit is contained in:
parent
9505af72d4
commit
f39ade9e00
|
@ -25,7 +25,7 @@
|
|||
|
||||
GPU_SHADER_CREATE_INFO(draw_hair_refine_compute)
|
||||
.local_group_size(1, 1)
|
||||
.storage_buf(0, Qualifier::WRITE_ONLY, "vec4", "posTime[]")
|
||||
.storage_buf(0, Qualifier::WRITE, "vec4", "posTime[]")
|
||||
.sampler(0, ImageType::FLOAT_BUFFER, "hairPointBuffer")
|
||||
.sampler(1, ImageType::UINT_BUFFER, "hairStrandBuffer")
|
||||
.sampler(2, ImageType::UINT_BUFFER, "hairStrandSegBuffer")
|
||||
|
|
|
@ -130,10 +130,13 @@ enum class ImageType {
|
|||
|
||||
/* Storage qualifiers. */
|
||||
enum class Qualifier {
|
||||
RESTRICT = (1 << 0),
|
||||
READ_ONLY = (1 << 1),
|
||||
WRITE_ONLY = (1 << 2),
|
||||
QUALIFIER_MAX = (WRITE_ONLY << 1) - 1,
|
||||
/** Restrict flag is set by default. Unless specified otherwise. */
|
||||
NO_RESTRICT = (1 << 0),
|
||||
READ = (1 << 1),
|
||||
WRITE = (1 << 2),
|
||||
/** Shorthand version of combined flags. */
|
||||
READ_WRITE = READ | WRITE,
|
||||
QUALIFIER_MAX = (WRITE << 1) - 1,
|
||||
};
|
||||
ENUM_OPERATORS(Qualifier, Qualifier::QUALIFIER_MAX);
|
||||
|
||||
|
|
|
@ -277,15 +277,15 @@ static void print_image_type(std::ostream &os,
|
|||
|
||||
static std::ostream &print_qualifier(std::ostream &os, const Qualifier &qualifiers)
|
||||
{
|
||||
if ((qualifiers & Qualifier::RESTRICT) == Qualifier::RESTRICT) {
|
||||
if (bool(qualifiers & Qualifier::NO_RESTRICT) == false) {
|
||||
os << "restrict ";
|
||||
}
|
||||
if ((qualifiers & Qualifier::READ_ONLY) == Qualifier::READ_ONLY) {
|
||||
os << "readonly ";
|
||||
}
|
||||
if ((qualifiers & Qualifier::WRITE_ONLY) == Qualifier::WRITE_ONLY) {
|
||||
if (bool(qualifiers & Qualifier::READ) == false) {
|
||||
os << "writeonly ";
|
||||
}
|
||||
if (bool(qualifiers & Qualifier::WRITE) == false) {
|
||||
os << "readonly ";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue