Igalia/vkrunner

Allow to set up entry point name

Closed this issue · 6 comments

Currently VkRunner supports only the entry point named main (see here and here).

Why don't we allow users to set up the entry point name in the script?
It would be useful when a shader has multiple entry points and users want to test it with those entry points using only a single script.
In addition, some compiler might not allow to use main as an entry point name e.g., clspv.

bpeel commented

This seems like a good idea. What do you think is the best way to handle this? If we want to test different entry points for a shader within a single VkRunner script perhaps we could make a property for each of the stages on the vr_pipeline_key. Then you could do something like this:

[test]
vs entrypoint my_main
draw rect -1 -1 1 1
vs entrypoint my_other_main
draw rect 0 0 1 1

That would cause VkRunner to internally create a separate pipeline for each of those draw commands.

However, if the goal is just to make clspv work, perhaps it would be simpler just to have a single global option in the [require] section. What do you think?

Right. Supporting multiple entry points for a stage requires a big change.

Why don't we support the later one i.e., a single global option in the [require] such as vs entrypoint my_main and delay the support of multiple entry points until we have a specific use case?

In addition, if an entry point is not specified, we can assume that the entry point is main as default.

bpeel commented

I started looking at how hard it would be to implement the pipeline key idea and decided it wouldn’t be too tricky so I just implemented it on a branch.

Note, it doesn’t work with GLSL sources because it doesn’t do anything to tell glslangValidator what the entrypoint is. It has --entry-point and --source-entrypoint options but I’m not entirely sure if that’s supposed to let you use something other than main and I can’t get it to work.

Instead there is an example using a SPIR-V source directly.

If you have any feedback I’d be happy to hear it.

Thank you for making it work.
I checked the code and it looks good to me.

One minor thing I want to doublecheck is first_graphics_pipeline in this line.
IMHO, it is not the first graphics pipeline but it is the last (i.e., previous) one.
Changing the name would make it more clear.

bpeel commented

One minor thing I want to doublecheck is first_graphics_pipeline in this line.

Oops! It was supposed to be the first pipeline. It was even reporting a validation layer error because of that. I have updated the branch. Thanks for finding it.

It looks good to me 👍