Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.

Jason Z

Member Since 04 Feb 2004
Offline Last Active Yesterday, 10:26 AM

#5168279 How dangerous is returning a initialized pointer in C++?

Posted by Jason Z on 21 July 2014 - 08:16 PM

What are you trying to accomplish with this design?  You could just as easily stack allocate the EngineAPI object in your main function, and then pass around a pointer to that object.  This would control the timing of the object creation, it would trivially ensure that the object is destroyed when it goes out of scope, and there is no question of ownership or shared ownership.  I usually default to the simplest solution with the fewest strings attached to it, and unless you have a good reason to hide the object creation behind a factory/singleton hybrid method, I think you are unnecessarily complicating this!

#5168272 Why Java games do not need installation

Posted by Jason Z on 21 July 2014 - 07:43 PM

That only tells me your games aren't complex enough to require an installation procedure.

That seems slightly misguided - I wouldn't count requiring registry settings or special installation locations as a measure of complexity...


To the OPs original question, it is clear that you need the java runtime environment for running your game - so as the others have mentioned, you have just been lucky so far that nobody tried to run your game without it already installed.  C++ has similar requirements in the form of the redistributable packages on Windows (not sure about Linux though...).  So the overall answer to your question is that you actually do require an installer, you just haven't run into a user that didn't have your pre-requisites already installed.

#5166563 Drawing levels and scanning them in 2D

Posted by Jason Z on 13 July 2014 - 06:34 AM

If you want it to be fully automated, that might be quite difficult to implement, as it would require computer vision algorithms to figure out where each object is and to pull them out.  However, if you do a partially automated system it might be pretty easy to get going.  You just scan the drawing in high res, then do a guided parsing of the file (i.e. you lasso an object, then use the image processing techniques to select all the details).

#5166496 [HLSL] Copy content of Consume Buffer to Structured Buffer

Posted by Jason Z on 12 July 2014 - 06:23 PM

If I'm correct I could solve this by copying the content of the consume buffer to an auxiliary structured buffer with CopyStructureCount. Will try and report results

That's right - and if you have the debug device activated, then you should also get warnings / errors about binding the same resource for input/output (UAV) and input (SRV) at the same time.

#5166329 Mipmaps not used with multiplied texture coordinates

Posted by Jason Z on 11 July 2014 - 06:33 PM

Beware that it's very slow, but will always produce correct results according to the D3D spec.

Off topic: The only caveat here being that multithreaded context behavior is not easily reproduced on the reference device, so if you have bug due to multithreading the reference device won't help you!

#5166081 Device or Context lost. Should I bother?

Posted by Jason Z on 10 July 2014 - 03:55 PM


Device and Context cannot be lost, but Swap Chain can be (though you have to reinstall driver or physically remove GPU). Read more here: http://msdn.microsoft.com/en-us/library/windows/apps/dn458383.aspx

If you read that, it's a lot more than the SwapChain being lost. You have to recreate the Device and all resources.

It's worthwhile IMO since drivers crash and the OS has to restart them sometimes, which is equivalent to reinstalling a driver or removing/replacing the GPU. Borderlands 2 did this for me a few months ago when my GPU started overheating (dust buildup in the heatsink) and it was nice that I didn't lose hours of play but rather just had a few moment of intermittent pauses/screen-blanks before I decided to find out what was wrong.



That's probably true for a production game like Borderlands, but for anything less than a commercial product it is most likely overkill.  If your graphics driver crashes, there are some serious issues, and most people wouldn't expect a game to continue running through that...

#5165925 Having a problem getting data from .obj file to render (index / Vertex buffer...

Posted by Jason Z on 09 July 2014 - 07:08 PM

Does your data look correct on the pre-VS tab for the vertices?  If so, then it may be an issue with your projection matrices, since your x values are squashed to zero.  I would guess that this is not the case though - I would bet that your data pre-VS is not correct, and that you have a data alignment issue in your vertex buffer.  Double check to make sure that the positions in your vertex buffer all match what is given in the OBJ file, and if they don't match then you probably have an alignment issue!

#5165541 How to use external variables in HLSL?

Posted by Jason Z on 08 July 2014 - 07:53 AM

@AvengerDR: That looks like an interesting approach (although you wrote much more C++ code than just writing the shader by hand :P ).  Do you have any further information about the system written up?

#5165027 Black smoke alpha settings

Posted by Jason Z on 06 July 2014 - 06:29 AM

I would use the same setup for any color of smoke - use billboards (which are just textured quads) and additively blend them together in a particle system that models the behavior of the smoke.  I normally use PNGs while developing, but you would likely want to switch to a processed format later on when you deploy your application.  That let's you load it faster into your application specific format.

#5164869 Wrote some simple SharpdDX tutorials, what do you think?

Posted by Jason Z on 05 July 2014 - 07:20 AM

I echo the call for D3D11 versions :)

#5164421 DirectX 11 Orbit Camera

Posted by Jason Z on 02 July 2014 - 04:46 PM

You can use your current view matrix functions, and just modify their input to an appropriate new model.  For example, if you want the camera view to rotate around an object, your look at point would be the center of the object.   Then the location for your 'look from' point can be calculated with spherical coordinates each frame.  This lets you easily increment the values of the spherical coordinates, which then get translated into a position.


Like Buckeye said, there are lots of ways to do it.  If you provide a little more detail about what you are currently using for your view matrix generation, we can probably give you a more specific answer.

#5164023 How to monitor video card memory

Posted by Jason Z on 01 July 2014 - 05:27 AM

I don't think it is possible to monitor all memory allocations and their locations for video memory.  On modern architectures the GPU memory is virtualized, meaning that more than one process will have GPU memory allocated at any given time (including Windows itself).  I believe the switch to DX10+ will help you in this situation, since DX9 was not a virtualized memory model. 


What you can do is to monitor your own memory allocations.  Anywhere that you allocate an object that resides in video memory, you can track it and keep a record of how much memory you have consumed.  Then this can be compared with the physical video memory of the system, which can be acquired through DXGI interfaces.


May I ask how you found out that the crash was caused by allocating too much memory? 

#5163734 Execute shader depending on what's visible on screen

Posted by Jason Z on 29 June 2014 - 05:52 PM

That's what I've meant. As soon as Hodgman has mentioned STALKER and raw D3D stuff being out of the picture, no soul seems to dare to reply unsure.png


I don't have any problem with the STALKER engine - I just don't know how to implement what you are asking without access to the API...  Is it really necessary to use the STALKER engine, or could you upgrade to something more open?

#5163733 Simulating lighting using volumetric meshes.

Posted by Jason Z on 29 June 2014 - 05:43 PM

I'm not sure about OpenGL, but in D3D11 you have to render to a slice of a 3D texture at a time.  If you want to fill the 3D texture will data, I would suggest using compute shaders rather than directly rendering...


Posted by Jason Z on 29 June 2014 - 05:40 PM

You can always create your vertex buffer as a structured buffer or byte address buffer, and then us SV_VertexID to manually unpack your data in the shader. However it's almost certainly not going to save you any performance.


It won't save performance for sure, but it opens lots of doors for you.  Indirect draw calls are much easier to do with a structured buffer as the data storage system for example.