This is the first step of moving the create infos back inside shader sources. All info files are now treated as source files. However, they are not considered in the include tree yet. This will come in another following PR. Each shader source file now generate a `.info` file containing only the create info declarations. This renames all info files so that they do not conflict with their previous versions that were copied (non-generated). Pull Request: https://projects.blender.org/blender/blender/pulls/146676
34 lines
702 B
GLSL
34 lines
702 B
GLSL
/* SPDX-FileCopyrightText: 2024 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
#include "infos/gpu_shader_print_infos.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);
|
|
}
|