Tuesday, November 15, 2011

Kolkata Developer Conference 2011 - A Recap of my WP7 Session

Kolkata Developer Conference 2011 - A Recap of my WP7 Session


Kolkata Developer Conference 2011 - A Recap of my WP7 Session

Posted: 15 Nov 2011 12:26 AM PST

On last Saturday, 12th November 2011, I presented 1 hour Technical session on "Windows Phone 7" in Kolkata Developer Conference . The event was organized by Microsoft User Group Kolkata (KolkataGeeks). It is the premier technical event for technology...( read more )...(read more)

10 Laps around Silverlight 5 (Part 6 of 10)

Posted: 15 Nov 2011 12:15 AM PST

This article is sponsored by Telerik RadControls for Silverlight . Related content from the sponsor: Check out what's new! XAML Controls BETA—Introducing a new and empowered ChartView! The LOB Chronicles—don't miss "Episode 10...( read more )...(read more)

Monday, November 14, 2011

Silverlight Training Montreal in November 2011

Silverlight Training Montreal in November 2011


Silverlight Training Montreal in November 2011

Posted: 13 Nov 2011 12:05 PM PST

Still a few seats available for the next Silverlight Tour stop in Montreal , come and learn top Silverlight content from local experts!!! What: Silverlight training When: November 21-24 (4 days) Where: Montreal, Qc Registration/info Also note that we...( read more )...(read more)

Solving the Shakespeare Million Monkeys Problem in Real-time with Parallelism and SignalR

Posted: 11 Nov 2011 05:09 PM PST

A little over 18 months ago I was talking to Stephen Toub (he of the Parallel Computing fame ) about parallelism and the kinds of problems it could solve. I said, naively, "could we solve the million monkey's problem ?" He said, "the what?" "You know, if you have an infinite number of monkeys and an infinite number of keyboards they will eventually write Shakespeare ." We brainstormed some ideas (since Stephen is a smarter than I, this consisted mostly of him gazing thoughtfully into the air while I sat on my hands) and eventually settled on an genetic algorithm. We would breed thousands of generations of (hypothetical) monkeys a second and then choose which ones would be allowed to perpetuate the species based...(read more)

Windows Phone 7.5 - Manipulating camera stream

Posted: 13 Nov 2011 06:52 PM PST

In the previous article from this series I've introduced how to access the cameras of the phone and emulate a photo camera using the Windows Phone API. These API are really straightforward and almost everyone can take pictures easily for the purposes...( read more )...(read more)

Silverlight Cream for November 13, 2011 -- #1166

Posted: 13 Nov 2011 08:14 PM PST

In this Issue: Pontus Wittenmark , Jeff Blankenburg ( -2- ), Colin Eberhardt , Charles Petzold , Dhananjay Kumar , Igor , Beth Massi , Kunal Chowdhury ( -2- ), Shawn Wildermuth , XAMLNinja , and Peter Kuhn ( -2- ). Above the Fold: Silverlight: "Silverlight...( read more )...(read more)

Sunday, November 13, 2011

Weekly News Digest @SilverlightZone - 06-November-2011 to 12-November-2011

Weekly News Digest @SilverlightZone - 06-November-2011 to 12-November-2011


Weekly News Digest @SilverlightZone - 06-November-2011 to 12-November-2011

Posted: 12 Nov 2011 08:30 AM PST

Here comes the weekly news digest of Silverlight-Zone.com for the week 6th November 2011 to 12th November 2011. Once again the "Future of Silverlight" hit the developers. Lots of rumours we have seen during the week on Silverlight. Still waiting to hear...( read more )...(read more)

Friday, November 11, 2011

Semantic Colorization (Visual C++ 2011 Developer Preview)

Semantic Colorization (Visual C++ 2011 Developer Preview)


Semantic Colorization (Visual C++ 2011 Developer Preview)

Posted: 11 Nov 2011 12:25 PM PST

Additional C++ tokens, such as types, enumerations, and macros, among others, now have colorization. By default, this colorization is enabled. Parameters appear in italic. You can specify additional token colorizations in the Options dialog box under Environment, Fonts and Colors.

Thursday, November 10, 2011

WP7Contrib – FindaPad and the fastest list in the west

