Merge commit 'origin/master' into gallium-sw-api-2

Conflicts:
	src/gallium/drivers/llvmpipe/lp_setup.c
	src/gallium/drivers/softpipe/sp_texture.c
	src/gallium/drivers/softpipe/sp_winsys.h
	src/gallium/state_trackers/egl/common/egl_g3d.c
	src/gallium/state_trackers/egl/x11/native_x11.c
	src/gallium/state_trackers/egl/x11/native_x11.h
	src/gallium/state_trackers/egl/x11/native_ximage.c
This commit is contained in:
Keith Whitwell 2010-03-09 11:02:37 +00:00
commit 0c96690a5b
287 changed files with 11944 additions and 17015 deletions

View file

@ -180,7 +180,7 @@ ultrix-gcc:
# Rules for making release tarballs
VERSION=7.8-devel
VERSION=7.9-devel
DIRECTORY = Mesa-$(VERSION)
LIB_NAME = MesaLib-$(VERSION)
DEMO_NAME = MesaDemos-$(VERSION)
@ -215,7 +215,6 @@ MAIN_FILES = \
$(DIRECTORY)/include/GL/glx_mangle.h \
$(DIRECTORY)/include/GL/glfbdev.h \
$(DIRECTORY)/include/GL/mesa_wgl.h \
$(DIRECTORY)/include/GL/mglmesa.h \
$(DIRECTORY)/include/GL/osmesa.h \
$(DIRECTORY)/include/GL/vms_x_fix.h \
$(DIRECTORY)/include/GL/wglext.h \

View file

@ -84,7 +84,6 @@ PROGRAM_DIRS = @PROGRAM_DIRS@
# Driver specific build vars
DRI_DIRS = @DRI_DIRS@
WINDOW_SYSTEM = @WINDOW_SYSTEM@
EGL_DISPLAYS = @EGL_DISPLAYS@
# Dependencies

View file

@ -9,7 +9,7 @@ CONFIG_NAME = default
# Version info
MESA_MAJOR=7
MESA_MINOR=8
MESA_MINOR=9
MESA_TINY=0
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)

View file

@ -44,7 +44,6 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt -lX11
SRC_DIRS = glx gallium mesa glu glut/glx glew glw
DRIVER_DIRS = dri
PROGRAM_DIRS =
WINDOW_SYSTEM=dri
DRM_SOURCE_PATH=$(TOP)/../drm

View file

@ -58,7 +58,6 @@ PROGRAM_DIRS := egl $(PROGRAM_DIRS)
EGL_DRIVERS_DIRS = glx
DRIVER_DIRS = dri
WINDOW_SYSTEM = dri
GALLIUM_WINSYS_DIRS = drm
GALLIUM_TARGET_DIRS =
GALLIUM_WINSYS_DRM_DIRS = vmware intel i965

View file

@ -51,7 +51,5 @@ SRC_DIRS = glx gallium mesa glu glut/glx glew glw
PROGRAM_DIRS = xdemos
DRIVER_DIRS = dri
WINDOW_SYSTEM=dri
DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon \
savage sis tdfx unichrome

View file

@ -51,7 +51,6 @@ SRC_DIRS = gallium mesa gallium/winsys gallium/targets glu egl
PROGRAM_DIRS = egl
DRIVER_DIRS = dri
WINDOW_SYSTEM = dri
GALLIUM_WINSYS_DIRS = egl_drm
GALLIUM_TARGET_DIRS =

View file

@ -50,4 +50,3 @@ GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl
SRC_DIRS = glx glu glut/glx glew glw
DRIVER_DIRS =
PROGRAM_DIRS =
WINDOW_SYSTEM=dri

View file

@ -457,7 +457,6 @@ CORE_DIRS="glsl mesa"
SRC_DIRS="glew"
GLU_DIRS="sgi"
WINDOW_SYSTEM=""
GALLIUM_DIRS="auxiliary drivers state_trackers"
GALLIUM_WINSYS_DIRS=""
GALLIUM_WINSYS_DRM_DIRS=""
@ -472,7 +471,6 @@ xlib)
dri)
SRC_DIRS="$SRC_DIRS glx"
DRIVER_DIRS="dri"
WINDOW_SYSTEM="dri"
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
;;
osmesa)
@ -482,7 +480,6 @@ esac
AC_SUBST([SRC_DIRS])
AC_SUBST([GLU_DIRS])
AC_SUBST([DRIVER_DIRS])
AC_SUBST([WINDOW_SYSTEM])
AC_SUBST([GALLIUM_DIRS])
AC_SUBST([GALLIUM_WINSYS_DIRS])
AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])

View file

@ -38,6 +38,7 @@ tbd
<li>GL_EXT_draw_buffers2 extension (swrast and i965 driver only)
<li>GL_ARB_fragment_coord_conventions extension (for swrast, i965, and Gallium drivers)
<li>GL_EXT_texture_array extension (swrast driver only)
<li>GL_APPLE_object_purgeable extension (swrast and i945/i965 DRI drivers)
<li>Much improved support for <a href="egl.html">EGL in Mesa</a>
<li>New state trackers for <a href="opengles.html">OpenGL ES 1.1 and 2.0</a>
<li>Dedicated documentation for Gallium

50
docs/relnotes-7.9.html Normal file
View file

@ -0,0 +1,50 @@
<HTML>
<TITLE>Mesa Release Notes</TITLE>
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.9 Release Notes / date TBD</H1>
<p>
Mesa 7.9 is a new development release.
People who are concerned with stability and reliability should stick
with a previous release or wait for Mesa 7.9.1.
</p>
<p>
Mesa 7.9 implements the OpenGL 2.1 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
tbd
</pre>
<h2>New features</h2>
<ul>
</ul>
<h2>Bug fixes</h2>
<ul>
</ul>
<h2>Changes</h2>
<ul>
</ul>
</body>
</html>

View file

@ -13,7 +13,6 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
<<<<<<< HEAD:docs/relnotes.html
<LI><A HREF="relnotes-7.8.html">7.8 release notes</A>
<LI><A HREF="relnotes-7.7.1.html">7.7.1 release notes</A>
<LI><A HREF="relnotes-7.7.html">7.7 release notes</A>

View file

@ -1,340 +0,0 @@
/*
* Mesa 3-D graphics library
* Version: 3.1
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* This header file is based on the REAL glut.h by Mark J. Kilgard.
*
* The DJGPP/ALLEGRO (DJA) GLUT implementation was written by
* Bernhard Tschirren (bernie-t@geocities.com) for the sole purpose
* of compiling all the sample programs (which use GLUT). Therefore,
* is NOT AT ALL a complete version of GLUT!
*/
#ifndef __AGLUT_H__
#define __AGLUT_H__
#include <GL/gl.h>
#include <GL/glu.h>
#define GLUTCALLBACK
#define APIENTRY
#define GLUTAPI extern
#define GLUT_RGB 0
#define GLUT_RGBA GLUT_RGB
#define GLUT_INDEX 1
#define GLUT_SINGLE 0
#define GLUT_DOUBLE 2
#define GLUT_ACCUM 4
#define GLUT_ALPHA 8
#define GLUT_DEPTH 16
#define GLUT_STENCIL 32
/* Mouse buttons. */
#define GLUT_LEFT_BUTTON 0
#define GLUT_MIDDLE_BUTTON 1
#define GLUT_RIGHT_BUTTON 2
/* Mouse button state. */
#define GLUT_DOWN 0
#define GLUT_UP 1
/* function keys */
#define GLUT_KEY_F1 1
#define GLUT_KEY_F2 2
#define GLUT_KEY_F3 3
#define GLUT_KEY_F4 4
#define GLUT_KEY_F5 5
#define GLUT_KEY_F6 6
#define GLUT_KEY_F7 7
#define GLUT_KEY_F8 8
#define GLUT_KEY_F9 9
#define GLUT_KEY_F10 10
#define GLUT_KEY_F11 11
#define GLUT_KEY_F12 12
/* directional keys */
#define GLUT_KEY_LEFT 100
#define GLUT_KEY_UP 101
#define GLUT_KEY_RIGHT 102
#define GLUT_KEY_DOWN 103
#define GLUT_KEY_PAGE_UP 104
#define GLUT_KEY_PAGE_DOWN 105
#define GLUT_KEY_HOME 106
#define GLUT_KEY_END 107
#define GLUT_KEY_INSERT 108
/* Entry/exit state. */
#define GLUT_LEFT 0
#define GLUT_ENTERED 1
/* Visibility state. */
#define GLUT_NOT_VISIBLE 0
#define GLUT_VISIBLE 1
/* Color index component selection values. */
#define GLUT_RED 0
#define GLUT_GREEN 1
#define GLUT_BLUE 2
/* Layers for use. */
#define GLUT_NORMAL 0
#define GLUT_OVERLAY 1
/* Stroke font constants (use these in GLUT program). */
#define GLUT_STROKE_ROMAN ((void*)0)
#define GLUT_STROKE_MONO_ROMAN ((void*)1)
/* Bitmap font constants (use these in GLUT program). */
#define GLUT_BITMAP_9_BY_15 ((void*)2)
#define GLUT_BITMAP_8_BY_13 ((void*)3)
#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
#define GLUT_BITMAP_HELVETICA_10 ((void*)6)
#define GLUT_BITMAP_HELVETICA_12 ((void*)7)
#define GLUT_BITMAP_HELVETICA_18 ((void*)8)
/* glutGet parameters. */
#define GLUT_WINDOW_X 100
#define GLUT_WINDOW_Y 101
#define GLUT_WINDOW_WIDTH 102
#define GLUT_WINDOW_HEIGHT 103
#define GLUT_WINDOW_BUFFER_SIZE 104
#define GLUT_WINDOW_STENCIL_SIZE 105
#define GLUT_WINDOW_DEPTH_SIZE 106
#define GLUT_WINDOW_RED_SIZE 107
#define GLUT_WINDOW_GREEN_SIZE 108
#define GLUT_WINDOW_BLUE_SIZE 109
#define GLUT_WINDOW_ALPHA_SIZE 110
#define GLUT_WINDOW_ACCUM_RED_SIZE 111
#define GLUT_WINDOW_ACCUM_GREEN_SIZE 112
#define GLUT_WINDOW_ACCUM_BLUE_SIZE 113
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114
#define GLUT_WINDOW_DOUBLEBUFFER 115
#define GLUT_WINDOW_RGBA 116
#define GLUT_WINDOW_PARENT 117
#define GLUT_WINDOW_NUM_CHILDREN 118
#define GLUT_WINDOW_COLORMAP_SIZE 119
#define GLUT_WINDOW_NUM_SAMPLES 120
#define GLUT_WINDOW_STEREO 121
#define GLUT_WINDOW_CURSOR 122
#define GLUT_SCREEN_WIDTH 200
#define GLUT_SCREEN_HEIGHT 201
#define GLUT_SCREEN_WIDTH_MM 202
#define GLUT_SCREEN_HEIGHT_MM 203
#define GLUT_MENU_NUM_ITEMS 300
#define GLUT_DISPLAY_MODE_POSSIBLE 400
#define GLUT_INIT_WINDOW_X 500
#define GLUT_INIT_WINDOW_Y 501
#define GLUT_INIT_WINDOW_WIDTH 502
#define GLUT_INIT_WINDOW_HEIGHT 503
#define GLUT_INIT_DISPLAY_MODE 504
#define GLUT_ELAPSED_TIME 700
#define GLUT_WINDOW_FORMAT_ID 123
/* glutDeviceGet parameters. */
#define GLUT_HAS_KEYBOARD 600
#define GLUT_HAS_MOUSE 601
#define GLUT_HAS_SPACEBALL 602
#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
#define GLUT_HAS_TABLET 604
#define GLUT_NUM_MOUSE_BUTTONS 605
#define GLUT_NUM_SPACEBALL_BUTTONS 606
#define GLUT_NUM_BUTTON_BOX_BUTTONS 607
#define GLUT_NUM_DIALS 608
#define GLUT_NUM_TABLET_BUTTONS 609
#define GLUT_DEVICE_IGNORE_KEY_REPEAT 610
#define GLUT_DEVICE_KEY_REPEAT 611
#define GLUT_HAS_JOYSTICK 612
#define GLUT_OWNS_JOYSTICK 613
#define GLUT_JOYSTICK_BUTTONS 614
#define GLUT_JOYSTICK_AXES 615
#define GLUT_JOYSTICK_POLL_RATE 616
/* glutLayerGet parameters. */
#define GLUT_OVERLAY_POSSIBLE 800
#define GLUT_LAYER_IN_USE 801
#define GLUT_HAS_OVERLAY 802
#define GLUT_TRANSPARENT_INDEX 803
#define GLUT_NORMAL_DAMAGED 804
#define GLUT_OVERLAY_DAMAGED 805
/* glutVideoResizeGet parameters. */
#define GLUT_VIDEO_RESIZE_POSSIBLE 900
#define GLUT_VIDEO_RESIZE_IN_USE 901
#define GLUT_VIDEO_RESIZE_X_DELTA 902
#define GLUT_VIDEO_RESIZE_Y_DELTA 903
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
#define GLUT_VIDEO_RESIZE_X 906
#define GLUT_VIDEO_RESIZE_Y 907
#define GLUT_VIDEO_RESIZE_WIDTH 908
#define GLUT_VIDEO_RESIZE_HEIGHT 909
/* glutUseLayer parameters. */
#define GLUT_NORMAL 0
#define GLUT_OVERLAY 1
/* glutGetModifiers return mask. */
#define GLUT_ACTIVE_SHIFT 1
#define GLUT_ACTIVE_CTRL 2
#define GLUT_ACTIVE_ALT 4
/* glutSetCursor parameters. */
/* Basic arrows. */
#define GLUT_CURSOR_RIGHT_ARROW 0
#define GLUT_CURSOR_LEFT_ARROW 1
/* Symbolic cursor shapes. */
#define GLUT_CURSOR_INFO 2
#define GLUT_CURSOR_DESTROY 3
#define GLUT_CURSOR_HELP 4
#define GLUT_CURSOR_CYCLE 5
#define GLUT_CURSOR_SPRAY 6
#define GLUT_CURSOR_WAIT 7
#define GLUT_CURSOR_TEXT 8
#define GLUT_CURSOR_CROSSHAIR 9
/* Directional cursors. */
#define GLUT_CURSOR_UP_DOWN 10
#define GLUT_CURSOR_LEFT_RIGHT 11
/* Sizing cursors. */
#define GLUT_CURSOR_TOP_SIDE 12
#define GLUT_CURSOR_BOTTOM_SIDE 13
#define GLUT_CURSOR_LEFT_SIDE 14
#define GLUT_CURSOR_RIGHT_SIDE 15
#define GLUT_CURSOR_TOP_LEFT_CORNER 16
#define GLUT_CURSOR_TOP_RIGHT_CORNER 17
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
/* Inherit from parent window. */
#define GLUT_CURSOR_INHERIT 100
/* Blank cursor. */
#define GLUT_CURSOR_NONE 101
/* Fullscreen crosshair (if available). */
#define GLUT_CURSOR_FULL_CROSSHAIR 102
/* GLUT initialization sub-API. */
GLUTAPI void APIENTRY glutInit(int *argcp, char **argv);
GLUTAPI void APIENTRY glutInitDisplayMode(unsigned int mode);
GLUTAPI void APIENTRY glutInitWindowPosition(int x, int y);
GLUTAPI void APIENTRY glutInitWindowSize(int width, int height);
GLUTAPI void APIENTRY glutMainLoop(void);
/* GLUT window sub-API. */
GLUTAPI int APIENTRY glutCreateWindow(const char *title);
GLUTAPI int APIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
GLUTAPI void APIENTRY glutDestroyWindow(int win);
GLUTAPI void APIENTRY glutPostRedisplay(void);
GLUTAPI void APIENTRY glutSwapBuffers(void);
GLUTAPI int APIENTRY glutGetWindow(void);
GLUTAPI void APIENTRY glutSetWindow(int win);
GLUTAPI void APIENTRY glutSetWindowTitle(const char *title);
GLUTAPI void APIENTRY glutSetIconTitle(const char *title);
GLUTAPI void APIENTRY glutPositionWindow(int x, int y);
GLUTAPI void APIENTRY glutReshapeWindow(int width, int height);
GLUTAPI void APIENTRY glutPopWindow(void);
GLUTAPI void APIENTRY glutPushWindow(void);
GLUTAPI void APIENTRY glutIconifyWindow(void);
GLUTAPI void APIENTRY glutShowWindow(void);
GLUTAPI void APIENTRY glutHideWindow(void);
/* GLUT overlay sub-API. */
GLUTAPI void APIENTRY glutEstablishOverlay(void);
GLUTAPI void APIENTRY glutRemoveOverlay(void);
GLUTAPI void APIENTRY glutUseLayer(GLenum layer);
GLUTAPI void APIENTRY glutPostOverlayRedisplay(void);
GLUTAPI void APIENTRY glutShowOverlay(void);
GLUTAPI void APIENTRY glutHideOverlay(void);
/* GLUT menu sub-API. */
GLUTAPI int APIENTRY glutCreateMenu(void (GLUTCALLBACK *)(int));
GLUTAPI void APIENTRY glutDestroyMenu(int menu);
GLUTAPI int APIENTRY glutGetMenu(void);
GLUTAPI void APIENTRY glutSetMenu(int menu);
GLUTAPI void APIENTRY glutAddMenuEntry(const char *label, int value);
GLUTAPI void APIENTRY glutAddSubMenu(const char *label, int submenu);
GLUTAPI void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
GLUTAPI void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
GLUTAPI void APIENTRY glutRemoveMenuItem(int item);
GLUTAPI void APIENTRY glutAttachMenu(int button);
GLUTAPI void APIENTRY glutDetachMenu(int button);
/* GLUT window callback sub-API. */
GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK * func)(void));
GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK * func)(int width, int height));
GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK * func)(int state));
GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK * func)(int state));
GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK * func)(void));
GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK * func)(int value), int value);
GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK * func)(int state));
GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK * func)(int button, int state));
GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK * func)(int button, int state));
GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK * func)(int dial, int value));
GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK * func)(int status, int x, int y));
GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK * func)(void));
GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK * func)(int state));
/* GLUT color index sub-API. */
GLUTAPI void APIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
GLUTAPI GLfloat APIENTRY glutGetColor(int ndx, int component);
GLUTAPI void APIENTRY glutCopyColormap(int win);
/* GLUT state retrieval sub-API. */
GLUTAPI int APIENTRY glutGet(GLenum type);
GLUTAPI int APIENTRY glutDeviceGet(GLenum type);
/* GLUT font sub-API */
GLUTAPI void APIENTRY glutBitmapCharacter(void *font, int character);
GLUTAPI int APIENTRY glutBitmapWidth(void *font, int character);
GLUTAPI void APIENTRY glutStrokeCharacter(void *font, int character);
GLUTAPI int APIENTRY glutStrokeWidth(void *font, int character);
/* GLUT pre-built models sub-API */
GLUTAPI void APIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
GLUTAPI void APIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
GLUTAPI void APIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
GLUTAPI void APIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
GLUTAPI void APIENTRY glutWireCube(GLdouble size);
GLUTAPI void APIENTRY glutSolidCube(GLdouble size);
GLUTAPI void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
GLUTAPI void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
GLUTAPI void APIENTRY glutWireDodecahedron(void);
GLUTAPI void APIENTRY glutSolidDodecahedron(void);
GLUTAPI void APIENTRY glutWireTeapot(GLdouble size);
GLUTAPI void APIENTRY glutSolidTeapot(GLdouble size);
GLUTAPI void APIENTRY glutWireOctahedron(void);
GLUTAPI void APIENTRY glutSolidOctahedron(void);
GLUTAPI void APIENTRY glutWireTetrahedron(void);
GLUTAPI void APIENTRY glutSolidTetrahedron(void);
GLUTAPI void APIENTRY glutWireIcosahedron(void);
GLUTAPI void APIENTRY glutSolidIcosahedron(void);
#endif /* __AGLUT_H__ */

View file

@ -1,79 +0,0 @@
/****************************************************************************
*
* Mesa bindings for SciTech MGL
*
* Copyright (C) 1996 SciTech Software.
* All rights reserved.
*
* Filename: mglmesa.h
* Version: Revision: 1.1.1.1
*
* Language: ANSI C
* Environment: Any
*
* Description: Header file for the Mesa/OpenGL interface bindings for the
* SciTech MGL graphics library. Uses the MGL internal
* device context structures to get direct access to the
* high performance MGL rasterization functions for maximum
* performance. Utilizes the VESA VBE/AF Accelerator Functions
* via the MGL's accelerated device driver functions, as well
* as basic DirectDraw accelerated functions provided by the
* MGL.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
****************************************************************************/
#ifndef __MGLMESA_H
#define __MGLMESA_H
#include "mgraph.h"
/*------------------------- Function Prototypes ---------------------------*/
#ifdef __cplusplus
extern "C" { /* Use "C" linkage when in C++ mode */
#endif
#ifndef __WINDOWS__
#define GLAPIENTRY
#endif
#ifdef __WINDOWS__
bool GLAPIENTRY MGLMesaInitDLL(MGLCallbacks *cb,char *version);
#endif
void GLAPIENTRY MGLMesaChooseVisual(MGLDC *dc,MGLVisual *visual);
bool GLAPIENTRY MGLMesaSetVisual(MGLDC *dc,MGLVisual *visual);
bool GLAPIENTRY MGLMesaCreateContext(MGLDC *dc,bool forceMemDC);
void GLAPIENTRY MGLMesaDestroyContext(MGLDC *dc);
void GLAPIENTRY MGLMesaMakeCurrent(MGLDC *dc);
void GLAPIENTRY MGLMesaSwapBuffers(MGLDC *dc,bool waitVRT);
/* Palette manipulation support. The reason we provide palette manipulation
* routines is so that when rendering in double buffered modes with a
* software backbuffer, the palette for the backbuffer is kept consistent
* with the hardware front buffer.
*/
void GLAPIENTRY MGLMesaSetPaletteEntry(MGLDC *dc,int entry,uchar red,uchar green,uchar blue);
void GLAPIENTRY MGLMesaSetPalette(MGLDC *dc,palette_t *pal,int numColors,int startIndex);
void GLAPIENTRY MGLMesaRealizePalette(MGLDC *dc,int numColors,int startIndex,int waitVRT);
#ifdef __cplusplus
} /* End of "C" linkage for C++ */
#endif /* __cplusplus */
#endif /* __MGLMESA_H */

View file

@ -1,6 +1,7 @@
arbfplight
arbfslight
arbocclude
arbocclude2
bounce
clearspd
copypix

View file

@ -15,6 +15,7 @@ PROGS = \
arbfplight \
arbfslight \
arbocclude \
arbocclude2 \
bounce \
clearspd \
copypix \

View file

@ -4,6 +4,7 @@ progs = [
'arbfplight',
'arbfslight',
'arbocclude',
'arbocclude2',
'bounce',
'clearspd',
'copypix',

314
progs/demos/arbocclude2.c Normal file
View file

@ -0,0 +1,314 @@
/*
* GL_ARB_occlusion_query demo
*
* Brian Paul
* 12 June 2003
*
* Copyright (C) 2003 Brian Paul All Rights Reserved.
*
* 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
* BRIAN PAUL 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.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/glut.h>
static GLboolean Anim = GL_TRUE;
static GLfloat Xpos = 0;
static GLuint OccQuery1;
static GLuint OccQuery2;
static GLint Win = 0;
static void
PrintString(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void Idle(void)
{
static int lastTime = 0;
static int sign = +1;
int time = glutGet(GLUT_ELAPSED_TIME);
float step;
if (lastTime == 0)
lastTime = time;
else if (time - lastTime < 20) /* 50Hz update */
return;
step = (time - lastTime) / 1000.0 * sign;
lastTime = time;
Xpos += step;
if (Xpos > 2.5) {
Xpos = 2.5;
sign = -1;
}
else if (Xpos < -2.5) {
Xpos = -2.5;
sign = +1;
}
glutPostRedisplay();
}
static void Display( void )
{
GLuint passed1, passed2;
GLint ready;
char s[100];
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -15.0 );
/* draw the occluding polygons */
glColor3f(0, 0.6, 0.8);
glBegin(GL_QUADS);
glVertex2f(-1.6, -1.5);
glVertex2f(-0.4, -1.5);
glVertex2f(-0.4, 1.5);
glVertex2f(-1.6, 1.5);
glVertex2f( 0.4, -1.5);
glVertex2f( 1.6, -1.5);
glVertex2f( 1.6, 1.5);
glVertex2f( 0.4, 1.5);
glEnd();
#if defined(GL_ARB_occlusion_query)
glColorMask(0, 0, 0, 0);
glDepthMask(GL_FALSE);
/* draw the first polygon with occlusion testing */
glPushMatrix();
glTranslatef(Xpos, 0.4, -0.5);
glScalef(0.3, 0.3, 1.0);
glRotatef(-90.0 * Xpos, 0, 0, 1);
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery1);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
glEnd();
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
/* draw the second polygon with occlusion testing */
glPopMatrix();
glPushMatrix();
glTranslatef(Xpos, -0.4, -0.5);
glScalef(0.3, 0.3, 1.0);
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery2);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
glEnd();
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
/* turn off occlusion testing */
glColorMask(1, 1, 1, 1);
glDepthMask(GL_TRUE);
do {
/* do useful work here, if any */
glGetQueryObjectivARB(OccQuery1, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
} while (!ready);
glGetQueryObjectuivARB(OccQuery1, GL_QUERY_RESULT_ARB, &passed1);
do {
/* do useful work here, if any */
glGetQueryObjectivARB(OccQuery2, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
} while (!ready);
glGetQueryObjectuivARB(OccQuery2, GL_QUERY_RESULT_ARB, &passed2);
#endif /* GL_ARB_occlusion_query */
/* draw the second rect, so we can see what's going on */
glColor3f(0.8, 0.5, 0);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslatef(Xpos, 0.4, -0.5);
glScalef(0.3, 0.3, 1.0);
glRotatef(-90.0 * Xpos, 0, 0, 1);
/* draw the first rect, so we can see what's going on */
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
glEnd();
glPopMatrix();
/* Print result message */
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glColor3f(1, 1, 1);
#if defined(GL_ARB_occlusion_query)
sprintf(s, " %4d Fragments Visible", passed1);
glRasterPos3f(-0.50, -0.6, 0);
PrintString(s);
if (!passed1) {
glRasterPos3f(-0.25, -0.7, 0);
PrintString("Fully Occluded");
}
sprintf(s, " %4d Fragments Visible", passed2);
glRasterPos3f(-0.50, -0.8, 0);
PrintString(s);
if (!passed2) {
glRasterPos3f(-0.25, -0.9, 0);
PrintString("Fully Occluded");
}
#else
glRasterPos3f(-0.25, -0.8, 0);
PrintString("GL_ARB_occlusion_query not available at compile time");
#endif /* GL_ARB_occlusion_query */
glutSwapBuffers();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
glutDestroyWindow(Win);
exit(0);
break;
case ' ':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
const GLfloat step = 0.1;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_LEFT:
Xpos -= step;
break;
case GLUT_KEY_RIGHT:
Xpos += step;
break;
}
glutPostRedisplay();
}
static void Init( void )
{
const char *ext = (const char *) glGetString(GL_EXTENSIONS);
GLint bits;
if (!strstr(ext, "GL_ARB_occlusion_query")) {
printf("Sorry, this demo requires the GL_ARB_occlusion_query extension\n");
exit(-1);
}
#if defined(GL_ARB_occlusion_query)
glGetQueryivARB(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB, &bits);
if (!bits) {
printf("Hmmm, GL_QUERY_COUNTER_BITS_ARB is zero!\n");
exit(-1);
}
#endif /* GL_ARB_occlusion_query */
glGetIntegerv(GL_DEPTH_BITS, &bits);
printf("Depthbits: %d\n", bits);
#if defined(GL_ARB_occlusion_query)
glGenQueriesARB(1, &OccQuery1);
assert(OccQuery1 > 0);
glGenQueriesARB(1, &OccQuery2);
assert(OccQuery2 > 0);
#endif /* GL_ARB_occlusion_query */
glEnable(GL_DEPTH_TEST);
}
int main( int argc, char *argv[] )
{
glutInitWindowSize( 400, 400 );
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutIdleFunc( Idle );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}

