static INLINE struct pipe_sampler_view *create_texture_1d_view(struct vg_context *ctx, const VGuint *color_data, const VGint color_data_len) { struct pipe_context *pipe = ctx->pipe; struct pipe_resource *texture; struct pipe_sampler_view view_templ; struct pipe_sampler_view *view; texture = create_texture_1d(ctx, color_data, color_data_len); if (!texture) return NULL; u_sampler_view_default_template(&view_templ, texture, texture->format); view = pipe->create_sampler_view(pipe, texture, &view_templ); /* want the texture to go away if the view is freed */ pipe_resource_reference(&texture, NULL); return view; }
enum piglit_result piglit_display(void) { GLboolean pass = GL_TRUE; GLuint tex1d; int level; glClearColor(0.1, 0.1, 0.1, 0.1); glClear(GL_COLOR_BUFFER_BIT); tex1d = create_texture_1d(); for (level = 0; level < TEX_LEVELS; level++) { draw_level(5, 5 + level * 10, level); pass = pass && test_level(level); } glDeleteTextures(1, &tex1d); piglit_present_results(); return pass ? PIGLIT_PASS : PIGLIT_FAIL; }