WP7Contrib – FindaPad and the fastest list in the west


WP7Contrib – FindaPad and the fastest list in the west

Posted: 10 Nov 2011 07:13 AM PST

FindaPad is the first App to be built from the ground up using the WP7Contrib. In fact, the process of building FindaPad led to the creation of the WP7Contrib. FindaPad is a property searching experience that provides users with the ability to view the...( read more )...(read more)

Wednesday, November 9, 2011

Code Analysis in Visual C++ 11

Code Analysis in Visual C++ 11


Code Analysis in Visual C++ 11

Posted: 09 Nov 2011 10:07 AM PST

Code Analysis in Visual C++ 11The Microsoft Security Science team has recently posted a note about Security Development Lifecycle integration as part of the Code Analysis rules coming with the next version of Visual C++.

[Read the full post]

ASP.NET Dynamic Data Overview

Posted: 09 Nov 2011 10:50 AM PST

ASP.NET Dynamic Data lets you create extensible data-driven Web applications by inferring at run time the appearance and behavior of data entities from the database schema and deriving UI behavior from it.

Silverlight Cream for November 08, 2011 -- #1165

Posted: 08 Nov 2011 10:06 PM PST

In this Issue: Brian Noyes , Michael Crump , WindowsPhoneGeek , Erno de Weerd , Jesse Liberty , Derik Whittaker , Sumit Dutta , Asim Sajjad , Dhananjay Kumar , Kunal Chowdhury , and Beth Massi . Above the Fold: Silverlight: "Working with Prism 4 Part...( read more )...(read more)

Tuesday, November 8, 2011

Game Debugging in Visual Studio 11

Game Debugging in Visual Studio 11


Game Debugging in Visual Studio 11

Posted: 08 Nov 2011 02:20 PM PST

Hi! I am Amit Mohindra, a Program Manager on the Visual C++ team.

We believe Metro style games and graphics-intensive apps present a huge opportunity for developers on new devices such as tablets. The primary API for accessing the full power of the underlying graphics hardware on Windows is DirectX 11 (including Direct3D and Direct2D).

One of the most significant innovations we have brought to Visual Studio 11 is a series of tools for assisting you in developing Direct3D games. We made a quick video of some of these features on Channel9 (link). In this post, I will walk through our debugging & diagnostics support for D3D.

The new Graphics Debugger in Visual Studio is a debugging and analysis tool that captures detailed information from a Direct3D application as it executes. You can use it to:

  • Capture rendered frames for later inspection and analysis.
  • View DirectX events and their effects on the application.
  • View 3D meshes before and after vertex shader transformations.
  • Discover which DirectX events contribute to the color of a specific pixel.
  • Jump directly to the location in source code for a particular DirectX call

Let's try to hypothetically solve a simple problem step by step using the graphics debugger. For this blog the game we're working on is a rotating Die game. Here is what it should look like.

However, when we run the application we find out that the Die does not get rendered in the game.

To start debugging this game, right-click on the project in Solution Explorer and set "Enable Graphics Capture" to "Yes" in the Debugging node.

Now, F5 to start debugging your application and you will notice that the game now has some fundamental statistics displayed in the top left corner. This indicates that VS is ready to capture diagnostic information from the game for you to investigate the rendering issues.

In order to capture a frame, just hit the "Print Screen" key. You can repeat this as often as you like; each frame will show up in Visual Studio as part of the "Graphics Experiment.vsglog" file. The log file contains all the information required for you to debug the rendering issues. The file by default is located in a temporary location, but you can choose to save the file and share it with other developers.

Let's dig further into what's going on by analyzing the captured frame in Visual Studio. To understand it better I want to know what got drawn when I called the "DrawIndexed" API in my code.

To inspect the "DrawIndexed" call right-click on the frame thumbnail and select "Events List" from the context menu to bring up the events list window.

The Graphics Event List window lists all the DirectX events captured by running a program under the VS debugger. It also simulates the events under the graphics debugger, re-running the commands using the same inputs as used by the running program. In the search box you could type "Draw" to filter the list to show the DirectX draw calls. Clicking through the draw calls you will be able to see in the frame window (on the right) how that frame was drawn piece by piece.

