Check size of name before testing for @count.
This commit is contained in:
parent
ec45c9efb3
commit
08b3c674a9
@ -824,7 +824,7 @@ void Compiler::set_name(uint32_t id, const std::string &name)
|
||||
// glslang uses identifiers to pass along meaningful information
|
||||
// about HLSL reflection.
|
||||
auto &m = meta.at(id);
|
||||
if (source.hlsl && name.find("@count") == name.size() - 6)
|
||||
if (source.hlsl && name.size() >= 6 && name.find("@count") == name.size() - 6)
|
||||
{
|
||||
m.hlsl_magic_counter_buffer_candidate = true;
|
||||
m.hlsl_magic_counter_buffer_name = name.substr(0, name.find("@count"));
|
||||
|
@ -69,6 +69,8 @@ string CompilerHLSL::image_type_hlsl_modern(const SPIRType &type)
|
||||
case DimSubpassData:
|
||||
// This should be implemented same way as desktop GL. Fetch on a 2D texture based on int2(SV_Position).
|
||||
SPIRV_CROSS_THROW("Subpass data support is not yet implemented for HLSL"); // TODO
|
||||
default:
|
||||
SPIRV_CROSS_THROW("Invalid dimension.");
|
||||
}
|
||||
uint32_t components = 4;
|
||||
const char *arrayed = type.image.arrayed ? "Array" : "";
|
||||
@ -1375,6 +1377,8 @@ void CompilerHLSL::emit_texture_op(const Instruction &i)
|
||||
case DimBuffer:
|
||||
case DimSubpassData:
|
||||
SPIRV_CROSS_THROW("Buffer texture support is not yet implemented for HLSL"); // TODO
|
||||
default:
|
||||
SPIRV_CROSS_THROW("Invalid dimension.");
|
||||
}
|
||||
|
||||
if (gather)
|
||||
|
Loading…
Reference in New Issue
Block a user