static bool util_probe_rect_rgba(struct pipe_context *ctx, struct pipe_resource *tex, unsigned offx, unsigned offy, unsigned w, unsigned h, const float *expected) { return util_probe_rect_rgba_multi(ctx, tex, offx, offy, w, h, expected, 1); }
static void null_sampler_view(struct pipe_context *ctx, unsigned tgsi_tex_target) { struct cso_context *cso; struct pipe_resource *cb; void *fs, *vs; bool pass = true; /* 2 expected colors: */ static const float expected_tex[] = {0, 0, 0, 1, 0, 0, 0, 0}; static const float expected_buf[] = {0, 0, 0, 0}; const float *expected = tgsi_tex_target == TGSI_TEXTURE_BUFFER ? expected_buf : expected_tex; unsigned num_expected = tgsi_tex_target == TGSI_TEXTURE_BUFFER ? 1 : 2; if (tgsi_tex_target == TGSI_TEXTURE_BUFFER && !ctx->screen->get_param(ctx->screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) { util_report_result_helper(SKIP, "%s: %s", __func__, tgsi_texture_names[tgsi_tex_target]); return; } cso = cso_create_context(ctx, 0); cb = util_create_texture2d(ctx->screen, 256, 256, PIPE_FORMAT_R8G8B8A8_UNORM, 0); util_set_common_states_and_clear(cso, ctx, cb); ctx->set_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 1, NULL); /* Fragment shader. */ fs = util_make_fragment_tex_shader(ctx, tgsi_tex_target, TGSI_INTERPOLATE_LINEAR, TGSI_RETURN_TYPE_FLOAT, TGSI_RETURN_TYPE_FLOAT, false, false); cso_set_fragment_shader_handle(cso, fs); /* Vertex shader. */ vs = util_set_passthrough_vertex_shader(cso, ctx, false); util_draw_fullscreen_quad(cso); /* Probe pixels. */ pass = pass && util_probe_rect_rgba_multi(ctx, cb, 0, 0, cb->width0, cb->height0, expected, num_expected); /* Cleanup. */ cso_destroy_context(cso); ctx->delete_vs_state(ctx, vs); ctx->delete_fs_state(ctx, fs); pipe_resource_reference(&cb, NULL); util_report_result_helper(pass, "%s: %s", __func__, tgsi_texture_names[tgsi_tex_target]); }