GMS 2 Draw failed due to invalid input layout

Re-Edited post to get to the point.

Gamemaker Studio 2 IDE version: v2.2.5.481
Runtime Version: v2.2.5.378
Platform: Windows

This script below, I believe interferes with ANY shader when used together(could be due to old code - minor alterations from this script: Click Here)

Draw Circular Bar
GML:
///@desc draw_circular_bar
///@arg x                0
///@arg y                1
///@arg value            2
///@arg max                3  higher the slower and lower the faster
///@arg colour            4
///@arg radius            5
///@arg alpha            6
///@arg width            7

if (argument2 > 0) { // no point even running if there is nothing to display (also stops /0
    var i, len, tx, ty, val;
 
    var numberofsections = 15 // there is no draw_get_circle_precision() else I would use that here
    var sizeofsection = numberofsections // -ve draws clockwise
 
    val = (argument2/argument3) * numberofsections // 2=value 3=max
 
    if (val > 1) {
     
        circlesurface = surface_create(argument5*2,argument5*2)
        if surface_exists(circlesurface){
        draw_set_colour(argument4);
        draw_set_alpha(argument6);
     
        surface_set_target(circlesurface)
     
        draw_clear_alpha(c_blue,0.7)
        draw_clear_alpha(c_black,0)
     
        draw_primitive_begin(pr_linestrip);
        draw_vertex(argument5, argument5);

        for(i=0; i<=val; i++) {
            len = (i*sizeofsection)-45; // the 45 here is the starting angle
            tx = lengthdir_x(argument5, -len);
            ty = lengthdir_y(argument5, len);
            draw_vertex(argument5+tx, argument5+ty);
        }
     
        draw_primitive_end();
     
        draw_set_alpha(1);
        gpu_set_blendmode(bm_subtract)
        draw_set_colour(c_black)
        draw_circle(argument5-1, argument5-1,argument5-argument7,false) //draws invisible circle to make ring
        gpu_set_blendmode(bm_normal)

        surface_reset_target()
     
  
        draw_surface(circlesurface,argument0-argument5, argument1-argument5)
     
        surface_free(circlesurface)
        }
    }
 
}
I've narrowed it down to this script being the cause of this compiler spam:

[Run] Run game
Options: Z:/Draw_faile_F90EFEAE_AB69B9D4\MainOptions.json
X://windows/Runner.exe -game "Y:/Draw_failed_due_to_invalid_input_project_6301C514_VM\Draw failed due to invalid input project.win"
Attempting to set gamepadcount to 12
DirectX11: Using hardware device
Collision Event time(microsecs)=1
Total memory used = 7571222(0x00738716) bytes
**********************************.
Entering main loop.
**********************************.
Could not generate input layout (is there a mismatch between your shader and vertex format?)
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Draw failed due to invalid input layout
Attempting to set gamepadcount to 0
Not shutting down steam as it is not initialised


X://windows/Runner.exe DONE (0)

I've exported a project that can be downloaded through this link: Click Here
But it may not be necessary to do that as someone with a trained eye will likely suss out the cause just from the code above.

It isn't a vital part of my project and I may scrap the idea of the script completely if it's not going to work this way but if anyone can help me get shaders to work with this
it'd be appreciated.

Usually the circle drawn has another circle drawn in the centre that is subtracted out, therefore creating a ring shape. With a shader enabled, this doesn't occur.

I looked at the primitive and the gpu_blendmode and even commented these out but the issue still occurs.
 
Last edited:

Bart

WiseBart
It's a very vague error message from GM's perspective but this part:

is there a mismatch between your shader and vertex format?

gives a bit of useful information.

I don't know the details but I'm quite sure that "input layout" has something to do with layout qualifiers in GLSL.

You get that message when something doesn't correspond between the vertex format and the attributes you use inside the shader.
It's printed to the debug output every step since drawing is performed each step.
I'm not exactly sure when it happens and how to reproduce it but I've encountered it myself before.

Did you also verify that it doesn't work with the default passthrough shader? (i.e. after a shader_reset() or a shader_set(-1))
It'd be odd if that's the case.
What vertex attributes do you have inside the shader?

It's a bit of a guess to figure out the underlying vertex format used by those draw_primitive functions but I'd expect it to at least work with the default format (under Vertex Formats).
Which means you should be able to write a shader that works together with that format.

Another thing that comes to mind: maybe you have to set the shader after setting the surface as render target?
Not sure about that.

Hope this can help a bit :)
 
It's a very vague error message from GM's perspective but this part:

is there a mismatch between your shader and vertex format?

gives a bit of useful information.

I don't know the details but I'm quite sure that "input layout" has something to do with layout qualifiers in GLSL.

You get that message when something doesn't correspond between the vertex format and the attributes you use inside the shader.
It's printed to the debug output every step since drawing is performed each step.
I'm not exactly sure when it happens and how to reproduce it but I've encountered it myself before.

Did you also verify that it doesn't work with the default passthrough shader? (i.e. after a shader_reset() or a shader_set(-1))
It'd be odd if that's the case.
What vertex attributes do you have inside the shader?

It's a bit of a guess to figure out the underlying vertex format used by those draw_primitive functions but I'd expect it to at least work with the default format (under Vertex Formats).
Which means you should be able to write a shader that works together with that format.

Another thing that comes to mind: maybe you have to set the shader after setting the surface as render target?
Not sure about that.

Hope this can help a bit :)
Thanks for an interesting reply.

The shader I've used is literally a "create shader". I've added nothing to it from standard.

If I used shader_reset(); yes that will stop the error but the shader itself will no longer exist - above is my issue narrowed down. The attempt is to get a brightness adjustment shader created on a layer above all instances, to maintain a brightness value after adjusting. If I incorporate shader_reset() in that object, it won't work in-game.

I'm still new to shaders, perhaps I need to call the shader_reset in another object, but I don't know for sure. Heres what I have setup in my brightness object:

Draw Event
GML:
if(!brightness_adjustment_dial) {/*shader_reset();*/ exit;}


draw_sprite(sDimmerPanel,ZERO,posx,posy);
shader_set(sh_brightness);
shader_set_uniform_f(pos_uni, pos);

I'll pay more attention to what you've said though as it appears this could be where I'm going wrong. So thankyou very much for your reply, it's helped me think better as to what the issue could be.
 
Top