Finally, a DirectX 10 video driver for Irrlicht
Re: Finally, a DirectX 10 video driver for Irrlicht
Can any one use geometry shaders?
So far it would seem that the driver Is trying to set the geometry shader from a null Shader object but I cannot find how or why the Shader object containing the geometry shader is null
So far it would seem that the driver Is trying to set the geometry shader from a null Shader object but I cannot find how or why the Shader object containing the geometry shader is null
Re: Finally, a DirectX 10 video driver for Irrlicht
hi,
if you can provide an example i will test it tomorrow.
if i remember right the d3dcompiler.h should be in
C:\Program Files\Windows Kit\8.0\include\x86
regards
zerochen
if you can provide an example i will test it tomorrow.
if i remember right the d3dcompiler.h should be in
C:\Program Files\Windows Kit\8.0\include\x86
regards
zerochen
Re: Finally, a DirectX 10 video driver for Irrlicht
the modification to the example 10
d3d11.hlsl
and d3compile.h was not present there nor anywhere while I had windows 8 sdk instaled
Code: Select all
newMaterialType1 = gpu->addHighLevelShaderMaterialFromFiles(
vsFileName,
"vertexMain",
video::EVST_VS_4_0,
psFileName,
"pixelMain",
video::EPST_PS_4_0,
psFileName,
"GS",
irr::video::EGST_GS_4_0,
scene::EPT_TRIANGLES,
scene::EPT_TRIANGLES,
102,
mc,
video::EMT_SOLID, 0, shadingLanguage);
d3d11.hlsl
Code: Select all
// part of the Irrlicht Engine Shader example.
// These simple Direct3D11 pixel and vertex shaders will be loaded by the shaders
// example. Please note that these example shaders don't do anything really useful.
// They only demonstrate that shaders can be used in Irrlicht.
//-----------------------------------------------------------------------------
// Global variables
//-----------------------------------------------------------------------------
cbuffer cbParams : register(c0)
{
float4x4 mWorld; // World * View * Projection transformation
float4x4 mViewProj;
float4x4 mInvWorld; // Inverted world matrix
float4x4 mTransWorld; // Transposed world matrix
float3 mLightPos; // Light position
float4 mLightColor; // Light color
};
struct VS_INPUT
{
float4 vPosition : POSITION;
float3 vNormal : NORMAL;
float4 color : COLOR;
float2 texCoord : TEXCOORD0;
};
// Vertex shader output structure
struct VS_OUTPUT
{
float4 Position : SV_Position; // vertex position
float4 Diffuse : COLOR0; // vertex diffuse color
float2 TexCoord : TEXTURE0; // tex coords
};
VS_OUTPUT vertexMain( VS_INPUT input )
{
VS_OUTPUT Output = (VS_OUTPUT)0;
// transform position to clip space
Output.Position = mul(mul(input.vPosition, mWorld),mViewProj);
// transform normal
float3 normal = mul(input.vNormal, mInvWorld);
// renormalize normal
normal = normalize(normal);
// position in world coodinates
float3 worldpos = mul(mTransWorld, input.vPosition);
// calculate light vector, vtxpos - lightpos
//float3 lightVector = worldpos.xyz - mLightPos;
float3 lightVector = mLightPos - worldpos.xyz;
// normalize light vector
lightVector = normalize(lightVector);
// calculate light color
float3 tmp = dot(-lightVector, normal);
tmp = lit(tmp.x, tmp.y, 1.0);
tmp = mLightColor * tmp.y;
Output.Diffuse = float4(tmp.x, tmp.y, tmp.z, 0);
Output.TexCoord = input.texCoord;
return Output;
}
[maxvertexcount(12)]
void GS( triangle VS_OUTPUT sprite[3], inout TriangleStream<VS_OUTPUT> triStream )
{
VS_OUTPUT v1,v2,v3;
v1 = sprite[0];
v2 = sprite[1];
v3 = sprite[2];
v1.Position = sprite[0].Position;//mul(sprite[0].Position,mViewProj);
v2.Position = sprite[1].Position;//mul(sprite[1].Position,mViewProj);
v3.Position = sprite[2].Position;//mul(sprite[2].Position,mViewProj);
triStream.Append(v1);
triStream.Append(v2);
triStream.Append(v3);
for (int a = 0; a<3; a++)
{
triStream.RestartStrip();
v1.Position = mul(sprite[0].Position+float4(a*50,a*20,0,0),mViewProj);
v1.Position +=a;
v2.Position = mul(sprite[1].Position+float4(a*50,a*20,0,0),mViewProj);
v1.Position +=a;
v3.Position = mul(sprite[2].Position+float4(a*50,a*20,0,0),mViewProj);
v3.Diffuse.y = 0;
v1.Position +=a;
triStream.Append(v1);
triStream.Append(v2);
triStream.Append(v3);
}
}
Texture2D tex0 : register(t0);
SamplerState st : register(s0);
float4 pixelMain( VS_OUTPUT input ) : SV_Target
{
float4 Output;
float4 col = tex0.Sample( st, input.TexCoord ); // sample color map
// multiply with diffuse and do other senseless operations
Output = input.Diffuse * col;
Output *= 4.0;
return Output;
}
and d3compile.h was not present there nor anywhere while I had windows 8 sdk instaled
Re: Finally, a DirectX 10 video driver for Irrlicht
I´ve installed the 8.1 SDK on my Win 7 system, and the D3D 10 & 11 headers are here: C:\Program Files (x86)\Windows Kits\8.1\Include\um (files such as d3d11shader.h )
Is there no 64-bit version of DX11?
Is there no 64-bit version of DX11?
Re: Finally, a DirectX 10 video driver for Irrlicht
I have no idea for the windows 8 sdk but for the dx sdk yes all my project compile to 64 bits
Re: Finally, a DirectX 10 video driver for Irrlicht
@robmar
the lib files for the 64bit version are under
<winsdk>\Lib\win8\um\x64
@Granyte
i found the reason for the crash. there was a problem with resetting the shaders. here is the patch file
CD3D11CallBridge.cpp.patch
with the d3dcompiler.h problem
make sure after you download the setup file that you have checked the "windows software development kit" box otherwise the header files will be missed.
regards
zerochen
edit: now the app did not crash but still did not see anything. maybe there is a problem with the shader code?
edit: i see that there is a problem with the shaders if they are in the same file... i will be fix this soon.
the lib files for the 64bit version are under
<winsdk>\Lib\win8\um\x64
@Granyte
i found the reason for the crash. there was a problem with resetting the shaders. here is the patch file
CD3D11CallBridge.cpp.patch
with the d3dcompiler.h problem
make sure after you download the setup file that you have checked the "windows software development kit" box otherwise the header files will be missed.
regards
zerochen
edit: now the app did not crash but still did not see anything. maybe there is a problem with the shader code?
edit: i see that there is a problem with the shaders if they are in the same file... i will be fix this soon.
Re: Finally, a DirectX 10 video driver for Irrlicht
Alright after that fix ill see if i can expose hull domain and compute shaders through the interphase (unless you did and i can't find how to use them)
And then see if i can expose stream output functionality(http://msdn.microsoft.com/en-us/library ... s.85).aspx)
Also when nadro will give me the go i will add multipe vbo support and instancing
Same for the 3dtexture and other type of textures;
And then see if i can expose stream output functionality(http://msdn.microsoft.com/en-us/library ... s.85).aspx)
Also when nadro will give me the go i will add multipe vbo support and instancing
Same for the 3dtexture and other type of textures;
Re: Finally, a DirectX 10 video driver for Irrlicht
So cubemaps are needing to be added to this DX10/11 driver?
Re: Finally, a DirectX 10 video driver for Irrlicht
Not specificaly cube maps but there was a patch for ogl that added support for 3d texture in a way that created an interphase we could use to handle any texture type so the more feature i can push and uniformise across dx9 and the dx10/11 driver the more we can hppe to get for irrlicht 2.0
Re: Finally, a DirectX 10 video driver for Irrlicht
okay well hope it goes well.
Re: Finally, a DirectX 10 video driver for Irrlicht
do you know why the shaders bug when they are in the same file?
Re: Finally, a DirectX 10 video driver for Irrlicht
no idea but that´s got to be an easy one to fix.
Re: Finally, a DirectX 10 video driver for Irrlicht
Surely if you have two shaders in the same file there will be two 'main's; hence a compiling (or linking) error.
Re: Finally, a DirectX 10 video driver for Irrlicht
hi,
i already fixed it but if i would made a patch now it also includes the changes from the patch earlier.
ShaderInSameFile_CleanUp_ShaderReset.patch
or you just change line 583 in CD3D11MaterialRenderer.cpp to
another thing is i m not sure in which shader you can share a constant buffer.
if we have a vertex and geometry shader in one file they can share the constant buffer but works this in a hull or domain shader too?
if vertex and geometry shader are in 2 files i guess you have to declare the constant buffer twice but is it still shared?
and if not do we need another function like
regards
zerochen
edit: yea the main's must be different but this is more a problem of who shares the constant buffer... so it is more a lack of my knowledge about shaders:D
i already fixed it but if i would made a patch now it also includes the changes from the patch earlier.
ShaderInSameFile_CleanUp_ShaderReset.patch
or you just change line 583 in CD3D11MaterialRenderer.cpp to
Code: Select all
if(core::stringc(vertexShaderProgram) == core::stringc(pixelShaderProgram))
if we have a vertex and geometry shader in one file they can share the constant buffer but works this in a hull or domain shader too?
if vertex and geometry shader are in 2 files i guess you have to declare the constant buffer twice but is it still shared?
and if not do we need another function like
Code: Select all
bool CD3D11Driver::set[u]Geometry[/u]ShaderConstant(s32 index, const f32* floats, int count)
regards
zerochen
edit: yea the main's must be different but this is more a problem of who shares the constant buffer... so it is more a lack of my knowledge about shaders:D
Re: Finally, a DirectX 10 video driver for Irrlicht
I guess it would work as existing shaders work, like in GLSL, where you double define the common variables.
In HLSL and CG it can all go in the same single file, but the mains are usually like "mainVS" and "mainPS" as far as I´ve seen.
OpenGL should give some guidance on this....http://www.opengl.org/wiki/Shader_Compilation
Microsoft must also, to allow developers to use their shader compiler http://msdn.microsoft.com/en-us/library ... s.85).aspx
With Irrlicht 1.7.3. I notice that global variable don´t maintain their data between vertex and pixel shader calls... is that normal? I sort of thought the data would last over the two calls...
In HLSL and CG it can all go in the same single file, but the mains are usually like "mainVS" and "mainPS" as far as I´ve seen.
OpenGL should give some guidance on this....http://www.opengl.org/wiki/Shader_Compilation
Microsoft must also, to allow developers to use their shader compiler http://msdn.microsoft.com/en-us/library ... s.85).aspx
With Irrlicht 1.7.3. I notice that global variable don´t maintain their data between vertex and pixel shader calls... is that normal? I sort of thought the data would last over the two calls...