Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!

Jason Z

Member Since 04 Feb 2004
Offline Last Active May 21 2015 06:59 PM

#5191124 D3D11 Graphics Debugging under VS2012 (Missing Call)

Posted by Jason Z on 04 November 2014 - 09:33 AM

Are you capturing a full stream, or only a frame?  You could try to verify that the buffers were properly created by calling the GetDesc member function and verifying that the object allows you to actually access its data.  That way if your graphics tools are not catching the second buffer creation then you can still rule the creation part out.


Do you also have the debug runtime enabled?  If you enable it, then any obvious misconfigurations (like a potentially missing buffer) will get printed to the output console.

#5189213 Need some help, can't figure out what's wrong

Posted by Jason Z on 26 October 2014 - 06:56 AM

Ok I am trying to fix it but what does this mean "16 byte aligned boundaries" I don't even know what that is. And why do they have to be 16 byte aligned?

If you go to the link in my original answer, you will have a decent description of what the alignment of an object is, and why it matters in the case of the XMM registers.  I would also like to say, that you have received a number of good answers (and admittedly a few not so good ones too...) which should be more than enough for you to continue on debugging and experimenting on your own.  If someone points you towards alignment issues and you don't know about alignment, start to research it.  If you type in "C++ memory alignment Visual Studio" in Google, I'm 99% sure there is a full explanation waiting for you.  You should be willing to take the second step on your own, instead of waiting for someone to fully explain a basic concept to you.


Regarding the declaration syntax for aligned variables, you could do something similar and look up the documentation about the declspec keyword, where you are sure to find answers.  Take the initiative, and you will make much faster progress.

#5188357 [Solved] Stretching bug in Parallax Occlusion Mapping

Posted by Jason Z on 21 October 2014 - 12:45 PM

For case #2, I think that is an authoring problem.  If you assign texture coordinates in such a way that the texture itself is stretched more in one direction, then that is something you need to correct when you create your geometry - it isn't a problem to be solved in your shader!


I think the non-uniform scaling is also a very special case type of problem.  Do you really need non-uniform scaling on a cube?  I would say you should simply apply the texture coordinates to the geometry with the appropriate scaling that you want, and then just use uniform scaling and forget about it the issue!

#5188228 [Solved] Stretching bug in Parallax Occlusion Mapping

Posted by Jason Z on 20 October 2014 - 08:18 PM

It is hard to say what the issue is, but I would guess that either your input data incorrect (i.e. your normal space is not correctly defined at each vertex) or perhaps your matrices are not being passed correctly.  I recall seeing this type of error quite a few times during my own work with POM, so it isn't unusual.  My bet is that the matrices are incorrect, but of course that is just a guess...

#5187862 Help! GS StreamOutput..

Posted by Jason Z on 18 October 2014 - 12:36 PM

You can actually stream output and rasterize at the same time, you just use multiple stream outputs in your geometry shader.  You would append the single float4 to your stream output stream, and then just send your other geometry out another stream to be rasterized.  Have you tried that out yet?  Perhaps if you could show your steam output declaration entries, it might help to understand what you are currently set up for.

#5187822 A stable portable threading implementation

Posted by Jason Z on 18 October 2014 - 06:08 AM

Being able to start threads is like 0.5% of the work of doing useful parallelism.

I recommend Intel Threaded Building Blocks or Microsoft Parallel Programming Library (which _is_ portable!) as they help you solve the actually hard stuff.

I think this is a pretty insightful comment - the machinery of making threads is one thing, but being able to make good use of them is of course much harder.  Under the assumption that you are aware of the myriad issues with multithreaded program design, the higher level libraries that Sean mentions here will help you considerably in safely utilizing more of your available parallelism.  It is at least worth checking the docs on those libraries to see how they handle certain situations, and then use that to inform your own design if you go that route.

#5187560 Why not use UE4?

Posted by Jason Z on 16 October 2014 - 08:15 PM

Another point that I find attractive about both Unity and Unreal 4 is the built in cross platform capabilities.  I don't know anyone that enjoys resolving cross platform issues, so having a system designed to minimize that pain is a good thing all the way around.  That wasn't such a big deal a couple of years ago, but nowadays there are lots of platforms to target...


I can also agree with Phantom's statement about the 5% not being such a big deal for your first game project.  If your game makes enough money for that 5% to become significant, then you are pretty successful and won't mind that royalty.

#5187544 Should I try to optimise the World matrix build like this?

Posted by Jason Z on 16 October 2014 - 07:37 PM

Why not have different methods for each case - if you know an object is only going to be using translation and rotation, then don't include the other calculations.  The other thing you can do is to decompose those matrix multiplies into a direct calculation for each element of the end result matrix.  That lets you factor out common calculations and reduce the overall number of multiplies to perform.

