Exemplo n.º 1
0
        public CommonDeviceInterface(int adapter, OutputRequirements baseReq, OutputRequirements minReq,
                                     string base_path)
        {
            this.adapter     = adapter;
            this.outCaps     = OutputCaps.GetAdapterCaps(adapter, baseReq.DeviceType, baseReq.DeviceFormat);
            this.minSettings = OutputSettings.CreateFromRequirements(baseReq, outCaps, minReq);
            rzManager        = new NuGenSVisualLib.Resources.ResourceManager();
            rzManager.AddSet(new NuGenSVisualLib.Resources.ResourceSet(GlobalResources));

            log = new DirectFileLog(base_path + "general.log");

            rzLoader = new RzLoader();
            rzLoader.RegisterContentLoader(new ImageContentLoader());
        }
Exemplo n.º 2
0
        public RenderDeviceInfo(OutputSettings settings, OutputCaps caps)
        {
            InitializeComponent();

            // populate list
            AddItem("Adapter Desc", caps.AdapterDetails.Description);
            AddItem("Driver Name", caps.AdapterDetails.DriverName);
            AddItem("Driver Version", caps.AdapterDetails.DriverVersion.ToString());
            AddItem("T&L Support", caps.HardwareTnL.ToString());
            AddItem("Device Format", settings.DeviceFormat.ToString());
            AddItem("Depth Format", settings.DepthFormat.ToString());
            AddItem("Vertex Shader", caps.VertexShaderVersion.ToString());
            AddItem("Pixel Shader", caps.FragmentShaderVersion.ToString());
        }
Exemplo n.º 3
0
        public static OutputCaps GetAdapterCaps(int adapter, DeviceType deviceType, Format format)
        {
            OutputCaps caps = new OutputCaps();

            caps.adapter        = adapter;
            caps.adapterDetails = Manager.Adapters.Default.Information;

            caps.caps          = Manager.GetDeviceCaps(adapter, deviceType);
            caps.antialiasCaps = new AntiAliasCaps(adapter, deviceType, format);
            caps.hardwareTnL   = caps.caps.DeviceCaps.SupportsHardwareTransformAndLight;

            caps.vShaderCaps    = caps.caps.VertexShaderCaps;
            caps.vShaderVersion = caps.caps.VertexShaderVersion;
            caps.pShaderCaps    = caps.caps.PixelShaderCaps;
            caps.pShaderVersion = caps.caps.PixelShaderVersion;

            return(caps);
        }
Exemplo n.º 4
0
        public static OutputSettings CreateFromRequirements(OutputRequirements requirements, OutputCaps caps,
                                                            OutputRequirements fallbacks)
        {
            if (caps == null)
            {
                caps = OutputCaps.GetDefaultAdapterCaps(requirements);
            }

            OutputSettings settings = new OutputSettings();

            settings.adapter = caps.Adapter;

            Type type = typeof(OutputSettings);

            OutputCaps.OutputCapsCompatibility reqComp      = caps.CheckCompatibility(requirements);
            OutputCaps.OutputCapsCompatibility fallbackComp = caps.CheckCompatibility(fallbacks);

            // check reqs against caps
            if (reqComp.SupportDeviceType)
            {
                settings.devType = requirements.DeviceType;
            }
            else if (fallbackComp.SupportDeviceType)
            {
                settings.devType = fallbacks.DeviceType;
            }
            else
            {
                throw new OutputSettingsException(type.GetProperty("DeviceType"),
                                                  requirements.DeviceType, null);
            }

            if (reqComp.SupportDeviceFormat)
            {
                settings.devFormat = requirements.DeviceFormat;
            }
            else if (fallbackComp.SupportDeviceFormat)
            {
                settings.devFormat = fallbacks.DeviceFormat;
            }
            else
            {
                throw new OutputSettingsException(type.GetProperty("DeviceFormat"),
                                                  requirements.DeviceFormat, null);
            }

            if (reqComp.SupportDepthFormat)
            {
                settings.depthFormat = requirements.DepthFormat;
            }
            else if (fallbackComp.SupportDepthFormat)
            {
                settings.depthFormat = fallbacks.DepthFormat;
            }
            else
            {
                throw new OutputSettingsException(type.GetProperty("DepthFormat"),
                                                  requirements.DepthFormat, null);
            }

            if (caps.HardwareTnL && requirements.HardwareTnL)
            {
                settings.createFlags = CreateFlags.HardwareVertexProcessing;
            }
            else if (!requirements.HardwareTnL)
            {
                settings.createFlags = CreateFlags.SoftwareVertexProcessing;
            }
            else if (!fallbacks.HardwareTnL)
            {
                settings.createFlags = CreateFlags.SoftwareVertexProcessing;
            }
            else
            {
                throw new OutputSettingsException(type.GetProperty("CreateFlags"),
                                                  requirements.HardwareTnL, null);
            }

            if (requirements.AntiAliasing <= caps.AntiAliasing.MaxSupported)
            {
                settings.antiAliasing = requirements.AntiAliasing;
            }
            else if (fallbacks.AntiAliasing <= caps.AntiAliasing.MaxSupported)
            {
                settings.antiAliasing = fallbacks.AntiAliasing;
            }
            else
            {
                throw new OutputSettingsException(type.GetProperty("AntiAliasing"),
                                                  requirements.AntiAliasing, caps.AntiAliasing.MaxSupported);
            }

            return(settings);
        }