In the search box in this window type "Draw", this will filter the list to show the draw calls made by the game. Select the "DrawIndexed" call in the events list and check to see in the frame window if something gets rendered.

Unfortunately in this scenario as seen above nothing is rendered so we need to continue our debugging process. A draw API (DrawIndexed) submits work to the rendering pipeline. So let's inspect the rendering pipeline to see if something was submitted as part of the "DrawIndexed" call. In order to see what was going on in the graphics pipeline when the draw call was executed, right-click on the call in the events list and bring up the pipeline viewer by selecting "Pipeline Viewer" from the context menu.

The Graphics pipeline viewer shows the different stages in the graphics pipeline and how those stages modify your model.

The viewer shows four different views of the mesh data; these correspond to four different stages in the pipeline

 

View Description
Pre-Vertex Shader View the mesh vertices before the vertex shader. The camera is pointed at the center of the object.
Post Vertex Shader View the mesh vertices after the vertex shader. The camera is pointed at the center of the object.
Geometry Shader
(not seen in this example as it is not used)
View the mesh vertices after the geometry shader. The camera is pointed at the center of the object. If there is no geometry shader assigned, this view is blank (a solid shade of light gray).
View Port View the mesh vertices in screen space. The camera is set up identical to the camera in the target program.

 

Note there are other stages in the graphics pipeline which are not represented in this view. For more on the new graphics pipeline stages in DirectX 11, see here.

