Merge pull request #597 from KhronosGroup/fix-595-596-592

Various maintenance fixes.
This commit is contained in:
Hans-Kristian Arntzen 2018-06-03 12:22:25 +02:00 коммит произвёл GitHub
Родитель 0a83bacf3e 3a9b045dc3
Коммит 6fea07f2fd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 24 добавлений и 8 удалений

Просмотреть файл

@ -122,7 +122,7 @@ struct CLIParser
THROW("Tried to parse uint, but nothing left in arguments");
}
uint32_t val = stoul(*argv);
uint64_t val = stoul(*argv);
if (val > numeric_limits<uint32_t>::max())
{
THROW("next_uint() out of range");
@ -131,7 +131,7 @@ struct CLIParser
argc--;
argv++;
return val;
return uint32_t(val);
}
double next_double()
@ -212,7 +212,6 @@ static void print_resources(const Compiler &compiler, const char *tag, const vec
for (auto &res : resources)
{
auto &type = compiler.get_type(res.type_id);
auto &mask = compiler.get_decoration_bitset(res.id);
if (print_ssbo && compiler.buffer_is_hlsl_counter_buffer(res.id))
continue;
@ -231,6 +230,12 @@ static void print_resources(const Compiler &compiler, const char *tag, const vec
if (is_sized_block)
block_size = uint32_t(compiler.get_declared_struct_size(compiler.get_type(res.base_type_id)));
Bitset mask;
if (print_ssbo)
mask = compiler.get_buffer_block_flags(res.id);
else
mask = compiler.get_decoration_bitset(res.id);
string array;
for (auto arr : type.array)
array = join("[", arr ? convert_to_string(arr) : "", "]") + array;

Просмотреть файл

@ -4078,7 +4078,12 @@ void Compiler::analyze_variable_scope(SPIRFunction &entry)
}
}
Bitset Compiler::get_buffer_block_flags(const SPIRVariable &var)
Bitset Compiler::get_buffer_block_flags(uint32_t id) const
{
return get_buffer_block_flags(get<SPIRVariable>(id));
}
Bitset Compiler::get_buffer_block_flags(const SPIRVariable &var) const
{
auto &type = get<SPIRType>(var.basetype);
assert(type.basetype == SPIRType::Struct);

Просмотреть файл

@ -483,6 +483,12 @@ public:
// ID is the name of a variable as returned by Resource::id, and must be a variable with a Block-like type.
std::string get_remapped_declared_block_name(uint32_t id) const;
// For buffer block variables, get the decorations for that variable.
// Sometimes, decorations for buffer blocks are found in member decorations instead
// of direct decorations on the variable itself.
// The most common use here is to check if a buffer is readonly or writeonly.
Bitset get_buffer_block_flags(uint32_t id) const;
protected:
const uint32_t *stream(const Instruction &instr) const
{
@ -784,7 +790,7 @@ protected:
VariableTypeRemapCallback variable_remap_callback;
Bitset get_buffer_block_flags(const SPIRVariable &var);
Bitset get_buffer_block_flags(const SPIRVariable &var) const;
bool get_common_basic_type(const SPIRType &type, SPIRType::BaseType &base_type);
std::unordered_set<uint32_t> forced_temporaries;

Просмотреть файл

@ -1265,11 +1265,11 @@ string CompilerGLSL::layout_for_variable(const SPIRVariable &var)
if (flags.get(DecorationIndex))
attr.push_back(join("index = ", dec.index));
// set = 0 is the default. Do not emit set = decoration in regular GLSL output, but
// we should preserve it in Vulkan GLSL mode.
// Do not emit set = decoration in regular GLSL output, but
// we need to preserve it in Vulkan GLSL mode.
if (var.storage != StorageClassPushConstant)
{
if (flags.get(DecorationDescriptorSet) && (dec.set != 0 || options.vulkan_semantics))
if (flags.get(DecorationDescriptorSet) && options.vulkan_semantics)
attr.push_back(join("set = ", dec.set));
}