5#include "testing/testing.h"
35 const float4 clear_color(0.1f, 0.2f, 0.5f, 1.0f);
48GPU_TEST(framebuffer_clear_color_single_attachment);
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);
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);
140 const float clear_depth = 0.5f;
169 const float4 color1(0.0f);
170 const float4 color2(0.5f);
171 const float4 color3(1.0f);
206 const float4 clear_colors[6] = {
207 {0.5f, 0.0f, 0.0f, 1.0f},
208 {1.0f, 0.0f, 0.0f, 1.0f},
209 {0.0f, 0.5f, 0.0f, 1.0f},
210 {0.0f, 1.0f, 0.0f, 1.0f},
211 {0.0f, 0.0f, 0.5f, 1.0f},
212 {0.0f, 0.0f, 1.0f, 1.0f},
229 int index = pixel_index + (
SIZE *
SIZE) * side;
253 GTEST_SKIP() <<
"NVIDIA fails to compile workaround due to reserved names. Gladly it doesn't "
254 "need the workaround.";
260 const int layers = 256;
270 int viewport_rects[16][4];
271 for (
int i = 0;
i < 16;
i++) {
272 viewport_rects[
i][0] =
i % 4;
273 viewport_rects[
i][1] =
i / 4;
274 viewport_rects[
i][2] = 1;
275 viewport_rects[
i][3] = 1;
279 const float4 clear_color(0.0f);
283 create_info.
vertex_source(
"gpu_framebuffer_layer_viewport_test.glsl");
284 create_info.
fragment_source(
"gpu_framebuffer_layer_viewport_test.glsl");
285 create_info.
builtins(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER);
289 reinterpret_cast<GPUShaderCreateInfo *
>(&create_info));
300 int tri_count =
size.x *
size.y * layers;
310 int2 expected_color(layer, viewport);
311 int2 pixel_color = read_data[viewport + layer * 16];
350 const float4 clear_color(0.0f);
354 create_info_write.
define(
"WRITE");
355 create_info_write.
vertex_source(
"gpu_framebuffer_subpass_input_test.glsl");
356 create_info_write.
fragment_source(
"gpu_framebuffer_subpass_input_test.glsl");
357 create_info_write.
fragment_out(0, Type::int_t,
"out_value", DualBlend::NONE, 0);
360 reinterpret_cast<GPUShaderCreateInfo *
>(&create_info_write));
363 create_info_read.
define(
"READ");
364 create_info_read.
vertex_source(
"gpu_framebuffer_subpass_input_test.glsl");
365 create_info_read.
fragment_source(
"gpu_framebuffer_subpass_input_test.glsl");
366 create_info_read.
subpass_in(0, Type::int_t, ImageType::Int2D,
"in_value", 0);
367 create_info_read.
fragment_out(1, Type::int_t,
"out_value");
370 reinterpret_cast<GPUShaderCreateInfo *
>(&create_info_read));
@ G_DEBUG_GPU_FORCE_WORKAROUNDS
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
blender::gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, blender::gpu::VertBuf *vertex_buf, blender::gpu::IndexBuf *index_buf, eGPUBatchFlag owns_flag)
void GPU_batch_discard(blender::gpu::Batch *batch)
void GPU_batch_draw_advanced(blender::gpu::Batch *batch, int vertex_first, int vertex_count, int instance_first, int instance_count)
void GPU_batch_draw(blender::gpu::Batch *batch)
void GPU_batch_set_shader(blender::gpu::Batch *batch, GPUShader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_framebuffer_multi_viewports_set(GPUFrameBuffer *gpu_fb, const int viewport_rects[GPU_MAX_VIEWPORTS][4])
GPUFrameBuffer * GPU_framebuffer_create(const char *name)
#define GPU_FRAMEBUFFER_FREE_SAFE(fb)
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_TEXTURE_CUBEFACE(_texture, _face)
#define GPU_ATTACHMENT_NONE
void GPU_framebuffer_free(GPUFrameBuffer *fb)
void GPU_framebuffer_bind(GPUFrameBuffer *fb)
void GPU_framebuffer_multi_clear(GPUFrameBuffer *fb, const float(*clear_colors)[4])
void GPU_framebuffer_clear_color(GPUFrameBuffer *fb, const float clear_col[4])
#define GPU_framebuffer_ensure_config(_fb,...)
void GPU_framebuffer_clear_depth(GPUFrameBuffer *fb, float clear_depth)
#define GPU_framebuffer_subpass_transition(_fb,...)
GPUShader * GPU_shader_create_from_info(const GPUShaderCreateInfo *_info)
void GPU_shader_free(GPUShader *shader)
void GPU_scissor_test(bool enable)
void GPU_scissor(int x, int y, int width, int height)
GPUTexture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_free(GPUTexture *texture)
void * GPU_texture_read(GPUTexture *texture, eGPUDataFormat data_format, int mip_level)
@ GPU_TEXTURE_USAGE_HOST_READ
@ GPU_TEXTURE_USAGE_ATTACHMENT
GPUTexture * GPU_texture_create_2d_array(const char *name, int width, int height, int layer_len, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
GPUTexture * GPU_texture_create_cube(const char *name, int width, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
#define GPU_vertbuf_create_with_format(format)
void GPU_vertbuf_data_alloc(blender::gpu::VertBuf &verts, uint v_len)
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
struct @242053044010324116347033273112253060004051364061::@051143074301336237271216303350234260141112266062 batch
GPUFrameBuffer * 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="")