• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
lomateron

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

29 posts in this topic

so i was developing a physics system, then i feel the necesity to acces the gpu memory from the shaders to change the vertex buffer fast after moving an object, so i started searching and i find the stream output step in the shaders, so i incorporated this step in my program, modifiying the step because i am still not using the geometry shader as the title of this topic says,i writted all the lines of codes required to do this correctly, the problem came when i runned it in debug mode, the program wasnt going further than the D3DX10CreateEffectFromFile(), it wasnt reading my .fx file, so i started searching for the promen and then i realize that when i added the line:
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.
0

Share this post


Link to post
Share on other sites
[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left]CompileShader() is not supposed to be in HLSL. I'm not sure if you knew that or not, but it's supposed to be in your main app, not in the effects file[/left][/size][/font][/color]
0

Share this post


Link to post
nop it doent because the man has misplaced the code where it doent belong, what happens to me is different, the D3DX10CreateEffectFromFile() stops working when i am using the line i show you, pls read my post correctly
0

Share this post


Link to post
Share on other sites
i know, that was my mistake, sorry, so i edited my post to say post your vertex shader instead. actually, could you just post your whole effect file?
0

Share this post


Link to post
Share on other sites
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 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;
}
0

Share this post


Link to post
Share on other sites
ohhh no i putted the wrong name in here,in my project is ok, i mean thats not the problem sorry for that, just think the name is correct, i am gona edit it
0

Share this post


Link to post
Share on other sites
the thing is that there is no error with the names in my project, its just that line that makes it all dont work, maybe its because when compile it doent knows what the class VertexShader because the right part of the equation CompileShader( vs_4_0, VS2() ); is running normally when it runs down in the shaders metodos
0

Share this post


Link to post
Share on other sites
I don't know why, but i used that line just like you did, and it compiles perfect for me. here is the effect file i tried it with:

[code]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() ) );
}
}[/code]

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?
0

Share this post


Link to post
Share on other sites
damm yes it runs here too when i run it in the advanceParticles sample from the sdk but it doent runs in my proyect, read my reply that is behind this one, i edited it
0

Share this post


Link to post
Share on other sites
this is where it fails

[indent=1]//////////////////////////////////////////////////*******************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;

}[/indent]
0

Share this post


Link to post
Share on other sites
ok, this might not be the problem, but i'm just going to ask anyway since i can't see at all what your doing wrong. but did you install a more recent version of directx over an older version of directx?

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
0

Share this post


Link to post
Share on other sites
yes i had a problem installing the Microsoft DirectX SDK (June 2010) because i intalled the Microsoft DirectX SDK (February 2010) first and then i realiced that there was a new version just after intalling it, but when i tried intalling the newest Microsoft DirectX SDK (June 2010), the intaller said that the intallation failed dont remember why, then i saw the samples all that folders i needed from the Microsoft DirectX SDK (June 2010) where there int hte Microsoft DirectX SDK (June 2010) folder so i didnt bothered to reintalling it because the folders were already there with everything, i dont know were the intaller failed, its all there. But ok i will do it i will try unistalling all that, man but that like 600mb to download, mmm it doent matter
0

Share this post


Link to post
Share on other sites
I am stuck, how do you unistall that, theres no directx sdk program in the control panel programs
0

Share this post


Link to post
Share on other sites
yeah i know, reinstalling the sdk is a pain because of it's size to download, but i'm sure it's for the better ;) hope it works for ya!
0

Share this post


Link to post
Share on other sites
hey i ultimately discorvered that the error is in the .fx file (after long test) but i really really dont see where is it look this is the code pls help me find where is the mistake

[code]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() ) );
}
}[/code]
0

Share this post


Link to post
Share on other sites
come on ppl you can find the mistake, i am stuck because of it, grate proyects come after this big rock thats not letting me pass
0

Share this post


Link to post
Share on other sites
I really can't see anything wrong at the moment, but you said if you don't use the debug flag when compiling your shader, it works right? I would just skip the debug flag for now. Try out the advanceparticles sample from the sdk or whatever like you said, and try using the debug flag when compiling the shader. if it still doesn't work even with the sample, then i'm sure it's a problem with your directx install
0

Share this post


Link to post
Share on other sites
hey man replace the .fx proyect that you have any, with my exact .fx file code i will say it would not work
0

Share this post


Link to post
Share on other sites
maybe this was a mistake, but check out this line:


[color=#660066]SetVertexShader[/color][color=#666600]([/color][color=#000000] vss [/color][color=#666600])[/color][color=#000000] [/color][color=#666600]);[/color]

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
0

Share this post


Link to post
Share on other sites

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  
Followers 0