GPU: ShaderInterface: Refactor to setup all uniform at creation time

This remove the complexity of queriying the locations at runtime and
allows for more performance and upfront binding specifications.

The benefit of doing everything at creation time is that we can assign binding
points in a predictable order which is going to be somewhat the same for
every similar shader.

This also rewrite GPU_vertformat_from_shader to not use shaderface.

This is to keep the shaderface simple. If it becomes necessary to not query
the shader after creation (i.e: vulkan?) we could just create the vert
format in advance at compilation for PyGPU shaders.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7879
This commit is contained in:
2020-06-02 12:11:39 +02:00
parent bdda53fdb2
commit cecda64e2e
8 changed files with 342 additions and 247 deletions

View File

@@ -524,7 +524,7 @@ PyDoc_STRVAR(bpygpu_shader_calc_format_doc,
static PyObject *bpygpu_shader_calc_format(BPyGPUShader *self, PyObject *UNUSED(arg))
{
BPyGPUVertFormat *ret = (BPyGPUVertFormat *)BPyGPUVertFormat_CreatePyObject(NULL);
GPU_vertformat_from_interface(&ret->fmt, GPU_shader_get_interface(self->shader));
GPU_vertformat_from_shader(&ret->fmt, self->shader);
return (PyObject *)ret;
}