Jump to content

  • Log In with Google      Sign In   
  • Create Account


collie

Member Since 08 Feb 2013
Offline Last Active Jun 28 2014 10:46 AM
-----

Posts I've Made

In Topic: A sampled float value in a Texture2D is unexpectedly 1.0 higher.

29 March 2014 - 02:57 AM

Hi Jason,  Thank you for the reply.

Yes I believe blending was off..

 

D3D11_BLEND_DESC desc;
::ZeroMemory(&desc, sizeof(D3D11_BLEND_DESC));
desc.RenderTarget[0].BlendEnable = FALSE;

...

 

Regards


In Topic: Issue with Visual Studio 2012 Graphics Debuging

14 April 2013 - 09:59 AM

If your seeing a variable show as a NaN double check that it's really is being *used* within the shader.

If your seeing a variable show as 0.000000000 check that it's going to be accessed within your shader, i.e. it may be in an 'if' that won't be entered?

 

The compiler could be optimizing those variables out.  Assuming this is the issue you've described?


In Topic: Constant buffer not working

09 February 2013 - 04:55 AM

I read somewhere the other day that you have to use XMMatrixTranspose() in DX11 otherwise you'll get NaN in the pixel shader.

 

http://stackoverflow.com/questions/14150922/directx-11-shader-error-pixel-shader-receiving-only-nan/14164755#14164755


In Topic: Incorrect Vertex Shader float input values (NaN or 0.000000000).

08 February 2013 - 03:51 PM

Well done; you were right I *wasn't* using...

float2 textureCoordinates  : TEXCOORD0;

...within the vertex shader.
I did a quick hack and added it to another existing value, recompiled and it magically appeared.
As I was only using the .x part of the float2 it appeared as...

textureCoordinates    x = 5.000000000, y = NaN    float2

So 'NaN's basically could mean a variable is unused. 

 

Also interestingly...

float bitWidth             : TEXCOORD2;

...turned out to have a value of...

bitWidth    00.000000000    float

...because though it *was* being used within the vertex shader it was within a 'if' that wouldn't be entered.
Another quick bodge to allow the entering of the 'if' showed the value as...

bitWidth    33.000000000    float

So a 0.000000000 value could/may mean that though a variable is being used within the vertex shader it may not be called (so you won't see the true value).

I wonder if this behaviour is written down anywhere as I can't remember reading this or seeing it before?

Many thanks for your help Polarist; have a good weekend.

 

Regards
Cole


In Topic: Incorrect Vertex Shader float input values (NaN or 0.000000000).

08 February 2013 - 12:50 PM

Thanks for the reply.

I set it directly after the vertexLayoutDesc declaration.

 

const D3D11_INPUT_ELEMENT_DESC vertexLayoutDesc[] =
{
// Vertex buffer slot 0.
{ "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0,
D3D11_INPUT_PER_VERTEX_DATA, 0 }, // vertexPosition
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT,
D3D11_INPUT_PER_VERTEX_DATA, 0 }, // textureCoordinates
{ "TEXCOORD", 1, DXGI_FORMAT_R32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT,
D3D11_INPUT_PER_VERTEX_DATA, 0 }, // vertexNumber

// Vertex buffer slot 1.
{ "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, D3D11_APPEND_ALIGNED_ELEMENT,
D3D11_INPUT_PER_INSTANCE_DATA, 1 }, // bitColour

// Vertex buffer slot 2.
{ "TEXCOORD", 2, DXGI_FORMAT_R32_FLOAT, 2, D3D11_APPEND_ALIGNED_ELEMENT,
D3D11_INPUT_PER_INSTANCE_DATA, 1 }, // bitWidth

// Vertex buffer slot 3.
{ "TEXCOORD", 3, DXGI_FORMAT_R32G32_FLOAT, 3, D3D11_APPEND_ALIGNED_ELEMENT,
D3D11_INPUT_PER_INSTANCE_DATA, 1 }, // bitOffset
};

  hr = device->CreateInputLayout(
    vertexLayoutDesc,
    ARRAYSIZE(vertexLayoutDesc),
    vertexShaderBytecode,
    vertexShaderBytecodeLength,
    &_inputLayout);

  deviceContext->IASetInputLayout(_inputLayout);

PARTNERS