• 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.
Sign in to follow this  
Followers 0
#Include Graphics

Too large shaders - micro specializations.

10 posts in this topic

Hey all,

 

There has been assaulting me some doubts about how to manage better the drawcalls. Actually I am using a vast generic effect which commsumate all the possible materials but .... I have several object types that are very similar, should I have to specialize some materials for each "object type" branch for having less material state changes?, does it really affect performance so much?.

 

I saw that at least for DX9, the dynamic branching isnt very good carried and all the branches seems to be executed... that carried me to think about real object material specializations.

 

May you spare some knowledge with me?, thanks in advance. smile.png

0

Share this post


Link to post
Share on other sites

The cpu and gpu are alternatively my bottleneck, it depends a lot every frame, so I am spending a little time on optimizing both and trying to upgrade synchronizations.

 

But I reached to have no more ideas and thought on cpu wait times for the gpu...I hope the render calls and material states would be multithreaded, can they be parallelized? I am thinking on a gpu which saves the info of the threads that are calling it and launch execution when a whole drawcall loop is completed. Maybe a dream?

0

Share this post


Link to post
Share on other sites


Have you profiled your application to see if the CPU is the bottleneck?  If it isn't the bottleneck, then reducing draw calls probably won't help much - so you should start there. 
That depends on his batch sizes, doesn't it? If he's submitting large blocks of polygons then sure, but if we're talking about small batches and frequent effect changes, then he's going to see GPU side inefficiency stemming from that too.
2

Share this post


Link to post
Share on other sites

 


Have you profiled your application to see if the CPU is the bottleneck?  If it isn't the bottleneck, then reducing draw calls probably won't help much - so you should start there. 
That depends on his batch sizes, doesn't it? If he's submitting large blocks of polygons then sure, but if we're talking about small batches and frequent effect changes, then he's going to see GPU side inefficiency stemming from that too.

 

 

So, this is what alarms more to me:

 

- I always apply the materials begin/end with each object which is being drawn, no matter if it has exactly the same material as before.

 

I know this is not the best way to do, how is this affecting my cpu/gpu?

 

 

- I am drawing about 58 type of different materials each frame!

 

Is this normal?, Do i have to try to compact some effects to make this state changes less at the expense of having some more branches in some shaders?

0

Share this post


Link to post
Share on other sites

The cpu and gpu are alternatively my bottleneck, it depends a lot every frame, so I am spending a little time on optimizing both and trying to upgrade synchronizations.

 

But I reached to have no more ideas and thought on cpu wait times for the gpu...I hope the render calls and material states would be multithreaded, can they be parallelized? I am thinking on a gpu which saves the info of the threads that are calling it and launch execution when a whole drawcall loop is completed. Maybe a dream?

 

Answering to myself <Gollum mode on>:

 

This is not a  dream myself....this is done at the API level in DX11. The technology advances, thanks god.

 

<Gollum mode off>

0

Share this post


Link to post
Share on other sites


- I am drawing about 58 type of different materials each frame!
It is a very affordable amount. What's about the '!' ?

Personally if I would still have to be stuck in D3D9 I'd drop all optimizations. It's not going anywhere.

0

Share this post


Link to post
Share on other sites

Well I think most pc games still support directx9 and are always trying to be if so the more optimized there because of his base lack of resources management. But its my opinion, you can have yours.

0

Share this post


Link to post
Share on other sites

I am not giving you my opinion. I am giving you my experience.

My render loop can draw 80+ materials, over 20k tris total without even pulling the CPU out of the energy saving mode.

You are cracking your head open, spending your time which will never came back... to optimize for an API which is dead in the water and has been for quite a while.

But... you are free to make your choices.

0

Share this post


Link to post
Share on other sites

I am not giving you my opinion. I am giving you my experience.

My render loop can draw 80+ materials, over 20k tris total without even pulling the CPU out of the energy saving mode.

You are cracking your head open, spending your time which will never came back... to optimize for an API which is dead in the water and has been for quite a while.

But... you are free to make your choices.

 

There are lots of people that are still supporting DX9, and I think it makes perfect sense to optimize a rendering sequence in an existing program.  The algorithm runs on the same GPU regardless of which API you use, it is just a different API so I don't really see why you are pushing so hard about DX9 being dead.  The API still exists, and will continue to exist more or less forever in the Desktop environment.  Small batches cause issues at some point in DX9, but there are many ways to address those types of problems.

 

@Promit: You are right of course.  The general case is that in D3D9 if you are doing lots of small batches that the CPU will become the bottleneck pretty quickly.  However, in some cases it could be possible that you are also causing the GPU to be inefficient.  I guess this is why you need to profile before you can find and fix the problems!

1

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0