Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 21 Feb 2008
Offline Last Active Oct 21 2016 09:42 AM

#5271814 C++

Posted by on 19 January 2016 - 03:18 AM

http://www.amazon.com/A-Tour-C-In-Depth/dp/0321958314 this is Bjarnes new book on C++ and its more written for people who can already program as in construct an algorithm and just want to pick up C++ as a language.

Scott Meyers books are also good to learn C++ but again these assume you can already program and want to know more about C++ under the hood.

#5270517 Injection LPV Geometry Shader

Posted by on 11 January 2016 - 06:19 AM


Use RenderDoc. It will provide a lot of help in debugging your problem.


Normally your errors means the structure definition between the VS & GS and the GS & PS do not match. It doesn't seem to be the case here, although I never worked with GS that involved points instead of tris.

This error can also happen if you later render something else, and you changed the VS & PS but forgot to take out the GS (very common mistake).


You're also getting errors that your pixel shader is using MRT and outputting to 3 RTs; but you never call OMSetRenderTargets with three different RTs. It looks like you're confusing PSSetShaderResources with OMSetRenderTargets.


And last but not least. Use RenderDoc. It's an invaluable tool which will help you understand what's going wrong.


thank you for your guide

i've used OMSetRenderTargets at the first line of my function.



This error can also happen if you later render something else, and you changed the VS & PS but forgot to take out the GS (very common mistake).


this was an issue !

i also didn't set 3 global variables in my geometry shader thanks to RenderDoc

but still has some issue, i'll let you know if it doesn't solve.


thanks btw


Update : another issue was i didn't return back the primitive topology to TriangleList

this RenderDoc is very useful tool but i have to gain more experience of how to use it and which parts are more important to look at when i facing on any errors.


everything looks fine now, i have to go for propagation step and see the result !


RenderDoc works pretty similar to a normal debugger for C++ code, except that in GPU land you have a few more things to worry about, like pipeline states and stuff like that. A very usefull overlay in the render target view is "Wireframe mesh" this will instantly show you where and whether a draw call hit the render target. Edit from there you usually start with debug pixel in that wire frame overlay so you can see what happens to it, this will also id most of the resources used so you can inspect them.

#5264231 as3 need link for tuturial from scrap

Posted by on 30 November 2015 - 09:08 AM