View file

@ -30,546 +30,10 @@
#include <stdio.h>
#include "util/u_format.h"
#include "util/u_format_tests.h"
#include "util/u_format_pack.h"
#define MAX_PACKED_BYTES 16
/**
* A (packed, unpacked) color pair.
*/
struct util_format_test_case
{
enum pipe_format format;
/**
* Mask of the bits that actually meaningful data. Used to mask out the
* "X" channels.
*/
uint8_t mask[MAX_PACKED_BYTES];
uint8_t packed[MAX_PACKED_BYTES];
/**
* RGBA.
*/
double unpacked[4];
};
/*
* Helper macros to create the packed bytes for longer words.
*/
#define PACKED_1x8(x) {x, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_2x8(x, y) {x, y, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_3x8(x, y, z) {x, y, z, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_4x8(x, y, z, w) {x, y, z, w, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_1x16(x) {(x) & 0xff, (x) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_2x16(x, y) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_3x16(x, y, z) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_4x16(x, y, z, w) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8, (w) & 0xff, (w) >> 8, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_1x32(x) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_2x32(x, y) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_3x32(x, y, z) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24, 0, 0, 0, 0}
#define PACKED_4x32(x, y, z, w) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24, (w) & 0xff, ((w) >> 8) & 0xff, ((w) >> 16) & 0xff, (w) >> 24}
/**
* Test cases.
*
* These were manually entered. We could generate these
*
* To keep this to a we cover only the corner cases, which should produce
* good enough coverage since that pixel format transformations are afine for
* non SRGB formats.
*/
static const struct util_format_test_case
test_cases[] =
{
/*
* 32-bit rendertarget formats
*/
{PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000ff), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000ff00), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xff000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000003ff), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000ffc00), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x3ff00000), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xc0000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
/*
* 16-bit rendertarget formats
*/
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x03e0), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00f0), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0f00), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x07e0), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf800), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
/*
* Luminance/intensity/alpha formats
*/
{PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00ff), {1.0, 1.0, 1.0, 0.0}},
{PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xff00), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
/*
* TODO: SRGB formats
*/
/*
* Mixed-signed formats
*/
{PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000007f), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000081), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00007f00), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00008100), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), { 0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xff000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0011), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x01e0), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0220), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), { 0.0, 0.0, 1.0, 1.0}},
/*
* TODO: Depth-stencil formats
*/
/*
* TODO: YUV formats
*/
/*
* TODO: Compressed formats
*/
/*
* Standard 8-bit integer formats
*/
{PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), {1.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0xff), {255.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), {255.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), { 0.0, 255.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), {255.0, 255.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), {255.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), { 0.0, 255.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), { 0.0, 0.0, 255.0, 1.0}},
{PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), {255.0, 255.0, 255.0, 1.0}},
{PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), {255.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), { 0.0, 255.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), { 0.0, 0.0, 255.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), { 0.0, 0.0, 0.0, 255.0}},
{PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), {255.0, 255.0, 255.0, 255.0}},
{PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x7f), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x81), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x81, 0x00), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x81), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x81, 0x00, 0x00), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x81, 0x00), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), { 0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x81), { 0.0, 0.0, -1.0, 1.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), { 1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x81, 0x00, 0x00, 0x00), {-1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), { 0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x81, 0x00, 0x00), { 0.0, -1.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), { 0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x81, 0x00), { 0.0, 0.0, -1.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x81), { 0.0, 0.0, 0.0, -1.0}},
{PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x7f), { 127.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x80), {-128.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), { 127.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x80, 0x00), {-128.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), { 0.0, 127.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x80), { 0.0, -128.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), { 127.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x80, 0x00, 0x00), {-128.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), { 0.0, 127.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x80, 0x00), { 0.0, -128.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), { 0.0, 0.0, 127.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x80), { 0.0, 0.0, -128.0, 1.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), { 127.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0x00, 0x00, 0x00), {-128.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), { 0.0, 127.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x80, 0x00, 0x00), { 0.0, -128.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), { 0.0, 0.0, 127.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x80, 0x00), { 0.0, 0.0, -128.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), { 0.0, 0.0, 0.0, 127.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x80), { 0.0, 0.0, 0.0, -128.0}},
/*
* Standard 16-bit integer formats
*/
{PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), {1.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {65535.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), {65535.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), { 0.0, 65535.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), {65535.0, 65535.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), {65535.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), { 0.0, 65535.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), { 0.0, 0.0, 65535.0, 1.0}},
{PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), {65535.0, 65535.0, 65535.0, 1.0}},
{PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), {65535.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), { 0.0, 65535.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), { 0.0, 0.0, 65535.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), { 0.0, 0.0, 0.0, 65535.0}},
{PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), {65535.0, 65535.0, 65535.0, 65535.0}},
{PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8001), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8001, 0x0000), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8001), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8001, 0x0000, 0x0000), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8001, 0x0000), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), { 0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8001), { 0.0, 0.0, -1.0, 1.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), { 1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8001, 0x0000, 0x0000, 0x0000), { -1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), { 0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8001, 0x0000, 0x0000), { 0.0, -1.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), { 0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8001, 0x0000), { 0.0, 0.0, -1.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8001), { 0.0, 0.0, 0.0, -1.0}},
{PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), { 32767.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x8000), {-32768.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), { 32767.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8000, 0x0000), {-32768.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), { 0.0, 32767.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8000), { 0.0, -32768.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), { 32767.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8000, 0x0000, 0x0000), {-32768.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), { 0.0, 32767.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8000, 0x0000), { 0.0, -32768.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), { 0.0, 0.0, 32767.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8000), { 0.0, 0.0, -32768.0, 1.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), { 32767.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8000, 0x0000, 0x0000, 0x0000), {-32768.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), { 0.0, 32767.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8000, 0x0000, 0x0000), { 0.0, -32768.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), { 0.0, 0.0, 32767.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8000, 0x0000), { 0.0, 0.0, -32768.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), { 0.0, 0.0, 0.0, 32767.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8000), { 0.0, 0.0, 0.0, -32768.0}},
/*
* Standard 32-bit integer formats
*
* NOTE: We can't accurately represent integers larger than +/-0x1000000
* with single precision floats, so that's as far as we test.
*/
{PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0x00000000), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xffffffff), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0xffffffff), {1.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0x00000000, 0x00000000), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xffffffff, 0x00000000), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xffffffff), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0x00000000, 0x00000000, 0x00000000), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xffffffff, 0x00000000, 0x00000000), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xffffffff, 0x00000000), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xffffffff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), {16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), {16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), { 0.0, 16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x01000000), {16777216.0, 16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), {16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), { 0.0, 16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), { 0.0, 0.0, 16777216.0, 1.0}},
{PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x01000000, 0x01000000), {16777216.0, 16777216.0, 16777216.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), {16777216.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), { 0.0, 16777216.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), { 0.0, 0.0, 16777216.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), { 0.0, 0.0, 0.0, 16777216.0}},
{PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x01000000, 0x01000000, 0x01000000), {16777216.0, 16777216.0, 16777216.0, 16777216.0}},
{PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x7fffffff), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x80000001), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x7fffffff, 0x00000000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x80000001, 0x00000000), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x7fffffff), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x80000001), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x7fffffff, 0x00000000, 0x00000000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x80000001, 0x00000000, 0x00000000), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x7fffffff, 0x00000000), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x80000001, 0x00000000), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x7fffffff), { 0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x80000001), { 0.0, 0.0, -1.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x7fffffff, 0x00000000, 0x00000000, 0x00000000), { 1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x80000001, 0x00000000, 0x00000000, 0x00000000), { -1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x7fffffff, 0x00000000, 0x00000000), { 0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x80000001, 0x00000000, 0x00000000), { 0.0, -1.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x7fffffff, 0x00000000), { 0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x80000001, 0x00000000), { 0.0, 0.0, -1.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x7fffffff), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x80000001), { 0.0, 0.0, 0.0, -1.0}},
{PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), { 16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), {-16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), { 16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xff000000, 0x00000000), {-16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), { 0.0, 16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xff000000), { 0.0, -16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), { 16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xff000000, 0x00000000, 0x00000000), {-16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), { 0.0, 16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xff000000, 0x00000000), { 0.0, -16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), { 0.0, 0.0, 16777216.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xff000000), { 0.0, 0.0, -16777216.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), { 16777216.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xff000000, 0x00000000, 0x00000000, 0x00000000), {-16777216.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), { 0.0, 16777216.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xff000000, 0x00000000, 0x00000000), { 0.0, -16777216.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), { 0.0, 0.0, 16777216.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xff000000, 0x00000000), { 0.0, 0.0, -16777216.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), { 0.0, 0.0, 0.0, 16777216.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xff000000), { 0.0, 0.0, 0.0, -16777216.0}},
/*
* Standard 32-bit float formats
*/
{PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x3f800000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0xbf800000), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x00000000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xbf800000, 0x00000000), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x3f800000), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xbf800000), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x3f800000), { 1.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x00000000, 0x00000000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xbf800000, 0x00000000, 0x00000000), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x3f800000, 0x00000000), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xbf800000, 0x00000000), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x3f800000), { 0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xbf800000), { 0.0, 0.0, -1.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x3f800000, 0x3f800000), { 1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x00000000, 0x00000000, 0x00000000), { 1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xbf800000, 0x00000000, 0x00000000, 0x00000000), {-1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x3f800000, 0x00000000, 0x00000000), { 0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xbf800000, 0x00000000, 0x00000000), { 0.0, -1.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x3f800000, 0x00000000), { 0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xbf800000, 0x00000000), { 0.0, 0.0, -1.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x3f800000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xbf800000), { 0.0, 0.0, 0.0, -1.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000), { 1.0, 1.0, 1.0, 1.0}},
};
static boolean
test_format_unpack_4f(const struct util_format_test_case *test)
{
@ -596,7 +60,7 @@ test_format_unpack_4f(const struct util_format_test_case *test)
static boolean
test_format_pack_4f(const struct util_format_test_case *test)
{
uint8_t packed[MAX_PACKED_BYTES];
uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
unsigned i;
boolean success;
@ -605,7 +69,7 @@ test_format_pack_4f(const struct util_format_test_case *test)
util_format_pack_4f(test->format, packed, test->unpacked[0], test->unpacked[1], test->unpacked[2], test->unpacked[3]);
success = TRUE;
for (i = 0; i < MAX_PACKED_BYTES; ++i)
for (i = 0; i < UTIL_FORMAT_MAX_PACKED_BYTES; ++i)
if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
success = FALSE;
@ -627,13 +91,27 @@ test_format_pack_4f(const struct util_format_test_case *test)
}
static void
static boolean
convert_4f_to_4ub(uint8_t *dst, const double *src)
{
unsigned i;
boolean accurate = TRUE;
for (i = 0; i < 4; ++i)
dst[i] = CLAMP(src[i], 0.0, 1.0) * 255.0;
for (i = 0; i < 4; ++i) {
if (src[i] < 0.0) {
accurate = FALSE;
dst[i] = 0;
}
else if (src[i] > 1.0) {
accurate = FALSE;
dst[i] = 255;
}
else {
dst[i] = src[i] * 255.0;
}
}
return accurate;
}
@ -667,18 +145,23 @@ static boolean
test_format_pack_4ub(const struct util_format_test_case *test)
{
uint8_t unpacked[4];
uint8_t packed[MAX_PACKED_BYTES];
uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
unsigned i;
boolean success;
convert_4f_to_4ub(unpacked, test->unpacked);
if (!convert_4f_to_4ub(unpacked, test->unpacked)) {
/*
* Skip test cases which cannot be represented by four unorm bytes.
*/
return TRUE;
}
memset(packed, 0, sizeof packed);
util_format_pack_4ub(test->format, packed, unpacked[0], unpacked[1], unpacked[2], unpacked[3]);
success = TRUE;
for (i = 0; i < MAX_PACKED_BYTES; ++i)
for (i = 0; i < UTIL_FORMAT_MAX_PACKED_BYTES; ++i)
if ((test->packed[i] & test->mask[i]) != (packed[i] & test->mask[i]))
success = FALSE;
@ -711,15 +194,16 @@ test_one(test_func_t func, const char *suffix)
unsigned i;
bool success = TRUE;
for (i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); ++i) {
if (test_cases[i].format != last_format) {
for (i = 0; i < util_format_nr_test_cases; ++i) {
const struct util_format_test_case *test = &util_format_test_cases[i];
if (test->format != last_format) {
const struct util_format_description *format_desc;
format_desc = util_format_description(test_cases[i].format);
printf("Testing %s.%s ...\n", format_desc->name, suffix);
last_format = test_cases[i].format;
format_desc = util_format_description(test->format);
printf("Testing util_format_%s_%s ...\n", format_desc->short_name, suffix);
last_format = test->format;
}
if (!func(&test_cases[i]))
if (!func(&util_format_test_cases[i]))
success = FALSE;
}

View file

@ -4,7 +4,7 @@
# Helper for the getprocaddress.c test.
import sys, getopt, re
sys.path.append("../../src/mesa/glapi/" )
sys.path.append("../../src/mesa/glapi/gen" )
import gl_XML
import license

View file

@ -27,3 +27,4 @@ xfont
xrotfontdemo
yuvrect_client
msctest
omlsync

View file

@ -32,6 +32,7 @@ PROGS = \
msctest \
multictx \
offset \
omlsync \
overlay \
pbinfo \
pbdemo \

View file

@ -63,19 +63,12 @@ void (*swap_interval)();
static int GLXExtensionSupported(Display *dpy, const char *extension)
{
const char *extensionsString, *client_extensions, *pos;
const char *extensionsString, *pos;
extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
pos = strstr(extensionsString, extension);
if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
return 1;
pos = strstr(client_extensions, extension);
if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
return 1;
@ -235,7 +228,7 @@ int main(int argc, char *argv[])
XMapWindow(disp, winGL);
ret = glXMakeCurrent(disp, winGL, context);
if (ret) {
if (!ret) {
fprintf(stderr, "failed to make context current: %d\n", ret);
}

View file

@ -45,19 +45,12 @@ void (*wait_sync)(Display *dpy, Window winGL, int64_t target_msc, int64_t diviso
static int GLXExtensionSupported(Display *dpy, const char *extension)
{
const char *extensionsString, *client_extensions, *pos;
const char *extensionsString, *pos;
extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
client_extensions = glXGetClientString(dpy, GLX_EXTENSIONS);
pos = strstr(extensionsString, extension);
if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
return 1;
pos = strstr(client_extensions, extension);
if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
return 1;
@ -167,8 +160,8 @@ int main(int argc, char *argv[])
glXMakeCurrent(disp, winGL, context);
get_sync_values = glXGetProcAddress((unsigned char *)"glXGetSyncValuesOML");
wait_sync = glXGetProcAddress((unsigned char *)"glXWaitForMscOML");
get_sync_values = (void *)glXGetProcAddress((unsigned char *)"glXGetSyncValuesOML");
wait_sync = (void *)glXGetProcAddress((unsigned char *)"glXWaitForMscOML");
if (!get_sync_values || !wait_sync) {
fprintf(stderr, "failed to get sync values function\n");

267
progs/xdemos/omlsync.c Normal file
View file

@ -0,0 +1,267 @@
/*
* Copyright © 2007-2010 Intel Corporation
*
* 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 (including the next
* paragraph) 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:
* Jesse Barnes <jesse.barnes@intel.com>
*
*/
/** @file omlsync.c
* The program is simple: it paints a window alternating colors (red &
* white) either as fast as possible or synchronized to vblank events
*
* If run normally, the program should display a window that exhibits
* significant tearing between red and white colors (e.g. you might get
* a "waterfall" effect of red and white horizontal bars).
*
* If run with the '-s b' option, the program should synchronize the
* window color changes with the vertical blank period, resulting in a
* window that looks orangish with a high frequency flicker (which may
* be invisible). If the window is moved to another screen, this
* property should be preserved. If the window spans two screens, it
* shouldn't tear on whichever screen most of the window is on; the
* portion on the other screen may show some tearing (like the
* waterfall effect above).
*
* Other options include '-w <width>' and '-h <height>' to set the
* window size.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glx.h>
#include <GL/glxext.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
Bool (*glXGetSyncValuesOML)(Display *dpy, GLXDrawable drawable,
int64_t *ust, int64_t *msc, int64_t *sbc);
Bool (*glXGetMscRateOML)(Display *dpy, GLXDrawable drawable, int32_t *numerator,
int32_t *denominator);
int64_t (*glXSwapBuffersMscOML)(Display *dpy, GLXDrawable drawable,
int64_t target_msc, int64_t divisor,
int64_t remainder);
Bool (*glXWaitForMscOML)(Display *dpy, GLXDrawable drawable, int64_t target_msc,
int64_t divisor, int64_t remainder, int64_t *ust,
int64_t *msc, int64_t *sbc);
Bool (*glXWaitForSbcOML)(Display *dpy, GLXDrawable drawable, int64_t target_sbc,
int64_t *ust, int64_t *msc, int64_t *sbc);
int (*glXSwapInterval)(int interval);
static int GLXExtensionSupported(Display *dpy, const char *extension)
{
const char *extensionsString, *pos;
extensionsString = glXQueryExtensionsString(dpy, DefaultScreen(dpy));
pos = strstr(extensionsString, extension);
if (pos != NULL && (pos == extensionsString || pos[-1] == ' ') &&
(pos[strlen(extension)] == ' ' || pos[strlen(extension)] == '\0'))
return 1;
return 0;
}
extern char *optarg;
extern int optind, opterr, optopt;
static char optstr[] = "w:h:vd:r:n:i:";
static void usage(char *name)
{
printf("usage: %s [-w <width>] [-h <height>] ...\n", name);
printf("\t-d<divisor> - divisor for OML swap\n");
printf("\t-r<remainder> - remainder for OML swap\n");
printf("\t-n<interval> - wait interval for OML WaitMSC\n");
printf("\t-i<swap interval> - swap at most once every n frames\n");
printf("\t-v: verbose (print count)\n");
exit(-1);
}
int main(int argc, char *argv[])
{
Display *disp;
XVisualInfo *pvi;
XSetWindowAttributes swa;
Window winGL;
GLXContext context;
int dummy;
Atom wmDelete;
int64_t ust, msc, sbc;
int width = 500, height = 500, verbose = 0, divisor = 0, remainder = 0,
wait_interval = 0, swap_interval = 1;
int c, i = 1;
int ret;
int db_attribs[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
GLX_DEPTH_SIZE, 1,
None };
XSizeHints sizehints;
opterr = 0;
while ((c = getopt(argc, argv, optstr)) != -1) {
switch (c) {
case 'w':
width = atoi(optarg);
break;
case 'h':
height = atoi(optarg);
break;
case 'v':
verbose = 1;
break;
case 'd':
divisor = atoi(optarg);
break;
case 'r':
remainder = atoi(optarg);
break;
case 'n':
wait_interval = atoi(optarg);
break;
case 'i':
swap_interval = atoi(optarg);
break;
default:
usage(argv[0]);
break;
}
}
disp = XOpenDisplay(NULL);
if (!disp) {
fprintf(stderr, "failed to open display\n");
return -1;
}
if (!glXQueryExtension(disp, &dummy, &dummy)) {
fprintf(stderr, "glXQueryExtension failed\n");
return -1;
}
if (!GLXExtensionSupported(disp, "GLX_OML_sync_control")) {
fprintf(stderr, "GLX_OML_sync_control not supported\n");
return -1;
}
if (!GLXExtensionSupported(disp, "GLX_MESA_swap_control")) {
fprintf(stderr, "GLX_MESA_swap_control not supported\n");
return -1;
}
pvi = glXChooseVisual(disp, DefaultScreen(disp), db_attribs);
if (!pvi) {
fprintf(stderr, "failed to choose visual, exiting\n");
return -1;
}
pvi->screen = DefaultScreen(disp);
swa.colormap = XCreateColormap(disp, RootWindow(disp, pvi->screen),
pvi->visual, AllocNone);
swa.border_pixel = 0;
swa.event_mask = ExposureMask | KeyPressMask | ButtonPressMask |
StructureNotifyMask;
winGL = XCreateWindow(disp, RootWindow(disp, pvi->screen),
0, 0,
width, height,
0, pvi->depth, InputOutput, pvi->visual,
CWBorderPixel | CWColormap | CWEventMask, &swa);
if (!winGL) {
fprintf(stderr, "window creation failed\n");
return -1;
}
wmDelete = XInternAtom(disp, "WM_DELETE_WINDOW", True);
XSetWMProtocols(disp, winGL, &wmDelete, 1);
sizehints.x = 0;
sizehints.y = 0;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(disp, winGL, &sizehints);
XSetStandardProperties(disp, winGL, "glsync test", "glsync text",
None, NULL, 0, &sizehints);
context = glXCreateContext(disp, pvi, NULL, GL_TRUE);
if (!context) {
fprintf(stderr, "failed to create glx context\n");
return -1;
}
XMapWindow(disp, winGL);
ret = glXMakeCurrent(disp, winGL, context);
if (!ret) {
fprintf(stderr, "failed to make context current: %d\n", ret);
}
glXGetSyncValuesOML = (void *)glXGetProcAddress((unsigned char *)"glXGetSyncValuesOML");
glXGetMscRateOML = (void *)glXGetProcAddress((unsigned char *)"glXGetMscRateOML");
glXSwapBuffersMscOML = (void *)glXGetProcAddress((unsigned char *)"glXSwapBuffersMscOML");
glXWaitForMscOML = (void *)glXGetProcAddress((unsigned char *)"glXWaitForMscOML");
glXWaitForSbcOML = (void *)glXGetProcAddress((unsigned char *)"glXWaitForSbcOML");
glXSwapInterval = (void *)glXGetProcAddress((unsigned char *)"glXSwapIntervalMESA");
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glXSwapInterval(swap_interval);
fprintf(stderr, "set swap interval to %d\n", swap_interval);
glXGetSyncValuesOML(disp, winGL, &ust, &msc, &sbc);
while (i++) {
/* Alternate colors to make tearing obvious */
if (i & 1) {
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glColor3f(1.0f, 1.0f, 1.0f);
} else {
glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
glColor3f(1.0f, 0.0f, 0.0f);
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glRectf(0, 0, width, height);
if (!wait_interval)
glXSwapBuffersMscOML(disp, winGL, 0, divisor,
remainder);
else {
glXWaitForMscOML(disp, winGL, msc + wait_interval,
divisor, remainder, &ust, &msc, &sbc);
glXSwapBuffersMscOML(disp, winGL, 0, 0, 0);
}
}
XDestroyWindow(disp, winGL);
glXDestroyContext(disp, context);
XCloseDisplay(disp);
return 0;
}

View file

@ -29,7 +29,9 @@ Tool-specific initialization for LLVM
import os
import os.path
import re
import sys
import distutils.version
import SCons.Errors
import SCons.Util
@ -60,71 +62,108 @@ def generate(env):
if env['platform'] == 'windows':
# XXX: There is no llvm-config on Windows, so assume a standard layout
if llvm_dir is not None:
env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
env.AppendUnique(CPPDEFINES = [
'__STDC_LIMIT_MACROS',
'__STDC_CONSTANT_MACROS',
'HAVE_STDINT_H',
])
env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
if llvm_dir is None:
return
# Try to determine the LLVM version from llvm/Config/config.h
llvm_config = os.path.join(llvm_dir, 'include/llvm/Config/config.h')
if not os.path.exists(llvm_config):
print 'scons: could not find %s' % llvm_config
return
llvm_version_re = re.compile(r'^#define PACKAGE_VERSION "([^"]*)"')
llvm_version = None
for line in open(llvm_config, 'rt'):
mo = llvm_version_re.match(line)
if mo:
llvm_version = mo.group(1)
llvm_version = distutils.version.LooseVersion(llvm_version)
break
if llvm_version is None:
print 'scons: could not determine the LLVM version from %s' % llvm_config
return
if llvm_version >= distutils.version.LooseVersion('2.7'):
print 'scons: Ignoring unsupported LLVM version %s' % llvm_version
print 'scons: See http://www.llvm.org/bugs/show_bug.cgi?id=6429'
return
env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
env.AppendUnique(CPPDEFINES = [
'__STDC_LIMIT_MACROS',
'__STDC_CONSTANT_MACROS',
'HAVE_STDINT_H',
])
env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
if llvm_version >= distutils.version.LooseVersion('2.7'):
# 2.7
env.Prepend(LIBS = [
'LLVMX86AsmParser',
'LLVMX86AsmPrinter',
'LLVMX86CodeGen',
'LLVMX86Info',
'LLVMLinker',
'LLVMipo',
'LLVMInterpreter',
'LLVMInstrumentation',
'LLVMJIT',
'LLVMExecutionEngine',
'LLVMDebugger',
'LLVMBitWriter',
'LLVMAsmParser',
'LLVMArchive',
'LLVMBitReader',
'LLVMSelectionDAG',
'LLVMAsmPrinter',
'LLVMCodeGen',
'LLVMScalarOpts',
'LLVMTransformUtils',
'LLVMipa',
'LLVMAnalysis',
'LLVMTarget',
'LLVMMC',
'LLVMCore',
'LLVMSupport',
'LLVMSystem',
'imagehlp',
'psapi',
'LLVMLinker', 'LLVMipo', 'LLVMInterpreter',
'LLVMInstrumentation', 'LLVMJIT', 'LLVMExecutionEngine',
'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
'LLVMMCParser', 'LLVMX86AsmPrinter', 'LLVMX86CodeGen',
'LLVMSelectionDAG', 'LLVMX86Info', 'LLVMAsmPrinter',
'LLVMCodeGen', 'LLVMScalarOpts', 'LLVMInstCombine',
'LLVMTransformUtils', 'LLVMipa', 'LLVMAsmParser',
'LLVMArchive', 'LLVMBitReader', 'LLVMAnalysis', 'LLVMTarget',
'LLVMMC', 'LLVMCore', 'LLVMSupport', 'LLVMSystem',
])
if env['msvc']:
# Some of the LLVM C headers use the inline keyword without
# defining it.
env.Append(CPPDEFINES = [('inline', '__inline')])
if env['debug']:
# LLVM libraries are static, build with /MT, and they
# automatically link agains LIBCMT. When we're doing a
# debug build we'll be linking against LIBCMTD, so disable
# that.
env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT'])
env['LLVM_VERSION'] = '2.6'
return
else:
# 2.6
env.Prepend(LIBS = [
'LLVMX86AsmParser', 'LLVMX86AsmPrinter', 'LLVMX86CodeGen',
'LLVMX86Info', 'LLVMLinker', 'LLVMipo', 'LLVMInterpreter',
'LLVMInstrumentation', 'LLVMJIT', 'LLVMExecutionEngine',
'LLVMDebugger', 'LLVMBitWriter', 'LLVMAsmParser',
'LLVMArchive', 'LLVMBitReader', 'LLVMSelectionDAG',
'LLVMAsmPrinter', 'LLVMCodeGen', 'LLVMScalarOpts',
'LLVMTransformUtils', 'LLVMipa', 'LLVMAnalysis',
'LLVMTarget', 'LLVMMC', 'LLVMCore', 'LLVMSupport',
'LLVMSystem',
])
env.Append(LIBS = [
'imagehlp',
'psapi',
])
if env['msvc']:
# Some of the LLVM C headers use the inline keyword without
# defining it.
env.Append(CPPDEFINES = [('inline', '__inline')])
if env['debug']:
# LLVM libraries are static, build with /MT, and they
# automatically link agains LIBCMT. When we're doing a
# debug build we'll be linking against LIBCMTD, so disable
# that.
env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT'])
elif env.Detect('llvm-config'):
version = env.backtick('llvm-config --version').rstrip()
llvm_version = env.backtick('llvm-config --version').rstrip()
llvm_version = distutils.version.LooseVersion(llvm_version)
if llvm_version >= distutils.version.LooseVersion('2.7'):
print 'scons: Ignoring unsupported LLVM version %s' % llvm_version
print 'scons: See http://www.llvm.org/bugs/show_bug.cgi?id=6429'
return
try:
env.ParseConfig('llvm-config --cppflags')
env.ParseConfig('llvm-config --libs jit interpreter nativecodegen bitwriter')
env.ParseConfig('llvm-config --ldflags')
except OSError:
print 'llvm-config version %s failed' % version
print 'llvm-config version %s failed' % llvm_version
else:
if env['platform'] == 'windows':
env.Append(LIBS = ['imagehlp', 'psapi'])
env['LINK'] = env['CXX']
env['LLVM_VERSION'] = version
else:
return
assert llvm_version is not None
print 'scons: Found LLVM version %s' % llvm_version
env['LLVM_VERSION'] = llvm_version
# Define HAVE_LLVM macro with the major/minor version number (e.g., 0x0206 for 2.6)
llvm_version_major = int(llvm_version.version[0])
llvm_version_minor = int(llvm_version.version[1])
llvm_version_hex = '0x%02x%02x' % (llvm_version_major, llvm_version_minor)
env.Prepend(CPPDEFINES = [('HAVE_LLVM', llvm_version_hex)])
def exists(env):
return True

View file

@ -107,6 +107,7 @@ C_SOURCES = \
util/u_draw_quad.c \
util/u_format_access.c \
util/u_format_table.c \
util/u_format_tests.c \
util/u_gen_mipmap.c \
util/u_handle_table.c \
util/u_hash_table.c \

View file

@ -7,6 +7,8 @@ env.Append(CPPPATH = [
'util',
])
env.Tool('udis86')
env.CodeGenerate(
target = 'indices/u_indices_gen.c',
script = 'indices/u_indices_gen.py',
@ -149,6 +151,7 @@ source = [
'util/u_draw_quad.c',
'util/u_format_access.c',
'util/u_format_table.c',
'util/u_format_tests.c',
'util/u_gen_mipmap.c',
'util/u_handle_table.c',
'util/u_hash.c',

View file

@ -105,40 +105,20 @@ static void FUNC( ARGS,
case PIPE_PRIM_QUADS:
if (flatfirst) {
for (i = 0; i+3 < count; i += 4) {
QUAD( (i + 1),
(i + 2),
(i + 3),
(i + 0) );
}
}
else {
for (i = 0; i+3 < count; i += 4) {
QUAD( (i + 0),
(i + 1),
(i + 2),
(i + 3));
}
for (i = 0; i+3 < count; i += 4) {
QUAD( (i + 0),
(i + 1),
(i + 2),
(i + 3));
}
break;
case PIPE_PRIM_QUAD_STRIP:
if (flatfirst) {
for (i = 0; i+3 < count; i += 2) {
QUAD( (i + 1),
(i + 3),
(i + 2),
(i + 0) );
}
}
else {
for (i = 0; i+3 < count; i += 2) {
QUAD( (i + 2),
(i + 0),
(i + 1),
(i + 3));
}
for (i = 0; i+3 < count; i += 2) {
QUAD( (i + 2),
(i + 0),
(i + 1),
(i + 3));
}
break;

View file

@ -118,39 +118,21 @@ static void FUNC( struct draw_pt_front_end *frontend,
case PIPE_PRIM_QUADS:
for (i = 0; i+3 < count; i += 4) {
if (flatfirst) {
QUAD( vcache,
get_elt(elts, i + 0),
get_elt(elts, i + 1),
get_elt(elts, i + 2),
get_elt(elts, i + 3) );
}
else {
QUAD( vcache,
get_elt(elts, i + 0),
get_elt(elts, i + 1),
get_elt(elts, i + 2),
get_elt(elts, i + 3) );
}
QUAD( vcache,
get_elt(elts, i + 0),
get_elt(elts, i + 1),
get_elt(elts, i + 2),
get_elt(elts, i + 3) );
}
break;
case PIPE_PRIM_QUAD_STRIP:
for (i = 0; i+3 < count; i += 2) {
if (flatfirst) {
QUAD( vcache,
get_elt(elts, i + 0),
get_elt(elts, i + 1),
get_elt(elts, i + 3),
get_elt(elts, i + 2) );
}
else {
QUAD( vcache,
get_elt(elts, i + 2),
get_elt(elts, i + 0),
get_elt(elts, i + 1),
get_elt(elts, i + 3) );
}
QUAD( vcache,
get_elt(elts, i + 2),
get_elt(elts, i + 0),
get_elt(elts, i + 1),
get_elt(elts, i + 3) );
}
break;

View file

@ -668,6 +668,14 @@ lp_build_abs(struct lp_build_context *bld,
}
LLVMValueRef
lp_build_negate(struct lp_build_context *bld,
LLVMValueRef a)
{
return LLVMBuildNeg(bld->builder, a, "");
}
LLVMValueRef
lp_build_sgn(struct lp_build_context *bld,
LLVMValueRef a)
@ -709,6 +717,41 @@ lp_build_sgn(struct lp_build_context *bld,
}
/**
* Set the sign of float vector 'a' according to 'sign'.
* If sign==0, return abs(a).
* If sign==1, return -abs(a);
* Other values for sign produce undefined results.
*/
LLVMValueRef
lp_build_set_sign(struct lp_build_context *bld,
LLVMValueRef a, LLVMValueRef sign)
{
const struct lp_type type = bld->type;
LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
LLVMTypeRef vec_type = lp_build_vec_type(type);
LLVMValueRef shift = lp_build_int_const_scalar(type, type.width - 1);
LLVMValueRef mask = lp_build_int_const_scalar(type,
~((unsigned long long) 1 << (type.width - 1)));
LLVMValueRef val, res;
assert(type.floating);
/* val = reinterpret_cast<int>(a) */
val = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
/* val = val & mask */
val = LLVMBuildAnd(bld->builder, val, mask, "");
/* sign = sign << shift */
sign = LLVMBuildShl(bld->builder, sign, shift, "");
/* res = val | sign */
res = LLVMBuildOr(bld->builder, val, sign, "");
/* res = reinterpret_cast<float>(res) */
res = LLVMBuildBitCast(bld->builder, res, vec_type, "");
return res;
}
/**
* Convert vector of int to vector of float.
*/
@ -856,6 +899,19 @@ lp_build_ceil(struct lp_build_context *bld,
}
/**
* Return fractional part of 'a' computed as a - floor(f)
* Typically used in texture coord arithmetic.
*/
LLVMValueRef
lp_build_fract(struct lp_build_context *bld,
LLVMValueRef a)
{
assert(bld->type.floating);
return lp_build_sub(bld, a, lp_build_floor(bld, a));
}
/**
* Convert to integer, through whichever rounding method that's fastest,
* typically truncating toward zero.

View file

@ -116,10 +116,18 @@ LLVMValueRef
lp_build_abs(struct lp_build_context *bld,
LLVMValueRef a);
LLVMValueRef
lp_build_negate(struct lp_build_context *bld,
LLVMValueRef a);
LLVMValueRef
lp_build_sgn(struct lp_build_context *bld,
LLVMValueRef a);
LLVMValueRef
lp_build_set_sign(struct lp_build_context *bld,
LLVMValueRef a, LLVMValueRef sign);
LLVMValueRef
lp_build_int_to_float(struct lp_build_context *bld,
LLVMValueRef a);
@ -140,6 +148,10 @@ LLVMValueRef
lp_build_trunc(struct lp_build_context *bld,
LLVMValueRef a);
LLVMValueRef
lp_build_fract(struct lp_build_context *bld,
LLVMValueRef a);
LLVMValueRef
lp_build_ifloor(struct lp_build_context *bld,
LLVMValueRef a);

View file

@ -45,6 +45,7 @@
/**
* Build code to compare two values 'a' and 'b' of 'type' using the given func.
* \param func one of PIPE_FUNC_x
* The result values will be 0 for false or ~0 for true.
*/
LLVMValueRef
lp_build_compare(LLVMBuilderRef builder,
@ -311,6 +312,7 @@ lp_build_compare(LLVMBuilderRef builder,
/**
* Build code to compare two values 'a' and 'b' using the given func.
* \param func one of PIPE_FUNC_x
* The result values will be 0 for false or ~0 for true.
*/
LLVMValueRef
lp_build_cmp(struct lp_build_context *bld,
@ -322,6 +324,9 @@ lp_build_cmp(struct lp_build_context *bld,
}
/**
* Return mask ? a : b;
*/
LLVMValueRef
lp_build_select(struct lp_build_context *bld,
LLVMValueRef mask,

View file

@ -256,7 +256,9 @@ lp_build_pack2(LLVMBuilderRef builder,
LLVMValueRef lo,
LLVMValueRef hi)
{
#if !(HAVE_LLVM >= 0x0207)
LLVMTypeRef src_vec_type = lp_build_vec_type(src_type);
#endif
LLVMTypeRef dst_vec_type = lp_build_vec_type(dst_type);
LLVMValueRef shuffle;
LLVMValueRef res;
@ -272,11 +274,14 @@ lp_build_pack2(LLVMBuilderRef builder,
switch(src_type.width) {
case 32:
if(dst_type.sign) {
#if HAVE_LLVM >= 0x0207
res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", dst_vec_type, lo, hi);
#else
res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", src_vec_type, lo, hi);
#endif
}
else {
if (util_cpu_caps.has_sse4_1) {
/* PACKUSDW is the only instrinsic with a consistent signature */
return lp_build_intrinsic_binary(builder, "llvm.x86.sse41.packusdw", dst_vec_type, lo, hi);
}
else {
@ -288,9 +293,17 @@ lp_build_pack2(LLVMBuilderRef builder,
case 16:
if(dst_type.sign)
#if HAVE_LLVM >= 0x0207
res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packsswb.128", dst_vec_type, lo, hi);
#else
res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packsswb.128", src_vec_type, lo, hi);
#endif
else
#if HAVE_LLVM >= 0x0207
res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packuswb.128", dst_vec_type, lo, hi);
#else
res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packuswb.128", src_vec_type, lo, hi);
#endif
break;
default:

View file

@ -44,6 +44,11 @@
#include "lp_bld_sample.h"
/**
* Initialize lp_sampler_static_state object with the gallium sampler
* and texture state.
* The former is considered to be static and the later dynamic.
*/
void
lp_sampler_static_state(struct lp_sampler_static_state *state,
const struct pipe_texture *texture,
@ -57,6 +62,18 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
if(!sampler)
return;
/*
* We don't copy sampler state over unless it is actually enabled, to avoid
* spurious recompiles, as the sampler static state is part of the shader
* key.
*
* Ideally the state tracker or cso_cache module would make all state
* canonical, but until that happens it's better to be safe than sorry here.
*
* XXX: Actually there's much more than can be done here, especially
* regarding 1D/2D/3D/CUBE textures, wrap modes, etc.
*/
state->format = texture->format;
state->target = texture->target;
state->pot_width = util_is_pot(texture->width0);
@ -69,11 +86,20 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
state->min_img_filter = sampler->min_img_filter;
state->min_mip_filter = sampler->min_mip_filter;
state->mag_img_filter = sampler->mag_img_filter;
state->compare_mode = sampler->compare_mode;
if(sampler->compare_mode != PIPE_TEX_COMPARE_NONE) {
state->compare_func = sampler->compare_func;
if (sampler->compare_mode != PIPE_TEX_COMPARE_NONE) {
state->compare_func = sampler->compare_func;
}
state->normalized_coords = sampler->normalized_coords;
state->lod_bias = sampler->lod_bias;
state->min_lod = sampler->min_lod;
state->max_lod = sampler->max_lod;
state->border_color[0] = sampler->border_color[0];
state->border_color[1] = sampler->border_color[1];
state->border_color[2] = sampler->border_color[2];
state->border_color[3] = sampler->border_color[3];
}
@ -136,8 +162,7 @@ lp_build_sample_offset(struct lp_build_context *bld,
const struct util_format_description *format_desc,
LLVMValueRef x,
LLVMValueRef y,
LLVMValueRef y_stride,
LLVMValueRef data_ptr)
LLVMValueRef y_stride)
{
LLVMValueRef x_stride;
LLVMValueRef offset;

View file

@ -70,6 +70,8 @@ struct lp_sampler_static_state
unsigned compare_mode:1;
unsigned compare_func:3;
unsigned normalized_coords:1;
float lod_bias, min_lod, max_lod;
float border_color[4];
};
@ -98,6 +100,18 @@ struct lp_sampler_dynamic_state
LLVMBuilderRef builder,
unsigned unit);
/** Obtain the base texture depth. */
LLVMValueRef
(*depth)( struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder,
unsigned unit);
/** Obtain the number of mipmap levels (minus one). */
LLVMValueRef
(*last_level)( struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder,
unsigned unit);
LLVMValueRef
(*stride)( struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder,
@ -134,8 +148,7 @@ lp_build_sample_offset(struct lp_build_context *bld,
const struct util_format_description *format_desc,
LLVMValueRef x,
LLVMValueRef y,
LLVMValueRef y_stride,
LLVMValueRef data_ptr);
LLVMValueRef y_stride);
void

File diff suppressed because it is too large Load diff

View file

@ -152,8 +152,7 @@ static void lp_exec_mask_init(struct lp_exec_mask *mask, struct lp_build_context
static void lp_exec_mask_update(struct lp_exec_mask *mask)
{
mask->exec_mask = mask->cond_mask;
if (mask->cond_stack_size > 0)
mask->has_mask = TRUE;
mask->has_mask = (mask->cond_stack_size > 0);
}
static void lp_exec_mask_cond_push(struct lp_exec_mask *mask,
@ -384,6 +383,11 @@ emit_store(
assert(0);
break;
case TGSI_FILE_PREDICATE:
/* FIXME */
assert(0);
break;
default:
assert( 0 );
}
@ -581,6 +585,17 @@ emit_instruction(
if (indirect_temp_reference(inst))
return FALSE;
/*
* Stores and write masks are handled in a general fashion after the long
* instruction opcode switch statement.
*
* Although not stricitly necessary, we avoid generating instructions for
* channels which won't be stored, in cases where's that easy. For some
* complex instructions, like texture sampling, it is more convenient to
* assume a full writemask and then let LLVM optimization passes eliminate
* redundant code.
*/
assert(info->num_dst <= 1);
if(info->num_dst) {
FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) {

View file

@ -178,6 +178,25 @@ lp_build_int32_vec4_type(void)
}
/**
* Create unsigned integer type variation of given type.
*/
struct lp_type
lp_uint_type(struct lp_type type)
{
struct lp_type res_type;
memset(&res_type, 0, sizeof res_type);
res_type.width = type.width;
res_type.length = type.length;
return res_type;
}
/**
* Create signed integer type variation of given type.
*/
struct lp_type
lp_int_type(struct lp_type type)
{
@ -186,6 +205,7 @@ lp_int_type(struct lp_type type)
memset(&res_type, 0, sizeof res_type);
res_type.width = type.width;
res_type.length = type.length;
res_type.sign = 1;
return res_type;
}

View file

@ -256,6 +256,10 @@ LLVMTypeRef
lp_build_int32_vec4_type(void);
struct lp_type
lp_uint_type(struct lp_type type);
struct lp_type
lp_int_type(struct lp_type type);

View file

@ -120,8 +120,14 @@ struct util_format_channel_description
struct util_format_description
{
enum pipe_format format;
const char *name;
/**
* Short name, striped of the prefix, lower case.
*/
const char *short_name;
/**
* Pixel block dimensions.
*/
@ -139,6 +145,15 @@ struct util_format_description
*/
unsigned is_array:1;
/**
* Whether the pixel format can be described as a bitfield structure.
*
* In particular:
* - pixel depth must be 8, 16, or 32 bits;
* - all channels must be unsigned, signed, or void
*/
unsigned is_bitmask:1;
/**
* Whether channels have mixed types (ignoring UTIL_FORMAT_TYPE_VOID).
*/

View file

@ -252,9 +252,6 @@ def conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=True
if src_channel.type == FLOAT and dst_channel.type == FLOAT:
return '(%s)%s' % (dst_native_type, value)
if not src_channel.norm and not dst_channel.norm:
return '(%s)%s' % (dst_native_type, value)
if clamp:
value = clamp_expr(src_channel, dst_channel, dst_native_type, value)
@ -280,15 +277,15 @@ def conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=True
value = '(%s * %s)' % (value, scale)
return '(%s)%s' % (dst_native_type, value)
if not src_channel.norm and not dst_channel.norm:
# neither is normalized -- just cast
return '(%s)%s' % (dst_native_type, value)
if src_channel.type in (SIGNED, UNSIGNED) and dst_channel.type in (SIGNED, UNSIGNED):
if not src_channel.norm and not dst_channel.norm:
# neither is normalized -- just cast
return '(%s)%s' % (dst_native_type, value)
src_one = get_one(src_channel)
dst_one = get_one(dst_channel)
if src_one > dst_one and src_channel.norm:
if src_one > dst_one and src_channel.norm and dst_channel.norm:
# We can just bitshift
src_shift = get_one_shift(src_channel)
dst_shift = get_one_shift(dst_channel)
@ -296,7 +293,7 @@ def conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=True
else:
# We need to rescale using an intermediate type big enough to hold the multiplication of both
tmp_native_type = intermediate_native_type(src_channel.size + dst_channel.size, src_channel.sign and dst_channel.sign)
value = '(%s)%s' % (tmp_native_type, value)
value = '((%s)%s)' % (tmp_native_type, value)
value = '(%s * 0x%x / 0x%x)' % (value, dst_one, src_one)
value = '(%s)%s' % (dst_native_type, value)
return value
@ -307,6 +304,8 @@ def conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=True
def generate_format_unpack(format, dst_channel, dst_native_type, dst_suffix):
'''Generate the function to unpack pixels from a particular format'''
assert format.layout == PLAIN
name = format.short_name()
src_native_type = native_type(format)
@ -314,32 +313,99 @@ def generate_format_unpack(format, dst_channel, dst_native_type, dst_suffix):
print 'static INLINE void'
print 'util_format_%s_unpack_%s(%s *dst, const void *src)' % (name, dst_suffix, dst_native_type)
print '{'
print ' union util_format_%s pixel;' % format.short_name()
print ' memcpy(&pixel, src, sizeof pixel);'
bswap_format(format)
if format.is_bitmask():
depth = format.block_size()
print ' uint%u_t value = *(uint%u_t *)src;' % (depth, depth)
assert format.layout == PLAIN
# Declare the intermediate variables
for i in range(format.nr_channels()):
src_channel = format.channels[i]
if src_channel.type == UNSIGNED:
print ' uint%u_t %s;' % (depth, src_channel.name)
elif src_channel.type == SIGNED:
print ' int%u_t %s;' % (depth, src_channel.name)
for i in range(4):
swizzle = format.swizzles[i]
if swizzle < 4:
src_channel = format.channels[swizzle]
value = 'pixel.chan.%s' % src_channel.name
value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
elif swizzle == SWIZZLE_0:
value = '0'
elif swizzle == SWIZZLE_1:
value = get_one(dst_channel)
elif swizzle == SWIZZLE_NONE:
value = '0'
else:
assert False
if format.colorspace == ZS:
if i == 3:
print '#ifdef PIPE_ARCH_BIG_ENDIAN'
print ' value = util_bswap%u(value);' % depth
print '#endif'
# Compute the intermediate unshifted values
shift = 0
for i in range(format.nr_channels()):
src_channel = format.channels[i]
value = 'value'
if src_channel.type == UNSIGNED:
if shift:
value = '%s >> %u' % (value, shift)
if shift + src_channel.size < depth:
value = '(%s) & 0x%x' % (value, (1 << src_channel.size) - 1)
elif src_channel.type == SIGNED:
if shift + src_channel.size < depth:
# Align the sign bit
lshift = depth - (shift + src_channel.size)
value = '%s << %u' % (value, lshift)
# Cast to signed
value = '(int%u_t)(%s) ' % (depth, value)
if src_channel.size < depth:
# Align the LSB bit
rshift = depth - src_channel.size
value = '(%s) >> %u' % (value, rshift)
else:
value = None
if value is not None:
print ' %s = %s;' % (src_channel.name, value)
shift += src_channel.size
# Convert, swizzle, and store final values
for i in range(4):
swizzle = format.swizzles[i]
if swizzle < 4:
src_channel = format.channels[swizzle]
value = src_channel.name
value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
elif swizzle == SWIZZLE_0:
value = '0'
elif swizzle == SWIZZLE_1:
value = get_one(dst_channel)
elif i >= 1:
value = 'dst[0]'
print ' dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i])
elif swizzle == SWIZZLE_NONE:
value = '0'
else:
assert False
if format.colorspace == ZS:
if i == 3:
value = get_one(dst_channel)
elif i >= 1:
value = 'dst[0]'
print ' dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i])
else:
print ' union util_format_%s pixel;' % format.short_name()
print ' memcpy(&pixel, src, sizeof pixel);'
bswap_format(format)
for i in range(4):
swizzle = format.swizzles[i]
if swizzle < 4:
src_channel = format.channels[swizzle]
value = 'pixel.chan.%s' % src_channel.name
value = conversion_expr(src_channel, dst_channel, dst_native_type, value)
elif swizzle == SWIZZLE_0:
value = '0'
elif swizzle == SWIZZLE_1:
value = get_one(dst_channel)
elif swizzle == SWIZZLE_NONE:
value = '0'
else:
assert False
if format.colorspace == ZS:
if i == 3:
value = get_one(dst_channel)
elif i >= 1:
value = 'dst[0]'
print ' dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i])
print '}'
print

View file

@ -78,7 +78,7 @@ class Channel:
if self.type == UNSIGNED:
return (1 << self.size) - 1
if self.type == SIGNED:
return self.size - 1
return (1 << (self.size - 1)) - 1
assert False
def min(self):
@ -166,17 +166,11 @@ class Format:
return True
def is_bitmask(self):
if self.block_size() > 32:
return False
if not self.is_pot():
if self.block_size() not in (8, 16, 32):
return False
for channel in self.channels:
if not is_pot(channel.size):
return True
if channel.type not in (VOID, UNSIGNED, SIGNED):
return False
if channel.size >= 32:
return False
return True
def inv_swizzles(self):

View file

@ -90,11 +90,13 @@ def write_format_table(formats):
print 'util_format_none_description = {'
print " PIPE_FORMAT_NONE,"
print " \"PIPE_FORMAT_NONE\","
print " \"none\","
print " {0, 0, 0},"
print " 0,"
print " 0,"
print " 0,"
print " 0,"
print " 0,"
print " {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},"
print " {0, 0, 0, 0},"
print " 0"
@ -105,10 +107,12 @@ def write_format_table(formats):
print 'util_format_%s_description = {' % (format.short_name(),)
print " %s," % (format.name,)
print " \"%s\"," % (format.name,)
print " \"%s\"," % (format.short_name(),)
print " {%u, %u, %u},\t/* block */" % (format.block_width, format.block_height, format.block_size())
print " %s," % (layout_map(format.layout),)
print " %u,\t/* nr_channels */" % (format.nr_channels(),)
print " %s,\t/* is_array */" % (bool_map(format.is_array()),)
print " %s,\t/* is_bitmask */" % (bool_map(format.is_bitmask()),)
print " %s,\t/* is_mixed */" % (bool_map(format.is_mixed()),)
print " {"
for i in range(4):

View file

@ -0,0 +1,544 @@
/**************************************************************************
*
* Copyright 2009-2010 VMware, Inc.
* All Rights Reserved.
*
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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.
*
**************************************************************************/
#include "u_memory.h"
#include "u_format_tests.h"
/*
* Helper macros to create the packed bytes for longer words.
*/
#define PACKED_1x8(x) {x, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_2x8(x, y) {x, y, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_3x8(x, y, z) {x, y, z, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_4x8(x, y, z, w) {x, y, z, w, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_1x16(x) {(x) & 0xff, (x) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_2x16(x, y) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_3x16(x, y, z) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_4x16(x, y, z, w) {(x) & 0xff, (x) >> 8, (y) & 0xff, (y) >> 8, (z) & 0xff, (z) >> 8, (w) & 0xff, (w) >> 8, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_1x32(x) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_2x32(x, y) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, 0, 0, 0, 0, 0, 0, 0, 0}
#define PACKED_3x32(x, y, z) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24, 0, 0, 0, 0}
#define PACKED_4x32(x, y, z, w) {(x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, (x) >> 24, (y) & 0xff, ((y) >> 8) & 0xff, ((y) >> 16) & 0xff, (y) >> 24, (z) & 0xff, ((z) >> 8) & 0xff, ((z) >> 16) & 0xff, (z) >> 24, (w) & 0xff, ((w) >> 8) & 0xff, ((w) >> 16) & 0xff, (w) >> 24}
/**
* Test cases.
*
* These were manually entered. We could generate these
*
* To keep this to a we cover only the corner cases, which should produce
* good enough coverage since that pixel format transformations are afine for
* non SRGB formats.
*/
const struct util_format_test_case
util_format_test_cases[] =
{
/*
* 32-bit rendertarget formats
*/
{PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B8G8R8A8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x000000ff), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x0000ff00), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0x00ff0000), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xff000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B8G8R8X8_UNORM, PACKED_1x32(0x00ffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_A8R8G8B8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_X8R8G8B8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000000ff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x0000ff00), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00ff0000), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_A8B8G8R8_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x000000ff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x0000ff00), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0x00ff0000), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xff000000), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_X8B8G8R8_UNORM, PACKED_1x32(0xffffff00), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000003ff), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x000ffc00), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x3ff00000), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xc0000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R10G10B10A2_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 1.0, 1.0, 1.0}},
/*
* 16-bit rendertarget formats
*/
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x03e0), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00f0), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0f00), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B4G4R4A4_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x001f), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x07e0), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xf800), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_B5G6R5_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
/*
* Luminance/intensity/alpha formats
*/
{PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_L8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_A8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_I8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x00ff), {1.0, 1.0, 1.0, 0.0}},
{PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xff00), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_L8A8_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_L16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 1.0, 1.0, 1.0}},
/*
* TODO: SRGB formats
*/
/*
* Mixed-signed formats
*/
{PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x81, 0x00, 0x00, 0x00), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x81, 0x00, 0x00), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8SG8SB8UX8U_NORM, PACKED_4x8(0xff, 0xff, 0xff, 0x00), PACKED_4x8(0x00, 0x00, 0xff, 0x00), { 0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x000f), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0011), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x01e0), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0x0220), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R5SG5SB6U_NORM, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), { 0.0, 0.0, 1.0, 1.0}},
/*
* TODO: Depth-stencil formats
*/
/*
* TODO: YUV formats
*/
/*
* TODO: Compressed formats
*/
/*
* Standard 8-bit integer formats
*/
{PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8_UNORM, PACKED_1x8(0xff), PACKED_1x8(0xff), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_UNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), {1.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R8G8B8_UNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8A8_UNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8_USCALED, PACKED_1x8(0xff), PACKED_1x8(0xff), {255.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0x00), {255.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0xff), { 0.0, 255.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_USCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0xff, 0xff), {255.0, 255.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0x00, 0x00), {255.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0xff, 0x00), { 0.0, 255.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0xff), { 0.0, 0.0, 255.0, 1.0}},
{PIPE_FORMAT_R8G8B8_USCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0xff, 0xff, 0xff), {255.0, 255.0, 255.0, 1.0}},
{PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0x00, 0x00, 0x00), {255.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0xff, 0x00, 0x00), { 0.0, 255.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0xff, 0x00), { 0.0, 0.0, 255.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0xff), { 0.0, 0.0, 0.0, 255.0}},
{PIPE_FORMAT_R8G8B8A8_USCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0xff, 0xff, 0xff, 0xff), {255.0, 255.0, 255.0, 255.0}},
{PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x7f), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8_SNORM, PACKED_1x8(0xff), PACKED_1x8(0x81), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x81, 0x00), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SNORM, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x81), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x81, 0x00, 0x00), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x81, 0x00), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), { 0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SNORM, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x81), { 0.0, 0.0, -1.0, 1.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), { 1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x81, 0x00, 0x00, 0x00), {-1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), { 0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x81, 0x00, 0x00), { 0.0, -1.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), { 0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x81, 0x00), { 0.0, 0.0, -1.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8A8_SNORM, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x81), { 0.0, 0.0, 0.0, -1.0}},
{PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x7f), { 127.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8_SSCALED, PACKED_1x8(0xff), PACKED_1x8(0x80), {-128.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x7f, 0x00), { 127.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x80, 0x00), {-128.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x7f), { 0.0, 127.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8_SSCALED, PACKED_2x8(0xff, 0xff), PACKED_2x8(0x00, 0x80), { 0.0, -128.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x7f, 0x00, 0x00), { 127.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x80, 0x00, 0x00), {-128.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x7f, 0x00), { 0.0, 127.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x80, 0x00), { 0.0, -128.0, 0.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x7f), { 0.0, 0.0, 127.0, 1.0}},
{PIPE_FORMAT_R8G8B8_SSCALED, PACKED_3x8(0xff, 0xff, 0xff), PACKED_3x8(0x00, 0x00, 0x80), { 0.0, 0.0, -128.0, 1.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x00), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x7f, 0x00, 0x00, 0x00), { 127.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x80, 0x00, 0x00, 0x00), {-128.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x7f, 0x00, 0x00), { 0.0, 127.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x80, 0x00, 0x00), { 0.0, -128.0, 0.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x7f, 0x00), { 0.0, 0.0, 127.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x80, 0x00), { 0.0, 0.0, -128.0, 0.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x7f), { 0.0, 0.0, 0.0, 127.0}},
{PIPE_FORMAT_R8G8B8A8_SSCALED, PACKED_4x8(0xff, 0xff, 0xff, 0xff), PACKED_4x8(0x00, 0x00, 0x00, 0x80), { 0.0, 0.0, 0.0, -128.0}},
/*
* Standard 16-bit integer formats
*/
{PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16_UNORM, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_UNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), {1.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R16G16B16_UNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16A16_UNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16_USCALED, PACKED_1x16(0xffff), PACKED_1x16(0xffff), {65535.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0x0000), {65535.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0xffff), { 0.0, 65535.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_USCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0xffff, 0xffff), {65535.0, 65535.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0x0000, 0x0000), {65535.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0xffff, 0x0000), { 0.0, 65535.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0xffff), { 0.0, 0.0, 65535.0, 1.0}},
{PIPE_FORMAT_R16G16B16_USCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0xffff, 0xffff, 0xffff), {65535.0, 65535.0, 65535.0, 1.0}},
{PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0x0000, 0x0000, 0x0000), {65535.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0xffff, 0x0000, 0x0000), { 0.0, 65535.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0xffff, 0x0000), { 0.0, 0.0, 65535.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0xffff), { 0.0, 0.0, 0.0, 65535.0}},
{PIPE_FORMAT_R16G16B16A16_USCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), {65535.0, 65535.0, 65535.0, 65535.0}},
{PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16_SNORM, PACKED_1x16(0xffff), PACKED_1x16(0x8001), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8001, 0x0000), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SNORM, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8001), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8001, 0x0000, 0x0000), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8001, 0x0000), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), { 0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SNORM, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8001), { 0.0, 0.0, -1.0, 1.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), { 1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8001, 0x0000, 0x0000, 0x0000), { -1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), { 0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8001, 0x0000, 0x0000), { 0.0, -1.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), { 0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8001, 0x0000), { 0.0, 0.0, -1.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16A16_SNORM, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8001), { 0.0, 0.0, 0.0, -1.0}},
{PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x7fff), { 32767.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16_SSCALED, PACKED_1x16(0xffff), PACKED_1x16(0x8000), {-32768.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x7fff, 0x0000), { 32767.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x8000, 0x0000), {-32768.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x7fff), { 0.0, 32767.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16_SSCALED, PACKED_2x16(0xffff, 0xffff), PACKED_2x16(0x0000, 0x8000), { 0.0, -32768.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x7fff, 0x0000, 0x0000), { 32767.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x8000, 0x0000, 0x0000), {-32768.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x7fff, 0x0000), { 0.0, 32767.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x8000, 0x0000), { 0.0, -32768.0, 0.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x7fff), { 0.0, 0.0, 32767.0, 1.0}},
{PIPE_FORMAT_R16G16B16_SSCALED, PACKED_3x16(0xffff, 0xffff, 0xffff), PACKED_3x16(0x0000, 0x0000, 0x8000), { 0.0, 0.0, -32768.0, 1.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x0000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x7fff, 0x0000, 0x0000, 0x0000), { 32767.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x8000, 0x0000, 0x0000, 0x0000), {-32768.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x7fff, 0x0000, 0x0000), { 0.0, 32767.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x8000, 0x0000, 0x0000), { 0.0, -32768.0, 0.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x7fff, 0x0000), { 0.0, 0.0, 32767.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x8000, 0x0000), { 0.0, 0.0, -32768.0, 0.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x7fff), { 0.0, 0.0, 0.0, 32767.0}},
{PIPE_FORMAT_R16G16B16A16_SSCALED, PACKED_4x16(0xffff, 0xffff, 0xffff, 0xffff), PACKED_4x16(0x0000, 0x0000, 0x0000, 0x8000), { 0.0, 0.0, 0.0, -32768.0}},
/*
* Standard 32-bit integer formats
*
* NOTE: We can't accurately represent integers larger than +/-0x1000000
* with single precision floats, so that's as far as we test.
*/
{PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_UNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0xffffffff), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0x00000000), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xffffffff), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_UNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xffffffff, 0xffffffff), {1.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0x00000000, 0x00000000), {1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xffffffff, 0x00000000), {0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xffffffff), {0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R32G32B32_UNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), {0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0x00000000, 0x00000000, 0x00000000), {1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xffffffff, 0x00000000, 0x00000000), {0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xffffffff, 0x00000000), {0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xffffffff), {0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_UNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), {1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_USCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), {16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), {16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), { 0.0, 16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_USCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x01000000), {16777216.0, 16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), {16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), { 0.0, 16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), { 0.0, 0.0, 16777216.0, 1.0}},
{PIPE_FORMAT_R32G32B32_USCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x01000000, 0x01000000), {16777216.0, 16777216.0, 16777216.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), {16777216.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), { 0.0, 16777216.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), { 0.0, 0.0, 16777216.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), { 0.0, 0.0, 0.0, 16777216.0}},
{PIPE_FORMAT_R32G32B32A32_USCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x01000000, 0x01000000, 0x01000000), {16777216.0, 16777216.0, 16777216.0, 16777216.0}},
{PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x7fffffff), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_SNORM, PACKED_1x32(0xffffffff), PACKED_1x32(0x80000001), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x7fffffff, 0x00000000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x80000001, 0x00000000), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x7fffffff), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SNORM, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x80000001), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x7fffffff, 0x00000000, 0x00000000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x80000001, 0x00000000, 0x00000000), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x7fffffff, 0x00000000), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x80000001, 0x00000000), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x7fffffff), { 0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SNORM, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x80000001), { 0.0, 0.0, -1.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x7fffffff, 0x00000000, 0x00000000, 0x00000000), { 1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x80000001, 0x00000000, 0x00000000, 0x00000000), { -1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x7fffffff, 0x00000000, 0x00000000), { 0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x80000001, 0x00000000, 0x00000000), { 0.0, -1.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x7fffffff, 0x00000000), { 0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x80000001, 0x00000000), { 0.0, 0.0, -1.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x7fffffff), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_SNORM, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x80000001), { 0.0, 0.0, 0.0, -1.0}},
{PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0x01000000), { 16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_SSCALED, PACKED_1x32(0xffffffff), PACKED_1x32(0xff000000), {-16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x01000000, 0x00000000), { 16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xff000000, 0x00000000), {-16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x01000000), { 0.0, 16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_SSCALED, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xff000000), { 0.0, -16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x01000000, 0x00000000, 0x00000000), { 16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xff000000, 0x00000000, 0x00000000), {-16777216.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x01000000, 0x00000000), { 0.0, 16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xff000000, 0x00000000), { 0.0, -16777216.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x01000000), { 0.0, 0.0, 16777216.0, 1.0}},
{PIPE_FORMAT_R32G32B32_SSCALED, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xff000000), { 0.0, 0.0, -16777216.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x01000000, 0x00000000, 0x00000000, 0x00000000), { 16777216.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xff000000, 0x00000000, 0x00000000, 0x00000000), {-16777216.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x01000000, 0x00000000, 0x00000000), { 0.0, 16777216.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xff000000, 0x00000000, 0x00000000), { 0.0, -16777216.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x01000000, 0x00000000), { 0.0, 0.0, 16777216.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xff000000, 0x00000000), { 0.0, 0.0, -16777216.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x01000000), { 0.0, 0.0, 0.0, 16777216.0}},
{PIPE_FORMAT_R32G32B32A32_SSCALED, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xff000000), { 0.0, 0.0, 0.0, -16777216.0}},
/*
* Standard 32-bit float formats
*/
{PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0x3f800000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32_FLOAT, PACKED_1x32(0xffffffff), PACKED_1x32(0xbf800000), { -1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x00000000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0xbf800000, 0x00000000), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0x3f800000), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x00000000, 0xbf800000), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32_FLOAT, PACKED_2x32(0xffffffff, 0xffffffff), PACKED_2x32(0x3f800000, 0x3f800000), { 1.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x00000000, 0x00000000), { 1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0xbf800000, 0x00000000, 0x00000000), {-1.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x3f800000, 0x00000000), { 0.0, 1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0xbf800000, 0x00000000), { 0.0, -1.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0x3f800000), { 0.0, 0.0, 1.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x00000000, 0x00000000, 0xbf800000), { 0.0, 0.0, -1.0, 1.0}},
{PIPE_FORMAT_R32G32B32_FLOAT, PACKED_3x32(0xffffffff, 0xffffffff, 0xffffffff), PACKED_3x32(0x3f800000, 0x3f800000, 0x3f800000), { 1.0, 1.0, 1.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x00000000), { 0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x00000000, 0x00000000, 0x00000000), { 1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0xbf800000, 0x00000000, 0x00000000, 0x00000000), {-1.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x3f800000, 0x00000000, 0x00000000), { 0.0, 1.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0xbf800000, 0x00000000, 0x00000000), { 0.0, -1.0, 0.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x3f800000, 0x00000000), { 0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0xbf800000, 0x00000000), { 0.0, 0.0, -1.0, 0.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0x3f800000), { 0.0, 0.0, 0.0, 1.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x00000000, 0x00000000, 0x00000000, 0xbf800000), { 0.0, 0.0, 0.0, -1.0}},
{PIPE_FORMAT_R32G32B32A32_FLOAT, PACKED_4x32(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), PACKED_4x32(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000), { 1.0, 1.0, 1.0, 1.0}},
};
const unsigned util_format_nr_test_cases = Elements(util_format_test_cases);

