Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[xsrc/trunk]: xsrc/external/mit/mesa-demos/dist/src merge mesa-demos 8.4.0.
details: https://anonhg.NetBSD.org/xsrc/rev/0602f138fb01
branches: trunk
changeset: 10224:0602f138fb01
user: mrg <mrg%NetBSD.org@localhost>
date: Mon Mar 11 07:00:43 2019 +0000
description:
merge mesa-demos 8.4.0.
diffstat:
external/mit/mesa-demos/dist/src/egl/eglut/eglut_screen.c | 180 ---
external/mit/mesa-demos/dist/src/egl/opengl/demo1.c | 147 ---
external/mit/mesa-demos/dist/src/egl/opengl/demo2.c | 216 ----
external/mit/mesa-demos/dist/src/egl/opengl/demo3.c | 647 --------------
external/mit/mesa-demos/dist/src/xdemos/corender.c | 400 --------
external/mit/mesa-demos/dist/src/xdemos/ipc.c | 264 -----
external/mit/mesa-demos/dist/src/xdemos/ipc.h | 16 -
7 files changed, 0 insertions(+), 1870 deletions(-)
diffs (truncated from 1898 to 300 lines):
diff -r c826101a25a0 -r 0602f138fb01 external/mit/mesa-demos/dist/src/egl/eglut/eglut_screen.c
--- a/external/mit/mesa-demos/dist/src/egl/eglut/eglut_screen.c Mon Mar 11 06:59:37 2019 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2010 LunarG Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Chia-I Wu <olv%lunarg.com@localhost>
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-
-#define EGL_EGLEXT_PROTOTYPES
-#include "EGL/egl.h"
-#include "EGL/eglext.h"
-
-#include "eglutint.h"
-
-#define MAX_MODES 100
-
-static EGLScreenMESA kms_screen;
-static EGLModeMESA kms_mode;
-static EGLint kms_width, kms_height;
-
-void
-_eglutNativeInitDisplay(void)
-{
- _eglut->native_dpy = EGL_DEFAULT_DISPLAY;
- _eglut->surface_type = EGL_SCREEN_BIT_MESA;
-}
-
-void
-_eglutNativeFiniDisplay(void)
-{
- kms_screen = 0;
- kms_mode = 0;
- kms_width = 0;
- kms_height = 0;
-}
-
-static void
-init_kms(void)
-{
- EGLModeMESA modes[MAX_MODES];
- EGLint num_screens, num_modes;
- EGLint width, height, best_mode;
- EGLint i;
-
- if (!eglGetScreensMESA(_eglut->dpy, &kms_screen, 1, &num_screens) ||
- !num_screens)
- _eglutFatal("eglGetScreensMESA failed\n");
-
- if (!eglGetModesMESA(_eglut->dpy, kms_screen,
- modes, MAX_MODES, &num_modes) || !num_modes)
- _eglutFatal("eglGetModesMESA failed!\n");
-
- printf("Found %d modes:\n", num_modes);
-
- best_mode = 0;
- width = 0;
- height = 0;
- for (i = 0; i < num_modes; i++) {
- EGLint w, h;
- eglGetModeAttribMESA(_eglut->dpy, modes[i], EGL_WIDTH, &w);
- eglGetModeAttribMESA(_eglut->dpy, modes[i], EGL_HEIGHT, &h);
- printf("%3d: %d x %d\n", i, w, h);
- if (w > width && h > height) {
- width = w;
- height = h;
- best_mode = i;
- }
- }
-
- printf("Will use screen size: %d x %d\n", width, height);
-
- kms_mode = modes[best_mode];
- kms_width = width;
- kms_height = height;
-}
-
-void
-_eglutNativeInitWindow(struct eglut_window *win, const char *title,
- int x, int y, int w, int h)
-{
- EGLint surf_attribs[16];
- EGLint i;
- const char *exts;
-
- exts = eglQueryString(_eglut->dpy, EGL_EXTENSIONS);
- if (!exts || !strstr(exts, "EGL_MESA_screen_surface"))
- _eglutFatal("EGL_MESA_screen_surface is not supported\n");
-
- init_kms();
-
- i = 0;
- surf_attribs[i++] = EGL_WIDTH;
- surf_attribs[i++] = kms_width;
- surf_attribs[i++] = EGL_HEIGHT;
- surf_attribs[i++] = kms_height;
- surf_attribs[i++] = EGL_NONE;
-
- /* create surface */
- win->native.u.surface = eglCreateScreenSurfaceMESA(_eglut->dpy,
- win->config, surf_attribs);
- if (win->native.u.surface == EGL_NO_SURFACE)
- _eglutFatal("eglCreateScreenSurfaceMESA failed\n");
-
- if (!eglShowScreenSurfaceMESA(_eglut->dpy, kms_screen,
- win->native.u.surface, kms_mode))
- _eglutFatal("eglShowScreenSurfaceMESA failed\n");
-
- win->native.width = kms_width;
- win->native.height = kms_height;
-}
-
-void
-_eglutNativeFiniWindow(struct eglut_window *win)
-{
- eglShowScreenSurfaceMESA(_eglut->dpy,
- kms_screen, EGL_NO_SURFACE, 0);
- eglDestroySurface(_eglut->dpy, win->native.u.surface);
-}
-
-void
-_eglutNativeEventLoop(void)
-{
- int start = _eglutNow();
- int frames = 0;
-
- _eglut->redisplay = 1;
-
- while (1) {
- struct eglut_window *win = _eglut->current;
- int now = _eglutNow();
-
- if (now - start > 5000) {
- double elapsed = (double) (now - start) / 1000.0;
-
- printf("%d frames in %3.1f seconds = %6.3f FPS\n",
- frames, elapsed, frames / elapsed);
- fflush(stdout);
-
- start = now;
- frames = 0;
-
- /* send escape */
- if (win->keyboard_cb)
- win->keyboard_cb(27);
- }
-
- if (_eglut->idle_cb)
- _eglut->idle_cb();
-
- if (_eglut->redisplay) {
- _eglut->redisplay = 0;
-
- if (win->display_cb)
- win->display_cb();
- eglSwapBuffers(_eglut->dpy, win->surface);
- frames++;
- }
- }
-}
diff -r c826101a25a0 -r 0602f138fb01 external/mit/mesa-demos/dist/src/egl/opengl/demo1.c
--- a/external/mit/mesa-demos/dist/src/egl/opengl/demo1.c Mon Mar 11 06:59:37 2019 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
- * Exercise EGL API functions
- */
-
-#define EGL_EGLEXT_PROTOTYPES
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/**
- * Test EGL_MESA_screen_surface functions
- */
-static void
-TestScreens(EGLDisplay dpy)
-{
-#define MAX 8
- EGLScreenMESA screens[MAX];
- EGLint numScreens;
- EGLint i;
-
- eglGetScreensMESA(dpy, screens, MAX, &numScreens);
- printf("Found %d screens\n", numScreens);
- for (i = 0; i < numScreens; i++) {
- printf(" Screen %d handle: %d\n", i, (int) screens[i]);
- }
-}
-
-/**
- * Print table of all available configurations.
- */
-static void
-PrintConfigs(EGLDisplay d, EGLConfig *configs, EGLint numConfigs)
-{
- EGLint i;
-
- printf("Configurations:\n");
- printf(" bf lv d st colorbuffer dp st supported \n");
- printf(" id sz l b ro r g b a th cl surfaces \n");
- printf("----------------------------------------------\n");
- for (i = 0; i < numConfigs; i++) {
- EGLint id, size, level;
- EGLint red, green, blue, alpha;
- EGLint depth, stencil;
- EGLint surfaces;
- EGLint doubleBuf = 1, stereo = 0;
- char surfString[100] = "";
-
- eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
- eglGetConfigAttrib(d, configs[i], EGL_BUFFER_SIZE, &size);
- eglGetConfigAttrib(d, configs[i], EGL_LEVEL, &level);
-
- eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red);
- eglGetConfigAttrib(d, configs[i], EGL_GREEN_SIZE, &green);
- eglGetConfigAttrib(d, configs[i], EGL_BLUE_SIZE, &blue);
- eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha);
- eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
- eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil);
- eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces);
-
- if (surfaces & EGL_WINDOW_BIT)
- strcat(surfString, "win,");
- if (surfaces & EGL_PBUFFER_BIT)
- strcat(surfString, "pb,");
- if (surfaces & EGL_PIXMAP_BIT)
- strcat(surfString, "pix,");
- if (strlen(surfString) > 0)
- surfString[strlen(surfString) - 1] = 0;
-
- printf("0x%02x %2d %2d %c %c %2d %2d %2d %2d %2d %2d %-12s\n",
- id, size, level,
- doubleBuf ? 'y' : '.',
- stereo ? 'y' : '.',
- red, green, blue, alpha,
- depth, stencil, surfString);
- }
-}
-
-
-
-int
-main(int argc, char *argv[])
-{
- int maj, min;
- EGLContext ctx;
- EGLSurface pbuffer;
- EGLConfig *configs;
- EGLint numConfigs;
- EGLBoolean b;
- const EGLint pbufAttribs[] = {
- EGL_WIDTH, 500,
- EGL_HEIGHT, 500,
- EGL_NONE
- };
-
- EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- assert(d);
-
- if (!eglInitialize(d, &maj, &min)) {
- printf("demo: eglInitialize failed\n");
- exit(1);
- }
-
- printf("EGL version = %d.%d\n", maj, min);
- printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
-
- eglGetConfigs(d, NULL, 0, &numConfigs);
- configs = malloc(sizeof(*configs) *numConfigs);
Home |
Main Index |
Thread Index |
Old Index