sk_in array is now sized correctly in SPIR-V output
Bug: skia: Change-Id: Id63c8d79a7b60485d2f4071caca245c46691c9d3 Reviewed-on: https://skia-review.googlesource.com/95780 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
d8b01ad405
commit
b6ba82ca0a
@ -17,8 +17,6 @@
|
||||
|
||||
namespace SkSL {
|
||||
|
||||
#define SPIRV_DEBUG 0
|
||||
|
||||
static const int32_t SKSL_MAGIC = 0x0; // FIXME: we should probably register a magic number
|
||||
|
||||
void SPIRVCodeGenerator::setupIntrinsics() {
|
||||
@ -142,13 +140,7 @@ void SPIRVCodeGenerator::setupIntrinsics() {
|
||||
}
|
||||
|
||||
void SPIRVCodeGenerator::writeWord(int32_t word, OutputStream& out) {
|
||||
#if SPIRV_DEBUG
|
||||
out.write8('(');
|
||||
out.writeString(to_string(word));
|
||||
out.write8(')');
|
||||
#else
|
||||
out.write((const char*) &word, sizeof(word));
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool is_float(const Context& context, const Type& type) {
|
||||
@ -184,604 +176,8 @@ static bool is_out(const Variable& var) {
|
||||
return (var.fModifiers.fFlags & Modifiers::kOut_Flag) != 0;
|
||||
}
|
||||
|
||||
#if SPIRV_DEBUG
|
||||
static const char* opcode_text(SpvOp_ opCode) {
|
||||
switch (opCode) {
|
||||
case SpvOpNop:
|
||||
return String("Nop");
|
||||
case SpvOpUndef:
|
||||
return String("Undef");
|
||||
case SpvOpSourceContinued:
|
||||
return String("SourceContinued");
|
||||
case SpvOpSource:
|
||||
return String("Source");
|
||||
case SpvOpSourceExtension:
|
||||
return String("SourceExtension");
|
||||
case SpvOpName:
|
||||
return String("Name");
|
||||
case SpvOpMemberName:
|
||||
return String("MemberName");
|
||||
case SpvOpString:
|
||||
return String("String");
|
||||
case SpvOpLine:
|
||||
return String("Line");
|
||||
case SpvOpExtension:
|
||||
return String("Extension");
|
||||
case SpvOpExtInstImport:
|
||||
return String("ExtInstImport");
|
||||
case SpvOpExtInst:
|
||||
return String("ExtInst");
|
||||
case SpvOpMemoryModel:
|
||||
return String("MemoryModel");
|
||||
case SpvOpEntryPoint:
|
||||
return String("EntryPoint");
|
||||
case SpvOpExecutionMode:
|
||||
return String("ExecutionMode");
|
||||
case SpvOpCapability:
|
||||
return String("Capability");
|
||||
case SpvOpTypeVoid:
|
||||
return String("TypeVoid");
|
||||
case SpvOpTypeBool:
|
||||
return String("TypeBool");
|
||||
case SpvOpTypeInt:
|
||||
return String("TypeInt");
|
||||
case SpvOpTypeFloat:
|
||||
return String("TypeFloat");
|
||||
case SpvOpTypeVector:
|
||||
return String("TypeVector");
|
||||
case SpvOpTypeMatrix:
|
||||
return String("TypeMatrix");
|
||||
case SpvOpTypeImage:
|
||||
return String("TypeImage");
|
||||
case SpvOpTypeSampler:
|
||||
return String("TypeSampler");
|
||||
case SpvOpTypeSampledImage:
|
||||
return String("TypeSampledImage");
|
||||
case SpvOpTypeArray:
|
||||
return String("TypeArray");
|
||||
case SpvOpTypeRuntimeArray:
|
||||
return String("TypeRuntimeArray");
|
||||
case SpvOpTypeStruct:
|
||||
return String("TypeStruct");
|
||||
case SpvOpTypeOpaque:
|
||||
return String("TypeOpaque");
|
||||
case SpvOpTypePointer:
|
||||
return String("TypePointer");
|
||||
case SpvOpTypeFunction:
|
||||
return String("TypeFunction");
|
||||
case SpvOpTypeEvent:
|
||||
return String("TypeEvent");
|
||||
case SpvOpTypeDeviceEvent:
|
||||
return String("TypeDeviceEvent");
|
||||
case SpvOpTypeReserveId:
|
||||
return String("TypeReserveId");
|
||||
case SpvOpTypeQueue:
|
||||
return String("TypeQueue");
|
||||
case SpvOpTypePipe:
|
||||
return String("TypePipe");
|
||||
case SpvOpTypeForwardPointer:
|
||||
return String("TypeForwardPointer");
|
||||
case SpvOpConstantTrue:
|
||||
return String("ConstantTrue");
|
||||
case SpvOpConstantFalse:
|
||||
return String("ConstantFalse");
|
||||
case SpvOpConstant:
|
||||
return String("Constant");
|
||||
case SpvOpConstantComposite:
|
||||
return String("ConstantComposite");
|
||||
case SpvOpConstantSampler:
|
||||
return String("ConstantSampler");
|
||||
case SpvOpConstantNull:
|
||||
return String("ConstantNull");
|
||||
case SpvOpSpecConstantTrue:
|
||||
return String("SpecConstantTrue");
|
||||
case SpvOpSpecConstantFalse:
|
||||
return String("SpecConstantFalse");
|
||||
case SpvOpSpecConstant:
|
||||
return String("SpecConstant");
|
||||
case SpvOpSpecConstantComposite:
|
||||
return String("SpecConstantComposite");
|
||||
case SpvOpSpecConstantOp:
|
||||
return String("SpecConstantOp");
|
||||
case SpvOpFunction:
|
||||
return String("Function");
|
||||
case SpvOpFunctionParameter:
|
||||
return String("FunctionParameter");
|
||||
case SpvOpFunctionEnd:
|
||||
return String("FunctionEnd");
|
||||
case SpvOpFunctionCall:
|
||||
return String("FunctionCall");
|
||||
case SpvOpVariable:
|
||||
return String("Variable");
|
||||
case SpvOpImageTexelPointer:
|
||||
return String("ImageTexelPointer");
|
||||
case SpvOpLoad:
|
||||
return String("Load");
|
||||
case SpvOpStore:
|
||||
return String("Store");
|
||||
case SpvOpCopyMemory:
|
||||
return String("CopyMemory");
|
||||
case SpvOpCopyMemorySized:
|
||||
return String("CopyMemorySized");
|
||||
case SpvOpAccessChain:
|
||||
return String("AccessChain");
|
||||
case SpvOpInBoundsAccessChain:
|
||||
return String("InBoundsAccessChain");
|
||||
case SpvOpPtrAccessChain:
|
||||
return String("PtrAccessChain");
|
||||
case SpvOpArrayLength:
|
||||
return String("ArrayLength");
|
||||
case SpvOpGenericPtrMemSemantics:
|
||||
return String("GenericPtrMemSemantics");
|
||||
case SpvOpInBoundsPtrAccessChain:
|
||||
return String("InBoundsPtrAccessChain");
|
||||
case SpvOpDecorate:
|
||||
return String("Decorate");
|
||||
case SpvOpMemberDecorate:
|
||||
return String("MemberDecorate");
|
||||
case SpvOpDecorationGroup:
|
||||
return String("DecorationGroup");
|
||||
case SpvOpGroupDecorate:
|
||||
return String("GroupDecorate");
|
||||
case SpvOpGroupMemberDecorate:
|
||||
return String("GroupMemberDecorate");
|
||||
case SpvOpVectorExtractDynamic:
|
||||
return String("VectorExtractDynamic");
|
||||
case SpvOpVectorInsertDynamic:
|
||||
return String("VectorInsertDynamic");
|
||||
case SpvOpVectorShuffle:
|
||||
return String("VectorShuffle");
|
||||
case SpvOpCompositeConstruct:
|
||||
return String("CompositeConstruct");
|
||||
case SpvOpCompositeExtract:
|
||||
return String("CompositeExtract");
|
||||
case SpvOpCompositeInsert:
|
||||
return String("CompositeInsert");
|
||||
case SpvOpCopyObject:
|
||||
return String("CopyObject");
|
||||
case SpvOpTranspose:
|
||||
return String("Transpose");
|
||||
case SpvOpSampledImage:
|
||||
return String("SampledImage");
|
||||
case SpvOpImageSampleImplicitLod:
|
||||
return String("ImageSampleImplicitLod");
|
||||
case SpvOpImageSampleExplicitLod:
|
||||
return String("ImageSampleExplicitLod");
|
||||
case SpvOpImageSampleDrefImplicitLod:
|
||||
return String("ImageSampleDrefImplicitLod");
|
||||
case SpvOpImageSampleDrefExplicitLod:
|
||||
return String("ImageSampleDrefExplicitLod");
|
||||
case SpvOpImageSampleProjImplicitLod:
|
||||
return String("ImageSampleProjImplicitLod");
|
||||
case SpvOpImageSampleProjExplicitLod:
|
||||
return String("ImageSampleProjExplicitLod");
|
||||
case SpvOpImageSampleProjDrefImplicitLod:
|
||||
return String("ImageSampleProjDrefImplicitLod");
|
||||
case SpvOpImageSampleProjDrefExplicitLod:
|
||||
return String("ImageSampleProjDrefExplicitLod");
|
||||
case SpvOpImageFetch:
|
||||
return String("ImageFetch");
|
||||
case SpvOpImageGather:
|
||||
return String("ImageGather");
|
||||
case SpvOpImageDrefGather:
|
||||
return String("ImageDrefGather");
|
||||
case SpvOpImageRead:
|
||||
return String("ImageRead");
|
||||
case SpvOpImageWrite:
|
||||
return String("ImageWrite");
|
||||
case SpvOpImage:
|
||||
return String("Image");
|
||||
case SpvOpImageQueryFormat:
|
||||
return String("ImageQueryFormat");
|
||||
case SpvOpImageQueryOrder:
|
||||
return String("ImageQueryOrder");
|
||||
case SpvOpImageQuerySizeLod:
|
||||
return String("ImageQuerySizeLod");
|
||||
case SpvOpImageQuerySize:
|
||||
return String("ImageQuerySize");
|
||||
case SpvOpImageQueryLod:
|
||||
return String("ImageQueryLod");
|
||||
case SpvOpImageQueryLevels:
|
||||
return String("ImageQueryLevels");
|
||||
case SpvOpImageQuerySamples:
|
||||
return String("ImageQuerySamples");
|
||||
case SpvOpConvertFToU:
|
||||
return String("ConvertFToU");
|
||||
case SpvOpConvertFToS:
|
||||
return String("ConvertFToS");
|
||||
case SpvOpConvertSToF:
|
||||
return String("ConvertSToF");
|
||||
case SpvOpConvertUToF:
|
||||
return String("ConvertUToF");
|
||||
case SpvOpUConvert:
|
||||
return String("UConvert");
|
||||
case SpvOpSConvert:
|
||||
return String("SConvert");
|
||||
case SpvOpFConvert:
|
||||
return String("FConvert");
|
||||
case SpvOpQuantizeToF16:
|
||||
return String("QuantizeToF16");
|
||||
case SpvOpConvertPtrToU:
|
||||
return String("ConvertPtrToU");
|
||||
case SpvOpSatConvertSToU:
|
||||
return String("SatConvertSToU");
|
||||
case SpvOpSatConvertUToS:
|
||||
return String("SatConvertUToS");
|
||||
case SpvOpConvertUToPtr:
|
||||
return String("ConvertUToPtr");
|
||||
case SpvOpPtrCastToGeneric:
|
||||
return String("PtrCastToGeneric");
|
||||
case SpvOpGenericCastToPtr:
|
||||
return String("GenericCastToPtr");
|
||||
case SpvOpGenericCastToPtrExplicit:
|
||||
return String("GenericCastToPtrExplicit");
|
||||
case SpvOpBitcast:
|
||||
return String("Bitcast");
|
||||
case SpvOpSNegate:
|
||||
return String("SNegate");
|
||||
case SpvOpFNegate:
|
||||
return String("FNegate");
|
||||
case SpvOpIAdd:
|
||||
return String("IAdd");
|
||||
case SpvOpFAdd:
|
||||
return String("FAdd");
|
||||
case SpvOpISub:
|
||||
return String("ISub");
|
||||
case SpvOpFSub:
|
||||
return String("FSub");
|
||||
case SpvOpIMul:
|
||||
return String("IMul");
|
||||
case SpvOpFMul:
|
||||
return String("FMul");
|
||||
case SpvOpUDiv:
|
||||
return String("UDiv");
|
||||
case SpvOpSDiv:
|
||||
return String("SDiv");
|
||||
case SpvOpFDiv:
|
||||
return String("FDiv");
|
||||
case SpvOpUMod:
|
||||
return String("UMod");
|
||||
case SpvOpSRem:
|
||||
return String("SRem");
|
||||
case SpvOpSMod:
|
||||
return String("SMod");
|
||||
case SpvOpFRem:
|
||||
return String("FRem");
|
||||
case SpvOpFMod:
|
||||
return String("FMod");
|
||||
case SpvOpVectorTimesScalar:
|
||||
return String("VectorTimesScalar");
|
||||
case SpvOpMatrixTimesScalar:
|
||||
return String("MatrixTimesScalar");
|
||||
case SpvOpVectorTimesMatrix:
|
||||
return String("VectorTimesMatrix");
|
||||
case SpvOpMatrixTimesVector:
|
||||
return String("MatrixTimesVector");
|
||||
case SpvOpMatrixTimesMatrix:
|
||||
return String("MatrixTimesMatrix");
|
||||
case SpvOpOuterProduct:
|
||||
return String("OuterProduct");
|
||||
case SpvOpDot:
|
||||
return String("Dot");
|
||||
case SpvOpIAddCarry:
|
||||
return String("IAddCarry");
|
||||
case SpvOpISubBorrow:
|
||||
return String("ISubBorrow");
|
||||
case SpvOpUMulExtended:
|
||||
return String("UMulExtended");
|
||||
case SpvOpSMulExtended:
|
||||
return String("SMulExtended");
|
||||
case SpvOpAny:
|
||||
return String("Any");
|
||||
case SpvOpAll:
|
||||
return String("All");
|
||||
case SpvOpIsNan:
|
||||
return String("IsNan");
|
||||
case SpvOpIsInf:
|
||||
return String("IsInf");
|
||||
case SpvOpIsFinite:
|
||||
return String("IsFinite");
|
||||
case SpvOpIsNormal:
|
||||
return String("IsNormal");
|
||||
case SpvOpSignBitSet:
|
||||
return String("SignBitSet");
|
||||
case SpvOpLessOrGreater:
|
||||
return String("LessOrGreater");
|
||||
case SpvOpOrdered:
|
||||
return String("Ordered");
|
||||
case SpvOpUnordered:
|
||||
return String("Unordered");
|
||||
case SpvOpLogicalEqual:
|
||||
return String("LogicalEqual");
|
||||
case SpvOpLogicalNotEqual:
|
||||
return String("LogicalNotEqual");
|
||||
case SpvOpLogicalOr:
|
||||
return String("LogicalOr");
|
||||
case SpvOpLogicalAnd:
|
||||
return String("LogicalAnd");
|
||||
case SpvOpLogicalNot:
|
||||
return String("LogicalNot");
|
||||
case SpvOpSelect:
|
||||
return String("Select");
|
||||
case SpvOpIEqual:
|
||||
return String("IEqual");
|
||||
case SpvOpINotEqual:
|
||||
return String("INotEqual");
|
||||
case SpvOpUGreaterThan:
|
||||
return String("UGreaterThan");
|
||||
case SpvOpSGreaterThan:
|
||||
return String("SGreaterThan");
|
||||
case SpvOpUGreaterThanEqual:
|
||||
return String("UGreaterThanEqual");
|
||||
case SpvOpSGreaterThanEqual:
|
||||
return String("SGreaterThanEqual");
|
||||
case SpvOpULessThan:
|
||||
return String("ULessThan");
|
||||
case SpvOpSLessThan:
|
||||
return String("SLessThan");
|
||||
case SpvOpULessThanEqual:
|
||||
return String("ULessThanEqual");
|
||||
case SpvOpSLessThanEqual:
|
||||
return String("SLessThanEqual");
|
||||
case SpvOpFOrdEqual:
|
||||
return String("FOrdEqual");
|
||||
case SpvOpFUnordEqual:
|
||||
return String("FUnordEqual");
|
||||
case SpvOpFOrdNotEqual:
|
||||
return String("FOrdNotEqual");
|
||||
case SpvOpFUnordNotEqual:
|
||||
return String("FUnordNotEqual");
|
||||
case SpvOpFOrdLessThan:
|
||||
return String("FOrdLessThan");
|
||||
case SpvOpFUnordLessThan:
|
||||
return String("FUnordLessThan");
|
||||
case SpvOpFOrdGreaterThan:
|
||||
return String("FOrdGreaterThan");
|
||||
case SpvOpFUnordGreaterThan:
|
||||
return String("FUnordGreaterThan");
|
||||
case SpvOpFOrdLessThanEqual:
|
||||
return String("FOrdLessThanEqual");
|
||||
case SpvOpFUnordLessThanEqual:
|
||||
return String("FUnordLessThanEqual");
|
||||
case SpvOpFOrdGreaterThanEqual:
|
||||
return String("FOrdGreaterThanEqual");
|
||||
case SpvOpFUnordGreaterThanEqual:
|
||||
return String("FUnordGreaterThanEqual");
|
||||
case SpvOpShiftRightLogical:
|
||||
return String("ShiftRightLogical");
|
||||
case SpvOpShiftRightArithmetic:
|
||||
return String("ShiftRightArithmetic");
|
||||
case SpvOpShiftLeftLogical:
|
||||
return String("ShiftLeftLogical");
|
||||
case SpvOpBitwiseOr:
|
||||
return String("BitwiseOr");
|
||||
case SpvOpBitwiseXor:
|
||||
return String("BitwiseXor");
|
||||
case SpvOpBitwiseAnd:
|
||||
return String("BitwiseAnd");
|
||||
case SpvOpNot:
|
||||
return String("Not");
|
||||
case SpvOpBitFieldInsert:
|
||||
return String("BitFieldInsert");
|
||||
case SpvOpBitFieldSExtract:
|
||||
return String("BitFieldSExtract");
|
||||
case SpvOpBitFieldUExtract:
|
||||
return String("BitFieldUExtract");
|
||||
case SpvOpBitReverse:
|
||||
return String("BitReverse");
|
||||
case SpvOpBitCount:
|
||||
return String("BitCount");
|
||||
case SpvOpDPdx:
|
||||
return String("DPdx");
|
||||
case SpvOpDPdy:
|
||||
return String("DPdy");
|
||||
case SpvOpFwidth:
|
||||
return String("Fwidth");
|
||||
case SpvOpDPdxFine:
|
||||
return String("DPdxFine");
|
||||
case SpvOpDPdyFine:
|
||||
return String("DPdyFine");
|
||||
case SpvOpFwidthFine:
|
||||
return String("FwidthFine");
|
||||
case SpvOpDPdxCoarse:
|
||||
return String("DPdxCoarse");
|
||||
case SpvOpDPdyCoarse:
|
||||
return String("DPdyCoarse");
|
||||
case SpvOpFwidthCoarse:
|
||||
return String("FwidthCoarse");
|
||||
case SpvOpEmitVertex:
|
||||
return String("EmitVertex");
|
||||
case SpvOpEndPrimitive:
|
||||
return String("EndPrimitive");
|
||||
case SpvOpEmitStreamVertex:
|
||||
return String("EmitStreamVertex");
|
||||
case SpvOpEndStreamPrimitive:
|
||||
return String("EndStreamPrimitive");
|
||||
case SpvOpControlBarrier:
|
||||
return String("ControlBarrier");
|
||||
case SpvOpMemoryBarrier:
|
||||
return String("MemoryBarrier");
|
||||
case SpvOpAtomicLoad:
|
||||
return String("AtomicLoad");
|
||||
case SpvOpAtomicStore:
|
||||
return String("AtomicStore");
|
||||
case SpvOpAtomicExchange:
|
||||
return String("AtomicExchange");
|
||||
case SpvOpAtomicCompareExchange:
|
||||
return String("AtomicCompareExchange");
|
||||
case SpvOpAtomicCompareExchangeWeak:
|
||||
return String("AtomicCompareExchangeWeak");
|
||||
case SpvOpAtomicIIncrement:
|
||||
return String("AtomicIIncrement");
|
||||
case SpvOpAtomicIDecrement:
|
||||
return String("AtomicIDecrement");
|
||||
case SpvOpAtomicIAdd:
|
||||
return String("AtomicIAdd");
|
||||
case SpvOpAtomicISub:
|
||||
return String("AtomicISub");
|
||||
case SpvOpAtomicSMin:
|
||||
return String("AtomicSMin");
|
||||
case SpvOpAtomicUMin:
|
||||
return String("AtomicUMin");
|
||||
case SpvOpAtomicSMax:
|
||||
return String("AtomicSMax");
|
||||
case SpvOpAtomicUMax:
|
||||
return String("AtomicUMax");
|
||||
case SpvOpAtomicAnd:
|
||||
return String("AtomicAnd");
|
||||
case SpvOpAtomicOr:
|
||||
return String("AtomicOr");
|
||||
case SpvOpAtomicXor:
|
||||
return String("AtomicXor");
|
||||
case SpvOpPhi:
|
||||
return String("Phi");
|
||||
case SpvOpLoopMerge:
|
||||
return String("LoopMerge");
|
||||
case SpvOpSelectionMerge:
|
||||
return String("SelectionMerge");
|
||||
case SpvOpLabel:
|
||||
return String("Label");
|
||||
case SpvOpBranch:
|
||||
return String("Branch");
|
||||
case SpvOpBranchConditional:
|
||||
return String("BranchConditional");
|
||||
case SpvOpSwitch:
|
||||
return String("Switch");
|
||||
case SpvOpKill:
|
||||
return String("Kill");
|
||||
case SpvOpReturn:
|
||||
return String("Return");
|
||||
case SpvOpReturnValue:
|
||||
return String("ReturnValue");
|
||||
case SpvOpUnreachable:
|
||||
return String("Unreachable");
|
||||
case SpvOpLifetimeStart:
|
||||
return String("LifetimeStart");
|
||||
case SpvOpLifetimeStop:
|
||||
return String("LifetimeStop");
|
||||
case SpvOpGroupAsyncCopy:
|
||||
return String("GroupAsyncCopy");
|
||||
case SpvOpGroupWaitEvents:
|
||||
return String("GroupWaitEvents");
|
||||
case SpvOpGroupAll:
|
||||
return String("GroupAll");
|
||||
case SpvOpGroupAny:
|
||||
return String("GroupAny");
|
||||
case SpvOpGroupBroadcast:
|
||||
return String("GroupBroadcast");
|
||||
case SpvOpGroupIAdd:
|
||||
return String("GroupIAdd");
|
||||
case SpvOpGroupFAdd:
|
||||
return String("GroupFAdd");
|
||||
case SpvOpGroupFMin:
|
||||
return String("GroupFMin");
|
||||
case SpvOpGroupUMin:
|
||||
return String("GroupUMin");
|
||||
case SpvOpGroupSMin:
|
||||
return String("GroupSMin");
|
||||
case SpvOpGroupFMax:
|
||||
return String("GroupFMax");
|
||||
case SpvOpGroupUMax:
|
||||
return String("GroupUMax");
|
||||
case SpvOpGroupSMax:
|
||||
return String("GroupSMax");
|
||||
case SpvOpReadPipe:
|
||||
return String("ReadPipe");
|
||||
case SpvOpWritePipe:
|
||||
return String("WritePipe");
|
||||
case SpvOpReservedReadPipe:
|
||||
return String("ReservedReadPipe");
|
||||
case SpvOpReservedWritePipe:
|
||||
return String("ReservedWritePipe");
|
||||
case SpvOpReserveReadPipePackets:
|
||||
return String("ReserveReadPipePackets");
|
||||
case SpvOpReserveWritePipePackets:
|
||||
return String("ReserveWritePipePackets");
|
||||
case SpvOpCommitReadPipe:
|
||||
return String("CommitReadPipe");
|
||||
case SpvOpCommitWritePipe:
|
||||
return String("CommitWritePipe");
|
||||
case SpvOpIsValidReserveId:
|
||||
return String("IsValidReserveId");
|
||||
case SpvOpGetNumPipePackets:
|
||||
return String("GetNumPipePackets");
|
||||
case SpvOpGetMaxPipePackets:
|
||||
return String("GetMaxPipePackets");
|
||||
case SpvOpGroupReserveReadPipePackets:
|
||||
return String("GroupReserveReadPipePackets");
|
||||
case SpvOpGroupReserveWritePipePackets:
|
||||
return String("GroupReserveWritePipePackets");
|
||||
case SpvOpGroupCommitReadPipe:
|
||||
return String("GroupCommitReadPipe");
|
||||
case SpvOpGroupCommitWritePipe:
|
||||
return String("GroupCommitWritePipe");
|
||||
case SpvOpEnqueueMarker:
|
||||
return String("EnqueueMarker");
|
||||
case SpvOpEnqueueKernel:
|
||||
return String("EnqueueKernel");
|
||||
case SpvOpGetKernelNDrangeSubGroupCount:
|
||||
return String("GetKernelNDrangeSubGroupCount");
|
||||
case SpvOpGetKernelNDrangeMaxSubGroupSize:
|
||||
return String("GetKernelNDrangeMaxSubGroupSize");
|
||||
case SpvOpGetKernelWorkGroupSize:
|
||||
return String("GetKernelWorkGroupSize");
|
||||
case SpvOpGetKernelPreferredWorkGroupSizeMultiple:
|
||||
return String("GetKernelPreferredWorkGroupSizeMultiple");
|
||||
case SpvOpRetainEvent:
|
||||
return String("RetainEvent");
|
||||
case SpvOpReleaseEvent:
|
||||
return String("ReleaseEvent");
|
||||
case SpvOpCreateUserEvent:
|
||||
return String("CreateUserEvent");
|
||||
case SpvOpIsValidEvent:
|
||||
return String("IsValidEvent");
|
||||
case SpvOpSetUserEventStatus:
|
||||
return String("SetUserEventStatus");
|
||||
case SpvOpCaptureEventProfilingInfo:
|
||||
return String("CaptureEventProfilingInfo");
|
||||
case SpvOpGetDefaultQueue:
|
||||
return String("GetDefaultQueue");
|
||||
case SpvOpBuildNDRange:
|
||||
return String("BuildNDRange");
|
||||
case SpvOpImageSparseSampleImplicitLod:
|
||||
return String("ImageSparseSampleImplicitLod");
|
||||
case SpvOpImageSparseSampleExplicitLod:
|
||||
return String("ImageSparseSampleExplicitLod");
|
||||
case SpvOpImageSparseSampleDrefImplicitLod:
|
||||
return String("ImageSparseSampleDrefImplicitLod");
|
||||
case SpvOpImageSparseSampleDrefExplicitLod:
|
||||
return String("ImageSparseSampleDrefExplicitLod");
|
||||
case SpvOpImageSparseSampleProjImplicitLod:
|
||||
return String("ImageSparseSampleProjImplicitLod");
|
||||
case SpvOpImageSparseSampleProjExplicitLod:
|
||||
return String("ImageSparseSampleProjExplicitLod");
|
||||
case SpvOpImageSparseSampleProjDrefImplicitLod:
|
||||
return String("ImageSparseSampleProjDrefImplicitLod");
|
||||
case SpvOpImageSparseSampleProjDrefExplicitLod:
|
||||
return String("ImageSparseSampleProjDrefExplicitLod");
|
||||
case SpvOpImageSparseFetch:
|
||||
return String("ImageSparseFetch");
|
||||
case SpvOpImageSparseGather:
|
||||
return String("ImageSparseGather");
|
||||
case SpvOpImageSparseDrefGather:
|
||||
return String("ImageSparseDrefGather");
|
||||
case SpvOpImageSparseTexelsResident:
|
||||
return String("ImageSparseTexelsResident");
|
||||
case SpvOpNoLine:
|
||||
return String("NoLine");
|
||||
case SpvOpAtomicFlagTestAndSet:
|
||||
return String("AtomicFlagTestAndSet");
|
||||
case SpvOpAtomicFlagClear:
|
||||
return String("AtomicFlagClear");
|
||||
case SpvOpImageSparseRead:
|
||||
return String("ImageSparseRead");
|
||||
default:
|
||||
ABORT("unsupported SPIR-V op");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void SPIRVCodeGenerator::writeOpCode(SpvOp_ opCode, int length, OutputStream& out) {
|
||||
ASSERT(opCode != SpvOpLoad || &out != &fConstantBuffer);
|
||||
ASSERT(opCode != SpvOpUndef);
|
||||
switch (opCode) {
|
||||
case SpvOpReturn: // fall through
|
||||
@ -828,12 +224,7 @@ void SPIRVCodeGenerator::writeOpCode(SpvOp_ opCode, int length, OutputStream& ou
|
||||
default:
|
||||
ASSERT(fCurrentBlock);
|
||||
}
|
||||
#if SPIRV_DEBUG
|
||||
out.write8('\n');
|
||||
out.writeText(opcode_text(opCode));
|
||||
#else
|
||||
this->writeWord((length << 16) | opCode, out);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SPIRVCodeGenerator::writeLabel(SpvId label, OutputStream& out) {
|
||||
@ -3333,16 +2724,47 @@ void SPIRVCodeGenerator::writeInstructions(const Program& program, OutputStream&
|
||||
fGLSLExtendedInstructions = this->nextId();
|
||||
StringStream body;
|
||||
std::set<SpvId> interfaceVars;
|
||||
// assign IDs to functions
|
||||
// assign IDs to functions, determine sk_in size
|
||||
int skInSize = -1;
|
||||
for (size_t i = 0; i < program.fElements.size(); i++) {
|
||||
if (program.fElements[i]->fKind == ProgramElement::kFunction_Kind) {
|
||||
FunctionDefinition& f = (FunctionDefinition&) *program.fElements[i];
|
||||
fFunctionMap[&f.fDeclaration] = this->nextId();
|
||||
switch (program.fElements[i]->fKind) {
|
||||
case ProgramElement::kFunction_Kind: {
|
||||
FunctionDefinition& f = (FunctionDefinition&) *program.fElements[i];
|
||||
fFunctionMap[&f.fDeclaration] = this->nextId();
|
||||
break;
|
||||
}
|
||||
case ProgramElement::kModifiers_Kind: {
|
||||
Modifiers& m = ((ModifiersDeclaration&) *program.fElements[i]).fModifiers;
|
||||
if (m.fFlags & Modifiers::kIn_Flag) {
|
||||
switch (m.fLayout.fPrimitive) {
|
||||
case Layout::kPoints_Primitive: // break
|
||||
case Layout::kLines_Primitive:
|
||||
skInSize = 1;
|
||||
break;
|
||||
case Layout::kLinesAdjacency_Primitive: // break
|
||||
skInSize = 2;
|
||||
break;
|
||||
case Layout::kTriangles_Primitive: // break
|
||||
case Layout::kTrianglesAdjacency_Primitive:
|
||||
skInSize = 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < program.fElements.size(); i++) {
|
||||
if (program.fElements[i]->fKind == ProgramElement::kInterfaceBlock_Kind) {
|
||||
InterfaceBlock& intf = (InterfaceBlock&) *program.fElements[i];
|
||||
if (SK_IN_BUILTIN == intf.fVariable.fModifiers.fLayout.fBuiltin) {
|
||||
ASSERT(skInSize != -1);
|
||||
intf.fSizes.emplace_back(new IntLiteral(fContext, -1, skInSize));
|
||||
}
|
||||
SpvId id = this->writeInterfaceBlock(intf);
|
||||
if ((intf.fVariable.fModifiers.fFlags & Modifiers::kIn_Flag) ||
|
||||
(intf.fVariable.fModifiers.fFlags & Modifiers::kOut_Flag)) {
|
||||
|
@ -61,7 +61,7 @@ struct InterfaceBlock : public ProgramElement {
|
||||
const Variable& fVariable;
|
||||
const String fTypeName;
|
||||
const String fInstanceName;
|
||||
const std::vector<std::unique_ptr<Expression>> fSizes;
|
||||
std::vector<std::unique_ptr<Expression>> fSizes;
|
||||
const std::shared_ptr<SymbolTable> fTypeOwner;
|
||||
|
||||
typedef ProgramElement INHERITED;
|
||||
|
@ -5,13 +5,13 @@ STRINGIFY(
|
||||
layout(builtin=10002) in sk_PerVertex {
|
||||
layout(builtin=0) float4 sk_Position;
|
||||
layout(builtin=1) float sk_PointSize;
|
||||
layout(builtin=3) float sk_ClipDistance[];
|
||||
layout(builtin=3) float sk_ClipDistance[1];
|
||||
} sk_in[];
|
||||
|
||||
out sk_PerVertex {
|
||||
layout(builtin=0) float4 sk_Position;
|
||||
layout(builtin=1) float sk_PointSize;
|
||||
layout(builtin=3) float sk_ClipDistance[];
|
||||
layout(builtin=3) float sk_ClipDistance[1];
|
||||
};
|
||||
|
||||
layout(builtin=8) int sk_InvocationID;
|
||||
|
Loading…
Reference in New Issue
Block a user