View file

@ -0,0 +1,69 @@
/**************************************************************************
*
* Copyright 2010 VMware, Inc.
* All Rights Reserved.
*
* 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, sub license, 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 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
**************************************************************************/
#ifndef U_FORMAT_TESTS_H_
#define U_FORMAT_TESTS_H_
#include "pipe/p_compiler.h"
#include "pipe/p_format.h"
#define UTIL_FORMAT_MAX_PACKED_BYTES 16
/**
* A (packed, unpacked) color pair.
*/
struct util_format_test_case
{
enum pipe_format format;
/**
* Mask of the bits that actually meaningful data. Used to mask out the
* "X" channels.
*/
uint8_t mask[UTIL_FORMAT_MAX_PACKED_BYTES];
uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES];
/**
* RGBA.
*/
double unpacked[4];
};
extern const struct util_format_test_case
util_format_test_cases[];
extern const unsigned util_format_nr_test_cases;
#endif /* U_FORMAT_TESTS_H_ */

View file

@ -59,22 +59,7 @@ pass_user_buffer_create(struct pipe_screen *screen,
return buffer;
}
static struct pipe_buffer *
pass_surface_buffer_create(struct pipe_screen *screen,
unsigned width, unsigned height,
enum pipe_format format,
unsigned usage,
unsigned tex_usage,
unsigned *stride)
{
struct pipe_buffer *buffer =
screen->winsys->surface_buffer_create(screen->winsys, width, height,
format, usage, tex_usage, stride);
buffer->screen = screen;
return buffer;
}
static void *
pass_buffer_map(struct pipe_screen *screen,
@ -135,7 +120,6 @@ u_simple_screen_init(struct pipe_screen *screen)
{
screen->buffer_create = pass_buffer_create;
screen->user_buffer_create = pass_user_buffer_create;
screen->surface_buffer_create = pass_surface_buffer_create;
screen->buffer_map = pass_buffer_map;
screen->buffer_unmap = pass_buffer_unmap;

View file

@ -13,38 +13,97 @@ Members
-------
wrap_s
How to wrap the S coordinate. One of PIPE_TEX_WRAP.
How to wrap the S coordinate. One of PIPE_TEX_WRAP_*.
wrap_t
How to wrap the T coordinate. One of PIPE_TEX_WRAP.
How to wrap the T coordinate. One of PIPE_TEX_WRAP_*.
wrap_r
How to wrap the R coordinate. One of PIPE_TEX_WRAP.
How to wrap the R coordinate. One of PIPE_TEX_WRAP_*.
The wrap modes are:
* ``PIPE_TEX_WRAP_REPEAT``: Standard coord repeat/wrap-around mode.
* ``PIPE_TEX_WRAP_CLAMP_TO_EDGE``: Clamp coord to edge of texture, the border
color is never sampled.
* ``PIPE_TEX_WRAP_CLAMP_TO_BORDER``: Clamp coord to border of texture, the
border color is sampled when coords go outside the range [0,1].
* ``PIPE_TEX_WRAP_CLAMP``: The coord is clamped to the range [0,1] before
scaling to the texture size. This corresponds to the legacy OpenGL GL_CLAMP
texture wrap mode. Historically, this mode hasn't acted consistantly across
all graphics hardware. It sometimes acts like CLAMP_TO_EDGE or
CLAMP_TO_BORDER. The behaviour may also vary depending on linear vs.
nearest sampling mode.
* ``PIPE_TEX_WRAP_MIRROR_REPEAT``: If the integer part of the coordinate
is odd, the coord becomes (1 - coord). Then, normal texture REPEAT is
applied to the coord.
* ``PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE``: First, the absolute value of the
coordinate is computed. Then, regular CLAMP_TO_EDGE is applied to the coord.
* ``PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER``: First, the absolute value of the
coordinate is computed. Then, regular CLAMP_TO_BORDER is applied to the
coord.
* ``PIPE_TEX_WRAP_MIRROR_CLAMP``: First, the absolute value of the coord is
computed. Then, regular CLAMP is applied to the coord.
min_img_filter
The filter to use when minifying texels. One of PIPE_TEX_FILTER.
The image filter to use when minifying texels. One of PIPE_TEX_FILTER_*.
mag_img_filter
The image filter to use when magnifying texels. One of PIPE_TEX_FILTER_*.
The texture image filter modes are:
* ``PIPE_TEX_FILTER_NEAREST``: One texel is fetched from the texture image
at the texture coordinate.
* ``PIPE_TEX_FILTER_LINEAR``: Two, four or eight texels (depending on the
texture dimensions; 1D/2D/3D) are fetched from the texture image and
linearly weighted and blended together.
min_mip_filter
The filter to use when minifying mipmapped textures. One of
PIPE_TEX_FILTER.
mag_img_filter
The filter to use when magnifying texels. One of PIPE_TEX_FILTER.
PIPE_TEX_MIPFILTER_*.
The texture mip filter modes are:
* ``PIPE_TEX_MIPFILTER_NEAREST``: A single mipmap level/image is selected
according to the texture LOD (lambda) value.
* ``PIPE_TEX_MIPFILTER_LINEAR``: The two mipmap levels/images above/below
the texture LOD value are sampled from. The results of sampling from
those two images are blended together with linear interpolation.
* ``PIPE_TEX_MIPFILTER_NONE``: Mipmap filtering is disabled. All texels
are taken from the level 0 image.
compare_mode
If set to PIPE_TEX_COMPARE_R_TO_TEXTURE, texture output is computed
according to compare_func, using r coord and the texture value as operands.
If set to PIPE_TEX_COMPARE_R_TO_TEXTURE, the result of texture sampling
is not a color but a true/false value which is the result of comparing the
sampled texture value (typically a Z value from a depth texture) to the
texture coordinate's R component.
If set to PIPE_TEX_COMPARE_NONE, no comparison calculation is performed.
compare_func
How the comparison is computed. One of PIPE_FUNC.
The inequality operator used when compare_mode=1. One of PIPE_FUNC_x.
normalized_coords
Whether the texture coordinates are normalized. If normalized, they will
always be in [0, 1]. If not, they will be in the range of each dimension
of the loaded texture.
If set, the incoming texture coordinates (nominally in the range [0,1])
will be scaled by the texture width, height, depth to compute texel
addresses. Otherwise, the texture coords are used as-is (they are not
scaled by the texture dimensions).
When normalized_coords=0, only a subset of the texture wrap modes are
allowed: PIPE_TEX_WRAP_CLAMP, PIPE_TEX_WRAP_CLAMP_TO_EDGE and
PIPE_TEX_WRAP_CLAMP_TO_BORDER.
lod_bias
The bias to apply to the level of detail.
Bias factor which is added to the computed level of detail.
The normal level of detail is computed from the partial derivatives of
the texture coordinates and/or the fragment shader TEX/TXB/TXL
instruction.
min_lod
Minimum level of detail, used to clamp LoD after bias.
Minimum level of detail, used to clamp LOD after bias. The LOD values
correspond to mipmap levels where LOD=0 is the level 0 mipmap image.
max_lod
Maximum level of detail, used to clamp LoD after bias.
Maximum level of detail, used to clamp LOD after bias.
border_color
RGBA color used for out-of-bounds coordinates.
RGBA color used for texel coordinates that are outside the [0,width-1],
[0, height-1] or [0, depth-1] ranges.
max_anisotropy
Maximum filtering to apply anisotropically to textures. Setting this to
0 disables anisotropic filtering. Any other setting enables anisotropic
filtering, however it's not unexpected some drivers only will change their
filtering with a setting of 2 and higher.
Maximum anistropy ratio to use when sampling from textures. For example,
if max_anistropy=4, a region of up to 1 by 4 texels will be sampled.
Set to zero to disable anisotropic filtering. Any other setting enables
anisotropic filtering, however it's not unexpected some drivers only will
change their filtering with a setting of 2 and higher.

View file

@ -187,6 +187,9 @@ struct i915_sampler_state {
unsigned maxlod;
};
#define I915_MAX_TEXTURE_2D_LEVELS 11 /* max 1024x1024 */
#define I915_MAX_TEXTURE_3D_LEVELS 8 /* max 128x128x128 */
struct i915_texture {
struct pipe_texture base;
@ -199,7 +202,7 @@ struct i915_texture {
unsigned sw_tiled; /**< tiled with software flags */
unsigned hw_tiled; /**< tiled with hardware fences */
unsigned nr_images[PIPE_MAX_TEXTURE_LEVELS];
unsigned nr_images[I915_MAX_TEXTURE_2D_LEVELS];
/* Explicitly store the offset of each image for each cube face or
* depth value. Pretty much have to accept that hardware formats
@ -207,7 +210,7 @@ struct i915_texture {
* compute the offsets of depth/cube images within a mipmap level,
* so have to store them as a lookup table:
*/
unsigned *image_offset[PIPE_MAX_TEXTURE_LEVELS]; /**< array [depth] of offsets */
unsigned *image_offset[I915_MAX_TEXTURE_2D_LEVELS]; /**< array [depth] of offsets */
/* The data is held here:
*/

View file

@ -116,11 +116,11 @@ i915_get_param(struct pipe_screen *screen, int param)
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return 11; /* max 1024x1024 */
return I915_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return 8; /* max 128x128x128 */
return I915_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return 11; /* max 1024x1024 */
return I915_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 1;

View file

@ -96,7 +96,7 @@ i915_miptree_set_level_info(struct i915_texture *tex,
unsigned nr_images,
unsigned w, unsigned h, unsigned d)
{
assert(level < PIPE_MAX_TEXTURE_LEVELS);
assert(level < Elements(tex->nr_images));
tex->nr_images[level] = nr_images;
@ -219,12 +219,12 @@ i915_miptree_layout_2d(struct i915_texture *tex)
unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->width0);
/* used for scanouts that need special layouts */
if (pt->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
if (pt->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT)
if (i915_scanout_layout(tex))
return;
/* for shared buffers we use something very like scanout */
if (pt->tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET)
/* shared buffers needs to be compatible with X servers */
if (pt->tex_usage & PIPE_TEXTURE_USAGE_SHARED)
if (i915_display_target_layout(tex))
return;
@ -369,12 +369,12 @@ i945_miptree_layout_2d(struct i915_texture *tex)
unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->height0);
/* used for scanouts that need special layouts */
if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_SCANOUT)
if (i915_scanout_layout(tex))
return;
/* for shared buffers we use some very like scanout */
if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET)
/* shared buffers needs to be compatible with X servers */
if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_SHARED)
if (i915_display_target_layout(tex))
return;
@ -642,7 +642,7 @@ i915_texture_create(struct pipe_screen *screen,
/* for scanouts and cursors, cursors arn't scanouts */
if (templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY && templat->width0 != 64)
if (templat->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT && templat->width0 != 64)
buf_usage = INTEL_NEW_SCANOUT;
else
buf_usage = INTEL_NEW_TEXTURE;
@ -673,19 +673,24 @@ fail:
}
static struct pipe_texture *
i915_texture_blanket(struct pipe_screen * screen,
const struct pipe_texture *base,
const unsigned *stride,
struct pipe_buffer *buffer)
i915_texture_from_handle(struct pipe_screen * screen,
const struct pipe_texture *templat,
struct winsys_handle *whandle)
{
#if 0
struct i915_screen *is = i915_screen(screen);
struct i915_texture *tex;
struct intel_winsys *iws = is->iws;
struct intel_buffer *buffer;
unsigned stride;
assert(screen);
buffer = iws->buffer_from_handle(iws, whandle, &stride);
/* Only supports one type */
if (base->target != PIPE_TEXTURE_2D ||
base->last_level != 0 ||
base->depth0 != 1) {
if (templat->target != PIPE_TEXTURE_2D ||
templat->last_level != 0 ||
templat->depth0 != 1) {
return NULL;
}
@ -693,23 +698,33 @@ i915_texture_blanket(struct pipe_screen * screen,
if (!tex)
return NULL;
tex->base = *base;
tex->base = *templat;
pipe_reference_init(&tex->base.reference, 1);
tex->base.screen = screen;
tex->stride = stride[0];
tex->stride = stride;
i915_miptree_set_level_info(tex, 0, 1, base->width0, base->height0, 1);
i915_miptree_set_level_info(tex, 0, 1, templat->width0, templat->height0, 1);
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
pipe_buffer_reference(&tex->buffer, buffer);
tex->buffer = buffer;
return &tex->base;
#else
return NULL;
#endif
}
static boolean
i915_texture_get_handle(struct pipe_screen * screen,
struct pipe_texture *texture,
struct winsys_handle *whandle)
{
struct i915_screen *is = i915_screen(screen);
struct i915_texture *tex = (struct i915_texture *)texture;
struct intel_winsys *iws = is->iws;
return iws->buffer_get_handle(iws, tex->buffer, whandle, tex->stride);
}
static void
i915_texture_destroy(struct pipe_texture *pt)
{
@ -723,7 +738,7 @@ i915_texture_destroy(struct pipe_texture *pt)
iws->buffer_destroy(iws, tex->buffer);
for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
for (i = 0; i < Elements(tex->image_offset); i++)
if (tex->image_offset[i])
FREE(tex->image_offset[i]);
@ -869,7 +884,8 @@ void
i915_init_screen_texture_functions(struct i915_screen *is)
{
is->base.texture_create = i915_texture_create;
is->base.texture_blanket = i915_texture_blanket;
is->base.texture_from_handle = i915_texture_from_handle;
is->base.texture_get_handle = i915_texture_get_handle;
is->base.texture_destroy = i915_texture_destroy;
is->base.get_tex_surface = i915_get_tex_surface;
is->base.tex_surface_destroy = i915_tex_surface_destroy;
@ -878,53 +894,3 @@ i915_init_screen_texture_functions(struct i915_screen *is)
is->base.transfer_unmap = i915_transfer_unmap;
is->base.tex_transfer_destroy = i915_tex_transfer_destroy;
}
struct pipe_texture *
i915_texture_blanket_intel(struct pipe_screen *screen,
struct pipe_texture *base,
unsigned stride,
struct intel_buffer *buffer)
{
struct i915_texture *tex;
assert(screen);
/* Only supports one type */
if (base->target != PIPE_TEXTURE_2D ||
base->last_level != 0 ||
base->depth0 != 1) {
return NULL;
}
tex = CALLOC_STRUCT(i915_texture);
if (!tex)
return NULL;
tex->base = *base;
pipe_reference_init(&tex->base.reference, 1);
tex->base.screen = screen;
tex->stride = stride;
i915_miptree_set_level_info(tex, 0, 1, base->width0, base->height0, 1);
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
tex->buffer = buffer;
return &tex->base;
}
boolean
i915_get_texture_buffer_intel(struct pipe_texture *texture,
struct intel_buffer **buffer,
unsigned *stride)
{
struct i915_texture *tex = (struct i915_texture *)texture;
if (!texture)
return FALSE;
*stride = tex->stride;
*buffer = tex->buffer;
return TRUE;
}

View file

@ -33,6 +33,7 @@ struct intel_buffer;
struct intel_batchbuffer;
struct pipe_texture;
struct pipe_fence_handle;
struct winsys_handle;
enum intel_buffer_usage
{
@ -128,6 +129,25 @@ struct intel_winsys {
unsigned size, unsigned alignment,
enum intel_buffer_type type);
/**
* Creates a buffer from a handle.
* Used to implement pipe_screen::texture_from_handle.
* Also provides the stride information needed for the
* texture via the stride argument.
*/
struct intel_buffer *(*buffer_from_handle)(struct intel_winsys *iws,
struct winsys_handle *whandle,
unsigned *stride);
/**
* Used to implement pipe_screen::texture_get_handle.
* The winsys might need the stride information.
*/
boolean (*buffer_get_handle)(struct intel_winsys *iws,
struct intel_buffer *buffer,
struct winsys_handle *whandle,
unsigned stride);
/**
* Fence a buffer with a fence reg.
* Not to be confused with pipe_fence_handle.
@ -204,23 +224,4 @@ struct intel_winsys {
struct pipe_screen *i915_create_screen(struct intel_winsys *iws, unsigned pci_id);
/**
* Get the intel_winsys buffer backing the texture.
*
* TODO UGLY
*/
boolean i915_get_texture_buffer_intel(struct pipe_texture *texture,
struct intel_buffer **buffer,
unsigned *stride);
/**
* Wrap a intel_winsys buffer with a texture blanket.
*
* TODO UGLY
*/
struct pipe_texture * i915_texture_blanket_intel(struct pipe_screen *screen,
struct pipe_texture *tmplt,
unsigned pitch,
struct intel_buffer *buffer);
#endif

View file

@ -174,11 +174,11 @@ brw_get_param(struct pipe_screen *screen, int param)
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return 11; /* max 1024x1024 */
return BRW_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return 8; /* max 128x128x128 */
return BRW_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return 11; /* max 1024x1024 */
return BRW_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 1;

View file

@ -100,6 +100,9 @@ struct brw_surface
};
#define BRW_MAX_TEXTURE_2D_LEVELS 11 /* max 1024x1024 */
#define BRW_MAX_TEXTURE_3D_LEVELS 8 /* max 128x128x128 */
struct brw_texture
{
@ -107,9 +110,9 @@ struct brw_texture
struct brw_winsys_buffer *bo;
struct brw_surface_state ss;
unsigned *image_offset[PIPE_MAX_TEXTURE_LEVELS];
unsigned nr_images[PIPE_MAX_TEXTURE_LEVELS];
unsigned level_offset[PIPE_MAX_TEXTURE_LEVELS];
unsigned *image_offset[BRW_MAX_TEXTURE_2D_LEVELS];
unsigned nr_images[BRW_MAX_TEXTURE_2D_LEVELS];
unsigned level_offset[BRW_MAX_TEXTURE_2D_LEVELS];
boolean compressed;
unsigned brw_target;

View file

@ -231,8 +231,8 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen,
goto fail;
if (templ->tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_PRIMARY)) {
if (templ->tex_usage & (PIPE_TEXTURE_USAGE_SCANOUT |
PIPE_TEXTURE_USAGE_SHARED)) {
buffer_type = BRW_BUFFER_TYPE_SCANOUT;
}
else {
@ -303,14 +303,121 @@ fail:
return NULL;
}
static struct pipe_texture *brw_texture_blanket(struct pipe_screen *screen,
const struct pipe_texture *templ,
const unsigned *stride,
struct pipe_buffer *buffer)
static struct pipe_texture *
brw_texture_from_handle(struct pipe_screen *screen,
const struct pipe_texture *templ,
struct winsys_handle *whandle)
{
struct brw_screen *bscreen = brw_screen(screen);
struct brw_texture *tex;
struct brw_winsys_buffer *buffer;
unsigned tiling;
unsigned pitch;
if (templ->target != PIPE_TEXTURE_2D ||
templ->last_level != 0 ||
templ->depth0 != 1)
return NULL;
if (util_format_is_compressed(templ->format))
return NULL;
tex = CALLOC_STRUCT(brw_texture);
if (!tex)
return NULL;
if (bscreen->sws->bo_from_handle(bscreen->sws, whandle, &pitch, &tiling, &buffer) != PIPE_OK)
goto fail;
memcpy(&tex->base, templ, sizeof *templ);
pipe_reference_init(&tex->base.reference, 1);
tex->base.screen = screen;
/* XXX: cpp vs. blocksize
*/
tex->cpp = util_format_get_blocksize(tex->base.format);
tex->tiling = tiling;
make_empty_list(&tex->views[0]);
make_empty_list(&tex->views[1]);
if (!brw_texture_layout(bscreen, tex))
goto fail;
/* XXX Maybe some more checks? */
if ((pitch / tex->cpp) < tex->pitch)
goto fail;
tex->pitch = pitch / tex->cpp;
tex->bo = buffer;
/* fix this warning */
#if 0
if (tex->size > buffer->size)
goto fail;
#endif
tex->ss.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
tex->ss.ss0.surface_type = translate_tex_target(tex->base.target);
tex->ss.ss0.surface_format = translate_tex_format(tex->base.format);
assert(tex->ss.ss0.surface_format != BRW_SURFACEFORMAT_INVALID);
/* This is ok for all textures with channel width 8bit or less:
*/
/* tex->ss.ss0.data_return_format = BRW_SURFACERETURNFORMAT_S1; */
/* XXX: what happens when tex->bo->offset changes???
*/
tex->ss.ss1.base_addr = 0; /* reloc */
tex->ss.ss2.mip_count = tex->base.last_level;
tex->ss.ss2.width = tex->base.width0 - 1;
tex->ss.ss2.height = tex->base.height0 - 1;
switch (tex->tiling) {
case BRW_TILING_NONE:
tex->ss.ss3.tiled_surface = 0;
tex->ss.ss3.tile_walk = 0;
break;
case BRW_TILING_X:
tex->ss.ss3.tiled_surface = 1;
tex->ss.ss3.tile_walk = BRW_TILEWALK_XMAJOR;
break;
case BRW_TILING_Y:
tex->ss.ss3.tiled_surface = 1;
tex->ss.ss3.tile_walk = BRW_TILEWALK_YMAJOR;
break;
}
tex->ss.ss3.pitch = (tex->pitch * tex->cpp) - 1;
tex->ss.ss3.depth = tex->base.depth0 - 1;
tex->ss.ss4.min_lod = 0;
return &tex->base;
fail:
FREE(tex);
return NULL;
}
static boolean
brw_texture_get_handle(struct pipe_screen *screen,
struct pipe_texture *texture,
struct winsys_handle *whandle)
{
struct brw_screen *bscreen = brw_screen(screen);
struct brw_texture *tex = brw_texture(texture);
unsigned stride;
stride = tex->pitch * tex->cpp;
return bscreen->sws->bo_get_handle(tex->bo, whandle, stride);
}
static void brw_texture_destroy(struct pipe_texture *pt)
{
struct brw_texture *tex = brw_texture(pt);
@ -451,127 +558,13 @@ brw_tex_transfer_destroy(struct pipe_transfer *trans)
}
/*
* Functions exported to the winsys
*/
boolean brw_texture_get_winsys_buffer(struct pipe_texture *texture,
struct brw_winsys_buffer **buffer,
unsigned *stride)
{
struct brw_texture *tex = brw_texture(texture);
*buffer = tex->bo;
if (stride)
*stride = tex->pitch * tex->cpp;
return TRUE;
}
struct pipe_texture *
brw_texture_blanket_winsys_buffer(struct pipe_screen *screen,
const struct pipe_texture *templ,
unsigned pitch,
unsigned tiling,
struct brw_winsys_buffer *buffer)
{
struct brw_screen *bscreen = brw_screen(screen);
struct brw_texture *tex;
GLuint format;
if (templ->target != PIPE_TEXTURE_2D ||
templ->last_level != 0 ||
templ->depth0 != 1)
return NULL;
if (util_format_is_compressed(templ->format))
return NULL;
tex = CALLOC_STRUCT(brw_texture);
if (!tex)
return NULL;
memcpy(&tex->base, templ, sizeof *templ);
pipe_reference_init(&tex->base.reference, 1);
tex->base.screen = screen;
/* XXX: cpp vs. blocksize
*/
tex->cpp = util_format_get_blocksize(tex->base.format);
tex->tiling = tiling;
make_empty_list(&tex->views[0]);
make_empty_list(&tex->views[1]);
if (!brw_texture_layout(bscreen, tex))
goto fail;
/* XXX Maybe some more checks? */
if ((pitch / tex->cpp) < tex->pitch)
goto fail;
tex->pitch = pitch / tex->cpp;
tex->bo = buffer;
/* fix this warning */
#if 0
if (tex->size > buffer->size)
goto fail;
#endif
tex->ss.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
tex->ss.ss0.surface_type = translate_tex_target(tex->base.target);
format = translate_tex_format(tex->base.format);
assert(format != BRW_SURFACEFORMAT_INVALID);
tex->ss.ss0.surface_format = format;
/* This is ok for all textures with channel width 8bit or less:
*/
/* tex->ss.ss0.data_return_format = BRW_SURFACERETURNFORMAT_S1; */
/* XXX: what happens when tex->bo->offset changes???
*/
tex->ss.ss1.base_addr = 0; /* reloc */
tex->ss.ss2.mip_count = tex->base.last_level;
tex->ss.ss2.width = tex->base.width0 - 1;
tex->ss.ss2.height = tex->base.height0 - 1;
switch (tex->tiling) {
case BRW_TILING_NONE:
tex->ss.ss3.tiled_surface = 0;
tex->ss.ss3.tile_walk = 0;
break;
case BRW_TILING_X:
tex->ss.ss3.tiled_surface = 1;
tex->ss.ss3.tile_walk = BRW_TILEWALK_XMAJOR;
break;
case BRW_TILING_Y:
tex->ss.ss3.tiled_surface = 1;
tex->ss.ss3.tile_walk = BRW_TILEWALK_YMAJOR;
break;
}
tex->ss.ss3.pitch = (tex->pitch * tex->cpp) - 1;
tex->ss.ss3.depth = tex->base.depth0 - 1;
tex->ss.ss4.min_lod = 0;
return &tex->base;
fail:
FREE(tex);
return NULL;
}
void brw_screen_tex_init( struct brw_screen *brw_screen )
{
brw_screen->base.is_format_supported = brw_is_format_supported;
brw_screen->base.texture_create = brw_texture_create;
brw_screen->base.texture_from_handle = brw_texture_from_handle;
brw_screen->base.texture_get_handle = brw_texture_get_handle;
brw_screen->base.texture_destroy = brw_texture_destroy;
brw_screen->base.texture_blanket = brw_texture_blanket;
brw_screen->base.get_tex_transfer = brw_get_tex_transfer;
brw_screen->base.transfer_map = brw_transfer_map;
brw_screen->base.transfer_unmap = brw_transfer_unmap;

View file

@ -162,6 +162,16 @@ struct brw_winsys_screen {
unsigned alignment,
struct brw_winsys_buffer **bo_out);
enum pipe_error (*bo_from_handle)(struct brw_winsys_screen *sws,
struct winsys_handle *whandle,
unsigned *stride,
unsigned *tiling,
struct brw_winsys_buffer **bo_out);
enum pipe_error (*bo_get_handle)(struct brw_winsys_buffer *buffer,
struct winsys_handle *whandle,
unsigned stride);
/* Destroy a buffer when our refcount goes to zero:
*/
void (*bo_destroy)(struct brw_winsys_buffer *buffer);
@ -257,28 +267,6 @@ bo_reference(struct brw_winsys_buffer **ptr, struct brw_winsys_buffer *buf)
struct pipe_screen *brw_create_screen(struct brw_winsys_screen *iws, unsigned pci_id);
/**
* Get the brw_winsys buffer backing the texture.
*
* TODO UGLY
*/
struct pipe_texture;
boolean brw_texture_get_winsys_buffer(struct pipe_texture *texture,
struct brw_winsys_buffer **buffer,
unsigned *stride);
/**
* Wrap a brw_winsys buffer with a texture blanket.
*
* TODO UGLY
*/
struct pipe_texture *
brw_texture_blanket_winsys_buffer(struct pipe_screen *screen,
const struct pipe_texture *template,
unsigned pitch,
unsigned tiling,
struct brw_winsys_buffer *buffer);
/*************************************************************************
* Cooperative dumping between winsys and driver. TODO: make this

View file

@ -63,62 +63,6 @@ identity_drm_create_screen(struct drm_api *_api, int fd,
return identity_screen_create(screen);
}
static struct pipe_texture *
identity_drm_texture_from_shared_handle(struct drm_api *_api,
struct pipe_screen *_screen,
struct pipe_texture *templ,
const char *name,
unsigned stride,
unsigned handle)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct identity_drm_api *id_api = identity_drm_api(_api);
struct pipe_screen *screen = id_screen->screen;
struct drm_api *api = id_api->api;
struct pipe_texture *result;
result = api->texture_from_shared_handle(api, screen, templ, name, stride, handle);
result = identity_texture_create(identity_screen(_screen), result);
return result;
}
static boolean
identity_drm_shared_handle_from_texture(struct drm_api *_api,
struct pipe_screen *_screen,
struct pipe_texture *_texture,
unsigned *stride,
unsigned *handle)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct identity_texture *id_texture = identity_texture(_texture);
struct identity_drm_api *id_api = identity_drm_api(_api);
struct pipe_screen *screen = id_screen->screen;
struct pipe_texture *texture = id_texture->texture;
struct drm_api *api = id_api->api;
return api->shared_handle_from_texture(api, screen, texture, stride, handle);
}
static boolean
identity_drm_local_handle_from_texture(struct drm_api *_api,
struct pipe_screen *_screen,
struct pipe_texture *_texture,
unsigned *stride,
unsigned *handle)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct identity_texture *id_texture = identity_texture(_texture);
struct identity_drm_api *id_api = identity_drm_api(_api);
struct pipe_screen *screen = id_screen->screen;
struct pipe_texture *texture = id_texture->texture;
struct drm_api *api = id_api->api;
return api->local_handle_from_texture(api, screen, texture, stride, handle);
}
static void
identity_drm_destroy(struct drm_api *_api)
{
@ -145,9 +89,6 @@ identity_drm_create(struct drm_api *api)
id_api->base.name = api->name;
id_api->base.driver_name = api->driver_name;
id_api->base.create_screen = identity_drm_create_screen;
id_api->base.texture_from_shared_handle = identity_drm_texture_from_shared_handle;
id_api->base.shared_handle_from_texture = identity_drm_shared_handle_from_texture;
id_api->base.local_handle_from_texture = identity_drm_local_handle_from_texture;
id_api->base.destroy = identity_drm_destroy;
id_api->api = api;

View file

@ -135,27 +135,40 @@ identity_screen_texture_create(struct pipe_screen *_screen,
}
static struct pipe_texture *
identity_screen_texture_blanket(struct pipe_screen *_screen,
const struct pipe_texture *templat,
const unsigned *stride,
struct pipe_buffer *_buffer)
identity_screen_texture_from_handle(struct pipe_screen *_screen,
const struct pipe_texture *templ,
struct winsys_handle *handle)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct identity_buffer *id_buffer = identity_buffer(_buffer);
struct pipe_screen *screen = id_screen->screen;
struct pipe_buffer *buffer = id_buffer->buffer;
struct pipe_texture *result;
result = screen->texture_blanket(screen,
templat,
stride,
buffer);
/* TODO trace call */
if (result)
return identity_texture_create(id_screen, result);
return NULL;
result = screen->texture_from_handle(screen, templ, handle);
result = identity_texture_create(identity_screen(_screen), result);
return result;
}
static boolean
identity_screen_texture_get_handle(struct pipe_screen *_screen,
struct pipe_texture *_texture,
struct winsys_handle *handle)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct identity_texture *id_texture = identity_texture(_texture);
struct pipe_screen *screen = id_screen->screen;
struct pipe_texture *texture = id_texture->texture;
/* TODO trace call */
return screen->texture_get_handle(screen, texture, handle);
}
static void
identity_screen_texture_destroy(struct pipe_texture *_texture)
{
@ -298,31 +311,6 @@ identity_screen_user_buffer_create(struct pipe_screen *_screen,
return NULL;
}
static struct pipe_buffer *
identity_screen_surface_buffer_create(struct pipe_screen *_screen,
unsigned width,
unsigned height,
enum pipe_format format,
unsigned usage,
unsigned tex_usage,
unsigned *stride)
{
struct identity_screen *id_screen = identity_screen(_screen);
struct pipe_screen *screen = id_screen->screen;
struct pipe_buffer *result;
result = screen->surface_buffer_create(screen,
width,
height,
format,
usage,
tex_usage,
stride);
if (result)
return identity_buffer_create(id_screen, result);
return NULL;
}
static void *
identity_screen_buffer_map(struct pipe_screen *_screen,
@ -495,7 +483,8 @@ identity_screen_create(struct pipe_screen *screen)
id_screen->base.is_format_supported = identity_screen_is_format_supported;
id_screen->base.context_create = identity_screen_context_create;
id_screen->base.texture_create = identity_screen_texture_create;
id_screen->base.texture_blanket = identity_screen_texture_blanket;
id_screen->base.texture_from_handle = identity_screen_texture_from_handle;
id_screen->base.texture_get_handle = identity_screen_texture_get_handle;
id_screen->base.texture_destroy = identity_screen_texture_destroy;
id_screen->base.get_tex_surface = identity_screen_get_tex_surface;
id_screen->base.tex_surface_destroy = identity_screen_tex_surface_destroy;
@ -505,7 +494,6 @@ identity_screen_create(struct pipe_screen *screen)
id_screen->base.transfer_unmap = identity_screen_transfer_unmap;
id_screen->base.buffer_create = identity_screen_buffer_create;
id_screen->base.user_buffer_create = identity_screen_user_buffer_create;
id_screen->base.surface_buffer_create = identity_screen_surface_buffer_create;
if (screen->buffer_map)
id_screen->base.buffer_map = identity_screen_buffer_map;
if (screen->buffer_map_range)

View file

@ -51,12 +51,16 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
/* struct lp_jit_texture */
{
LLVMTypeRef elem_types[4];
LLVMTypeRef elem_types[6];
elem_types[LP_JIT_TEXTURE_WIDTH] = LLVMInt32Type();
elem_types[LP_JIT_TEXTURE_HEIGHT] = LLVMInt32Type();
elem_types[LP_JIT_TEXTURE_DEPTH] = LLVMInt32Type();
elem_types[LP_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32Type();
elem_types[LP_JIT_TEXTURE_STRIDE] = LLVMInt32Type();
elem_types[LP_JIT_TEXTURE_DATA] = LLVMPointerType(LLVMInt8Type(), 0);
elem_types[LP_JIT_TEXTURE_DATA] =
LLVMArrayType(LLVMPointerType(LLVMInt8Type(), 0),
LP_MAX_TEXTURE_2D_LEVELS);
texture_type = LLVMStructType(elem_types, Elements(elem_types), 0);
@ -66,6 +70,12 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, height,
screen->target, texture_type,
LP_JIT_TEXTURE_HEIGHT);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, depth,
screen->target, texture_type,
LP_JIT_TEXTURE_DEPTH);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, last_level,
screen->target, texture_type,
LP_JIT_TEXTURE_LAST_LEVEL);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, stride,
screen->target, texture_type,
LP_JIT_TEXTURE_STRIDE);

View file

@ -39,6 +39,7 @@
#include "gallivm/lp_bld_struct.h"
#include "pipe/p_state.h"
#include "lp_texture.h"
struct llvmpipe_screen;
@ -48,14 +49,18 @@ struct lp_jit_texture
{
uint32_t width;
uint32_t height;
uint32_t depth;
uint32_t last_level;
uint32_t stride;
const void *data;
const void *data[LP_MAX_TEXTURE_2D_LEVELS];
};
enum {
LP_JIT_TEXTURE_WIDTH = 0,
LP_JIT_TEXTURE_HEIGHT,
LP_JIT_TEXTURE_DEPTH,
LP_JIT_TEXTURE_LAST_LEVEL,
LP_JIT_TEXTURE_STRIDE,
LP_JIT_TEXTURE_DATA
};

View file

@ -846,6 +846,12 @@ void lp_rast_destroy( struct lp_rasterizer *rast )
pipe_semaphore_signal(&rast->tasks[i].work_ready);
}
/* Wait for threads to terminate before cleaning up per-thread data */
for (i = 0; i < rast->num_threads; i++) {
pipe_thread_wait(rast->threads[i]);
}
/* Clean up per-thread data */
for (i = 0; i < rast->num_threads; i++) {
pipe_semaphore_destroy(&rast->tasks[i].work_ready);
pipe_semaphore_destroy(&rast->tasks[i].work_done);

View file

@ -108,11 +108,11 @@ llvmpipe_get_param(struct pipe_screen *screen, int param)
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return 13; /* max 4Kx4K */
return LP_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return 9; /* max 256x256x256 */
return LP_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return 13; /* max 4Kx4K */
return LP_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_TGSI_CONT_SUPPORTED:
return 1;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
@ -239,18 +239,6 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
}
static struct pipe_buffer *
llvmpipe_surface_buffer_create(struct pipe_screen *screen,
unsigned width, unsigned height,
enum pipe_format format,
unsigned tex_usage,
unsigned usage,
unsigned *stride)
{
/* This function should never be used */
assert(0);
return NULL;
}
static void
@ -310,7 +298,6 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
screen->base.get_paramf = llvmpipe_get_paramf;
screen->base.is_format_supported = llvmpipe_is_format_supported;
screen->base.surface_buffer_create = llvmpipe_surface_buffer_create;
screen->base.context_create = llvmpipe_create_context;
screen->base.flush_frontbuffer = llvmpipe_flush_frontbuffer;

View file

@ -469,20 +469,28 @@ lp_setup_set_sampler_textures( struct setup_context *setup,
jit_tex = &setup->fs.current.jit_context.textures[i];
jit_tex->width = tex->width0;
jit_tex->height = tex->height0;
jit_tex->depth = tex->depth0;
jit_tex->last_level = tex->last_level;
jit_tex->stride = lp_tex->stride[0];
if(!lp_tex->dt) {
jit_tex->data = lp_tex->data;
if (!lp_tex->dt) {
/* regular texture - setup array of mipmap level pointers */
int j;
for (j = 0; j < LP_MAX_TEXTURE_2D_LEVELS; j++) {
jit_tex->data[j] =
(ubyte *) lp_tex->data + lp_tex->level_offset[j];
}
}
else {
/* display target texture/surface */
/*
* XXX: Where should this be unmapped?
*/
struct llvmpipe_screen *screen = llvmpipe_screen(tex->screen);
struct sw_winsys *winsys = screen->winsys;
jit_tex->data = winsys->displaytarget_map(winsys, lp_tex->dt,
jit_tex->data[0] = winsys->displaytarget_map(winsys, lp_tex->dt,
PIPE_BUFFER_USAGE_CPU_READ);
assert(jit_tex->data);
assert(jit_tex->data[0]);
}
/* the scene references this texture */

View file

@ -231,57 +231,29 @@ lp_setup_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
break;
case PIPE_PRIM_QUADS:
if (setup->flatshade_first) {
for (i = 3; i < nr; i += 4) {
setup->triangle( setup,
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-3], stride) );
setup->triangle( setup,
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-0], stride),
get_vert(vertex_buffer, indices[i-3], stride) );
}
}
else {
for (i = 3; i < nr; i += 4) {
setup->triangle( setup,
get_vert(vertex_buffer, indices[i-3], stride),
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
for (i = 3; i < nr; i += 4) {
setup->triangle( setup,
get_vert(vertex_buffer, indices[i-3], stride),
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
setup->triangle( setup,
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
}
setup->triangle( setup,
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
}
break;
case PIPE_PRIM_QUAD_STRIP:
if (setup->flatshade_first) {
for (i = 3; i < nr; i += 2) {
setup->triangle( setup,
get_vert(vertex_buffer, indices[i-0], stride),
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-3], stride));
setup->triangle( setup,
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-0], stride),
get_vert(vertex_buffer, indices[i-3], stride) );
}
}
else {
for (i = 3; i < nr; i += 2) {
setup->triangle( setup,
get_vert(vertex_buffer, indices[i-3], stride),
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
setup->triangle( setup,
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-3], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
}
for (i = 3; i < nr; i += 2) {
setup->triangle( setup,
get_vert(vertex_buffer, indices[i-3], stride),
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
setup->triangle( setup,
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-3], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
}
break;
@ -415,57 +387,28 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
break;
case PIPE_PRIM_QUADS:
if (setup->flatshade_first) {
for (i = 3; i < nr; i += 4) {
setup->triangle( setup,
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-3, stride) );
setup->triangle( setup,
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-0, stride),
get_vert(vertex_buffer, i-3, stride) );
}
}
else {
for (i = 3; i < nr; i += 4) {
setup->triangle( setup,
get_vert(vertex_buffer, i-3, stride),
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-0, stride) );
setup->triangle( setup,
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-0, stride) );
}
for (i = 3; i < nr; i += 4) {
setup->triangle( setup,
get_vert(vertex_buffer, i-3, stride),
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-0, stride) );
setup->triangle( setup,
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-0, stride) );
}
break;
case PIPE_PRIM_QUAD_STRIP:
if (setup->flatshade_first) {
for (i = 3; i < nr; i += 2) {
setup->triangle( setup,
get_vert(vertex_buffer, i-0, stride),
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-3, stride) );
setup->triangle( setup,
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-0, stride),
get_vert(vertex_buffer, i-3, stride) );
}
}
else {
for (i = 3; i < nr; i += 2) {
setup->triangle( setup,
get_vert(vertex_buffer, i-3, stride),
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-0, stride) );
setup->triangle( setup,
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-3, stride),
get_vert(vertex_buffer, i-0, stride) );
}
for (i = 3; i < nr; i += 2) {
setup->triangle( setup,
get_vert(vertex_buffer, i-3, stride),
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-0, stride) );
setup->triangle( setup,
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-3, stride),
get_vert(vertex_buffer, i-0, stride) );
}
break;

