Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Core / CSharp / System / Windows / Media / RenderCapability.cs / 2 / RenderCapability.cs
//------------------------------------------------------------------------------ // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // The RenderCapability class allows clients to query for the current // render tier associated with their Dispatcher and to register for // notification on change. // //----------------------------------------------------------------------------- using System; using System.Diagnostics; namespace System.Windows.Media { ////// RenderCapability - /// The RenderCapability class allows clients to query for the current /// render tier associated with their Dispatcher and to register for /// notification on change. /// public static class RenderCapability { ////// Tier Property - returns the current render tier for the Dispatcher associated /// with the current thread. /// public static int Tier { get { MediaContext mediaContext = MediaContext.CurrentMediaContext; // The Dispatcher auto-creates if there is no Dispatcher associated with this // thread, and the MediaContext does the same. Thus, mediaContext should never // be null. Debug.Assert(mediaContext != null); return mediaContext.Tier; } } ////// Returns whether the specified PixelShader major/minor version is /// supported by this version of WPF, and whether Effects using the /// specified major/minor version can run on the GPU. /// public static bool IsPixelShaderVersionSupported(short majorVersionRequested, short minorVersionRequested) { bool isSupported = false; // For now, we only support PS 2.0. Can only return true if this is // the version asked for. const short majorVersionRequired = 2; const short minorVersionRequired = 0; if (majorVersionRequested == majorVersionRequired && minorVersionRequested == minorVersionRequired) { // Now actually check. MediaContext mediaContext = MediaContext.CurrentMediaContext; byte majorVersion = (byte)((mediaContext.PixelShaderVersion >> 8) & 0xFF); byte minorVersion = (byte)((mediaContext.PixelShaderVersion >> 0) & 0xFF); // We assume here that a higher version does in fact support the // version we're requiring. if (majorVersion >= majorVersionRequired) { isSupported = true; } else if (majorVersion == majorVersionRequired && minorVersion >= minorVersionRequired) { isSupported = true; } } return isSupported; } ////// Returns whether Effects can be rendered in software on this machine. /// public static bool IsShaderEffectSoftwareRenderingSupported { get { MediaContext mediaContext = MediaContext.CurrentMediaContext; return mediaContext.HasSSE2Support; } } ////// TierChanged event - /// This event is raised when the Tier for a given Dispatcher changes. /// public static event EventHandler TierChanged { add { MediaContext mediaContext = MediaContext.CurrentMediaContext; // The Dispatcher auto-creates if there is no Dispatcher associated with this // thread, and the MediaContext does the same. Thus, mediaContext should never // be null. Debug.Assert(mediaContext != null); mediaContext.TierChanged += value; } remove { MediaContext mediaContext = MediaContext.CurrentMediaContext; // The Dispatcher auto-creates if there is no Dispatcher associated with this // thread, and the MediaContext does the same. Thus, mediaContext should never // be null. Debug.Assert(mediaContext != null); mediaContext.TierChanged -= value; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // Description: // The RenderCapability class allows clients to query for the current // render tier associated with their Dispatcher and to register for // notification on change. // //----------------------------------------------------------------------------- using System; using System.Diagnostics; namespace System.Windows.Media { ////// RenderCapability - /// The RenderCapability class allows clients to query for the current /// render tier associated with their Dispatcher and to register for /// notification on change. /// public static class RenderCapability { ////// Tier Property - returns the current render tier for the Dispatcher associated /// with the current thread. /// public static int Tier { get { MediaContext mediaContext = MediaContext.CurrentMediaContext; // The Dispatcher auto-creates if there is no Dispatcher associated with this // thread, and the MediaContext does the same. Thus, mediaContext should never // be null. Debug.Assert(mediaContext != null); return mediaContext.Tier; } } ////// Returns whether the specified PixelShader major/minor version is /// supported by this version of WPF, and whether Effects using the /// specified major/minor version can run on the GPU. /// public static bool IsPixelShaderVersionSupported(short majorVersionRequested, short minorVersionRequested) { bool isSupported = false; // For now, we only support PS 2.0. Can only return true if this is // the version asked for. const short majorVersionRequired = 2; const short minorVersionRequired = 0; if (majorVersionRequested == majorVersionRequired && minorVersionRequested == minorVersionRequired) { // Now actually check. MediaContext mediaContext = MediaContext.CurrentMediaContext; byte majorVersion = (byte)((mediaContext.PixelShaderVersion >> 8) & 0xFF); byte minorVersion = (byte)((mediaContext.PixelShaderVersion >> 0) & 0xFF); // We assume here that a higher version does in fact support the // version we're requiring. if (majorVersion >= majorVersionRequired) { isSupported = true; } else if (majorVersion == majorVersionRequired && minorVersion >= minorVersionRequired) { isSupported = true; } } return isSupported; } ////// Returns whether Effects can be rendered in software on this machine. /// public static bool IsShaderEffectSoftwareRenderingSupported { get { MediaContext mediaContext = MediaContext.CurrentMediaContext; return mediaContext.HasSSE2Support; } } ////// TierChanged event - /// This event is raised when the Tier for a given Dispatcher changes. /// public static event EventHandler TierChanged { add { MediaContext mediaContext = MediaContext.CurrentMediaContext; // The Dispatcher auto-creates if there is no Dispatcher associated with this // thread, and the MediaContext does the same. Thus, mediaContext should never // be null. Debug.Assert(mediaContext != null); mediaContext.TierChanged += value; } remove { MediaContext mediaContext = MediaContext.CurrentMediaContext; // The Dispatcher auto-creates if there is no Dispatcher associated with this // thread, and the MediaContext does the same. Thus, mediaContext should never // be null. Debug.Assert(mediaContext != null); mediaContext.TierChanged -= value; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SHA1Managed.cs
- PartialTrustHelpers.cs
- DataGridViewRowsRemovedEventArgs.cs
- RoutedCommand.cs
- SecurityTokenProvider.cs
- CircleHotSpot.cs
- AdPostCacheSubstitution.cs
- NotificationContext.cs
- NullNotAllowedCollection.cs
- IdentityModelStringsVersion1.cs
- TransactionChannelFaultConverter.cs
- unsafenativemethodsother.cs
- ComplusEndpointConfigContainer.cs
- DateTimeFormat.cs
- AutomationFocusChangedEventArgs.cs
- XmlSchemaDatatype.cs
- DoubleLinkListEnumerator.cs
- DbConnectionHelper.cs
- EdmSchemaAttribute.cs
- SByteStorage.cs
- ResourceCategoryAttribute.cs
- XAMLParseException.cs
- InputEventArgs.cs
- TypeUtil.cs
- Vector3dCollection.cs
- AccessibleObject.cs
- DataGridAutoFormat.cs
- ConstructorArgumentAttribute.cs
- AuthenticationModuleElement.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- ObsoleteAttribute.cs
- SHA256.cs
- _DomainName.cs
- AppDomain.cs
- FigureParagraph.cs
- ParseChildrenAsPropertiesAttribute.cs
- BezierSegment.cs
- DSGeneratorProblem.cs
- ComponentEditorPage.cs
- XmlUtil.cs
- WSSecurityOneDotZeroReceiveSecurityHeader.cs
- AppearanceEditorPart.cs
- FileSystemEventArgs.cs
- LoadedOrUnloadedOperation.cs
- MethodImplAttribute.cs
- RepeaterItemEventArgs.cs
- ContainsSearchOperator.cs
- PtsHost.cs
- EntityContainerRelationshipSetEnd.cs
- BCryptSafeHandles.cs
- WindowsGraphics2.cs
- RegexCharClass.cs
- AuthenticationModulesSection.cs
- HttpRuntimeSection.cs
- CapabilitiesUse.cs
- SelectedCellsChangedEventArgs.cs
- PropertySegmentSerializer.cs
- DataPagerFieldCollection.cs
- ImageButton.cs
- BooleanConverter.cs
- ActivityValidationServices.cs
- GridItem.cs
- ToolStripLabel.cs
- CompositeFontFamily.cs
- ValidationEventArgs.cs
- StringConverter.cs
- HttpDictionary.cs
- CachedPathData.cs
- EventProxy.cs
- PropertyEntry.cs
- TemplateBuilder.cs
- ResourceKey.cs
- Rule.cs
- DataSourceComponent.cs
- EventProviderClassic.cs
- TextOnlyOutput.cs
- ImageEditor.cs
- ImageField.cs
- GroupBox.cs
- QueryExpression.cs
- Serializer.cs
- DiscoveryServerProtocol.cs
- TemplateColumn.cs
- ZipIOLocalFileHeader.cs
- SqlAggregateChecker.cs
- BinaryMethodMessage.cs
- TabletDeviceInfo.cs
- TextServicesDisplayAttribute.cs
- PartialToken.cs
- DetailsViewUpdateEventArgs.cs
- DataService.cs
- HttpProfileBase.cs
- HitTestParameters3D.cs
- RequestCachePolicyConverter.cs
- HttpsChannelListener.cs
- DataGridViewSelectedCellCollection.cs
- CapabilitiesPattern.cs
- DateTimeSerializationSection.cs
- LogEntrySerialization.cs
- CheckBoxField.cs