#5187262 Why not use UE4?

Posted by Jason Z on 15 October 2014 - 05:20 PM

For me, it is quite similar to a few others' arguments.  My engine was actually the vehicle that I used to learn about graphics programming (and general programming too), and I wouldn't trade that for anything.  Once you get attached to your own engine, it is pretty hard to make the decision to dump it and go with something else, no matter how awesome it looks.


If you are just in it for business reasons, then one of the low cost engines is probably an attractive way to go.  But if you are trying to understand and learn, then starting from zilch is still the best way to understand what you need to do.

#5186484 Multiple windows and views - help me understand Direct3D11 a little better?

Posted by Jason Z on 12 October 2014 - 09:04 AM

If you want to check out a sample program that demonstrates using multiple windows, you can check out the 'ViewFromTheWindow' sample in Hieroglyph 3.  It renders the scene to a single off screen render target, then renders sub areas of the window to each swap chain of many Win32 windows.  If you have any questions about how something is done in particular, I would be happy to answer them!

#5177475 Game development for Oculus Rift, where to start?

Posted by Jason Z on 01 September 2014 - 01:04 PM

I actually integrated Rift support into Hieroglyph 3.  It wasn't too difficult, and took about two days worth of work.  I utilized their documentation and their sample programs to see how to interact with the SDK.  Admittedly, the documentation isn't fully descriptive, but there is enough content to get the idea.

#5177128 What is your development environment?

Posted by Jason Z on 30 August 2014 - 05:23 PM

1. Win7

2. Win7+

3. C++11 and Visual Studio 2012

4. DirectXTK and Lua

5. Rendering Framework

6. Nothing - I am content with the tools that I am using, which is why I chose them :P


I am using Direct3D 11, so my use case may not be what you are looking for.  But anyways, the entire tool chain is free, so it is at least an option for beginners or indies.

#5174814 Best way to traverse a 2d array to dertermine the winner in Tic-Tac-Toe

Posted by Jason Z on 19 August 2014 - 01:58 PM


While the solutions posted here are really interesting, is it really the best thing to tell a beginner to use low level bit operations to check if someone wins at tic-tac-toe?  I would recommend just iterating through the board, checking each of the possibilities (as already mentioned, 3 horizontal, 3 vertical, and two diagonal).  Once that is working, then you can start to try to optimize the solution (i.e. create separate functions for each type of check, build incremental lists of winning moves, or whatever). 
However, all of those are just for learning - I can't believe that a check that is done once for each of the 9 moves in a game is really a candidate for doing abstract optimizations...

I have written code for a lot of board games. The first thing I do is come up with a board representation, a move representation, and functions to make moves, undo moves, generate moves and check for end-of-game conditions.

If you are writing a GUI where these things will only be needed once per move in a game, you normally don't have to think about it too hard, and any naive implementation will do.

But if you are writing any type of AI, you are going to have to consider gazillions of moves internally, whether you are using minimax, MCTS or something else. The performance of those basic routines really does matter, and there are clever implementations to be found for pretty much every game I can think of.

Tic-tac-toe is a learning tool, and it's a good opportunity to learn how to think of these clever implementations as well.

EDIT: One more thing: This is not the "For Beginners" forum. The thread I linked to was in "For Beginners", and I was reluctant to describe the fancy bit-manipulation method there.


That is a completely valid point - I was just making an observation based on the nature of the question from the OP.  Like I said, you solutions are really interesting, and they may just be what the OP was asking for.  I just thought for the game at hand it was slightly more than what was required.

#5174681 D3D11DeviceContext::DrawIndexed Does'nt Draw anything

Posted by Jason Z on 19 August 2014 - 05:14 AM

Just  a follow up, if you pass an integer to the std::vector constructor, it will create a vector with that many elements in it that are default constructed if you don't pass a second value.  This is called the 'fill' constructor.  Since UINT doesn't have a default constructor mechanism, you end up with the contents of memory in your vector.


See #2 here: http://www.cplusplus.com/reference/vector/vector/vector/

#5174102 D3D11DeviceContext::DrawIndexed Does'nt Draw anything

Posted by Jason Z on 16 August 2014 - 10:04 AM

Some common things to check are:


1. Your geometry is being transformed out of the viewport (possibly due to matrices being incorrect).

2. Your geometry is being culled by the back face culling check in the rasterizer (test this by disabling back face culling).

3. Your pixels are being discarded by the depth test (are you clearing the depth buffer each frame?).


Most of these cases can be found quickly with the graphics debugger (on Win8) or perhaps PIX (on some Win7 systems without the platform update).