View file

@ -51,10 +51,11 @@
/**
* This provides the bridge between the sampler state store in lp_jit_context
* and lp_jit_texture and the sampler code generator. It provides the
* texture layout information required by the texture sampler code generator
* in terms of the state stored in lp_jit_context and lp_jit_texture in runtime.
* This provides the bridge between the sampler state store in
* lp_jit_context and lp_jit_texture and the sampler code
* generator. It provides the texture layout information required by
* the texture sampler code generator in terms of the state stored in
* lp_jit_context and lp_jit_texture in runtime.
*/
struct llvmpipe_sampler_dynamic_state
{
@ -79,6 +80,9 @@ struct lp_llvm_sampler_soa
/**
* Fetch the specified member of the lp_jit_texture structure.
* \param emit_load if TRUE, emit the LLVM load instruction to actually
* fetch the field's value. Otherwise, just emit the
* GEP code to address the field.
*
* @sa http://llvm.org/docs/GetElementPtr.html
*/
@ -87,9 +91,11 @@ lp_llvm_texture_member(struct lp_sampler_dynamic_state *base,
LLVMBuilderRef builder,
unsigned unit,
unsigned member_index,
const char *member_name)
const char *member_name,
boolean emit_load)
{
struct llvmpipe_sampler_dynamic_state *state = (struct llvmpipe_sampler_dynamic_state *)base;
struct llvmpipe_sampler_dynamic_state *state =
(struct llvmpipe_sampler_dynamic_state *)base;
LLVMValueRef indices[4];
LLVMValueRef ptr;
LLVMValueRef res;
@ -107,7 +113,10 @@ lp_llvm_texture_member(struct lp_sampler_dynamic_state *base,
ptr = LLVMBuildGEP(builder, state->context_ptr, indices, Elements(indices), "");
res = LLVMBuildLoad(builder, ptr, "");
if (emit_load)
res = LLVMBuildLoad(builder, ptr, "");
else
res = ptr;
lp_build_name(res, "context.texture%u.%s", unit, member_name);
@ -116,26 +125,30 @@ lp_llvm_texture_member(struct lp_sampler_dynamic_state *base,
/**
* Helper macro to instantiate the functions that generate the code to fetch
* the members of lp_jit_texture to fulfill the sampler code generator requests.
* Helper macro to instantiate the functions that generate the code to
* fetch the members of lp_jit_texture to fulfill the sampler code
* generator requests.
*
* This complexity is the price we have to pay to keep the texture sampler code
* generator a reusable module without dependencies to llvmpipe internals.
* This complexity is the price we have to pay to keep the texture
* sampler code generator a reusable module without dependencies to
* llvmpipe internals.
*/
#define LP_LLVM_TEXTURE_MEMBER(_name, _index) \
#define LP_LLVM_TEXTURE_MEMBER(_name, _index, _emit_load) \
static LLVMValueRef \
lp_llvm_texture_##_name( struct lp_sampler_dynamic_state *base, \
LLVMBuilderRef builder, \
unsigned unit) \
{ \
return lp_llvm_texture_member(base, builder, unit, _index, #_name ); \
return lp_llvm_texture_member(base, builder, unit, _index, #_name, _emit_load ); \
}
LP_LLVM_TEXTURE_MEMBER(width, LP_JIT_TEXTURE_WIDTH)
LP_LLVM_TEXTURE_MEMBER(height, LP_JIT_TEXTURE_HEIGHT)
LP_LLVM_TEXTURE_MEMBER(stride, LP_JIT_TEXTURE_STRIDE)
LP_LLVM_TEXTURE_MEMBER(data_ptr, LP_JIT_TEXTURE_DATA)
LP_LLVM_TEXTURE_MEMBER(width, LP_JIT_TEXTURE_WIDTH, TRUE)
LP_LLVM_TEXTURE_MEMBER(height, LP_JIT_TEXTURE_HEIGHT, TRUE)
LP_LLVM_TEXTURE_MEMBER(depth, LP_JIT_TEXTURE_DEPTH, TRUE)
LP_LLVM_TEXTURE_MEMBER(last_level, LP_JIT_TEXTURE_LAST_LEVEL, TRUE)
LP_LLVM_TEXTURE_MEMBER(stride, LP_JIT_TEXTURE_STRIDE, TRUE)
LP_LLVM_TEXTURE_MEMBER(data_ptr, LP_JIT_TEXTURE_DATA, FALSE)
static void
@ -145,6 +158,10 @@ lp_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler)
}
/**
* Fetch filtered values from texture.
* The 'texel' parameter returns four vectors corresponding to R, G, B, A.
*/
static void
lp_llvm_sampler_soa_emit_fetch_texel(struct lp_build_sampler_soa *base,
LLVMBuilderRef builder,
@ -185,6 +202,8 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
sampler->base.emit_fetch_texel = lp_llvm_sampler_soa_emit_fetch_texel;
sampler->dynamic_state.base.width = lp_llvm_texture_width;
sampler->dynamic_state.base.height = lp_llvm_texture_height;
sampler->dynamic_state.base.depth = lp_llvm_texture_depth;
sampler->dynamic_state.base.last_level = lp_llvm_texture_last_level;
sampler->dynamic_state.base.stride = lp_llvm_texture_stride;
sampler->dynamic_state.base.data_ptr = lp_llvm_texture_data_ptr;
sampler->dynamic_state.static_state = static_state;

View file

@ -125,7 +125,8 @@ llvmpipe_texture_create(struct pipe_screen *_screen,
lpt->base.screen = &screen->base;
if (lpt->base.tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_PRIMARY)) {
PIPE_TEXTURE_USAGE_SCANOUT |
PIPE_TEXTURE_USAGE_SHARED)) {
if (!llvmpipe_displaytarget_layout(screen, lpt))
goto fail;
}
@ -142,43 +143,6 @@ llvmpipe_texture_create(struct pipe_screen *_screen,
}
static struct pipe_texture *
llvmpipe_texture_blanket(struct pipe_screen * screen,
const struct pipe_texture *base,
const unsigned *stride,
struct pipe_buffer *buffer)
{
/* FIXME */
#if 0
struct llvmpipe_texture *lpt;
assert(screen);
/* Only supports one type */
if (base->target != PIPE_TEXTURE_2D ||
base->last_level != 0 ||
base->depth0 != 1) {
return NULL;
}
lpt = CALLOC_STRUCT(llvmpipe_texture);
if (!lpt)
return NULL;
lpt->base = *base;
pipe_reference_init(&lpt->base.reference, 1);
lpt->base.screen = screen;
lpt->stride[0] = stride[0];
pipe_buffer_reference(&lpt->buffer, buffer);
return &lpt->base;
#else
debug_printf("llvmpipe_texture_blanket() not implemented!");
return NULL;
#endif
}
static void
llvmpipe_texture_destroy(struct pipe_texture *pt)
{
@ -408,7 +372,6 @@ void
llvmpipe_init_screen_texture_funcs(struct pipe_screen *screen)
{
screen->texture_create = llvmpipe_texture_create;
screen->texture_blanket = llvmpipe_texture_blanket;
screen->texture_destroy = llvmpipe_texture_destroy;
screen->get_tex_surface = llvmpipe_get_tex_surface;

View file

@ -32,6 +32,10 @@
#include "pipe/p_state.h"
#define LP_MAX_TEXTURE_2D_LEVELS 13 /* 4K x 4K for now */
#define LP_MAX_TEXTURE_3D_LEVELS 10 /* 512 x 512 x 512 for now */
struct pipe_context;
struct pipe_screen;
struct llvmpipe_context;
@ -43,8 +47,8 @@ struct llvmpipe_texture
{
struct pipe_texture base;
unsigned long level_offset[PIPE_MAX_TEXTURE_LEVELS];
unsigned stride[PIPE_MAX_TEXTURE_LEVELS];
unsigned long level_offset[LP_MAX_TEXTURE_2D_LEVELS];
unsigned stride[LP_MAX_TEXTURE_2D_LEVELS];
/**
* Display target, for textures with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET

View file

@ -4,6 +4,7 @@
#include "util/u_memory.h"
#include "util/u_inlines.h"
#include "util/u_format.h"
#include <stdio.h>
#include <errno.h>
@ -12,6 +13,9 @@
#include "nouveau_winsys.h"
#include "nouveau_screen.h"
/* XXX this should go away */
#include "state_tracker/drm_api.h"
static const char *
nouveau_screen_get_name(struct pipe_screen *pscreen)
{
@ -231,6 +235,72 @@ nouveau_screen_fence_finish(struct pipe_screen *screen,
return 0;
}
/*
* Both texture_{from|get}_handle use drm api defines directly which they
* shouldn't do. The problem is that from|get are pipe functions and as
* such they should be defined in the pipe level. If nouveau had a propper
* winsys interface we would have added from|get to that interface using
* the winsys_handle struct as done with other drivers. However this code
* calls directly into the libdrm_nouveau.so functions (nouveau_bo_*). So
* we need to translate the handle into something they understand.
*/
static struct pipe_texture *
nouveau_screen_texture_from_handle(struct pipe_screen *pscreen,
const struct pipe_texture *templ,
struct winsys_handle *whandle)
{
struct nouveau_device *dev = nouveau_screen(pscreen)->device;
struct pipe_texture *pt;
struct pipe_buffer *pb;
int ret;
pb = CALLOC(1, sizeof(struct pipe_buffer) + sizeof(struct nouveau_bo*));
if (!pb)
return NULL;
ret = nouveau_bo_handle_ref(dev, whandle->handle, (struct nouveau_bo**)(pb+1));
if (ret) {
debug_printf("%s: ref name 0x%08x failed with %d\n",
__func__, whandle->handle, ret);
FREE(pb);
return NULL;
}
pipe_reference_init(&pb->reference, 1);
pb->screen = pscreen;
pb->alignment = 0;
pb->usage = PIPE_BUFFER_USAGE_GPU_READ_WRITE |
PIPE_BUFFER_USAGE_CPU_READ_WRITE;
pb->size = nouveau_bo(pb)->size;
pt = nouveau_screen(pscreen)->texture_blanket(pscreen, templ,
&whandle->stride, pb);
pipe_buffer_reference(&pb, NULL);
return pt;
}
static boolean
nouveau_screen_texture_get_handle(struct pipe_screen *pscreen,
struct pipe_texture *pt,
struct winsys_handle *whandle)
{
struct nouveau_miptree *mt = nouveau_miptree(pt);
if (!mt || !mt->bo)
return false;
whandle->stride = util_format_get_stride(mt->base.format, mt->base.width0);
if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) {
return nouveau_bo_handle_get(mt->bo, &whandle->handle) == 0;
} else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
whandle->handle = mt->bo->handle;
return TRUE;
} else {
return FALSE;
}
}
int
nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
{
@ -258,6 +328,9 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
pscreen->fence_signalled = nouveau_screen_fence_signalled;
pscreen->fence_finish = nouveau_screen_fence_finish;
pscreen->texture_from_handle = nouveau_screen_texture_from_handle;
pscreen->texture_get_handle = nouveau_screen_texture_get_handle;
return 0;
}

View file

@ -6,6 +6,18 @@ struct nouveau_screen {
struct nouveau_device *device;
struct nouveau_channel *channel;
/**
* Create a new texture object, using the given template info, but on top of
* existing memory.
*
* It is assumed that the buffer data is layed out according to the expected
* by the hardware. NULL will be returned if any inconsistency is found.
*/
struct pipe_texture * (*texture_blanket)(struct pipe_screen *,
const struct pipe_texture *templat,
const unsigned *stride,
struct pipe_buffer *buffer);
int (*pre_pipebuffer_map_callback) (struct pipe_screen *pscreen,
struct pipe_buffer *pb, unsigned usage);
};

View file

@ -18,7 +18,7 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt)
PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
PIPE_TEXTURE_USAGE_RENDER_TARGET |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_PRIMARY);
PIPE_TEXTURE_USAGE_SCANOUT);
if (pt->target == PIPE_TEXTURE_CUBE) {
nr_faces = 6;
@ -78,7 +78,7 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
pt->height0 & (pt->height0 - 1))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
else
if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY |
if (pt->tex_usage & (PIPE_TEXTURE_USAGE_SCANOUT |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_DEPTH_STENCIL))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
@ -232,8 +232,9 @@ void
nv30_screen_init_miptree_functions(struct pipe_screen *pscreen)
{
pscreen->texture_create = nv30_miptree_create;
pscreen->texture_blanket = nv30_miptree_blanket;
pscreen->texture_destroy = nv30_miptree_destroy;
pscreen->get_tex_surface = nv30_miptree_surface_new;
pscreen->tex_surface_destroy = nv30_miptree_surface_del;
nouveau_screen(pscreen)->texture_blanket = nv50_miptree_blanket;
}

View file

@ -70,6 +70,8 @@ struct nv30_fragment_program {
struct nouveau_stateobj *so;
};
#define NV30_MAX_TEXTURE_LEVELS 16
struct nv30_miptree {
struct pipe_texture base;
struct nouveau_bo *bo;
@ -80,7 +82,7 @@ struct nv30_miptree {
struct {
uint pitch;
uint *image_offset;
} level[PIPE_MAX_TEXTURE_LEVELS];
} level[NV30_MAX_TEXTURE_LEVELS];
};
#endif

View file

@ -20,7 +20,7 @@ nv40_miptree_layout(struct nv40_miptree *mt)
PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
PIPE_TEXTURE_USAGE_RENDER_TARGET |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_PRIMARY);
PIPE_TEXTURE_USAGE_SCANOUT);
if (pt->target == PIPE_TEXTURE_CUBE) {
nr_faces = 6;
@ -80,7 +80,7 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
pt->height0 & (pt->height0 - 1))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
else
if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY |
if (pt->tex_usage & (PIPE_TEXTURE_USAGE_SCANOUT |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_DEPTH_STENCIL))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
@ -227,9 +227,10 @@ void
nv40_screen_init_miptree_functions(struct pipe_screen *pscreen)
{
pscreen->texture_create = nv40_miptree_create;
pscreen->texture_blanket = nv40_miptree_blanket;
pscreen->texture_destroy = nv40_miptree_destroy;
pscreen->get_tex_surface = nv40_miptree_surface_new;
pscreen->tex_surface_destroy = nv40_miptree_surface_del;
nouveau_screen(pscreen)->texture_blanket = nv40_miptree_blanket;
}

