diff options
author | marha <marha@users.sourceforge.net> | 2014-11-29 12:40:08 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-11-29 12:40:08 +0100 |
commit | a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9 (patch) | |
tree | 3875aa5d80808dfe3c52035a4148384d7090fb8a /mesalib | |
parent | d6d5581d5fba846c8476ad4d593da662306765d7 (diff) | |
download | vcxsrv-a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9.tar.gz vcxsrv-a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9.tar.bz2 vcxsrv-a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9.zip |
fontconfig libX11 libxcb libxcb/xcb-proto mesa xserver xkbcomp xkeyboard-config git update 29 Nov 2014
xserver commit c52a2b1ebad56820af932dfbc871701a8b04fd9c
libxcb commit bbca7b82f803fa13fd30a2891ec06f2a213a28c2
libxcb/xcb-proto commit 691d2b97e5989d6d7006304d81bd8fa128477ca1
xkeyboard-config commit b664d7fb8aab9b0f834dd9c81d273c7809561b34
libX11 commit f3831dde6972e4da9e018c6a5f4013d8756a5e78
xkbcomp commit 1e8ee9d0aad072f04186df84752f5636340574e0
fontconfig commit b732bf057f4b3ec3bac539803005e9c42d056b2a
mesa commit 67c498086d0858a94d53ebb6921cfda847250368
Diffstat (limited to 'mesalib')
116 files changed, 7351 insertions, 2496 deletions
diff --git a/mesalib/VERSION b/mesalib/VERSION index d43f97a97..093d8ba20 100644 --- a/mesalib/VERSION +++ b/mesalib/VERSION @@ -1 +1 @@ -10.4.0-devel +10.5.0-devel diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 03f1bca86..1d9d01548 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -39,6 +39,7 @@ PRESENTPROTO_REQUIRED=1.0 LIBUDEV_REQUIRED=151 GLPROTO_REQUIRED=1.4.14 LIBOMXIL_BELLAGIO_REQUIRED=0.0 +LIBVA_REQUIRED=0.35.0 VDPAU_REQUIRED=0.4.1 WAYLAND_REQUIRED=1.2.0 XCB_REQUIRED=1.9.3 @@ -252,7 +253,16 @@ AC_SUBST([VISIBILITY_CXXFLAGS]) dnl dnl Optional flags, check for compiler support dnl -AX_CHECK_COMPILE_FLAG([-msse4.1], [SSE41_SUPPORTED=1], [SSE41_SUPPORTED=0]) +save_CFLAGS="$CFLAGS" +CFLAGS="-msse4.1 $CFLAGS" +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +#include <smmintrin.h> +int main () { + __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c; + c = _mm_max_epu32(a, b); + return 0; +}]])], SSE41_SUPPORTED=1) +CFLAGS="$save_CFLAGS" if test "x$SSE41_SUPPORTED" = x1; then DEFINES="$DEFINES -DUSE_SSE41" fi @@ -527,6 +537,9 @@ if test "x$enable_asm" = xyes; then esac fi +AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"]) +AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) + dnl Check to see if dlopen is in default libraries (like Solaris, which dnl has it in libc), or if libdl is needed to get it. AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"], @@ -657,6 +670,11 @@ AC_ARG_ENABLE([gbm], [enable gbm library @<:@default=auto@:>@])], [enable_gbm="$enableval"], [enable_gbm=auto]) +AC_ARG_ENABLE([nine], + [AS_HELP_STRING([--enable-nine], + [enable build of the nine Direct3D9 API @<:@default=no@:>@])], + [enable_nine="$enableval"], + [enable_nine=no]) AC_ARG_ENABLE([xvmc], [AS_HELP_STRING([--enable-xvmc], @@ -694,20 +712,6 @@ AC_ARG_ENABLE([xlib-glx], [make GLX library Xlib-based instead of DRI-based @<:@default=disabled@:>@])], [enable_xlib_glx="$enableval"], [enable_xlib_glx=no]) -AC_ARG_ENABLE([gallium-egl], - [AS_HELP_STRING([--enable-gallium-egl], - [enable optional EGL state tracker (not required - for EGL support in Gallium with OpenGL and OpenGL ES) - @<:@default=disabled@:>@])], - [enable_gallium_egl="$enableval"], - [enable_gallium_egl=no]) -AC_ARG_ENABLE([gallium-gbm], - [AS_HELP_STRING([--enable-gallium-gbm], - [enable optional gbm state tracker (not required for - gbm support in Gallium) - @<:@default=auto@:>@])], - [enable_gallium_gbm="$enableval"], - [enable_gallium_gbm=auto]) AC_ARG_ENABLE([r600-llvm-compiler], [AS_HELP_STRING([--enable-r600-llvm-compiler], @@ -744,6 +748,7 @@ esac if test "x$enable_opengl" = xno -a \ "x$enable_gles1" = xno -a \ "x$enable_gles2" = xno -a \ + "x$enable_nine" = xno -a \ "x$enable_openvg" = xno -a \ "x$enable_xa" = xno -a \ "x$enable_xvmc" = xno -a \ @@ -1311,51 +1316,6 @@ AM_CONDITIONAL(HAVE_EGL, test "x$enable_egl" = xyes) AC_SUBST([EGL_LIB_DEPS]) dnl -dnl EGL Gallium configuration -dnl -if test "x$enable_gallium_egl" = xyes; then - if test -z "$with_gallium_drivers"; then - AC_MSG_ERROR([cannot enable egl_gallium without Gallium]) - fi - if test "x$enable_egl" = xno; then - AC_MSG_ERROR([cannot enable egl_gallium without EGL]) - fi - if test "x$have_libdrm" != xyes; then - AC_MSG_ERROR([egl_gallium requires libdrm >= $LIBDRM_REQUIRED]) - fi -# XXX: Uncomment once converted to use static/shared pipe-drivers -# enable_gallium_loader=$enable_shared_pipe_drivers -fi -AM_CONDITIONAL(HAVE_GALLIUM_EGL, test "x$enable_gallium_egl" = xyes) - -dnl -dnl gbm Gallium configuration -dnl -if test "x$enable_gallium_gbm" = xauto; then - case "$enable_gbm$enable_gallium_egl$enable_dri$with_egl_platforms" in - yesyesyes*drm*) - enable_gallium_gbm=yes ;; - *) - enable_gallium_gbm=no ;; - esac -fi -if test "x$enable_gallium_gbm" = xyes; then - if test -z "$with_gallium_drivers"; then - AC_MSG_ERROR([cannot enable gbm_gallium without Gallium]) - fi - if test "x$enable_gbm" = xno; then - AC_MSG_ERROR([cannot enable gbm_gallium without gbm]) - fi - - if test "x$enable_gallium_egl" != xyes; then - AC_MSG_ERROR([gbm_gallium is only used by egl_gallium]) - fi - - enable_gallium_loader=$enable_shared_pipe_drivers -fi -AM_CONDITIONAL(HAVE_GALLIUM_GBM, test "x$enable_gallium_gbm" = xyes) - -dnl dnl XA configuration dnl if test "x$enable_xa" = xyes; then @@ -1383,9 +1343,9 @@ if test "x$enable_openvg" = xyes; then if test -z "$with_gallium_drivers"; then AC_MSG_ERROR([cannot enable OpenVG without Gallium]) fi - if test "x$enable_gallium_egl" = xno; then - AC_MSG_ERROR([cannot enable OpenVG without egl_gallium]) - fi + + AC_MSG_ERROR([Cannot enable OpenVG, because egl_gallium has been removed and + OpenVG hasn't been integrated into standard libEGL yet]) EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)' VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS $PTHREAD_LIBS" @@ -1399,49 +1359,74 @@ dnl Gallium G3DVL configuration dnl if test -n "$with_gallium_drivers" -a "x$with_gallium_drivers" != xswrast; then if test "x$enable_xvmc" = xauto; then - PKG_CHECK_EXISTS([xvmc], [enable_xvmc=yes], [enable_xvmc=no]) + PKG_CHECK_EXISTS([xvmc >= $XVMC_REQUIRED], [enable_xvmc=yes], [enable_xvmc=no]) fi if test "x$enable_vdpau" = xauto; then - PKG_CHECK_EXISTS([vdpau], [enable_vdpau=yes], [enable_vdpau=no]) + PKG_CHECK_EXISTS([vdpau >= $VDPAU_REQUIRED], [enable_vdpau=yes], [enable_vdpau=no]) fi if test "x$enable_omx" = xauto; then - PKG_CHECK_EXISTS([libomxil-bellagio], [enable_omx=yes], [enable_omx=no]) + PKG_CHECK_EXISTS([libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED], [enable_omx=yes], [enable_omx=no]) fi if test "x$enable_va" = xauto; then - PKG_CHECK_EXISTS([libva], [enable_va=yes], [enable_va=no]) + PKG_CHECK_EXISTS([libva >= $LIBVA_REQUIRED], [enable_va=yes], [enable_va=no]) fi fi +if test "x$enable_xvmc" = xyes -o \ + "x$enable_vdpau" = xyes -o \ + "x$enable_omx" = xyes -o \ + "x$enable_va" = xyes; then + PKG_CHECK_MODULES([VL], [x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED]) + need_gallium_vl=yes +fi +AM_CONDITIONAL(NEED_GALLIUM_VL, test "x$need_gallium_vl" = xyes) + if test "x$enable_xvmc" = xyes; then - PKG_CHECK_MODULES([XVMC], [xvmc >= $XVMC_REQUIRED x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED]) + PKG_CHECK_MODULES([XVMC], [xvmc >= $XVMC_REQUIRED]) enable_gallium_loader=$enable_shared_pipe_drivers fi AM_CONDITIONAL(HAVE_ST_XVMC, test "x$enable_xvmc" = xyes) if test "x$enable_vdpau" = xyes; then - PKG_CHECK_MODULES([VDPAU], [vdpau >= $VDPAU_REQUIRED x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED], - [VDPAU_LIBS="`$PKG_CONFIG --libs x11-xcb xcb xcb-dri2`"]) + PKG_CHECK_MODULES([VDPAU], [vdpau >= $VDPAU_REQUIRED]) enable_gallium_loader=$enable_shared_pipe_drivers fi AM_CONDITIONAL(HAVE_ST_VDPAU, test "x$enable_vdpau" = xyes) if test "x$enable_omx" = xyes; then - PKG_CHECK_MODULES([OMX], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED]) + PKG_CHECK_MODULES([OMX], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED]) enable_gallium_loader=$enable_shared_pipe_drivers fi AM_CONDITIONAL(HAVE_ST_OMX, test "x$enable_omx" = xyes) if test "x$enable_va" = xyes; then - PKG_CHECK_MODULES([VA], [libva >= 0.35.0 x11-xcb xcb-dri2 >= $XCBDRI2_REQUIRED], - [VA_LIBS="`$PKG_CONFIG --libs x11-xcb xcb-dri2`"]) + PKG_CHECK_MODULES([VA], [libva >= $LIBVA_REQUIRED]) enable_gallium_loader=$enable_shared_pipe_drivers fi AM_CONDITIONAL(HAVE_ST_VA, test "x$enable_va" = xyes) dnl +dnl Nine Direct3D9 configuration +dnl +if test "x$enable_nine" = xyes; then + if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then + AC_MSG_ERROR([nine requires the gallium swrast driver]) + fi + if test "x$with_gallium_drivers" == xswrast; then + AC_MSG_ERROR([nine requires at least one non-swrast gallium driver]) + fi + if test "x$enable_dri3" = xno; then + AC_MSG_WARN([using nine together with wine requires DRI3 enabled system]) + fi + + enable_gallium_loader=$enable_shared_pipe_drivers +fi +AM_CONDITIONAL(HAVE_ST_NINE, test "x$enable_nine" = xyes) + +dnl dnl OpenCL configuration dnl @@ -1815,6 +1800,13 @@ AC_ARG_WITH([va-libdir], [VA_LIB_INSTALL_DIR="${libdir}/dri"]) AC_SUBST([VA_LIB_INSTALL_DIR]) +AC_ARG_WITH([d3d-libdir], + [AS_HELP_STRING([--with-d3d-libdir=DIR], + [directory for the D3D modules @<:@${libdir}/d3d@:>@])], + [D3D_DRIVER_INSTALL_DIR="$withval"], + [D3D_DRIVER_INSTALL_DIR="${libdir}/d3d"]) +AC_SUBST([D3D_DRIVER_INSTALL_DIR]) + dnl dnl Gallium helper functions dnl @@ -1970,7 +1962,7 @@ if test -n "$with_gallium_drivers"; then fi dnl Set LLVM_LIBS - This is done after the driver configuration so -dnl that drivers can add additonal components to LLVM_COMPONENTS. +dnl that drivers can add additional components to LLVM_COMPONENTS. dnl Previously, gallium drivers were updating LLVM_LIBS directly dnl by calling llvm-config --libs ${DRIVER_LLVM_COMPONENTS}, but dnl this was causing the same libraries to be appear multiple times @@ -2003,11 +1995,16 @@ if test "x$MESA_LLVM" != x0; then invocation and rebuild.])]) dnl We don't need to update LLVM_LIBS in this case because the LLVM - dnl install uses a shared object for each compoenent and we have + dnl install uses a shared object for each component and we have dnl already added all of these objects to LLVM_LIBS. fi else - AC_MSG_WARN([Building mesa with staticly linked LLVM may cause compilation issues]) + AC_MSG_WARN([Building mesa with statically linked LLVM may cause compilation issues]) + dnl We need to link to llvm system libs when using static libs + dnl However, only llvm 3.5+ provides --system-libs + if test $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 5; then + LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --system-libs`" + fi fi fi @@ -2094,6 +2091,11 @@ AM_CONDITIONAL(HAVE_X86_ASM, test "x$asm_arch" = xx86 -o "x$asm_arch" = xx86_64) AM_CONDITIONAL(HAVE_X86_64_ASM, test "x$asm_arch" = xx86_64) AM_CONDITIONAL(HAVE_SPARC_ASM, test "x$asm_arch" = xsparc) +AC_SUBST([NINE_MAJOR], 1) +AC_SUBST([NINE_MINOR], 0) +AC_SUBST([NINE_TINY], 0) +AC_SUBST([NINE_VERSION], "$NINE_MAJOR.$NINE_MINOR.$NINE_TINY") + AC_SUBST([VDPAU_MAJOR], 1) AC_SUBST([VDPAU_MINOR], 0) @@ -2162,9 +2164,8 @@ AC_CONFIG_FILES([Makefile src/gallium/drivers/vc4/kernel/Makefile src/gallium/state_trackers/clover/Makefile src/gallium/state_trackers/dri/Makefile - src/gallium/state_trackers/egl/Makefile - src/gallium/state_trackers/gbm/Makefile src/gallium/state_trackers/glx/xlib/Makefile + src/gallium/state_trackers/nine/Makefile src/gallium/state_trackers/omx/Makefile src/gallium/state_trackers/osmesa/Makefile src/gallium/state_trackers/va/Makefile @@ -2172,6 +2173,8 @@ AC_CONFIG_FILES([Makefile src/gallium/state_trackers/vega/Makefile src/gallium/state_trackers/xa/Makefile src/gallium/state_trackers/xvmc/Makefile + src/gallium/targets/d3dadapter9/Makefile + src/gallium/targets/d3dadapter9/d3d.pc src/gallium/targets/dri/Makefile src/gallium/targets/egl-static/Makefile src/gallium/targets/gbm/Makefile @@ -2299,12 +2302,7 @@ if test "$enable_egl" = yes; then egl_drivers="$egl_drivers builtin:egl_dri2" fi - if test "x$enable_gallium_egl" = xyes; then - echo " EGL drivers: ${egl_drivers} egl_gallium" - echo " EGL Gallium STs:$EGL_CLIENT_APIS" - else - echo " EGL drivers: $egl_drivers" - fi + echo " EGL drivers: $egl_drivers" fi echo "" diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt index 6a988d5e7..648f5ac86 100644 --- a/mesalib/docs/GL3.txt +++ b/mesalib/docs/GL3.txt @@ -18,7 +18,7 @@ are exposed in the 3.0 context as extensions. Feature Status ----------------------------------------------------- ------------------------ -GL 3.0, GLSL 1.30 --- all DONE: i965, nv50, nvc0, r600, radeonsi, llvmpipe (*), softpipe (*) +GL 3.0, GLSL 1.30 --- all DONE: i965, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe glBindFragDataLocation, glGetFragDataLocation DONE Conditional rendering (GL_NV_conditional_render) DONE (r300, swrast) @@ -45,7 +45,7 @@ GL 3.0, GLSL 1.30 --- all DONE: i965, nv50, nvc0, r600, radeonsi, llvmpipe (*), glVertexAttribI commands DONE Depth format cube textures DONE () GLX_ARB_create_context (GLX 1.4 is required) DONE - Multisample anti-aliasing DONE (r300) + Multisample anti-aliasing DONE (llvmpipe (*), softpipe (*), r300) (*) llvmpipe and softpipe have fake Multisample anti-aliasing support @@ -98,8 +98,8 @@ GL 4.0, GLSL 4.00: GL_ARB_draw_indirect DONE (i965, nvc0, radeonsi, llvmpipe, softpipe) GL_ARB_gpu_shader5 DONE (i965, nvc0) - 'precise' qualifier DONE - - Dynamically uniform sampler array indices DONE () - - Dynamically uniform UBO array indices DONE () + - Dynamically uniform sampler array indices DONE (r600) + - Dynamically uniform UBO array indices DONE (r600) - Implicit signed -> unsigned conversions DONE - Fused multiply-add DONE () - Packing/bitfield/conversion functions DONE (r600) @@ -107,7 +107,7 @@ GL 4.0, GLSL 4.00: - Geometry shader instancing DONE (r600) - Geometry shader multiple streams DONE () - Enhanced per-sample shading DONE (r600) - - Interpolation functions DONE () + - Interpolation functions DONE (r600) - New overload resolution rules DONE GL_ARB_gpu_shader_fp64 started (Dave) GL_ARB_sample_shading DONE (i965, nv50, nvc0, r600, radeonsi) @@ -187,15 +187,15 @@ GL 4.4, GLSL 4.40: GL 4.5, GLSL 4.50: GL_ARB_ES3_1_compatibility not started - GL_ARB_clip_control DONE (llvmpipe, softpipe, r300, r600, radeonsi) - GL_ARB_conditional_render_inverted DONE (i965, nvc0, llvmpipe, softpipe) + GL_ARB_clip_control DONE (nv50, nvc0, r300, r600, radeonsi, llvmpipe, softpipe) + GL_ARB_conditional_render_inverted DONE (i965, nv50, nvc0, llvmpipe, softpipe) GL_ARB_cull_distance not started GL_ARB_derivative_control DONE (i965, nv50, nvc0, r600) - GL_ARB_direct_state_access not started + GL_ARB_direct_state_access started (Laura Ekstrand) GL_ARB_get_texture_sub_image started (Brian Paul) GL_ARB_shader_texture_image_samples not started GL_ARB_texture_barrier DONE (nv50, nvc0, r300, r600, radeonsi) - GL_KHR_context_flush_control not started + GL_KHR_context_flush_control DONE (all - but needs GLX/EXT extension to be useful) GL_KHR_robust_buffer_access_behavior not started GL_KHR_robustness 90% done (the ARB variant) diff --git a/mesalib/docs/egl.html b/mesalib/docs/egl.html index eebb8c73b..e77c2359d 100644 --- a/mesalib/docs/egl.html +++ b/mesalib/docs/egl.html @@ -77,13 +77,6 @@ drivers will be installed to <code>${libdir}/egl</code>.</p> </dd> -<dt><code>--enable-gallium-egl</code></dt> -<dd> - -<p>Enable the optional <code>egl_gallium</code> driver.</p> - -</dd> - <dt><code>--with-egl-platforms</code></dt> <dd> diff --git a/mesalib/docs/index.html b/mesalib/docs/index.html index 0a491a2c9..024bb5f59 100644 --- a/mesalib/docs/index.html +++ b/mesalib/docs/index.html @@ -16,6 +16,18 @@ <h1>News</h1> +<h2>November 21, 2014</h2> +<p> +<a href="relnotes/10.3.4.html">Mesa 10.3.4</a> is released. +This is a bug-fix release. +</p> + +<h2>November 8, 2014</h2> +<p> +<a href="relnotes/10.3.3.html">Mesa 10.3.3</a> is released. +This is a bug-fix release. +</p> + <h2>October 24, 2014</h2> <p> <a href="relnotes/10.3.2.html">Mesa 10.3.2</a> is released. diff --git a/mesalib/docs/llvmpipe.html b/mesalib/docs/llvmpipe.html index 291527be8..72db93aaf 100644 --- a/mesalib/docs/llvmpipe.html +++ b/mesalib/docs/llvmpipe.html @@ -43,7 +43,7 @@ It's the fastest software rasterizer for Mesa. </p> </li> <li> - <p>LLVM: version 3.4 recommended; 3.1 or later required.</p> + <p>LLVM: version 3.4 recommended; 3.3 or later required.</p> <p> For Linux, on a recent Debian based distribution do: </p> diff --git a/mesalib/docs/relnotes.html b/mesalib/docs/relnotes.html index 1c97edd64..8dd732618 100644 --- a/mesalib/docs/relnotes.html +++ b/mesalib/docs/relnotes.html @@ -21,6 +21,8 @@ The release notes summarize what's new or changed in each Mesa release. </p> <ul> +<li><a href="relnotes/10.3.4.html">10.3.4 release notes</a> +<li><a href="relnotes/10.3.3.html">10.3.3 release notes</a> <li><a href="relnotes/10.3.2.html">10.3.2 release notes</a> <li><a href="relnotes/10.3.1.html">10.3.1 release notes</a> <li><a href="relnotes/10.2.9.html">10.2.9 release notes</a> diff --git a/mesalib/docs/relnotes/10.3.3.html b/mesalib/docs/relnotes/10.3.3.html new file mode 100644 index 000000000..3ca6496b7 --- /dev/null +++ b/mesalib/docs/relnotes/10.3.3.html @@ -0,0 +1,209 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> +<head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <title>Mesa Release Notes</title> + <link rel="stylesheet" type="text/css" href="../mesa.css"> +</head> +<body> + +<div class="header"> + <h1>The Mesa 3D Graphics Library</h1> +</div> + +<iframe src="../contents.html"></iframe> +<div class="content"> + +<h1>Mesa 10.3.3 Release Notes / November 8, 2014</h1> + +<p> +Mesa 10.3.3 is a bug fix release which fixes bugs found since the 10.3.2 release. +</p> +<p> +Mesa 10.3.3 implements the OpenGL 3.3 API, but the version reported by +glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / +glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 3.3. OpenGL +3.3 is <strong>only</strong> available if requested at context creation +because compatibility contexts are not supported. +</p> + +<h2>SHA256 checksums</h2> +<pre> +23a0c36d88cd5d8968ae6454160de2878192fd1d37b5d606adca1f1b7e788b79 MesaLib-10.3.3.tar.gz +0e4eee4a2ddf86456eed2fc44da367f95471f74249636710491e85cc256c4753 MesaLib-10.3.3.tar.bz2 +a83648f17d776b7cf6c813fbb15782d2644b937dc6a7c53d8c0d1b35411f4840 MesaLib-10.3.3.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=70410">Bug 70410</a> - egl-static/Makefile: linking fails with llvm >= 3.4</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=82921">Bug 82921</a> - layout(location=0) emits error >= MAX_UNIFORM_LOCATIONS due to integer underflow</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83574">Bug 83574</a> - [llvmpipe] [softpipe] piglit arb_explicit_uniform_location-use-of-unused-loc regression</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85454">Bug 85454</a> - Unigine Sanctuary with Wine crashes on Mesa Git</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85918">Bug 85918</a> - Mesa: MSVC 2010/2012 Compile error</li> + +</ul> + + +<h2>Changes</h2> + +<p>Anuj Phogat (2):</p> +<ul> + <li>glsl: Fix crash due to negative array index</li> + <li>glsl: Use signed array index in update_max_array_access()</li> +</ul> + +<p>Brian Paul (1):</p> +<ul> + <li>mesa: fix UNCLAMPED_FLOAT_TO_UBYTE() macro for MSVC</li> +</ul> + +<p>Emil Velikov (2):</p> +<ul> + <li>docs: Add sha256 sums for the 10.3.2 release</li> + <li>Update version to 10.3.3</li> +</ul> + +<p>Ilia Mirkin (27):</p> +<ul> + <li>freedreno/ir3: fix FSLT/etc handling to return 0/-1 instead of 0/1.0</li> + <li>freedreno/ir3: INEG operates on src0, not src1</li> + <li>freedreno/ir3: add UARL support</li> + <li>freedreno/ir3: negate result of USLT/etc</li> + <li>freedreno/ir3: use unsigned comparison for UIF</li> + <li>freedreno/ir3: add TXL support</li> + <li>freedreno/ir3: fix UCMP handling</li> + <li>freedreno/ir3: implement UMUL correctly</li> + <li>freedreno: add default .dir-locals.el for emacs settings</li> + <li>freedreno/ir3: make texture instruction construction more dynamic</li> + <li>freedreno/ir3: fix TXB/TXL to actually pull the bias/lod argument</li> + <li>freedreno/ir3: add TXQ support</li> + <li>freedreno/ir3: add TXB2 support</li> + <li>freedreno: dual-source render targets are not supported</li> + <li>freedreno: instanced drawing/compute not yet supported</li> + <li>freedreno/ir3: avoid fan-in sources referring to same instruction</li> + <li>freedreno/ir3: add IDIV/UDIV support</li> + <li>freedreno/ir3: add UMOD support, based on UDIV</li> + <li>freedreno/ir3: add MOD support</li> + <li>freedreno/ir3: add ISSG support</li> + <li>freedreno/ir3: add UMAD support</li> + <li>freedreno/ir3: make TXQ return integers, not floats</li> + <li>freedreno/ir3: shadow comes before array</li> + <li>freedreno/ir3: add texture offset support</li> + <li>freedreno/ir3: add TXD support and expose ARB_shader_texture_lod</li> + <li>freedreno/ir3: add TXF support</li> + <li>freedreno: positions come out as integers, not half-integers</li> +</ul> + +<p>Jan Vesely (1):</p> +<ul> + <li>configure: include llvm systemlibs when using static llvm</li> +</ul> + +<p>Marek Olšák (5):</p> +<ul> + <li>r600g: fix polygon mode for points and lines and point/line fill modes</li> + <li>radeonsi: fix polygon mode for points and lines and point/line fill modes</li> + <li>radeonsi: fix incorrect index buffer max size for lowered 8-bit indices</li> + <li>Revert "st/mesa: set MaxUnrollIterations = 255"</li> + <li>r300g: remove enabled/disabled hyperz and AA compression messages</li> +</ul> + +<p>Mauro Rossi (1):</p> +<ul> + <li>gallium/nouveau: fully build the driver under android</li> +</ul> + +<p>Michel Dänzer (1):</p> +<ul> + <li>radeon/llvm: Dynamically allocate branch/loop stack arrays</li> +</ul> + +<p>Rob Clark (62):</p> +<ul> + <li>freedreno/ir3: detect scheduler fail</li> + <li>freedreno/ir3: add TXB</li> + <li>freedreno/ir3: add DDX/DDY</li> + <li>freedreno/ir3: bit of debug</li> + <li>freedreno/ir3: fix error in bail logic</li> + <li>freedreno/ir3: fix constlen with relative addressing</li> + <li>freedreno/ir3: add no-copy-propagate fallback step</li> + <li>freedreno: don't overflow cmdstream buffer so much</li> + <li>freedreno/ir3: fix potential segfault in RA</li> + <li>freedreno: update generated headers</li> + <li>freedreno/a3xx: enable hw primitive-restart</li> + <li>freedreno/a3xx: handle rendering to layer != 0</li> + <li>freedreno: update generated headers</li> + <li>freedreno/a3xx: format fixes</li> + <li>util/u_format: add _is_alpha()</li> + <li>freedreno/a3xx: alpha render-target shenanigans</li> + <li>freedreno/ir3: catch incorrect usage of tmp-dst</li> + <li>freedreno/ir3: add missing put_dst</li> + <li>freedreno: "fix" problems with excessive flushes</li> + <li>freedreno: update generated headers</li> + <li>freedreno/a3xx: 3d/array textures</li> + <li>freedreno: add DRM_CONF_SHARE_FD</li> + <li>freedreno/a3xx: more texture array fixes</li> + <li>freedreno/a3xx: initial texture border-color</li> + <li>freedreno: fix compiler warning</li> + <li>freedreno: don't advertise mirror-clamp support</li> + <li>freedreno: update generated headers</li> + <li>freedreno: we have more than 0 viewports!</li> + <li>freedreno: turn missing caps into compile warnings</li> + <li>freedreno/a3xx: add LOD_BIAS</li> + <li>freedreno/a3xx: add flat interpolation mode</li> + <li>freedreno/a3xx: add 32bit integer vtx formats</li> + <li>freedreno/a3xx: fix border color order</li> + <li>freedreno: move bind_sampler_states to per-generation</li> + <li>freedreno: add texcoord clamp support to lowering</li> + <li>freedreno/a3xx: add support to emulate GL_CLAMP</li> + <li>freedreno/a3xx: re-emit shaders on variant change</li> + <li>freedreno/lowering: fix token calculation for lowering</li> + <li>freedreno: destroy transfer pool after blitter</li> + <li>freedreno: max-texture-lod-bias should be 15.0f</li> + <li>freedreno: update generated headers</li> + <li>freedreno/a3xx: handle large shader program sizes</li> + <li>freedreno/a3xx: emit all immediates in one shot</li> + <li>freedreno/ir3: fix lockups with lame FRAG shaders</li> + <li>freedreno/a3xx: handle VS only outputting BCOLOR</li> + <li>freedreno: query fixes</li> + <li>freedreno/a3xx: refactor vertex state emit</li> + <li>freedreno/a3xx: refactor/optimize emit</li> + <li>freedreno/ir3: optimize shader key comparision</li> + <li>freedreno: inline fd_draw_emit()</li> + <li>freedreno: fix layer_stride</li> + <li>freedreno: update generated headers</li> + <li>freedreno/ir3: large const support</li> + <li>freedreno/a3xx: more layer/level fixes</li> + <li>freedreno/ir3: comment + better fxn name</li> + <li>freedreno/ir3: fix potential gpu lockup with kill</li> + <li>freedreno/a3xx: disable early-z when we have kill's</li> + <li>freedreno/ir3: add debug flag to disable cp</li> + <li>freedreno: clear vs scissor</li> + <li>freedreno: mark scissor state dirty when enable bit changes</li> + <li>freedreno/a3xx: fix viewport state during clear</li> + <li>freedreno/a3xx: fix depth/stencil restore format</li> +</ul> + +<p>Tapani Pälli (2):</p> +<ul> + <li>glsl: fix uniform location count used for glsl types</li> + <li>mesa: check that uniform exists in glUniform* functions</li> +</ul> + + +</div> +</body> +</html> diff --git a/mesalib/docs/relnotes/10.3.4.html b/mesalib/docs/relnotes/10.3.4.html new file mode 100644 index 000000000..bc29462e4 --- /dev/null +++ b/mesalib/docs/relnotes/10.3.4.html @@ -0,0 +1,106 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> +<head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <title>Mesa Release Notes</title> + <link rel="stylesheet" type="text/css" href="../mesa.css"> +</head> +<body> + +<div class="header"> + <h1>The Mesa 3D Graphics Library</h1> +</div> + +<iframe src="../contents.html"></iframe> +<div class="content"> + +<h1>Mesa 10.3.4 Release Notes / November 21, 2014</h1> + +<p> +Mesa 10.3.4 is a bug fix release which fixes bugs found since the 10.3.3 release. +</p> +<p> +Mesa 10.3.4 implements the OpenGL 3.3 API, but the version reported by +glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / +glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 3.3. OpenGL +3.3 is <strong>only</strong> available if requested at context creation +because compatibility contexts are not supported. +</p> + +<h2>SHA256 checksums</h2> +<pre> +26482495ef6177f889dbd87c7edcccfedd995598785bbbd7e3e066352574c8e0 MesaLib-10.3.4.tar.gz +e6373913142338d10515daf619d659433bfd2989988198930c13b0945a15e98a MesaLib-10.3.4.tar.bz2 +8c3ebbb6535daf3414305860ebca6ac67dbb6e3d35058c7a6ce18b84b5945b7f MesaLib-10.3.4.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=76252">Bug 76252</a> - Dynamic loading/unloading of opengl32.dll results in a deadlock</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=78770">Bug 78770</a> - [SNB bisected]Webglc conformance/textures/texture-size-limit.html fails</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=83500">Bug 83500</a> - si_dma_copy_tile causes GPU hangs</li> + +<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=85647">Bug 85647</a> - Random radeonsi crashes with mesa 10.3.x</li> + +</ul> + +<h2>Changes</h2> +<p>Brian Paul (1):</p> +<ul> + <li>st/mesa: copy sampler_array_size field when copying instructions</li> +</ul> + +<p>Chad Versace (1):</p> +<ul> + <li>i965: Fix segfault in WebGL Conformance on Ivybridge</li> +</ul> + +<p>Dave Airlie (5):</p> +<ul> + <li>r600g/cayman: fix integer multiplication output overwrite (v2)</li> + <li>r600g/cayman: fix texture gather tests</li> + <li>r600g/cayman: handle empty vertex shaders</li> + <li>r600g: geom shaders: always load texture src regs from inputs</li> + <li>r600g: limit texture offset application to specific types (v2)</li> +</ul> + +<p>Emil Velikov (3):</p> +<ul> + <li>docs: Add sha256 sums for the 10.3.3 release</li> + <li>configure.ac: roll up a program for the sse4.1 check</li> + <li>get-pick-list.sh: Require explicit "10.3" for nominating stable patches</li> +</ul> + +<p>Ilia Mirkin (1):</p> +<ul> + <li>st/mesa: add a fallback for clear_with_quad when no vs_layer</li> +</ul> + +<p>José Fonseca (1):</p> +<ul> + <li>llvmpipe: Avoid deadlock when unloading opengl32.dll</li> +</ul> + +<p>Kenneth Graunke (1):</p> +<ul> + <li>i915g: we also have more than 0 viewports!</li> +</ul> + +<p>Michel Dänzer (1):</p> +<ul> + <li>radeonsi: Disable asynchronous DMA except for PIPE_BUFFER</li> +</ul> + +</div> +</body> +</html> diff --git a/mesalib/docs/relnotes/10.4.html b/mesalib/docs/relnotes/10.4.html index 67c3087ee..8682d7196 100644 --- a/mesalib/docs/relnotes/10.4.html +++ b/mesalib/docs/relnotes/10.4.html @@ -44,9 +44,11 @@ Note: some of the new features are only available with certain drivers. </p> <ul> +<li>GL_ARB_conditional_render_inverted on nv50</li> <li>GL_ARB_sample_shading on r600</li> <li>GL_ARB_texture_view on nv50, nvc0</li> -<li>GL_ARB_clip_control on llvmpipe, softpipe, r300, r600, radeonsi</li> +<li>GL_ARB_clip_control on nv50, nvc0, r300, r600, radeonsi, llvmpipe, softpipe</li> +<li>GL_KHR_context_flush_control on all drivers</li> </ul> diff --git a/mesalib/docs/relnotes/10.5.0.html b/mesalib/docs/relnotes/10.5.0.html new file mode 100644 index 000000000..84bfcdbdb --- /dev/null +++ b/mesalib/docs/relnotes/10.5.0.html @@ -0,0 +1,61 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html lang="en"> +<head> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <title>Mesa Release Notes</title> + <link rel="stylesheet" type="text/css" href="../mesa.css"> +</head> +<body> + +<div class="header"> + <h1>The Mesa 3D Graphics Library</h1> +</div> + +<iframe src="../contents.html"></iframe> +<div class="content"> + +<h1>Mesa 10.5.0 Release Notes / TBD</h1> + +<p> +Mesa 10.5.0 is a new development release. +People who are concerned with stability and reliability should stick +with a previous release or wait for Mesa 10.5.1. +</p> +<p> +Mesa 10.5.0 implements the OpenGL 3.3 API, but the version reported by +glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) / +glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 3.3. OpenGL +3.3 is <strong>only</strong> available if requested at context creation +because compatibility contexts are not supported. +</p> + + +<h2>MD5 checksums</h2> +<pre> +TBD. +</pre> + + +<h2>New features</h2> + +<p> +Note: some of the new features are only available with certain drivers. +</p> + +<ul> +</ul> + + +<h2>Bug fixes</h2> + +TBD. + +<h2>Changes</h2> + +<ul> +</ul> + +</div> +</body> +</html> diff --git a/mesalib/include/D3D9/d3d9.h b/mesalib/include/D3D9/d3d9.h new file mode 100644 index 000000000..f872be79b --- /dev/null +++ b/mesalib/include/D3D9/d3d9.h @@ -0,0 +1,1858 @@ +/* + * Copyright 2011 Joakim Sindholt <opensource@zhasha.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/*** THIS FILE IS AUTOGENERATED. DO NOT MODIFY MANUALLY. ***/ + +#ifndef _D3D9_H_ +#define _D3D9_H_ + +#include "d3d9types.h" +#include "d3d9caps.h" + +typedef struct IDirect3D9 IDirect3D9, *PDIRECT3D9, *LPDIRECT3D9; +typedef struct IDirect3D9Ex IDirect3D9Ex, *PDIRECT3D9EX, *LPDIRECT3D9EX; +typedef struct IDirect3D9ExOverlayExtension IDirect3D9ExOverlayExtension, *PDIRECT3D9EXOVERLAYEXTENSION, *LPDIRECT3D9EXOVERLAYEXTENSION; +typedef struct IDirect3DAuthenticatedChannel9 IDirect3DAuthenticatedChannel9, *PDIRECT3DAUTHENTICATEDCHANNEL9, *LPDIRECT3DAUTHENTICATEDCHANNEL9; +typedef struct IDirect3DBaseTexture9 IDirect3DBaseTexture9, *PDIRECT3DBASETEXTURE9, *LPDIRECT3DBASETEXTURE9; +typedef struct IDirect3DCryptoSession9 IDirect3DCryptoSession9, *PDIRECT3DCRYPTOSESSION9, *LPDIRECT3DCRYPTOSESSION9; +typedef struct IDirect3DCubeTexture9 IDirect3DCubeTexture9, *PDIRECT3DCUBETEXTURE9, *LPDIRECT3DCUBETEXTURE9; +typedef struct IDirect3DDevice9 IDirect3DDevice9, *PDIRECT3DDEVICE9, *LPDIRECT3DDEVICE9; +typedef struct IDirect3DDevice9Ex IDirect3DDevice9Ex, *PDIRECT3DDEVICE9EX, *LPDIRECT3DDEVICE9EX; +typedef struct IDirect3DDevice9Video IDirect3DDevice9Video, *PDIRECT3DDEVICE9VIDEO, *LPDIRECT3DDEVICE9VIDEO; +typedef struct IDirect3DIndexBuffer9 IDirect3DIndexBuffer9, *PDIRECT3DINDEXBUFFER9, *LPDIRECT3DINDEXBUFFER9; +typedef struct IDirect3DPixelShader9 IDirect3DPixelShader9, *PDIRECT3DPIXELSHADER9, *LPDIRECT3DPIXELSHADER9; +typedef struct IDirect3DQuery9 IDirect3DQuery9, *PDIRECT3DQUERY9, *LPDIRECT3DQUERY9; +typedef struct IDirect3DResource9 IDirect3DResource9, *PDIRECT3DRESOURCE9, *LPDIRECT3DRESOURCE9; +typedef struct IDirect3DStateBlock9 IDirect3DStateBlock9, *PDIRECT3DSTATEBLOCK9, *LPDIRECT3DSTATEBLOCK9; +typedef struct IDirect3DSurface9 IDirect3DSurface9, *PDIRECT3DSURFACE9, *LPDIRECT3DSURFACE9; +typedef struct IDirect3DSwapChain9 IDirect3DSwapChain9, *PDIRECT3DSWAPCHAIN9, *LPDIRECT3DSWAPCHAIN9; +typedef struct IDirect3DSwapChain9Ex IDirect3DSwapChain9Ex, *PDIRECT3DSWAPCHAIN9EX, *LPDIRECT3DSWAPCHAIN9EX; +typedef struct IDirect3DTexture9 IDirect3DTexture9, *PDIRECT3DTEXTURE9, *LPDIRECT3DTEXTURE9; +typedef struct IDirect3DVertexBuffer9 IDirect3DVertexBuffer9, *PDIRECT3DVERTEXBUFFER9, *LPDIRECT3DVERTEXBUFFER9; +typedef struct IDirect3DVertexDeclaration9 IDirect3DVertexDeclaration9, *PDIRECT3DVERTEXDECLARATION9, *LPDIRECT3DVERTEXDECLARATION9; +typedef struct IDirect3DVertexShader9 IDirect3DVertexShader9, *PDIRECT3DVERTEXSHADER9, *LPDIRECT3DVERTEXSHADER9; +typedef struct IDirect3DVolume9 IDirect3DVolume9, *PDIRECT3DVOLUME9, *LPDIRECT3DVOLUME9; +typedef struct IDirect3DVolumeTexture9 IDirect3DVolumeTexture9, *PDIRECT3DVOLUMETEXTURE9, *LPDIRECT3DVOLUMETEXTURE9; + +#ifdef __cplusplus + +extern "C" const GUID IID_IDirect3D9; +extern "C" const GUID IID_IDirect3D9Ex; +extern "C" const GUID IID_IDirect3D9ExOverlayExtension; +extern "C" const GUID IID_IDirect3DAuthenticatedChannel9; +extern "C" const GUID IID_IDirect3DBaseTexture9; +extern "C" const GUID IID_IDirect3DCryptoSession9; +extern "C" const GUID IID_IDirect3DCubeTexture9; +extern "C" const GUID IID_IDirect3DDevice9; +extern "C" const GUID IID_IDirect3DDevice9Ex; +extern "C" const GUID IID_IDirect3DDevice9Video; +extern "C" const GUID IID_IDirect3DIndexBuffer9; +extern "C" const GUID IID_IDirect3DPixelShader9; +extern "C" const GUID IID_IDirect3DQuery9; +extern "C" const GUID IID_IDirect3DResource9; +extern "C" const GUID IID_IDirect3DStateBlock9; +extern "C" const GUID IID_IDirect3DSurface9; +extern "C" const GUID IID_IDirect3DSwapChain9; +extern "C" const GUID IID_IDirect3DSwapChain9Ex; +extern "C" const GUID IID_IDirect3DTexture9; +extern "C" const GUID IID_IDirect3DVertexBuffer9; +extern "C" const GUID IID_IDirect3DVertexDeclaration9; +extern "C" const GUID IID_IDirect3DVertexShader9; +extern "C" const GUID IID_IDirect3DVolume9; +extern "C" const GUID IID_IDirect3DVolumeTexture9; + +struct IDirect3D9 : public IUnknown +{ + virtual HRESULT WINAPI RegisterSoftwareDevice(void *pInitializeFunction) = 0; + virtual UINT WINAPI GetAdapterCount() = 0; + virtual HRESULT WINAPI GetAdapterIdentifier(UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9 *pIdentifier) = 0; + virtual UINT WINAPI GetAdapterModeCount(UINT Adapter, D3DFORMAT Format) = 0; + virtual HRESULT WINAPI EnumAdapterModes(UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE *pMode) = 0; + virtual HRESULT WINAPI GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE *pMode) = 0; + virtual HRESULT WINAPI CheckDeviceType(UINT Adapter, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed) = 0; + virtual HRESULT WINAPI CheckDeviceFormat(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) = 0; + virtual HRESULT WINAPI CheckDeviceMultiSampleType(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD *pQualityLevels) = 0; + virtual HRESULT WINAPI CheckDepthStencilMatch(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) = 0; + virtual HRESULT WINAPI CheckDeviceFormatConversion(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) = 0; + virtual HRESULT WINAPI GetDeviceCaps(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9 *pCaps) = 0; + virtual HMONITOR WINAPI GetAdapterMonitor(UINT Adapter) = 0; + virtual HRESULT WINAPI CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DDevice9 **ppReturnedDeviceInterface) = 0; +}; + +struct IDirect3D9Ex : public IDirect3D9 +{ + virtual UINT WINAPI GetAdapterModeCountEx(UINT Adapter, const D3DDISPLAYMODEFILTER *pFilter) = 0; + virtual HRESULT WINAPI EnumAdapterModesEx(UINT Adapter, const D3DDISPLAYMODEFILTER *pFilter, UINT Mode, D3DDISPLAYMODEEX *pMode) = 0; + virtual HRESULT WINAPI GetAdapterDisplayModeEx(UINT Adapter, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation) = 0; + virtual HRESULT WINAPI CreateDeviceEx(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode, IDirect3DDevice9Ex **ppReturnedDeviceInterface) = 0; + virtual HRESULT WINAPI GetAdapterLUID(UINT Adapter, LUID *pLUID) = 0; +}; + +struct IDirect3D9ExOverlayExtension : public IUnknown +{ + virtual HRESULT WINAPI CheckDeviceOverlayType(UINT Adapter, D3DDEVTYPE DevType, UINT OverlayWidth, UINT OverlayHeight, D3DFORMAT OverlayFormat, D3DDISPLAYMODEEX *pDisplayMode, D3DDISPLAYROTATION DisplayRotation, D3DOVERLAYCAPS *pOverlayCaps) = 0; +}; + +struct IDirect3DResource9 : public IUnknown +{ + virtual HRESULT WINAPI GetDevice(IDirect3DDevice9 **ppDevice) = 0; + virtual HRESULT WINAPI SetPrivateData(REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags) = 0; + virtual HRESULT WINAPI GetPrivateData(REFGUID refguid, void *pData, DWORD *pSizeOfData) = 0; + virtual HRESULT WINAPI FreePrivateData(REFGUID refguid) = 0; + virtual DWORD WINAPI SetPriority(DWORD PriorityNew) = 0; + virtual DWORD WINAPI GetPriority() = 0; + virtual void WINAPI PreLoad() = 0; + virtual D3DRESOURCETYPE WINAPI GetType() = 0; +}; + +struct IDirect3DBaseTexture9 : public IDirect3DResource9 +{ + virtual DWORD WINAPI SetLOD(DWORD LODNew) = 0; + virtual DWORD WINAPI GetLOD() = 0; + virtual DWORD WINAPI GetLevelCount() = 0; + virtual HRESULT WINAPI SetAutoGenFilterType(D3DTEXTUREFILTERTYPE FilterType) = 0; + virtual D3DTEXTUREFILTERTYPE WINAPI GetAutoGenFilterType() = 0; + virtual void WINAPI GenerateMipSubLevels() = 0; +}; + +struct IDirect3DCryptoSession9 : public IUnknown +{ + virtual HRESULT WINAPI GetCertificateSize(UINT *pCertificateSize) = 0; + virtual HRESULT WINAPI GetCertificate(UINT CertifacteSize, BYTE *ppCertificate) = 0; + virtual HRESULT WINAPI NegotiateKeyExchange(UINT DataSize, void *pData) = 0; + virtual HRESULT WINAPI EncryptionBlt(IDirect3DSurface9 *pSrcSurface, IDirect3DSurface9 *pDstSurface, UINT DstSurfaceSize, void *pIV) = 0; + virtual HRESULT WINAPI DecryptionBlt(IDirect3DSurface9 *pSrcSurface, IDirect3DSurface9 *pDstSurface, UINT SrcSurfaceSize, D3DENCRYPTED_BLOCK_INFO *pEncryptedBlockInfo, void *pContentKey, void *pIV) = 0; + virtual HRESULT WINAPI GetSurfacePitch(IDirect3DSurface9 *pSrcSurface, UINT *pSurfacePitch) = 0; + virtual HRESULT WINAPI StartSessionKeyRefresh(void *pRandomNumber, UINT RandomNumberSize) = 0; + virtual HRESULT WINAPI FinishSessionKeyRefresh() = 0; + virtual HRESULT WINAPI GetEncryptionBltKey(void *pReadbackKey, UINT KeySize) = 0; +}; + +struct IDirect3DCubeTexture9 : public IDirect3DBaseTexture9 +{ + virtual HRESULT WINAPI GetLevelDesc(UINT Level, D3DSURFACE_DESC *pDesc) = 0; + virtual HRESULT WINAPI GetCubeMapSurface(D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9 **ppCubeMapSurface) = 0; + virtual HRESULT WINAPI LockRect(D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags) = 0; + virtual HRESULT WINAPI UnlockRect(D3DCUBEMAP_FACES FaceType, UINT Level) = 0; + virtual HRESULT WINAPI AddDirtyRect(D3DCUBEMAP_FACES FaceType, const RECT *pDirtyRect) = 0; +}; + +struct IDirect3DDevice9 : public IUnknown +{ + virtual HRESULT WINAPI TestCooperativeLevel() = 0; + virtual UINT WINAPI GetAvailableTextureMem() = 0; + virtual HRESULT WINAPI EvictManagedResources() = 0; + virtual HRESULT WINAPI GetDirect3D(IDirect3D9 **ppD3D9) = 0; + virtual HRESULT WINAPI GetDeviceCaps(D3DCAPS9 *pCaps) = 0; + virtual HRESULT WINAPI GetDisplayMode(UINT iSwapChain, D3DDISPLAYMODE *pMode) = 0; + virtual HRESULT WINAPI GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters) = 0; + virtual HRESULT WINAPI SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9 *pCursorBitmap) = 0; + virtual void WINAPI SetCursorPosition(int X, int Y, DWORD Flags) = 0; + virtual BOOL WINAPI ShowCursor(BOOL bShow) = 0; + virtual HRESULT WINAPI CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DSwapChain9 **pSwapChain) = 0; + virtual HRESULT WINAPI GetSwapChain(UINT iSwapChain, IDirect3DSwapChain9 **pSwapChain) = 0; + virtual UINT WINAPI GetNumberOfSwapChains() = 0; + virtual HRESULT WINAPI Reset(D3DPRESENT_PARAMETERS *pPresentationParameters) = 0; + virtual HRESULT WINAPI Present(const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion) = 0; + virtual HRESULT WINAPI GetBackBuffer(UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer) = 0; + virtual HRESULT WINAPI GetRasterStatus(UINT iSwapChain, D3DRASTER_STATUS *pRasterStatus) = 0; + virtual HRESULT WINAPI SetDialogBoxMode(BOOL bEnableDialogs) = 0; + virtual void WINAPI SetGammaRamp(UINT iSwapChain, DWORD Flags, const D3DGAMMARAMP *pRamp) = 0; + virtual void WINAPI GetGammaRamp(UINT iSwapChain, D3DGAMMARAMP *pRamp) = 0; + virtual HRESULT WINAPI CreateTexture(UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9 **ppTexture, HANDLE *pSharedHandle) = 0; + virtual HRESULT WINAPI CreateVolumeTexture(UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9 **ppVolumeTexture, HANDLE *pSharedHandle) = 0; + virtual HRESULT WINAPI CreateCubeTexture(UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9 **ppCubeTexture, HANDLE *pSharedHandle) = 0; + virtual HRESULT WINAPI CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9 **ppVertexBuffer, HANDLE *pSharedHandle) = 0; + virtual HRESULT WINAPI CreateIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9 **ppIndexBuffer, HANDLE *pSharedHandle) = 0; + virtual HRESULT WINAPI CreateRenderTarget(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle) = 0; + virtual HRESULT WINAPI CreateDepthStencilSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle) = 0; + virtual HRESULT WINAPI UpdateSurface(IDirect3DSurface9 *pSourceSurface, const RECT *pSourceRect, IDirect3DSurface9 *pDestinationSurface, const POINT *pDestPoint) = 0; + virtual HRESULT WINAPI UpdateTexture(IDirect3DBaseTexture9 *pSourceTexture, IDirect3DBaseTexture9 *pDestinationTexture) = 0; + virtual HRESULT WINAPI GetRenderTargetData(IDirect3DSurface9 *pRenderTarget, IDirect3DSurface9 *pDestSurface) = 0; + virtual HRESULT WINAPI GetFrontBufferData(UINT iSwapChain, IDirect3DSurface9 *pDestSurface) = 0; + virtual HRESULT WINAPI StretchRect(IDirect3DSurface9 *pSourceSurface, const RECT *pSourceRect, IDirect3DSurface9 *pDestSurface, const RECT *pDestRect, D3DTEXTUREFILTERTYPE Filter) = 0; + virtual HRESULT WINAPI ColorFill(IDirect3DSurface9 *pSurface, const RECT *pRect, D3DCOLOR color) = 0; + virtual HRESULT WINAPI CreateOffscreenPlainSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle) = 0; + virtual HRESULT WINAPI SetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9 *pRenderTarget) = 0; + virtual HRESULT WINAPI GetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9 **ppRenderTarget) = 0; + virtual HRESULT WINAPI SetDepthStencilSurface(IDirect3DSurface9 *pNewZStencil) = 0; + virtual HRESULT WINAPI GetDepthStencilSurface(IDirect3DSurface9 **ppZStencilSurface) = 0; + virtual HRESULT WINAPI BeginScene() = 0; + virtual HRESULT WINAPI EndScene() = 0; + virtual HRESULT WINAPI Clear(DWORD Count, const D3DRECT *pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) = 0; + virtual HRESULT WINAPI SetTransform(D3DTRANSFORMSTATETYPE State, const D3DMATRIX *pMatrix) = 0; + virtual HRESULT WINAPI GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX *pMatrix) = 0; + virtual HRESULT WINAPI MultiplyTransform(D3DTRANSFORMSTATETYPE State, const D3DMATRIX *pMatrix) = 0; + virtual HRESULT WINAPI SetViewport(const D3DVIEWPORT9 *pViewport) = 0; + virtual HRESULT WINAPI GetViewport(D3DVIEWPORT9 *pViewport) = 0; + virtual HRESULT WINAPI SetMaterial(const D3DMATERIAL9 *pMaterial) = 0; + virtual HRESULT WINAPI GetMaterial(D3DMATERIAL9 *pMaterial) = 0; + virtual HRESULT WINAPI SetLight(DWORD Index, const D3DLIGHT9 *pLight) = 0; + virtual HRESULT WINAPI GetLight(DWORD Index, D3DLIGHT9 *pLight) = 0; + virtual HRESULT WINAPI LightEnable(DWORD Index, BOOL Enable) = 0; + virtual HRESULT WINAPI GetLightEnable(DWORD Index, BOOL *pEnable) = 0; + virtual HRESULT WINAPI SetClipPlane(DWORD Index, const float *pPlane) = 0; + virtual HRESULT WINAPI GetClipPlane(DWORD Index, float *pPlane) = 0; + virtual HRESULT WINAPI SetRenderState(D3DRENDERSTATETYPE State, DWORD Value) = 0; + virtual HRESULT WINAPI GetRenderState(D3DRENDERSTATETYPE State, DWORD *pValue) = 0; + virtual HRESULT WINAPI CreateStateBlock(D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9 **ppSB) = 0; + virtual HRESULT WINAPI BeginStateBlock() = 0; + virtual HRESULT WINAPI EndStateBlock(IDirect3DStateBlock9 **ppSB) = 0; + virtual HRESULT WINAPI SetClipStatus(const D3DCLIPSTATUS9 *pClipStatus) = 0; + virtual HRESULT WINAPI GetClipStatus(D3DCLIPSTATUS9 *pClipStatus) = 0; + virtual HRESULT WINAPI GetTexture(DWORD Stage, IDirect3DBaseTexture9 **ppTexture) = 0; + virtual HRESULT WINAPI SetTexture(DWORD Stage, IDirect3DBaseTexture9 *pTexture) = 0; + virtual HRESULT WINAPI GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *pValue) = 0; + virtual HRESULT WINAPI SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) = 0; + virtual HRESULT WINAPI GetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD *pValue) = 0; + virtual HRESULT WINAPI SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) = 0; + virtual HRESULT WINAPI ValidateDevice(DWORD *pNumPasses) = 0; + virtual HRESULT WINAPI SetPaletteEntries(UINT PaletteNumber, const PALETTEENTRY *pEntries) = 0; + virtual HRESULT WINAPI GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY *pEntries) = 0; + virtual HRESULT WINAPI SetCurrentTexturePalette(UINT PaletteNumber) = 0; + virtual HRESULT WINAPI GetCurrentTexturePalette(UINT *PaletteNumber) = 0; + virtual HRESULT WINAPI SetScissorRect(const RECT *pRect) = 0; + virtual HRESULT WINAPI GetScissorRect(RECT *pRect) = 0; + virtual HRESULT WINAPI SetSoftwareVertexProcessing(BOOL bSoftware) = 0; + virtual BOOL WINAPI GetSoftwareVertexProcessing() = 0; + virtual HRESULT WINAPI SetNPatchMode(float nSegments) = 0; + virtual float WINAPI GetNPatchMode() = 0; + virtual HRESULT WINAPI DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) = 0; + virtual HRESULT WINAPI DrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount) = 0; + virtual HRESULT WINAPI DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, const void *pVertexStreamZeroData, UINT VertexStreamZeroStride) = 0; + virtual HRESULT WINAPI DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, const void *pIndexData, D3DFORMAT IndexDataFormat, const void *pVertexStreamZeroData, UINT VertexStreamZeroStride) = 0; + virtual HRESULT WINAPI ProcessVertices(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9 *pDestBuffer, IDirect3DVertexDeclaration9 *pVertexDecl, DWORD Flags) = 0; + virtual HRESULT WINAPI CreateVertexDeclaration(const D3DVERTEXELEMENT9 *pVertexElements, IDirect3DVertexDeclaration9 **ppDecl) = 0; + virtual HRESULT WINAPI SetVertexDeclaration(IDirect3DVertexDeclaration9 *pDecl) = 0; + virtual HRESULT WINAPI GetVertexDeclaration(IDirect3DVertexDeclaration9 **ppDecl) = 0; + virtual HRESULT WINAPI SetFVF(DWORD FVF) = 0; + virtual HRESULT WINAPI GetFVF(DWORD *pFVF) = 0; + virtual HRESULT WINAPI CreateVertexShader(const DWORD *pFunction, IDirect3DVertexShader9 **ppShader) = 0; + virtual HRESULT WINAPI SetVertexShader(IDirect3DVertexShader9 *pShader) = 0; + virtual HRESULT WINAPI GetVertexShader(IDirect3DVertexShader9 **ppShader) = 0; + virtual HRESULT WINAPI SetVertexShaderConstantF(UINT StartRegister, const float *pConstantData, UINT Vector4fCount) = 0; + virtual HRESULT WINAPI GetVertexShaderConstantF(UINT StartRegister, float *pConstantData, UINT Vector4fCount) = 0; + virtual HRESULT WINAPI SetVertexShaderConstantI(UINT StartRegister, const int *pConstantData, UINT Vector4iCount) = 0; + virtual HRESULT WINAPI GetVertexShaderConstantI(UINT StartRegister, int *pConstantData, UINT Vector4iCount) = 0; + virtual HRESULT WINAPI SetVertexShaderConstantB(UINT StartRegister, const BOOL *pConstantData, UINT BoolCount) = 0; + virtual HRESULT WINAPI GetVertexShaderConstantB(UINT StartRegister, BOOL *pConstantData, UINT BoolCount) = 0; + virtual HRESULT WINAPI SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9 *pStreamData, UINT OffsetInBytes, UINT Stride) = 0; + virtual HRESULT WINAPI GetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9 **ppStreamData, UINT *pOffsetInBytes, UINT *pStride) = 0; + virtual HRESULT WINAPI SetStreamSourceFreq(UINT StreamNumber, UINT Setting) = 0; + virtual HRESULT WINAPI GetStreamSourceFreq(UINT StreamNumber, UINT *pSetting) = 0; + virtual HRESULT WINAPI SetIndices(IDirect3DIndexBuffer9 *pIndexData) = 0; + virtual HRESULT WINAPI GetIndices(IDirect3DIndexBuffer9 **ppIndexData, UINT *pBaseVertexIndex) = 0; + virtual HRESULT WINAPI CreatePixelShader(const DWORD *pFunction, IDirect3DPixelShader9 **ppShader) = 0; + virtual HRESULT WINAPI SetPixelShader(IDirect3DPixelShader9 *pShader) = 0; + virtual HRESULT WINAPI GetPixelShader(IDirect3DPixelShader9 **ppShader) = 0; + virtual HRESULT WINAPI SetPixelShaderConstantF(UINT StartRegister, const float *pConstantData, UINT Vector4fCount) = 0; + virtual HRESULT WINAPI GetPixelShaderConstantF(UINT StartRegister, float *pConstantData, UINT Vector4fCount) = 0; + virtual HRESULT WINAPI SetPixelShaderConstantI(UINT StartRegister, const int *pConstantData, UINT Vector4iCount) = 0; + virtual HRESULT WINAPI GetPixelShaderConstantI(UINT StartRegister, int *pConstantData, UINT Vector4iCount) = 0; + virtual HRESULT WINAPI SetPixelShaderConstantB(UINT StartRegister, const BOOL *pConstantData, UINT BoolCount) = 0; + virtual HRESULT WINAPI GetPixelShaderConstantB(UINT StartRegister, BOOL *pConstantData, UINT BoolCount) = 0; + virtual HRESULT WINAPI DrawRectPatch(UINT Handle, const float *pNumSegs, const D3DRECTPATCH_INFO *pRectPatchInfo) = 0; + virtual HRESULT WINAPI DrawTriPatch(UINT Handle, const float *pNumSegs, const D3DTRIPATCH_INFO *pTriPatchInfo) = 0; + virtual HRESULT WINAPI DeletePatch(UINT Handle) = 0; + virtual HRESULT WINAPI CreateQuery(D3DQUERYTYPE Type, IDirect3DQuery9 **ppQuery) = 0; +}; + +struct IDirect3DDevice9Ex : public IDirect3DDevice9 +{ + virtual HRESULT WINAPI SetConvolutionMonoKernel(UINT width, UINT height, float *rows, float *columns) = 0; + virtual HRESULT WINAPI ComposeRects(IDirect3DSurface9 *pSrc, IDirect3DSurface9 *pDst, IDirect3DVertexBuffer9 *pSrcRectDescs, UINT NumRects, IDirect3DVertexBuffer9 *pDstRectDescs, D3DCOMPOSERECTSOP Operation, int Xoffset, int Yoffset) = 0; + virtual HRESULT WINAPI PresentEx(const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion, DWORD dwFlags) = 0; + virtual HRESULT WINAPI GetGPUThreadPriority(INT *pPriority) = 0; + virtual HRESULT WINAPI SetGPUThreadPriority(INT Priority) = 0; + virtual HRESULT WINAPI WaitForVBlank(UINT iSwapChain) = 0; + virtual HRESULT WINAPI CheckResourceResidency(IDirect3DResource9 **pResourceArray, UINT32 NumResources) = 0; + virtual HRESULT WINAPI SetMaximumFrameLatency(UINT MaxLatency) = 0; + virtual HRESULT WINAPI GetMaximumFrameLatency(UINT *pMaxLatency) = 0; + virtual HRESULT WINAPI CheckDeviceState(HWND hDestinationWindow) = 0; + virtual HRESULT WINAPI CreateRenderTargetEx(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle, DWORD Usage) = 0; + virtual HRESULT WINAPI CreateOffscreenPlainSurfaceEx(UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle, DWORD Usage) = 0; + virtual HRESULT WINAPI CreateDepthStencilSurfaceEx(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle, DWORD Usage) = 0; + virtual HRESULT WINAPI ResetEx(D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode) = 0; + virtual HRESULT WINAPI GetDisplayModeEx(UINT iSwapChain, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation) = 0; +}; + +struct IDirect3DDevice9Video : public IUnknown +{ + virtual HRESULT WINAPI GetContentProtectionCaps(const GUID *pCryptoType, const GUID *pDecodeProfile, D3DCONTENTPROTECTIONCAPS *pCaps) = 0; + virtual HRESULT WINAPI CreateAuthenticatedChannel(D3DAUTHENTICATEDCHANNELTYPE ChannelType, IDirect3DAuthenticatedChannel9 **ppAuthenticatedChannel, HANDLE *pChannelHandle) = 0; + virtual HRESULT WINAPI CreateCryptoSession(const GUID *pCryptoType, const GUID *pDecodeProfile, IDirect3DCryptoSession9 **ppCryptoSession, HANDLE *pCryptoHandle) = 0; +}; + +struct IDirect3DIndexBuffer9 : public IDirect3DResource9 +{ + virtual HRESULT WINAPI Lock(UINT OffsetToLock, UINT SizeToLock, void **ppbData, DWORD Flags) = 0; + virtual HRESULT WINAPI Unlock() = 0; + virtual HRESULT WINAPI GetDesc(D3DINDEXBUFFER_DESC *pDesc) = 0; +}; + +struct IDirect3DPixelShader9 : public IUnknown +{ + virtual HRESULT WINAPI GetDevice(IDirect3DDevice9 **ppDevice) = 0; + virtual HRESULT WINAPI GetFunction(void *pData, UINT *pSizeOfData) = 0; +}; + +struct IDirect3DQuery9 : public IUnknown +{ + virtual HRESULT WINAPI GetDevice(IDirect3DDevice9 **ppDevice) = 0; + virtual D3DQUERYTYPE WINAPI GetType() = 0; + virtual DWORD WINAPI GetDataSize() = 0; + virtual HRESULT WINAPI Issue(DWORD dwIssueFlags) = 0; + virtual HRESULT WINAPI GetData(void *pData, DWORD dwSize, DWORD dwGetDataFlags) = 0; +}; + +struct IDirect3DStateBlock9 : public IUnknown +{ + virtual HRESULT WINAPI GetDevice(IDirect3DDevice9 **ppDevice) = 0; + virtual HRESULT WINAPI Capture() = 0; + virtual HRESULT WINAPI Apply() = 0; +}; + +struct IDirect3DSurface9 : public IDirect3DResource9 +{ + virtual HRESULT WINAPI GetContainer(REFIID riid, void **ppContainer) = 0; + virtual HRESULT WINAPI GetDesc(D3DSURFACE_DESC *pDesc) = 0; + virtual HRESULT WINAPI LockRect(D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags) = 0; + virtual HRESULT WINAPI UnlockRect() = 0; + virtual HRESULT WINAPI GetDC(HDC *phdc) = 0; + virtual HRESULT WINAPI ReleaseDC(HDC hdc) = 0; +}; + +struct IDirect3DSwapChain9 : public IUnknown +{ + virtual HRESULT WINAPI Present(const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion, DWORD dwFlags) = 0; + virtual HRESULT WINAPI GetFrontBufferData(IDirect3DSurface9 *pDestSurface) = 0; + virtual HRESULT WINAPI GetBackBuffer(UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer) = 0; + virtual HRESULT WINAPI GetRasterStatus(D3DRASTER_STATUS *pRasterStatus) = 0; + virtual HRESULT WINAPI GetDisplayMode(D3DDISPLAYMODE *pMode) = 0; + virtual HRESULT WINAPI GetDevice(IDirect3DDevice9 **ppDevice) = 0; + virtual HRESULT WINAPI GetPresentParameters(D3DPRESENT_PARAMETERS *pPresentationParameters) = 0; +}; + +struct IDirect3DSwapChain9Ex : public IDirect3DSwapChain9 +{ + virtual HRESULT WINAPI GetLastPresentCount(UINT *pLastPresentCount) = 0; + virtual HRESULT WINAPI GetPresentStats(D3DPRESENTSTATS *pPresentationStatistics) = 0; + virtual HRESULT WINAPI GetDisplayModeEx(D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation) = 0; +}; + +struct IDirect3DTexture9 : public IDirect3DBaseTexture9 +{ + virtual HRESULT WINAPI GetLevelDesc(UINT Level, D3DSURFACE_DESC *pDesc) = 0; + virtual HRESULT WINAPI GetSurfaceLevel(UINT Level, IDirect3DSurface9 **ppSurfaceLevel) = 0; + virtual HRESULT WINAPI LockRect(UINT Level, D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags) = 0; + virtual HRESULT WINAPI UnlockRect(UINT Level) = 0; + virtual HRESULT WINAPI AddDirtyRect(const RECT *pDirtyRect) = 0; +}; + +struct IDirect3DVertexBuffer9 : public IDirect3DResource9 +{ + virtual HRESULT WINAPI Lock(UINT OffsetToLock, UINT SizeToLock, void **ppbData, DWORD Flags) = 0; + virtual HRESULT WINAPI Unlock() = 0; + virtual HRESULT WINAPI GetDesc(D3DVERTEXBUFFER_DESC *pDesc) = 0; +}; + +struct IDirect3DVertexDeclaration9 : public IUnknown +{ + virtual HRESULT WINAPI GetDevice(IDirect3DDevice9 **ppDevice) = 0; + virtual HRESULT WINAPI GetDeclaration(D3DVERTEXELEMENT9 *pElement, UINT *pNumElements) = 0; +}; + +struct IDirect3DVertexShader9 : public IUnknown +{ + virtual HRESULT WINAPI GetDevice(IDirect3DDevice9 **ppDevice) = 0; + virtual HRESULT WINAPI GetFunction(void *pData, UINT *pSizeOfData) = 0; +}; + +struct IDirect3DVolume9 : public IUnknown +{ + virtual HRESULT WINAPI GetDevice(IDirect3DDevice9 **ppDevice) = 0; + virtual HRESULT WINAPI SetPrivateData(REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags) = 0; + virtual HRESULT WINAPI GetPrivateData(REFGUID refguid, void *pData, DWORD *pSizeOfData) = 0; + virtual HRESULT WINAPI FreePrivateData(REFGUID refguid) = 0; + virtual HRESULT WINAPI GetContainer(REFIID riid, void **ppContainer) = 0; + virtual HRESULT WINAPI GetDesc(D3DVOLUME_DESC *pDesc) = 0; + virtual HRESULT WINAPI LockBox(D3DLOCKED_BOX *pLockedVolume, const D3DBOX *pBox, DWORD Flags) = 0; + virtual HRESULT WINAPI UnlockBox() = 0; +}; + +#else /* __cplusplus */ + +extern const GUID IID_IDirect3D9; +extern const GUID IID_IDirect3D9Ex; +extern const GUID IID_IDirect3D9ExOverlayExtension; +extern const GUID IID_IDirect3DAuthenticatedChannel9; +extern const GUID IID_IDirect3DBaseTexture9; +extern const GUID IID_IDirect3DCryptoSession9; +extern const GUID IID_IDirect3DCubeTexture9; +extern const GUID IID_IDirect3DDevice9; +extern const GUID IID_IDirect3DDevice9Ex; +extern const GUID IID_IDirect3DDevice9Video; +extern const GUID IID_IDirect3DIndexBuffer9; +extern const GUID IID_IDirect3DPixelShader9; +extern const GUID IID_IDirect3DQuery9; +extern const GUID IID_IDirect3DResource9; +extern const GUID IID_IDirect3DStateBlock9; +extern const GUID IID_IDirect3DSurface9; +extern const GUID IID_IDirect3DSwapChain9; +extern const GUID IID_IDirect3DSwapChain9Ex; +extern const GUID IID_IDirect3DTexture9; +extern const GUID IID_IDirect3DVertexBuffer9; +extern const GUID IID_IDirect3DVertexDeclaration9; +extern const GUID IID_IDirect3DVertexShader9; +extern const GUID IID_IDirect3DVolume9; +extern const GUID IID_IDirect3DVolumeTexture9; + +typedef struct IDirect3D9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3D9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3D9 *This); + ULONG (WINAPI *Release)(IDirect3D9 *This); + /* IDirect3D9 */ + HRESULT (WINAPI *RegisterSoftwareDevice)(IDirect3D9 *This, void *pInitializeFunction); + UINT (WINAPI *GetAdapterCount)(IDirect3D9 *This); + HRESULT (WINAPI *GetAdapterIdentifier)(IDirect3D9 *This, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9 *pIdentifier); + UINT (WINAPI *GetAdapterModeCount)(IDirect3D9 *This, UINT Adapter, D3DFORMAT Format); + HRESULT (WINAPI *EnumAdapterModes)(IDirect3D9 *This, UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE *pMode); + HRESULT (WINAPI *GetAdapterDisplayMode)(IDirect3D9 *This, UINT Adapter, D3DDISPLAYMODE *pMode); + HRESULT (WINAPI *CheckDeviceType)(IDirect3D9 *This, UINT Adapter, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed); + HRESULT (WINAPI *CheckDeviceFormat)(IDirect3D9 *This, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat); + HRESULT (WINAPI *CheckDeviceMultiSampleType)(IDirect3D9 *This, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD *pQualityLevels); + HRESULT (WINAPI *CheckDepthStencilMatch)(IDirect3D9 *This, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat); + HRESULT (WINAPI *CheckDeviceFormatConversion)(IDirect3D9 *This, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat); + HRESULT (WINAPI *GetDeviceCaps)(IDirect3D9 *This, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9 *pCaps); + HMONITOR (WINAPI *GetAdapterMonitor)(IDirect3D9 *This, UINT Adapter); + HRESULT (WINAPI *CreateDevice)(IDirect3D9 *This, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DDevice9 **ppReturnedDeviceInterface); +} IDirect3D9Vtbl; +struct IDirect3D9 +{ + IDirect3D9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3D9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3D9 macros */ +#define IDirect3D9_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a) +#define IDirect3D9_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) +#define IDirect3D9_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) +#define IDirect3D9_GetAdapterModeCount(p,a,b) (p)->lpVtbl->GetAdapterModeCount(p,a,b) +#define IDirect3D9_EnumAdapterModes(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModes(p,a,b,c,d) +#define IDirect3D9_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) +#define IDirect3D9_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) +#define IDirect3D9_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e,f) +#define IDirect3D9_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d) +#define IDirect3D9_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) +#define IDirect3D9_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) +#define IDirect3D9_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) + +typedef struct IDirect3D9ExVtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3D9Ex *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3D9Ex *This); + ULONG (WINAPI *Release)(IDirect3D9Ex *This); + /* IDirect3D9 */ + HRESULT (WINAPI *RegisterSoftwareDevice)(IDirect3D9Ex *This, void *pInitializeFunction); + UINT (WINAPI *GetAdapterCount)(IDirect3D9Ex *This); + HRESULT (WINAPI *GetAdapterIdentifier)(IDirect3D9Ex *This, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9 *pIdentifier); + UINT (WINAPI *GetAdapterModeCount)(IDirect3D9Ex *This, UINT Adapter, D3DFORMAT Format); + HRESULT (WINAPI *EnumAdapterModes)(IDirect3D9Ex *This, UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE *pMode); + HRESULT (WINAPI *GetAdapterDisplayMode)(IDirect3D9Ex *This, UINT Adapter, D3DDISPLAYMODE *pMode); + HRESULT (WINAPI *CheckDeviceType)(IDirect3D9Ex *This, UINT Adapter, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed); + HRESULT (WINAPI *CheckDeviceFormat)(IDirect3D9Ex *This, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat); + HRESULT (WINAPI *CheckDeviceMultiSampleType)(IDirect3D9Ex *This, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD *pQualityLevels); + HRESULT (WINAPI *CheckDepthStencilMatch)(IDirect3D9Ex *This, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat); + HRESULT (WINAPI *CheckDeviceFormatConversion)(IDirect3D9Ex *This, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat); + HRESULT (WINAPI *GetDeviceCaps)(IDirect3D9Ex *This, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9 *pCaps); + HMONITOR (WINAPI *GetAdapterMonitor)(IDirect3D9Ex *This, UINT Adapter); + HRESULT (WINAPI *CreateDevice)(IDirect3D9Ex *This, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DDevice9 **ppReturnedDeviceInterface); + /* IDirect3D9Ex */ + UINT (WINAPI *GetAdapterModeCountEx)(IDirect3D9Ex *This, UINT Adapter, const D3DDISPLAYMODEFILTER *pFilter); + HRESULT (WINAPI *EnumAdapterModesEx)(IDirect3D9Ex *This, UINT Adapter, const D3DDISPLAYMODEFILTER *pFilter, UINT Mode, D3DDISPLAYMODEEX *pMode); + HRESULT (WINAPI *GetAdapterDisplayModeEx)(IDirect3D9Ex *This, UINT Adapter, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation); + HRESULT (WINAPI *CreateDeviceEx)(IDirect3D9Ex *This, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode, IDirect3DDevice9Ex **ppReturnedDeviceInterface); + HRESULT (WINAPI *GetAdapterLUID)(IDirect3D9Ex *This, UINT Adapter, LUID *pLUID); +} IDirect3D9ExVtbl; +struct IDirect3D9Ex +{ + IDirect3D9ExVtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3D9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D9Ex_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D9Ex_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3D9 macros */ +#define IDirect3D9Ex_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a) +#define IDirect3D9Ex_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) +#define IDirect3D9Ex_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) +#define IDirect3D9Ex_GetAdapterModeCount(p,a,b) (p)->lpVtbl->GetAdapterModeCount(p,a,b) +#define IDirect3D9Ex_EnumAdapterModes(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModes(p,a,b,c,d) +#define IDirect3D9Ex_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) +#define IDirect3D9Ex_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) +#define IDirect3D9Ex_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) +#define IDirect3D9Ex_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e,f) +#define IDirect3D9Ex_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) +#define IDirect3D9Ex_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d) +#define IDirect3D9Ex_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) +#define IDirect3D9Ex_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) +#define IDirect3D9Ex_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) +/* IDirect3D9Ex macros */ +#define IDirect3D9Ex_GetAdapterModeCountEx(p,a,b) (p)->lpVtbl->GetAdapterModeCountEx(p,a,b) +#define IDirect3D9Ex_EnumAdapterModesEx(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModesEx(p,a,b,c,d) +#define IDirect3D9Ex_GetAdapterDisplayModeEx(p,a,b,c) (p)->lpVtbl->GetAdapterDisplayModeEx(p,a,b,c) +#define IDirect3D9Ex_CreateDeviceEx(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d,e,f,g) +#define IDirect3D9Ex_GetAdapterLUID(p,a,b) (p)->lpVtbl->GetAdapterLUID(p,a,b) + +typedef struct IDirect3D9ExOverlayExtensionVtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3D9ExOverlayExtension *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3D9ExOverlayExtension *This); + ULONG (WINAPI *Release)(IDirect3D9ExOverlayExtension *This); + /* IDirect3D9ExOverlayExtension */ + HRESULT (WINAPI *CheckDeviceOverlayType)(IDirect3D9ExOverlayExtension *This, UINT Adapter, D3DDEVTYPE DevType, UINT OverlayWidth, UINT OverlayHeight, D3DFORMAT OverlayFormat, D3DDISPLAYMODEEX *pDisplayMode, D3DDISPLAYROTATION DisplayRotation, D3DOVERLAYCAPS *pOverlayCaps); +} IDirect3D9ExOverlayExtensionVtbl; +struct IDirect3D9ExOverlayExtension +{ + IDirect3D9ExOverlayExtensionVtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3D9ExOverlayExtension_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D9ExOverlayExtension_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D9ExOverlayExtension_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3D9ExOverlayExtension macros */ +#define IDirect3D9ExOverlayExtension_CheckDeviceOverlayType(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CheckDeviceOverlayType(p,a,b,c,d,e,f,g,h) + +typedef struct IDirect3DAuthenticatedChannel9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DAuthenticatedChannel9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DAuthenticatedChannel9 *This); + ULONG (WINAPI *Release)(IDirect3DAuthenticatedChannel9 *This); + /* IDirect3DAuthenticatedChannel9 */ + HRESULT (WINAPI *GetCertificateSize)(IDirect3DAuthenticatedChannel9 *This, UINT *pCertificateSize); + HRESULT (WINAPI *GetCertificate)(IDirect3DAuthenticatedChannel9 *This, UINT CertifacteSize, BYTE *ppCertificate); + HRESULT (WINAPI *NegotiateKeyExchange)(IDirect3DAuthenticatedChannel9 *This, UINT DataSize, void *pData); + HRESULT (WINAPI *Query)(IDirect3DAuthenticatedChannel9 *This, UINT InputSize, const void *pInput, UINT OutputSize, void *pOutput); + HRESULT (WINAPI *Configure)(IDirect3DAuthenticatedChannel9 *This, UINT InputSize, const void *pInput, D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT *pOutput); +} IDirect3DAuthenticatedChannel9Vtbl; +struct IDirect3DAuthenticatedChannel9 +{ + IDirect3DAuthenticatedChannel9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DAuthenticatedChannel9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DAuthenticatedChannel9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DAuthenticatedChannel9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DAuthenticatedChannel9 macros */ +#define IDirect3DAuthenticatedChannel9_GetCertificateSize(p,a) (p)->lpVtbl->GetCertificateSize(p,a) +#define IDirect3DAuthenticatedChannel9_GetCertificate(p,a,b) (p)->lpVtbl->GetCertificate(p,a,b) +#define IDirect3DAuthenticatedChannel9_NegotiateKeyExchange(p,a,b) (p)->lpVtbl->NegotiateKeyExchange(p,a,b) +#define IDirect3DAuthenticatedChannel9_Query(p,a,b,c,d) (p)->lpVtbl->Query(p,a,b,c,d) +#define IDirect3DAuthenticatedChannel9_Configure(p,a,b,c) (p)->lpVtbl->Configure(p,a,b,c) + +typedef struct IDirect3DBaseTexture9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DBaseTexture9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DBaseTexture9 *This); + ULONG (WINAPI *Release)(IDirect3DBaseTexture9 *This); + /* IDirect3DResource9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DBaseTexture9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *SetPrivateData)(IDirect3DBaseTexture9 *This, REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags); + HRESULT (WINAPI *GetPrivateData)(IDirect3DBaseTexture9 *This, REFGUID refguid, void *pData, DWORD *pSizeOfData); + HRESULT (WINAPI *FreePrivateData)(IDirect3DBaseTexture9 *This, REFGUID refguid); + DWORD (WINAPI *SetPriority)(IDirect3DBaseTexture9 *This, DWORD PriorityNew); + DWORD (WINAPI *GetPriority)(IDirect3DBaseTexture9 *This); + void (WINAPI *PreLoad)(IDirect3DBaseTexture9 *This); + D3DRESOURCETYPE (WINAPI *GetType)(IDirect3DBaseTexture9 *This); + /* IDirect3DBaseTexture9 */ + DWORD (WINAPI *SetLOD)(IDirect3DBaseTexture9 *This, DWORD LODNew); + DWORD (WINAPI *GetLOD)(IDirect3DBaseTexture9 *This); + DWORD (WINAPI *GetLevelCount)(IDirect3DBaseTexture9 *This); + HRESULT (WINAPI *SetAutoGenFilterType)(IDirect3DBaseTexture9 *This, D3DTEXTUREFILTERTYPE FilterType); + D3DTEXTUREFILTERTYPE (WINAPI *GetAutoGenFilterType)(IDirect3DBaseTexture9 *This); + void (WINAPI *GenerateMipSubLevels)(IDirect3DBaseTexture9 *This); +} IDirect3DBaseTexture9Vtbl; +struct IDirect3DBaseTexture9 +{ + IDirect3DBaseTexture9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DBaseTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DBaseTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DBaseTexture9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DResource9 macros */ +#define IDirect3DBaseTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DBaseTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DBaseTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DBaseTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DBaseTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DBaseTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DBaseTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DBaseTexture9_GetType(p) (p)->lpVtbl->GetType(p) +/* IDirect3DBaseTexture9 macros */ +#define IDirect3DBaseTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DBaseTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DBaseTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DBaseTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DBaseTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DBaseTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) + +typedef struct IDirect3DCryptoSession9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DCryptoSession9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DCryptoSession9 *This); + ULONG (WINAPI *Release)(IDirect3DCryptoSession9 *This); + /* IDirect3DCryptoSession9 */ + HRESULT (WINAPI *GetCertificateSize)(IDirect3DCryptoSession9 *This, UINT *pCertificateSize); + HRESULT (WINAPI *GetCertificate)(IDirect3DCryptoSession9 *This, UINT CertifacteSize, BYTE *ppCertificate); + HRESULT (WINAPI *NegotiateKeyExchange)(IDirect3DCryptoSession9 *This, UINT DataSize, void *pData); + HRESULT (WINAPI *EncryptionBlt)(IDirect3DCryptoSession9 *This, IDirect3DSurface9 *pSrcSurface, IDirect3DSurface9 *pDstSurface, UINT DstSurfaceSize, void *pIV); + HRESULT (WINAPI *DecryptionBlt)(IDirect3DCryptoSession9 *This, IDirect3DSurface9 *pSrcSurface, IDirect3DSurface9 *pDstSurface, UINT SrcSurfaceSize, D3DENCRYPTED_BLOCK_INFO *pEncryptedBlockInfo, void *pContentKey, void *pIV); + HRESULT (WINAPI *GetSurfacePitch)(IDirect3DCryptoSession9 *This, IDirect3DSurface9 *pSrcSurface, UINT *pSurfacePitch); + HRESULT (WINAPI *StartSessionKeyRefresh)(IDirect3DCryptoSession9 *This, void *pRandomNumber, UINT RandomNumberSize); + HRESULT (WINAPI *FinishSessionKeyRefresh)(IDirect3DCryptoSession9 *This); + HRESULT (WINAPI *GetEncryptionBltKey)(IDirect3DCryptoSession9 *This, void *pReadbackKey, UINT KeySize); +} IDirect3DCryptoSession9Vtbl; +struct IDirect3DCryptoSession9 +{ + IDirect3DCryptoSession9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DCryptoSession9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DCryptoSession9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DCryptoSession9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DCryptoSession9 macros */ +#define IDirect3DCryptoSession9_GetCertificateSize(p,a) (p)->lpVtbl->GetCertificateSize(p,a) +#define IDirect3DCryptoSession9_GetCertificate(p,a,b) (p)->lpVtbl->GetCertificate(p,a,b) +#define IDirect3DCryptoSession9_NegotiateKeyExchange(p,a,b) (p)->lpVtbl->NegotiateKeyExchange(p,a,b) +#define IDirect3DCryptoSession9_EncryptionBlt(p,a,b,c,d) (p)->lpVtbl->EncryptionBlt(p,a,b,c,d) +#define IDirect3DCryptoSession9_DecryptionBlt(p,a,b,c,d,e,f) (p)->lpVtbl->DecryptionBlt(p,a,b,c,d,e,f) +#define IDirect3DCryptoSession9_GetSurfacePitch(p,a,b) (p)->lpVtbl->GetSurfacePitch(p,a,b) +#define IDirect3DCryptoSession9_StartSessionKeyRefresh(p,a,b) (p)->lpVtbl->StartSessionKeyRefresh(p,a,b) +#define IDirect3DCryptoSession9_FinishSessionKeyRefresh(p) (p)->lpVtbl->FinishSessionKeyRefresh(p) +#define IDirect3DCryptoSession9_GetEncryptionBltKey(p,a,b) (p)->lpVtbl->GetEncryptionBltKey(p,a,b) + +typedef struct IDirect3DCubeTexture9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DCubeTexture9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DCubeTexture9 *This); + ULONG (WINAPI *Release)(IDirect3DCubeTexture9 *This); + /* IDirect3DResource9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DCubeTexture9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *SetPrivateData)(IDirect3DCubeTexture9 *This, REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags); + HRESULT (WINAPI *GetPrivateData)(IDirect3DCubeTexture9 *This, REFGUID refguid, void *pData, DWORD *pSizeOfData); + HRESULT (WINAPI *FreePrivateData)(IDirect3DCubeTexture9 *This, REFGUID refguid); + DWORD (WINAPI *SetPriority)(IDirect3DCubeTexture9 *This, DWORD PriorityNew); + DWORD (WINAPI *GetPriority)(IDirect3DCubeTexture9 *This); + void (WINAPI *PreLoad)(IDirect3DCubeTexture9 *This); + D3DRESOURCETYPE (WINAPI *GetType)(IDirect3DCubeTexture9 *This); + /* IDirect3DBaseTexture9 */ + DWORD (WINAPI *SetLOD)(IDirect3DCubeTexture9 *This, DWORD LODNew); + DWORD (WINAPI *GetLOD)(IDirect3DCubeTexture9 *This); + DWORD (WINAPI *GetLevelCount)(IDirect3DCubeTexture9 *This); + HRESULT (WINAPI *SetAutoGenFilterType)(IDirect3DCubeTexture9 *This, D3DTEXTUREFILTERTYPE FilterType); + D3DTEXTUREFILTERTYPE (WINAPI *GetAutoGenFilterType)(IDirect3DCubeTexture9 *This); + void (WINAPI *GenerateMipSubLevels)(IDirect3DCubeTexture9 *This); + /* IDirect3DCubeTexture9 */ + HRESULT (WINAPI *GetLevelDesc)(IDirect3DCubeTexture9 *This, UINT Level, D3DSURFACE_DESC *pDesc); + HRESULT (WINAPI *GetCubeMapSurface)(IDirect3DCubeTexture9 *This, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9 **ppCubeMapSurface); + HRESULT (WINAPI *LockRect)(IDirect3DCubeTexture9 *This, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags); + HRESULT (WINAPI *UnlockRect)(IDirect3DCubeTexture9 *This, D3DCUBEMAP_FACES FaceType, UINT Level); + HRESULT (WINAPI *AddDirtyRect)(IDirect3DCubeTexture9 *This, D3DCUBEMAP_FACES FaceType, const RECT *pDirtyRect); +} IDirect3DCubeTexture9Vtbl; +struct IDirect3DCubeTexture9 +{ + IDirect3DCubeTexture9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DCubeTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DCubeTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DCubeTexture9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DResource9 macros */ +#define IDirect3DCubeTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DCubeTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DCubeTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DCubeTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DCubeTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DCubeTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DCubeTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DCubeTexture9_GetType(p) (p)->lpVtbl->GetType(p) +/* IDirect3DBaseTexture9 macros */ +#define IDirect3DCubeTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DCubeTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DCubeTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DCubeTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DCubeTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DCubeTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +/* IDirect3DCubeTexture9 macros */ +#define IDirect3DCubeTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DCubeTexture9_GetCubeMapSurface(p,a,b,c) (p)->lpVtbl->GetCubeMapSurface(p,a,b,c) +#define IDirect3DCubeTexture9_LockRect(p,a,b,c,d,e) (p)->lpVtbl->LockRect(p,a,b,c,d,e) +#define IDirect3DCubeTexture9_UnlockRect(p,a,b) (p)->lpVtbl->UnlockRect(p,a,b) +#define IDirect3DCubeTexture9_AddDirtyRect(p,a,b) (p)->lpVtbl->AddDirtyRect(p,a,b) + +typedef struct IDirect3DDevice9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DDevice9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DDevice9 *This); + ULONG (WINAPI *Release)(IDirect3DDevice9 *This); + /* IDirect3DDevice9 */ + HRESULT (WINAPI *TestCooperativeLevel)(IDirect3DDevice9 *This); + UINT (WINAPI *GetAvailableTextureMem)(IDirect3DDevice9 *This); + HRESULT (WINAPI *EvictManagedResources)(IDirect3DDevice9 *This); + HRESULT (WINAPI *GetDirect3D)(IDirect3DDevice9 *This, IDirect3D9 **ppD3D9); + HRESULT (WINAPI *GetDeviceCaps)(IDirect3DDevice9 *This, D3DCAPS9 *pCaps); + HRESULT (WINAPI *GetDisplayMode)(IDirect3DDevice9 *This, UINT iSwapChain, D3DDISPLAYMODE *pMode); + HRESULT (WINAPI *GetCreationParameters)(IDirect3DDevice9 *This, D3DDEVICE_CREATION_PARAMETERS *pParameters); + HRESULT (WINAPI *SetCursorProperties)(IDirect3DDevice9 *This, UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9 *pCursorBitmap); + void (WINAPI *SetCursorPosition)(IDirect3DDevice9 *This, int X, int Y, DWORD Flags); + BOOL (WINAPI *ShowCursor)(IDirect3DDevice9 *This, BOOL bShow); + HRESULT (WINAPI *CreateAdditionalSwapChain)(IDirect3DDevice9 *This, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DSwapChain9 **pSwapChain); + HRESULT (WINAPI *GetSwapChain)(IDirect3DDevice9 *This, UINT iSwapChain, IDirect3DSwapChain9 **pSwapChain); + UINT (WINAPI *GetNumberOfSwapChains)(IDirect3DDevice9 *This); + HRESULT (WINAPI *Reset)(IDirect3DDevice9 *This, D3DPRESENT_PARAMETERS *pPresentationParameters); + HRESULT (WINAPI *Present)(IDirect3DDevice9 *This, const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion); + HRESULT (WINAPI *GetBackBuffer)(IDirect3DDevice9 *This, UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer); + HRESULT (WINAPI *GetRasterStatus)(IDirect3DDevice9 *This, UINT iSwapChain, D3DRASTER_STATUS *pRasterStatus); + HRESULT (WINAPI *SetDialogBoxMode)(IDirect3DDevice9 *This, BOOL bEnableDialogs); + void (WINAPI *SetGammaRamp)(IDirect3DDevice9 *This, UINT iSwapChain, DWORD Flags, const D3DGAMMARAMP *pRamp); + void (WINAPI *GetGammaRamp)(IDirect3DDevice9 *This, UINT iSwapChain, D3DGAMMARAMP *pRamp); + HRESULT (WINAPI *CreateTexture)(IDirect3DDevice9 *This, UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9 **ppTexture, HANDLE *pSharedHandle); + HRESULT (WINAPI *CreateVolumeTexture)(IDirect3DDevice9 *This, UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9 **ppVolumeTexture, HANDLE *pSharedHandle); + HRESULT (WINAPI *CreateCubeTexture)(IDirect3DDevice9 *This, UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9 **ppCubeTexture, HANDLE *pSharedHandle); + HRESULT (WINAPI *CreateVertexBuffer)(IDirect3DDevice9 *This, UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9 **ppVertexBuffer, HANDLE *pSharedHandle); + HRESULT (WINAPI *CreateIndexBuffer)(IDirect3DDevice9 *This, UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9 **ppIndexBuffer, HANDLE *pSharedHandle); + HRESULT (WINAPI *CreateRenderTarget)(IDirect3DDevice9 *This, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle); + HRESULT (WINAPI *CreateDepthStencilSurface)(IDirect3DDevice9 *This, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle); + HRESULT (WINAPI *UpdateSurface)(IDirect3DDevice9 *This, IDirect3DSurface9 *pSourceSurface, const RECT *pSourceRect, IDirect3DSurface9 *pDestinationSurface, const POINT *pDestPoint); + HRESULT (WINAPI *UpdateTexture)(IDirect3DDevice9 *This, IDirect3DBaseTexture9 *pSourceTexture, IDirect3DBaseTexture9 *pDestinationTexture); + HRESULT (WINAPI *GetRenderTargetData)(IDirect3DDevice9 *This, IDirect3DSurface9 *pRenderTarget, IDirect3DSurface9 *pDestSurface); + HRESULT (WINAPI *GetFrontBufferData)(IDirect3DDevice9 *This, UINT iSwapChain, IDirect3DSurface9 *pDestSurface); + HRESULT (WINAPI *StretchRect)(IDirect3DDevice9 *This, IDirect3DSurface9 *pSourceSurface, const RECT *pSourceRect, IDirect3DSurface9 *pDestSurface, const RECT *pDestRect, D3DTEXTUREFILTERTYPE Filter); + HRESULT (WINAPI *ColorFill)(IDirect3DDevice9 *This, IDirect3DSurface9 *pSurface, const RECT *pRect, D3DCOLOR color); + HRESULT (WINAPI *CreateOffscreenPlainSurface)(IDirect3DDevice9 *This, UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle); + HRESULT (WINAPI *SetRenderTarget)(IDirect3DDevice9 *This, DWORD RenderTargetIndex, IDirect3DSurface9 *pRenderTarget); + HRESULT (WINAPI *GetRenderTarget)(IDirect3DDevice9 *This, DWORD RenderTargetIndex, IDirect3DSurface9 **ppRenderTarget); + HRESULT (WINAPI *SetDepthStencilSurface)(IDirect3DDevice9 *This, IDirect3DSurface9 *pNewZStencil); + HRESULT (WINAPI *GetDepthStencilSurface)(IDirect3DDevice9 *This, IDirect3DSurface9 **ppZStencilSurface); + HRESULT (WINAPI *BeginScene)(IDirect3DDevice9 *This); + HRESULT (WINAPI *EndScene)(IDirect3DDevice9 *This); + HRESULT (WINAPI *Clear)(IDirect3DDevice9 *This, DWORD Count, const D3DRECT *pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil); + HRESULT (WINAPI *SetTransform)(IDirect3DDevice9 *This, D3DTRANSFORMSTATETYPE State, const D3DMATRIX *pMatrix); + HRESULT (WINAPI *GetTransform)(IDirect3DDevice9 *This, D3DTRANSFORMSTATETYPE State, D3DMATRIX *pMatrix); + HRESULT (WINAPI *MultiplyTransform)(IDirect3DDevice9 *This, D3DTRANSFORMSTATETYPE State, const D3DMATRIX *pMatrix); + HRESULT (WINAPI *SetViewport)(IDirect3DDevice9 *This, const D3DVIEWPORT9 *pViewport); + HRESULT (WINAPI *GetViewport)(IDirect3DDevice9 *This, D3DVIEWPORT9 *pViewport); + HRESULT (WINAPI *SetMaterial)(IDirect3DDevice9 *This, const D3DMATERIAL9 *pMaterial); + HRESULT (WINAPI *GetMaterial)(IDirect3DDevice9 *This, D3DMATERIAL9 *pMaterial); + HRESULT (WINAPI *SetLight)(IDirect3DDevice9 *This, DWORD Index, const D3DLIGHT9 *pLight); + HRESULT (WINAPI *GetLight)(IDirect3DDevice9 *This, DWORD Index, D3DLIGHT9 *pLight); + HRESULT (WINAPI *LightEnable)(IDirect3DDevice9 *This, DWORD Index, BOOL Enable); + HRESULT (WINAPI *GetLightEnable)(IDirect3DDevice9 *This, DWORD Index, BOOL *pEnable); + HRESULT (WINAPI *SetClipPlane)(IDirect3DDevice9 *This, DWORD Index, const float *pPlane); + HRESULT (WINAPI *GetClipPlane)(IDirect3DDevice9 *This, DWORD Index, float *pPlane); + HRESULT (WINAPI *SetRenderState)(IDirect3DDevice9 *This, D3DRENDERSTATETYPE State, DWORD Value); + HRESULT (WINAPI *GetRenderState)(IDirect3DDevice9 *This, D3DRENDERSTATETYPE State, DWORD *pValue); + HRESULT (WINAPI *CreateStateBlock)(IDirect3DDevice9 *This, D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9 **ppSB); + HRESULT (WINAPI *BeginStateBlock)(IDirect3DDevice9 *This); + HRESULT (WINAPI *EndStateBlock)(IDirect3DDevice9 *This, IDirect3DStateBlock9 **ppSB); + HRESULT (WINAPI *SetClipStatus)(IDirect3DDevice9 *This, const D3DCLIPSTATUS9 *pClipStatus); + HRESULT (WINAPI *GetClipStatus)(IDirect3DDevice9 *This, D3DCLIPSTATUS9 *pClipStatus); + HRESULT (WINAPI *GetTexture)(IDirect3DDevice9 *This, DWORD Stage, IDirect3DBaseTexture9 **ppTexture); + HRESULT (WINAPI *SetTexture)(IDirect3DDevice9 *This, DWORD Stage, IDirect3DBaseTexture9 *pTexture); + HRESULT (WINAPI *GetTextureStageState)(IDirect3DDevice9 *This, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *pValue); + HRESULT (WINAPI *SetTextureStageState)(IDirect3DDevice9 *This, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value); + HRESULT (WINAPI *GetSamplerState)(IDirect3DDevice9 *This, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD *pValue); + HRESULT (WINAPI *SetSamplerState)(IDirect3DDevice9 *This, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value); + HRESULT (WINAPI *ValidateDevice)(IDirect3DDevice9 *This, DWORD *pNumPasses); + HRESULT (WINAPI *SetPaletteEntries)(IDirect3DDevice9 *This, UINT PaletteNumber, const PALETTEENTRY *pEntries); + HRESULT (WINAPI *GetPaletteEntries)(IDirect3DDevice9 *This, UINT PaletteNumber, PALETTEENTRY *pEntries); + HRESULT (WINAPI *SetCurrentTexturePalette)(IDirect3DDevice9 *This, UINT PaletteNumber); + HRESULT (WINAPI *GetCurrentTexturePalette)(IDirect3DDevice9 *This, UINT *PaletteNumber); + HRESULT (WINAPI *SetScissorRect)(IDirect3DDevice9 *This, const RECT *pRect); + HRESULT (WINAPI *GetScissorRect)(IDirect3DDevice9 *This, RECT *pRect); + HRESULT (WINAPI *SetSoftwareVertexProcessing)(IDirect3DDevice9 *This, BOOL bSoftware); + BOOL (WINAPI *GetSoftwareVertexProcessing)(IDirect3DDevice9 *This); + HRESULT (WINAPI *SetNPatchMode)(IDirect3DDevice9 *This, float nSegments); + float (WINAPI *GetNPatchMode)(IDirect3DDevice9 *This); + HRESULT (WINAPI *DrawPrimitive)(IDirect3DDevice9 *This, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount); + HRESULT (WINAPI *DrawIndexedPrimitive)(IDirect3DDevice9 *This, D3DPRIMITIVETYPE PrimitiveType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount); + HRESULT (WINAPI *DrawPrimitiveUP)(IDirect3DDevice9 *This, D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, const void *pVertexStreamZeroData, UINT VertexStreamZeroStride); + HRESULT (WINAPI *DrawIndexedPrimitiveUP)(IDirect3DDevice9 *This, D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, const void *pIndexData, D3DFORMAT IndexDataFormat, const void *pVertexStreamZeroData, UINT VertexStreamZeroStride); + HRESULT (WINAPI *ProcessVertices)(IDirect3DDevice9 *This, UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9 *pDestBuffer, IDirect3DVertexDeclaration9 *pVertexDecl, DWORD Flags); + HRESULT (WINAPI *CreateVertexDeclaration)(IDirect3DDevice9 *This, const D3DVERTEXELEMENT9 *pVertexElements, IDirect3DVertexDeclaration9 **ppDecl); + HRESULT (WINAPI *SetVertexDeclaration)(IDirect3DDevice9 *This, IDirect3DVertexDeclaration9 *pDecl); + HRESULT (WINAPI *GetVertexDeclaration)(IDirect3DDevice9 *This, IDirect3DVertexDeclaration9 **ppDecl); + HRESULT (WINAPI *SetFVF)(IDirect3DDevice9 *This, DWORD FVF); + HRESULT (WINAPI *GetFVF)(IDirect3DDevice9 *This, DWORD *pFVF); + HRESULT (WINAPI *CreateVertexShader)(IDirect3DDevice9 *This, const DWORD *pFunction, IDirect3DVertexShader9 **ppShader); + HRESULT (WINAPI *SetVertexShader)(IDirect3DDevice9 *This, IDirect3DVertexShader9 *pShader); + HRESULT (WINAPI *GetVertexShader)(IDirect3DDevice9 *This, IDirect3DVertexShader9 **ppShader); + HRESULT (WINAPI *SetVertexShaderConstantF)(IDirect3DDevice9 *This, UINT StartRegister, const float *pConstantData, UINT Vector4fCount); + HRESULT (WINAPI *GetVertexShaderConstantF)(IDirect3DDevice9 *This, UINT StartRegister, float *pConstantData, UINT Vector4fCount); + HRESULT (WINAPI *SetVertexShaderConstantI)(IDirect3DDevice9 *This, UINT StartRegister, const int *pConstantData, UINT Vector4iCount); + HRESULT (WINAPI *GetVertexShaderConstantI)(IDirect3DDevice9 *This, UINT StartRegister, int *pConstantData, UINT Vector4iCount); + HRESULT (WINAPI *SetVertexShaderConstantB)(IDirect3DDevice9 *This, UINT StartRegister, const BOOL *pConstantData, UINT BoolCount); + HRESULT (WINAPI *GetVertexShaderConstantB)(IDirect3DDevice9 *This, UINT StartRegister, BOOL *pConstantData, UINT BoolCount); + HRESULT (WINAPI *SetStreamSource)(IDirect3DDevice9 *This, UINT StreamNumber, IDirect3DVertexBuffer9 *pStreamData, UINT OffsetInBytes, UINT Stride); + HRESULT (WINAPI *GetStreamSource)(IDirect3DDevice9 *This, UINT StreamNumber, IDirect3DVertexBuffer9 **ppStreamData, UINT *pOffsetInBytes, UINT *pStride); + HRESULT (WINAPI *SetStreamSourceFreq)(IDirect3DDevice9 *This, UINT StreamNumber, UINT Setting); + HRESULT (WINAPI *GetStreamSourceFreq)(IDirect3DDevice9 *This, UINT StreamNumber, UINT *pSetting); + HRESULT (WINAPI *SetIndices)(IDirect3DDevice9 *This, IDirect3DIndexBuffer9 *pIndexData); + HRESULT (WINAPI *GetIndices)(IDirect3DDevice9 *This, IDirect3DIndexBuffer9 **ppIndexData, UINT *pBaseVertexIndex); + HRESULT (WINAPI *CreatePixelShader)(IDirect3DDevice9 *This, const DWORD *pFunction, IDirect3DPixelShader9 **ppShader); + HRESULT (WINAPI *SetPixelShader)(IDirect3DDevice9 *This, IDirect3DPixelShader9 *pShader); + HRESULT (WINAPI *GetPixelShader)(IDirect3DDevice9 *This, IDirect3DPixelShader9 **ppShader); + HRESULT (WINAPI *SetPixelShaderConstantF)(IDirect3DDevice9 *This, UINT StartRegister, const float *pConstantData, UINT Vector4fCount); + HRESULT (WINAPI *GetPixelShaderConstantF)(IDirect3DDevice9 *This, UINT StartRegister, float *pConstantData, UINT Vector4fCount); + HRESULT (WINAPI *SetPixelShaderConstantI)(IDirect3DDevice9 *This, UINT StartRegister, const int *pConstantData, UINT Vector4iCount); + HRESULT (WINAPI *GetPixelShaderConstantI)(IDirect3DDevice9 *This, UINT StartRegister, int *pConstantData, UINT Vector4iCount); + HRESULT (WINAPI *SetPixelShaderConstantB)(IDirect3DDevice9 *This, UINT StartRegister, const BOOL *pConstantData, UINT BoolCount); + HRESULT (WINAPI *GetPixelShaderConstantB)(IDirect3DDevice9 *This, UINT StartRegister, BOOL *pConstantData, UINT BoolCount); + HRESULT (WINAPI *DrawRectPatch)(IDirect3DDevice9 *This, UINT Handle, const float *pNumSegs, const D3DRECTPATCH_INFO *pRectPatchInfo); + HRESULT (WINAPI *DrawTriPatch)(IDirect3DDevice9 *This, UINT Handle, const float *pNumSegs, const D3DTRIPATCH_INFO *pTriPatchInfo); + HRESULT (WINAPI *DeletePatch)(IDirect3DDevice9 *This, UINT Handle); + HRESULT (WINAPI *CreateQuery)(IDirect3DDevice9 *This, D3DQUERYTYPE Type, IDirect3DQuery9 **ppQuery); +} IDirect3DDevice9Vtbl; +struct IDirect3DDevice9 +{ + IDirect3DDevice9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DDevice9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DDevice9 macros */ +#define IDirect3DDevice9_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirect3DDevice9_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) +#define IDirect3DDevice9_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p) +#define IDirect3DDevice9_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice9_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) +#define IDirect3DDevice9_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b) +#define IDirect3DDevice9_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) +#define IDirect3DDevice9_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) +#define IDirect3DDevice9_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) +#define IDirect3DDevice9_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) +#define IDirect3DDevice9_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) +#define IDirect3DDevice9_GetSwapChain(p,a,b) (p)->lpVtbl->GetSwapChain(p,a,b) +#define IDirect3DDevice9_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p) +#define IDirect3DDevice9_Reset(p,a) (p)->lpVtbl->Reset(p,a) +#define IDirect3DDevice9_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DDevice9_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d) +#define IDirect3DDevice9_GetRasterStatus(p,a,b) (p)->lpVtbl->GetRasterStatus(p,a,b) +#define IDirect3DDevice9_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a) +#define IDirect3DDevice9_SetGammaRamp(p,a,b,c) (p)->lpVtbl->SetGammaRamp(p,a,b,c) +#define IDirect3DDevice9_GetGammaRamp(p,a,b) (p)->lpVtbl->GetGammaRamp(p,a,b) +#define IDirect3DDevice9_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g) +#define IDirect3DDevice9_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d) +#define IDirect3DDevice9_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) +#define IDirect3DDevice9_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b) +#define IDirect3DDevice9_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b) +#define IDirect3DDevice9_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e) +#define IDirect3DDevice9_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c) +#define IDirect3DDevice9_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->lpVtbl->CreateOffscreenPlainSurface(p,a,b,c,d,e,f) +#define IDirect3DDevice9_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice9_GetRenderTarget(p,a,b) (p)->lpVtbl->GetRenderTarget(p,a,b) +#define IDirect3DDevice9_SetDepthStencilSurface(p,a) (p)->lpVtbl->SetDepthStencilSurface(p,a) +#define IDirect3DDevice9_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) +#define IDirect3DDevice9_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice9_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice9_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice9_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice9_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice9_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice9_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice9_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice9_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice9_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice9_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice9_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice9_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice9_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice9_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice9_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice9_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice9_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice9_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice9_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice9_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice9_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice9_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice9_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice9_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice9_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice9_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice9_GetSamplerState(p,a,b,c) (p)->lpVtbl->GetSamplerState(p,a,b,c) +#define IDirect3DDevice9_SetSamplerState(p,a,b,c) (p)->lpVtbl->SetSamplerState(p,a,b,c) +#define IDirect3DDevice9_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice9_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) +#define IDirect3DDevice9_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) +#define IDirect3DDevice9_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) +#define IDirect3DDevice9_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) +#define IDirect3DDevice9_SetScissorRect(p,a) (p)->lpVtbl->SetScissorRect(p,a) +#define IDirect3DDevice9_GetScissorRect(p,a) (p)->lpVtbl->GetScissorRect(p,a) +#define IDirect3DDevice9_SetSoftwareVertexProcessing(p,a) (p)->lpVtbl->SetSoftwareVertexProcessing(p,a) +#define IDirect3DDevice9_GetSoftwareVertexProcessing(p) (p)->lpVtbl->GetSoftwareVertexProcessing(p) +#define IDirect3DDevice9_SetNPatchMode(p,a) (p)->lpVtbl->SetNPatchMode(p,a) +#define IDirect3DDevice9_GetNPatchMode(p) (p)->lpVtbl->GetNPatchMode(p) +#define IDirect3DDevice9_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) +#define IDirect3DDevice9_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f) +#define IDirect3DDevice9_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) +#define IDirect3DDevice9_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_ProcessVertices(p,a,b,c,d,e,f) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateVertexDeclaration(p,a,b) (p)->lpVtbl->CreateVertexDeclaration(p,a,b) +#define IDirect3DDevice9_SetVertexDeclaration(p,a) (p)->lpVtbl->SetVertexDeclaration(p,a) +#define IDirect3DDevice9_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a) +#define IDirect3DDevice9_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a) +#define IDirect3DDevice9_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a) +#define IDirect3DDevice9_CreateVertexShader(p,a,b) (p)->lpVtbl->CreateVertexShader(p,a,b) +#define IDirect3DDevice9_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) +#define IDirect3DDevice9_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) +#define IDirect3DDevice9_SetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9_GetStreamSource(p,a,b,c,d) (p)->lpVtbl->GetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9_SetStreamSourceFreq(p,a,b) (p)->lpVtbl->SetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9_GetStreamSourceFreq(p,a,b) (p)->lpVtbl->GetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9_SetIndices(p,a) (p)->lpVtbl->SetIndices(p,a) +#define IDirect3DDevice9_GetIndices(p,a,b) (p)->lpVtbl->GetIndices(p,a,b) +#define IDirect3DDevice9_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) +#define IDirect3DDevice9_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) +#define IDirect3DDevice9_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) +#define IDirect3DDevice9_SetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) +#define IDirect3DDevice9_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) +#define IDirect3DDevice9_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) +#define IDirect3DDevice9_CreateQuery(p,a,b) (p)->lpVtbl->CreateQuery(p,a,b) + +typedef struct IDirect3DDevice9ExVtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DDevice9Ex *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DDevice9Ex *This); + ULONG (WINAPI *Release)(IDirect3DDevice9Ex *This); + /* IDirect3DDevice9 */ + HRESULT (WINAPI *TestCooperativeLevel)(IDirect3DDevice9Ex *This); + UINT (WINAPI *GetAvailableTextureMem)(IDirect3DDevice9Ex *This); + HRESULT (WINAPI *EvictManagedResources)(IDirect3DDevice9Ex *This); + HRESULT (WINAPI *GetDirect3D)(IDirect3DDevice9Ex *This, IDirect3D9 **ppD3D9); + HRESULT (WINAPI *GetDeviceCaps)(IDirect3DDevice9Ex *This, D3DCAPS9 *pCaps); + HRESULT (WINAPI *GetDisplayMode)(IDirect3DDevice9Ex *This, UINT iSwapChain, D3DDISPLAYMODE *pMode); + HRESULT (WINAPI *GetCreationParameters)(IDirect3DDevice9Ex *This, D3DDEVICE_CREATION_PARAMETERS *pParameters); + HRESULT (WINAPI *SetCursorProperties)(IDirect3DDevice9Ex *This, UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9 *pCursorBitmap); + void (WINAPI *SetCursorPosition)(IDirect3DDevice9Ex *This, int X, int Y, DWORD Flags); + BOOL (WINAPI *ShowCursor)(IDirect3DDevice9Ex *This, BOOL bShow); + HRESULT (WINAPI *CreateAdditionalSwapChain)(IDirect3DDevice9Ex *This, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DSwapChain9 **pSwapChain); + HRESULT (WINAPI *GetSwapChain)(IDirect3DDevice9Ex *This, UINT iSwapChain, IDirect3DSwapChain9 **pSwapChain); + UINT (WINAPI *GetNumberOfSwapChains)(IDirect3DDevice9Ex *This); + HRESULT (WINAPI *Reset)(IDirect3DDevice9Ex *This, D3DPRESENT_PARAMETERS *pPresentationParameters); + HRESULT (WINAPI *Present)(IDirect3DDevice9Ex *This, const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion); + HRESULT (WINAPI *GetBackBuffer)(IDirect3DDevice9Ex *This, UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer); + HRESULT (WINAPI *GetRasterStatus)(IDirect3DDevice9Ex *This, UINT iSwapChain, D3DRASTER_STATUS *pRasterStatus); + HRESULT (WINAPI *SetDialogBoxMode)(IDirect3DDevice9Ex *This, BOOL bEnableDialogs); + void (WINAPI *SetGammaRamp)(IDirect3DDevice9Ex *This, UINT iSwapChain, DWORD Flags, const D3DGAMMARAMP *pRamp); + void (WINAPI *GetGammaRamp)(IDirect3DDevice9Ex *This, UINT iSwapChain, D3DGAMMARAMP *pRamp); + HRESULT (WINAPI *CreateTexture)(IDirect3DDevice9Ex *This, UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9 **ppTexture, HANDLE *pSharedHandle); + HRESULT (WINAPI *CreateVolumeTexture)(IDirect3DDevice9Ex *This, UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9 **ppVolumeTexture, HANDLE *pSharedHandle); + HRESULT (WINAPI *CreateCubeTexture)(IDirect3DDevice9Ex *This, UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9 **ppCubeTexture, HANDLE *pSharedHandle); + HRESULT (WINAPI *CreateVertexBuffer)(IDirect3DDevice9Ex *This, UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9 **ppVertexBuffer, HANDLE *pSharedHandle); + HRESULT (WINAPI *CreateIndexBuffer)(IDirect3DDevice9Ex *This, UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9 **ppIndexBuffer, HANDLE *pSharedHandle); + HRESULT (WINAPI *CreateRenderTarget)(IDirect3DDevice9Ex *This, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle); + HRESULT (WINAPI *CreateDepthStencilSurface)(IDirect3DDevice9Ex *This, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle); + HRESULT (WINAPI *UpdateSurface)(IDirect3DDevice9Ex *This, IDirect3DSurface9 *pSourceSurface, const RECT *pSourceRect, IDirect3DSurface9 *pDestinationSurface, const POINT *pDestPoint); + HRESULT (WINAPI *UpdateTexture)(IDirect3DDevice9Ex *This, IDirect3DBaseTexture9 *pSourceTexture, IDirect3DBaseTexture9 *pDestinationTexture); + HRESULT (WINAPI *GetRenderTargetData)(IDirect3DDevice9Ex *This, IDirect3DSurface9 *pRenderTarget, IDirect3DSurface9 *pDestSurface); + HRESULT (WINAPI *GetFrontBufferData)(IDirect3DDevice9Ex *This, UINT iSwapChain, IDirect3DSurface9 *pDestSurface); + HRESULT (WINAPI *StretchRect)(IDirect3DDevice9Ex *This, IDirect3DSurface9 *pSourceSurface, const RECT *pSourceRect, IDirect3DSurface9 *pDestSurface, const RECT *pDestRect, D3DTEXTUREFILTERTYPE Filter); + HRESULT (WINAPI *ColorFill)(IDirect3DDevice9Ex *This, IDirect3DSurface9 *pSurface, const RECT *pRect, D3DCOLOR color); + HRESULT (WINAPI *CreateOffscreenPlainSurface)(IDirect3DDevice9Ex *This, UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle); + HRESULT (WINAPI *SetRenderTarget)(IDirect3DDevice9Ex *This, DWORD RenderTargetIndex, IDirect3DSurface9 *pRenderTarget); + HRESULT (WINAPI *GetRenderTarget)(IDirect3DDevice9Ex *This, DWORD RenderTargetIndex, IDirect3DSurface9 **ppRenderTarget); + HRESULT (WINAPI *SetDepthStencilSurface)(IDirect3DDevice9Ex *This, IDirect3DSurface9 *pNewZStencil); + HRESULT (WINAPI *GetDepthStencilSurface)(IDirect3DDevice9Ex *This, IDirect3DSurface9 **ppZStencilSurface); + HRESULT (WINAPI *BeginScene)(IDirect3DDevice9Ex *This); + HRESULT (WINAPI *EndScene)(IDirect3DDevice9Ex *This); + HRESULT (WINAPI *Clear)(IDirect3DDevice9Ex *This, DWORD Count, const D3DRECT *pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil); + HRESULT (WINAPI *SetTransform)(IDirect3DDevice9Ex *This, D3DTRANSFORMSTATETYPE State, const D3DMATRIX *pMatrix); + HRESULT (WINAPI *GetTransform)(IDirect3DDevice9Ex *This, D3DTRANSFORMSTATETYPE State, D3DMATRIX *pMatrix); + HRESULT (WINAPI *MultiplyTransform)(IDirect3DDevice9Ex *This, D3DTRANSFORMSTATETYPE State, const D3DMATRIX *pMatrix); + HRESULT (WINAPI *SetViewport)(IDirect3DDevice9Ex *This, const D3DVIEWPORT9 *pViewport); + HRESULT (WINAPI *GetViewport)(IDirect3DDevice9Ex *This, D3DVIEWPORT9 *pViewport); + HRESULT (WINAPI *SetMaterial)(IDirect3DDevice9Ex *This, const D3DMATERIAL9 *pMaterial); + HRESULT (WINAPI *GetMaterial)(IDirect3DDevice9Ex *This, D3DMATERIAL9 *pMaterial); + HRESULT (WINAPI *SetLight)(IDirect3DDevice9Ex *This, DWORD Index, const D3DLIGHT9 *pLight); + HRESULT (WINAPI *GetLight)(IDirect3DDevice9Ex *This, DWORD Index, D3DLIGHT9 *pLight); + HRESULT (WINAPI *LightEnable)(IDirect3DDevice9Ex *This, DWORD Index, BOOL Enable); + HRESULT (WINAPI *GetLightEnable)(IDirect3DDevice9Ex *This, DWORD Index, BOOL *pEnable); + HRESULT (WINAPI *SetClipPlane)(IDirect3DDevice9Ex *This, DWORD Index, const float *pPlane); + HRESULT (WINAPI *GetClipPlane)(IDirect3DDevice9Ex *This, DWORD Index, float *pPlane); + HRESULT (WINAPI *SetRenderState)(IDirect3DDevice9Ex *This, D3DRENDERSTATETYPE State, DWORD Value); + HRESULT (WINAPI *GetRenderState)(IDirect3DDevice9Ex *This, D3DRENDERSTATETYPE State, DWORD *pValue); + HRESULT (WINAPI *CreateStateBlock)(IDirect3DDevice9Ex *This, D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9 **ppSB); + HRESULT (WINAPI *BeginStateBlock)(IDirect3DDevice9Ex *This); + HRESULT (WINAPI *EndStateBlock)(IDirect3DDevice9Ex *This, IDirect3DStateBlock9 **ppSB); + HRESULT (WINAPI *SetClipStatus)(IDirect3DDevice9Ex *This, const D3DCLIPSTATUS9 *pClipStatus); + HRESULT (WINAPI *GetClipStatus)(IDirect3DDevice9Ex *This, D3DCLIPSTATUS9 *pClipStatus); + HRESULT (WINAPI *GetTexture)(IDirect3DDevice9Ex *This, DWORD Stage, IDirect3DBaseTexture9 **ppTexture); + HRESULT (WINAPI *SetTexture)(IDirect3DDevice9Ex *This, DWORD Stage, IDirect3DBaseTexture9 *pTexture); + HRESULT (WINAPI *GetTextureStageState)(IDirect3DDevice9Ex *This, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *pValue); + HRESULT (WINAPI *SetTextureStageState)(IDirect3DDevice9Ex *This, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value); + HRESULT (WINAPI *GetSamplerState)(IDirect3DDevice9Ex *This, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD *pValue); + HRESULT (WINAPI *SetSamplerState)(IDirect3DDevice9Ex *This, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value); + HRESULT (WINAPI *ValidateDevice)(IDirect3DDevice9Ex *This, DWORD *pNumPasses); + HRESULT (WINAPI *SetPaletteEntries)(IDirect3DDevice9Ex *This, UINT PaletteNumber, const PALETTEENTRY *pEntries); + HRESULT (WINAPI *GetPaletteEntries)(IDirect3DDevice9Ex *This, UINT PaletteNumber, PALETTEENTRY *pEntries); + HRESULT (WINAPI *SetCurrentTexturePalette)(IDirect3DDevice9Ex *This, UINT PaletteNumber); + HRESULT (WINAPI *GetCurrentTexturePalette)(IDirect3DDevice9Ex *This, UINT *PaletteNumber); + HRESULT (WINAPI *SetScissorRect)(IDirect3DDevice9Ex *This, const RECT *pRect); + HRESULT (WINAPI *GetScissorRect)(IDirect3DDevice9Ex *This, RECT *pRect); + HRESULT (WINAPI *SetSoftwareVertexProcessing)(IDirect3DDevice9Ex *This, BOOL bSoftware); + BOOL (WINAPI *GetSoftwareVertexProcessing)(IDirect3DDevice9Ex *This); + HRESULT (WINAPI *SetNPatchMode)(IDirect3DDevice9Ex *This, float nSegments); + float (WINAPI *GetNPatchMode)(IDirect3DDevice9Ex *This); + HRESULT (WINAPI *DrawPrimitive)(IDirect3DDevice9Ex *This, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount); + HRESULT (WINAPI *DrawIndexedPrimitive)(IDirect3DDevice9Ex *This, D3DPRIMITIVETYPE PrimitiveType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount); + HRESULT (WINAPI *DrawPrimitiveUP)(IDirect3DDevice9Ex *This, D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, const void *pVertexStreamZeroData, UINT VertexStreamZeroStride); + HRESULT (WINAPI *DrawIndexedPrimitiveUP)(IDirect3DDevice9Ex *This, D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, const void *pIndexData, D3DFORMAT IndexDataFormat, const void *pVertexStreamZeroData, UINT VertexStreamZeroStride); + HRESULT (WINAPI *ProcessVertices)(IDirect3DDevice9Ex *This, UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9 *pDestBuffer, IDirect3DVertexDeclaration9 *pVertexDecl, DWORD Flags); + HRESULT (WINAPI *CreateVertexDeclaration)(IDirect3DDevice9Ex *This, const D3DVERTEXELEMENT9 *pVertexElements, IDirect3DVertexDeclaration9 **ppDecl); + HRESULT (WINAPI *SetVertexDeclaration)(IDirect3DDevice9Ex *This, IDirect3DVertexDeclaration9 *pDecl); + HRESULT (WINAPI *GetVertexDeclaration)(IDirect3DDevice9Ex *This, IDirect3DVertexDeclaration9 **ppDecl); + HRESULT (WINAPI *SetFVF)(IDirect3DDevice9Ex *This, DWORD FVF); + HRESULT (WINAPI *GetFVF)(IDirect3DDevice9Ex *This, DWORD *pFVF); + HRESULT (WINAPI *CreateVertexShader)(IDirect3DDevice9Ex *This, const DWORD *pFunction, IDirect3DVertexShader9 **ppShader); + HRESULT (WINAPI *SetVertexShader)(IDirect3DDevice9Ex *This, IDirect3DVertexShader9 *pShader); + HRESULT (WINAPI *GetVertexShader)(IDirect3DDevice9Ex *This, IDirect3DVertexShader9 **ppShader); + HRESULT (WINAPI *SetVertexShaderConstantF)(IDirect3DDevice9Ex *This, UINT StartRegister, const float *pConstantData, UINT Vector4fCount); + HRESULT (WINAPI *GetVertexShaderConstantF)(IDirect3DDevice9Ex *This, UINT StartRegister, float *pConstantData, UINT Vector4fCount); + HRESULT (WINAPI *SetVertexShaderConstantI)(IDirect3DDevice9Ex *This, UINT StartRegister, const int *pConstantData, UINT Vector4iCount); + HRESULT (WINAPI *GetVertexShaderConstantI)(IDirect3DDevice9Ex *This, UINT StartRegister, int *pConstantData, UINT Vector4iCount); + HRESULT (WINAPI *SetVertexShaderConstantB)(IDirect3DDevice9Ex *This, UINT StartRegister, const BOOL *pConstantData, UINT BoolCount); + HRESULT (WINAPI *GetVertexShaderConstantB)(IDirect3DDevice9Ex *This, UINT StartRegister, BOOL *pConstantData, UINT BoolCount); + HRESULT (WINAPI *SetStreamSource)(IDirect3DDevice9Ex *This, UINT StreamNumber, IDirect3DVertexBuffer9 *pStreamData, UINT OffsetInBytes, UINT Stride); + HRESULT (WINAPI *GetStreamSource)(IDirect3DDevice9Ex *This, UINT StreamNumber, IDirect3DVertexBuffer9 **ppStreamData, UINT *pOffsetInBytes, UINT *pStride); + HRESULT (WINAPI *SetStreamSourceFreq)(IDirect3DDevice9Ex *This, UINT StreamNumber, UINT Setting); + HRESULT (WINAPI *GetStreamSourceFreq)(IDirect3DDevice9Ex *This, UINT StreamNumber, UINT *pSetting); + HRESULT (WINAPI *SetIndices)(IDirect3DDevice9Ex *This, IDirect3DIndexBuffer9 *pIndexData); + HRESULT (WINAPI *GetIndices)(IDirect3DDevice9Ex *This, IDirect3DIndexBuffer9 **ppIndexData, UINT *pBaseVertexIndex); + HRESULT (WINAPI *CreatePixelShader)(IDirect3DDevice9Ex *This, const DWORD *pFunction, IDirect3DPixelShader9 **ppShader); + HRESULT (WINAPI *SetPixelShader)(IDirect3DDevice9Ex *This, IDirect3DPixelShader9 *pShader); + HRESULT (WINAPI *GetPixelShader)(IDirect3DDevice9Ex *This, IDirect3DPixelShader9 **ppShader); + HRESULT (WINAPI *SetPixelShaderConstantF)(IDirect3DDevice9Ex *This, UINT StartRegister, const float *pConstantData, UINT Vector4fCount); + HRESULT (WINAPI *GetPixelShaderConstantF)(IDirect3DDevice9Ex *This, UINT StartRegister, float *pConstantData, UINT Vector4fCount); + HRESULT (WINAPI *SetPixelShaderConstantI)(IDirect3DDevice9Ex *This, UINT StartRegister, const int *pConstantData, UINT Vector4iCount); + HRESULT (WINAPI *GetPixelShaderConstantI)(IDirect3DDevice9Ex *This, UINT StartRegister, int *pConstantData, UINT Vector4iCount); + HRESULT (WINAPI *SetPixelShaderConstantB)(IDirect3DDevice9Ex *This, UINT StartRegister, const BOOL *pConstantData, UINT BoolCount); + HRESULT (WINAPI *GetPixelShaderConstantB)(IDirect3DDevice9Ex *This, UINT StartRegister, BOOL *pConstantData, UINT BoolCount); + HRESULT (WINAPI *DrawRectPatch)(IDirect3DDevice9Ex *This, UINT Handle, const float *pNumSegs, const D3DRECTPATCH_INFO *pRectPatchInfo); + HRESULT (WINAPI *DrawTriPatch)(IDirect3DDevice9Ex *This, UINT Handle, const float *pNumSegs, const D3DTRIPATCH_INFO *pTriPatchInfo); + HRESULT (WINAPI *DeletePatch)(IDirect3DDevice9Ex *This, UINT Handle); + HRESULT (WINAPI *CreateQuery)(IDirect3DDevice9Ex *This, D3DQUERYTYPE Type, IDirect3DQuery9 **ppQuery); + /* IDirect3DDevice9Ex */ + HRESULT (WINAPI *SetConvolutionMonoKernel)(IDirect3DDevice9Ex *This, UINT width, UINT height, float *rows, float *columns); + HRESULT (WINAPI *ComposeRects)(IDirect3DDevice9Ex *This, IDirect3DSurface9 *pSrc, IDirect3DSurface9 *pDst, IDirect3DVertexBuffer9 *pSrcRectDescs, UINT NumRects, IDirect3DVertexBuffer9 *pDstRectDescs, D3DCOMPOSERECTSOP Operation, int Xoffset, int Yoffset); + HRESULT (WINAPI *PresentEx)(IDirect3DDevice9Ex *This, const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion, DWORD dwFlags); + HRESULT (WINAPI *GetGPUThreadPriority)(IDirect3DDevice9Ex *This, INT *pPriority); + HRESULT (WINAPI *SetGPUThreadPriority)(IDirect3DDevice9Ex *This, INT Priority); + HRESULT (WINAPI *WaitForVBlank)(IDirect3DDevice9Ex *This, UINT iSwapChain); + HRESULT (WINAPI *CheckResourceResidency)(IDirect3DDevice9Ex *This, IDirect3DResource9 **pResourceArray, UINT32 NumResources); + HRESULT (WINAPI *SetMaximumFrameLatency)(IDirect3DDevice9Ex *This, UINT MaxLatency); + HRESULT (WINAPI *GetMaximumFrameLatency)(IDirect3DDevice9Ex *This, UINT *pMaxLatency); + HRESULT (WINAPI *CheckDeviceState)(IDirect3DDevice9Ex *This, HWND hDestinationWindow); + HRESULT (WINAPI *CreateRenderTargetEx)(IDirect3DDevice9Ex *This, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle, DWORD Usage); + HRESULT (WINAPI *CreateOffscreenPlainSurfaceEx)(IDirect3DDevice9Ex *This, UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle, DWORD Usage); + HRESULT (WINAPI *CreateDepthStencilSurfaceEx)(IDirect3DDevice9Ex *This, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle, DWORD Usage); + HRESULT (WINAPI *ResetEx)(IDirect3DDevice9Ex *This, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode); + HRESULT (WINAPI *GetDisplayModeEx)(IDirect3DDevice9Ex *This, UINT iSwapChain, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation); +} IDirect3DDevice9ExVtbl; +struct IDirect3DDevice9Ex +{ + IDirect3DDevice9ExVtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DDevice9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice9Ex_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice9Ex_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DDevice9 macros */ +#define IDirect3DDevice9Ex_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirect3DDevice9Ex_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) +#define IDirect3DDevice9Ex_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p) +#define IDirect3DDevice9Ex_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice9Ex_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) +#define IDirect3DDevice9Ex_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b) +#define IDirect3DDevice9Ex_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) +#define IDirect3DDevice9Ex_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) +#define IDirect3DDevice9Ex_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) +#define IDirect3DDevice9Ex_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) +#define IDirect3DDevice9Ex_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) +#define IDirect3DDevice9Ex_GetSwapChain(p,a,b) (p)->lpVtbl->GetSwapChain(p,a,b) +#define IDirect3DDevice9Ex_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p) +#define IDirect3DDevice9Ex_Reset(p,a) (p)->lpVtbl->Reset(p,a) +#define IDirect3DDevice9Ex_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DDevice9Ex_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d) +#define IDirect3DDevice9Ex_GetRasterStatus(p,a,b) (p)->lpVtbl->GetRasterStatus(p,a,b) +#define IDirect3DDevice9Ex_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a) +#define IDirect3DDevice9Ex_SetGammaRamp(p,a,b,c) (p)->lpVtbl->SetGammaRamp(p,a,b,c) +#define IDirect3DDevice9Ex_GetGammaRamp(p,a,b) (p)->lpVtbl->GetGammaRamp(p,a,b) +#define IDirect3DDevice9Ex_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g) +#define IDirect3DDevice9Ex_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d) +#define IDirect3DDevice9Ex_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) +#define IDirect3DDevice9Ex_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b) +#define IDirect3DDevice9Ex_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b) +#define IDirect3DDevice9Ex_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e) +#define IDirect3DDevice9Ex_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c) +#define IDirect3DDevice9Ex_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->lpVtbl->CreateOffscreenPlainSurface(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice9Ex_GetRenderTarget(p,a,b) (p)->lpVtbl->GetRenderTarget(p,a,b) +#define IDirect3DDevice9Ex_SetDepthStencilSurface(p,a) (p)->lpVtbl->SetDepthStencilSurface(p,a) +#define IDirect3DDevice9Ex_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) +#define IDirect3DDevice9Ex_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice9Ex_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice9Ex_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice9Ex_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice9Ex_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice9Ex_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice9Ex_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice9Ex_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice9Ex_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice9Ex_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice9Ex_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice9Ex_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice9Ex_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice9Ex_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice9Ex_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice9Ex_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice9Ex_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice9Ex_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice9Ex_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice9Ex_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice9Ex_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice9Ex_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice9Ex_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice9Ex_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice9Ex_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice9Ex_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice9Ex_GetSamplerState(p,a,b,c) (p)->lpVtbl->GetSamplerState(p,a,b,c) +#define IDirect3DDevice9Ex_SetSamplerState(p,a,b,c) (p)->lpVtbl->SetSamplerState(p,a,b,c) +#define IDirect3DDevice9Ex_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice9Ex_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) +#define IDirect3DDevice9Ex_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) +#define IDirect3DDevice9Ex_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) +#define IDirect3DDevice9Ex_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) +#define IDirect3DDevice9Ex_SetScissorRect(p,a) (p)->lpVtbl->SetScissorRect(p,a) +#define IDirect3DDevice9Ex_GetScissorRect(p,a) (p)->lpVtbl->GetScissorRect(p,a) +#define IDirect3DDevice9Ex_SetSoftwareVertexProcessing(p,a) (p)->lpVtbl->SetSoftwareVertexProcessing(p,a) +#define IDirect3DDevice9Ex_GetSoftwareVertexProcessing(p) (p)->lpVtbl->GetSoftwareVertexProcessing(p) +#define IDirect3DDevice9Ex_SetNPatchMode(p,a) (p)->lpVtbl->SetNPatchMode(p,a) +#define IDirect3DDevice9Ex_GetNPatchMode(p) (p)->lpVtbl->GetNPatchMode(p) +#define IDirect3DDevice9Ex_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) +#define IDirect3DDevice9Ex_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) +#define IDirect3DDevice9Ex_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_ProcessVertices(p,a,b,c,d,e,f) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f) +#define IDirect3DDevice9Ex_CreateVertexDeclaration(p,a,b) (p)->lpVtbl->CreateVertexDeclaration(p,a,b) +#define IDirect3DDevice9Ex_SetVertexDeclaration(p,a) (p)->lpVtbl->SetVertexDeclaration(p,a) +#define IDirect3DDevice9Ex_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a) +#define IDirect3DDevice9Ex_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a) +#define IDirect3DDevice9Ex_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a) +#define IDirect3DDevice9Ex_CreateVertexShader(p,a,b) (p)->lpVtbl->CreateVertexShader(p,a,b) +#define IDirect3DDevice9Ex_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) +#define IDirect3DDevice9Ex_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) +#define IDirect3DDevice9Ex_SetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9Ex_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9Ex_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9Ex_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9Ex_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9Ex_GetStreamSource(p,a,b,c,d) (p)->lpVtbl->GetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9Ex_SetStreamSourceFreq(p,a,b) (p)->lpVtbl->SetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9Ex_GetStreamSourceFreq(p,a,b) (p)->lpVtbl->GetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9Ex_SetIndices(p,a) (p)->lpVtbl->SetIndices(p,a) +#define IDirect3DDevice9Ex_GetIndices(p,a,b) (p)->lpVtbl->GetIndices(p,a,b) +#define IDirect3DDevice9Ex_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) +#define IDirect3DDevice9Ex_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) +#define IDirect3DDevice9Ex_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) +#define IDirect3DDevice9Ex_SetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9Ex_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9Ex_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9Ex_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9Ex_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) +#define IDirect3DDevice9Ex_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) +#define IDirect3DDevice9Ex_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) +#define IDirect3DDevice9Ex_CreateQuery(p,a,b) (p)->lpVtbl->CreateQuery(p,a,b) +/* IDirect3DDevice9Ex macros */ +#define IDirect3DDevice9Ex_SetConvolutionMonoKernel(p,a,b,c,d) (p)->lpVtbl->SetConvolutionMonoKernel(p,a,b,c,d) +#define IDirect3DDevice9Ex_ComposeRects(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->ComposeRects(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9Ex_PresentEx(p,a,b,c,d,e) (p)->lpVtbl->PresentEx(p,a,b,c,d,e) +#define IDirect3DDevice9Ex_GetGPUThreadPriority(p,a) (p)->lpVtbl->GetGPUThreadPriority(p,a) +#define IDirect3DDevice9Ex_SetGPUThreadPriority(p,a) (p)->lpVtbl->SetGPUThreadPriority(p,a) +#define IDirect3DDevice9Ex_WaitForVBlank(p,a) (p)->lpVtbl->WaitForVBlank(p,a) +#define IDirect3DDevice9Ex_CheckResourceResidency(p,a,b) (p)->lpVtbl->CheckResourceResidency(p,a,b) +#define IDirect3DDevice9Ex_SetMaximumFrameLatency(p,a) (p)->lpVtbl->SetMaximumFrameLatency(p,a) +#define IDirect3DDevice9Ex_GetMaximumFrameLatency(p,a) (p)->lpVtbl->GetMaximumFrameLatency(p,a) +#define IDirect3DDevice9Ex_CheckDeviceState(p,a) (p)->lpVtbl->CheckDeviceState(p,a) +#define IDirect3DDevice9Ex_CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g) +#define IDirect3DDevice9Ex_CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9Ex_ResetEx(p,a,b) (p)->lpVtbl->ResetEx(p,a,b) +#define IDirect3DDevice9Ex_GetDisplayModeEx(p,a,b,c) (p)->lpVtbl->GetDisplayModeEx(p,a,b,c) + +typedef struct IDirect3DDevice9VideoVtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DDevice9Video *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DDevice9Video *This); + ULONG (WINAPI *Release)(IDirect3DDevice9Video *This); + /* IDirect3DDevice9Video */ + HRESULT (WINAPI *GetContentProtectionCaps)(IDirect3DDevice9Video *This, const GUID *pCryptoType, const GUID *pDecodeProfile, D3DCONTENTPROTECTIONCAPS *pCaps); + HRESULT (WINAPI *CreateAuthenticatedChannel)(IDirect3DDevice9Video *This, D3DAUTHENTICATEDCHANNELTYPE ChannelType, IDirect3DAuthenticatedChannel9 **ppAuthenticatedChannel, HANDLE *pChannelHandle); + HRESULT (WINAPI *CreateCryptoSession)(IDirect3DDevice9Video *This, const GUID *pCryptoType, const GUID *pDecodeProfile, IDirect3DCryptoSession9 **ppCryptoSession, HANDLE *pCryptoHandle); +} IDirect3DDevice9VideoVtbl; +struct IDirect3DDevice9Video +{ + IDirect3DDevice9VideoVtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DDevice9Video_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice9Video_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice9Video_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DDevice9Video macros */ +#define IDirect3DDevice9Video_GetContentProtectionCaps(p,a,b,c) (p)->lpVtbl->GetContentProtectionCaps(p,a,b,c) +#define IDirect3DDevice9Video_CreateAuthenticatedChannel(p,a,b,c) (p)->lpVtbl->CreateAuthenticatedChannel(p,a,b,c) +#define IDirect3DDevice9Video_CreateCryptoSession(p,a,b,c,d) (p)->lpVtbl->CreateCryptoSession(p,a,b,c,d) + +typedef struct IDirect3DIndexBuffer9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DIndexBuffer9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DIndexBuffer9 *This); + ULONG (WINAPI *Release)(IDirect3DIndexBuffer9 *This); + /* IDirect3DResource9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DIndexBuffer9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *SetPrivateData)(IDirect3DIndexBuffer9 *This, REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags); + HRESULT (WINAPI *GetPrivateData)(IDirect3DIndexBuffer9 *This, REFGUID refguid, void *pData, DWORD *pSizeOfData); + HRESULT (WINAPI *FreePrivateData)(IDirect3DIndexBuffer9 *This, REFGUID refguid); + DWORD (WINAPI *SetPriority)(IDirect3DIndexBuffer9 *This, DWORD PriorityNew); + DWORD (WINAPI *GetPriority)(IDirect3DIndexBuffer9 *This); + void (WINAPI *PreLoad)(IDirect3DIndexBuffer9 *This); + D3DRESOURCETYPE (WINAPI *GetType)(IDirect3DIndexBuffer9 *This); + /* IDirect3DIndexBuffer9 */ + HRESULT (WINAPI *Lock)(IDirect3DIndexBuffer9 *This, UINT OffsetToLock, UINT SizeToLock, void **ppbData, DWORD Flags); + HRESULT (WINAPI *Unlock)(IDirect3DIndexBuffer9 *This); + HRESULT (WINAPI *GetDesc)(IDirect3DIndexBuffer9 *This, D3DINDEXBUFFER_DESC *pDesc); +} IDirect3DIndexBuffer9Vtbl; +struct IDirect3DIndexBuffer9 +{ + IDirect3DIndexBuffer9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DIndexBuffer9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DIndexBuffer9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DIndexBuffer9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DResource9 macros */ +#define IDirect3DIndexBuffer9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DIndexBuffer9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DIndexBuffer9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DIndexBuffer9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DIndexBuffer9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DIndexBuffer9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DIndexBuffer9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DIndexBuffer9_GetType(p) (p)->lpVtbl->GetType(p) +/* IDirect3DIndexBuffer9 macros */ +#define IDirect3DIndexBuffer9_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DIndexBuffer9_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DIndexBuffer9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) + +typedef struct IDirect3DPixelShader9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DPixelShader9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DPixelShader9 *This); + ULONG (WINAPI *Release)(IDirect3DPixelShader9 *This); + /* IDirect3DPixelShader9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DPixelShader9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *GetFunction)(IDirect3DPixelShader9 *This, void *pData, UINT *pSizeOfData); +} IDirect3DPixelShader9Vtbl; +struct IDirect3DPixelShader9 +{ + IDirect3DPixelShader9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DPixelShader9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DPixelShader9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DPixelShader9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DPixelShader9 macros */ +#define IDirect3DPixelShader9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DPixelShader9_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) + +typedef struct IDirect3DQuery9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DQuery9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DQuery9 *This); + ULONG (WINAPI *Release)(IDirect3DQuery9 *This); + /* IDirect3DQuery9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DQuery9 *This, IDirect3DDevice9 **ppDevice); + D3DQUERYTYPE (WINAPI *GetType)(IDirect3DQuery9 *This); + DWORD (WINAPI *GetDataSize)(IDirect3DQuery9 *This); + HRESULT (WINAPI *Issue)(IDirect3DQuery9 *This, DWORD dwIssueFlags); + HRESULT (WINAPI *GetData)(IDirect3DQuery9 *This, void *pData, DWORD dwSize, DWORD dwGetDataFlags); +} IDirect3DQuery9Vtbl; +struct IDirect3DQuery9 +{ + IDirect3DQuery9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DQuery9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DQuery9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DQuery9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DQuery9 macros */ +#define IDirect3DQuery9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DQuery9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DQuery9_GetDataSize(p) (p)->lpVtbl->GetDataSize(p) +#define IDirect3DQuery9_Issue(p,a) (p)->lpVtbl->Issue(p,a) +#define IDirect3DQuery9_GetData(p,a,b,c) (p)->lpVtbl->GetData(p,a,b,c) + +typedef struct IDirect3DResource9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DResource9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DResource9 *This); + ULONG (WINAPI *Release)(IDirect3DResource9 *This); + /* IDirect3DResource9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DResource9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *SetPrivateData)(IDirect3DResource9 *This, REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags); + HRESULT (WINAPI *GetPrivateData)(IDirect3DResource9 *This, REFGUID refguid, void *pData, DWORD *pSizeOfData); + HRESULT (WINAPI *FreePrivateData)(IDirect3DResource9 *This, REFGUID refguid); + DWORD (WINAPI *SetPriority)(IDirect3DResource9 *This, DWORD PriorityNew); + DWORD (WINAPI *GetPriority)(IDirect3DResource9 *This); + void (WINAPI *PreLoad)(IDirect3DResource9 *This); + D3DRESOURCETYPE (WINAPI *GetType)(IDirect3DResource9 *This); +} IDirect3DResource9Vtbl; +struct IDirect3DResource9 +{ + IDirect3DResource9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DResource9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DResource9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DResource9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DResource9 macros */ +#define IDirect3DResource9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DResource9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DResource9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DResource9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DResource9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DResource9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DResource9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DResource9_GetType(p) (p)->lpVtbl->GetType(p) + +typedef struct IDirect3DStateBlock9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DStateBlock9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DStateBlock9 *This); + ULONG (WINAPI *Release)(IDirect3DStateBlock9 *This); + /* IDirect3DStateBlock9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DStateBlock9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *Capture)(IDirect3DStateBlock9 *This); + HRESULT (WINAPI *Apply)(IDirect3DStateBlock9 *This); +} IDirect3DStateBlock9Vtbl; +struct IDirect3DStateBlock9 +{ + IDirect3DStateBlock9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DStateBlock9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DStateBlock9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DStateBlock9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DStateBlock9 macros */ +#define IDirect3DStateBlock9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DStateBlock9_Capture(p) (p)->lpVtbl->Capture(p) +#define IDirect3DStateBlock9_Apply(p) (p)->lpVtbl->Apply(p) + +typedef struct IDirect3DSurface9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DSurface9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DSurface9 *This); + ULONG (WINAPI *Release)(IDirect3DSurface9 *This); + /* IDirect3DResource9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DSurface9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *SetPrivateData)(IDirect3DSurface9 *This, REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags); + HRESULT (WINAPI *GetPrivateData)(IDirect3DSurface9 *This, REFGUID refguid, void *pData, DWORD *pSizeOfData); + HRESULT (WINAPI *FreePrivateData)(IDirect3DSurface9 *This, REFGUID refguid); + DWORD (WINAPI *SetPriority)(IDirect3DSurface9 *This, DWORD PriorityNew); + DWORD (WINAPI *GetPriority)(IDirect3DSurface9 *This); + void (WINAPI *PreLoad)(IDirect3DSurface9 *This); + D3DRESOURCETYPE (WINAPI *GetType)(IDirect3DSurface9 *This); + /* IDirect3DSurface9 */ + HRESULT (WINAPI *GetContainer)(IDirect3DSurface9 *This, REFIID riid, void **ppContainer); + HRESULT (WINAPI *GetDesc)(IDirect3DSurface9 *This, D3DSURFACE_DESC *pDesc); + HRESULT (WINAPI *LockRect)(IDirect3DSurface9 *This, D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags); + HRESULT (WINAPI *UnlockRect)(IDirect3DSurface9 *This); + HRESULT (WINAPI *GetDC)(IDirect3DSurface9 *This, HDC *phdc); + HRESULT (WINAPI *ReleaseDC)(IDirect3DSurface9 *This, HDC hdc); +} IDirect3DSurface9Vtbl; +struct IDirect3DSurface9 +{ + IDirect3DSurface9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DSurface9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSurface9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSurface9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DResource9 macros */ +#define IDirect3DSurface9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSurface9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DSurface9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DSurface9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DSurface9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DSurface9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DSurface9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DSurface9_GetType(p) (p)->lpVtbl->GetType(p) +/* IDirect3DSurface9 macros */ +#define IDirect3DSurface9_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DSurface9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DSurface9_LockRect(p,a,b,c) (p)->lpVtbl->LockRect(p,a,b,c) +#define IDirect3DSurface9_UnlockRect(p) (p)->lpVtbl->UnlockRect(p) +#define IDirect3DSurface9_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirect3DSurface9_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) + +typedef struct IDirect3DSwapChain9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DSwapChain9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DSwapChain9 *This); + ULONG (WINAPI *Release)(IDirect3DSwapChain9 *This); + /* IDirect3DSwapChain9 */ + HRESULT (WINAPI *Present)(IDirect3DSwapChain9 *This, const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion, DWORD dwFlags); + HRESULT (WINAPI *GetFrontBufferData)(IDirect3DSwapChain9 *This, IDirect3DSurface9 *pDestSurface); + HRESULT (WINAPI *GetBackBuffer)(IDirect3DSwapChain9 *This, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer); + HRESULT (WINAPI *GetRasterStatus)(IDirect3DSwapChain9 *This, D3DRASTER_STATUS *pRasterStatus); + HRESULT (WINAPI *GetDisplayMode)(IDirect3DSwapChain9 *This, D3DDISPLAYMODE *pMode); + HRESULT (WINAPI *GetDevice)(IDirect3DSwapChain9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *GetPresentParameters)(IDirect3DSwapChain9 *This, D3DPRESENT_PARAMETERS *pPresentationParameters); +} IDirect3DSwapChain9Vtbl; +struct IDirect3DSwapChain9 +{ + IDirect3DSwapChain9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DSwapChain9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSwapChain9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSwapChain9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DSwapChain9 macros */ +#define IDirect3DSwapChain9_Present(p,a,b,c,d,e) (p)->lpVtbl->Present(p,a,b,c,d,e) +#define IDirect3DSwapChain9_GetFrontBufferData(p,a) (p)->lpVtbl->GetFrontBufferData(p,a) +#define IDirect3DSwapChain9_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#define IDirect3DSwapChain9_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) +#define IDirect3DSwapChain9_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) +#define IDirect3DSwapChain9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSwapChain9_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a) + +typedef struct IDirect3DSwapChain9ExVtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DSwapChain9Ex *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DSwapChain9Ex *This); + ULONG (WINAPI *Release)(IDirect3DSwapChain9Ex *This); + /* IDirect3DSwapChain9 */ + HRESULT (WINAPI *Present)(IDirect3DSwapChain9Ex *This, const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion, DWORD dwFlags); + HRESULT (WINAPI *GetFrontBufferData)(IDirect3DSwapChain9Ex *This, IDirect3DSurface9 *pDestSurface); + HRESULT (WINAPI *GetBackBuffer)(IDirect3DSwapChain9Ex *This, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer); + HRESULT (WINAPI *GetRasterStatus)(IDirect3DSwapChain9Ex *This, D3DRASTER_STATUS *pRasterStatus); + HRESULT (WINAPI *GetDisplayMode)(IDirect3DSwapChain9Ex *This, D3DDISPLAYMODE *pMode); + HRESULT (WINAPI *GetDevice)(IDirect3DSwapChain9Ex *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *GetPresentParameters)(IDirect3DSwapChain9Ex *This, D3DPRESENT_PARAMETERS *pPresentationParameters); + /* IDirect3DSwapChain9Ex */ + HRESULT (WINAPI *GetLastPresentCount)(IDirect3DSwapChain9Ex *This, UINT *pLastPresentCount); + HRESULT (WINAPI *GetPresentStats)(IDirect3DSwapChain9Ex *This, D3DPRESENTSTATS *pPresentationStatistics); + HRESULT (WINAPI *GetDisplayModeEx)(IDirect3DSwapChain9Ex *This, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation); +} IDirect3DSwapChain9ExVtbl; +struct IDirect3DSwapChain9Ex +{ + IDirect3DSwapChain9ExVtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DSwapChain9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSwapChain9Ex_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSwapChain9Ex_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DSwapChain9 macros */ +#define IDirect3DSwapChain9Ex_Present(p,a,b,c,d,e) (p)->lpVtbl->Present(p,a,b,c,d,e) +#define IDirect3DSwapChain9Ex_GetFrontBufferData(p,a) (p)->lpVtbl->GetFrontBufferData(p,a) +#define IDirect3DSwapChain9Ex_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#define IDirect3DSwapChain9Ex_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) +#define IDirect3DSwapChain9Ex_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) +#define IDirect3DSwapChain9Ex_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSwapChain9Ex_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a) +/* IDirect3DSwapChain9Ex macros */ +#define IDirect3DSwapChain9Ex_GetLastPresentCount(p,a) (p)->lpVtbl->GetLastPresentCount(p,a) +#define IDirect3DSwapChain9Ex_GetPresentStats(p,a) (p)->lpVtbl->GetPresentStats(p,a) +#define IDirect3DSwapChain9Ex_GetDisplayModeEx(p,a,b) (p)->lpVtbl->GetDisplayModeEx(p,a,b) + +typedef struct IDirect3DTexture9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DTexture9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DTexture9 *This); + ULONG (WINAPI *Release)(IDirect3DTexture9 *This); + /* IDirect3DResource9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DTexture9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *SetPrivateData)(IDirect3DTexture9 *This, REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags); + HRESULT (WINAPI *GetPrivateData)(IDirect3DTexture9 *This, REFGUID refguid, void *pData, DWORD *pSizeOfData); + HRESULT (WINAPI *FreePrivateData)(IDirect3DTexture9 *This, REFGUID refguid); + DWORD (WINAPI *SetPriority)(IDirect3DTexture9 *This, DWORD PriorityNew); + DWORD (WINAPI *GetPriority)(IDirect3DTexture9 *This); + void (WINAPI *PreLoad)(IDirect3DTexture9 *This); + D3DRESOURCETYPE (WINAPI *GetType)(IDirect3DTexture9 *This); + /* IDirect3DBaseTexture9 */ + DWORD (WINAPI *SetLOD)(IDirect3DTexture9 *This, DWORD LODNew); + DWORD (WINAPI *GetLOD)(IDirect3DTexture9 *This); + DWORD (WINAPI *GetLevelCount)(IDirect3DTexture9 *This); + HRESULT (WINAPI *SetAutoGenFilterType)(IDirect3DTexture9 *This, D3DTEXTUREFILTERTYPE FilterType); + D3DTEXTUREFILTERTYPE (WINAPI *GetAutoGenFilterType)(IDirect3DTexture9 *This); + void (WINAPI *GenerateMipSubLevels)(IDirect3DTexture9 *This); + /* IDirect3DTexture9 */ + HRESULT (WINAPI *GetLevelDesc)(IDirect3DTexture9 *This, UINT Level, D3DSURFACE_DESC *pDesc); + HRESULT (WINAPI *GetSurfaceLevel)(IDirect3DTexture9 *This, UINT Level, IDirect3DSurface9 **ppSurfaceLevel); + HRESULT (WINAPI *LockRect)(IDirect3DTexture9 *This, UINT Level, D3DLOCKED_RECT *pLockedRect, const RECT *pRect, DWORD Flags); + HRESULT (WINAPI *UnlockRect)(IDirect3DTexture9 *This, UINT Level); + HRESULT (WINAPI *AddDirtyRect)(IDirect3DTexture9 *This, const RECT *pDirtyRect); +} IDirect3DTexture9Vtbl; +struct IDirect3DTexture9 +{ + IDirect3DTexture9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DResource9 macros */ +#define IDirect3DTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DTexture9_GetType(p) (p)->lpVtbl->GetType(p) +/* IDirect3DBaseTexture9 macros */ +#define IDirect3DTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +/* IDirect3DTexture9 macros */ +#define IDirect3DTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DTexture9_GetSurfaceLevel(p,a,b) (p)->lpVtbl->GetSurfaceLevel(p,a,b) +#define IDirect3DTexture9_LockRect(p,a,b,c,d) (p)->lpVtbl->LockRect(p,a,b,c,d) +#define IDirect3DTexture9_UnlockRect(p,a) (p)->lpVtbl->UnlockRect(p,a) +#define IDirect3DTexture9_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a) + +typedef struct IDirect3DVertexBuffer9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DVertexBuffer9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DVertexBuffer9 *This); + ULONG (WINAPI *Release)(IDirect3DVertexBuffer9 *This); + /* IDirect3DResource9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DVertexBuffer9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *SetPrivateData)(IDirect3DVertexBuffer9 *This, REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags); + HRESULT (WINAPI *GetPrivateData)(IDirect3DVertexBuffer9 *This, REFGUID refguid, void *pData, DWORD *pSizeOfData); + HRESULT (WINAPI *FreePrivateData)(IDirect3DVertexBuffer9 *This, REFGUID refguid); + DWORD (WINAPI *SetPriority)(IDirect3DVertexBuffer9 *This, DWORD PriorityNew); + DWORD (WINAPI *GetPriority)(IDirect3DVertexBuffer9 *This); + void (WINAPI *PreLoad)(IDirect3DVertexBuffer9 *This); + D3DRESOURCETYPE (WINAPI *GetType)(IDirect3DVertexBuffer9 *This); + /* IDirect3DVertexBuffer9 */ + HRESULT (WINAPI *Lock)(IDirect3DVertexBuffer9 *This, UINT OffsetToLock, UINT SizeToLock, void **ppbData, DWORD Flags); + HRESULT (WINAPI *Unlock)(IDirect3DVertexBuffer9 *This); + HRESULT (WINAPI *GetDesc)(IDirect3DVertexBuffer9 *This, D3DVERTEXBUFFER_DESC *pDesc); +} IDirect3DVertexBuffer9Vtbl; +struct IDirect3DVertexBuffer9 +{ + IDirect3DVertexBuffer9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DVertexBuffer9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexBuffer9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexBuffer9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DResource9 macros */ +#define IDirect3DVertexBuffer9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexBuffer9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVertexBuffer9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVertexBuffer9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVertexBuffer9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVertexBuffer9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVertexBuffer9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVertexBuffer9_GetType(p) (p)->lpVtbl->GetType(p) +/* IDirect3DVertexBuffer9 macros */ +#define IDirect3DVertexBuffer9_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DVertexBuffer9_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DVertexBuffer9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) + +typedef struct IDirect3DVertexDeclaration9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DVertexDeclaration9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DVertexDeclaration9 *This); + ULONG (WINAPI *Release)(IDirect3DVertexDeclaration9 *This); + /* IDirect3DVertexDeclaration9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DVertexDeclaration9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *GetDeclaration)(IDirect3DVertexDeclaration9 *This, D3DVERTEXELEMENT9 *pElement, UINT *pNumElements); +} IDirect3DVertexDeclaration9Vtbl; +struct IDirect3DVertexDeclaration9 +{ + IDirect3DVertexDeclaration9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DVertexDeclaration9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexDeclaration9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexDeclaration9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DVertexDeclaration9 macros */ +#define IDirect3DVertexDeclaration9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexDeclaration9_GetDeclaration(p,a,b) (p)->lpVtbl->GetDeclaration(p,a,b) + +typedef struct IDirect3DVertexShader9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DVertexShader9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DVertexShader9 *This); + ULONG (WINAPI *Release)(IDirect3DVertexShader9 *This); + /* IDirect3DVertexShader9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DVertexShader9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *GetFunction)(IDirect3DVertexShader9 *This, void *pData, UINT *pSizeOfData); +} IDirect3DVertexShader9Vtbl; +struct IDirect3DVertexShader9 +{ + IDirect3DVertexShader9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DVertexShader9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexShader9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexShader9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DVertexShader9 macros */ +#define IDirect3DVertexShader9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexShader9_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) + +typedef struct IDirect3DVolume9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DVolume9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DVolume9 *This); + ULONG (WINAPI *Release)(IDirect3DVolume9 *This); + /* IDirect3DVolume9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DVolume9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *SetPrivateData)(IDirect3DVolume9 *This, REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags); + HRESULT (WINAPI *GetPrivateData)(IDirect3DVolume9 *This, REFGUID refguid, void *pData, DWORD *pSizeOfData); + HRESULT (WINAPI *FreePrivateData)(IDirect3DVolume9 *This, REFGUID refguid); + HRESULT (WINAPI *GetContainer)(IDirect3DVolume9 *This, REFIID riid, void **ppContainer); + HRESULT (WINAPI *GetDesc)(IDirect3DVolume9 *This, D3DVOLUME_DESC *pDesc); + HRESULT (WINAPI *LockBox)(IDirect3DVolume9 *This, D3DLOCKED_BOX *pLockedVolume, const D3DBOX *pBox, DWORD Flags); + HRESULT (WINAPI *UnlockBox)(IDirect3DVolume9 *This); +} IDirect3DVolume9Vtbl; +struct IDirect3DVolume9 +{ + IDirect3DVolume9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DVolume9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolume9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolume9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DVolume9 macros */ +#define IDirect3DVolume9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolume9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolume9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolume9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolume9_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DVolume9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DVolume9_LockBox(p,a,b,c) (p)->lpVtbl->LockBox(p,a,b,c) +#define IDirect3DVolume9_UnlockBox(p) (p)->lpVtbl->UnlockBox(p) + +typedef struct IDirect3DVolumeTexture9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IDirect3DVolumeTexture9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IDirect3DVolumeTexture9 *This); + ULONG (WINAPI *Release)(IDirect3DVolumeTexture9 *This); + /* IDirect3DResource9 */ + HRESULT (WINAPI *GetDevice)(IDirect3DVolumeTexture9 *This, IDirect3DDevice9 **ppDevice); + HRESULT (WINAPI *SetPrivateData)(IDirect3DVolumeTexture9 *This, REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags); + HRESULT (WINAPI *GetPrivateData)(IDirect3DVolumeTexture9 *This, REFGUID refguid, void *pData, DWORD *pSizeOfData); + HRESULT (WINAPI *FreePrivateData)(IDirect3DVolumeTexture9 *This, REFGUID refguid); + DWORD (WINAPI *SetPriority)(IDirect3DVolumeTexture9 *This, DWORD PriorityNew); + DWORD (WINAPI *GetPriority)(IDirect3DVolumeTexture9 *This); + void (WINAPI *PreLoad)(IDirect3DVolumeTexture9 *This); + D3DRESOURCETYPE (WINAPI *GetType)(IDirect3DVolumeTexture9 *This); + /* IDirect3DBaseTexture9 */ + DWORD (WINAPI *SetLOD)(IDirect3DVolumeTexture9 *This, DWORD LODNew); + DWORD (WINAPI *GetLOD)(IDirect3DVolumeTexture9 *This); + DWORD (WINAPI *GetLevelCount)(IDirect3DVolumeTexture9 *This); + HRESULT (WINAPI *SetAutoGenFilterType)(IDirect3DVolumeTexture9 *This, D3DTEXTUREFILTERTYPE FilterType); + D3DTEXTUREFILTERTYPE (WINAPI *GetAutoGenFilterType)(IDirect3DVolumeTexture9 *This); + void (WINAPI *GenerateMipSubLevels)(IDirect3DVolumeTexture9 *This); + /* IDirect3DVolumeTexture9 */ + HRESULT (WINAPI *GetLevelDesc)(IDirect3DVolumeTexture9 *This, UINT Level, D3DVOLUME_DESC *pDesc); + HRESULT (WINAPI *GetVolumeLevel)(IDirect3DVolumeTexture9 *This, UINT Level, IDirect3DVolume9 **ppVolumeLevel); + HRESULT (WINAPI *LockBox)(IDirect3DVolumeTexture9 *This, UINT Level, D3DLOCKED_BOX *pLockedVolume, const D3DBOX *pBox, DWORD Flags); + HRESULT (WINAPI *UnlockBox)(IDirect3DVolumeTexture9 *This, UINT Level); + HRESULT (WINAPI *AddDirtyBox)(IDirect3DVolumeTexture9 *This, const D3DBOX *pDirtyBox); +} IDirect3DVolumeTexture9Vtbl; +struct IDirect3DVolumeTexture9 +{ + IDirect3DVolumeTexture9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IDirect3DVolumeTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolumeTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolumeTexture9_Release(p) (p)->lpVtbl->Release(p) +/* IDirect3DResource9 macros */ +#define IDirect3DVolumeTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolumeTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolumeTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolumeTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolumeTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVolumeTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVolumeTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVolumeTexture9_GetType(p) (p)->lpVtbl->GetType(p) +/* IDirect3DBaseTexture9 macros */ +#define IDirect3DVolumeTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DVolumeTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DVolumeTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DVolumeTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DVolumeTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DVolumeTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +/* IDirect3DVolumeTexture9 macros */ +#define IDirect3DVolumeTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DVolumeTexture9_GetVolumeLevel(p,a,b) (p)->lpVtbl->GetVolumeLevel(p,a,b) +#define IDirect3DVolumeTexture9_LockBox(p,a,b,c,d) (p)->lpVtbl->LockBox(p,a,b,c,d) +#define IDirect3DVolumeTexture9_UnlockBox(p,a) (p)->lpVtbl->UnlockBox(p,a) +#define IDirect3DVolumeTexture9_AddDirtyBox(p,a) (p)->lpVtbl->AddDirtyBox(p,a) + +#endif /* __cplusplus */ + +#ifdef _WIN32 + +IDirect3D9 *WINAPI +Direct3DCreate9( UINT SDKVersion ); + +HRESULT WINAPI +Direct3DCreate9Ex( UINT SDKVersion, + IDirect3D9Ex **ppD3D9 ); + +void *WINAPI +Direct3DShaderValidatorCreate9( void ); + +int WINAPI +D3DPERF_BeginEvent( D3DCOLOR color, + LPCWSTR name ); + +int WINAPI +D3DPERF_EndEvent( void ); + +DWORD WINAPI +D3DPERF_GetStatus( void ); + +void WINAPI +D3DPERF_SetOptions( DWORD options ); + +BOOL WINAPI +D3DPERF_QueryRepeatFrame( void ); + +void WINAPI +D3DPERF_SetMarker( D3DCOLOR color, + LPCWSTR name ); + +void WINAPI +D3DPERF_SetRegion( D3DCOLOR color, + LPCWSTR name ); + +void WINAPI +DebugSetMute( void ); + +#endif + +#endif /* _D3D9_H_ */ diff --git a/mesalib/include/D3D9/d3d9caps.h b/mesalib/include/D3D9/d3d9caps.h new file mode 100644 index 000000000..0cce5d3f6 --- /dev/null +++ b/mesalib/include/D3D9/d3d9caps.h @@ -0,0 +1,387 @@ +/* + * Copyright 2011 Joakim Sindholt <opensource@zhasha.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _D3D9CAPS_H_ +#define _D3D9CAPS_H_ + +#include "d3d9types.h" + +/* Caps flags */ +#define D3DCAPS2_FULLSCREENGAMMA 0x00020000 +#define D3DCAPS2_CANCALIBRATEGAMMA 0x00100000 +#define D3DCAPS2_RESERVED 0x02000000 +#define D3DCAPS2_CANMANAGERESOURCE 0x10000000 +#define D3DCAPS2_DYNAMICTEXTURES 0x20000000 +#define D3DCAPS2_CANAUTOGENMIPMAP 0x40000000 +#define D3DCAPS2_CANSHARERESOURCE 0x80000000 + +#define D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD 0x00000020 +#define D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION 0x00000080 +#define D3DCAPS3_COPY_TO_VIDMEM 0x00000100 +#define D3DCAPS3_COPY_TO_SYSTEMMEM 0x00000200 +#define D3DCAPS3_DXVAHD 0x00000400 +#define D3DCAPS3_RESERVED 0x8000001F + +#define D3DPRESENT_INTERVAL_DEFAULT 0x00000000 +#define D3DPRESENT_INTERVAL_ONE 0x00000001 +#define D3DPRESENT_INTERVAL_TWO 0x00000002 +#define D3DPRESENT_INTERVAL_THREE 0x00000004 +#define D3DPRESENT_INTERVAL_FOUR 0x00000008 +#define D3DPRESENT_INTERVAL_IMMEDIATE 0x80000000 + +#define D3DCURSORCAPS_COLOR 0x00000001 +#define D3DCURSORCAPS_LOWRES 0x00000002 + +#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010 +#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020 +#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040 +#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080 +#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100 +#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200 +#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400 +#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800 +#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000 +#define D3DDEVCAPS_DRAWPRIMITIVES2 0x00002000 +#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000 +#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000 +#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000 +#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000 +#define D3DDEVCAPS_HWRASTERIZATION 0x00080000 +#define D3DDEVCAPS_PUREDEVICE 0x00100000 +#define D3DDEVCAPS_QUINTICRTPATCHES 0x00200000 +#define D3DDEVCAPS_RTPATCHES 0x00400000 +#define D3DDEVCAPS_RTPATCHHANDLEZERO 0x00800000 +#define D3DDEVCAPS_NPATCHES 0x01000000 + +#define D3DPMISCCAPS_MASKZ 0x00000002 +#define D3DPMISCCAPS_CULLNONE 0x00000010 +#define D3DPMISCCAPS_CULLCW 0x00000020 +#define D3DPMISCCAPS_CULLCCW 0x00000040 +#define D3DPMISCCAPS_COLORWRITEENABLE 0x00000080 +#define D3DPMISCCAPS_CLIPPLANESCALEDPOINTS 0x00000100 +#define D3DPMISCCAPS_CLIPTLVERTS 0x00000200 +#define D3DPMISCCAPS_TSSARGTEMP 0x00000400 +#define D3DPMISCCAPS_BLENDOP 0x00000800 +#define D3DPMISCCAPS_NULLREFERENCE 0x00001000 +#define D3DPMISCCAPS_INDEPENDENTWRITEMASKS 0x00004000 +#define D3DPMISCCAPS_PERSTAGECONSTANT 0x00008000 +#define D3DPMISCCAPS_FOGANDSPECULARALPHA 0x00010000 +#define D3DPMISCCAPS_SEPARATEALPHABLEND 0x00020000 +#define D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS 0x00040000 +#define D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING 0x00080000 +#define D3DPMISCCAPS_FOGVERTEXCLAMPED 0x00100000 +#define D3DPMISCCAPS_POSTBLENDSRGBCONVERT 0x00200000 + +#define D3DPRASTERCAPS_DITHER 0x00000001 +#define D3DPRASTERCAPS_ZTEST 0x00000010 +#define D3DPRASTERCAPS_FOGVERTEX 0x00000080 +#define D3DPRASTERCAPS_FOGTABLE 0x00000100 +#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000 +#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000 +#define D3DPRASTERCAPS_FOGRANGE 0x00010000 +#define D3DPRASTERCAPS_ANISOTROPY 0x00020000 +#define D3DPRASTERCAPS_WBUFFER 0x00040000 +#define D3DPRASTERCAPS_WFOG 0x00100000 +#define D3DPRASTERCAPS_ZFOG 0x00200000 +#define D3DPRASTERCAPS_COLORPERSPECTIVE 0x00400000 +#define D3DPRASTERCAPS_SCISSORTEST 0x01000000 +#define D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS 0x02000000 +#define D3DPRASTERCAPS_DEPTHBIAS 0x04000000 +#define D3DPRASTERCAPS_MULTISAMPLE_TOGGLE 0x08000000 + +#define D3DPCMPCAPS_NEVER 0x00000001 +#define D3DPCMPCAPS_LESS 0x00000002 +#define D3DPCMPCAPS_EQUAL 0x00000004 +#define D3DPCMPCAPS_LESSEQUAL 0x00000008 +#define D3DPCMPCAPS_GREATER 0x00000010 +#define D3DPCMPCAPS_NOTEQUAL 0x00000020 +#define D3DPCMPCAPS_GREATEREQUAL 0x00000040 +#define D3DPCMPCAPS_ALWAYS 0x00000080 + +#define D3DPBLENDCAPS_ZERO 0x00000001 +#define D3DPBLENDCAPS_ONE 0x00000002 +#define D3DPBLENDCAPS_SRCCOLOR 0x00000004 +#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008 +#define D3DPBLENDCAPS_SRCALPHA 0x00000010 +#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020 +#define D3DPBLENDCAPS_DESTALPHA 0x00000040 +#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080 +#define D3DPBLENDCAPS_DESTCOLOR 0x00000100 +#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200 +#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400 +#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800 +#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000 +#define D3DPBLENDCAPS_BLENDFACTOR 0x00002000 +#ifndef D3D_DISABLE_9EX +# define D3DPBLENDCAPS_SRCCOLOR2 0x00004000 +# define D3DPBLENDCAPS_INVSRCCOLOR2 0x00008000 +#endif + +#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008 +#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200 +#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000 +#define D3DPSHADECAPS_FOGGOURAUD 0x00080000 + +#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001 +#define D3DPTEXTURECAPS_POW2 0x00000002 +#define D3DPTEXTURECAPS_ALPHA 0x00000004 +#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020 +#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040 +#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080 +#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100 +#define D3DPTEXTURECAPS_PROJECTED 0x00000400 +#define D3DPTEXTURECAPS_CUBEMAP 0x00000800 +#define D3DPTEXTURECAPS_VOLUMEMAP 0x00002000 +#define D3DPTEXTURECAPS_MIPMAP 0x00004000 +#define D3DPTEXTURECAPS_MIPVOLUMEMAP 0x00008000 +#define D3DPTEXTURECAPS_MIPCUBEMAP 0x00010000 +#define D3DPTEXTURECAPS_CUBEMAP_POW2 0x00020000 +#define D3DPTEXTURECAPS_VOLUMEMAP_POW2 0x00040000 +#define D3DPTEXTURECAPS_NOPROJECTEDBUMPENV 0x00200000 + +#define D3DPTFILTERCAPS_MINFPOINT 0x00000100 +#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200 +#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400 +#define D3DPTFILTERCAPS_MINFPYRAMIDALQUAD 0x00000800 +#define D3DPTFILTERCAPS_MINFGAUSSIANQUAD 0x00001000 +#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000 +#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000 +#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000 +#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000 +#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000 +#define D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD 0x08000000 +#define D3DPTFILTERCAPS_MAGFGAUSSIANQUAD 0x10000000 + +#define D3DPTADDRESSCAPS_WRAP 0x00000001 +#define D3DPTADDRESSCAPS_MIRROR 0x00000002 +#define D3DPTADDRESSCAPS_CLAMP 0x00000004 +#define D3DPTADDRESSCAPS_BORDER 0x00000008 +#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010 +#define D3DPTADDRESSCAPS_MIRRORONCE 0x00000020 + +#define D3DLINECAPS_TEXTURE 0x00000001 +#define D3DLINECAPS_ZTEST 0x00000002 +#define D3DLINECAPS_BLEND 0x00000004 +#define D3DLINECAPS_ALPHACMP 0x00000008 +#define D3DLINECAPS_FOG 0x00000010 +#define D3DLINECAPS_ANTIALIAS 0x00000020 + +#define D3DSTENCILCAPS_KEEP 0x00000001 +#define D3DSTENCILCAPS_ZERO 0x00000002 +#define D3DSTENCILCAPS_REPLACE 0x00000004 +#define D3DSTENCILCAPS_INCRSAT 0x00000008 +#define D3DSTENCILCAPS_DECRSAT 0x00000010 +#define D3DSTENCILCAPS_INVERT 0x00000020 +#define D3DSTENCILCAPS_INCR 0x00000040 +#define D3DSTENCILCAPS_DECR 0x00000080 +#define D3DSTENCILCAPS_TWOSIDED 0x00000100 + +#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000FFFF +#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000 +#define D3DFVFCAPS_PSIZE 0x00100000 + +#define D3DTEXOPCAPS_DISABLE 0x00000001 +#define D3DTEXOPCAPS_SELECTARG1 0x00000002 +#define D3DTEXOPCAPS_SELECTARG2 0x00000004 +#define D3DTEXOPCAPS_MODULATE 0x00000008 +#define D3DTEXOPCAPS_MODULATE2X 0x00000010 +#define D3DTEXOPCAPS_MODULATE4X 0x00000020 +#define D3DTEXOPCAPS_ADD 0x00000040 +#define D3DTEXOPCAPS_ADDSIGNED 0x00000080 +#define D3DTEXOPCAPS_ADDSIGNED2X 0x00000100 +#define D3DTEXOPCAPS_SUBTRACT 0x00000200 +#define D3DTEXOPCAPS_ADDSMOOTH 0x00000400 +#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800 +#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000 +#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000 +#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000 +#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000 +#define D3DTEXOPCAPS_PREMODULATE 0x00010000 +#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000 +#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000 +#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000 +#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000 +#define D3DTEXOPCAPS_BUMPENVMAP 0x00200000 +#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000 +#define D3DTEXOPCAPS_DOTPRODUCT3 0x00800000 +#define D3DTEXOPCAPS_MULTIPLYADD 0x01000000 +#define D3DTEXOPCAPS_LERP 0x02000000 + +#define D3DVTXPCAPS_TEXGEN 0x00000001 +#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002 +#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008 +#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010 +#define D3DVTXPCAPS_LOCALVIEWER 0x00000020 +#define D3DVTXPCAPS_TWEENING 0x00000040 +#define D3DVTXPCAPS_TEXGEN_SPHEREMAP 0x00000100 +#define D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER 0x00000200 + +#define D3DDEVCAPS2_STREAMOFFSET 0x00000001 +#define D3DDEVCAPS2_DMAPNPATCH 0x00000002 +#define D3DDEVCAPS2_ADAPTIVETESSRTPATCH 0x00000004 +#define D3DDEVCAPS2_ADAPTIVETESSNPATCH 0x00000008 +#define D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES 0x00000010 +#define D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH 0x00000020 +#define D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET 0x00000040 + +#define D3DDTCAPS_UBYTE4 0x00000001 +#define D3DDTCAPS_UBYTE4N 0x00000002 +#define D3DDTCAPS_SHORT2N 0x00000004 +#define D3DDTCAPS_SHORT4N 0x00000008 +#define D3DDTCAPS_USHORT2N 0x00000010 +#define D3DDTCAPS_USHORT4N 0x00000020 +#define D3DDTCAPS_UDEC3 0x00000040 +#define D3DDTCAPS_DEC3N 0x00000080 +#define D3DDTCAPS_FLOAT16_2 0x00000100 +#define D3DDTCAPS_FLOAT16_4 0x00000200 + + +#define D3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH 24 +#define D3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH 0 +#define D3DVS20_MAX_NUMTEMPS 32 +#define D3DVS20_MIN_NUMTEMPS 12 +#define D3DVS20_MAX_STATICFLOWCONTROLDEPTH 4 +#define D3DVS20_MIN_STATICFLOWCONTROLDEPTH 1 + +#define D3DVS20CAPS_PREDICATION (1 << 0) + +#define D3DPS20CAPS_ARBITRARYSWIZZLE (1 << 0) +#define D3DPS20CAPS_GRADIENTINSTRUCTIONS (1 << 1) +#define D3DPS20CAPS_PREDICATION (1 << 2) +#define D3DPS20CAPS_NODEPENDENTREADLIMIT (1 << 3) +#define D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT (1 << 4) + +#define D3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH 24 +#define D3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH 0 +#define D3DPS20_MAX_NUMTEMPS 32 +#define D3DPS20_MIN_NUMTEMPS 12 +#define D3DPS20_MAX_STATICFLOWCONTROLDEPTH 4 +#define D3DPS20_MIN_STATICFLOWCONTROLDEPTH 0 +#define D3DPS20_MAX_NUMINSTRUCTIONSLOTS 512 +#define D3DPS20_MIN_NUMINSTRUCTIONSLOTS 96 + +#define D3DMIN30SHADERINSTRUCTIONS 512 +#define D3DMAX30SHADERINSTRUCTIONS 32768 + +/* Structs */ +typedef struct _D3DVSHADERCAPS2_0 { + DWORD Caps; + INT DynamicFlowControlDepth; + INT NumTemps; + INT StaticFlowControlDepth; +} D3DVSHADERCAPS2_0, *PD3DVSHADERCAPS2_0, *LPD3DVSHADERCAPS2_0; + +typedef struct _D3DPSHADERCAPS2_0 { + DWORD Caps; + INT DynamicFlowControlDepth; + INT NumTemps; + INT StaticFlowControlDepth; + INT NumInstructionSlots; +} D3DPSHADERCAPS2_0, *PD3DPSHADERCAPS2_0, *LPD3DPSHADERCAPS2_0; + +typedef struct _D3DCAPS9 { + D3DDEVTYPE DeviceType; + UINT AdapterOrdinal; + DWORD Caps; + DWORD Caps2; + DWORD Caps3; + DWORD PresentationIntervals; + DWORD CursorCaps; + DWORD DevCaps; + DWORD PrimitiveMiscCaps; + DWORD RasterCaps; + DWORD ZCmpCaps; + DWORD SrcBlendCaps; + DWORD DestBlendCaps; + DWORD AlphaCmpCaps; + DWORD ShadeCaps; + DWORD TextureCaps; + DWORD TextureFilterCaps; + DWORD CubeTextureFilterCaps; + DWORD VolumeTextureFilterCaps; + DWORD TextureAddressCaps; + DWORD VolumeTextureAddressCaps; + DWORD LineCaps; + DWORD MaxTextureWidth; + DWORD MaxTextureHeight; + DWORD MaxVolumeExtent; + DWORD MaxTextureRepeat; + DWORD MaxTextureAspectRatio; + DWORD MaxAnisotropy; + float MaxVertexW; + float GuardBandLeft; + float GuardBandTop; + float GuardBandRight; + float GuardBandBottom; + float ExtentsAdjust; + DWORD StencilCaps; + DWORD FVFCaps; + DWORD TextureOpCaps; + DWORD MaxTextureBlendStages; + DWORD MaxSimultaneousTextures; + DWORD VertexProcessingCaps; + DWORD MaxActiveLights; + DWORD MaxUserClipPlanes; + DWORD MaxVertexBlendMatrices; + DWORD MaxVertexBlendMatrixIndex; + float MaxPointSize; + DWORD MaxPrimitiveCount; + DWORD MaxVertexIndex; + DWORD MaxStreams; + DWORD MaxStreamStride; + DWORD VertexShaderVersion; + DWORD MaxVertexShaderConst; + DWORD PixelShaderVersion; + float PixelShader1xMaxValue; + DWORD DevCaps2; + float MaxNpatchTessellationLevel; + DWORD Reserved5; + UINT MasterAdapterOrdinal; + UINT AdapterOrdinalInGroup; + UINT NumberOfAdaptersInGroup; + DWORD DeclTypes; + DWORD NumSimultaneousRTs; + DWORD StretchRectFilterCaps; + D3DVSHADERCAPS2_0 VS20Caps; + D3DPSHADERCAPS2_0 PS20Caps; + DWORD VertexTextureFilterCaps; + DWORD MaxVShaderInstructionsExecuted; + DWORD MaxPShaderInstructionsExecuted; + DWORD MaxVertexShader30InstructionSlots; + DWORD MaxPixelShader30InstructionSlots; +} D3DCAPS9, *PD3DCAPS9, *LPD3DCAPS9; + +typedef struct _D3DCONTENTPROTECTIONCAPS { + DWORD Caps; + GUID KeyExchangeType; + UINT BufferAlignmentStart; + UINT BlockAlignmentSize; + ULONGLONG ProtectedMemorySize; +} D3DCONTENTPROTECTIONCAPS, *PD3DCONTENTPROTECTIONCAPS, *LPD3DCONTENTPROTECTIONCAPS; + +typedef struct _D3DOVERLAYCAPS { + UINT Caps; + UINT MaxOverlayDisplayWidth; + UINT MaxOverlayDisplayHeight; +} D3DOVERLAYCAPS, *PD3DOVERLAYCAPS, *LPD3DOVERLAYCAPS; + +#endif /* _D3D9CAPS_H_ */ diff --git a/mesalib/include/D3D9/d3d9types.h b/mesalib/include/D3D9/d3d9types.h new file mode 100644 index 000000000..0a8f9e580 --- /dev/null +++ b/mesalib/include/D3D9/d3d9types.h @@ -0,0 +1,1797 @@ +/* + * Copyright 2011 Joakim Sindholt <opensource@zhasha.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _D3D9TYPES_H_ +#define _D3D9TYPES_H_ + +#ifdef _WIN32 +#include <windows.h> +#else /* _WIN32 */ +#include <stdint.h> + +#ifndef NULL +#define NULL 0 +#endif + +/******************************************************** + * Windows types * + ********************************************************/ +/* Function macros */ +#define FAILED(x) ((HRESULT)(x) < 0) +#define SUCCEEDED(x) ((HRESULT)(x) >= 0) + +#define MAKE_HRESULT(sev,fac,code) \ + ( \ + ((HRESULT)(sev) << 31) | \ + ((HRESULT)(fac) << 16) | \ + (HRESULT)(code) \ + ) + +/* Windows errors */ +#define E_OUTOFMEMORY MAKE_HRESULT(1, 0x007, 14) +#define E_NOINTERFACE MAKE_HRESULT(1, 0x000, 0x4002) +#define E_POINTER MAKE_HRESULT(1, 0x000, 0x4003) + +#define S_OK ((HRESULT)0) +#define S_FALSE ((HRESULT)1) + +/* WORD types */ +typedef uint8_t BYTE; +typedef uint16_t WORD; +typedef uint32_t DWORD; + +/* Renamed types */ +typedef int BOOL; +#ifndef FALSE +#define FALSE 0 +#define TRUE (!FALSE) +#endif + +typedef uint32_t UINT32; +typedef uint64_t UINT64; + +typedef unsigned short USHORT; +typedef unsigned int UINT; +typedef unsigned int ULONG; +typedef unsigned long long ULONGLONG; + +typedef short SHORT; +typedef int INT; +typedef int LONG; +typedef long long LONGLONG; +typedef float FLOAT; + +/* Windows types */ +typedef void *HANDLE; +typedef int32_t HRESULT; +typedef HANDLE HWND; +typedef HANDLE HMONITOR; +typedef HANDLE HDC; + +/* Unions */ +typedef union { + struct { + DWORD LowPart; + LONG HighPart; + }; + + struct { + DWORD LowPart; + LONG HighPart; + } u; + + LONGLONG QuadPart; +} LARGE_INTEGER, *LPLARGE_INTEGER; + +/* Structs */ + +typedef struct _GUID { + DWORD Data1; + WORD Data2; + WORD Data3; + BYTE Data4[8]; +} GUID, IID, *LPGUID, *REFGUID, *REFIID; + +typedef struct _LUID { + DWORD LowPart; + LONG HighPart; +} LUID, *LPLUID, *PLUID; + +typedef struct _PALETTEENTRY { + BYTE peRed; + BYTE peGreen; + BYTE peBlue; + BYTE peFlags; +} PALETTEENTRY, *LPPALETTEENTRY; + +typedef struct _POINT { + LONG x; + LONG y; +} POINT, *LPPOINT; + +typedef struct _RECT { + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECT, *LPRECT; + +typedef struct _RGNDATAHEADER { + DWORD dwSize; + DWORD iType; + DWORD nCount; + DWORD nRgnSize; + RECT rcBound; +} RGNDATAHEADER, *LPRGNDATAHEADER; + +typedef struct _RGNDATA { + RGNDATAHEADER rdh; + char Buffer[1]; +} RGNDATA, *LPRGNDATA; +#endif /* _WIN32 */ + +#ifndef MAKEFOURCC +#define MAKEFOURCC(a, b, c, d) \ + ( \ + (DWORD)(BYTE)(a) | \ + ((DWORD)(BYTE)(b) << 8) | \ + ((DWORD)(BYTE)(c) << 16) | \ + ((DWORD)(BYTE)(d) << 24) \ + ) +#endif /* MAKEFOURCC */ + + +#define D3DPRESENTFLAG_LOCKABLE_BACKBUFFER 0x00000001 +#define D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL 0x00000002 +#define D3DPRESENTFLAG_DEVICECLIP 0x00000004 +#define D3DPRESENTFLAG_VIDEO 0x00000010 +#define D3DPRESENTFLAG_NOAUTOROTATE 0x00000020 +#define D3DPRESENTFLAG_UNPRUNEDMODE 0x00000040 +#define D3DPRESENTFLAG_OVERLAY_LIMITEDRGB 0x00000080 +#define D3DPRESENTFLAG_OVERLAY_YCbCr_BT709 0x00000100 +#define D3DPRESENTFLAG_OVERLAY_YCbCr_xvYCC 0x00000200 +#define D3DPRESENTFLAG_RESTRICTED_CONTENT 0x00000400 +#define D3DPRESENTFLAG_RESTRICT_SHARED_RESOURCE_DRIVER 0x00000800 + + +#ifdef WINAPI +#undef WINAPI +#endif /* WINAPI*/ + +#if defined(__x86_64__) || defined(_M_X64) +#define WINAPI __attribute__((ms_abi)) +#else /* x86_64 */ +#define WINAPI __attribute__((__stdcall__)) +#endif /* x86_64 */ + +/* Implementation caps */ +#define D3DPRESENT_BACK_BUFFERS_MAX 3 +#define D3DPRESENT_BACK_BUFFERS_MAX_EX 30 + +/* Functions */ +#define MAKE_D3DHRESULT(code) MAKE_HRESULT(1, 0x876, code) +#define MAKE_D3DSTATUS(code) MAKE_HRESULT(0, 0x876, code) + +/* SDK version */ +#define D3D_SDK_VERSION 32 + +/* Adapter */ +#define D3DADAPTER_DEFAULT 0 + +/******************************************************** + * Return codes * + ********************************************************/ +#define D3D_OK S_OK +#define D3DOK_NOAUTOGEN MAKE_D3DSTATUS(2159) +#define D3DERR_OUTOFVIDEOMEMORY MAKE_D3DHRESULT(380) +#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540) +#define D3DERR_WRONGTEXTUREFORMAT MAKE_D3DHRESULT(2072) +#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT(2073) +#define D3DERR_UNSUPPORTEDCOLORARG MAKE_D3DHRESULT(2074) +#define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_D3DHRESULT(2075) +#define D3DERR_UNSUPPORTEDALPHAARG MAKE_D3DHRESULT(2076) +#define D3DERR_TOOMANYOPERATIONS MAKE_D3DHRESULT(2077) +#define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_D3DHRESULT(2078) +#define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_D3DHRESULT(2079) +#define D3DERR_CONFLICTINGRENDERSTATE MAKE_D3DHRESULT(2081) +#define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_D3DHRESULT(2082) +#define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_D3DHRESULT(2086) +#define D3DERR_DRIVERINTERNALERROR MAKE_D3DHRESULT(2087) +#define D3DERR_NOTFOUND MAKE_D3DHRESULT(2150) +#define D3DERR_MOREDATA MAKE_D3DHRESULT(2151) +#define D3DERR_DEVICELOST MAKE_D3DHRESULT(2152) +#define D3DERR_DEVICENOTRESET MAKE_D3DHRESULT(2153) +#define D3DERR_NOTAVAILABLE MAKE_D3DHRESULT(2154) +#define D3DERR_INVALIDDEVICE MAKE_D3DHRESULT(2155) +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#define D3DERR_DRIVERINVALIDCALL MAKE_D3DHRESULT(2157) + +/******************************************************** + * Bitmasks * + *******************************************************/ +/* IDirect3DDevice9::Clear */ +#define D3DCLEAR_TARGET 0x00000001 +#define D3DCLEAR_ZBUFFER 0x00000002 +#define D3DCLEAR_STENCIL 0x00000004 + +/* Usage */ +/* http://msdn.microsoft.com/en-us/library/ee416659(VS.85).aspx */ +#define D3DUSAGE_RENDERTARGET 0x00000001 +#define D3DUSAGE_DEPTHSTENCIL 0x00000002 +#define D3DUSAGE_WRITEONLY 0x00000008 +#define D3DUSAGE_SOFTWAREPROCESSING 0x00000010 +#define D3DUSAGE_DONOTCLIP 0x00000020 +#define D3DUSAGE_POINTS 0x00000040 +#define D3DUSAGE_RTPATCHES 0x00000080 +#define D3DUSAGE_NPATCHES 0x00000100 +#define D3DUSAGE_DYNAMIC 0x00000200 +#define D3DUSAGE_AUTOGENMIPMAP 0x00000400 +#ifndef D3D_DISABLE_9EX +#define D3DUSAGE_RESTRICTED_CONTENT 0x00000800 +#define D3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER 0x00001000 +#define D3DUSAGE_RESTRICT_SHARED_RESOURCE 0x00002000 +#endif +#define D3DUSAGE_DMAP 0x00004000 +#define D3DUSAGE_QUERY_LEGACYBUMPMAP 0x00008000 +#define D3DUSAGE_QUERY_SRGBREAD 0x00010000 +#define D3DUSAGE_QUERY_FILTER 0x00020000 +#define D3DUSAGE_QUERY_SRGBWRITE 0x00040000 +#define D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING 0x00080000 +#define D3DUSAGE_QUERY_VERTEXTEXTURE 0x00100000 +#define D3DUSAGE_QUERY_WRAPANDMIP 0x00200000 +#ifndef D3D_DISABLE_9EX +#define D3DUSAGE_NONSECURE 0x00800000 +#define D3DUSAGE_TEXTAPI 0x10000000 +#endif + +/* Buffer locking */ +/* http://msdn.microsoft.com/en-us/library/ee416503(VS.85).aspx */ +#define D3DLOCK_READONLY 0x00000010 +#define D3DLOCK_NOSYSLOCK 0x00000800 +#define D3DLOCK_NOOVERWRITE 0x00001000 +#define D3DLOCK_DISCARD 0x00002000 +#define D3DLOCK_DONOTWAIT 0x00004000 +#define D3DLOCK_NO_DIRTY_UPDATE 0x00008000 + +/* FVF */ +/* http://msdn.microsoft.com/en-us/library/ee416490(VS.85).aspx */ +/* http://msdn.microsoft.com/en-us/library/ms791638.aspx */ +#define D3DFVF_XYZ 0x00000002 +#define D3DFVF_XYZRHW 0x00000004 +#define D3DFVF_XYZB1 0x00000006 +#define D3DFVF_XYZB2 0x00000008 +#define D3DFVF_XYZB3 0x0000000A +#define D3DFVF_XYZB4 0x0000000C +#define D3DFVF_XYZB5 0x0000000E +#define D3DFVF_XYZW 0x00004002 +#define D3DFVF_POSITION_MASK 0x0000400E + +#define D3DFVF_NORMAL 0x00000010 +#define D3DFVF_PSIZE 0x00000020 +#define D3DFVF_DIFFUSE 0x00000040 +#define D3DFVF_SPECULAR 0x00000080 + +#define D3DFVF_TEX0 0x00000000 +#define D3DFVF_TEX1 0x00000100 +#define D3DFVF_TEX2 0x00000200 +#define D3DFVF_TEX3 0x00000300 +#define D3DFVF_TEX4 0x00000400 +#define D3DFVF_TEX5 0x00000500 +#define D3DFVF_TEX6 0x00000600 +#define D3DFVF_TEX7 0x00000700 +#define D3DFVF_TEX8 0x00000800 +#define D3DFVF_TEXCOUNT_MASK 0x00000F00 +#define D3DFVF_TEXCOUNT_SHIFT 8 +#define D3DFVF_TEXTUREFORMAT1 0x00000003 +#define D3DFVF_TEXTUREFORMAT2 0x00000000 +#define D3DFVF_TEXTUREFORMAT3 0x00000001 +#define D3DFVF_TEXTUREFORMAT4 0x00000002 + +#define D3DFVF_POSITION_MASK 0x0000400E +#define D3DFVF_TEXCOUNT_MASK 0x00000F00 +#define D3DFVF_TEXCOUNT_SHIFT 8 + +#define D3DFVF_LASTBETA_UBYTE4 0x00001000 +#define D3DFVF_LASTBETA_D3DCOLOR 0x00008000 + +#define D3DFVF_RESERVED0 0x00000001 +#define D3DFVF_RESERVED2 0x00006000 + +#define D3DTA_SELECTMASK 0x0000000f +#define D3DTA_DIFFUSE 0x00000000 +#define D3DTA_CURRENT 0x00000001 +#define D3DTA_TEXTURE 0x00000002 +#define D3DTA_TFACTOR 0x00000003 +#define D3DTA_SPECULAR 0x00000004 +#define D3DTA_TEMP 0x00000005 +#define D3DTA_CONSTANT 0x00000006 +#define D3DTA_COMPLEMENT 0x00000010 +#define D3DTA_ALPHAREPLICATE 0x00000020 + +#define D3DSPD_IUNKNOWN 0x00000001 + +#define D3DPRESENT_DONOTWAIT 0x00000001 +#define D3DPRESENT_LINEAR_CONTENT 0x00000002 + +#define D3DCREATE_FPU_PRESERVE 0x00000002 +#define D3DCREATE_MULTITHREADED 0x00000004 +#define D3DCREATE_PUREDEVICE 0x00000010 +#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0x00000020 +#define D3DCREATE_HARDWARE_VERTEXPROCESSING 0x00000040 +#define D3DCREATE_MIXED_VERTEXPROCESSING 0x00000080 +#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT 0x00000100 +#define D3DCREATE_ADAPTERGROUP_DEVICE 0x00000200 + +#define D3DSTREAMSOURCE_INDEXEDDATA (1 << 30) +#define D3DSTREAMSOURCE_INSTANCEDATA (2 << 30) + +/******************************************************** + * Function macros * + *******************************************************/ + +/* Colors */ +#define D3DCOLOR_ARGB(a,r,g,b) \ + ((D3DCOLOR)( \ + (((a) & 0xFF) << 24) | \ + (((r) & 0xFF) << 16) | \ + (((g) & 0xFF) << 8) | \ + ((b) & 0xFF) \ + )) + +#define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) +#define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xFF,r,g,b) +#define D3DCOLOR_AYUV(a,y,u,v) D3DCOLOR_ARGB(a,y,u,v) +#define D3DCOLOR_XYUV(y,u,v) D3DCOLOR_ARGB(0xFF,y,u,v) + +#define D3DCOLOR_COLORVALUE(r,g,b,a) \ + D3DCOLOR_RGBA( \ + (DWORD)((r) * 255.0f), \ + (DWORD)((g) * 255.0f), \ + (DWORD)((b) * 255.0f), \ + (DWORD)((a) * 255.0f) \ + ) + +/* Shaders */ +#define D3DDECL_END() { 0xFF, 0, D3DDECLTYPE_UNUSED, 0, 0, 0 } + +/***************************************************************************** + * Typedefs * + *****************************************************************************/ +typedef DWORD D3DCOLOR; + +/***************************************************************************** + * Enums * + *****************************************************************************/ +typedef enum D3DDISPLAYROTATION { + D3DDISPLAYROTATION_IDENTITY = 1, + D3DDISPLAYROTATION_90 = 2, + D3DDISPLAYROTATION_180 = 3, + D3DDISPLAYROTATION_270 = 4 +} D3DDISPLAYROTATION; + +typedef enum D3DSCANLINEORDERING { + D3DSCANLINEORDERING_UNKNOWN = 0, + D3DSCANLINEORDERING_PROGRESSIVE = 1, + D3DSCANLINEORDERING_INTERLACED = 2 +} D3DSCANLINEORDERING; + +typedef enum _D3DAUTHENTICATEDCHANNELTYPE { + D3DAUTHENTICATEDCHANNEL_D3D9 = 1, + D3DAUTHENTICATEDCHANNEL_DRIVER_SOFTWARE = 2, + D3DAUTHENTICATEDCHANNEL_DRIVER_HARDWARE = 3 +} D3DAUTHENTICATEDCHANNELTYPE; + +typedef enum _D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE { + PROCESSIDTYPE_UNKNOWN = 0, + PROCESSIDTYPE_DWM = 1, + PROCESSIDTYPE_HANDLE = 2 +} D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE; + +typedef enum _D3DBACKBUFFER_TYPE { + D3DBACKBUFFER_TYPE_MONO = 0, + D3DBACKBUFFER_TYPE_LEFT = 1, + D3DBACKBUFFER_TYPE_RIGHT = 2 +} D3DBACKBUFFER_TYPE; + +typedef enum _D3DBASISTYPE { + D3DBASIS_BEZIER = 0, + D3DBASIS_BSPLINE = 1, + D3DBASIS_CATMULL_ROM = 2 +} D3DBASISTYPE; + +typedef enum _D3DBLEND { + D3DBLEND_ZERO = 1, + D3DBLEND_ONE = 2, + D3DBLEND_SRCCOLOR = 3, + D3DBLEND_INVSRCCOLOR = 4, + D3DBLEND_SRCALPHA = 5, + D3DBLEND_INVSRCALPHA = 6, + D3DBLEND_DESTALPHA = 7, + D3DBLEND_INVDESTALPHA = 8, + D3DBLEND_DESTCOLOR = 9, + D3DBLEND_INVDESTCOLOR = 10, + D3DBLEND_SRCALPHASAT = 11, + D3DBLEND_BOTHSRCALPHA = 12, + D3DBLEND_BOTHINVSRCALPHA = 13, + D3DBLEND_BLENDFACTOR = 14, + D3DBLEND_INVBLENDFACTOR = 15, + D3DBLEND_SRCCOLOR2 = 16, + D3DBLEND_INVSRCCOLOR2 = 17 +} D3DBLEND; + +typedef enum _D3DBLENDOP { + D3DBLENDOP_ADD = 1, + D3DBLENDOP_SUBTRACT = 2, + D3DBLENDOP_REVSUBTRACT = 3, + D3DBLENDOP_MIN = 4, + D3DBLENDOP_MAX = 5 +} D3DBLENDOP; + +typedef enum _D3DBUSTYPE { + D3DBUSTYPE_OTHER = 0x00000000, + D3DBUSTYPE_PCI = 0x00000001, + D3DBUSTYPE_PCIX = 0x00000002, + D3DBUSTYPE_PCIEXPRESS = 0x00000003, + D3DBUSTYPE_AGP = 0x00000004, + D3DBUSIMPL_MODIFIER_INSIDE_OF_CHIPSET = 0x00010000, + D3DBUSIMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP = 0x00020000, + D3DBUSIMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET = 0x00030000, + D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR = 0x00040000, + D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE = 0x00050000, + D3DBUSIMPL_MODIFIER_NON_STANDARD = 0x80000000 +} D3DBUSTYPE; + +typedef enum _D3DCMPFUNC { + D3DCMP_NEVER = 1, + D3DCMP_LESS = 2, + D3DCMP_EQUAL = 3, + D3DCMP_LESSEQUAL = 4, + D3DCMP_GREATER = 5, + D3DCMP_NOTEQUAL = 6, + D3DCMP_GREATEREQUAL = 7, + D3DCMP_ALWAYS = 8 +} D3DCMPFUNC; + +typedef enum _D3DCOMPOSERECTSOP{ + D3DCOMPOSERECTS_COPY = 1, + D3DCOMPOSERECTS_OR = 2, + D3DCOMPOSERECTS_AND = 3, + D3DCOMPOSERECTS_NEG = 4 +} D3DCOMPOSERECTSOP; + +typedef enum _D3DCUBEMAP_FACES { + D3DCUBEMAP_FACE_POSITIVE_X = 0, + D3DCUBEMAP_FACE_NEGATIVE_X = 1, + D3DCUBEMAP_FACE_POSITIVE_Y = 2, + D3DCUBEMAP_FACE_NEGATIVE_Y = 3, + D3DCUBEMAP_FACE_POSITIVE_Z = 4, + D3DCUBEMAP_FACE_NEGATIVE_Z = 5 +} D3DCUBEMAP_FACES; + +typedef enum _D3DCULL { + D3DCULL_NONE = 1, + D3DCULL_CW = 2, + D3DCULL_CCW = 3 +} D3DCULL; + +typedef enum _D3DDEBUGMONITORTOKENS { + D3DDMT_ENABLE = 0, + D3DDMT_DISABLE = 1 +} D3DDEBUGMONITORTOKENS; + +typedef enum _D3DDECLMETHOD { + D3DDECLMETHOD_DEFAULT = 0, + D3DDECLMETHOD_PARTIALU = 1, + D3DDECLMETHOD_PARTIALV = 2, + D3DDECLMETHOD_CROSSUV = 3, + D3DDECLMETHOD_UV = 4, + D3DDECLMETHOD_LOOKUP = 5, + D3DDECLMETHOD_LOOKUPPRESAMPLED = 6 +} D3DDECLMETHOD; + +typedef enum _D3DDECLTYPE { + D3DDECLTYPE_FLOAT1 = 0, + D3DDECLTYPE_FLOAT2 = 1, + D3DDECLTYPE_FLOAT3 = 2, + D3DDECLTYPE_FLOAT4 = 3, + D3DDECLTYPE_D3DCOLOR = 4, + D3DDECLTYPE_UBYTE4 = 5, + D3DDECLTYPE_SHORT2 = 6, + D3DDECLTYPE_SHORT4 = 7, + D3DDECLTYPE_UBYTE4N = 8, + D3DDECLTYPE_SHORT2N = 9, + D3DDECLTYPE_SHORT4N = 10, + D3DDECLTYPE_USHORT2N = 11, + D3DDECLTYPE_USHORT4N = 12, + D3DDECLTYPE_UDEC3 = 13, + D3DDECLTYPE_DEC3N = 14, + D3DDECLTYPE_FLOAT16_2 = 15, + D3DDECLTYPE_FLOAT16_4 = 16, + D3DDECLTYPE_UNUSED = 17 +} D3DDECLTYPE; + +typedef enum _D3DDECLUSAGE { + D3DDECLUSAGE_POSITION = 0, + D3DDECLUSAGE_BLENDWEIGHT = 1, + D3DDECLUSAGE_BLENDINDICES = 2, + D3DDECLUSAGE_NORMAL = 3, + D3DDECLUSAGE_PSIZE = 4, + D3DDECLUSAGE_TEXCOORD = 5, + D3DDECLUSAGE_TANGENT = 6, + D3DDECLUSAGE_BINORMAL = 7, + D3DDECLUSAGE_TESSFACTOR = 8, + D3DDECLUSAGE_POSITIONT = 9, + D3DDECLUSAGE_COLOR = 10, + D3DDECLUSAGE_FOG = 11, + D3DDECLUSAGE_DEPTH = 12, + D3DDECLUSAGE_SAMPLE = 13 +} D3DDECLUSAGE; + +typedef enum _D3DDEGREETYPE { + D3DDEGREE_LINEAR = 1, + D3DDEGREE_QUADRATIC = 2, + D3DDEGREE_CUBIC = 3, + D3DDEGREE_QUINTIC = 5 +} D3DDEGREETYPE; + +typedef enum _D3DDEVTYPE { + D3DDEVTYPE_HAL = 1, + D3DDEVTYPE_REF = 2, + D3DDEVTYPE_SW = 3, + D3DDEVTYPE_NULLREF = 4 +} D3DDEVTYPE; + +typedef enum _D3DFILLMODE { + D3DFILL_POINT = 1, + D3DFILL_WIREFRAME = 2, + D3DFILL_SOLID = 3 +} D3DFILLMODE; + +typedef enum _D3DFOGMODE { + D3DFOG_NONE = 0, + D3DFOG_EXP = 1, + D3DFOG_EXP2 = 2, + D3DFOG_LINEAR = 3 +} D3DFOGMODE; + +typedef enum _D3DFORMAT { + D3DFMT_UNKNOWN = 0, + D3DFMT_R8G8B8 = 20, + D3DFMT_A8R8G8B8 = 21, + D3DFMT_X8R8G8B8 = 22, + D3DFMT_R5G6B5 = 23, + D3DFMT_X1R5G5B5 = 24, + D3DFMT_A1R5G5B5 = 25, + D3DFMT_A4R4G4B4 = 26, + D3DFMT_R3G3B2 = 27, + D3DFMT_A8 = 28, + D3DFMT_A8R3G3B2 = 29, + D3DFMT_X4R4G4B4 = 30, + D3DFMT_A2B10G10R10 = 31, + D3DFMT_A8B8G8R8 = 32, + D3DFMT_X8B8G8R8 = 33, + D3DFMT_G16R16 = 34, + D3DFMT_A2R10G10B10 = 35, + D3DFMT_A16B16G16R16 = 36, + D3DFMT_A8P8 = 40, + D3DFMT_P8 = 41, + D3DFMT_L8 = 50, + D3DFMT_A8L8 = 51, + D3DFMT_A4L4 = 52, + D3DFMT_V8U8 = 60, + D3DFMT_L6V5U5 = 61, + D3DFMT_X8L8V8U8 = 62, + D3DFMT_Q8W8V8U8 = 63, + D3DFMT_V16U16 = 64, + D3DFMT_A2W10V10U10 = 67, + D3DFMT_UYVY = MAKEFOURCC('U', 'Y', 'V', 'Y'), + D3DFMT_R8G8_B8G8 = MAKEFOURCC('R', 'G', 'B', 'G'), + D3DFMT_YUY2 = MAKEFOURCC('Y', 'U', 'Y', '2'), + D3DFMT_G8R8_G8B8 = MAKEFOURCC('G', 'R', 'G', 'B'), + D3DFMT_DXT1 = MAKEFOURCC('D', 'X', 'T', '1'), + D3DFMT_DXT2 = MAKEFOURCC('D', 'X', 'T', '2'), + D3DFMT_DXT3 = MAKEFOURCC('D', 'X', 'T', '3'), + D3DFMT_DXT4 = MAKEFOURCC('D', 'X', 'T', '4'), + D3DFMT_DXT5 = MAKEFOURCC('D', 'X', 'T', '5'), + D3DFMT_D16_LOCKABLE = 70, + D3DFMT_D32 = 71, + D3DFMT_D15S1 = 73, + D3DFMT_D24S8 = 75, + D3DFMT_D24X8 = 77, + D3DFMT_D24X4S4 = 79, + D3DFMT_D16 = 80, + D3DFMT_D32F_LOCKABLE = 82, + D3DFMT_D24FS8 = 83, + D3DFMT_D32_LOCKABLE = 84, + D3DFMT_S8_LOCKABLE = 85, + D3DFMT_L16 = 81, + D3DFMT_VERTEXDATA = 100, + D3DFMT_INDEX16 = 101, + D3DFMT_INDEX32 = 102, + D3DFMT_Q16W16V16U16 = 110, + D3DFMT_MULTI2_ARGB8 = MAKEFOURCC('M','E','T','1'), + D3DFMT_R16F = 111, + D3DFMT_G16R16F = 112, + D3DFMT_A16B16G16R16F = 113, + D3DFMT_R32F = 114, + D3DFMT_G32R32F = 115, + D3DFMT_A32B32G32R32F = 116, + D3DFMT_CxV8U8 = 117, + D3DFMT_A1 = 118, + D3DFMT_A2B10G10R10_XR_BIAS = 119, + D3DFMT_BINARYBUFFER = 199, + D3DFMT_DF16 = MAKEFOURCC('D', 'F', '1', '6'), + D3DFMT_DF24 = MAKEFOURCC('D', 'F', '2', '4'), + D3DFMT_INTZ = MAKEFOURCC('I', 'N', 'T', 'Z'), + D3DFMT_NULL = MAKEFOURCC('N', 'U', 'L', 'L'), + D3DFMT_NV11 = MAKEFOURCC('N', 'V', '1', '1'), + D3DFMT_NV12 = MAKEFOURCC('N', 'V', '1', '2'), + D3DFMT_Y210 = MAKEFOURCC('Y', '2', '1', '0'), + D3DFMT_Y216 = MAKEFOURCC('Y', '2', '1', '6'), + D3DFMT_Y410 = MAKEFOURCC('Y', '4', '1', '0') +} D3DFORMAT; + +typedef enum _D3DLIGHTTYPE { + D3DLIGHT_POINT = 1, + D3DLIGHT_SPOT = 2, + D3DLIGHT_DIRECTIONAL = 3 +} D3DLIGHTTYPE; + +typedef enum _D3DMATERIALCOLORSOURCE { + D3DMCS_MATERIAL = 0, + D3DMCS_COLOR1 = 1, + D3DMCS_COLOR2 = 2 +} D3DMATERIALCOLORSOURCE; + +typedef enum _D3DMULTISAMPLE_TYPE { + D3DMULTISAMPLE_NONE = 0, + D3DMULTISAMPLE_NONMASKABLE = 1, + D3DMULTISAMPLE_2_SAMPLES = 2, + D3DMULTISAMPLE_3_SAMPLES = 3, + D3DMULTISAMPLE_4_SAMPLES = 4, + D3DMULTISAMPLE_5_SAMPLES = 5, + D3DMULTISAMPLE_6_SAMPLES = 6, + D3DMULTISAMPLE_7_SAMPLES = 7, + D3DMULTISAMPLE_8_SAMPLES = 8, + D3DMULTISAMPLE_9_SAMPLES = 9, + D3DMULTISAMPLE_10_SAMPLES = 10, + D3DMULTISAMPLE_11_SAMPLES = 11, + D3DMULTISAMPLE_12_SAMPLES = 12, + D3DMULTISAMPLE_13_SAMPLES = 13, + D3DMULTISAMPLE_14_SAMPLES = 14, + D3DMULTISAMPLE_15_SAMPLES = 15, + D3DMULTISAMPLE_16_SAMPLES = 16 +} D3DMULTISAMPLE_TYPE; + +typedef enum _D3DPATCHEDGESTYLE { + D3DPATCHEDGE_DISCRETE = 0, + D3DPATCHEDGE_CONTINUOUS = 1 +} D3DPATCHEDGESTYLE; + +typedef enum _D3DPOOL { + D3DPOOL_DEFAULT = 0, + D3DPOOL_MANAGED = 1, + D3DPOOL_SYSTEMMEM = 2, + D3DPOOL_SCRATCH = 3 +} D3DPOOL; + +typedef enum _D3DPRIMITIVETYPE { + D3DPT_POINTLIST = 1, + D3DPT_LINELIST = 2, + D3DPT_LINESTRIP = 3, + D3DPT_TRIANGLELIST = 4, + D3DPT_TRIANGLESTRIP = 5, + D3DPT_TRIANGLEFAN = 6 +} D3DPRIMITIVETYPE; + +typedef enum _D3DQUERYTYPE { + D3DQUERYTYPE_VCACHE = 4, + D3DQUERYTYPE_RESOURCEMANAGER = 5, + D3DQUERYTYPE_VERTEXSTATS = 6, + D3DQUERYTYPE_EVENT = 8, + D3DQUERYTYPE_OCCLUSION = 9, + D3DQUERYTYPE_TIMESTAMP = 10, + D3DQUERYTYPE_TIMESTAMPDISJOINT = 11, + D3DQUERYTYPE_TIMESTAMPFREQ = 12, + D3DQUERYTYPE_PIPELINETIMINGS = 13, + D3DQUERYTYPE_INTERFACETIMINGS = 14, + D3DQUERYTYPE_VERTEXTIMINGS = 15, + D3DQUERYTYPE_PIXELTIMINGS = 16, + D3DQUERYTYPE_BANDWIDTHTIMINGS = 17, + D3DQUERYTYPE_CACHEUTILIZATION = 18, + D3DQUERYTYPE_MEMORYPRESSURE = 19 +} D3DQUERYTYPE; + +#define D3DISSUE_BEGIN (1 << 1) +#define D3DISSUE_END (1 << 0) +#define D3DGETDATA_FLUSH (1 << 0) + + +typedef enum _D3DRENDERSTATETYPE { + D3DRS_ZENABLE = 7, + D3DRS_FILLMODE = 8, + D3DRS_SHADEMODE = 9, + D3DRS_ZWRITEENABLE = 14, + D3DRS_ALPHATESTENABLE = 15, + D3DRS_LASTPIXEL = 16, + D3DRS_SRCBLEND = 19, + D3DRS_DESTBLEND = 20, + D3DRS_CULLMODE = 22, + D3DRS_ZFUNC = 23, + D3DRS_ALPHAREF = 24, + D3DRS_ALPHAFUNC = 25, + D3DRS_DITHERENABLE = 26, + D3DRS_ALPHABLENDENABLE = 27, + D3DRS_FOGENABLE = 28, + D3DRS_SPECULARENABLE = 29, + D3DRS_FOGCOLOR = 34, + D3DRS_FOGTABLEMODE = 35, + D3DRS_FOGSTART = 36, + D3DRS_FOGEND = 37, + D3DRS_FOGDENSITY = 38, + D3DRS_RANGEFOGENABLE = 48, + D3DRS_STENCILENABLE = 52, + D3DRS_STENCILFAIL = 53, + D3DRS_STENCILZFAIL = 54, + D3DRS_STENCILPASS = 55, + D3DRS_STENCILFUNC = 56, + D3DRS_STENCILREF = 57, + D3DRS_STENCILMASK = 58, + D3DRS_STENCILWRITEMASK = 59, + D3DRS_TEXTUREFACTOR = 60, + D3DRS_WRAP0 = 128, + D3DRS_WRAP1 = 129, + D3DRS_WRAP2 = 130, + D3DRS_WRAP3 = 131, + D3DRS_WRAP4 = 132, + D3DRS_WRAP5 = 133, + D3DRS_WRAP6 = 134, + D3DRS_WRAP7 = 135, + D3DRS_CLIPPING = 136, + D3DRS_LIGHTING = 137, + D3DRS_AMBIENT = 139, + D3DRS_FOGVERTEXMODE = 140, + D3DRS_COLORVERTEX = 141, + D3DRS_LOCALVIEWER = 142, + D3DRS_NORMALIZENORMALS = 143, + D3DRS_DIFFUSEMATERIALSOURCE = 145, + D3DRS_SPECULARMATERIALSOURCE = 146, + D3DRS_AMBIENTMATERIALSOURCE = 147, + D3DRS_EMISSIVEMATERIALSOURCE = 148, + D3DRS_VERTEXBLEND = 151, + D3DRS_CLIPPLANEENABLE = 152, + D3DRS_POINTSIZE = 154, + D3DRS_POINTSIZE_MIN = 155, + D3DRS_POINTSPRITEENABLE = 156, + D3DRS_POINTSCALEENABLE = 157, + D3DRS_POINTSCALE_A = 158, + D3DRS_POINTSCALE_B = 159, + D3DRS_POINTSCALE_C = 160, + D3DRS_MULTISAMPLEANTIALIAS = 161, + D3DRS_MULTISAMPLEMASK = 162, + D3DRS_PATCHEDGESTYLE = 163, + D3DRS_DEBUGMONITORTOKEN = 165, + D3DRS_POINTSIZE_MAX = 166, + D3DRS_INDEXEDVERTEXBLENDENABLE = 167, + D3DRS_COLORWRITEENABLE = 168, + D3DRS_TWEENFACTOR = 170, + D3DRS_BLENDOP = 171, + D3DRS_POSITIONDEGREE = 172, + D3DRS_NORMALDEGREE = 173, + D3DRS_SCISSORTESTENABLE = 174, + D3DRS_SLOPESCALEDEPTHBIAS = 175, + D3DRS_ANTIALIASEDLINEENABLE = 176, + D3DRS_MINTESSELLATIONLEVEL = 178, + D3DRS_MAXTESSELLATIONLEVEL = 179, + D3DRS_ADAPTIVETESS_X = 180, + D3DRS_ADAPTIVETESS_Y = 181, + D3DRS_ADAPTIVETESS_Z = 182, + D3DRS_ADAPTIVETESS_W = 183, + D3DRS_ENABLEADAPTIVETESSELLATION = 184, + D3DRS_TWOSIDEDSTENCILMODE = 185, + D3DRS_CCW_STENCILFAIL = 186, + D3DRS_CCW_STENCILZFAIL = 187, + D3DRS_CCW_STENCILPASS = 188, + D3DRS_CCW_STENCILFUNC = 189, + D3DRS_COLORWRITEENABLE1 = 190, + D3DRS_COLORWRITEENABLE2 = 191, + D3DRS_COLORWRITEENABLE3 = 192, + D3DRS_BLENDFACTOR = 193, + D3DRS_SRGBWRITEENABLE = 194, + D3DRS_DEPTHBIAS = 195, + D3DRS_WRAP8 = 198, + D3DRS_WRAP9 = 199, + D3DRS_WRAP10 = 200, + D3DRS_WRAP11 = 201, + D3DRS_WRAP12 = 202, + D3DRS_WRAP13 = 203, + D3DRS_WRAP14 = 204, + D3DRS_WRAP15 = 205, + D3DRS_SEPARATEALPHABLENDENABLE = 206, + D3DRS_SRCBLENDALPHA = 207, + D3DRS_DESTBLENDALPHA = 208, + D3DRS_BLENDOPALPHA = 209 +} D3DRENDERSTATETYPE; + +typedef enum _D3DRESOURCETYPE { + D3DRTYPE_SURFACE = 1, + D3DRTYPE_VOLUME = 2, + D3DRTYPE_TEXTURE = 3, + D3DRTYPE_VOLUMETEXTURE = 4, + D3DRTYPE_CUBETEXTURE = 5, + D3DRTYPE_VERTEXBUFFER = 6, + D3DRTYPE_INDEXBUFFER = 7 +} D3DRESOURCETYPE; +#define D3DRTYPECOUNT (D3DRTYPE_INDEXBUFFER+1) + +typedef enum _D3DSAMPLERSTATETYPE { + D3DSAMP_ADDRESSU = 1, + D3DSAMP_ADDRESSV = 2, + D3DSAMP_ADDRESSW = 3, + D3DSAMP_BORDERCOLOR = 4, + D3DSAMP_MAGFILTER = 5, + D3DSAMP_MINFILTER = 6, + D3DSAMP_MIPFILTER = 7, + D3DSAMP_MIPMAPLODBIAS = 8, + D3DSAMP_MAXMIPLEVEL = 9, + D3DSAMP_MAXANISOTROPY = 10, + D3DSAMP_SRGBTEXTURE = 11, + D3DSAMP_ELEMENTINDEX = 12, + D3DSAMP_DMAPOFFSET = 13 +} D3DSAMPLERSTATETYPE; + +typedef enum _D3DSAMPLER_TEXTURE_TYPE { + D3DSTT_UNKNOWN = 0<<27, + D3DSTT_1D = 1<<27, + D3DSTT_2D = 2<<27, + D3DSTT_CUBE = 3<<27, + D3DSTT_VOLUME = 4<<27 +} D3DSAMPLER_TEXTURE_TYPE; + +typedef enum _D3DSHADEMODE { + D3DSHADE_FLAT = 1, + D3DSHADE_GOURAUD = 2, + D3DSHADE_PHONG = 3 +} D3DSHADEMODE; + +typedef enum _D3DSHADER_ADDRESSMODE_TYPE { + D3DSHADER_ADDRMODE_ABSOLUTE = 0<<13, + D3DSHADER_ADDRMODE_RELATIVE = 1<<13 +} D3DSHADER_ADDRESSMODE_TYPE; + +typedef enum _D3DSHADER_COMPARISON { + D3DSPC_RESERVED0 = 0, + D3DSPC_GT = 1, + D3DSPC_EQ = 2, + D3DSPC_GE = 3, + D3DSPC_LT = 4, + D3DSPC_NE = 5, + D3DSPC_LE = 6, + D3DSPC_RESERVED1 = 7 +} D3DSHADER_COMPARISON; + +#define D3DDP_MAXTEXCOORD 8 + +#define D3DSI_OPCODE_MASK 0x0000FFFF +#define D3DSI_INSTLENGTH_MASK 0x0F000000 +#define D3DSI_INSTLENGTH_SHIFT 24 + +typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE { + D3DSIO_NOP = 0, + D3DSIO_MOV = 1, + D3DSIO_ADD = 2, + D3DSIO_SUB = 3, + D3DSIO_MAD = 4, + D3DSIO_MUL = 5, + D3DSIO_RCP = 6, + D3DSIO_RSQ = 7, + D3DSIO_DP3 = 8, + D3DSIO_DP4 = 9, + D3DSIO_MIN = 10, + D3DSIO_MAX = 11, + D3DSIO_SLT = 12, + D3DSIO_SGE = 13, + D3DSIO_EXP = 14, + D3DSIO_LOG = 15, + D3DSIO_LIT = 16, + D3DSIO_DST = 17, + D3DSIO_LRP = 18, + D3DSIO_FRC = 19, + D3DSIO_M4x4 = 20, + D3DSIO_M4x3 = 21, + D3DSIO_M3x4 = 22, + D3DSIO_M3x3 = 23, + D3DSIO_M3x2 = 24, + D3DSIO_CALL = 25, + D3DSIO_CALLNZ = 26, + D3DSIO_LOOP = 27, + D3DSIO_RET = 28, + D3DSIO_ENDLOOP = 29, + D3DSIO_LABEL = 30, + D3DSIO_DCL = 31, + D3DSIO_POW = 32, + D3DSIO_CRS = 33, + D3DSIO_SGN = 34, + D3DSIO_ABS = 35, + D3DSIO_NRM = 36, + D3DSIO_SINCOS = 37, + D3DSIO_REP = 38, + D3DSIO_ENDREP = 39, + D3DSIO_IF = 40, + D3DSIO_IFC = 41, + D3DSIO_ELSE = 42, + D3DSIO_ENDIF = 43, + D3DSIO_BREAK = 44, + D3DSIO_BREAKC = 45, + D3DSIO_MOVA = 46, + D3DSIO_DEFB = 47, + D3DSIO_DEFI = 48, + D3DSIO_TEXCOORD = 64, + D3DSIO_TEXKILL = 65, + D3DSIO_TEX = 66, + D3DSIO_TEXBEM = 67, + D3DSIO_TEXBEML = 68, + D3DSIO_TEXREG2AR = 69, + D3DSIO_TEXREG2GB = 70, + D3DSIO_TEXM3x2PAD = 71, + D3DSIO_TEXM3x2TEX = 72, + D3DSIO_TEXM3x3PAD = 73, + D3DSIO_TEXM3x3TEX = 74, + D3DSIO_RESERVED0 = 75, + D3DSIO_TEXM3x3SPEC = 76, + D3DSIO_TEXM3x3VSPEC = 77, + D3DSIO_EXPP = 78, + D3DSIO_LOGP = 79, + D3DSIO_CND = 80, + D3DSIO_DEF = 81, + D3DSIO_TEXREG2RGB = 82, + D3DSIO_TEXDP3TEX = 83, + D3DSIO_TEXM3x2DEPTH = 84, + D3DSIO_TEXDP3 = 85, + D3DSIO_TEXM3x3 = 86, + D3DSIO_TEXDEPTH = 87, + D3DSIO_CMP = 88, + D3DSIO_BEM = 89, + D3DSIO_DP2ADD = 90, + D3DSIO_DSX = 91, + D3DSIO_DSY = 92, + D3DSIO_TEXLDD = 93, + D3DSIO_SETP = 94, + D3DSIO_TEXLDL = 95, + D3DSIO_BREAKP = 96, + D3DSIO_PHASE = 0xFFFD, + D3DSIO_COMMENT = 0xFFFE, + D3DSIO_END = 0xFFFF +} D3DSHADER_INSTRUCTION_OPCODE_TYPE; + +#define D3DSI_COISSUE 0x40000000 + +#define D3DSP_DCL_USAGE_SHIFT 0 +#define D3DSP_DCL_USAGE_MASK 0x0000000f + +#define D3DSP_DCL_USAGEINDEX_SHIFT 16 +#define D3DSP_DCL_USAGEINDEX_MASK 0x000f0000 + +#define D3DSP_TEXTURETYPE_SHIFT 27 +#define D3DSP_TEXTURETYPE_MASK 0x78000000 + +#define D3DSP_REGNUM_MASK 0x000007FF + +#define D3DSP_WRITEMASK_0 0x00010000 +#define D3DSP_WRITEMASK_1 0x00020000 +#define D3DSP_WRITEMASK_2 0x00040000 +#define D3DSP_WRITEMASK_3 0x00080000 +#define D3DSP_WRITEMASK_ALL 0x000F0000 + +#define D3DSP_DSTMOD_SHIFT 20 +#define D3DSP_DSTMOD_MASK (0xF << D3DSP_DSTMOD_SHIFT) + +typedef enum _D3DSHADER_PARAM_DSTMOD_TYPE { + D3DSPDM_NONE = 0 << D3DSP_DSTMOD_SHIFT, + D3DSPDM_SATURATE = 1 << D3DSP_DSTMOD_SHIFT, + D3DSPDM_PARTIALPRECISION = 2 << D3DSP_DSTMOD_SHIFT, + D3DSPDM_MSAMPCENTROID = 4 << D3DSP_DSTMOD_SHIFT, + D3DSPDM_FORCE_DWORD = 0x7FFFFFFF +} D3DSHADER_PARAM_DSTMOD_TYPE; + +#define D3DSP_DSTSHIFT_SHIFT 24 +#define D3DSP_DSTSHIFT_MASK (0xF << D3DSP_DSTSHIFT_SHIFT) + +#define D3DSP_REGTYPE_SHIFT 28 +#define D3DSP_REGTYPE_SHIFT2 8 +#define D3DSP_REGTYPE_MASK (0x7 << D3DSP_REGTYPE_SHIFT) +#define D3DSP_REGTYPE_MASK2 0x00001800 + +typedef enum _D3DSHADER_MISCTYPE_OFFSETS { + D3DSMO_POSITION = 0, + D3DSMO_FACE = 1 +} D3DSHADER_MISCTYPE_OFFSETS; + +typedef enum _D3DSHADER_PARAM_REGISTER_TYPE { + D3DSPR_TEMP = 0, + D3DSPR_INPUT = 1, + D3DSPR_CONST = 2, + D3DSPR_ADDR = 3, + D3DSPR_TEXTURE = 3, + D3DSPR_RASTOUT = 4, + D3DSPR_ATTROUT = 5, + D3DSPR_TEXCRDOUT = 6, + D3DSPR_OUTPUT = 6, + D3DSPR_CONSTINT = 7, + D3DSPR_COLOROUT = 8, + D3DSPR_DEPTHOUT = 9, + D3DSPR_SAMPLER = 10, + D3DSPR_CONST2 = 11, + D3DSPR_CONST3 = 12, + D3DSPR_CONST4 = 13, + D3DSPR_CONSTBOOL = 14, + D3DSPR_LOOP = 15, + D3DSPR_TEMPFLOAT16 = 16, + D3DSPR_MISCTYPE = 17, + D3DSPR_LABEL = 18, + D3DSPR_PREDICATE = 19 +} D3DSHADER_PARAM_REGISTER_TYPE; + +#define D3DSP_SWIZZLE_SHIFT 16 +#define D3DSP_SWIZZLE_MASK (0xFF << D3DSP_SWIZZLE_SHIFT) + +#define D3DSP_NOSWIZZLE \ + ((0 << (D3DSP_SWIZZLE_SHIFT + 0)) | (1 << (D3DSP_SWIZZLE_SHIFT + 2)) | (2 << (D3DSP_SWIZZLE_SHIFT + 4)) | (3 << (D3DSP_SWIZZLE_SHIFT + 6))) + +#define D3DSP_SRCMOD_SHIFT 24 +#define D3DSP_SRCMOD_MASK (0xF << D3DSP_SRCMOD_SHIFT) + +typedef enum _D3DSHADER_PARAM_SRCMOD_TYPE { + D3DSPSM_NONE = 0<<24, + D3DSPSM_NEG = 1<<24, + D3DSPSM_BIAS = 2<<24, + D3DSPSM_BIASNEG = 3<<24, + D3DSPSM_SIGN = 4<<24, + D3DSPSM_SIGNNEG = 5<<24, + D3DSPSM_COMP = 6<<24, + D3DSPSM_X2 = 7<<24, + D3DSPSM_X2NEG = 8<<24, + D3DSPSM_DZ = 9<<24, + D3DSPSM_DW = 10<<24, + D3DSPSM_ABS = 11<<24, + D3DSPSM_ABSNEG = 12<<24, + D3DSPSM_NOT = 13<<24 +} D3DSHADER_PARAM_SRCMOD_TYPE; + +#define D3DPS_VERSION(major, minor) (0xFFFF0000 | ((major) << 8) | (minor)) +#define D3DVS_VERSION(major, minor) (0xFFFE0000 | ((major) << 8) | (minor)) +#define D3DSHADER_VERSION_MAJOR(version) (((version) >> 8) & 0xFF) +#define D3DSHADER_VERSION_MINOR(version) (((version) >> 0) & 0xFF) + +#define D3DSI_COMMENTSIZE_SHIFT 16 +#define D3DSI_COMMENTSIZE_MASK (0x7FFF << D3DSI_COMMENTSIZE_SHIFT) + +typedef enum _D3DSTATEBLOCKTYPE { + D3DSBT_ALL = 1, + D3DSBT_PIXELSTATE = 2, + D3DSBT_VERTEXSTATE = 3 +} D3DSTATEBLOCKTYPE; + +typedef enum _D3DSTENCILOP { + D3DSTENCILOP_KEEP = 1, + D3DSTENCILOP_ZERO = 2, + D3DSTENCILOP_REPLACE = 3, + D3DSTENCILOP_INCRSAT = 4, + D3DSTENCILOP_DECRSAT = 5, + D3DSTENCILOP_INVERT = 6, + D3DSTENCILOP_INCR = 7, + D3DSTENCILOP_DECR = 8 +} D3DSTENCILOP; + +typedef enum _D3DSWAPEFFECT { + D3DSWAPEFFECT_DISCARD = 1, + D3DSWAPEFFECT_FLIP = 2, + D3DSWAPEFFECT_COPY = 3, + D3DSWAPEFFECT_OVERLAY = 4, + D3DSWAPEFFECT_FLIPEX = 5 +} D3DSWAPEFFECT; + +typedef enum _D3DTEXTUREADDRESS { + D3DTADDRESS_WRAP = 1, + D3DTADDRESS_MIRROR = 2, + D3DTADDRESS_CLAMP = 3, + D3DTADDRESS_BORDER = 4, + D3DTADDRESS_MIRRORONCE = 5 +} D3DTEXTUREADDRESS; + +typedef enum _D3DTEXTUREFILTERTYPE { + D3DTEXF_NONE = 0, + D3DTEXF_POINT = 1, + D3DTEXF_LINEAR = 2, + D3DTEXF_ANISOTROPIC = 3, + D3DTEXF_PYRAMIDALQUAD = 6, + D3DTEXF_GAUSSIANQUAD = 7, + D3DTEXF_CONVOLUTIONMONO = 8 +} D3DTEXTUREFILTERTYPE; + +typedef enum _D3DTEXTUREOP { + D3DTOP_DISABLE = 1, + D3DTOP_SELECTARG1 = 2, + D3DTOP_SELECTARG2 = 3, + D3DTOP_MODULATE = 4, + D3DTOP_MODULATE2X = 5, + D3DTOP_MODULATE4X = 6, + D3DTOP_ADD = 7, + D3DTOP_ADDSIGNED = 8, + D3DTOP_ADDSIGNED2X = 9, + D3DTOP_SUBTRACT = 10, + D3DTOP_ADDSMOOTH = 11, + D3DTOP_BLENDDIFFUSEALPHA = 12, + D3DTOP_BLENDTEXTUREALPHA = 13, + D3DTOP_BLENDFACTORALPHA = 14, + D3DTOP_BLENDTEXTUREALPHAPM = 15, + D3DTOP_BLENDCURRENTALPHA = 16, + D3DTOP_PREMODULATE = 17, + D3DTOP_MODULATEALPHA_ADDCOLOR = 18, + D3DTOP_MODULATECOLOR_ADDALPHA = 19, + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, + D3DTOP_BUMPENVMAP = 22, + D3DTOP_BUMPENVMAPLUMINANCE = 23, + D3DTOP_DOTPRODUCT3 = 24, + D3DTOP_MULTIPLYADD = 25, + D3DTOP_LERP = 26 +} D3DTEXTUREOP; + +typedef enum _D3DTEXTURESTAGESTATETYPE { + D3DTSS_COLOROP = 1, + D3DTSS_COLORARG1 = 2, + D3DTSS_COLORARG2 = 3, + D3DTSS_ALPHAOP = 4, + D3DTSS_ALPHAARG1 = 5, + D3DTSS_ALPHAARG2 = 6, + D3DTSS_BUMPENVMAT00 = 7, + D3DTSS_BUMPENVMAT01 = 8, + D3DTSS_BUMPENVMAT10 = 9, + D3DTSS_BUMPENVMAT11 = 10, + D3DTSS_TEXCOORDINDEX = 11, + D3DTSS_BUMPENVLSCALE = 22, + D3DTSS_BUMPENVLOFFSET = 23, + D3DTSS_TEXTURETRANSFORMFLAGS = 24, + D3DTSS_COLORARG0 = 26, + D3DTSS_ALPHAARG0 = 27, + D3DTSS_RESULTARG = 28, + D3DTSS_CONSTANT = 32 +} D3DTEXTURESTAGESTATETYPE; + +/* MSDN has this in d3d9caps.h, but it should be here */ +#define D3DTSS_TCI_PASSTHRU 0x00000 +#define D3DTSS_TCI_CAMERASPACENORMAL 0x10000 +#define D3DTSS_TCI_CAMERASPACEPOSITION 0x20000 +#define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x30000 +#define D3DTSS_TCI_SPHEREMAP 0x40000 + +typedef enum _D3DTEXTURETRANSFORMFLAGS { + D3DTTFF_DISABLE = 0, + D3DTTFF_COUNT1 = 1, + D3DTTFF_COUNT2 = 2, + D3DTTFF_COUNT3 = 3, + D3DTTFF_COUNT4 = 4, + D3DTTFF_PROJECTED = 256 +} D3DTEXTURETRANSFORMFLAGS; + +typedef enum _D3DTRANSFORMSTATETYPE { + D3DTS_VIEW = 2, + D3DTS_PROJECTION = 3, + D3DTS_TEXTURE0 = 16, + D3DTS_TEXTURE1 = 17, + D3DTS_TEXTURE2 = 18, + D3DTS_TEXTURE3 = 19, + D3DTS_TEXTURE4 = 20, + D3DTS_TEXTURE5 = 21, + D3DTS_TEXTURE6 = 22, + D3DTS_TEXTURE7 = 23 +} D3DTRANSFORMSTATETYPE; + +#define D3DDMAPSAMPLER 256 +#define D3DVERTEXTEXTURESAMPLER0 (D3DDMAPSAMPLER+1) +#define D3DVERTEXTEXTURESAMPLER1 (D3DDMAPSAMPLER+2) +#define D3DVERTEXTEXTURESAMPLER2 (D3DDMAPSAMPLER+3) +#define D3DVERTEXTEXTURESAMPLER3 (D3DDMAPSAMPLER+4) + +#define D3DTS_WORLD D3DTS_WORLDMATRIX(0) +#define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1) +#define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2) +#define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3) +#define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) + +typedef enum _D3DVERTEXBLENDFLAGS { + D3DVBF_DISABLE = 0, + D3DVBF_1WEIGHTS = 1, + D3DVBF_2WEIGHTS = 2, + D3DVBF_3WEIGHTS = 3, + D3DVBF_TWEENING = 255, + D3DVBF_0WEIGHTS = 256 +} D3DVERTEXBLENDFLAGS; + +typedef enum _D3DVS_ADDRESSMODE_TYPE { + D3DVS_ADDRMODE_ABSOLUTE = 0<<13, + D3DVS_ADDRMODE_RELATIVE = 1<<13 +} D3DVS_ADDRESSMODE_TYPE; + +typedef enum _D3DVS_RASTOUT_OFFSETS { + D3DSRO_POSITION = 0, + D3DSRO_FOG = 1, + D3DSRO_POINT_SIZE = 2 +} D3DVS_RASTOUT_OFFSETS; + +typedef enum _D3DZBUFFERTYPE { + D3DZB_FALSE = 0, + D3DZB_TRUE = 1, + D3DZB_USEW = 2 +} D3DZBUFFERTYPE; + +/***************************************************************************** + * Structs * + *****************************************************************************/ +typedef struct D3DDISPLAYMODEEX { + UINT Size; + UINT Width; + UINT Height; + UINT RefreshRate; + D3DFORMAT Format; + D3DSCANLINEORDERING ScanLineOrdering; +} D3DDISPLAYMODEEX, *PD3DDISPLAYMODEEX, *LPD3DDISPLAYMODEEX; + +typedef struct D3DDISPLAYMODEFILTER { + UINT Size; + D3DFORMAT Format; + D3DSCANLINEORDERING ScanLineOrdering; +} D3DDISPLAYMODEFILTER, *PD3DDISPLAYMODEFILTER, *LPD3DDISPLAYMODEFILTER; + +typedef struct _D3D_OMAC { + BYTE Omac[16]; +} D3D_OMAC, *PD3D_OMAC, *LPD3D_OMAC; + +typedef struct _D3DADAPTER_IDENTIFIER9 { + char Driver[512]; + char Description[512]; + char DeviceName[32]; + DWORD DriverVersionLowPart; + DWORD DriverVersionHighPart; + DWORD VendorId; + DWORD DeviceId; + DWORD SubSysId; + DWORD Revision; + GUID DeviceIdentifier; + DWORD WHQLLevel; +} D3DADAPTER_IDENTIFIER9, *PD3DADAPTER_IDENTIFIER9, *LPD3DADAPTER_IDENTIFIER9; + +typedef struct _D3DAES_CTR_IV { + UINT64 IV; + UINT64 Count; +} D3DAES_CTR_IV, *PD3DAES_CTR_IV, *LPD3DAES_CTR_IV; + +typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT { + D3D_OMAC omac; + GUID ConfigureType; + HANDLE hChannel; + UINT SequenceNumber; +} D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, *PD3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT, *LPD3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGURECRYPTOSESSION { + D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters; + HANDLE DXVA2DecodeHandle; + HANDLE CryptoSessionHandle; + HANDLE DeviceHandle; +} D3DAUTHENTICATEDCHANNEL_CONFIGURECRYPTOSESSION, *PD3DAUTHENTICATEDCHANNEL_CONFIGURECRYPTOSESSION, *LPD3DAUTHENTICATEDCHANNEL_CONFIGURECRYPTOSESSION; + +typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGUREINITIALIZE { + D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters; + UINT StartSequenceQuery; + UINT StartSequenceConfigure; +} D3DAUTHENTICATEDCHANNEL_CONFIGUREINITIALIZE, *PD3DAUTHENTICATEDCHANNEL_CONFIGUREINITIALIZE, *LPD3DAUTHENTICATEDCHANNEL_CONFIGUREINITIALIZE; + +typedef struct _D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS { + union { + struct { + UINT ProtectionEnabled : 1; + UINT OverlayOrFullscreenRequired : 1; + UINT Reserved : 30; + }; + UINT Value; + }; +} D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS, *PD3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS, *LPD3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS; + +typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGUREPROTECTION { + D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters; + D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS Protections; +} D3DAUTHENTICATEDCHANNEL_CONFIGUREPROTECTION, *PD3DAUTHENTICATEDCHANNEL_CONFIGUREPROTECTION, *LPD3DAUTHENTICATEDCHANNEL_CONFIGUREPROTECTION; + +typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGURESHAREDRESOURCE { + D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters; + D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE ProcessIdentiferType; + HANDLE ProcessHandle; + BOOL AllowAccess; +} D3DAUTHENTICATEDCHANNEL_CONFIGURESHAREDRESOURCE, *PD3DAUTHENTICATEDCHANNEL_CONFIGURESHAREDRESOURCE, *LPD3DAUTHENTICATEDCHANNEL_CONFIGURESHAREDRESOURCE; + +typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGUREUNCOMPRESSEDENCRYPTION { + D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters; + GUID EncryptionGuid; +} D3DAUTHENTICATEDCHANNEL_CONFIGUREUNCOMPRESSEDENCRYPTION, *PD3DAUTHENTICATEDCHANNEL_CONFIGUREUNCOMPRESSEDENCRYPTION, *LPD3DAUTHENTICATEDCHANNEL_CONFIGUREUNCOMPRESSEDENCRYPTION; + +typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT { + D3D_OMAC omac; + GUID ConfigureType; + HANDLE hChannel; + UINT SequenceNumber; + HRESULT ReturnCode; +} D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERY_INPUT { + GUID QueryType; + HANDLE hChannel; + UINT SequenceNumber; +} D3DAUTHENTICATEDCHANNEL_QUERY_INPUT, *PD3DAUTHENTICATEDCHANNEL_QUERY_INPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERY_INPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT { + D3D_OMAC omac; + GUID QueryType; + HANDLE hChannel; + UINT SequenceNumber; + HRESULT ReturnCode; +} D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYCHANNELTYPE_OUTPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; + D3DAUTHENTICATEDCHANNELTYPE ChannelType; +} D3DAUTHENTICATEDCHANNEL_QUERYCHANNELTYPE_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYCHANNELTYPE_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYCHANNELTYPE_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_INPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input; + HANDLE DXVA2DecodeHandle; +} D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_INPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_INPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_INPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_OUTPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; + HANDLE DXVA2DecodeHandle; + HANDLE CryptoSessionHandle; + HANDLE DeviceHandle; +} D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYDEVICEHANDLE_OUTPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; + HANDLE DeviceHandle; +} D3DAUTHENTICATEDCHANNEL_QUERYDEVICEHANDLE_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYDEVICEHANDLE_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYDEVICEHANDLE_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUIDCOUNT_OUTPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; + UINT NumEncryptionGuids; +} D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUIDCOUNT_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUIDCOUNT_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUIDCOUNT_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_INPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input; + UINT EncryptionGuidIndex; +} D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_INPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_INPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_INPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_OUTPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; + UINT EncryptionGuidIndex; + GUID EncryptionGuid; +} D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYINFOBUSTYPE_OUTPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; + D3DBUSTYPE BusType; + BOOL bAccessibleInContiguousBlocks; + BOOL bAccessibleInNonContiguousBlocks; +} D3DAUTHENTICATEDCHANNEL_QUERYINFOBUSTYPE_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYINFOBUSTYPE_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYINFOBUSTYPE_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_INPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input; + HANDLE DeviceHandle; + HANDLE CryptoSessionHandle; +} D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_INPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_INPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_INPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_OUTPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; + HANDLE DeviceHandle; + HANDLE CryptoSessionHandle; + UINT NumOutputIDs; +} D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_INPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input; + HANDLE DeviceHandle; + HANDLE CryptoSessionHandle; + UINT OutputIDIndex; +} D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_INPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_INPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_INPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_OUTPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; + HANDLE DeviceHandle; + HANDLE CryptoSessionHandle; + UINT OutputIDIndex; + UINT64 OutputID; +} D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYPROTECTION_OUTPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; + D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS ProtectionFlags; +} D3DAUTHENTICATEDCHANNEL_QUERYPROTECTION_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYPROTECTION_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYPROTECTION_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESSCOUNT_OUTPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; + UINT NumRestrictedSharedResourceProcesses; +} D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESSCOUNT_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESSCOUNT_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESSCOUNT_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_INPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input; + UINT ProcessIndex; +} D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_INPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_INPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_INPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_OUTPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; + UINT ProcessIndex; + D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE ProcessIdentifer; + HANDLE ProcessHandle; +} D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYUNCOMPRESSEDENCRYPTIONLEVEL_OUTPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; + GUID EncryptionGuid; +} D3DAUTHENTICATEDCHANNEL_QUERYUNCOMPRESSEDENCRYPTIONLEVEL_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYUNCOMPRESSEDENCRYPTIONLEVEL_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYUNCOMPRESSEDENCRYPTIONLEVEL_OUTPUT; + +typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYUNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT_OUTPUT { + D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; + UINT NumUnrestrictedProtectedSharedResources; +} D3DAUTHENTICATEDCHANNEL_QUERYUNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT_OUTPUT, *PD3DAUTHENTICATEDCHANNEL_QUERYUNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT_OUTPUT, *LPD3DAUTHENTICATEDCHANNEL_QUERYUNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT_OUTPUT; + +typedef struct _D3DBOX { + UINT Left; + UINT Top; + UINT Right; + UINT Bottom; + UINT Front; + UINT Back; +} D3DBOX, *PD3DBOX, *LPD3DBOX; + +typedef struct _D3DCLIPSTATUS9 { + DWORD ClipUnion; + DWORD ClipIntersection; +} D3DCLIPSTATUS9, *PD3DCLIPSTATUS9, *LPD3DCLIPSTATUS9; + +typedef struct _D3DCOLORVALUE { + float r; + float g; + float b; + float a; +} D3DCOLORVALUE, *PD3DCOLORVALUE, *LPD3DCOLORVALUE; + +typedef struct _D3DCOMPOSERECTDESC { + USHORT X, Y; + USHORT Width, Height; +} D3DCOMPOSERECTDESC, *PD3DCOMPOSERECTDESC, *LPD3DCOMPOSERECTDESC; + +typedef struct _D3DCOMPOSERECTDESTINATION { + USHORT SrcRectIndex; + USHORT Reserved; + SHORT X, Y; +} D3DCOMPOSERECTDESTINATION, *PD3DCOMPOSERECTDESTINATION, *LPD3DCOMPOSERECTDESTINATION; + +typedef struct _D3DDEVICE_CREATION_PARAMETERS { + UINT AdapterOrdinal; + D3DDEVTYPE DeviceType; + HWND hFocusWindow; + DWORD BehaviorFlags; +} D3DDEVICE_CREATION_PARAMETERS, *PD3DDEVICE_CREATION_PARAMETERS, *LPD3DDEVICE_CREATION_PARAMETERS; + +typedef struct _D3DDEVINFO_D3D9BANDWIDTHTIMINGS { + FLOAT MaxBandwidthUtilized; + FLOAT FrontEndUploadMemoryUtilizedPercent; + FLOAT VertexRateUtilizedPercent; + FLOAT TriangleSetupRateUtilizedPercent; + FLOAT FillRateUtilizedPercent; +} D3DDEVINFO_D3D9BANDWIDTHTIMINGS, *PD3DDEVINFO_D3D9BANDWIDTHTIMINGS, *LPD3DDEVINFO_D3D9BANDWIDTHTIMINGS; + +typedef struct _D3DDEVINFO_D3D9CACHEUTILIZATION { + FLOAT TextureCacheHitRate; + FLOAT PostTransformVertexCacheHitRate; +} D3DDEVINFO_D3D9CACHEUTILIZATION, *PD3DDEVINFO_D3D9CACHEUTILIZATION, *LPD3DDEVINFO_D3D9CACHEUTILIZATION; + +typedef struct _D3DDEVINFO_D3D9INTERFACETIMINGS { + FLOAT WaitingForGPUToUseApplicationResourceTimePercent; + FLOAT WaitingForGPUToAcceptMoreCommandsTimePercent; + FLOAT WaitingForGPUToStayWithinLatencyTimePercent; + FLOAT WaitingForGPUExclusiveResourceTimePercent; + FLOAT WaitingForGPUOtherTimePercent; +} D3DDEVINFO_D3D9INTERFACETIMINGS, *PD3DDEVINFO_D3D9INTERFACETIMINGS, *LPD3DDEVINFO_D3D9INTERFACETIMINGS; + +typedef struct _D3DDEVINFO_D3D9PIPELINETIMINGS { + FLOAT VertexProcessingTimePercent; + FLOAT PixelProcessingTimePercent; + FLOAT OtherGPUProcessingTimePercent; + FLOAT GPUIdleTimePercent; +} D3DDEVINFO_D3D9PIPELINETIMINGS, *PD3DDEVINFO_D3D9PIPELINETIMINGS, *LPD3DDEVINFO_D3D9PIPELINETIMINGS; + +typedef struct _D3DDEVINFO_D3D9STAGETIMINGS { + FLOAT MemoryProcessingPercent; + FLOAT ComputationProcessingPercent; +} D3DDEVINFO_D3D9STAGETIMINGS, *PD3DDEVINFO_D3D9STAGETIMINGS, *LPD3DDEVINFO_D3D9STAGETIMINGS; + +typedef struct _D3DDEVINFO_D3DVERTEXSTATS { + DWORD NumRenderedTriangles; + DWORD NumExtraClippingTriangles; +} D3DDEVINFO_D3DVERTEXSTATS, *LPD3DDEVINFO_D3DVERTEXSTATS; + +typedef struct _D3DRESOURCESTATS { + BOOL bThrashing; + DWORD ApproxBytesDownloaded; + DWORD NumEvicts; + DWORD NumVidCreates; + DWORD LastPri; + DWORD NumUsed; + DWORD NumUsedInVidMem; + DWORD WorkingSet; + DWORD WorkingSetBytes; + DWORD TotalManaged; + DWORD TotalBytes; +} D3DRESOURCESTATS, *PD3DRESOURCESTATS, *LPD3DRESOURCESTATS; + +typedef struct _D3DDEVINFO_RESOURCEMANAGER { + D3DRESOURCESTATS stats[(D3DRTYPE_INDEXBUFFER+1)]; +} D3DDEVINFO_RESOURCEMANAGER, *LPD3DDEVINFO_RESOURCEMANAGER; + +typedef struct _D3DDEVINFO_VCACHE { + DWORD Pattern; + DWORD OptMethod; + DWORD CacheSize; + DWORD MagicNumber; +} D3DDEVINFO_VCACHE, *LPD3DDEVINFO_VCACHE; + +typedef struct _D3DDISPLAYMODE { + UINT Width; + UINT Height; + UINT RefreshRate; + D3DFORMAT Format; +} D3DDISPLAYMODE, *PD3DDISPLAYMODE, *LPD3DDISPLAYMODE; + +typedef struct _D3DENCRYPTED_BLOCK_INFO { + UINT NumEncryptedBytesAtBeginning; + UINT NumBytesInSkipPattern; + UINT NumBytesInEncryptPattern; +} D3DENCRYPTED_BLOCK_INFO, *PD3DENCRYPTED_BLOCK_INFO, *LPD3DENCRYPTED_BLOCK_INFO; + +typedef struct _D3DGAMMARAMP { + WORD red [256]; + WORD green[256]; + WORD blue [256]; +} D3DGAMMARAMP, *PD3DGAMMARAMP, *LPD3DGAMMARAMP; + +typedef struct _D3DINDEXBUFFER_DESC { + D3DFORMAT Format; + D3DRESOURCETYPE Type; + DWORD Usage; + D3DPOOL Pool; + UINT Size; +} D3DINDEXBUFFER_DESC, *PD3DINDEXBUFFER_DESC, *LPD3DINDEXBUFFER_DESC; + +typedef struct _D3DVECTOR { + float x; + float y; + float z; +} D3DVECTOR, *PD3DVECTOR, *LPD3DVECTOR; + +typedef struct _D3DLIGHT9 { + D3DLIGHTTYPE Type; + D3DCOLORVALUE Diffuse; + D3DCOLORVALUE Specular; + D3DCOLORVALUE Ambient; + D3DVECTOR Position; + D3DVECTOR Direction; + float Range; + float Falloff; + float Attenuation0; + float Attenuation1; + float Attenuation2; + float Theta; + float Phi; +} D3DLIGHT9, *PD3DLIGHT9, *LPD3DLIGHT9; + +typedef struct _D3DLOCKED_BOX { + INT RowPitch; + INT SlicePitch; + void* pBits; +} D3DLOCKED_BOX, *PD3DLOCKED_BOX, *LPD3DLOCKED_BOX; + +typedef struct _D3DLOCKED_RECT { + INT Pitch; + void* pBits; +} D3DLOCKED_RECT, *PD3DLOCKED_RECT, *LPD3DLOCKED_RECT; + +typedef struct _D3DMATERIAL9 { + D3DCOLORVALUE Diffuse; + D3DCOLORVALUE Ambient; + D3DCOLORVALUE Specular; + D3DCOLORVALUE Emissive; + float Power; +} D3DMATERIAL9, *PD3DMATERIAL9, *LPD3DMATERIAL9; + +typedef struct _D3DMATRIX { + union { + struct { + float _11, _12, _13, _14; + float _21, _22, _23, _24; + float _31, _32, _33, _34; + float _41, _42, _43, _44; + }; + float m[4][4]; + }; +} D3DMATRIX, *PD3DMATRIX, *LPD3DMATRIX; + +typedef struct _D3DMEMORYPRESSURE { + UINT64 BytesEvictedFromProcess; + UINT64 SizeOfInefficientAllocation; + DWORD LevelOfEfficiency; +} D3DMEMORYPRESSURE, *PD3DMEMORYPRESSURE, *LPD3DMEMORYPRESSURE; + +typedef struct _D3DPRESENTSTATS { + UINT PresentCount; + UINT PresentRefreshCount; + UINT SyncRefreshCount; + LARGE_INTEGER SyncQPCTime; + LARGE_INTEGER SyncGPUTime; +} D3DPRESENTSTATS, *PD3DPRESENTSTATS, *LPD3DPRESENTSTATS; + +typedef struct _D3DPRESENT_PARAMETERS_ { + UINT BackBufferWidth; + UINT BackBufferHeight; + D3DFORMAT BackBufferFormat; + UINT BackBufferCount; + D3DMULTISAMPLE_TYPE MultiSampleType; + DWORD MultiSampleQuality; + D3DSWAPEFFECT SwapEffect; + HWND hDeviceWindow; + BOOL Windowed; + BOOL EnableAutoDepthStencil; + D3DFORMAT AutoDepthStencilFormat; + DWORD Flags; + UINT FullScreen_RefreshRateInHz; + UINT PresentationInterval; +} D3DPRESENT_PARAMETERS, *PD3DPRESENT_PARAMETERS, *LPD3DPRESENT_PARAMETERS; + +typedef struct _D3DRANGE { + UINT Offset; + UINT Size; +} D3DRANGE, *PD3DRANGE, *LPD3DRANGE; + +typedef struct _D3DRASTER_STATUS { + BOOL InVBlank; + UINT ScanLine; +} D3DRASTER_STATUS, *PD3DRASTER_STATUS, *LPD3DRASTER_STATUS; + +typedef struct _D3DRECT { + LONG x1; + LONG y1; + LONG x2; + LONG y2; +} D3DRECT, *PD3DRECT, *LPD3DRECT; + +typedef struct _D3DRECTPATCH_INFO { + UINT StartVertexOffsetWidth; + UINT StartVertexOffsetHeight; + UINT Width; + UINT Height; + UINT Stride; + D3DBASISTYPE Basis; + D3DDEGREETYPE Degree; +} D3DRECTPATCH_INFO, *PD3DRECTPATCH_INFO, *LPD3DRECTPATCH_INFO; + +typedef struct _D3DSURFACE_DESC { + D3DFORMAT Format; + D3DRESOURCETYPE Type; + DWORD Usage; + D3DPOOL Pool; + D3DMULTISAMPLE_TYPE MultiSampleType; + DWORD MultiSampleQuality; + UINT Width; + UINT Height; +} D3DSURFACE_DESC, *PD3DSURFACE_DESC, *LPD3DSURFACE_DESC; + +typedef struct _D3DTRIPATCH_INFO { + UINT StartVertexOffset; + UINT NumVertices; + D3DBASISTYPE Basis; + D3DDEGREETYPE Degree; +} D3DTRIPATCH_INFO, *PD3DTRIPATCH_INFO, *LPD3DTRIPATCH_INFO; + +typedef struct _D3DVERTEXBUFFER_DESC { + D3DFORMAT Format; + D3DRESOURCETYPE Type; + DWORD Usage; + D3DPOOL Pool; + UINT Size; + DWORD FVF; +} D3DVERTEXBUFFER_DESC, *PD3DVERTEXBUFFER_DESC, *LPD3DVERTEXBUFFER_DESC; + +typedef struct _D3DVERTEXELEMENT9 { + WORD Stream; + WORD Offset; + BYTE Type; + BYTE Method; + BYTE Usage; + BYTE UsageIndex; +} D3DVERTEXELEMENT9, *LPD3DVERTEXELEMENT9; + +typedef struct _D3DVIEWPORT9 { + DWORD X; + DWORD Y; + DWORD Width; + DWORD Height; + float MinZ; + float MaxZ; +} D3DVIEWPORT9, *PD3DVIEWPORT9, *LPD3DVIEWPORT9; + +typedef struct _D3DVOLUME_DESC { + D3DFORMAT Format; + D3DRESOURCETYPE Type; + DWORD Usage; + D3DPOOL Pool; + UINT Width; + UINT Height; + UINT Depth; +} D3DVOLUME_DESC, *PD3DVOLUME_DESC, *LPD3DVOLUME_DESC; + +#ifndef _WIN32 +/* If _WIN32 isn't declared it means only internal header files are used. To + * avoid a conflict, IUnknown is declared here rather than in d3d9.h */ + +typedef struct IUnknown IUnknown, *PUNKNOWN, *LPUNKNOWN; + +#ifdef __cplusplus +extern "C" const GUID IID_IUnknown; + +struct IUnknown +{ + virtual HRESULT WINAPI QueryInterface(REFIID riid, void **ppvObject) = 0; + virtual ULONG WINAPI AddRef() = 0; + virtual ULONG WINAPI Release() = 0; +}; +#else /* __cplusplus */ +extern const GUID IID_IUnknown; + +typedef struct IUnknownVtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(IUnknown *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(IUnknown *This); + ULONG (WINAPI *Release)(IUnknown *This); +} IUnknownVtbl; + +struct IUnknown +{ + IUnknownVtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define IUnknown_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IUnknown_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IUnknown_Release(p) (p)->lpVtbl->Release(p) +#endif /* __cplusplus */ +#endif /* _WIN32 */ + +#endif /* _D3D9TYPES_H_ */ diff --git a/mesalib/include/GLES2/gl2ext.h b/mesalib/include/GLES2/gl2ext.h index a5e3f47d6..2b67c6e0f 100644 --- a/mesalib/include/GLES2/gl2ext.h +++ b/mesalib/include/GLES2/gl2ext.h @@ -33,14 +33,14 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** -** Khronos $Revision: 25922 $ on $Date: 2014-03-17 03:54:32 -0700 (Mon, 17 Mar 2014) $ +** Khronos $Revision: 28335 $ on $Date: 2014-09-26 18:55:45 -0700 (Fri, 26 Sep 2014) $ */ #ifndef GL_APIENTRYP #define GL_APIENTRYP GL_APIENTRY* #endif -/* Generated on date 20140317 */ +/* Generated on date 20140926 */ /* Generated C header for: * API: gles2 @@ -54,7 +54,6 @@ extern "C" { #ifndef GL_KHR_blend_equation_advanced #define GL_KHR_blend_equation_advanced 1 -#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 #define GL_MULTIPLY_KHR 0x9294 #define GL_SCREEN_KHR 0x9295 #define GL_OVERLAY_KHR 0x9296 @@ -76,6 +75,17 @@ GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void); #endif #endif /* GL_KHR_blend_equation_advanced */ +#ifndef GL_KHR_blend_equation_advanced_coherent +#define GL_KHR_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 +#endif /* GL_KHR_blend_equation_advanced_coherent */ + +#ifndef GL_KHR_context_flush_control +#define GL_KHR_context_flush_control 1 +#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x82FC +#endif /* GL_KHR_context_flush_control */ + #ifndef GL_KHR_debug #define GL_KHR_debug 1 typedef void (GL_APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); @@ -145,6 +155,34 @@ GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params); #endif #endif /* GL_KHR_debug */ +#ifndef GL_KHR_robust_buffer_access_behavior +#define GL_KHR_robust_buffer_access_behavior 1 +#endif /* GL_KHR_robust_buffer_access_behavior */ + +#ifndef GL_KHR_robustness +#define GL_KHR_robustness 1 +#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3 +#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252 +#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256 +#define GL_NO_RESET_NOTIFICATION_KHR 0x8261 +#define GL_CONTEXT_LOST_KHR 0x0507 +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSKHRPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusKHR (void); +GL_APICALL void GL_APIENTRY glReadnPixelsKHR (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GL_APICALL void GL_APIENTRY glGetnUniformfvKHR (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetnUniformivKHR (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GL_APICALL void GL_APIENTRY glGetnUniformuivKHR (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +#endif +#endif /* GL_KHR_robustness */ + #ifndef GL_KHR_texture_compression_astc_hdr #define GL_KHR_texture_compression_astc_hdr 1 #define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 @@ -200,6 +238,10 @@ GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum targe #define GL_SAMPLER_EXTERNAL_OES 0x8D66 #endif /* GL_OES_EGL_image_external */ +#ifndef GL_OES_compressed_ETC1_RGB8_sub_texture +#define GL_OES_compressed_ETC1_RGB8_sub_texture 1 +#endif /* GL_OES_compressed_ETC1_RGB8_sub_texture */ + #ifndef GL_OES_compressed_ETC1_RGB8_texture #define GL_OES_compressed_ETC1_RGB8_texture 1 #define GL_ETC1_RGB8_OES 0x8D64 @@ -512,6 +554,10 @@ GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLen #define GL_Z400_BINARY_AMD 0x8740 #endif /* GL_AMD_program_binary_Z400 */ +#ifndef GL_ANDROID_extension_pack_es31a +#define GL_ANDROID_extension_pack_es31a 1 +#endif /* GL_ANDROID_extension_pack_es31a */ + #ifndef GL_ANGLE_depth_texture #define GL_ANGLE_depth_texture 1 #endif /* GL_ANGLE_depth_texture */ @@ -587,6 +633,23 @@ GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLs #endif #endif /* GL_ANGLE_translated_shader_source */ +#ifndef GL_APPLE_clip_distance +#define GL_APPLE_clip_distance 1 +#define GL_MAX_CLIP_DISTANCES_APPLE 0x0D32 +#define GL_CLIP_DISTANCE0_APPLE 0x3000 +#define GL_CLIP_DISTANCE1_APPLE 0x3001 +#define GL_CLIP_DISTANCE2_APPLE 0x3002 +#define GL_CLIP_DISTANCE3_APPLE 0x3003 +#define GL_CLIP_DISTANCE4_APPLE 0x3004 +#define GL_CLIP_DISTANCE5_APPLE 0x3005 +#define GL_CLIP_DISTANCE6_APPLE 0x3006 +#define GL_CLIP_DISTANCE7_APPLE 0x3007 +#endif /* GL_APPLE_clip_distance */ + +#ifndef GL_APPLE_color_buffer_packed_float +#define GL_APPLE_color_buffer_packed_float 1 +#endif /* GL_APPLE_color_buffer_packed_float */ + #ifndef GL_APPLE_copy_texture_levels #define GL_APPLE_copy_texture_levels 1 typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); @@ -667,6 +730,14 @@ GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei #define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D #endif /* GL_APPLE_texture_max_level */ +#ifndef GL_APPLE_texture_packed_float +#define GL_APPLE_texture_packed_float 1 +#define GL_UNSIGNED_INT_10F_11F_11F_REV_APPLE 0x8C3B +#define GL_UNSIGNED_INT_5_9_9_9_REV_APPLE 0x8C3E +#define GL_R11F_G11F_B10F_APPLE 0x8C3A +#define GL_RGB9_E5_APPLE 0x8C3D +#endif /* GL_APPLE_texture_packed_float */ + #ifndef GL_ARM_mali_program_binary #define GL_ARM_mali_program_binary 1 #define GL_MALI_PROGRAM_BINARY_ARM 0x8F61 @@ -691,6 +762,13 @@ GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei #define GL_ARM_shader_framebuffer_fetch_depth_stencil 1 #endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */ +#ifndef GL_DMP_program_binary +#define GL_DMP_program_binary 1 +#define GL_SMAPHS30_PROGRAM_BINARY_DMP 0x9251 +#define GL_SMAPHS_PROGRAM_BINARY_DMP 0x9252 +#define GL_DMP_PROGRAM_BINARY_DMP 0x9253 +#endif /* GL_DMP_program_binary */ + #ifndef GL_DMP_shader_binary #define GL_DMP_shader_binary 1 #define GL_SHADER_BINARY_DMP 0x9250 @@ -712,6 +790,14 @@ GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei #define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 #endif /* GL_EXT_color_buffer_half_float */ +#ifndef GL_EXT_copy_image +#define GL_EXT_copy_image 1 +typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAEXTPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyImageSubDataEXT (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#endif +#endif /* GL_EXT_copy_image */ + #ifndef GL_EXT_debug_label #define GL_EXT_debug_label 1 #define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F @@ -829,6 +915,30 @@ GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs); #endif #endif /* GL_EXT_draw_buffers */ +#ifndef GL_EXT_draw_buffers_indexed +#define GL_EXT_draw_buffers_indexed 1 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +typedef void (GL_APIENTRYP PFNGLENABLEIEXTPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLDISABLEIEXTPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIEXTPROC) (GLuint buf, GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIEXTPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCIEXTPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIEXTPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (GL_APIENTRYP PFNGLCOLORMASKIEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIEXTPROC) (GLenum target, GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEnableiEXT (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glDisableiEXT (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glBlendEquationiEXT (GLuint buf, GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparateiEXT (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunciEXT (GLuint buf, GLenum src, GLenum dst); +GL_APICALL void GL_APIENTRY glBlendFuncSeparateiEXT (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glColorMaskiEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GL_APICALL GLboolean GL_APIENTRY glIsEnablediEXT (GLenum target, GLuint index); +#endif +#endif /* GL_EXT_draw_buffers_indexed */ + #ifndef GL_EXT_draw_instanced #define GL_EXT_draw_instanced 1 typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); @@ -839,6 +949,55 @@ GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei cou #endif #endif /* GL_EXT_draw_instanced */ +#ifndef GL_EXT_geometry_point_size +#define GL_EXT_geometry_point_size 1 +#endif /* GL_EXT_geometry_point_size */ + +#ifndef GL_EXT_geometry_shader +#define GL_EXT_geometry_shader 1 +#define GL_GEOMETRY_SHADER_EXT 0x8DD9 +#define GL_GEOMETRY_SHADER_BIT_EXT 0x00000004 +#define GL_GEOMETRY_LINKED_VERTICES_OUT_EXT 0x8916 +#define GL_GEOMETRY_LINKED_INPUT_TYPE_EXT 0x8917 +#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT 0x8918 +#define GL_GEOMETRY_SHADER_INVOCATIONS_EXT 0x887F +#define GL_LAYER_PROVOKING_VERTEX_EXT 0x825E +#define GL_LINES_ADJACENCY_EXT 0x000A +#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B +#define GL_TRIANGLES_ADJACENCY_EXT 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT 0x8A2C +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8A32 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT 0x9124 +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT 0x8E5A +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT 0x92CF +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT 0x92D5 +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT 0x90CD +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT 0x90D7 +#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E +#define GL_UNDEFINED_VERTEX_EXT 0x8260 +#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT 0x9312 +#define GL_MAX_FRAMEBUFFER_LAYERS_EXT 0x9317 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 +#define GL_REFERENCED_BY_GEOMETRY_SHADER_EXT 0x9309 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); +#endif +#endif /* GL_EXT_geometry_shader */ + +#ifndef GL_EXT_gpu_shader5 +#define GL_EXT_gpu_shader5 1 +#endif /* GL_EXT_gpu_shader5 */ + #ifndef GL_EXT_instanced_arrays #define GL_EXT_instanced_arrays 1 #define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE @@ -911,12 +1070,23 @@ GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLi #define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A #endif /* GL_EXT_occlusion_query_boolean */ +#ifndef GL_EXT_primitive_bounding_box +#define GL_EXT_primitive_bounding_box 1 +#define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE +typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxEXT (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#endif +#endif /* GL_EXT_primitive_bounding_box */ + #ifndef GL_EXT_pvrtc_sRGB #define GL_EXT_pvrtc_sRGB 1 #define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 #define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 #define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 #define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1 #endif /* GL_EXT_pvrtc_sRGB */ #ifndef GL_EXT_read_format_bgra @@ -1064,10 +1234,18 @@ GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLin #define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 #endif /* GL_EXT_shader_framebuffer_fetch */ +#ifndef GL_EXT_shader_implicit_conversions +#define GL_EXT_shader_implicit_conversions 1 +#endif /* GL_EXT_shader_implicit_conversions */ + #ifndef GL_EXT_shader_integer_mix #define GL_EXT_shader_integer_mix 1 #endif /* GL_EXT_shader_integer_mix */ +#ifndef GL_EXT_shader_io_blocks +#define GL_EXT_shader_io_blocks 1 +#endif /* GL_EXT_shader_io_blocks */ + #ifndef GL_EXT_shader_pixel_local_storage #define GL_EXT_shader_pixel_local_storage 1 #define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63 @@ -1087,6 +1265,109 @@ GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLin #define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 #endif /* GL_EXT_shadow_samplers */ +#ifndef GL_EXT_tessellation_point_size +#define GL_EXT_tessellation_point_size 1 +#endif /* GL_EXT_tessellation_point_size */ + +#ifndef GL_EXT_tessellation_shader +#define GL_EXT_tessellation_shader 1 +#define GL_PATCHES_EXT 0x000E +#define GL_PATCH_VERTICES_EXT 0x8E72 +#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75 +#define GL_TESS_GEN_MODE_EXT 0x8E76 +#define GL_TESS_GEN_SPACING_EXT 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78 +#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79 +#define GL_ISOLINES_EXT 0x8E7A +#define GL_QUADS_EXT 0x0007 +#define GL_FRACTIONAL_ODD_EXT 0x8E7B +#define GL_FRACTIONAL_EVEN_EXT 0x8E7C +#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4 +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 +#define GL_IS_PER_PATCH_EXT 0x92E7 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308 +#define GL_TESS_CONTROL_SHADER_EXT 0x8E88 +#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87 +#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010 +typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPatchParameteriEXT (GLenum pname, GLint value); +#endif +#endif /* GL_EXT_tessellation_shader */ + +#ifndef GL_EXT_texture_border_clamp +#define GL_EXT_texture_border_clamp 1 +#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004 +#define GL_CLAMP_TO_BORDER_EXT 0x812D +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glSamplerParameterIivEXT (GLuint sampler, GLenum pname, const GLint *param); +GL_APICALL void GL_APIENTRY glSamplerParameterIuivEXT (GLuint sampler, GLenum pname, const GLuint *param); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIivEXT (GLuint sampler, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivEXT (GLuint sampler, GLenum pname, GLuint *params); +#endif +#endif /* GL_EXT_texture_border_clamp */ + +#ifndef GL_EXT_texture_buffer +#define GL_EXT_texture_buffer 1 +#define GL_TEXTURE_BUFFER_EXT 0x8C2A +#define GL_TEXTURE_BUFFER_BINDING_EXT 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F +#define GL_SAMPLER_BUFFER_EXT 0x8DC2 +#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 +#define GL_IMAGE_BUFFER_EXT 0x9051 +#define GL_INT_IMAGE_BUFFER_EXT 0x905C +#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 +#define GL_TEXTURE_BUFFER_OFFSET_EXT 0x919D +#define GL_TEXTURE_BUFFER_SIZE_EXT 0x919E +typedef void (GL_APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEEXTPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer); +GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#endif +#endif /* GL_EXT_texture_buffer */ + #ifndef GL_EXT_texture_compression_dxt1 #define GL_EXT_texture_compression_dxt1 1 #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 @@ -1099,6 +1380,19 @@ GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLin #define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 #endif /* GL_EXT_texture_compression_s3tc */ +#ifndef GL_EXT_texture_cube_map_array +#define GL_EXT_texture_cube_map_array 1 +#define GL_TEXTURE_CUBE_MAP_ARRAY_EXT 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT 0x900A +#define GL_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900F +#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A +#endif /* GL_EXT_texture_cube_map_array */ + #ifndef GL_EXT_texture_filter_anisotropic #define GL_EXT_texture_filter_anisotropic 1 #define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE @@ -1161,6 +1455,19 @@ GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target #define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 #endif /* GL_EXT_texture_type_2_10_10_10_REV */ +#ifndef GL_EXT_texture_view +#define GL_EXT_texture_view 1 +#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWEXTPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTextureViewEXT (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#endif +#endif /* GL_EXT_texture_view */ + #ifndef GL_EXT_unpack_subimage #define GL_EXT_unpack_subimage 1 #define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2 diff --git a/mesalib/include/d3dadapter/d3dadapter9.h b/mesalib/include/d3dadapter/d3dadapter9.h new file mode 100644 index 000000000..76ad3d4cf --- /dev/null +++ b/mesalib/include/d3dadapter/d3dadapter9.h @@ -0,0 +1,101 @@ +/* + * Copyright 2011 Joakim Sindholt <opensource@zhasha.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _D3DADAPTER9_H_ +#define _D3DADAPTER9_H_ + +#include "present.h" + +#ifndef __cplusplus + +/* Representation of an adapter group, although since this is implemented by + * the driver, it knows nothing about the windowing system it's on */ +typedef struct ID3DAdapter9Vtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(ID3DAdapter9 *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(ID3DAdapter9 *This); + ULONG (WINAPI *Release)(ID3DAdapter9 *This); + + /* ID3DAdapter9 */ + HRESULT (WINAPI *GetAdapterIdentifier)(ID3DAdapter9 *This, DWORD Flags, D3DADAPTER_IDENTIFIER9 *pIdentifier); + HRESULT (WINAPI *CheckDeviceType)(ID3DAdapter9 *This, D3DDEVTYPE DevType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed); + HRESULT (WINAPI *CheckDeviceFormat)(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat); + HRESULT (WINAPI *CheckDeviceMultiSampleType)(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD *pQualityLevels); + HRESULT (WINAPI *CheckDepthStencilMatch)(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat); + HRESULT (WINAPI *CheckDeviceFormatConversion)(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat); + HRESULT (WINAPI *GetDeviceCaps)(ID3DAdapter9 *This, D3DDEVTYPE DeviceType, D3DCAPS9 *pCaps); + HRESULT (WINAPI *CreateDevice)(ID3DAdapter9 *This, UINT RealAdapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3D9 *pD3D9, ID3DPresentGroup *pPresentationFactory, IDirect3DDevice9 **ppReturnedDeviceInterface); + HRESULT (WINAPI *CreateDeviceEx)(ID3DAdapter9 *This, UINT RealAdapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode, IDirect3D9Ex *pD3D9Ex, ID3DPresentGroup *pPresentationFactory, IDirect3DDevice9Ex **ppReturnedDeviceInterface); +} ID3DAdapter9Vtbl; + +struct ID3DAdapter9 +{ + ID3DAdapter9Vtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define ID3DAdapter9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define ID3DAdapter9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define ID3DAdapter9_Release(p) (p)->lpVtbl->Release(p) +/* ID3DAdapter9 macros */ +#define ID3DAdapter9_GetAdapterIdentifier(p,a,b) (p)->lpVtbl->GetAdapterIdentifier(p,a,b) +#define ID3DAdapter9_CheckDeviceType(p,a,b,c,d) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d) +#define ID3DAdapter9_CheckDeviceFormat(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e) +#define ID3DAdapter9_CheckDeviceMultiSampleType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e) +#define ID3DAdapter9_CheckDepthStencilMatch(p,a,b,c,d) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d) +#define ID3DAdapter9_CheckDeviceFormatConversion(p,a,b,c) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c) +#define ID3DAdapter9_GetDeviceCaps(p,a,b) (p)->lpVtbl->GetDeviceCaps(p,a,b) +#define ID3DAdapter9_CreateDevice(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f,g,h) +#define ID3DAdapter9_CreateDeviceEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d,e,f,g,h,i) + +#else /* __cplusplus */ + +struct ID3DAdapter9 : public IUnknown +{ + HRESULT WINAPI GetAdapterIdentifier(DWORD Flags, D3DADAPTER_IDENTIFIER9 *pIdentifier); + HRESULT WINAPI CheckDeviceType(D3DDEVTYPE DevType, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed); + HRESULT WINAPI CheckDeviceFormat(D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat); + HRESULT WINAPI CheckDeviceMultiSampleType(D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD *pQualityLevels); + HRESULT WINAPI CheckDepthStencilMatch(D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat); + HRESULT WINAPI CheckDeviceFormatConversion(D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat); + HRESULT WINAPI GetDeviceCaps(D3DDEVTYPE DeviceType, D3DCAPS9 *pCaps); + HRESULT WINAPI CreateDevice(UINT RealAdapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3D9 *pD3D9, ID3DPresentGroup *pPresentationFactory, IDirect3DDevice9 **ppReturnedDeviceInterface); + HRESULT WINAPI CreateDeviceEx(UINT RealAdapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode, IDirect3D9Ex *pD3D9Ex, ID3DPresentGroup *pPresentationFactory, IDirect3DDevice9Ex **ppReturnedDeviceInterface); +}; + +#endif /* __cplusplus */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* acquire a const struct D3DAdapter9* structure describing the interface + * queried. See */ +const void * WINAPI +D3DAdapter9GetProc( const char *name ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _D3DADAPTER9_H_ */ diff --git a/mesalib/include/d3dadapter/drm.h b/mesalib/include/d3dadapter/drm.h new file mode 100644 index 000000000..9ec3e6066 --- /dev/null +++ b/mesalib/include/d3dadapter/drm.h @@ -0,0 +1,44 @@ +/* + * Copyright 2011 Joakim Sindholt <opensource@zhasha.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _D3DADAPTER9_DRM_H_ +#define _D3DADAPTER9_DRM_H_ + +#include "d3dadapter9.h" + +/* query driver support name */ +#define D3DADAPTER9DRM_NAME "drm" +/* current version */ +#define D3DADAPTER9DRM_MAJOR 0 +#define D3DADAPTER9DRM_MINOR 0 + +struct D3DAdapter9DRM +{ + unsigned major_version; /* ABI break */ + unsigned minor_version; /* backwards compatible feature additions */ + + /* NOTE: upon passing an fd to this function, it's now owned by this + function. If this function fails, the fd will be closed here as well */ + HRESULT (WINAPI *create_adapter)(int fd, ID3DAdapter9 **ppAdapter); +}; + +#endif /* _D3DADAPTER9_DRM_H_ */ diff --git a/mesalib/include/d3dadapter/present.h b/mesalib/include/d3dadapter/present.h new file mode 100644 index 000000000..08a972972 --- /dev/null +++ b/mesalib/include/d3dadapter/present.h @@ -0,0 +1,136 @@ +/* + * Copyright 2011 Joakim Sindholt <opensource@zhasha.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _D3DADAPTER_PRESENT_H_ +#define _D3DADAPTER_PRESENT_H_ + +#include <d3d9.h> + +#ifndef D3DOK_WINDOW_OCCLUDED +#define D3DOK_WINDOW_OCCLUDED MAKE_D3DSTATUS(2531) +#endif /* D3DOK_WINDOW_OCCLUDED */ + +#ifndef __cplusplus +typedef struct ID3DPresent ID3DPresent; +typedef struct ID3DPresentGroup ID3DPresentGroup; +typedef struct ID3DAdapter9 ID3DAdapter9; +typedef struct D3DWindowBuffer D3DWindowBuffer; + +/* Presentation backend for drivers to display their brilliant work */ +typedef struct ID3DPresentVtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(ID3DPresent *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(ID3DPresent *This); + ULONG (WINAPI *Release)(ID3DPresent *This); + + /* ID3DPresent */ + /* This function initializes the screen and window provided at creation. + * Hence why this should always be called as the one of first things a new + * swap chain does */ + HRESULT (WINAPI *SetPresentParameters)(ID3DPresent *This, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode); + /* Make a buffer visible to the window system via dma-buf fd. + * For better compatibility, it must be 32bpp and format ARGB/XRGB */ + HRESULT (WINAPI *NewD3DWindowBufferFromDmaBuf)(ID3DPresent *This, int dmaBufFd, int width, int height, int stride, int depth, int bpp, D3DWindowBuffer **out); + HRESULT (WINAPI *DestroyD3DWindowBuffer)(ID3DPresent *This, D3DWindowBuffer *buffer); + /* After presenting a buffer to the window system, the buffer + * may be used as is (no copy of the content) by the window system. + * You must not use a non-released buffer, else the user may see undefined content. */ + HRESULT (WINAPI *WaitBufferReleased)(ID3DPresent *This, D3DWindowBuffer *buffer); + HRESULT (WINAPI *FrontBufferCopy)(ID3DPresent *This, D3DWindowBuffer *buffer); + /* It is possible to do partial copy, but impossible to do resizing, which must + * be done by the client after checking the front buffer size */ + HRESULT (WINAPI *PresentBuffer)(ID3DPresent *This, D3DWindowBuffer *buffer, HWND hWndOverride, const RECT *pSourceRect, const RECT *pDestRect, const RGNDATA *pDirtyRegion, DWORD Flags); + HRESULT (WINAPI *GetRasterStatus)(ID3DPresent *This, D3DRASTER_STATUS *pRasterStatus); + HRESULT (WINAPI *GetDisplayMode)(ID3DPresent *This, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation); + HRESULT (WINAPI *GetPresentStats)(ID3DPresent *This, D3DPRESENTSTATS *pStats); + HRESULT (WINAPI *GetCursorPos)(ID3DPresent *This, POINT *pPoint); + HRESULT (WINAPI *SetCursorPos)(ID3DPresent *This, POINT *pPoint); + /* Cursor size is always 32x32. pBitmap and pHotspot can be NULL. */ + HRESULT (WINAPI *SetCursor)(ID3DPresent *This, void *pBitmap, POINT *pHotspot, BOOL bShow); + HRESULT (WINAPI *SetGammaRamp)(ID3DPresent *This, const D3DGAMMARAMP *pRamp, HWND hWndOverride); + HRESULT (WINAPI *GetWindowInfo)(ID3DPresent *This, HWND hWnd, int *width, int *height, int *depth); +} ID3DPresentVtbl; + +struct ID3DPresent +{ + ID3DPresentVtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define ID3DPresent_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define ID3DPresent_AddRef(p) (p)->lpVtbl->AddRef(p) +#define ID3DPresent_Release(p) (p)->lpVtbl->Release(p) +/* ID3DPresent macros */ +#define ID3DPresent_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a) +#define ID3DPresent_SetPresentParameters(p,a,b) (p)->lpVtbl->SetPresentParameters(p,a,b) +#define ID3DPresent_NewD3DWindowBufferFromDmaBuf(p,a,b,c,d,e,f,g) (p)->lpVtbl->NewD3DWindowBufferFromDmaBuf(p,a,b,c,d,e,f,g) +#define ID3DPresent_DestroyD3DWindowBuffer(p,a) (p)->lpVtbl->DestroyD3DWindowBuffer(p,a) +#define ID3DPresent_WaitBufferReleased(p,a) (p)->lpVtbl->WaitBufferReleased(p,a) +#define ID3DPresent_FrontBufferCopy(p,a) (p)->lpVtbl->FrontBufferCopy(p,a) +#define ID3DPresent_PresentBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->PresentBuffer(p,a,b,c,d,e,f) +#define ID3DPresent_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) +#define ID3DPresent_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b) +#define ID3DPresent_GetPresentStats(p,a) (p)->lpVtbl->GetPresentStats(p,a) +#define ID3DPresent_GetCursorPos(p,a) (p)->lpVtbl->GetCursorPos(p,a) +#define ID3DPresent_SetCursorPos(p,a) (p)->lpVtbl->SetCursorPos(p,a) +#define ID3DPresent_SetCursor(p,a,b,c) (p)->lpVtbl->SetCursor(p,a,b,c) +#define ID3DPresent_SetGammaRamp(p,a,b) (p)->lpVtbl->SetGammaRamp(p,a,b) +#define ID3DPresent_GetWindowInfo(p,a,b,c,d) (p)->lpVtbl->GetWindowSize(p,a,b,c,d) + +typedef struct ID3DPresentGroupVtbl +{ + /* IUnknown */ + HRESULT (WINAPI *QueryInterface)(ID3DPresentGroup *This, REFIID riid, void **ppvObject); + ULONG (WINAPI *AddRef)(ID3DPresentGroup *This); + ULONG (WINAPI *Release)(ID3DPresentGroup *This); + + /* ID3DPresentGroup */ + /* When creating a device, it's relevant for the driver to know how many + * implicit swap chains to create. It has to create one per monitor in a + * multi-monitor setup */ + UINT (WINAPI *GetMultiheadCount)(ID3DPresentGroup *This); + /* returns only the implicit present interfaces */ + HRESULT (WINAPI *GetPresent)(ID3DPresentGroup *This, UINT Index, ID3DPresent **ppPresent); + /* used to create additional presentation interfaces along the way */ + HRESULT (WINAPI *CreateAdditionalPresent)(ID3DPresentGroup *This, D3DPRESENT_PARAMETERS *pPresentationParameters, ID3DPresent **ppPresent); + void (WINAPI *GetVersion) (ID3DPresentGroup *This, int *major, int *minor); +} ID3DPresentGroupVtbl; + +struct ID3DPresentGroup +{ + ID3DPresentGroupVtbl *lpVtbl; +}; + +/* IUnknown macros */ +#define ID3DPresentGroup_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define ID3DPresentGroup_AddRef(p) (p)->lpVtbl->AddRef(p) +#define ID3DPresentGroup_Release(p) (p)->lpVtbl->Release(p) +/* ID3DPresentGroup */ +#define ID3DPresentGroup_GetMultiheadCount(p) (p)->lpVtbl->GetMultiheadCount(p) +#define ID3DPresentGroup_GetPresent(p,a,b) (p)->lpVtbl->GetPresent(p,a,b) +#define ID3DPresentGroup_CreateAdditionalPresent(p,a,b) (p)->lpVtbl->CreateAdditionalPresent(p,a,b) +#define ID3DPresentGroup_GetVersion(p,a,b) (p)->lpVtbl->GetVersion(p,a,b) + +#endif /* __cplusplus */ + +#endif /* _D3DADAPTER_PRESENT_H_ */ diff --git a/mesalib/scons/gallium.py b/mesalib/scons/gallium.py index dd5ca56a2..8e2090bc6 100644 --- a/mesalib/scons/gallium.py +++ b/mesalib/scons/gallium.py @@ -301,6 +301,10 @@ def generate(env): cppdefines += ['HAVE_ALIAS'] else: cppdefines += ['GLX_ALIAS_UNSUPPORTED'] + + if env['platform'] in ('linux', 'darwin'): + cppdefines += ['HAVE_XLOCALE_H'] + if env['platform'] == 'haiku': cppdefines += [ 'HAVE_PTHREAD', @@ -374,22 +378,19 @@ def generate(env): #'-march=pentium4', ] if distutils.version.LooseVersion(ccversion) >= distutils.version.LooseVersion('4.2') \ - and (platform != 'windows' or env['build'] == 'debug' or True) \ and platform != 'haiku': # NOTE: We need to ensure stack is realigned given that we # produce shared objects, and have no control over the stack # alignment policy of the application. Therefore we need # -mstackrealign ore -mincoming-stack-boundary=2. # - # XXX: -O and -mstackrealign causes stack corruption on MinGW - # # XXX: We could have SSE without -mstackrealign if we always used # __attribute__((force_align_arg_pointer)), but that's not # always the case. ccflags += [ '-mstackrealign', # ensure stack is aligned - '-mmmx', '-msse', '-msse2', # enable SIMD intrinsics - #'-mfpmath=sse', + '-msse', '-msse2', # enable SIMD intrinsics + '-mfpmath=sse', # generate SSE floating-point arithmetic ] if platform in ['windows', 'darwin']: # Workaround http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216 @@ -468,7 +469,7 @@ def generate(env): ] if env['machine'] == 'x86': ccflags += [ - #'/arch:SSE2', # use the SSE2 instructions + '/arch:SSE2', # use the SSE2 instructions (default since MSVC 2012) ] if platform == 'windows': ccflags += [ @@ -617,7 +618,7 @@ def generate(env): env.Tool('custom') createInstallMethods(env) - env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes']) + env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes', 'glproto >= 1.4.13']) env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1', 'xcb-dri2 >= 1.8']) env.PkgCheckModules('XF86VIDMODE', ['xxf86vm']) env.PkgCheckModules('DRM', ['libdrm >= 2.4.38']) diff --git a/mesalib/src/gallium/Automake.inc b/mesalib/src/gallium/Automake.inc index c43f735c3..9b312b113 100644 --- a/mesalib/src/gallium/Automake.inc +++ b/mesalib/src/gallium/Automake.inc @@ -58,7 +58,8 @@ GALLIUM_WINSYS_CFLAGS = \ GALLIUM_PIPE_LOADER_WINSYS_LIBS = \ - $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la + $(top_builddir)/src/gallium/winsys/sw/null/libws_null.la \ + $(top_builddir)/src/gallium/winsys/sw/wrapper/libwsw.la if HAVE_DRISW GALLIUM_PIPE_LOADER_WINSYS_LIBS += \ diff --git a/mesalib/src/gallium/Makefile.am b/mesalib/src/gallium/Makefile.am index 21595a1aa..81840b208 100644 --- a/mesalib/src/gallium/Makefile.am +++ b/mesalib/src/gallium/Makefile.am @@ -138,14 +138,6 @@ if HAVE_OPENVG SUBDIRS += state_trackers/vega endif -if HAVE_GALLIUM_EGL -SUBDIRS += state_trackers/egl targets/egl-static -endif - -if HAVE_GALLIUM_GBM -SUBDIRS += state_trackers/gbm targets/gbm -endif - if HAVE_X11_DRIVER SUBDIRS += state_trackers/glx/xlib targets/libgl-xlib endif @@ -174,11 +166,16 @@ if HAVE_ST_XVMC SUBDIRS += state_trackers/xvmc targets/xvmc endif +if HAVE_ST_NINE +SUBDIRS += state_trackers/nine targets/d3dadapter9 +endif + ## ## Don't forget to bundle the remaining (non autotools) state-trackers/targets ## EXTRA_DIST += \ + include \ state_trackers/README \ state_trackers/wgl targets/libgl-gdi \ targets/graw-gdi targets/graw-null targets/graw-xlib \ diff --git a/mesalib/src/gallium/auxiliary/Android.mk b/mesalib/src/gallium/auxiliary/Android.mk index 8046943c1..0bc183170 100644 --- a/mesalib/src/gallium/auxiliary/Android.mk +++ b/mesalib/src/gallium/auxiliary/Android.mk @@ -28,7 +28,9 @@ include $(LOCAL_PATH)/Makefile.sources include $(CLEAR_VARS) -LOCAL_SRC_FILES := $(C_SOURCES) +LOCAL_SRC_FILES := \ + $(C_SOURCES) \ + $(VL_STUB_SOURCES) LOCAL_C_INCLUDES := \ $(GALLIUM_TOP)/auxiliary/util \ diff --git a/mesalib/src/gallium/auxiliary/Makefile.am b/mesalib/src/gallium/auxiliary/Makefile.am index 4d8ba89cc..4085e510b 100644 --- a/mesalib/src/gallium/auxiliary/Makefile.am +++ b/mesalib/src/gallium/auxiliary/Makefile.am @@ -30,8 +30,7 @@ AM_CXXFLAGS += \ $(LLVM_CXXFLAGS) libgallium_la_SOURCES += \ - $(GALLIVM_SOURCES) \ - $(GALLIVM_CPP_SOURCES) + $(GALLIVM_SOURCES) endif @@ -46,3 +45,42 @@ indices/u_unfilled_gen.c: $(srcdir)/indices/u_unfilled_gen.py util/u_format_table.c: $(srcdir)/util/u_format_table.py $(srcdir)/util/u_format_pack.py $(srcdir)/util/u_format_parse.py $(srcdir)/util/u_format.csv $(AM_V_at)$(MKDIR_P) util $(AM_V_GEN) $(PYTHON2) $(srcdir)/util/u_format_table.py $(srcdir)/util/u_format.csv > $@ + + +noinst_LTLIBRARIES += libgalliumvl_stub.la +libgalliumvl_stub_la_SOURCES = \ + $(VL_STUB_SOURCES) + +if NEED_GALLIUM_VL + +noinst_LTLIBRARIES += libgalliumvl.la + +libgalliumvl_la_CFLAGS = \ + $(AM_CFLAGS) \ + $(VL_CFLAGS) \ + $(LIBDRM_CFLAGS) \ + $(GALLIUM_PIPE_LOADER_DEFINES) \ + -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\" + +if HAVE_GALLIUM_STATIC_TARGETS +libgalliumvl_la_CFLAGS += \ + -DGALLIUM_STATIC_TARGETS=1 + +endif # HAVE_GALLIUM_STATIC_TARGETS + +libgalliumvl_la_SOURCES = \ + $(VL_SOURCES) + +endif + +EXTRA_DIST = \ + Android.mk SConscript \ + indices/u_indices.c \ + indices/u_unfilled_indices.c \ + indices/u_indices_gen.py \ + indices/u_unfilled_gen.py \ + target-helpers \ + util/u_format.csv \ + util/u_format_pack.py \ + util/u_format_parse.py \ + util/u_format_table.py diff --git a/mesalib/src/gallium/auxiliary/Makefile.sources b/mesalib/src/gallium/auxiliary/Makefile.sources index f6621ef99..862626461 100644 --- a/mesalib/src/gallium/auxiliary/Makefile.sources +++ b/mesalib/src/gallium/auxiliary/Makefile.sources @@ -1,13 +1,23 @@ C_SOURCES := \ cso_cache/cso_cache.c \ + cso_cache/cso_cache.h \ cso_cache/cso_context.c \ + cso_cache/cso_context.h \ cso_cache/cso_hash.c \ + cso_cache/cso_hash.h \ + draw/draw_cliptest_tmp.h \ draw/draw_context.c \ + draw/draw_context.h \ + draw/draw_decompose_tmp.h \ draw/draw_fs.c \ + draw/draw_fs.h \ draw/draw_gs.c \ - draw/draw_pipe.c \ + draw/draw_gs.h \ + draw/draw_gs_tmp.h \ draw/draw_pipe_aaline.c \ draw/draw_pipe_aapoint.c \ + draw/draw_pipe.c \ + draw/draw_pipe.h \ draw/draw_pipe_clip.c \ draw/draw_pipe_cull.c \ draw/draw_pipe_flatshade.c \ @@ -22,142 +32,315 @@ C_SOURCES := \ draw/draw_pipe_wide_line.c \ draw/draw_pipe_wide_point.c \ draw/draw_prim_assembler.c \ + draw/draw_prim_assembler.h \ + draw/draw_prim_assembler_tmp.h \ + draw/draw_private.h \ draw/draw_pt.c \ + draw/draw_pt_decompose.h \ draw/draw_pt_emit.c \ draw/draw_pt_fetch.c \ draw/draw_pt_fetch_emit.c \ draw/draw_pt_fetch_shade_emit.c \ draw/draw_pt_fetch_shade_pipeline.c \ + draw/draw_pt.h \ draw/draw_pt_post_vs.c \ draw/draw_pt_so_emit.c \ draw/draw_pt_util.c \ draw/draw_pt_vsplit.c \ + draw/draw_pt_vsplit_tmp.h \ + draw/draw_so_emit_tmp.h \ + draw/draw_split_tmp.h \ + draw/draw_vbuf.h \ draw/draw_vertex.c \ + draw/draw_vertex.h \ draw/draw_vs.c \ draw/draw_vs_exec.c \ + draw/draw_vs.h \ draw/draw_vs_variant.c \ hud/font.c \ + hud/font.h \ hud/hud_context.c \ + hud/hud_context.h \ hud/hud_cpu.c \ + hud/hud_driver_query.c \ hud/hud_fps.c \ - hud/hud_driver_query.c \ + hud/hud_private.h \ + indices/u_indices.h \ + indices/u_indices_priv.h \ indices/u_primconvert.c \ + indices/u_primconvert.h \ + os/os_memory_aligned.h \ + os/os_memory_debug.h \ + os/os_memory_stdc.h \ + os/os_memory.h \ os/os_misc.c \ + os/os_misc.h \ + os/os_mman.h \ os/os_process.c \ + os/os_process.h \ + os/os_thread.h \ os/os_time.c \ + os/os_time.h \ pipebuffer/pb_buffer_fenced.c \ + pipebuffer/pb_buffer_fenced.h \ + pipebuffer/pb_buffer.h \ pipebuffer/pb_buffer_malloc.c \ pipebuffer/pb_bufmgr_alt.c \ pipebuffer/pb_bufmgr_cache.c \ pipebuffer/pb_bufmgr_debug.c \ + pipebuffer/pb_bufmgr.h \ pipebuffer/pb_bufmgr_mm.c \ pipebuffer/pb_bufmgr_ondemand.c \ pipebuffer/pb_bufmgr_pool.c \ pipebuffer/pb_bufmgr_slab.c \ pipebuffer/pb_validate.c \ + pipebuffer/pb_validate.h \ + postprocess/filters.h \ + postprocess/postprocess.h \ postprocess/pp_celshade.c \ + postprocess/pp_celshade.h \ postprocess/pp_colors.c \ + postprocess/pp_colors.h \ + postprocess/pp_filters.h \ postprocess/pp_init.c \ + postprocess/pp_mlaa_areamap.h \ postprocess/pp_mlaa.c \ - postprocess/pp_run.c \ + postprocess/pp_mlaa.h \ + postprocess/pp_private.h \ postprocess/pp_program.c \ + postprocess/pp_run.c \ rbug/rbug_connection.c \ + rbug/rbug_connection.h \ rbug/rbug_context.c \ + rbug/rbug_context.h \ rbug/rbug_core.c \ + rbug/rbug_core.h \ rbug/rbug_demarshal.c \ - rbug/rbug_texture.c \ + rbug/rbug.h \ + rbug/rbug_internal.h \ + rbug/rbug_proto.h \ rbug/rbug_shader.c \ + rbug/rbug_shader.h \ + rbug/rbug_texture.c \ + rbug/rbug_texture.h \ rtasm/rtasm_cpu.c \ + rtasm/rtasm_cpu.h \ rtasm/rtasm_execmem.c \ + rtasm/rtasm_execmem.h \ rtasm/rtasm_x86sse.c \ + rtasm/rtasm_x86sse.h \ tgsi/tgsi_build.c \ + tgsi/tgsi_build.h \ tgsi/tgsi_dump.c \ + tgsi/tgsi_dump.h \ tgsi/tgsi_exec.c \ + tgsi/tgsi_exec.h \ tgsi/tgsi_info.c \ + tgsi/tgsi_info.h \ tgsi/tgsi_iterate.c \ + tgsi/tgsi_iterate.h \ tgsi/tgsi_lowering.c \ + tgsi/tgsi_lowering.h \ + tgsi/tgsi_opcode_tmp.h \ tgsi/tgsi_parse.c \ + tgsi/tgsi_parse.h \ tgsi/tgsi_sanity.c \ + tgsi/tgsi_sanity.h \ tgsi/tgsi_scan.c \ + tgsi/tgsi_scan.h \ tgsi/tgsi_strings.c \ + tgsi/tgsi_strings.h \ tgsi/tgsi_text.c \ + tgsi/tgsi_text.h \ tgsi/tgsi_transform.c \ + tgsi/tgsi_transform.h \ tgsi/tgsi_ureg.c \ + tgsi/tgsi_ureg.h \ tgsi/tgsi_util.c \ + tgsi/tgsi_util.h \ translate/translate.c \ + translate/translate.h \ translate/translate_cache.c \ + translate/translate_cache.h \ translate/translate_generic.c \ translate/translate_sse.c \ + util/dbghelp.h \ + util/u_atomic.h \ + util/u_bitmask.c \ + util/u_bitmask.h \ + util/u_blit.c \ + util/u_blit.h \ + util/u_blitter.c \ + util/u_blitter.h \ + util/u_box.h \ + util/u_cache.c \ + util/u_cache.h \ + util/u_caps.c \ + util/u_caps.h \ + util/u_clear.h \ + util/u_cpu_detect.c \ + util/u_cpu_detect.h \ util/u_debug.c \ util/u_debug_describe.c \ + util/u_debug_describe.h \ util/u_debug_flush.c \ + util/u_debug_flush.h \ + util/u_debug.h \ util/u_debug_memory.c \ util/u_debug_refcnt.c \ + util/u_debug_refcnt.h \ util/u_debug_stack.c \ + util/u_debug_stack.h \ util/u_debug_symbol.c \ - util/u_dump_defines.c \ - util/u_dump_state.c \ - util/u_bitmask.c \ - util/u_blit.c \ - util/u_blitter.c \ - util/u_cache.c \ - util/u_caps.c \ - util/u_cpu_detect.c \ + util/u_debug_symbol.h \ + util/u_dirty_flags.h \ + util/u_dirty_surfaces.h \ util/u_dl.c \ + util/u_dl.h \ + util/u_double_list.h \ util/u_draw.c \ + util/u_draw.h \ util/u_draw_quad.c \ + util/u_draw_quad.h \ + util/u_dual_blend.h \ + util/u_dump_defines.c \ + util/u_dump.h \ + util/u_dump_state.c \ + util/u_dynarray.h \ + util/u_fifo.h \ + util/u_format_bptc.c \ + util/u_format_bptc.h \ util/u_format.c \ - util/u_format_other.c \ + util/u_format_etc.c \ + util/u_format_etc.h \ + util/u_format.h \ util/u_format_latc.c \ - util/u_format_s3tc.c \ + util/u_format_latc.h \ + util/u_format_other.c \ + util/u_format_other.h \ + util/u_format_r11g11b10f.h \ + util/u_format_rgb9e5.h \ util/u_format_rgtc.c \ - util/u_format_etc.c \ - util/u_format_bptc.c \ + util/u_format_rgtc.h \ + util/u_format_s3tc.c \ + util/u_format_s3tc.h \ util/u_format_tests.c \ + util/u_format_tests.h \ util/u_format_yuv.c \ + util/u_format_yuv.h \ util/u_format_zs.c \ + util/u_format_zs.h \ util/u_framebuffer.c \ + util/u_framebuffer.h \ util/u_gen_mipmap.c \ + util/u_gen_mipmap.h \ + util/u_half.h \ util/u_handle_table.c \ + util/u_handle_table.h \ util/u_hash.c \ + util/u_hash.h \ util/u_hash_table.c \ + util/u_hash_table.h \ util/u_helpers.c \ + util/u_helpers.h \ util/u_index_modify.c \ + util/u_index_modify.h \ + util/u_init.h \ + util/u_inlines.h \ util/u_keymap.c \ + util/u_keymap.h \ util/u_linear.c \ + util/u_linear.h \ util/u_linkage.c \ - util/u_network.c \ + util/u_linkage.h \ util/u_math.c \ + util/u_math.h \ + util/u_memory.h \ util/u_mm.c \ + util/u_mm.h \ + util/u_network.c \ + util/u_network.h \ + util/u_pack_color.h \ + util/u_pointer.h \ + util/u_prim.h \ util/u_pstipple.c \ + util/u_pstipple.h \ + util/u_range.h \ + util/u_rect.h \ + util/u_resource.c \ + util/u_resource.h \ util/u_ringbuffer.c \ + util/u_ringbuffer.h \ util/u_sampler.c \ + util/u_sampler.h \ + util/u_simple_list.h \ util/u_simple_shaders.c \ + util/u_simple_shaders.h \ util/u_slab.c \ + util/u_slab.h \ util/u_snprintf.c \ + util/u_split_prim.h \ + util/u_sse.h \ util/u_staging.c \ + util/u_staging.h \ + util/u_string.h \ util/u_suballoc.c \ + util/u_suballoc.h \ util/u_surface.c \ + util/u_surface.h \ util/u_surfaces.c \ + util/u_surfaces.h \ + util/u_tests.c \ + util/u_tests.h \ util/u_texture.c \ + util/u_texture.h \ util/u_tile.c \ + util/u_tile.h \ + util/u_time.h \ util/u_transfer.c \ - util/u_resource.c \ + util/u_transfer.h \ util/u_upload_mgr.c \ + util/u_upload_mgr.h \ util/u_vbuf.c \ - vl/vl_csc.c \ + util/u_vbuf.h \ + util/u_video.h + +VL_SOURCES := \ vl/vl_compositor.c \ + vl/vl_compositor.h \ + vl/vl_csc.c \ + vl/vl_csc.h \ + vl/vl_decoder.c \ + vl/vl_decoder.h \ + vl/vl_defines.h \ + vl/vl_deint_filter.c \ + vl/vl_deint_filter.h \ + vl/vl_idct.c \ + vl/vl_idct.h \ vl/vl_matrix_filter.c \ + vl/vl_matrix_filter.h \ + vl/vl_mc.c \ + vl/vl_mc.h \ vl/vl_median_filter.c \ - vl/vl_decoder.c \ - vl/vl_mpeg12_decoder.c \ + vl/vl_median_filter.h \ vl/vl_mpeg12_bitstream.c \ + vl/vl_mpeg12_bitstream.h \ + vl/vl_mpeg12_decoder.c \ + vl/vl_mpeg12_decoder.h \ + vl/vl_rbsp.h \ + vl/vl_types.h \ + vl/vl_vertex_buffers.c \ + vl/vl_vertex_buffers.h \ + vl/vl_video_buffer.c \ + vl/vl_video_buffer.h \ + vl/vl_vlc.h \ + vl/vl_winsys.h \ + vl/vl_winsys_dri.c \ vl/vl_zscan.c \ - vl/vl_idct.c \ - vl/vl_mc.c \ - vl/vl_vertex_buffers.c \ - vl/vl_video_buffer.c \ - vl/vl_deint_filter.c + vl/vl_zscan.h + +VL_STUB_SOURCES := \ + vl/vl_stubs.c GENERATED_SOURCES := \ indices/u_indices_gen.c \ @@ -165,42 +348,67 @@ GENERATED_SOURCES := \ util/u_format_table.c GALLIVM_SOURCES := \ - gallivm/lp_bld_arit.c \ - gallivm/lp_bld_arit_overflow.c \ - gallivm/lp_bld_assert.c \ - gallivm/lp_bld_bitarit.c \ - gallivm/lp_bld_const.c \ - gallivm/lp_bld_conv.c \ - gallivm/lp_bld_flow.c \ - gallivm/lp_bld_format_aos.c \ - gallivm/lp_bld_format_aos_array.c \ - gallivm/lp_bld_format_float.c \ - gallivm/lp_bld_format_srgb.c \ - gallivm/lp_bld_format_soa.c \ - gallivm/lp_bld_format_yuv.c \ - gallivm/lp_bld_gather.c \ - gallivm/lp_bld_init.c \ - gallivm/lp_bld_intr.c \ - gallivm/lp_bld_logic.c \ - gallivm/lp_bld_pack.c \ - gallivm/lp_bld_printf.c \ - gallivm/lp_bld_quad.c \ - gallivm/lp_bld_sample.c \ - gallivm/lp_bld_sample_aos.c \ - gallivm/lp_bld_sample_soa.c \ - gallivm/lp_bld_struct.c \ - gallivm/lp_bld_swizzle.c \ - gallivm/lp_bld_tgsi.c \ - gallivm/lp_bld_tgsi_action.c \ - gallivm/lp_bld_tgsi_aos.c \ - gallivm/lp_bld_tgsi_info.c \ - gallivm/lp_bld_tgsi_soa.c \ - gallivm/lp_bld_type.c \ - draw/draw_llvm.c \ - draw/draw_llvm_sample.c \ - draw/draw_vs_llvm.c \ - draw/draw_pt_fetch_shade_pipeline_llvm.c - -GALLIVM_CPP_SOURCES := \ + gallivm/lp_bld_arit.c \ + gallivm/lp_bld_arit.h \ + gallivm/lp_bld_arit_overflow.c \ + gallivm/lp_bld_arit_overflow.h \ + gallivm/lp_bld_assert.c \ + gallivm/lp_bld_assert.h \ + gallivm/lp_bld_bitarit.c \ + gallivm/lp_bld_bitarit.h \ + gallivm/lp_bld_const.c \ + gallivm/lp_bld_const.h \ + gallivm/lp_bld_conv.c \ + gallivm/lp_bld_conv.h \ gallivm/lp_bld_debug.cpp \ - gallivm/lp_bld_misc.cpp + gallivm/lp_bld_debug.h \ + gallivm/lp_bld_flow.c \ + gallivm/lp_bld_flow.h \ + gallivm/lp_bld_format_aos_array.c \ + gallivm/lp_bld_format_aos.c \ + gallivm/lp_bld_format_float.c \ + gallivm/lp_bld_format.h \ + gallivm/lp_bld_format_soa.c \ + gallivm/lp_bld_format_srgb.c \ + gallivm/lp_bld_format_yuv.c \ + gallivm/lp_bld_gather.c \ + gallivm/lp_bld_gather.h \ + gallivm/lp_bld.h \ + gallivm/lp_bld_init.c \ + gallivm/lp_bld_init.h \ + gallivm/lp_bld_intr.c \ + gallivm/lp_bld_intr.h \ + gallivm/lp_bld_limits.h \ + gallivm/lp_bld_logic.c \ + gallivm/lp_bld_logic.h \ + gallivm/lp_bld_misc.cpp \ + gallivm/lp_bld_misc.h \ + gallivm/lp_bld_pack.c \ + gallivm/lp_bld_pack.h \ + gallivm/lp_bld_printf.c \ + gallivm/lp_bld_printf.h \ + gallivm/lp_bld_quad.c \ + gallivm/lp_bld_quad.h \ + gallivm/lp_bld_sample_aos.c \ + gallivm/lp_bld_sample_aos.h \ + gallivm/lp_bld_sample.c \ + gallivm/lp_bld_sample.h \ + gallivm/lp_bld_sample_soa.c \ + gallivm/lp_bld_struct.c \ + gallivm/lp_bld_struct.h \ + gallivm/lp_bld_swizzle.c \ + gallivm/lp_bld_swizzle.h \ + gallivm/lp_bld_tgsi_action.c \ + gallivm/lp_bld_tgsi_action.h \ + gallivm/lp_bld_tgsi_aos.c \ + gallivm/lp_bld_tgsi.c \ + gallivm/lp_bld_tgsi.h \ + gallivm/lp_bld_tgsi_info.c \ + gallivm/lp_bld_tgsi_soa.c \ + gallivm/lp_bld_type.c \ + gallivm/lp_bld_type.h \ + draw/draw_llvm.c \ + draw/draw_llvm.h \ + draw/draw_llvm_sample.c \ + draw/draw_pt_fetch_shade_pipeline_llvm.c \ + draw/draw_vs_llvm.c diff --git a/mesalib/src/gallium/auxiliary/SConscript b/mesalib/src/gallium/auxiliary/SConscript index 94041d247..6cb6b8c65 100644 --- a/mesalib/src/gallium/auxiliary/SConscript +++ b/mesalib/src/gallium/auxiliary/SConscript @@ -36,13 +36,13 @@ env.Depends('util/u_format_table.c', [ source = env.ParseSourceList('Makefile.sources', [ 'C_SOURCES', + 'VL_STUB_SOURCES', 'GENERATED_SOURCES' ]) if env['llvm']: source += env.ParseSourceList('Makefile.sources', [ 'GALLIVM_SOURCES', - 'GALLIVM_CPP_SOURCES' ]) gallium = env.ConvenienceLibrary( diff --git a/mesalib/src/gallium/auxiliary/hud/hud_context.c b/mesalib/src/gallium/auxiliary/hud/hud_context.c index 18a878118..98678fc9f 100644 --- a/mesalib/src/gallium/auxiliary/hud/hud_context.c +++ b/mesalib/src/gallium/auxiliary/hud/hud_context.c @@ -444,11 +444,9 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex) viewport.scale[0] = 0.5f * hud->fb_width; viewport.scale[1] = 0.5f * hud->fb_height; viewport.scale[2] = 1.0f; - viewport.scale[3] = 1.0f; viewport.translate[0] = 0.5f * hud->fb_width; viewport.translate[1] = 0.5f * hud->fb_height; viewport.translate[2] = 0.0f; - viewport.translate[3] = 0.0f; cso_set_framebuffer(cso, &fb); cso_set_sample_mask(cso, ~0); diff --git a/mesalib/src/gallium/auxiliary/util/u_atomic.h b/mesalib/src/gallium/auxiliary/util/u_atomic.h index 2f2b42b34..2500bc752 100644 --- a/mesalib/src/gallium/auxiliary/util/u_atomic.h +++ b/mesalib/src/gallium/auxiliary/util/u_atomic.h @@ -24,12 +24,12 @@ #define PIPE_ATOMIC_MSVC_INTRINSIC #elif (defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)) #define PIPE_ATOMIC_ASM_MSVC_X86 +#elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401) +#define PIPE_ATOMIC_GCC_INTRINSIC #elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)) #define PIPE_ATOMIC_ASM_GCC_X86 #elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64)) #define PIPE_ATOMIC_ASM_GCC_X86_64 -#elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401) -#define PIPE_ATOMIC_GCC_INTRINSIC #else #error "Unsupported platform" #endif @@ -69,6 +69,18 @@ p_atomic_dec(int32_t *v) } static INLINE int32_t +p_atomic_inc_return(int32_t *v) +{ + return __sync_add_and_fetch(v, 1); +} + +static INLINE int32_t +p_atomic_dec_return(int32_t *v) +{ + return __sync_sub_and_fetch(v, 1); +} + +static INLINE int32_t p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) { return __sync_val_compare_and_swap(v, old, _new); @@ -116,6 +128,18 @@ p_atomic_dec(int32_t *v) } static INLINE int32_t +p_atomic_inc_return(int32_t *v) +{ + return __sync_add_and_fetch(v, 1); +} + +static INLINE int32_t +p_atomic_dec_return(int32_t *v) +{ + return __sync_sub_and_fetch(v, 1); +} + +static INLINE int32_t p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) { return __sync_val_compare_and_swap(v, old, _new); @@ -161,6 +185,18 @@ p_atomic_dec(int32_t *v) } static INLINE int32_t +p_atomic_inc_return(int32_t *v) +{ + return __sync_add_and_fetch(v, 1); +} + +static INLINE int32_t +p_atomic_dec_return(int32_t *v) +{ + return __sync_sub_and_fetch(v, 1); +} + +static INLINE int32_t p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) { return __sync_val_compare_and_swap(v, old, _new); @@ -186,6 +222,8 @@ p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) #define p_atomic_dec_zero(_v) ((boolean) --(*(_v))) #define p_atomic_inc(_v) ((void) (*(_v))++) #define p_atomic_dec(_v) ((void) (*(_v))--) +#define p_atomic_inc_return(_v) ((*(_v))++) +#define p_atomic_dec_return(_v) ((*(_v))--) #define p_atomic_cmpxchg(_v, old, _new) (*(_v) == old ? *(_v) = (_new) : *(_v)) #endif @@ -288,6 +326,12 @@ p_atomic_inc(int32_t *v) _InterlockedIncrement((long *)v); } +static INLINE int32_t +p_atomic_inc_return(int32_t *v) +{ + return _InterlockedIncrement((long *)v); +} + static INLINE void p_atomic_dec(int32_t *v) { @@ -295,6 +339,12 @@ p_atomic_dec(int32_t *v) } static INLINE int32_t +p_atomic_dec_return(int32_t *v) +{ + return _InterlockedDecrement((long *)v); +} + +static INLINE int32_t p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) { return _InterlockedCompareExchange((long *)v, _new, old); @@ -329,6 +379,8 @@ p_atomic_dec_zero(int32_t *v) #define p_atomic_inc(_v) atomic_inc_32((uint32_t *) _v) #define p_atomic_dec(_v) atomic_dec_32((uint32_t *) _v) +#define p_atomic_inc_return(_v) atomic_inc_32_nv((uint32_t *) _v) +#define p_atomic_dec_return(_v) atomic_dec_32_nv((uint32_t *) _v) #define p_atomic_cmpxchg(_v, _old, _new) \ atomic_cas_32( (uint32_t *) _v, (uint32_t) _old, (uint32_t) _new) diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.c b/mesalib/src/gallium/auxiliary/util/u_blit.c index 2573bedf5..90408ffdc 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blit.c +++ b/mesalib/src/gallium/auxiliary/util/u_blit.c @@ -188,7 +188,7 @@ set_vertex_shader(struct blit_state *ctx) const uint semantic_indexes[] = { 0, 0 }; ctx->vs = util_make_vertex_passthrough_shader(ctx->pipe, 2, semantic_names, - semantic_indexes); + semantic_indexes, FALSE); } cso_set_vertex_shader_handle(ctx->cso, ctx->vs); @@ -559,11 +559,9 @@ util_blit_pixels_tex(struct blit_state *ctx, ctx->viewport.scale[0] = 0.5f * dst->width; ctx->viewport.scale[1] = 0.5f * dst->height; ctx->viewport.scale[2] = 0.5f; - ctx->viewport.scale[3] = 1.0f; ctx->viewport.translate[0] = 0.5f * dst->width; ctx->viewport.translate[1] = 0.5f * dst->height; ctx->viewport.translate[2] = 0.5f; - ctx->viewport.translate[3] = 0.0f; cso_set_viewport(ctx->cso, &ctx->viewport); /* texture */ diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index e59fa0481..9d087fe8a 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -319,7 +319,8 @@ static void bind_vs_pos_only(struct blitter_context_priv *ctx) ctx->vs_pos_only = util_make_vertex_passthrough_shader_with_so(pipe, 1, semantic_names, - semantic_indices, &so); + semantic_indices, FALSE, + &so); } pipe->bind_vs_state(pipe, ctx->vs_pos_only); @@ -335,7 +336,7 @@ static void bind_vs_passthrough(struct blitter_context_priv *ctx) const uint semantic_indices[] = { 0, 0 }; ctx->vs = util_make_vertex_passthrough_shader(pipe, 2, semantic_names, - semantic_indices); + semantic_indices, FALSE); } pipe->bind_vs_state(pipe, ctx->vs); @@ -682,11 +683,9 @@ static void blitter_set_rectangle(struct blitter_context_priv *ctx, ctx->viewport.scale[0] = 0.5f * ctx->dst_width; ctx->viewport.scale[1] = 0.5f * ctx->dst_height; ctx->viewport.scale[2] = 1.0f; - ctx->viewport.scale[3] = 1.0f; ctx->viewport.translate[0] = 0.5f * ctx->dst_width; ctx->viewport.translate[1] = 0.5f * ctx->dst_height; ctx->viewport.translate[2] = 0.0f; - ctx->viewport.translate[3] = 0.0f; ctx->base.pipe->set_viewport_states(ctx->base.pipe, 0, 1, &ctx->viewport); } diff --git a/mesalib/src/gallium/auxiliary/util/u_box.h b/mesalib/src/gallium/auxiliary/util/u_box.h index 0b28d0f12..520a3d596 100644 --- a/mesalib/src/gallium/auxiliary/util/u_box.h +++ b/mesalib/src/gallium/auxiliary/util/u_box.h @@ -2,6 +2,7 @@ #define UTIL_BOX_INLINES_H #include "pipe/p_state.h" +#include "util/u_math.h" static INLINE void u_box_1d( unsigned x, @@ -77,4 +78,121 @@ void u_box_3d( unsigned x, box->depth = d; } +/* Clips @dst to width @w and height @h. + * Returns -1 if the resulting box would be empty (then @dst is left unchanged). + * 0 if nothing has been reduced. + * 1 if width has been reduced. + * 2 if height has been reduced. + * 3 if both width and height have been reduced. + * Aliasing permitted. + */ +static INLINE int +u_box_clip_2d(struct pipe_box *dst, + const struct pipe_box *box, int w, int h) +{ + unsigned i; + int a[2], b[2], dim[2]; + int *start, *end; + int res = 0; + + if (!box->width || !box->height) + return -1; + dim[0] = w; + dim[1] = h; + a[0] = box->x; + a[1] = box->y; + b[0] = box->x + box->width; + b[1] = box->y + box->height; + + for (i = 0; i < 2; ++i) { + start = (a[i] <= b[i]) ? &a[i] : &b[i]; + end = (a[i] <= b[i]) ? &b[i] : &a[i]; + + if (*end < 0 || *start >= dim[i]) + return -1; + if (*start < 0) { + *start = 0; + res |= (1 << i); + } + if (*end > dim[i]) { + *end = dim[i]; + res |= (1 << i); + } + } + + if (res) { + dst->x = a[0]; + dst->y = a[1]; + dst->width = b[0] - a[0]; + dst->height = b[1] - a[1]; + } + return res; +} + +static INLINE int64_t +u_box_volume_3d(const struct pipe_box *box) +{ + return (int64_t)box->width * box->height * box->depth; +} + +/* Aliasing of @dst permitted. */ +static INLINE void +u_box_union_2d(struct pipe_box *dst, + const struct pipe_box *a, const struct pipe_box *b) +{ + dst->x = MIN2(a->x, b->x); + dst->y = MIN2(a->y, b->y); + + dst->width = MAX2(a->x + a->width, b->x + b->width) - dst->x; + dst->height = MAX2(a->y + a->height, b->y + b->height) - dst->y; +} + +/* Aliasing of @dst permitted. */ +static INLINE void +u_box_union_3d(struct pipe_box *dst, + const struct pipe_box *a, const struct pipe_box *b) +{ + dst->x = MIN2(a->x, b->x); + dst->y = MIN2(a->y, b->y); + dst->z = MIN2(a->z, b->z); + + dst->width = MAX2(a->x + a->width, b->x + b->width) - dst->x; + dst->height = MAX2(a->y + a->height, b->y + b->height) - dst->y; + dst->depth = MAX2(a->z + a->depth, b->z + b->depth) - dst->z; +} + +static INLINE boolean +u_box_test_intersection_2d(const struct pipe_box *a, + const struct pipe_box *b) +{ + unsigned i; + int a_l[2], a_r[2], b_l[2], b_r[2]; + + a_l[0] = MIN2(a->x, a->x + a->width); + a_r[0] = MAX2(a->x, a->x + a->width); + a_l[1] = MIN2(a->y, a->y + a->height); + a_r[1] = MAX2(a->y, a->y + a->height); + + b_l[0] = MIN2(b->x, b->x + b->width); + b_r[0] = MAX2(b->x, b->x + b->width); + b_l[1] = MIN2(b->y, b->y + b->height); + b_r[1] = MAX2(b->y, b->y + b->height); + + for (i = 0; i < 2; ++i) { + if (a_l[i] > b_r[i] || a_r[i] < b_l[i]) + return FALSE; + } + return TRUE; +} + +static INLINE void +u_box_minify_2d(struct pipe_box *dst, + const struct pipe_box *src, unsigned l) +{ + dst->x = src->x >> l; + dst->y = src->y >> l; + dst->width = MAX2(src->width >> l, 1); + dst->height = MAX2(src->height >> l, 1); +} + #endif diff --git a/mesalib/src/gallium/auxiliary/util/u_format_pack.py b/mesalib/src/gallium/auxiliary/util/u_format_pack.py index 6ccf04c29..d5138cc05 100644 --- a/mesalib/src/gallium/auxiliary/util/u_format_pack.py +++ b/mesalib/src/gallium/auxiliary/util/u_format_pack.py @@ -207,9 +207,36 @@ def get_one_shift(type): assert False +def truncate_mantissa(x, bits): + '''Truncate an integer so it can be represented exactly with a floating + point mantissa''' + + assert isinstance(x, (int, long)) + + s = 1 + if x < 0: + s = -1 + x = -x + + # We can represent integers up to mantissa + 1 bits exactly + mask = (1 << (bits + 1)) - 1 + + # Slide the mask until the MSB matches + shift = 0 + while (x >> shift) & ~mask: + shift += 1 + + x &= mask << shift + x *= s + return x + + def value_to_native(type, value): '''Get the value of unity for this type.''' if type.type == FLOAT: + if type.size <= 32 \ + and isinstance(value, (int, long)): + return truncate_mantissa(value, 23) return value if type.type == FIXED: return int(value * (1 << (type.size/2))) @@ -226,9 +253,9 @@ def native_to_constant(type, value): '''Get the value of unity for this type.''' if type.type == FLOAT: if type.size <= 32: - return "%ff" % value + return "%.1ff" % float(value) else: - return "%ff" % value + return "%.1f" % float(value) else: return str(int(value)) @@ -251,8 +278,8 @@ def clamp_expr(src_channel, dst_channel, dst_native_type, value): dst_max = dst_channel.max() # Translate the destination range to the src native value - dst_min_native = value_to_native(src_channel, dst_min) - dst_max_native = value_to_native(src_channel, dst_max) + dst_min_native = native_to_constant(src_channel, value_to_native(src_channel, dst_min)) + dst_max_native = native_to_constant(src_channel, value_to_native(src_channel, dst_max)) if src_min < dst_min and src_max > dst_max: return 'CLAMP(%s, %s, %s)' % (value, dst_min_native, dst_max_native) diff --git a/mesalib/src/gallium/auxiliary/util/u_pstipple.c b/mesalib/src/gallium/auxiliary/util/u_pstipple.c index 509f815c5..1e1ec4a98 100644 --- a/mesalib/src/gallium/auxiliary/util/u_pstipple.c +++ b/mesalib/src/gallium/auxiliary/util/u_pstipple.c @@ -180,9 +180,7 @@ struct pstip_transform_context { int maxInput; uint samplersUsed; /**< bitfield of samplers used */ int freeSampler; /** an available sampler for the pstipple */ - int texTemp; /**< temp registers */ int numImmed; - boolean firstInstruction; uint coordOrigin; }; @@ -243,7 +241,7 @@ free_bit(uint bitfield) /** - * TGSI instruction transform callback. + * TGSI transform prolog * Before the first instruction, insert our new code to sample the * stipple texture (using the fragment coord register) then kill the * fragment if the stipple texture bit is off. @@ -256,165 +254,95 @@ free_bit(uint bitfield) * [...original code...] */ static void -pstip_transform_inst(struct tgsi_transform_context *ctx, - struct tgsi_full_instruction *inst) +pstip_transform_prolog(struct tgsi_transform_context *ctx) { struct pstip_transform_context *pctx = (struct pstip_transform_context *) ctx; + int wincoordInput; + int texTemp; + + /* find free texture sampler */ + pctx->freeSampler = free_bit(pctx->samplersUsed); + if (pctx->freeSampler >= PIPE_MAX_SAMPLERS) + pctx->freeSampler = PIPE_MAX_SAMPLERS - 1; + + if (pctx->wincoordInput < 0) + wincoordInput = pctx->maxInput + 1; + else + wincoordInput = pctx->wincoordInput; + + if (pctx->wincoordInput < 0) { + /* declare new position input reg */ + tgsi_transform_input_decl(ctx, wincoordInput, + TGSI_SEMANTIC_POSITION, 1, + TGSI_INTERPOLATE_LINEAR); + } - if (pctx->firstInstruction) { - /* emit our new declarations before the first instruction */ - - struct tgsi_full_declaration decl; - struct tgsi_full_instruction newInst; - uint i; - int wincoordInput; - - /* find free texture sampler */ - pctx->freeSampler = free_bit(pctx->samplersUsed); - if (pctx->freeSampler >= PIPE_MAX_SAMPLERS) - pctx->freeSampler = PIPE_MAX_SAMPLERS - 1; - - if (pctx->wincoordInput < 0) - wincoordInput = pctx->maxInput + 1; - else - wincoordInput = pctx->wincoordInput; - - /* find one free temp register */ - for (i = 0; i < 32; i++) { - if ((pctx->tempsUsed & (1 << i)) == 0) { - /* found a free temp */ - if (pctx->texTemp < 0) - pctx->texTemp = i; - else - break; - } - } - assert(pctx->texTemp >= 0); - - if (pctx->wincoordInput < 0) { - /* declare new position input reg */ - decl = tgsi_default_full_declaration(); - decl.Declaration.File = TGSI_FILE_INPUT; - decl.Declaration.Interpolate = 1; - decl.Declaration.Semantic = 1; - decl.Semantic.Name = TGSI_SEMANTIC_POSITION; - decl.Semantic.Index = 0; - decl.Range.First = - decl.Range.Last = wincoordInput; - decl.Interp.Interpolate = TGSI_INTERPOLATE_LINEAR; - ctx->emit_declaration(ctx, &decl); - } + /* declare new sampler */ + tgsi_transform_sampler_decl(ctx, pctx->freeSampler); - /* declare new sampler */ - decl = tgsi_default_full_declaration(); - decl.Declaration.File = TGSI_FILE_SAMPLER; - decl.Range.First = - decl.Range.Last = pctx->freeSampler; - ctx->emit_declaration(ctx, &decl); - - /* declare new temp regs */ - decl = tgsi_default_full_declaration(); - decl.Declaration.File = TGSI_FILE_TEMPORARY; - decl.Range.First = - decl.Range.Last = pctx->texTemp; - ctx->emit_declaration(ctx, &decl); - - /* emit immediate = {1/32, 1/32, 1, 1} - * The index/position of this immediate will be pctx->numImmed - */ - { - static const float value[4] = { 1.0/32, 1.0/32, 1.0, 1.0 }; - struct tgsi_full_immediate immed; - uint size = 4; - immed = tgsi_default_full_immediate(); - immed.Immediate.NrTokens = 1 + size; /* one for the token itself */ - immed.u[0].Float = value[0]; - immed.u[1].Float = value[1]; - immed.u[2].Float = value[2]; - immed.u[3].Float = value[3]; - ctx->emit_immediate(ctx, &immed); - } - - pctx->firstInstruction = FALSE; - - - /* - * Insert new MUL/TEX/KILL_IF instructions at start of program - * Take gl_FragCoord, divide by 32 (stipple size), sample the - * texture and kill fragment if needed. - * - * We'd like to use non-normalized texcoords to index into a RECT - * texture, but we can only use REPEAT wrap mode with normalized - * texcoords. Darn. - */ - - /* XXX invert wincoord if origin isn't lower-left... */ - - /* MUL texTemp, INPUT[wincoord], 1/32; */ - newInst = tgsi_default_full_instruction(); - newInst.Instruction.Opcode = TGSI_OPCODE_MUL; - newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].Register.Index = pctx->texTemp; - newInst.Instruction.NumSrcRegs = 2; - newInst.Src[0].Register.File = TGSI_FILE_INPUT; - newInst.Src[0].Register.Index = wincoordInput; - newInst.Src[1].Register.File = TGSI_FILE_IMMEDIATE; - newInst.Src[1].Register.Index = pctx->numImmed; - ctx->emit_instruction(ctx, &newInst); - - /* TEX texTemp, texTemp, sampler; */ - newInst = tgsi_default_full_instruction(); - newInst.Instruction.Opcode = TGSI_OPCODE_TEX; - newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].Register.Index = pctx->texTemp; - newInst.Instruction.NumSrcRegs = 2; - newInst.Instruction.Texture = TRUE; - newInst.Texture.Texture = TGSI_TEXTURE_2D; - newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].Register.Index = pctx->texTemp; - newInst.Src[1].Register.File = TGSI_FILE_SAMPLER; - newInst.Src[1].Register.Index = pctx->freeSampler; - ctx->emit_instruction(ctx, &newInst); - - /* KILL_IF -texTemp; # if -texTemp < 0, kill fragment */ - newInst = tgsi_default_full_instruction(); - newInst.Instruction.Opcode = TGSI_OPCODE_KILL_IF; - newInst.Instruction.NumDstRegs = 0; - newInst.Instruction.NumSrcRegs = 1; - newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].Register.Index = pctx->texTemp; - newInst.Src[0].Register.Negate = 1; - ctx->emit_instruction(ctx, &newInst); + /* Declare temp[0] reg if not already declared. + * We can always use temp[0] since this code is before + * the rest of the shader. + */ + texTemp = 0; + if ((pctx->tempsUsed & (1 << texTemp)) == 0) { + tgsi_transform_temp_decl(ctx, texTemp); } - /* emit this instruction */ - ctx->emit_instruction(ctx, inst); + /* emit immediate = {1/32, 1/32, 1, 1} + * The index/position of this immediate will be pctx->numImmed + */ + tgsi_transform_immediate_decl(ctx, 1.0/32.0, 1.0/32.0, 1.0, 1.0); + + /* + * Insert new MUL/TEX/KILL_IF instructions at start of program + * Take gl_FragCoord, divide by 32 (stipple size), sample the + * texture and kill fragment if needed. + * + * We'd like to use non-normalized texcoords to index into a RECT + * texture, but we can only use REPEAT wrap mode with normalized + * texcoords. Darn. + */ + + /* XXX invert wincoord if origin isn't lower-left... */ + + /* MUL texTemp, INPUT[wincoord], 1/32; */ + tgsi_transform_op2_inst(ctx, TGSI_OPCODE_MUL, + TGSI_FILE_TEMPORARY, texTemp, + TGSI_WRITEMASK_XYZW, + TGSI_FILE_INPUT, wincoordInput, + TGSI_FILE_IMMEDIATE, pctx->numImmed); + + /* TEX texTemp, texTemp, sampler; */ + tgsi_transform_tex_2d_inst(ctx, + TGSI_FILE_TEMPORARY, texTemp, + TGSI_FILE_TEMPORARY, texTemp, + pctx->freeSampler); + + /* KILL_IF -texTemp; # if -texTemp < 0, kill fragment */ + tgsi_transform_kill_inst(ctx, + TGSI_FILE_TEMPORARY, texTemp, + TGSI_SWIZZLE_W); } /** * Given a fragment shader, return a new fragment shader which * samples a stipple texture and executes KILL. + * \param samplerUnitOut returns the index of the sampler unit which + * will be used to sample the stipple texture */ -struct pipe_shader_state * -util_pstipple_create_fragment_shader(struct pipe_context *pipe, - struct pipe_shader_state *fs, +struct tgsi_token * +util_pstipple_create_fragment_shader(const struct tgsi_token *tokens, unsigned *samplerUnitOut) { - struct pipe_shader_state *new_fs; struct pstip_transform_context transform; - const uint newLen = tgsi_num_tokens(fs->tokens) + NUM_NEW_TOKENS; - - new_fs = MALLOC(sizeof(*new_fs)); - if (!new_fs) - return NULL; + const uint newLen = tgsi_num_tokens(tokens) + NUM_NEW_TOKENS; + struct tgsi_token *new_tokens; - new_fs->tokens = tgsi_alloc_tokens(newLen); - if (!new_fs->tokens) { - FREE(new_fs); + new_tokens = tgsi_alloc_tokens(newLen); + if (!new_tokens) { return NULL; } @@ -423,21 +351,17 @@ util_pstipple_create_fragment_shader(struct pipe_context *pipe, memset(&transform, 0, sizeof(transform)); transform.wincoordInput = -1; transform.maxInput = -1; - transform.texTemp = -1; - transform.firstInstruction = TRUE; transform.coordOrigin = TGSI_FS_COORD_ORIGIN_UPPER_LEFT; - transform.base.transform_instruction = pstip_transform_inst; + transform.base.prolog = pstip_transform_prolog; transform.base.transform_declaration = pstip_transform_decl; transform.base.transform_immediate = pstip_transform_immed; - tgsi_scan_shader(fs->tokens, &transform.info); + tgsi_scan_shader(tokens, &transform.info); transform.coordOrigin = transform.info.properties[TGSI_PROPERTY_FS_COORD_ORIGIN]; - tgsi_transform_shader(fs->tokens, - (struct tgsi_token *) new_fs->tokens, - newLen, &transform.base); + tgsi_transform_shader(tokens, new_tokens, newLen, &transform.base); #if 0 /* DEBUG */ tgsi_dump(fs->tokens, 0); @@ -447,6 +371,6 @@ util_pstipple_create_fragment_shader(struct pipe_context *pipe, assert(transform.freeSampler < PIPE_MAX_SAMPLERS); *samplerUnitOut = transform.freeSampler; - return new_fs; + return new_tokens; } diff --git a/mesalib/src/gallium/auxiliary/util/u_pstipple.h b/mesalib/src/gallium/auxiliary/util/u_pstipple.h index 6fbed80cc..13155e7f5 100644 --- a/mesalib/src/gallium/auxiliary/util/u_pstipple.h +++ b/mesalib/src/gallium/auxiliary/util/u_pstipple.h @@ -47,9 +47,8 @@ util_pstipple_create_sampler_view(struct pipe_context *pipe, extern void * util_pstipple_create_sampler(struct pipe_context *pipe); -extern struct pipe_shader_state * -util_pstipple_create_fragment_shader(struct pipe_context *pipe, - struct pipe_shader_state *fs, +struct tgsi_token * +util_pstipple_create_fragment_shader(const struct tgsi_token *tokens, unsigned *samplerUnitOut); diff --git a/mesalib/src/gallium/auxiliary/util/u_rect.h b/mesalib/src/gallium/auxiliary/util/u_rect.h index dd87f81f3..cf29dff0d 100644 --- a/mesalib/src/gallium/auxiliary/util/u_rect.h +++ b/mesalib/src/gallium/auxiliary/util/u_rect.h @@ -30,6 +30,7 @@ #define U_RECT_H #include "pipe/p_compiler.h" +#include "util/u_math.h" #ifdef __cplusplus extern "C" { @@ -67,6 +68,12 @@ u_rect_find_intersection(const struct u_rect *a, } +static INLINE int +u_rect_area(const struct u_rect *r) +{ + return (r->x1 - r->x0) * (r->y1 - r->y0); +} + static INLINE void u_rect_possible_intersection(const struct u_rect *a, struct u_rect *b) @@ -79,6 +86,17 @@ u_rect_possible_intersection(const struct u_rect *a, } } +/* Set @d to a rectangle that covers both @a and @b. + */ +static INLINE void +u_rect_union(struct u_rect *d, const struct u_rect *a, const struct u_rect *b) +{ + d->x0 = MIN2(a->x0, b->x0); + d->y0 = MIN2(a->y0, b->y0); + d->x1 = MAX2(a->x1, b->x1); + d->y1 = MAX2(a->y1, b->y1); +} + #ifdef __cplusplus } #endif diff --git a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c index adf4887d5..edb30379b 100644 --- a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c @@ -59,11 +59,13 @@ void * util_make_vertex_passthrough_shader(struct pipe_context *pipe, uint num_attribs, const uint *semantic_names, - const uint *semantic_indexes) + const uint *semantic_indexes, + bool window_space) { return util_make_vertex_passthrough_shader_with_so(pipe, num_attribs, semantic_names, - semantic_indexes, NULL); + semantic_indexes, + window_space, NULL); } void * @@ -71,6 +73,7 @@ util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe, uint num_attribs, const uint *semantic_names, const uint *semantic_indexes, + bool window_space, const struct pipe_stream_output_info *so) { struct ureg_program *ureg; @@ -80,6 +83,9 @@ util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe, if (ureg == NULL) return NULL; + if (window_space) + ureg_property(ureg, TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION, TRUE); + for (i = 0; i < num_attribs; i++) { struct ureg_src src; struct ureg_dst dst; @@ -124,6 +130,76 @@ void *util_make_layered_clear_vertex_shader(struct pipe_context *pipe) return pipe->create_vs_state(pipe, &state); } +/** + * Takes position and color, and outputs position, color, and instance id. + */ +void *util_make_layered_clear_helper_vertex_shader(struct pipe_context *pipe) +{ + static const char text[] = + "VERT\n" + "DCL IN[0]\n" + "DCL IN[1]\n" + "DCL SV[0], INSTANCEID\n" + "DCL OUT[0], POSITION\n" + "DCL OUT[1], GENERIC[0]\n" + "DCL OUT[2], GENERIC[1]\n" + + "MOV OUT[0], IN[0]\n" + "MOV OUT[1], IN[1]\n" + "MOV OUT[2].x, SV[0].xxxx\n" + "END\n"; + struct tgsi_token tokens[1000]; + struct pipe_shader_state state = {tokens}; + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) { + assert(0); + return NULL; + } + return pipe->create_vs_state(pipe, &state); +} + +/** + * Takes position, color, and target layer, and emits vertices on that target + * layer, with the specified color. + */ +void *util_make_layered_clear_geometry_shader(struct pipe_context *pipe) +{ + static const char text[] = + "GEOM\n" + "PROPERTY GS_INPUT_PRIMITIVE TRIANGLES\n" + "PROPERTY GS_OUTPUT_PRIMITIVE TRIANGLE_STRIP\n" + "PROPERTY GS_MAX_OUTPUT_VERTICES 3\n" + "PROPERTY GS_INVOCATIONS 1\n" + "DCL IN[][0], POSITION\n" /* position */ + "DCL IN[][1], GENERIC[0]\n" /* color */ + "DCL IN[][2], GENERIC[1]\n" /* vs invocation */ + "DCL OUT[0], POSITION\n" + "DCL OUT[1], GENERIC[0]\n" + "DCL OUT[2], LAYER\n" + "IMM[0] INT32 {0, 0, 0, 0}\n" + + "MOV OUT[0], IN[0][0]\n" + "MOV OUT[1], IN[0][1]\n" + "MOV OUT[2].x, IN[0][2].xxxx\n" + "EMIT IMM[0].xxxx\n" + "MOV OUT[0], IN[1][0]\n" + "MOV OUT[1], IN[1][1]\n" + "MOV OUT[2].x, IN[1][2].xxxx\n" + "EMIT IMM[0].xxxx\n" + "MOV OUT[0], IN[2][0]\n" + "MOV OUT[1], IN[2][1]\n" + "MOV OUT[2].x, IN[2][2].xxxx\n" + "EMIT IMM[0].xxxx\n" + "END\n"; + struct tgsi_token tokens[1000]; + struct pipe_shader_state state = {tokens}; + + if (!tgsi_text_translate(text, tokens, Elements(tokens))) { + assert(0); + return NULL; + } + return pipe->create_gs_state(pipe, &state); +} /** * Make simple fragment texture shader: diff --git a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.h b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.h index c1d14aa3b..dd282e02a 100644 --- a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.h +++ b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.h @@ -47,19 +47,27 @@ extern void * util_make_vertex_passthrough_shader(struct pipe_context *pipe, uint num_attribs, const uint *semantic_names, - const uint *semantic_indexes); + const uint *semantic_indexes, + bool window_space); extern void * util_make_vertex_passthrough_shader_with_so(struct pipe_context *pipe, uint num_attribs, const uint *semantic_names, const uint *semantic_indexes, + bool window_space, const struct pipe_stream_output_info *so); extern void * util_make_layered_clear_vertex_shader(struct pipe_context *pipe); extern void * +util_make_layered_clear_helper_vertex_shader(struct pipe_context *pipe); + +extern void * +util_make_layered_clear_geometry_shader(struct pipe_context *pipe); + +extern void * util_make_fragment_tex_shader_writemask(struct pipe_context *pipe, unsigned tex_target, unsigned interp_mode, diff --git a/mesalib/src/gallium/auxiliary/util/u_snprintf.c b/mesalib/src/gallium/auxiliary/util/u_snprintf.c index 7a2bf2a6f..39e9b70d0 100644 --- a/mesalib/src/gallium/auxiliary/util/u_snprintf.c +++ b/mesalib/src/gallium/auxiliary/util/u_snprintf.c @@ -176,7 +176,7 @@ #define HAVE_ASPRINTF 1 /* not needed */ #define HAVE_STDARG_H 1 #define HAVE_STDDEF_H 1 -#define HAVE_STDINT_H 0 +#define HAVE_STDINT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_INTTYPES_H 0 #define HAVE_LOCALE_H 0 diff --git a/mesalib/src/gallium/auxiliary/util/u_tests.c b/mesalib/src/gallium/auxiliary/util/u_tests.c new file mode 100644 index 000000000..c0f6327b6 --- /dev/null +++ b/mesalib/src/gallium/auxiliary/util/u_tests.c @@ -0,0 +1,268 @@ +/************************************************************************** + * + * Copyright 2014 Advanced Micro Devices, 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 THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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_tests.h" + +#include "util/u_draw_quad.h" +#include "util/u_format.h" +#include "util/u_inlines.h" +#include "util/u_simple_shaders.h" +#include "util/u_surface.h" +#include "util/u_tile.h" +#include "cso_cache/cso_context.h" +#include <stdio.h> + +#define TOLERANCE 0.01 + +static struct pipe_resource * +util_create_texture2d(struct pipe_screen *screen, unsigned width, + unsigned height, enum pipe_format format) +{ + struct pipe_resource templ = {{0}}; + + templ.target = PIPE_TEXTURE_2D; + templ.width0 = width; + templ.height0 = height; + templ.depth0 = 1; + templ.array_size = 1; + templ.format = format; + templ.usage = PIPE_USAGE_DEFAULT; + templ.bind = PIPE_BIND_SAMPLER_VIEW | + (util_format_is_depth_or_stencil(format) ? + PIPE_BIND_DEPTH_STENCIL : PIPE_BIND_RENDER_TARGET); + + return screen->resource_create(screen, &templ); +} + +static void +util_set_framebuffer_cb0(struct cso_context *cso, struct pipe_context *ctx, + struct pipe_resource *tex) +{ + struct pipe_surface templ = {{0}}, *surf; + struct pipe_framebuffer_state fb = {0}; + + templ.format = tex->format; + surf = ctx->create_surface(ctx, tex, &templ); + + fb.width = tex->width0; + fb.height = tex->height0; + fb.cbufs[0] = surf; + fb.nr_cbufs = 1; + + cso_set_framebuffer(cso, &fb); + pipe_surface_reference(&surf, NULL); +} + +static void +util_set_blend_normal(struct cso_context *cso) +{ + struct pipe_blend_state blend = {0}; + + blend.rt[0].colormask = PIPE_MASK_RGBA; + cso_set_blend(cso, &blend); +} + +static void +util_set_dsa_disable(struct cso_context *cso) +{ + struct pipe_depth_stencil_alpha_state dsa = {{0}}; + + cso_set_depth_stencil_alpha(cso, &dsa); +} + +static void +util_set_rasterizer_normal(struct cso_context *cso) +{ + struct pipe_rasterizer_state rs = {0}; + + rs.half_pixel_center = 1; + rs.bottom_edge_rule = 1; + rs.depth_clip = 1; + + cso_set_rasterizer(cso, &rs); +} + +static void +util_set_max_viewport(struct cso_context *cso, struct pipe_resource *tex) +{ + struct pipe_viewport_state viewport; + + viewport.scale[0] = 0.5f * tex->width0; + viewport.scale[1] = 0.5f * tex->height0; + viewport.scale[2] = 1.0f; + viewport.translate[0] = 0.5f * tex->width0; + viewport.translate[1] = 0.5f * tex->height0; + viewport.translate[2] = 0.0f; + + cso_set_viewport(cso, &viewport); +} + +static void +util_set_interleaved_vertex_elements(struct cso_context *cso, + unsigned num_elements) +{ + int i; + struct pipe_vertex_element *velem = + calloc(1, num_elements * sizeof(struct pipe_vertex_element)); + + for (i = 0; i < num_elements; i++) { + velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + velem[i].src_offset = i * 16; + } + + cso_set_vertex_elements(cso, num_elements, velem); + free(velem); +} + +static bool +util_probe_rect_rgba(struct pipe_context *ctx, struct pipe_resource *tex, + unsigned offx, unsigned offy, unsigned w, unsigned h, + const float *expected) +{ + struct pipe_transfer *transfer; + void *map; + float *pixels = malloc(w * h * 4 * sizeof(float)); + int x,y,c; + bool pass = true; + + map = pipe_transfer_map(ctx, tex, 0, 0, PIPE_TRANSFER_READ, + offx, offy, w, h, &transfer); + pipe_get_tile_rgba(transfer, map, 0, 0, w, h, pixels); + pipe_transfer_unmap(ctx, transfer); + + for (y = 0; y < h; y++) { + for (x = 0; x < w; x++) { + float *probe = &pixels[(y*w + x)*4]; + + for (c = 0; c < 4; c++) + if (fabs(probe[c] - expected[c]) >= TOLERANCE) { + printf("Probe color at (%i,%i), ", offx+x, offy+y); + printf("Expected: %.3f, %.3f, %.3f, %.3f, ", + expected[0], expected[1], expected[2], expected[3]); + printf("Got: %.3f, %.3f, %.3f, %.3f\n", + probe[0], probe[1], probe[2], probe[2]); + pass = false; + goto done; + } + } + } +done: + + free(pixels); + return pass; +} + +/** + * Test TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION. + * + * The viewport state is set as usual, but it should have no effect. + * Clipping should also be disabled. + * + * POSITION.xyz should already be multiplied by 1/w and POSITION.w should + * contain 1/w. By setting w=0, we can test that POSITION.xyz isn't + * multiplied by 1/w (otherwise nothing would be rendered). + * + * TODO: Whether the value of POSITION.w is correctly interpreted as 1/w + * during perspective interpolation is not tested. + */ +static void +tgsi_vs_window_space_position(struct pipe_context *ctx) +{ + struct cso_context *cso; + struct pipe_resource *cb; + void *fs, *vs; + bool pass = true; + + static uint vs_attribs[] = { + TGSI_SEMANTIC_POSITION, + TGSI_SEMANTIC_GENERIC + }; + static uint vs_indices[] = {0, 0}; + static float vertices[] = { + 0, 0, 0, 0, 1, 0, 0, 1, + 0, 256, 0, 0, 1, 0, 0, 1, + 256, 256, 0, 0, 1, 0, 0, 1, + 256, 0, 0, 0, 1, 0, 0, 1, + }; + static float red[] = {1, 0, 0, 1}; + static float clear_color[] = {0.1, 0.1, 0.1, 0.1}; + + if (!ctx->screen->get_param(ctx->screen, + PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION)) { + printf("Test(%s) = skip\n", __func__); + return; + } + + cso = cso_create_context(ctx); + cb = util_create_texture2d(ctx->screen, 256, 256, + PIPE_FORMAT_R8G8B8A8_UNORM); + + /* Set states. */ + util_set_framebuffer_cb0(cso, ctx, cb); + util_set_blend_normal(cso); + util_set_dsa_disable(cso); + util_set_rasterizer_normal(cso); + util_set_max_viewport(cso, cb); + util_set_interleaved_vertex_elements(cso, 2); + + /* Fragment shader. */ + fs = util_make_fragment_passthrough_shader(ctx, TGSI_SEMANTIC_GENERIC, + TGSI_INTERPOLATE_LINEAR, TRUE); + cso_set_fragment_shader_handle(cso, fs); + + /* Vertex shader. */ + vs = util_make_vertex_passthrough_shader(ctx, 2, vs_attribs, vs_indices, + TRUE); + cso_set_vertex_shader_handle(cso, vs); + + /* Clear and draw. */ + ctx->clear(ctx, PIPE_CLEAR_COLOR0, (void*)clear_color, 0, 0); + util_draw_user_vertex_buffer(cso, vertices, PIPE_PRIM_QUADS, 4, 2); + + /* Probe pixels. */ + pass = pass && util_probe_rect_rgba(ctx, cb, 0, 0, + cb->width0, cb->height0, red); + + /* Cleanup. */ + cso_release_all(cso); + cso_destroy_context(cso); + ctx->delete_vs_state(ctx, vs); + ctx->delete_fs_state(ctx, fs); + pipe_resource_reference(&cb, NULL); + + printf("Test(%s) = %s\n", __func__, pass ? "pass" : "fail"); +} + +/** + * Run all tests. This should be run with a clean context after + * context_create. + */ +void +util_run_tests(struct pipe_context *ctx) +{ + tgsi_vs_window_space_position(ctx); +} diff --git a/mesalib/src/gallium/auxiliary/util/u_tests.h b/mesalib/src/gallium/auxiliary/util/u_tests.h new file mode 100644 index 000000000..a1439347d --- /dev/null +++ b/mesalib/src/gallium/auxiliary/util/u_tests.h @@ -0,0 +1,37 @@ +/************************************************************************** + * + * Copyright 2014 Advanced Micro Devices, 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 THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef U_TESTS_H +#define U_TESTS_H + +#include "pipe/p_compiler.h" + +struct pipe_context; + +void util_run_tests(struct pipe_context *ctx); + +#endif diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources index 0c55327d6..676fa0d7a 100644 --- a/mesalib/src/glsl/Makefile.sources +++ b/mesalib/src/glsl/Makefile.sources @@ -59,6 +59,7 @@ LIBGLSL_FILES = \ $(GLSL_SRCDIR)/loop_controls.cpp \ $(GLSL_SRCDIR)/loop_unroll.cpp \ $(GLSL_SRCDIR)/lower_clip_distance.cpp \ + $(GLSL_SRCDIR)/lower_const_arrays_to_uniforms.cpp \ $(GLSL_SRCDIR)/lower_discard.cpp \ $(GLSL_SRCDIR)/lower_discard_flow.cpp \ $(GLSL_SRCDIR)/lower_if_to_cond_assign.cpp \ @@ -104,8 +105,7 @@ LIBGLSL_FILES = \ $(GLSL_SRCDIR)/opt_swizzle_swizzle.cpp \ $(GLSL_SRCDIR)/opt_tree_grafting.cpp \ $(GLSL_SRCDIR)/opt_vectorize.cpp \ - $(GLSL_SRCDIR)/s_expression.cpp \ - $(GLSL_SRCDIR)/strtod.c + $(GLSL_SRCDIR)/s_expression.cpp # glsl_compiler diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h index 15bf086a1..6995ae83b 100644 --- a/mesalib/src/glsl/ast.h +++ b/mesalib/src/glsl/ast.h @@ -640,19 +640,6 @@ class ast_declarator_list; class ast_struct_specifier : public ast_node { public: - /** - * \brief Make a shallow copy of an ast_struct_specifier. - * - * Use only if the objects are allocated from the same context and will not - * be modified. Zeros the inherited ast_node's fields. - */ - ast_struct_specifier(const ast_struct_specifier& that): - ast_node(), name(that.name), declarations(that.declarations), - is_declaration(that.is_declaration) - { - /* empty */ - } - ast_struct_specifier(const char *identifier, ast_declarator_list *declarator_list); virtual void print(void) const; @@ -670,22 +657,6 @@ public: class ast_type_specifier : public ast_node { public: - /** - * \brief Make a shallow copy of an ast_type_specifier, specifying array - * fields. - * - * Use only if the objects are allocated from the same context and will not - * be modified. Zeros the inherited ast_node's fields. - */ - ast_type_specifier(const ast_type_specifier *that, - ast_array_specifier *array_specifier) - : ast_node(), type_name(that->type_name), structure(that->structure), - array_specifier(array_specifier), - default_precision(that->default_precision) - { - /* empty */ - } - /** Construct a type specifier from a type name */ ast_type_specifier(const char *name) : type_name(name), structure(NULL), array_specifier(NULL), diff --git a/mesalib/src/glsl/glsl_lexer.ll b/mesalib/src/glsl/glsl_lexer.ll index e66a93591..57c46be84 100644 --- a/mesalib/src/glsl/glsl_lexer.ll +++ b/mesalib/src/glsl/glsl_lexer.ll @@ -23,7 +23,7 @@ */ #include <ctype.h> #include <limits.h> -#include "strtod.h" +#include "util/strtod.h" #include "ast.h" #include "glsl_parser_extras.h" #include "glsl_parser.h" @@ -450,24 +450,11 @@ layout { return LITERAL_INTEGER(8); } -[0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fF]? { - yylval->real = glsl_strtof(yytext, NULL); - return FLOATCONSTANT; - } -\.[0-9]+([eE][+-]?[0-9]+)?[fF]? { - yylval->real = glsl_strtof(yytext, NULL); - return FLOATCONSTANT; - } -[0-9]+\.([eE][+-]?[0-9]+)?[fF]? { - yylval->real = glsl_strtof(yytext, NULL); - return FLOATCONSTANT; - } +[0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fF]? | +\.[0-9]+([eE][+-]?[0-9]+)?[fF]? | +[0-9]+\.([eE][+-]?[0-9]+)?[fF]? | [0-9]+[eE][+-]?[0-9]+[fF]? { - yylval->real = glsl_strtof(yytext, NULL); - return FLOATCONSTANT; - } -[0-9]+[fF] { - yylval->real = glsl_strtof(yytext, NULL); + yylval->real = _mesa_strtof(yytext, NULL); return FLOATCONSTANT; } diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index 79f849465..27e3301e2 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -1350,9 +1350,15 @@ ast_struct_specifier::ast_struct_specifier(const char *identifier, ast_declarator_list *declarator_list) { if (identifier == NULL) { + static mtx_t mutex = _MTX_INITIALIZER_NP; static unsigned anon_count = 1; - identifier = ralloc_asprintf(this, "#anon_struct_%04x", anon_count); - anon_count++; + unsigned count; + + mtx_lock(&mutex); + count = anon_count++; + mtx_unlock(&mutex); + + identifier = ralloc_asprintf(this, "#anon_struct_%04x", count); } name = identifier; this->declarations.push_degenerate_list_at_head(&declarator_list->link); diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp index c11d86482..5f9919348 100644 --- a/mesalib/src/glsl/glsl_types.cpp +++ b/mesalib/src/glsl/glsl_types.cpp @@ -29,6 +29,7 @@ extern "C" { #include "program/hash_table.h" } +mtx_t glsl_type::mutex = _MTX_INITIALIZER_NP; hash_table *glsl_type::array_types = NULL; hash_table *glsl_type::record_types = NULL; hash_table *glsl_type::interface_types = NULL; @@ -53,9 +54,14 @@ glsl_type::glsl_type(GLenum gl_type, vector_elements(vector_elements), matrix_columns(matrix_columns), length(0) { + mtx_lock(&glsl_type::mutex); + init_ralloc_type_ctx(); assert(name != NULL); this->name = ralloc_strdup(this->mem_ctx, name); + + mtx_unlock(&glsl_type::mutex); + /* Neither dimension is zero or both dimensions are zero. */ assert((vector_elements == 0) == (matrix_columns == 0)); @@ -71,9 +77,14 @@ glsl_type::glsl_type(GLenum gl_type, glsl_base_type base_type, sampler_array(array), sampler_type(type), interface_packing(0), length(0) { + mtx_lock(&glsl_type::mutex); + init_ralloc_type_ctx(); assert(name != NULL); this->name = ralloc_strdup(this->mem_ctx, name); + + mtx_unlock(&glsl_type::mutex); + memset(& fields, 0, sizeof(fields)); if (base_type == GLSL_TYPE_SAMPLER) { @@ -95,11 +106,14 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, { unsigned int i; + mtx_lock(&glsl_type::mutex); + init_ralloc_type_ctx(); assert(name != NULL); this->name = ralloc_strdup(this->mem_ctx, name); this->fields.structure = ralloc_array(this->mem_ctx, glsl_struct_field, length); + for (i = 0; i < length; i++) { this->fields.structure[i].type = fields[i].type; this->fields.structure[i].name = ralloc_strdup(this->fields.structure, @@ -110,6 +124,8 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, this->fields.structure[i].sample = fields[i].sample; this->fields.structure[i].matrix_layout = fields[i].matrix_layout; } + + mtx_unlock(&glsl_type::mutex); } glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, @@ -123,6 +139,8 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, { unsigned int i; + mtx_lock(&glsl_type::mutex); + init_ralloc_type_ctx(); assert(name != NULL); this->name = ralloc_strdup(this->mem_ctx, name); @@ -138,6 +156,8 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, this->fields.structure[i].sample = fields[i].sample; this->fields.structure[i].matrix_layout = fields[i].matrix_layout; } + + mtx_unlock(&glsl_type::mutex); } @@ -285,6 +305,8 @@ const glsl_type *glsl_type::get_scalar_type() const void _mesa_glsl_release_types(void) { + mtx_lock(&glsl_type::mutex); + if (glsl_type::array_types != NULL) { hash_table_dtor(glsl_type::array_types); glsl_type::array_types = NULL; @@ -294,6 +316,8 @@ _mesa_glsl_release_types(void) hash_table_dtor(glsl_type::record_types); glsl_type::record_types = NULL; } + + mtx_unlock(&glsl_type::mutex); } @@ -302,7 +326,7 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) : sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), sampler_type(0), interface_packing(0), vector_elements(0), matrix_columns(0), - name(NULL), length(length) + length(length), name(NULL) { this->fields.array = array; /* Inherit the gl type of the base. The GL type is used for @@ -316,7 +340,10 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) : * NUL. */ const unsigned name_length = strlen(array->name) + 10 + 3; + + mtx_lock(&glsl_type::mutex); char *const n = (char *) ralloc_size(this->mem_ctx, name_length); + mtx_unlock(&glsl_type::mutex); if (length == 0) snprintf(n, name_length, "%s[]", array->name); @@ -452,12 +479,6 @@ glsl_type::get_instance(unsigned base_type, unsigned rows, unsigned columns) const glsl_type * glsl_type::get_array_instance(const glsl_type *base, unsigned array_size) { - - if (array_types == NULL) { - array_types = hash_table_ctor(64, hash_table_string_hash, - hash_table_string_compare); - } - /* Generate a name using the base type pointer in the key. This is * done because the name of the base type may not be unique across * shaders. For example, two shaders may have different record types @@ -466,9 +487,19 @@ glsl_type::get_array_instance(const glsl_type *base, unsigned array_size) char key[128]; snprintf(key, sizeof(key), "%p[%u]", (void *) base, array_size); + mtx_lock(&glsl_type::mutex); + + if (array_types == NULL) { + array_types = hash_table_ctor(64, hash_table_string_hash, + hash_table_string_compare); + } + const glsl_type *t = (glsl_type *) hash_table_find(array_types, key); + if (t == NULL) { + mtx_unlock(&glsl_type::mutex); t = new glsl_type(base, array_size); + mtx_lock(&glsl_type::mutex); hash_table_insert(array_types, (void *) t, ralloc_strdup(mem_ctx, key)); } @@ -477,6 +508,8 @@ glsl_type::get_array_instance(const glsl_type *base, unsigned array_size) assert(t->length == array_size); assert(t->fields.array == base); + mtx_unlock(&glsl_type::mutex); + return t; } @@ -575,13 +608,17 @@ glsl_type::get_record_instance(const glsl_struct_field *fields, { const glsl_type key(fields, num_fields, name); + mtx_lock(&glsl_type::mutex); + if (record_types == NULL) { record_types = hash_table_ctor(64, record_key_hash, record_key_compare); } const glsl_type *t = (glsl_type *) hash_table_find(record_types, & key); if (t == NULL) { + mtx_unlock(&glsl_type::mutex); t = new glsl_type(fields, num_fields, name); + mtx_lock(&glsl_type::mutex); hash_table_insert(record_types, (void *) t, t); } @@ -590,6 +627,8 @@ glsl_type::get_record_instance(const glsl_struct_field *fields, assert(t->length == num_fields); assert(strcmp(t->name, name) == 0); + mtx_unlock(&glsl_type::mutex); + return t; } @@ -602,13 +641,17 @@ glsl_type::get_interface_instance(const glsl_struct_field *fields, { const glsl_type key(fields, num_fields, packing, block_name); + mtx_lock(&glsl_type::mutex); + if (interface_types == NULL) { interface_types = hash_table_ctor(64, record_key_hash, record_key_compare); } const glsl_type *t = (glsl_type *) hash_table_find(interface_types, & key); if (t == NULL) { + mtx_unlock(&glsl_type::mutex); t = new glsl_type(fields, num_fields, packing, block_name); + mtx_lock(&glsl_type::mutex); hash_table_insert(interface_types, (void *) t, t); } @@ -617,6 +660,8 @@ glsl_type::get_interface_instance(const glsl_struct_field *fields, assert(t->length == num_fields); assert(strcmp(t->name, block_name) == 0); + mtx_unlock(&glsl_type::mutex); + return t; } diff --git a/mesalib/src/glsl/glsl_types.h b/mesalib/src/glsl/glsl_types.h index eeb14c274..474b12914 100644 --- a/mesalib/src/glsl/glsl_types.h +++ b/mesalib/src/glsl/glsl_types.h @@ -122,16 +122,18 @@ struct glsl_type { * easier to just ralloc_free 'mem_ctx' (or any of its ancestors). */ static void* operator new(size_t size) { - if (glsl_type::mem_ctx == NULL) { - glsl_type::mem_ctx = ralloc_context(NULL); - assert(glsl_type::mem_ctx != NULL); - } + mtx_lock(&glsl_type::mutex); + + /* mem_ctx should have been created by the static members */ + assert(glsl_type::mem_ctx != NULL); void *type; type = ralloc_size(glsl_type::mem_ctx, size); assert(type != NULL); + mtx_unlock(&glsl_type::mutex); + return type; } @@ -139,7 +141,9 @@ struct glsl_type { * ralloc_free in that case. */ static void operator delete(void *type) { + mtx_lock(&glsl_type::mutex); ralloc_free(type); + mtx_unlock(&glsl_type::mutex); } /** @@ -149,18 +153,11 @@ struct glsl_type { * these will be 0. */ /*@{*/ - unsigned vector_elements:3; /**< 1, 2, 3, or 4 vector elements. */ - unsigned matrix_columns:3; /**< 1, 2, 3, or 4 matrix columns. */ + uint8_t vector_elements; /**< 1, 2, 3, or 4 vector elements. */ + uint8_t matrix_columns; /**< 1, 2, 3, or 4 matrix columns. */ /*@}*/ /** - * Name of the data type - * - * Will never be \c NULL. - */ - const char *name; - - /** * For \c GLSL_TYPE_ARRAY, this is the length of the array. For * \c GLSL_TYPE_STRUCT or \c GLSL_TYPE_INTERFACE, it is the number of * elements in the structure and the number of values pointed to by @@ -169,6 +166,13 @@ struct glsl_type { unsigned length; /** + * Name of the data type + * + * Will never be \c NULL. + */ + const char *name; + + /** * Subtype of composite data types. */ union { @@ -618,6 +622,9 @@ struct glsl_type { bool record_compare(const glsl_type *b) const; private: + + static mtx_t mutex; + /** * ralloc context for all glsl_type allocations * diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp index c712c6a7b..fe5601a16 100644 --- a/mesalib/src/glsl/ir.cpp +++ b/mesalib/src/glsl/ir.cpp @@ -46,11 +46,6 @@ bool ir_rvalue::is_negative_one() const return false; } -bool ir_rvalue::is_basis() const -{ - return false; -} - /** * Modify the swizzle make to move one component to another * @@ -1191,49 +1186,6 @@ ir_constant::is_negative_one() const } bool -ir_constant::is_basis() const -{ - if (!this->type->is_scalar() && !this->type->is_vector()) - return false; - - if (this->type->is_boolean()) - return false; - - unsigned ones = 0; - for (unsigned c = 0; c < this->type->vector_elements; c++) { - switch (this->type->base_type) { - case GLSL_TYPE_FLOAT: - if (this->value.f[c] == 1.0) - ones++; - else if (this->value.f[c] != 0.0) - return false; - break; - case GLSL_TYPE_INT: - if (this->value.i[c] == 1) - ones++; - else if (this->value.i[c] != 0) - return false; - break; - case GLSL_TYPE_UINT: - if (int(this->value.u[c]) == 1) - ones++; - else if (int(this->value.u[c]) != 0) - return false; - break; - default: - /* The only other base types are structures, arrays, samplers, and - * booleans. Samplers cannot be constants, and the others should - * have been filtered out above. - */ - assert(!"Should not get here."); - return false; - } - } - - return ones == 1; -} - -bool ir_constant::is_uint16_constant() const { if (!type->is_integer()) diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h index 90c443c3d..a0f48b2af 100644 --- a/mesalib/src/glsl/ir.h +++ b/mesalib/src/glsl/ir.h @@ -251,8 +251,7 @@ public: * for vector and scalar types that have all elements set to the value * zero (or \c false for booleans). * - * \sa ir_constant::has_value, ir_rvalue::is_one, ir_rvalue::is_negative_one, - * ir_constant::is_basis + * \sa ir_constant::has_value, ir_rvalue::is_one, ir_rvalue::is_negative_one */ virtual bool is_zero() const; @@ -264,8 +263,7 @@ public: * for vector and scalar types that have all elements set to the value * one (or \c true for booleans). * - * \sa ir_constant::has_value, ir_rvalue::is_zero, ir_rvalue::is_negative_one, - * ir_constant::is_basis + * \sa ir_constant::has_value, ir_rvalue::is_zero, ir_rvalue::is_negative_one */ virtual bool is_one() const; @@ -278,25 +276,10 @@ public: * negative one. For boolean types, the result is always \c false. * * \sa ir_constant::has_value, ir_rvalue::is_zero, ir_rvalue::is_one - * ir_constant::is_basis */ virtual bool is_negative_one() const; /** - * Determine if an r-value is a basis vector - * - * The base implementation of this function always returns \c false. The - * \c ir_constant class over-rides this function to return \c true \b only - * for vector and scalar types that have one element set to the value one, - * and the other elements set to the value zero. For boolean types, the - * result is always \c false. - * - * \sa ir_constant::has_value, ir_rvalue::is_zero, ir_rvalue::is_one, - * is_constant::is_negative_one - */ - virtual bool is_basis() const; - - /** * Determine if an r-value is an unsigned integer constant which can be * stored in 16 bits. * @@ -359,6 +342,12 @@ enum ir_var_declaration_type { * re-declared by the shader. */ ir_var_declared_implicitly, + + /** + * Variable is implicitly generated by the compiler and should not be + * visible via the API. + */ + ir_var_hidden, }; /** @@ -2257,7 +2246,7 @@ public: * Determine whether a constant has the same value as another constant * * \sa ir_constant::is_zero, ir_constant::is_one, - * ir_constant::is_negative_one, ir_constant::is_basis + * ir_constant::is_negative_one */ bool has_value(const ir_constant *) const; @@ -2270,7 +2259,6 @@ public: virtual bool is_zero() const; virtual bool is_one() const; virtual bool is_negative_one() const; - virtual bool is_basis() const; /** * Return true for constants that could be stored as 16-bit unsigned values. diff --git a/mesalib/src/glsl/ir_optimization.h b/mesalib/src/glsl/ir_optimization.h index e25857ac5..34e0b4b94 100644 --- a/mesalib/src/glsl/ir_optimization.h +++ b/mesalib/src/glsl/ir_optimization.h @@ -114,6 +114,7 @@ bool lower_noise(exec_list *instructions); bool lower_variable_index_to_cond_assign(exec_list *instructions, bool lower_input, bool lower_output, bool lower_temp, bool lower_uniform); bool lower_quadop_vector(exec_list *instructions, bool dont_lower_swz); +bool lower_const_arrays_to_uniforms(exec_list *instructions); bool lower_clip_distance(gl_shader *shader); void lower_output_reads(exec_list *instructions); bool lower_packing_builtins(exec_list *instructions, int op_mask); diff --git a/mesalib/src/glsl/ir_reader.cpp b/mesalib/src/glsl/ir_reader.cpp index ae00e7934..fd318c046 100644 --- a/mesalib/src/glsl/ir_reader.cpp +++ b/mesalib/src/glsl/ir_reader.cpp @@ -972,7 +972,7 @@ ir_reader::read_texture(s_expression *expr) op = ir_query_levels; } else if (MATCH(expr, other_pattern)) { op = ir_texture::get_opcode(tag->value()); - if (op == -1) + if (op == (ir_texture_opcode) -1) return NULL; } else { ir_read_error(NULL, "unexpected texture pattern %s", tag->value()); diff --git a/mesalib/src/glsl/ir_uniform.h b/mesalib/src/glsl/ir_uniform.h index b9ecf7cdd..21b5d05c1 100644 --- a/mesalib/src/glsl/ir_uniform.h +++ b/mesalib/src/glsl/ir_uniform.h @@ -175,6 +175,12 @@ struct gl_uniform_storage { * arrays this is the first element in the array. */ unsigned remap_location; + + /** + * This is a compiler-generated uniform that should not be advertised + * via the API. + */ + bool hidden; }; #ifdef __cplusplus diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp index 400e13479..de2f6c9ac 100644 --- a/mesalib/src/glsl/link_uniforms.cpp +++ b/mesalib/src/glsl/link_uniforms.cpp @@ -585,6 +585,8 @@ private: this->uniforms[id].driver_storage = NULL; this->uniforms[id].storage = this->values; this->uniforms[id].atomic_buffer_index = -1; + this->uniforms[id].hidden = + current_var->data.how_declared == ir_var_hidden; if (this->ubo_block_index != -1) { this->uniforms[id].block_index = this->ubo_block_index; @@ -806,6 +808,50 @@ link_set_image_access_qualifiers(struct gl_shader_program *prog) } } +/** + * Sort the array of uniform storage so that the non-hidden uniforms are first + * + * This function sorts the list "in place." This is important because some of + * the storage accessible from \c uniforms has \c uniforms as its \c ralloc + * context. If \c uniforms is freed, some other storage will also be freed. + */ +static unsigned +move_hidden_uniforms_to_end(struct gl_shader_program *prog, + struct gl_uniform_storage *uniforms, + unsigned num_elements) +{ + struct gl_uniform_storage *sorted_uniforms = + ralloc_array(prog, struct gl_uniform_storage, num_elements); + unsigned hidden_uniforms = 0; + unsigned j = 0; + + /* Add the non-hidden uniforms. */ + for (unsigned i = 0; i < num_elements; i++) { + if (!uniforms[i].hidden) + sorted_uniforms[j++] = uniforms[i]; + } + + /* Add and count the hidden uniforms. */ + for (unsigned i = 0; i < num_elements; i++) { + if (uniforms[i].hidden) { + sorted_uniforms[j++] = uniforms[i]; + hidden_uniforms++; + } + } + + assert(prog->UniformHash != NULL); + prog->UniformHash->clear(); + for (unsigned i = 0; i < num_elements; i++) { + if (sorted_uniforms[i].name != NULL) + prog->UniformHash->put(i, sorted_uniforms[i].name); + } + + memcpy(uniforms, sorted_uniforms, sizeof(uniforms[0]) * num_elements); + ralloc_free(sorted_uniforms); + + return hidden_uniforms; +} + void link_assign_uniform_locations(struct gl_shader_program *prog, unsigned int boolean_true) @@ -926,6 +972,9 @@ link_assign_uniform_locations(struct gl_shader_program *prog, sizeof(prog->_LinkedShaders[i]->SamplerTargets)); } + const unsigned hidden_uniforms = + move_hidden_uniforms_to_end(prog, uniforms, num_user_uniforms); + /* Reserve all the explicit locations of the active uniforms. */ for (unsigned i = 0; i < num_user_uniforms; i++) { if (uniforms[i].remap_location != UNMAPPED_UNIFORM_LOC) { @@ -978,6 +1027,7 @@ link_assign_uniform_locations(struct gl_shader_program *prog, #endif prog->NumUserUniformStorage = num_user_uniforms; + prog->NumHiddenUniforms = hidden_uniforms; prog->UniformStorage = uniforms; link_set_image_access_qualifiers(prog); diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp index 2d31801d3..de6b1fb9f 100644 --- a/mesalib/src/glsl/linker.cpp +++ b/mesalib/src/glsl/linker.cpp @@ -642,7 +642,7 @@ validate_geometry_shader_emissions(struct gl_context *ctx, emit_vertex.run(prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->ir); if (emit_vertex.error()) { linker_error(prog, "Invalid call %s(%d). Accepted values for the " - "stream parameter are in the range [0, %d].", + "stream parameter are in the range [0, %d].\n", emit_vertex.error_func(), emit_vertex.error_stream(), ctx->Const.MaxVertexStreams - 1); @@ -676,7 +676,7 @@ validate_geometry_shader_emissions(struct gl_context *ctx, */ if (prog->Geom.UsesStreams && prog->Geom.OutputType != GL_POINTS) { linker_error(prog, "EmitStreamVertex(n) and EndStreamPrimitive(n) " - "with n>0 requires point output"); + "with n>0 requires point output\n"); } } } @@ -808,7 +808,7 @@ cross_validate_globals(struct gl_shader_program *prog, linker_error(prog, "All redeclarations of gl_FragDepth in all " "fragment shaders in a single program must have " - "the same set of qualifiers."); + "the same set of qualifiers.\n"); } if (var->data.used && layout_differs) { @@ -817,7 +817,7 @@ cross_validate_globals(struct gl_shader_program *prog, "qualifier in any fragment shader, it must be " "redeclared with the same layout qualifier in " "all fragment shaders that have assignments to " - "gl_FragDepth"); + "gl_FragDepth\n"); } } @@ -948,7 +948,7 @@ interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog) &sh->UniformBlocks[j]); if (index == -1) { - linker_error(prog, "uniform block `%s' has mismatching definitions", + linker_error(prog, "uniform block `%s' has mismatching definitions\n", sh->UniformBlocks[j].Name); return false; } @@ -1635,7 +1635,7 @@ link_intrastage_shaders(void *mem_ctx, if ((other_sig != NULL) && other_sig->is_defined && !other_sig->is_builtin()) { - linker_error(prog, "function `%s' is multiply defined", + linker_error(prog, "function `%s' is multiply defined\n", f->name); return NULL; } @@ -2086,7 +2086,7 @@ assign_attribute_or_color_locations(gl_shader_program *prog, if (attr + slots > max_index) { linker_error(prog, "insufficient contiguous locations " - "available for %s `%s' %d %d %d", string, + "available for %s `%s' %d %d %d\n", string, var->name, used_locations, use_mask, attr); return false; } @@ -2155,7 +2155,7 @@ assign_attribute_or_color_locations(gl_shader_program *prog, linker_error(prog, "insufficient contiguous locations " - "available for %s `%s'", + "available for %s `%s'\n", string, to_assign[i].var->name); return false; } @@ -2257,7 +2257,7 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog) continue; if (sh->num_samplers > ctx->Const.Program[i].MaxTextureImageUnits) { - linker_error(prog, "Too many %s shader texture samplers", + linker_error(prog, "Too many %s shader texture samplers\n", _mesa_shader_stage_to_string(i)); } @@ -2271,7 +2271,7 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog) _mesa_shader_stage_to_string(i)); } else { linker_error(prog, "Too many %s shader default uniform block " - "components", + "components\n", _mesa_shader_stage_to_string(i)); } } @@ -2284,7 +2284,7 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog) "this is non-portable out-of-spec behavior\n", _mesa_shader_stage_to_string(i)); } else { - linker_error(prog, "Too many %s shader uniform components", + linker_error(prog, "Too many %s shader uniform components\n", _mesa_shader_stage_to_string(i)); } } @@ -2302,7 +2302,7 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog) } if (total_uniform_blocks > ctx->Const.MaxCombinedUniformBlocks) { - linker_error(prog, "Too many combined uniform blocks (%d/%d)", + linker_error(prog, "Too many combined uniform blocks (%d/%d)\n", prog->NumUniformBlocks, ctx->Const.MaxCombinedUniformBlocks); } else { @@ -2310,7 +2310,7 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog) const unsigned max_uniform_blocks = ctx->Const.Program[i].MaxUniformBlocks; if (blocks[i] > max_uniform_blocks) { - linker_error(prog, "Too many %s uniform blocks (%d/%d)", + linker_error(prog, "Too many %s uniform blocks (%d/%d)\n", _mesa_shader_stage_to_string(i), blocks[i], max_uniform_blocks); @@ -2338,7 +2338,7 @@ check_image_resources(struct gl_context *ctx, struct gl_shader_program *prog) if (sh) { if (sh->NumImages > ctx->Const.Program[i].MaxImageUniforms) - linker_error(prog, "Too many %s shader image uniforms", + linker_error(prog, "Too many %s shader image uniforms\n", _mesa_shader_stage_to_string(i)); total_image_units += sh->NumImages; @@ -2354,11 +2354,11 @@ check_image_resources(struct gl_context *ctx, struct gl_shader_program *prog) } if (total_image_units > ctx->Const.MaxCombinedImageUniforms) - linker_error(prog, "Too many combined image uniforms"); + linker_error(prog, "Too many combined image uniforms\n"); if (total_image_units + fragment_outputs > ctx->Const.MaxCombinedImageUnitsAndFragmentOutputs) - linker_error(prog, "Too many combined image uniforms and fragment outputs"); + linker_error(prog, "Too many combined image uniforms and fragment outputs\n"); } @@ -2382,7 +2382,7 @@ reserve_explicit_locations(struct gl_shader_program *prog, max_loc + 1); if (!prog->UniformRemapTable) { - linker_error(prog, "Out of memory during linking."); + linker_error(prog, "Out of memory during linking.\n"); return false; } @@ -2411,8 +2411,8 @@ reserve_explicit_locations(struct gl_shader_program *prog, * or linker error will be generated." */ linker_error(prog, - "location qualifier for uniform %s overlaps" - "previously used location", + "location qualifier for uniform %s overlaps " + "previously used location\n", var->name); return false; } @@ -2447,7 +2447,7 @@ check_explicit_uniform_locations(struct gl_context *ctx, string_to_uint_map *uniform_map = new string_to_uint_map; if (!uniform_map) { - linker_error(prog, "Out of memory during linking."); + linker_error(prog, "Out of memory during linking.\n"); return; } @@ -2678,6 +2678,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) &ctx->Const.ShaderCompilerOptions[i], ctx->Const.NativeIntegers)) ; + + lower_const_arrays_to_uniforms(prog->_LinkedShaders[i]->ir); } /* Check and validate stream emissions in geometry shaders */ @@ -2719,7 +2721,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) */ if (first == MESA_SHADER_FRAGMENT) { linker_error(prog, "Transform feedback varyings specified, but " - "no vertex or geometry shader is present."); + "no vertex or geometry shader is present.\n"); goto done; } diff --git a/mesalib/src/glsl/list.h b/mesalib/src/glsl/list.h index b6c32bccc..995c666ea 100644 --- a/mesalib/src/glsl/list.h +++ b/mesalib/src/glsl/list.h @@ -521,6 +521,27 @@ exec_node_insert_list_before(struct exec_node *n, struct exec_list *before) exec_list_make_empty(before); } +static inline void +exec_list_validate(const struct exec_list *list) +{ + const struct exec_node *node; + + assert(list->head->prev == (const struct exec_node *) &list->head); + assert(list->tail == NULL); + assert(list->tail_pred->next == (const struct exec_node *) &list->tail); + + /* We could try to use one of the interators below for this but they all + * either require C++ or assume the exec_node is embedded in a structure + * which is not the case for this function. + */ + for (node = exec_list_get_head_const(list); + !exec_node_is_tail_sentinel(node); + node = exec_node_get_next_const(node)) { + assert(node->next->prev == node); + assert(node->prev->next == node); + } +} + #ifdef __cplusplus inline void exec_list::make_empty() { diff --git a/mesalib/src/glsl/loop_unroll.cpp b/mesalib/src/glsl/loop_unroll.cpp index ce795f6cd..635e1dd99 100644 --- a/mesalib/src/glsl/loop_unroll.cpp +++ b/mesalib/src/glsl/loop_unroll.cpp @@ -64,6 +64,7 @@ class loop_unroll_count : public ir_hierarchical_visitor { public: int nodes; bool unsupported_variable_indexing; + bool array_indexed_by_induction_var_with_exact_iterations; /* If there are nested loops, the node count will be inaccurate. */ bool nested_loop; @@ -74,6 +75,7 @@ public: nodes = 0; nested_loop = false; unsupported_variable_indexing = false; + array_indexed_by_induction_var_with_exact_iterations = false; run(list); } @@ -112,6 +114,14 @@ public: ir_variable *array = ir->array->variable_referenced(); loop_variable *lv = ls->get(ir->array_index->variable_referenced()); if (array && lv && lv->is_induction_var()) { + /* If an array is indexed by a loop induction variable, and the + * array size is exactly the number of loop iterations, this is + * probably a simple for-loop trying to access each element in + * turn; the application may expect it to be unrolled. + */ + if (int(array->type->length) == ls->limiting_terminator->iterations) + array_indexed_by_induction_var_with_exact_iterations = true; + switch (array->data.mode) { case ir_var_auto: case ir_var_temporary: @@ -314,7 +324,8 @@ loop_unroll_visitor::visit_leave(ir_loop *ir) bool loop_too_large = count.nested_loop || count.nodes * iterations > max_iterations * 5; - if (loop_too_large && !count.unsupported_variable_indexing) + if (loop_too_large && !count.unsupported_variable_indexing && + !count.array_indexed_by_induction_var_with_exact_iterations) return visit_continue; /* Note: the limiting terminator contributes 1 to ls->num_loop_jumps. diff --git a/mesalib/src/glsl/lower_const_arrays_to_uniforms.cpp b/mesalib/src/glsl/lower_const_arrays_to_uniforms.cpp new file mode 100644 index 000000000..2243f479a --- /dev/null +++ b/mesalib/src/glsl/lower_const_arrays_to_uniforms.cpp @@ -0,0 +1,111 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file lower_const_arrays_to_uniforms.cpp + * + * Lower constant arrays to uniform arrays. + * + * Some driver backends (such as i965 and nouveau) don't handle constant arrays + * gracefully, instead treating them as ordinary writable temporary arrays. + * Since arrays can be large, this often means spilling them to scratch memory, + * which usually involves a large number of instructions. + * + * This must be called prior to link_set_uniform_initializers(); we need the + * linker to process our new uniform's constant initializer. + * + * This should be called after optimizations, since those can result in + * splitting and removing arrays that are indexed by constant expressions. + */ +#include "ir.h" +#include "ir_visitor.h" +#include "ir_rvalue_visitor.h" +#include "glsl_types.h" + +namespace { +class lower_const_array_visitor : public ir_rvalue_visitor { +public: + lower_const_array_visitor(exec_list *insts) + { + instructions = insts; + progress = false; + index = 0; + } + + bool run() + { + visit_list_elements(this, instructions); + return progress; + } + + void handle_rvalue(ir_rvalue **rvalue); + +private: + exec_list *instructions; + bool progress; + unsigned index; +}; + +void +lower_const_array_visitor::handle_rvalue(ir_rvalue **rvalue) +{ + if (!*rvalue) + return; + + ir_dereference_array *dra = (*rvalue)->as_dereference_array(); + if (!dra) + return; + + ir_constant *con = dra->array->as_constant(); + if (!con || !con->type->is_array()) + return; + + void *mem_ctx = ralloc_parent(con); + + char *uniform_name = ralloc_asprintf(mem_ctx, "constarray__%d", index++); + + ir_variable *uni = + new(mem_ctx) ir_variable(con->type, uniform_name, ir_var_uniform); + uni->constant_initializer = con; + uni->constant_value = con; + uni->data.has_initializer = true; + uni->data.how_declared = ir_var_hidden; + uni->data.read_only = true; + /* Assume the whole thing is accessed. */ + uni->data.max_array_access = uni->type->length - 1; + instructions->push_head(uni); + + ir_dereference_variable *varref = new(mem_ctx) ir_dereference_variable(uni); + *rvalue = new(mem_ctx) ir_dereference_array(varref, dra->array_index); + + progress = true; +} + +} /* anonymous namespace */ + +bool +lower_const_arrays_to_uniforms(exec_list *instructions) +{ + lower_const_array_visitor v(instructions); + return v.run(); +} diff --git a/mesalib/src/glsl/main.cpp b/mesalib/src/glsl/main.cpp index 9b36a1fed..91e457ada 100644 --- a/mesalib/src/glsl/main.cpp +++ b/mesalib/src/glsl/main.cpp @@ -35,6 +35,7 @@ #include "glsl_parser_extras.h" #include "ir_optimization.h" #include "program.h" +#include "program/hash_table.h" #include "loop_analysis.h" #include "standalone_scaffolding.h" @@ -357,6 +358,11 @@ main(int argc, char **argv) assert(whole_program != NULL); whole_program->InfoLog = ralloc_strdup(whole_program, ""); + /* Created just to avoid segmentation faults */ + whole_program->AttributeBindings = new string_to_uint_map; + whole_program->FragDataBindings = new string_to_uint_map; + whole_program->FragDataIndexBindings = new string_to_uint_map; + for (/* empty */; argc > optind; optind++) { whole_program->Shaders = reralloc(whole_program, whole_program->Shaders, @@ -415,6 +421,10 @@ main(int argc, char **argv) for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) ralloc_free(whole_program->_LinkedShaders[i]); + delete whole_program->AttributeBindings; + delete whole_program->FragDataBindings; + delete whole_program->FragDataIndexBindings; + ralloc_free(whole_program); _mesa_glsl_release_types(); _mesa_glsl_release_builtin_functions(); diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp index 0cdb8ecfc..430f5cb97 100644 --- a/mesalib/src/glsl/opt_algebraic.cpp +++ b/mesalib/src/glsl/opt_algebraic.cpp @@ -105,12 +105,6 @@ is_vec_negative_one(ir_constant *ir) } static inline bool -is_vec_basis(ir_constant *ir) -{ - return (ir == NULL) ? false : ir->is_basis(); -} - -static inline bool is_valid_vec_const(ir_constant *ir) { if (ir == NULL) @@ -537,21 +531,34 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) if (is_vec_zero(op_const[0]) || is_vec_zero(op_const[1])) return ir_constant::zero(mem_ctx, ir->type); - if (is_vec_basis(op_const[0])) { - unsigned component = 0; - for (unsigned c = 0; c < op_const[0]->type->vector_elements; c++) { - if (op_const[0]->value.f[c] == 1.0) - component = c; - } - return new(mem_ctx) ir_swizzle(ir->operands[1], component, 0, 0, 0, 1); - } - if (is_vec_basis(op_const[1])) { - unsigned component = 0; - for (unsigned c = 0; c < op_const[1]->type->vector_elements; c++) { - if (op_const[1]->value.f[c] == 1.0) - component = c; - } - return new(mem_ctx) ir_swizzle(ir->operands[0], component, 0, 0, 0, 1); + for (int i = 0; i < 2; i++) { + if (!op_const[i]) + continue; + + unsigned components[4] = { 0 }, count = 0; + + for (unsigned c = 0; c < op_const[i]->type->vector_elements; c++) { + if (op_const[i]->value.f[c] == 0.0) + continue; + + components[count] = c; + count++; + } + + /* No channels had zero values; bail. */ + if (count >= op_const[i]->type->vector_elements) + break; + + ir_expression_operation op = count == 1 ? + ir_binop_mul : ir_binop_dot; + + /* Swizzle both operands to remove the channels that were zero. */ + return new(mem_ctx) + ir_expression(op, glsl_type::float_type, + new(mem_ctx) ir_swizzle(ir->operands[0], + components, count), + new(mem_ctx) ir_swizzle(ir->operands[1], + components, count)); } break; diff --git a/mesalib/src/glsl/opt_cse.cpp b/mesalib/src/glsl/opt_cse.cpp index 9c96835dd..b0b67f496 100644 --- a/mesalib/src/glsl/opt_cse.cpp +++ b/mesalib/src/glsl/opt_cse.cpp @@ -194,6 +194,8 @@ is_cse_candidate_visitor::visit(ir_dereference_variable *ir) if (ir->var->data.read_only) { return visit_continue; } else { + if (debug) + printf("CSE: non-candidate: var %s is not read only\n", ir->var->name); ok = false; return visit_stop; } @@ -220,8 +222,11 @@ is_cse_candidate(ir_rvalue *ir) /* Our temporary variable assignment generation isn't ready to handle * anything bigger than a vector. */ - if (!ir->type->is_vector() && !ir->type->is_scalar()) + if (!ir->type->is_vector() && !ir->type->is_scalar()) { + if (debug) + printf("CSE: non-candidate: not a vector/scalar\n"); return false; + } /* Only handle expressions and textures currently. We may want to extend * to variable-index array dereferences at some point. @@ -231,6 +236,8 @@ is_cse_candidate(ir_rvalue *ir) case ir_type_texture: break; default: + if (debug) + printf("CSE: non-candidate: not an expression/texture\n"); return false; } diff --git a/mesalib/src/glsl/s_expression.cpp b/mesalib/src/glsl/s_expression.cpp index 1a28e1d52..2928a4db8 100644 --- a/mesalib/src/glsl/s_expression.cpp +++ b/mesalib/src/glsl/s_expression.cpp @@ -73,7 +73,7 @@ read_atom(void *ctx, const char *&src, char *&symbol_buffer) } else { // Check if the atom is a number. char *float_end = NULL; - float f = glsl_strtof(src, &float_end); + float f = _mesa_strtof(src, &float_end); if (float_end != src) { char *int_end = NULL; int i = strtol(src, &int_end, 10); diff --git a/mesalib/src/glsl/s_expression.h b/mesalib/src/glsl/s_expression.h index 642af19b4..1d4753530 100644 --- a/mesalib/src/glsl/s_expression.h +++ b/mesalib/src/glsl/s_expression.h @@ -27,7 +27,7 @@ #define S_EXPRESSION_H #include "main/core.h" /* for Elements */ -#include "strtod.h" +#include "util/strtod.h" #include "list.h" /* Type-safe downcasting macros (also safe to pass NULL) */ diff --git a/mesalib/src/mapi/glapi/SConscript b/mesalib/src/mapi/glapi/SConscript index bc1c43aa8..97ebfe638 100644 --- a/mesalib/src/mapi/glapi/SConscript +++ b/mesalib/src/mapi/glapi/SConscript @@ -16,6 +16,7 @@ if env['platform'] == 'windows': env.Append(CPPDEFINES = [ '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers + 'KHRONOS_DLL_EXPORTS', # declare gl* as __declspec(dllexport) in Khronos headers ]) if env['gles']: env.Append(CPPDEFINES = ['_GLAPI_DLL_EXPORTS']) diff --git a/mesalib/src/mapi/glapi/gen/KHR_context_flush_control.xml b/mesalib/src/mapi/glapi/gen/KHR_context_flush_control.xml new file mode 100644 index 000000000..bc724357b --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/KHR_context_flush_control.xml @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<OpenGLAPI> + +<category name="GL_KHR_context_flush_control" number="168"> + <enum name="CONTEXT_RELEASE_BEHAVIOR" value="0x82FB"/> + <enum name="CONTEXT_RELEASE_BEHAVIOR_FLUSH" value="0x82FC"/> +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am index 72e5095ee..7f76f1971 100644 --- a/mesalib/src/mapi/glapi/gen/Makefile.am +++ b/mesalib/src/mapi/glapi/gen/Makefile.am @@ -61,12 +61,10 @@ EXTRA_DIST= \ $(MESA_GLAPI_DIR)/glapi_x86-64.S \ $(MESA_GLAPI_DIR)/glapi_sparc.S \ $(COMMON_GLX) \ - extension_helper.py \ gl_apitemp.py \ gl_enums.py \ gl_genexec.py \ gl_gentable.py \ - gl_offsets.py \ gl_procs.py \ gl_SPARC_asm.py \ gl_table.py \ @@ -76,7 +74,6 @@ EXTRA_DIST= \ glX_proto_send.py \ glX_proto_size.py \ glX_server_table.py \ - mesadef.py \ remap_helper.py \ gl_API.dtd diff --git a/mesalib/src/mapi/glapi/gen/extension_helper.py b/mesalib/src/mapi/glapi/gen/extension_helper.py deleted file mode 100644 index da633dc61..000000000 --- a/mesalib/src/mapi/glapi/gen/extension_helper.py +++ /dev/null @@ -1,324 +0,0 @@ -#!/usr/bin/env python - -# (C) Copyright IBM Corporation 2005 -# 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 -# on the rights to use, copy, modify, merge, publish, distribute, sub -# license, and/or sell copies of the Software, and to permit persons to whom -# the Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -# IBM 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. -# -# Authors: -# Ian Romanick <idr@us.ibm.com> - -import gl_XML -import license -import sys, getopt, string - -vtxfmt = [ - "ArrayElement", \ - "Color3f", \ - "Color3fv", \ - "Color4f", \ - "Color4fv", \ - "EdgeFlag", \ - "EdgeFlagv", \ - "EvalCoord1f", \ - "EvalCoord1fv", \ - "EvalCoord2f", \ - "EvalCoord2fv", \ - "EvalPoint1", \ - "EvalPoint2", \ - "FogCoordfEXT", \ - "FogCoordfvEXT", \ - "Indexf", \ - "Indexfv", \ - "Materialfv", \ - "MultiTexCoord1fARB", \ - "MultiTexCoord1fvARB", \ - "MultiTexCoord2fARB", \ - "MultiTexCoord2fvARB", \ - "MultiTexCoord3fARB", \ - "MultiTexCoord3fvARB", \ - "MultiTexCoord4fARB", \ - "MultiTexCoord4fvARB", \ - "Normal3f", \ - "Normal3fv", \ - "SecondaryColor3fEXT", \ - "SecondaryColor3fvEXT", \ - "TexCoord1f", \ - "TexCoord1fv", \ - "TexCoord2f", \ - "TexCoord2fv", \ - "TexCoord3f", \ - "TexCoord3fv", \ - "TexCoord4f", \ - "TexCoord4fv", \ - "Vertex2f", \ - "Vertex2fv", \ - "Vertex3f", \ - "Vertex3fv", \ - "Vertex4f", \ - "Vertex4fv", \ - "CallList", \ - "CallLists", \ - "Begin", \ - "End", \ - "VertexAttrib1fNV", \ - "VertexAttrib1fvNV", \ - "VertexAttrib2fNV", \ - "VertexAttrib2fvNV", \ - "VertexAttrib3fNV", \ - "VertexAttrib3fvNV", \ - "VertexAttrib4fNV", \ - "VertexAttrib4fvNV", \ - "VertexAttrib1fARB", \ - "VertexAttrib1fvARB", \ - "VertexAttrib2fARB", \ - "VertexAttrib2fvARB", \ - "VertexAttrib3fARB", \ - "VertexAttrib3fvARB", \ - "VertexAttrib4fARB", \ - "VertexAttrib4fvARB", \ - "Rectf", \ - "DrawArrays", \ - "DrawElements", \ - "DrawRangeElements", \ - "EvalMesh1", \ - "EvalMesh2", \ -] - -def all_entrypoints_in_abi(f, abi, api): - for n in f.entry_points: - [category, num] = api.get_category_for_name( n ) - if category not in abi: - return 0 - - return 1 - - -def any_entrypoints_in_abi(f, abi, api): - for n in f.entry_points: - [category, num] = api.get_category_for_name( n ) - if category in abi: - return 1 - - return 0 - - -def condition_for_function(f, abi, all_not_in_ABI): - """Create a C-preprocessor condition for the function. - - There are two modes of operation. If all_not_in_ABI is set, a - condition is only created is all of the entry-point names for f are - not in the selected ABI. If all_not_in_ABI is not set, a condition - is created if any entryp-point name is not in the selected ABI. - """ - - condition = [] - for n in f.entry_points: - [category, num] = api.get_category_for_name( n ) - if category not in abi: - condition.append( 'defined(need_%s)' % (gl_XML.real_category_name( category )) ) - elif all_not_in_ABI: - return [] - - return condition - - -class PrintGlExtensionGlue(gl_XML.gl_print_base): - def __init__(self): - gl_XML.gl_print_base.__init__(self) - - self.name = "extension_helper.py (from Mesa)" - self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM") - return - - - def printRealHeader(self): - print '#include "utils.h"' - print '#include "main/dispatch.h"' - print '' - return - - - def printBody(self, api): - abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ] - - category_list = {} - - print '#ifndef NULL' - print '# define NULL 0' - print '#endif' - print '' - - for f in api.functionIterateAll(): - condition = condition_for_function(f, abi, 0) - if len(condition): - print '#if %s' % (string.join(condition, " || ")) - print 'static const char %s_names[] =' % (f.name) - - parameter_signature = '' - for p in f.parameterIterator(): - if p.is_padding: - continue - - # FIXME: This is a *really* ugly hack. :( - - tn = p.type_expr.get_base_type_node() - if p.is_pointer(): - parameter_signature += 'p' - elif tn.integer: - parameter_signature += 'i' - elif tn.size == 4: - parameter_signature += 'f' - else: - parameter_signature += 'd' - - print ' "%s\\0" /* Parameter signature */' % (parameter_signature) - - for n in f.entry_points: - print ' "gl%s\\0"' % (n) - - [category, num] = api.get_category_for_name( n ) - if category not in abi: - c = gl_XML.real_category_name(category) - if not category_list.has_key(c): - category_list[ c ] = [] - - category_list[ c ].append( f ) - - print ' "";' - print '#endif' - print '' - - keys = category_list.keys() - keys.sort() - - for category in keys: - print '#if defined(need_%s)' % (category) - print 'static const struct dri_extension_function %s_functions[] = {' % (category) - - for f in category_list[ category ]: - # A function either has an offset that is - # assigned by the ABI, or it has a remap - # index. - if any_entrypoints_in_abi(f, abi, api): - index_name = "-1" - offset = f.offset - else: - index_name = "%s_remap_index" % (f.name) - offset = -1 - - print ' { %s_names, %s, %d },' % (f.name, index_name, offset) - - - print ' { NULL, 0, 0 }' - print '};' - print '#endif' - print '' - - return - - -class PrintInitDispatch(gl_XML.gl_print_base): - def __init__(self): - gl_XML.gl_print_base.__init__(self) - - self.name = "extension_helper.py (from Mesa)" - self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM") - return - - - def do_function_body(self, api, abi, vtxfmt_only): - last_condition_string = None - for f in api.functionIterateByOffset(): - if (f.name in vtxfmt) and not vtxfmt_only: - continue - - if (f.name not in vtxfmt) and vtxfmt_only: - continue - - condition = condition_for_function(f, abi, 1) - condition_string = string.join(condition, " || ") - - if condition_string != last_condition_string: - if last_condition_string: - print '#endif /* %s */' % (last_condition_string) - - if condition_string: - print '#if %s' % (condition_string) - - if vtxfmt_only: - print ' disp->%s = vfmt->%s;' % (f.name, f.name) - else: - print ' disp->%s = _mesa_%s;' % (f.name, f.name) - - last_condition_string = condition_string - - if last_condition_string: - print '#endif /* %s */' % (last_condition_string) - - - - def printBody(self, api): - abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ] - - print 'void driver_init_exec_table(struct _glapi_table *disp)' - print '{' - self.do_function_body(api, abi, 0) - print '}' - print '' - print 'void driver_install_vtxfmt(struct _glapi_table *disp, const GLvertexformat *vfmt)' - print '{' - self.do_function_body(api, abi, 1) - print '}' - - return - - -def show_usage(): - print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0] - print " -m output_mode Output mode can be one of 'extensions' or 'exec_init'." - sys.exit(1) - -if __name__ == '__main__': - file_name = "gl_API.xml" - - try: - (args, trail) = getopt.getopt(sys.argv[1:], "f:m:") - except Exception,e: - show_usage() - - mode = "extensions" - for (arg,val) in args: - if arg == "-f": - file_name = val - if arg == '-m': - mode = val - - - api = gl_XML.parse_GL_API( file_name ) - - if mode == "extensions": - printer = PrintGlExtensionGlue() - elif mode == "exec_init": - printer = PrintInitDispatch() - else: - show_usage() - - printer.Print( api ) diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index 534e6a0b4..e1b12462e 100644 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -8379,6 +8379,8 @@ <xi:include href="ARB_texture_barrier.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> +<xi:include href="KHR_context_flush_control.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + <!-- Non-ARB extensions sorted by extension number. --> <category name="GL_EXT_blend_color" number="2"> diff --git a/mesalib/src/mapi/glapi/gen/gl_offsets.py b/mesalib/src/mapi/glapi/gen/gl_offsets.py deleted file mode 100644 index 897ac18ae..000000000 --- a/mesalib/src/mapi/glapi/gen/gl_offsets.py +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env python - -# (C) Copyright IBM Corporation 2004, 2005 -# 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 -# on the rights to use, copy, modify, merge, publish, distribute, sub -# license, and/or sell copies of the Software, and to permit persons to whom -# the Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -# IBM 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. -# -# Authors: -# Ian Romanick <idr@us.ibm.com> - -import gl_XML -import license -import sys, getopt - -class PrintGlOffsets(gl_XML.gl_print_base): - def __init__(self, es=False): - gl_XML.gl_print_base.__init__(self) - - self.es = es - self.name = "gl_offsets.py (from Mesa)" - self.header_tag = '_GLAPI_OFFSETS_H_' - self.license = license.bsd_license_template % ( \ -"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved. -(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM") - return - - def printBody(self, api): - print '/* this file should not be included directly in mesa */' - print '' - - functions = [] - abi_functions = [] - alias_functions = [] - count = 0 - for f in api.functionIterateByOffset(): - if not f.is_abi(): - functions.append( [f, count] ) - count += 1 - else: - abi_functions.append( f ) - - if self.es: - # remember functions with aliases - if len(f.entry_points) > 1: - alias_functions.append(f) - - for f in abi_functions: - print '#define _gloffset_%s %d' % (f.name, f.offset) - last_static = f.offset - - print '' - print '#if !defined(_GLAPI_USE_REMAP_TABLE)' - print '' - - for [f, index] in functions: - print '#define _gloffset_%s %d' % (f.name, f.offset) - - print '#define _gloffset_FIRST_DYNAMIC %d' % (api.next_offset) - - print '' - print '#else' - print '' - - for [f, index] in functions: - print '#define _gloffset_%s driDispatchRemapTable[%s_remap_index]' % (f.name, f.name) - - print '' - print '#endif /* !defined(_GLAPI_USE_REMAP_TABLE) */' - - if alias_functions: - print '' - print '/* define aliases for compatibility */' - for f in alias_functions: - for name in f.entry_points: - if name != f.name: - print '#define _gloffset_%s _gloffset_%s' % (name, f.name) - return - - -def show_usage(): - print "Usage: %s [-f input_file_name] [-c]" % sys.argv[0] - print " -c Enable compatibility with OpenGL ES." - sys.exit(1) - -if __name__ == '__main__': - file_name = "gl_API.xml" - - try: - (args, trail) = getopt.getopt(sys.argv[1:], "f:c") - except Exception,e: - show_usage() - - es = False - for (arg,val) in args: - if arg == "-f": - file_name = val - elif arg == "-c": - es = True - - api = gl_XML.parse_GL_API( file_name ) - - printer = PrintGlOffsets(es) - printer.Print( api ) diff --git a/mesalib/src/mapi/glapi/gen/mesadef.py b/mesalib/src/mapi/glapi/gen/mesadef.py deleted file mode 100644 index 77cc4a350..000000000 --- a/mesalib/src/mapi/glapi/gen/mesadef.py +++ /dev/null @@ -1,215 +0,0 @@ -#!/usr/bin/env python - - -# Mesa 3-D graphics library -# -# Copyright (C) 1999-2001 Brian Paul All Rights Reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# 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. - - -# Generate the mesa.def file for Windows. -# -# Usage: -# mesadef.py >mesa.def -# Then copy to src/mesa/drivers/windows/gdi -# -# Dependencies: -# The apispec file must be in the current directory. - - - -import apiparser -import string - - -def PrintHead(): - print '; DO NOT EDIT - This file generated automatically by mesadef.py script' - print 'DESCRIPTION \'Mesa (OpenGL work-alike) for Win32\'' - print 'VERSION 6.0' - print ';' - print '; Module definition file for Mesa (OPENGL32.DLL)' - print ';' - print '; Note: The OpenGL functions use the STDCALL' - print '; function calling convention. Microsoft\'s' - print '; OPENGL32 uses this convention and so must the' - print '; Mesa OPENGL32 so that the Mesa DLL can be used' - print '; as a drop-in replacement.' - print ';' - print '; The linker exports STDCALL entry points with' - print '; \'decorated\' names; e.g., _glBegin@0, where the' - print '; trailing number is the number of bytes of ' - print '; parameter data pushed onto the stack. The' - print '; callee is responsible for popping this data' - print '; off the stack, usually via a RETF n instruction.' - print ';' - print '; However, the Microsoft OPENGL32.DLL does not export' - print '; the decorated names, even though the calling convention' - print '; is STDCALL. So, this module definition file is' - print '; needed to force the Mesa OPENGL32.DLL to export the' - print '; symbols in the same manner as the Microsoft DLL.' - print '; Were it not for this problem, this file would not' - print '; be needed (for the gl* functions) since the entry' - print '; points are compiled with dllexport declspec.' - print ';' - print '; However, this file is still needed to export "internal"' - print '; Mesa symbols for the benefit of the OSMESA32.DLL.' - print ';' - print 'EXPORTS' - return -#enddef - - -def PrintTail(): - print ';' - print '; WGL API' - print '\twglChoosePixelFormat' - print '\twglCopyContext' - print '\twglCreateContext' - print '\twglCreateLayerContext' - print '\twglDeleteContext' - print '\twglDescribeLayerPlane' - print '\twglDescribePixelFormat' - print '\twglGetCurrentContext' - print '\twglGetCurrentDC' - print '\twglGetExtensionsStringARB' - print '\twglGetLayerPaletteEntries' - print '\twglGetPixelFormat' - print '\twglGetProcAddress' - print '\twglMakeCurrent' - print '\twglRealizeLayerPalette' - print '\twglSetLayerPaletteEntries' - print '\twglSetPixelFormat' - print '\twglShareLists' - print '\twglSwapBuffers' - print '\twglSwapLayerBuffers' - print '\twglUseFontBitmapsA' - print '\twglUseFontBitmapsW' - print '\twglUseFontOutlinesA' - print '\twglUseFontOutlinesW' - print ';' - print '; Mesa internals - mostly for OSMESA' - print '\t_ac_CreateContext' - print '\t_ac_DestroyContext' - print '\t_ac_InvalidateState' - print '\t_glapi_get_context' - print '\t_glapi_get_proc_address' - print '\t_mesa_buffer_data' - print '\t_mesa_buffer_map' - print '\t_mesa_buffer_subdata' - print '\t_mesa_choose_tex_format' - print '\t_mesa_compressed_texture_size' - print '\t_mesa_create_framebuffer' - print '\t_mesa_create_visual' - print '\t_mesa_delete_buffer_object' - print '\t_mesa_delete_texture_object' - print '\t_mesa_destroy_framebuffer' - print '\t_mesa_destroy_visual' - print '\t_mesa_enable_1_3_extensions' - print '\t_mesa_enable_1_4_extensions' - print '\t_mesa_enable_1_5_extensions' - print '\t_mesa_enable_sw_extensions' - print '\t_mesa_error' - print '\t_mesa_free_context_data' - print '\t_mesa_get_current_context' - print '\t_mesa_init_default_imports' - print '\t_mesa_initialize_context' - print '\t_mesa_make_current' - print '\t_mesa_new_buffer_object' - print '\t_mesa_new_texture_object' - print '\t_mesa_problem' - print '\t_mesa_store_compressed_teximage1d' - print '\t_mesa_store_compressed_teximage2d' - print '\t_mesa_store_compressed_teximage3d' - print '\t_mesa_store_compressed_texsubimage1d' - print '\t_mesa_store_compressed_texsubimage2d' - print '\t_mesa_store_compressed_texsubimage3d' - print '\t_mesa_store_teximage1d' - print '\t_mesa_store_teximage2d' - print '\t_mesa_store_teximage3d' - print '\t_mesa_store_texsubimage1d' - print '\t_mesa_store_texsubimage2d' - print '\t_mesa_store_texsubimage3d' - print '\t_mesa_test_proxy_teximage' - print '\t_mesa_Viewport' - print '\t_mesa_meta_CopyColorSubTable' - print '\t_mesa_meta_CopyColorTable' - print '\t_mesa_meta_CopyConvolutionFilter1D' - print '\t_mesa_meta_CopyConvolutionFilter2D' - print '\t_mesa_meta_CopyTexImage1D' - print '\t_mesa_meta_CopyTexImage2D' - print '\t_mesa_meta_CopyTexSubImage1D' - print '\t_mesa_meta_CopyTexSubImage2D' - print '\t_mesa_meta_CopyTexSubImage3D' - print '\t_swrast_Accum' - print '\t_swrast_alloc_buffers' - print '\t_swrast_Bitmap' - print '\t_swrast_CopyPixels' - print '\t_swrast_DrawPixels' - print '\t_swrast_GetDeviceDriverReference' - print '\t_swrast_Clear' - print '\t_swrast_choose_line' - print '\t_swrast_choose_triangle' - print '\t_swrast_CreateContext' - print '\t_swrast_DestroyContext' - print '\t_swrast_InvalidateState' - print '\t_swrast_ReadPixels' - print '\t_swrast_zbuffer_address' - print '\t_swsetup_Wakeup' - print '\t_swsetup_CreateContext' - print '\t_swsetup_DestroyContext' - print '\t_swsetup_InvalidateState' - print '\t_tnl_CreateContext' - print '\t_tnl_DestroyContext' - print '\t_tnl_InvalidateState' - print '\t_tnl_MakeCurrent' - print '\t_tnl_run_pipeline' -#enddef - - -records = [] - -def FindOffset(funcName): - for (name, alias, offset) in records: - if name == funcName: - return offset - #endif - #endfor - return -1 -#enddef - - -def EmitEntry(name, returnType, argTypeList, argNameList, alias, offset): - if alias == '': - dispatchName = name - else: - dispatchName = alias - if offset < 0: - offset = FindOffset(dispatchName) - if offset >= 0 and string.find(name, "unused") == -1: - print '\tgl%s' % (name) - # save this info in case we need to look up an alias later - records.append((name, dispatchName, offset)) - -#enddef - - -PrintHead() -apiparser.ProcessSpecFile("APIspec", EmitEntry) -PrintTail() diff --git a/mesalib/src/mesa/Android.libmesa_dricore.mk b/mesalib/src/mesa/Android.libmesa_dricore.mk index 1e6d94872..2ab593d3c 100644 --- a/mesalib/src/mesa/Android.libmesa_dricore.mk +++ b/mesalib/src/mesa/Android.libmesa_dricore.mk @@ -51,10 +51,16 @@ endif # MESA_ENABLE_ASM ifeq ($(ARCH_X86_HAVE_SSE4_1),true) LOCAL_SRC_FILES += \ - $(SRCDIR)main/streaming-load-memcpy.c + $(SRCDIR)main/streaming-load-memcpy.c \ + $(SRCDIR)main/sse_minmax.c LOCAL_CFLAGS := -msse4.1 endif +ifeq ($(ARCH_X86_HAVE_SSE4_1),true) +LOCAL_CFLAGS += \ + -DUSE_SSE41 +endif + LOCAL_C_INCLUDES := \ $(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \ $(MESA_TOP)/src \ diff --git a/mesalib/src/mesa/Android.libmesa_st_mesa.mk b/mesalib/src/mesa/Android.libmesa_st_mesa.mk index 8b8d652a3..618d6bfb2 100644 --- a/mesalib/src/mesa/Android.libmesa_st_mesa.mk +++ b/mesalib/src/mesa/Android.libmesa_st_mesa.mk @@ -48,6 +48,11 @@ ifeq ($(TARGET_ARCH),x86) endif # x86 endif # MESA_ENABLE_ASM +ifeq ($(ARCH_X86_HAVE_SSE4_1),true) +LOCAL_CFLAGS := \ + -DUSE_SSE41 +endif + LOCAL_C_INCLUDES := \ $(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \ $(MESA_TOP)/src/gallium/auxiliary \ diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am index e71bccbbe..932db4fb8 100644 --- a/mesalib/src/mesa/Makefile.am +++ b/mesalib/src/mesa/Makefile.am @@ -151,7 +151,8 @@ libmesagallium_la_LIBADD = \ $(ARCH_LIBS) libmesa_sse41_la_SOURCES = \ - main/streaming-load-memcpy.c + main/streaming-load-memcpy.c \ + main/sse_minmax.c libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1 pkgconfigdir = $(libdir)/pkgconfig diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c index 6c78928ee..d6e875fcf 100644 --- a/mesalib/src/mesa/drivers/dri/common/dri_util.c +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c @@ -376,19 +376,17 @@ driCreateContextAttribs(__DRIscreen *screen, int api, return NULL; } - /* The EGL_KHR_create_context spec says: + /* The latest version of EGL_KHR_create_context spec says: * - * "Flags are only defined for OpenGL context creation, and specifying - * a flags value other than zero for other types of contexts, - * including OpenGL ES contexts, will generate an error." + * "If the EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR flag bit is set in + * EGL_CONTEXT_FLAGS_KHR, then a <debug context> will be created. + * [...] This bit is supported for OpenGL and OpenGL ES contexts. * - * The GLX_EXT_create_context_es2_profile specification doesn't say - * anything specific about this case. However, none of the known flags - * have any meaning in an ES context, so this seems safe. + * None of the other flags have any meaning in an ES context, so this seems safe. */ if (mesa_api != API_OPENGL_COMPAT && mesa_api != API_OPENGL_CORE - && flags != 0) { + && (flags & ~__DRI_CTX_FLAG_DEBUG)) { *error = __DRI_CTX_ERROR_BAD_FLAG; return NULL; } @@ -569,6 +567,12 @@ static int driUnbindContext(__DRIcontext *pcp) if (pcp == NULL) return GL_FALSE; + /* + ** Call driUnbindContext before checking for valid drawables + ** to handle surfaceless contexts properly. + */ + pcp->driScreenPriv->driver->UnbindContext(pcp); + pdp = pcp->driDrawablePriv; prp = pcp->driReadablePriv; @@ -576,8 +580,6 @@ static int driUnbindContext(__DRIcontext *pcp) if (!pdp && !prp) return GL_TRUE; - pcp->driScreenPriv->driver->UnbindContext(pcp); - assert(pdp); if (pdp->refcount == 0) { /* ERROR!!! */ diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h index b73a6620c..4e5a7217e 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h @@ -340,3 +340,21 @@ DRI_CONF_SECTION_BEGIN \ DRI_CONF_OPT_BEGIN(device_id, string, def) \ DRI_CONF_DESC(en,gettext("Define the graphic device to use if possible")) \ DRI_CONF_OPT_END + +/** + * \brief Gallium-Nine specific configuration options + */ + +#define DRI_CONF_SECTION_NINE \ +DRI_CONF_SECTION_BEGIN \ + DRI_CONF_DESC(en,gettext("Gallium Nine")) + +#define DRI_CONF_NINE_THROTTLE(def) \ +DRI_CONF_OPT_BEGIN(throttle_value, int, def) \ + DRI_CONF_DESC(en,gettext("Define the throttling value. -1 for no throttling, -2 for default (usually 2), 0 for glfinish behaviour")) \ +DRI_CONF_OPT_END + +#define DRI_CONF_NINE_THREADSUBMIT(def) \ +DRI_CONF_OPT_BEGIN_B(thread_submit, def) \ + DRI_CONF_DESC(en,gettext("Use an additional thread to submit buffers.")) \ +DRI_CONF_OPT_END diff --git a/mesalib/src/mesa/drivers/windows/gdi/mesa.def b/mesalib/src/mesa/drivers/windows/gdi/mesa.def index 92736b368..a52207b63 100644 --- a/mesalib/src/mesa/drivers/windows/gdi/mesa.def +++ b/mesalib/src/mesa/drivers/windows/gdi/mesa.def @@ -1,6 +1,3 @@ -; DO NOT EDIT - This file generated automatically by mesadef.py script -;DESCRIPTION 'Mesa (OpenGL work-alike) for Win32' -VERSION 6.5 ; ; Module definition file for Mesa (OPENGL32.DLL) ; @@ -27,15 +24,23 @@ VERSION 6.5 ; points are compiled with dllexport declspec. ; EXPORTS - glNewList - glEndList - glCallList - glCallLists - glDeleteLists - glGenLists - glListBase + glAccum + glAlphaFunc + glAreTexturesResident + glArrayElement glBegin + glBindTexture glBitmap + glBlendFunc + glCallList + glCallLists + glClear + glClearAccum + glClearColor + glClearDepth + glClearIndex + glClearStencil + glClipPlane glColor3b glColor3bv glColor3d @@ -68,9 +73,88 @@ EXPORTS glColor4uiv glColor4us glColor4usv + glColorMask + glColorMaterial + glColorPointer + glCopyPixels + glCopyTexImage1D + glCopyTexImage2D + glCopyTexSubImage1D + glCopyTexSubImage2D + glCullFace + glDeleteLists + glDeleteTextures + glDepthFunc + glDepthMask + glDepthRange + glDisable + glDisableClientState + glDrawArrays + glDrawBuffer + glDrawElements + glDrawPixels glEdgeFlag + glEdgeFlagPointer glEdgeFlagv + glEnable + glEnableClientState glEnd + glEndList + glEvalCoord1d + glEvalCoord1dv + glEvalCoord1f + glEvalCoord1fv + glEvalCoord2d + glEvalCoord2dv + glEvalCoord2f + glEvalCoord2fv + glEvalMesh1 + glEvalMesh2 + glEvalPoint1 + glEvalPoint2 + glFeedbackBuffer + glFinish + glFlush + glFogf + glFogfv + glFogi + glFogiv + glFrontFace + glFrustum + glGenLists + glGenTextures + glGetBooleanv + glGetClipPlane + glGetDoublev + glGetError + glGetFloatv + glGetIntegerv + glGetLightfv + glGetLightiv + glGetMapdv + glGetMapfv + glGetMapiv + glGetMaterialfv + glGetMaterialiv + glGetPixelMapfv + glGetPixelMapuiv + glGetPixelMapusv + glGetPointerv + glGetPolygonStipple + glGetString + glGetTexEnvfv + glGetTexEnviv + glGetTexGendv + glGetTexGenfv + glGetTexGeniv + glGetTexImage + glGetTexLevelParameterfv + glGetTexLevelParameteriv + glGetTexParameterfv + glGetTexParameteriv + glHint + glIndexMask + glIndexPointer glIndexd glIndexdv glIndexf @@ -79,6 +163,45 @@ EXPORTS glIndexiv glIndexs glIndexsv + glIndexub + glIndexubv + glInitNames + glInterleavedArrays + glIsEnabled + glIsList + glIsTexture + glLightModelf + glLightModelfv + glLightModeli + glLightModeliv + glLightf + glLightfv + glLighti + glLightiv + glLineStipple + glLineWidth + glListBase + glLoadIdentity + glLoadMatrixd + glLoadMatrixf + glLoadName + glLogicOp + glMap1d + glMap1f + glMap2d + glMap2f + glMapGrid1d + glMapGrid1f + glMapGrid2d + glMapGrid2f + glMaterialf + glMaterialfv + glMateriali + glMaterialiv + glMatrixMode + glMultMatrixd + glMultMatrixf + glNewList glNormal3b glNormal3bv glNormal3d @@ -89,6 +212,30 @@ EXPORTS glNormal3iv glNormal3s glNormal3sv + glNormalPointer + glOrtho + glPassThrough + glPixelMapfv + glPixelMapuiv + glPixelMapusv + glPixelStoref + glPixelStorei + glPixelTransferf + glPixelTransferi + glPixelZoom + glPointSize + glPolygonMode + glPolygonOffset + glPolygonStipple + glPopAttrib + glPopClientAttrib + glPopMatrix + glPopName + glPrioritizeTextures + glPushAttrib + glPushClientAttrib + glPushMatrix + glPushName glRasterPos2d glRasterPos2dv glRasterPos2f @@ -113,6 +260,8 @@ EXPORTS glRasterPos4iv glRasterPos4s glRasterPos4sv + glReadBuffer + glReadPixels glRectd glRectdv glRectf @@ -121,6 +270,17 @@ EXPORTS glRectiv glRects glRectsv + glRenderMode + glRotated + glRotatef + glScaled + glScalef + glScissor + glSelectBuffer + glShadeModel + glStencilFunc + glStencilMask + glStencilOp glTexCoord1d glTexCoord1dv glTexCoord1f @@ -153,6 +313,27 @@ EXPORTS glTexCoord4iv glTexCoord4s glTexCoord4sv + glTexCoordPointer + glTexEnvf + glTexEnvfv + glTexEnvi + glTexEnviv + glTexGend + glTexGendv + glTexGenf + glTexGenfv + glTexGeni + glTexGeniv + glTexImage1D + glTexImage2D + glTexParameterf + glTexParameterfv + glTexParameteri + glTexParameteriv + glTexSubImage1D + glTexSubImage2D + glTranslated + glTranslatef glVertex2d glVertex2dv glVertex2f @@ -177,643 +358,8 @@ EXPORTS glVertex4iv glVertex4s glVertex4sv - glClipPlane - glColorMaterial - glCullFace - glFogf - glFogfv - glFogi - glFogiv - glFrontFace - glHint - glLightf - glLightfv - glLighti - glLightiv - glLightModelf - glLightModelfv - glLightModeli - glLightModeliv - glLineStipple - glLineWidth - glMaterialf - glMaterialfv - glMateriali - glMaterialiv - glPointSize - glPolygonMode - glPolygonStipple - glScissor - glShadeModel - glTexParameterf - glTexParameterfv - glTexParameteri - glTexParameteriv - glTexImage1D - glTexImage2D - glTexEnvf - glTexEnvfv - glTexEnvi - glTexEnviv - glTexGend - glTexGendv - glTexGenf - glTexGenfv - glTexGeni - glTexGeniv - glFeedbackBuffer - glSelectBuffer - glRenderMode - glInitNames - glLoadName - glPassThrough - glPopName - glPushName - glDrawBuffer - glClear - glClearAccum - glClearIndex - glClearColor - glClearStencil - glClearDepth - glStencilMask - glColorMask - glDepthMask - glIndexMask - glAccum - glDisable - glEnable - glFinish - glFlush - glPopAttrib - glPushAttrib - glMap1d - glMap1f - glMap2d - glMap2f - glMapGrid1d - glMapGrid1f - glMapGrid2d - glMapGrid2f - glEvalCoord1d - glEvalCoord1dv - glEvalCoord1f - glEvalCoord1fv - glEvalCoord2d - glEvalCoord2dv - glEvalCoord2f - glEvalCoord2fv - glEvalMesh1 - glEvalPoint1 - glEvalMesh2 - glEvalPoint2 - glAlphaFunc - glBlendFunc - glLogicOp - glStencilFunc - glStencilOp - glDepthFunc - glPixelZoom - glPixelTransferf - glPixelTransferi - glPixelStoref - glPixelStorei - glPixelMapfv - glPixelMapuiv - glPixelMapusv - glReadBuffer - glCopyPixels - glReadPixels - glDrawPixels - glGetBooleanv - glGetClipPlane - glGetDoublev - glGetError - glGetFloatv - glGetIntegerv - glGetLightfv - glGetLightiv - glGetMapdv - glGetMapfv - glGetMapiv - glGetMaterialfv - glGetMaterialiv - glGetPixelMapfv - glGetPixelMapuiv - glGetPixelMapusv - glGetPolygonStipple - glGetString - glGetTexEnvfv - glGetTexEnviv - glGetTexGendv - glGetTexGenfv - glGetTexGeniv - glGetTexImage - glGetTexParameterfv - glGetTexParameteriv - glGetTexLevelParameterfv - glGetTexLevelParameteriv - glIsEnabled - glIsList - glDepthRange - glFrustum - glLoadIdentity - glLoadMatrixf - glLoadMatrixd - glMatrixMode - glMultMatrixf - glMultMatrixd - glOrtho - glPopMatrix - glPushMatrix - glRotated - glRotatef - glScaled - glScalef - glTranslated - glTranslatef - glViewport - glArrayElement - glColorPointer - glDisableClientState - glDrawArrays - glDrawElements - glEdgeFlagPointer - glEnableClientState - glGetPointerv - glIndexPointer - glInterleavedArrays - glNormalPointer - glTexCoordPointer glVertexPointer - glPolygonOffset - glCopyTexImage1D - glCopyTexImage2D - glCopyTexSubImage1D - glCopyTexSubImage2D - glTexSubImage1D - glTexSubImage2D - glAreTexturesResident - glBindTexture - glDeleteTextures - glGenTextures - glIsTexture - glPrioritizeTextures - glIndexub - glIndexubv - glPopClientAttrib - glPushClientAttrib - glBlendColor - glBlendEquation - glDrawRangeElements - glColorTable - glColorTableParameterfv - glColorTableParameteriv - glCopyColorTable - glGetColorTable - glGetColorTableParameterfv - glGetColorTableParameteriv - glColorSubTable - glCopyColorSubTable - glConvolutionFilter1D - glConvolutionFilter2D - glConvolutionParameterf - glConvolutionParameterfv - glConvolutionParameteri - glConvolutionParameteriv - glCopyConvolutionFilter1D - glCopyConvolutionFilter2D - glGetConvolutionFilter - glGetConvolutionParameterfv - glGetConvolutionParameteriv - glGetSeparableFilter - glSeparableFilter2D - glGetHistogram - glGetHistogramParameterfv - glGetHistogramParameteriv - glGetMinmax - glGetMinmaxParameterfv - glGetMinmaxParameteriv - glHistogram - glMinmax - glResetHistogram - glResetMinmax - glTexImage3D - glTexSubImage3D - glCopyTexSubImage3D - glActiveTextureARB - glClientActiveTextureARB - glMultiTexCoord1dARB - glMultiTexCoord1dvARB - glMultiTexCoord1fARB - glMultiTexCoord1fvARB - glMultiTexCoord1iARB - glMultiTexCoord1ivARB - glMultiTexCoord1sARB - glMultiTexCoord1svARB - glMultiTexCoord2dARB - glMultiTexCoord2dvARB - glMultiTexCoord2fARB - glMultiTexCoord2fvARB - glMultiTexCoord2iARB - glMultiTexCoord2ivARB - glMultiTexCoord2sARB - glMultiTexCoord2svARB - glMultiTexCoord3dARB - glMultiTexCoord3dvARB - glMultiTexCoord3fARB - glMultiTexCoord3fvARB - glMultiTexCoord3iARB - glMultiTexCoord3ivARB - glMultiTexCoord3sARB - glMultiTexCoord3svARB - glMultiTexCoord4dARB - glMultiTexCoord4dvARB - glMultiTexCoord4fARB - glMultiTexCoord4fvARB - glMultiTexCoord4iARB - glMultiTexCoord4ivARB - glMultiTexCoord4sARB - glMultiTexCoord4svARB - glLoadTransposeMatrixfARB - glLoadTransposeMatrixdARB - glMultTransposeMatrixfARB - glMultTransposeMatrixdARB - glSampleCoverageARB - glCompressedTexImage3DARB - glCompressedTexImage2DARB - glCompressedTexImage1DARB - glCompressedTexSubImage3DARB - glCompressedTexSubImage2DARB - glCompressedTexSubImage1DARB - glGetCompressedTexImageARB - glActiveTexture - glClientActiveTexture - glMultiTexCoord1d - glMultiTexCoord1dv - glMultiTexCoord1f - glMultiTexCoord1fv - glMultiTexCoord1i - glMultiTexCoord1iv - glMultiTexCoord1s - glMultiTexCoord1sv - glMultiTexCoord2d - glMultiTexCoord2dv - glMultiTexCoord2f - glMultiTexCoord2fv - glMultiTexCoord2i - glMultiTexCoord2iv - glMultiTexCoord2s - glMultiTexCoord2sv - glMultiTexCoord3d - glMultiTexCoord3dv - glMultiTexCoord3f - glMultiTexCoord3fv - glMultiTexCoord3i - glMultiTexCoord3iv - glMultiTexCoord3s - glMultiTexCoord3sv - glMultiTexCoord4d - glMultiTexCoord4dv - glMultiTexCoord4f - glMultiTexCoord4fv - glMultiTexCoord4i - glMultiTexCoord4iv - glMultiTexCoord4s - glMultiTexCoord4sv - glLoadTransposeMatrixf - glLoadTransposeMatrixd - glMultTransposeMatrixf - glMultTransposeMatrixd - glSampleCoverage - glCompressedTexImage3D - glCompressedTexImage2D - glCompressedTexImage1D - glCompressedTexSubImage3D - glCompressedTexSubImage2D - glCompressedTexSubImage1D - glGetCompressedTexImage - glBlendColorEXT - glPolygonOffsetEXT - glTexImage3DEXT - glTexSubImage3DEXT - glTexSubImage1DEXT - glTexSubImage2DEXT - glCopyTexImage1DEXT - glCopyTexImage2DEXT - glCopyTexSubImage1DEXT - glCopyTexSubImage2DEXT - glCopyTexSubImage3DEXT - glAreTexturesResidentEXT - glBindTextureEXT - glDeleteTexturesEXT - glGenTexturesEXT - glIsTextureEXT - glPrioritizeTexturesEXT - glArrayElementEXT - glColorPointerEXT - glDrawArraysEXT - glEdgeFlagPointerEXT - glGetPointervEXT - glIndexPointerEXT - glNormalPointerEXT - glTexCoordPointerEXT - glVertexPointerEXT - glBlendEquationEXT - glPointParameterfEXT - glPointParameterfvEXT - glPointParameterfARB - glPointParameterfvARB - glColorTableEXT - glGetColorTableEXT - glGetColorTableParameterivEXT - glGetColorTableParameterfvEXT - glLockArraysEXT - glUnlockArraysEXT - glDrawRangeElementsEXT - glSecondaryColor3bEXT - glSecondaryColor3bvEXT - glSecondaryColor3dEXT - glSecondaryColor3dvEXT - glSecondaryColor3fEXT - glSecondaryColor3fvEXT - glSecondaryColor3iEXT - glSecondaryColor3ivEXT - glSecondaryColor3sEXT - glSecondaryColor3svEXT - glSecondaryColor3ubEXT - glSecondaryColor3ubvEXT - glSecondaryColor3uiEXT - glSecondaryColor3uivEXT - glSecondaryColor3usEXT - glSecondaryColor3usvEXT - glSecondaryColorPointerEXT - glMultiDrawArraysEXT - glMultiDrawElementsEXT - glFogCoordfEXT - glFogCoordfvEXT - glFogCoorddEXT - glFogCoorddvEXT - glFogCoordPointerEXT - glBlendFuncSeparateEXT - glWindowPos2dMESA - glWindowPos2dvMESA - glWindowPos2fMESA - glWindowPos2fvMESA - glWindowPos2iMESA - glWindowPos2ivMESA - glWindowPos2sMESA - glWindowPos2svMESA - glWindowPos3dMESA - glWindowPos3dvMESA - glWindowPos3fMESA - glWindowPos3fvMESA - glWindowPos3iMESA - glWindowPos3ivMESA - glWindowPos3sMESA - glWindowPos3svMESA - glWindowPos4dMESA - glWindowPos4dvMESA - glWindowPos4fMESA - glWindowPos4fvMESA - glWindowPos4iMESA - glWindowPos4ivMESA - glWindowPos4sMESA - glWindowPos4svMESA - glWindowPos2dARB - glWindowPos2fARB - glWindowPos2iARB - glWindowPos2sARB - glWindowPos2dvARB - glWindowPos2fvARB - glWindowPos2ivARB - glWindowPos2svARB - glWindowPos3dARB - glWindowPos3fARB - glWindowPos3iARB - glWindowPos3sARB - glWindowPos3dvARB - glWindowPos3fvARB - glWindowPos3ivARB - glWindowPos3svARB - glAreProgramsResidentNV - glBindProgramNV - glDeleteProgramsNV - glExecuteProgramNV - glGenProgramsNV - glGetProgramParameterdvNV - glGetProgramParameterfvNV - glGetProgramivNV - glGetProgramStringNV - glGetTrackMatrixivNV - glGetVertexAttribdvNV - glGetVertexAttribfvNV - glGetVertexAttribivNV - glGetVertexAttribPointervNV - glIsProgramNV - glLoadProgramNV - glProgramParameter4dNV - glProgramParameter4dvNV - glProgramParameter4fNV - glProgramParameter4fvNV - glProgramParameters4dvNV - glProgramParameters4fvNV - glRequestResidentProgramsNV - glTrackMatrixNV - glVertexAttribPointerNV - glVertexAttrib1dNV - glVertexAttrib1dvNV - glVertexAttrib1fNV - glVertexAttrib1fvNV - glVertexAttrib1sNV - glVertexAttrib1svNV - glVertexAttrib2dNV - glVertexAttrib2dvNV - glVertexAttrib2fNV - glVertexAttrib2fvNV - glVertexAttrib2sNV - glVertexAttrib2svNV - glVertexAttrib3dNV - glVertexAttrib3dvNV - glVertexAttrib3fNV - glVertexAttrib3fvNV - glVertexAttrib3sNV - glVertexAttrib3svNV - glVertexAttrib4dNV - glVertexAttrib4dvNV - glVertexAttrib4fNV - glVertexAttrib4fvNV - glVertexAttrib4sNV - glVertexAttrib4svNV - glVertexAttrib4ubNV - glVertexAttrib4ubvNV - glVertexAttribs1dvNV - glVertexAttribs1fvNV - glVertexAttribs1svNV - glVertexAttribs2dvNV - glVertexAttribs2fvNV - glVertexAttribs2svNV - glVertexAttribs3dvNV - glVertexAttribs3fvNV - glVertexAttribs3svNV - glVertexAttribs4dvNV - glVertexAttribs4fvNV - glVertexAttribs4svNV - glVertexAttribs4ubvNV - glPointParameteriNV - glPointParameterivNV - glFogCoordf - glFogCoordfv - glFogCoordd - glFogCoorddv - glFogCoordPointer - glMultiDrawArrays - glMultiDrawElements - glPointParameterf - glPointParameterfv - glPointParameteri - glPointParameteriv - glSecondaryColor3b - glSecondaryColor3bv - glSecondaryColor3d - glSecondaryColor3dv - glSecondaryColor3f - glSecondaryColor3fv - glSecondaryColor3i - glSecondaryColor3iv - glSecondaryColor3s - glSecondaryColor3sv - glSecondaryColor3ub - glSecondaryColor3ubv - glSecondaryColor3ui - glSecondaryColor3uiv - glSecondaryColor3us - glSecondaryColor3usv - glSecondaryColorPointer - glWindowPos2d - glWindowPos2dv - glWindowPos2f - glWindowPos2fv - glWindowPos2i - glWindowPos2iv - glWindowPos2s - glWindowPos2sv - glWindowPos3d - glWindowPos3dv - glWindowPos3f - glWindowPos3fv - glWindowPos3i - glWindowPos3iv - glWindowPos3s - glWindowPos3sv - glVertexAttrib1sARB - glVertexAttrib1fARB - glVertexAttrib1dARB - glVertexAttrib2sARB - glVertexAttrib2fARB - glVertexAttrib2dARB - glVertexAttrib3sARB - glVertexAttrib3fARB - glVertexAttrib3dARB - glVertexAttrib4sARB - glVertexAttrib4fARB - glVertexAttrib4dARB - glVertexAttrib4NubARB - glVertexAttrib1svARB - glVertexAttrib1fvARB - glVertexAttrib1dvARB - glVertexAttrib2svARB - glVertexAttrib2fvARB - glVertexAttrib2dvARB - glVertexAttrib3svARB - glVertexAttrib3fvARB - glVertexAttrib3dvARB - glVertexAttrib4bvARB - glVertexAttrib4svARB - glVertexAttrib4ivARB - glVertexAttrib4ubvARB - glVertexAttrib4usvARB - glVertexAttrib4uivARB - glVertexAttrib4fvARB - glVertexAttrib4dvARB - glVertexAttrib4NbvARB - glVertexAttrib4NsvARB - glVertexAttrib4NivARB - glVertexAttrib4NubvARB - glVertexAttrib4NusvARB - glVertexAttrib4NuivARB - glVertexAttribPointerARB - glEnableVertexAttribArrayARB - glDisableVertexAttribArrayARB - glProgramStringARB - glBindProgramARB - glDeleteProgramsARB - glGenProgramsARB - glIsProgramARB - glProgramEnvParameter4dARB - glProgramEnvParameter4dvARB - glProgramEnvParameter4fARB - glProgramEnvParameter4fvARB - glProgramLocalParameter4dARB - glProgramLocalParameter4dvARB - glProgramLocalParameter4fARB - glProgramLocalParameter4fvARB - glGetProgramEnvParameterdvARB - glGetProgramEnvParameterfvARB - glGetProgramLocalParameterdvARB - glGetProgramLocalParameterfvARB - glGetProgramivARB - glGetProgramStringARB - glGetVertexAttribdvARB - glGetVertexAttribfvARB - glGetVertexAttribivARB - glGetVertexAttribPointervARB - glProgramNamedParameter4fNV - glProgramNamedParameter4dNV - glProgramNamedParameter4fvNV - glProgramNamedParameter4dvNV - glGetProgramNamedParameterfvNV - glGetProgramNamedParameterdvNV - glBindBufferARB - glBufferDataARB - glBufferSubDataARB - glDeleteBuffersARB - glGenBuffersARB - glGetBufferParameterivARB - glGetBufferPointervARB - glGetBufferSubDataARB - glIsBufferARB - glMapBufferARB - glUnmapBufferARB - glGenQueriesARB - glDeleteQueriesARB - glIsQueryARB - glBeginQueryARB - glEndQueryARB - glGetQueryivARB - glGetQueryObjectivARB - glGetQueryObjectuivARB - glBindBuffer - glBufferData - glBufferSubData - glDeleteBuffers - glGenBuffers - glGetBufferParameteriv - glGetBufferPointerv - glGetBufferSubData - glIsBuffer - glMapBuffer - glUnmapBuffer - glGenQueries - glDeleteQueries - glIsQuery - glBeginQuery - glEndQuery - glGetQueryiv - glGetQueryObjectiv - glGetQueryObjectuiv -; -; WGL API + glViewport wglChoosePixelFormat wglCopyContext wglCreateContext @@ -837,4 +383,3 @@ EXPORTS wglUseFontBitmapsW wglUseFontOutlinesA wglUseFontOutlinesW - wglGetExtensionsStringARB diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c index 9b80600de..bf4fa3ea8 100644 --- a/mesalib/src/mesa/main/api_validate.c +++ b/mesalib/src/mesa/main/api_validate.c @@ -55,52 +55,6 @@ index_bytes(GLenum type, GLsizei count) /** - * Find the max index in the given element/index buffer - */ -GLuint -_mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type, - const void *indices, - struct gl_buffer_object *elementBuf) -{ - const GLubyte *map = NULL; - GLuint max = 0; - GLuint i; - - if (_mesa_is_bufferobj(elementBuf)) { - /* elements are in a user-defined buffer object. need to map it */ - map = ctx->Driver.MapBufferRange(ctx, 0, elementBuf->Size, - GL_MAP_READ_BIT, elementBuf, - MAP_INTERNAL); - /* Actual address is the sum of pointers */ - indices = (const GLvoid *) ADD_POINTERS(map, (const GLubyte *) indices); - } - - if (type == GL_UNSIGNED_INT) { - for (i = 0; i < count; i++) - if (((GLuint *) indices)[i] > max) - max = ((GLuint *) indices)[i]; - } - else if (type == GL_UNSIGNED_SHORT) { - for (i = 0; i < count; i++) - if (((GLushort *) indices)[i] > max) - max = ((GLushort *) indices)[i]; - } - else { - ASSERT(type == GL_UNSIGNED_BYTE); - for (i = 0; i < count; i++) - if (((GLubyte *) indices)[i] > max) - max = ((GLubyte *) indices)[i]; - } - - if (map) { - ctx->Driver.UnmapBuffer(ctx, elementBuf, MAP_INTERNAL); - } - - return max; -} - - -/** * Check if OK to draw arrays/elements. */ static GLboolean @@ -749,17 +703,17 @@ _mesa_validate_DrawTransformFeedback(struct gl_context *ctx, return GL_FALSE; } - if (!obj->EndedAnytime) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawTransformFeedback*"); - return GL_FALSE; - } - if (stream >= ctx->Const.MaxVertexStreams) { _mesa_error(ctx, GL_INVALID_VALUE, "glDrawTransformFeedbackStream*(index>=MaxVertexStream)"); return GL_FALSE; } + if (!obj->EndedAnytime) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawTransformFeedback*"); + return GL_FALSE; + } + if (numInstances <= 0) { if (numInstances < 0) _mesa_error(ctx, GL_INVALID_VALUE, diff --git a/mesalib/src/mesa/main/api_validate.h b/mesalib/src/mesa/main/api_validate.h index 8238df16c..0bb91c675 100644 --- a/mesalib/src/mesa/main/api_validate.h +++ b/mesalib/src/mesa/main/api_validate.h @@ -35,12 +35,6 @@ struct gl_context; struct gl_transform_feedback_object; -extern GLuint -_mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type, - const void *indices, - struct gl_buffer_object *elementBuf); - - extern bool _mesa_is_valid_prim_mode(struct gl_context *ctx, GLenum mode); diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c index 5345339f6..4684615a8 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -1345,7 +1345,8 @@ _mesa_PopAttrib(void) if (xform->DepthClamp != ctx->Transform.DepthClamp) _mesa_set_enable(ctx, GL_DEPTH_CLAMP, ctx->Transform.DepthClamp); - _mesa_ClipControl(xform->ClipOrigin, xform->ClipDepthMode); + if (ctx->Extensions.ARB_clip_control) + _mesa_ClipControl(xform->ClipOrigin, xform->ClipDepthMode); } break; case GL_TEXTURE_BIT: diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 25b9bfc4c..400c158a7 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -719,6 +719,9 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api) /** GL_ARB_gpu_shader5 */ consts->MinFragmentInterpolationOffset = MIN_FRAGMENT_INTERPOLATION_OFFSET; consts->MaxFragmentInterpolationOffset = MAX_FRAGMENT_INTERPOLATION_OFFSET; + + /** GL_KHR_context_flush_control */ + consts->ContextReleaseBehavior = GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH; } @@ -729,6 +732,8 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api) static void check_context_limits(struct gl_context *ctx) { + (void) ctx; + /* check that we don't exceed the size of various bitfields */ assert(VARYING_SLOT_MAX <= (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten))); @@ -1622,9 +1627,11 @@ _mesa_make_current( struct gl_context *newCtx, } if (curCtx && - (curCtx->WinSysDrawBuffer || curCtx->WinSysReadBuffer) && + (curCtx->WinSysDrawBuffer || curCtx->WinSysReadBuffer) && /* make sure this context is valid for flushing */ - curCtx != newCtx) + curCtx != newCtx && + curCtx->Const.ContextReleaseBehavior == + GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH) _mesa_flush(curCtx); /* We used to call _glapi_check_multithread() here. Now do it in drivers */ diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c index 25171f0ee..7d622bb16 100644 --- a/mesalib/src/mesa/main/errors.c +++ b/mesalib/src/mesa/main/errors.c @@ -676,22 +676,41 @@ debug_pop_group(struct gl_debug_state *debug) /** - * Return debug state for the context. The debug state will be allocated - * and initialized upon the first call. + * Lock and return debug state for the context. The debug state will be + * allocated and initialized upon the first call. When NULL is returned, the + * debug state is not locked. */ static struct gl_debug_state * -_mesa_get_debug_state(struct gl_context *ctx) +_mesa_lock_debug_state(struct gl_context *ctx) { + mtx_lock(&ctx->DebugMutex); + if (!ctx->Debug) { ctx->Debug = debug_create(); if (!ctx->Debug) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "allocating debug state"); + GET_CURRENT_CONTEXT(cur); + mtx_unlock(&ctx->DebugMutex); + + /* + * This function may be called from other threads. When that is the + * case, we cannot record this OOM error. + */ + if (ctx == cur) + _mesa_error(ctx, GL_OUT_OF_MEMORY, "allocating debug state"); + + return NULL; } } return ctx->Debug; } +static void +_mesa_unlock_debug_state(struct gl_context *ctx) +{ + mtx_unlock(&ctx->DebugMutex); +} + /** * Set the integer debug state specified by \p pname. This can be called from * _mesa_set_enable for example. @@ -699,7 +718,7 @@ _mesa_get_debug_state(struct gl_context *ctx) bool _mesa_set_debug_state_int(struct gl_context *ctx, GLenum pname, GLint val) { - struct gl_debug_state *debug = _mesa_get_debug_state(ctx); + struct gl_debug_state *debug = _mesa_lock_debug_state(ctx); if (!debug) return false; @@ -716,6 +735,8 @@ _mesa_set_debug_state_int(struct gl_context *ctx, GLenum pname, GLint val) break; } + _mesa_unlock_debug_state(ctx); + return true; } @@ -729,9 +750,12 @@ _mesa_get_debug_state_int(struct gl_context *ctx, GLenum pname) struct gl_debug_state *debug; GLint val; + mtx_lock(&ctx->DebugMutex); debug = ctx->Debug; - if (!debug) + if (!debug) { + mtx_unlock(&ctx->DebugMutex); return 0; + } switch (pname) { case GL_DEBUG_OUTPUT: @@ -756,6 +780,8 @@ _mesa_get_debug_state_int(struct gl_context *ctx, GLenum pname) break; } + mtx_unlock(&ctx->DebugMutex); + return val; } @@ -769,9 +795,12 @@ _mesa_get_debug_state_ptr(struct gl_context *ctx, GLenum pname) struct gl_debug_state *debug; void *val; + mtx_lock(&ctx->DebugMutex); debug = ctx->Debug; - if (!debug) + if (!debug) { + mtx_unlock(&ctx->DebugMutex); return NULL; + } switch (pname) { case GL_DEBUG_CALLBACK_FUNCTION_ARB: @@ -786,9 +815,49 @@ _mesa_get_debug_state_ptr(struct gl_context *ctx, GLenum pname) break; } + mtx_unlock(&ctx->DebugMutex); + return val; } +/** + * Insert a debug message. The mutex is assumed to be locked, and will be + * unlocked by this call. + */ +static void +log_msg_locked_and_unlock(struct gl_context *ctx, + enum mesa_debug_source source, + enum mesa_debug_type type, GLuint id, + enum mesa_debug_severity severity, + GLint len, const char *buf) +{ + struct gl_debug_state *debug = ctx->Debug; + + if (!debug_is_message_enabled(debug, source, type, id, severity)) { + _mesa_unlock_debug_state(ctx); + return; + } + + if (ctx->Debug->Callback) { + GLenum gl_source = debug_source_enums[source]; + GLenum gl_type = debug_type_enums[type]; + GLenum gl_severity = debug_severity_enums[severity]; + GLDEBUGPROC callback = ctx->Debug->Callback; + const void *data = ctx->Debug->CallbackData; + + /* + * When ctx->Debug->SyncOutput is GL_FALSE, the client is prepared for + * unsynchronous calls. When it is GL_TRUE, we will not spawn threads. + * In either case, we can call the callback unlocked. + */ + _mesa_unlock_debug_state(ctx); + callback(gl_source, gl_type, id, gl_severity, len, buf, data); + } + else { + debug_log_message(ctx->Debug, source, type, id, severity, len, buf); + _mesa_unlock_debug_state(ctx); + } +} /** * Log a client or driver debug message. @@ -798,24 +867,12 @@ log_msg(struct gl_context *ctx, enum mesa_debug_source source, enum mesa_debug_type type, GLuint id, enum mesa_debug_severity severity, GLint len, const char *buf) { - struct gl_debug_state *debug = _mesa_get_debug_state(ctx); + struct gl_debug_state *debug = _mesa_lock_debug_state(ctx); if (!debug) return; - if (!debug_is_message_enabled(debug, source, type, id, severity)) - return; - - if (debug->Callback) { - GLenum gl_type = debug_type_enums[type]; - GLenum gl_severity = debug_severity_enums[severity]; - - debug->Callback(debug_source_enums[source], gl_type, id, gl_severity, - len, buf, debug->CallbackData); - return; - } - - debug_log_message(debug, source, type, id, severity, len, buf); + log_msg_locked_and_unlock(ctx, source, type, id, severity, len, buf); } @@ -956,7 +1013,7 @@ _mesa_GetDebugMessageLog(GLuint count, GLsizei logSize, GLenum *sources, return 0; } - debug = _mesa_get_debug_state(ctx); + debug = _mesa_lock_debug_state(ctx); if (!debug) return 0; @@ -991,6 +1048,8 @@ _mesa_GetDebugMessageLog(GLuint count, GLsizei logSize, GLenum *sources, debug_delete_messages(debug, 1); } + _mesa_unlock_debug_state(ctx); + return ret; } @@ -1027,7 +1086,7 @@ _mesa_DebugMessageControl(GLenum gl_source, GLenum gl_type, return; } - debug = _mesa_get_debug_state(ctx); + debug = _mesa_lock_debug_state(ctx); if (!debug) return; @@ -1039,6 +1098,8 @@ _mesa_DebugMessageControl(GLenum gl_source, GLenum gl_type, else { debug_set_message_enable_all(debug, source, type, severity, enabled); } + + _mesa_unlock_debug_state(ctx); } @@ -1046,10 +1107,11 @@ void GLAPIENTRY _mesa_DebugMessageCallback(GLDEBUGPROC callback, const void *userParam) { GET_CURRENT_CONTEXT(ctx); - struct gl_debug_state *debug = _mesa_get_debug_state(ctx); + struct gl_debug_state *debug = _mesa_lock_debug_state(ctx); if (debug) { debug->Callback = callback; debug->CallbackData = userParam; + _mesa_unlock_debug_state(ctx); } } @@ -1059,18 +1121,10 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message) { GET_CURRENT_CONTEXT(ctx); - struct gl_debug_state *debug = _mesa_get_debug_state(ctx); const char *callerstr = "glPushDebugGroup"; + struct gl_debug_state *debug; struct gl_debug_message *emptySlot; - if (!debug) - return; - - if (debug->GroupStackDepth >= MAX_DEBUG_GROUP_STACK_DEPTH-1) { - _mesa_error(ctx, GL_STACK_OVERFLOW, "%s", callerstr); - return; - } - switch(source) { case GL_DEBUG_SOURCE_APPLICATION: case GL_DEBUG_SOURCE_THIRD_PARTY: @@ -1086,10 +1140,15 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length, if (!validate_length(ctx, callerstr, length)) return; /* GL_INVALID_VALUE */ - log_msg(ctx, gl_enum_to_debug_source(source), - MESA_DEBUG_TYPE_PUSH_GROUP, id, - MESA_DEBUG_SEVERITY_NOTIFICATION, length, - message); + debug = _mesa_lock_debug_state(ctx); + if (!debug) + return; + + if (debug->GroupStackDepth >= MAX_DEBUG_GROUP_STACK_DEPTH-1) { + _mesa_unlock_debug_state(ctx); + _mesa_error(ctx, GL_STACK_OVERFLOW, "%s", callerstr); + return; + } /* pop reuses the message details from push so we store this */ emptySlot = debug_get_group_message(debug); @@ -1101,6 +1160,12 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length, length, message); debug_push_group(debug); + + log_msg_locked_and_unlock(ctx, + gl_enum_to_debug_source(source), + MESA_DEBUG_TYPE_PUSH_GROUP, id, + MESA_DEBUG_SEVERITY_NOTIFICATION, length, + message); } @@ -1108,35 +1173,43 @@ void GLAPIENTRY _mesa_PopDebugGroup(void) { GET_CURRENT_CONTEXT(ctx); - struct gl_debug_state *debug = _mesa_get_debug_state(ctx); const char *callerstr = "glPopDebugGroup"; - struct gl_debug_message *gdmessage; + struct gl_debug_state *debug; + struct gl_debug_message *gdmessage, msg; + debug = _mesa_lock_debug_state(ctx); if (!debug) return; if (debug->GroupStackDepth <= 0) { + _mesa_unlock_debug_state(ctx); _mesa_error(ctx, GL_STACK_UNDERFLOW, "%s", callerstr); return; } debug_pop_group(debug); + /* make a shallow copy */ gdmessage = debug_get_group_message(debug); - log_msg(ctx, gdmessage->source, - gl_enum_to_debug_type(GL_DEBUG_TYPE_POP_GROUP), - gdmessage->id, - gl_enum_to_debug_severity(GL_DEBUG_SEVERITY_NOTIFICATION), - gdmessage->length, gdmessage->message); - - debug_message_clear(gdmessage); + msg = *gdmessage; + gdmessage->message = NULL; + gdmessage->length = 0; + + log_msg_locked_and_unlock(ctx, + msg.source, + gl_enum_to_debug_type(GL_DEBUG_TYPE_POP_GROUP), + msg.id, + gl_enum_to_debug_severity(GL_DEBUG_SEVERITY_NOTIFICATION), + msg.length, msg.message); + + debug_message_clear(&msg); } void _mesa_init_errors(struct gl_context *ctx) { - /* no-op */ + mtx_init(&ctx->DebugMutex, mtx_plain); } @@ -1148,6 +1221,8 @@ _mesa_free_errors_data(struct gl_context *ctx) /* set to NULL just in case it is used before context is completely gone. */ ctx->Debug = NULL; } + + mtx_destroy(&ctx->DebugMutex); } @@ -1362,6 +1437,8 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) debug_get_id(&error_msg_id); do_output = should_output(ctx, error, fmtString); + + mtx_lock(&ctx->DebugMutex); if (ctx->Debug) { do_log = debug_is_message_enabled(ctx->Debug, MESA_DEBUG_SOURCE_API, @@ -1372,6 +1449,7 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) else { do_log = GL_FALSE; } + mtx_unlock(&ctx->DebugMutex); if (do_output || do_log) { char s[MAX_DEBUG_MESSAGE_LENGTH], s2[MAX_DEBUG_MESSAGE_LENGTH]; diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 15d66a744..0df04c2e6 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -320,6 +320,7 @@ static const struct extension extension_table[] = { /* KHR extensions */ { "GL_KHR_debug", o(dummy_true), GL, 2012 }, + { "GL_KHR_context_flush_control", o(dummy_true), GL | ES2, 2014 }, /* Vendor extensions */ { "GL_3DFX_texture_compression_FXT1", o(TDFX_texture_compression_FXT1), GL, 1999 }, diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index aa9f282d8..09a61acc1 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -318,6 +318,9 @@ descriptor=[ [ "PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL", "CONST(MAX_PERFQUERY_COUNTER_NAME_LENGTH), extra_INTEL_performance_query" ], [ "PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL", "CONST(MAX_PERFQUERY_COUNTER_DESC_LENGTH), extra_INTEL_performance_query" ], [ "PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL", "CONST(PERFQUERY_HAVE_GPA_EXTENDED_COUNTERS), extra_INTEL_performance_query" ], + +# GL_KHR_context_flush_control + [ "CONTEXT_RELEASE_BEHAVIOR", "CONTEXT_ENUM(Const.ContextReleaseBehavior), NO_EXTRA" ], ]}, # GLES3 is not a typo. @@ -624,7 +627,7 @@ descriptor=[ # == GL_CURRENT_MATRIX_NV [ "CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX, 0, extra_ARB_vertex_program_ARB_fragment_program" ], # == GL_CURRENT_MATRIX_NV - [ "TRANSPOSE_CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX, 0, extra_ARB_vertex_program_ARB_fragment_program" ], + [ "TRANSPOSE_CURRENT_MATRIX_ARB", "LOC_CUSTOM, TYPE_MATRIX_T, 0, extra_ARB_vertex_program_ARB_fragment_program" ], # == GL_PROGRAM_ERROR_POSITION_NV [ "PROGRAM_ERROR_POSITION_ARB", "CONTEXT_INT(Program.ErrorPos), extra_ARB_vertex_program_ARB_fragment_program" ], diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c index b8c754815..4f5a2d11f 100644 --- a/mesalib/src/mesa/main/imports.c +++ b/mesalib/src/mesa/main/imports.c @@ -499,25 +499,6 @@ _mesa_strdup( const char *s ) } } -/** Wrapper around strtof() */ -float -_mesa_strtof( const char *s, char **end ) -{ -#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \ - !defined(ANDROID) && !defined(__HAIKU__) && !defined(__UCLIBC__) && \ - !defined(__NetBSD__) - static locale_t loc = NULL; - if (!loc) { - loc = newlocale(LC_CTYPE_MASK, "C", NULL); - } - return strtof_l(s, end, loc); -#elif defined(_ISOC99_SOURCE) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) - return strtof(s, end); -#else - return (float)strtod(s, end); -#endif -} - /** Compute simple checksum/hash for a string */ unsigned int _mesa_str_checksum(const char *str) diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index 436d1651a..0fcba4fb9 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -540,9 +540,6 @@ _mesa_half_is_negative(GLhalfARB h) extern char * _mesa_strdup( const char *s ); -extern float -_mesa_strtof( const char *s, char **end ); - extern unsigned int _mesa_str_checksum(const char *str); diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index e1f1f1dde..7389baa1d 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2843,6 +2843,7 @@ struct gl_shader_program /* post-link info: */ unsigned NumUserUniformStorage; + unsigned NumHiddenUniforms; struct gl_uniform_storage *UniformStorage; /** @@ -3680,6 +3681,9 @@ struct gl_constants GLboolean FakeSWMSAA; + /** GL_KHR_context_flush_control */ + GLenum ContextReleaseBehavior; + struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_STAGES]; }; @@ -4390,6 +4394,7 @@ struct gl_context GLuint ErrorDebugCount; /* GL_ARB_debug_output/GL_KHR_debug */ + mtx_t DebugMutex; struct gl_debug_state *Debug; GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 2be9092c1..66578204f 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -565,13 +565,15 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param *params = _mesa_longest_attribute_name_length(shProg); return; case GL_ACTIVE_UNIFORMS: - *params = shProg->NumUserUniformStorage; + *params = shProg->NumUserUniformStorage - shProg->NumHiddenUniforms; return; case GL_ACTIVE_UNIFORM_MAX_LENGTH: { unsigned i; GLint max_len = 0; + const unsigned num_uniforms = + shProg->NumUserUniformStorage - shProg->NumHiddenUniforms; - for (i = 0; i < shProg->NumUserUniformStorage; i++) { + for (i = 0; i < num_uniforms; i++) { /* Add one for the terminating NUL character for a non-array, and * 4 for the "[0]" and the NUL for an array. */ diff --git a/mesalib/src/mesa/main/sse_minmax.c b/mesalib/src/mesa/main/sse_minmax.c new file mode 100644 index 000000000..222ac1454 --- /dev/null +++ b/mesalib/src/mesa/main/sse_minmax.c @@ -0,0 +1,97 @@ +/* + * Copyright © 2014 Timothy Arceri + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Author: + * Timothy Arceri <t_arceri@yahoo.com.au> + * + */ + +#ifdef __SSE4_1__ +#include "main/sse_minmax.h" +#include <smmintrin.h> +#include <stdint.h> + +void +_mesa_uint_array_min_max(const unsigned *ui_indices, unsigned *min_index, + unsigned *max_index, const unsigned count) +{ + unsigned max_ui = 0; + unsigned min_ui = ~0U; + unsigned i = 0; + unsigned aligned_count = count; + + /* handle the first few values without SSE until the pointer is aligned */ + while (((uintptr_t)ui_indices & 15) && aligned_count) { + if (*ui_indices > max_ui) + max_ui = *ui_indices; + if (*ui_indices < min_ui) + min_ui = *ui_indices; + + aligned_count--; + ui_indices++; + } + + /* TODO: The actual threshold for SSE begin useful may be higher than 8. + * Some careful microbenchmarks and measurement are required to + * find the actual tipping point. + */ + if (aligned_count >= 8) { + unsigned max_arr[4] __attribute__ ((aligned (16))); + unsigned min_arr[4] __attribute__ ((aligned (16))); + unsigned vec_count; + __m128i max_ui4 = _mm_setzero_si128(); + __m128i min_ui4 = _mm_set1_epi32(~0U); + __m128i ui_indices4; + __m128i *ui_indices_ptr; + + vec_count = aligned_count & ~0x3; + ui_indices_ptr = (__m128i *)ui_indices; + for (i = 0; i < vec_count / 4; i++) { + ui_indices4 = _mm_load_si128(&ui_indices_ptr[i]); + max_ui4 = _mm_max_epu32(ui_indices4, max_ui4); + min_ui4 = _mm_min_epu32(ui_indices4, min_ui4); + } + + _mm_store_si128((__m128i *)max_arr, max_ui4); + _mm_store_si128((__m128i *)min_arr, min_ui4); + + for (i = 0; i < 4; i++) { + if (max_arr[i] > max_ui) + max_ui = max_arr[i]; + if (min_arr[i] < min_ui) + min_ui = min_arr[i]; + } + i = vec_count; + } + + for (; i < aligned_count; i++) { + if (ui_indices[i] > max_ui) + max_ui = ui_indices[i]; + if (ui_indices[i] < min_ui) + min_ui = ui_indices[i]; + } + + *min_index = min_ui; + *max_index = max_ui; +} + +#endif diff --git a/mesalib/src/mesa/main/sse_minmax.h b/mesalib/src/mesa/main/sse_minmax.h new file mode 100644 index 000000000..953c4e9eb --- /dev/null +++ b/mesalib/src/mesa/main/sse_minmax.h @@ -0,0 +1,30 @@ +/* + * Copyright © 2014 Timothy Arceri + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Author: + * Timothy Arceri <t_arceri@yahoo.com.au> + * + */ + +void +_mesa_uint_array_min_max(const unsigned *ui_indices, unsigned *min_index, + unsigned *max_index, const unsigned count); diff --git a/mesalib/src/mesa/main/streaming-load-memcpy.c b/mesalib/src/mesa/main/streaming-load-memcpy.c index 8427149c5..d7147afdc 100644 --- a/mesalib/src/mesa/main/streaming-load-memcpy.c +++ b/mesalib/src/mesa/main/streaming-load-memcpy.c @@ -26,7 +26,6 @@ * */ -#ifdef __SSE4_1__ #include "main/macros.h" #include "main/streaming-load-memcpy.h" #include <smmintrin.h> @@ -84,5 +83,3 @@ _mesa_streaming_load_memcpy(void *restrict dst, void *restrict src, size_t len) memcpy(d, s, len); } } - -#endif diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c index 832e66128..ec16af9d2 100644 --- a/mesalib/src/mesa/main/texformat.c +++ b/mesalib/src/mesa/main/texformat.c @@ -155,12 +155,14 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_ALPHA4: case GL_ALPHA8: RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM); break; case GL_ALPHA12: case GL_ALPHA16: RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM16); RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM); break; /* Luminance formats */ @@ -224,6 +226,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_COMPRESSED_ALPHA_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM); break; case GL_COMPRESSED_LUMINANCE_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_L_UNORM8); diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index f913e42d3..f858cef50 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -1667,8 +1667,10 @@ texstore_rgba_integer(TEXSTORE_PARAMS) assert(is_array && !normalized); - if (!is_array) + if (!is_array) { + free(tmp_row); return GL_FALSE; + } invert_swizzle(dst2rgba, rgba2dst); compute_component_mapping(GL_RGBA, baseInternalFormat, base2rgba); diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp index fcb14c4e2..32870d0c4 100644 --- a/mesalib/src/mesa/main/uniform_query.cpp +++ b/mesalib/src/mesa/main/uniform_query.cpp @@ -176,46 +176,13 @@ validate_uniform_parameters(struct gl_context *ctx, struct gl_shader_program *shProg, GLint location, GLsizei count, unsigned *array_index, - const char *caller, - bool negative_one_is_not_valid) + const char *caller) { - if (!shProg || !shProg->LinkStatus) { + if (shProg == NULL) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(program not linked)", caller); return NULL; } - if (location == -1) { - /* For glGetUniform, page 264 (page 278 of the PDF) of the OpenGL 2.1 - * spec says: - * - * "The error INVALID_OPERATION is generated if program has not been - * linked successfully, or if location is not a valid location for - * program." - * - * For glUniform, page 82 (page 96 of the PDF) of the OpenGL 2.1 spec - * says: - * - * "If the value of location is -1, the Uniform* commands will - * silently ignore the data passed in, and the current uniform - * values will not be changed." - * - * Allowing -1 for the location parameter of glUniform allows - * applications to avoid error paths in the case that, for example, some - * uniform variable is removed by the compiler / linker after - * optimization. In this case, the new value of the uniform is dropped - * on the floor. For the case of glGetUniform, there is nothing - * sensible to do for a location of -1. - * - * The negative_one_is_not_valid flag selects between the two behaviors. - */ - if (negative_one_is_not_valid) { - _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)", - caller, location); - } - - return NULL; - } - /* From page 12 (page 26 of the PDF) of the OpenGL 2.1 spec: * * "If a negative number is provided where an argument of type sizei or @@ -226,10 +193,26 @@ validate_uniform_parameters(struct gl_context *ctx, return NULL; } - /* Check that the given location is in bounds of uniform remap table. */ - if (location >= (GLint) shProg->NumUniformRemapTable) { - _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)", - caller, location); + /* Check that the given location is in bounds of uniform remap table. + * Unlinked programs will have NumUniformRemapTable == 0, so we can take + * the shProg->LinkStatus check out of the main path. + */ + if (unlikely(location >= (GLint) shProg->NumUniformRemapTable)) { + if (!shProg->LinkStatus) + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(program not linked)", + caller); + else + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)", + caller, location); + + return NULL; + } + + if (location == -1) { + if (!shProg->LinkStatus) + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(program not linked)", + caller); + return NULL; } @@ -269,27 +252,30 @@ validate_uniform_parameters(struct gl_context *ctx, struct gl_uniform_storage *const uni = shProg->UniformRemapTable[location]; - if (uni->array_elements == 0 && count > 1) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "%s(count > 1 for non-array, location=%d)", - caller, location); - return NULL; - } + if (uni->array_elements == 0) { + if (count > 1) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(count > 1 for non-array, location=%d)", + caller, location); + return NULL; + } - /* The array index specified by the uniform location is just the uniform - * location minus the base location of of the uniform. - */ - *array_index = location - uni->remap_location; + assert((location - uni->remap_location) == 0); + *array_index = 0; + } else { + /* The array index specified by the uniform location is just the uniform + * location minus the base location of of the uniform. + */ + *array_index = location - uni->remap_location; - /* If the uniform is an array, check that array_index is in bounds. - * If not an array, check that array_index is zero. - * array_index is unsigned so no need to check for less than zero. - */ - const unsigned limit = MAX2(uni->array_elements, 1); - if (*array_index >= limit) { - _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)", - caller, location); - return NULL; + /* If the uniform is an array, check that array_index is in bounds. + * array_index is unsigned so no need to check for less than zero. + */ + if (*array_index >= uni->array_elements) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)", + caller, location); + return NULL; + } } return uni; } @@ -308,9 +294,39 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location, struct gl_uniform_storage *const uni = validate_uniform_parameters(ctx, shProg, location, 1, - &offset, "glGetUniform", true); - if (uni == NULL) + &offset, "glGetUniform"); + if (uni == NULL) { + /* For glGetUniform, page 264 (page 278 of the PDF) of the OpenGL 2.1 + * spec says: + * + * "The error INVALID_OPERATION is generated if program has not been + * linked successfully, or if location is not a valid location for + * program." + * + * For glUniform, page 82 (page 96 of the PDF) of the OpenGL 2.1 spec + * says: + * + * "If the value of location is -1, the Uniform* commands will + * silently ignore the data passed in, and the current uniform + * values will not be changed." + * + * Allowing -1 for the location parameter of glUniform allows + * applications to avoid error paths in the case that, for example, some + * uniform variable is removed by the compiler / linker after + * optimization. In this case, the new value of the uniform is dropped + * on the floor. For the case of glGetUniform, there is nothing + * sensible to do for a location of -1. + * + * If the location was -1, validate_unfirom_parameters will return NULL + * without raising an error. Raise the error here. + */ + if (location == -1) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniform(location=%d)", + location); + } + return; + } { unsigned elements = (uni->type->is_sampler()) @@ -342,8 +358,7 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location, */ if (returnType == uni->type->base_type || ((returnType == GLSL_TYPE_INT - || returnType == GLSL_TYPE_UINT - || returnType == GLSL_TYPE_SAMPLER) + || returnType == GLSL_TYPE_UINT) && (uni->type->base_type == GLSL_TYPE_INT || uni->type->base_type == GLSL_TYPE_UINT @@ -583,93 +598,22 @@ _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni, extern "C" void _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, GLint location, GLsizei count, - const GLvoid *values, GLenum type) + const GLvoid *values, + enum glsl_base_type basicType, + unsigned src_components) { unsigned offset; - unsigned components; - unsigned src_components; - enum glsl_base_type basicType; struct gl_uniform_storage *const uni = validate_uniform_parameters(ctx, shProg, location, count, - &offset, "glUniform", false); + &offset, "glUniform"); if (uni == NULL) return; /* Verify that the types are compatible. */ - switch (type) { - case GL_FLOAT: - basicType = GLSL_TYPE_FLOAT; - src_components = 1; - break; - case GL_FLOAT_VEC2: - basicType = GLSL_TYPE_FLOAT; - src_components = 2; - break; - case GL_FLOAT_VEC3: - basicType = GLSL_TYPE_FLOAT; - src_components = 3; - break; - case GL_FLOAT_VEC4: - basicType = GLSL_TYPE_FLOAT; - src_components = 4; - break; - case GL_UNSIGNED_INT: - basicType = GLSL_TYPE_UINT; - src_components = 1; - break; - case GL_UNSIGNED_INT_VEC2: - basicType = GLSL_TYPE_UINT; - src_components = 2; - break; - case GL_UNSIGNED_INT_VEC3: - basicType = GLSL_TYPE_UINT; - src_components = 3; - break; - case GL_UNSIGNED_INT_VEC4: - basicType = GLSL_TYPE_UINT; - src_components = 4; - break; - case GL_INT: - basicType = GLSL_TYPE_INT; - src_components = 1; - break; - case GL_INT_VEC2: - basicType = GLSL_TYPE_INT; - src_components = 2; - break; - case GL_INT_VEC3: - basicType = GLSL_TYPE_INT; - src_components = 3; - break; - case GL_INT_VEC4: - basicType = GLSL_TYPE_INT; - src_components = 4; - break; - case GL_BOOL: - case GL_BOOL_VEC2: - case GL_BOOL_VEC3: - case GL_BOOL_VEC4: - case GL_FLOAT_MAT2: - case GL_FLOAT_MAT2x3: - case GL_FLOAT_MAT2x4: - case GL_FLOAT_MAT3x2: - case GL_FLOAT_MAT3: - case GL_FLOAT_MAT3x4: - case GL_FLOAT_MAT4x2: - case GL_FLOAT_MAT4x3: - case GL_FLOAT_MAT4: - default: - _mesa_problem(NULL, "Invalid type in %s", __func__); - return; - } - - if (uni->type->is_sampler()) { - components = 1; - } else { - components = uni->type->vector_elements; - } + const unsigned components = uni->type->is_sampler() + ? 1 : uni->type->vector_elements; bool match; switch (uni->type->base_type) { @@ -690,7 +634,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, return; } - if (ctx->_Shader->Flags & GLSL_UNIFORMS) { + if (unlikely(ctx->_Shader->Flags & GLSL_UNIFORMS)) { log_uniform(values, basicType, components, 1, count, false, shProg, location, uni); } @@ -713,9 +657,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, * GL_INVALID_VALUE error and ignore the command. */ if (uni->type->is_sampler()) { - int i; - - for (i = 0; i < count; i++) { + for (int i = 0; i < count; i++) { const unsigned texUnit = ((unsigned *) values)[i]; /* check that the sampler (tex unit index) is legal */ @@ -730,9 +672,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, } if (uni->type->is_image()) { - int i; - - for (i = 0; i < count; i++) { + for (int i = 0; i < count; i++) { const int unit = ((GLint *) values)[i]; /* check that the image unit is legal */ @@ -772,9 +712,8 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, (const union gl_constant_value *) values; union gl_constant_value *dst = &uni->storage[components * offset]; const unsigned elems = components * count; - unsigned i; - for (i = 0; i < elems; i++) { + for (unsigned i = 0; i < elems; i++) { if (basicType == GLSL_TYPE_FLOAT) { dst[i].i = src[i].f != 0.0f ? ctx->Const.UniformBooleanTrue : 0; } else { @@ -791,19 +730,16 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, * the changes through. */ if (uni->type->is_sampler()) { - int i; - bool flushed = false; - for (i = 0; i < MESA_SHADER_STAGES; i++) { + for (int i = 0; i < MESA_SHADER_STAGES; i++) { struct gl_shader *const sh = shProg->_LinkedShaders[i]; - int j; /* If the shader stage doesn't use the sampler uniform, skip this. */ if (sh == NULL || !uni->sampler[i].active) continue; - for (j = 0; j < count; j++) { + for (int j = 0; j < count; j++) { sh->SamplerUnits[uni->sampler[i].index + offset + j] = ((unsigned *) values)[j]; } @@ -845,13 +781,11 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, * uniforms to image units present in the shader data structure. */ if (uni->type->is_image()) { - int i, j; - - for (i = 0; i < MESA_SHADER_STAGES; i++) { + for (int i = 0; i < MESA_SHADER_STAGES; i++) { if (uni->image[i].active) { struct gl_shader *sh = shProg->_LinkedShaders[i]; - for (j = 0; j < count; j++) + for (int j = 0; j < count; j++) sh->ImageUnits[uni->image[i].index + offset + j] = ((GLint *) values)[j]; } @@ -878,7 +812,7 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg, struct gl_uniform_storage *const uni = validate_uniform_parameters(ctx, shProg, location, count, - &offset, "glUniformMatrix", false); + &offset, "glUniformMatrix"); if (uni == NULL) return; @@ -902,17 +836,17 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg, } /* GL_INVALID_VALUE is generated if `transpose' is not GL_FALSE. - * http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml */ - if (ctx->API == API_OPENGLES - || (ctx->API == API_OPENGLES2 && ctx->Version < 30)) { - if (transpose) { + * http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml + */ + if (transpose) { + if (ctx->API == API_OPENGLES2 && ctx->Version < 30) { _mesa_error(ctx, GL_INVALID_VALUE, "glUniformMatrix(matrix transpose is not GL_FALSE)"); return; } } - if (ctx->_Shader->Flags & GLSL_UNIFORMS) { + if (unlikely(ctx->_Shader->Flags & GLSL_UNIFORMS)) { log_uniform(values, GLSL_TYPE_FLOAT, components, vectors, count, bool(transpose), shProg, location, uni); } diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c index c30710772..d2d70e7f7 100644 --- a/mesalib/src/mesa/main/uniforms.c +++ b/mesalib/src/mesa/main/uniforms.c @@ -151,7 +151,7 @@ void GLAPIENTRY _mesa_Uniform1f(GLint location, GLfloat v0) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GL_FLOAT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_FLOAT, 1); } void GLAPIENTRY @@ -161,7 +161,7 @@ _mesa_Uniform2f(GLint location, GLfloat v0, GLfloat v1) GLfloat v[2]; v[0] = v0; v[1] = v1; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_FLOAT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_FLOAT, 2); } void GLAPIENTRY @@ -172,7 +172,7 @@ _mesa_Uniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) v[0] = v0; v[1] = v1; v[2] = v2; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_FLOAT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_FLOAT, 3); } void GLAPIENTRY @@ -185,14 +185,14 @@ _mesa_Uniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, v[1] = v1; v[2] = v2; v[3] = v3; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_FLOAT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_FLOAT, 4); } void GLAPIENTRY _mesa_Uniform1i(GLint location, GLint v0) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GL_INT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_INT, 1); } void GLAPIENTRY @@ -202,7 +202,7 @@ _mesa_Uniform2i(GLint location, GLint v0, GLint v1) GLint v[2]; v[0] = v0; v[1] = v1; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_INT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT, 2); } void GLAPIENTRY @@ -213,7 +213,7 @@ _mesa_Uniform3i(GLint location, GLint v0, GLint v1, GLint v2) v[0] = v0; v[1] = v1; v[2] = v2; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_INT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT, 3); } void GLAPIENTRY @@ -225,63 +225,63 @@ _mesa_Uniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) v[1] = v1; v[2] = v2; v[3] = v3; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_INT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_INT, 4); } void GLAPIENTRY _mesa_Uniform1fv(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_FLOAT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_FLOAT, 1); } void GLAPIENTRY _mesa_Uniform2fv(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_FLOAT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_FLOAT, 2); } void GLAPIENTRY _mesa_Uniform3fv(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_FLOAT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_FLOAT, 3); } void GLAPIENTRY _mesa_Uniform4fv(GLint location, GLsizei count, const GLfloat * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_FLOAT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_FLOAT, 4); } void GLAPIENTRY _mesa_Uniform1iv(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_INT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT, 1); } void GLAPIENTRY _mesa_Uniform2iv(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_INT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT, 2); } void GLAPIENTRY _mesa_Uniform3iv(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_INT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT, 3); } void GLAPIENTRY _mesa_Uniform4iv(GLint location, GLsizei count, const GLint * value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_INT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_INT, 4); } /** Same as above with direct state access **/ @@ -292,7 +292,7 @@ _mesa_ProgramUniform1f(GLuint program, GLint location, GLfloat v0) struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform1f"); - _mesa_uniform(ctx, shProg, location, 1, &v0, GL_FLOAT); + _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_FLOAT, 1); } void GLAPIENTRY @@ -304,7 +304,7 @@ _mesa_ProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1) v[0] = v0; v[1] = v1; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2f"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_FLOAT_VEC2); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_FLOAT, 2); } void GLAPIENTRY @@ -318,7 +318,7 @@ _mesa_ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, v[1] = v1; v[2] = v2; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3f"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_FLOAT_VEC3); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_FLOAT, 3); } void GLAPIENTRY @@ -333,7 +333,7 @@ _mesa_ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, v[2] = v2; v[3] = v3; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4f"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_FLOAT_VEC4); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_FLOAT, 4); } void GLAPIENTRY @@ -343,7 +343,7 @@ _mesa_ProgramUniform1i(GLuint program, GLint location, GLint v0) struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform1i"); - _mesa_uniform(ctx, shProg, location, 1, &v0, GL_INT); + _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_INT, 1); } void GLAPIENTRY @@ -355,7 +355,7 @@ _mesa_ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1) v[0] = v0; v[1] = v1; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2i"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_INT_VEC2); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_INT, 2); } void GLAPIENTRY @@ -369,7 +369,7 @@ _mesa_ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, v[1] = v1; v[2] = v2; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3i"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_INT_VEC3); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_INT, 3); } void GLAPIENTRY @@ -384,7 +384,7 @@ _mesa_ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, v[2] = v2; v[3] = v3; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4i"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_INT_VEC4); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_INT, 4); } void GLAPIENTRY @@ -395,7 +395,7 @@ _mesa_ProgramUniform1fv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform1fv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_FLOAT); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 1); } void GLAPIENTRY @@ -406,7 +406,7 @@ _mesa_ProgramUniform2fv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2fv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_FLOAT_VEC2); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 2); } void GLAPIENTRY @@ -417,7 +417,7 @@ _mesa_ProgramUniform3fv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3fv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_FLOAT_VEC3); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 3); } void GLAPIENTRY @@ -428,7 +428,7 @@ _mesa_ProgramUniform4fv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4fv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_FLOAT_VEC4); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_FLOAT, 4); } void GLAPIENTRY @@ -439,7 +439,7 @@ _mesa_ProgramUniform1iv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform1iv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_INT); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 1); } void GLAPIENTRY @@ -450,7 +450,7 @@ _mesa_ProgramUniform2iv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2iv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_INT_VEC2); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 2); } void GLAPIENTRY @@ -461,7 +461,7 @@ _mesa_ProgramUniform3iv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3iv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_INT_VEC3); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 3); } void GLAPIENTRY @@ -472,7 +472,7 @@ _mesa_ProgramUniform4iv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4iv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_INT_VEC4); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_INT, 4); } @@ -481,7 +481,7 @@ void GLAPIENTRY _mesa_Uniform1ui(GLint location, GLuint v0) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GL_UNSIGNED_INT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, &v0, GLSL_TYPE_UINT, 1); } void GLAPIENTRY @@ -491,7 +491,7 @@ _mesa_Uniform2ui(GLint location, GLuint v0, GLuint v1) GLuint v[2]; v[0] = v0; v[1] = v1; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_UNSIGNED_INT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT, 2); } void GLAPIENTRY @@ -502,7 +502,7 @@ _mesa_Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) v[0] = v0; v[1] = v1; v[2] = v2; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_UNSIGNED_INT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT, 3); } void GLAPIENTRY @@ -514,35 +514,35 @@ _mesa_Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) v[1] = v1; v[2] = v2; v[3] = v3; - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GL_UNSIGNED_INT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, 1, v, GLSL_TYPE_UINT, 4); } void GLAPIENTRY _mesa_Uniform1uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_UNSIGNED_INT); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT, 1); } void GLAPIENTRY _mesa_Uniform2uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_UNSIGNED_INT_VEC2); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT, 2); } void GLAPIENTRY _mesa_Uniform3uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_UNSIGNED_INT_VEC3); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT, 3); } void GLAPIENTRY _mesa_Uniform4uiv(GLint location, GLsizei count, const GLuint *value) { GET_CURRENT_CONTEXT(ctx); - _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GL_UNSIGNED_INT_VEC4); + _mesa_uniform(ctx, ctx->_Shader->ActiveProgram, location, count, value, GLSL_TYPE_UINT, 4); } @@ -583,7 +583,7 @@ _mesa_ProgramUniform1ui(GLuint program, GLint location, GLuint v0) struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform1ui"); - _mesa_uniform(ctx, shProg, location, 1, &v0, GL_UNSIGNED_INT); + _mesa_uniform(ctx, shProg, location, 1, &v0, GLSL_TYPE_UINT, 1); } void GLAPIENTRY @@ -596,7 +596,7 @@ _mesa_ProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1) v[1] = v1; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2ui"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_UNSIGNED_INT_VEC2); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_UINT, 2); } void GLAPIENTRY @@ -611,7 +611,7 @@ _mesa_ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, v[2] = v2; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3ui"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_UNSIGNED_INT_VEC3); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_UINT, 3); } void GLAPIENTRY @@ -626,7 +626,7 @@ _mesa_ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, v[2] = v2; v[3] = v3; shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4ui"); - _mesa_uniform(ctx, shProg, location, 1, v, GL_UNSIGNED_INT_VEC4); + _mesa_uniform(ctx, shProg, location, 1, v, GLSL_TYPE_UINT, 4); } void GLAPIENTRY @@ -637,7 +637,7 @@ _mesa_ProgramUniform1uiv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform1uiv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_UNSIGNED_INT); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT, 1); } void GLAPIENTRY @@ -648,7 +648,7 @@ _mesa_ProgramUniform2uiv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform2uiv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_UNSIGNED_INT_VEC2); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT, 2); } void GLAPIENTRY @@ -659,7 +659,7 @@ _mesa_ProgramUniform3uiv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform3uiv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_UNSIGNED_INT_VEC3); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT, 3); } void GLAPIENTRY @@ -670,7 +670,7 @@ _mesa_ProgramUniform4uiv(GLuint program, GLint location, GLsizei count, struct gl_shader_program *shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramUniform4uiv"); - _mesa_uniform(ctx, shProg, location, count, value, GL_UNSIGNED_INT_VEC4); + _mesa_uniform(ctx, shProg, location, count, value, GLSL_TYPE_UINT, 4); } @@ -1208,7 +1208,7 @@ _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex, struct gl_shader_program *shProg; if (!ctx->Extensions.ARB_uniform_buffer_object) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniformBlockiv"); + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetActiveUniformName"); return; } diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h index 6575a52f4..0a9ee7de9 100644 --- a/mesalib/src/mesa/main/uniforms.h +++ b/mesalib/src/mesa/main/uniforms.h @@ -265,7 +265,9 @@ _mesa_get_uniform_location(struct gl_shader_program *shProg, void _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shader_program, GLint location, GLsizei count, - const GLvoid *values, GLenum type); + const GLvoid *values, + enum glsl_base_type basicType, + unsigned src_components); void _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg, diff --git a/mesalib/src/mesa/main/viewport.c b/mesalib/src/mesa/main/viewport.c index d6a9e290a..0adce9c78 100644 --- a/mesalib/src/mesa/main/viewport.c +++ b/mesalib/src/mesa/main/viewport.c @@ -459,15 +459,14 @@ _mesa_ClipControl(GLenum origin, GLenum depth) ctx->Transform.ClipDepthMode == depth) return; - FLUSH_VERTICES(ctx, 0); + /* Affects transform state and the viewport transform */ + FLUSH_VERTICES(ctx, _NEW_TRANSFORM | _NEW_VIEWPORT); if (ctx->Transform.ClipOrigin != origin) { ctx->Transform.ClipOrigin = origin; /* Affects the winding order of the front face. */ ctx->NewState |= _NEW_POLYGON; - /* Affects the y component of the viewport transform. */ - ctx->NewState |= _NEW_VIEWPORT; if (ctx->Driver.FrontFace) ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace); @@ -476,9 +475,6 @@ _mesa_ClipControl(GLenum origin, GLenum depth) if (ctx->Transform.ClipDepthMode != depth) { ctx->Transform.ClipDepthMode = depth; - /* Affects the z part of the viewpoint transform. */ - ctx->NewState |= _NEW_VIEWPORT; - if (ctx->Driver.DepthRange) ctx->Driver.DepthRange(ctx); } diff --git a/mesalib/src/mesa/program/prog_execute.c b/mesalib/src/mesa/program/prog_execute.c index fcc9ed518..650c40f2a 100644 --- a/mesalib/src/mesa/program/prog_execute.c +++ b/mesalib/src/mesa/program/prog_execute.c @@ -1119,77 +1119,6 @@ _mesa_execute_program(struct gl_context * ctx, break; case OPCODE_NOP: break; - case OPCODE_PK2H: /* pack two 16-bit floats in one 32-bit float */ - { - GLfloat a[4]; - GLuint result[4]; - GLhalfNV hx, hy; - fetch_vector4(&inst->SrcReg[0], machine, a); - hx = _mesa_float_to_half(a[0]); - hy = _mesa_float_to_half(a[1]); - result[0] = - result[1] = - result[2] = - result[3] = hx | (hy << 16); - store_vector4ui(inst, machine, result); - } - break; - case OPCODE_PK2US: /* pack two GLushorts into one 32-bit float */ - { - GLfloat a[4]; - GLuint result[4], usx, usy; - fetch_vector4(&inst->SrcReg[0], machine, a); - a[0] = CLAMP(a[0], 0.0F, 1.0F); - a[1] = CLAMP(a[1], 0.0F, 1.0F); - usx = F_TO_I(a[0] * 65535.0F); - usy = F_TO_I(a[1] * 65535.0F); - result[0] = - result[1] = - result[2] = - result[3] = usx | (usy << 16); - store_vector4ui(inst, machine, result); - } - break; - case OPCODE_PK4B: /* pack four GLbytes into one 32-bit float */ - { - GLfloat a[4]; - GLuint result[4], ubx, uby, ubz, ubw; - fetch_vector4(&inst->SrcReg[0], machine, a); - a[0] = CLAMP(a[0], -128.0F / 127.0F, 1.0F); - a[1] = CLAMP(a[1], -128.0F / 127.0F, 1.0F); - a[2] = CLAMP(a[2], -128.0F / 127.0F, 1.0F); - a[3] = CLAMP(a[3], -128.0F / 127.0F, 1.0F); - ubx = F_TO_I(127.0F * a[0] + 128.0F); - uby = F_TO_I(127.0F * a[1] + 128.0F); - ubz = F_TO_I(127.0F * a[2] + 128.0F); - ubw = F_TO_I(127.0F * a[3] + 128.0F); - result[0] = - result[1] = - result[2] = - result[3] = ubx | (uby << 8) | (ubz << 16) | (ubw << 24); - store_vector4ui(inst, machine, result); - } - break; - case OPCODE_PK4UB: /* pack four GLubytes into one 32-bit float */ - { - GLfloat a[4]; - GLuint result[4], ubx, uby, ubz, ubw; - fetch_vector4(&inst->SrcReg[0], machine, a); - a[0] = CLAMP(a[0], 0.0F, 1.0F); - a[1] = CLAMP(a[1], 0.0F, 1.0F); - a[2] = CLAMP(a[2], 0.0F, 1.0F); - a[3] = CLAMP(a[3], 0.0F, 1.0F); - ubx = F_TO_I(255.0F * a[0]); - uby = F_TO_I(255.0F * a[1]); - ubz = F_TO_I(255.0F * a[2]); - ubw = F_TO_I(255.0F * a[3]); - result[0] = - result[1] = - result[2] = - result[3] = ubx | (uby << 8) | (ubz << 16) | (ubw << 24); - store_vector4ui(inst, machine, result); - } - break; case OPCODE_POW: { GLfloat a[4], b[4], result[4]; @@ -1224,20 +1153,6 @@ _mesa_execute_program(struct gl_context * ctx, pc = machine->CallStack[--machine->StackDepth] - 1; } break; - case OPCODE_RFL: /* reflection vector */ - { - GLfloat axis[4], dir[4], result[4], tmpX, tmpW; - fetch_vector4(&inst->SrcReg[0], machine, axis); - fetch_vector4(&inst->SrcReg[1], machine, dir); - tmpW = DOT3(axis, axis); - tmpX = (2.0F * DOT3(axis, dir)) / tmpW; - result[0] = tmpX * axis[0] - dir[0]; - result[1] = tmpX * axis[1] - dir[1]; - result[2] = tmpX * axis[2] - dir[2]; - /* result[3] is never written! XXX enforce in parser! */ - store_vector4(inst, machine, result); - } - break; case OPCODE_RSQ: /* 1 / sqrt() */ { GLfloat a[4], result[4]; @@ -1279,12 +1194,6 @@ _mesa_execute_program(struct gl_context * ctx, } } break; - case OPCODE_SFL: /* set false, operands ignored */ - { - static const GLfloat result[4] = { 0.0F, 0.0F, 0.0F, 0.0F }; - store_vector4(inst, machine, result); - } - break; case OPCODE_SGE: /* set on greater or equal */ { GLfloat a[4], b[4], result[4]; @@ -1395,12 +1304,6 @@ _mesa_execute_program(struct gl_context * ctx, store_vector4(inst, machine, result); } break; - case OPCODE_STR: /* set true, operands ignored */ - { - static const GLfloat result[4] = { 1.0F, 1.0F, 1.0F, 1.0F }; - store_vector4(inst, machine, result); - } - break; case OPCODE_SUB: { GLfloat a[4], b[4], result[4]; @@ -1574,52 +1477,6 @@ _mesa_execute_program(struct gl_context * ctx, store_vector4(inst, machine, result); } break; - case OPCODE_UP2H: /* unpack two 16-bit floats */ - { - const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine); - GLfloat result[4]; - GLushort hx, hy; - hx = raw & 0xffff; - hy = raw >> 16; - result[0] = result[2] = _mesa_half_to_float(hx); - result[1] = result[3] = _mesa_half_to_float(hy); - store_vector4(inst, machine, result); - } - break; - case OPCODE_UP2US: /* unpack two GLushorts */ - { - const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine); - GLfloat result[4]; - GLushort usx, usy; - usx = raw & 0xffff; - usy = raw >> 16; - result[0] = result[2] = usx * (1.0f / 65535.0f); - result[1] = result[3] = usy * (1.0f / 65535.0f); - store_vector4(inst, machine, result); - } - break; - case OPCODE_UP4B: /* unpack four GLbytes */ - { - const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine); - GLfloat result[4]; - result[0] = (((raw >> 0) & 0xff) - 128) / 127.0F; - result[1] = (((raw >> 8) & 0xff) - 128) / 127.0F; - result[2] = (((raw >> 16) & 0xff) - 128) / 127.0F; - result[3] = (((raw >> 24) & 0xff) - 128) / 127.0F; - store_vector4(inst, machine, result); - } - break; - case OPCODE_UP4UB: /* unpack four GLubytes */ - { - const GLuint raw = fetch_vector1ui(&inst->SrcReg[0], machine); - GLfloat result[4]; - result[0] = ((raw >> 0) & 0xff) / 255.0F; - result[1] = ((raw >> 8) & 0xff) / 255.0F; - result[2] = ((raw >> 16) & 0xff) / 255.0F; - result[3] = ((raw >> 24) & 0xff) / 255.0F; - store_vector4(inst, machine, result); - } - break; case OPCODE_XPD: /* cross product */ { GLfloat a[4], b[4], result[4]; @@ -1637,19 +1494,6 @@ _mesa_execute_program(struct gl_context * ctx, } } break; - case OPCODE_X2D: /* 2-D matrix transform */ - { - GLfloat a[4], b[4], c[4], result[4]; - fetch_vector4(&inst->SrcReg[0], machine, a); - fetch_vector4(&inst->SrcReg[1], machine, b); - fetch_vector4(&inst->SrcReg[2], machine, c); - result[0] = a[0] + b[0] * c[0] + b[1] * c[1]; - result[1] = a[1] + b[0] * c[2] + b[1] * c[3]; - result[2] = a[2] + b[0] * c[0] + b[1] * c[1]; - result[3] = a[3] + b[0] * c[2] + b[1] * c[3]; - store_vector4(inst, machine, result); - } - break; case OPCODE_END: return GL_TRUE; default: diff --git a/mesalib/src/mesa/program/prog_instruction.c b/mesalib/src/mesa/program/prog_instruction.c index e2eadc36c..976024e3c 100644 --- a/mesalib/src/mesa/program/prog_instruction.c +++ b/mesalib/src/mesa/program/prog_instruction.c @@ -191,18 +191,12 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = { { OPCODE_NOISE2, "NOISE2", 1, 1 }, { OPCODE_NOISE3, "NOISE3", 1, 1 }, { OPCODE_NOISE4, "NOISE4", 1, 1 }, - { OPCODE_PK2H, "PK2H", 1, 1 }, - { OPCODE_PK2US, "PK2US", 1, 1 }, - { OPCODE_PK4B, "PK4B", 1, 1 }, - { OPCODE_PK4UB, "PK4UB", 1, 1 }, { OPCODE_POW, "POW", 2, 1 }, { OPCODE_RCP, "RCP", 1, 1 }, { OPCODE_RET, "RET", 0, 0 }, - { OPCODE_RFL, "RFL", 1, 1 }, { OPCODE_RSQ, "RSQ", 1, 1 }, { OPCODE_SCS, "SCS", 1, 1 }, { OPCODE_SEQ, "SEQ", 2, 1 }, - { OPCODE_SFL, "SFL", 0, 1 }, { OPCODE_SGE, "SGE", 2, 1 }, { OPCODE_SGT, "SGT", 2, 1 }, { OPCODE_SIN, "SIN", 1, 1 }, @@ -210,7 +204,6 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = { { OPCODE_SLT, "SLT", 2, 1 }, { OPCODE_SNE, "SNE", 2, 1 }, { OPCODE_SSG, "SSG", 1, 1 }, - { OPCODE_STR, "STR", 0, 1 }, { OPCODE_SUB, "SUB", 2, 1 }, { OPCODE_SWZ, "SWZ", 1, 1 }, { OPCODE_TEX, "TEX", 1, 1 }, @@ -220,11 +213,6 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = { { OPCODE_TXP, "TXP", 1, 1 }, { OPCODE_TXP_NV, "TXP_NV", 1, 1 }, { OPCODE_TRUNC, "TRUNC", 1, 1 }, - { OPCODE_UP2H, "UP2H", 1, 1 }, - { OPCODE_UP2US, "UP2US", 1, 1 }, - { OPCODE_UP4B, "UP4B", 1, 1 }, - { OPCODE_UP4UB, "UP4UB", 1, 1 }, - { OPCODE_X2D, "X2D", 3, 1 }, { OPCODE_XPD, "XPD", 2, 1 } }; diff --git a/mesalib/src/mesa/program/prog_instruction.h b/mesalib/src/mesa/program/prog_instruction.h index b9604e50d..de7880499 100644 --- a/mesalib/src/mesa/program/prog_instruction.h +++ b/mesalib/src/mesa/program/prog_instruction.h @@ -187,18 +187,12 @@ typedef enum prog_opcode { OPCODE_NOISE2, /* X */ OPCODE_NOISE3, /* X */ OPCODE_NOISE4, /* X */ - OPCODE_PK2H, /* X */ - OPCODE_PK2US, /* X */ - OPCODE_PK4B, /* X */ - OPCODE_PK4UB, /* X */ OPCODE_POW, /* X X X X */ OPCODE_RCP, /* X X X X X */ OPCODE_RET, /* 2 2 opt */ - OPCODE_RFL, /* X */ OPCODE_RSQ, /* X X X X X */ OPCODE_SCS, /* X X */ OPCODE_SEQ, /* 2 X X */ - OPCODE_SFL, /* 2 X */ OPCODE_SGE, /* X X X X X */ OPCODE_SGT, /* 2 X X */ OPCODE_SIN, /* X 2 X X */ @@ -206,7 +200,6 @@ typedef enum prog_opcode { OPCODE_SLT, /* X X X X X */ OPCODE_SNE, /* 2 X X */ OPCODE_SSG, /* 2 X */ - OPCODE_STR, /* 2 X */ OPCODE_SUB, /* X X 1.1 X X */ OPCODE_SWZ, /* X X X */ OPCODE_TEX, /* X 3 X X */ @@ -216,11 +209,6 @@ typedef enum prog_opcode { OPCODE_TXP, /* X X */ OPCODE_TXP_NV, /* 3 X */ OPCODE_TRUNC, /* X */ - OPCODE_UP2H, /* X */ - OPCODE_UP2US, /* X */ - OPCODE_UP4B, /* X */ - OPCODE_UP4UB, /* X */ - OPCODE_X2D, /* X */ OPCODE_XPD, /* X X */ MAX_OPCODE } gl_inst_opcode; diff --git a/mesalib/src/mesa/program/program_lexer.l b/mesalib/src/mesa/program/program_lexer.l index d5dbcf347..2fcd71f22 100644 --- a/mesalib/src/mesa/program/program_lexer.l +++ b/mesalib/src/mesa/program/program_lexer.l @@ -28,6 +28,7 @@ #include "program/symbol_table.h" #include "program/program_parser.h" #include "program/program_parse.tab.h" +#include "util/strtod.h" #define require_ARB_vp (yyextra->mode == ARB_vertex) #define require_ARB_fp (yyextra->mode == ARB_fragment) @@ -216,26 +217,19 @@ MIN{sz}{cc}{sat} { return_opcode( 1, BIN_OP, MIN, 3); } MOV{sz}{cc}{sat} { return_opcode( 1, VECTOR_OP, MOV, 3); } MUL{sz}{cc}{sat} { return_opcode( 1, BIN_OP, MUL, 3); } -PK2H { return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); } -PK2US { return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); } -PK4B { return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); } -PK4UB { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); } POW{szf}{cc}{sat} { return_opcode( 1, BINSC_OP, POW, 3); } RCP{szf}{cc}{sat} { return_opcode( 1, SCALAR_OP, RCP, 3); } -RFL{szf}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, RFL, 3); } RSQ{szf}{cc}{sat} { return_opcode( 1, SCALAR_OP, RSQ, 3); } SCS{sat} { return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); } SEQ{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SEQ, 3); } -SFL{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SFL, 3); } SGE{sz}{cc}{sat} { return_opcode( 1, BIN_OP, SGE, 3); } SGT{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SGT, 3); } SIN{szf}{cc}{sat} { return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); } SLE{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SLE, 3); } SLT{sz}{cc}{sat} { return_opcode( 1, BIN_OP, SLT, 3); } SNE{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SNE, 3); } -STR{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, STR, 3); } SUB{sz}{cc}{sat} { return_opcode( 1, BIN_OP, SUB, 3); } SWZ{sat} { return_opcode( 1, SWZ, SWZ, 3); } @@ -244,12 +238,6 @@ TXB{cc}{sat} { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); } TXD{cc}{sat} { return_opcode(require_NV_fp, TXD_OP, TXD, 3); } TXP{cc}{sat} { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); } -UP2H{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); } -UP2US{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); } -UP4B{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP4B, 4); } -UP4UB{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP4UB, 5); } - -X2D{szf}{cc}{sat} { return_opcode(require_NV_fp, TRI_OP, X2D, 3); } XPD{sat} { return_opcode( 1, BIN_OP, XPD, 3); } vertex { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c index 50209788b..606f19a18 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c @@ -72,7 +72,7 @@ static void update_raster_state( struct st_context *st ) { raster->front_ccw = (ctx->Polygon.FrontFace == GL_CCW); - /* _NEW_VIEWPORT */ + /* _NEW_TRANSFORM */ if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT) { raster->front_ccw ^= 1; } @@ -246,13 +246,10 @@ static void update_raster_state( struct st_context *st ) raster->half_pixel_center = 1; if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) raster->bottom_edge_rule = 1; - /* _NEW_VIEWPORT */ + /* _NEW_TRANSFORM */ if (ctx->Transform.ClipOrigin == GL_UPPER_LEFT) raster->bottom_edge_rule ^= 1; - /* _NEW_VIEWPORT */ - raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE); - /* ST_NEW_RASTERIZER */ raster->rasterizer_discard = ctx->RasterDiscard; @@ -267,6 +264,7 @@ static void update_raster_state( struct st_context *st ) /* _NEW_TRANSFORM */ raster->depth_clip = !ctx->Transform.DepthClamp; raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled; + raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE); cso_set_rasterizer(st->cso_context, raster); } @@ -283,8 +281,7 @@ const struct st_tracked_state st_update_rasterizer = { _NEW_PROGRAM | _NEW_SCISSOR | _NEW_FRAG_CLAMP | - _NEW_TRANSFORM | - _NEW_VIEWPORT), /* mesa state dependencies*/ + _NEW_TRANSFORM), /* mesa state dependencies*/ (ST_NEW_VERTEX_PROGRAM | ST_NEW_RASTERIZER), /* state tracker dependencies */ }, diff --git a/mesalib/src/mesa/state_tracker/st_atom_viewport.c b/mesalib/src/mesa/state_tracker/st_atom_viewport.c index 5b992084b..efa056e10 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_viewport.c +++ b/mesalib/src/mesa/state_tracker/st_atom_viewport.c @@ -70,12 +70,10 @@ update_viewport( struct st_context *st ) st->state.viewport[i].scale[0] = scale[0]; st->state.viewport[i].scale[1] = scale[1] * yScale; st->state.viewport[i].scale[2] = scale[2]; - st->state.viewport[i].scale[3] = 1.0; st->state.viewport[i].translate[0] = translate[0]; st->state.viewport[i].translate[1] = translate[1] * yScale + yBias; st->state.viewport[i].translate[2] = translate[2]; - st->state.viewport[i].translate[3] = 0.0; } cso_set_viewport(st->cso_context, &st->state.viewport[0]); diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c index e3ba5a88f..2107ab167 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c @@ -504,11 +504,9 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, vp.scale[0] = 0.5f * width; vp.scale[1] = height * (invert ? -0.5f : 0.5f); vp.scale[2] = 0.5f; - vp.scale[3] = 1.0f; vp.translate[0] = 0.5f * width; vp.translate[1] = 0.5f * height; vp.translate[2] = 0.5f; - vp.translate[3] = 0.0f; cso_set_viewport(cso, &vp); } @@ -769,7 +767,8 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y, const uint semantic_indexes[] = { 0, 0, 0 }; st->bitmap.vs = util_make_vertex_passthrough_shader(st->pipe, 3, semantic_names, - semantic_indexes); + semantic_indexes, + FALSE); } if (UseBitmapCache && accum_bitmap(ctx, x, y, width, height, unpack, bitmap)) diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c index 2c1414e48..45dea594e 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_clear.c +++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c @@ -88,6 +88,14 @@ st_destroy_clear(struct st_context *st) cso_delete_vertex_shader(st->cso_context, st->clear.vs); st->clear.vs = NULL; } + if (st->clear.vs_layered) { + cso_delete_vertex_shader(st->cso_context, st->clear.vs_layered); + st->clear.vs_layered = NULL; + } + if (st->clear.gs_layered) { + cso_delete_geometry_shader(st->cso_context, st->clear.gs_layered); + st->clear.gs_layered = NULL; + } } @@ -123,10 +131,12 @@ set_vertex_shader(struct st_context *st) const uint semantic_indexes[] = { 0, 0 }; st->clear.vs = util_make_vertex_passthrough_shader(st->pipe, 2, semantic_names, - semantic_indexes); + semantic_indexes, + FALSE); } cso_set_vertex_shader_handle(st->cso_context, st->clear.vs); + cso_set_geometry_shader_handle(st->cso_context, NULL); } @@ -135,18 +145,25 @@ set_vertex_shader_layered(struct st_context *st) { struct pipe_context *pipe = st->pipe; - if (!pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_INSTANCEID) || - !pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT)) { - assert(!"Got layered clear, but the VS layer output is unsupported"); + if (!pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_INSTANCEID)) { + assert(!"Got layered clear, but VS instancing is unsupported"); set_vertex_shader(st); return; } if (!st->clear.vs_layered) { - st->clear.vs_layered = util_make_layered_clear_vertex_shader(pipe); + bool vs_layer = + pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT); + if (vs_layer) { + st->clear.vs_layered = util_make_layered_clear_vertex_shader(pipe); + } else { + st->clear.vs_layered = util_make_layered_clear_helper_vertex_shader(pipe); + st->clear.gs_layered = util_make_layered_clear_geometry_shader(pipe); + } } cso_set_vertex_shader_handle(st->cso_context, st->clear.vs_layered); + cso_set_geometry_shader_handle(st->cso_context, st->clear.gs_layered); } @@ -323,16 +340,13 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) vp.scale[0] = 0.5f * fb_width; vp.scale[1] = fb_height * (invert ? -0.5f : 0.5f); vp.scale[2] = 0.5f; - vp.scale[3] = 1.0f; vp.translate[0] = 0.5f * fb_width; vp.translate[1] = 0.5f * fb_height; vp.translate[2] = 0.5f; - vp.translate[3] = 0.0f; cso_set_viewport(st->cso_context, &vp); } set_fragment_shader(st); - cso_set_geometry_shader_handle(st->cso_context, NULL); if (num_layers > 1) set_vertex_shader_layered(st); diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index 5ae092b94..939fc2065 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -776,11 +776,9 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, vp.scale[0] = 0.5f * w; vp.scale[1] = -0.5f * h; vp.scale[2] = 0.5f; - vp.scale[3] = 1.0f; vp.translate[0] = 0.5f * w; vp.translate[1] = 0.5f * h; vp.translate[2] = 0.5f; - vp.translate[3] = 0.0f; cso_set_viewport(cso, &vp); } diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c index f997e6b00..d057ff62a 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c @@ -91,7 +91,7 @@ lookup_shader(struct pipe_context *pipe, util_make_vertex_passthrough_shader(pipe, num_attribs, semantic_names, - semantic_indexes); + semantic_indexes, FALSE); NumCachedShaders++; return CachedShaders[i].handle; @@ -258,11 +258,9 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, vp.scale[0] = 0.5f * width; vp.scale[1] = height * (invert ? -0.5f : 0.5f); vp.scale[2] = 1.0f; - vp.scale[3] = 1.0f; vp.translate[0] = 0.5f * width; vp.translate[1] = 0.5f * height; vp.translate[2] = 0.0f; - vp.translate[3] = 0.0f; cso_set_viewport(cso, &vp); } diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h index 58f14f954..15f9df492 100644 --- a/mesalib/src/mesa/state_tracker/st_context.h +++ b/mesalib/src/mesa/state_tracker/st_context.h @@ -181,6 +181,7 @@ struct st_context void *vs; void *fs; void *vs_layered; + void *gs_layered; } clear; /** used for anything using util_draw_vertex_buffer */ diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index aff3ddebe..bdfab8b41 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -241,8 +241,7 @@ void st_init_limits(struct pipe_screen *screen, if (options->EmitNoLoops) options->MaxUnrollIterations = MIN2(screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INSTRUCTIONS), 65536); - else - options->MaxUnrollIterations = 255; /* SM3 limit */ + options->LowerClipDistance = true; } diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index a4e2c8da5..8e91c4b61 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -4022,6 +4022,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp, newinst = v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]); newinst->tex_target = inst->tex_target; + newinst->sampler_array_size = inst->sampler_array_size; } /* Make modifications to fragment program info. */ @@ -4101,6 +4102,7 @@ get_bitmap_visitor(struct st_fragment_program *fp, newinst = v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]); newinst->tex_target = inst->tex_target; + newinst->sampler_array_size = inst->sampler_array_size; } /* Make modifications to fragment program info. */ @@ -4524,8 +4526,10 @@ compile_tgsi_instruction(struct st_translate *t, inst->saturate, clamp_dst_color_output); - for (i = 0; i < num_src; i++) + for (i = 0; i < num_src; i++) { + assert(inst->src[i].file != PROGRAM_UNDEFINED); src[i] = translate_src(t, &inst->src[i]); + } switch(inst->op) { case TGSI_OPCODE_BGNLOOP: @@ -4555,6 +4559,7 @@ compile_tgsi_instruction(struct st_translate *t, case TGSI_OPCODE_TG4: case TGSI_OPCODE_LODQ: src[num_src] = t->samplers[inst->sampler.index]; + assert(src[num_src].File != TGSI_FILE_NULL); if (inst->sampler.reladdr) src[num_src] = ureg_src_indirect(src[num_src], ureg_src(t->address[2])); @@ -4721,7 +4726,8 @@ emit_wpos(struct st_context *st, } else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) { /* the driver supports lower-left origin, need to invert Y */ - ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_ORIGIN, + TGSI_FS_COORD_ORIGIN_LOWER_LEFT); invert = TRUE; } else @@ -4731,7 +4737,8 @@ emit_wpos(struct st_context *st, /* Fragment shader wants origin in lower-left */ if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) /* the driver supports lower-left origin */ - ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_ORIGIN, + TGSI_FS_COORD_ORIGIN_LOWER_LEFT); else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT)) /* the driver supports upper-left origin, need to invert Y */ invert = TRUE; @@ -4744,7 +4751,8 @@ emit_wpos(struct st_context *st, if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) { /* the driver supports pixel center integer */ adjY[1] = 1.0f; - ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_PIXEL_CENTER, + TGSI_FS_COORD_PIXEL_CENTER_INTEGER); } else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER)) { /* the driver supports pixel center half integer, need to bias X,Y */ @@ -4763,7 +4771,8 @@ emit_wpos(struct st_context *st, else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) { /* the driver supports pixel center integer, need to bias X,Y */ adjX = adjY[0] = adjY[1] = 0.5f; - ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_PIXEL_CENTER, + TGSI_FS_COORD_PIXEL_CENTER_INTEGER); } else assert(0); diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c index df6de737f..606d67891 100644 --- a/mesalib/src/mesa/state_tracker/st_manager.c +++ b/mesalib/src/mesa/state_tracker/st_manager.c @@ -452,7 +452,8 @@ st_framebuffer_create(struct st_context *st, st_pipe_format_to_mesa_format(srgb_format) != MESA_FORMAT_NONE && screen->is_format_supported(screen, srgb_format, PIPE_TEXTURE_2D, stfbi->visual->samples, - PIPE_BIND_RENDER_TARGET)) + (PIPE_BIND_DISPLAY_TARGET | + PIPE_BIND_RENDER_TARGET))) mode.sRGBCapable = GL_TRUE; } diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c index 26a5f51c7..2c9d9a523 100644 --- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -891,7 +891,8 @@ emit_wpos(struct st_context *st, } else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) { /* the driver supports lower-left origin, need to invert Y */ - ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_ORIGIN, + TGSI_FS_COORD_ORIGIN_LOWER_LEFT); invert = TRUE; } else @@ -901,7 +902,8 @@ emit_wpos(struct st_context *st, /* Fragment shader wants origin in lower-left */ if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT)) /* the driver supports lower-left origin */ - ureg_property_fs_coord_origin(ureg, TGSI_FS_COORD_ORIGIN_LOWER_LEFT); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_ORIGIN, + TGSI_FS_COORD_ORIGIN_LOWER_LEFT); else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT)) /* the driver supports upper-left origin, need to invert Y */ invert = TRUE; @@ -914,7 +916,8 @@ emit_wpos(struct st_context *st, if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) { /* the driver supports pixel center integer */ adjY[1] = 1.0f; - ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_PIXEL_CENTER, + TGSI_FS_COORD_PIXEL_CENTER_INTEGER); } else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER)) { /* the driver supports pixel center half integer, need to bias X,Y */ @@ -933,7 +936,8 @@ emit_wpos(struct st_context *st, else if (pscreen->get_param(pscreen, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER)) { /* the driver supports pixel center integer, need to bias X,Y */ adjX = adjY[0] = adjY[1] = 0.5f; - ureg_property_fs_coord_pixel_center(ureg, TGSI_FS_COORD_PIXEL_CENTER_INTEGER); + ureg_property(ureg, TGSI_PROPERTY_FS_COORD_PIXEL_CENTER, + TGSI_FS_COORD_PIXEL_CENTER_INTEGER); } else assert(0); diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index 926086bf8..737c2694e 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -742,21 +742,25 @@ st_translate_fragment_program(struct st_context *st, debug_printf("\n"); } if (write_all == GL_TRUE) - ureg_property_fs_color0_writes_all_cbufs(ureg, 1); + ureg_property(ureg, TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS, 1); if (stfp->Base.FragDepthLayout != FRAG_DEPTH_LAYOUT_NONE) { switch (stfp->Base.FragDepthLayout) { case FRAG_DEPTH_LAYOUT_ANY: - ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_ANY); + ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, + TGSI_FS_DEPTH_LAYOUT_ANY); break; case FRAG_DEPTH_LAYOUT_GREATER: - ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_GREATER); + ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, + TGSI_FS_DEPTH_LAYOUT_GREATER); break; case FRAG_DEPTH_LAYOUT_LESS: - ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_LESS); + ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, + TGSI_FS_DEPTH_LAYOUT_LESS); break; case FRAG_DEPTH_LAYOUT_UNCHANGED: - ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_UNCHANGED); + ureg_property(ureg, TGSI_PROPERTY_FS_DEPTH_LAYOUT, + TGSI_FS_DEPTH_LAYOUT_UNCHANGED); break; default: assert(0); @@ -1122,10 +1126,11 @@ st_translate_geometry_program(struct st_context *st, stgp->tgsi.tokens = NULL; } - ureg_property_gs_input_prim(ureg, stgp->Base.InputType); - ureg_property_gs_output_prim(ureg, stgp->Base.OutputType); - ureg_property_gs_max_vertices(ureg, stgp->Base.VerticesOut); - ureg_property_gs_invocations(ureg, stgp->Base.Invocations); + ureg_property(ureg, TGSI_PROPERTY_GS_INPUT_PRIM, stgp->Base.InputType); + ureg_property(ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, stgp->Base.OutputType); + ureg_property(ureg, TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES, + stgp->Base.VerticesOut); + ureg_property(ureg, TGSI_PROPERTY_GS_INVOCATIONS, stgp->Base.Invocations); if (stgp->glsl_to_tgsi) st_translate_program(st->ctx, diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c index 045dbb506..e623b361a 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_array.c +++ b/mesalib/src/mesa/vbo/vbo_exec_array.c @@ -36,6 +36,8 @@ #include "main/enums.h" #include "main/macros.h" #include "main/transformfeedback.h" +#include "main/sse_minmax.h" +#include "x86/common_x86_asm.h" #include "vbo_context.h" @@ -119,10 +121,16 @@ vbo_get_minmax_index(struct gl_context *ctx, } } else { - for (i = 0; i < count; i++) { - if (ui_indices[i] > max_ui) max_ui = ui_indices[i]; - if (ui_indices[i] < min_ui) min_ui = ui_indices[i]; +#if defined(USE_SSE41) + if (cpu_has_sse4_1) { + _mesa_uint_array_min_max(ui_indices, &min_ui, &max_ui, count); } + else +#endif + for (i = 0; i < count; i++) { + if (ui_indices[i] > max_ui) max_ui = ui_indices[i]; + if (ui_indices[i] < min_ui) min_ui = ui_indices[i]; + } } *min_index = min_ui; *max_index = max_ui; diff --git a/mesalib/src/mesa/x86/common_x86_features.h b/mesalib/src/mesa/x86/common_x86_features.h index 66f2cf651..65634aa5d 100644 --- a/mesalib/src/mesa/x86/common_x86_features.h +++ b/mesalib/src/mesa/x86/common_x86_features.h @@ -59,13 +59,39 @@ #define X86_CPUEXT_3DNOW_EXT (1<<30) #define X86_CPUEXT_3DNOW (1<<31) +#ifdef __MMX__ +#define cpu_has_mmx 1 +#else #define cpu_has_mmx (_mesa_x86_cpu_features & X86_FEATURE_MMX) +#endif + #define cpu_has_mmxext (_mesa_x86_cpu_features & X86_FEATURE_MMXEXT) + +#ifdef __SSE__ +#define cpu_has_xmm 1 +#else #define cpu_has_xmm (_mesa_x86_cpu_features & X86_FEATURE_XMM) +#endif + +#ifdef __SSE2__ +#define cpu_has_xmm2 1 +#else #define cpu_has_xmm2 (_mesa_x86_cpu_features & X86_FEATURE_XMM2) +#endif + +#ifdef __3dNOW__ +#define cpu_has_3dnow 1 +#else #define cpu_has_3dnow (_mesa_x86_cpu_features & X86_FEATURE_3DNOW) +#endif + #define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT) + +#ifdef __SSE4_1__ +#define cpu_has_sse4_1 1 +#else #define cpu_has_sse4_1 (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1) +#endif #endif diff --git a/mesalib/src/util/Makefile.sources b/mesalib/src/util/Makefile.sources index 952b79905..9e274241d 100644 --- a/mesalib/src/util/Makefile.sources +++ b/mesalib/src/util/Makefile.sources @@ -3,7 +3,8 @@ MESA_UTIL_FILES := \ ralloc.c \ register_allocate.c \ register_allocate.h \ - rgtc.c + rgtc.c \ + strtod.cpp MESA_UTIL_GENERATED_FILES = \ format_srgb.c diff --git a/mesalib/src/util/hash_table.c b/mesalib/src/util/hash_table.c index 1b6726c79..920bdfd33 100644 --- a/mesalib/src/util/hash_table.c +++ b/mesalib/src/util/hash_table.c @@ -385,12 +385,12 @@ _mesa_hash_table_random_entry(struct hash_table *ht, /** - * Quick FNV-1 hash implementation based on: + * Quick FNV-1a hash implementation based on: * http://www.isthe.com/chongo/tech/comp/fnv/ * - * FNV-1 is not be the best hash out there -- Jenkins's lookup3 is supposed to - * be quite good, and it probably beats FNV. But FNV has the advantage that - * it involves almost no code. For an improvement on both, see Paul + * FNV-1a is not be the best hash out there -- Jenkins's lookup3 is supposed + * to be quite good, and it probably beats FNV. But FNV has the advantage + * that it involves almost no code. For an improvement on both, see Paul * Hsieh's http://www.azillionmonkeys.com/qed/hash.html */ uint32_t @@ -408,7 +408,7 @@ _mesa_hash_data(const void *data, size_t size) return hash; } -/** FNV-1 string hash implementation */ +/** FNV-1a string hash implementation */ uint32_t _mesa_hash_string(const char *key) { diff --git a/mesalib/src/util/macros.h b/mesalib/src/util/macros.h index ff37a7d63..5fc672953 100644 --- a/mesalib/src/util/macros.h +++ b/mesalib/src/util/macros.h @@ -29,6 +29,10 @@ # define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) #endif +/* For compatibility with Clang's __has_builtin() */ +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif /** * __builtin_expect macros @@ -69,6 +73,12 @@ do { \ assert(!str); \ __builtin_unreachable(); \ } while (0) +#elif _MSC_VER >= 1200 +#define unreachable(str) \ +do { \ + assert(!str); \ + __assume(0); \ +} while (0) #endif #ifndef unreachable @@ -79,7 +89,13 @@ do { \ * Assume macro. Useful for expressing our assumptions to the compiler, * typically for purposes of silencing warnings. */ -#ifdef HAVE___BUILTIN_UNREACHABLE +#if __has_builtin(__builtin_assume) +#define assume(expr) \ +do { \ + assert(expr); \ + __builtin_assume(expr); \ +} while (0) +#elif defined HAVE___BUILTIN_UNREACHABLE #define assume(expr) ((expr) ? ((void) 0) \ : (assert(!"assumption failed"), \ __builtin_unreachable())) diff --git a/mesalib/src/glsl/strtod.c b/mesalib/src/util/strtod.cpp index 5d4346b5a..2b4dd982a 100644 --- a/mesalib/src/glsl/strtod.c +++ b/mesalib/src/util/strtod.cpp @@ -28,7 +28,7 @@ #ifdef _GNU_SOURCE #include <locale.h> -#ifdef __APPLE__ +#ifdef HAVE_XLOCALE_H #include <xlocale.h> #endif #endif @@ -36,21 +36,22 @@ #include "strtod.h" +#if defined(_GNU_SOURCE) && defined(HAVE_XLOCALE_H) +static struct locale_initializer { + locale_initializer() { loc = newlocale(LC_CTYPE_MASK, "C", NULL); } + locale_t loc; +} loc_init; +#endif /** * Wrapper around strtod which uses the "C" locale so the decimal * point is always '.' */ double -glsl_strtod(const char *s, char **end) +_mesa_strtod(const char *s, char **end) { -#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \ - !defined(__HAIKU__) && !defined(__UCLIBC__) - static locale_t loc = NULL; - if (!loc) { - loc = newlocale(LC_CTYPE_MASK, "C", NULL); - } - return strtod_l(s, end, loc); +#if defined(_GNU_SOURCE) && defined(HAVE_XLOCALE_H) + return strtod_l(s, end, loc_init.loc); #else return strtod(s, end); #endif @@ -62,16 +63,11 @@ glsl_strtod(const char *s, char **end) * point is always '.' */ float -glsl_strtof(const char *s, char **end) +_mesa_strtof(const char *s, char **end) { -#if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \ - !defined(__HAIKU__) && !defined(__UCLIBC__) - static locale_t loc = NULL; - if (!loc) { - loc = newlocale(LC_CTYPE_MASK, "C", NULL); - } - return strtof_l(s, end, loc); -#elif _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE +#if defined(_GNU_SOURCE) && defined(HAVE_XLOCALE_H) + return strtof_l(s, end, loc_init.loc); +#elif defined(HAVE_STRTOF) return strtof(s, end); #else return (float) strtod(s, end); diff --git a/mesalib/src/glsl/strtod.h b/mesalib/src/util/strtod.h index ad847dbb0..02c25ddb7 100644 --- a/mesalib/src/glsl/strtod.h +++ b/mesalib/src/util/strtod.h @@ -32,10 +32,10 @@ extern "C" { #endif extern double -glsl_strtod(const char *s, char **end); +_mesa_strtod(const char *s, char **end); extern float -glsl_strtof(const char *s, char **end); +_mesa_strtof(const char *s, char **end); #ifdef __cplusplus |