2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-03-05 12:33:02 +00:00

fix: shader arg matrix row count

This commit is contained in:
Jan Laupetin
2026-03-01 01:27:52 +01:00
parent 400c6ca78a
commit dcd67adad4

View File

@@ -203,15 +203,14 @@ namespace
if (!maybeInfo) if (!maybeInfo)
return result::Unexpected<std::string>("Could not find info for code constant"); return result::Unexpected<std::string>("Could not find info for code constant");
const auto isMatrix = maybeInfo->transposedMatrix.has_value();
techset::CommonShaderArgCodeConstValue value{ techset::CommonShaderArgCodeConstValue value{
.m_index = 0, .m_index = 0,
.m_first_row = 0, .m_first_row = 0,
.m_row_count = 1, .m_row_count = isMatrix ? 4u : 1u,
}; };
// All matrices have a transposed version if (isMatrix)
// this checks whether this is a matrix
if (maybeInfo->transposedMatrix)
{ {
if (sourceIndex >= 4) if (sourceIndex >= 4)
return result::Unexpected(std::format("Index for matrix code const is out of bounds: {} (must be < 4)", sourceIndex)); return result::Unexpected(std::format("Index for matrix code const is out of bounds: {} (must be < 4)", sourceIndex));