5#include "testing/testing.h"
18using namespace blender::gpu::shader;
29 GTEST_SKIP() <<
"NVIDIA fails to compile workaround due to reserved names. Gladly it doesn't "
30 "need the workaround.";
43 GTEST_SKIP() <<
"NVIDIA fails to compile workaround due to reserved names. Gladly it doesn't "
44 "need the workaround.";
48 GTEST_SKIP() <<
"Device does not support multi viewport, but the test requires it.";
54 create_info.
vertex_source(
"gpu_framebuffer_layer_viewport_test.glsl");
55 create_info.
fragment_source(
"gpu_framebuffer_layer_viewport_test.glsl");
72 reinterpret_cast<GPUShaderCreateInfo *
>(&create_info));
77 const int2 size(4, 4);
78 const int layers = 256;
81 __func__,
UNPACK2(size), layers, 1, TextureFormat::SINT_32_32, usage,
nullptr);
89 int viewport_rects[16][4];
90 for (
int i = 0; i < 16; i++) {
91 viewport_rects[i][0] = i % 4;
92 viewport_rects[i][1] = i / 4;
93 viewport_rects[i][2] = 1;
94 viewport_rects[i][3] = 1;
97 int tri_count = size.x * size.y * layers;
116GPU_TEST(shader_create_info_pipeline)
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_NONE
#define GPU_framebuffer_ensure_config(_fb,...)
#define GPU_SHADER_FREE_SAFE(shader)
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
#define EXPECT_TRUE(result)
#define GPU_TEST(test_name)
static void test_static_shaders()
static void test_shader_create_info_pipeline()
void GPU_framebuffer_bind(gpu::FrameBuffer *fb)
gpu::Batch * GPU_batch_create_procedural(GPUPrimType primitive_type, int32_t vertex_count)
bool GPU_type_matches_ex(GPUDeviceType device, GPUOSType os, GPUDriverType driver, GPUBackendType backend)
bool gpu_shader_create_info_compile_all(const char *name_starts_with_filter)
void GPU_framebuffer_free(gpu::FrameBuffer *fb)
gpu::Shader * GPU_shader_create_from_info(const GPUShaderCreateInfo *_info)
gpu::Texture * GPU_texture_create_2d_array(const char *name, int width, int height, int layer_len, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_batch_discard(gpu::Batch *batch)
void GPU_batch_set_shader(gpu::Batch *batch, gpu::Shader *shader, const gpu::shader::SpecializationConstants *constants_state=nullptr)
@ G_DEBUG_GPU_FORCE_WORKAROUNDS
@ GPU_TEXTURE_USAGE_HOST_READ
@ GPU_TEXTURE_USAGE_ATTACHMENT
void GPU_framebuffer_multi_viewports_set(gpu::FrameBuffer *gpu_fb, const int viewport_rects[GPU_MAX_VIEWPORTS][4])
void GPU_batch_draw(gpu::Batch *batch)
gpu::FrameBuffer * GPU_framebuffer_create(const char *name)
void GPU_texture_free(gpu::Texture *texture)
bool GPU_multi_viewport_support()
GPUContext * GPU_context_active_get()
Activate pipeline creation debugging for a certain scope.
Self & viewports(uint32_t viewport_count)
Self & color_format(TextureTargetFormat color_format)
Self & primitive(GPUPrimType primitive_type)
Self & state(GPUWriteMask write_mask, GPUBlend blend, GPUFaceCullTest culling_test, GPUDepthTest depth_test, GPUStencilTest stencil_test, GPUStencilOp stencil_op, GPUProvokingVertex provoking_vert)
Describe inputs & outputs, stage interfaces, resources and sources of a shader. If all data is correc...
Self & fragment_source(StringRefNull filename)
Self & fragment_out(int slot, Type type, StringRefNull name, DualBlend blend=DualBlend::NONE, int raster_order_group=-1, ConditionFn cond=nullptr)
Self & builtins(BuiltinBits builtin, ConditionFn cond=nullptr)
Self & vertex_source(StringRefNull filename)
PipelineState & pipeline_state()
Create a new pipeline state.