damu / Urho-Sample-Platformer

https://github.com/gawag/Urho-Sample-Platformer/wiki
MIT License
17 stars 10 forks source link

figure out whose fault input layout failure is #57

Open bvanevery opened 8 years ago

bvanevery commented 8 years ago

USP is junked with highly fragmented rendering errors. Doesn't matter if built against Urho3D 1.5 or the latest GitHub pull. The same 3 log errors are given:

[Mon Dec 14 14:20:25 2015] ERROR: Failed to create input layout for shader Shadow(), missing element mask 8
[Mon Dec 14 14:20:25 2015] ERROR: Failed to create input layout for shader Shadow(SKINNED), missing element mask 8
[Mon Dec 14 14:20:26 2015] ERROR: Failed to create input layout for shader level_1_terrain(DIRLIGHT PERPIXEL SHADOW VERTEXCOLOR), missing element mask 8

I swear I had everything working with a Urho3D pull maybe 2 days ago. Need to figure out if this is Urho3D's bug or USP's.

bvanevery commented 8 years ago

D3D11VertexDeclaration.cpp logs those errors. I used TortoiseGit to pull up a log of changes to it. It doesn't look like any of that code has changed recently. A long time ago, back in March, there was an entry:

* Fix LitSolid & LitParticle shaders failing to create input layout (missing normals.) Log more detailed error when input layout creation fails.

In that commit was a change to LitSolid.hlsl that went from:

    float3 iNormal : NORMAL,

to:

    #ifndef BILLBOARD
        float3 iNormal : NORMAL,
    #endif

So, I'm betting this is the general nature of the error. A shader written for Urho3D requires various defined symbols for all the permutations possible according to user selection. The shaders provided by USP probably do not implement all of the needed permutations correctly. Probably nothing wrong on Urho3D's end, just USP's.

This would be a tough learning curve for a new user of Urho3D. I'll review whether these requirements are documented. It would also be good if Urho3D could detect whether various symbols are defined, for its rather specific shader requirements.

bvanevery commented 8 years ago

The following notation was added to the Urho3D docs yesterday: "Direct3D11 is strict about vertex attributes referenced by shaders. A model will not render (input layout fails to create) if the shader for example asks for UV coordinates and the model does not have them. For this particular case, see the NOUV define in LitSolid shader, which is defined in the NoTexture family of techniques to prevent the attempted reading of UV coords."

damu commented 8 years ago

Cadaver wrote a bit about that issue in http://urho3d.prophpbb.com/topic1644.html