Jump to content

  • Log In with Google      Sign In   
  • Create Account


はとぶ

Member Since 23 Oct 2000
Offline Last Active Jul 17 2014 08:26 AM
-----

#5087153 Using some ConstantBuffer values causing CreateShader to fail

Posted by はとぶ on 18 August 2013 - 06:34 PM

In the end the problem was that I wasn't loading the compiled shader as a binary file, so, sometimes the file read was interrupted before the actual end, thus the CreateVertexShader() caused an E_INVALIDARG because the size of the vs data did not match the actual size of the shader.

 

dogh!...

 

anyways!... thanks for the help!




#5086901 constant buffer data layout mismatch between app/shader

Posted by はとぶ on 17 August 2013 - 05:09 PM

just to complete the post (for anyone else who might run into the same problem and founds this post).

 

After making some experiments with the data layout, it looks like when using more then one data type whose length is less that 16-bytes, the GPU packs them into the same 16-byte "array".

 

What I mean is:

 

If you want to pass properly the data to a constant buffer like this in your shader:

buffer cbPerFrame : register (b0)
{
    float value1;
    float value2;
    float4x4 value3;
};

.

I first thought on giving each independent value a padding like this:

struct ConstantBuffer
{
    float value1;
    float value1_dummy[3];
    float value2;
    float value2_dummy[3];
    Matrix value3;
};

.

Expecting the GPU would read the data with a layout like this:

V1 xx xx xx
V2 xx xx xx
V3 V3 V3 V3
V3 V3 V3 V3
V3 V3 V3 V3
V3 V3 V3 V3

.

However, it turned out that what the GPU is expecting is something like this:

V1 V2 xx xx
V3 V3 V3 V3
V3 V3 V3 V3
V3 V3 V3 V3
V3 V3 V3 V3

.

So, you would have to write your C++ struct like this:

struct ConstantBuffer
{
    float value1;
    float value2;
    float value2_dummy[2];
    Matrix value3;
};

=)

 

just wanted to point it out if anyone runs into the same trouble =P

 

Cheers!




#5010728 GPU's Exection Units stalling and other performance issues

Posted by はとぶ on 14 December 2012 - 02:44 PM

Hi,

I took a trace from the project I'm working on and I saw that the GPU VERY under used, basically GPU's EUs are Active 50% of the time (21% VertexShader, 29% PxielShader), and it's stalled 38.2% of the time, and Idle 11.5%.

I'm taking a look into it, but I'm not sure what kind of things to look for... I asume that the GPU can be stalling because of texture loads, I also found that there are more than 70 render targets used in each frame, so I asume that there must be some overhead in that (though not sure exactly what the penalty is for, creating targets is costly?.. switching to it?)....

What other kind of things could be stalling the GPU?... and if the application is running so slow why it says that the 11.5% of the time the GPU is idle?...

I'd appreciate some light on this Posted Image

Thanks!


#4967806 Is there a way to write HLSL 5 Assembly?

Posted by はとぶ on 09 August 2012 - 08:59 AM

Hi CryZe,

Is there a way to write HLSL 5 Assembly? I don't really like the instructions the HLSL compiler compiles. I could hand optimize about 30% of the instructions if I could directly write the assembly instructions.


Unfortunately no, in DirectX 9 it was something you could do, but starting from DirectX 10 upwards you are not able to write shaders in assambly langage anymore, just to read their instructions... It's a pain, I know.. but we'll have to stick to it.

Here's the reference from MSDN:

Porting Shaders
Direct3D 10 Shaders are Authored in HLSL
Direct3D 10 limits the use of assembly language to that of debugging purposes only, therefore any hand written assembly shaders used in Direct3D 9 will need to be converted to HLSL.


Cheers!...


#4949797 Scene Graph implementation dilemma

Posted by はとぶ on 16 June 2012 - 08:15 AM

haha.. I really wasted a lot of time trying to figure out which was more appropriate hahaha... but yeah, I guess you're right.. thanks to both of you!


#4947395 Visual Studio 2012 Express won't support Win32 Projects

Posted by はとぶ on 08 June 2012 - 09:29 AM

Well, it looks that this is not going to be an "Express only" thing, I've downloaded Visual Studio Ultimate 2012 RC and it has no C++ support either, and i haven't found so far how to enable it or download the C++ part.

the weird thing is that a few weeks ago previews Visual Studio 11 Beta did had that C++ support (and it was quite fantastic to be honest).


#4941920 Using mipmaps with RT's in DirectX9

Posted by はとぶ on 21 May 2012 - 08:30 AM

Really really thank you unbird!..

you are totalli right, I was almost convinced it was not possible, but now, after explictly setting the mip filter to point/linear it's doing it correctly.

thanks the three of you for your help!


PARTNERS