View file

@ -73,6 +73,8 @@ struct nv40_fragment_program {
struct nouveau_stateobj *so;
};
#define NV40_MAX_TEXTURE_LEVELS 16
struct nv40_miptree {
struct pipe_texture base;
struct nouveau_bo *bo;
@ -83,7 +85,7 @@ struct nv40_miptree {
struct {
uint pitch;
uint *image_offset;
} level[PIPE_MAX_TEXTURE_LEVELS];
} level[NV40_MAX_TEXTURE_LEVELS];
};
#endif

View file

@ -90,10 +90,12 @@ struct nv50_miptree_level {
unsigned tile_mode;
};
#define NV50_MAX_TEXTURE_LEVELS 16
struct nv50_miptree {
struct nouveau_miptree base;
struct nv50_miptree_level level[PIPE_MAX_TEXTURE_LEVELS];
struct nv50_miptree_level level[NV50_MAX_TEXTURE_LEVELS];
int image_nr;
int total_size;
};

View file

@ -104,7 +104,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
tile_flags = 0x7400;
break;
default:
if ((pt->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) &&
if ((pt->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT) &&
util_format_get_blocksizebits(pt->format) == 32)
tile_flags = 0x7a00;
else
@ -255,9 +255,10 @@ void
nv50_screen_init_miptree_functions(struct pipe_screen *pscreen)
{
pscreen->texture_create = nv50_miptree_create;
pscreen->texture_blanket = nv50_miptree_blanket;
pscreen->texture_destroy = nv50_miptree_destroy;
pscreen->get_tex_surface = nv50_miptree_surface_new;
pscreen->tex_surface_destroy = nv50_miptree_surface_del;
nouveau_screen(pscreen)->texture_blanket = nv50_miptree_blanket;
}

View file

@ -19,7 +19,8 @@ C_SOURCES = \
r300_state_invariant.c \
r300_vs.c \
r300_texture.c \
r300_tgsi_to_rc.c
r300_tgsi_to_rc.c \
r300_transfer.c
LIBRARY_INCLUDES = \
-I$(TOP)/src/mesa/drivers/dri/r300/compiler \

View file

@ -30,6 +30,7 @@ r300 = env.ConvenienceLibrary(
'r300_vs.c',
'r300_texture.c',
'r300_tgsi_to_rc.c',
'r300_transfer.c',
] + r300compiler) + r300compiler
Export('r300')

