Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Feb 2008
Offline Last Active Yesterday, 12:10 PM

#5162965 Direct3D 11 Swap-Chain Madness

Posted by NightCreature83 on 26 June 2014 - 02:34 AM

I can’t use D3D11_CREATE_DEVICE_DEBUG without the Windows SDK 8 installed, something I fear doing considering apparently some things have to be done through Visual Studio 2012 (which I do not have).

L. Spiro


VS 2012 makes it easier to launch these applications, you can still just manually go into the SDK directory and launch the tool you need from there.

#5162492 Direct3D 11 Swap-Chain Madness

Posted by NightCreature83 on 24 June 2014 - 02:39 AM

Have you turned the Debug runtime on, because as of WIN8 SDK this has to be done through the VS2012 and up window or through executing the settings window from the WinSDK directory. It will not turn your debug runtime on other wise even though you did set it on in the D3D june SDK. http://blogs.msdn.com/b/chuckw/archive/2012/11/30/direct3d-sdk-debug-layer-tricks.aspx

#5155183 Templates causing linker errors.

Posted by NightCreature83 on 22 May 2014 - 02:44 AM

template <class T>
void list_add_end( node_t<T>** list, T data );

If all you do is modify what the list pointer needs to point at please write this in the C++ way, which looks like this:

template <class T>
void list_add_end( node_t<T>*& list, T data );

Also means you don't have to write your pointer modification code like this anymore:

node_t<t>* newNode = new node_t<T>();
*list = &newNode;
//instead you can just write this
node_t<t>* newNode = new node_t<T>();
list = newNode;

#5154786 Location of data in the class

Posted by NightCreature83 on 20 May 2014 - 05:31 AM

Not what I wanted to hear, but thank you anyway :3

there's no way to ensure no padding is there? 

guess it's back to my  float _m[3][3] then

Using these kind of trick, will work but it is also how you write unmaintainable code. And code readability is often more important than ease of writing your code, because in six months time you are going to be wondering why you wrote it that way.


The other way of doing this is

class Matrix44
        float f[16];
        float mm[4][4];
        Vector4  v[4]; //Assuming vector4 is stored as 128 bytes contiguously
    } matrix;

You can now access matrix.f as an array, matrix.mm as a 2D array or as an array of vector4, if you add 16 float variables in the union you get 16 slot access options.

#5154635 c++ class vs struct+functions

Posted by NightCreature83 on 19 May 2014 - 09:01 AM


So just as a reminder to the OP, but a struct is a class in C++, only difference is default visibility level, struct = public, class = private

Heh, this was my first answer-reflex, too. However, on closer inspection, that's not what the OP is asking. The question is not whether there is a difference in having member functions in a struct or class, but rather whether there is a difference between

struct foo{....};
void func1(foo* f);
void func2000(foo* f, type bar);


class foo
    void func1();
    void func2000(type bar);

Jeff8j: Did I understand that you are basically trying to write a C++ decompiler? Knoweth that this is a daunting endeavour, next to impossible.

Decompiling Java bytecode or such into a human-readable source file is easy (the language is kind of specifically made for that, too). Decompiling C or C++ is harsh. While it is certainly possible to identify things as function prologs and such, there is no way of determining a meaningful variable name of any kind, or a function name (unless these are exported as symbols), no way to reproduce something like template instantiations into something that even vaguely ressembles the original, and no way to restore variables (or sub-expressions) which have been eliminated by compiler optimizations.

In one word, it's pretty much a nightmare...


Still the answer to that question is no, effectively this is what a member function does, its first param is the this pointer. So it comes down to how the structure is passed in those functions. If it is by value it is more expensive, because of the copy of the structure, pass by pointer or reference on the first argument to the function it would be the same as a member function.

#5154283 Wonderfully simple OpenGL UI

Posted by NightCreature83 on 17 May 2014 - 10:09 AM

Well where are the cpp files that implement all of the features with just the interface there isn't much to discuss to be honest. Also this will only work for 2d UI, what about 3d UI like this:


What about controller input?


How is the UI constructed, from code, other filed, can I override how a button is drawn easily or which shader is being used to render with?

#5152284 Books (Long post sorry)

Posted by NightCreature83 on 08 May 2014 - 05:23 AM

General programming courses can help in designing code and structure to, MIT and Standford have some awesome open courses you can watch on the internet about this stuff. This also shows you what most university educated programmers have seen so that you can increase your knowledge in areas you werent aware you might needed to know. One of the best topics to read about is logic and set algebra and general algorithm construction and design.

#5151569 Using Directx11 without using a Microsoft math library

Posted by NightCreature83 on 05 May 2014 - 03:56 AM

Yeah D3D doesn't come with a math library so has no requirements really.


The way that you construct your matrices will have an effect on your HLSL code.


By default, matrices in HLSL are stored in column-major element order - e.g. for [column,row], the floats are stored in the order [0,0], [0,1], [0,2], [0,3], [1,0], [1,1], etc....

