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

warning X4714: ~'excessive temp registers'

4 posts in this topic

I am compling the following compute shader using fxc:

[code]void RayCast(uint3 ThreadIndex : SV_DispatchThreadID)
{
RayStruct Ray = GenerateCameraRay(ThreadIndex.xy);
RaySceneResultStruct RaySceneResult = GetRaySceneResult(Ray);
uint PixelIndex = ThreadIndex.x + ThreadIndex.y * ResWidthDiv2 * 2;

if(RaySceneResult.DoesMeet)
{
RayHits[PixelIndex].Direction = Ray.Direction;
RayHits[PixelIndex].Position = RaySceneResult.Position;
RayHits[PixelIndex].Normal = RaySceneResult.Normal;
RayHits[PixelIndex].ObjectType = RaySceneResult.ObjectType;
RayHits[PixelIndex].ObjectIndex = RaySceneResult.ObjectIndex;
}
}[/code]

(where RayHits is a UAV) and I get the following warning:

[quote]warning X4714: sum of temp registers and indexable temp registers times 1024 threads exceeds the recommended total 16384. Performance may be reduced.[/quote]

Performance is significantly reduced.

Simply commenting out the line "RayHits[PixelIndex].Normal = RaySceneResult.Normal;" gets rid of the warning, but, confusingly for me, removing all other lines inside the if statement except that one does not get rid of the warning...

It might be of interest that the asm output shows that 13 r# registers are used without the specified line, and 19 are used with that line (16 being the limit specified by 16384/1024), regardless of whether all the other lines in the if statement are present.

WTF. What makes that line so special, and how can I fix this?
0

Share this post


Link to post
Share on other sites
[quote name='forsandifs' timestamp='1333819691' post='4929098']
WTF. What makes that line so special, and how can I fix this?
[/quote]

Well when you comment out that line you're also going to cause the compiler to strip out all instructions needed to generate the data for that line. So in your case, all of the code in your other functions for getting the normal of the intersecting surface will get stripped out.
1

Share this post


Link to post
Share on other sites
Wow, the compiler is smarter than I thought. I guess the solution then is to simplify the calculation of the normal if possible. Many thanks.
0

Share this post


Link to post
Share on other sites
Hmm, better yet, I'll divide my shaders into single functions, which IIRC is the way shaders are supposed to be coded anyway...

Eg: the code for GenerateCameraRay() will be put into one shader, and the code for GetRaySceneResult will be put into many shaders, one for each type of object, etc.
0

Share this post


Link to post
Share on other sites
Yeah the compiler is extremely aggressive with optimizations, since all of the code run by a shader is compiled simultaneously (expect in the case of dynamic shader linkage) and also because the HLSL language is pretty simple. This also means that function calls are pretty much always inlined, so using them typically has no effect on the resulting assembly. So you're free to organize your functions and #include's however you'd like, and you'll always end up with a tightly-optimized shader.
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