Beispiel #1
0
        public static Scope Parse(WordReader reader, uint wordCount)
        {
            var id = (Enumerant)reader.ReadWord();

            switch (id)
            {
            case Enumerant.CrossDevice:
                return(CrossDeviceImpl.Parse(reader, wordCount - 1));

            case Enumerant.Device:
                return(DeviceImpl.Parse(reader, wordCount - 1));

            case Enumerant.Workgroup:
                return(WorkgroupImpl.Parse(reader, wordCount - 1));

            case Enumerant.Subgroup:
                return(SubgroupImpl.Parse(reader, wordCount - 1));

            case Enumerant.Invocation:
                return(InvocationImpl.Parse(reader, wordCount - 1));

            case Enumerant.QueueFamily:
                return(QueueFamilyImpl.Parse(reader, wordCount - 1));

            //QueueFamilyKHR has the same id as another value in enum.
            //case Enumerant.QueueFamilyKHR :
            //    return QueueFamilyKHR.Parse(reader, wordCount - 1);
            case Enumerant.ShaderCallKHR:
                return(ShaderCallKHRImpl.Parse(reader, wordCount - 1));

            default:
                throw new IndexOutOfRangeException("Unknown Scope " + id);
            }
        }
Beispiel #2
0
        public static StorageClass Parse(WordReader reader, uint wordCount)
        {
            var id = (Enumerant)reader.ReadWord();

            switch (id)
            {
            case Enumerant.UniformConstant:
                return(UniformConstantImpl.Parse(reader, wordCount - 1));

            case Enumerant.Input:
                return(InputImpl.Parse(reader, wordCount - 1));

            case Enumerant.Uniform:
                return(UniformImpl.Parse(reader, wordCount - 1));

            case Enumerant.Output:
                return(OutputImpl.Parse(reader, wordCount - 1));

            case Enumerant.Workgroup:
                return(WorkgroupImpl.Parse(reader, wordCount - 1));

            case Enumerant.CrossWorkgroup:
                return(CrossWorkgroupImpl.Parse(reader, wordCount - 1));

            case Enumerant.Private:
                return(PrivateImpl.Parse(reader, wordCount - 1));

            case Enumerant.Function:
                return(FunctionImpl.Parse(reader, wordCount - 1));

            case Enumerant.Generic:
                return(GenericImpl.Parse(reader, wordCount - 1));

            case Enumerant.PushConstant:
                return(PushConstantImpl.Parse(reader, wordCount - 1));

            case Enumerant.AtomicCounter:
                return(AtomicCounterImpl.Parse(reader, wordCount - 1));

            case Enumerant.Image:
                return(ImageImpl.Parse(reader, wordCount - 1));

            case Enumerant.StorageBuffer:
                return(StorageBufferImpl.Parse(reader, wordCount - 1));

            case Enumerant.CallableDataNV:
                return(CallableDataNVImpl.Parse(reader, wordCount - 1));

            //CallableDataKHR has the same id as another value in enum.
            //case Enumerant.CallableDataKHR :
            //    return CallableDataKHR.Parse(reader, wordCount - 1);
            case Enumerant.IncomingCallableDataNV:
                return(IncomingCallableDataNVImpl.Parse(reader, wordCount - 1));

            //IncomingCallableDataKHR has the same id as another value in enum.
            //case Enumerant.IncomingCallableDataKHR :
            //    return IncomingCallableDataKHR.Parse(reader, wordCount - 1);
            case Enumerant.RayPayloadNV:
                return(RayPayloadNVImpl.Parse(reader, wordCount - 1));

            //RayPayloadKHR has the same id as another value in enum.
            //case Enumerant.RayPayloadKHR :
            //    return RayPayloadKHR.Parse(reader, wordCount - 1);
            case Enumerant.HitAttributeNV:
                return(HitAttributeNVImpl.Parse(reader, wordCount - 1));

            //HitAttributeKHR has the same id as another value in enum.
            //case Enumerant.HitAttributeKHR :
            //    return HitAttributeKHR.Parse(reader, wordCount - 1);
            case Enumerant.IncomingRayPayloadNV:
                return(IncomingRayPayloadNVImpl.Parse(reader, wordCount - 1));

            //IncomingRayPayloadKHR has the same id as another value in enum.
            //case Enumerant.IncomingRayPayloadKHR :
            //    return IncomingRayPayloadKHR.Parse(reader, wordCount - 1);
            case Enumerant.ShaderRecordBufferNV:
                return(ShaderRecordBufferNVImpl.Parse(reader, wordCount - 1));

            //ShaderRecordBufferKHR has the same id as another value in enum.
            //case Enumerant.ShaderRecordBufferKHR :
            //    return ShaderRecordBufferKHR.Parse(reader, wordCount - 1);
            case Enumerant.PhysicalStorageBuffer:
                return(PhysicalStorageBufferImpl.Parse(reader, wordCount - 1));

            //PhysicalStorageBufferEXT has the same id as another value in enum.
            //case Enumerant.PhysicalStorageBufferEXT :
            //    return PhysicalStorageBufferEXT.Parse(reader, wordCount - 1);
            default:
                throw new IndexOutOfRangeException("Unknown StorageClass " + id);
            }
        }