In the graphics pipeline view you can see that something is being drawn that looks like the Die that the application wanted to render. It seems from the figure above that the "Die" (cube) structure is going through the graphics pipeline correctly indicating that the shaders are functioning correctly (they aren't modifying the original structure in a way that would prevent them from being rendered).

At this point we need to continue debugging and take a look elsewhere. It could be that the pixels being overwritten or discarded. To verify this hypothesis lets go take a look at the pixels in the center of the frame (where the Die is supposed to be rendered). In the frame buffer window click in the center to first select a pixel and then right click and choose "Pixel History" from the context menu.

The Graphics Pixel History window displays the activities that contribute to the color of the selected pixel in the current frame. It contains information about how the pixel was modified by each DirectX event in the pixel history window. This includes the initial frame buffer state, followed by the intermediate draw events of rendering and the final result.

We can see from the "Pixel History" window that the frame buffer color for the pixel was blue, and then the pixel shader applied a different color (grey) to the pixel. However, the final color is still blue. The desired pixel color being rendered is not getting applied at all. This is an indication that the blend state might not be set correctly. Blend state controls how color and alpha values are blended when combining rendered data with existing render target data. To inspect the blend state, right click on the pixel and choose "Object Table" from the context menu. This will pop up the "Graphics Object Table" window.

The Graphics Object Table displays Direct3D objects created by the target program. Any object that contains state information can be viewed by double clicking on the object in the table.

Sort the object table (by "Type") and then scroll to the list of "D3D11 Blend State" object. Double click on the "D3D11 Blend State" object will the lowest valid (not N/A) "Usage Age". "Usage Age" helps scope the object to investigate in relation to the selected draw call, lower the usage age the more relevant it is. Double click on the blend state object with the lowest usage age and it will open a document with details of the object inside Visual Studio.

 

From the picture above we can see:

    Blend Source = D3D11_BLEND_ZERO; //Source represents the color output by the pixel shader on which blend operation is performed
    Blend Destination = D3D11_BLEND_ONE; //Destination represents the color of the frame on which blend operation is performed
    Blend Op = D3D11_BLEND_ADD; //Blend operation to perform with the source and destination.

We can see from this that the blend state for the source is being masked since it is set to zero (D3D11_BLEND_ZERO) and the blend state for the destination is set to one (D3D11_BLEND_ONE). This causes the background color to come out as the primary color after blending thus we don't see the Die being rendered. The values should be switched such that the output of the pixel shader is primary output of the blending operation.

    Blend Source = D3D11_BLEND_ONE;
    Blend Destination = D3D11_BLEND_ZERO;
    Blend Op = D3D11_BLEND_ADD;

To find out where the blend state is being set we can go back to the event list window and filter the event list to look for "blendstate" since the event list lists all the DirectX events that transpired for the captured frame. Once you filter you can see calls to "OMSetBlendState". "OMSetBlendState" is the call that sets the blend state. To get to the source code where this call is being made right click on the "OMSetBlendState" call and chose "Call Stack" from the context menu to bring up the "Graphics Call Stack" window

The Graphics Event Callstack window ties the DirectX events to the C++ source code being debugged.

Double click on the first call in the call stack and it takes you to the "OMSetBlendState" call in the code. A few lines above the "OMBlendState" call and you will notice the lines of code where source and destination blend values are set.

Switch the two states by changing the code to reflect the following:

    blenddesc.RenderTarget[0].SrcBlend=D3D11_BLEND_ONE;
    blenddesc.RenderTarget[0].DestBlend=D3D11_BLEND_ZERO;

Build and Run.

 

 

Summary:

Game development isn't easy and we think tools should help you make use of the underlying DirectX platform. In this release, we are excited to bring this new type of diagnostics experience directly into Visual Studio. These features are still under development and could potentially change or not even be included in our final product. These features are only available of Visual Studio Professional and above SKU's.

10 Laps around Silverlight 5 (Part 5 of 10)

Posted: 08 Nov 2011 12:18 PM PST

This article is sponsored by Telerik RadControls for Silverlight . Related content from the sponsor: Check out what's new! XAML Controls BETA—Introducing a new and empowered ChartingKit! The LOB Chronicles—don't miss "Episode 10...( read more )...(read more)

SilverlightShow for October 31 - November 06, 2011

Posted: 08 Nov 2011 06:30 AM PST

Check out the Top Five most popular news at SilverlightShow for SilverlightShow Top 5 News for October 31 - November 06, 2011. Here are the top 5 news on SilverlightShow for last week: Silverlight Best Practices: Data-Centric Applications Top 5 SilverlightShow...( read more )...(read more)

Windows Client Developer Roundup 084 for 11/8/2011

Posted: 08 Nov 2011 05:12 AM PST

The Windows Client Developer Roundup aggregates information of interest to Windows Client Developers, including WinRT XAML , WPF , Silverlight , Visual C++ , XNA , Expression Blend , Surface , Windows 7 , Windows Phone , Visual Studio, WCF RIA Services...( read more )...(read more)

Windows Client Developer Roundup 084 for 11/8/2011

Posted: 08 Nov 2011 05:12 AM PST

The Windows Client Developer Roundup aggregates information of interest to Windows Client Developers, including WinRT XAML , WPF , Silverlight , Visual C++ , XNA , Expression Blend , Surface , Windows 7 , Windows Phone , Visual Studio, WCF RIA Services...( read more )...(read more)

Silverlight Cream for November 07, 2011 -- #1164

Posted: 07 Nov 2011 09:06 PM PST

In this Issue: Colin Eberhardt , WindowsPhoneGeek , John Papa , Jesse Liberty , Derik Whittaker , Sumit Dutta , Asim Sajjad , Dhananjay Kumar , Charles Petzold , Peter Kuhn , and Ollie Riches . Above the Fold: Silverlight: "Display Total Records After...( read more )...(read more)

Useful Visual Studio Extension - Web Essentials from Mads Kristensen

Posted: 07 Nov 2011 05:03 PM PST

Visual Studio 2010 is really extensible and that's allowed many folks on the team to try out new features for Web Development without having to rebuild Visual Studio itself. One of those "playground" extensions is called " Web Essentials " by Mads Kristensen. Mads handles HTML5 and CSS3 tools for our team. You might remember Mads from when we released the Web Standards Update a few months back. Web Essentials is Mads' playground and it's pretty awesome. It's so awesome that I think you should check it out and then, *ahem*,  leave a comment on this post encouraging Mads and gentle urging his boss(es) to get these features into the next version of Visual Studio. First, it adds a few nice touches to the...(read more)

How to use PlaySoundAction Behavior in WP7 Application?

Posted: 07 Nov 2011 08:30 AM PST

Behaviors are most demanded feature to include in Silverlight, Windows Phone 7 and/or WPF applications to implement proper MVVM pattern to do some UI level actions. These are pluggable on demand and don't need any other extra code to integrate. Just a...( read more )...(read more)