arb_framebuffer_object: add missing MSAA alpha-to-coverage and alpha-to-one tests
[piglit.git] / tests / wgl / wgl-sanity.c
blob133501dec6d54bb931c0e72f804cc474b9a9daba
1 /*
2 * Copyright © 2017 VMware, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
25 * Basic WGL sanity check: create a window, context, clear window to green.
27 * Authors:
28 * Brian Paul
31 #include <assert.h>
32 #include <stdio.h>
33 #include "piglit-util-gl.h"
34 #include "piglit-wgl-util.h"
36 HWND hWnd;
37 HGLRC ctx;
40 enum piglit_result
41 draw(void)
43 static const float green[4] = { 0, 1, 0, 1 };
44 bool pass = true;
46 glClearColor(0, 1, 0, 1);
47 glClear(GL_COLOR_BUFFER_BIT);
49 if (!piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
50 green)) {
51 pass = false;
54 SwapBuffers(GetDC(hWnd));
56 return pass ? PIGLIT_PASS : PIGLIT_FAIL;
60 int
61 main(int argc, char **argv)
63 int i;
65 for (i = 1; i < argc; i++) {
66 if (strcmp(argv[i], "-auto") == 0) {
67 piglit_automatic = 1;
68 break;
72 hWnd = piglit_get_wgl_window();
73 assert(hWnd);
75 ctx = piglit_get_wgl_context(hWnd);
76 assert(ctx);
78 if (!wglMakeCurrent(GetDC(hWnd), ctx)) {
79 fprintf(stderr, "wglMakeCurrent failed\n");
80 return 0;
83 piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
85 piglit_wgl_event_loop(draw);
87 return 0;