- }
-
- ctx = screen->context_create(screen, NULL);
- if (ctx == NULL)
- exit(3);
-
- templat.target = PIPE_TEXTURE_2D;
- templat.format = formats[i];
- templat.width0 = WIDTH;
- templat.height0 = HEIGHT;
- templat.depth0 = 1;
- templat.array_size = 1;
- templat.last_level = 0;
- templat.nr_samples = 1;
- templat.bind = (PIPE_BIND_RENDER_TARGET |
- PIPE_BIND_DISPLAY_TARGET);
-
- rttex = screen->resource_create(screen,
- &templat);
- if (rttex == NULL)
- exit(4);
-
- surf_tmpl.format = templat.format;
- surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
- surf_tmpl.u.tex.level = 0;
- surf_tmpl.u.tex.first_layer = 0;
- surf_tmpl.u.tex.last_layer = 0;
- surf = ctx->create_surface(ctx, rttex, &surf_tmpl);
- if (surf == NULL)
- exit(5);
-
- memset(&fb, 0, sizeof fb);
- fb.nr_cbufs = 1;
- fb.width = WIDTH;
- fb.height = HEIGHT;
- fb.cbufs[0] = surf;
-
- ctx->set_framebuffer_state(ctx, &fb);
-
- {
- struct pipe_blend_state blend;
- void *handle;
- memset(&blend, 0, sizeof blend);
- blend.rt[0].colormask = PIPE_MASK_RGBA;
- handle = ctx->create_blend_state(ctx, &blend);
- ctx->bind_blend_state(ctx, handle);
- }