HLSL. Possible?

Blitz3D Forums/Blitz3D Userlibs/HLSL. Possible?

ZJP(Posted 2008) [#1]
Hi,

B3D is a Dx7 engine. Well. It is possible to use the DX9 engine shader with an EXTERNAL DLL like this ?
Call_shader_DLL(Buffer_adr,width,height,depth,"pixel_shader_routine.fx")

Buffer_adr = Texture or Image buffer ;-)
JP


Vertigo(Posted 2008) [#2]
No, not its not.
As far as I know current cards backwardly support directx 7 however newer technology(especially the ASM on the pipe for shaders) is completely different. Basically we're limited to whatever DirectX 7(most of it anyways) was able to draw to the card. D3d 9/10 are completely different. So much between 7 and 9 is deprecated that it would be scary as hell to see if ANYTHING at the class library level were compatible.


ZJP(Posted 2008) [#3]
How to use HLSL in a Picture Box with a external DLL ( VB6 exemple )
Sorry, french web site ;-)

http://www.vbfrance.com/codes/IMAGES-EFFETS-HLSL-SHADERS-DIRECTX_44113.aspx

JP


ZJP(Posted 2008) [#4]
Hi,

One test of a "Post-Processing Pixel Shader"

Work well !!! ;-)

JP
The DLL http://www.zinfo972.net/avatar/imagefx.dll
The B3d test file

Graphics3D 800,600,32,2

Global hwnd    = SystemProperty ("AppHWND")

Global context% = ifx_Create(hwnd, 800,600, "shock.fx")

If context = 0 Then End

; technic shader routine
ifx_SetTechnique context, "t0"

; set the texture file texture
ifx_SetTexture   context, "diffuse", "test.bmp"

While Not KeyDown( 1 )

	ifx_SetFloat context, "time", Rnd(0.1,0.2)
	ifx_Render   context
	
	Flip
Wend

ifx_Destroy context

End 


The DECLS file

;
 .lib "imagefx.dll"

 ifx_Create%(hwnd%,Width%,Height%,fxname$):"ifx_Create"
 ifx_Destroy(context%):"ifx_Destroy"
 ifx_Render(context%):"ifx_Render"
 ifx_PreRender(context%):"ifx_PreRender"
 ifx_PreRenderViewport(context%,X%,Y%,Width%,Height%):"ifx_PreRenderViewport"
 ifx_PostRender(context%):"ifx_PostRender"
 ifx_DestroyTexture(context%,texname$):"ifx_DestroyTexture"
 ifx_GetLastError(context%,buf$,size%):"ifx_GetLastError"
 ifx_GetGlobalLastError(buf$,size%):"ifx_GetGlobalLastError"

 ifx_SetTechnique(context%,Handle$):"ifx_SetTechnique"
 ifx_SetString(context%,Handle$,value$):"ifx_SetString"
 ifx_SetVector(context%,Handle$,X#,Y#,z#,w#):"ifx_SetVector"
 ifx_SetFloat(context%,Handle$,value#):"ifx_SetFloat"
 ifx_SetTexture(context%,Handle$,texname$):"ifx_SetTexture"
 ifx_SetInteger(context%,Handle$,value%):"ifx_SetInteger"

 ifx_SetColor(context%,Handle$,value%):"ifx_SetColor"



the Shader "shock.fx" file

texture diffuse;
float time;

sampler SamplerWaves = sampler_state
{ 	Texture   = (diffuse);

	MipFilter = NONE;
	MinFilter = NONE;
	MagFilter = NONE;
};

float4 pswaves(float2 inTexcoord : TEXCOORD0) : COLOR
{
	float normtime = time * 0.2f;
	return float4(tex2D(SamplerWaves, inTexcoord * 1.5f + float2(normtime*0.2f, normtime*0.13f) * 3.0f).rgb, 1.0f);
}

technique t0
{
	pass P0
	{
		pixelshader = compile ps_1_4 pswaves();
	}
}



mongia2(Posted 2008) [#5]
imagefx.dll is your dll?


puki(Posted 2008) [#6]
This looks interesting.


ZJP(Posted 2008) [#7]
"imagefx.dll is your dll? "

No. It's from this french guy http://www.vbfrance.com/codes/IMAGES-EFFETS-HLSL-SHADERS-DIRECTX_44113.aspx

I'm just try to use this DLL with B3D.

JP


KimoTech(Posted 2008) [#8]
But isn't it slowly, when using GDI to read from Blitz3D?


MikhailV(Posted 2008) [#9]
Interesting!
But this does not work with RenderWorld of the Blitz3D :(