• Advertisement

Chris_J_H

Member
  • Content count

    28
  • Joined

  • Last visited

Community Reputation

256 Neutral

About Chris_J_H

  • Rank
    Member
  1. Introduction to Game Programming with CUDA

    Great article - I was left wondering what aspects of Game Programming are successfully implemented utilizing GPGPU techniques (over and above cutting-edge graphics of course)...
  2. Loading an Image cause game lag

    Also - I understand that performance is generally better if your image/texture is sized on each dimension as 2^n (so here 512/1024/2048/4096).... and pre-processed mip-maps obviously... (all your mip-maps will be powers of 2 also)
  3. Thanks - that makes sense.
  4. nfactorial - yes, I think you are right if the Process doesn't need to be paused independently (which I guess mostly it doesn't....) - it can also get more complicated in some processes such as Sound Processes whereby actions must be performed entering and exiting the paused state...- however, this was just a simple example to illustrate the general concern of mixing implementation detail and interface in the same virtual functions.
  5. Good link! Gets right to the heart of the matter.... I've been taking examples for game system designs from Game Coding Complete which mostly uses Public Virtual Interface methodology and have suffered with the complexity of my derived classes. The alternative is much kinder on the smaller-brained.
  6. Hi - apologies if this is a bit vague but I am trying to understand the consequences of some base class design choices in my game engine. Below are 2 simplified Process classes that are designed to be used as Base Classes. It seems to me on the face of it Process1 is a better design choice as it demands way less of clients' derived classes - eg, having to remember to invoke Process1::VPause() - although I guess there is a loss of flexibility... In Derived2 for example the client could choose not to pause the process if some condition is met.   Insight/Advice appreciated - is there a better way? I really hate the routine requirement to invoke the base class VPause()... it seems to be asking for trouble.   [source lang="cpp"] class Process1 { public:     virtual ~Process1();       bool GetPaused() const {return m_bPaused;}     void SetPause(bool b) {if (b!=GetPaused()) {m_bPaused = b; VPause(b);}}   protected:     virtual void VPause(bool b) { }   private:     bool m_bPaused; };   class Derived1 : public Process1 { //...    void VPause(bool b) override { /* do something - no need to worry about m_bPaused, invoking Process1::VPause() etc*/} };   // --------------------------------------------------------------------------------   class Process2 { public:    virtual ~Process2();      bool GetPaused() const {return m_bPaused;}    virtual void VPause(bool b) {m_bPaused = b;}   private:    bool m_bPaused; };   class Derived2 : public Process2 { //...    void VPause(bool b) override {    if (b!=GetPaused()) {       //...    }    Process2::VPause(b);} }; [/source]  
  7. Thanks - that's helpful.
  8.   I hear you on clearing the whole DepthStencilBuffer and then repopulating (works for the 2 non-overlapping main views)... however, not for the overlapping sub-views.The sub-views are currently updating at the same rate... If they weren't I guess I would have to render them to a texture and render that texture to the screen each frame - right? In fact I may move to something like that in due course as I may need a mini-HUD/frame around the subviews and it does seem a waste to render them as frequently as the main view...  Anyway - interested to hear general approaches to this that would be used... Thanks.
  9. Hi - I am having a bit of difficulty getting my head around how I should be approaching the following problem in D3D11:   My (simple) 3D game has 2 players, split screen showing the main forward views. Overwriting each of the 2 main views there are 2 smaller rectangles with the left & right side views. So in total: 2 main (non-overlapping) views and then 4 additional sub-views (overlapping). In D3D9 it was no problem I could clear the DepthStencilBuffer for each view's view-port and keep rendering to the back buffer in my swap chain. Not so easy in D3D11: I cannot seem to easily partially clear the DepthStencil Buffer.   I have a skybox effect that I can employ with a depthbuffer overwrite which, if I render first, should do the job... but is this the best way? - what if I have no sky...   This must be a common problem, and have seen some discussion in the forums on related issues but don't seem to have a clear understanding of alternative approaches. Insight appreciated.
  10. Hi, I have a variable number of spotlights in my scene and would like to pass in all my lighting info via a single cbuffer update. Ideally something that would look like this:   // hlsl -------------------------------------------------- struct DirectionalLight {     float4         ambient;     //... }; struct SpotLight {     float3        pos;     //... };   cbuffer LightingBuffer            : register (b0) {     DirectionalLight   gDirectionalLight;     SpotLight           gSpotLight[4];     int                     gNumActiveSpotLights; };   // c++ ----------------------------------------------------- struct DirectionalLight {     XMFLOAT4         ambient;     //... }; struct SpotLight {     XMFLOAT3        pos;     //... };   struct LightingBuffer {    DirectionalLight    directionalLight;    SpotLight            spotLight[4];    int                      gNumActiveSpotLights; };   Does the system tolerate the nested structs and struct arrays? - if so, could you give me guidelines to ensure that the packing will match? (4 is the maximum number of active spotLights allowed). Is there a better way of doing this? Thanks.
  11. Thanks MrHeisenberg - I did not know you could use the Windows 8 SDK on Windows 7. Not sure I want to install it though - maybe I'll write my own functions to avoid having to do that.
  12. Help! - I've been busy replacing my custom collision volumes with the xnacollison.h versions to make use of the xnamath.h SIMD functionality... and only just noticed that it doesn't provide the general transform functions for these volumes (ie. passing in a CXMMATRIX instead of the broken down contributions: translation, rotations etc. I now read that the directxcollision library has these functions but I am running on Windows 7 (DirectX June10 SDK) so cannot access it. The 4 functions I need are the (c++) equivalents of: xnacollision.h : TransformSphere(), TransformAxisAlignedBox(), TransformOrientedBox(), TransformFrustum() Does anyone have the source for general transform versions of these functions handy that they could let me have - to save me reinventing the wheel (and probably a lot less efficiently...)?
  13. Algorithm for generating indices

    Suggestion: How about hashing by rounded floating point values.
  14. MrHeisenberg - thanks for your observations. I ran your code on my pc (replacing your test matrix with the identity matrix as it was giving error values in my output, 5mm iterations). I see a 12% speed gain for the optimized functions on x64 and 27% gain on x86 compilations. Given I really only care about x64 at this point, I agree, it doesn't seem a big deal... Then I tested: 1) add inline to the optimized functions and 2) declaring them as _fastcall (which the docs recommend) - neither seem to make any difference within the noise of the data for either x86 or x64. I Then refactored the code to eliminate the calls completely for the optimized calculation: to get a total 21% gain in x64 and 33% total gain in x86 which starts to be more significant. I checked my compiler (VC++) setting for inlining functions: it is at the max (/Ob2): if I change the inline declaration to _forceinline (!) I finally get the same effect using functions as if I had refactored the code... hmm maybe some other settings on the compiler are interfering...
  15. Hi - I am having a bit of difficulty understanding exactly what the documentation is telling me on this... I am using Visual C++ 2010 express compiling for 32 or 64 bit implementation (Windows 7). I am using the XNA Math library (xnamath.h) and wish to write some of my own functions to handle more complex collision detection where I pass XMVECTOR parameters (going further than xnacollision.h). As I understand it, to achieve reasonable optimization, I should: 1) inline the functions       ** This is because standard function call conventions are not great at allowing register passing of SIMD registers, so call overhead best avoided if poss...?** 2) specify _fastcall in function declaration. 3) pass FXMVECTOR for 1st 3 args and CXMVECTOR thereafter.       ** 2 & 3 give the best chance of an optimal transfer of values within the SIMD registers if the inline is ignored by the compiler? **       ** For x64 the docs seem to imply no possibility of SIMD register passing in a function call - so I have to hope it inlines... is that right? ** Thanks for any comments/explanations/insight.
  • Advertisement