DirectX Graphics Development with Visual Studio 2013 and Update 2
Hello, everyone! My name is Rong Lu, a program manager on the Visual C++ team. Last week at BUILD conference, I gave a talk on “DirectX Graphics Development with Visual Studio 2013 and Update 2” in which we walked through a couple of exciting new features in Visual Studio 2013 Update 2 (Download Update 2 RC) for DirectX development. In case you missed it, check out the recording or read on this blog post.
What’s in Visual Studio 2013 for DirectX development?
If you’re using VS 2013, you already have access to these features. All features are now available in Visual Studio 2013 Express for Windows (install), Professional and above SKUs.
- In New Project dialog, look for Visual C++ -> Store Apps node, and you’ll find two templates: DirectX App, DirectX and XAML App. The templates have had a major update in VS 2013. They are better organized aiming to make it easier to be used as a starting point. Ian Huff has a blog post describing these templates in more details.
- For adding new shader files: Compute Shader, Domain Shader, Geometry Shader, Hull Shader, Pixel Shader, Vertex Shader.
- For adding Graphics files: .bmp, .gif, .jpg, .png, .tif, .dds, .tga, .fbx, .dgsl
Graphics Assets Authoring
You can use the Image Editor to work with the kinds of rich texture and image formats that are used in DirectX app development—this includes support for popular image file formats and color encodings, features such as alpha-channels and MIP-mapping, and many of the highly-compressed, hardware-accelerated texture formats that DirectX supports.
You can use the Model Editor to create basic 3-D models from scratch, or to view and modify more-complex 3-D models that were created by using full-featured 3-D modeling tools.
You can use the Shader Designer to create custom visual effects for your game or app even if you don’t know HLSL programming.
You can use it to have your original assets transformed into a format that DirectX can understand. Visual Studio has built-in content pipeline for transforming Textures and images, 3-D Models, and Shaders.
Compile HLSL in VS
You can use syntax coloring, indenting, and outlining when you are coding HLSL shaders, and MSBuild automatically supports the Microsoft HLSL Compiler (fxc.exe).
Graphics Diagnostics helps you debug rendering errors in DirectX games and apps. If you’ve already used the tool in VS 2012, here’s what’s new in VS 2013:
- Remote debugging on x86, x64 and ARM machines and devices. See How to: Change the Graphics Diagnostics Playback Machine and How to: Use Graphics Diagnostics with an ARM Device.
- Compute shader debugging. Walkthrough: Using Graphics Diagnostics to Debug a Compute Shader
What’s new in VS 2013 Update 2 for DirectX development?
Now onto new things in Update 2! In Visual Studio 2013 Update 2 RC that went live last week, there’re even more features added for DirectX development!
Take your DirectX app to Windows Phone, tablets and PCs using Windows Universal Apps
At BUILD conference last week, we introduced Windows Universal Apps which was designed to help developers create universal Windows apps for Windows 8.1 and Windows Phone 8.1. Visual Studio 2013 Update 2 RC includes the Windows Universal apps support that allow you to create an app that is easily tailored to render a contextually appropriate experience across Windows phones, tablets and PCs. See Kevin Gallo’s Extending platform commonality through universal Windows apps.
How you can use it in DirectX App? DirectX APIs have nicely converged between Windows 8.1 and Windows Phone 8.1 making it really easy to share your DirectX code across platforms. In this example below, 100% of the DirectX is in the Shared node, and even the main XAML page is shared! If you’re interested, check out my session recording where I showed how to make an existing Windows 8.1 app work across Windows and Windows Phone.
If you’re starting fresh, use the Visual Studio project templates for Universal Apps might be a good starting point.
Graphics Diagnostics just got even better! In addition to what’s already available in VS 2013, in Update 2 we have not only enhanced the Graphics Debugger including newly added full support for debugging Windows Phone 8.1, but also added a brand new Graphics Profiler!
Graphics Debugger enhancement
you can now capture up to 30 consecutive frames with one capture.
Programmatic capture is especially useful for debugging compute shaders in programs that never call Present, or when a rendering problem is difficult to anticipate and capture in manual testing but can be predicted programmatically by using information about the state of the app at runtime.
Enhanced Graphics Event List
A new Draw Calls view is added which displays captured events and their state in a hierarchy organized by Draw Calls. You can expand draw calls to display the device state that was current at the time of the draw call; and you can further expand each kind of state to display the events that set their values.
Debugging Windows Phone 8.1 apps
Graphics Debugger now fully supports debugging Windows Phone 8.1 apps in Phone emulator or tethered Phone!
Graphics Profiler (new in Update 2!)
Graphics Frame Analysis collects performance measurements on captured frames; in addition it also performs a set of pre-defined experiments which provides insights into how performance would be affected when various texture techniques are applied. Last but not least, Frame Analysis also collects performance counters from hardware. The feature works the same on Windows 8.1 and Windows Phone 8.1 devices (feature relies on timestamp query which was not part of Windows Phone 8). Shawn Hargreaves has already blogged about the feature. J
Here are a few more useful resources to help you get started on DirectX programming. These are not included in Visual Studio, but are available for download from the web.
– Visual Studio 3D Starter Kit is a sample solution that showcase model and texture design, assets format conversion and runtime loading. It can be downloaded at http://aka.ms/vs3dkit.
– DirectX Toolkit is a Shared source utility library that makes D3D easier to work with for loading textures and models, drawing sprites and text, playing sound effects and shaders for simple rendering. It supports all the latest platforms Windows Store, Windows Phone, Desktop and Xbox One. Available on CodePlex: https://directxtk.codeplex.com/
– Direct3D tutorial sample download.
Migrate DirectX Windows Phone 8.0 app to Windows Phone 8.1
If you have an existing DirectX app targeting Windows Phone 8.0, here is a whitepaper describes how to migrate it to Windows Phone 8.1.
Here is a complete picture of what VS has to offer for DirectX development in VS 2013 plus Update 2. We’re very excited about the latest VS 2013 Update, and we hope you’d like the features too. If you haven’t already installed the update, get VS 2013 Update 2 RC now! As always, we look forward to hearing your comments about what you like or dislike.