diff --git a/src/toGLSLInstruction.cpp b/src/toGLSLInstruction.cpp index 1c1dee2..fe32c62 100644 --- a/src/toGLSLInstruction.cpp +++ b/src/toGLSLInstruction.cpp @@ -4315,7 +4315,7 @@ void ToGLSL::TranslateInstruction(Instruction* psInst, bool isEmbedded /* = fals { std::string vulkanSamplerName = GetVulkanDummySamplerName(); - const RESOURCE_DIMENSION eResDim = psContext->psShader->aeResourceDims[psInst->asOperands[2].ui32RegisterNumber]; + const RESOURCE_DIMENSION eResDim = psContext->psShader->aeResourceDims[psInst->asOperands[1].ui32RegisterNumber]; std::string smpType = GetSamplerType(psContext, eResDim, psInst->asOperands[2].ui32RegisterNumber); std::ostringstream oss; oss << smpType; diff --git a/src/toGLSLOperand.cpp b/src/toGLSLOperand.cpp index 4cb2f03..57a79a4 100644 --- a/src/toGLSLOperand.cpp +++ b/src/toGLSLOperand.cpp @@ -1164,7 +1164,7 @@ void ToGLSL::TranslateVariableNameWithMask(bstring glsl, const Operand* psOperan if (((psVarType->Class == SVC_MATRIX_COLUMNS) || (psVarType->Class == SVC_MATRIX_ROWS)) && (psVarType->Elements > 1) && ((psContext->flags & HLSLCC_FLAG_TRANSLATE_MATRICES) == 0)) { // Special handling for old matrix arrays - bformata(glsl, "%%s / 4%s", squareBrackets[squareBracketType][0], fullIndexOss.str().c_str(), squareBrackets[squareBracketType][1]); + bformata(glsl, "%s%s / 4%s", squareBrackets[squareBracketType][0], fullIndexOss.str().c_str(), squareBrackets[squareBracketType][1]); bformata(glsl, "%s%s %% 4%s", squareBrackets[squareBracketType][0], fullIndexOss.str().c_str(), squareBrackets[squareBracketType][1]); } else // This path is atm the default