Fix #131943: GPU: Vertex formats for polyline shaders
PR #129315 refactored polylines. The shaders now attaches the vertex attributes as SSBOs. Adding a workaround for polyline shaders to extract the correct vertex formats when called via Python. Pull Request: https://projects.blender.org/blender/blender/pulls/132689
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "GPU_capabilities.hh"
|
||||
#include "GPU_shader.hh"
|
||||
#include "GPU_texture.hh"
|
||||
#include "GPU_uniform_buffer.hh"
|
||||
@@ -685,7 +686,20 @@ PyDoc_STRVAR(
|
||||
static PyObject *pygpu_shader_format_calc(BPyGPUShader *self, PyObject * /*arg*/)
|
||||
{
|
||||
BPyGPUVertFormat *ret = (BPyGPUVertFormat *)BPyGPUVertFormat_CreatePyObject(nullptr);
|
||||
GPU_vertformat_from_shader(&ret->fmt, self->shader);
|
||||
if (bpygpu_shader_is_polyline(self->shader)) {
|
||||
GPU_vertformat_clear(&ret->fmt);
|
||||
|
||||
/* WORKAROUND: Special case for POLYLINE shader. */
|
||||
if (GPU_shader_get_ssbo_binding(self->shader, "pos") >= 0) {
|
||||
GPU_vertformat_attr_add(&ret->fmt, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
||||
}
|
||||
if (GPU_shader_get_ssbo_binding(self->shader, "color") >= 0) {
|
||||
GPU_vertformat_attr_add(&ret->fmt, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
|
||||
}
|
||||
}
|
||||
else {
|
||||
GPU_vertformat_from_shader(&ret->fmt, self->shader);
|
||||
}
|
||||
return (PyObject *)ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user