Lines Matching refs:Shader
21 #include "libGLESv2/Shader.h"
215 sw::PixelShader *Shader::getPixelShader() const
220 sw::VertexShader *Shader::getVertexShader() const
305 OutputASM::OutputASM(TParseContext &context, Shader *shaderObject) : TIntermTraverser(true, true, true), shaderObject(shaderObject), mContext(context)
307 shader = 0;
313 shader = shaderObject->getShader();
329 if(shader)
335 Instruction *callMain = emit(sw::Shader::OPCODE_CALL);
336 callMain->dst.type = sw::Shader::PARAMETER_LABEL;
339 emit(sw::Shader::OPCODE_RET);
358 sw::Shader::Opcode OutputASM::getOpcode(sw::Shader::Opcode op, TIntermTyped *in) const
364 case sw::Shader::OPCODE_NEG:
369 return sw::Shader::OPCODE_INEG;
374 case sw::Shader::OPCODE_ABS:
378 return sw::Shader::OPCODE_IABS;
383 case sw::Shader::OPCODE_SGN:
387 return sw::Shader::OPCODE_ISGN;
392 case sw::Shader::OPCODE_ADD:
397 return sw::Shader::OPCODE_IADD;
402 case sw::Shader::OPCODE_SUB:
407 return sw::Shader::OPCODE_ISUB;
412 case sw::Shader::OPCODE_MUL:
417 return sw::Shader::OPCODE_IMUL;
422 case sw::Shader::OPCODE_DIV:
426 return sw::Shader::OPCODE_IDIV;
428 return sw::Shader::OPCODE_UDIV;
433 case sw::Shader::OPCODE_IMOD:
434 return baseType == EbtUInt ? sw::Shader::OPCODE_UMOD : op;
435 case sw::Shader::OPCODE_ISHR:
436 return baseType == EbtUInt ? sw::Shader::OPCODE_USHR : op;
437 case sw::Shader::OPCODE_MIN:
441 return sw::Shader::OPCODE_IMIN;
443 return sw::Shader::OPCODE_UMIN;
448 case sw::Shader::OPCODE_MAX:
452 return sw::Shader::OPCODE_IMAX;
454 return sw::Shader::OPCODE_UMAX;
479 // are considered active, even if they are not referenced in any shader in the program.
526 emit(sw::Shader::OPCODE_MUL, result, i, left, i, right);
539 Instruction *dot = emit(sw::Shader::OPCODE_DP(size), result, 0, left, 0, right, i);
553 Instruction *mul = emit(sw::Shader::OPCODE_MUL, result, i, left, 0, right, i);
558 Instruction *mad = emit(sw::Shader::OPCODE_MAD, result, i, left, j, right, i, result, i);
594 Instruction *mov = emit(sw::Shader::OPCODE_MOV, result, 0, left, srcIndex);
611 Instruction *mov = emit(sw::Shader::OPCODE_MOV, result, index, left, index);
616 sw::Shader::SourceParameter relativeRegister;
628 emit(sw::Shader::OPCODE_EXTRACT, result, left, right);
679 Instruction *mov = emit(sw::Shader::OPCODE_MOV, result, left);
683 case EOpAddAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_ADD, result), result, left, left, right); break;
684 case EOpAdd: if(visit == PostVisit) emitBinary(getOpcode(sw::Shader::OPCODE_ADD, result), result, left, right); break;
685 case EOpSubAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_SUB, result), result, left, left, right); break;
686 case EOpSub: if(visit == PostVisit) emitBinary(getOpcode(sw::Shader::OPCODE_SUB, result), result, left, right); break;
687 case EOpMulAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_MUL, result), result, left, left, right); break;
688 case EOpMul: if(visit == PostVisit) emitBinary(getOpcode(sw::Shader::OPCODE_MUL, result), result, left, right); break;
689 case EOpDivAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_DIV, result), result, left, left, right); break;
690 case EOpDiv: if(visit == PostVisit) emitBinary(getOpcode(sw::Shader::OPCODE_DIV, result), result, left, right); break;
691 case EOpIModAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_IMOD, result), result, left, left, right); break;
692 case EOpIMod: if(visit == PostVisit) emitBinary(getOpcode(sw::Shader::OPCODE_IMOD, result), result, left, right); break;
693 case EOpBitShiftLeftAssign: if(visit == PostVisit) emitAssign(sw::Shader::OPCODE_SHL, result, left, left, right); break;
694 case EOpBitShiftLeft: if(visit == PostVisit) emitBinary(sw::Shader::OPCODE_SHL, result, left, right); break;
695 case EOpBitShiftRightAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_ISHR, result), result, left, left, right); break;
696 case EOpBitShiftRight: if(visit == PostVisit) emitBinary(getOpcode(sw::Shader::OPCODE_ISHR, result), result, left, right); break;
697 case EOpBitwiseAndAssign: if(visit == PostVisit) emitAssign(sw::Shader::OPCODE_AND, result, left, left, right); break;
698 case EOpBitwiseAnd: if(visit == PostVisit) emitBinary(sw::Shader::OPCODE_AND, result, left, right); break;
699 case EOpBitwiseXorAssign: if(visit == PostVisit) emitAssign(sw::Shader::OPCODE_XOR, result, left, left, right); break;
700 case EOpBitwiseXor: if(visit == PostVisit) emitBinary(sw::Shader::OPCODE_XOR, result, left, right); break;
701 case EOpBitwiseOrAssign: if(visit == PostVisit) emitAssign(sw::Shader::OPCODE_OR, result, left, left, right); break;
702 case EOpBitwiseOr: if(visit == PostVisit) emitBinary(sw::Shader::OPCODE_OR, result, left, right); break;
706 emitBinary(sw::Shader::OPCODE_EQ, result, left, right);
711 emit(sw::Shader::OPCODE_EQ, &equal, 0, left, index, right, index);
712 emit(sw::Shader::OPCODE_AND, result, result, &equal);
719 emitBinary(sw::Shader::OPCODE_NE, result, left, right);
724 emit(sw::Shader::OPCODE_NE, ¬Equal, 0, left, index, right, index);
725 emit(sw::Shader::OPCODE_OR, result, result, ¬Equal);
729 case EOpLessThan: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_LT, result, left, right); break;
730 case EOpGreaterThan: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_GT, result, left, right); break;
731 case EOpLessThanEqual: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_LE, result, left, right); break;
732 case EOpGreaterThanEqual: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_GE, result, left, right); break;
733 case EOpVectorTimesScalarAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_MUL, left), result, left, left, right); break;
734 case EOpVectorTimesScalar: if(visit == PostVisit) emit(getOpcode(sw::Shader::OPCODE_MUL, left), result, left, right); break;
742 emit(sw::Shader::OPCODE_MUL, result, i, left, i, right, 0);
749 emit(sw::Shader::OPCODE_MUL, result, i, left, 0, right, i);
758 sw::Shader::Opcode dpOpcode = sw::Shader::OPCODE_DP(leftType.getNominalSize());
771 Instruction *mul = emit(sw::Shader::OPCODE_MUL, result, left, right);
777 Instruction *mad = emit(sw::Shader::OPCODE_MAD, result, 0, left, i, right, 0, result);
790 Instruction *mul = emit(sw::Shader::OPCODE_MUL, result, i, left, 0, right, i);
795 Instruction *mad = emit(sw::Shader::OPCODE_MAD, result, i, left, j, right, i, result, i);
806 emit(sw::Shader::OPCODE_OR, result, left, right);
813 emit(sw::Shader::OPCODE_MOV, result, left);
814 Instruction *ifnot = emit(sw::Shader::OPCODE_IF, 0, result);
815 ifnot->src[0].modifier = sw::Shader::MODIFIER_NOT;
819 emit(sw::Shader::OPCODE_MOV, result, right);
820 emit(sw::Shader::OPCODE_ENDIF);
824 case EOpLogicalXor: if(visit == PostVisit) emit(sw::Shader::OPCODE_XOR, result, left, right); break;
830 emit(sw::Shader::OPCODE_AND, result, left, right);
837 emit(sw::Shader::OPCODE_MOV, result, left);
838 emit(sw::Shader::OPCODE_IF, 0, result);
842 emit(sw::Shader::OPCODE_MOV, result, right);
843 emit(sw::Shader::OPCODE_ENDIF);
861 sw::Shader::Opcode op = isMov ? sw::Shader::OPCODE_MOV : sw::Shader::OPCODE_NEG;
876 Instruction *det = emit(sw::Shader::OPCODE_DET2, result, outCol, arg, negate ? col1 : col0, arg, negate ? col0 : col1);
891 Instruction *det = emit(sw::Shader::OPCODE_DET3, result, outCol, arg, col0, arg, negate ? col2 : col1, arg, negate ? col1 : col2);
898 Instruction *det = emit(sw::Shader::OPCODE_DET4, result, outCol, arg, 0, arg, 1, arg, 2, arg, 3);
943 sw::Shader::Opcode negOpcode = getOpcode(sw::Shader::OPCODE_NEG, arg);
950 case EOpVectorLogicalNot: if(visit == PostVisit) emit(sw::Shader::OPCODE_NOT, result, arg); break;
951 case EOpLogicalNot: if(visit == PostVisit) emit(sw::Shader::OPCODE_NOT, result, arg); break;
957 sw::Shader::Opcode addOpcode = getOpcode(sw::Shader::OPCODE_ADD, arg);
971 sw::Shader::Opcode subOpcode = getOpcode(sw::Shader::OPCODE_SUB, arg);
983 sw::Shader::Opcode addOpcode = getOpcode(sw::Shader::OPCODE_ADD, arg);
995 sw::Shader::Opcode subOpcode = getOpcode(sw::Shader::OPCODE_SUB, arg);
1004 case EOpRadians: if(visit == PostVisit) emit(sw::Shader::OPCODE_MUL, result, arg, &rad); break;
1005 case EOpDegrees: if(visit == PostVisit) emit(sw::Shader::OPCODE_MUL, result, arg, °); break;
1006 case EOpSin: if(visit == PostVisit) emit(sw::Shader::OPCODE_SIN, result, arg); break;
1007 case EOpCos: if(visit == PostVisit) emit(sw::Shader::OPCODE_COS, result, arg); break;
1008 case EOpTan: if(visit == PostVisit) emit(sw::Shader::OPCODE_TAN, result, arg); break;
1009 case EOpAsin: if(visit == PostVisit) emit(sw::Shader::OPCODE_ASIN, result, arg); break;
1010 case EOpAcos: if(visit == PostVisit) emit(sw::Shader::OPCODE_ACOS, result, arg); break;
1011 case EOpAtan: if(visit == PostVisit) emit(sw::Shader::OPCODE_ATAN, result, arg); break;
1012 case EOpSinh: if(visit == PostVisit) emit(sw::Shader::OPCODE_SINH, result, arg); break;
1013 case EOpCosh: if(visit == PostVisit) emit(sw::Shader::OPCODE_COSH, result, arg); break;
1014 case EOpTanh: if(visit == PostVisit) emit(sw::Shader::OPCODE_TANH, result, arg); break;
1015 case EOpAsinh: if(visit == PostVisit) emit(sw::Shader::OPCODE_ASINH, result, arg); break;
1016 case EOpAcosh: if(visit == PostVisit) emit(sw::Shader::OPCODE_ACOSH, result, arg); break;
1017 case EOpAtanh: if(visit == PostVisit) emit(sw::Shader::OPCODE_ATANH, result, arg); break;
1018 case EOpExp: if(visit == PostVisit) emit(sw::Shader::OPCODE_EXP, result, arg); break;
1019 case EOpLog: if(visit == PostVisit) emit(sw::Shader::OPCODE_LOG, result, arg); break;
1020 case EOpExp2: if(visit == PostVisit) emit(sw::Shader::OPCODE_EXP2, result, arg); break;
1021 case EOpLog2: if(visit == PostVisit) emit(sw::Shader::OPCODE_LOG2, result, arg); break;
1022 case EOpSqrt: if(visit == PostVisit) emit(sw::Shader::OPCODE_SQRT, result, arg); break;
1023 case EOpInverseSqrt: if(visit == PostVisit) emit(sw::Shader::OPCODE_RSQ, result, arg); break;
1024 case EOpAbs: if(visit == PostVisit) emit(getOpcode(sw::Shader::OPCODE_ABS, result), result, arg); break;
1025 case EOpSign: if(visit == PostVisit) emit(getOpcode(sw::Shader::OPCODE_SGN, result), result, arg); break;
1026 case EOpFloor: if(visit == PostVisit) emit(sw::Shader::OPCODE_FLOOR, result, arg); break;
1027 case EOpTrunc: if(visit == PostVisit) emit(sw::Shader::OPCODE_TRUNC, result, arg); break;
1028 case EOpRound: if(visit == PostVisit) emit(sw::Shader::OPCODE_ROUND, result, arg); break;
1029 case EOpRoundEven: if(visit == PostVisit) emit(sw::Shader::OPCODE_ROUNDEVEN, result, arg); break;
1030 case EOpCeil: if(visit == PostVisit) emit(sw::Shader::OPCODE_CEIL, result, arg, result); break;
1031 case EOpFract: if(visit == PostVisit) emit(sw::Shader::OPCODE_FRC, result, arg); break;
1032 case EOpIsNan: if(visit == PostVisit) emit(sw::Shader::OPCODE_ISNAN, result, arg); break;
1033 case EOpIsInf: if(visit == PostVisit) emit(sw::Shader::OPCODE_ISINF, result, arg); break;
1034 case EOpLength: if(visit == PostVisit) emit(sw::Shader::OPCODE_LEN(dim(arg)), result, arg); break;
1035 case EOpNormalize: if(visit == PostVisit) emit(sw::Shader::OPCODE_NRM(dim(arg)), result, arg); break;
1036 case EOpDFdx: if(visit == PostVisit) emit(sw::Shader::OPCODE_DFDX, result, arg); break;
1037 case EOpDFdy: if(visit == PostVisit) emit(sw::Shader::OPCODE_DFDY, result, arg); break;
1038 case EOpFwidth: if(visit == PostVisit) emit(sw::Shader::OPCODE_FWIDTH, result, arg); break;
1039 case EOpAny: if(visit == PostVisit) emit(sw::Shader::OPCODE_ANY, result, arg); break;
1040 case EOpAll: if(visit == PostVisit) emit(sw::Shader::OPCODE_ALL, result, arg); break;
1041 case EOpFloatBitsToInt: if(visit == PostVisit) emit(sw::Shader::OPCODE_FLOATBITSTOINT, result, arg); break;
1042 case EOpFloatBitsToUint: if(visit == PostVisit) emit(sw::Shader::OPCODE_FLOATBITSTOUINT, result, arg); break;
1043 case EOpIntBitsToFloat: if(visit == PostVisit) emit(sw::Shader::OPCODE_INTBITSTOFLOAT, result, arg); break;
1044 case EOpUintBitsToFloat: if(visit == PostVisit) emit(sw::Shader::OPCODE_UINTBITSTOFLOAT, result, arg); break;
1045 case EOpPackSnorm2x16: if(visit == PostVisit) emit(sw::Shader::OPCODE_PACKSNORM2x16, result, arg); break;
1046 case EOpPackUnorm2x16: if(visit == PostVisit) emit(sw::Shader
1047 case EOpPackHalf2x16: if(visit == PostVisit) emit(sw::Shader::OPCODE_PACKHALF2x16, result, arg); break;
1048 case EOpUnpackSnorm2x16: if(visit == PostVisit) emit(sw::Shader::OPCODE_UNPACKSNORM2x16, result, arg); break;
1049 case EOpUnpackUnorm2x16: if(visit == PostVisit) emit(sw::Shader::OPCODE_UNPACKUNORM2x16, result, arg); break;
1050 case EOpUnpackHalf2x16: if(visit == PostVisit) emit(sw::Shader::OPCODE_UNPACKHALF2x16, result, arg); break;
1060 Instruction *mov = emit(sw::Shader::OPCODE_MOV, result, j, arg, i);
1097 Instruction *div = emit(sw::Shader::OPCODE_DIV, &invDet, &one, &invDet);
1103 emit(sw::Shader::OPCODE_MUL, result, i, result, i, &invDet);
1148 Instruction *label = emit(sw::Shader::OPCODE_LABEL);
1149 label->dst.type = sw::Shader::PARAMETER_LABEL;
1175 emit(sw::Shader::OPCODE_RET);
1210 Instruction *call = emit(sw::Shader::OPCODE_CALL);
1211 call->dst.type = sw::Shader::PARAMETER_LABEL;
1248 emit(sw::Shader::OPCODE_MOV, &coord, &projCoord);
1252 Instruction *rcp = emit(sw::Shader::OPCODE_RCPX, &coord, arg[1]);
1256 Instruction *mul = emit(sw::Shader::OPCODE_MUL, &coord, arg[1], &coord);
1262 emit(sw::Shader::OPCODE_MOV, &coord, arg[1]);
1273 Instruction *tex = emit(textureFunction.offset ? sw::Shader::OPCODE_TEXOFFSET : sw::Shader::OPCODE_TEX,
1278 Instruction *bias = emit(sw::Shader::OPCODE_MOV, &coord, arg[textureFunction.offset ? 3 : 2]);
1281 Instruction *tex = emit(textureFunction.offset ? sw::Shader::OPCODE_TEXOFFSET : sw::Shader::OPCODE_TEX,
1290 Instruction *lod = emit(sw::Shader::OPCODE_MOV, &coord, arg[2]);
1293 emit(textureFunction.offset ? sw::Shader::OPCODE_TEXLDLOFFSET : sw::Shader::OPCODE_TEXLDL,
1303 emit(textureFunction.offset ? sw::Shader::OPCODE_TEXELFETCHOFFSET : sw::Shader::OPCODE_TEXELFETCH,
1315 emit(textureFunction.offset ? sw::Shader::OPCODE_TEXGRADOFFSET : sw::Shader::OPCODE_TEXGRAD,
1322 emit(sw::Shader::OPCODE_TEXSIZE, result, arg[1], arg[0]);
1401 Instruction *init = emit(sw::Shader::OPCODE_MOV, result, i, &zero);
1465 Instruction *mov = emit(sw::Shader::OPCODE_MOV, result, index + offset, argi, index);
1473 case EOpLessThan: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_LT, result, arg[0], arg[1]); break;
1474 case EOpGreaterThan: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_GT, result, arg[0], arg[1]); break;
1475 case EOpLessThanEqual: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_LE, result, arg[0], arg[1]); break;
1476 case EOpGreaterThanEqual: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_GE, result, arg[0], arg[1]); break;
1477 case EOpVectorEqual: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_EQ, result, arg[0], arg[1]); break;
1478 case EOpVectorNotEqual: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_NE, result, arg[0], arg[1]); break;
1479 case EOpMod: if(visit == PostVisit) emit(sw::Shader::OPCODE_MOD, result, arg[0], arg[1]); break;
1484 emit(sw::Shader::OPCODE_TRUNC, arg1, arg[0]);
1486 emitBinary(sw::Shader::OPCODE_SUB, result, arg[0], arg1);
1489 case EOpPow: if(visit == PostVisit) emit(sw::Shader::OPCODE_POW, result, arg[0], arg[1]); break;
1490 case EOpAtan: if(visit == PostVisit) emit(sw::Shader::OPCODE_ATAN2, result, arg[0], arg[1]); break;
1491 case EOpMin: if(visit == PostVisit) emit(getOpcode(sw::Shader::OPCODE_MIN, result), result, arg[0], arg[1]); break;
1492 case EOpMax: if(visit == PostVisit) emit(getOpcode(sw::Shader::OPCODE_MAX, result), result, arg[0], arg[1]); break;
1496 emit(getOpcode(sw::Shader::OPCODE_MAX, result), result, arg[0], arg[1]);
1497 emit(getOpcode(sw::Shader::OPCODE_MIN, result), result, result, arg[2]);
1500 case EOpMix: if(visit == PostVisit) emit(sw::Shader::OPCODE_LRP, result, arg[2], arg[1], arg[0]); break;
1501 case EOpStep: if(visit == PostVisit) emit(sw::Shader::OPCODE_STEP, result, arg[0], arg[1]); break;
1502 case EOpSmoothStep: if(visit == PostVisit) emit(sw::Shader::OPCODE_SMOOTH, result, arg[0], arg[1], arg[2]); break;
1503 case EOpDistance: if(visit == PostVisit) emit(sw::Shader::OPCODE_DIST(dim(arg[0])), result, arg[0], arg[1]); break;
1504 case EOpDot: if(visit == PostVisit) emit(sw::Shader::OPCODE_DP(dim(arg[0])), result, arg[0], arg[1]); break;
1505 case EOpCross: if(visit == PostVisit) emit(sw::Shader::OPCODE_CRS, result, arg[0], arg[1]); break;
1506 case EOpFaceForward: if(visit == PostVisit) emit(sw::Shader::OPCODE_FORWARD(dim(arg[0])), result, arg[0], arg[1], arg[2]); break;
1507 case EOpReflect: if(visit == PostVisit) emit(sw::Shader::OPCODE_REFLECT(dim(arg[0])), result, arg[0], arg[1]); break;
1508 case EOpRefract: if(visit == PostVisit) emit(sw::Shader::OPCODE_REFRACT(dim(arg[0])), result, arg[0], arg[1], arg[2]); break;
1519 emit(sw::Shader::OPCODE_MUL, result, i, arg[0], i, arg[1], i);
1528 Instruction *mul = emit(sw::Shader::OPCODE_MUL, result, i, arg[0], 0, arg[1]);
1574 emit(sw::Shader::OPCODE_SELECT, node, condition, trueBlock, falseBlock);
1578 emit(sw::Shader::OPCODE_IF, 0, condition);
1588 emit(sw::Shader::OPCODE_ELSE);
1593 emit(sw::Shader::OPCODE_ENDIF);
1619 emit(sw::Shader::OPCODE_IF, 0, condition);
1628 emit(sw::Shader::OPCODE_ELSE);
1632 emit(sw::Shader::OPCODE_ENDIF);
1670 emit(sw::Shader::OPCODE_MOV, &iterate, &True);
1672 emit(sw::Shader::OPCODE_WHILE, 0, &iterate); // FIXME: Implement real do-while
1679 emit(sw::Shader::OPCODE_TEST);
1682 emit(sw::Shader::OPCODE_MOV, &iterate, condition);
1684 emit(sw::Shader::OPCODE_ENDWHILE);
1721 emit(sw::Shader::OPCODE_WHILE, 0, condition);
1728 emit(sw::Shader::OPCODE_TEST);
1740 emit(sw::Shader::OPCODE_ENDWHILE);
1756 case EOpKill: if(visit == PostVisit) emit(sw::Shader::OPCODE_DISCARD); break;
1757 case EOpBreak: if(visit == PostVisit) emit(sw::Shader::OPCODE_BREAK); break;
1758 case EOpContinue: if(visit == PostVisit) emit(sw::Shader::OPCODE_CONTINUE); break;
1769 emit(sw::Shader::OPCODE_LEAVE);
1795 emit(sw::Shader::OPCODE_SWITCH);
1813 emit(sw::Shader::OPCODE_ELSE);
1818 emitBinary(sw::Shader::OPCODE_EQ, &result, switchValue, condition);
1819 emit(sw::Shader::OPCODE_IF, 0, &result);
1841 emit(sw::Shader::OPCODE_ELSE);
1854 emit(sw::Shader::OPCODE_ENDIF);
1857 emit(sw::Shader::OPCODE_ENDSWITCH);
1862 Instruction *OutputASM::emit(sw::Shader::Opcode op, TIntermTyped *dst, TIntermNode *src0, TIntermNode *src1, TIntermNode *src2, TIntermNode *src3, TIntermNode *src4)
1867 Instruction *OutputASM::emit(sw::Shader::Opcode op, TIntermTyped *dst, int dstIndex, TIntermNode *src0, int index0, TIntermNode *src1, int index1,
1886 shader->append(instruction);
1903 case EbtInt: return emit(sw::Shader::OPCODE_B2I, dst, dstIndex, src, srcIndex);
1904 case EbtUInt: return emit(sw::Shader::OPCODE_B2I, dst, dstIndex, src, srcIndex);
1905 case EbtFloat: return emit(sw::Shader::OPCODE_B2F, dst, dstIndex, src, srcIndex);
1912 case EbtBool: return emit(sw::Shader::OPCODE_I2B, dst, dstIndex, src, srcIndex);
1913 case EbtFloat: return emit(sw::Shader::OPCODE_I2F, dst, dstIndex, src, srcIndex);
1920 case EbtBool: return emit(sw::Shader::OPCODE_I2B, dst, dstIndex, src, srcIndex);
1921 case EbtFloat: return emit(sw::Shader::OPCODE_U2F, dst, dstIndex, src, srcIndex);
1928 case EbtBool: return emit(sw::Shader::OPCODE_F2B, dst, dstIndex, src, srcIndex);
1929 case EbtInt: return emit(sw::Shader::OPCODE_F2I, dst, dstIndex, src, srcIndex);
1930 case EbtUInt: return emit(sw::Shader::OPCODE_F2U, dst, dstIndex, src, srcIndex);
1942 return emit(sw::Shader::OPCODE_MOV, dst, dstIndex, src, srcIndex);
1945 void OutputASM::emitBinary(sw::Shader::Opcode op, TIntermTyped *dst, TIntermNode *src0, TIntermNode *src1, TIntermNode *src2)
1953 void OutputASM::emitAssign(sw::Shader::Opcode op, TIntermTyped *result, TIntermTyped *lhs, TIntermTyped *src0, TIntermTyped *src1)
1959 void OutputASM::emitCmp(sw::Shader::Control cmpOp, TIntermTyped *dst, TIntermNode *left, TIntermNode *right, int index)
1961 sw::Shader::Opcode opcode;
1966 opcode = sw::Shader::OPCODE_ICMP;
1969 opcode = sw::Shader::OPCODE_UCMP;
1972 opcode = sw::Shader::OPCODE_CMP;
2158 void OutputASM::argument(sw::Shader::SourceParameter ¶meter, TIntermNode *argument, int index)
2178 Instruction *instruction = new Instruction(sw::Shader::OPCODE_I2B);
2179 instruction->dst.type = sw::Shader::PARAMETER_TEMP;
2181 instruction->src[0].type = sw::Shader::PARAMETER_CONST;
2185 shader->append(instruction);
2206 Instruction *instruction = new Instruction(sw::Shader::OPCODE_MOV);
2207 instruction->dst.type = sw::Shader::PARAMETER_TEMP;
2210 instruction->src[0].type = sw::Shader::PARAMETER_CONST;
2215 shader->append(instruction);
2274 Instruction *mov = emit(sw::Shader::OPCODE_MOV, dst, index, src, offset + index);
2305 Instruction *insert = new Instruction(sw::Shader::OPCODE_INSERT);
2316 shader->append(insert);
2322 Instruction *mov = new Instruction(sw::Shader::OPCODE_MOV);
2336 shader->append(mov);
2341 int OutputASM::lvalue(sw::Shader::DestinationParameter &dst, Temporary &address, TIntermTyped *node)
2393 if(dst.rel.type == sw::Shader::PARAMETER_VOID) // Use the index register as the relative address directly
2397 sw::Shader::SourceParameter relativeRegister;
2411 Instruction *mad = emit(sw::Shader::OPCODE_IMAD, &address, &address, &oldScale, right);
2418 Instruction *mul = emit(sw::Shader::OPCODE_IMUL, &address, &address, &oldScale);
2423 emit(sw::Shader::OPCODE_IMAD, &address, right, &newScale, &address);
2426 dst.rel.type = sw::Shader::PARAMETER_TEMP;
2434 emit(sw::Shader::OPCODE_IADD, &address, &address, right);
2439 emit(sw::Shader::OPCODE_IMAD, &address, right, &newScale, &address);
2508 sw::Shader::ParameterType OutputASM::registerType(TIntermTyped *operand)
2512 return sw::Shader::PARAMETER_SAMPLER;
2528 return sw::Shader::PARAMETER_TEMP;
2533 case EvqTemporary: return sw::Shader::PARAMETER_TEMP;
2534 case EvqGlobal: return sw::Shader::PARAMETER_TEMP;
2535 case EvqConstExpr: return sw::Shader::PARAMETER_FLOAT4LITERAL; // All converted to float
2536 case EvqAttribute: return sw::Shader::PARAMETER_INPUT;
2537 case EvqVaryingIn: return sw::Shader::PARAMETER_INPUT;
2538 case EvqVaryingOut: return sw::Shader::PARAMETER_OUTPUT;
2539 case EvqVertexIn: return sw::Shader::PARAMETER_INPUT;
2540 case EvqFragmentOut: return sw::Shader::PARAMETER_COLOROUT;
2541 case EvqVertexOut: return sw::Shader::PARAMETER_OUTPUT;
2542 case EvqFragmentIn: return sw::Shader::PARAMETER_INPUT;
2543 case EvqInvariantVaryingIn: return sw::Shader::PARAMETER_INPUT; // FIXME: Guarantee invariance at the backend
2544 case EvqInvariantVaryingOut: return sw::Shader::PARAMETER_OUTPUT; // FIXME: Guarantee invariance at the backend
2545 case EvqSmooth: return sw::Shader::PARAMETER_OUTPUT;
2546 case EvqFlat: return sw::Shader::PARAMETER_OUTPUT;
2547 case EvqCentroidOut: return sw::Shader::PARAMETER_OUTPUT;
2548 case EvqSmoothIn: return sw::Shader::PARAMETER_INPUT;
2549 case EvqFlatIn: return sw::Shader::PARAMETER_INPUT;
2550 case EvqCentroidIn: return sw::Shader::PARAMETER_INPUT;
2551 case EvqUniform: return sw::Shader::PARAMETER_CONST;
2552 case EvqIn: return sw::Shader::PARAMETER_TEMP;
2553 case EvqOut: return sw::Shader::PARAMETER_TEMP;
2554 case EvqInOut: return sw::Shader::PARAMETER_TEMP;
2555 case EvqConstReadOnly: return sw::Shader::PARAMETER_TEMP;
2556 case EvqPosition: return sw::Shader::PARAMETER_OUTPUT;
2557 case EvqPointSize: return sw::Shader::PARAMETER_OUTPUT;
2558 case EvqInstanceID: return sw::Shader::PARAMETER_MISCTYPE;
2559 case EvqFragCoord: return sw::Shader::PARAMETER_MISCTYPE;
2560 case EvqFrontFacing: return sw::Shader::PARAMETER_MISCTYPE;
2561 case EvqPointCoord: return sw::Shader::PARAMETER_INPUT;
2562 case EvqFragColor: return sw::Shader::PARAMETER_COLOROUT;
2563 case EvqFragData: return sw::Shader::PARAMETER_COLOROUT;
2564 case EvqFragDepth: return sw::Shader::PARAMETER_DEPTHOUT;
2568 return sw::Shader::PARAMETER_VOID;
2765 mContext.error(varying->getLine(), "Varyings packing failed: Too many varyings", "fragment shader");
2772 if(componentCount >= 1) pixelShader->semantic[var][0] = sw::Shader::Semantic(sw::Shader::USAGE_TEXCOORD, var);
2773 if(componentCount >= 2) pixelShader->semantic[var][1] = sw::Shader::Semantic(sw::Shader::USAGE_TEXCOORD, var);
2774 if(componentCount >= 3) pixelShader->semantic[var][2] = sw::Shader::Semantic(sw::Shader::USAGE_TEXCOORD, var);
2775 if(componentCount >= 4) pixelShader->semantic[var][3] = sw::Shader::Semantic(sw::Shader::USAGE_TEXCOORD, var);
2781 if(componentCount >= 1) pixelShader->semantic[var + i][0] = sw::Shader::Semantic(sw::Shader::USAGE_COLOR, var + i);
2782 if(componentCount >= 2) pixelShader->semantic[var + i][1] = sw::Shader::Semantic(sw::Shader::USAGE_COLOR, var + i);
2783 if(componentCount >= 3) pixelShader->semantic[var + i][2] = sw::Shader::Semantic(sw::Shader::USAGE_COLOR, var + i);
2784 if(componentCount >= 4) pixelShader->semantic[var + i][3] = sw::Shader::Semantic(sw::Shader::USAGE_COLOR, var + i);
2792 mContext.error(varying->getLine(), "Varyings packing failed: Too many varyings", "vertex shader");
2799 vertexShader->output[var][0] = sw::Shader::Semantic(sw::Shader::USAGE_POSITION, 0);
2800 vertexShader->output[var][1] = sw::Shader::Semantic(sw::Shader::USAGE_POSITION, 0);
2801 vertexShader->output[var][2] = sw::Shader::Semantic(sw::Shader::USAGE_POSITION, 0);
2802 vertexShader->output[var][3] = sw::Shader::Semantic(sw::Shader::USAGE_POSITION, 0);
2808 vertexShader->output[var][0] = sw::Shader::Semantic(sw::Shader::USAGE_PSIZE, 0);
2809 vertexShader->output[var][1] = sw::Shader::Semantic(sw::Shader::USAGE_PSIZE, 0);
2810 vertexShader->output[var][2] = sw::Shader::Semantic(sw::Shader::USAGE_PSIZE, 0);
2811 vertexShader->output[var][3] = sw::Shader::Semantic(sw::Shader::USAGE_PSIZE, 0);
2816 // Semantic indexes for user varyings will be assigned during program link to match the pixel shader
2915 vertexShader->input[index + i] = sw::Shader::Semantic(sw::Shader::USAGE_TEXCOORD, index + i);
3208 shader->declareSampler(fieldRegisterIndex + i);