Fix SPV type conversion for vec

This commit is contained in:
Josip Miskovic 2022-08-18 21:49:21 +02:00 committed by Bjorn
parent fcc684ac28
commit 6ba902ba1c
1 changed files with 5 additions and 5 deletions

View File

@ -462,10 +462,10 @@ static spv_result spv_parse_push_constants(spv_context* spv, const uint32_t* op,
}
if (OP_CODE(type) == 22 && type[2] == 32) { // OpTypeFloat
if (columnCount > 2 && columnCount < 4 && componentCount == columnCount) {
if (columnCount >= 2 && columnCount <= 4 && componentCount == columnCount) {
constant->type = SPV_MAT2 + columnCount - 2;
} else if (columnCount == 1 && componentCount > 2 && componentCount < 4) {
constant->type = SPV_F32x2 + columnCount - 2;
} else if (columnCount == 1 && componentCount >= 2 && componentCount <= 4) {
constant->type = SPV_F32x2 + componentCount - 2;
} else if (columnCount == 1 && componentCount == 1) {
constant->type = SPV_F32;
} else {
@ -473,7 +473,7 @@ static spv_result spv_parse_push_constants(spv_context* spv, const uint32_t* op,
}
} else if (OP_CODE(type) == 21 && type[2] == 32) { // OpTypeInteger
if (type[3] > 0) { // signed
if (columnCount == 1 && componentCount > 2 && componentCount < 4) {
if (columnCount == 1 && componentCount >= 2 && componentCount <= 4) {
constant->type = SPV_I32x2 + componentCount - 2;
} else if (columnCount == 1 && componentCount == 1) {
constant->type = SPV_I32;
@ -481,7 +481,7 @@ static spv_result spv_parse_push_constants(spv_context* spv, const uint32_t* op,
return SPV_UNSUPPORTED_PUSH_CONSTANT_TYPE;
}
} else {
if (columnCount == 1 && componentCount > 2 && componentCount < 4) {
if (columnCount == 1 && componentCount >= 2 && componentCount <= 4) {
constant->type = SPV_U32x2 + componentCount - 2;
} else if (columnCount == 1 && componentCount == 1) {
constant->type = SPV_U32;