Jump to content

  • Log In with Google      Sign In   
  • Create Account


problem:stream output from vertex shader(not geometry shader)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
29 replies to this topic

#21 lomateron   Members   -  Reputation: 281

Like
0Likes
Like

Posted 03 February 2012 - 11:43 AM

hey man replace the .fx proyect that you have any, with my exact .fx file code i will say it would not work

Sponsor:

#22 iedoc   Members   -  Reputation: 524

Like
0Likes
Like

Posted 03 February 2012 - 11:46 AM

all right, i'll try it out, i'll let you know what happens
Braynzar Soft - DirectX Lessons & Game Programming Resources!

#23 lomateron   Members   -  Reputation: 281

Like
0Likes
Like

Posted 03 February 2012 - 11:48 AM

it still doent works without the debug flag

#24 iedoc   Members   -  Reputation: 524

Like
0Likes
Like

Posted 03 February 2012 - 11:49 AM

maybe this was a mistake, but check out this line:


SetVertexShader( vss ) );

you have an extra ")". delete one of them if that wasn't just a typo in your post

Otherwise, sorry to say but it does compile for me... Other than that extra ")", there's no errors in the file
Braynzar Soft - DirectX Lessons & Game Programming Resources!

#25 lomateron   Members   -  Reputation: 281

Like
0Likes
Like

Posted 03 February 2012 - 11:56 AM

OHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHSHI!!!!! i am gona pffffffffffffffffffffffffffffffffffffffffffffff that was SHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII, 2 days stuck in thaat SHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII

thanks... bye

#26 iedoc   Members   -  Reputation: 524

Like
0Likes
Like

Posted 03 February 2012 - 11:59 AM

HAHA, it happens
Braynzar Soft - DirectX Lessons & Game Programming Resources!

#27 lomateron   Members   -  Reputation: 281

Like
0Likes
Like

Posted 03 February 2012 - 02:25 PM

One final question, is there any app to see hlsl errors i mean like visual with .cpp files, or eclipse with java, etc

#28 iedoc   Members   -  Reputation: 524

Like
0Likes
Like

Posted 04 February 2012 - 12:31 AM

yeah, look into pix. I don't know much about it, and i've never used it, but i see people using it all the time. You can debug individual pixels or something
Braynzar Soft - DirectX Lessons & Game Programming Resources!

#29 lomateron   Members   -  Reputation: 281

Like
0Likes
Like

Posted 04 February 2012 - 06:54 AM

damm i cant still get it working with directx 10 i did this in the .cpp file, first the layout:

