Sign in to follow this  

Can't Get Stream Out to Work?

This topic is 3771 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have never used the DX10 Stream Out functionality before. I don’t get it to work and probably am I doing something wrong. If someone with a little experience could help me I would be thrilled. I got the following message: D3D10: INFO: ID3D10Device::Draw: Stream Output buffer bound at slot 0 but the pipeline is not configured to use it. There is nothing wrong with this, unless the intent was to actually stream out something now. [ EXECUTION INFO #374: DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE ] D3D10: WARNING: ID3D10Device::OMSetRenderTargets: Resource being set to OM RenderTarget slot 0 is still bound on input! [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD ] D3D10: WARNING: ID3D10Device::OMSetRenderTargets: Forcing VS shader resource slot 0 to NULL. [ STATE_SETTING WARNING #3: DEVICE_VSSETSHADERRESOURCES_HAZARD ] D3D10: WARNING: ID3D10Device::OMSetRenderTargets: Resource being set to OM RenderTarget slot 1 is still bound on input! [ STATE_SETTING WARNING #9: DEVICE_OMSETRENDERTARGETS_HAZARD ] D3D10: WARNING: ID3D10Device::OMSetRenderTargets: Forcing VS shader resource slot 1 to NULL. [ STATE_SETTING WARNING #3: DEVICE_VSSETSHADERRESOURCES_HAZARD ] D3D10: WARNING: ID3D10Device::SOSetTargets: Resource being set to SO buffer slot 0 is still bound on input! [ STATE_SETTING WARNING #10: DEVICE_SOSETTARGETS_HAZARD ] D3D10: WARNING: ID3D10Device::SOSetTargets: Forcing Vertex Buffer slot 1 to NULL. [ STATE_SETTING WARNING #1: DEVICE_IASETVERTEXBUFFERS_HAZARD ] The application code looks like this:
	pd3dDevice->OMSetRenderTargets( 0, NULL, NULL);
	pd3dDevice->IASetInputLayout( g_pSampleBufferLayout);
	Strides[0] = 8;
	pd3dDevice->IASetVertexBuffers( 0, 1, &g_SamplingPattern.m_pSampleBuffer, Strides, Offsets);
	pd3dDevice->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_POINTLIST);
	pd3dDevice->SOSetTargets( 1, &g_pIndirectLightData, Offsets);
	V( g_pTechRenderPipeline->GetPassByIndex( 2)->Apply( 0));
	pd3dDevice->Draw( g_SamplingPattern.m_iBufferSize, 0);
    	pd3dDevice->SOSetTargets( 0, 0, 0); 



g_pIndirectLightData is created with the D3D10_BIND_STREAM_OUTPUT bind flag. When I comment out the code above the messages go away. The effect looks like this:
DepthStencilState DisableDepthTestWrite
{
	DepthEnable = FALSE;
	DepthWriteMask = ZERO;
};

pass P2
{
	SetDepthStencilState( DisableDepthTestWrite, 0 );
	
	SetVertexShader( CompileShader( vs_4_0, CreateMarkDataVS()));
	SetGeometryShader( NULL);
	SetPixelShader( NULL);
}



What could be the problem? Thanks

Share this post


Link to post
Share on other sites
I was success with Stream Out

I create the buffer in this way

ID3D10Buffer *buffer;

D3D10_BUFFER_DESC bufferDesc =
{
bufferSize,
D3D10_USAGE_DEFAULT,
D3D10_BIND_VERTEX_BUFFER | D3D10_BIND_STREAM_OUTPUT,
0,
0
};
HRESULT hr = device->CreateBuffer( &bufferDesc, NULL, &buffer );

set into device with this

UINT offset[]={0};
ID3D10Buffer* temp[1];
temp[0]=this->buffer;
Device->SOSetTargets( 1, temp, offset );

and in shader (this one is important) I've written


GeometryShader gsS = ConstructGSWithSO( CompileShader( gs_4_0, GS() ), "POSITION.xyz; NORMAL.xyz; TEXCOORD.xyz" );


technique10 Render
{
pass P0
{
SetVertexShader( CompileShader( vs_4_0, VS() ) );
SetGeometryShader(gsS);
SetPixelShader( NULL );
}
}

here you must specify the output layout for output stream and you must use geometry buffer.

Hope can help, this is the only way I could run output stream



Share this post


Link to post
Share on other sites
From what I've looked at this section of the API, you need to create, at the very least, a geometry shader.

The SDK docs say you must use CreateGeometryShaderWithStreamOut to create a GS that supports stream out, but I'm reluctant to use this method since the GS is compiled outside the Effect interface. There might be a special way of doing this with Effects, but I havn't found it yet. Even so, I doubt it would work even with that setting if you don't have a GS at all.

Hope this helps.

Share this post


Link to post
Share on other sites
Quote:
Original post by sirob
From what I've looked at this section of the API, you need to create, at the very least, a geometry shader.

