Presentation is loading. Please wait.

Presentation is loading. Please wait.

 David Teitlebaum Program Manager Microsoft Corporation PC07.

Similar presentations


Presentation on theme: " David Teitlebaum Program Manager Microsoft Corporation PC07."— Presentation transcript:

1  David Teitlebaum Program Manager Microsoft Corporation PC07

2

3

4

5

6

7

8

9

10

11

12

13 No HW Acceleration for: OuterGlowBitmapEffect EmbossBitmapEffect BevelBitmapEffect No Effect Analogs either Software fallback requires SSE2 Added RenderCapability.IsShaderEffectSoftwareRenderingSupported No EffectGroup Group via nesting elements

14  David Teitlebaum Program Manager WPF

15 Etc…

16

17

18 2.0 & variants (DX 10) Texture instruction limit32Unlimited Instruction slots Executed instructions Unlimited Constant registers x4096

19

20 float4 myColor = { 0.5f, 0.2f, 0.4f, 0.2f } float4 colorFilter = {0.0f, 0.0f, 1.0f, 1.0f} float4 result = myColor * colorFilter; result == {0.0f, 0.0f, 0.4f, 0.2f} {result.x, result.y, result.z, result.w} …equivalent to {result.r, result,g, result.b, result.a}

21 float2x4 fMatrix; // float matrix with 2 rows, 4 columns float2x2 fMatrix = { 0.0f, 0.1, // row 1 2.1f, 2.2f // row 2

22

23 float width : register( C0 ); float height : register( C1 ); float2 mousePosition : register( C2 ) float totalPixels = width * height; float mouseXpos = mousePosition.x ;

24

25 sampler2D implicitInputSampler : register(S0); float2 texCoord = {0.4, 0.6}; float4 color = tex2D ( implicitInputSampler, texCoord ); // Texture Coordinates always range from 0..1 // on both x and y axes

26

27 sampler2D Input : register(s0); float4 main(float2 uv:TEXCOORD) : COLOR { float4 Color; Color = tex2D(Input, uv.xy); Color.rg = 0; return Color; }

28

29

30

31 public class MyEffect : ShaderEffect { static MyEffect () { _pixelShader.UriSource = Global.MakePackUri(“MyEffect.ps"); } public MyEffect () { this.PixelShader = _pixelShader; UpdateShaderValue(InputProperty); } public Brush Input { get { return (Brush)GetValue(InputProperty); } set { SetValue(InputProperty, value); } } public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty( "Input", typeof(WaveEffect), 0); private static PixelShader _pixelShader = new PixelShader(); }

32

33 Grid g = new Grid(); MyEffect me = new MyEffect(); g.Effect = me;

34 Write pixel shader in HLSL Derive from the ShaderEffect class Expose whatever DPs you want accessible from your ShaderEffect Assign your DPs to Shader Constant Registers Compile your ShaderEffect using the Visual Studio build task – HLSL gets compiled at this time Apply your ShaderEffect via the new UIElement.Effect property

35

36

37

38  David Teitlebaum Program Manager WPF

39

40

41

42

43

44 D3DImage myD3DImage = new D3DImage(); // myD3DImage.IsFrontBufferAvailableChanged += new EventHandler( myD3DImage_IsFrontBufferAvailableChanged ); // //when surface needs updating if (myD3DImage.IsFrontBufferAvailable) { myD3DImage.Lock(); // or TryLock(...); // myD3DImage.AddDirtyRect(); myD3DImage.Unlock(); } static void myD3DImage_IsFrontBufferAvailableChanged(...) { if (myD3DImage.IsFrontBufferAvailable) { myD3DImage.Lock(); // or TryLock() myD3DImage.SetBackBuffer(); // myD3DImage.AddDirtyRect(); myD3DImage.Unlock(); } else { // }

45  David Teitlebaum Program Manager WPF

46

47 Surface pixel format Windows Vista, WDDM and 9Ex Other Windows Vista configurations Windows XP SP3 or SP2 w/ hotfix Windows XP SP2 D3DFMT_ X 8R8G8B8 (not lockable) Hardware Update Software Update D3DFMT_ X 8R8G8B8 (lockable) Hardware Update Software Update Hardware Update D3DFMT_ A 8R8G8B8 (not lockable) Hardware Update Software Update D3DFMT_ A 8R8G8B8 (lockable) Hardware Update Software Update Hardware Update Software Update

48

49

50

51

52

53

54

55 Please fill out your evaluation for this session at: This session will be available as a recording at:

56

57 © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

58


Download ppt " David Teitlebaum Program Manager Microsoft Corporation PC07."

Similar presentations


Ads by Google