Merge remote branch 'origin/master' into pipe-video

Conflicts:
	configs/linux-dri
	src/gallium/drivers/r600/r600_pipe.c
	src/gallium/drivers/r600/r600_state.c
	src/gallium/include/pipe/p_format.h
	src/gallium/tests/graw/fragment-shader/frag-abs.sh
	src/gallium/tests/graw/fragment-shader/frag-add.sh
	src/gallium/tests/graw/fragment-shader/frag-cb-1d.sh
	src/gallium/tests/graw/fragment-shader/frag-cb-2d.sh
	src/gallium/tests/graw/fragment-shader/frag-dp3.sh
	src/gallium/tests/graw/fragment-shader/frag-dp4.sh
	src/gallium/tests/graw/fragment-shader/frag-dst.sh
	src/gallium/tests/graw/fragment-shader/frag-ex2.sh
	src/gallium/tests/graw/fragment-shader/frag-face.sh
	src/gallium/tests/graw/fragment-shader/frag-flr.sh
	src/gallium/tests/graw/fragment-shader/frag-frc.sh
	src/gallium/tests/graw/fragment-shader/frag-kil.sh
	src/gallium/tests/graw/fragment-shader/frag-lg2.sh
	src/gallium/tests/graw/fragment-shader/frag-lit.sh
	src/gallium/tests/graw/fragment-shader/frag-lrp.sh
	src/gallium/tests/graw/fragment-shader/frag-mad-immx.sh
	src/gallium/tests/graw/fragment-shader/frag-mad.sh
	src/gallium/tests/graw/fragment-shader/frag-max.sh
	src/gallium/tests/graw/fragment-shader/frag-min.sh
	src/gallium/tests/graw/fragment-shader/frag-mov.sh
	src/gallium/tests/graw/fragment-shader/frag-mul.sh
	src/gallium/tests/graw/fragment-shader/frag-rcp.sh
	src/gallium/tests/graw/fragment-shader/frag-rsq.sh
	src/gallium/tests/graw/fragment-shader/frag-sge.sh
	src/gallium/tests/graw/fragment-shader/frag-slt.sh
	src/gallium/tests/graw/fragment-shader/frag-srcmod-abs.sh
	src/gallium/tests/graw/fragment-shader/frag-srcmod-absneg.sh
	src/gallium/tests/graw/fragment-shader/frag-srcmod-neg.sh
	src/gallium/tests/graw/fragment-shader/frag-srcmod-swz.sh
	src/gallium/tests/graw/fragment-shader/frag-sub.sh
	src/gallium/tests/graw/fragment-shader/frag-tempx.sh
	src/gallium/tests/graw/fragment-shader/frag-xpd.sh
	src/gallium/tests/graw/vertex-shader/vert-abs.sh
	src/gallium/tests/graw/vertex-shader/vert-add.sh
	src/gallium/tests/graw/vertex-shader/vert-arl.sh
	src/gallium/tests/graw/vertex-shader/vert-arr.sh
	src/gallium/tests/graw/vertex-shader/vert-cb-1d.sh
	src/gallium/tests/graw/vertex-shader/vert-cb-2d.sh
	src/gallium/tests/graw/vertex-shader/vert-dp3.sh
	src/gallium/tests/graw/vertex-shader/vert-dp4.sh
	src/gallium/tests/graw/vertex-shader/vert-dst.sh
	src/gallium/tests/graw/vertex-shader/vert-ex2.sh
	src/gallium/tests/graw/vertex-shader/vert-flr.sh
	src/gallium/tests/graw/vertex-shader/vert-frc.sh
	src/gallium/tests/graw/vertex-shader/vert-lg2.sh
	src/gallium/tests/graw/vertex-shader/vert-lit.sh
	src/gallium/tests/graw/vertex-shader/vert-lrp.sh
	src/gallium/tests/graw/vertex-shader/vert-mad.sh
	src/gallium/tests/graw/vertex-shader/vert-max.sh
	src/gallium/tests/graw/vertex-shader/vert-min.sh
	src/gallium/tests/graw/vertex-shader/vert-mov.sh
	src/gallium/tests/graw/vertex-shader/vert-mul.sh
	src/gallium/tests/graw/vertex-shader/vert-rcp.sh
	src/gallium/tests/graw/vertex-shader/vert-rsq.sh
	src/gallium/tests/graw/vertex-shader/vert-sge.sh
	src/gallium/tests/graw/vertex-shader/vert-slt.sh
	src/gallium/tests/graw/vertex-shader/vert-srcmod-abs.sh
	src/gallium/tests/graw/vertex-shader/vert-srcmod-absneg.sh
	src/gallium/tests/graw/vertex-shader/vert-srcmod-neg.sh
	src/gallium/tests/graw/vertex-shader/vert-srcmod-swz.sh
	src/gallium/tests/graw/vertex-shader/vert-sub.sh
	src/gallium/tests/graw/vertex-shader/vert-xpd.sh
	src/gallium/tools/trace/dump.py
	src/gallium/tools/trace/format.py
	src/gallium/tools/trace/model.py
	src/gallium/tools/trace/parse.py
This commit is contained in:
Christian König 2011-04-23 14:27:40 +02:00
commit fa31b1095e
616 changed files with 27465 additions and 24414 deletions

View file