View file

@ -72,11 +72,8 @@ r300_is_texture_referenced(struct pipe_context *pipe,
struct pipe_texture *texture,
unsigned face, unsigned level)
{
struct pipe_buffer* buf = 0;
r300_get_texture_buffer(pipe->screen, texture, &buf, NULL);
return pipe->is_buffer_referenced(pipe, buf);
return pipe->is_buffer_referenced(pipe,
((struct r300_texture *)texture)->buffer);
}
static unsigned int
@ -86,7 +83,14 @@ r300_is_buffer_referenced(struct pipe_context *pipe,
/* This only checks to see whether actual hardware buffers are
* referenced. Since we use managed BOs and transfers, it's actually not
* possible for pipe_buffers to ever reference the actual hardware, so
* buffers are never referenced. */
* buffers are never referenced.
*/
/* XXX: that doesn't make sense given that
* r300_is_texture_referenced is implemented on top of this
* function and hardware can certainly refer to textures
* directly...
*/
return 0;
}
@ -159,6 +163,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
if (!r300)
return NULL;
r300screen->ctx = (struct pipe_context*)r300;
r300->winsys = radeon_winsys;
r300->context.winsys = (struct pipe_winsys*)radeon_winsys;
@ -212,7 +218,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
r300->invariant_state.dirty = TRUE;
r300->winsys->set_flush_cb(r300->winsys, r300_flush_cb, r300);
r300->dirty_state = R300_NEW_KITCHEN_SINK;
r300->dirty_hw++;
r300->blitter = util_blitter_create(&r300->context);

View file

@ -124,13 +124,15 @@ struct r300_texture_format_state {
uint32_t format2; /* R300_TX_FORMAT2: 0x4500 */
};
#define R300_MAX_TEXTURE_LEVELS 13
struct r300_texture_fb_state {
/* Colorbuffer. */
uint32_t colorpitch[PIPE_MAX_TEXTURE_LEVELS]; /* R300_RB3D_COLORPITCH[0-3]*/
uint32_t colorpitch[R300_MAX_TEXTURE_LEVELS]; /* R300_RB3D_COLORPITCH[0-3]*/
uint32_t us_out_fmt; /* R300_US_OUT_FMT[0-3] */
/* Zbuffer. */
uint32_t depthpitch[PIPE_MAX_TEXTURE_LEVELS]; /* R300_RB3D_DEPTHPITCH */
uint32_t depthpitch[R300_MAX_TEXTURE_LEVELS]; /* R300_RB3D_DEPTHPITCH */
uint32_t zb_format; /* R300_ZB_FORMAT */
};
@ -236,16 +238,16 @@ struct r300_texture {
struct pipe_texture tex;
/* Offsets into the buffer. */
unsigned offset[PIPE_MAX_TEXTURE_LEVELS];
unsigned offset[R300_MAX_TEXTURE_LEVELS];
/* A pitch for each mip-level */
unsigned pitch[PIPE_MAX_TEXTURE_LEVELS];
unsigned pitch[R300_MAX_TEXTURE_LEVELS];
/* Size of one zslice or face based on the texture target */
unsigned layer_size[PIPE_MAX_TEXTURE_LEVELS];
unsigned layer_size[R300_MAX_TEXTURE_LEVELS];
/* Whether the mipmap level is macrotiled. */
enum r300_buffer_tiling mip_macrotile[PIPE_MAX_TEXTURE_LEVELS];
enum r300_buffer_tiling mip_macrotile[R300_MAX_TEXTURE_LEVELS];
/**
* If non-zero, override the natural texture layout with
@ -368,6 +370,8 @@ struct r300_context {
boolean polygon_offset_enabled;
/* Z buffer bit depth. */
uint32_t zbuffer_bpp;
/* Whether scissor is enabled. */
boolean scissor_enabled;
};
/* Convenience cast wrapper. */

View file

@ -675,7 +675,7 @@ void r300_emit_scissor_state(struct r300_context* r300,
maxx = fb->width;
maxy = fb->height;
if (((struct r300_rs_state*)r300->rs_state.state)->rs.scissor) {
if (r300->scissor_enabled) {
minx = MAX2(minx, scissor->minx);
miny = MAX2(miny, scissor->miny);
maxx = MIN2(maxx, scissor->maxx);
@ -794,6 +794,30 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset)
END_CS;
}
void r300_emit_vertex_buffer(struct r300_context* r300)
{
CS_LOCALS(r300);
DBG(r300, DBG_DRAW, "r300: Preparing vertex buffer %p for render, "
"vertex size %d\n", r300->vbo,
r300->vertex_info.size);
/* Set the pointer to our vertex buffer. The emitted values are this:
* PACKET3 [3D_LOAD_VBPNTR]
* COUNT [1]
* FORMAT [size | stride << 8]
* OFFSET [offset into BO]
* VBPNTR [relocated BO]
*/
BEGIN_CS(7);
OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, 3);
OUT_CS(1);
OUT_CS(r300->vertex_info.size |
(r300->vertex_info.size << 8));
OUT_CS(r300->vbo_offset);
OUT_CS_RELOC(r300->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0);
END_CS;
}
void r300_emit_vertex_stream_state(struct r300_context* r300,
unsigned size, void* state)
{
@ -868,7 +892,7 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state)
CS_LOCALS(r300);
if (!r300screen->caps->has_tcl) {
debug_printf("r300: Implementation error: emit_vertex_shader called,"
debug_printf("r300: Implementation error: emit_vs_state called,"
" but has_tcl is FALSE!\n");
return;
}
@ -907,7 +931,7 @@ void r300_emit_vs_constant_buffer(struct r300_context* r300,
CS_LOCALS(r300);
if (!r300screen->caps->has_tcl) {
debug_printf("r300: Implementation error: emit_vertex_shader called,"
debug_printf("r300: Implementation error: emit_vs_constant_buffer called,"
" but has_tcl is FALSE!\n");
return;
}
@ -1135,8 +1159,10 @@ void r300_emit_dirty_state(struct r300_context* r300)
assert(r300->dirty_state == 0);
*/
/* Finally, emit the VBO. */
/* r300_emit_vertex_buffer(r300); */
/* Emit the VBO for SWTCL. */
if (!r300screen->caps->has_tcl) {
r300_emit_vertex_buffer(r300);
}
r300->dirty_hw++;
}

View file

@ -61,6 +61,12 @@ static void r300_flush(struct pipe_context* pipe,
atom->dirty = TRUE;
}
}
/* Unmark HWTCL state for SWTCL. */
if (!r300_screen(pipe->screen)->caps->has_tcl) {
r300->vs_state.dirty = FALSE;
r300->dirty_state &= ~R300_NEW_VERTEX_SHADER_CONSTANTS;
}
}
/* reset flushed query */

View file

@ -207,6 +207,7 @@ static void r300_translate_fragment_shader(
DBG(r300, DBG_FP, "r300: Error compiling fragment program: %s\n",
compiler.Base.ErrorMsg);
assert(0);
abort();
}
/* And, finally... */

View file

