Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Mona2000

Member Since 08 Sep 2011
Offline Last Active Dec 21 2014 05:08 PM

#5190896 Converting UINT to float4 in HLSL

Posted by Mona2000 on 03 November 2014 - 07:22 AM

Change
{"COLOR", 0, DXGI_FORMAT_R32_UINT, 0,D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },

to
{"COLOR", 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0,D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },

and
uint col: COLOR;

to
float4 col: COLOR;



#5188838 using coldet collison library on d3d9 3d models

Posted by Mona2000 on 23 October 2014 - 07:26 PM

Assuming your D3D runtime might be bugged  (because that's the only way you can find a different value) sounds like a terrible "programming philosophy".

Do you also check if the pointer returned by CreateIndexBuffer is in your process' address space, in case the return value is garbage due to a bug?




#5183372 DX11 HLSL: pass SamplerState to a function?

Posted by Mona2000 on 27 September 2014 - 06:58 PM

sampler is a reserved keyword. Use a different name.




#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.

 

Except

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
to
in bool isBackFacing : VFACE

float isBackFacing
to
bool isBackFacing

if (isBackFacing < 0)
to
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.






PARTNERS