I'm getting:
D3D11: WARNING: ID3D11DeviceContext::OMSetRenderTargets: Resource being set to OM RenderTarget slot 0 is still bound on input! [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD ]
D3D11: WARNING: ID3D11DeviceContext::OMSetRenderTargets[AndUnorderedAccessViews]: Forcing PS shader resource slot 0 to NULL. [ STATE_SETTING WARNING #7: DEVICE_PSSETSHADERRESOURCES_HAZARD ]
When trying to render with the following loop:
void render()
{
static float theta = 0;
float thetaRads = theta * 3.14159/180.0;
float ClearColor[4] = { 0.0f, 0.0, 0, 0.9f }; // red,green,blue,alpha
float r = 0.1 * cos(2 * 3.14159 * 1 * thetaRads);
//Render the texture
g_pImmediateContext->OMSetRenderTargets(1, &g_baseRTV,NULL);
g_pImmediateContext->ClearRenderTargetView( g_baseRTV, ClearColor );
ConstantBufferType cb;
XMStoreFloat4x4(&cb.worldView, XMMatrixIdentity());
cb.worldView._11 = cos(thetaRads);
cb.worldView._12 = -sin(thetaRads);
cb.worldView._21 = sin(thetaRads);
cb.worldView._22 = cos(thetaRads);
//cb.worldView._14 = r*cos(thetaRads);
//cb.worldView._24 = r*sin(thetaRads);
g_pImmediateContext->UpdateSubresource(g_constantBuffer, 0, NULL, &cb, 0,0);
g_pImmediateContext->VSSetConstantBuffers(0, 1, &g_constantBuffer);
g_pImmediateContext->PSSetConstantBuffers(0, 1, &g_constantBuffer);
g_pImmediateContext->VSSetShader(g_baseVShader, NULL, 0);
g_pImmediateContext->PSSetShader(g_basePShader, NULL, 0);
g_pImmediateContext->IASetInputLayout(g_layout);
g_pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
UINT stride = sizeof(BasicVertex);
UINT offset = 0;
g_pImmediateContext->IASetVertexBuffers(0,1,&g_pLineVtxBuffer,&stride,&offset);
g_pImmediateContext->Draw(6,0);
//Render the screen.
g_pImmediateContext->OMSetRenderTargets(1,&g_pRenderTargetView, NULL);
g_pImmediateContext->VSSetShader(g_texVShader, NULL, 0);
g_pImmediateContext->PSSetShader(g_texPShader, NULL, 0);
g_pImmediateContext->IASetVertexBuffers(0,1,&g_pScreenVtxBuffer,&stride,&offset);
g_pImmediateContext->PSSetShaderResources(0,1, &g_baseSRV);
g_pImmediateContext->PSSetSamplers(0,1,&g_pSamplerLinear);
g_pImmediateContext->Draw(6,0);
g_pSwapChain->Present( 0, 0 );
theta += 0.05;
}
g_pRenderTargetView is the main screen's render target view, and g_baseRTV is the render target view I'm using for render to texture.
Any pointers on what I'm doing wrong?
It also doesn't seem to be alpha blending properly (I'm expecting a sort of blurred trail like an accumulation buffer effect, but it doesn't seem to be working), and I'm wondering if it has something to do with the errors I'm seeing D3D throw...









