mirror of
https://github.com/KhronosGroup/SPIRV-Cross.git
synced 2024-11-14 16:01:07 +00:00
Move is_sampled_image_type() onto the Compiler class.
While I'm at it, don't use a bitwise op with a `bool` variable. Apparently, MSVC doesn't like that.
This commit is contained in:
parent
c11374c3cf
commit
8855ea0a3e
@ -1096,6 +1096,12 @@ const SPIRType &Compiler::get_non_pointer_type(uint32_t type_id) const
|
||||
return get_non_pointer_type(get<SPIRType>(type_id));
|
||||
}
|
||||
|
||||
bool Compiler::is_sampled_image_type(const SPIRType &type)
|
||||
{
|
||||
return (type.basetype == SPIRType::Image || type.basetype == SPIRType::SampledImage) &&
|
||||
type.image.sampled == 1 && type.image.dim != DimBuffer;
|
||||
}
|
||||
|
||||
void Compiler::set_member_decoration_string(uint32_t id, uint32_t index, spv::Decoration decoration,
|
||||
const std::string &argument)
|
||||
{
|
||||
|
@ -179,6 +179,9 @@ public:
|
||||
// Gets the SPIR-V type underlying the given type_id, which might be a pointer.
|
||||
const SPIRType &get_non_pointer_type(uint32_t type_id) const;
|
||||
|
||||
// Returns if the given type refers to a sampled image.
|
||||
bool is_sampled_image_type(const SPIRType &type);
|
||||
|
||||
// Gets the underlying storage class for an OpVariable.
|
||||
spv::StorageClass get_storage_class(uint32_t id) const;
|
||||
|
||||
|
@ -4685,7 +4685,8 @@ bool CompilerMSL::SampledImageScanner::handle(spv::Op opcode, const uint32_t *ar
|
||||
case OpImageSampleProjDrefImplicitLod:
|
||||
case OpImageFetch:
|
||||
case OpImageGather:
|
||||
compiler.has_sampled_images |= is_sampled_image_type(compiler.expression_type(args[2]));
|
||||
compiler.has_sampled_images = compiler.has_sampled_images ||
|
||||
compiler.is_sampled_image_type(compiler.expression_type(args[2]));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -4693,11 +4694,6 @@ bool CompilerMSL::SampledImageScanner::handle(spv::Op opcode, const uint32_t *ar
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CompilerMSL::SampledImageScanner::is_sampled_image_type(const SPIRType &type)
|
||||
{
|
||||
return type.image.sampled == 1 && type.image.dim != DimBuffer;
|
||||
}
|
||||
|
||||
bool CompilerMSL::OpCodePreprocessor::handle(Op opcode, const uint32_t *args, uint32_t length)
|
||||
{
|
||||
// Since MSL exists in a single execution scope, function prototype declarations are not
|
||||
|
@ -435,7 +435,6 @@ protected:
|
||||
}
|
||||
|
||||
bool handle(spv::Op opcode, const uint32_t *args, uint32_t) override;
|
||||
bool is_sampled_image_type(const SPIRType &type);
|
||||
|
||||
CompilerMSL &compiler;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user