@ -186,7 +186,7 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
dwords = 10 + count * vertex_size;
r300_reserve_cs_space(r300, r300_get_num_dirty_dwords(r300) + dwords);
r300_emit_buffer_validate(r300, FALSE, 0);
r300_emit_buffer_validate(r300, FALSE, NULL);
r300_emit_dirty_state(r300);
BEGIN_CS(dwords);
@ -273,9 +273,14 @@ static void r300_emit_draw_elements(struct r300_context *r300,
CS_LOCALS(r300);
assert((start * indexSize) % 4 == 0);
assert(count < (1 << 24));
DBG(r300, DBG_DRAW, "r300: Indexbuf of %u indices, min %u max %u\n",
count, minIndex, maxIndex);
maxIndex = MIN2(maxIndex, r300->vertex_buffer_max_index);
if (alt_num_verts) {
assert(count < (1 << 24));
BEGIN_CS(16);
OUT_CS_REG(R500_VAP_ALT_NUM_VERTICES, count);
} else {
@ -445,7 +450,7 @@ void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
/* Make sure there are at least 128 spare dwords in the command buffer.
* (most of it being consumed by emit_aos) */
r300_reserve_cs_space(r300, r300_get_num_dirty_dwords(r300) + 128);
r300_emit_buffer_validate(r300, TRUE, 0);
r300_emit_buffer_validate(r300, TRUE, NULL);
r300_emit_dirty_state(r300);
if (alt_num_verts || count <= 65535) {
@ -463,7 +468,7 @@ void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
/* Again, we emit both AOS and draw_arrays so there should be
* at least 128 spare dwords. */
if (count && r300_reserve_cs_space(r300, 128)) {
r300_emit_buffer_validate(r300, TRUE, 0);
r300_emit_buffer_validate(r300, TRUE, NULL);
r300_emit_dirty_state(r300);
}
} while (count);
@ -683,6 +688,7 @@ static void r300_render_draw_arrays(struct vbuf_render* render,
CS_LOCALS(r300);
r300_reserve_cs_space(r300, r300_get_num_dirty_dwords(r300) + 2);
r300_emit_buffer_validate(r300, FALSE, NULL);
r300_emit_dirty_state(r300);
DBG(r300, DBG_DRAW, "r300: Doing vbuf render, count %d\n", count);
@ -706,6 +712,7 @@ static void r300_render_draw(struct vbuf_render* render,
CS_LOCALS(r300);
r300_reserve_cs_space(r300, r300_get_num_dirty_dwords(r300) + dwords);
r300_emit_buffer_validate(r300, FALSE, NULL);
r300_emit_dirty_state(r300);
BEGIN_CS(dwords);

View file

@ -1,5 +1,6 @@
/*
* Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
* Copyright 2010 Marek Olšák <maraeo@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -20,14 +21,13 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "util/u_inlines.h"
#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_simple_screen.h"
#include "r300_context.h"
#include "r300_screen.h"
#include "r300_texture.h"
#include "r300_transfer.h"
#include "radeon_winsys.h"
#include "r300_winsys.h"
@ -231,14 +231,16 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
/* Check colorbuffer format support. */
if ((usage & (PIPE_TEXTURE_USAGE_RENDER_TARGET |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_PRIMARY)) &&
PIPE_TEXTURE_USAGE_SCANOUT |
PIPE_TEXTURE_USAGE_SHARED)) &&
/* 2101010 cannot be rendered to on non-r5xx. */
(is_r500 || !is_color2101010) &&
r300_is_colorbuffer_format_supported(format)) {
retval |= usage &
(PIPE_TEXTURE_USAGE_RENDER_TARGET |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_PRIMARY);
PIPE_TEXTURE_USAGE_SCANOUT |
PIPE_TEXTURE_USAGE_SHARED);
}
/* Check depth-stencil format support. */
@ -250,70 +252,6 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
return retval == usage;
}
static struct pipe_transfer*
r300_get_tex_transfer(struct pipe_screen *screen,
struct pipe_texture *texture,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage, unsigned x, unsigned y,
unsigned w, unsigned h)
{
struct r300_texture *tex = (struct r300_texture *)texture;
struct r300_transfer *trans;
struct r300_screen *rscreen = r300_screen(screen);
unsigned offset;
offset = r300_texture_get_offset(tex, level, zslice, face); /* in bytes */
trans = CALLOC_STRUCT(r300_transfer);
if (trans) {
pipe_texture_reference(&trans->transfer.texture, texture);
trans->transfer.x = x;
trans->transfer.y = y;
trans->transfer.width = w;
trans->transfer.height = h;
trans->transfer.stride = r300_texture_get_stride(rscreen, tex, level);
trans->transfer.usage = usage;
trans->transfer.zslice = zslice;
trans->transfer.face = face;
trans->offset = offset;
}
return &trans->transfer;
}
static void
r300_tex_transfer_destroy(struct pipe_transfer *trans)
{
pipe_texture_reference(&trans->texture, NULL);
FREE(trans);
}
static void* r300_transfer_map(struct pipe_screen* screen,
struct pipe_transfer* transfer)
{
struct r300_texture* tex = (struct r300_texture*)transfer->texture;
char* map;
enum pipe_format format = tex->tex.format;
map = pipe_buffer_map(screen, tex->buffer,
pipe_transfer_buffer_flags(transfer));
if (!map) {
return NULL;
}
return map + r300_transfer(transfer)->offset +
transfer->y / util_format_get_blockheight(format) * transfer->stride +
transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
}
static void r300_transfer_unmap(struct pipe_screen* screen,
struct pipe_transfer* transfer)
{
struct r300_texture* tex = (struct r300_texture*)transfer->texture;
pipe_buffer_unmap(screen, tex->buffer);
}
static void r300_destroy_screen(struct pipe_screen* pscreen)
{
struct r300_screen* r300screen = r300_screen(pscreen);
@ -350,13 +288,11 @@ struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys)
r300screen->screen.get_paramf = r300_get_paramf;
r300screen->screen.is_format_supported = r300_is_format_supported;
r300screen->screen.context_create = r300_create_context;
r300screen->screen.get_tex_transfer = r300_get_tex_transfer;
r300screen->screen.tex_transfer_destroy = r300_tex_transfer_destroy;
r300screen->screen.transfer_map = r300_transfer_map;
r300screen->screen.transfer_unmap = r300_transfer_unmap;
r300_init_screen_texture_functions(&r300screen->screen);
r300_init_screen_transfer_functions(&r300screen->screen);
u_simple_screen_init(&r300screen->screen);
return &r300screen->screen;
}

View file

@ -1,5 +1,6 @@
/*
* Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
* Copyright 2010 Marek Olšák <maraeo@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -27,6 +28,8 @@
#include "r300_chipset.h"
#define R300_TEXTURE_USAGE_TRANSFER PIPE_TEXTURE_USAGE_CUSTOM
struct radeon_winsys;
struct r300_screen {
@ -35,6 +38,10 @@ struct r300_screen {
struct radeon_winsys* radeon_winsys;
/* XXX This hack will be removed once texture transfers become part of
* pipe_context. */
struct pipe_context* ctx;
/* Chipset capabilities */
struct r300_capabilities* caps;
@ -42,25 +49,14 @@ struct r300_screen {
unsigned debug;
};
struct r300_transfer {
/* Parent class */
struct pipe_transfer transfer;
/* Offset from start of buffer. */
unsigned offset;
};
/* Convenience cast wrapper. */
static INLINE struct r300_screen* r300_screen(struct pipe_screen* screen) {
return (struct r300_screen*)screen;
}
/* Convenience cast wrapper. */
static INLINE struct r300_transfer*
r300_transfer(struct pipe_transfer* transfer)
{
return (struct r300_transfer*)transfer;
}
/* Creates a new r300 screen. */
struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys);
/* Debug functionality. */

View file