D3D10_INPUT_ELEMENT_DESC vertexDesc[] =
{
  {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0},
  {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0},
  { "VEL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 28, D3D10_INPUT_PER_VERTEX_DATA, 0 },
  { "MA", 0, DXGI_FORMAT_R32_FLOAT, 0, 40, D3D10_INPUT_PER_VERTEX_DATA, 0 },
};
UINT numElements = sizeof( vertexDesc) / sizeof( vertexDesc[0] );

D3D10_PASS_DESC PassDesc;
g_pTechnique->GetPassByIndex(0)->GetDesc(&PassDesc);
hr = g_pd3dDevice->CreateInputLayout(vertexDesc, numElements,PassDesc.pIAInputSignature, PassDesc.IAInputSignatureSize,&g_pVertexLayout);
if( FAILED( hr ) )
	    return hr;
g_pd3dDevice->IASetInputLayout(g_pVertexLayout);

now the buffer: i have 2 buffers one with the original vertex data and another where the modified vertex buffer is gonna be
SimpleVertex vertices2[] =
    {
	    { D3DXVECTOR3( 0.0f, 1.0f, 0.0f ), D3DXCOLOR( 0.0f, 0.0f, 1.0f, 1.0f ), D3DXVECTOR3( 0.0f, 0.0f, 0.0f ),float(1.0f)},
	    { D3DXVECTOR3( 1.0f, 0.0f, 0.0f ), D3DXCOLOR( 0.0f, 1.0f, 0.0f, 1.0f ), D3DXVECTOR3( 0.0f, 0.0f, 0.0f ),float(1.0f)},
	    { D3DXVECTOR3( 0.0f, 0.0f, -1.0f ), D3DXCOLOR( 0.0f, 1.0f, 1.0f, 1.0f ), D3DXVECTOR3( 0.0f, 0.0f, 0.0f ),float(1.0f)},
	    { D3DXVECTOR3( 0.0f, 0.0f, 0.0f ), D3DXCOLOR( 1.0f, 0.0f, 0.0f, 1.0f ), D3DXVECTOR3( 0.0f, 0.0f, 0.0f ),float(1.0f)},
    };
    bd.Usage = D3D10_USAGE_DEFAULT;
    bd.ByteWidth = sizeof( SimpleVertex ) * 4;
    bd.BindFlags = D3D10_BIND_VERTEX_BUFFER | D3D10_BIND_STREAM_OUTPUT;
    bd.CPUAccessFlags = 0;
    bd.MiscFlags = 0;
    initData.pSysMem = vertices2;
    hr = g_pd3dDevice->CreateBuffer( &bd, &initData, &g_pVertexBuffer2 );//first buffer where the original info is
if( FAILED( hr ) )
	    return hr;
hr = g_pd3dDevice->CreateBuffer( &bd, 0, &g_pVertexBuffer3 );//second buffer where the info form the first is gona be after modified
if( FAILED( hr ) )
	    return hr;

and now this is how i render it, i change the buffers each frame ping pong metod

if(g)
{
  g_pd3dDevice->SOSetTargets(1, &g_pVertexBuffer3 , &offset);
  g_pd3dDevice->IASetVertexBuffers(0, 1, &g_pVertexBuffer2, &stride, &offset);
  g=false;
}
else
{
  g_pd3dDevice->SOSetTargets(1, &g_pVertexBuffer2 , &offset);
  g_pd3dDevice->IASetVertexBuffers(0, 1, &g_pVertexBuffer3, &stride, &offset);
  g=true;
}
g_pd3dDevice->IASetIndexBuffer( g_pIndexBuffer2, DXGI_FORMAT_R32_UINT, 0 );
g_pWorldVariable->SetMatrix( ( float* )&g_World2 );
    g_pTechnique2->GetPassByIndex( 0 )->Apply( 0 );
    g_pd3dDevice->DrawIndexed( 12, 0, 0 );
    g_pSwapChain->Present( 0, 0 );

the .fx is like this, there are no errors any more, the vertex shader only returns the same position, the thetaedron never moves.

struct VS_INPUT
{
    float4 Pos : POSITION;
    float4 Color : COLOR;
float3 Vel : VEL;
float Ma : MA;
};
struct VS_INPUTT
{
    float4 Pos : SV_POSITION;
    float4 Color : COLOR;
float3 Vel : VEL;
float Ma : MA;
};
VS_INPUTT VS2( VS_INPUT input )
{
    VS_INPUTT output = (VS_INPUTT)0;
    output.Pos = mul( input.Pos, World );
    output.Pos = mul( output.Pos, View );
    output.Pos = mul( output.Pos, Projection );
    output.Color = input.Color;
output.Vel.x = input.Vel.x+(Time*Force.x);
output.Vel.y = input.Vel.y+(Time*Force.y);
output.Vel.z = input.Vel.z+(Time*Force.z);
output.Ma = input.Ma;
    return output;
}

and at the end of the .fx file is this

VertexShader vss = CompileShader( vs_4_0, VS2() );
GeometryShader gss= ConstructGSWithSO( vss, "SV_POSITION.xyz; COLOR.xyzw; VEL.xyz; MA.x" );
technique10 Pa
{
    pass P0
    {
	    SetVertexShader( vss );
	    SetGeometryShader( gss );
	    SetPixelShader( CompileShader( ps_4_0, PS2() ) );
    }
}

what happens it that there is no error anywere, the first frame i render it renders ok, the thetaedron is in its place, then the second frame some vertex of the thetaedron are in its place and the others are like very far away up, and then in the next frame it disapears.

#30 lomateron   Members   -  Reputation: 281

Like
0Likes
Like

Posted 04 February 2012 - 07:20 AM

this topic is still hot dont leave meee




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS