DRW: Curves: Indexbuf optimization for large numbers of curves #116617
|
@ -79,6 +79,11 @@ typedef enum eGPUBuiltinShader {
|
|||
/** Draw wide lines with uniform color. Has an additional clip plane parameter. */
|
||||
GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR,
|
||||
|
||||
/** Compute shaders to generate 2d index buffers (mainly for curve drawing). */
|
||||
GPU_SHADER_INDEXBUF_POINTS,
|
||||
GPU_SHADER_INDEXBUF_LINES,
|
||||
GPU_SHADER_INDEXBUF_TRIS,
|
||||
|
||||
/**
|
||||
* ----------------------- Shaders exposed through pyGPU module -----------------------
|
||||
*
|
||||
|
@ -127,15 +132,8 @@ typedef enum eGPUBuiltinShader {
|
|||
* \param pos: in vec3
|
||||
*/
|
||||
GPU_SHADER_3D_IMAGE_COLOR,
|
||||
|
||||
/**
|
||||
* Compute shaders to generate 2d index buffers (mainly for curve drawing).
|
||||
* */
|
||||
GPU_SHADER_INDEXBUF_POINTS,
|
||||
GPU_SHADER_INDEXBUF_LINES,
|
||||
GPU_SHADER_INDEXBUF_TRIS,
|
||||
} eGPUBuiltinShader;
|
||||
#define GPU_SHADER_BUILTIN_LEN (GPU_SHADER_INDEXBUF_TRIS + 1)
|
||||
#define GPU_SHADER_BUILTIN_LEN (GPU_SHADER_3D_IMAGE_COLOR + 1)
|
||||
|
||||
/** Support multiple configurations. */
|
||||
typedef enum eGPUShaderConfig {
|
||||
|
|
|
@ -274,12 +274,15 @@ GPUIndexBuf *GPU_indexbuf_build_curves_on_device(GPUPrimType prim_type,
|
|||
GPU_memory_barrier(GPU_BARRIER_BUFFER_UPDATE);
|
||||
ib = GPU_indexbuf_build_on_device(curves_num * dispatch_x_dim);
|
||||
int resolution;
|
||||
if (tris)
|
||||
if (tris) {
|
||||
resolution = 6;
|
||||
else if (lines)
|
||||
}
|
||||
else if (lines) {
|
||||
resolution = 2;
|
||||
else
|
||||
}
|
||||
else {
|
||||
resolution = 1;
|
||||
}
|
||||
GPU_shader_uniform_1i(shader, "elements_per_curve", dispatch_x_dim / resolution);
|
||||
GPU_shader_uniform_1i(shader, "ncurves", curves_num);
|
||||
GPU_indexbuf_bind_as_ssbo(ib, GPU_shader_get_ssbo_binding(shader, "out_indices"));
|
||||
|
|
Loading…
Reference in New Issue