You can explicitly state the storage convention you want to  use by using the appropriate keyword in front of your declaration, like this:

column_major float4x4 myMat;


row_major float4x4 myMat;


If you use the column-vector convention in your maths, then you'll write mul(myMat, myVec), otherwise if you're using the row-vector convention you'll write mul(myVec, myMat).


You can also just tell the runtime when compiling your shaders which order to use with a compile flag.

#5151386 Resource Cache and Models

Posted by NightCreature83 on 04 May 2014 - 03:52 AM

You probably want to be carefull in how you construct your load units, so that they load only what you need got that unit. Dependency checks in your bundle build step can alleviate these issues, so that you only bundle resources that are often used together. This will remove your problems in that the load unit has to be loaded completely.

#5149376 unhandled exception CreateWindow()

Posted by NightCreature83 on 25 April 2014 - 07:02 AM

You are passing a pointer somewhere that is 0 and shouldnt be zero. This 0xC0000005: Access violation writing location 0x00000000 exception always means you are trying to write to something through a pointer that has value 0.


I expect either strWindowTitle, hMenu or hInstance to be 0.

#5149327 C# for Xbox anyone? I'm excited!

Posted by NightCreature83 on 25 April 2014 - 01:47 AM

While this is indeed encouraging, It is still unclear if C# on XBox One will get the same level of access as the private Indie XBox One program is currently allowed. Specifically, we are not yet sure that apps developed in C# will be considered as Game Apps or plain AppOS with limited resources (don't know the details, but could have memory/GPU restrictions...etc.)

From the details they have leaked at E3 it sounds like you will be considered just windows store apps and not GameOs apps, which means you only have 3bGB of memory and thats shared with the rest that is running in the shared OS.


Most of these apps will just run on windows 8 store too without any real modification to the code.


#5149050 FileSystem Cross-Platform

Posted by NightCreature83 on 23 April 2014 - 03:33 PM

I looked into filesystem boost source code, he uses #ifdef inside one file, he doesn't split, but that end to the same.

It's very full but a lot of function is not needed in a game dev, it's more a lib for soft who needs all about file system.

You can use #if defined() guards too, the split in different .c or .cpp files is another way to achieve this in a less mess way. Code that has a lot of #if defined (PLATFORM_WIN) guards in the code becomes hard to read really really fast, if if you try to minimize this, specially if it is mixed with paths that all platforms need to execute. Having a FileSystemWin.cpp and a FileSystemXOne.cpp with a single FileSystem.h becomes a lot easier to maintain and read.

#5148955 FileSystem Cross-Platform

Posted by NightCreature83 on 23 April 2014 - 07:42 AM


This is not true for everyone, I see this advice too much around here. For some people the fun is actually in writing the systems software and not the game itself, I have done both and I much prefer writing the systems to help other people create the games.
Also remember that for the platform specific implementations you don't need to go with a C interface this works perfectly fine with classes too.

Hey, if writing a cross platform file system floats your boat (assuming you are doing it on your own time and not wasting your employers time), that's cool. Go nuts and sincerely, I hope you end up with something epic that we can all benefit from. smile.png

Most people don't bother with it because it's essentially a solved problem, and unless your solution brings something new, it's pretty much a waste of time (in the context of trying to get a game made).

And yes, I'm aware that classes will work fine, I was illustrating the point with the OPs example.



My comment was more aimed at that we throw this thing at everyone on this forum, but the reality is that in triple A companies you will probably end up developing your own system instead of using a lib. So this is definitely not a waste of time and it is a good thing to know how these things work.


Besides most external libs won't actually work for the consoles you are working on so developing these things is actually worth while.


See on this website we mostly only seem to worry about pc compatiblity, but when you hit consoles or even mobile phones this situation starts to change completely, because they neither support windows api or posix on all spots. And with the new generation it is actually not such a stretch that people here will be able to develop for them to be honest just look at the PSN indie and Xbox Indie programs.

#5148902 Switching between languages/API

Posted by NightCreature83 on 23 April 2014 - 02:22 AM

When I dont spend time on a codebase for a while I will have to read the stuff again and see how I do things, this is normal you can't keep all of this in your head all the time. The thing is though that you haven't actually forgotten how something works it's just the details that you miss, once you have seen them again for once you remember how it works.


I switch between 3 programming languages often, mostly C++/C# the only mistake I always make is array syntax related, if I switch to or from python extra {} are added in python or forgotten in C++.

#5148342 Tips on FileLoader code

Posted by NightCreature83 on 20 April 2014 - 06:02 AM

Just from a coding standard view why are you placing an enter after a function or if conditional and the { and not on an else clause.


I would store the GetLastError code too to be honest or at least trace it to the output log so you can figure out why a file didn't load instead of having error X. This code is also very platform specific, this is ok if you never intend to support another platform. To get a way from this you could use fstreams, but they have no async reads in the way the windows shell file loader does it.


Other than that it looks like a good file loader.