Beispiel #1
0
        private IEmitVal MapBuiltinTypeFormat(MidBuiltinType type)
        {
            switch (type.Name)
            {
            case "int":
                return(InitBlock.Enum32("DXGI_FORMAT", "DXGI_FORMAT_R32_SINT", DXGI_FORMAT.DXGI_FORMAT_R32_SINT));

            case "float2":
                return(InitBlock.Enum32("DXGI_FORMAT", "DXGI_FORMAT_R32G32_FLOAT", DXGI_FORMAT.DXGI_FORMAT_R32G32_FLOAT));

            case "float3":
            case "Tangent":
                return(InitBlock.Enum32("DXGI_FORMAT", "DXGI_FORMAT_R32G32B32_FLOAT", DXGI_FORMAT.DXGI_FORMAT_R32G32B32_FLOAT));

            case "float4":
                return(InitBlock.Enum32("DXGI_FORMAT", "DXGI_FORMAT_R32G32B32A32_FLOAT", DXGI_FORMAT.DXGI_FORMAT_R32G32B32A32_FLOAT));

            case "ubyte4":
                return(InitBlock.Enum32("DXGI_FORMAT", "DXGI_FORMAT_R8G8B8A8_UINT", DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UINT));

            case "unorm4":
                return(InitBlock.Enum32("DXGI_FORMAT", "DXGI_FORMAT_R8G8B8A8_UNORM", DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM));

            default:
                throw new NotImplementedException();
            }
        }
Beispiel #2
0
        private SizeInfo GetSizeInfoImpl(MidBuiltinType type)
        {
            switch (type.Name)
            {
            case "ubyte4": return(new SizeInfo {
                    Size = 1 * 4, Align = 4
                });

            case "unorm4": return(new SizeInfo {
                    Size = 1 * 4, Align = 4
                });

            case "float2": return(new SizeInfo {
                    Size = 2 * 4, Align = 4
                });

            case "Tangent":
            case "float3": return(new SizeInfo {
                    Size = 3 * 4, Align = 4
                });

            case "float4": return(new SizeInfo {
                    Size = 4 * 4, Align = 4
                });

            default:
                throw new NotImplementedException();
            }
        }
Beispiel #3
0
 private IEmitType EmitTypeImpl(
     MidBuiltinType midType,
     EmitEnv env)
 {
     IEmitTerm[] args = null;
     if (midType.Args != null)
     {
         args = (from a in midType.Args
                 select EmitGenericArg(a, env)).ToArray();
     }
     return(Target.GetBuiltinType(
                midType.GetTemplate(Target.TargetName),
                args));
 }
Beispiel #4
0
        private AttributeInfo GenerateInputElementsImpl(
            SourceRange range,
            string name,
            MidBuiltinType type,
            int vertexStream,
            IndexSourceInfo index,
            UInt32 baseOffset,
            int inputSlotIndex)
        {
            var format = MapBuiltinTypeFormat(type);

            return(new InputElementInfo(range)
            {
                Name = name,
                Format = format,
                ByteOffset = baseOffset,
                Index = index,
                InputSlotIndex = inputSlotIndex,
            });
        }