@ -571,6 +571,7 @@ static void
{
struct r300_context* r300 = r300_context(pipe);
struct r300_screen* r300screen = r300_screen(pipe->screen);
struct pipe_framebuffer_state *old_state = r300->fb_state.state;
unsigned max_width, max_height;
uint32_t zbuffer_bpp = 0;
@ -595,24 +596,31 @@ static void
return;
}
if (r300->draw) {
draw_flush(r300->draw);
}
r300->fb_state.dirty = TRUE;
/* If nr_cbufs is changed from zero to non-zero or vice versa... */
if (!!old_state->nr_cbufs != !!state->nr_cbufs) {
r300->blend_state.dirty = TRUE;
}
/* If zsbuf is set from NULL to non-NULL or vice versa.. */
if (!!old_state->zsbuf != !!state->zsbuf) {
r300->dsa_state.dirty = TRUE;
}
if (!r300->scissor_enabled) {
r300->scissor_state.dirty = TRUE;
}
r300_fb_update_tiling_flags(r300, r300->fb_state.state, state);
memcpy(r300->fb_state.state, state, sizeof(struct pipe_framebuffer_state));
r300->fb_state.size = (10 * state->nr_cbufs) + (2 * (4 - state->nr_cbufs)) +
(state->zsbuf ? 10 : 0) + 8;
r300_fb_update_tiling_flags(r300, r300->fb_state.state, state);
/* XXX wait what */
r300->blend_state.dirty = TRUE;
r300->dsa_state.dirty = TRUE;
r300->fb_state.dirty = TRUE;
r300->scissor_state.dirty = TRUE;
/* Polygon offset depends on the zbuffer bit depth. */
if (state->zsbuf && r300->polygon_offset_enabled) {
switch (util_format_get_blocksize(state->zsbuf->texture->format)) {
@ -716,8 +724,7 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
rs->vap_control_status = R300_VC_32BIT_SWAP;
#endif
/* If bypassing TCL, or if no TCL engine is present, turn off the HW TCL.
* Else, enable HW TCL and force Draw's TCL off. */
/* If no TCL engine is present, turn off the HW TCL. */
if (!r300screen->caps->has_tcl) {
rs->vap_control_status |= R300_VAP_TCL_BYPASS;
}
@ -807,6 +814,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
{
struct r300_context* r300 = r300_context(pipe);
struct r300_rs_state* rs = (struct r300_rs_state*)state;
boolean scissor_was_enabled = r300->scissor_enabled;
if (r300->draw) {
draw_flush(r300->draw);
@ -815,20 +823,17 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
if (rs) {
r300->polygon_offset_enabled = rs->rs.offset_cw || rs->rs.offset_ccw;
r300->scissor_enabled = rs->rs.scissor;
} else {
r300->polygon_offset_enabled = FALSE;
r300->scissor_enabled = FALSE;
}
UPDATE_STATE(state, r300->rs_state);
r300->rs_state.size = 17 + (r300->polygon_offset_enabled ? 5 : 0);
/* XXX Why is this still needed, dammit!? */
r300->scissor_state.dirty = TRUE;
r300->viewport_state.dirty = TRUE;
/* XXX Clean these up when we move to atom emits */
if (r300->fs && r300->fs->inputs.wpos != ATTR_UNUSED) {
r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
if (scissor_was_enabled != r300->scissor_enabled) {
r300->scissor_state.dirty = TRUE;
}
}
@ -973,7 +978,9 @@ static void r300_set_scissor_state(struct pipe_context* pipe,
memcpy(r300->scissor_state.state, state,
sizeof(struct pipe_scissor_state));
r300->scissor_state.dirty = TRUE;
if (r300->scissor_enabled) {
r300->scissor_state.dirty = TRUE;
}
}
static void r300_set_viewport_state(struct pipe_context* pipe,
@ -1088,68 +1095,71 @@ static void* r300_create_vs_state(struct pipe_context* pipe,
{
struct r300_context* r300 = r300_context(pipe);
struct r300_vertex_shader* vs = CALLOC_STRUCT(r300_vertex_shader);
r300_vertex_shader_common_init(vs, shader);
if (r300_screen(pipe->screen)->caps->has_tcl) {
struct r300_vertex_shader* vs = CALLOC_STRUCT(r300_vertex_shader);
/* Copy state directly into shader. */
vs->state = *shader;
vs->state.tokens = tgsi_dup_tokens(shader->tokens);
tgsi_scan_shader(shader->tokens, &vs->info);
return (void*)vs;
r300_translate_vertex_shader(r300, vs);
} else {
return draw_create_vertex_shader(r300->draw, shader);
vs->draw_vs = draw_create_vertex_shader(r300->draw, shader);
}
return vs;
}
static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
{
struct r300_context* r300 = r300_context(pipe);
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
if (vs == NULL) {
r300->vs_state.state = NULL;
return;
}
if (vs == r300->vs_state.state) {
return;
}
r300->vs_state.state = vs;
// VS output mapping for HWTCL or stream mapping for SWTCL to the RS block
if (r300->fs) {
r300_vertex_shader_setup_wpos(r300);
}
memcpy(r300->vap_output_state.state, &vs->vap_out,
sizeof(struct r300_vap_output_state));
r300->vap_output_state.dirty = TRUE;
/* The majority of the RS block bits is dependent on the vertex shader. */
r300->rs_block_state.dirty = TRUE; /* Will be updated before the emission. */
if (r300_screen(pipe->screen)->caps->has_tcl) {
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
if (vs == NULL) {
r300->vs_state.state = NULL;
return;
} else if (!vs->translated) {
r300_translate_vertex_shader(r300, vs);
}
UPDATE_STATE(shader, r300->vs_state);
r300->vs_state.dirty = TRUE;
r300->vs_state.size = vs->code.length + 9;
r300->rs_block_state.dirty = TRUE; /* Will be updated before the emission. */
r300->vap_output_state.dirty = TRUE;
r300->vertex_stream_state.dirty = TRUE; /* XXX needed for TCL bypass */
r300->pvs_flush.dirty = TRUE;
if (r300->fs) {
r300_vertex_shader_setup_wpos(r300);
}
r300->dirty_state |= R300_NEW_VERTEX_SHADER_CONSTANTS;
} else {
draw_flush(r300->draw);
draw_bind_vertex_shader(r300->draw,
(struct draw_vertex_shader*)shader);
(struct draw_vertex_shader*)vs->draw_vs);
}
}
static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
{
struct r300_context* r300 = r300_context(pipe);
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
if (r300_screen(pipe->screen)->caps->has_tcl) {
struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
rc_constants_destroy(&vs->code.constants);
FREE((void*)vs->state.tokens);
FREE(shader);
} else {
draw_delete_vertex_shader(r300->draw,
(struct draw_vertex_shader*)shader);
(struct draw_vertex_shader*)vs->draw_vs);
}
FREE((void*)vs->state.tokens);
FREE(shader);
}
static void r300_set_constant_buffer(struct pipe_context *pipe,
@ -1201,8 +1211,10 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
pipe_buffer_unmap(pipe->screen, buf);
if (shader == PIPE_SHADER_VERTEX) {
r300->dirty_state |= R300_NEW_VERTEX_SHADER_CONSTANTS;
r300->pvs_flush.dirty = TRUE;
if (r300screen->caps->has_tcl) {
r300->dirty_state |= R300_NEW_VERTEX_SHADER_CONSTANTS;
r300->pvs_flush.dirty = TRUE;
}
}
else if (shader == PIPE_SHADER_FRAGMENT)
r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;

View file

@ -433,18 +433,13 @@ static void r300_update_derived_shader_state(struct r300_context* r300)
{
struct r300_vertex_shader* vs = r300->vs_state.state;
struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct r300_vap_output_state *vap_out =
(struct r300_vap_output_state*)r300->vap_output_state.state;
/* XXX Mmm, delicious hax */
memset(&r300->vertex_info, 0, sizeof(struct vertex_info));
memcpy(vap_out, vs->hwfmt, sizeof(uint)*4);
r300_update_rs_block(r300, &vs->outputs, &r300->fs->inputs);
if (r300screen->caps->has_tcl) {
r300_vertex_psc(r300);
} else {
memset(&r300->vertex_info, 0, sizeof(struct vertex_info));
r300_draw_emit_all_attribs(r300);
draw_compute_vertex_size(&r300->vertex_info);
r300_swtcl_vertex_psc(r300);
@ -582,8 +577,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
void r300_update_derived_state(struct r300_context* r300)
{
if (r300->rs_block_state.dirty ||
r300->vertex_stream_state.dirty || /* XXX put updating this state out of this file */
r300->rs_state.dirty) { /* XXX and remove this one (tcl_bypass dependency) */
r300->vertex_stream_state.dirty) { /* XXX put updating PSC out of this file */
r300_update_derived_shader_state(r300);
}

View file

@ -453,7 +453,6 @@ r300_translate_vertex_data_type(enum pipe_format format) {
static INLINE uint16_t
r300_translate_vertex_data_swizzle(enum pipe_format format) {
const struct util_format_description *desc = util_format_description(format);
unsigned swizzle[4], i;
assert(format);
@ -463,25 +462,10 @@ r300_translate_vertex_data_swizzle(enum pipe_format format) {
return 0;
}
/* Swizzles for 8bits formats are in the reversed order, not sure why. */
if (desc->channel[0].size == 8) {
for (i = 0; i < 4; i++) {
if (desc->swizzle[i] <= 3) {
swizzle[i] = 3 - desc->swizzle[i];
} else {
swizzle[i] = desc->swizzle[i];
}
}
} else {
for (i = 0; i < 4; i++) {
swizzle[i] = desc->swizzle[i];
}
}
return ((swizzle[0] << R300_SWIZZLE_SELECT_X_SHIFT) |
(swizzle[1] << R300_SWIZZLE_SELECT_Y_SHIFT) |
(swizzle[2] << R300_SWIZZLE_SELECT_Z_SHIFT) |
(swizzle[3] << R300_SWIZZLE_SELECT_W_SHIFT) |
return ((desc->swizzle[0] << R300_SWIZZLE_SELECT_X_SHIFT) |
(desc->swizzle[1] << R300_SWIZZLE_SELECT_Y_SHIFT) |
(desc->swizzle[2] << R300_SWIZZLE_SELECT_Z_SHIFT) |
(desc->swizzle[3] << R300_SWIZZLE_SELECT_W_SHIFT) |
(0xf << R300_WRITE_ENA_SHIFT));
}

View file

@ -617,18 +617,23 @@ static unsigned r300_texture_get_tile_size(struct r300_texture* tex,
/* Return true if macrotiling should be enabled on the miplevel. */
static boolean r300_texture_macro_switch(struct r300_texture *tex,
unsigned level,
boolean rv350_mode)
boolean rv350_mode,
int dim)
{
unsigned tile_width, width;
unsigned tile, texdim;
tile_width = r300_texture_get_tile_size(tex, TILE_WIDTH, TRUE);
width = u_minify(tex->tex.width0, level);
tile = r300_texture_get_tile_size(tex, dim, TRUE);
if (dim == TILE_WIDTH) {
texdim = u_minify(tex->tex.width0, level);
} else {
texdim = u_minify(tex->tex.height0, level);
}
/* See TX_FILTER1_n.MACRO_SWITCH. */
if (rv350_mode) {
return width >= tile_width;
return texdim >= tile;
} else {
return width > tile_width;
return texdim > tile;
}
}
@ -692,9 +697,10 @@ static void r300_setup_miptree(struct r300_screen* screen,
for (i = 0; i <= base->last_level; i++) {
/* Let's see if this miplevel can be macrotiled. */
tex->mip_macrotile[i] = (tex->macrotile == R300_BUFFER_TILED &&
r300_texture_macro_switch(tex, i, rv350_mode)) ?
R300_BUFFER_TILED : R300_BUFFER_LINEAR;
tex->mip_macrotile[i] =
(tex->macrotile == R300_BUFFER_TILED &&
r300_texture_macro_switch(tex, i, rv350_mode, TILE_WIDTH)) ?
R300_BUFFER_TILED : R300_BUFFER_LINEAR;
stride = r300_texture_get_stride(screen, tex, i);
nblocksy = r300_texture_get_nblocksy(tex, i);
@ -724,10 +730,46 @@ static void r300_setup_flags(struct r300_texture* tex)
!util_is_power_of_two(tex->tex.height0);
}
static void r300_setup_tiling(struct pipe_screen *screen,
struct r300_texture *tex)
{
enum pipe_format format = tex->tex.format;
boolean rv350_mode = r300_screen(screen)->caps->family >= CHIP_FAMILY_RV350;
if (util_format_is_compressed(format)) {
return;
}
if (tex->tex.width0 == 1 ||
tex->tex.height0 == 1) {
return;
}
/* Set microtiling. */
switch (util_format_get_blocksize(format)) {
case 1:
case 4:
tex->microtile = R300_BUFFER_TILED;
break;
/* XXX Square-tiling doesn't work with kernel older than 2.6.34,
* XXX need to check the DRM version */
/*case 2:
case 8:
tex->microtile = R300_BUFFER_SQUARETILED;
break;*/
}
/* Set macrotiling. */
if (r300_texture_macro_switch(tex, 0, rv350_mode, TILE_WIDTH) &&
r300_texture_macro_switch(tex, 0, rv350_mode, TILE_HEIGHT)) {
tex->macrotile = R300_BUFFER_TILED;
}
}
/* Create a new texture. */
static struct pipe_texture*
r300_texture_create(struct pipe_screen* screen,
const struct pipe_texture* template)
static struct pipe_texture* r300_texture_create(struct pipe_screen* screen,
const struct pipe_texture* template)
{
struct r300_texture* tex = CALLOC_STRUCT(r300_texture);
struct r300_screen* rscreen = r300_screen(screen);
@ -742,6 +784,9 @@ static struct pipe_texture*
tex->tex.screen = screen;
r300_setup_flags(tex);
if (!(template->tex_usage & R300_TEXTURE_USAGE_TRANSFER)) {
r300_setup_tiling(screen, tex);
}
r300_setup_miptree(rscreen, tex);
r300_setup_texture_state(rscreen, tex);
@ -806,14 +851,17 @@ static void r300_tex_surface_destroy(struct pipe_surface* s)
FREE(s);
}
static struct pipe_texture*
r300_texture_blanket(struct pipe_screen* screen,
const struct pipe_texture* base,
const unsigned* stride,
struct pipe_buffer* buffer)
r300_texture_from_handle(struct pipe_screen* screen,
const struct pipe_texture* base,
struct winsys_handle *whandle)
{
struct r300_texture* tex;
struct radeon_winsys* winsys = (struct radeon_winsys*)screen->winsys;
struct r300_screen* rscreen = r300_screen(screen);
struct pipe_buffer *buffer;
struct r300_texture* tex;
unsigned stride;
/* Support only 2D textures without mipmaps */
if (base->target != PIPE_TEXTURE_2D ||
@ -822,6 +870,11 @@ static struct pipe_texture*
return NULL;
}
buffer = winsys->buffer_from_handle(winsys, screen, whandle, &stride);
if (!buffer) {
return NULL;
}
tex = CALLOC_STRUCT(r300_texture);
if (!tex) {
return NULL;
@ -831,17 +884,38 @@ static struct pipe_texture*
pipe_reference_init(&tex->tex.reference, 1);
tex->tex.screen = screen;
tex->stride_override = *stride;
tex->pitch[0] = *stride / util_format_get_blocksize(base->format);
tex->stride_override = stride;
tex->pitch[0] = stride / util_format_get_blocksize(base->format);
r300_setup_flags(tex);
r300_setup_texture_state(rscreen, tex);
pipe_buffer_reference(&tex->buffer, buffer);
/* one ref already taken */
tex->buffer = buffer;
return (struct pipe_texture*)tex;
}
static boolean
r300_texture_get_handle(struct pipe_screen* screen,
struct pipe_texture *texture,
struct winsys_handle *whandle)
{
struct radeon_winsys* winsys = (struct radeon_winsys*)screen->winsys;
struct r300_texture* tex = (struct r300_texture*)texture;
unsigned stride;
if (!tex) {
return FALSE;
}
stride = r300_texture_get_stride(r300_screen(screen), tex, 0);
winsys->buffer_get_handle(winsys, tex->buffer, stride, whandle);
return TRUE;
}
static struct pipe_video_surface *
r300_video_surface_create(struct pipe_screen *screen,
enum pipe_video_chroma_format chroma_format,
@ -893,30 +967,13 @@ static void r300_video_surface_destroy(struct pipe_video_surface *vsfc)
void r300_init_screen_texture_functions(struct pipe_screen* screen)
{
screen->texture_create = r300_texture_create;
screen->texture_from_handle = r300_texture_from_handle;
screen->texture_get_handle = r300_texture_get_handle;
screen->texture_destroy = r300_texture_destroy;
screen->get_tex_surface = r300_get_tex_surface;
screen->tex_surface_destroy = r300_tex_surface_destroy;
screen->texture_blanket = r300_texture_blanket;
screen->video_surface_create = r300_video_surface_create;
screen->video_surface_destroy= r300_video_surface_destroy;
}
boolean r300_get_texture_buffer(struct pipe_screen* screen,
struct pipe_texture* texture,
struct pipe_buffer** buffer,
unsigned* stride)
{
struct r300_texture* tex = (struct r300_texture*)texture;
if (!tex) {
return FALSE;
}
pipe_buffer_reference(buffer, tex->buffer);
if (stride) {
*stride = r300_texture_get_stride(r300_screen(screen), tex, 0);
}
return TRUE;
}

View file

@ -60,13 +60,11 @@ r300_video_surface(struct pipe_video_surface *pvs)
return (struct r300_video_surface *)pvs;
}
#ifndef R300_WINSYS_H
/* Used internally for texture_is_referenced()
*/
boolean r300_get_texture_buffer(struct pipe_screen* screen,
struct pipe_texture* texture,
struct pipe_buffer** buffer,
unsigned* stride);
#endif /* R300_WINSYS_H */
#endif /* R300_TEXTURE_H */

View file

@ -0,0 +1,270 @@
/*
* Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
* Copyright 2010 Marek Olšák <maraeo@gmail.com>
*
* 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
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, 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 (including the next
* paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS 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. */
#include "r300_context.h"
#include "r300_transfer.h"
#include "r300_texture.h"
#include "r300_screen.h"
#include "util/u_memory.h"
#include "util/u_format.h"
struct r300_transfer {
/* Parent class */
struct pipe_transfer transfer;
/* Pipe context. */
struct pipe_context *ctx;
/* Parameters of get_tex_transfer. */
unsigned x, y, level, zslice, face;
/* Offset from start of buffer. */
unsigned offset;
/* Detiled texture. */
struct r300_texture *detiled_texture;
/* Transfer and format flags. */
unsigned buffer_usage, render_target_usage;
};
/* Convenience cast wrapper. */
static INLINE struct r300_transfer*
r300_transfer(struct pipe_transfer* transfer)
{
return (struct r300_transfer*)transfer;
}
/* Copy from a tiled texture to a detiled one. */
static void r300_copy_from_tiled_texture(struct pipe_context *ctx,
struct r300_transfer *r300transfer)
{
struct pipe_screen *screen = ctx->screen;
struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer;
struct pipe_texture *tex = transfer->texture;
struct pipe_surface *src, *dst;
src = screen->get_tex_surface(screen, tex, r300transfer->face,
r300transfer->level, r300transfer->zslice,
PIPE_BUFFER_USAGE_GPU_READ |
PIPE_BUFFER_USAGE_PIXEL);
dst = screen->get_tex_surface(screen, &r300transfer->detiled_texture->tex,
0, 0, 0,
PIPE_BUFFER_USAGE_GPU_WRITE |
PIPE_BUFFER_USAGE_PIXEL |
r300transfer->buffer_usage);
ctx->surface_copy(ctx, dst, 0, 0, src, r300transfer->x, r300transfer->y,
transfer->width, transfer->height);
pipe_surface_reference(&src, NULL);
pipe_surface_reference(&dst, NULL);
}
/* Copy a detiled texture to a tiled one. */
static void r300_copy_into_tiled_texture(struct pipe_context *ctx,
struct r300_transfer *r300transfer)
{
struct pipe_screen *screen = ctx->screen;
struct pipe_transfer *transfer = (struct pipe_transfer*)r300transfer;
struct pipe_texture *tex = transfer->texture;
struct pipe_surface *src, *dst;
src = screen->get_tex_surface(screen, &r300transfer->detiled_texture->tex,
0, 0, 0,
PIPE_BUFFER_USAGE_GPU_READ |
PIPE_BUFFER_USAGE_PIXEL);
dst = screen->get_tex_surface(screen, tex, r300transfer->face,
r300transfer->level, r300transfer->zslice,
PIPE_BUFFER_USAGE_GPU_WRITE |
PIPE_BUFFER_USAGE_PIXEL);
/* XXX this flush prevents the following DRM error from occuring:
* [drm:radeon_cs_ioctl] *ERROR* Failed to parse relocation !
* Reproducible with perf/copytex. */
ctx->flush(ctx, 0, NULL);
ctx->surface_copy(ctx, dst, r300transfer->x, r300transfer->y, src, 0, 0,
transfer->width, transfer->height);
/* XXX this flush fixes a few piglit tests (e.g. glean/pixelFormats). */
ctx->flush(ctx, 0, NULL);
pipe_surface_reference(&src, NULL);
pipe_surface_reference(&dst, NULL);
}
static struct pipe_transfer*
r300_get_tex_transfer(struct pipe_screen *screen,
struct pipe_texture *texture,
unsigned face, unsigned level, unsigned zslice,
enum pipe_transfer_usage usage, unsigned x, unsigned y,
unsigned w, unsigned h)
{
struct r300_texture *tex = (struct r300_texture *)texture;
struct r300_transfer *trans;
struct r300_screen *r300screen = r300_screen(screen);
struct pipe_texture template;
trans = CALLOC_STRUCT(r300_transfer);
if (trans) {
/* Initialize the transfer object. */
pipe_texture_reference(&trans->transfer.texture, texture);
trans->transfer.usage = usage;
trans->transfer.width = w;
trans->transfer.height = h;
trans->ctx = r300screen->ctx;
trans->x = x;
trans->y = y;
trans->level = level;
trans->zslice = zslice;
trans->face = face;
/* If the texture is tiled, we must create a temporary detiled texture
* for this transfer. */
if (tex->microtile || tex->macrotile) {
trans->buffer_usage = pipe_transfer_buffer_flags(&trans->transfer);
trans->render_target_usage =
util_format_is_depth_or_stencil(texture->format) ?
PIPE_TEXTURE_USAGE_DEPTH_STENCIL :
PIPE_TEXTURE_USAGE_RENDER_TARGET;
template.target = PIPE_TEXTURE_2D;
template.format = texture->format;
template.width0 = w;
template.height0 = h;
template.depth0 = 0;
template.last_level = 0;
template.nr_samples = 0;
template.tex_usage = PIPE_TEXTURE_USAGE_DYNAMIC |
R300_TEXTURE_USAGE_TRANSFER;
/* For texture reading, the temporary (detiled) texture is used as
* a render target when blitting from a tiled texture. */
if (usage & PIPE_TRANSFER_READ) {
template.tex_usage |= trans->render_target_usage;
}
/* For texture writing, the temporary texture is used as a sampler
* when blitting into a tiled texture. */
if (usage & PIPE_TRANSFER_WRITE) {
template.tex_usage |= PIPE_TEXTURE_USAGE_SAMPLER;
}
/* Create the temporary texture. */
trans->detiled_texture =
(struct r300_texture*)screen->texture_create(screen, &template);
assert(!trans->detiled_texture->microtile &&
!trans->detiled_texture->macrotile);
/* Set the stride.
* Parameters x, y, level, zslice, and face remain zero. */
trans->transfer.stride =
r300_texture_get_stride(r300screen, trans->detiled_texture, 0);
if (usage & PIPE_TRANSFER_READ) {
/* We cannot map a tiled texture directly because the data is
* in a different order, therefore we do detiling using a blit. */
r300_copy_from_tiled_texture(r300screen->ctx, trans);
}
} else {
trans->transfer.x = x;
trans->transfer.y = y;
trans->transfer.stride =
r300_texture_get_stride(r300screen, tex, level);
trans->transfer.level = level;
trans->transfer.zslice = zslice;
trans->transfer.face = face;
trans->offset = r300_texture_get_offset(tex, level, zslice, face);
}
}
return &trans->transfer;
}
static void r300_tex_transfer_destroy(struct pipe_transfer *trans)
{
struct r300_transfer *r300transfer = r300_transfer(trans);
if (r300transfer->detiled_texture) {
if (trans->usage & PIPE_TRANSFER_WRITE) {
r300_copy_into_tiled_texture(r300transfer->ctx, r300transfer);
}
pipe_texture_reference(
(struct pipe_texture**)&r300transfer->detiled_texture, NULL);
}
pipe_texture_reference(&trans->texture, NULL);
FREE(trans);
}
static void* r300_transfer_map(struct pipe_screen *screen,
struct pipe_transfer *transfer)
{
struct r300_transfer *r300transfer = r300_transfer(transfer);
struct r300_texture *tex = (struct r300_texture*)transfer->texture;
char *map;
enum pipe_format format = tex->tex.format;
if (r300transfer->detiled_texture) {
/* The detiled texture is of the same size as the region being mapped
* (no offset needed). */
return pipe_buffer_map(screen,
r300transfer->detiled_texture->buffer,
pipe_transfer_buffer_flags(transfer));
} else {
/* Tiling is disabled. */
map = pipe_buffer_map(screen, tex->buffer,
pipe_transfer_buffer_flags(transfer));
if (!map) {
return NULL;
}
return map + r300_transfer(transfer)->offset +
transfer->y / util_format_get_blockheight(format) * transfer->stride +
transfer->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
}
}
static void r300_transfer_unmap(struct pipe_screen *screen,
struct pipe_transfer *transfer)
{
struct r300_transfer *r300transfer = r300_transfer(transfer);
struct r300_texture *tex = (struct r300_texture*)transfer->texture;
if (r300transfer->detiled_texture) {
pipe_buffer_unmap(screen, r300transfer->detiled_texture->buffer);
} else {
pipe_buffer_unmap(screen, tex->buffer);
}
}
void r300_init_screen_transfer_functions(struct pipe_screen *screen)
{
screen->get_tex_transfer = r300_get_tex_transfer;
screen->tex_transfer_destroy = r300_tex_transfer_destroy;
screen->transfer_map = r300_transfer_map;
screen->transfer_unmap = r300_transfer_unmap;
}

View file

@ -0,0 +1,31 @@
/*
* Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
* Copyright 2010 Marek Olšák <maraeo@gmail.com>
*
* 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
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, 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 (including the next
* paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS 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. */
#ifndef R300_TRANSFER
#define R300_TRANSFER
#include "pipe/p_screen.h"
void r300_init_screen_transfer_functions(struct pipe_screen *screen);
#endif

View file

@ -89,95 +89,41 @@ static void r300_shader_read_vs_outputs(
assert(0);
}
}
/* WPOS is a straight copy of POSITION and it's always emitted. */
vs_outputs->wpos = i;
}
static void r300_shader_vap_output_fmt(struct r300_vertex_shader* vs)
/* This function sets up:
* - VAP mapping, which maps VS registers to output semantics and
* at the same time it indicates which attributes are enabled and should
* be rasterized.
* - Stream mapping to VS outputs if TCL is not present. */
static void r300_init_vs_output_mapping(struct r300_vertex_shader* vs)
{
struct r300_shader_semantics* vs_outputs = &vs->outputs;
uint32_t* hwfmt = vs->hwfmt;
int i, gen_count;
struct r300_vap_output_state *vap_out = &vs->vap_out;
int *stream_loc = vs->stream_loc_notcl;
int i, gen_count, tabi = 0;
boolean any_bcolor_used = vs_outputs->bcolor[0] != ATTR_UNUSED ||
vs_outputs->bcolor[1] != ATTR_UNUSED;
/* Do the actual vertex_info setup.
*
* vertex_info has four uints of hardware-specific data in it.
* vinfo.hwfmt[0] is R300_VAP_VTX_STATE_CNTL
* vinfo.hwfmt[1] is R300_VAP_VSM_VTX_ASSM
* vinfo.hwfmt[2] is R300_VAP_OUTPUT_VTX_FMT_0
* vinfo.hwfmt[3] is R300_VAP_OUTPUT_VTX_FMT_1 */
hwfmt[0] = 0x5555; /* XXX this is classic Mesa bonghits */
vap_out->vap_vtx_state_cntl = 0x5555; /* XXX this is classic Mesa bonghits */
/* Position. */
if (vs_outputs->pos != ATTR_UNUSED) {
hwfmt[1] |= R300_INPUT_CNTL_POS;
hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
vap_out->vap_vsm_vtx_assm |= R300_INPUT_CNTL_POS;
vap_out->vap_out_vtx_fmt[0] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
stream_loc[tabi++] = 0;
} else {
assert(0);
}
/* Point size. */
if (vs_outputs->psize != ATTR_UNUSED) {
hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT;
}
vap_out->vap_out_vtx_fmt[0] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT;
/* Colors. */
for (i = 0; i < ATTR_COLOR_COUNT; i++) {
if (vs_outputs->color[i] != ATTR_UNUSED || any_bcolor_used ||
vs_outputs->color[1] != ATTR_UNUSED) {
hwfmt[1] |= R300_INPUT_CNTL_COLOR;
hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i;
}
}
/* Back-face colors. */
if (any_bcolor_used) {
for (i = 0; i < ATTR_COLOR_COUNT; i++) {
hwfmt[1] |= R300_INPUT_CNTL_COLOR;
hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << (2+i);
}
}
/* Texture coordinates. */
gen_count = 0;
for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
if (vs_outputs->generic[i] != ATTR_UNUSED) {
hwfmt[1] |= (R300_INPUT_CNTL_TC0 << gen_count);
hwfmt[3] |= (4 << (3 * gen_count));
gen_count++;
}
}
/* Fog coordinates. */
if (vs_outputs->fog != ATTR_UNUSED) {
hwfmt[1] |= (R300_INPUT_CNTL_TC0 << gen_count);
hwfmt[3] |= (4 << (3 * gen_count));
gen_count++;
}
/* XXX magic */
assert(gen_count <= 8);
/* WPOS. */
vs->wpos_tex_output = gen_count;
}
/* Sets up stream mapping to equivalent VS outputs if TCL is bypassed
* or isn't present. */
static void r300_stream_locations_notcl(
struct r300_shader_semantics* vs_outputs,
int* stream_loc)
{
int i, tabi = 0, gen_count;
boolean any_bcolor_used = vs_outputs->bcolor[0] != ATTR_UNUSED ||
vs_outputs->bcolor[1] != ATTR_UNUSED;
/* Position. */
stream_loc[tabi++] = 0;
/* Point size. */
if (vs_outputs->psize != ATTR_UNUSED) {
stream_loc[tabi++] = 1;
}
@ -185,6 +131,9 @@ static void r300_stream_locations_notcl(
for (i = 0; i < ATTR_COLOR_COUNT; i++) {
if (vs_outputs->color[i] != ATTR_UNUSED || any_bcolor_used ||
vs_outputs->color[1] != ATTR_UNUSED) {
vap_out->vap_vsm_vtx_assm |= R300_INPUT_CNTL_COLOR;
vap_out->vap_out_vtx_fmt[0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i;
stream_loc[tabi++] = 2 + i;
}
}
@ -192,6 +141,9 @@ static void r300_stream_locations_notcl(
/* Back-face colors. */
if (any_bcolor_used) {
for (i = 0; i < ATTR_COLOR_COUNT; i++) {
vap_out->vap_vsm_vtx_assm |= R300_INPUT_CNTL_COLOR;
vap_out->vap_out_vtx_fmt[0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << (2+i);
stream_loc[tabi++] = 4 + i;
}
}
@ -200,6 +152,9 @@ static void r300_stream_locations_notcl(
gen_count = 0;
for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
if (vs_outputs->generic[i] != ATTR_UNUSED) {
vap_out->vap_vsm_vtx_assm |= (R300_INPUT_CNTL_TC0 << gen_count);
vap_out->vap_out_vtx_fmt[1] |= (4 << (3 * gen_count));
assert(tabi < 16);
stream_loc[tabi++] = 6 + gen_count;
gen_count++;
@ -208,17 +163,22 @@ static void r300_stream_locations_notcl(
/* Fog coordinates. */
if (vs_outputs->fog != ATTR_UNUSED) {
vap_out->vap_vsm_vtx_assm |= (R300_INPUT_CNTL_TC0 << gen_count);
vap_out->vap_out_vtx_fmt[1] |= (4 << (3 * gen_count));
assert(tabi < 16);
stream_loc[tabi++] = 6 + gen_count;
gen_count++;
}
/* XXX magic */
assert(gen_count <= 8);
/* WPOS. */
if (vs_outputs->wpos != ATTR_UNUSED) {
assert(tabi < 16);
stream_loc[tabi++] = 6 + gen_count;
gen_count++;
}
vs->wpos_tex_output = gen_count;
assert(tabi < 16);
stream_loc[tabi++] = 6 + gen_count;
for (; tabi < 16;) {
stream_loc[tabi++] = -1;
@ -294,26 +254,16 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c)
}
}
static void r300_insert_wpos(struct r300_vertex_program_compiler* c,
struct r300_shader_semantics* outputs)
void r300_vertex_shader_common_init(struct r300_vertex_shader *vs,
const struct pipe_shader_state *shader)
{
int i, lastOutput = 0;
/* Copy state directly into shader. */
vs->state = *shader;
vs->state.tokens = tgsi_dup_tokens(shader->tokens);
tgsi_scan_shader(shader->tokens, &vs->info);
/* Find the max output index. */
lastOutput = MAX2(lastOutput, outputs->psize);
for (i = 0; i < ATTR_COLOR_COUNT; i++) {
lastOutput = MAX2(lastOutput, outputs->color[i]);
lastOutput = MAX2(lastOutput, outputs->bcolor[i]);
}
for (i = 0; i < ATTR_GENERIC_COUNT; i++) {
lastOutput = MAX2(lastOutput, outputs->generic[i]);
}
lastOutput = MAX2(lastOutput, outputs->fog);
/* Set WPOS after the last output. */
lastOutput++;
rc_copy_output(&c->Base, 0, lastOutput); /* out[lastOutput] = out[0]; */
outputs->wpos = lastOutput;
r300_shader_read_vs_outputs(&vs->info, &vs->outputs);
r300_init_vs_output_mapping(vs);
}
void r300_translate_vertex_shader(struct r300_context* r300,
@ -322,9 +272,6 @@ void r300_translate_vertex_shader(struct r300_context* r300,
struct r300_vertex_program_compiler compiler;
struct tgsi_to_rc ttr;
/* Initialize. */
r300_shader_read_vs_outputs(&vs->info, &vs->outputs);
/* Setup the compiler */
rc_init(&compiler.Base);
@ -348,10 +295,7 @@ void r300_translate_vertex_shader(struct r300_context* r300,
compiler.SetHwInputOutput = &set_vertex_inputs_outputs;
/* Insert the WPOS output. */
r300_insert_wpos(&compiler, &vs->outputs);
r300_shader_vap_output_fmt(vs);
r300_stream_locations_notcl(&vs->outputs, vs->stream_loc_notcl);
rc_copy_output(&compiler.Base, 0, vs->outputs.wpos);
/* Invoke the compiler */
r3xx_compile_vertex_program(&compiler);
@ -363,30 +307,29 @@ void r300_translate_vertex_shader(struct r300_context* r300,
/* And, finally... */
rc_destroy(&compiler.Base);
vs->translated = TRUE;
}
boolean r300_vertex_shader_setup_wpos(struct r300_context* r300)
{
struct r300_vertex_shader* vs = r300->vs_state.state;
struct r300_vap_output_state *vap_out = &vs->vap_out;
int tex_output = vs->wpos_tex_output;
uint32_t tex_fmt = R300_INPUT_CNTL_TC0 << tex_output;
uint32_t* hwfmt = vs->hwfmt;
if (r300->fs->inputs.wpos != ATTR_UNUSED) {
/* Enable WPOS in VAP. */
if (!(hwfmt[1] & tex_fmt)) {
hwfmt[1] |= tex_fmt;
hwfmt[3] |= (4 << (3 * tex_output));
if (!(vap_out->vap_vsm_vtx_assm & tex_fmt)) {
vap_out->vap_vsm_vtx_assm |= tex_fmt;
vap_out->vap_out_vtx_fmt[1] |= (4 << (3 * tex_output));
assert(tex_output < 8);
return TRUE;
}
} else {
/* Disable WPOS in VAP. */
if (hwfmt[1] & tex_fmt) {
hwfmt[1] &= ~tex_fmt;
hwfmt[3] &= ~(4 << (3 * tex_output));
if (vap_out->vap_vsm_vtx_assm & tex_fmt) {
vap_out->vap_vsm_vtx_assm &= ~tex_fmt;
vap_out->vap_out_vtx_fmt[1] &= ~(4 << (3 * tex_output));
return TRUE;
}
}

View file

@ -28,6 +28,7 @@
#include "tgsi/tgsi_scan.h"
#include "radeon_code.h"
#include "r300_context.h"
#include "r300_shader_semantics.h"
struct r300_context;
@ -38,7 +39,7 @@ struct r300_vertex_shader {
struct tgsi_shader_info info;
struct r300_shader_semantics outputs;
uint hwfmt[4];
struct r300_vap_output_state vap_out;
/* Stream locations for SWTCL or if TCL is bypassed. */
int stream_loc_notcl[16];
@ -46,13 +47,17 @@ struct r300_vertex_shader {
/* Output stream location for WPOS. */
int wpos_tex_output;
/* Has this shader been translated yet? */
boolean translated;
/* HWTCL-specific. */
/* Machine code (if translated) */
struct r300_vertex_program_code code;
/* SWTCL-specific. */
void *draw_vs;
};
void r300_vertex_shader_common_init(struct r300_vertex_shader *vs,
const struct pipe_shader_state *shader);
void r300_translate_vertex_shader(struct r300_context* r300,
struct r300_vertex_shader* vs);

View file

@ -40,11 +40,6 @@ struct radeon_winsys;
struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys);
boolean r300_get_texture_buffer(struct pipe_screen* screen,
struct pipe_texture* texture,
struct pipe_buffer** buffer,
unsigned* stride);
#ifdef __cplusplus
}
#endif

View file

@ -264,57 +264,29 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr)
break;
case PIPE_PRIM_QUADS:
if (softpipe->rasterizer->flatshade_first) {
for (i = 3; i < nr; i += 4) {
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-3], stride) );
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-0], stride),
get_vert(vertex_buffer, indices[i-3], stride) );
}
}
else {
for (i = 3; i < nr; i += 4) {
sp_setup_tri( setup_ctx,
for (i = 3; i < nr; i += 4) {
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, indices[i-3], stride),
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
sp_setup_tri( setup_ctx,
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
}
}
break;
case PIPE_PRIM_QUAD_STRIP:
if (softpipe->rasterizer->flatshade_first) {
for (i = 3; i < nr; i += 2) {
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, indices[i-0], stride),
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-3], stride));
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-0], stride),
get_vert(vertex_buffer, indices[i-3], stride) );
}
}
else {
for (i = 3; i < nr; i += 2) {
sp_setup_tri( setup_ctx,
for (i = 3; i < nr; i += 2) {
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, indices[i-3], stride),
get_vert(vertex_buffer, indices[i-2], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
sp_setup_tri( setup_ctx,
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, indices[i-1], stride),
get_vert(vertex_buffer, indices[i-3], stride),
get_vert(vertex_buffer, indices[i-0], stride) );
}
}
break;
@ -448,56 +420,28 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
break;
case PIPE_PRIM_QUADS:
if (softpipe->rasterizer->flatshade_first) {
for (i = 3; i < nr; i += 4) {
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-3, stride) );
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-0, stride),
get_vert(vertex_buffer, i-3, stride) );
}
}
else {
for (i = 3; i < nr; i += 4) {
sp_setup_tri( setup_ctx,
for (i = 3; i < nr; i += 4) {
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, i-3, stride),
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-0, stride) );
sp_setup_tri( setup_ctx,
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-0, stride) );
}
}
break;
case PIPE_PRIM_QUAD_STRIP:
if (softpipe->rasterizer->flatshade_first) {
for (i = 3; i < nr; i += 2) {
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, i-0, stride),
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-3, stride) );
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-0, stride),
get_vert(vertex_buffer, i-3, stride) );
}
}
else {
for (i = 3; i < nr; i += 2) {
sp_setup_tri( setup_ctx,
for (i = 3; i < nr; i += 2) {
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, i-3, stride),
get_vert(vertex_buffer, i-2, stride),
get_vert(vertex_buffer, i-0, stride) );
sp_setup_tri( setup_ctx,
sp_setup_tri( setup_ctx,
get_vert(vertex_buffer, i-1, stride),
get_vert(vertex_buffer, i-3, stride),
get_vert(vertex_buffer, i-0, stride) );
}
}
break;

View file

@ -83,11 +83,11 @@ softpipe_get_param(struct pipe_screen *screen, int param)
case PIPE_CAP_TEXTURE_SHADOW_MAP:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return 13; /* max 4Kx4K */
return SP_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return 9; /* max 256x256x256 */
return SP_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return 13; /* max 4Kx4K */
return SP_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_TGSI_CONT_SUPPORTED:
return 1;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:

View file

@ -55,7 +55,7 @@
static INLINE float
frac(float f)
{
return f - util_ifloor(f);
return f - floorf(f);
}
@ -201,11 +201,9 @@ wrap_nearest_mirror_repeat(const float s[4], unsigned size, int icoord[4])
const float max = 1.0F - min;
for (ch = 0; ch < 4; ch++) {
const int flr = util_ifloor(s[ch]);
float u;
float u = frac(s[ch]);
if (flr & 1)
u = 1.0F - (s[ch] - (float) flr);
else
u = s[ch] - (float) flr;
u = 1.0F - u;
if (u < min)
icoord[ch] = 0;
else if (u > max)
@ -358,11 +356,9 @@ wrap_linear_mirror_repeat(const float s[4], unsigned size,
uint ch;
for (ch = 0; ch < 4; ch++) {
const int flr = util_ifloor(s[ch]);
float u;
float u = frac(s[ch]);
if (flr & 1)
u = 1.0F - (s[ch] - (float) flr);
else
u = s[ch] - (float) flr;
u = 1.0F - u;
u = u * size - 0.5F;
icoord0[ch] = util_ifloor(u);
icoord1[ch] = icoord0[ch] + 1;
@ -441,8 +437,7 @@ wrap_linear_mirror_clamp_to_border(const float s[4], unsigned size,
/**
* For RECT textures / unnormalized texcoords
* Only a subset of wrap modes supported.
* PIPE_TEX_WRAP_CLAMP for nearest sampling, unnormalized coords.
*/
static void
wrap_nearest_unorm_clamp(const float s[4], unsigned size, int icoord[4])
@ -456,11 +451,25 @@ wrap_nearest_unorm_clamp(const float s[4], unsigned size, int icoord[4])
/**
* Handles clamp_to_edge and clamp_to_border:
* PIPE_TEX_WRAP_CLAMP_TO_BORDER for nearest sampling, unnormalized coords.
*/
static void
wrap_nearest_unorm_clamp_to_border(const float s[4], unsigned size,
int icoord[4])
{
uint ch;
for (ch = 0; ch < 4; ch++) {
icoord[ch]= util_ifloor( CLAMP(s[ch], -0.5F, (float) size + 0.5F) );
}
}
/**
* PIPE_TEX_WRAP_CLAMP_TO_EDGE for nearest sampling, unnormalized coords.
*/
static void
wrap_nearest_unorm_clamp_to_edge(const float s[4], unsigned size,
int icoord[4])
{
uint ch;
for (ch = 0; ch < 4; ch++) {
@ -470,8 +479,7 @@ wrap_nearest_unorm_clamp_to_border(const float s[4], unsigned size,
/**
* For RECT textures / unnormalized texcoords.
* Only a subset of wrap modes supported.
* PIPE_TEX_WRAP_CLAMP for linear sampling, unnormalized coords.
*/
static void
wrap_linear_unorm_clamp(const float s[4], unsigned size,
@ -488,13 +496,36 @@ wrap_linear_unorm_clamp(const float s[4], unsigned size,
}
/**
* PIPE_TEX_WRAP_CLAMP_TO_BORDER for linear sampling, unnormalized coords.
*/
static void
wrap_linear_unorm_clamp_to_border(const float s[4], unsigned size,
int icoord0[4], int icoord1[4], float w[4])
{
uint ch;
for (ch = 0; ch < 4; ch++) {
float u = CLAMP(s[ch], 0.5F, (float) size - 0.5F);
float u = CLAMP(s[ch], -0.5F, (float) size + 0.5F);
u -= 0.5F;
icoord0[ch] = util_ifloor(u);
icoord1[ch] = icoord0[ch] + 1;
if (icoord1[ch] > (int) size - 1)
icoord1[ch] = size - 1;
w[ch] = frac(u);
}
}
/**
* PIPE_TEX_WRAP_CLAMP_TO_EDGE for linear sampling, unnormalized coords.
*/
static void
wrap_linear_unorm_clamp_to_edge(const float s[4], unsigned size,
int icoord0[4], int icoord1[4], float w[4])
{
uint ch;
for (ch = 0; ch < 4; ch++) {
float u = CLAMP(s[ch], +0.5F, (float) size - 0.5F);
u -= 0.5F;
icoord0[ch] = util_ifloor(u);
icoord1[ch] = icoord0[ch] + 1;
@ -1711,6 +1742,7 @@ get_nearest_unorm_wrap(unsigned mode)
case PIPE_TEX_WRAP_CLAMP:
return wrap_nearest_unorm_clamp;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
return wrap_nearest_unorm_clamp_to_edge;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
return wrap_nearest_unorm_clamp_to_border;
default:
@ -1754,6 +1786,7 @@ get_linear_unorm_wrap(unsigned mode)
case PIPE_TEX_WRAP_CLAMP:
return wrap_linear_unorm_clamp;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
return wrap_linear_unorm_clamp_to_edge;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
return wrap_linear_unorm_clamp_to_border;
default:

View file

@ -36,6 +36,7 @@
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_simple_screen.h"
#include "sp_context.h"
#include "sp_texture.h"
@ -121,7 +122,8 @@ softpipe_texture_create(struct pipe_screen *screen,
util_is_power_of_two(template->depth0));
if (spt->base.tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
PIPE_TEXTURE_USAGE_PRIMARY)) {
PIPE_TEXTURE_USAGE_SCANOUT |
PIPE_TEXTURE_USAGE_SHARED)) {
if (!softpipe_displaytarget_layout(screen, spt))
goto fail;
}
@ -138,20 +140,6 @@ softpipe_texture_create(struct pipe_screen *screen,
}
/**
* Create a new pipe_texture which wraps an existing buffer.
*/
static struct pipe_texture *
softpipe_texture_blanket(struct pipe_screen * screen,
const struct pipe_texture *base,
const unsigned *stride,
struct pipe_buffer *buffer)
{
/* Texture blanket is going away.
*/
debug_printf("softpipe_texture_blanket() not implemented!");
return NULL;
}
static void
@ -463,7 +451,6 @@ void
softpipe_init_screen_texture_funcs(struct pipe_screen *screen)
{
screen->texture_create = softpipe_texture_create;
screen->texture_blanket = softpipe_texture_blanket;
screen->texture_destroy = softpipe_texture_destroy;
screen->get_tex_surface = softpipe_get_tex_surface;

View file

@ -33,6 +33,10 @@
#include "pipe/p_video_state.h"
#define SP_MAX_TEXTURE_2D_LEVELS 13 /* 4K x 4K */
#define SP_MAX_TEXTURE_3D_LEVELS 9 /* 512 x 512 x 512 */
struct pipe_context;
struct pipe_screen;
struct softpipe_context;
@ -42,8 +46,8 @@ struct softpipe_texture
{
struct pipe_texture base;
unsigned long level_offset[PIPE_MAX_TEXTURE_LEVELS];
unsigned stride[PIPE_MAX_TEXTURE_LEVELS];
unsigned long level_offset[SP_MAX_TEXTURE_2D_LEVELS];
unsigned stride[SP_MAX_TEXTURE_2D_LEVELS];
/**
* Display target, for textures with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET

Some files were not shown because too many files have changed in this diff Show more