DirectX Graphics Development with Visual Studio 2013 and Update 2

DirectX Graphics Development with Visual Studio 2013 and Update 2

Rate This
  • Comments 13

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. Smile

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.

Getting Started

Project Templates

  • 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.

Item Templates

  • 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

Image Editor

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.

Model Editor

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.

Shader Designer

You can use the Shader Designer to create custom visual effects for your game or app even if you don't know HLSL programming.

Content Pipeline

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

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:

 

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.

clip_image001

If you’re starting fresh, use the Visual Studio project templates for Universal Apps might be a good starting point.

clip_image003

Graphics Diagnostics

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

Consecutive capture

you can now capture up to 30 consecutive frames with one capture.

clip_image005

Programmatic 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.

clip_image007

Debugging Windows Phone 8.1 apps

Graphics Debugger now fully supports debugging Windows Phone 8.1 apps in Phone emulator or tethered Phone!

clip_image009

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

clip_image011

More resources

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.

Summary

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. Smile

clip_image012
  • Thanks for all these improvements pertaining to DirectX.

    Now on a different note:

    Please bring WebGL up to speed with other browsers. Since the vision of oneness begs this kind of initiative, I believe it would be greatly appreciated by the team leads if someone help IE folks in this regard. You can test IE11 (latest update) in comparison with other browsers' latest editions by running this official WebGL benchmark //www.khronos.org/registry/webgl/sdk/tests/webgl-conformance-tests.html and test against various version of WebGL (from the dropdown menu).

    Then the branch prediction, loop hoisting and other optimizations which are not implemented by VC team yet are yet to come  across all Microsoft products; .NET and Windows JavaScript engine. Here is a small JS test bed; //jsperf.com/branch-prediction (also scroll down to see various revision of same test) .. again observe the performance difference between various browsers and IE.

    Even in simple DOM operations, IE11 is lagging behind all major browsers' edge versions. For instance; //jsfiddle.net/f6eKZ/. If Google's Chrome can do it under 30sec, then Microsoft product can do it better. Currently IE11 perform worst in this test.

    JavaScript is highly imperative in modern era, especially the web. It needs a warranted implementation of all kinds of optimization tricks which are common in C++ and JS constructs for catching up the expectation set by competition, the entire ecosystem and betterment of mankind.

    Thank you.

  • This is welcome, but I'd much prefer to see a template for a DirectX desktop app.

  • Sorry; Programmers shouldn't be making 3D models/ textures and we definitely shouldn't be making them in Visual Studio. What are you doing?

  • @Rob G, thanks for the suggestion. As we plan for next release, we'll evaluate how to make it easy to develop DX desktop apps. A project template is probably a good start.

    @BSF, I agree with you. The goal of the VS built-in texture and model editors are mainly for viewing than editing/creating. Although programmers don't usually create these assets, if they want to inspect or just to take a quick look at the texture/model, it's convenient to be able to do that inside VS. There's no need to find and switch to a different tool. The texture and model editors can also be used to create placeholder art assets if needed. These two editors are both in a good state for these purposes, that's why in VS 2013 and Update 2 we've been very much focusing on the graphics diagnostics feature - adding features and adding platform support. Does this sound reasonable? Other thoughts to share?

  • If viewed from the angle of an extended visual debugger, then some graphics visualization tools certainly make sense and are welcome. I wonder if it wouldn't be better to just farm the visualization out to a separate user-defined executable, though. Eg, for textures we have the very robust IrfanView which supports many more texture formats.

    That workflow would look something like: VS saves the model/texture to a file (yes, I'm being a bit hand-wavy) -> launch external viewer/editor, possibly hosted within the VS window -> VS listens for file modifications and reflects those back in the runtime.  This feature can then be generalized to viewing/debugging/editing any binary data, not just textures and models. For example: you then get 'for free' audio debugging, in the hundreds of extant formats,  without trying to write the Sound Editor. If you want to package your own default visualizers (mspaint?), then you can still have such built-in support as well.

  • Somehow since I installed the update something is not quite right. I am unable to add new classes to the Shared project! It is as if the entire solution is read only!

  • @BSF, I love the idea of VS connecting with external editors for textures, models and other binary data! Certainly there are way too many formats out there than VS can support built-in. I think the model where VS opens up the extensibilities for external editors and integrate various experiences together into VS for developers is where we'd like to go in the future. Thanks much for sharing your suggestions!

  • @EA, sorry to hear that. Have you tried this on a new project? Do you see the same problem? You can send it to me directly ronglu at Microsoft.com to follow up on this.

  • I am having a lot of trouble debugging shaders with VS2013U2RC (not necessarily due to the update). Even when using a debug D3D11 device and compiling the shaders with the debug and skip optimization flags, the value of about half of the variables in my shader cannot be visualized, and the control flow in the shader regularly jumps around in non-obvious ways.

    Given that the debugging is based on a shader trace generated on the CPU on demand, I was expecting to have a very robust debugging experience. Am I doing it wrong or this is the experience to expect?

  • @RongLu thanks for the offer. I did send a feed back to the VS team and got a reply.

  • @RongLu, regarding Rob G's suggestion,

    In my opinion it's best if people learn how to use the low-level DX API directly rather than through a tutorial/sample framework. Show people the proper startup sequence _without_ leaning on a framework like DXUT or D3DX. Yes I know those things are dead anyway but that's not the point.

    There are subtleties associated with the earliest steps that are unknown to many newbies and glossed over in documentation, such as querying the system for valid display modes and how to avoid the mysterious "inefficiencies" warning when going to full-screen. The documentation talks about monitors and display modes, sort of, but it leaves a lot to trial and error.

    If you're going to create a template for a basic Desktop app then make it a real one that you would actually use in shipping code. People will learn more from that.

  • @Tristan, I sent you an email - we expect shader debugging to work with SharpDX, but it's not something we've tested. I'm curious if there's some optimization performed on the shader files by SharpDX. if you are willing to share a vsglog file with us, we'll be able to get a better idea of what's happening.

    @Scott, thanks for the suggestion! The existing DX templates are using low-level APIs and the DX samples we ship are doing the same. We're trying to find a good balance between templates being a bare bone starting point and templates to show how APIs should be used. Right now we have the 3D spinning cube as an example in the template. When you say "make it a real one that you would actually use in shipping code", are you referring a sample-like template which show case various features? Or do you prefer a blank template that you can start adding your content right away? As for documents, I agree there can be more to help beginners learn about DX and get started. We have a team working on the developer center content for games: msdn.microsoft.com/.../hh452744.aspx if you haven't checked it out. let us know what content you would like to see in the future would be very helpful.

  • Hello. I'm also voting for more windows desktop content - examples and templates. As far as I know there's no any DX templates for VS 2013 desktop.

Page 1 of 1 (13 items)