5#include "testing/testing.h"
22static constexpr int Size = 2;
24template<VertAttrType attr_type,
typename ColorType>
29 Size,
Size,
false, TextureFormat::SFLOAT_32_32_32_32, usage,
false,
nullptr);
43 std::array<Vert, 3>
data = {
49 VertBuf *vbo = GPU_vertbuf_create_with_format(format);
69 if constexpr (std::is_same_v<ColorType, char4_norm> || std::is_same_v<ColorType, short2_norm> ||
70 std::is_same_v<ColorType, short4_norm> ||
71 std::is_same_v<ColorType, int1010102_norm>)
76 else if constexpr (std::is_same_v<ColorType, uchar4_norm> ||
77 std::is_same_v<ColorType, ushort2_norm> ||
78 std::is_same_v<ColorType, ushort4_norm> ||
79 std::is_same_v<ColorType, uint1010102_norm>)
83 else if constexpr (std::is_same_v<ColorType, float4>) {
87 static_assert(
false,
"Missing implementation");
98GPU_TEST(vertex_buffer_fetch_mode__GPU_COMP_I8__GPU_FETCH_INT_TO_FLOAT_UNIT);
104GPU_TEST(vertex_buffer_fetch_mode__GPU_COMP_U8__GPU_FETCH_INT_TO_FLOAT_UNIT);
109 int4(12034, -32767, 32767, 0));
111GPU_TEST(vertex_buffer_fetch_mode__GPU_COMP_I16__GPU_FETCH_INT_TO_FLOAT_UNIT);
116 uint4(12034, 0, 65535, 32767));
118GPU_TEST(vertex_buffer_fetch_mode__GPU_COMP_U16__GPU_FETCH_INT_TO_FLOAT_UNIT);
123 int4(321, -511, 511, 0));
125GPU_TEST(vertex_buffer_fetch_mode__GPU_COMP_I10__GPU_FETCH_INT_TO_FLOAT_UNIT);
131GPU_TEST(vertex_buffer_fetch_mode__GPU_COMP_F32__GPU_FETCH_FLOAT);
145 VertBuf *src_vbo = GPU_vertbuf_create_with_format(format);
160 VertBuf *dst_vbo = GPU_vertbuf_create_with_format(format);
163 Vert dest_data[4] = {
175 dst_vbo->
copy_sub(*src_vbo, 1, 0, 2);
181 EXPECT_EQ(read_data[i].pos, src_data[i + 1].pos);
185 EXPECT_EQ(read_data[i].pos, dest_data[i].pos);
constexpr IndexRange()=default
virtual void copy_sub(VertBuf &source_buf, uint source_first_vertex, uint dest_first_vertex, uint vertex_len)=0
Copy from part of source vertex buffer into the vertex buffer.
static void test_vertex_buffer_copy_sub()
static void test_vertex_buffer_fetch_mode__GPU_COMP_I8__GPU_FETCH_INT_TO_FLOAT_UNIT()
static constexpr int Size
static void vertex_buffer_fetch_mode(ColorType color)
static void test_vertex_buffer_fetch_mode__GPU_COMP_F32__GPU_FETCH_FLOAT()
static void test_vertex_buffer_fetch_mode__GPU_COMP_U16__GPU_FETCH_INT_TO_FLOAT_UNIT()
static void test_vertex_buffer_fetch_mode__GPU_COMP_I10__GPU_FETCH_INT_TO_FLOAT_UNIT()
static void test_vertex_buffer_fetch_mode__GPU_COMP_U8__GPU_FETCH_INT_TO_FLOAT_UNIT()
GPU_TEST(compute_indirect)
static void test_vertex_buffer_fetch_mode__GPU_COMP_I16__GPU_FETCH_INT_TO_FLOAT_UNIT()
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void GPU_offscreen_free(GPUOffScreen *offscreen)
gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, gpu::VertBuf *vertex_buf, gpu::IndexBuf *index_buf, GPUBatchFlag owns_flag)
VecBase< uint32_t, 4 > uint4
void GPU_vertbuf_read(const gpu::VertBuf *verts, void *data)
void GPU_batch_discard(gpu::Batch *batch)
void GPU_vertbuf_use(gpu::VertBuf *)
void GPU_offscreen_unbind(GPUOffScreen *offscreen, bool restore)
@ GPU_TEXTURE_USAGE_HOST_READ
@ GPU_TEXTURE_USAGE_ATTACHMENT
BMesh const char void * data
@ GPU_SHADER_3D_FLAT_COLOR
void GPU_batch_draw(gpu::Batch *batch)
void GPU_offscreen_bind(GPUOffScreen *offscreen, bool save)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
void GPU_vertbuf_vert_set(gpu::VertBuf *verts, uint v_idx, const void *data)
void GPU_batch_program_set_builtin(gpu::Batch *batch, GPUBuiltinShader shader_id)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
gpu::Texture * GPU_offscreen_color_texture(const GPUOffScreen *offscreen)
void GPU_texture_clear(gpu::Texture *texture, eGPUDataFormat data_format, const void *data)
void GPU_vertbuf_data_alloc(gpu::VertBuf &verts, uint v_len)
GPUOffScreen * GPU_offscreen_create(int width, int height, bool with_depth_buffer, gpu::TextureFormat format, eGPUTextureUsage usage, bool clear, char err_out[256])
void GPU_vertbuf_discard(gpu::VertBuf *)
void GPU_offscreen_read_color(GPUOffScreen *offscreen, eGPUDataFormat data_format, void *r_data)