Jump to content

  • Log In with Google      Sign In   
  • Create Account

Giallanon

Member Since 25 Apr 2001
Offline Last Active Today, 04:10 AM

Topics I've Started

HLSL matrix, colum major

15 May 2014 - 05:58 AM

There's something I don't understand with the way DX11 HLSL parse a constant buffer when it's time to "transform it" in a matrix.
I've declared a constant buffer like this:
 

cbuffer cbPerMesh : register( b1 )
{
   matrix<float,3,4> World;
}

 
The shader is compiled with D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR.
 
The shader expects to receive matrix in a colum major form, but it's not working as I supposed to.
I'm feeding the shader with this data:
 

f32 temp[12] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
gpuProg.updateConstantBuffer (hCBPerMesh, &temp, sizeof(f32) * 12);

 
To my understanding, the World matrix should be like this:

1 2 3 4
5 6 7 8
9 10 11 12

 ie: 3 rows, 4 columns per row, feeded by an array of 12 floats.

 
By debugging the shader, I'm able to see the following:

Data buffer:
#,Indirizzo,Float4
0,[0x00000000-0x0000000F],{+1, +2, +3, +4}
1,[0x00000010-0x0000001F],{+5, +6, +7, +8}
2,[0x00000020-0x0000002F],{+9, +10, +11, +12}

which is right, and means that I'm transferring the buffer correctly.
 

 

What I don't understand, is that the World matrix, inside the vertex shader, appears like this:
 

World[0] x = 1.000000000, y = 5.000000000, z = 9.000000000, w = 0.000000000 float4
World[1] x = 2.000000000, y = 6.000000000, z = 10.000000000, w = 0.000000000 float4
World[2] x = 3.000000000, y = 7.000000000, z = 11.000000000, w = 8.660300000 float4


I see 2 "errors":
First, my buffer is not taken as a colum major, otherwise World[0] should be like "1, 2, 3, 4"
Second, where are my "4", "8" and "12" left? They are skipped when the compiler parse the buffer into the matrix.
 
 
To fix this, I have to transpose() my buffer, and then declare

row_major float3x4 World;

This way everything works as expected


How to detect only attached device using win32 GetRawInputDeviceList?

05 December 2013 - 02:16 PM

I'm using GetRawInputDeviceList() to obtain a list of input devices, and it's working fine, but it returns something like 3 o 4 keyboards and 2 or 3 mouses even if I only have 1 keyboard and 1 mouse attached.

I guess that what the function is returning is a list of all devices ever seen by the OS.

I can't find a way to know if a device is actually attached (and working) or it's a ghost.

I remember that with direct input there was a flag to set in order to retreive only attached devices, so I'm guessing that there should be something similar to use with RawInput family of functions, but so far I've found any.

Any idea?

 


Which app to use in order to show profiler data?

03 October 2013 - 10:29 AM

Hello. I'm collecting a lot of profile data from my engine, something like memory allocations and thread pool jobs duration.

I can generate files with timestamps in microseconds of all the events, but what I'd like to have, is some sort of graph.

Sure I could write a program to show them all, but I will take some times and I wonder if there's something out there that can help me.

 

ATM I'm using google chrome built-in profiler, to show the data I collect, and it looks like this:

 

chromeoutput.jpg

This is good for the "thread pool" section; it shows me start time, length and so on, but it's not so good in the "Memory" section.

The problem with memory section is that the height of "globalheapAllocator" is not related to the height of "GlobalPageAllocator" so I can't see if the first is allocating more memory than the second.

What I'd need here could be a standard graph with lines that share the same chart.

 

Anyway, do you know of a program with an open input file format that could help me showing this stuff? It should also be able to manage big files, and have some tools like zoom and pan


Back to old IOTD?

25 August 2013 - 02:11 PM

Maybe it's just me, but I don't like the "new" IOTD.

It seems to me that there are way to many screenshot posted, so many that I don't bother to look at any of them, except for the last one.

I see the screenshot on the homepage, click on it, take a short look and then I switch to another section of the site.

When IOTD was a real IOTD (and not a showcase), a screenshot usually would last for at least 3 or 4 day, so that people had the time to look and eventually comment.

To me, comments were a big part of IOTD that now I'm missing.

Also I could come back to this site 2 or 3 times in a day and be able to remember if that IOTD was a a new one (for me) or an old one that I already checked.

Anyway, this is not that important, after all it was just an IOTD, but I miss the "old" style

 


MSVC2010 preprocessor definition for current configuration

09 November 2012 - 07:13 AM

I've a solution with many projects and I need to declare some preprocessor definition like GOS_OS_WINDOWS and GOS_RENDERER_DX9 in order to select which OS to use and which renderer to use.

Since now, my solution has been to create different configurations and then edit every single project adding the right preprocessor defines.

So, for example, I've the configuration [DEBUG Win32 DX9] and every project that is included in this configuration have the GOS_OS_WINDOWS and GOS_RENDERER_DX9 defined by clicking on proprietis | c++ preprocessor and so on.

Then I've the [DEBUG Win32 DX11] configuration, which in turn need to define GOS_OS_WINDOWS and GOS_RENDERER_DX11.
I guess you've got the idea.

Is there a way to tell MSVC that I want GOS_OS_WINDOWS and GOS_RENDERER_DX9 defined for all projects that stay in a [DEBUG Win32 DX9] configuration without editing every single projects?

PARTNERS