• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
  • entries
  • comments
  • views

Grouping D3D11 Pipeline State

Sign in to follow this  
Followers 0
Jason Z


After using Hieroglyph 3 for a while now, and especially after doing some refactoring of the sample programs, I have had a chance to revisit some of the design choices that I made while building the library. Some things work extraordinarily well, and some things not so much... But after gaining more experience and learning more about software engineering, I have really enjoyed looking at how I did certain things - and more importantly to figure out how to improve on some of those designs. This time around I will be talking about how the pipeline state is handled, how I set up the pipeline for rendering, and then how the pipeline is actually executed to do the desired drawing.

[subheading]Pipeline State[/subheading]
When it comes down to it, there are basically three different areas that comprise the overall Direct3D 11 rendering pipeline state. Starting at the entry to the pipeline, there is state that provides input data into the pipeline. Examples of this are the input layout, primitive type selection, vertex buffers, and index buffers. They more or less only put data into the system, either literally as a data source (in the case of the vertex / index buffers) or as a configuration (in the case of input layout and primitive type). This group of states reside in the input assembler, which seems appropriately named.

Then you have what I would call the actual pipeline setup - all of the states and configuration for the pipeline stages from the vertex shader through to the pixel shader. This includes all of the programmable stages, which have shader programs, samplers, constant buffers, plus other resources added as input with shader resource views. In addition, there is the fixed pipeline stages as well, the most important of which is the rasterizer stage and its configuration. I also group the output merger's depth and blend configurations in this pipeline state. This group controls all of the processing of the data that flows through the pipeline.

Finally, there is pipeline state which configures the output of the pipeline - which is more or less the output merger stage. This is essentially a collection of output render targets, depth targets, and perhaps unordered access views. Since it receives the output data from the pipeline, I think of this group of states as the logical output of the pipeline.

[subheading]Hieroglyph 3 and Rendering[/subheading]
In Hieroglyph 3, I let render views configure the output of the pipeline. The pipeline setup is provide by my material system, and the input configuration is provided by the geometry class. There is a semi-convoluted path to get all of the state set properly, but in the end these three classes are responsible for the configuration of the whole pipeline.

After it has been configured, it is then time to actually do some rendering. In the beginning of the library development, I implemented a simple draw call that took a reference to a geometry object, a render effect (from the material system), and then called a DrawIndexed(...) pipeline invocation. This worked great for a long time, especially since I was only using basic input into the pipeline, which was either manually generated and loaded into a geometry object, or loaded from a Milkshape3D file.

While we were developing the samples for Practical Rendering and Computation with D3D11, we started to need fancier types of draw calls, and also fancier input state setups. D3D11 isn't shy about giving you options to get your data into the pipeline, and also has a good variety of draw calls to use. With indexed, instanced, and indirect flavors for draw (and dispatch calls too, for that matter), it was kind of difficult to fit a bunch of different capabilities into a monolithic geometry class - configuring and executing all these different types of draw calls was becoming untenable.

In the end, we ended up adding more draw calls that could be manually configured instead of having the simple geometry class take care of everything. This made the system functional, but still not ideal, and certainly not a pretty design point...

[subheading]The New PipelineExecutorDX11 Interfaces[/subheading]
To remedy this point, I have replaced the monolithic geometry class with a PipelineExecutorDX11 base class reference. This interface simply provides one "Execute" method, with provides parameters to the pipeline and parameter system classes. In the end, this is intended to delegate the entire pipeline input configuration to the PipelineExecutorDX11 subclass. After configuring the pipeline input, the execute method also provides its own draw call. This lets each implementation of the PipelineExecutorDX11 class decide on its own which sets of state and draw call will best fit for its type of rendering action.

Even though it seems like a very clean-cut design, it has really taken some time to get things converted over. I now have the GeometryDX11 class converted to be a subclass of PipelineExecutorDX11, and approximately 90% of the drawing in the entire engine and all of its samples are covered by this method. I am now going through the remaining 10% of drawing and creating new subclasses to handle the special case rendering that is going on. In the end, this will lead to more robust and maintainable code, and also make the entire drawing system easily extensible.

For example, I intend to add an immediate mode style geometry object that can collect simple draw calls and then collate them into a single buffer to be drawn all at once. This is the same style of rendering that is used in Processing, and it provides a simple but effective rendering model for small scale projects (this is more or less the pre-programmable pipeline rendering system). Before this design update, doing this would have meant trying to make a converter class to put the data into a GeometryDX11 instance, which would be less than optimal...

Overall, I am quite happy with the progress so far, and I hope to have a stable version available fairly soon. Keep an eye on the repository over the next week or so for an update!

Sign in to follow this  
Followers 0


There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now