2023-08-15 16:20:26 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2022-08-08 19:01:38 +02:00
|
|
|
|
2022-09-02 18:30:48 +02:00
|
|
|
#include "draw_defines.h"
|
2022-08-08 19:01:38 +02:00
|
|
|
#include "gpu_shader_create_info.hh"
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Debug print
|
|
|
|
*
|
|
|
|
* Allows print() function to have logging support inside shaders.
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_debug_print)
|
2023-08-20 16:48:46 +02:00
|
|
|
.define("DRW_DEBUG_PRINT")
|
2022-08-08 19:01:38 +02:00
|
|
|
.typedef_source("draw_shader_shared.h")
|
2022-09-02 18:30:48 +02:00
|
|
|
.storage_buf(DRW_DEBUG_PRINT_SLOT, Qualifier::READ_WRITE, "uint", "drw_debug_print_buf[]");
|
2022-08-08 19:01:38 +02:00
|
|
|
|
|
|
|
GPU_SHADER_INTERFACE_INFO(draw_debug_print_display_iface, "").flat(Type::UINT, "char_index");
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_debug_print_display)
|
|
|
|
.do_static_compilation(true)
|
|
|
|
.typedef_source("draw_shader_shared.h")
|
2023-02-12 23:04:04 +01:00
|
|
|
.storage_buf(DRW_DEBUG_PRINT_SLOT, Qualifier::READ, "uint", "drw_debug_print_buf[]")
|
2022-08-08 19:01:38 +02:00
|
|
|
.vertex_out(draw_debug_print_display_iface)
|
|
|
|
.fragment_out(0, Type::VEC4, "out_color")
|
2022-10-07 12:21:30 +02:00
|
|
|
.push_constant(Type::VEC2, "viewport_size")
|
2022-08-08 19:01:38 +02:00
|
|
|
.vertex_source("draw_debug_print_display_vert.glsl")
|
|
|
|
.fragment_source("draw_debug_print_display_frag.glsl")
|
|
|
|
.additional_info("draw_view");
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Debug draw shapes
|
|
|
|
*
|
|
|
|
* Allows to draw lines and points just like the DRW_debug module functions.
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_debug_draw)
|
2023-08-20 16:48:46 +02:00
|
|
|
.define("DRW_DEBUG_DRAW")
|
2022-08-08 19:01:38 +02:00
|
|
|
.typedef_source("draw_shader_shared.h")
|
2022-09-02 18:30:48 +02:00
|
|
|
.storage_buf(DRW_DEBUG_DRAW_SLOT,
|
|
|
|
Qualifier::READ_WRITE,
|
|
|
|
"DRWDebugVert",
|
|
|
|
"drw_debug_verts_buf[]");
|
2022-08-08 19:01:38 +02:00
|
|
|
|
|
|
|
GPU_SHADER_INTERFACE_INFO(draw_debug_draw_display_iface, "interp").flat(Type::VEC4, "color");
|
|
|
|
|
|
|
|
GPU_SHADER_CREATE_INFO(draw_debug_draw_display)
|
|
|
|
.do_static_compilation(true)
|
|
|
|
.typedef_source("draw_shader_shared.h")
|
2023-02-12 23:04:04 +01:00
|
|
|
.storage_buf(DRW_DEBUG_DRAW_SLOT, Qualifier::READ, "DRWDebugVert", "drw_debug_verts_buf[]")
|
2022-08-08 19:01:38 +02:00
|
|
|
.vertex_out(draw_debug_draw_display_iface)
|
|
|
|
.fragment_out(0, Type::VEC4, "out_color")
|
|
|
|
.push_constant(Type::MAT4, "persmat")
|
|
|
|
.vertex_source("draw_debug_draw_display_vert.glsl")
|
|
|
|
.fragment_source("draw_debug_draw_display_frag.glsl")
|
|
|
|
.additional_info("draw_view");
|
|
|
|
|
|
|
|
/** \} */
|