NightCreature83

Members
  • Content count

    1211
  • Joined

  • Last visited

Everything posted by NightCreature83

  1. 3D Question about Font and Text in Direct3D

    You can just z test the stream of characters so turn depth test enabled on for text rendering
  2. NVIDIA Optimus enablement

    They actually have dedicated output paths to HDMI, so in the case of the hybrids they all run the external outputs over the iGPU which adds a frame delay to the frame being rendered. Also there is no 1060m NVidia did away with the mobile lineup and just sticks desktop grade chips in the laptops now (maxwel2 already paved the way for that its why a 970m is so powerful and is actually comparable to a 960 desktop chip). For video and display purpose this doesnt matter that much but for VR it does because the tracking needs to match the frame rendering. This is why its important that if you have a laptop and you want to buy a VR kit you check its VR Ready.
  3. NVIDIA Optimus enablement

    You can see here that the NV chip is not connected to any real outputs and as mentioned earlier the OS fakes all of this stuff for you. I did a dx diag on a desktop PC and the "Device Type" lines dont show up in that log, which to me means all devices in there are Full devices. Besides you dont really want to transport your framebuffer over PCI-E to display each time. If the GPU is used as GPGPU you dont need it to output anything that is true but its also most likely not doing rendering work at that moment in time. My NV 970M GTX says the same thing Render-Only Device, this means that most things work but stuff like VR is impossible. It can render everything but the latency of the VR kit itself is so bad you cant use it.
  4. NVIDIA Optimus enablement

    As Hodgman mentioned earlier in an Optimus setup there are no outputs bound to the dGPU they are all bound to the iGPU, this is also why VR doesnt work on these kinds of cards. And why we are now getting laptops like we had in the past that have direct connections again. Can you list what dxDiag says if it tells you the NV chip is render only it has no output things to enumerate.
  5. C++ Overloading Question

    If you pass primitive types by value to a function const is not needed on that parameter. The code outside wont see any changes you make to the parameter anyway.
  6. NVIDIA Optimus enablement

    In DX11 and upwards you dont need optimus or the amd equivalent to select the graphics device, you can actually detect if the device has dedicated memory assigned to it, if so its a dGPU. When you select your DXGI adapter pass this to the Device construction function and you will always select a dGPU. The following piece of code shows you how to achieve what that article is listing for D3D11, with the exception that it will accept a NVidia or AMD chip as the rendering adapter. IDXGIAdapter* adapter = nullptr; IDXGIFactory * pFactory; HRESULT hr = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)(&pFactory)); if (hr == S_OK) { for (size_t counter = 0; hr == S_OK; ++counter) { adapter = nullptr; hr = pFactory->EnumAdapters((UINT)counter, &adapter); if (adapter != nullptr) { DXGI_ADAPTER_DESC adapterDesc; adapter->GetDesc(&adapterDesc); if (adapterDesc.VendorId != 0x8086) { break; } } } pFactory->Release(); } Within windows the DX11 adapter selection will respect your choice, the only thing the preferred GPU setting in NV control panel does is list the NV GPU first in the adapter list which works for applications that always choose adapter 0. BTW: VedorId 0x8086 is Intel you can find AMD (0x1002 this is actually ATI) and NV(0x10DE) on google easily
  7. C++ Naming convention on interfaces in C++

    Underscores are evil and should never be used in anything, camelCase for the win. That being said do what you like in your own projects and stick to your own conventions. When working in another project were you are collaborating with other people conform to the convention of that code base or agree on a common convention and stick to that. I have worked in a few code bases that use C and S for classes and structures in the naming but dont use this in the filenames and just use the logical name of the class. Personally I have the C, S I and other sort of Hungarian but not really prefixes, I much rather see sensible names for variables and classes so I can at a glance see what they are supposed to do, or at least give me a clear idea of what they should do. Making code readable and understandable is far more important than sticking to a particular way of casing or pre/post-fixing names or Hungarian coding. Besides a good IDE will actually show you what type something is when you hover over it when you need to know it.
  8. C++ / OpenGL Particle Generator help

    I have used D3D11 for a while now I still use these tools to figure out what goes wrong if something isnt showing up as I expect them to show up. Using tools only makes it easier to find the location where your problem is and thus much easier to solve your issue.
  9. C++ / OpenGL Particle Generator help

    You could try using CodeXL to see if your OpenGL commands are actually handles by the gpu. This should also show you the GPU state and such so that you can see what is actually wrong. Renderdoc is another tool for this but the openGL support for that is not optimal had it been d3d or vullkan you could have used that tool which is really good at debugging graphics and is used in the industry by AAA game companies.
  10. There are also free tools out there written by gamedevs like https://mtuner.net/
  11. Where to create bullets - in Player or in World?

    I would spawn a SpawnBullet/SpawnResource message and have whatever needs to deal with that message pick it up. This way you can stick the control handling in player or player input handling but not have the responsibility of creating a bullet inside the player. Also this message should carry all needed information to spawn that resource in the world.
  12. New job in games is killing my passion

    If you are in a bad situation job wise and its not you but the fit is just so off that stay will do more harm to you personally than going, my advice is leave. I have been in that situation and stuck around worst option ever, my last year at the job was hell to be honest (bad fit, reason I was on the project was kicked off the project all kinds of things that just killed my motivation to go to work), the only option in that case is leave. Verbally accepting an offer is not the same as actually signing the contract you can back out of these things, its not great to do this but you haven't signed anything yet so there is no real legal obligation yet. Also never ever accept an offer if anything feels off, even if its the littlest thing you (the reason why my last job was such a bad fit). The hardest thing to learn when entering the games industry I found is that it's a job at the end of the day. What this means is that you have to make sure for yourself that the job you accept fits with you, you are more important than the company when it gets down to the line for yourself.   In the first year on my first game(DiRT2) I learnt more about writing software and implementing things than I ever did on my own to be honest so keep that in mind too, as mentioned in previous messages
  13. I used pygments to do some parsing with, its fairly straight forward and will tell you what token each word in a script is. Pygments supports a lot of languages, I for example used it to figure out what the arguments and names of public function were in a actionscript 3 class. This took me about 3 hours to write most of that time was not spent on integrating pygments to the script. Pygments is mostly used for langauges highlighters in text editors, it allows you to define the grammar it matches the string against too. You might want to look at abstract syntaxes to understand the meaning of the concepts mentioned in parsing.
  14. HLSL Shader for multiple light source types

    IMHO Deferred shading solves this problem.   You can go much further with tiled deferred and forward+ and clustered forward or deferred shading, these techniques allow 1000s of lights in a scene whilst maintaining shading performance. These techniques create light lists that only shade the geometry that is in the view frustum subdivision the light affects. http://www.humus.name/Articles/PracticalClusteredShading.pdf The choice for forward or deferred matters more on the scenes you are making and whats in it than on how many lights you can have with the above techniques. If you have lots of transparent surfaces that are affected by light forward shading is much simpler to use.
  15. SOA and cache locality

    In your particular case however your access in that loop is not cache friendly because the arrays are stored after each other if declared and created at the same time. Had you looped over all x's then y's and then z's you would have had a cache friendly access. The trick is to layout your data in such a way that when you need to access that data you access all/most of it in the same loop.   Herb has done a talk about the benefit of looping in order through your data and has some slides that show what happens an why. ( https://channel9.msdn.com/Events/Build/2014/2-661 there is more in this talk than just that.) https://view.officeapps.live.com/op/view.aspx?src=http%3a%2f%2fvideo.ch9.ms%2fsessions%2fbuild%2f2014%2f2-661.pptx   Ps: on most PC hardware the cache line size is 64-bytes.
  16. Unity Xamarin IDE (Win10) - Your Opinions?

    Seeing Xamarin is now a part of visual studio (https://www.xamarin.com/compare-visual-studio) why not use Visual Studio Community edition to begin with.
  17. pre-increment versus post-increment

    The difference between the two operations is that post will return the previous value of the variable you increment when assigning to a variable. In the case of user types, like iterators, this can come with a copy cost and as such the rule started to exist that you should prefer per-increment for a loop variable. When user types are involved the compiler cannot see the optimisations anymore that it can do for POD types, most likely a ++i and i++ will both result in to a inc eax assembly instruction in the case of a for loop. But when its implemented as an overloaded operator the compiler has to insert that code there. As a simple example this code with a release compile on VS2015: int i = 0; int y = ++i; int x = i++; //can be a fair amount of code in between here std::cout << i << x << y; Will generate this assembly: 00007FF6718C9C43  mov         edx,2   00007FF6718C9C48  mov         rcx,qword ptr [__imp_std::cout (07FF6718CD1C0h)]   00007FF6718C9C4F  call        qword ptr [__imp_std::basic_ostream<char,std::char_traits<char> >::operator<< (07FF6718CD198h)]  00007FF6718C9C55  mov         rcx,rax   00007FF6718C9C58  mov         edx,1   00007FF6718C9C5D  call        qword ptr [__imp_std::basic_ostream<char,std::char_traits<char> >::operator<< (07FF6718CD198h)]   00007FF6718C9C63  mov         rcx,rax   00007FF6718C9C66  mov         edx,1   00007FF6718C9C6B  call        qword ptr [__imp_std::basic_ostream<char,std::char_traits<char> >::operator<< (07FF6718CD198h)] Which shows that for integers the compiler can compile the increment away completely. When you wrap that code in a for loop you get a sub asm call followed by a jne on the counter value to jump back to the beginning of the loop.
  18. Unmaintainable code

    Came across this the other day and thought I would share on how not to write game code: http://hg.icculus.org/icculus/lugaru/file/97b303e79826/Source/GameTick.cpp#l7276
  19. Getting rid of void*

    It sounds to me that you are deriving from a base class, why not cast to that instead of the void*. Added benefit is that you can just call the handle function on these classes, assuming its part of the interface.   class EventHandler { public:     void HandleEvent() = 0; };   template<class T> class EventHandlerT : public EventHandler { };   THis would work fine and you can now store pointers to EventHandler instead of void* in a container. std::function and std::bind are options you should avoid in favour of lambdas if you can, lambdas are more efficient.
  20.   As I said, the original idea was to enforce a certain semantic for a certain type. IE:   - int, float, bool are passed as value - std::string, std::vector<>, user-defined structs are passed via const reference - user-defined objects are passed via pointer   so the idea was, that if I called such a function, it would enforce the correct semantic automatically in the function signature: int x = 1; dummyFunction(x); // works dummyFunction(&x); // doesn't compile, int is only passed by value Object* pObject = new Object(); dummyFunction(pObject); // works dummyFunction(*pObject); // doesn't compile, objects are only passed by pointer So if I just put auto&&, it would take whatever I pass to it (like int***** as an extreme case), and I didn't want that. Apparently this isn't possible with the type-trait template that I made. So what I'm now going to do is akin to this: template<typename Type> void function(Type type) { // clearType-trait removes const, reference, pointer static_assert(std::is_same<Type, typename semantic<typename clearType<Type>::type>::type>::value, "Type is passed with an invalid signature."); } This should make sure that the signature fits the expected value for the underlying type, and since all calls of those type eventually come down to my variant-class, I can just put it there and be fine with it, I assume.   Auto&& allowes that its a universal reference so it even maintains const correctness and accepts both pointer, reference and pass by value semantics.
  21. Why not stick an "auto&&" in your function instead of the specific type, if you use a modern (C++14 compiler) that would work, and would also be easier to read.
  22. How do you finish a game!

    This happens in AAA games too, if you dont make a plan at the beginning you will never get your time schedule in order. The worst thing to happen in a game is start the production phase without having a design in AAA because you are running behind already things cant move forward without a design.
  23. How would Trump influence foreign game devs?

    The Euro isnt pegged to the USD, they float seperatly from each other, so the USD dropping shoulnd't have a dramatic effect on the Euro. Just means EU and EU produced goods got more expensive for USians.
  24. Unmaintainable code

    This needs a bump to show what not to do when writing code.
  25. Fast Approximation to memcpy()

    Lets not care about anything :) template<class T> void memcpyApproximation(void* dest, void* src, size_t size) {     T::memcpy(dest, src); }