Home Game Development directx11 – Why is not my cbuffer updating?

directx11 – Why is not my cbuffer updating?

0
directx11 – Why is not my cbuffer updating?

[ad_1]

I’m actually pissed off as a result of my cbufer is not updating.
This is my VS:

cbuffer MatrixBuffer: register(b0)
{
float4x4 worldViewProj;

};

struct VertexIn
{
float4 Pos : POSITION;
float4 Color: COLOR;
};

struct PixelIn
{
float4 PosH : SV_POSITION;
float4 Color: COLOR;
};

PixelIn VS (VertexIn vin)
{
PixelIn vout;

vin.Pos.w = 1.0f;

vout.PosH = mul(vin.Pos, worldViewProj);

vout.Color = vin.Color;

return vout;
}

PixelIn VS1(VertexIn vin)
{
PixelIn vout;

vin.Pos.w = 1.0f;
vout.PosH = vin.Pos;

vout.Color = vin.Color;

return vout;
}

When utilizing VS1 it attracts appropriately, however when utilizing VS it does not draw something?

Here is my CBUFFER replace code

bool Game::UpdateShaders()
{
    HRESULT consequence;
    D3D11_MAPPED_SUBRESOURCE mappedResource;
    MatrixBufferType* dataPtr;

    worldViewProjM = worldM * viewM * projM;
    worldViewProjM = XMMatrixTranspose(worldViewProjM);
    consequence = md3dDeviceContext->Map(mMatrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    if (FAILED(consequence))
    {
        MessageBoxW(mMainWnd, L"FAOE:", 0, 0);
        return false;
    }

    dataPtr = (MatrixBufferType*)mappedResource.pData;

    dataPtr->worldViewProj = worldViewProjM;

    md3dDeviceContext->Unmap(mMatrixBuffer, 0);

    int NBuffers = 0;

    md3dDeviceContext->VSSetConstantBuffers(0, 1, &mMatrixBuffer);
    //md3dDeviceContext->PSSetConstantBuffers(0, 1, &mMatrixBuffer);

    return true;
}

Here is my MATRIXBUFFERTYPE struct:

struct MatrixBufferType
{
        XMMATRIX worldViewProj;
};

This is known as after I clear my depth stencil view and render goal view.
Does any individual know why my CBUFFER is not updating?

Thanks upfront.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here