@ -5,7 +5,10 @@ TOP = .
SUBDIRS = src
# The git command below generates an empty string when we're not
# building in a GIT tree (i.e., building from a release tarball).
default: $(TOP)/configs/current
@$(TOP)/bin/extract_git_sha1
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE)) || exit 1 ; \
@ -197,8 +200,12 @@ MAIN_FILES = \
$(DIRECTORY)/configure.ac \
$(DIRECTORY)/acinclude.m4 \
$(DIRECTORY)/aclocal.m4 \
$(DIRECTORY)/SConstruct \
$(DIRECTORY)/common.py \
$(DIRECTORY)/scons/*py \
$(DIRECTORY)/bin/config.guess \
$(DIRECTORY)/bin/config.sub \
$(DIRECTORY)/bin/extract_git_sha1 \
$(DIRECTORY)/bin/install-sh \
$(DIRECTORY)/bin/mklib \
$(DIRECTORY)/bin/minstall \
@ -223,17 +230,23 @@ MAIN_FILES = \
$(DIRECTORY)/include/GL/vms_x_fix.h \
$(DIRECTORY)/include/GL/wglext.h \
$(DIRECTORY)/include/GL/wmesa.h \
$(DIRECTORY)/src/getopt/SConscript \
$(DIRECTORY)/src/getopt/getopt*.[ch] \
$(DIRECTORY)/src/glsl/Makefile \
$(DIRECTORY)/src/glsl/Makefile.template \
$(DIRECTORY)/src/glsl/SConscript \
$(DIRECTORY)/src/glsl/*.[ch] \
$(DIRECTORY)/src/glsl/*.ll \
$(DIRECTORY)/src/glsl/*.yy \
$(DIRECTORY)/src/glsl/*.[cly]pp \
$(DIRECTORY)/src/glsl/README \
$(DIRECTORY)/src/glsl/glcpp/*.[chly] \
$(DIRECTORY)/src/glsl/glcpp/README \
$(DIRECTORY)/src/glsl/builtins \
$(DIRECTORY)/src/Makefile \
$(DIRECTORY)/src/SConscript \
$(DIRECTORY)/src/mesa/Makefile* \
$(DIRECTORY)/src/mesa/SConscript \
$(DIRECTORY)/src/mesa/sources.mak \
$(DIRECTORY)/src/mesa/descrip.mms \
$(DIRECTORY)/src/mesa/gl.pc.in \
@ -241,12 +254,12 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/depend \
$(MAIN_ES_FILES) \
$(DIRECTORY)/src/mesa/main/*.[chS] \
$(DIRECTORY)/src/mesa/main/*.cpp \
$(DIRECTORY)/src/mesa/main/descrip.mms \
$(DIRECTORY)/src/mesa/math/*.[ch] \
$(DIRECTORY)/src/mesa/math/descrip.mms \
$(DIRECTORY)/src/mesa/program/*.[chly] \
$(DIRECTORY)/src/mesa/program/*.cpp \
$(DIRECTORY)/src/mesa/program/Makefile \
$(DIRECTORY)/src/mesa/program/descrip.mms \
$(DIRECTORY)/src/mesa/swrast/*.[ch] \
$(DIRECTORY)/src/mesa/swrast/descrip.mms \
@ -259,6 +272,7 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/tnl_dd/*.[ch] \
$(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch] \
$(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm \
$(DIRECTORY)/src/mesa/vf/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/Makefile \
$(DIRECTORY)/src/mesa/drivers/beos/*.cpp \
$(DIRECTORY)/src/mesa/drivers/beos/Makefile \
@ -271,6 +285,9 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/drivers/osmesa/descrip.mms \
$(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def \
$(DIRECTORY)/src/mesa/drivers/osmesa/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/dri/r300/compiler/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/dri/r300/compiler/Makefile \
$(DIRECTORY)/src/mesa/drivers/dri/r300/compiler/SConscript \
$(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/windows/*/*.def \
$(DIRECTORY)/src/mesa/drivers/x11/Makefile \
@ -305,7 +322,9 @@ MAPI_FILES = \
$(DIRECTORY)/src/mapi/mapi/mapi_abi.py \
$(DIRECTORY)/src/mapi/mapi/sources.mak \
$(DIRECTORY)/src/mapi/mapi/*.[ch] \
$(DIRECTORY)/src/mapi/shared-glapi/SConscript \
$(DIRECTORY)/src/mapi/vgapi/Makefile \
$(DIRECTORY)/src/mapi/vgapi/SConscript \
$(DIRECTORY)/src/mapi/vgapi/vgapi.csv \
$(DIRECTORY)/src/mapi/vgapi/vg.pc.in
@ -318,6 +337,7 @@ EGL_FILES = \
$(DIRECTORY)/src/egl/*/*.[ch] \
$(DIRECTORY)/src/egl/*/*/Makefile \
$(DIRECTORY)/src/egl/*/*/*.[ch] \
$(DIRECTORY)/src/egl/main/SConscript \
$(DIRECTORY)/src/egl/main/*.pc.in \
$(DIRECTORY)/src/egl/main/*.def
@ -393,6 +413,7 @@ GLUT_FILES = \
$(DIRECTORY)/include/GL/glut.h \
$(DIRECTORY)/include/GL/glutf90.h \
$(DIRECTORY)/src/glut/glx/Makefile* \
$(DIRECTORY)/src/glut/glx/SConscript \
$(DIRECTORY)/src/glut/glx/depend \
$(DIRECTORY)/src/glut/glx/glut.pc.in \
$(DIRECTORY)/src/glut/glx/*def \

10
bin/extract_git_sha1 Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
touch src/mesa/main/git_sha1.h
if which git > /dev/null; then
# Extract the 7-digit "short" SHA1 for the current HEAD, convert
# it to a string, and wrap it in a #define. This is used in
# src/mesa/main/version.c to put the GIT SHA1 in the GL_VERSION string.
git log -n 1 --oneline |\
sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
> src/mesa/main/git_sha1.h
fi

View file

@ -64,7 +64,8 @@ GALLIUM_WINSYS_DIRS = sw sw/xlib drm/vmware drm/intel drm/i965
GALLIUM_TARGET_DIRS = egl-swrast
GALLIUM_STATE_TRACKERS_DIRS = egl vdpau
DRI_DIRS = r300 radeon swrast
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon \
savage sis tdfx unichrome swrast
INTEL_LIBS = `pkg-config --libs libdrm_intel`
INTEL_CFLAGS = `pkg-config --cflags libdrm_intel`

View file

@ -319,6 +319,21 @@ else
esac
fi
dnl
dnl potentially-infringing-but-nobody-knows-for-sure stuff
dnl
AC_ARG_ENABLE([texture-float],
[AS_HELP_STRING([--enable-texture-float],
[enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
[enable_texture_float="$enableval"],
[enable_texture_float=no]
)
if test "x$enable_texture_float" = xyes; then
AC_MSG_WARN([Floating-point textures enabled.])
AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
fi
GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
@ -729,6 +744,27 @@ else
enable_xcb=no
fi
dnl Direct rendering or just indirect rendering
case "$host_os" in
gnu*)
dnl Disable by default on GNU/Hurd
driglx_direct_default="no"
;;
cygwin*)
dnl Disable by default on cygwin
driglx_direct_default="no"
;;
*)
driglx_direct_default="yes"
;;
esac
AC_ARG_ENABLE([driglx-direct],
[AS_HELP_STRING([--disable-driglx-direct],
[enable direct rendering in GLX and EGL for DRI \
@<:@default=auto@:>@])],
[driglx_direct="$enableval"],
[driglx_direct="$driglx_direct_default"])
dnl
dnl libGL configuration per driver
dnl
@ -762,12 +798,17 @@ dri|no) # these checks are still desired when there is no mesa_driver
AC_MSG_ERROR([Can't use static libraries for DRI drivers])
fi
# Check for libdrm
PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED glproto >= $GLPROTO_REQUIRED"
DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
GL_PC_REQ_PRIV="glproto >= $GLPROTO_REQUIRED"
DRI_PC_REQ_PRIV=""
if test x"$driglx_direct" = xyes; then
# Check for libdrm
PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
fi
# find the DRI deps for libGL
if test "$x11_pkgconfig" = yes; then
@ -910,12 +951,6 @@ AC_ARG_WITH([dri-searchpath],
[DRI_DRIVER_SEARCH_DIR="$withval"],
[DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
AC_SUBST([DRI_DRIVER_SEARCH_DIR])
dnl Direct rendering or just indirect rendering
AC_ARG_ENABLE([driglx-direct],
[AS_HELP_STRING([--disable-driglx-direct],
[enable direct rendering in GLX and EGL for DRI @<:@default=enabled@:>@])],
[driglx_direct="$enableval"],
[driglx_direct="yes"])
dnl Which drivers to build - default is chosen by platform
AC_ARG_WITH([dri-drivers],
[AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
@ -1006,6 +1041,16 @@ if test "$mesa_driver" = dri -o "$mesa_driver" = no; then
DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
fi
;;
cygwin*)
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
if test "x$driglx_direct" = xyes; then
DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
fi
if test "x$DRI_DIRS" = "xyes"; then
DRI_DIRS="swrast"
fi
;;
esac
# default drivers
@ -1758,16 +1803,15 @@ fi
dnl
dnl Gallium Radeon r300g configuration
dnl
AC_ARG_ENABLE([gallium-radeon],
[AS_HELP_STRING([--enable-gallium-radeon],
[build gallium radeon @<:@default=disabled@:>@])],
[enable_gallium_radeon="$enableval"],
[enable_gallium_radeon=auto])
if test "x$enable_gallium_radeon" = xauto; then
AC_ARG_ENABLE([gallium-r300],
[AS_HELP_STRING([--enable-gallium-r300],
[build gallium r300 @<:@default=DRI-only@:>@])],
[enable_gallium_r300="$enableval"],
[enable_gallium_r300=auto])
if test "x$enable_gallium_r300" = xauto; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
gallium_check_st "radeon/drm" "dri-r300"
fi
if test "x$enable_gallium_radeon" = xyes; then
elif test "x$enable_gallium_r300" = xyes; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
fi
@ -1777,7 +1821,7 @@ dnl Gallium Radeon r600g configuration
dnl
AC_ARG_ENABLE([gallium-r600],
[AS_HELP_STRING([--enable-gallium-r600],
[build gallium radeon @<:@default=disabled@:>@])],
[build gallium r600 @<:@default=disabled@:>@])],
[enable_gallium_r600="$enableval"],
[enable_gallium_r600=auto])
if test "x$enable_gallium_r600" = xyes; then

View file

@ -0,0 +1,4 @@
Known issues in the ARB_color_buffer_float implementation:
- Rendering to multiple render targets, some fixed-point, some floating-point, with FIXED_ONLY fragment clamping and polygon smooth enabled may write incorrect values to the fixed point buffers (depends on spec interpretation)
- For fragment programs with ARB_fog_* options, colors are clamped before fog application regardless of the fragment clamping setting (this depends on spec interpretation)

View file

@ -12,11 +12,11 @@ Feature Status
GL 3.0:
GLSL changes (GL_EXT_gpu_shader4, etc) not started
GLSL 1.30 (GL_EXT_gpu_shader4, etc.) started
Conditional rendering (GL_NV_conditional_render) DONE (swrast & softpipe)
Map buffer subranges (GL_ARB_map_buffer_range) DONE
Clamping controls (GL_ARB_color_buffer_float) BRANCH ~mareko/mesa floating2
Float textures, renderbuffers (GL_ARB_texture_float) BRANCH ~mareko/mesa floating2
Clamping controls (GL_ARB_color_buffer_float) DONE
Float textures, renderbuffers (GL_ARB_texture_float) DONE (gallium r300)
GL_EXT_packed_float not started
GL_EXT_texture_shared_exponent not started
Float depth buffers (GL_ARB_depth_buffer_float) not started
@ -45,7 +45,7 @@ Depth format cube textures 0% done
GL 3.1:
GLSL 1.30 and 1.40 not started
GLSL 1.40 not started
Instanced drawing (GL_ARB_draw_instanced) DONE (gallium, swrast)
Buffer copying (GL_ARB_copy_buffer) DONE
Primitive restart (GL_NV_primitive_restart) DONE (gallium)
@ -53,7 +53,7 @@ Primitive restart (GL_NV_primitive_restart) DONE (gallium)
Texture buffer objs (GL_ARB_texture_buffer_object) not started
Rectangular textures (GL_ARB_texture_rectangle) DONE
Uniform buffer objs (GL_ARB_uniform_buffer_object) not started
Signed normalized textures (GL_EXT_texture_snorm) ~50% done
Signed normalized textures (GL_EXT_texture_snorm) DONE (gallium)
GL 3.2:
@ -77,7 +77,7 @@ GLSL 3.30 not started
GL_ARB_blend_func_extended not started
GL_ARB_explicit_attrib_location DONE (swrast, i915, i965)
GL_ARB_occlusion_query2 DONE (swrast, gallium)
GL_ARB_sampler_objects not started
GL_ARB_sampler_objects DONE (gallium)
GL_ARB_texture_rgb10_a2ui not started
GL_ARB_texture_swizzle DONE (same as EXT version)
GL_ARB_timer_query DONE (only Xlib sw driver)

View file

@ -67,7 +67,7 @@ Additions to Chapter 3 the GLX 1.4 Specification (Functions and Errors)
On "PC" computers, AGP memory can be allocated with glXAllocateMemoryNV
and freed with glXFreeMemoryNV. Sometimes it's useful to know where a
block of AGP memory is located with respect to the start of the AGP
aperature. The function
aperture. The function
GLuint glXGetAGPOffsetMESA( const GLvoid *pointer )

View file

@ -24,7 +24,7 @@ Number
Dependencies
Reguires EGL 1.4 or later. This extension is written against the
Requires EGL 1.4 or later. This extension is written against the
wording of the EGL 1.4 specification.
EGL_KHR_base_image is required.
@ -134,7 +134,7 @@ Issues
RESOLVED: The eglQueryImage function has been proposed often,
but it goes against the EGLImage design. EGLImages are opaque
handles to a 2D array of pixels, which can be passed between
client APIs. By referenceing an EGLImage in a client API, the
client APIs. By referencing an EGLImage in a client API, the
EGLImage target (a texture, a renderbuffer or such) can be
used to query the attributes of the EGLImage. We don't have a
full client API for creating and querying DRM buffers, though,

View file

@ -48,7 +48,7 @@ IP Status
Issues
1. Should we also defined UNPACK_INVERT_MESA for glDrawPixels, etc?
1. Should we also define UNPACK_INVERT_MESA for glDrawPixels, etc?
Resolved: No, we're only concerned with pixel packing. There are other
solutions for inverting images when using glDrawPixels (negative Y pixel

View file

@ -31,12 +31,12 @@ Overview
Mesa's implementation of GLX is entirely implemented on the client side.
Therefore, Mesa cannot immediately detect when an X window or pixmap is
destroyed in order to free any ancilliary data associated with the window
destroyed in order to free any ancillary data associated with the window
or pixmap.
The glxMesaReleaseBuffers() function can be used to explicitly indicate
when the back color buffer, depth buffer, stencil buffer, and/or accum-
ulation buffer associated with a drawable can be freed.
when the back color buffer, depth buffer, stencil buffer, and/or accumu-
lation buffer associated with a drawable can be freed.
IP Status
@ -60,7 +60,7 @@ Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors)
Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
causes all software ancilliary buffers (back buffer, depth, stencil,
causes all software ancillary buffers (back buffer, depth, stencil,
accum, etc) associated with the named drawable to be immediately
deallocated. True is returned if <d> is a valid Mesa GLX drawable,
else False is returned. After calling glXReleaseBuffersMESA, the

View file

@ -35,7 +35,7 @@ Overview
Mesa's glViewport command queries the current window size and updates
its internal data structors accordingly. This normally works fine
since most applications call glViewport in responce to window size
since most applications call glViewport in response to window size
changes.
In some situations, however, the application may not call glViewport
@ -65,7 +65,7 @@ Additions to the AGL/GLX/WGL Specifications
Errors
INVALID_OPERATION is generated if ResizeBuffersMESA is called betweeen
INVALID_OPERATION is generated if glResizeBuffersMESA is called between
Begin and End.
New State

View file

@ -88,8 +88,8 @@ Additions to the GLX 1.3 Specification
this is typically the time required to display both the even and odd
fields of a frame of video data.
If <interval> is set to a value of 0, buffer swaps are not synchron-
ized to a video frame. The <interval> value is silently clamped to
If <interval> is set to a value of 0, buffer swaps are not synchro-
nized to a video frame. The <interval> value is silently clamped to
the maximum implementation-dependent value supported before being
stored.

View file

@ -328,7 +328,7 @@ Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
-- Section 3.8.10 "Texture Completeness"
Change the second paragaph (page 177) to say (spec changes identical
Change the second paragraph (page 177) to say (spec changes identical
to EXT_texture_array):
"For one-, two-, or three-dimensional textures and one- or
@ -443,10 +443,10 @@ Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
Change second through fourth paragraphs (page 188) to say:
"Let D_t be the depth texture value, in the range [0, 1]. For
texture lookups from one- and two-dimesional, rectangle, and
texture lookups from one- and two-dimensional, rectangle, and
one-dimensional array targets, let R be the interpolated <r>
texture coordinate, clamped to the range [0, 1]. For texture lookups
from two-dimesional array texture targets, let R be the interpolated
from two-dimensional array texture targets, let R be the interpolated
<q> texture coordinate, clamped to the range [0, 1]. Then the
effective texture value L_t, I_t, or A_t is computed as follows:
@ -604,7 +604,7 @@ Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions)
-- Section 5.4 "Display Lists"
Change the first paragraphi on page 242 to say (spec changes
Change the first paragraph on page 242 to say (spec changes
identical to EXT_texture_array):
"TexImage3D, TexImage2D, TexImage1D, Histogram, and ColorTable are

View file

@ -44,7 +44,7 @@ Overview
ARB_texture_compression_rgtc introduces some compressed red and
red_green signed formats but no uncompressed ones, which might
still be useful. NV_texture_shader adds signed texture formats,
but also a lot of functionality which has been superceded by fragment
but also a lot of functionality which has been superseded by fragment
shaders.
It is usually possible to get the same functionality
using a unsigned format by doing scale and bias in a shader, but this
@ -105,7 +105,7 @@ Issues
This is also different to what NV_texture_shader used.
The above mapping should be considered the reference, but there
is some leeway so other mappings are allowed for implementations which
cannot do this. Particulary the mapping given in NV_texture_shader or
cannot do this. Particularly the mapping given in NV_texture_shader or
the standard OpenGL byte/float mapping is considered acceptable too, as
might be a mapping which represents -1.0 by -128, 0.0 by 0 and 1.0 by
127 (that is, uses different scale factors for negative and positive

View file

@ -88,7 +88,7 @@ Additions to Chapter 2 of the OpenGL 1.2 Specification (OpenGL Operation)
WindosPos4MESA takes four values indicating x, y, z, and w.
WindowPos3MESA (or WindowPos2MESA) is analaguos, but sets only
x, y, and z with w implicitly set to 1 (or only x and y with z
implicititly set to 0 and w implicitly set to 1).
implicitly set to 0 and w implicitly set to 1).
WindowPosMESA operates like RasterPos except that the current modelview
matrix, projection matrix and viewport parameters are ignored and the
@ -108,7 +108,7 @@ GLX Protocol
Errors
INVALID_OPERATION is generated if WindowPosMESA is called betweeen
INVALID_OPERATION is generated if WindowPosMESA is called between
Begin and End.
New State

View file

@ -26,7 +26,7 @@ Number
Dependencies
OpenGL 1.0 or later is required
This extensions is written against the OpenGL 1.4 Specification.
This extension is written against the OpenGL 1.4 Specification.
NV_texture_rectangle effects the definition of this extension.
Overview
@ -104,7 +104,7 @@ Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization)
In section 3.6.4, Rasterization of Pixel Rectangles, on page 104,
add the following to Table 3.12 (Packed pixel fiedl assignments):
add the following to Table 3.12 (Packed pixel field assignments):
First Second Third Fourth
Format Element Element Element Element

View file

@ -25,7 +25,7 @@ Number
Dependencies
Reguires EGL 1.4 or later. This extension is written against the
Requires EGL 1.4 or later. This extension is written against the
wording of the EGL 1.4 specification.
EGL_KHR_base_image is required.
@ -40,9 +40,9 @@ Overview
provides a new target for eglCreateImageKHR, to create an EGLImage
from a wl_buffer
Adding a implementation specific wayland interface, allows the
Adding an implementation specific wayland interface, allows the
EGL implementation to define specific wayland requests and events,
needed for buffer sharing in a EGL wayland platform.
needed for buffer sharing in an EGL wayland platform.
IP Status
@ -82,7 +82,7 @@ Additions to the EGL 1.4 Specification:
Import a wl_buffer by calling eglCreateImageKHR with
wl_buffer as EGLClientBuffer, EGL_WAYLAND_BUFFER_WL as the target,
and an empty attribute_list.
NULL context and an empty attribute_list.
Issues

View file

@ -62,6 +62,7 @@ a:visited {
<LI><A HREF="perf.html" target="MainFrame">Performance Tips</A>
<LI><A HREF="extensions.html" target="MainFrame">Mesa Extensions</A>
<LI><A HREF="mangling.html" target="MainFrame">Function Name Mangling</A>
<LI><A href="llvmpipe.html" target="MainFrame">Gallium llvmpipe driver</A>
</ul>
<b>Developer Topics</b>

View file

@ -21,76 +21,52 @@ When a new release is coming, release candidates (betas) may be found
<p>
Mesa is distributed in several parts:
The Mesa package is named MesaLib-x.y.z.{tar.bz2, tar.gz, zip} where x.y.z
is the version. There are three types of compressed archives.
</p>
<ul>
<li><b>MesaLib-x.y.z</b> - the main Mesa library source code, drivers
and documentation.
</li>
<li><b>MesaDemos-x.y.z</b> - OpenGL demonstration and test programs.
Most of the programs require GLUT (either the
<a href="http://www.opengl.org/resources/libraries/glut"
target="_parent">original GLUT by Mark Kilgard</a> or
<a href="http://freeglut.sourceforge.net" target="_parent">freeglut</a> or
<a href="http://openglut.sourceforge.net" target="_parent">OpenGLUT</a>).
</li>
<li><b>MesaGLUT-x.y.z</b> - Mark Kilgard's GLUT, easily compiled and used
with Mesa. Plus, other implementation of GLUT for DOS, OS/2, BeOS, etc.
</li>
</ul>
<p>
If you're not interested in running the demos, you'll only need the first
package.
There's also the MesaGLUT-x.y.z.{tar.bz2, tar.gz, zip} packages which
contain Mark Kilgard's GLUT library.
This is optional.
Most Linux distributions include an implementation of GLUT (such as freeglut).
</p>
<p>
In the past, the Mesa demos collection was distributed as
MesaDemos-x.y.z.{tar.bz2, tar.gz, zip}.
Now, the
<a href="ftp://ftp.freedesktop.org/pub/mesa/demos/" target="_parent">
Mesa demos</a> are distributed separately.
</p>
<p>
If you're new to this and not sure what you're doing, grab all three packages.
</p>
<p>
The packages are available in .tar.gz, .tar.bz2 and .zip formats.
Other sites might offer additional package formats.
</p>
<H1>Unpacking</H1>
<p>
All the packages should be in the same directory prior to unpacking.
To unpack .tar.gz files:
</p>
<ul>
<li>To unpack .tar.gz files:
<pre>
tar zxf MesaLib-X.Y.tar.gz
tar zxf MesaDemos-X.Y.tar.gz
tar zxf MesaGLUT-X.Y.tar.gz
tar zxf MesaLib-x.y.z.tar.gz
</pre>
or
<pre>
gzcat MesaLib-X.Y.tar.gz | tar xf -
gzcat MesaDemos-X.Y.tar.gz | tar xf -
gzcat MesaGLUT-X.Y.tar.gz | tar xf -
gzcat MesaLib-x.y.z.tar.gz | tar xf -
</pre>
or
<pre>
gunzip MesaLib-X.Y.tar.gz ; tar xf MesaLib-X.Y.tar
gunzip MesaDemos-X.Y.tar.gz ; tar xf MesaDemos-X.Y.tar
gunzip MesaGLUT-X.Y.tar.gz ; tar xf MesaGLUT-X.Y.tar
gunzip MesaLib-x.y.z.tar.gz ; tar xf MesaLib-x.y.z.tar
</pre>
<li>To unpack .tar.bz2 files:
<p>
To unpack .tar.bz2 files:
</p>
<pre>
bunzip2 -c MesaLib-X.Y.tar.gz | tar xf -
bunzip2 -c MesaDemos-X.Y.tar.gz | tar xf -
bunzip2 -c MesaGLUT-X.Y.tar.gz | tar xf -
bunzip2 -c MesaLib-x.y.z.tar.gz | tar xf -
</pre>
<li>To unpack .zip files:
<p>
To unpack .zip files:
</p>
<pre>
unzip MesaLib-X.Y.zip
unzip MesaDemos-X.Y.zip
unzip MesaGLUT-X.Y.zip
unzip MesaLib-x.y.z.zip
</pre>
</ul>
<h1>Contents</h1>
@ -106,22 +82,13 @@ bin/ - shell scripts for making shared libraries, etc
docs/ - documentation
src/ - source code for libraries
src/mesa - sources for the main Mesa library and device drivers
src/gallium - sources for Gallium and Gallium drivers
src/glu - libGLU source code
src/glx - sources for building libGL with full GLX and DRI support
src/glw - Xt/Motif/OpenGL widget code
</pre>
If you downloaded and unpacked the MesaDemos.X.Y package:
<pre>
progs/demos - original Mesa demos
progs/xdemos - GLX OpenGL/Mesa demos
progs/redbook - examples from the OpenGL Programming Guide
progs/samples - examples from SGI
progs/images/ - image files
</pre>
If you downloaded and unpacked the MesaGLUT.X.Y package:
If you downloaded and unpacked the MesaGLUT.x.y.z package:
<pre>
src/glut - GLUT library source code
</pre>

View file

@ -49,6 +49,15 @@ Setting this variable automatically sets the MESA_TEX_PROG variable as well.
<li>MESA_EXTENSION_OVERRIDE - can be used to enable/disable extensions.
A value such as "GL_EXT_foo -GL_EXT_bar" will enable the GL_EXT_foo extension
and disable the GL_EXT_bar extension.
<li>MESA_EXTENSION_MAX_YEAR - The GL_EXTENSIONS string returned by Mesa is sorted
by extension year.
If this variable is set to year X, only extensions defined on or before year
X will be reported.
This is to work-around a bug in some games where the extension string is
copied into a fixed-size buffer without truncating.
If the extension string is too long, the buffer overrun can cause the game
to crash.
This is a work-around for that.
<li>MESA_GLSL - <a href="shading.html#envvars">shading language compiler options</a>
</ul>

View file

@ -12,16 +12,16 @@
<ol>
<li><a href="#unix-x11">Unix / X11</a>
<ul>
<li><a href="#prereq">Prerequisites for DRI and hardware acceleration</a>
<li><a href="#prereq-general">General prerequisites for building</a>
<li><a href="#prereq-dri">Prerequisites for DRI and hardware acceleration</a>
<li><a href="#autoconf">Building with autoconf</a>
<li><a href="#traditional">Building with traditional Makefiles</a>
<li><a href="#libs">The Libraries</a>
<li><a href="#demos">Running the demos
<li><a href="#install">Installing the header and library files
<li><a href="#pkg-config">Building OpenGL programs with pkg-config
</ul>
<li><a href="#windows">Windows</a>
<li><a href="#scons">SCons</a>
<li><a href="#scons">Building with SCons</a>
<li><a href="#other">Other</a>
</ol>
<br>
@ -31,8 +31,22 @@
<H2>1. Unix/X11 Compilation and Installation</H1>
<a name="prereq">
<h3>1.1 Prerequisites for DRI and hardware acceleration</h3>
<a name="prereq-general">
<h3>1.1 General prerequisites for building</h3>
<ul>
<li>lex / yacc - for building the GLSL compiler.
On Linux systems, flex and bison are used.
Versions 2.5.35 and 2.4.1, respectively, (or later) should work.
</li>
<li>python - Python is needed for building the Gallium components.
Version 2.6.4 or later should work.
</li>
</ul>
<a name="prereq-dri">
<h3>1.2 Prerequisites for DRI and hardware acceleration</h3>
<p>
The following are required for DRI-based hardware acceleration with Mesa:
@ -49,7 +63,7 @@ version 2.4.15 or later
<a name="autoconf">
<h3>1.2 Building with Autoconf</h3>
<h3>1.3 Building with Autoconf</h3>
<p>
Mesa may be <a href="autoconf.html">built using autoconf</a>.
@ -59,7 +73,7 @@ If that fails the traditional Mesa build system is available.
<a name="traditional">
<h3>1.3 Building with traditional Makefiles</h3>
<h3>1.4 Building with traditional Makefiles</h3>
<p>
The traditional Mesa build system is based on a collection of pre-defined
@ -126,7 +140,7 @@ Later, if you want to rebuild for a different configuration run
<a name="libs">
<h3>1.4 The libraries</h3>
<h3>1.5 The libraries</h3>
<p>
When compilation has finished, look in the top-level <code>lib/</code>
@ -185,81 +199,11 @@ If you built the DRI hardware drivers, you'll also see the DRI drivers:
-rwxr-xr-x 1 brian users 10997120 Jul 21 12:13 unichrome_dri.so
</pre>
<a name="demos">
<h3>1.5 Running the demos</h3>
<p>
If you downloaded/unpacked the MesaDemos-x.y.z.tar.gz archive or
obtained Mesa from CVS, the <b>progs/</b> directory will contain a
bunch of demonstration programs.
If you built with Gallium support, look in lib/gallium/ for Gallium-based
versions of libGL and device drivers.
</p>
<p>
Before running a demo, you'll probably have to set two environment variables
to indicate where the libraries are located. For example:
<p>
<blockquote>
<b>cd lib/</b>
<br>
<b>export LD_LIBRARY_PATH=${PWD}</b>
<br>
<b>export LIBGL_DRIVERS_PATH=${PWD}</b> (if using DRI drivers)
</blockquote>
<p>
Next, change to the Mesa/demos/ directory:
</p>
<blockquote>
<b>cd ../progs/demos</b>
</blockquote>
<p>
Run a demo such as gears:
</p>
<blockquote>
<b>./gears</b>
</blockquote>
<p>
If this doesn't work, try the <b>Mesa/progs/xdemos/glxinfo</b> program
and see that it prints the expected Mesa version number.
</p>
<p>
If you're using Linux or a similar OS, verify that the demo program is
being linked with the proper library files:
</p>
<blockquote>
<b>ldd gears</b>
</blockquote>
<p>
You should see something like this:
</p>
<pre>
libglut.so.3 => /home/brian/Mesa/lib/libglut.so.3 (0x40013000)
libGLU.so.1 => /home/brian/Mesa/lib/libGLU.so.1 (0x40051000)
libGL.so.1 => /home/brian/Mesa/lib/libGL.so.1 (0x400e0000)
libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
libm.so.6 => /lib/i686/libm.so.6 (0x403da000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x403fc000)
libXmu.so.6 => /usr/X11R6/lib/libXmu.so.6 (0x404da000)
libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x404f1000)
libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x40543000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4054b000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x405fd000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40605000)
libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40613000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
libdl.so.2 => /lib/libdl.so.2 (0x40644000)
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40647000)
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x40650000)
</pre>
<p>
Retrace your steps if this doesn't look right.
</p>
<a name="install">

View file

@ -1,61 +1,116 @@
LLVMPIPE -- a fork of softpipe that employs LLVM for code generation.
<HTML>
<TITLE>llvmpipe</TITLE>
<link rel="stylesheet" type="text/css" href="mesa.css"></head>
<BODY>
<H1>Introduction</H1>
<p>
The Gallium llvmpipe driver is a software rasterizer that uses LLVM to
do runtime code generation.
Shaders, point/line/triangle rasterization and vertex processing are
implemented with LLVM IR which is translated to x86 or x86-64 machine
code.
Also, the driver is multithreaded to take advantage of multiple CPU cores
(up to 8 at this time).
It's the fastest software rasterizer for Mesa.
</p>
Requirements
============
<h1>Requirements</h1>
- A x86 or amd64 processor. 64bit mode is preferred.
<dl>
<dt>An x86 or amd64 processor. 64-bit mode is preferred.</dt>
<dd>
<p>
Support for sse2 is strongly encouraged. Support for ssse3, and sse4.1 will
yield the most efficient code. The less features the CPU has the more
likely is that you ran into underperforming, buggy, or incomplete code.
</p>
<p>
See /proc/cpuinfo to know what your CPU supports.
- LLVM. Version 2.8 recommended. 2.6 or later required.
</p>
</dd>
<dt>LLVM. Version 2.8 recommended. 2.6 or later required.</dt>
<dd>
<p>
<b>NOTE</b>: LLVM 2.8 and earlier will not work on systems that support the
Intel AVX extensions (e.g. Sandybridge). LLVM's code generator will
fail when trying to emit AVX instructions. This was fixed in LLVM 2.9.
</p>
<p>
For Linux, on a recent Debian based distribution do:
</p>
<pre>
aptitude install llvm-dev
</pre>
For a RPM-based distribution do:
</p>
<pre>
yum install llvm-devel
</pre>
<p>
For Windows download pre-built MSVC 9.0 or MinGW binaries from
http://people.freedesktop.org/~jrfonseca/llvm/ and set the LLVM environment
variable to the extracted path.
</p>
<p>
For MSVC there are two set of binaries: llvm-x.x-msvc32mt.7z and
llvm-x.x-msvc32mtd.7z .
</p>
<p>
You have to set the LLVM=/path/to/llvm-x.x-msvc32mtd env var when passing
debug=yes to scons, and LLVM=/path/to/llvm-x.x-msvc32mt when building with
debug=no. This is necessary as LLVM builds as static library so the chosen
MS CRT must match.
</p>
</dd>
- scons (optional)
<dt>scons (optional)</dt>
</dl>
Building
========
<h1>Building</h1>
To build everything on Linux invoke scons as:
<pre>
scons build=debug libgl-xlib
</pre>
Alternatively, you can build it with GNU make, if you prefer, by invoking it as
<pre>
make linux-llvm
</pre>
but the rest of these instructions assume that scons is used.
For windows is everything the except except the winsys:
<pre>
scons build=debug libgl-gdi
</pre>
Using
=====
<h1>Using</h1>
On Linux, building will create a drop-in alternative for libGL.so into
<pre>
build/foo/gallium/targets/libgl-xlib/libGL.so
</pre>
or
<pre>
lib/gallium/libGL.so
</pre>
To use it set the LD_LIBRARY_PATH environment variable accordingly.
@ -68,19 +123,20 @@ replacing the native ICD driver, but it's quite an advanced usage, so if you
need to ask, don't even try it.
Profiling
=========
<h1>Profiling</h1>
To profile llvmpipe you should pass the options
<pre>
scons build=profile <same-as-before>
</pre>
This will ensure that frame pointers are used both in C and JIT functions, and
that no tail call optimizations are done by gcc.
To better profile JIT code you'll need to build LLVM with oprofile integration.
<pre>
./configure \
--prefix=$install_dir \
--enable-optimized \
@ -92,43 +148,57 @@ To better profile JIT code you'll need to build LLVM with oprofile integration.
make -C "$build_dir" install
find "$install_dir/lib" -iname '*.a' -print0 | xargs -0 strip --strip-debug
</pre>
The you should define
<pre>
export LLVM=/path/to/llvm-2.6-profile
</pre>
and rebuild.
Unit testing
============
<h1>Unit testing</h1>
<p>
Building will also create several unit tests in
build/linux-???-debug/gallium/drivers/llvmpipe:
</p>
- lp_test_blend: blending
- lp_test_conv: SIMD vector conversion
- lp_test_format: pixel unpacking/packing
</ul>
<li> lp_test_blend: blending
<li> lp_test_conv: SIMD vector conversion
<li> lp_test_format: pixel unpacking/packing
</ul>
<p>
Some of this tests can output results and benchmarks to a tab-separated-file
for posterior analysis, e.g.:
</p>
<pre>
build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_blend -o blend.tsv
</pre>
Development Notes
=================
<h1>Development Notes</h1>
- When looking to this code by the first time start in lp_state_fs.c, and
<ul>
<li>
When looking to this code by the first time start in lp_state_fs.c, and
then skim through the lp_bld_* functions called in there, and the comments
at the top of the lp_bld_*.c functions.
- The driver-independent parts of the LLVM / Gallium code are found in
</li>
<li>
The driver-independent parts of the LLVM / Gallium code are found in
src/gallium/auxiliary/gallivm/. The filenames and function prefixes
need to be renamed from "lp_bld_" to something else though.
- We use LLVM-C bindings for now. They are not documented, but follow the C++
</li>
<li>
We use LLVM-C bindings for now. They are not documented, but follow the C++
interfaces very closely, and appear to be complete enough for code
generation. See
http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
for a stand-alone example. See the llvm-c/Core.h file for reference.
</li>
</ul>

View file

@ -11,6 +11,13 @@
<H1>News</H1>
<h2>April 6, 2011</h2>
<p>
<a href="relnotes-7.10.2.html">Mesa 7.10.2</a> is released. This is a bug
fix release release.
</p>
<h2>March 2, 2011</h2>
<p>

31
docs/patents.txt Normal file
View file

@ -0,0 +1,31 @@
ARB_texture_float:
Silicon Graphics, Inc. owns US Patent #6,650,327, issued November 18,
2003 [1].
SGI believes this patent contains necessary IP for graphics systems
implementing floating point rasterization and floating point
framebuffer capabilities described in ARB_texture_float extension, and
will discuss licensing on RAND terms, on an individual basis with
companies wishing to use this IP in the context of conformant OpenGL
implementations [2].
The source code to implement ARB_texture_float extension is included
and can be toggled on at compile time, for those who purchased a
license from SGI, or are in a country where the patent does not apply,
etc.
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.
You should contact a lawyer or SGI's legal department if you want to
enable this extension.
[1] http://www.google.com/patents/about?id=mIIOAAAAEBAJ&dq=6650327
[2] http://www.opengl.org/registry/specs/ARB/texture_float.txt

206
docs/relnotes-7.10.2.html Normal file
View file

@ -0,0 +1,206 @@
<HTML>
<head>
<TITLE>Mesa Release Notes</TITLE>
<link rel="stylesheet" type="text/css" href="mesa.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<BODY>
<body bgcolor="#eeeeee">
<H1>Mesa 7.10.2 Release Notes / April 6, 2011</H1>
<p>
Mesa 7.10.2 is a bug fix release which fixes bugs found since the 7.10 release.
</p>
<p>
Mesa 7.10.2 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>
2f9f444265534a2cfd9a99d1a8291089 MesaLib-7.10.2.tar.gz
f5de82852f1243f42cc004039e10b771 MesaLib-7.10.2.tar.bz2
47836e37bab6fcafe3ac90c9544ba0e9 MesaLib-7.10.2.zip
175120325828f313621cc5bc6c504803 MesaGLUT-7.10.2.tar.gz
8c71d273f5f8d6c5eda4ffc39e0fe03e MesaGLUT-7.10.2.tar.bz2
03036c8efe7b791a90fa0f2c41b43f43 MesaGLUT-7.10.2.zip
</pre>
<h2>New features</h2>
<p>None.</p>
<h2>Bug fixes</h2>
<p>This list is likely incomplete.</p>
<ul>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29172">Bug 29172</a> - Arrandale - Pill Popper Pops Pills</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=31159">Bug 31159</a> - shadow problem in 0ad game</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32688">Bug 32688</a> - [RADEON:KMS:R300G] some games have a wireframe or outline visible</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=32949">Bug 32949</a> - [glsl wine] Need for Speed renders incorrectly with GLSL enabled</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34203">Bug 34203</a> - [GLSL] fail to call long chains across shaders</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34376">Bug 34376</a> - [GLSL] allowing assignment to unsized array
<ul>
<li>The commit message incorrectly
lists <a href="https://bugs.freedesktop.org/show_bug.cgi?id=34367">bug
34367</a>.</li>
</ul>
</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34370">Bug 34370</a> - [GLSL] "i&lt;5 &amp;&amp; i&lt;4" in for loop fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=34374">Bug 34374</a> - [GLSL] fail to redeclare an array using initializer</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=35073">Bug 35073</a> - [GM45] Alpha test is broken when rendering to FBO with no color attachment</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=35483">Bug 35483</a> - util_blit_pixels_writemask: crash in line 322 of src/gallium/auxiliary/util/u_blit.c</li>
<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li> -->
</ul>
<h2>Changes</h2>
<p>The full set of changes can be viewed by using the following GIT command:</p>
<pre>
git log mesa-7.10.1..mesa-7.10.2
</pre>
<p><em>Note:</em> Reverted commits and the reverts are not included in this list.</p>
<p>Alex Deucher (2):
<ul>
<li>r600c: add new ontario pci ids</li>
<li>r600g: add some additional ontario pci ids</li>
</ul></p>
<p>Benjamin Franzke (1):
<ul>
<li>st/dri: Fix surfaceless gl using contexts with previous bound surfaces</li>
</ul></p>
<p>Brian Paul (9):
<ul>
<li>docs: pull 7.9.2 release notes into 7.10 branch</li>
<li>docs: update news.html with 7.10.1 and 7.9.2 releases</li>
<li>docs: fill in 7.10.1 release data</li>
<li>docs: add, fix release notes links</li>
<li>docs: update info about Mesa packaging/contents</li>
<li>docs: update prerequisites, remove old demo info</li>
<li>mesa: Guard against null pointer deref in fbo validation</li>
<li>st/mesa: Apply LOD bias from correct texture unit</li>
<li>glsl: silence warning in printf() with a cast</li>
</ul></p>
<p>Chad Versace (1):
<ul>
<li>i965: Fix tex_swizzle when depth mode is GL_RED</li>
</ul></p>
<p>Dave Airlie (1):
<ul>
<li>r600: don't close fd on failed load</li>
</ul></p>
<p>Eric Anholt (2):
<ul>
<li>i965: Apply a workaround for the Ironlake "vertex flashing".</li>
<li>i965: Fix alpha testing when there is no color buffer in the FBO.</li>
</ul></p>
<p>Fabian Bieler (1):
<ul>
<li>st/mesa: Apply LOD from texture object</li>
</ul></p>
<p>Henri Verbeet (1):
<ul>
<li>st/mesa: Validate state before doing blits.</li>
</ul></p>
<p>Ian Romanick (13):
<ul>
<li>docs: Add 7.10.1 md5sums</li>
<li>glsl: Refactor AST-to-HIR code handling variable initializers</li>
<li>glsl: Refactor AST-to-HIR code handling variable redeclarations</li>
<li>glsl: Process redeclarations before initializers</li>
<li>glsl: Function signatures cannot have NULL return type</li>
<li>glsl: Add several function / call related validations</li>
<li>linker: Add imported functions to the linked IR</li>
<li>glsl: Use insert_before for lists instead of open coding it</li>
<li>glsl: Only allow unsized array assignment in an initializer</li>
<li>glcpp: Refresh autogenerated lexer files</li>
<li>docs: Initial bits of 7.10.2 release notes</li>
<li>mesa: set version string to 7.10.2</li>
<li>mesa: Remove nonexistant files from _FILES lists</li>
</ul></p>
<p>Jerome Glisse (1):
<ul>
<li>r600g: move user fence into base radeon structure</li>
</ul></p>
<p>José Fonseca (2):
<ul>
<li>mesa: Fix typo glGet*v(GL_TEXTURE_COORD_ARRAY_*).</li>
<li>mesa: More glGet* fixes.</li>
</ul></p>
<p>Kenneth Graunke (4):
<ul>
<li>glcpp: Rework lexer to use a SKIP state rather than REJECT.</li>
<li>glcpp: Remove trailing contexts from #if rules.</li>
<li>i965/fs: Fix linear gl_Color interpolation on pre-gen6 hardware.</li>
<li>glsl: Accept precision qualifiers on sampler types, but only in ES.</li>
</ul></p>
<p>Marek Olšák (15):
<ul>
<li>st/mesa: fix crash when DrawBuffer-&gt;_ColorDrawBuffers[0] is NULL</li>
<li>st/mesa: fail to alloc a renderbuffer if st_choose_renderbuffer_format fails</li>
<li>r300/compiler: fix the saturate modifier when applied to TEX instructions</li>
<li>r300/compiler: fix translating the src negate bits in pair_translate</li>
<li>r300/compiler: Abs doesn't cancel Negate (in the conversion to native swizzles)</li>
<li>r300/compiler: TEX instructions don't support negation on source arguments</li>
<li>r300/compiler: do not set TEX_IGNORE_UNCOVERED on r500</li>
<li>r300/compiler: saturate Z before the shadow comparison</li>
<li>r300/compiler: fix equal and notequal shadow compare functions</li>
<li>r300/compiler: remove unused variables</li>
<li>st/mesa: fix crash when using both user and vbo buffers with the same stride</li>
<li>r300g: fix alpha-test with no colorbuffer</li>
<li>r300g: tell the GLSL compiler to lower the continue opcode</li>
<li>r300/compiler: propagate SaturateMode down to the result of shadow comparison</li>
<li>r300/compiler: apply the texture swizzle to shadow pass and fail values too</li>
</ul></p>
<p>Michel Dänzer (1):
<ul>
<li>Use proper source row stride when getting depth/stencil texels.</li>
</ul></p>
<p>Tom Stellard (4):
<ul>
<li>r300/compiler: Use a 4-bit writemask in pair instructions</li>
<li>prog_optimize: Fix reallocating registers for shaders with loops</li>
<li>r300/compiler: Fix vertex shader MAD instructions with constant swizzles</li>
<li>r300/compiler: Don't try to convert RGB to Alpha in full instructions</li>
</ul></p>
</body>
</html>

View file

@ -36,11 +36,22 @@ tbd
<h2>New features</h2>
<ul>
<li>GL_ARB_color_buffer_float (gallium drivers, i965)
<li>GL_ARB_draw_buffers_blend (gallium)
<li>GL_ARB_draw_instanced extension (gallium drivers, swrast)
<li>GL_ARB_instanced_arrays extension (gallium drivers)
<li>GL_ARB_texture_compression_rgtc (gallium r600, swrast)
<li>GL_ARB_draw_buffers_blend (gallium)
<li>GL_ARB_occlusion_query2 (gallium drivers, swrast)
<li>GL_ARB_sampler_objects (gallium drivers)
<li>GL_ARB_texture_compression_rgtc (gallium drivers, swrast)
<li>GL_ARB_texture_float (gallium, i965)
<li>GL_EXT_texture_compression_latc (gallium drivers, swrast)
<li>GL_EXT_texture_compression_rgtc (gallium drivers, swrast)
<li>GL_EXT_texture_sRGB_decode (gallium drivers, swrast, i965)
<li>GL_EXT_texture_snorm (gallium drivers)
<li>GL_ATI_draw_buffers (all drivers)
<li>GL_ATI_texture_compression_3dc (gallium drivers, swrast)
<li>GL_ATI_texture_float (gallium, i965)
<li>GL_NV_texture_barrier (gallium drivers)
</ul>

View file

@ -14,6 +14,7 @@ The release notes summarize what's new or changed in each Mesa release.
<UL>
<LI><A HREF="relnotes-7.11.html">7.11 release notes</A>
<LI><A HREF="relnotes-7.10.2.html">7.10.2 release notes</A>
<LI><A HREF="relnotes-7.10.1.html">7.10.1 release notes</A>
<LI><A HREF="relnotes-7.10.html">7.10 release notes</A>
<LI><A HREF="relnotes-7.9.2.html">7.9.2 release notes</A>

View file

@ -80,7 +80,7 @@ typedef void *EGLNativePixmapType;
#elif defined(WL_EGL_PLATFORM)
typedef struct wl_egl_display *EGLNativeDisplayType;
typedef struct wl_display *EGLNativeDisplayType;
typedef struct wl_egl_pixmap *EGLNativePixmapType;
typedef struct wl_egl_window *EGLNativeWindowType;

View file

@ -655,6 +655,8 @@ typedef double GLclampd; /* double precision float in [0,1] */
#define GL_TEXTURE_ENV_COLOR 0x2201
#define GL_TEXTURE_GEN_S 0x0C60
#define GL_TEXTURE_GEN_T 0x0C61
#define GL_TEXTURE_GEN_R 0x0C62
#define GL_TEXTURE_GEN_Q 0x0C63
#define GL_TEXTURE_GEN_MODE 0x2500
#define GL_TEXTURE_BORDER_COLOR 0x1004
#define GL_TEXTURE_WIDTH 0x1000
@ -685,8 +687,6 @@ typedef double GLclampd; /* double precision float in [0,1] */
#define GL_T 0x2001
#define GL_R 0x2002
#define GL_Q 0x2003
#define GL_TEXTURE_GEN_R 0x0C62
#define GL_TEXTURE_GEN_Q 0x0C63
/* Utility */
#define GL_VENDOR 0x1F00

