Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 08 Sep 2011
Offline Last Active Sep 11 2014 05:36 AM

#5175794 Strange ifstream crash

Posted by Mona2000 on 24 August 2014 - 07:14 AM

Just a note, since this seems to be resolved already, but "if(file)" is not a proper way to check if the file opened or not.


It actually is, using operator void * (or operator bool if c++11).

#5174685 D3D11DeviceContext::DrawIndexed Does'nt Draw anything

Posted by Mona2000 on 19 August 2014 - 05:29 AM

Since UINT doesn't have a default constructor mechanism, you end up with the contents of memory in your vector.


The parameter is declared as const value_type& val = value_type(), so it will perform zero initialization for built-in types:

int a; // garbage
int b = int(); // zero initialized

#5172568 DirectX 10 - Displaying tile squares as...squares?

Posted by Mona2000 on 10 August 2014 - 02:28 AM

Except 1050/1680 is integer division and results in 0. This code works "like expected" only because it ends up using window's height automagically when it's set to 0.



1) there's a multiplication before the division so the code will not result in 0

2) both width and height have to be 0 to use the window dimensions automagically

#5167953 SamplerState in code or HLSL?

Posted by Mona2000 on 20 July 2014 - 08:17 AM

I really wouldn't recommend using the effects framework (it's old and no longer updated)


Not that I'm a fan of the effects framework, but it's still being updated.

#5162433 Direct3D 11 Swap-Chain Madness

Posted by Mona2000 on 23 June 2014 - 05:55 PM

Are you sure you got debug logging properly working? IIRC exception 0x87a is the debug layer error exception.

#5153579 VFACE semantic in hlsl (SM3)

Posted by Mona2000 on 14 May 2014 - 09:12 AM

My guess is the combination of dynamic branching + vface breaks something in the compiler (bug). Try kauna's refactored code (seemed to produce saner asm when i tried it) or try putting a [flatten] in front of the if statement.

#5153561 VFACE semantic in hlsl (SM3)

Posted by Mona2000 on 14 May 2014 - 07:56 AM

Under SM3, a bool works perfectly too (and apparently better than a float). fxc magic ;)

#5153556 VFACE semantic in hlsl (SM3)

Posted by Mona2000 on 14 May 2014 - 07:34 AM

Alternatively change

in float isBackFacing : VFACE
in bool isBackFacing : VFACE

float isBackFacing
bool isBackFacing

if (isBackFacing < 0)
if (!isBackFacing)

and it will work (cmp r0.x, vFace, c8.x, c8.x turns into cmp r0.x, vFace, c8.x, c8.y). Why? I have no idea.

#5152277 Instancing not working correctly

Posted by Mona2000 on 08 May 2014 - 04:45 AM

You forgot to use the instance world matrix here:

 // Transform to homogeneous clip space.
vout.PosH = mul(float4(vin.PosL, 1.0f), gWorldViewProj);

It should be more like this:

 // Transform to homogeneous clip space.
vout.PosH = mul(float4(vout.PosW, 1.0f), gViewProj);

#5151570 Using Directx11 without using a Microsoft math library

Posted by Mona2000 on 05 May 2014 - 04:03 AM

Or you can write #pragma pack_matrix(row_major/column_major) to set the default storage convention for everything that comes after.

#5151427 context->UpdateSubresource(constant buffer) - how does it work?

Posted by Mona2000 on 04 May 2014 - 09:56 AM

UpdateSubresource is for updating the contents of a buffer, not for binding it. What you're looking for is ID3D11DeviceContext::PSSetConstantBuffers and the VS/GS/HS/DS equivalents. Are you using something that hides that part (Effects11)?

#5151258 Upon compiling with Nvidia SDK 3.3.1 - I get This Operator is not allowed as...

Posted by Mona2000 on 03 May 2014 - 03:30 PM

I think I've had that since switching to VS2013 (or 2012?). The assert is not failing, it's just a harmless IntelliSense false positive: you can either ignore it or comment it away.

#5150761 DX9 with MRT, access violation

Posted by Mona2000 on 01 May 2014 - 11:21 AM

Have you tried enabling the debug runtime and checking the debug output?

#5149741 ReportLiveObjects() isn't giving me enough information.

Posted by Mona2000 on 26 April 2014 - 06:32 PM

What you pasted is not the output from ReportLiveObjects, it's the simple report that gets generated when the applications exits.

Try placing a breakpoint right after you call ReportLiveObjects and check what gets printed.

#5146898 Strange graphics file format

Posted by Mona2000 on 14 April 2014 - 07:23 AM

I was wrong about the modes, mode 1 means it's the difference from the pixel at (x - 1, y), mode 2 means it's the difference from the pixel at (x, y - 1). Still no clue about the other modes.

Edit: mode 3 is the difference from (pixel[x - 1, y] + pixel[x, y - 1]) / 2 or something like that