5#include "testing/testing.h"
28 __func__,
UNPACK2(
size), 1, TextureFormat::SFLOAT_32_32_32_32, usage,
nullptr);
35 const float4 clear_color(0.1f, 0.2f, 0.5f, 1.0f);
48GPU_TEST(framebuffer_clear_color_single_attachment);
55 __func__,
UNPACK2(
size), 1, TextureFormat::SFLOAT_32_32_32_32, usage,
nullptr);
57 __func__,
UNPACK2(
size), 1, TextureFormat::UINT_32_32_32_32, usage,
nullptr);
65 const float4 clear_color(0.1f, 0.2f, 0.5f, 1.0f);
78 uint4 clear_color_uint(1036831949, 1045220557, 1056964608, 1065353216);
89GPU_TEST(framebuffer_clear_color_multiple_attachments);
96 __func__,
UNPACK2(
size), 1, TextureFormat::SFLOAT_32_32_32_32, usage,
nullptr);
98 __func__,
UNPACK2(
size), 1, TextureFormat::SFLOAT_32_32_32_32, usage,
nullptr);
106 const float4 clear_color[2] = {
float4(0.1f, 0.2f, 0.5f, 1.0f),
float4(0.5f, 0.2f, 0.1f, 1.0f)};
108 framebuffer,
static_cast<const float (*)[4]
>(
static_cast<const void *
>(clear_color)));
127GPU_TEST(framebuffer_clear_multiple_color_multiple_attachments);
134 __func__,
UNPACK2(
size), 1, TextureFormat::SFLOAT_32_DEPTH, usage,
nullptr);
140 const float clear_depth = 0.5f;
162 __func__,
UNPACK2(
size), 1, TextureFormat::SFLOAT_32_32_32_32, usage,
nullptr);
169 const float4 color1(0.0f);
170 const float4 color2(0.5f);
171 const float4 color3(1.0f);
205 "tex",
SIZE, 1, TextureFormat::SFLOAT_32_32_32_32, usage,
nullptr);
207 const float4 clear_colors[6] = {
208 {0.5f, 0.0f, 0.0f, 1.0f},
209 {1.0f, 0.0f, 0.0f, 1.0f},
210 {0.0f, 0.5f, 0.0f, 1.0f},
211 {0.0f, 1.0f, 0.0f, 1.0f},
212 {0.0f, 0.0f, 0.5f, 1.0f},
213 {0.0f, 0.0f, 1.0f, 1.0f},
230 int index = pixel_index + (
SIZE *
SIZE) * side;
254 GTEST_SKIP() <<
"NVIDIA fails to compile workaround due to reserved names. Gladly it doesn't "
255 "need the workaround.";
261 const int layers = 256;
264 __func__,
UNPACK2(
size), layers, 1, TextureFormat::SINT_32_32, usage,
nullptr);
271 int viewport_rects[16][4];
272 for (
int i = 0;
i < 16;
i++) {
273 viewport_rects[
i][0] =
i % 4;
274 viewport_rects[
i][1] =
i / 4;
275 viewport_rects[
i][2] = 1;
276 viewport_rects[
i][3] = 1;
280 const float4 clear_color(0.0f);
284 create_info.
vertex_source(
"gpu_framebuffer_layer_viewport_test.glsl");
285 create_info.
fragment_source(
"gpu_framebuffer_layer_viewport_test.glsl");
286 create_info.
builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER);
290 reinterpret_cast<GPUShaderCreateInfo *
>(&create_info));
292 int tri_count =
size.x *
size.y * layers;
307 int2 expected_color(layer, viewport);
308 int2 pixel_color = read_data[viewport + layer * 16];
337 __func__,
UNPACK2(
size), 1, TextureFormat::SINT_32, usage,
nullptr);
339 __func__,
UNPACK2(
size), 1, TextureFormat::SINT_32, usage,
nullptr);
347 const float4 clear_color(0.0f);
351 create_info_write.
define(
"WRITE");
352 create_info_write.
vertex_source(
"gpu_framebuffer_subpass_input_test.glsl");
353 create_info_write.
fragment_source(
"gpu_framebuffer_subpass_input_test.glsl");
354 create_info_write.
fragment_out(0, Type::int_t,
"out_value", DualBlend::NONE, 0);
357 reinterpret_cast<GPUShaderCreateInfo *
>(&create_info_write));
360 create_info_read.
define(
"READ");
361 create_info_read.
vertex_source(
"gpu_framebuffer_subpass_input_test.glsl");
362 create_info_read.
fragment_source(
"gpu_framebuffer_subpass_input_test.glsl");
363 create_info_read.
subpass_in(0, Type::int_t, ImageType::Int2D,
"in_value", 0);
364 create_info_read.
fragment_out(1, Type::int_t,
"out_value");
367 reinterpret_cast<GPUShaderCreateInfo *
>(&create_info_read));
@ G_DEBUG_GPU_FORCE_WORKAROUNDS
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
void GPU_batch_discard(blender::gpu::Batch *batch)
void GPU_batch_draw(blender::gpu::Batch *batch)
blender::gpu::Batch * GPU_batch_create_procedural(GPUPrimType primitive_type, int32_t vertex_count)
void GPU_batch_set_shader(blender::gpu::Batch *batch, blender::gpu::Shader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
blender::gpu::FrameBuffer * GPU_framebuffer_create(const char *name)
#define GPU_FRAMEBUFFER_FREE_SAFE(fb)
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_TEXTURE_CUBEFACE(_texture, _face)
void GPU_framebuffer_multi_clear(blender::gpu::FrameBuffer *fb, const float(*clear_colors)[4])
#define GPU_ATTACHMENT_NONE
void GPU_framebuffer_free(blender::gpu::FrameBuffer *fb)
void GPU_framebuffer_clear_depth(blender::gpu::FrameBuffer *fb, float clear_depth)
void GPU_framebuffer_clear_color(blender::gpu::FrameBuffer *fb, const float clear_col[4])
#define GPU_framebuffer_ensure_config(_fb,...)
void GPU_framebuffer_multi_viewports_set(blender::gpu::FrameBuffer *gpu_fb, const int viewport_rects[GPU_MAX_VIEWPORTS][4])
void GPU_framebuffer_bind(blender::gpu::FrameBuffer *fb)
#define GPU_framebuffer_subpass_transition(_fb,...)
void GPU_shader_free(blender::gpu::Shader *shader)
blender::gpu::Shader * GPU_shader_create_from_info(const GPUShaderCreateInfo *_info)
void GPU_scissor_test(bool enable)
void GPU_scissor(int x, int y, int width, int height)
blender::gpu::Texture * GPU_texture_create_2d_array(const char *name, int width, int height, int layer_len, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
blender::gpu::Texture * GPU_texture_create_cube(const char *name, int width, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
@ GPU_TEXTURE_USAGE_HOST_READ
@ GPU_TEXTURE_USAGE_ATTACHMENT
void * GPU_texture_read(blender::gpu::Texture *texture, eGPUDataFormat data_format, int mip_level)
blender::gpu::Texture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_free(blender::gpu::Texture *texture)
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
struct @021025263243242147216143265077100330027142264337::@225245033123204053237120173316075113304004012000 batch
gpu::FrameBuffer * framebuffers[FRAMEBUFFER_STACK_DEPTH]
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
#define GPU_TEST(test_name)
void MEM_freeN(void *vmemh)
static void test_framebuffer_clear_depth()
static void test_framebuffer_clear_color_single_attachment()
static void test_framebuffer_clear_multiple_color_multiple_attachments()
static void test_framebuffer_cube()
static void test_framebuffer_subpass_input()
static void test_framebuffer_scissor_test()
static void test_framebuffer_multi_viewport()
static void test_framebuffer_clear_color_multiple_attachments()
VecBase< uint32_t, 4 > uint4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
Describe inputs & outputs, stage interfaces, resources and sources of a shader. If all data is correc...
Self & fragment_source(StringRefNull filename)
Self & builtins(BuiltinBits builtin)
Self & fragment_out(int slot, Type type, StringRefNull name, DualBlend blend=DualBlend::NONE, int raster_order_group=-1)
Self & vertex_source(StringRefNull filename)
Self & subpass_in(int slot, Type type, ImageType img_type, StringRefNull name, int raster_order_group=-1)
Self & define(StringRefNull name, StringRefNull value="")