View file

@ -1,72 +0,0 @@
"""gallium
Frontend-tool for Gallium3D architecture.
"""
#
# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
# 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 TUNGSTEN GRAPHICS 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.
#
import sys
import distutils.sysconfig
import os.path
def generate(env):
# See http://www.scons.org/wiki/PythonExtensions
if sys.platform in ['win32']:
python_root = sys.prefix
python_version = '%u%u' % sys.version_info[:2]
python_include = os.path.join(python_root, 'include')
python_libs = os.path.join(python_root, 'libs')
python_lib = os.path.join(python_libs, 'python' + python_version + '.lib')
env.Append(CPPPATH = [python_include])
env.Append(LIBPATH = [python_libs])
env.Append(LIBS = ['python' + python_version + '.lib'])
env.Replace(SHLIBPREFIX = '')
env.Replace(SHLIBSUFFIX = '.pyd')
# XXX; python25_d.lib is not included in Python for windows, and
# we'll get missing symbols unless we undefine _DEBUG
cppdefines = env['CPPDEFINES']
cppdefines = [define for define in cppdefines if define != '_DEBUG']
env.Replace(CPPDEFINES = cppdefines)
env.AppendUnique(CPPFLAGS = ['/U_DEBUG'])
env.AppendUnique(LINKFLAGS = ['/nodefaultlib:python25_d.lib'])
else:
#env.ParseConfig('python-config --cflags --ldflags --libs')
env.AppendUnique(CPPPATH = [distutils.sysconfig.get_python_inc()])
env.Replace(SHLIBPREFIX = '')
env.Replace(SHLIBSUFFIX = distutils.sysconfig.get_config_vars()['SO'])
# for debugging
#print env.Dump()
def exists(env):
return 1

View file

@ -462,6 +462,12 @@ dri2_create_screen(_EGLDisplay *disp)
}
}
if (dri2_dpy->image) {
disp->Extensions.MESA_drm_image = EGL_TRUE;
disp->Extensions.KHR_image_base = EGL_TRUE;
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
}
return EGL_TRUE;
cleanup_dri_screen:

View file

@ -85,8 +85,10 @@ struct dri2_egl_display
__DRIswrastLoaderExtension swrast_loader_extension;
const __DRIextension *extensions[3];
#ifdef HAVE_WAYLAND_PLATFORM
struct wl_egl_display *wl_dpy;
struct wl_display *wl_dpy;
struct wl_drm *wl_server_drm;
struct wl_drm *wl_drm;
int authenticated;
#endif
int (*authenticate) (_EGLDisplay *disp, uint32_t id);

View file

@ -708,11 +708,6 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
for (i = 0; dri2_dpy->driver_configs[i]; i++)
dri2_add_config(disp, dri2_dpy->driver_configs[i], i + 1, 0, 0, NULL);
disp->Extensions.MESA_drm_image = EGL_TRUE;
disp->Extensions.KHR_image_base = EGL_TRUE;
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
#ifdef HAVE_WAYLAND_PLATFORM
disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
#endif

View file

