Files
test2/source/blender/gpu/shaders/common/gpu_shader_print_lib.glsl
Clément Foucault 091004f1b8 GPU: GLSL compilation as C++ for gpu static shaders
Allow compilation of shaders using C++ for linting and
IDE support.

Related #127983

Pull Request: https://projects.blender.org/blender/blender/pulls/128724
2024-11-12 18:53:34 +01:00

34 lines
701 B
GLSL

/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "infos/gpu_shader_print_info.hh"
SHADER_LIBRARY_CREATE_INFO(gpu_print)
uint print_data(uint offset, uint data)
{
if (offset < GPU_SHADER_PRINTF_MAX_CAPACITY) {
gpu_print_buf[offset] = data;
}
return offset + 1u;
}
uint print_data(uint offset, int data)
{
return print_data(offset, uint(data));
}
uint print_data(uint offset, float data)
{
return print_data(offset, floatBitsToUint(data));
}
uint print_header(const uint data_len, uint format_hash)
{
uint offset = atomicAdd(gpu_print_buf[0], 1u + data_len) + 1u;
return print_data(offset, format_hash);
}