Hi everyone. I will try to soften you first because i sure that you will answer to my question in rude way, stating that i just don't know how to search google. Ok, so first i must admit that right now i'm in fury(as i can't find what i want). I like to start learning something from scrap to fully understand concept. Like for exsample learning all 3 possibilities of declarating types in c++ or unique tricks like java ToString function. just knowing primal features is not for me, i must know like 99% of everything about programing language to use it as best as i can. I hope that you understood my policy of learning. Now here comes question/asking for favor : i need some very good tuturials for pure as3 language , from scientific way. I mean most what i found was just ""make image, handle event,make game , make game, make game .... bla bla bla"". I dont want to know how function to make rectangle is works(because it obvious), i want to know how it build so in future i can use this knowledge for making own more advance version of drawing rectangle. I want a long tuturial there most of important functions/data types/classes described accurately.


Flash is not really a langauge in its own, you can do most things in AS but that is not how you should use flash. Flash is more of a designer/artists tool to create animated pages in. This is also why most tutorials only show the graphical side of what you are doing. As3 for me is nothing more than a weird mix between C# and Python, as such writing code in it is not that hard when you know C++.


Generally I just use the adobe documentation sites to figure out what a particular class does in Flash, and which methods it has.

After having learned 2 languages I no longer care for knowing all the obscure things in a langauge as long as I know how to express what I want to do.

#5263528 Render GUI elements with projection matrix

Posted by on 25 November 2015 - 02:59 AM

That depends on what you want to do, usually you have an overlay 2D ui to do things like error message boxes or HUD elements but these are 2D ui and are a different scene from the 3D ui one. And they just use normal ortho projection rendering.


Offcourse you can embed rendertargets into the 3D scene to render another UI scene to that, but even for that you dont need to know things about pixels for positioning the elements.

#5263526 Visual Studio Community need to login!

Posted by on 25 November 2015 - 02:56 AM

The login part has its advantages. 


Vs2015 will save various preferences to your profile, and if you reinstall they'll all be fetched from "the cloud" for you.


A worthwhile sacrifice for the service as setting up programs again how I like them is an annoying chore that I'd rather avoid...


There are other things linked to it as well, like your developer status for store apps and beta apis that you can use.

#5263432 Render GUI elements with projection matrix

Posted by on 24 November 2015 - 11:56 AM

Thanks to all for your answers. 


What do you think about using PerspectiveOffCenterLH matrix for this?

Seems it project DirectX units directly to pixels and position correspondingly. Using this matrix 0.0 will be at the top left corner of the window without any additional manipulations.

Step away from the pixel idea for 3D ui pixels dont really matter, the scene is authored in 3D space and its coordinate system. Think in camera composition instead, moving the camera closer to an object will make it appear bigger on screen.

#5263321 Render GUI elements with projection matrix

Posted by on 23 November 2015 - 02:22 PM

I mean that I want to draw controls using true depth feeling, which could be made only with projection matrix. With ortho I need to scale objects manually if I want make them smaller when they are far from the camera.

You will want to just do normal 3D rendering and use a camera to view the menu through. Use this camera idea to frame the UI too it makes it a lot easier to deal with.


In a 3D ui you dont have to care about the 0,0,0 mapping on to the 0,0 corner, this is what the frameing with a camera is for.


If you look at the DiRT and GRID games they all have a 3D ui, and for ease of development we never supported mouse input all input is either keyboard arrows and enter or controller. Doing the unprojection is not that hard but the system we had to create these UIs made that a lot harder, the update side of the UI had no idea of where the rendering of the UI was happening in space. Which allowed for a lot of flexibility in setting up scenes and implementing the behaviour of the screens at the cost of not having mouse input though.

#5262753 No idea about this warning in VS2015

Posted by on 19 November 2015 - 10:25 AM

By upgrading to the latest SDK

#5262432 AS3. Inventory function can't be called in a Scene

Posted by on 17 November 2015 - 11:04 AM

You are trying to execute a function of a none existing object in as. In Flash CC you can start a debug session with ctrl+shift+enter, when this error occurs it should stop at that line of the code, either in the AS file or on the actions tab for a particular frame.

#5261872 [c++ | asm x64] I think I call a function in the wrong way

Posted by on 13 November 2015 - 02:52 AM

Eeh, I must be sounding like a spoiled asshole dry.png I won't argue if you think that of me.
But I'm not that bad a person. Really.

And I appreciate the help.

I'm just bitter because I'm being halted by yet another problem that's only the last in a long streak you haven't seen me deal with. Only, this time it involves assembly, a subject I never delved in.
Could this be solved it'd be the very last brick to complete the wall. Which makes it even more frustrating a problem, 'cause I'm spending several hours on it instead of moving on the other modules in this project.

I'll read the link posted by Nypyren (<-- thanks for it, man), and then, dunno, we'll see...

What are you really trying to achieve, maybe if you described more of your problem in general terms we might actually be able to give you a solution. And that solution might not even need asm to work.

#5261843 [c++ | asm x64] I think I call a function in the wrong way

Posted by on 12 November 2015 - 05:39 PM


The ABI for both the 32-bit and 64-bit code is well documented. There are several large PDFs about it, you need to read them and have a solid understanding of what they are and how they work for all the different calling conventions and parameter types, an understanding of what must be saved and what is invalidated, and know how to convert from one to the other.

So you're saying that I should go read a couple tomes, learn how to do proper assembly, implying that I shouldn't be asking for help in a forum.

Honestly, that wasn't nice. At all.


[...] On the other hand, the 32-bit cdecl calling convention will preserve EBX, EBP, EDI, ESI, ESP, CS, and DS. While the 32-bit code shouldn't be touching the Rxx registers you need to know that they might, so you need to preserve them. Since the memory addresses in 64-bit code may not exist in the 32-bit address space you need to ensure proper virtualization. You don't do either.

You talk to me as if I know this stuff already. Don't you realize that this is the same mistake made by every one of those that write the tutorials on assembly? Those very same tutorials that I don't understand -- because they assume I'm familiar with the subject _already_? If that was the case why would I be reading a tutorial?
And the same goes for the notes on the x64 ABI -- And by the way, by mere luck I know what A.B.I. stands for. But you just threw the acronim in the discussion, assuming that I knew it _already_. See? the same mistake


@ Rattrap:

I understand now. Makes sense.

But still: whatever I write, doesn't work. It crashes invariably. I'm noticing a misalignment with the arguments passed to the function that's crashing. Instead of a pointer to a pointer I'm seeing the address of a local function. And where should be a small integer value I'm seeing what might be a portion of an address. It's as if things were offset to the left or right altogether.


You are trying to do something in asm that is a fairly advanced affair, if you dont understand asm well enough I would not even start with DLL loading and stick with getting the hang of asm first. Visual Studio can show you what asm is generated for C/C++ code when you are on a breakpoint and tell it to show you the disassembly. It should look like this: L3ral.png


Assembly is not a topic you should jump in lightly and x86 and x64 is not the easiest instruction set to get to know. You should start learning asm with a simple board like an arduino or a Rasberry pi, this chips are simple enough to easily understand what is going on on them. From there moving to x86 and x64 is easier, because you understand the basics of asm by that point.


There are some serious tricks going on in some asm code like moving to only the ah or al register and then cmp on the next line with eax or rax, which require that you know things about the architecture of the chips involved. For example: al/ah, ax, eax and rax all refer to the same register for example but with different bit sizes and this is all legacy stuff coming from the shifts from 8 bits -> 16bits -> 32bits -> 64 bits. In x64 you will hardly see any x87 or FPU instructions any more these are almost always replaced by SSE2 instructions. I am surpised that link nypren provided didnt mention the LEA instruction because next to the most common once that lists.

#5260924 char[32] as function parameter

Posted by on 07 November 2015 - 02:40 PM

The syntax for array passing is crazy in C++ but this will do allow you to do this:

template <size_t charCount>
void stringCopy(char (&output)[charCount], const char* source)

I highly recommend you use a template on the array parameter here because this function now works with any sized arrays.


#5258020 Confusion with smart pointers

Posted by on 19 October 2015 - 06:03 PM

You would get access violations if you were trying to access member variables in those functions on very low address. Like access violation at 0x00000008 for example, usually when seeing these low address values in access violations it indicates that your object access has been cleared. Because members are usually accessed by adding the field offset to the object memory address.

#5256990 Migrated from VC++ 2008 Express to Visual Studio 2015: Now getting linking er...

Posted by on 13 October 2015 - 01:32 AM

Or if you have the code for that library rebuild it with VS2015

#5256818 Hash on gpu?

Posted by on 12 October 2015 - 02:57 AM

The question I am asking myself is why do you want to do this on the GPU. If its just to have a resource name changed in a hash the CPU will do fine for that.