Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

LoadShaderFromMemory Function is not working. #20

@SoloByte

Description

@SoloByte

Using LoadShaderFromMemory returns a shader but when used in Raylib.BeginShaderMode(shader); the shader does not work. Doing the exact same thing in a project using Raylib cs everything works as expected.

Does the first try-statement throw an exception if "vsCode" parameter is null?

Raylib CsLo Binding Code:

public unsafe static Shader LoadShaderFromMemory(string? vsCode, string fsCode)
{
    SpanOwner<sbyte> spanOwner = vsCode.MarshalUtf8();
    try
    {
        SpanOwner<sbyte> spanOwner2 = fsCode.MarshalUtf8();
        try
        {
            return LoadShaderFromMemory(spanOwner.AsPtr(), spanOwner2.AsPtr());
        }
        finally
        {
            spanOwner2.Dispose();
        }
    }
    finally
    {
        spanOwner.Dispose();
    }
}

Raylib Cs Binding Code:

public unsafe static Shader LoadShaderFromMemory(string vsCode, string fsCode)
{
    using UTF8Buffer uTF8Buffer = vsCode.ToUTF8Buffer();
    using UTF8Buffer uTF8Buffer2 = fsCode.ToUTF8Buffer();
    return LoadShaderFromMemory(uTF8Buffer.AsPointer(), uTF8Buffer2.AsPointer());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions