[fixed]Pixelshader debug problem..

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
NewerCookie
Posts: 20
Joined: Sat Jan 10, 2009 12:53 pm

[fixed]Pixelshader debug problem..

Post by NewerCookie »

hi everyone, im first this forum

i tried debugging pixelshader in irrlicht 1.5
irrlicht make "irr_d3d9_dbg_hlsl_~.vsh"

...ok, then... where "irr_d3d9_dbg_hlsl_~.psh"??

finally, i found CD3D9HLSLMaterialRenderer.cpp
it don't make "irr_d3d9_dbg_hlsl_~.psh"

this topic discussed previously? i cant find..
I hope you understand my poor english.
If i used wrong sentence, notify me.
NewerCookie
Posts: 20
Joined: Sat Jan 10, 2009 12:53 pm

Post by NewerCookie »

i have been wait reply.. nothing :)
anyway, i fixed it. code below..
patch file here : http://www.mediafire.com/?jzo0gmtuogr

Code: Select all

	#ifdef _IRR_D3D_NO_SHADER_DEBUGGING

	HRESULT h = stubD3DXCompileShader(
		pixelShaderProgram,
		strlen(pixelShaderProgram), 
		0, // macros
		0, // no includes
		shaderEntryPointName,
		shaderTargetName,
		0, // no flags (D3DXSHADER_DEBUG)
		&buffer,
		&errors,
		&PSConstantsTable);

	#else

	// compile shader and emitt some debug informations to
	// make it possible to debug the shader in visual studio

	static int irr_dbg_hlsl_file_nr = 0; 
	++irr_dbg_hlsl_file_nr;
	char tmp[32];
	sprintf(tmp, "irr_d3d9_dbg_hlsl_%d.psh", irr_dbg_hlsl_file_nr);

	FILE* f = fopen(tmp, "wb");
	fwrite(pixelShaderProgram, strlen(pixelShaderProgram), 1, f);
	fflush(f);
	fclose(f);

	HRESULT h = stubD3DXCompileShaderFromFile(
		tmp,
		0, // macros
		0, // no includes
		shaderEntryPointName,
		shaderTargetName,
		D3DXSHADER_DEBUG | D3DXSHADER_SKIPOPTIMIZATION,
		&buffer,
		&errors,
		&PSConstantsTable);

	#endif
I hope you understand my poor english.
If i used wrong sentence, notify me.
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, I get your point. Question is if it's really necessary to create a file first. Can't we just put the debug flags to the first call, just conditionally?
NewerCookie
Posts: 20
Joined: Sat Jan 10, 2009 12:53 pm

Post by NewerCookie »

You mean.. "irr_d3d9_dbg_hlsl_~.psh" file making support by debug flag?
I think always make "irr_d3d9_dbg_hlsl_~.psh" is better..
I'm misunderstanding?
I hope you understand my poor english.
If i used wrong sentence, notify me.
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I don't see any reason why I'd want to create a file first, and then load and compile it again (with Debug flags on). We could do the debugging also with the IReadFile handle used in the true-branch of the ifdef.
And no, always writing the file is no option.
NewerCookie
Posts: 20
Joined: Sat Jan 10, 2009 12:53 pm

Post by NewerCookie »

I don't understand you or not.. I don't know :?
Sorry, I have poor english :cry:
Simply, my question is
Why don't irrlicht make "Psh" files in "CD3D9HLSLMaterialRenderer.cpp"
Even if i undef "_IRR_D3D_NO_SHADER_DEBUGGING", irrlicht make just "Vsh" file only
I hope you understand my poor english.
If i used wrong sentence, notify me.
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

What are those files good for? Do you need the file, or do you need the debug mode enabled for your shader?
NewerCookie
Posts: 20
Joined: Sat Jan 10, 2009 12:53 pm

Post by NewerCookie »

Yes, I need the file that "irr_d3d9_dbg_hlsl_~.psh"
I can't debug pixelshader without it
So, I fixed engine code
I hope you understand my poor english.
If i used wrong sentence, notify me.
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

fixed in SVN trunk.
Post Reply