Direct10 StreamOut如何追加顶点数据到尾部?

Viskag 2010-09-03 01:58:41
void SOSetTargets(
[in] UINT NumBuffers,
[in] ID3D10Buffer *const *ppSOTargets,
[in] const UINT *pOffsets
);
An offset of -1 will cause the stream output buffer to be appended, continuing after the last location written to the buffer in a previous stream output pass.

//=================================================
我有4个顶点数据放在g_pVertexBuffer_SO里(bytewidth很大,D3D10_BIND_VERTEX_BUFFER|D3D10_BIND_STREAM_OUTPUT)
offset[1] = { -1 };
pd3dDevice->SOSetTargets( 1, g_pVertexBuffer_SO, offset );
g_Tech->GetPassByIndex(1)->Apply( 0 );//pass1
pd3dDevice->DrawIndexed(4, 0, 0);

做完这步按理说g_pVertexBuffer_SO应该不止4个顶点了,但是
offset = 0;
pd3dDevice->IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP);
pd3dDevice->IASetVertexBuffers( 0, 1, &g_pVertexBuffer_SO, &stride, &offset );
g_Tech->GetPassByIndex( 0 )->Apply( 0 );//pass0
pd3dDevice->DrawAuto()的时候一个线段都画不出,不知道错在哪里。。。

//===================
[maxvertexcount(2)]
void GS1( line VS_Input input[2], inout LineStream<VS_Input> gzStream )
{
if( input[1].UV.x < 0.5 && input[1].UV.y >0.5)
{
VS_Input mid = (VS_Input)0;
gzStream.Append( mid );
mid.Pos = float4(0.1f, 0.1f, 0.0f, 0.0f);
gzStream.Append( mid );
gzStream.RestartStrip();
}
}
GeometryShader gsStreamOut1 = ConstructGSWithSO( CompileShader( gs_4_0, GS1() ), "POSITION.xyz; TEXCOORD.xy" );
technique10 myTech
{
pass P0
{
SetVertexShader( CompileShader( vs_4_0, VSfunc() ) );
SetGeometryShader( NULL );
SetPixelShader( CompileShader( ps_4_0, PSfunc() ) );
}
pass P1
{
SetVertexShader( CompileShader( vs_4_0, VS_nochange() ) );
SetGeometryShader( gsStreamOut1 );
SetPixelShader( NULL );
}
}
...全文
84 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
gamemagic 2010-09-03
  • 打赏
  • 举报
回复
学OPENGL的路过

8,304

社区成员

发帖
与我相关
我的任务
社区描述
游戏开发相关内容讨论专区
社区管理员
  • 游戏开发
  • 呆呆敲代码的小Y
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