@ -32,6 +32,8 @@
#include <dlfcn.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <xf86drm.h>
#include "egl_dri2.h"
@ -107,7 +109,7 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
dri2_surf->base.Width = dri2_surf->wl_pix->width;
dri2_surf->base.Height = dri2_surf->wl_pix->height;
if (dri2_surf->wl_pix->name > 0) {
if (dri2_surf->wl_pix->driver_private) {
dri2_buf = dri2_surf->wl_pix->driver_private;
dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT] = dri2_buf->dri_buffer;
}
@ -204,7 +206,19 @@ dri2_wl_egl_pixmap_destroy(struct wl_egl_pixmap *egl_pixmap)
egl_pixmap->driver_private = NULL;
egl_pixmap->destroy = NULL;
egl_pixmap->name = 0;
}
static struct wl_buffer *
wayland_create_buffer(struct dri2_egl_surface *dri2_surf,
__DRIbuffer *buffer,
struct wl_visual *visual)
{
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
return wl_drm_create_buffer(dri2_dpy->wl_drm, buffer->name,
dri2_surf->base.Width, dri2_surf->base.Height,
buffer->pitch, visual);
}
static void
@ -244,8 +258,6 @@ dri2_process_front_buffer(struct dri2_egl_surface *dri2_surf, unsigned format)
dri2_buf->dri_buffer = dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT];
dri2_buf->dri2_dpy = dri2_dpy;
dri2_surf->wl_pix->name = dri2_buf->dri_buffer->name;
dri2_surf->wl_pix->stride = dri2_buf->dri_buffer->pitch;
dri2_surf->wl_pix->driver_private = dri2_buf;
dri2_surf->wl_pix->destroy = dri2_wl_egl_pixmap_destroy;
break;
@ -282,9 +294,9 @@ dri2_release_buffers(struct dri2_egl_surface *dri2_surf)
switch (i) {
case __DRI_BUFFER_FRONT_LEFT:
if (dri2_surf->pending_buffer)
force_roundtrip(dri2_dpy->wl_dpy->display);
force_roundtrip(dri2_dpy->wl_dpy);
dri2_surf->pending_buffer = dri2_surf->dri_buffers[i];
wl_display_sync_callback(dri2_dpy->wl_dpy->display,
wl_display_sync_callback(dri2_dpy->wl_dpy,
dri2_release_pending_buffer, dri2_surf);
break;
default:
@ -357,6 +369,12 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
assert(dri2_surf->type == DRI2_PIXMAP_SURFACE ||
dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]);
if (dri2_surf->type == DRI2_PIXMAP_SURFACE && !dri2_surf->wl_pix->buffer)
dri2_surf->wl_pix->buffer =
wayland_create_buffer(dri2_surf,
dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT],
dri2_surf->wl_pix->visual);
*out_count = dri2_surf->buffer_count;
if (dri2_surf->buffer_count == 0)
return NULL;
@ -417,19 +435,8 @@ dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
#endif
}
static struct wl_buffer *
wayland_create_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
{
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
return wl_drm_create_buffer(dri2_dpy->wl_dpy->drm, buffer->name,
dri2_surf->base.Width, dri2_surf->base.Height,
buffer->pitch, dri2_surf->wl_win->visual);
}
static void
wayland_frame_callback(void *data, uint32_t time)
wayland_frame_callback(struct wl_surface *surface, void *data, uint32_t time)
{
struct dri2_egl_surface *dri2_surf = data;
@ -455,11 +462,12 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
while (dri2_surf->block_swap_buffers)
wl_display_iterate(dri2_dpy->wl_dpy->display, WL_DISPLAY_READABLE);
wl_display_iterate(dri2_dpy->wl_dpy, WL_DISPLAY_READABLE);
dri2_surf->block_swap_buffers = EGL_TRUE;
wl_display_frame_callback(dri2_dpy->wl_dpy->display,
wayland_frame_callback, dri2_surf);
wl_display_frame_callback(dri2_dpy->wl_dpy,
dri2_surf->wl_win->surface,
wayland_frame_callback, dri2_surf);
if (dri2_surf->type == DRI2_WINDOW_SURFACE) {
pointer_swap(
@ -477,8 +485,11 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
if (!dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT])
dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT] =
wayland_create_buffer(dri2_surf,
dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT]);
dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT],
dri2_surf->wl_win->visual);
wl_buffer_damage(dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT], 0, 0,
dri2_surf->base.Width, dri2_surf->base.Height);
wl_surface_attach(dri2_surf->wl_win->surface,
dri2_surf->wl_drm_buffer[WL_BUFFER_FRONT],
dri2_surf->dx, dri2_surf->dy);
@ -535,18 +546,23 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
wl_egl_pixmap->width,
wl_egl_pixmap->height);
wl_egl_pixmap->name = dri2_buf->dri_buffer->name;
wl_egl_pixmap->stride = dri2_buf->dri_buffer->pitch;
wl_egl_pixmap->destroy = dri2_wl_egl_pixmap_destroy;
wl_egl_pixmap->driver_private = dri2_buf;
wl_egl_pixmap->buffer =
wl_drm_create_buffer(dri2_dpy->wl_drm,
dri2_buf->dri_buffer->name,
wl_egl_pixmap->width,
wl_egl_pixmap->height,
dri2_buf->dri_buffer->pitch,
wl_egl_pixmap->visual);
wl_attr_list[1] = wl_egl_pixmap->width;
wl_attr_list[3] = wl_egl_pixmap->height;
wl_attr_list[5] = wl_egl_pixmap->stride / 4;
wl_attr_list[5] = dri2_buf->dri_buffer->pitch / 4;
return dri2_create_image_khr(disp->Driver, disp, ctx, EGL_DRM_BUFFER_MESA,
(EGLClientBuffer)(intptr_t) wl_egl_pixmap->name, wl_attr_list);
(EGLClientBuffer)(intptr_t) dri2_buf->dri_buffer->name, wl_attr_list);
}
static _EGLImage *
@ -570,16 +586,16 @@ dri2_wayland_authenticate(_EGLDisplay *disp, uint32_t id)
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
int ret = 0;
dri2_dpy->wl_dpy->authenticated = false;
dri2_dpy->authenticated = false;
wl_drm_authenticate(dri2_dpy->wl_dpy->drm, id);
force_roundtrip(dri2_dpy->wl_dpy->display);
wl_drm_authenticate(dri2_dpy->wl_drm, id);
force_roundtrip(dri2_dpy->wl_dpy);
if (!dri2_dpy->wl_dpy->authenticated)
if (!dri2_dpy->authenticated)
ret = -1;
/* reset authenticated */
dri2_dpy->wl_dpy->authenticated = true;
dri2_dpy->authenticated = true;
return ret;
}
@ -605,10 +621,45 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
return EGL_TRUE;
}
static void
drm_handle_device(void *data, struct wl_drm *drm, const char *device)
{
struct dri2_egl_display *dri2_dpy = data;
drm_magic_t magic;
dri2_dpy->device_name = strdup(device);
if (!dri2_dpy->device_name)
return;
dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR);
if (dri2_dpy->fd == -1) {
_eglLog(_EGL_WARNING, "wayland-egl: could not open %s (%s)",
dri2_dpy->device_name, strerror(errno));
return;
}
drmGetMagic(dri2_dpy->fd, &magic);
wl_drm_authenticate(dri2_dpy->wl_drm, magic);
}
static void
drm_handle_authenticated(void *data, struct wl_drm *drm)
{
struct dri2_egl_display *dri2_dpy = data;
dri2_dpy->authenticated = true;
}
static const struct wl_drm_listener drm_listener = {
drm_handle_device,
drm_handle_authenticated
};
EGLBoolean
dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy;
uint32_t id;
int i;
drv->API.CreateWindowSurface = dri2_create_window_surface;
@ -627,21 +678,23 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
disp->DriverData = (void *) dri2_dpy;
dri2_dpy->wl_dpy = disp->PlatformDisplay;
if (dri2_dpy->wl_dpy->fd == -1)
force_roundtrip(dri2_dpy->wl_dpy->display);
if (dri2_dpy->wl_dpy->fd == -1)
id = wl_display_get_global(dri2_dpy->wl_dpy, "wl_drm", 1);
if (id == 0)
wl_display_iterate(dri2_dpy->wl_dpy, WL_DISPLAY_READABLE);
id = wl_display_get_global(dri2_dpy->wl_dpy, "wl_drm", 1);
if (id == 0)
goto cleanup_dpy;
dri2_dpy->wl_drm = wl_drm_create(dri2_dpy->wl_dpy, id, 1);
if (!dri2_dpy->wl_drm)
goto cleanup_dpy;
wl_drm_add_listener(dri2_dpy->wl_drm, &drm_listener, dri2_dpy);
force_roundtrip(dri2_dpy->wl_dpy);
if (dri2_dpy->fd == -1)
goto cleanup_drm;
dri2_dpy->fd = dup(dri2_dpy->wl_dpy->fd);
if (dri2_dpy->fd < 0) {
_eglError(EGL_BAD_ALLOC, "DRI2: failed to dup fd");
goto cleanup_dpy;
}
if (!dri2_dpy->wl_dpy->authenticated)
force_roundtrip(dri2_dpy->wl_dpy->display);
if (!dri2_dpy->wl_dpy->authenticated)
goto cleanup_dpy;
force_roundtrip(dri2_dpy->wl_dpy);
if (!dri2_dpy->authenticated)
goto cleanup_fd;
dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd);
if (dri2_dpy->driver_name == NULL) {
@ -649,14 +702,8 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
goto cleanup_fd;
}
dri2_dpy->device_name = strdup(dri2_dpy->wl_dpy->device_name);
if (dri2_dpy->device_name == NULL) {
_eglError(EGL_BAD_ALLOC, "DRI2: failed to get device name");
goto cleanup_driver_name;
}
if (!dri2_load_driver(disp))
goto cleanup_device_name;
goto cleanup_driver_name;
dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER;
dri2_dpy->dri2_loader_extension.base.version = 3;
@ -677,11 +724,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
EGL_WINDOW_BIT | EGL_PIXMAP_BIT, NULL);
disp->Extensions.MESA_drm_image = EGL_TRUE;
disp->Extensions.KHR_image_base = EGL_TRUE;
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
dri2_dpy->authenticate = dri2_wayland_authenticate;
@ -694,12 +737,13 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
cleanup_driver:
dlclose(dri2_dpy->driver);
cleanup_device_name:
free(dri2_dpy->device_name);
cleanup_driver_name:
free(dri2_dpy->driver_name);
cleanup_fd:
close(dri2_dpy->fd);
cleanup_drm:
free(dri2_dpy->device_name);
wl_drm_destroy(dri2_dpy->wl_drm);
cleanup_dpy:
free(dri2_dpy);

View file

