problem:stream output from vertex shader(not geometry shader)
#1 Members - Reputation: 230
Posted 03 February 2012 - 03:25 AM
VertexShader vss = CompileShader( vs_4_0, VS2() );
the D3DX10CreateEffectFromFile() wont read the file, so i want someone to tell me whats the problem, is it a library? what i am missing, the libraries i am using are these:
#include <windows.h>
#include <d3d10.h>
#include <d3dx10.h>
#include "resource.h"
#include <dinput.h>
i am not using DXUT i know the advanceParticles sample from the SDK uses this line and the sample works when i run it from there.
So what i am doing at the end of the .fx file just to prove that that line isnt working is this:
VertexShader vss = CompileShader( vs_4_0, VS2() ); ---> this is the line that makes the file unreadable
technique10 Pa
{
pass P0
{
SetVertexShader( vss ) );
SetGeometryShader( NULL );
SetPixelShader( CompileShader( ps_4_0, PS2() ) );
}
}
And what i am finally wanting to do is this:
VertexShader vss = CompileShader( vs_4_0, VS2() ); ---> this is the line that makes the file unreadable
GeometryShader gss= ConstructGSWithSO( vss, "POSITION.xyz; COLOR.xyzw;VEL.xyz;MASS.x" );
technique10 Pa
{
pass P0
{
SetVertexShader( vss ) );
SetGeometryShader( gss );
SetPixelShader( CompileShader( ps_4_0, PS2() ) );
}
}
but without that first line working this final code wouldnt work.
#2 Members - Reputation: 499
Posted 03 February 2012 - 04:48 AM
#4 Members - Reputation: 499
Posted 03 February 2012 - 04:57 AM
#5 Members - Reputation: 230
Posted 03 February 2012 - 04:59 AM
{
float4 Pos : POSITION;
float4 Color : COLOR;
float3 Vel : VEL;
float Ma : MA;
};
struct PS_INPUT
{
float4 Pos : SV_POSITION;
float4 Color : COLOR;
};
PS_INPUT VS2( VS_INPUT input )
{
PS_INPUT output = (PS_INPUT)0;
output.Pos = mul( input.Pos, World );
output.Pos = mul( output.Pos, View );
output.Pos = mul( output.Pos, Projection );
output.Color = input.Color;
return output;
}
#6 Members - Reputation: 499
Posted 03 February 2012 - 05:05 AM
#8 Members - Reputation: 230
Posted 03 February 2012 - 05:16 AM
#9 Members - Reputation: 499
Posted 03 February 2012 - 05:21 AM
cbuffer cbPerObject
{
float4x4 WVP;
};
struct VS_INPUT
{
float4 Pos : POSITION;
float4 Color : COLOR;
};
struct VS_OUTPUT
{
float4 Pos : SV_POSITION;
float4 Color : COLOR;
};
VS_OUTPUT VS(VS_INPUT vIn)
{
VS_OUTPUT output = (VS_OUTPUT)0;
output.Pos = mul(vIn.Pos, WVP);
output.Color = vIn.Color;
return output;
}
float4 PS(VS_OUTPUT input) : SV_Target
{
return input.Color;
}
VertexShader vss = CompileShader( vs_4_0, VS() );
GeometryShader gss= ConstructGSWithSO( vss, "POSITION.xyz; COLOR.xyzw" );
technique10 Tech
{
pass P0
{
SetVertexShader(vss );
SetGeometryShader( gss );
SetPixelShader( CompileShader( ps_4_0, PS() ) );
}
}I know that's probably not helpful for you. What is the exact error you are getting?
wait, are you saying that if you remove this single line, it works, but if you put it there, it doesn't? does it show you an error for your effect file? or is the error only in the applications code?
#12 Members - Reputation: 499
Posted 03 February 2012 - 05:31 AM
#13 Members - Reputation: 230
Posted 03 February 2012 - 05:39 AM
//////////////////////////////////////////////////*******************effect*************************/////////////////////////////////////////
DWORD dwShaderFlags = D3D10_SHADER_ENABLE_STRICTNESS;
#if defined( DEBUG ) || defined( _DEBUG )
dwShaderFlags |= D3D10_SHADER_DEBUG;
#endif
ID3D10Blob* pErr;
hr = D3DX10CreateEffectFromFile( L"Tutorial01.fx", NULL, NULL, "fx_4_0", dwShaderFlags, 0, g_pd3dDevice, NULL,NULL, &g_pEffect, &pErr, NULL );
if( FAILED( hr ) )
{
if (pErr != NULL)
{
LPCSTR psErr = (LPCSTR)pErr->GetBufferPointer();
pErr->Release ();
}
return hr;
}
#14 Members - Reputation: 499
Posted 03 February 2012 - 05:52 AM
I'm asking, because a couple months ago or so, i had the second latest version of directx sdk installed. everything worked fine. Then i saw there was a new release of the sdk and installed it "over" the version i had before, so i ended up with two versions. all my projects worked fine, but when i tried to use debug mode for directx 10, it was giving me an error when i used a debug flag. so at first i just stopped using the debug flags for directx 10 projects. last month i decided to reinstal windows, and just got the newest version of the dx sdk, so now i only have the latest version, and everything works normal again. If you have two versions of the sdk installed, try uninstalling both of them, then just reinstall the latest version
#15 Members - Reputation: 230
Posted 03 February 2012 - 06:06 AM
#17 Members - Reputation: 499
Posted 03 February 2012 - 06:19 AM
#18 Members - Reputation: 230
Posted 03 February 2012 - 08:56 AM
matrix World;
matrix View;
matrix Projection;
float Time;
//--------------------------------------------------------------------------------------
struct VS_INPUT
{
float4 Pos : POSITION;
float4 Color : COLOR;
float3 Vel : VEL;
float Ma : MA;
};
struct PS_INPUT
{
float4 Pos : SV_POSITION;
float4 Color : COLOR;
};
PS_INPUT VS( VS_INPUT input )
{
PS_INPUT output = (PS_INPUT)0;
output.Pos = mul( input.Pos, World );
output.Pos = mul( output.Pos, View );
output.Pos = mul( output.Pos, Projection );
output.Color = input.Color;
return output;
}
float4 PS( PS_INPUT input) : SV_Target
{
return input.Color;
}
PS_INPUT VS2( VS_INPUT input )
{
PS_INPUT output = (PS_INPUT)0;
output.Pos = mul( input.Pos, World );
output.Pos = mul( output.Pos, View );
output.Pos = mul( output.Pos, Projection );
output.Color = input.Color;
return output;
}
float4 PS2( PS_INPUT input) : SV_Target
{
return input.Color;
}
technique10 Render
{
pass P0
{
SetVertexShader( CompileShader( vs_4_0, VS() ) );
SetGeometryShader( NULL );
SetPixelShader( CompileShader( ps_4_0, PS() ) );
}
}
VertexShader vss = CompileShader( vs_4_0, VS2() );
technique10 Pa
{
pass P0
{
SetVertexShader( vss ) );
SetGeometryShader( NULL );
SetPixelShader( CompileShader( ps_4_0, PS2() ) );
}
}
#20 Members - Reputation: 499
Posted 03 February 2012 - 11:29 AM






