Hi, im rendering to to rendering targets and render on of those targets to a texture. Which seems to work fine, its displaying what it should, a quad in the corner showing the normals as of the scene as a color.
Im getting this warning and trying to understand what it means
D3D11 WARNING: ID3D11DeviceContext::DrawIndexed: The Pixel Shader expects a Render Target View bound to slot 1, but none is bound. This is OK, as writes of an unbound Render Target View are discarded. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Render Target View here. [ EXECUTION WARNING #3146081: DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET]
This is what i think is happening, would be awesome if some one could confirm or despute this.
1) Set both rendertargets with OMSetRenderTargets and the DepthStencilView
2) Render the scene -> which the PixelShader in turn fills with Color output SV_Target0 and SV_Target1 with Normals.
3) Sets the Rendertarget
4) Render the quad with is linked to SV_Target1 but because I use the same PixelShader as "the main scene" nothing is
bound to SV_Target1. Because only on RenderTarget is active
What i think this means i no Render target is bound SV_Target1 when i draw the quad.
PixelShader
Texture2D txDiffuse : register( t0 );
SamplerState samLinear : register( s0 );
cbuffer cbPerObject : register(b0)
{
float4 diffuse;
float4 lightDirection;
float4 lightColor;
float4 lightAmbient;
bool isTextured;
}
//--------------------------------------------------------------------------------------
struct PS_INPUT
{
float4 position : SV_POSITION;
float2 texcoord : TEXCOORD0;
float3 normal : NORMAL;
};
struct PSOutput
{
float4 Color : SV_Target0;
float3 Normal : SV_Target1;
};
//--------------------------------------------------------------------------------------
// Pixel Shader
//--------------------------------------------------------------------------------------
PSOutput main(PS_INPUT input)
{
PSOutput output;
float4 finalColor=0;
if (isTextured==true){
finalColor = diffuse*txDiffuse.Sample(samLinear, input.texcoord);
}
else{
finalColor = diffuse;
}
output.Color = diffuse*txDiffuse.Sample(samLinear, input.texcoord);;
output.Normal = input.normal;
return output;
}
Thx for the help.