Giter Site home page Giter Site logo

Failure to compile effect about fna HOT 12 CLOSED

fna-xna avatar fna-xna commented on August 23, 2024
Failure to compile effect

from fna.

Comments (12)

flibitijibibo avatar flibitijibibo commented on August 23, 2024

Put a breakpoint in the DebugCallback and it'll tell you which call it was.

from fna.

flibitijibibo avatar flibitijibibo commented on August 23, 2024

It also looks like your drivers are out of date:

https://downloadcenter.intel.com/product/81496/Intel-HD-Graphics-4600-for-4th-Generation-Intel-Core-Processors

from fna.

jeffphilp avatar jeffphilp commented on August 23, 2024

Good shout, it produces the error during the call to MOJOSHADER_glCompileEffect. I agree the drivers may be out of date on this laptop, but I got the same issue on my work machine running up to date nvidea drivers.

from fna.

flibitijibibo avatar flibitijibibo commented on August 23, 2024

If you've also got the latest fnalibs and you're still getting this then you'll have to step through this:

https://github.com/flibitijibibo/MojoShader/blob/master/mojoshader_opengl.c#L416

The likelihood of an actual INVALID_ENUM is extremely unlikely, as it would have to be glCreateShader getting sent GL_NONE, which is only true if you're attempting to send a shader other than vertex/pixel, which wouldn't make it past the parsing process.

from fna.

jeffphilp avatar jeffphilp commented on August 23, 2024

I am using the latest fnalibs, Ill step through that code first thing and post what I find. Thanks for your help.

from fna.

jeffphilp avatar jeffphilp commented on August 23, 2024

After stepping through the failure occurs in mojoshader.c 2723:
fail(ctx, "unsupported color index");

it was caused by an effect file which passed a color between the Vertex shader, and Pixel shader using COLOR2.

I'm not sure if by using that channel if I am violating the usage of the COLOR2 semantic, but the problem is fixed by passing a float4 using a TEXCOORD semantic.

from fna.

flibitijibibo avatar flibitijibibo commented on August 23, 2024

I believe I fixed this with the latest MojoShader commit, can you try it out?

from fna.

jeffphilp avatar jeffphilp commented on August 23, 2024

I just tried your latest commit, and that fixes the unknown variable issue. Thank you! What do you think about trying to get access to the fail reasons which are written too during processing and trying to expose them to the FNA logger? even if it is only during debug sessions. May make diagnostics easier in future, which in my case testing on windows involved a lot of printf statements.

from fna.

flibitijibibo avatar flibitijibibo commented on August 23, 2024

Error checking for the effects has been a very overdue fix, so I'd be up for that. Just add it to this method using FNAPlatform.Log and I'll pull it in (check your tabs carefully! ;P ).

https://github.com/FNA-XNA/FNA/blob/master/src/Graphics/OpenGLDevice.cs#L1750

from fna.

jeffphilp avatar jeffphilp commented on August 23, 2024

So I have written at least logging errors for parsing of effects, however it also uses Utf8 to managed string marshaling like that which exists in SDL2# LPUtf8StrMarshaler, and which is also used in SDL2_FnaPlatform. Do you have a place for sticking a convenience method such as:

private static unsafe string MarshalNativeUtf8ToManagedString(IntPtr pNativeData)
{
    if (pNativeData == IntPtr.Zero)
        return null;
    var ptr = (byte*)pNativeData;
    while (*ptr != 0)
    {
        ptr++;
    }
    var bytes = new byte[ptr - (byte*)pNativeData];
    Marshal.Copy(pNativeData, bytes, 0, bytes.Length);
    return Encoding.UTF8.GetString(bytes);
}

which could be used at least initially in OpenGLDevice#CreateEffect ?

from fna.

flibitijibibo avatar flibitijibibo commented on August 23, 2024

At the moment no, but I wouldn't mind if you just copied this into that function:

https://github.com/FNA-XNA/FNA/blob/master/src/SDL2/SDL2_FNAPlatform.cs#L395

from fna.

flibitijibibo avatar flibitijibibo commented on August 23, 2024

This will be fixed with the next fnalibs update, pending #24's fixes.

from fna.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.