The SDK docs say you must use CreateGeometryShaderWithStreamOut to create a GS that supports stream out, but I'm reluctant to use this method since the GS is compiled outside the Effect interface. There might be a special way of doing this with Effects, but I havn't found it yet. Even so, I doubt it would work even with that setting if you don't have a GS at all.

Hope this helps.


You might be right but the documentation sas:

The purpose of the SO stage is to write vertex data streamed out of the GS stage (or the VS stage if the GS stage is inactive)

Also in the Nvidia SDK they where streaming out buffers directly from the VS in the PerlinFire and Smoke demos. Unfortunately I wasn’t able to compile their code on my computer, for reasons I don’t know? I guess that using the GS would be a bit slower (at least a little) so I will investigate this some more.


robydx: Thanks, I might try that if I don't get my original plan to work :)

Share this post


Link to post
Share on other sites
Quote:
Original post by 51mon
You might be right but the documentation sas:

The purpose of the SO stage is to write vertex data streamed out of the GS stage (or the VS stage if the GS stage is inactive)


Looking at robydx's reply, you might be able to call ConstructGSWithSO with a NULL GS. I'd try that first.

Share this post


Link to post
Share on other sites
Quote:
Original post by sirob
Quote:
Original post by 51mon
You might be right but the documentation sas:

The purpose of the SO stage is to write vertex data streamed out of the GS stage (or the VS stage if the GS stage is inactive)


Looking at robydx's reply, you might be able to call ConstructGSWithSO with a NULL GS. I'd try that first.


I tried that but it didn't work. In the Skinning10 demo they compile the VS into a GS, like this

VertexShader vsBuffer = CompileShader( vs_4_0, VSSkinnedStreamOutmain( FT_BUFFER ) );
GeometryShader vsBufferSO = ConstructGSWithSO( vsBuffer, "POS.xyzw; NORMAL.xyz; TEXCOORD.xy; TANGENT.xyz" );


The input and output of the VS is not identical. I tried that on my code but get the messages:

f:\Programing\MyEngine\MyEngine.fx(448,7): D3D10EffectCompiler: ERROR: No valid VertexShader-GeometryShader combination could be found in Technique RenderPipeline, Pass P2.
f:\Programing\MyEngine\MyEngine.fx(448,7): Stage linkeage warning: Semantic TEXCOORD is read from, but it's never written to.


I'm confused?

Share this post


Link to post
Share on other sites
you must use correct semantic to pass parameter between shader pass.
The reason of that error could be that you don't use the same struct as vertex shader output and geometry shader input or that geometry shader output don't corrispond to your output stream definition

GeometryShader gsS = ConstructGSWithSO( CompileShader( gs_4_0, GS() ), "POSITION.xyz; NORMAL.xyz; TEXCOORD.xyz" );

using this one for example you must return a struct like this

struct GS_OUT{
float3 P:POSITION;
float3 N:NORMAL;
float3 T:TEXCOORD;
}

semantic and size of parameter is important. If you use SV_POSITION instead of POSITION it will give you an error. Also seems that you can't use directX specific semantic for geometry output when you use output stream (so you can use SV_POSITION).

Share this post


Link to post
Share on other sites
Ok, so if I'm using geometry shaders I got two options.

1) Send the input vertex data through the VS and process the output vertex in the GS.

2) Process the input vertex in the VS and just pass the data throug GS and out.

Anyone got an opinion of which way is most effective?

Share this post


Link to post
Share on other sites
If you can simplify the pipeline by using VS->SO rather than VS->GS->SO then do it. Keep it short and sweet [smile]

You'll almost certainly (unless the driver is good at optimization) be chewing up unnecessary registers and pipeline resources by having extra stages active, and that will reduce the number of threads in flight which will in turn reduce performance.

I'd only go with the VS->GS->SO route if you're actually wanting to manipulate (or add/remove) data at the topology level.

hth
Jack

Share this post


Link to post
Share on other sites
Quote:
Original post by jollyjeffers
If you can simplify the pipeline by using VS->SO rather than VS->GS->SO then do it. Keep it short and sweet [smile]

You'll almost certainly (unless the driver is good at optimization) be chewing up unnecessary registers and pipeline resources by having extra stages active, and that will reduce the number of threads in flight which will in turn reduce performance.

I'd only go with the VS->GS->SO route if you're actually wanting to manipulate (or add/remove) data at the topology level.

hth
Jack


Yeah going VS->SO is what I want the most; but I got error messages all the time telling me:

D3D10: INFO: ID3D10Device::Draw: Stream Output buffer bound at slot 0 but the pipeline is not configured to use it. There is nothing wrong with this, unless the intent was to actually stream out something now. [ EXECUTION INFO #374: DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE ]

Do you know how to set up VS->SO properly. What I do is creating a vertex buffer which I declare D3D10_BIND_STREAM_OUTPUT and set as target with ID3D10Device::SOSetTargets. I set GS and PS to NULL inside the fx and turn off depth and alpha test.

[Edited by - 51mon on August 15, 2007 11:00:39 AM]

Share this post


Link to post
Share on other sites

This topic is 3771 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this