@ -231,7 +231,7 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
if (dri2_dpy->dri2) {
xcb_dri2_create_drawable (dri2_dpy->conn, dri2_surf->drawable);
} else {
swrastCreateDrawable(dri2_dpy, dri2_surf, _eglGetConfigKey(conf, EGL_DEPTH_SIZE));
swrastCreateDrawable(dri2_dpy, dri2_surf, _eglGetConfigKey(conf, EGL_BUFFER_SIZE));
}
if (type != EGL_PBUFFER_BIT) {
@ -990,7 +990,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
if (!dri2_load_driver(disp))
goto cleanup_conn;
dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR);
dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR | O_CLOEXEC);
if (dri2_dpy->fd == -1) {
_eglLog(_EGL_WARNING,
"DRI2: could not open %s (%s)", dri2_dpy->device_name,
@ -1030,11 +1030,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
goto cleanup_configs;
}
disp->Extensions.MESA_drm_image = EGL_TRUE;
disp->Extensions.KHR_image_base = EGL_TRUE;
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
disp->Extensions.NOK_swap_region = EGL_TRUE;
disp->Extensions.NOK_texture_from_pixmap = EGL_TRUE;

View file

@ -12,7 +12,8 @@ wayland_drm_OBJECTS = $(wayland_drm_SOURCES:.c=.o)
wayland_drm_INCLUDES = \
$(WAYLAND_CFLAGS) \
-I$(TOP)/src/egl/main
-I$(TOP)/src/egl/main \
-I$(TOP)/include
# Generate protocol sources
prefix=$(shell pkg-config --variable=prefix wayland-server)

View file

@ -2,7 +2,7 @@
<protocol name="drm">
<!-- drm support. This object is created by the server and published
using the display's global event. -->
<interface name="drm" version="1">
<interface name="wl_drm" version="1">
<!-- Call this request with the magic received from drmGetMagic().
It will be passed on to the drmAuthMagic() or
DRIAuthConnection() call. This authentication must be
@ -14,12 +14,12 @@
<!-- Create a wayland buffer for the named DRM buffer. The DRM
surface must have a name using the flink ioctl -->
<request name="create_buffer">
<arg name="id" type="new_id" interface="buffer"/>
<arg name="id" type="new_id" interface="wl_buffer"/>
<arg name="name" type="uint"/>
<arg name="width" type="int"/>
<arg name="height" type="int"/>
<arg name="stride" type="uint"/>
<arg name="visual" type="object" interface="visual"/>
<arg name="visual" type="object" interface="wl_visual"/>
</request>
<!-- Notification of the path of the drm device which is used by

View file

@ -51,9 +51,8 @@ struct wl_drm {
};
static void
drm_buffer_damage(struct wl_buffer *buffer_base,
struct wl_surface *surface,
int32_t x, int32_t y, int32_t width, int32_t height)
buffer_damage(struct wl_client *client, struct wl_buffer *buffer,
int32_t x, int32_t y, int32_t width, int32_t height)
{
}
@ -74,6 +73,7 @@ buffer_destroy(struct wl_client *client, struct wl_buffer *buffer)
}
const static struct wl_buffer_interface buffer_interface = {
buffer_damage,
buffer_destroy
};
@ -103,8 +103,6 @@ drm_create_buffer(struct wl_client *client, struct wl_drm *drm,
buffer->buffer.width = width;
buffer->buffer.height = height;
buffer->buffer.visual = visual;
buffer->buffer.attach = NULL;
buffer->buffer.damage = drm_buffer_damage;
if (visual->object.interface != &wl_visual_interface) {
/* FIXME: Define a real exception event instead of
@ -164,7 +162,9 @@ const static struct wl_drm_interface drm_interface = {
};
static void
post_drm_device(struct wl_client *client, struct wl_object *global)
post_drm_device(struct wl_client *client,
struct wl_object *global,
uint32_t version)
{
struct wl_drm *drm = (struct wl_drm *) global;

View file

@ -42,11 +42,10 @@ struct wl_egl_window {
struct wl_egl_pixmap {
struct wl_egl_display *display;
struct wl_visual *visual;
struct wl_buffer *buffer;
int name;
int width;
int height;
int stride;
void (*destroy) (struct wl_egl_pixmap *egl_pixmap);

View file

@ -17,115 +17,6 @@
#include "wayland-drm-client-protocol.h"
#include <xf86drm.h>
static void
drm_handle_device(void *data, struct wl_drm *drm, const char *device)
{
struct wl_egl_display *egl_display = data;
drm_magic_t magic;
egl_display->device_name = strdup(device);
egl_display->fd = open(egl_display->device_name, O_RDWR);
if (egl_display->fd == -1) {
fprintf(stderr, "wayland-egl: could not open %s (%s)",
egl_display->device_name, strerror(errno));
return;
}
drmGetMagic(egl_display->fd, &magic);
wl_drm_authenticate(egl_display->drm, magic);
}
static void
drm_handle_authenticated(void *data, struct wl_drm *drm)
{
struct wl_egl_display *egl_display = data;
egl_display->authenticated = true;
}
static const struct wl_drm_listener drm_listener = {
drm_handle_device,
drm_handle_authenticated
};
static void
wl_display_handle_global(struct wl_display *display, uint32_t id,
const char *interface, uint32_t version, void *data)
{
struct wl_egl_display *egl_display = data;
if (strcmp(interface, "drm") == 0) {
egl_display->drm = wl_drm_create(display, id);
wl_drm_add_listener(egl_display->drm, &drm_listener,
egl_display);
}
}
/* stolen from egl_dri2:dri2_load() */
static void *
get_flush_address() {
void *handle;
void *(*get_proc_address)(const char *procname);
handle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);
if (handle) {
get_proc_address = (void* (*)(const char *))
dlsym(handle, "_glapi_get_proc_address");
/* no need to keep a reference */
dlclose(handle);
}
/*
* If glapi is not available, loading DRI drivers will fail. Ideally, we
* should load one of libGL, libGLESv1_CM, or libGLESv2 and go on. But if
* the app has loaded another one of them with RTLD_LOCAL, there may be
* unexpected behaviors later because there will be two copies of glapi
* (with global variables of the same names!) in the memory.
*/
if (!get_proc_address) {
fprintf(stderr, "failed to find _glapi_get_proc_address");
return NULL;
}
return get_proc_address("glFlush");
}
WL_EGL_EXPORT struct wl_egl_display *
wl_egl_display_create(struct wl_display *display)
{
struct wl_egl_display *egl_display;
egl_display = malloc(sizeof *egl_display);
if (!egl_display)
return NULL;
egl_display->display = display;
egl_display->drm = NULL;
egl_display->fd = -1;
egl_display->device_name = NULL;
egl_display->authenticated = false;
egl_display->glFlush = (void (*)(void)) get_flush_address();
wl_display_add_global_listener(display, wl_display_handle_global,
egl_display);
return egl_display;
}
WL_EGL_EXPORT void
wl_egl_display_destroy(struct wl_egl_display *egl_display)
{
free(egl_display->device_name);
close(egl_display->fd);
wl_drm_destroy(egl_display->drm);
free(egl_display);
}
WL_EGL_EXPORT void
wl_egl_window_resize(struct wl_egl_window *egl_window,
int width, int height,
@ -138,8 +29,7 @@ wl_egl_window_resize(struct wl_egl_window *egl_window,
}
WL_EGL_EXPORT struct wl_egl_window *
wl_egl_window_create(struct wl_egl_display *egl_display,
struct wl_surface *surface,
wl_egl_window_create(struct wl_surface *surface,
int width, int height,
struct wl_visual *visual)
{
@ -175,8 +65,7 @@ wl_egl_window_get_attached_size(struct wl_egl_window *egl_window,
}
WL_EGL_EXPORT struct wl_egl_pixmap *
wl_egl_pixmap_create(struct wl_egl_display *egl_display,
int width, int height,
wl_egl_pixmap_create(int width, int height,
struct wl_visual *visual, uint32_t flags)
{
struct wl_egl_pixmap *egl_pixmap;
@ -185,14 +74,13 @@ wl_egl_pixmap_create(struct wl_egl_display *egl_display,
if (egl_pixmap == NULL)
return NULL;
egl_pixmap->display = egl_display;
egl_pixmap->width = width;
egl_pixmap->height = height;
egl_pixmap->visual = visual;
egl_pixmap->name = 0;
egl_pixmap->stride = 0;
egl_pixmap->destroy = NULL;
egl_pixmap->buffer = NULL;
egl_pixmap->driver_private = NULL;
return egl_pixmap;
}
@ -206,21 +94,7 @@ wl_egl_pixmap_destroy(struct wl_egl_pixmap *egl_pixmap)
}
WL_EGL_EXPORT struct wl_buffer *
wl_egl_pixmap_create_buffer(struct wl_egl_display *egl_display,
struct wl_egl_pixmap *egl_pixmap)
wl_egl_pixmap_create_buffer(struct wl_egl_pixmap *egl_pixmap)
{
if (egl_pixmap->name == 0)
return NULL;
return wl_drm_create_buffer(egl_display->drm, egl_pixmap->name,
egl_pixmap->width, egl_pixmap->height,
egl_pixmap->stride, egl_pixmap->visual);
}
WL_EGL_EXPORT void
wl_egl_pixmap_flush(struct wl_egl_display *egl_display,
struct wl_egl_pixmap *egl_pixmap)
{
if (egl_display->glFlush)
egl_display->glFlush();
return egl_pixmap->buffer;
}

View file

@ -53,7 +53,6 @@ if env['drm']:
# Needed by some state trackers
SConscript('winsys/sw/null/SConscript')
SConscript('state_trackers/python/SConscript')
if env['platform'] != 'embedded':
SConscript('state_trackers/vega/SConscript')
SConscript('state_trackers/egl/SConscript')

View file

@ -107,6 +107,7 @@ C_SOURCES = \
util/u_caps.c \
util/u_cpu_detect.c \
util/u_dl.c \
util/u_draw.c \
util/u_draw_quad.c \
util/u_format.c \
util/u_format_other.c \

View file

@ -154,6 +154,7 @@ source = [
'util/u_dump_defines.c',
'util/u_dump_state.c',
'util/u_dl.c',
'util/u_draw.c',
'util/u_draw_quad.c',
'util/u_format.c',
'util/u_format_other.c',

View file

@ -751,7 +751,7 @@ void
draw_set_mapped_texture(struct draw_context *draw,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
uint32_t first_level, uint32_t last_level,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
const void *data[PIPE_MAX_TEXTURE_LEVELS])
@ -760,7 +760,7 @@ draw_set_mapped_texture(struct draw_context *draw,
if(draw->llvm)
draw_llvm_set_mapped_texture(draw,
sampler_idx,
width, height, depth, last_level,
width, height, depth, first_level, last_level,
row_stride, img_stride, data);
#endif
}

View file

@ -123,7 +123,7 @@ void
draw_set_mapped_texture(struct draw_context *draw,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
uint32_t first_level, uint32_t last_level,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
const void *data[PIPE_MAX_TEXTURE_LEVELS]);

View file

@ -106,6 +106,7 @@ create_jit_texture_type(struct gallivm_state *gallivm)
elem_types[DRAW_JIT_TEXTURE_WIDTH] =
elem_types[DRAW_JIT_TEXTURE_HEIGHT] =
elem_types[DRAW_JIT_TEXTURE_DEPTH] =
elem_types[DRAW_JIT_TEXTURE_FIRST_LEVEL] =
elem_types[DRAW_JIT_TEXTURE_LAST_LEVEL] = int32_type;
elem_types[DRAW_JIT_TEXTURE_ROW_STRIDE] =
elem_types[DRAW_JIT_TEXTURE_IMG_STRIDE] =
@ -136,6 +137,9 @@ create_jit_texture_type(struct gallivm_state *gallivm)
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, depth,
target, texture_type,
DRAW_JIT_TEXTURE_DEPTH);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, first_level,
target, texture_type,
DRAW_JIT_TEXTURE_FIRST_LEVEL);
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, last_level,
target, texture_type,
DRAW_JIT_TEXTURE_LAST_LEVEL);
@ -438,7 +442,8 @@ generate_vs(struct draw_llvm *llvm,
const LLVMValueRef (*inputs)[NUM_CHANNELS],
LLVMValueRef system_values_array,
LLVMValueRef context_ptr,
struct lp_build_sampler_soa *draw_sampler)
struct lp_build_sampler_soa *draw_sampler,
boolean clamp_vertex_color)
{
const struct tgsi_token *tokens = llvm->draw->vs.vertex_shader->state.tokens;
struct lp_type vs_type;
@ -474,6 +479,30 @@ generate_vs(struct draw_llvm *llvm,
outputs,
sampler,
&llvm->draw->vs.vertex_shader->info);
if(clamp_vertex_color)
{
LLVMValueRef out;
unsigned chan, attrib;
struct lp_build_context bld;
struct tgsi_shader_info* info = &llvm->draw->vs.vertex_shader->info;
lp_build_context_init(&bld, llvm->gallivm, vs_type);
for (attrib = 0; attrib < info->num_outputs; ++attrib) {
for(chan = 0; chan < NUM_CHANNELS; ++chan) {
if(outputs[attrib][chan]) {
switch (info->output_semantic_name[attrib]) {
case TGSI_SEMANTIC_COLOR:
case TGSI_SEMANTIC_BCOLOR:
out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
out = lp_build_clamp(&bld, out, bld.zero, bld.one);
LLVMBuildStore(builder, out, outputs[attrib][chan]);
break;
}
}
}
}
}
}
#if DEBUG_STORE
@ -1235,7 +1264,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
ptr_aos,
system_values_array,
context_ptr,
sampler);
sampler,
variant->key.clamp_vertex_color);
/* store original positions in clip before further manipulation */
store_clip(gallivm, io, outputs);
@ -1446,7 +1476,8 @@ draw_llvm_generate_elts(struct draw_llvm *llvm, struct draw_llvm_variant *varian
ptr_aos,
system_values_array,
context_ptr,
sampler);
sampler,
variant->key.clamp_vertex_color);
/* store original positions in clip before further manipulation */
store_clip(gallivm, io, outputs);
@ -1524,6 +1555,8 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
key = (struct draw_llvm_variant_key *)store;
key->clamp_vertex_color = llvm->draw->rasterizer->clamp_vertex_color; /**/
/* Presumably all variants of the shader should have the same
* number of vertex elements - ie the number of shader inputs.
*/
@ -1566,7 +1599,7 @@ void
draw_llvm_set_mapped_texture(struct draw_context *draw,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
uint32_t first_level, uint32_t last_level,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
const void *data[PIPE_MAX_TEXTURE_LEVELS])
@ -1582,9 +1615,10 @@ draw_llvm_set_mapped_texture(struct draw_context *draw,
jit_tex->width = width;
jit_tex->height = height;
jit_tex->depth = depth;
jit_tex->first_level = first_level;
jit_tex->last_level = last_level;
for (j = 0; j <= last_level; j++) {
for (j = first_level; j <= last_level; j++) {
jit_tex->data[j] = data[j];
jit_tex->row_stride[j] = row_stride[j];
jit_tex->img_stride[j] = img_stride[j];

View file

@ -50,6 +50,7 @@ struct draw_jit_texture
uint32_t width;
uint32_t height;
uint32_t depth;
uint32_t first_level;
uint32_t last_level;
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS];
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
@ -64,6 +65,7 @@ enum {
DRAW_JIT_TEXTURE_WIDTH = 0,
DRAW_JIT_TEXTURE_HEIGHT,
DRAW_JIT_TEXTURE_DEPTH,
DRAW_JIT_TEXTURE_FIRST_LEVEL,
DRAW_JIT_TEXTURE_LAST_LEVEL,
DRAW_JIT_TEXTURE_ROW_STRIDE,
DRAW_JIT_TEXTURE_IMG_STRIDE,
@ -162,6 +164,7 @@ struct draw_llvm_variant_key
{
unsigned nr_vertex_elements:8;
unsigned nr_samplers:8;
unsigned clamp_vertex_color:1;
unsigned clip_xy:1;
unsigned clip_z:1;
unsigned clip_user:1;
@ -169,7 +172,7 @@ struct draw_llvm_variant_key
unsigned bypass_viewport:1;
unsigned need_edgeflags:1;
unsigned nr_planes:4;
unsigned pad:6;
unsigned pad:5;
/* Variable number of vertex elements:
*/
@ -295,7 +298,7 @@ void
draw_llvm_set_mapped_texture(struct draw_context *draw,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
uint32_t first_level, uint32_t last_level,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
const void *data[PIPE_MAX_TEXTURE_LEVELS]);

View file

@ -144,6 +144,7 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
DRAW_LLVM_TEXTURE_MEMBER(width, DRAW_JIT_TEXTURE_WIDTH, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(height, DRAW_JIT_TEXTURE_HEIGHT, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(depth, DRAW_JIT_TEXTURE_DEPTH, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(first_level,DRAW_JIT_TEXTURE_FIRST_LEVEL, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(last_level, DRAW_JIT_TEXTURE_LAST_LEVEL, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(row_stride, DRAW_JIT_TEXTURE_ROW_STRIDE, FALSE)
DRAW_LLVM_TEXTURE_MEMBER(img_stride, DRAW_JIT_TEXTURE_IMG_STRIDE, FALSE)
@ -209,6 +210,7 @@ draw_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
sampler->dynamic_state.base.width = draw_llvm_texture_width;
sampler->dynamic_state.base.height = draw_llvm_texture_height;
sampler->dynamic_state.base.depth = draw_llvm_texture_depth;
sampler->dynamic_state.base.first_level = draw_llvm_texture_first_level;
sampler->dynamic_state.base.last_level = draw_llvm_texture_last_level;
sampler->dynamic_state.base.row_stride = draw_llvm_texture_row_stride;
sampler->dynamic_state.base.img_stride = draw_llvm_texture_img_stride;

View file

@ -341,6 +341,16 @@ vbuf_flush_vertices( struct vbuf_stage *vbuf )
vbuf->max_vertices = vbuf->nr_vertices = 0;
vbuf->vertex_ptr = vbuf->vertices = NULL;
}
/* Reset point/line/tri function pointers.
* If (for example) we transition from points to tris and back to points
* again, we need to call the vbuf_first_point() function again to flush
* the triangles before drawing more points. This can happen when drawing
* with front polygon mode = filled and back polygon mode = line or point.
*/
vbuf->stage.point = vbuf_first_point;
vbuf->stage.line = vbuf_first_line;
vbuf->stage.tri = vbuf_first_tri;
}
@ -378,10 +388,6 @@ vbuf_flush( struct draw_stage *stage, unsigned flags )
struct vbuf_stage *vbuf = vbuf_stage( stage );
vbuf_flush_vertices( vbuf );
stage->point = vbuf_first_point;
stage->line = vbuf_first_line;
stage->tri = vbuf_first_tri;
}

View file

@ -146,6 +146,14 @@ struct draw_context
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
unsigned nr_vertex_buffers;
/*
* This is the largest legal index value for the current set of
* bound vertex buffers. Regardless of any other consideration,
* all vertex lookups need to be clamped to 0..max_index to
* prevent out-of-bound access.
*/
unsigned max_index;
struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
unsigned nr_vertex_elements;

View file

@ -470,6 +470,17 @@ draw_vbo(struct draw_context *draw,
if (0)
draw_print_arrays(draw, info->mode, info->start, MIN2(info->count, 20));
draw->pt.max_index = util_draw_max_index(draw->pt.vertex_buffer,
draw->pt.nr_vertex_buffers,
draw->pt.vertex_element,
draw->pt.nr_vertex_elements,
info);
/*
* TODO: We could use draw->pt.max_index to further narrow
* the min_index/max_index hints given by the state tracker.
*/
for (instance = 0; instance < info->instance_count; instance++) {
draw->instance_id = instance + info->start_instance;

View file

@ -139,7 +139,7 @@ void draw_pt_fetch_run( struct pt_fetch *fetch,
((char *)draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
draw->pt.vertex_buffer[i].stride,
draw->pt.user.max_index);
draw->pt.max_index);
}
translate->run_elts( translate,

View file

@ -186,7 +186,7 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle,
((char *)draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
draw->pt.vertex_buffer[i].stride,
draw->pt.user.max_index);
draw->pt.max_index);
}
*max_vertices = (draw->render->max_vertex_buffer_bytes /

View file

@ -169,7 +169,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
((const ubyte *) draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
draw->pt.vertex_buffer[i].stride,
draw->pt.user.max_index );
draw->pt.max_index );
}
*max_vertices = (draw->render->max_vertex_buffer_bytes /

View file

@ -85,7 +85,12 @@ vsplit_flush_cache(struct vsplit_frontend *vsplit, unsigned flags)
static INLINE void
vsplit_add_cache(struct vsplit_frontend *vsplit, unsigned fetch)
{
unsigned hash = fetch % MAP_SIZE;
struct draw_context *draw = vsplit->draw;
unsigned hash;
fetch = MIN2(fetch, draw->pt.max_index);
hash = fetch % MAP_SIZE;
if (vsplit->cache.fetches[hash] != fetch) {
/* update cache */

View file

@ -47,14 +47,18 @@ CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
const ushort *draw_elts = NULL;
unsigned i;
ib += istart;
/* use the ib directly */
if (min_index == 0 && sizeof(ib[0]) == sizeof(draw_elts[0])) {
if (icount > vsplit->max_vertices)
return FALSE;
for (i = 0; i < icount; i++) {
ELT_TYPE idx = ib[istart + i];
assert(idx >= min_index && idx <= max_index);
ELT_TYPE idx = ib[i];
if (idx < min_index || idx > max_index) {
debug_printf("warning: index out of range\n");
}
}
draw_elts = (const ushort *) ib;
}
@ -83,17 +87,21 @@ CONCAT(vsplit_primitive_, ELT_TYPE)(struct vsplit_frontend *vsplit,
if (!draw_elts) {
if (min_index == 0) {
for (i = 0; i < icount; i++) {
ELT_TYPE idx = ib[istart + i];
ELT_TYPE idx = ib[i];
assert(idx >= min_index && idx <= max_index);
if (idx < min_index || idx > max_index) {
debug_printf("warning: index out of range\n");
}
vsplit->draw_elts[i] = (ushort) idx;
}
}
else {
for (i = 0; i < icount; i++) {
ELT_TYPE idx = ib[istart + i];
ELT_TYPE idx = ib[i];
assert(idx >= min_index && idx <= max_index);
if (idx < min_index || idx > max_index) {
debug_printf("warning: index out of range\n");
}
vsplit->draw_elts[i] = (ushort) (idx - min_index);
}
}

View file

@ -104,10 +104,17 @@ draw_create_vertex_shader(struct draw_context *draw,
}
if (!draw->pt.middle.llvm) {
#if 0
/* these paths don't support vertex clamping
* TODO: either add it, or remove them completely
* use LLVM instead if you want performance
* use exec instead if you want debugging/more correctness
*/
#if defined(PIPE_ARCH_X86)
vs = draw_create_vs_sse( draw, shader );
#elif defined(PIPE_ARCH_PPC)
vs = draw_create_vs_ppc( draw, shader );
#endif
#endif
}
#if HAVE_LLVM

View file

@ -95,6 +95,7 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
struct tgsi_exec_machine *machine = evs->machine;
unsigned int i, j;
unsigned slot;
boolean clamp_vertex_color = shader->draw->rasterizer->clamp_vertex_color;
tgsi_exec_set_constant_buffers(machine, PIPE_MAX_CONSTANT_BUFFERS,
constants, const_size);
@ -151,11 +152,22 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
*/
for (j = 0; j < max_vertices; j++) {
for (slot = 0; slot < shader->info.num_outputs; slot++) {
output[slot][0] = machine->Outputs[slot].xyzw[0].f[j];
output[slot][1] = machine->Outputs[slot].xyzw[1].f[j];
output[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
output[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
unsigned name = shader->info.output_semantic_name[slot];
if(clamp_vertex_color &&
(name == TGSI_SEMANTIC_COLOR || name == TGSI_SEMANTIC_BCOLOR))
{
output[slot][0] = CLAMP(machine->Outputs[slot].xyzw[0].f[j], 0.0f, 1.0f);
output[slot][1] = CLAMP(machine->Outputs[slot].xyzw[1].f[j], 0.0f, 1.0f);
output[slot][2] = CLAMP(machine->Outputs[slot].xyzw[2].f[j], 0.0f, 1.0f);
output[slot][3] = CLAMP(machine->Outputs[slot].xyzw[3].f[j], 0.0f, 1.0f);
}
else
{
output[slot][0] = machine->Outputs[slot].xyzw[0].f[j];
output[slot][1] = machine->Outputs[slot].xyzw[1].f[j];
output[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
output[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
}
}
#if 0

View file

@ -32,7 +32,12 @@
#include <llvm/Target/TargetInstrInfo.h>
#include <llvm/Support/raw_ostream.h>
#include <llvm/Support/MemoryObject.h>
#if HAVE_LLVM >= 0x0209
#include <llvm/Support/Host.h>
#else
#include <llvm/System/Host.h>
#endif
#if HAVE_LLVM >= 0x0207
#include <llvm/MC/MCDisassembler.h>
@ -202,9 +207,17 @@ lp_disassemble(const void* func)
}
raw_debug_ostream Out;
TargetMachine *TM = T->createTargetMachine(Triple, "");
#if HAVE_LLVM >= 0x0300
unsigned int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
#else
int AsmPrinterVariant = AsmInfo->getAssemblerDialect();
#if HAVE_LLVM >= 0x0208
#endif
#if HAVE_LLVM >= 0x0300
OwningPtr<MCInstPrinter> Printer(
T->createMCInstPrinter(*TM, AsmPrinterVariant, *AsmInfo));
#elif HAVE_LLVM >= 0x0208
OwningPtr<MCInstPrinter> Printer(
T->createMCInstPrinter(AsmPrinterVariant, *AsmInfo));
#else
@ -216,8 +229,6 @@ lp_disassemble(const void* func)
return;
}
TargetMachine *TM = T->createTargetMachine(Triple, "");
const TargetInstrInfo *TII = TM->getInstrInfo();
/*

View file

@ -51,6 +51,10 @@
*/
#define BRILINEAR_FACTOR 2
static LLVMValueRef
lp_build_minify(struct lp_build_context *bld,
LLVMValueRef base_size,
LLVMValueRef level);
/**
* Does the given texture wrap mode allow sampling the texture border color?
@ -184,9 +188,11 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
*/
static LLVMValueRef
lp_build_rho(struct lp_build_sample_context *bld,
unsigned unit,
const LLVMValueRef ddx[4],
const LLVMValueRef ddy[4])
{
struct lp_build_context *int_size_bld = &bld->int_size_bld;
struct lp_build_context *float_size_bld = &bld->float_size_bld;
struct lp_build_context *float_bld = &bld->float_bld;
const unsigned dims = bld->dims;
@ -198,8 +204,9 @@ lp_build_rho(struct lp_build_sample_context *bld,
LLVMValueRef dsdx, dsdy, dtdx, dtdy, drdx, drdy;
LLVMValueRef rho_x, rho_y;
LLVMValueRef rho_vec;
LLVMValueRef float_size;
LLVMValueRef int_size, float_size;
LLVMValueRef rho;
LLVMValueRef first_level, first_level_vec;
dsdx = ddx[0];
dsdy = ddy[0];
@ -235,7 +242,11 @@ lp_build_rho(struct lp_build_sample_context *bld,
rho_vec = lp_build_max(float_size_bld, rho_x, rho_y);
float_size = lp_build_int_to_float(float_size_bld, bld->int_size);
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
first_level_vec = lp_build_broadcast_scalar(&bld->int_size_bld, first_level);
int_size = lp_build_minify(int_size_bld, bld->int_size, first_level_vec);
float_size = lp_build_int_to_float(float_size_bld, int_size);
rho_vec = lp_build_mul(float_size_bld, rho_vec, float_size);
@ -442,7 +453,7 @@ lp_build_lod_selector(struct lp_build_sample_context *bld,
else {
LLVMValueRef rho;
rho = lp_build_rho(bld, ddx, ddy);
rho = lp_build_rho(bld, unit, ddx, ddy);
/*
* Compute lod = log2(rho)
@ -542,18 +553,18 @@ lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
LLVMValueRef *level_out)
{
struct lp_build_context *int_bld = &bld->int_bld;
LLVMValueRef last_level, level;
LLVMValueRef zero = lp_build_const_int32(bld->gallivm, 0);
LLVMValueRef first_level, last_level, level;
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
last_level = bld->dynamic_state->last_level(bld->dynamic_state,
bld->gallivm, unit);
/* convert float lod to integer */
level = lod_ipart;
level = lp_build_add(int_bld, lod_ipart, first_level);
/* clamp level to legal range of levels */
*level_out = lp_build_clamp(int_bld, level, zero, last_level);
*level_out = lp_build_clamp(int_bld, level, first_level, last_level);
}
@ -573,39 +584,42 @@ lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
LLVMBuilderRef builder = bld->gallivm->builder;
struct lp_build_context *int_bld = &bld->int_bld;
struct lp_build_context *float_bld = &bld->float_bld;
LLVMValueRef last_level;
LLVMValueRef first_level, last_level;
LLVMValueRef clamp_min;
LLVMValueRef clamp_max;
*level0_out = lod_ipart;
*level1_out = lp_build_add(int_bld, lod_ipart, int_bld->one);
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
*level0_out = lp_build_add(int_bld, lod_ipart, first_level);
*level1_out = lp_build_add(int_bld, *level0_out, int_bld->one);
last_level = bld->dynamic_state->last_level(bld->dynamic_state,
bld->gallivm, unit);
/*
* Clamp both lod_ipart and lod_ipart + 1 to [0, last_level], with the
* minimum number of comparisons, and zeroing lod_fpart in the extreme
* Clamp both *level0_out and *level1_out to [first_level, last_level], with
* the minimum number of comparisons, and zeroing lod_fpart in the extreme
* ends in the process.
*/
/* lod_ipart < 0 */
/* *level0_out < first_level */
clamp_min = LLVMBuildICmp(builder, LLVMIntSLT,
lod_ipart, int_bld->zero,
"clamp_lod_to_zero");
*level0_out, first_level,
"clamp_lod_to_first");
*level0_out = LLVMBuildSelect(builder, clamp_min,
int_bld->zero, *level0_out, "");
first_level, *level0_out, "");
*level1_out = LLVMBuildSelect(builder, clamp_min,
int_bld->zero, *level1_out, "");
first_level, *level1_out, "");
*lod_fpart_inout = LLVMBuildSelect(builder, clamp_min,
float_bld->zero, *lod_fpart_inout, "");
/* lod_ipart >= last_level */
/* *level0_out >= last_level */
clamp_max = LLVMBuildICmp(builder, LLVMIntSGE,
lod_ipart, last_level,
*level0_out, last_level,
"clamp_lod_to_last");
*level0_out = LLVMBuildSelect(builder, clamp_max,

View file

@ -120,6 +120,12 @@ struct lp_sampler_dynamic_state
struct gallivm_state *gallivm,
unsigned unit);
/** Obtain the first mipmap level (base level) (returns int32) */
LLVMValueRef
(*first_level)( const struct lp_sampler_dynamic_state *state,
struct gallivm_state *gallivm,
unsigned unit);
/** Obtain the number of mipmap levels minus one (returns int32) */
LLVMValueRef
(*last_level)( const struct lp_sampler_dynamic_state *state,

View file

@ -939,6 +939,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
LLVMValueRef unswizzled[4];
LLVMValueRef face_ddx[4], face_ddy[4];
struct lp_build_context h16_bld;
LLVMValueRef first_level;
LLVMValueRef i32t_zero = lp_build_const_int32(bld->gallivm, 0);
/* we only support the common/simple wrap modes at this time */
@ -1008,7 +1009,9 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0);
}
else {
ilevel0 = i32t_zero;
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
ilevel0 = first_level;
}
break;
case PIPE_TEX_MIPFILTER_NEAREST:
@ -1065,7 +1068,7 @@ lp_build_sample_aos(struct lp_build_sample_context *bld,
lp_build_sample_mipmap(bld,
mag_filter, PIPE_TEX_MIPFILTER_NONE,
s, t, r,
i32t_zero, NULL, NULL,
ilevel0, NULL, NULL,
packed_lo, packed_hi);
}
lp_build_endif(&if_ctx);

View file

@ -943,6 +943,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
LLVMValueRef ilevel0, ilevel1 = NULL;
LLVMValueRef face_ddx[4], face_ddy[4];
LLVMValueRef texels[4];
LLVMValueRef first_level;
LLVMValueRef i32t_zero = lp_build_const_int32(bld->gallivm, 0);
unsigned chan;
@ -1009,7 +1010,9 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0);
}
else {
ilevel0 = i32t_zero;
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
bld->gallivm, unit);
ilevel0 = first_level;
}
break;
case PIPE_TEX_MIPFILTER_NEAREST:
@ -1068,7 +1071,7 @@ lp_build_sample_general(struct lp_build_sample_context *bld,
lp_build_sample_mipmap(bld, unit,
mag_filter, PIPE_TEX_MIPFILTER_NONE,
s, t, r,
i32t_zero, NULL, NULL,
ilevel0, NULL, NULL,
texels);
}
lp_build_endif(&if_ctx);

View file

@ -726,6 +726,16 @@ void x86_movzx16(struct x86_function *p, struct x86_reg dst, struct x86_reg src
emit_modrm(p, dst, src);
}
void x86_cmovcc( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src,
enum x86_cc cc)
{
DUMP_RRI( dst, src, cc );
emit_2ub( p, 0x0f, 0x40 + cc );
emit_modrm( p, dst, src );
}
void x86_xor( struct x86_function *p,
struct x86_reg dst,
struct x86_reg src )

View file

@ -309,6 +309,7 @@ void sse_movmskps( struct x86_function *p, struct x86_reg dst, struct x86_reg sr
void x86_add( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
void x86_and( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
void x86_cmovcc( struct x86_function *p, struct x86_reg dst, struct x86_reg src, enum x86_cc cc );
void x86_cmp( struct x86_function *p, struct x86_reg dst, struct x86_reg src );
void x86_dec( struct x86_function *p, struct x86_reg reg );
void x86_inc( struct x86_function *p, struct x86_reg reg );

View file

@ -381,14 +381,17 @@ static ALWAYS_INLINE void PIPE_CDECL generic_run_one( struct translate_generic *
if (tg->attrib[attr].instance_divisor) {
index = instance_id / tg->attrib[attr].instance_divisor;
/* XXX we need to clamp the index here too, but to a
* per-array max value, not the draw->pt.max_index value
* that's being given to us via translate->set_buffer().
*/
}
else {
index = elt;
/* clamp to avoid going out of bounds */
index = MIN2(index, tg->attrib[attr].max_index);
}
/* clamp to void going out of bounds */
index = MIN2(index, tg->attrib[attr].max_index);
src = tg->attrib[attr].input_ptr +
tg->attrib[attr].input_stride * index;

View file

@ -53,7 +53,7 @@ struct translate_buffer {
unsigned max_index;
};
struct translate_buffer_varient {
struct translate_buffer_variant {
unsigned buffer_index;
unsigned instance_divisor;
void *ptr; /* updated either per vertex or per instance */
@ -103,12 +103,12 @@ struct translate_sse {
struct translate_buffer buffer[PIPE_MAX_ATTRIBS];
unsigned nr_buffers;
/* Multiple buffer varients can map to a single buffer. */
struct translate_buffer_varient buffer_varient[PIPE_MAX_ATTRIBS];
unsigned nr_buffer_varients;
/* Multiple buffer variants can map to a single buffer. */
struct translate_buffer_variant buffer_variant[PIPE_MAX_ATTRIBS];
unsigned nr_buffer_variants;
/* Multiple elements can map to a single buffer varient. */
unsigned element_to_buffer_varient[PIPE_MAX_ATTRIBS];
/* Multiple elements can map to a single buffer variant. */
unsigned element_to_buffer_variant[PIPE_MAX_ATTRIBS];
boolean use_instancing;
unsigned instance_id;
@ -1062,15 +1062,17 @@ static boolean init_inputs( struct translate_sse *p,
struct x86_reg instance_id = x86_make_disp(p->machine_EDI,
get_offset(p, &p->instance_id));
for (i = 0; i < p->nr_buffer_varients; i++) {
struct translate_buffer_varient *varient = &p->buffer_varient[i];
struct translate_buffer *buffer = &p->buffer[varient->buffer_index];
for (i = 0; i < p->nr_buffer_variants; i++) {
struct translate_buffer_variant *variant = &p->buffer_variant[i];
struct translate_buffer *buffer = &p->buffer[variant->buffer_index];
if (!index_size || varient->instance_divisor) {
if (!index_size || variant->instance_divisor) {
struct x86_reg buf_max_index = x86_make_disp(p->machine_EDI,
get_offset(p, &buffer->max_index));
struct x86_reg buf_stride = x86_make_disp(p->machine_EDI,
get_offset(p, &buffer->stride));
struct x86_reg buf_ptr = x86_make_disp(p->machine_EDI,
get_offset(p, &varient->ptr));
get_offset(p, &variant->ptr));
struct x86_reg buf_base_ptr = x86_make_disp(p->machine_EDI,
get_offset(p, &buffer->base_ptr));
struct x86_reg elt = p->idx_ESI;
@ -1079,12 +1081,12 @@ static boolean init_inputs( struct translate_sse *p,
/* Calculate pointer to first attrib:
* base_ptr + stride * index, where index depends on instance divisor
*/
if (varient->instance_divisor) {
if (variant->instance_divisor) {
/* Our index is instance ID divided by instance divisor.
*/
x86_mov(p->func, tmp_EAX, instance_id);
if (varient->instance_divisor != 1) {
if (variant->instance_divisor != 1) {
struct x86_reg tmp_EDX = p->tmp2_EDX;
struct x86_reg tmp_ECX = p->src_ECX;
@ -1093,26 +1095,33 @@ static boolean init_inputs( struct translate_sse *p,
*/
x86_xor(p->func, tmp_EDX, tmp_EDX);
x86_mov_reg_imm(p->func, tmp_ECX, varient->instance_divisor);
x86_mov_reg_imm(p->func, tmp_ECX, variant->instance_divisor);
x86_div(p->func, tmp_ECX); /* EAX = EDX:EAX / ECX */
}
/* XXX we need to clamp the index here too, but to a
* per-array max value, not the draw->pt.max_index value
* that's being given to us via translate->set_buffer().
*/
} else {
x86_mov(p->func, tmp_EAX, elt);
}
/*
* TODO: Respect translate_buffer::max_index.
*/
/* Clamp to max_index
*/
x86_cmp(p->func, tmp_EAX, buf_max_index);
x86_cmovcc(p->func, tmp_EAX, buf_max_index, cc_AE);
}
x86_imul(p->func, tmp_EAX, buf_stride);
x64_rexw(p->func);
x86_add(p->func, tmp_EAX, buf_base_ptr);
x86_cmp(p->func, p->count_EBP, p->tmp_EAX);
/* In the linear case, keep the buffer pointer instead of the
* index number.
*/
if (!index_size && p->nr_buffer_varients == 1)
if (!index_size && p->nr_buffer_variants == 1)
{
x64_rexw(p->func);
x86_mov(p->func, elt, tmp_EAX);
@ -1138,14 +1147,14 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p,
return x86_make_disp(p->machine_EDI,
get_offset(p, &p->instance_id));
}
if (!index_size && p->nr_buffer_varients == 1) {
if (!index_size && p->nr_buffer_variants == 1) {
return p->idx_ESI;
}
else if (!index_size || p->buffer_varient[var_idx].instance_divisor) {
else if (!index_size || p->buffer_variant[var_idx].instance_divisor) {
struct x86_reg ptr = p->src_ECX;
struct x86_reg buf_ptr =
x86_make_disp(p->machine_EDI,
get_offset(p, &p->buffer_varient[var_idx].ptr));
get_offset(p, &p->buffer_variant[var_idx].ptr));
x64_rexw(p->func);
x86_mov(p->func, ptr, buf_ptr);
@ -1153,15 +1162,19 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p,
}
else {
struct x86_reg ptr = p->src_ECX;
const struct translate_buffer_varient *varient = &p->buffer_varient[var_idx];
const struct translate_buffer_variant *variant = &p->buffer_variant[var_idx];
struct x86_reg buf_stride =
x86_make_disp(p->machine_EDI,
get_offset(p, &p->buffer[varient->buffer_index].stride));
get_offset(p, &p->buffer[variant->buffer_index].stride));
struct x86_reg buf_base_ptr =
x86_make_disp(p->machine_EDI,
get_offset(p, &p->buffer[varient->buffer_index].base_ptr));
get_offset(p, &p->buffer[variant->buffer_index].base_ptr));
struct x86_reg buf_max_index =
x86_make_disp(p->machine_EDI,
get_offset(p, &p->buffer[variant->buffer_index].max_index));
@ -1179,6 +1192,12 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p,
x86_mov(p->func, ptr, elt);
break;
}
/* Clamp to max_index
*/
x86_cmp(p->func, ptr, buf_max_index);
x86_cmovcc(p->func, ptr, buf_max_index, cc_AE);
x86_imul(p->func, ptr, buf_stride);
x64_rexw(p->func);
x86_add(p->func, ptr, buf_base_ptr);
@ -1191,11 +1210,11 @@ static struct x86_reg get_buffer_ptr( struct translate_sse *p,
static boolean incr_inputs( struct translate_sse *p,
unsigned index_size )
{
if (!index_size && p->nr_buffer_varients == 1) {
if (!index_size && p->nr_buffer_variants == 1) {
struct x86_reg stride = x86_make_disp(p->machine_EDI,
get_offset(p, &p->buffer[0].stride));
if (p->buffer_varient[0].instance_divisor == 0) {
if (p->buffer_variant[0].instance_divisor == 0) {
x64_rexw(p->func);
x86_add(p->func, p->idx_ESI, stride);
sse_prefetchnta(p->func, x86_make_disp(p->idx_ESI, 192));
@ -1206,14 +1225,14 @@ static boolean incr_inputs( struct translate_sse *p,
/* Is this worthwhile??
*/
for (i = 0; i < p->nr_buffer_varients; i++) {
struct translate_buffer_varient *varient = &p->buffer_varient[i];
for (i = 0; i < p->nr_buffer_variants; i++) {
struct translate_buffer_variant *variant = &p->buffer_variant[i];
struct x86_reg buf_ptr = x86_make_disp(p->machine_EDI,
get_offset(p, &varient->ptr));
get_offset(p, &variant->ptr));
struct x86_reg buf_stride = x86_make_disp(p->machine_EDI,
get_offset(p, &p->buffer[varient->buffer_index].stride));
get_offset(p, &p->buffer[variant->buffer_index].stride));
if (varient->instance_divisor == 0) {
if (variant->instance_divisor == 0) {
x86_mov(p->func, p->tmp_EAX, buf_stride);
x64_rexw(p->func);
x86_add(p->func, p->tmp_EAX, buf_ptr);
@ -1323,18 +1342,18 @@ static boolean build_vertex_emit( struct translate_sse *p,
label = x86_get_label(p->func);
{
struct x86_reg elt = !index_size ? p->idx_ESI : x86_deref(p->idx_ESI);
int last_varient = -1;
int last_variant = -1;
struct x86_reg vb;
for (j = 0; j < p->translate.key.nr_elements; j++) {
const struct translate_element *a = &p->translate.key.element[j];
unsigned varient = p->element_to_buffer_varient[j];
unsigned variant = p->element_to_buffer_variant[j];
/* Figure out source pointer address:
*/
if (varient != last_varient) {
last_varient = varient;
vb = get_buffer_ptr(p, index_size, varient, elt);
if (variant != last_variant) {
last_variant = variant;
vb = get_buffer_ptr(p, index_size, variant, elt);
}
if (!translate_attr( p, a,
@ -1460,24 +1479,24 @@ struct translate *translate_sse2_create( const struct translate_key *key )
}
/*
* Map vertex element to vertex buffer varient.
* Map vertex element to vertex buffer variant.
*/
for (j = 0; j < p->nr_buffer_varients; j++) {
if (p->buffer_varient[j].buffer_index == key->element[i].input_buffer &&
p->buffer_varient[j].instance_divisor == key->element[i].instance_divisor) {
for (j = 0; j < p->nr_buffer_variants; j++) {
if (p->buffer_variant[j].buffer_index == key->element[i].input_buffer &&
p->buffer_variant[j].instance_divisor == key->element[i].instance_divisor) {
break;
}
}
if (j == p->nr_buffer_varients) {
p->buffer_varient[j].buffer_index = key->element[i].input_buffer;
p->buffer_varient[j].instance_divisor = key->element[i].instance_divisor;
p->nr_buffer_varients++;
if (j == p->nr_buffer_variants) {
p->buffer_variant[j].buffer_index = key->element[i].input_buffer;
p->buffer_variant[j].instance_divisor = key->element[i].instance_divisor;
p->nr_buffer_variants++;
}
p->element_to_buffer_varient[i] = j;
p->element_to_buffer_variant[i] = j;
} else {
assert(key->element[i].type == TRANSLATE_ELEMENT_INSTANCE_ID);
p->element_to_buffer_varient[i] = ELEMENT_BUFFER_INSTANCE_ID;
p->element_to_buffer_variant[i] = ELEMENT_BUFFER_INSTANCE_ID;
}
}

View file

@ -270,13 +270,15 @@ util_cpu_detect(void)
util_cpu_caps.x86_cpu_type = 8 + ((regs2[0] >> 20) & 255); /* use extended family (P4, IA64) */
/* general feature flags */
util_cpu_caps.has_tsc = (regs2[3] & (1 << 8 )) >> 8; /* 0x0000010 */
util_cpu_caps.has_mmx = (regs2[3] & (1 << 23 )) >> 23; /* 0x0800000 */
util_cpu_caps.has_sse = (regs2[3] & (1 << 25 )) >> 25; /* 0x2000000 */
util_cpu_caps.has_sse2 = (regs2[3] & (1 << 26 )) >> 26; /* 0x4000000 */
util_cpu_caps.has_sse3 = (regs2[2] & (1)); /* 0x0000001 */
util_cpu_caps.has_ssse3 = (regs2[2] & (1 << 9 )) >> 9; /* 0x0000020 */
util_cpu_caps.has_sse4_1 = (regs2[2] & (1 << 19)) >> 19;
util_cpu_caps.has_tsc = (regs2[3] >> 8) & 1; /* 0x0000010 */
util_cpu_caps.has_mmx = (regs2[3] >> 23) & 1; /* 0x0800000 */
util_cpu_caps.has_sse = (regs2[3] >> 25) & 1; /* 0x2000000 */
util_cpu_caps.has_sse2 = (regs2[3] >> 26) & 1; /* 0x4000000 */
util_cpu_caps.has_sse3 = (regs2[2] >> 0) & 1; /* 0x0000001 */
util_cpu_caps.has_ssse3 = (regs2[2] >> 9) & 1; /* 0x0000020 */
util_cpu_caps.has_sse4_1 = (regs2[2] >> 19) & 1;
util_cpu_caps.has_sse4_2 = (regs2[2] >> 20) & 1;
util_cpu_caps.has_avx = (regs2[2] >> 28) & 1;
util_cpu_caps.has_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */
cacheline = ((regs2[1] >> 8) & 0xFF) * 8;
@ -290,10 +292,10 @@ util_cpu_detect(void)
cpuid(0x80000001, regs2);
util_cpu_caps.has_mmx |= (regs2[3] & (1 << 23 )) >> 23; /* 0x0800000 */
util_cpu_caps.has_mmx2 |= (regs2[3] & (1 << 22 )) >> 22; /* 0x400000 */
util_cpu_caps.has_3dnow = (regs2[3] & (1 << 31 )) >> 31; /* 0x80000000 */
util_cpu_caps.has_3dnow_ext = (regs2[3] & (1 << 30 )) >> 30;
util_cpu_caps.has_mmx |= (regs2[3] >> 23) & 1;
util_cpu_caps.has_mmx2 |= (regs2[3] >> 22) & 1;
util_cpu_caps.has_3dnow = (regs2[3] >> 31) & 1;
util_cpu_caps.has_3dnow_ext = (regs2[3] >> 30) & 1;
}
if (regs[0] >= 0x80000006) {
@ -329,6 +331,8 @@ util_cpu_detect(void)
debug_printf("util_cpu_caps.has_sse3 = %u\n", util_cpu_caps.has_sse3);
debug_printf("util_cpu_caps.has_ssse3 = %u\n", util_cpu_caps.has_ssse3);
debug_printf("util_cpu_caps.has_sse4_1 = %u\n", util_cpu_caps.has_sse4_1);
debug_printf("util_cpu_caps.has_sse4_2 = %u\n", util_cpu_caps.has_sse4_2);
debug_printf("util_cpu_caps.has_avx = %u\n", util_cpu_caps.has_avx);
debug_printf("util_cpu_caps.has_3dnow = %u\n", util_cpu_caps.has_3dnow);
debug_printf("util_cpu_caps.has_3dnow_ext = %u\n", util_cpu_caps.has_3dnow_ext);
debug_printf("util_cpu_caps.has_altivec = %u\n", util_cpu_caps.has_altivec);

View file

@ -53,6 +53,8 @@ struct util_cpu_caps {
unsigned has_sse3:1;
unsigned has_ssse3:1;
unsigned has_sse4_1:1;
unsigned has_sse4_2:1;
unsigned has_avx:1;
unsigned has_3dnow:1;
unsigned has_3dnow_ext:1;
unsigned has_altivec:1;

View file

@ -39,6 +39,7 @@
#include <stddef.h>
#include "pipe/p_compiler.h"
struct list_head
@ -47,50 +48,56 @@ struct list_head
struct list_head *next;
};
static INLINE void list_inithead(struct list_head *item)
{
item->prev = item;
item->next = item;
}
#define LIST_INITHEAD(__item) \
do { \
(__item)->prev = (__item); \
(__item)->next = (__item); \
} while (0)
static INLINE void list_add(struct list_head *item, struct list_head *list)
{
item->prev = list;
item->next = list->next;
list->next->prev = item;
list->next = item;
}
#define LIST_ADD(__item, __list) \
do { \
(__item)->prev = (__list); \
(__item)->next = (__list)->next; \
(__list)->next->prev = (__item); \
(__list)->next = (__item); \
} while (0)
static INLINE void list_addtail(struct list_head *item, struct list_head *list)
{
item->next = list;
item->prev = list->prev;
list->prev->next = item;
list->prev = item;
}
#define LIST_ADDTAIL(__item, __list) \
do { \
(__item)->next = (__list); \
(__item)->prev = (__list)->prev; \
(__list)->prev->next = (__item); \
(__list)->prev = (__item); \
} while(0)
static INLINE void list_replace(struct list_head *from, struct list_head *to)
{
to->prev = from->prev;
to->next = from->next;
from->next->prev = to;
from->prev->next = to;
}
#define LIST_REPLACE(__from, __to) \
do { \
(__to)->prev = (__from)->prev; \
(__to)->next = (__from)->next; \
(__from)->next->prev = (__to); \
(__from)->prev->next = (__to); \
} while (0)
static INLINE void list_del(struct list_head *item)
{
item->prev->next = item->next;
item->next->prev = item->prev;
}
#define LIST_DEL(__item) \
do { \
(__item)->prev->next = (__item)->next; \
(__item)->next->prev = (__item)->prev; \
} while(0)
static INLINE void list_delinit(struct list_head *item)
{
item->prev->next = item->next;
item->next->prev = item->prev;
item->next = item;
item->prev = item;
}
#define LIST_DELINIT(__item) \
do { \
(__item)->prev->next = (__item)->next; \
(__item)->next->prev = (__item)->prev; \
(__item)->next = (__item); \
(__item)->prev = (__item); \
} while(0)
#define LIST_INITHEAD(__item) list_inithead(__item)
#define LIST_ADD(__item, __list) list_add(__item, __list)
#define LIST_ADDTAIL(__item, __list) list_addtail(__item, __list)
#define LIST_REPLACE(__from, __to) list_replace(__from, __to)
#define LIST_DEL(__item) list_del(__item)
#define LIST_DELINIT(__item) list_delinit(__item)
#define LIST_ENTRY(__type, __item, __field) \
((__type *)(((char *)(__item)) - offsetof(__type, __field)))
@ -114,4 +121,21 @@ struct list_head
storage = container_of(pos->member.next, pos, member); \
&pos->member != (head); \
pos = storage, storage = container_of(storage->member.next, storage, member))
#define LIST_FOR_EACH_ENTRY_SAFE_REV(pos, storage, head, member) \
for (pos = container_of((head)->prev, pos, member), \
storage = container_of(pos->member.prev, pos, member); \
&pos->member != (head); \
pos = storage, storage = container_of(storage->member.prev, storage, member))
#define LIST_FOR_EACH_ENTRY_FROM(pos, start, head, member) \
for (pos = container_of((start), pos, member); \
&pos->member != (head); \
pos = container_of(pos->member.next, pos, member))
#define LIST_FOR_EACH_ENTRY_FROM_REV(pos, start, head, member) \
for (pos = container_of((start), pos, member); \
&pos->member != (head); \
pos = container_of(pos->member.prev, pos, member))
#endif /*_U_DOUBLE_LIST_H_*/

View file

@ -0,0 +1,99 @@
/**************************************************************************
*
* Copyright 2011 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 "util/u_debug.h"
#include "util/u_math.h"
#include "util/u_format.h"
#include "util/u_draw.h"
/**
* Returns the largest legal index value for the current set of bound vertex
* buffers. Regardless of any other consideration, all vertex lookups need to
* be clamped to 0..max_index to prevent an out-of-bound access.
*/
unsigned
util_draw_max_index(
const struct pipe_vertex_buffer *vertex_buffers,
unsigned nr_vertex_buffers,
const struct pipe_vertex_element *vertex_elements,
unsigned nr_vertex_elements,
const struct pipe_draw_info *info)
{
unsigned max_index;
unsigned i;
max_index = ~0;
for (i = 0; i < nr_vertex_elements; i++) {
const struct pipe_vertex_element *element =
&vertex_elements[i];
const struct pipe_vertex_buffer *buffer =
&vertex_buffers[element->vertex_buffer_index];
unsigned buffer_size;
const struct util_format_description *format_desc;
unsigned format_size;
assert(buffer->buffer->height0 == 1);
assert(buffer->buffer->depth0 == 1);
buffer_size = buffer->buffer->width0;
format_desc = util_format_description(element->src_format);
assert(format_desc->block.width == 1);
assert(format_desc->block.height == 1);
assert(format_desc->block.bits % 8 == 0);
format_size = format_desc->block.bits/8;
assert(buffer_size - buffer->buffer_offset <= buffer_size);
buffer_size -= buffer->buffer_offset;
assert(buffer_size - element->src_offset <= buffer_size);
buffer_size -= element->src_offset;
assert(buffer_size - format_size <= buffer_size);
buffer_size -= format_size;
if (buffer->stride != 0) {
unsigned buffer_max_index;
buffer_max_index = buffer_size / buffer->stride;
if (element->instance_divisor == 0) {
/* Per-vertex data */
max_index = MIN2(max_index, buffer_max_index);
}
else {
/* Per-instance data. Simply make sure the state tracker didn't
* request more instances than those that fit in the buffer */
assert((info->start_instance + info->instance_count)/element->instance_divisor
<= (buffer_max_index + 1));
}
}
}
return max_index;
}

View file

@ -34,6 +34,11 @@
#include "pipe/p_state.h"
#ifdef __cplusplus
extern "C" {
#endif
static INLINE void
util_draw_init_info(struct pipe_draw_info *info)
{
@ -136,4 +141,18 @@ util_draw_range_elements(struct pipe_context *pipe,
pipe->draw_vbo(pipe, &info);
}
unsigned
util_draw_max_index(
const struct pipe_vertex_buffer *vertex_buffers,
unsigned nr_vertex_buffers,
const struct pipe_vertex_element *vertex_elements,
unsigned nr_vertex_elements,
const struct pipe_draw_info *info);
#ifdef __cplusplus
}
#endif
#endif /* !U_DRAW_H */

View file

@ -36,6 +36,55 @@
#include "u_memory.h"
#include "u_rect.h"
#include "u_format.h"
#include "u_format_s3tc.h"
#include "pipe/p_defines.h"
boolean
util_format_is_float(enum pipe_format format)
{
const struct util_format_description *desc = util_format_description(format);
unsigned i;
assert(desc);
if (!desc) {
return FALSE;
}
/* Find the first non-void channel. */
for (i = 0; i < 4; i++) {
if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
break;
}
}
if (i == 4) {
return FALSE;
}
return desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT ? TRUE : FALSE;
}
boolean
util_format_is_supported(enum pipe_format format, unsigned bind)
{
if (util_format_is_s3tc(format) && !util_format_s3tc_enabled) {
return FALSE;
}
#ifndef TEXTURE_FLOAT_ENABLED
if ((bind & PIPE_BIND_RENDER_TARGET) &&
format != PIPE_FORMAT_R9G9B9E5_FLOAT &&
format != PIPE_FORMAT_R11G11B10_FLOAT &&
util_format_is_float(format)) {
return FALSE;
}
#endif
return TRUE;
}
void

View file

@ -88,6 +88,22 @@ PIPE_FORMAT_L16_UNORM , plain, 1, 1, un16, , , , xxx1, r
PIPE_FORMAT_A16_UNORM , plain, 1, 1, un16, , , , 000x, rgb
PIPE_FORMAT_I16_UNORM , plain, 1, 1, un16, , , , xxxx, rgb
PIPE_FORMAT_L16A16_UNORM , plain, 1, 1, un16, un16, , , xxxy, rgb
PIPE_FORMAT_A8_SNORM , plain, 1, 1, sn8 , , , , 000x, rgb
PIPE_FORMAT_L8_SNORM , plain, 1, 1, sn8 , , , , xxx1, rgb
PIPE_FORMAT_L8A8_SNORM , plain, 1, 1, sn8 , sn8 , , , xxxy, rgb
PIPE_FORMAT_I8_SNORM , plain, 1, 1, sn8 , , , , xxxx, rgb
PIPE_FORMAT_A16_SNORM , plain, 1, 1, sn16, , , , 000x, rgb
PIPE_FORMAT_L16_SNORM , plain, 1, 1, sn16, , , , xxx1, rgb
PIPE_FORMAT_L16A16_SNORM , plain, 1, 1, sn16, sn16, , , xxxy, rgb
PIPE_FORMAT_I16_SNORM , plain, 1, 1, sn16, , , , xxxx, rgb
PIPE_FORMAT_A16_FLOAT , plain, 1, 1, f16 , , , , 000x, rgb
PIPE_FORMAT_L16_FLOAT , plain, 1, 1, f16 , , , , xxx1, rgb
PIPE_FORMAT_L16A16_FLOAT , plain, 1, 1, f16 , f16 , , , xxxy, rgb
PIPE_FORMAT_I16_FLOAT , plain, 1, 1, f16 , , , , xxxx, rgb
PIPE_FORMAT_A32_FLOAT , plain, 1, 1, f32 , , , , 000x, rgb
PIPE_FORMAT_L32_FLOAT , plain, 1, 1, f32 , , , , xxx1, rgb
PIPE_FORMAT_L32A32_FLOAT , plain, 1, 1, f32 , f32 , , , xxxy, rgb
PIPE_FORMAT_I32_FLOAT , plain, 1, 1, f32 , , , , xxxx, rgb
# SRGB formats
PIPE_FORMAT_L8_SRGB , plain, 1, 1, un8 , , , , xxx1, srgb

Can't render this file because it contains an unexpected character in line 8 and column 3.

View file

@ -473,6 +473,10 @@ util_format_colormask(const struct util_format_description *desc)
}
boolean
util_format_is_float(enum pipe_format format);
/**
* Whether the src format can be blitted to destation format with a simple
* memcpy.
@ -481,6 +485,12 @@ boolean
util_is_format_compatible(const struct util_format_description *src_desc,
const struct util_format_description *dst_desc);
/**
* Whether the format is supported by Gallium for the given bindings.
* This covers S3TC textures and floating-point render targets.
*/
boolean
util_format_is_supported(enum pipe_format format, unsigned bind);
/**
* Whether this format is a rgab8 variant.

View file

@ -157,6 +157,9 @@ util_resource_copy_region(struct pipe_context *pipe,
unsigned h = src_box->height;
assert(src && dst);
assert((src->target == PIPE_BUFFER && dst->target == PIPE_BUFFER) ||
(src->target != PIPE_BUFFER && dst->target != PIPE_BUFFER));
if (!src || !dst)
return;
@ -188,15 +191,19 @@ util_resource_copy_region(struct pipe_context *pipe,
assert(dst_map);
if (src_map && dst_map) {
util_copy_rect(dst_map,
dst_format,
dst_trans->stride,
0, 0,
w, h,
src_map,
src_trans->stride,
0,
0);
if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
memcpy(dst_map, src_map, w);
} else {
util_copy_rect(dst_map,
dst_format,
dst_trans->stride,
0, 0,
w, h,
src_map,
src_trans->stride,
0,
0);
}
}
pipe->transfer_unmap(pipe, src_trans);

View file

@ -499,7 +499,7 @@ void u_vbuf_mgr_set_vertex_buffers(struct u_vbuf_mgr *mgrb,
/* Update the maximum index. */
mgr->b.max_index =
MIN2(mgr->b.max_index,
(vb->buffer->width0 - vb->buffer_offset) / vb->stride);
(vb->buffer->width0 - vb->buffer_offset) / vb->stride - 1);
}
for (; i < mgr->b.nr_real_vertex_buffers; i++) {
@ -572,7 +572,11 @@ void u_vbuf_mgr_draw_begin(struct u_vbuf_mgr *mgrb,
int min_index, max_index;
min_index = info->min_index - info->index_bias;
max_index = info->max_index - info->index_bias;
if (info->max_index == ~0) {
max_index = mgr->b.max_index;
} else {
max_index = MIN2(info->max_index - info->index_bias, mgr->b.max_index);
}
/* Translate vertices with non-native layouts or formats. */
if (mgr->incompatible_vb_layout || mgr->ve->incompatible_layout) {

View file

@ -53,7 +53,7 @@ struct u_vbuf_mgr {
int nr_real_vertex_buffers;
/* Precomputed max_index for hardware vertex buffers. */
int max_index;
unsigned max_index;
/* This uploader can optionally be used by the driver.
*

View file

@ -655,7 +655,7 @@ init_zscan(struct vl_mpeg12_decoder *dec)
static bool
init_idct(struct vl_mpeg12_decoder *dec)
{
struct pipe_sampler_view *matrix, *transpose;
struct pipe_sampler_view *matrix, *transpose = NULL;
float matrix_scale, transpose_scale;
dec->nr_of_idct_render_targets = dec->pipe->screen->get_param(dec->pipe->screen, PIPE_CAP_MAX_RENDER_TARGETS);

View file

@ -179,16 +179,25 @@ the mode of the primitive and the vertices to be fetched, in the range between
Every instance with instanceID in the range between ``start_instance`` and
``start_instance``+``instance_count``-1, inclusive, will be drawn.
All vertex indices must fall inside the range given by ``min_index`` and
``max_index``. In case non-indexed draw, ``min_index`` should be set to
If there is an index buffer bound, and ``indexed`` field is true, all vertex
indices will be looked up in the index buffer.
In indexed draw, ``min_index`` and ``max_index`` respectively provide a lower
and upper bound of the indices contained in the index buffer inside the range
between ``start`` to ``start``+``count``-1. This allows the driver to
determine which subset of vertices will be referenced during te draw call
without having to scan the index buffer. Providing a over-estimation of the
the true bounds, for example, a ``min_index`` and ``max_index`` of 0 and
0xffffffff respectively, must give exactly the same rendering, albeit with less
performance due to unreferenced vertex buffers being unnecessarily DMA'ed or
processed. Providing a underestimation of the true bounds will result in
undefined behavior, but should not result in program or system failure.
In case of non-indexed draw, ``min_index`` should be set to
``start`` and ``max_index`` should be set to ``start``+``count``-1.
``index_bias`` is a value added to every vertex index before fetching vertex
attributes. It does not affect ``min_index`` and ``max_index``.
If there is an index buffer bound, and ``indexed`` field is true, all vertex
indices will be looked up in the index buffer. ``min_index``, ``max_index``,
and ``index_bias`` apply after index lookup.
``index_bias`` is a value added to every vertex index after lookup and before
fetching vertex attributes.
When drawing indexed primitives, the primitive restart index can be
used to draw disjoint primitive strips. For example, several separate

View file

@ -7,6 +7,30 @@ The rasterizer state controls the rendering of points, lines and triangles.
Attributes include polygon culling state, line width, line stipple,
multisample state, scissoring and flat/smooth shading.
Linkage
clamp_vertex_color
^^^^^^^^^^^^^^^^^^
If set, TGSI_SEMANTIC_COLOR registers are clamped to the [0, 1] range after
the execution of the vertex shader, before being passed to the geometry
shader or fragment shader.
OpenGL: glClampColor(GL_CLAMP_VERTEX_COLOR) in GL 3.0 or GL_ARB_color_buffer_float
D3D11: seems always disabled
clamp_fragment_color
^^^^^^^^^^^^^^^^^^^^
Controls whether TGSI_SEMANTIC_COLOR outputs of the fragment shader
are clamped to [0, 1].
OpenGL: glClampColor(GL_CLAMP_FRAGMENT_COLOR) in GL 3.0 or ARB_color_buffer_float
D3D11: seems always disabled
Shading
-------

View file

@ -685,6 +685,12 @@ galahad_resource_copy_region(struct pipe_context *_pipe,
util_format_short_name(_dst->format));
}
if ((_src->target == PIPE_BUFFER && _dst->target != PIPE_BUFFER) ||
(_src->target != PIPE_BUFFER && _dst->target == PIPE_BUFFER)) {
glhd_warn("Resource target mismatch: Source is %i, destination is %i",
_src->target, _dst->target);
}
pipe->resource_copy_region(pipe,
dst,
dst_level,

View file

@ -27,6 +27,7 @@
#include "draw/draw_context.h"
#include "util/u_format.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_string.h"
@ -285,6 +286,9 @@ i915_is_format_supported(struct pipe_screen *screen,
const enum pipe_format *list;
uint i;
if (!util_format_is_supported(format, tex_usage))
return FALSE;
if (sample_count > 1)
return FALSE;

View file

@ -37,6 +37,7 @@
#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_pack_color.h"
#include "util/u_surface.h"
/*
* surface functions using the render engine
@ -51,6 +52,13 @@ i915_surface_copy_render(struct pipe_context *pipe,
{
struct i915_context *i915 = i915_context(pipe);
/* Fallback for buffers. */
if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz,
src, src_level, src_box);
return;
}
util_blitter_save_blend(i915->blitter, (void *)i915->blend);
util_blitter_save_depth_stencil_alpha(i915->blitter, (void *)i915->depth_stencil);
util_blitter_save_stencil_ref(i915->blitter, &i915->stencil_ref);
@ -158,6 +166,13 @@ i915_surface_copy_blitter(struct pipe_context *pipe,
struct pipe_resource *spt = &src_tex->b.b;
unsigned dst_offset, src_offset; /* in bytes */
/* Fallback for buffers. */
if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz,
src, src_level, src_box);
return;
}
/* XXX cannot copy 3d regions at this time */
assert(src_box->depth == 1);
if (dst->target != PIPE_TEXTURE_CUBE &&

View file

@ -26,6 +26,7 @@
**************************************************************************/
#include "util/u_format.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_string.h"
@ -333,6 +334,9 @@ brw_is_format_supported(struct pipe_screen *screen,
const enum pipe_format *list;
uint i;
if (!util_format_is_supported(format, tex_usage))
return FALSE;
if (sample_count > 1)
return FALSE;

View file

@ -54,6 +54,7 @@ lp_jit_create_types(struct llvmpipe_context *lp)
elem_types[LP_JIT_TEXTURE_WIDTH] =
elem_types[LP_JIT_TEXTURE_HEIGHT] =
elem_types[LP_JIT_TEXTURE_DEPTH] =
elem_types[LP_JIT_TEXTURE_FIRST_LEVEL] =
elem_types[LP_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32TypeInContext(lc);
elem_types[LP_JIT_TEXTURE_ROW_STRIDE] =
elem_types[LP_JIT_TEXTURE_IMG_STRIDE] =
@ -81,6 +82,9 @@ lp_jit_create_types(struct llvmpipe_context *lp)
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, depth,
gallivm->target, texture_type,
LP_JIT_TEXTURE_DEPTH);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, first_level,
gallivm->target, texture_type,
LP_JIT_TEXTURE_FIRST_LEVEL);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, last_level,
gallivm->target, texture_type,
LP_JIT_TEXTURE_LAST_LEVEL);

View file

@ -50,6 +50,7 @@ struct lp_jit_texture
uint32_t width;
uint32_t height;
uint32_t depth;
uint32_t first_level;
uint32_t last_level;
uint32_t row_stride[LP_MAX_TEXTURE_LEVELS];
uint32_t img_stride[LP_MAX_TEXTURE_LEVELS];
@ -66,6 +67,7 @@ enum {
LP_JIT_TEXTURE_WIDTH = 0,
LP_JIT_TEXTURE_HEIGHT,
LP_JIT_TEXTURE_DEPTH,
LP_JIT_TEXTURE_FIRST_LEVEL,
LP_JIT_TEXTURE_LAST_LEVEL,
LP_JIT_TEXTURE_ROW_STRIDE,
LP_JIT_TEXTURE_IMG_STRIDE,

View file

@ -166,6 +166,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
return 0;
case PIPE_CAP_TGSI_INSTANCEID:
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
return 1;
default:
return 0;

View file

@ -653,6 +653,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
jit_tex->width = tex->width0;
jit_tex->height = tex->height0;
jit_tex->depth = tex->depth0;
jit_tex->first_level = view->u.tex.first_level;
jit_tex->last_level = tex->last_level;
/* We're referencing the texture's internal data, so save a
@ -663,7 +664,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
if (!lp_tex->dt) {
/* regular texture - setup array of mipmap level pointers */
int j;
for (j = 0; j <= tex->last_level; j++) {
for (j = view->u.tex.first_level; j <= tex->last_level; j++) {
jit_tex->data[j] =
llvmpipe_get_texture_image_all(lp_tex, j, LP_TEX_USAGE_READ,
LP_TEX_LAYOUT_LINEAR);
@ -677,6 +678,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
jit_tex->width = TILE_SIZE/8;
jit_tex->height = TILE_SIZE/8;
jit_tex->depth = 1;
jit_tex->first_level = 0;
jit_tex->last_level = 0;
jit_tex->row_stride[j] = 0;
jit_tex->img_stride[j] = 0;

View file

@ -269,7 +269,7 @@ llvmpipe_prepare_vertex_sampling(struct llvmpipe_context *lp,
if (!lp_tex->dt) {
/* regular texture - setup array of mipmap level pointers */
int j;
for (j = 0; j <= tex->last_level; j++) {
for (j = view->u.tex.first_level; j <= tex->last_level; j++) {
data[j] =
llvmpipe_get_texture_image_all(lp_tex, j, LP_TEX_USAGE_READ,
LP_TEX_LAYOUT_LINEAR);
@ -293,7 +293,7 @@ llvmpipe_prepare_vertex_sampling(struct llvmpipe_context *lp,
draw_set_mapped_texture(lp->draw,
i,
tex->width0, tex->height0, tex->depth0,
tex->last_level,
view->u.tex.first_level, tex->last_level,
row_stride, img_stride, data);
}
}

View file

@ -67,6 +67,13 @@ lp_resource_copy(struct pipe_context *pipe,
unsigned height = src_box->height;
assert(src_box->depth == 1);
/* Fallback for buffers. */
if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz,
src, src_level, src_box);
return;
}
llvmpipe_flush_resource(pipe,
dst, dst_level, dstz,
FALSE, /* read_only */

View file

@ -149,6 +149,7 @@ lp_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
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(first_level, LP_JIT_TEXTURE_FIRST_LEVEL, TRUE)
LP_LLVM_TEXTURE_MEMBER(last_level, LP_JIT_TEXTURE_LAST_LEVEL, TRUE)
LP_LLVM_TEXTURE_MEMBER(row_stride, LP_JIT_TEXTURE_ROW_STRIDE, FALSE)
LP_LLVM_TEXTURE_MEMBER(img_stride, LP_JIT_TEXTURE_IMG_STRIDE, FALSE)
@ -219,6 +220,7 @@ lp_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
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.first_level = lp_llvm_texture_first_level;
sampler->dynamic_state.base.last_level = lp_llvm_texture_last_level;
sampler->dynamic_state.base.row_stride = lp_llvm_texture_row_stride;
sampler->dynamic_state.base.img_stride = lp_llvm_texture_img_stride;

View file

@ -337,6 +337,7 @@ static int noop_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_TEXTURE_SHADOW_MAP:
case PIPE_CAP_TEXTURE_SWIZZLE:
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
return 1;
case PIPE_CAP_DUAL_SOURCE_BLEND:

View file

@ -558,7 +558,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NV50_3D_UNK0F8C 0x00000f8c
#define NV50_3D_UNK0F90 0x00000f90
#define NV50_3D_COLOR_MASK_COMMON 0x00000f90
#define NV50_3D_UNK0F94 0x00000f94
@ -1007,7 +1007,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NV50_3D_TEX_CACHE_CTL_UNK1__MASK 0x00000030
#define NV50_3D_TEX_CACHE_CTL_UNK1__SHIFT 4
#define NV50_3D_UNK133C 0x0000133c
#define NV50_3D_BLEND_SEPARATE_ALPHA 0x0000133c
#define NV50_3D_BLEND_EQUATION_RGB 0x00001340
#define NV50_3D_BLEND_EQUATION_RGB_FUNC_ADD 0x00008006
@ -1033,7 +1033,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NV50_3D_BLEND_FUNC_DST_ALPHA 0x00001358
#define NV50_3D_UNK135C 0x0000135c
#define NV50_3D_BLEND_ENABLE_COMMON 0x0000135c
#define NV50_3D_BLEND_ENABLE(i0) (0x00001360 + 0x4*(i0))
#define NV50_3D_BLEND_ENABLE__ESIZE 0x00000004
@ -1673,7 +1673,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NV50_3D_MAP_SEMANTIC_0_BFC0_ID__SHIFT 8
#define NV50_3D_MAP_SEMANTIC_0_COLR_NR__MASK 0x00ff0000
#define NV50_3D_MAP_SEMANTIC_0_COLR_NR__SHIFT 16
#define NV50_3D_MAP_SEMANTIC_0_CLMP_EN 0xff000000
#define NV50_3D_MAP_SEMANTIC_0_CLMP_EN 0x01000000
#define NV50_3D_MAP_SEMANTIC_1 0x00001908
#define NV50_3D_MAP_SEMANTIC_1_CLIP_START__MASK 0x000000ff
@ -1706,7 +1706,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NV50_3D_CULL_FACE_BACK 0x00000405
#define NV50_3D_CULL_FACE_FRONT_AND_BACK 0x00000408
#define NV50_3D_UNK1924 0x00001924
#define NV50_3D_LINE_LAST_PIXEL 0x00001924
#define NVA3_3D_FP_MULTISAMPLE 0x00001928
#define NVA3_3D_FP_MULTISAMPLE_EXPORT_SAMPLE_MASK 0x00000001

View file

@ -46,6 +46,17 @@ nv50_flush(struct pipe_context *pipe,
FIRE_RING(screen->channel);
}
static void
nv50_texture_barrier(struct pipe_context *pipe)
{
struct nouveau_channel *chan = nv50_context(pipe)->screen->base.channel;
BEGIN_RING(chan, RING_3D(SERIALIZE), 1);
OUT_RING (chan, 0);
BEGIN_RING(chan, RING_3D(TEX_CACHE_CTL), 1);
OUT_RING (chan, 0x20);
}
void
nv50_default_flush_notify(struct nouveau_channel *chan)
{
@ -125,6 +136,7 @@ nv50_create(struct pipe_screen *pscreen, void *priv)
pipe->clear = nv50_clear;
pipe->flush = nv50_flush;
pipe->texture_barrier = nv50_texture_barrier;
if (!screen->cur_ctx)
screen->cur_ctx = nv50;

View file

@ -1,7 +1,6 @@
#ifndef __NV50_CONTEXT_H__
#define __NV50_CONTEXT_H__
#include <stdio.h>
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
@ -13,6 +12,7 @@
#include "draw/draw_vertex.h"
#include "nv50_debug.h"
#include "nv50_winsys.h"
#include "nv50_stateobj.h"
#include "nv50_screen.h"
@ -26,15 +26,6 @@
#include "nv50_3d.xml.h"
#include "nv50_2d.xml.h"
#define NOUVEAU_ERR(fmt, args...) \
fprintf(stderr, "%s:%d - "fmt, __FUNCTION__, __LINE__, ##args);
#ifdef NOUVEAU_DEBUG
# define NOUVEAU_DBG(args...) printf(args);
#else
# define NOUVEAU_DBG(args...)
#endif
#define NV50_NEW_BLEND (1 << 0)
#define NV50_NEW_RASTERIZER (1 << 1)
#define NV50_NEW_ZSA (1 << 2)
@ -80,6 +71,8 @@ struct nv50_context {
uint32_t instance_elts; /* bitmask of per-instance elements */
uint32_t instance_base;
uint32_t interpolant_ctrl;
uint32_t semantic_color;
uint32_t semantic_psize;
int32_t index_bias;
boolean prim_restart;
boolean point_sprite;
@ -183,7 +176,7 @@ void nv50_fragprog_validate(struct nv50_context *);
void nv50_fp_linkage_validate(struct nv50_context *);
void nv50_gp_linkage_validate(struct nv50_context *);
void nv50_constbufs_validate(struct nv50_context *);
void nv50_sprite_coords_validate(struct nv50_context *);
void nv50_validate_derived_rs(struct nv50_context *);
/* nv50_state.c */
extern void nv50_init_state_functions(struct nv50_context *);

View file

@ -0,0 +1,25 @@
#ifndef __NV50_DEBUG_H__
#define __NV50_DEBUG_H__
#include <stdio.h>
#include "util/u_debug.h"
#define NV50_DEBUG_MISC 0x0001
#define NV50_DEBUG_SHADER 0x0100
#define NV50_DEBUG_PROG_IR 0x0200
#define NV50_DEBUG_PROG_RA 0x0400
#define NV50_DEBUG_PROG_CFLOW 0x0800
#define NV50_DEBUG_PROG_ALL 0x1f00
#define NV50_DEBUG 0
#define NOUVEAU_ERR(fmt, args...) \
fprintf(stderr, "%s:%d - "fmt, __FUNCTION__, __LINE__, ##args)
#define NV50_DBGMSG(ch, args...) \
if ((NV50_DEBUG) & (NV50_DEBUG_##ch)) \
debug_printf(args)
#endif /* __NV50_DEBUG_H__ */

View file

@ -93,6 +93,10 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] =
B_(C2, C1, C0, C3, UNORM, UNORM, UNORM, UNORM, 4_4_4_4, 1),
SAMPLER_VIEW },
[PIPE_FORMAT_B4G4R4X4_UNORM] = { 0,
B_(C2, C1, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 4_4_4_4, 1),
SAMPLER_VIEW },
[PIPE_FORMAT_R10G10B10A2_UNORM] = { NV50_SURFACE_FORMAT_A2B10G10R10_UNORM,
A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 2_10_10_10, 0),
SAMPLER_VIEW | RENDER_TARGET | VERTEX_BUFFER | SCANOUT },
@ -138,14 +142,62 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] =
A_(C0, C0, C0, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 8, 0),
SAMPLER_VIEW | RENDER_TARGET },
[PIPE_FORMAT_I8_UNORM] = { NV50_SURFACE_FORMAT_R8_UNORM,
A_(C0, C0, C0, C0, UNORM, UNORM, UNORM, UNORM, 8, 0),
[PIPE_FORMAT_L16_SNORM] = { NV50_SURFACE_FORMAT_R16_SNORM,
B_(C0, C0, C0, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 16, 0),
SAMPLER_VIEW | RENDER_TARGET },
[PIPE_FORMAT_L16_FLOAT] = { NV50_SURFACE_FORMAT_R16_FLOAT,
B_(C0, C0, C0, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 16, 0),
SAMPLER_VIEW | RENDER_TARGET },
[PIPE_FORMAT_L32_FLOAT] = { NV50_SURFACE_FORMAT_R32_FLOAT,
B_(C0, C0, C0, ONE_FLOAT, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
SAMPLER_VIEW | RENDER_TARGET },
[PIPE_FORMAT_I8_UNORM] = { 0,
A_(C0, C0, C0, C0, UNORM, UNORM, UNORM, UNORM, 8, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_I16_UNORM] = { NV50_SURFACE_FORMAT_R16_UNORM,
A_(C0, C0, C0, C0, UNORM, UNORM, UNORM, UNORM, 16, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_I16_SNORM] = { NV50_SURFACE_FORMAT_R16_SNORM,
B_(C0, C0, C0, C0, SNORM, SNORM, SNORM, SNORM, 16, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_I16_FLOAT] = { NV50_SURFACE_FORMAT_R16_FLOAT,
B_(C0, C0, C0, C0, FLOAT, FLOAT, FLOAT, FLOAT, 16, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_I32_FLOAT] = { NV50_SURFACE_FORMAT_R32_FLOAT,
B_(C0, C0, C0, C0, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_A8_UNORM] = { NV50_SURFACE_FORMAT_A8_UNORM,
A_(ZERO, ZERO, ZERO, C0, UNORM, UNORM, UNORM, UNORM, 8, 0),
SAMPLER_VIEW | RENDER_TARGET },
[PIPE_FORMAT_A8_SNORM] = { 0,
A_(ZERO, ZERO, ZERO, C0, SNORM, SNORM, SNORM, SNORM, 8, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_A16_UNORM] = { 0,
A_(ZERO, ZERO, ZERO, C0, UNORM, UNORM, UNORM, UNORM, 16, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_A16_SNORM] = { 0,
A_(ZERO, ZERO, ZERO, C0, SNORM, SNORM, SNORM, SNORM, 16, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_A16_FLOAT] = { 0,
B_(ZERO, ZERO, ZERO, C0, FLOAT, FLOAT, FLOAT, FLOAT, 16, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_A32_FLOAT] = { 0,
B_(ZERO, ZERO, ZERO, C0, FLOAT, FLOAT, FLOAT, FLOAT, 32, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_L8A8_UNORM] = { 0,
A_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 8_8, 0),
SAMPLER_VIEW },
@ -154,6 +206,26 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] =
A_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 8_8, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_L16A16_UNORM] = { 0,
A_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 16_16, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_L16A16_SNORM] = { 0,
A_(C0, C0, C0, C1, SNORM, SNORM, SNORM, SNORM, 16_16, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_L16A16_FLOAT] = { 0,
B_(C0, C0, C0, C1, FLOAT, FLOAT, FLOAT, FLOAT, 16_16, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_L32A32_FLOAT] = { 0,
B_(C0, C0, C0, C1, FLOAT, FLOAT, FLOAT, FLOAT, 32_32, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_L4A4_UNORM] = { 0,
B_(C0, C0, C0, C1, UNORM, UNORM, UNORM, UNORM, 4_4, 0),
SAMPLER_VIEW },
/* DXT, RGTC */
[PIPE_FORMAT_DXT1_RGB] = { 0,
@ -172,6 +244,22 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] =
B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT5, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_DXT1_SRGB] = { 0,
B_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, DXT1, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_DXT1_SRGBA] = { 0,
B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT1, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_DXT3_SRGBA] = { 0,
B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT3, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_DXT5_SRGBA] = { 0,
B_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, DXT5, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_RGTC1_UNORM] = { 0,
B_(C0, ZERO, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, RGTC1, 0),
SAMPLER_VIEW },
@ -237,7 +325,7 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] =
/* SNORM 32 */
[PIPE_FORMAT_R32G32B32A32_SNORM] = { 0,
A_(C0, C1, C2, C3, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32_32, 0),
A_(C0, C1, C2, C3, SNORM, SNORM, SNORM, SNORM, 32_32_32_32, 0),
VERTEX_BUFFER | SAMPLER_VIEW },
[PIPE_FORMAT_R32G32B32_SNORM] = { 0,
@ -255,7 +343,7 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] =
/* UNORM 32 */
[PIPE_FORMAT_R32G32B32A32_UNORM] = { 0,
A_(C0, C1, C2, C3, FLOAT, FLOAT, FLOAT, FLOAT, 32_32_32_32, 0),
A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 32_32_32_32, 0),
VERTEX_BUFFER | SAMPLER_VIEW },
[PIPE_FORMAT_R32G32B32_UNORM] = { 0,
@ -281,7 +369,7 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] =
VERTEX_BUFFER | SAMPLER_VIEW },
[PIPE_FORMAT_R16G16_SNORM] = { NV50_SURFACE_FORMAT_R16G16_SNORM,
A_(C0, C1, C2, C3, SNORM, SNORM, SNORM, SNORM, 16_16, 0),
A_(C0, C1, ZERO, ONE_FLOAT, SNORM, SNORM, SNORM, SNORM, 16_16, 0),
VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
[PIPE_FORMAT_R16_SNORM] = { NV50_SURFACE_FORMAT_R16_SNORM,
@ -299,7 +387,7 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] =
VERTEX_BUFFER | SAMPLER_VIEW },
[PIPE_FORMAT_R16G16_UNORM] = { NV50_SURFACE_FORMAT_R16G16_UNORM,
A_(C0, C1, C2, C3, UNORM, UNORM, UNORM, UNORM, 16_16, 0),
A_(C0, C1, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, 16_16, 0),
VERTEX_BUFFER | SAMPLER_VIEW | RENDER_TARGET },
[PIPE_FORMAT_R16_UNORM] = { NV50_SURFACE_FORMAT_R16_UNORM,
@ -457,4 +545,30 @@ const struct nv50_format nv50_format_table[PIPE_FORMAT_COUNT] =
[PIPE_FORMAT_R8_USCALED] = { 0,
A_(C0, ZERO, ZERO, ONE_FLOAT, USCALED, USCALED, USCALED, USCALED, 8, 0),
VERTEX_BUFFER },
/* OTHER FORMATS */
[PIPE_FORMAT_R8G8_B8G8_UNORM] = { 0,
B_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, C1_C2_C1_C0, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_G8R8_G8B8_UNORM] = { 0,
B_(C0, C1, C2, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, C2_C1_C0_C1, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_R8SG8SB8UX8U_NORM] = { 0,
B_(C0, C1, C2, ONE_FLOAT, SNORM, SNORM, UNORM, UNORM, 8_8_8_8, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_R5SG5SB6U_NORM] = { 0,
B_(C0, C1, C2, ONE_FLOAT, SNORM, SNORM, UNORM, UNORM, 6_5_5, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_R1_UNORM] = { 0,
B_(C0, ZERO, ZERO, ONE_FLOAT, UNORM, UNORM, UNORM, UNORM, BITMAP_8X8, 0),
SAMPLER_VIEW },
[PIPE_FORMAT_A8B8G8R8_UNORM] = { 0,
B_(C3, C2, C1, C0, UNORM, UNORM, UNORM, UNORM, 8_8_8_8, 0),
SAMPLER_VIEW },
};

View file

@ -20,8 +20,6 @@
* SOFTWARE.
*/
/* #define NV50PC_DEBUG */
#include "nv50_pc.h"
#include "nv50_program.h"
@ -180,6 +178,7 @@ nv50_op_can_write_flags(uint opcode)
switch (opcode) { /* obvious ones like KIL, CALL, etc. not included */
case NV_OP_PHI:
case NV_OP_MOV:
case NV_OP_SELECT:
case NV_OP_LINTERP:
case NV_OP_PINTERP:
case NV_OP_LDA:
@ -367,7 +366,7 @@ nv_print_program(struct nv_pc *pc)
nv_print_function(pc->root[i]);
}
#ifdef NV50PC_DEBUG
#if NV50_DEBUG & NV50_DEBUG_PROG_CFLOW
static void
nv_do_print_cfgraph(struct nv_pc *pc, FILE *f, struct nv_basic_block *b)
{
@ -425,7 +424,7 @@ nv_print_cfgraph(struct nv_pc *pc, const char *filepath, int subr)
fclose(f);
}
#endif
#endif /* NV50_DEBUG_PROG_CFLOW */
static INLINE void
nvcg_show_bincode(struct nv_pc *pc)
@ -446,7 +445,7 @@ nv50_emit_program(struct nv_pc *pc)
uint32_t *code = pc->emit;
int n;
NV50_DBGMSG("emitting program: size = %u\n", pc->bin_size);
NV50_DBGMSG(SHADER, "emitting program: size = %u\n", pc->bin_size);
for (n = 0; n < pc->num_blocks; ++n) {
struct nv_instruction *i;
@ -472,7 +471,7 @@ nv50_emit_program(struct nv_pc *pc)
pc->emit = code;
code[pc->bin_size / 4 - 1] |= 1;
#ifdef NV50PC_DEBUG
#if NV50_DEBUG & NV50_DEBUG_SHADER
nvcg_show_bincode(pc);
#endif
@ -500,7 +499,7 @@ nv50_generate_code(struct nv50_translation_info *ti)
ret = nv50_tgsi_to_nc(pc, ti);
if (ret)
goto out;
#ifdef NV50PC_DEBUG
#if NV50_DEBUG & NV50_DEBUG_PROG_IR
nv_print_program(pc);
#endif
@ -510,7 +509,7 @@ nv50_generate_code(struct nv50_translation_info *ti)
ret = nv_pc_exec_pass0(pc);
if (ret)
goto out;
#ifdef NV50PC_DEBUG
#if NV50_DEBUG & NV50_DEBUG_PROG_IR
nv_print_program(pc);
#endif
@ -518,7 +517,7 @@ nv50_generate_code(struct nv50_translation_info *ti)
ret = nv_pc_exec_pass1(pc);
if (ret)
goto out;
#ifdef NV50PC_DEBUG
#if NV50_DEBUG & NV50_DEBUG_PROG_CFLOW
nv_print_program(pc);
nv_print_cfgraph(pc, "nv50_shader_cfgraph.dot", 0);
#endif
@ -552,7 +551,7 @@ nv50_generate_code(struct nv50_translation_info *ti)
ti->p->uses_lmem = ti->store_to_memory;
NV50_DBGMSG("SHADER TRANSLATION - %s\n", ret ? "failure" : "success");
NV50_DBGMSG(SHADER, "SHADER TRANSLATION - %s\n", ret ? "failed" : "success");
out:
nv_pc_free_refs(pc);
@ -624,6 +623,9 @@ nvbb_insert_tail(struct nv_basic_block *b, struct nv_instruction *i)
i->bb = b;
b->num_instructions++;
if (i->prev && i->prev->is_terminator)
nv_nvi_permute(i->prev, i);
}
void
@ -669,7 +671,7 @@ nv_nvi_delete(struct nv_instruction *nvi)
if (nvi == b->phi) {
if (nvi->opcode != NV_OP_PHI)
NV50_DBGMSG("NOTE: b->phi points to non-PHI instruction\n");
NV50_DBGMSG(PROG_IR, "NOTE: b->phi points to non-PHI instruction\n");
assert(!nvi->prev);
if (!nvi->next || nvi->next->opcode != NV_OP_PHI)

View file

@ -23,13 +23,7 @@
#ifndef __NV50_COMPILER_H__
#define __NV50_COMPILER_H__
#define NV50PC_DEBUG
#ifdef NV50PC_DEBUG
# define NV50_DBGMSG(args...) debug_printf(args)
#else
# define NV50_DBGMSG(args...)
#endif
#include "nv50_debug.h"
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
@ -228,6 +222,8 @@ struct nv_ref {
ubyte flags; /* not used yet */
};
#define NV_REF_FLAG_REGALLOC_PRIV (1 << 0)
struct nv_basic_block;
struct nv_instruction {
@ -263,6 +259,15 @@ struct nv_instruction {
ubyte quadop;
};
static INLINE int
nvi_vector_size(struct nv_instruction *nvi)
{
int i;
assert(nvi);
for (i = 0; i < 4 && nvi->def[i]; ++i);
return i;
}
#define CFG_EDGE_FORWARD 0
#define CFG_EDGE_BACK 1
#define CFG_EDGE_LOOP_ENTER 2

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