gl_shader_decompiler: Fix implicit conversion errors

This commit is contained in:
ReinUsesLisp 2020-03-09 20:46:16 -03:00
parent 47459f6a36
commit 4bc4851d45

View file

@ -761,7 +761,7 @@ private:
} }
std::optional<std::size_t> GetNumComponents(Attribute::Index index, u8 element = 0) const { std::optional<std::size_t> GetNumComponents(Attribute::Index index, u8 element = 0) const {
const u8 location = static_cast<u8>(index) * 4 + element; const u8 location = static_cast<u8>(static_cast<u32>(index) * 4 + element);
const auto it = transform_feedback.find(location); const auto it = transform_feedback.find(location);
if (it == transform_feedback.end()) { if (it == transform_feedback.end()) {
return {}; return {};
@ -770,7 +770,7 @@ private:
} }
std::string GetTransformFeedbackDecoration(Attribute::Index index, u8 element = 0) const { std::string GetTransformFeedbackDecoration(Attribute::Index index, u8 element = 0) const {
const u8 location = static_cast<u8>(index) * 4 + element; const u8 location = static_cast<u8>(static_cast<u32>(index) * 4 + element);
const auto it = transform_feedback.find(location); const auto it = transform_feedback.find(location);
if (it == transform_feedback.end()) { if (it == transform_feedback.end()) {
return {}; return {};
@ -811,7 +811,7 @@ private:
code.AddLine("layout (location = {}, component = {}{}) out {} {};", location, element, code.AddLine("layout (location = {}, component = {}{}) out {} {};", location, element,
xfb, type, description.name); xfb, type, description.name);
element += static_cast<u8>(num_components); element = static_cast<u8>(static_cast<std::size_t>(element) + num_components);
} }
} }