$(DIRECTORY)/src/gallium/Makefile.template \
$(DIRECTORY)/src/gallium/SConscript \
$(DIRECTORY)/src/gallium/targets/Makefile.dri \
+ $(DIRECTORY)/src/gallium/targets/Makefile.xorg \
+ $(DIRECTORY)/src/gallium/targets/SConscript.dri \
$(DIRECTORY)/src/gallium/*/Makefile \
$(DIRECTORY)/src/gallium/*/SConscript \
$(DIRECTORY)/src/gallium/*/*/Makefile \
SConscript(
'src/SConscript',
- variant_dir = env['build'],
+ variant_dir = env['build_dir'],
duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
)
from SCons.Variables.EnumVariable import EnumVariable as EnumOption
except ImportError:
from SCons.Options.EnumOption import EnumOption
- opts.Add(BoolOption('debug', 'debug build', 'yes'))
- opts.Add(BoolOption('profile', 'profile build', 'no'))
+ opts.Add(EnumOption('build', 'build type', 'debug',
+ allowed_values=('debug', 'checked', 'profile', 'release')))
opts.Add(BoolOption('quiet', 'quiet command lines', 'yes'))
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
opts.Add('toolchain', 'compiler toolchain', 'default')
opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))
+ opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes'))
+ opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no'))
AC_SUBST([HAVE_XF86VIDMODE])
+PKG_CHECK_MODULES([LIBDRM_RADEON],
+ [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
+ HAVE_LIBDRM_RADEON=yes,
+ HAVE_LIBDRM_RADEON=no)
+
dnl
dnl More X11 setup
dnl
case $DRI_DIRS in
*radeon*|*r200*|*r300*|*r600*)
- PKG_CHECK_MODULES([LIBDRM_RADEON],
- [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED],
- HAVE_LIBDRM_RADEON=yes,
- HAVE_LIBDRM_RADEON=no)
-
- if test "$HAVE_LIBDRM_RADEON" = yes; then
+ if test "x$HAVE_LIBDRM_RADEON" = xyes; then
RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
fi
[build gallium radeon @<:@default=disabled@:>@])],
[enable_gallium_radeon="$enableval"],
[enable_gallium_radeon=auto])
-if test "x$enable_gallium_radeon" = xyes || test "x$enable_gallium_radeon" = xauto; then
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
- gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
+if test "x$enable_gallium_radeon" = xauto; then
+ if test "x$HAVE_LIBDRM_RADEON" = xyes; then
+ GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
+ gallium_check_st "radeon/drm" "dri-r300"
+ else
+ AC_MSG_WARN([libdrm_radeon is missing, not building gallium-radeon (r300)])
+ fi
+fi
+if test "x$enable_gallium_radeon" = xyes; then
+ if test "x$HAVE_LIBDRM_RADEON" = xyes; then
+ GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
+ gallium_check_st "radeon/drm" "dri-r300" "xorg-radeon"
+ else
+ AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-radeon (r300)])
+ fi
fi
dnl
[enable_gallium_r600="$enableval"],
[enable_gallium_r600=auto])
if test "x$enable_gallium_r600" = xyes; then
- GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
- gallium_check_st "r600/drm" "dri-r600"
+ if test "x$HAVE_LIBDRM_RADEON" = xyes; then
+ GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
+ gallium_check_st "r600/drm" "dri-r600"
+ else
+ AC_MSG_ERROR([libdrm_radeon is missing, cannot build gallium-r600])
+ fi
fi
dnl
Packed depth/stencil formats DONE
Per-buffer blend and masks (GL_EXT_draw_buffers2) DONE
GL_EXT_texture_compression_rgtc not started
-Red and red/green texture formats Ian?
+Red and red/green texture formats DONE (swrast, i965)
Transform feedback (GL_EXT_transform_feedback) ~50% done
glBindFragDataLocation, glGetFragDataLocation,
glBindBufferRange, glBindBufferBase commands
Buffer copying (GL_ARB_copy_buffer) DONE
Primitive restart (GL_NV_primitive_restart) not started
16 vertex texture image units not started
-Texture buffer objs (GL_ARB_textur_buffer_object) not started
+Texture buffer objs (GL_ARB_texture_buffer_object) not started
Rectangular textures (GL_ARB_texture_rectangle) DONE
Uniform buffer objs (GL_ARB_uniform_buffer_object) not started
Signed normalized texture formats ~50% done
GLSL 3.30 not started
GL_ARB_blend_func_extended not started
-GL_ARB_explicit_attrib_location not started
+GL_ARB_explicit_attrib_location DONE (swrast, i915, i965)
GL_ARB_occlusion_query2 not started
GL_ARB_sampler_objects not started
GL_ARB_texture_rgb10_a2ui not started
</p>
<p>
-Update the docs/news.html file and docs/download.html files.
+Update docs/news.html.
</p>
<p>
<p>
Make an announcement on the mailing lists:
-<em>m</em><em>e</em><em>s</em><em>a</em><em>3</em><em>d</em><em>-</em><em>d</em><em>e</em><em>v</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>s</em><em>f</em><em>.</em><em>n</em><em>e</em><em>t</em>,
-<em>m</em><em>e</em><em>s</em><em>a</em><em>3</em><em>d</em><em>-</em><em>u</em><em>s</em><em>e</em><em>r</em><em>s</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>s</em><em>f</em><em>.</em><em>n</em><em>e</em><em>t</em>
+
+<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>d</em><em>e</em><em>v</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>,
+<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>u</em><em>s</em><em>e</em><em>r</em><em>s</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
and
-<em>m</em><em>e</em><em>s</em><em>a</em><em>3</em><em>d</em><em>-</em><em>a</em><em>n</em><em>n</em><em>o</em><em>u</em><em>n</em><em>c</em><em>e</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>s</em><em>f</em><em>.</em><em>n</em><em>e</em><em>t</em>
+<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>a</em><em>n</em><em>n</em><em>o</em><em>u</em><em>n</em><em>c</em><em>e</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
</p>
<H1>News</H1>
+<h2>October 4, 2010</h2>
+
+<p>
+<a href="relnotes-7.9.html">Mesa 7.9</a> (final) is released. This is a new
+development release.
+</p>
+
+
+<h2>September 27, 2010</h2>
+
+<p>
+<a href="relnotes-7.9.html">Mesa 7.9.0-rc1</a> is released. This is a
+release candidate for the 7.9 development release.
+</p>
+
+
<h2>June 16, 2010</h2>
<p>
--- /dev/null
+<HTML>
+
+<TITLE>Mesa Release Notes</TITLE>
+
+<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
+
+<BODY>
+
+<body bgcolor="#eeeeee">
+
+<H1>Mesa 7.10 Release Notes / tbd</H1>
+
+<p>
+Mesa 7.10 is a new development release.
+People who are concerned with stability and reliability should stick
+with a previous release or wait for Mesa 7.10.1.
+</p>
+<p>
+Mesa 7.10 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+</p>
+<p>
+See the <a href="install.html">Compiling/Installing page</a> for prerequisites
+for DRI hardware acceleration.
+</p>
+
+
+<h2>MD5 checksums</h2>
+<pre>
+tbd
+</pre>
+
+
+<h2>New features</h2>
+<ul>
+<li>GL_ARB_explicit_attrib_location extension (Intel and software drivers).
+</ul>
+
+
+<h2>Bug fixes</h2>
+<ul>
+<li>tbd</li>
+</ul>
+
+
+<h2>Changes</h2>
+<ul>
+<li>tbd</li>
+</ul>
+
+</body>
+</html>
<h2>MD5 checksums</h2>
<pre>
-tbd
+c89b63d253605ed40e8ac370d25a833c MesaLib-7.8.2.tar.gz
+6be2d343a0089bfd395ce02aaf8adb57 MesaLib-7.8.2.tar.bz2
+a04ad3b06ac5ff3969a003fa7bbf7d5b MesaLib-7.8.2.zip
+7c213f92efeb471f0331670d5079d4c0 MesaDemos-7.8.2.tar.gz
+757d9e2e06f48b1a52848be9b0307ced MesaDemos-7.8.2.tar.bz2
+8d0e5cfe68b8ebf90265d350ae2c48b1 MesaDemos-7.8.2.zip
+b74482e3f44f35ed395c4aada4fd8240 MesaGLUT-7.8.2.tar.gz
+a471807b65e49c325808ba4551be93ed MesaGLUT-7.8.2.tar.bz2
+9f190268c42be582ef66e47365ee61e3 MesaGLUT-7.8.2.zip
</pre>
<ul>
<li>Fixed Gallium glDrawPixels(GL_DEPTH_COMPONENT).
<li>Fixed Gallium Cell driver to buildable, runable state
+<li>Fixed bad error checking for glFramebufferRenderbuffer(attachment=GL_DEPTH_STENCIL_ATTACHMENT).
+<li>Fixed incorrect Z coordinate handling in "meta" glDraw/CopyPixels.
+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=23670">Bug
+ #23670</a>.</li>
+
+<li>Assorted i965 driver fixes.
+ Including but not limited to:
+ <ul>
+ <li>Fix scissoring when width or height is
+ 0. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27643">Bug
+ #27643</a>.
+ <li>Fix bit allocation for number of color regions for
+ ARB_draw_buffers.</li>
+ <li>Set the correct provoking vertex for clipped first-mode
+ trifans. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=24470">Bug
+ #24470</a>.</li>
+ <li>Use <code>R16G16B16A16_FLOAT</code> for 3-component half-float.</li>
+ <li>Fix assertion for surface tile offset usage on Ironlake.</li>
+ <li>Fix cube map layouts on Ironlake.</li>
+ <li>When an RB gets a new region, clear the old from the state
+ cache. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=24119">Bug
+ #24119</a>.</li>
+ <li>Reject shaders with uninlined function calls instead of hanging.</li>
+ </ul>
+</li>
+
+<li>Assorted i915 driver fixes. Including but not limited to:
+ <ul>
+ <li>Fixed texture LOD clamping in i915 driver.
+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=24846">Bug
+ #24846</a>.</li>
+ <li>Fix off-by-one for drawing rectangle.
+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27408">Bug
+ #27408</a>.</li>
+ </ul>
+</li>
+
+<li>Fixed hangs in etracer on 830 and 845
+ chipsets. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=26557">Bug
+ #26557</a>.</li>
+<li>Fixed tiling of small textures on all Intel drivers.</li>
+<li>Fixed crash in Savage driver when using <code>_mesa_CopyTexImage2D</code>.
+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27652">Bug
+ #27652</a>.</li>
+
+<li>Assorted GLX fixes. Including but not limited to:
+ <ul>
+ <li>Fixed <code>__glXInitializeVisualConfigFromTags</code>'s handling of
+ unrecognized fbconfig tags.</li>
+ <li>Fixed regression with <code>GLX_USE_GL</code>.
+ <li>Fixed config chooser logic for 'mask' matching.</li>
+ <li>Report swap events correctly in direct rendered case (DRI2)</li>
+ <li>Fixed build with dri2proto which doesn't define
+ <code>X_DRI2SwapInterval</code>.</li>
+ <li>Get <code>GLX_SCREEN</code> first in <code>__glXQueryContextInfo</code>.
+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=14245">Bug
+ #14245</a>.</li>
+ </ul>
+</li>
+
+<li>Assorted GLSL fixes. Including but not limited to:
+ <ul>
+ <li>Change variable declared assertion into conditional in GLSL
+ compiler. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27921">Bug
+ #27921</a>.</li>
+ <li>Fix instruction indexing
+ bugs. <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27566">Bug
+ #27566</a>.</li>
+ <li>Updated uniform location / offset encoding to be more like
+ other implementations.</li>
+ <li>Don't overwrite a driver's shader infolog with generic failure
+ message.</li>
+ </ul>
+</li>
+
+<li>Fixed OSMesa build for 16 and 32-bit color channel depth.
+<li>Fixed OSMesa build with hidden symbol visibility. libOSMesa no longer links to libGL.
+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=28305">Bug
+ #28305</a>.
+<li>Fixed handling of multiple render targets in fixed-function
+ texture envrionmnent programs.</li>
+<li>Fixed conversion errors in <code>signed_rgba8888[rev]</code> texel
+ fetch.</li>
+<li>Don't set srcLevel on <code>GL_TEXTURE_RECTANGLE_ARB</code> targets.</li>
+<li>Various build fixes for OpenBSD.</li>
+<li>Various build fixes for OS X.</li>
+<li>Various build fixes for GCC 3.3.</li>
</ul>
-<h2>Changes</h2>
-<p>None.</p>
</body>
</html>
--- /dev/null
+<HTML>
+
+<TITLE>Mesa Release Notes</TITLE>
+
+<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
+
+<BODY>
+
+<body bgcolor="#eeeeee">
+
+<H1>Mesa 7.8.3 Release Notes / (date tbd)</H1>
+
+<p>
+Mesa 7.8.3 is a bug fix release which fixes bugs found since the 7.8.2 release.
+</p>
+<p>
+Mesa 7.8.3 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+</p>
+<p>
+See the <a href="install.html">Compiling/Installing page</a> for prerequisites
+for DRI hardware acceleration.
+</p>
+
+
+<h2>MD5 checksums</h2>
+<pre>
+x MesaLib-7.8.3.tar.gz
+x MesaLib-7.8.3.tar.bz2
+x MesaLib-7.8.3.zip
+x MesaDemos-7.8.3.tar.gz
+x MesaDemos-7.8.3.tar.bz2
+x MesaDemos-7.8.3.zip
+x MesaGLUT-7.8.3.tar.gz
+x MesaGLUT-7.8.3.tar.bz2
+x MesaGLUT-7.8.3.zip
+</pre>
+
+
+<h2>New features</h2>
+<p>None.</p>
+
+
+<h2>Changes</h2>
+<ul>
+<li>The radeon driver should use less memory when searching for a valid mip
+image.</li>
+</ul>
+
+
+<h2>Bug fixes</h2>
+<ul>
+<li>Fix unsupported FB with D24S8 (bug
+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=23670">29116</a>)</li>
+<li>Fix ReadPixels crash when reading depth/stencil from an FBO</li>
+<li>Fixed a bug rendering to 16-bit buffers using swrast.</li>
+<li>Fixed a state tracker/TGSI bug that caused crashes when using Windows'
+ memory debugging features.</li>
+<li>Fixed an issue rendering to 32-bit channels with swrast (bug
+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=29487">29487</a>)</li>
+<li>GLSL: fix indirect <TT>gl_TextureMatrix</TT> addressing (bug
+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=28967">28967</a>)</li>
+<li>GLSL: fix for bug
+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=27216">27216</a></li>
+<li>GLSL: fix zw fragcoord entries in some cases (bug
+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=29183">29183</a>)</li>
+<li>Fix texture env generation in some cases (bug
+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=28169">28169</a>)</li>
+<li>osmesa: a fix for calling <TT>OSMesaMakeCurrent</TT> twice was applied (bug
+ <a href="https://bugs.freedesktop.org/show_bug.cgi?id=10966">10966</a></li>
+<li>A bug was fixed which could cause Mesa to ignore the
+ <TT>MESA_EXTENSION_OVERRIDE</TT> environment variable.</li>
+<li>A bug related to specular highlights on backfaces was fixed.</li>
+<li>A radeon-specific issue with <TT>glCopyTex(Sub)Image</TT> was
+ corrected.</li>
+<li>radeon/wine: flush command stream in more cases, fixing wine d3d9
+ tests.</li>
+<li>r600: fix sin+cos normalization.</li>
+<li>r600: (properly) ignore <TT>GL_COORD_REPLACE</TT> when point sprites are
+ disabled.</li>
+<li>radeon: avoid flushing when the context is not current.</li>
+<li>r300c: a bug affecting unaligned BOs was fixed.</li>
+<li>r300c: a hardlock caused by ARB_half_float_vertex incorrectly advertised on some chipsets.</li>
+</ul>
+
+
+</body>
+</html>
<body bgcolor="#eeeeee">
-<H1>Mesa 7.9 Release Notes / date TBD</H1>
+<H1>Mesa 7.9 Release Notes / October 4, 2010</H1>
<p>
Mesa 7.9 is a new development release.
<h2>MD5 checksums</h2>
<pre>
-tbd
+ed65ab425b25895c7f473d0a5e6e64f8 MesaLib-7.9.tar.gz
+82c740c49d572baa6da2b1a1eee90bca MesaLib-7.9.tar.bz2
+cd2b6ecec759b0457475e94bbb38fedb MesaLib-7.9.zip
+7b54af9fb9b1f6a1a65db2520f50848f MesaGLUT-7.9.tar.gz
+20d07419d1929f833fdb36bced290ad5 MesaGLUT-7.9.tar.bz2
+62a7edecd7c92675cd6029b05217eb0a MesaGLUT-7.9.zip
</pre>
<li>New, improved GLSL compiler written by Intel.
See the <a href="shading.html"> Shading Language</a> page for
more information.
-<li>GL_EXT_timer_query extension (i965 driver only)
+<li>New, very experimental Gallium driver for R600-R700 Radeons.
+<li>Support for AMD Evergreen-based Radeons (HD 5xxx)
+<li>GL_EXT_timer_query extension (i965 driver and softpipe only)
<li>GL_EXT_framebuffer_multisample extension (intel drivers, MAX_SAMPLES = 1)
<li>GL_ARB_texture_swizzle extension (alias of GL_EXT_texture_swizzle)
-<li>GL_ARB_draw_elements_base_vertex, GL_ARB_fragment_program_shadow
- and GL_EXT_draw_buffers2 in Gallium drivers
+<li>GL_ARB_draw_elements_base_vertex, GL_ARB_fragment_program_shadow,
+ GL_ARB_window_pos, GL_EXT_gpu_program_parameters,
+ GL_ATI_texture_env_combine3, GL_MESA_pack_invert, and GL_OES_EGL_image
+ extensions in Gallium drivers
+<li>GL_ARB_depth_clamp and GL_NV_depth_clamp extensions (in nv50 and r600
+ Gallium drivers)
+<li>GL_ARB_half_float_vertex extension (in nvfx, r300, r600, softpipe,
+ and llvmpipe Gallium drivers)
+<li>GL_EXT_draw_buffers2 (in nv50, r600, softpipe, and llvmpipe Gallium
+ drivers)
+<li>GL_EXT_texture_swizzle (in nvfx, r300, r600, softpipe, and llvmpipe
+ Gallium drivers)
+<li>GL_ATI_texture_mirror_once (in nvfx, nv50, r300, r600, softpipe, and
+ llvmpipe Gallium drivers)
+<li>GL_NV_conditional_render (in r300 Gallium driver)
+<li>Initial "signs of life" support for Sandybridge hardware in i965 DRI
+ driver.
</ul>
<h2>Bug fixes</h2>
+<p>This list is likely incomplete.</p>
<ul>
+<li>Massive improvements to the Gallium driver for R300-R500 Radeons; this
+ driver is now considered stable for use as a DRI (OpenGL) driver.
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=10908">Bug 10908</a> - GLSL: gl_FogParamaters gl_Fog built-in uniform not functioning</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=13753">Bug 13753</a> - Numerous bugs in GLSL uniform handling</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=16854">Bug 16854</a> - GLSL function call at global scope causes SEGV</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=16856">Bug 16856</a> - GLSL indexing of unsized array results in assertion failure</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=18659">Bug 18659</a> - Crash in shader/slang/slang_codegen.c _slang_gen_function_call_name()</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=19089">Bug 19089</a> - [GLSL] glsl1/shadow2D() cases fail</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=22622">Bug 22622</a> - [GM965 GLSL] noise*() cause GPU lockup</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=23743">Bug 23743</a> - For loop from 0 to 0 not optimized out</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=24553">Bug 24553</a> - shader compilation times explode when using more () pairs</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25664">Bug 25664</a> - [GLSL] re-declaring an empty array fails to compile</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25769">Bug 25769</a> - [GLSL] "float" can be implicitly converted to "int"</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25808">Bug 25808</a> - [GLSL] const variable is modified successfully</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25826">Bug 25826</a> - [GLSL] declaring an unsized array then re-declaring with a size fails</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25827">Bug 25827</a> - [GLSL] vector constructor accepts too many arguments successfully</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25829">Bug 25829</a> - [GLSL] allowing non-void function without returning value</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25830">Bug 25830</a> - [GLSL] allowing non-constant-expression as const declaration initializer</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25877">Bug 25877</a> - [GLSL 1.10] implicit conversion from "int" to "float" should not be allowed</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25878">Bug 25878</a> - [GLSL] sampler is converted to int successfully</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25994">Bug 25994</a> - [GM45][GLSL] 'return' statement in vertex shader unsupported</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=25999">Bug 25999</a> - [GLSL] embedded structure constructor fails to compile</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=26000">Bug 26000</a> - [GLSL] allowing different parameter qualifier between the function definition and declaration</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=26001">Bug 26001</a> - [GLSL 1.10] constructing matrix from matrix succeeds</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=26224">Bug 26224</a> - [GLSL] Cannot get location of a uniform struct member</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=26990">Bug 26990</a> - [GLSL] variable declaration in "while" fails to compile</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27004">Bug 27004</a> - [GLSL] allowing macro redefinition</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27060">Bug 27060</a> - [965] piglit glsl-fs-raytrace failure due to lack of function calls.</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27216">Bug 27216</a> - Assignment with a function call in an if statement causes an assertion failure</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27261">Bug 27261</a> - GLSL Compiler fails on the following vertex shader</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27265">Bug 27265</a> - GLSL Compiler doesnt link the attached vertex shader</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27388">Bug 27388</a> - [i965] piglit glsl-vs-arrays failure</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27403">Bug 27403</a> - GLSL struct causing "Invalid src register file ..." error</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=27914">Bug 27914</a> - GLSL compiler uses MUL+ADD where it could use MAD</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28055">Bug 28055</a> - glsl-texcoord-array fails GLSL compilation</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28374">Bug 28374</a> - SIGSEGV shader/slang/slang_typeinfo.c:534</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28748">Bug 28748</a> - [i965] uninlined function calls support</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28833">Bug 28833</a> - piglit/shaders/glsl-texcoord-array fail</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28834">Bug 28834</a> - Add support for system fpclassify to GL_OES_query_matrix function for OpenBSD / NetBSD</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28837">Bug 28837</a> - varying vec4 index support</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28845">Bug 28845</a> - The GLU tesselator code has some warnings</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28889">Bug 28889</a> - [regression] wine game crash</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28894">Bug 28894</a> - slang build fails if absolute path contains spaces</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28913">Bug 28913</a> - [GLSL] allowing two version statements</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28931">Bug 28931</a> - Floating Point Exception in Warzone2100 Trunk version</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28966">Bug 28966</a> - [r300g] Dynamic branching 3 demo does not run</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28967">Bug 28967</a> - slang/slang_emit.c:350: storage_to_src_reg: Assertion `index >= 0' failed.</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29013">Bug 29013</a> - [r300g] translate_rgb_op: unknown opcode ILLEGAL OPCODE</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29020">Bug 29020</a> - [r300g] Wine d3d9 tests hardlock</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=29910">Bug 29910</a> - Mesa advertises bogus GL_ARB_shading_language_120</li>
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30196">Bug 30196</a> - [GLSL] gl_TextureMatrix{Inverse,Transpose,InverseTranspose} unsupported</li>
</ul>
<UL>
<LI><A HREF="relnotes-7.9.html">7.9 release notes</A>
+<LI><A HREF="relnotes-7.8.3.html">7.8.3 release notes</A>
<LI><A HREF="relnotes-7.8.2.html">7.8.2 release notes</A>
<LI><A HREF="relnotes-7.8.1.html">7.8.1 release notes</A>
<LI><A HREF="relnotes-7.8.html">7.8 release notes</A>
+++ /dev/null
-#ifndef __gl_core_h_
-#define __gl_core_h_
-
-/*
- * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
- * Copyright (C) 1991-2000 Silicon Graphics, 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, 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 including the dates of first publication and
- * either this permission notice or a reference to
- * http://oss.sgi.com/projects/FreeB/
- * 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
- * SILICON GRAPHICS, INC. 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.
- *
- * Except as contained in this notice, the name of Silicon Graphics, Inc.
- * shall not be used in advertising or otherwise to promote the sale, use or
- * other dealings in this Software without prior written authorization from
- * Silicon Graphics, Inc.
- */
-
-#if !defined(_WIN32_WCE)
-#include <sys/types.h>
-#endif
-
-#define GL_CORE_SGI 1
-#define GL_CORE_MESA 2
-#define GL_CORE_APPLE 4
-#define GL_CORE_WINDOWS 8
-
-typedef struct __GLcontextRec __GLcontext;
-
-/*
-** This file defines the interface between the GL core and the surrounding
-** "operating system" that supports it (currently the GLX or WGL extensions).
-**
-** Members (data and function pointers) are documented as imported or
-** exported according to how they are used by the core rendering functions.
-** Imported members are initialized by the "operating system" and used by
-** the core functions. Exported members are initialized by the core functions
-** and used by the "operating system".
-*/
-
-/**
- * Mode and limit information for a context. This information is
- * kept around in the context so that values can be used during
- * command execution, and for returning information about the
- * context to the application.
- *
- * Instances of this structure are shared by the driver and the loader. To
- * maintain binary compatability, new fields \b must be added only to the
- * end of the structure.
- *
- * \sa _gl_context_modes_create
- */
-typedef struct __GLcontextModesRec {
- struct __GLcontextModesRec * next;
-
- GLboolean rgbMode;
- GLboolean floatMode;
- GLboolean colorIndexMode;
- GLuint doubleBufferMode;
- GLuint stereoMode;
-
- GLboolean haveAccumBuffer;
- GLboolean haveDepthBuffer;
- GLboolean haveStencilBuffer;
-
- GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */
- GLuint redMask, greenMask, blueMask, alphaMask;
- GLint rgbBits; /* total bits for rgb */
- GLint indexBits; /* total bits for colorindex */
-
- GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
- GLint depthBits;
- GLint stencilBits;
-
- GLint numAuxBuffers;
-
- GLint level;
-
- GLint pixmapMode;
-
- /* GLX */
- GLint visualID;
- GLint visualType; /**< One of the GLX X visual types. (i.e.,
- * \c GLX_TRUE_COLOR, etc.)
- */
-
- /* EXT_visual_rating / GLX 1.2 */
- GLint visualRating;
-
- /* EXT_visual_info / GLX 1.2 */
- GLint transparentPixel;
- /* colors are floats scaled to ints */
- GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
- GLint transparentIndex;
-
- /* ARB_multisample / SGIS_multisample */
- GLint sampleBuffers;
- GLint samples;
-
- /* SGIX_fbconfig / GLX 1.3 */
- GLint drawableType;
- GLint renderType;
- GLint xRenderable;
- GLint fbconfigID;
-
- /* SGIX_pbuffer / GLX 1.3 */
- GLint maxPbufferWidth;
- GLint maxPbufferHeight;
- GLint maxPbufferPixels;
- GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */
- GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */
-
- /* SGIX_visual_select_group */
- GLint visualSelectGroup;
-
- /* OML_swap_method */
- GLint swapMethod;
-
- GLint screen;
-
- /* EXT_texture_from_pixmap */
- GLint bindToTextureRgb;
- GLint bindToTextureRgba;
- GLint bindToMipmapTexture;
- GLint bindToTextureTargets;
- GLint yInverted;
-} __GLcontextModes;
-
-/* Several fields of __GLcontextModes can take these as values. Since
- * GLX header files may not be available everywhere they need to be used,
- * redefine them here.
- */
-#define GLX_NONE 0x8000
-#define GLX_SLOW_CONFIG 0x8001
-#define GLX_TRUE_COLOR 0x8002
-#define GLX_DIRECT_COLOR 0x8003
-#define GLX_PSEUDO_COLOR 0x8004
-#define GLX_STATIC_COLOR 0x8005
-#define GLX_GRAY_SCALE 0x8006
-#define GLX_STATIC_GRAY 0x8007
-#define GLX_TRANSPARENT_RGB 0x8008
-#define GLX_TRANSPARENT_INDEX 0x8009
-#define GLX_NON_CONFORMANT_CONFIG 0x800D
-#define GLX_SWAP_EXCHANGE_OML 0x8061
-#define GLX_SWAP_COPY_OML 0x8062
-#define GLX_SWAP_UNDEFINED_OML 0x8063
-
-#define GLX_DONT_CARE 0xFFFFFFFF
-
-#define GLX_RGBA_BIT 0x00000001
-#define GLX_COLOR_INDEX_BIT 0x00000002
-#define GLX_WINDOW_BIT 0x00000001
-#define GLX_PIXMAP_BIT 0x00000002
-#define GLX_PBUFFER_BIT 0x00000004
-
-#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
-#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
-#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
-#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
-#define GLX_Y_INVERTED_EXT 0x20D4
-
-#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
-#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
-#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
-
-#endif /* __gl_core_h_ */
os.symlink(os.path.basename(source), target)
def install(env, source, subdir):
- target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'], subdir)
+ target_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build_dir'], subdir)
env.Install(target_dir, source)
def install_program(env, source):
install(env, source, 'bin')
def install_shared_library(env, sources, version = ()):
- install_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build'])
+ install_dir = os.path.join(env.Dir('#.').srcnode().abspath, env['build_dir'])
version = tuple(map(str, version))
if env['SHLIBSUFFIX'] == '.dll':
dlls = env.FindIxes(sources, 'SHLIBPREFIX', 'SHLIBSUFFIX')
env['msvc'] = env['CC'] == 'cl'
# shortcuts
- debug = env['debug']
machine = env['machine']
platform = env['platform']
x86 = env['machine'] == 'x86'
gcc = env['gcc']
msvc = env['msvc']
+ # Backwards compatability with the debug= profile= options
+ if env['build'] == 'debug':
+ if not env['debug']:
+ print 'scons: debug option is deprecated: use instead build=release'
+ env['build'] = 'release'
+ if env['profile']:
+ print 'scons: profile option is deprecated: use instead build=profile'
+ env['build'] = 'profile'
+ if False:
+ # Enforce SConscripts to use the new build variable
+ env.popitem('debug')
+ env.popitem('profile')
+ else:
+ # Backwards portability with older sconscripts
+ if env['build'] in ('debug', 'checked'):
+ env['debug'] = True
+ env['profile'] = False
+ if env['build'] == 'profile':
+ env['debug'] = False
+ env['profile'] = True
+ if env['build'] == 'release':
+ env['debug'] = False
+ env['profile'] = False
+
# Put build output in a separate dir, which depends on the current
# configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
build_topdir = 'build'
build_subdir = env['platform']
if env['machine'] != 'generic':
build_subdir += '-' + env['machine']
- if env['debug']:
- build_subdir += "-debug"
- if env['profile']:
- build_subdir += "-profile"
+ if env['build'] != 'release':
+ build_subdir += '-' + env['build']
build_dir = os.path.join(build_topdir, build_subdir)
# Place the .sconsign file in the build dir too, to avoid issues with
# different scons versions building the same source file
- env['build'] = build_dir
+ env['build_dir'] = build_dir
env.SConsignFile(os.path.join(build_dir, '.sconsign'))
if 'SCONS_CACHE_DIR' in os.environ:
print 'scons: Using build cache in %s.' % (os.environ['SCONS_CACHE_DIR'],)
# C preprocessor options
cppdefines = []
- if debug:
+ if env['build'] in ('debug', 'checked'):
cppdefines += ['DEBUG']
else:
cppdefines += ['NDEBUG']
- if env['profile']:
+ if env['build'] == 'profile':
cppdefines += ['PROFILE']
if platform == 'windows':
cppdefines += [
'_SCL_SECURE_NO_WARNINGS',
'_SCL_SECURE_NO_DEPRECATE',
]
- if debug:
+ if env['build'] in ('debug', 'checked'):
cppdefines += ['_DEBUG']
if env['toolchain'] == 'winddk':
# Mimic WINDDK's builtin flags. See also:
('__BUILDMACHINE__', 'WinDDK'),
('FPO', '0'),
]
- if debug:
+ if env['build'] in ('debug', 'checked'):
cppdefines += [('DBG', 1)]
if platform == 'wince':
cppdefines += [
ccflags = [] # C & C++
if gcc:
ccversion = env['CCVERSION']
- if debug:
- ccflags += ['-O0', '-g3']
+ if env['build'] == 'debug':
+ ccflags += ['-O0']
elif ccversion.startswith('4.2.'):
# gcc 4.2.x optimizer is broken
print "warning: gcc 4.2.x optimizer is broken -- disabling optimizations"
- ccflags += ['-O0', '-g3']
+ ccflags += ['-O0']
else:
- ccflags += ['-O3', '-g3']
- if env['profile']:
+ ccflags += ['-O3']
+ ccflags += ['-g3']
+ if env['build'] in ('checked', 'profile'):
# See http://code.google.com/p/jrfonseca/wiki/Gprof2Dot#Which_options_should_I_pass_to_gcc_when_compiling_for_profiling?
ccflags += [
'-fno-omit-frame-pointer',
# See also:
# - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
# - cl /?
- if debug:
+ if env['build'] == 'debug':
ccflags += [
'/Od', # disable optimizations
'/Oi', # enable intrinsic functions
if env['platform'] == 'windows' and msvc:
# Choose the appropriate MSVC CRT
# http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
- if env['debug']:
+ if env['build'] in ('debug', 'checked'):
env.Append(CCFLAGS = ['/MTd'])
env.Append(SHCCFLAGS = ['/LDd'])
else:
else:
env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
if msvc:
- if not env['debug']:
+ if env['build'] != 'debug':
# enable Link-time Code Generation
linkflags += ['/LTCG']
env.Append(ARFLAGS = ['/LTCG'])
'/entry:DrvEnableDriver',
]
- if env['debug'] or env['profile']:
+ if env['build'] != 'release':
linkflags += [
'/MAP', # http://msdn.microsoft.com/en-us/library/k7xkk3e2.aspx
]
# Some of the LLVM C headers use the inline keyword without
# defining it.
env.Append(CPPDEFINES = [('inline', '__inline')])
- if env['debug']:
+ if env['build'] in ('debug', 'checked'):
# LLVM libraries are static, build with /MT, and they
# automatically link agains LIBCMT. When we're doing a
# debug build we'll be linking against LIBCMTD, so disable
host_cpu = os.environ.get('_HOSTCPUTYPE', 'i386')
target_cpu = os.environ.get('_TGTCPU', 'x86')
- if env['debug']:
+ if env['build'] == 'debug':
build = 'debug'
else:
build = 'retail'
_EGLContext *context;
EGLContext ret;
- if (config)
- _EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT, drv);
- else
- _EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
+ _EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
+
+ if (!config) {
+ /* config may be NULL if surfaceless */
+ if (!disp->Extensions.KHR_surfaceless_gles1 &&
+ !disp->Extensions.KHR_surfaceless_gles2 &&
+ !disp->Extensions.KHR_surfaceless_opengl)
+ RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT);
+ }
if (!share && share_list != EGL_NO_CONTEXT)
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
if (!context && ctx != EGL_NO_CONTEXT)
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
- if ((!draw_surf && draw != EGL_NO_SURFACE) ||
- (!read_surf && read != EGL_NO_SURFACE))
- RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
+ if (!draw_surf || !read_surf) {
+ /* surfaces may be NULL if surfaceless */
+ if (!disp->Extensions.KHR_surfaceless_gles1 &&
+ !disp->Extensions.KHR_surfaceless_gles2 &&
+ !disp->Extensions.KHR_surfaceless_opengl)
+ RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
+
+ if ((!draw_surf && draw != EGL_NO_SURFACE) ||
+ (!read_surf && read != EGL_NO_SURFACE))
+ RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
+ if (draw_surf || read_surf)
+ RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_FALSE);
+ }
ret = drv->API.MakeCurrent(drv, disp, draw_surf, read_surf, context);
EGLImageKHR ret;
_EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv);
+ if (!disp->Extensions.KHR_image_base)
+ RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR);
if (!context && ctx != EGL_NO_CONTEXT)
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
EGLBoolean ret;
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
+ if (!disp->Extensions.KHR_image_base)
+ RETURN_EGL_EVAL(disp, EGL_FALSE);
if (!img)
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
EGLSyncKHR ret;
_EGL_CHECK_DISPLAY(disp, EGL_NO_SYNC_KHR, drv);
+ if (!disp->Extensions.KHR_reusable_sync)
+ RETURN_EGL_EVAL(disp, EGL_NO_SYNC_KHR);
sync = drv->API.CreateSyncKHR(drv, disp, type, attrib_list);
ret = (sync) ? _eglLinkSync(sync, disp) : EGL_NO_SYNC_KHR;
EGLBoolean ret;
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
+ assert(disp->Extensions.KHR_reusable_sync);
+
_eglUnlinkSync(s);
ret = drv->API.DestroySyncKHR(drv, disp, s);
EGLint ret;
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
+ assert(disp->Extensions.KHR_reusable_sync);
ret = drv->API.ClientWaitSyncKHR(drv, disp, s, flags, timeout);
RETURN_EGL_EVAL(disp, ret);
EGLBoolean ret;
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
+ assert(disp->Extensions.KHR_reusable_sync);
ret = drv->API.SignalSyncKHR(drv, disp, s, mode);
RETURN_EGL_EVAL(disp, ret);
EGLBoolean ret;
_EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv);
+ assert(disp->Extensions.KHR_reusable_sync);
ret = drv->API.GetSyncAttribKHR(drv, disp, s, attribute, value);
RETURN_EGL_EVAL(disp, ret);
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
+ if (!disp->Extensions.NOK_swap_region)
+ RETURN_EGL_EVAL(disp, EGL_FALSE);
+
/* surface must be bound to current context in EGL 1.4 */
if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface)
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
- if (drv->API.SwapBuffersRegionNOK)
- ret = drv->API.SwapBuffersRegionNOK(drv, disp, surf, numRects, rects);
- else
- ret = drv->API.SwapBuffers(drv, disp, surf);
+ ret = drv->API.SwapBuffersRegionNOK(drv, disp, surf, numRects, rects);
RETURN_EGL_EVAL(disp, ret);
}
EGLImageKHR ret;
_EGL_CHECK_DISPLAY(disp, EGL_NO_IMAGE_KHR, drv);
+ if (!disp->Extensions.MESA_drm_image)
+ RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR);
img = drv->API.CreateDRMImageMESA(drv, disp, attr_list);
ret = (img) ? _eglLinkImage(img, disp) : EGL_NO_IMAGE_KHR;
EGLBoolean ret;
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
+ assert(disp->Extensions.MESA_drm_image);
+
if (!img)
RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE);
* IDs are from 1 to N respectively.
*/
void
-_eglInitConfig(_EGLConfig *config, _EGLDisplay *dpy, EGLint id)
+_eglInitConfig(_EGLConfig *conf, _EGLDisplay *dpy, EGLint id)
{
- memset(config, 0, sizeof(*config));
+ memset(conf, 0, sizeof(*conf));
- config->Display = dpy;
+ conf->Display = dpy;
/* some attributes take non-zero default values */
- SET_CONFIG_ATTRIB(config, EGL_CONFIG_ID, id);
- SET_CONFIG_ATTRIB(config, EGL_CONFIG_CAVEAT, EGL_NONE);
- SET_CONFIG_ATTRIB(config, EGL_TRANSPARENT_TYPE, EGL_NONE);
- SET_CONFIG_ATTRIB(config, EGL_NATIVE_VISUAL_TYPE, EGL_NONE);
-#ifdef EGL_VERSION_1_2
- SET_CONFIG_ATTRIB(config, EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
-#endif /* EGL_VERSION_1_2 */
+ conf->ConfigID = id;
+ conf->ConfigCaveat = EGL_NONE;
+ conf->TransparentType = EGL_NONE;
+ conf->NativeVisualType = EGL_NONE;
+ conf->ColorBufferType = EGL_RGB_BUFFER;
}
_eglAddConfig(_EGLDisplay *dpy, _EGLConfig *conf)
{
/* sanity check */
- assert(GET_CONFIG_ATTRIB(conf, EGL_CONFIG_ID) > 0);
+ assert(conf->ConfigID > 0);
if (!dpy->Configs) {
dpy->Configs = _eglCreateArray("Config", 16);
EGLint default_value;
} _eglValidationTable[] =
{
+ /* core */
{ EGL_BUFFER_SIZE, ATTRIB_TYPE_INTEGER,
ATTRIB_CRITERION_ATLEAST,
0 },
{ EGL_TRANSPARENT_BLUE_VALUE, ATTRIB_TYPE_INTEGER,
ATTRIB_CRITERION_EXACT,
EGL_DONT_CARE },
- /* these are not real attributes */
{ EGL_MATCH_NATIVE_PIXMAP, ATTRIB_TYPE_PSEUDO,
ATTRIB_CRITERION_SPECIAL,
EGL_NONE },
- /* there is a gap before EGL_SAMPLES */
- { 0x3030, ATTRIB_TYPE_PSEUDO,
- ATTRIB_CRITERION_IGNORE,
- 0 },
- { EGL_NONE, ATTRIB_TYPE_PSEUDO,
- ATTRIB_CRITERION_IGNORE,
- 0 },
-
+ /* extensions */
{ EGL_Y_INVERTED_NOK, ATTRIB_TYPE_BOOLEAN,
ATTRIB_CRITERION_EXACT,
- EGL_DONT_CARE },
-
+ EGL_DONT_CARE }
};
{
EGLint i, attr, val;
EGLBoolean valid = EGL_TRUE;
- EGLint red_size = 0, green_size = 0, blue_size = 0, luminance_size = 0;
- EGLint alpha_size = 0, buffer_size = 0;
-
- /* all attributes should have been listed */
- assert(ARRAY_SIZE(_eglValidationTable) == _EGL_CONFIG_NUM_ATTRIBS);
/* check attributes by their types */
for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) {
EGLint mask;
attr = _eglValidationTable[i].attr;
- val = GET_CONFIG_ATTRIB(conf, attr);
+ val = _eglGetConfigKey(conf, attr);
switch (_eglValidationTable[i].type) {
case ATTRIB_TYPE_INTEGER:
break;
case EGL_SAMPLE_BUFFERS:
/* there can be at most 1 sample buffer */
- if (val > 1)
+ if (val > 1 || val < 0)
valid = EGL_FALSE;
break;
- case EGL_RED_SIZE:
- red_size = val;
- break;
- case EGL_GREEN_SIZE:
- green_size = val;
- break;
- case EGL_BLUE_SIZE:
- blue_size = val;
- break;
- case EGL_LUMINANCE_SIZE:
- luminance_size = val;
- break;
- case EGL_ALPHA_SIZE:
- alpha_size = val;
- break;
- case EGL_BUFFER_SIZE:
- buffer_size = val;
+ default:
+ if (val < 0)
+ valid = EGL_FALSE;
break;
}
- if (val < 0)
- valid = EGL_FALSE;
break;
case ATTRIB_TYPE_BOOLEAN:
if (val != EGL_TRUE && val != EGL_FALSE)
/* now check for conflicting attribute values */
- switch (GET_CONFIG_ATTRIB(conf, EGL_COLOR_BUFFER_TYPE)) {
+ switch (conf->ColorBufferType) {
case EGL_RGB_BUFFER:
- if (luminance_size)
+ if (conf->LuminanceSize)
valid = EGL_FALSE;
- if (red_size + green_size + blue_size + alpha_size != buffer_size)
+ if (conf->RedSize + conf->GreenSize +
+ conf->BlueSize + conf->AlphaSize != conf->BufferSize)
valid = EGL_FALSE;
break;
case EGL_LUMINANCE_BUFFER:
- if (red_size || green_size || blue_size)
+ if (conf->RedSize || conf->GreenSize || conf->BlueSize)
valid = EGL_FALSE;
- if (luminance_size + alpha_size != buffer_size)
+ if (conf->LuminanceSize + conf->AlphaSize != conf->BufferSize)
valid = EGL_FALSE;
break;
}
return EGL_FALSE;
}
- val = GET_CONFIG_ATTRIB(conf, EGL_SAMPLE_BUFFERS);
- if (!val && GET_CONFIG_ATTRIB(conf, EGL_SAMPLES))
+ if (!conf->SampleBuffers && conf->Samples)
valid = EGL_FALSE;
if (!valid) {
_eglLog(_EGL_DEBUG, "conflicting samples and sample buffers");
return EGL_FALSE;
}
- val = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE);
- if (!(val & EGL_WINDOW_BIT)) {
- if (GET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_ID) != 0 ||
- GET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE) != EGL_NONE)
+ if (!(conf->SurfaceType & EGL_WINDOW_BIT)) {
+ if (conf->NativeVisualID != 0 || conf->NativeVisualType != EGL_NONE)
valid = EGL_FALSE;
}
- if (!(val & EGL_PBUFFER_BIT)) {
- if (GET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGB) ||
- GET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGBA))
+ if (!(conf->SurfaceType & EGL_PBUFFER_BIT)) {
+ if (conf->BindToTextureRGB || conf->BindToTextureRGBA)
valid = EGL_FALSE;
}
if (!valid) {
continue;
attr = _eglValidationTable[i].attr;
- cmp = GET_CONFIG_ATTRIB(criteria, attr);
+ cmp = _eglGetConfigKey(criteria, attr);
if (cmp == EGL_DONT_CARE)
continue;
- val = GET_CONFIG_ATTRIB(conf, attr);
+ val = _eglGetConfigKey(conf, attr);
switch (_eglValidationTable[i].criterion) {
case ATTRIB_CRITERION_EXACT:
if (val != cmp)
static INLINE EGLBoolean
_eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr)
{
- if (_eglIndexConfig(conf, attr) < 0)
+ if (_eglOffsetOfConfig(attr) < 0)
return EGL_FALSE;
- /* there are some holes in the range */
switch (attr) {
- case 0x3030 /* a gap before EGL_SAMPLES */:
- case EGL_NONE:
-#ifdef EGL_VERSION_1_4
case EGL_MATCH_NATIVE_PIXMAP:
-#endif
return EGL_FALSE;
case EGL_Y_INVERTED_NOK:
return conf->Display->Extensions.NOK_texture_from_pixmap;
_eglParseConfigAttribList(_EGLConfig *conf, const EGLint *attrib_list)
{
EGLint attr, val, i;
- EGLint config_id = 0, level = 0;
- EGLBoolean has_native_visual_type = EGL_FALSE;
- EGLBoolean has_transparent_color = EGL_FALSE;
/* reset to default values */
for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) {
attr = _eglValidationTable[i].attr;
val = _eglValidationTable[i].default_value;
- SET_CONFIG_ATTRIB(conf, attr, val);
+ _eglSetConfigKey(conf, attr, val);
}
/* parse the list */
if (!_eglIsConfigAttribValid(conf, attr))
return EGL_FALSE;
-
- SET_CONFIG_ATTRIB(conf, attr, val);
- /* rememeber some attributes for post-processing */
- switch (attr) {
- case EGL_CONFIG_ID:
- config_id = val;
- break;
- case EGL_LEVEL:
- level = val;
- break;
- case EGL_NATIVE_VISUAL_TYPE:
- has_native_visual_type = EGL_TRUE;
- break;
- case EGL_TRANSPARENT_RED_VALUE:
- case EGL_TRANSPARENT_GREEN_VALUE:
- case EGL_TRANSPARENT_BLUE_VALUE:
- has_transparent_color = EGL_TRUE;
- break;
- default:
- break;
- }
+ _eglSetConfigKey(conf, attr, val);
}
if (!_eglValidateConfig(conf, EGL_TRUE))
return EGL_FALSE;
/* the spec says that EGL_LEVEL cannot be EGL_DONT_CARE */
- if (level == EGL_DONT_CARE)
+ if (conf->Level == EGL_DONT_CARE)
return EGL_FALSE;
/* ignore other attributes when EGL_CONFIG_ID is given */
- if (config_id > 0) {
- _eglResetConfigKeys(conf, EGL_DONT_CARE);
- SET_CONFIG_ATTRIB(conf, EGL_CONFIG_ID, config_id);
+ if (conf->ConfigID > 0) {
+ for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) {
+ attr = _eglValidationTable[i].attr;
+ if (attr != EGL_CONFIG_ID)
+ _eglSetConfigKey(conf, attr, EGL_DONT_CARE);
+ }
}
else {
- if (has_native_visual_type) {
- val = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE);
- if (!(val & EGL_WINDOW_BIT))
- SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, EGL_DONT_CARE);
- }
+ if (!(conf->SurfaceType & EGL_WINDOW_BIT))
+ conf->NativeVisualType = EGL_DONT_CARE;
- if (has_transparent_color) {
- val = GET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_TYPE);
- if (val == EGL_NONE) {
- SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_RED_VALUE,
- EGL_DONT_CARE);
- SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_GREEN_VALUE,
- EGL_DONT_CARE);
- SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_BLUE_VALUE,
- EGL_DONT_CARE);
- }
+ if (conf->TransparentType == EGL_NONE) {
+ conf->TransparentRedValue = EGL_DONT_CARE;
+ conf->TransparentGreenValue = EGL_DONT_CARE;
+ conf->TransparentBlueValue = EGL_DONT_CARE;
}
}
EGL_ALPHA_MASK_SIZE,
};
EGLint val1, val2;
- EGLBoolean rgb_buffer;
EGLint i;
if (conf1 == conf2)
/* the enum values have the desired ordering */
assert(EGL_NONE < EGL_SLOW_CONFIG);
assert(EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG);
- val1 = GET_CONFIG_ATTRIB(conf1, EGL_CONFIG_CAVEAT);
- val2 = GET_CONFIG_ATTRIB(conf2, EGL_CONFIG_CAVEAT);
- if (val1 != val2)
- return (val1 - val2);
+ val1 = conf1->ConfigCaveat - conf2->ConfigCaveat;
+ if (val1)
+ return val1;
/* the enum values have the desired ordering */
assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER);
- val1 = GET_CONFIG_ATTRIB(conf1, EGL_COLOR_BUFFER_TYPE);
- val2 = GET_CONFIG_ATTRIB(conf2, EGL_COLOR_BUFFER_TYPE);
- if (val1 != val2)
- return (val1 - val2);
- rgb_buffer = (val1 == EGL_RGB_BUFFER);
+ val1 = conf1->ColorBufferType - conf2->ColorBufferType;
+ if (val1)
+ return val1;
if (criteria) {
val1 = val2 = 0;
- if (rgb_buffer) {
- if (GET_CONFIG_ATTRIB(criteria, EGL_RED_SIZE) > 0) {
- val1 += GET_CONFIG_ATTRIB(conf1, EGL_RED_SIZE);
- val2 += GET_CONFIG_ATTRIB(conf2, EGL_RED_SIZE);
+ if (conf1->ColorBufferType == EGL_RGB_BUFFER) {
+ if (criteria->RedSize > 0) {
+ val1 += conf1->RedSize;
+ val2 += conf2->RedSize;
}
- if (GET_CONFIG_ATTRIB(criteria, EGL_GREEN_SIZE) > 0) {
- val1 += GET_CONFIG_ATTRIB(conf1, EGL_GREEN_SIZE);
- val2 += GET_CONFIG_ATTRIB(conf2, EGL_GREEN_SIZE);
+ if (criteria->GreenSize > 0) {
+ val1 += conf1->GreenSize;
+ val2 += conf2->GreenSize;
}
- if (GET_CONFIG_ATTRIB(criteria, EGL_BLUE_SIZE) > 0) {
- val1 += GET_CONFIG_ATTRIB(conf1, EGL_BLUE_SIZE);
- val2 += GET_CONFIG_ATTRIB(conf2, EGL_BLUE_SIZE);
+ if (criteria->BlueSize > 0) {
+ val1 += conf1->BlueSize;
+ val2 += conf2->BlueSize;
}
}
else {
- if (GET_CONFIG_ATTRIB(criteria, EGL_LUMINANCE_SIZE) > 0) {
- val1 += GET_CONFIG_ATTRIB(conf1, EGL_LUMINANCE_SIZE);
- val2 += GET_CONFIG_ATTRIB(conf2, EGL_LUMINANCE_SIZE);
+ if (criteria->LuminanceSize > 0) {
+ val1 += conf1->LuminanceSize;
+ val2 += conf2->LuminanceSize;
}
}
- if (GET_CONFIG_ATTRIB(criteria, EGL_ALPHA_SIZE) > 0) {
- val1 += GET_CONFIG_ATTRIB(conf1, EGL_ALPHA_SIZE);
- val2 += GET_CONFIG_ATTRIB(conf2, EGL_ALPHA_SIZE);
+ if (criteria->AlphaSize > 0) {
+ val1 += conf1->AlphaSize;
+ val2 += conf2->AlphaSize;
}
}
else {
return (val2 - val1);
for (i = 0; i < ARRAY_SIZE(compare_attribs); i++) {
- val1 = GET_CONFIG_ATTRIB(conf1, compare_attribs[i]);
- val2 = GET_CONFIG_ATTRIB(conf2, compare_attribs[i]);
+ val1 = _eglGetConfigKey(conf1, compare_attribs[i]);
+ val2 = _eglGetConfigKey(conf2, compare_attribs[i]);
if (val1 != val2)
return (val1 - val2);
}
/* EGL_NATIVE_VISUAL_TYPE cannot be compared here */
- if (compare_id) {
- val1 = GET_CONFIG_ATTRIB(conf1, EGL_CONFIG_ID);
- val2 = GET_CONFIG_ATTRIB(conf2, EGL_CONFIG_ID);
- assert(val1 != val2);
- }
- else {
- val1 = val2 = 0;
- }
-
- return (val1 - val2);
+ return (compare_id) ? (conf1->ConfigID - conf2->ConfigID) : 0;
}
if (!value)
return _eglError(EGL_BAD_PARAMETER, "eglGetConfigAttrib");
- *value = GET_CONFIG_ATTRIB(conf, attribute);
+ *value = _eglGetConfigKey(conf, attribute);
return EGL_TRUE;
}
#include "egltypedefs.h"
-#define _EGL_CONFIG_FIRST_ATTRIB EGL_BUFFER_SIZE
-#define _EGL_CONFIG_LAST_ATTRIB EGL_CONFORMANT
-#define _EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS \
- (_EGL_CONFIG_LAST_ATTRIB - _EGL_CONFIG_FIRST_ATTRIB + 1)
-
-/* Attributes outside the contiguous block:
- *
- * EGL_Y_INVERTED_NOK
- */
-#define _EGL_CONFIG_FIRST_EXTRA_ATTRIB _EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS
-#define _EGL_CONFIG_NUM_EXTRA_ATTRIBS 1
-
-#define _EGL_CONFIG_NUM_ATTRIBS \
- _EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS + _EGL_CONFIG_NUM_EXTRA_ATTRIBS
-
-
+/* update _eglValidationTable and _eglOffsetOfConfig before updating this
+ * struct */
struct _egl_config
{
_EGLDisplay *Display;
- EGLint Storage[_EGL_CONFIG_NUM_ATTRIBS];
+
+ /* core */
+ EGLint BufferSize;
+ EGLint AlphaSize;
+ EGLint BlueSize;
+ EGLint GreenSize;
+ EGLint RedSize;
+ EGLint DepthSize;
+ EGLint StencilSize;
+ EGLint ConfigCaveat;
+ EGLint ConfigID;
+ EGLint Level;
+ EGLint MaxPbufferHeight;
+ EGLint MaxPbufferPixels;
+ EGLint MaxPbufferWidth;
+ EGLint NativeRenderable;
+ EGLint NativeVisualID;
+ EGLint NativeVisualType;
+ EGLint Samples;
+ EGLint SampleBuffers;
+ EGLint SurfaceType;
+ EGLint TransparentType;
+ EGLint TransparentBlueValue;
+ EGLint TransparentGreenValue;
+ EGLint TransparentRedValue;
+ EGLint BindToTextureRGB;
+ EGLint BindToTextureRGBA;
+ EGLint MinSwapInterval;
+ EGLint MaxSwapInterval;
+ EGLint LuminanceSize;
+ EGLint AlphaMaskSize;
+ EGLint ColorBufferType;
+ EGLint RenderableType;
+ EGLint MatchNativePixmap;
+ EGLint Conformant;
+
+ /* extensions */
+ EGLint YInvertedNOK;
};
/**
- * Given a key, return an index into the storage of the config.
- * Return -1 if the key is invalid.
+ * Map an EGL attribute enum to the offset of the member in _EGLConfig.
*/
static INLINE EGLint
-_eglIndexConfig(const _EGLConfig *conf, EGLint key)
+_eglOffsetOfConfig(EGLint attr)
{
- (void) conf;
- if (key >= _EGL_CONFIG_FIRST_ATTRIB &&
- key < _EGL_CONFIG_FIRST_ATTRIB + _EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS)
- return key - _EGL_CONFIG_FIRST_ATTRIB;
-
- switch (key) {
- case EGL_Y_INVERTED_NOK:
- return _EGL_CONFIG_FIRST_EXTRA_ATTRIB;
+ switch (attr) {
+#define ATTRIB_MAP(attr, memb) case attr: return offsetof(_EGLConfig, memb)
+ /* core */
+ ATTRIB_MAP(EGL_BUFFER_SIZE, BufferSize);
+ ATTRIB_MAP(EGL_ALPHA_SIZE, AlphaSize);
+ ATTRIB_MAP(EGL_BLUE_SIZE, BlueSize);
+ ATTRIB_MAP(EGL_GREEN_SIZE, GreenSize);
+ ATTRIB_MAP(EGL_RED_SIZE, RedSize);
+ ATTRIB_MAP(EGL_DEPTH_SIZE, DepthSize);
+ ATTRIB_MAP(EGL_STENCIL_SIZE, StencilSize);
+ ATTRIB_MAP(EGL_CONFIG_CAVEAT, ConfigCaveat);
+ ATTRIB_MAP(EGL_CONFIG_ID, ConfigID);
+ ATTRIB_MAP(EGL_LEVEL, Level);
+ ATTRIB_MAP(EGL_MAX_PBUFFER_HEIGHT, MaxPbufferHeight);
+ ATTRIB_MAP(EGL_MAX_PBUFFER_PIXELS, MaxPbufferPixels);
+ ATTRIB_MAP(EGL_MAX_PBUFFER_WIDTH, MaxPbufferWidth);
+ ATTRIB_MAP(EGL_NATIVE_RENDERABLE, NativeRenderable);
+ ATTRIB_MAP(EGL_NATIVE_VISUAL_ID, NativeVisualID);
+ ATTRIB_MAP(EGL_NATIVE_VISUAL_TYPE, NativeVisualType);
+ ATTRIB_MAP(EGL_SAMPLES, Samples);
+ ATTRIB_MAP(EGL_SAMPLE_BUFFERS, SampleBuffers);
+ ATTRIB_MAP(EGL_SURFACE_TYPE, SurfaceType);
+ ATTRIB_MAP(EGL_TRANSPARENT_TYPE, TransparentType);
+ ATTRIB_MAP(EGL_TRANSPARENT_BLUE_VALUE, TransparentBlueValue);
+ ATTRIB_MAP(EGL_TRANSPARENT_GREEN_VALUE, TransparentGreenValue);
+ ATTRIB_MAP(EGL_TRANSPARENT_RED_VALUE, TransparentRedValue);
+ ATTRIB_MAP(EGL_BIND_TO_TEXTURE_RGB, BindToTextureRGB);
+ ATTRIB_MAP(EGL_BIND_TO_TEXTURE_RGBA, BindToTextureRGBA);
+ ATTRIB_MAP(EGL_MIN_SWAP_INTERVAL, MinSwapInterval);
+ ATTRIB_MAP(EGL_MAX_SWAP_INTERVAL, MaxSwapInterval);
+ ATTRIB_MAP(EGL_LUMINANCE_SIZE, LuminanceSize);
+ ATTRIB_MAP(EGL_ALPHA_MASK_SIZE, AlphaMaskSize);
+ ATTRIB_MAP(EGL_COLOR_BUFFER_TYPE, ColorBufferType);
+ ATTRIB_MAP(EGL_RENDERABLE_TYPE, RenderableType);
+ ATTRIB_MAP(EGL_MATCH_NATIVE_PIXMAP, MatchNativePixmap);
+ ATTRIB_MAP(EGL_CONFORMANT, Conformant);
+ /* extensions */
+ ATTRIB_MAP(EGL_Y_INVERTED_NOK, YInvertedNOK);
+#undef ATTRIB_MAP
default:
return -1;
}
}
-/**
- * Reset all keys in the config to a given value.
- */
-static INLINE void
-_eglResetConfigKeys(_EGLConfig *conf, EGLint val)
-{
- EGLint i;
- for (i = 0; i < _EGL_CONFIG_NUM_ATTRIBS; i++)
- conf->Storage[i] = val;
-}
-
-
/**
* Update a config for a given key.
*
static INLINE void
_eglSetConfigKey(_EGLConfig *conf, EGLint key, EGLint val)
{
- EGLint idx = _eglIndexConfig(conf, key);
- assert(idx >= 0);
- conf->Storage[idx] = val;
+ EGLint offset = _eglOffsetOfConfig(key);
+ assert(offset >= 0);
+ *((EGLint *) ((char *) conf + offset)) = val;
}
static INLINE EGLint
_eglGetConfigKey(const _EGLConfig *conf, EGLint key)
{
- EGLint idx = _eglIndexConfig(conf, key);
- assert(idx >= 0);
- return conf->Storage[idx];
+ EGLint offset = _eglOffsetOfConfig(key);
+ assert(offset >= 0);
+ return *((EGLint *) ((char *) conf + offset));
}
err = _eglParseContextAttribList(ctx, attrib_list);
if (err == EGL_SUCCESS && ctx->Config) {
- EGLint renderable_type, api_bit;
+ EGLint api_bit;
- renderable_type = GET_CONFIG_ATTRIB(ctx->Config, EGL_RENDERABLE_TYPE);
api_bit = _eglGetContextAPIBit(ctx);
- if (!(renderable_type & api_bit)) {
+ if (!(ctx->Config->RenderableType & api_bit)) {
_eglLog(_EGL_DEBUG, "context api is 0x%x while config supports 0x%x",
- api_bit, renderable_type);
+ api_bit, ctx->Config->RenderableType);
err = EGL_BAD_CONFIG;
}
}
switch (attribute) {
case EGL_CONFIG_ID:
- *value = GET_CONFIG_ATTRIB(c->Config, EGL_CONFIG_ID);
+ if (!c->Config)
+ return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
+ *value = c->Config->ConfigID;
break;
case EGL_CONTEXT_CLIENT_VERSION:
*value = c->ClientVersion;
#include "eglmisc.h"
#include "eglmode.h"
#include "eglscreen.h"
-#include "eglstring.h"
#include "eglsurface.h"
#include "eglimage.h"
#include "eglsync.h"
static void
_eglClampSwapInterval(_EGLSurface *surf, EGLint interval)
{
- EGLint bound = GET_CONFIG_ATTRIB(surf->Config, EGL_MAX_SWAP_INTERVAL);
+ EGLint bound = surf->Config->MaxSwapInterval;
if (interval >= bound) {
interval = bound;
}
else {
- bound = GET_CONFIG_ATTRIB(surf->Config, EGL_MIN_SWAP_INTERVAL);
+ bound = surf->Config->MinSwapInterval;
if (interval < bound)
interval = bound;
}
return EGL_FALSE;
}
- if ((GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE) & type) == 0) {
+ if ((conf->SurfaceType & type) == 0) {
/* The config can't be used to create a surface of this type */
_eglError(EGL_BAD_CONFIG, func);
return EGL_FALSE;
*value = surface->Height;
break;
case EGL_CONFIG_ID:
- *value = GET_CONFIG_ATTRIB(surface->Config, EGL_CONFIG_ID);
+ *value = surface->Config->ConfigID;
break;
case EGL_LARGEST_PBUFFER:
*value = surface->LargestPbuffer;
switch (attribute) {
case EGL_MIPMAP_LEVEL:
- confval = GET_CONFIG_ATTRIB(surface->Config, EGL_RENDERABLE_TYPE);
+ confval = surface->Config->RenderableType;
if (!(confval & (EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT))) {
err = EGL_BAD_PARAMETER;
break;
case EGL_MULTISAMPLE_RESOLVE_DEFAULT:
break;
case EGL_MULTISAMPLE_RESOLVE_BOX:
- confval = GET_CONFIG_ATTRIB(surface->Config, EGL_SURFACE_TYPE);
+ confval = surface->Config->SurfaceType;
if (!(confval & EGL_MULTISAMPLE_RESOLVE_BOX_BIT))
err = EGL_BAD_MATCH;
break;
case EGL_BUFFER_DESTROYED:
break;
case EGL_BUFFER_PRESERVED:
- confval = GET_CONFIG_ATTRIB(surface->Config, EGL_SURFACE_TYPE);
+ confval = surface->Config->SurfaceType;
if (!(confval & EGL_SWAP_BEHAVIOR_PRESERVED_BIT))
err = EGL_BAD_MATCH;
break;
gallivm/lp_bld_struct.c \
gallivm/lp_bld_swizzle.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 \
'gallivm/lp_bld_struct.c',
'gallivm/lp_bld_swizzle.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->samplers[i] = NULL;
draw->num_samplers = num;
+
+#ifdef HAVE_LLVM
+ if (draw->llvm)
+ draw_llvm_set_sampler_state(draw);
+#endif
}
void
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
- uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS],
- uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS],
- const void *data[DRAW_MAX_TEXTURE_LEVELS])
+ uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
+ uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
+ const void *data[PIPE_MAX_TEXTURE_LEVELS])
{
#ifdef HAVE_LLVM
if(draw->llvm)
struct draw_fragment_shader;
struct tgsi_sampler;
-#define DRAW_MAX_TEXTURE_LEVELS 13 /* 4K x 4K for now */
struct draw_context *draw_create( struct pipe_context *pipe );
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
- uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS],
- uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS],
- const void *data[DRAW_MAX_TEXTURE_LEVELS]);
+ uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
+ uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
+ const void *data[PIPE_MAX_TEXTURE_LEVELS]);
/*
#include "tgsi/tgsi_dump.h"
#include "util/u_cpu_detect.h"
+#include "util/u_math.h"
#include "util/u_pointer.h"
#include "util/u_string.h"
elem_types[DRAW_JIT_TEXTURE_DEPTH] = LLVMInt32Type();
elem_types[DRAW_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32Type();
elem_types[DRAW_JIT_TEXTURE_ROW_STRIDE] =
- LLVMArrayType(LLVMInt32Type(), DRAW_MAX_TEXTURE_LEVELS);
+ LLVMArrayType(LLVMInt32Type(), PIPE_MAX_TEXTURE_LEVELS);
elem_types[DRAW_JIT_TEXTURE_IMG_STRIDE] =
- LLVMArrayType(LLVMInt32Type(), DRAW_MAX_TEXTURE_LEVELS);
+ LLVMArrayType(LLVMInt32Type(), PIPE_MAX_TEXTURE_LEVELS);
elem_types[DRAW_JIT_TEXTURE_DATA] =
LLVMArrayType(LLVMPointerType(LLVMInt8Type(), 0),
- DRAW_MAX_TEXTURE_LEVELS);
+ PIPE_MAX_TEXTURE_LEVELS);
elem_types[DRAW_JIT_TEXTURE_MIN_LOD] = LLVMFloatType();
elem_types[DRAW_JIT_TEXTURE_MAX_LOD] = LLVMFloatType();
elem_types[DRAW_JIT_TEXTURE_LOD_BIAS] = LLVMFloatType();
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
- uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS],
- uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS],
- const void *data[DRAW_MAX_TEXTURE_LEVELS])
+ uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
+ uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
+ const void *data[PIPE_MAX_TEXTURE_LEVELS])
{
unsigned j;
struct draw_jit_texture *jit_tex;
}
}
+
+void
+draw_llvm_set_sampler_state(struct draw_context *draw)
+{
+ unsigned i;
+
+ for (i = 0; i < draw->num_samplers; i++) {
+ struct draw_jit_texture *jit_tex = &draw->llvm->jit_context.textures[i];
+
+ if (draw->samplers[i]) {
+ jit_tex->min_lod = draw->samplers[i]->min_lod;
+ jit_tex->max_lod = draw->samplers[i]->max_lod;
+ jit_tex->lod_bias = draw->samplers[i]->lod_bias;
+ COPY_4V(jit_tex->border_color, draw->samplers[i]->border_color);
+ }
+ }
+}
+
+
void
draw_llvm_destroy_variant(struct draw_llvm_variant *variant)
{
#include <llvm-c/Target.h>
#include <llvm-c/ExecutionEngine.h>
-#define DRAW_MAX_TEXTURE_LEVELS 13 /* 4K x 4K for now */
struct draw_llvm;
struct llvm_vertex_shader;
uint32_t height;
uint32_t depth;
uint32_t last_level;
- uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS];
- uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS];
- const void *data[DRAW_MAX_TEXTURE_LEVELS];
+ uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS];
+ uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
+ const void *data[PIPE_MAX_TEXTURE_LEVELS];
float min_lod;
float max_lod;
float lod_bias;
draw_llvm_sampler_soa_create(const struct lp_sampler_static_state *static_state,
LLVMValueRef context_ptr);
+void
+draw_llvm_set_sampler_state(struct draw_context *draw);
+
void
draw_llvm_set_mapped_texture(struct draw_context *draw,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t last_level,
- uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS],
- uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS],
- const void *data[DRAW_MAX_TEXTURE_LEVELS]);
+ uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
+ uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
+ const void *data[PIPE_MAX_TEXTURE_LEVELS]);
#endif
};
+/**
+ * Helper for SSE4.1's ROUNDxx instructions.
+ *
+ * NOTE: In the SSE4.1's nearest mode, if two values are equally close, the
+ * result is the even value. That is, rounding 2.5 will be 2.0, and not 3.0.
+ */
static INLINE LLVMValueRef
lp_build_round_sse41(struct lp_build_context *bld,
LLVMValueRef a,
enum lp_build_round_sse41_mode mode)
{
const struct lp_type type = bld->type;
- LLVMTypeRef vec_type = lp_build_vec_type(type);
+ LLVMTypeRef i32t = LLVMInt32Type();
const char *intrinsic;
+ LLVMValueRef res;
assert(type.floating);
- assert(type.width*type.length == 128);
+
assert(lp_check_value(type, a));
assert(util_cpu_caps.has_sse4_1);
- switch(type.width) {
- case 32:
- intrinsic = "llvm.x86.sse41.round.ps";
- break;
- case 64:
- intrinsic = "llvm.x86.sse41.round.pd";
- break;
- default:
- assert(0);
- return bld->undef;
+ if (type.length == 1) {
+ LLVMTypeRef vec_type;
+ LLVMValueRef undef;
+ LLVMValueRef args[3];
+ LLVMValueRef index0 = LLVMConstInt(i32t, 0, 0);
+
+ switch(type.width) {
+ case 32:
+ intrinsic = "llvm.x86.sse41.round.ss";
+ break;
+ case 64:
+ intrinsic = "llvm.x86.sse41.round.sd";
+ break;
+ default:
+ assert(0);
+ return bld->undef;
+ }
+
+ vec_type = LLVMVectorType(bld->elem_type, 4);
+
+ undef = LLVMGetUndef(vec_type);
+
+ args[0] = undef;
+ args[1] = LLVMBuildInsertElement(bld->builder, undef, a, index0, "");
+ args[2] = LLVMConstInt(i32t, mode, 0);
+
+ res = lp_build_intrinsic(bld->builder, intrinsic,
+ vec_type, args, Elements(args));
+
+ res = LLVMBuildExtractElement(bld->builder, res, index0, "");
+ }
+ else {
+ assert(type.width*type.length == 128);
+
+ switch(type.width) {
+ case 32:
+ intrinsic = "llvm.x86.sse41.round.ps";
+ break;
+ case 64:
+ intrinsic = "llvm.x86.sse41.round.pd";
+ break;
+ default:
+ assert(0);
+ return bld->undef;
+ }
+
+ res = lp_build_intrinsic_binary(bld->builder, intrinsic,
+ bld->vec_type, a,
+ LLVMConstInt(i32t, mode, 0));
+ }
+
+ return res;
+}
+
+
+static INLINE LLVMValueRef
+lp_build_iround_nearest_sse2(struct lp_build_context *bld,
+ LLVMValueRef a)
+{
+ const struct lp_type type = bld->type;
+ LLVMTypeRef i32t = LLVMInt32Type();
+ LLVMTypeRef ret_type = lp_build_int_vec_type(type);
+ const char *intrinsic;
+ LLVMValueRef res;
+
+ assert(type.floating);
+ /* using the double precision conversions is a bit more complicated */
+ assert(type.width == 32);
+
+ assert(lp_check_value(type, a));
+ assert(util_cpu_caps.has_sse2);
+
+ /* This is relying on MXCSR rounding mode, which should always be nearest. */
+ if (type.length == 1) {
+ LLVMTypeRef vec_type;
+ LLVMValueRef undef;
+ LLVMValueRef arg;
+ LLVMValueRef index0 = LLVMConstInt(i32t, 0, 0);
+
+ vec_type = LLVMVectorType(bld->elem_type, 4);
+
+ intrinsic = "llvm.x86.sse.cvtss2si";
+
+ undef = LLVMGetUndef(vec_type);
+
+ arg = LLVMBuildInsertElement(bld->builder, undef, a, index0, "");
+
+ res = lp_build_intrinsic_unary(bld->builder, intrinsic,
+ ret_type, arg);
+ }
+ else {
+ assert(type.width*type.length == 128);
+
+ intrinsic = "llvm.x86.sse2.cvtps2dq";
+
+ res = lp_build_intrinsic_unary(bld->builder, intrinsic,
+ ret_type, a);
}
- return lp_build_intrinsic_binary(bld->builder, intrinsic, vec_type, a,
- LLVMConstInt(LLVMInt32Type(), mode, 0));
+ return res;
}
/**
- * Return the integer part of a float (vector) value. The returned value is
- * a float (vector).
- * Ex: trunc(-1.5) = 1.0
+ * Return the integer part of a float (vector) value (== round toward zero).
+ * The returned value is a float (vector).
+ * Ex: trunc(-1.5) = -1.0
*/
LLVMValueRef
lp_build_trunc(struct lp_build_context *bld,
assert(type.floating);
assert(lp_check_value(type, a));
- if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128)
+ if (util_cpu_caps.has_sse4_1 &&
+ (type.length == 1 || type.width*type.length == 128)) {
return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_TRUNCATE);
+ }
else {
LLVMTypeRef vec_type = lp_build_vec_type(type);
LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
assert(type.floating);
assert(lp_check_value(type, a));
- if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128)
+ if (util_cpu_caps.has_sse4_1 &&
+ (type.length == 1 || type.width*type.length == 128)) {
return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_NEAREST);
+ }
else {
LLVMTypeRef vec_type = lp_build_vec_type(type);
LLVMValueRef res;
assert(type.floating);
assert(lp_check_value(type, a));
- if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128)
+ if (util_cpu_caps.has_sse4_1 &&
+ (type.length == 1 || type.width*type.length == 128)) {
return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_FLOOR);
+ }
else {
LLVMTypeRef vec_type = lp_build_vec_type(type);
LLVMValueRef res;
assert(type.floating);
assert(lp_check_value(type, a));
- if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128)
+ if (util_cpu_caps.has_sse4_1 &&
+ (type.length == 1 || type.width*type.length == 128)) {
return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_CEIL);
+ }
else {
LLVMTypeRef vec_type = lp_build_vec_type(type);
LLVMValueRef res;
/**
- * Return the integer part of a float (vector) value. The returned value is
- * an integer (vector).
- * Ex: itrunc(-1.5) = 1
+ * Return the integer part of a float (vector) value (== round toward zero).
+ * The returned value is an integer (vector).
+ * Ex: itrunc(-1.5) = -1
*/
LLVMValueRef
lp_build_itrunc(struct lp_build_context *bld,
LLVMValueRef a)
{
const struct lp_type type = bld->type;
- LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+ LLVMTypeRef int_vec_type = bld->int_vec_type;
LLVMValueRef res;
assert(type.floating);
assert(lp_check_value(type, a));
- if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128) {
+ if (util_cpu_caps.has_sse2 &&
+ ((type.width == 32) && (type.length == 1 || type.length == 4))) {
+ return lp_build_iround_nearest_sse2(bld, a);
+ }
+ else if (util_cpu_caps.has_sse4_1 &&
+ (type.length == 1 || type.width*type.length == 128)) {
res = lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_NEAREST);
}
else {
- LLVMTypeRef vec_type = lp_build_vec_type(type);
- LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
- LLVMValueRef sign;
LLVMValueRef half;
- /* get sign bit */
- sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
- sign = LLVMBuildAnd(bld->builder, sign, mask, "");
-
- /* sign * 0.5 */
half = lp_build_const_vec(type, 0.5);
- half = LLVMBuildBitCast(bld->builder, half, int_vec_type, "");
- half = LLVMBuildOr(bld->builder, sign, half, "");
- half = LLVMBuildBitCast(bld->builder, half, vec_type, "");
+
+ if (type.sign) {
+ LLVMTypeRef vec_type = bld->vec_type;
+ LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
+ LLVMValueRef sign;
+
+ /* get sign bit */
+ sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
+ sign = LLVMBuildAnd(bld->builder, sign, mask, "");
+
+ /* sign * 0.5 */
+ half = LLVMBuildBitCast(bld->builder, half, int_vec_type, "");
+ half = LLVMBuildOr(bld->builder, sign, half, "");
+ half = LLVMBuildBitCast(bld->builder, half, vec_type, "");
+ }
res = LLVMBuildFAdd(bld->builder, a, half, "");
}
LLVMValueRef a)
{
const struct lp_type type = bld->type;
- LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+ LLVMTypeRef int_vec_type = bld->int_vec_type;
LLVMValueRef res;
assert(type.floating);
assert(lp_check_value(type, a));
- if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128) {
+ if (util_cpu_caps.has_sse4_1 &&
+ (type.length == 1 || type.width*type.length == 128)) {
res = lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_FLOOR);
}
else {
- /* Take the sign bit and add it to 1 constant */
- LLVMTypeRef vec_type = lp_build_vec_type(type);
- unsigned mantissa = lp_mantissa(type);
- LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
- LLVMValueRef sign;
- LLVMValueRef offset;
-
- /* sign = a < 0 ? ~0 : 0 */
- sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
- sign = LLVMBuildAnd(bld->builder, sign, mask, "");
- sign = LLVMBuildAShr(bld->builder, sign, lp_build_const_int_vec(type, type.width - 1), "ifloor.sign");
-
- /* offset = -0.99999(9)f */
- offset = lp_build_const_vec(type, -(double)(((unsigned long long)1 << mantissa) - 10)/((unsigned long long)1 << mantissa));
- offset = LLVMConstBitCast(offset, int_vec_type);
-
- /* offset = a < 0 ? offset : 0.0f */
- offset = LLVMBuildAnd(bld->builder, offset, sign, "");
- offset = LLVMBuildBitCast(bld->builder, offset, vec_type, "ifloor.offset");
-
- res = LLVMBuildFAdd(bld->builder, a, offset, "ifloor.res");
+ res = a;
+
+ if (type.sign) {
+ /* Take the sign bit and add it to 1 constant */
+ LLVMTypeRef vec_type = bld->vec_type;
+ unsigned mantissa = lp_mantissa(type);
+ LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
+ LLVMValueRef sign;
+ LLVMValueRef offset;
+
+ /* sign = a < 0 ? ~0 : 0 */
+ sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
+ sign = LLVMBuildAnd(bld->builder, sign, mask, "");
+ sign = LLVMBuildAShr(bld->builder, sign, lp_build_const_int_vec(type, type.width - 1), "ifloor.sign");
+
+ /* offset = -0.99999(9)f */
+ offset = lp_build_const_vec(type, -(double)(((unsigned long long)1 << mantissa) - 10)/((unsigned long long)1 << mantissa));
+ offset = LLVMConstBitCast(offset, int_vec_type);
+
+ /* offset = a < 0 ? offset : 0.0f */
+ offset = LLVMBuildAnd(bld->builder, offset, sign, "");
+ offset = LLVMBuildBitCast(bld->builder, offset, vec_type, "ifloor.offset");
+
+ res = LLVMBuildFAdd(bld->builder, res, offset, "ifloor.res");
+ }
}
/* round to nearest (toward zero) */
LLVMValueRef a)
{
const struct lp_type type = bld->type;
- LLVMTypeRef int_vec_type = lp_build_int_vec_type(type);
+ LLVMTypeRef int_vec_type = bld->int_vec_type;
LLVMValueRef res;
assert(type.floating);
assert(lp_check_value(type, a));
- if (util_cpu_caps.has_sse4_1 && type.width*type.length == 128) {
+ if (util_cpu_caps.has_sse4_1 &&
+ (type.length == 1 || type.width*type.length == 128)) {
res = lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_CEIL);
}
else {
- LLVMTypeRef vec_type = lp_build_vec_type(type);
+ LLVMTypeRef vec_type = bld->vec_type;
unsigned mantissa = lp_mantissa(type);
- LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
- LLVMValueRef sign;
LLVMValueRef offset;
- /* sign = a < 0 ? 0 : ~0 */
- sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
- sign = LLVMBuildAnd(bld->builder, sign, mask, "");
- sign = LLVMBuildAShr(bld->builder, sign, lp_build_const_int_vec(type, type.width - 1), "iceil.sign");
- sign = LLVMBuildNot(bld->builder, sign, "iceil.not");
-
/* offset = 0.99999(9)f */
offset = lp_build_const_vec(type, (double)(((unsigned long long)1 << mantissa) - 10)/((unsigned long long)1 << mantissa));
- offset = LLVMConstBitCast(offset, int_vec_type);
- /* offset = a < 0 ? 0.0 : offset */
- offset = LLVMBuildAnd(bld->builder, offset, sign, "");
- offset = LLVMBuildBitCast(bld->builder, offset, vec_type, "iceil.offset");
+ if (type.sign) {
+ LLVMValueRef mask = lp_build_const_int_vec(type, (unsigned long long)1 << (type.width - 1));
+ LLVMValueRef sign;
+
+ /* sign = a < 0 ? 0 : ~0 */
+ sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, "");
+ sign = LLVMBuildAnd(bld->builder, sign, mask, "");
+ sign = LLVMBuildAShr(bld->builder, sign, lp_build_const_int_vec(type, type.width - 1), "iceil.sign");
+ sign = LLVMBuildNot(bld->builder, sign, "iceil.not");
+
+ /* offset = a < 0 ? 0.0 : offset */
+ offset = LLVMConstBitCast(offset, int_vec_type);
+ offset = LLVMBuildAnd(bld->builder, offset, sign, "");
+ offset = LLVMBuildBitCast(bld->builder, offset, vec_type, "iceil.offset");
+ }
res = LLVMBuildFAdd(bld->builder, a, offset, "iceil.res");
}
}
+/**
+ * Combined ifloor() & fract().
+ *
+ * Preferred to calling the functions separately, as it will ensure that the
+ * stratergy (floor() vs ifloor()) that results in less redundant work is used.
+ */
+void
+lp_build_ifloor_fract(struct lp_build_context *bld,
+ LLVMValueRef a,
+ LLVMValueRef *out_ipart,
+ LLVMValueRef *out_fpart)
+{
+ const struct lp_type type = bld->type;
+ LLVMValueRef ipart;
+
+ assert(type.floating);
+ assert(lp_check_value(type, a));
+
+ if (util_cpu_caps.has_sse4_1 &&
+ (type.length == 1 || type.width*type.length == 128)) {
+ /*
+ * floor() is easier.
+ */
+
+ ipart = lp_build_floor(bld, a);
+ *out_fpart = LLVMBuildFSub(bld->builder, a, ipart, "fpart");
+ *out_ipart = LLVMBuildFPToSI(bld->builder, ipart, bld->int_vec_type, "ipart");
+ }
+ else {
+ /*
+ * ifloor() is easier.
+ */
+
+ *out_ipart = lp_build_ifloor(bld, a);
+ ipart = LLVMBuildSIToFP(bld->builder, *out_ipart, bld->vec_type, "ipart");
+ *out_fpart = LLVMBuildFSub(bld->builder, a, ipart, "fpart");
+ }
+}
+
+
LLVMValueRef
lp_build_sqrt(struct lp_build_context *bld,
LLVMValueRef a)
}
+/**
+ * Extract the exponent of a IEEE-754 floating point value.
+ *
+ * Optionally apply an integer bias.
+ *
+ * Result is an integer value with
+ *
+ * ifloor(log2(x)) + bias
+ */
+LLVMValueRef
+lp_build_extract_exponent(struct lp_build_context *bld,
+ LLVMValueRef x,
+ int bias)
+{
+ const struct lp_type type = bld->type;
+ unsigned mantissa = lp_mantissa(type);
+ LLVMValueRef res;
+
+ assert(type.floating);
+
+ assert(lp_check_value(bld->type, x));
+
+ x = LLVMBuildBitCast(bld->builder, x, bld->int_vec_type, "");
+
+ res = LLVMBuildLShr(bld->builder, x, lp_build_const_int_vec(type, mantissa), "");
+ res = LLVMBuildAnd(bld->builder, res, lp_build_const_int_vec(type, 255), "");
+ res = LLVMBuildSub(bld->builder, res, lp_build_const_int_vec(type, 127 - bias), "");
+
+ return res;
+}
+
+
+/**
+ * Extract the mantissa of the a floating.
+ *
+ * Result is a floating point value with
+ *
+ * x / floor(log2(x))
+ */
+LLVMValueRef
+lp_build_extract_mantissa(struct lp_build_context *bld,
+ LLVMValueRef x)
+{
+ const struct lp_type type = bld->type;
+ unsigned mantissa = lp_mantissa(type);
+ LLVMValueRef mantmask = lp_build_const_int_vec(type, (1ULL << mantissa) - 1);
+ LLVMValueRef one = LLVMConstBitCast(bld->one, bld->int_vec_type);
+ LLVMValueRef res;
+
+ assert(lp_check_value(bld->type, x));
+
+ assert(type.floating);
+
+ x = LLVMBuildBitCast(bld->builder, x, bld->int_vec_type, "");
+
+ /* res = x / 2**ipart */
+ res = LLVMBuildAnd(bld->builder, x, mantmask, "");
+ res = LLVMBuildOr(bld->builder, res, one, "");
+ res = LLVMBuildBitCast(bld->builder, res, bld->vec_type, "");
+
+ return res;
+}
+
+
+
/**
* Minimax polynomial fit of log2(x)/(x - 1), for x in range [1, 2[
* These coefficients can be generate with
lp_build_log2_approx(bld, x, NULL, NULL, &res);
return res;
}
+
+
+/**
+ * Faster (and less accurate) log2.
+ *
+ * log2(x) = floor(log2(x)) - 1 + x / 2**floor(log2(x))
+ *
+ * Piece-wise linear approximation, with exact results when x is a
+ * power of two.
+ *
+ * See http://www.flipcode.com/archives/Fast_log_Function.shtml
+ */
+LLVMValueRef
+lp_build_fast_log2(struct lp_build_context *bld,
+ LLVMValueRef x)
+{
+ LLVMValueRef ipart;
+ LLVMValueRef fpart;
+
+ assert(lp_check_value(bld->type, x));
+
+ assert(bld->type.floating);
+
+ /* ipart = floor(log2(x)) - 1 */
+ ipart = lp_build_extract_exponent(bld, x, -1);
+ ipart = LLVMBuildSIToFP(bld->builder, ipart, bld->vec_type, "");
+
+ /* fpart = x / 2**ipart */
+ fpart = lp_build_extract_mantissa(bld, x);
+
+ /* ipart + fpart */
+ return LLVMBuildFAdd(bld->builder, ipart, fpart, "");
+}
+
+
+/**
+ * Fast implementation of iround(log2(x)).
+ *
+ * Not an approximation -- it should give accurate results all the time.
+ */
+LLVMValueRef
+lp_build_ilog2(struct lp_build_context *bld,
+ LLVMValueRef x)
+{
+ LLVMValueRef sqrt2 = lp_build_const_vec(bld->type, M_SQRT2);
+ LLVMValueRef ipart;
+
+ assert(bld->type.floating);
+
+ assert(lp_check_value(bld->type, x));
+
+ /* x * 2^(0.5) i.e., add 0.5 to the log2(x) */
+ x = LLVMBuildFMul(bld->builder, x, sqrt2, "");
+
+ /* ipart = floor(log2(x) + 0.5) */
+ ipart = lp_build_extract_exponent(bld, x, 0);
+
+ return ipart;
+}
lp_build_itrunc(struct lp_build_context *bld,
LLVMValueRef a);
+void
+lp_build_ifloor_fract(struct lp_build_context *bld,
+ LLVMValueRef a,
+ LLVMValueRef *out_ipart,
+ LLVMValueRef *out_fpart);
+
LLVMValueRef
lp_build_sqrt(struct lp_build_context *bld,
LLVMValueRef a);
lp_build_exp2(struct lp_build_context *bld,
LLVMValueRef a);
+LLVMValueRef
+lp_build_extract_exponent(struct lp_build_context *bld,
+ LLVMValueRef x,
+ int bias);
+
+LLVMValueRef
+lp_build_extract_mantissa(struct lp_build_context *bld,
+ LLVMValueRef x);
+
LLVMValueRef
lp_build_log2(struct lp_build_context *bld,
LLVMValueRef a);
+LLVMValueRef
+lp_build_fast_log2(struct lp_build_context *bld,
+ LLVMValueRef a);
+
+LLVMValueRef
+lp_build_ilog2(struct lp_build_context *bld,
+ LLVMValueRef x);
+
void
lp_build_exp2_approx(struct lp_build_context *bld,
LLVMValueRef x,
#include "util/u_debug.h"
#include "util/u_math.h"
+#include "util/u_cpu_detect.h"
#include "lp_bld_type.h"
#include "lp_bld_const.h"
LLVMTypeRef int_vec_type = lp_build_int_vec_type(src_type);
LLVMValueRef res;
unsigned mantissa;
- unsigned n;
- unsigned long long ubound;
- unsigned long long mask;
- double scale;
- double bias;
assert(src_type.floating);
+ assert(dst_width <= src_type.width);
+ src_type.sign = FALSE;
mantissa = lp_mantissa(src_type);
- /* We cannot carry more bits than the mantissa */
- n = MIN2(mantissa, dst_width);
+ if (dst_width <= mantissa) {
+ /*
+ * Apply magic coefficients that will make the desired result to appear
+ * in the lowest significant bits of the mantissa, with correct rounding.
+ *
+ * This only works if the destination width fits in the mantissa.
+ */
- /* This magic coefficients will make the desired result to appear in the
- * lowest significant bits of the mantissa.
- */
- ubound = ((unsigned long long)1 << n);
- mask = ubound - 1;
- scale = (double)mask/ubound;
- bias = (double)((unsigned long long)1 << (mantissa - n));
+ unsigned long long ubound;
+ unsigned long long mask;
+ double scale;
+ double bias;
- res = LLVMBuildFMul(builder, src, lp_build_const_vec(src_type, scale), "");
- res = LLVMBuildFAdd(builder, res, lp_build_const_vec(src_type, bias), "");
- res = LLVMBuildBitCast(builder, res, int_vec_type, "");
+ ubound = (1ULL << dst_width);
+ mask = ubound - 1;
+ scale = (double)mask/ubound;
+ bias = (double)(1ULL << (mantissa - dst_width));
- if(dst_width > n) {
- int shift = dst_width - n;
- res = LLVMBuildShl(builder, res, lp_build_const_int_vec(src_type, shift), "");
+ res = LLVMBuildFMul(builder, src, lp_build_const_vec(src_type, scale), "");
+ res = LLVMBuildFAdd(builder, res, lp_build_const_vec(src_type, bias), "");
+ res = LLVMBuildBitCast(builder, res, int_vec_type, "");
+ res = LLVMBuildAnd(builder, res, lp_build_const_int_vec(src_type, mask), "");
+ }
+ else if (dst_width == (mantissa + 1)) {
+ /*
+ * The destination width matches exactly what can be represented in
+ * floating point (i.e., mantissa + 1 bits). So do a straight
+ * multiplication followed by casting. No further rounding is necessary.
+ */
+
+ double scale;
- /* TODO: Fill in the empty lower bits for additional precision? */
- /* YES: this fixes progs/trivial/tri-z-eq.c.
- * Otherwise vertex Z=1.0 values get converted to something like
- * 0xfffffb00 and the test for equality with 0xffffffff fails.
+ scale = (double)((1ULL << dst_width) - 1);
+
+ res = LLVMBuildFMul(builder, src, lp_build_const_vec(src_type, scale), "");
+ res = LLVMBuildFPToSI(builder, res, int_vec_type, "");
+ }
+ else {
+ /*
+ * The destination exceeds what can be represented in the floating point.
+ * So multiply by the largest power two we get away with, and when
+ * subtract the most significant bit to rescale to normalized values.
+ *
+ * The largest power of two factor we can get away is
+ * (1 << (src_type.width - 1)), because we need to use signed . In theory it
+ * should be (1 << (src_type.width - 2)), but IEEE 754 rules states
+ * INT_MIN should be returned in FPToSI, which is the correct result for
+ * values near 1.0!
+ *
+ * This means we get (src_type.width - 1) correct bits for values near 0.0,
+ * and (mantissa + 1) correct bits for values near 1.0. Equally or more
+ * important, we also get exact results for 0.0 and 1.0.
*/
-#if 0
- {
- LLVMValueRef msb;
- msb = LLVMBuildLShr(builder, res, lp_build_const_int_vec(src_type, dst_width - 1), "");
- msb = LLVMBuildShl(builder, msb, lp_build_const_int_vec(src_type, shift), "");
- msb = LLVMBuildSub(builder, msb, lp_build_const_int_vec(src_type, 1), "");
- res = LLVMBuildOr(builder, res, msb, "");
- }
-#elif 0
- while(shift > 0) {
- res = LLVMBuildOr(builder, res, LLVMBuildLShr(builder, res, lp_build_const_int_vec(src_type, n), ""), "");
- shift -= n;
- n *= 2;
+
+ unsigned n = MIN2(src_type.width - 1, dst_width);
+
+ double scale = (double)(1ULL << n);
+ unsigned lshift = dst_width - n;
+ unsigned rshift = n;
+ LLVMValueRef lshifted;
+ LLVMValueRef rshifted;
+
+ res = LLVMBuildFMul(builder, src, lp_build_const_vec(src_type, scale), "");
+ res = LLVMBuildFPToSI(builder, res, int_vec_type, "");
+
+ /*
+ * Align the most significant bit to its final place.
+ *
+ * This will cause 1.0 to overflow to 0, but the later adjustment will
+ * get it right.
+ */
+ if (lshift) {
+ lshifted = LLVMBuildShl(builder, res,
+ lp_build_const_int_vec(src_type, lshift), "");
+ } else {
+ lshifted = res;
}
-#endif
+
+ /*
+ * Align the most significant bit to the right.
+ */
+ rshifted = LLVMBuildAShr(builder, res,
+ lp_build_const_int_vec(src_type, rshift), "");
+
+ /*
+ * Subtract the MSB to the LSB, therefore re-scaling from
+ * (1 << dst_width) to ((1 << dst_width) - 1).
+ */
+
+ res = LLVMBuildSub(builder, lshifted, rshifted, "");
}
- else
- res = LLVMBuildAnd(builder, res, lp_build_const_int_vec(src_type, mask), "");
return res;
}
assert(dst_type.floating);
+ /* Special-case int8->float, though most cases could be handled
+ * this way:
+ */
+ if (src_width == 8) {
+ scale = 1.0/255.0;
+ res = LLVMBuildSIToFP(builder, src, vec_type, "");
+ res = LLVMBuildFMul(builder, res, lp_build_const_vec(dst_type, scale), "");
+ return res;
+ }
+
mantissa = lp_mantissa(dst_type);
n = MIN2(mantissa, src_width);
}
num_tmps = num_srcs;
+
+ /* Special case 4x4f --> 1x16ub
+ */
+ if (src_type.floating == 1 &&
+ src_type.fixed == 0 &&
+ src_type.sign == 1 &&
+ src_type.norm == 0 &&
+ src_type.width == 32 &&
+ src_type.length == 4 &&
+
+ dst_type.floating == 0 &&
+ dst_type.fixed == 0 &&
+ dst_type.sign == 0 &&
+ dst_type.norm == 1 &&
+ dst_type.width == 8 &&
+ dst_type.length == 16 &&
+
+ util_cpu_caps.has_sse2)
+ {
+ int i;
+
+ for (i = 0; i < num_dsts; i++, src += 4) {
+ struct lp_type int16_type = dst_type;
+ struct lp_type int32_type = dst_type;
+ LLVMValueRef lo, hi;
+ LLVMValueRef src_int0;
+ LLVMValueRef src_int1;
+ LLVMValueRef src_int2;
+ LLVMValueRef src_int3;
+ LLVMTypeRef int16_vec_type;
+ LLVMTypeRef int32_vec_type;
+ LLVMTypeRef src_vec_type;
+ LLVMTypeRef dst_vec_type;
+ LLVMValueRef const_255f;
+ LLVMValueRef a, b, c, d;
+
+ int16_type.width *= 2;
+ int16_type.length /= 2;
+ int16_type.sign = 1;
+
+ int32_type.width *= 4;
+ int32_type.length /= 4;
+ int32_type.sign = 1;
+
+ src_vec_type = lp_build_vec_type(src_type);
+ dst_vec_type = lp_build_vec_type(dst_type);
+ int16_vec_type = lp_build_vec_type(int16_type);
+ int32_vec_type = lp_build_vec_type(int32_type);
+
+ const_255f = lp_build_const_vec(src_type, 255.0f);
+
+ a = LLVMBuildFMul(builder, src[0], const_255f, "");
+ b = LLVMBuildFMul(builder, src[1], const_255f, "");
+ c = LLVMBuildFMul(builder, src[2], const_255f, "");
+ d = LLVMBuildFMul(builder, src[3], const_255f, "");
+
+ {
+ struct lp_build_context bld;
+
+ bld.builder = builder;
+ bld.type = src_type;
+ bld.vec_type = src_vec_type;
+ bld.int_elem_type = lp_build_elem_type(int32_type);
+ bld.int_vec_type = int32_vec_type;
+ bld.undef = lp_build_undef(src_type);
+ bld.zero = lp_build_zero(src_type);
+ bld.one = lp_build_one(src_type);
+
+ src_int0 = lp_build_iround(&bld, a);
+ src_int1 = lp_build_iround(&bld, b);
+ src_int2 = lp_build_iround(&bld, c);
+ src_int3 = lp_build_iround(&bld, d);
+ }
+ /* relying on clamping behavior of sse2 intrinsics here */
+ lo = lp_build_pack2(builder, int32_type, int16_type, src_int0, src_int1);
+ hi = lp_build_pack2(builder, int32_type, int16_type, src_int2, src_int3);
+ dst[i] = lp_build_pack2(builder, int16_type, dst_type, lo, hi);
+ }
+ return;
+ }
+
/*
* Clamp if necessary
*/
#ifdef HAVE_UDIS86
ud_t ud_obj;
uint64_t max_jmp_pc;
+ uint inst_no;
+ boolean emit_addrs = TRUE, emit_line_nos = FALSE;
ud_init(&ud_obj);
while (ud_disassemble(&ud_obj)) {
+ if (emit_addrs) {
#ifdef PIPE_ARCH_X86
- debug_printf("0x%08lx:\t", (unsigned long)ud_insn_off(&ud_obj));
+ debug_printf("0x%08lx:\t", (unsigned long)ud_insn_off(&ud_obj));
#endif
#ifdef PIPE_ARCH_X86_64
- debug_printf("0x%016llx:\t", (unsigned long long)ud_insn_off(&ud_obj));
+ debug_printf("0x%016llx:\t", (unsigned long long)ud_insn_off(&ud_obj));
#endif
-
+ }
+ else if (emit_line_nos) {
+ debug_printf("%6d:\t", inst_no);
+ inst_no++;
+ }
#if 0
debug_printf("%-16s ", ud_insn_hex(&ud_obj));
#endif
}
}
- if ((ud_insn_off(&ud_obj) >= max_jmp_pc && ud_obj.mnemonic == UD_Iret) ||
- ud_obj.mnemonic == UD_Iinvalid)
+ if (ud_obj.mnemonic == UD_Iinvalid ||
+ (ud_insn_off(&ud_obj) >= max_jmp_pc &&
+ (ud_obj.mnemonic == UD_Iret ||
+ ud_obj.mnemonic == UD_Ijmp)))
break;
}
#include "util/u_string.h"
-#define GALLIVM_DEBUG_TGSI 0x1
-#define GALLIVM_DEBUG_IR 0x2
-#define GALLIVM_DEBUG_ASM 0x4
-#define GALLIVM_DEBUG_NO_OPT 0x8
-#define GALLIVM_DEBUG_PERF 0x10
+#define GALLIVM_DEBUG_TGSI (1 << 0)
+#define GALLIVM_DEBUG_IR (1 << 1)
+#define GALLIVM_DEBUG_ASM (1 << 2)
+#define GALLIVM_DEBUG_NO_OPT (1 << 3)
+#define GALLIVM_DEBUG_PERF (1 << 4)
+#define GALLIVM_DEBUG_NO_BRILINEAR (1 << 5)
#ifdef DEBUG
#include "lp_bld_flow.h"
-#define LP_BUILD_FLOW_MAX_VARIABLES 64
-#define LP_BUILD_FLOW_MAX_DEPTH 32
-
-/**
- * Enumeration of all possible flow constructs.
- */
-enum lp_build_flow_construct_kind {
- LP_BUILD_FLOW_SCOPE,
- LP_BUILD_FLOW_SKIP,
- LP_BUILD_FLOW_IF
-};
-
-
-/**
- * Variable declaration scope.
- */
-struct lp_build_flow_scope
-{
- /** Number of variables declared in this scope */
- unsigned num_variables;
-};
-
-
-/**
- * Early exit. Useful to skip to the end of a function or block when
- * the execution mask becomes zero or when there is an error condition.
- */
-struct lp_build_flow_skip
-{
- /** Block to skip to */
- LLVMBasicBlockRef block;
-
- /** Number of variables declared at the beginning */
- unsigned num_variables;
-
- LLVMValueRef *phi; /**< array [num_variables] */
-};
-
-
-/**
- * if/else/endif.
- */
-struct lp_build_flow_if
-{
- unsigned num_variables;
-
- LLVMValueRef *phi; /**< array [num_variables] */
-
- LLVMValueRef condition;
- LLVMBasicBlockRef entry_block, true_block, false_block, merge_block;
-};
-
-
-/**
- * Union of all possible flow constructs' data
- */
-union lp_build_flow_construct_data
-{
- struct lp_build_flow_scope scope;
- struct lp_build_flow_skip skip;
- struct lp_build_flow_if ifthen;
-};
-
-
-/**
- * Element of the flow construct stack.
- */
-struct lp_build_flow_construct
-{
- enum lp_build_flow_construct_kind kind;
- union lp_build_flow_construct_data data;
-};
-
-
/**
- * All necessary data to generate LLVM control flow constructs.
+ * Insert a new block, right where builder is pointing to.
*
- * Besides keeping track of the control flow construct themselves we also
- * need to keep track of variables in order to generate SSA Phi values.
- */
-struct lp_build_flow_context
-{
- LLVMBuilderRef builder;
-
- /**
- * Control flow stack.
- */
- struct lp_build_flow_construct constructs[LP_BUILD_FLOW_MAX_DEPTH];
- unsigned num_constructs;
-
- /**
- * Variable stack
- */
- LLVMValueRef *variables[LP_BUILD_FLOW_MAX_VARIABLES];
- unsigned num_variables;
-};
-
-
-struct lp_build_flow_context *
-lp_build_flow_create(LLVMBuilderRef builder)
-{
- struct lp_build_flow_context *flow;
-
- flow = CALLOC_STRUCT(lp_build_flow_context);
- if(!flow)
- return NULL;
-
- flow->builder = builder;
-
- return flow;
-}
-
-
-void
-lp_build_flow_destroy(struct lp_build_flow_context *flow)
-{
- assert(flow->num_constructs == 0);
- assert(flow->num_variables == 0);
- FREE(flow);
-}
-
-
-/**
- * Begin/push a new flow control construct, such as a loop, skip block
- * or variable scope.
- */
-static union lp_build_flow_construct_data *
-lp_build_flow_push(struct lp_build_flow_context *flow,
- enum lp_build_flow_construct_kind kind)
-{
- assert(flow->num_constructs < LP_BUILD_FLOW_MAX_DEPTH);
- if(flow->num_constructs >= LP_BUILD_FLOW_MAX_DEPTH)
- return NULL;
-
- flow->constructs[flow->num_constructs].kind = kind;
- return &flow->constructs[flow->num_constructs++].data;
-}
-
-
-/**
- * Return the current/top flow control construct on the stack.
- * \param kind the expected type of the top-most construct
- */
-static union lp_build_flow_construct_data *
-lp_build_flow_peek(struct lp_build_flow_context *flow,
- enum lp_build_flow_construct_kind kind)
-{
- assert(flow->num_constructs);
- if(!flow->num_constructs)
- return NULL;
-
- assert(flow->constructs[flow->num_constructs - 1].kind == kind);
- if(flow->constructs[flow->num_constructs - 1].kind != kind)
- return NULL;
-
- return &flow->constructs[flow->num_constructs - 1].data;
-}
-
-
-/**
- * End/pop the current/top flow control construct on the stack.
- * \param kind the expected type of the top-most construct
- */
-static union lp_build_flow_construct_data *
-lp_build_flow_pop(struct lp_build_flow_context *flow,
- enum lp_build_flow_construct_kind kind)
-{
- assert(flow->num_constructs);
- if(!flow->num_constructs)
- return NULL;
-
- assert(flow->constructs[flow->num_constructs - 1].kind == kind);
- if(flow->constructs[flow->num_constructs - 1].kind != kind)
- return NULL;
-
- return &flow->constructs[--flow->num_constructs].data;
-}
-
-
-/**
- * Begin a variable scope.
+ * This is useful important not only for aesthetic reasons, but also for
+ * performance reasons, as frequently run blocks should be laid out next to
+ * each other and fall-throughs maximized.
*
+ * See also llvm/lib/Transforms/Scalar/BasicBlockPlacement.cpp.
*
- */
-void
-lp_build_flow_scope_begin(struct lp_build_flow_context *flow)
-{
- struct lp_build_flow_scope *scope;
-
- scope = &lp_build_flow_push(flow, LP_BUILD_FLOW_SCOPE)->scope;
- if(!scope)
- return;
-
- scope->num_variables = 0;
-}
-
-
-/**
- * Declare a variable.
- *
- * A variable is a named entity which can have different LLVMValueRef's at
- * different points of the program. This is relevant for control flow because
- * when there are multiple branches to a same location we need to replace
- * the variable's value with a Phi function as explained in
- * http://en.wikipedia.org/wiki/Static_single_assignment_form .
- *
- * We keep track of variables by keeping around a pointer to where they're
- * current.
- *
- * There are a few cautions to observe:
- *
- * - Variable's value must not be NULL. If there is no initial value then
- * LLVMGetUndef() should be used.
- *
- * - Variable's value must be kept up-to-date. If the variable is going to be
- * modified by a function then a pointer should be passed so that its value
- * is accurate. Failure to do this will cause some of the variables'
- * transient values to be lost, leading to wrong results.
- *
- * - A program should be written from top to bottom, by always appending
- * instructions to the bottom with a single LLVMBuilderRef. Inserting and/or
- * modifying existing statements will most likely lead to wrong results.
- *
- */
-void
-lp_build_flow_scope_declare(struct lp_build_flow_context *flow,
- LLVMValueRef *variable)
-{
- struct lp_build_flow_scope *scope;
-
- scope = &lp_build_flow_peek(flow, LP_BUILD_FLOW_SCOPE)->scope;
- if(!scope)
- return;
-
- assert(*variable);
- if(!*variable)
- return;
-
- assert(flow->num_variables < LP_BUILD_FLOW_MAX_VARIABLES);
- if(flow->num_variables >= LP_BUILD_FLOW_MAX_VARIABLES)
- return;
-
- flow->variables[flow->num_variables++] = variable;
- ++scope->num_variables;
-}
-
-
-void
-lp_build_flow_scope_end(struct lp_build_flow_context *flow)
-{
- struct lp_build_flow_scope *scope;
-
- scope = &lp_build_flow_pop(flow, LP_BUILD_FLOW_SCOPE)->scope;
- if(!scope)
- return;
-
- assert(flow->num_variables >= scope->num_variables);
- if(flow->num_variables < scope->num_variables) {
- flow->num_variables = 0;
- return;
- }
-
- flow->num_variables -= scope->num_variables;
-}
-
-
-/**
* Note: this function has no dependencies on the flow code and could
* be used elsewhere.
*/
}
-static LLVMBasicBlockRef
-lp_build_flow_insert_block(struct lp_build_flow_context *flow)
-{
- return lp_build_insert_new_block(flow->builder, "");
-}
-
-
/**
* Begin a "skip" block. Inside this block we can test a condition and
* skip to the end of the block if the condition is false.
*/
void
-lp_build_flow_skip_begin(struct lp_build_flow_context *flow)
+lp_build_flow_skip_begin(struct lp_build_skip_context *skip,
+ LLVMBuilderRef builder)
{
- struct lp_build_flow_skip *skip;
- LLVMBuilderRef builder;
- unsigned i;
-
- skip = &lp_build_flow_push(flow, LP_BUILD_FLOW_SKIP)->skip;
- if(!skip)
- return;
+ skip->builder = builder;
/* create new basic block */
- skip->block = lp_build_flow_insert_block(flow);
-
- skip->num_variables = flow->num_variables;
- if(!skip->num_variables) {
- skip->phi = NULL;
- return;
- }
-
- /* Allocate a Phi node for each variable in this skip scope */
- skip->phi = MALLOC(skip->num_variables * sizeof *skip->phi);
- if(!skip->phi) {
- skip->num_variables = 0;
- return;
- }
-
- builder = LLVMCreateBuilder();
- LLVMPositionBuilderAtEnd(builder, skip->block);
-
- /* create a Phi node for each variable */
- for(i = 0; i < skip->num_variables; ++i)
- skip->phi[i] = LLVMBuildPhi(builder, LLVMTypeOf(*flow->variables[i]), "");
-
- LLVMDisposeBuilder(builder);
+ skip->block = lp_build_insert_new_block(skip->builder, "skip");
}
* skip block if the condition is true.
*/
void
-lp_build_flow_skip_cond_break(struct lp_build_flow_context *flow,
+lp_build_flow_skip_cond_break(struct lp_build_skip_context *skip,
LLVMValueRef cond)
{
- struct lp_build_flow_skip *skip;
- LLVMBasicBlockRef current_block;
LLVMBasicBlockRef new_block;
- unsigned i;
-
- skip = &lp_build_flow_peek(flow, LP_BUILD_FLOW_SKIP)->skip;
- if(!skip)
- return;
- current_block = LLVMGetInsertBlock(flow->builder);
-
- new_block = lp_build_flow_insert_block(flow);
-
- /* for each variable, update the Phi node with a (variable, block) pair */
- for(i = 0; i < skip->num_variables; ++i) {
- assert(*flow->variables[i]);
- assert(LLVMTypeOf(skip->phi[i]) == LLVMTypeOf(*flow->variables[i]));
- LLVMAddIncoming(skip->phi[i], flow->variables[i], ¤t_block, 1);
- }
+ new_block = lp_build_insert_new_block(skip->builder, "");
/* if cond is true, goto skip->block, else goto new_block */
- LLVMBuildCondBr(flow->builder, cond, skip->block, new_block);
+ LLVMBuildCondBr(skip->builder, cond, skip->block, new_block);
- LLVMPositionBuilderAtEnd(flow->builder, new_block);
+ LLVMPositionBuilderAtEnd(skip->builder, new_block);
}
void
-lp_build_flow_skip_end(struct lp_build_flow_context *flow)
+lp_build_flow_skip_end(struct lp_build_skip_context *skip)
{
- struct lp_build_flow_skip *skip;
- LLVMBasicBlockRef current_block;
- unsigned i;
-
- skip = &lp_build_flow_pop(flow, LP_BUILD_FLOW_SKIP)->skip;
- if(!skip)
- return;
-
- current_block = LLVMGetInsertBlock(flow->builder);
-
- /* add (variable, block) tuples to the phi nodes */
- for(i = 0; i < skip->num_variables; ++i) {
- assert(*flow->variables[i]);
- assert(LLVMTypeOf(skip->phi[i]) == LLVMTypeOf(*flow->variables[i]));
- LLVMAddIncoming(skip->phi[i], flow->variables[i], ¤t_block, 1);
- *flow->variables[i] = skip->phi[i];
- }
-
/* goto block */
- LLVMBuildBr(flow->builder, skip->block);
- LLVMPositionBuilderAtEnd(flow->builder, skip->block);
-
- FREE(skip->phi);
+ LLVMBuildBr(skip->builder, skip->block);
+ LLVMPositionBuilderAtEnd(skip->builder, skip->block);
}
/**
* Check if the mask predicate is zero. If so, jump to the end of the block.
*/
-static void
+void
lp_build_mask_check(struct lp_build_mask_context *mask)
{
- LLVMBuilderRef builder = mask->flow->builder;
+ LLVMBuilderRef builder = mask->skip.builder;
+ LLVMValueRef value;
LLVMValueRef cond;
+ value = lp_build_mask_value(mask);
+
/* cond = (mask == 0) */
cond = LLVMBuildICmp(builder,
LLVMIntEQ,
- LLVMBuildBitCast(builder, mask->value, mask->reg_type, ""),
+ LLVMBuildBitCast(builder, value, mask->reg_type, ""),
LLVMConstNull(mask->reg_type),
"");
/* if cond, goto end of block */
- lp_build_flow_skip_cond_break(mask->flow, cond);
+ lp_build_flow_skip_cond_break(&mask->skip, cond);
}
*/
void
lp_build_mask_begin(struct lp_build_mask_context *mask,
- struct lp_build_flow_context *flow,
+ LLVMBuilderRef builder,
struct lp_type type,
LLVMValueRef value)
{
memset(mask, 0, sizeof *mask);
- mask->flow = flow;
mask->reg_type = LLVMIntType(type.width * type.length);
- mask->value = value;
+ mask->var = lp_build_alloca(builder,
+ lp_build_int_vec_type(type),
+ "execution_mask");
- lp_build_flow_scope_begin(flow);
- lp_build_flow_scope_declare(flow, &mask->value);
- lp_build_flow_skip_begin(flow);
+ LLVMBuildStore(builder, value, mask->var);
- lp_build_mask_check(mask);
+ lp_build_flow_skip_begin(&mask->skip, builder);
+}
+
+
+LLVMValueRef
+lp_build_mask_value(struct lp_build_mask_context *mask)
+{
+ return LLVMBuildLoad(mask->skip.builder, mask->var, "");
}
lp_build_mask_update(struct lp_build_mask_context *mask,
LLVMValueRef value)
{
- mask->value = LLVMBuildAnd( mask->flow->builder, mask->value, value, "");
-
- lp_build_mask_check(mask);
+ value = LLVMBuildAnd(mask->skip.builder,
+ lp_build_mask_value(mask),
+ value, "");
+ LLVMBuildStore(mask->skip.builder, value, mask->var);
}
LLVMValueRef
lp_build_mask_end(struct lp_build_mask_context *mask)
{
- lp_build_flow_skip_end(mask->flow);
- lp_build_flow_scope_end(mask->flow);
- return mask->value;
+ lp_build_flow_skip_end(&mask->skip);
+ return lp_build_mask_value(mask);
}
LLVMValueRef start,
struct lp_build_loop_state *state)
{
- LLVMBasicBlockRef block = LLVMGetInsertBlock(builder);
- LLVMValueRef function = LLVMGetBasicBlockParent(block);
+ state->block = lp_build_insert_new_block(builder, "loop_begin");
- state->block = LLVMAppendBasicBlock(function, "loop");
+ state->counter_var = lp_build_alloca(builder, LLVMTypeOf(start), "loop_counter");
+
+ LLVMBuildStore(builder, start, state->counter_var);
LLVMBuildBr(builder, state->block);
LLVMPositionBuilderAtEnd(builder, state->block);
- state->counter = LLVMBuildPhi(builder, LLVMTypeOf(start), "");
-
- LLVMAddIncoming(state->counter, &start, &block, 1);
-
+ state->counter = LLVMBuildLoad(builder, state->counter_var, "");
}
-void
-lp_build_loop_end(LLVMBuilderRef builder,
- LLVMValueRef end,
- LLVMValueRef step,
- struct lp_build_loop_state *state)
-{
- LLVMBasicBlockRef block = LLVMGetInsertBlock(builder);
- LLVMValueRef function = LLVMGetBasicBlockParent(block);
- LLVMValueRef next;
- LLVMValueRef cond;
- LLVMBasicBlockRef after_block;
-
- if (!step)
- step = LLVMConstInt(LLVMTypeOf(end), 1, 0);
-
- next = LLVMBuildAdd(builder, state->counter, step, "");
-
- cond = LLVMBuildICmp(builder, LLVMIntNE, next, end, "");
-
- after_block = LLVMAppendBasicBlock(function, "");
-
- LLVMBuildCondBr(builder, cond, after_block, state->block);
-
- LLVMAddIncoming(state->counter, &next, &block, 1);
-
- LLVMPositionBuilderAtEnd(builder, after_block);
-}
-
void
lp_build_loop_end_cond(LLVMBuilderRef builder,
LLVMValueRef end,
LLVMValueRef step,
- int llvm_cond,
+ LLVMIntPredicate llvm_cond,
struct lp_build_loop_state *state)
{
- LLVMBasicBlockRef block = LLVMGetInsertBlock(builder);
- LLVMValueRef function = LLVMGetBasicBlockParent(block);
LLVMValueRef next;
LLVMValueRef cond;
LLVMBasicBlockRef after_block;
next = LLVMBuildAdd(builder, state->counter, step, "");
+ LLVMBuildStore(builder, next, state->counter_var);
+
cond = LLVMBuildICmp(builder, llvm_cond, next, end, "");
- after_block = LLVMAppendBasicBlock(function, "");
+ after_block = lp_build_insert_new_block(builder, "loop_end");
LLVMBuildCondBr(builder, cond, after_block, state->block);
- LLVMAddIncoming(state->counter, &next, &block, 1);
-
LLVMPositionBuilderAtEnd(builder, after_block);
+
+ state->counter = LLVMBuildLoad(builder, state->counter_var, "");
+}
+
+
+void
+lp_build_loop_end(LLVMBuilderRef builder,
+ LLVMValueRef end,
+ LLVMValueRef step,
+ struct lp_build_loop_state *state)
+{
+ lp_build_loop_end_cond(builder, end, step, LLVMIntNE, state);
}
Is built with:
- LLVMValueRef x = LLVMGetUndef(); // or something else
+ // x needs an alloca variable
+ x = lp_build_alloca(builder, type, "x");
- flow = lp_build_flow_create(builder);
- lp_build_flow_scope_begin(flow);
+ lp_build_if(ctx, builder, cond);
+ LLVMBuildStore(LLVMBuildAdd(1, 2), x);
+ lp_build_else(ctx);
+ LLVMBuildStore(LLVMBuildAdd(2, 3). x);
+ lp_build_endif(ctx);
- // x needs a phi node
- lp_build_flow_scope_declare(flow, &x);
-
- lp_build_if(ctx, flow, builder, cond);
- x = LLVMAdd(1, 2);
- lp_build_else(ctx);
- x = LLVMAdd(2, 3);
- lp_build_endif(ctx);
-
- lp_build_flow_scope_end(flow);
-
- lp_build_flow_destroy(flow);
*/
* Begin an if/else/endif construct.
*/
void
-lp_build_if(struct lp_build_if_state *ctx,
- struct lp_build_flow_context *flow,
+lp_build_if(struct lp_build_if_state *ifthen,
LLVMBuilderRef builder,
LLVMValueRef condition)
{
LLVMBasicBlockRef block = LLVMGetInsertBlock(builder);
- struct lp_build_flow_if *ifthen;
- unsigned i;
-
- memset(ctx, 0, sizeof(*ctx));
- ctx->builder = builder;
- ctx->flow = flow;
- /* push/create new scope */
- ifthen = &lp_build_flow_push(flow, LP_BUILD_FLOW_IF)->ifthen;
- assert(ifthen);
-
- ifthen->num_variables = flow->num_variables;
+ memset(ifthen, 0, sizeof *ifthen);
+ ifthen->builder = builder;
ifthen->condition = condition;
ifthen->entry_block = block;
- /* create a Phi node for each variable in this flow scope */
- ifthen->phi = MALLOC(ifthen->num_variables * sizeof(*ifthen->phi));
- if (!ifthen->phi) {
- ifthen->num_variables = 0;
- return;
- }
-
/* create endif/merge basic block for the phi functions */
ifthen->merge_block = lp_build_insert_new_block(builder, "endif-block");
- LLVMPositionBuilderAtEnd(builder, ifthen->merge_block);
-
- /* create a phi node for each variable */
- for (i = 0; i < flow->num_variables; i++) {
- ifthen->phi[i] = LLVMBuildPhi(builder, LLVMTypeOf(*flow->variables[i]), "");
-
- /* add add the initial value of the var from the entry block */
- if (!LLVMIsUndef(*flow->variables[i]))
- LLVMAddIncoming(ifthen->phi[i], flow->variables[i],
- &ifthen->entry_block, 1);
- }
/* create/insert true_block before merge_block */
ifthen->true_block = LLVMInsertBasicBlock(ifthen->merge_block, "if-true-block");
* Begin else-part of a conditional
*/
void
-lp_build_else(struct lp_build_if_state *ctx)
+lp_build_else(struct lp_build_if_state *ifthen)
{
- struct lp_build_flow_context *flow = ctx->flow;
- struct lp_build_flow_if *ifthen;
- unsigned i;
-
- ifthen = &lp_build_flow_peek(flow, LP_BUILD_FLOW_IF)->ifthen;
- assert(ifthen);
-
- /* for each variable, update the Phi node with a (variable, block) pair */
- LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block);
- for (i = 0; i < flow->num_variables; i++) {
- assert(*flow->variables[i]);
- LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &ifthen->true_block, 1);
- }
+ /* Append an unconditional Br(anch) instruction on the true_block */
+ LLVMBuildBr(ifthen->builder, ifthen->merge_block);
/* create/insert false_block before the merge block */
ifthen->false_block = LLVMInsertBasicBlock(ifthen->merge_block, "if-false-block");
/* successive code goes into the else block */
- LLVMPositionBuilderAtEnd(ctx->builder, ifthen->false_block);
+ LLVMPositionBuilderAtEnd(ifthen->builder, ifthen->false_block);
}
* End a conditional.
*/
void
-lp_build_endif(struct lp_build_if_state *ctx)
+lp_build_endif(struct lp_build_if_state *ifthen)
{
- struct lp_build_flow_context *flow = ctx->flow;
- struct lp_build_flow_if *ifthen;
- LLVMBasicBlockRef curBlock = LLVMGetInsertBlock(ctx->builder);
- unsigned i;
-
- ifthen = &lp_build_flow_pop(flow, LP_BUILD_FLOW_IF)->ifthen;
- assert(ifthen);
-
/* Insert branch to the merge block from current block */
- LLVMBuildBr(ctx->builder, ifthen->merge_block);
+ LLVMBuildBr(ifthen->builder, ifthen->merge_block);
- if (ifthen->false_block) {
- LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block);
- /* for each variable, update the Phi node with a (variable, block) pair */
- for (i = 0; i < flow->num_variables; i++) {
- assert(*flow->variables[i]);
- LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &curBlock, 1);
- /* replace the variable ref with the phi function */
- *flow->variables[i] = ifthen->phi[i];
- }
- }
- else {
- /* no else clause */
- LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block);
- for (i = 0; i < flow->num_variables; i++) {
- assert(*flow->variables[i]);
- LLVMAddIncoming(ifthen->phi[i], flow->variables[i], &ifthen->true_block, 1);
-
- /* replace the variable ref with the phi function */
- *flow->variables[i] = ifthen->phi[i];
- }
- }
-
- FREE(ifthen->phi);
-
- /***
- *** Now patch in the various branch instructions.
- ***/
+ /*
+ * Now patch in the various branch instructions.
+ */
/* Insert the conditional branch instruction at the end of entry_block */
- LLVMPositionBuilderAtEnd(ctx->builder, ifthen->entry_block);
+ LLVMPositionBuilderAtEnd(ifthen->builder, ifthen->entry_block);
if (ifthen->false_block) {
/* we have an else clause */
- LLVMBuildCondBr(ctx->builder, ifthen->condition,
+ LLVMBuildCondBr(ifthen->builder, ifthen->condition,
ifthen->true_block, ifthen->false_block);
}
else {
/* no else clause */
- LLVMBuildCondBr(ctx->builder, ifthen->condition,
+ LLVMBuildCondBr(ifthen->builder, ifthen->condition,
ifthen->true_block, ifthen->merge_block);
}
- /* Insert branch from end of true_block to merge_block */
- if (ifthen->false_block) {
- /* Append an unconditional Br(anch) instruction on the true_block */
- LLVMPositionBuilderAtEnd(ctx->builder, ifthen->true_block);
- LLVMBuildBr(ctx->builder, ifthen->merge_block);
- }
- else {
- /* No else clause.
- * Note that we've already inserted the branch at the end of
- * true_block. See the very first LLVMBuildBr() call in this function.
- */
- }
-
/* Resume building code at end of the ifthen->merge_block */
- LLVMPositionBuilderAtEnd(ctx->builder, ifthen->merge_block);
+ LLVMPositionBuilderAtEnd(ifthen->builder, ifthen->merge_block);
}
}
res = LLVMBuildAlloca(first_builder, type, name);
+ LLVMBuildStore(builder, LLVMConstNull(type), res);
LLVMDisposeBuilder(first_builder);
struct lp_type;
-struct lp_build_flow_context;
-
-
-struct lp_build_flow_context *
-lp_build_flow_create(LLVMBuilderRef builder);
-
-void
-lp_build_flow_destroy(struct lp_build_flow_context *flow);
-
-void
-lp_build_flow_scope_begin(struct lp_build_flow_context *flow);
-
-void
-lp_build_flow_scope_declare(struct lp_build_flow_context *flow,
- LLVMValueRef *variable);
+/**
+ * Early exit. Useful to skip to the end of a function or block when
+ * the execution mask becomes zero or when there is an error condition.
+ */
+struct lp_build_skip_context
+{
+ LLVMBuilderRef builder;
-void
-lp_build_flow_scope_end(struct lp_build_flow_context *flow);
+ /** Block to skip to */
+ LLVMBasicBlockRef block;
+};
void
-lp_build_flow_skip_begin(struct lp_build_flow_context *flow);
+lp_build_flow_skip_begin(struct lp_build_skip_context *ctx,
+ LLVMBuilderRef builder);
void
-lp_build_flow_skip_cond_break(struct lp_build_flow_context *flow,
+lp_build_flow_skip_cond_break(struct lp_build_skip_context *ctx,
LLVMValueRef cond);
void
-lp_build_flow_skip_end(struct lp_build_flow_context *flow);
+lp_build_flow_skip_end(struct lp_build_skip_context *ctx);
struct lp_build_mask_context
{
- struct lp_build_flow_context *flow;
+ struct lp_build_skip_context skip;
LLVMTypeRef reg_type;
- LLVMValueRef value;
+ LLVMValueRef var;
};
void
lp_build_mask_begin(struct lp_build_mask_context *mask,
- struct lp_build_flow_context *flow,
+ LLVMBuilderRef builder,
struct lp_type type,
LLVMValueRef value);
+LLVMValueRef
+lp_build_mask_value(struct lp_build_mask_context *mask);
+
/**
* Bitwise AND the mask with the given value, if a previous mask was set.
*/
lp_build_mask_update(struct lp_build_mask_context *mask,
LLVMValueRef value);
+void
+lp_build_mask_check(struct lp_build_mask_context *mask);
+
LLVMValueRef
lp_build_mask_end(struct lp_build_mask_context *mask);
struct lp_build_loop_state
{
LLVMBasicBlockRef block;
+ LLVMValueRef counter_var;
LLVMValueRef counter;
};
lp_build_loop_end_cond(LLVMBuilderRef builder,
LLVMValueRef end,
LLVMValueRef step,
- int cond, /* LLVM condition */
+ LLVMIntPredicate cond,
struct lp_build_loop_state *state);
+/**
+ * if/else/endif.
+ */
struct lp_build_if_state
{
LLVMBuilderRef builder;
- struct lp_build_flow_context *flow;
+ LLVMValueRef condition;
+ LLVMBasicBlockRef entry_block;
+ LLVMBasicBlockRef true_block;
+ LLVMBasicBlockRef false_block;
+ LLVMBasicBlockRef merge_block;
};
void
lp_build_if(struct lp_build_if_state *ctx,
- struct lp_build_flow_context *flow,
LLVMBuilderRef builder,
LLVMValueRef condition);
{ "asm", GALLIVM_DEBUG_ASM, NULL },
{ "nopt", GALLIVM_DEBUG_NO_OPT, NULL },
{ "perf", GALLIVM_DEBUG_PERF, NULL },
+ { "no_brilinear", GALLIVM_DEBUG_NO_BRILINEAR, NULL },
DEBUG_NAMED_VALUE_END
};
extern void
lp_func_delete_body(LLVMValueRef func);
+
+extern LLVMValueRef
+lp_build_load_volatile(LLVMBuilderRef B, LLVMValueRef PointerVal,
+ const char *Name);
+
+
#endif /* !LP_BLD_INIT_H */
if(func == PIPE_FUNC_ALWAYS)
return ones;
- /* TODO: optimize the constant case */
+#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
+ /*
+ * There are no unsigned integer comparison instructions in SSE.
+ */
- /* XXX: It is not clear if we should use the ordered or unordered operators */
+ if (!type.floating && !type.sign &&
+ type.width * type.length == 128 &&
+ util_cpu_caps.has_sse2 &&
+ (func == PIPE_FUNC_LESS ||
+ func == PIPE_FUNC_LEQUAL ||
+ func == PIPE_FUNC_GREATER ||
+ func == PIPE_FUNC_GEQUAL) &&
+ (gallivm_debug & GALLIVM_DEBUG_PERF)) {
+ debug_printf("%s: inefficient <%u x i%u> unsigned comparison\n",
+ __FUNCTION__, type.length, type.width);
+ }
+#endif
#if HAVE_LLVM < 0x0207
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
#endif
#endif /* HAVE_LLVM < 0x0207 */
+ /* XXX: It is not clear if we should use the ordered or unordered operators */
+
if(type.floating) {
LLVMRealPredicate op;
switch(func) {
LLVMTypeRef arg_type;
LLVMValueRef args[3];
- if (type.width == 64) {
+ if (type.floating &&
+ type.width == 64) {
intrinsic = "llvm.x86.sse41.blendvpd";
arg_type = LLVMVectorType(LLVMDoubleType(), 2);
- } else if (type.width == 32) {
+ } else if (type.floating &&
+ type.width == 32) {
intrinsic = "llvm.x86.sse41.blendvps";
arg_type = LLVMVectorType(LLVMFloatType(), 4);
} else {
llvm::Function *func = llvm::unwrap<llvm::Function>(FF);
func->deleteBody();
}
+
+
+extern "C"
+LLVMValueRef
+lp_build_load_volatile(LLVMBuilderRef B, LLVMValueRef PointerVal,
+ const char *Name)
+{
+ return llvm::wrap(llvm::unwrap(B)->CreateLoad(llvm::unwrap(PointerVal), true, Name));
+}
+
#include "util/u_debug.h"
#include "util/u_memory.h"
+#include "util/u_string.h"
+#include "lp_bld_const.h"
#include "lp_bld_printf.h"
return LLVMBuildCall(builder, func_printf, params, argcount + 1, "");
}
+
+
+/**
+ * Print a float[4] vector.
+ */
+LLVMValueRef
+lp_build_print_vec4(LLVMBuilderRef builder, const char *msg, LLVMValueRef vec)
+{
+ char format[1000];
+ LLVMValueRef x, y, z, w;
+
+ x = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(0), "");
+ y = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(1), "");
+ z = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(2), "");
+ w = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(3), "");
+
+ util_snprintf(format, sizeof(format), "%s %%f %%f %%f %%f\n", msg);
+ return lp_build_printf(builder, format, x, y, z, w);
+}
LLVMValueRef lp_build_const_string_variable(LLVMModuleRef module, const char *str, int len);
LLVMValueRef lp_build_printf(LLVMBuilderRef builder, const char *fmt, ...);
+LLVMValueRef
+lp_build_print_vec4(LLVMBuilderRef builder, const char *msg, LLVMValueRef vec);
+
+
#endif
lp_build_scalar_ddx(struct lp_build_context *bld,
LLVMValueRef a)
{
- LLVMValueRef idx_left = LLVMConstInt(LLVMInt32Type(), LP_BLD_QUAD_TOP_LEFT, 0);
- LLVMValueRef idx_right = LLVMConstInt(LLVMInt32Type(), LP_BLD_QUAD_TOP_RIGHT, 0);
- LLVMValueRef a_left = LLVMBuildExtractElement(bld->builder, a, idx_left, "");
- LLVMValueRef a_right = LLVMBuildExtractElement(bld->builder, a, idx_right, "");
- return lp_build_sub(bld, a_right, a_left);
+ LLVMTypeRef i32t = LLVMInt32Type();
+ LLVMValueRef idx_left = LLVMConstInt(i32t, LP_BLD_QUAD_TOP_LEFT, 0);
+ LLVMValueRef idx_right = LLVMConstInt(i32t, LP_BLD_QUAD_TOP_RIGHT, 0);
+ LLVMValueRef a_left = LLVMBuildExtractElement(bld->builder, a, idx_left, "left");
+ LLVMValueRef a_right = LLVMBuildExtractElement(bld->builder, a, idx_right, "right");
+ if (bld->type.floating)
+ return LLVMBuildFSub(bld->builder, a_right, a_left, "ddx");
+ else
+ return LLVMBuildSub(bld->builder, a_right, a_left, "ddx");
}
lp_build_scalar_ddy(struct lp_build_context *bld,
LLVMValueRef a)
{
- LLVMValueRef idx_top = LLVMConstInt(LLVMInt32Type(), LP_BLD_QUAD_TOP_LEFT, 0);
- LLVMValueRef idx_bottom = LLVMConstInt(LLVMInt32Type(), LP_BLD_QUAD_BOTTOM_LEFT, 0);
- LLVMValueRef a_top = LLVMBuildExtractElement(bld->builder, a, idx_top, "");
- LLVMValueRef a_bottom = LLVMBuildExtractElement(bld->builder, a, idx_bottom, "");
- return lp_build_sub(bld, a_bottom, a_top);
+ LLVMTypeRef i32t = LLVMInt32Type();
+ LLVMValueRef idx_top = LLVMConstInt(i32t, LP_BLD_QUAD_TOP_LEFT, 0);
+ LLVMValueRef idx_bottom = LLVMConstInt(i32t, LP_BLD_QUAD_BOTTOM_LEFT, 0);
+ LLVMValueRef a_top = LLVMBuildExtractElement(bld->builder, a, idx_top, "top");
+ LLVMValueRef a_bottom = LLVMBuildExtractElement(bld->builder, a, idx_bottom, "bottom");
+ if (bld->type.floating)
+ return LLVMBuildFSub(bld->builder, a_bottom, a_top, "ddy");
+ else
+ return LLVMBuildSub(bld->builder, a_bottom, a_top, "ddy");
}
#include "lp_bld_arit.h"
#include "lp_bld_const.h"
#include "lp_bld_debug.h"
+#include "lp_bld_printf.h"
#include "lp_bld_flow.h"
#include "lp_bld_sample.h"
#include "lp_bld_swizzle.h"
#include "lp_bld_type.h"
+/*
+ * Bri-linear factor. Should be greater than one.
+ */
+#define BRILINEAR_FACTOR 2
+
+
+/**
+ * Does the given texture wrap mode allow sampling the texture border color?
+ * XXX maybe move this into gallium util code.
+ */
+boolean
+lp_sampler_wrap_mode_uses_border_color(unsigned mode,
+ unsigned min_img_filter,
+ unsigned mag_img_filter)
+{
+ switch (mode) {
+ case PIPE_TEX_WRAP_REPEAT:
+ case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+ case PIPE_TEX_WRAP_MIRROR_REPEAT:
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
+ return FALSE;
+ case PIPE_TEX_WRAP_CLAMP:
+ case PIPE_TEX_WRAP_MIRROR_CLAMP:
+ if (min_img_filter == PIPE_TEX_FILTER_NEAREST &&
+ mag_img_filter == PIPE_TEX_FILTER_NEAREST) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+ case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
+ return TRUE;
+ default:
+ assert(0 && "unexpected wrap mode");
+ return FALSE;
+ }
+}
+
+
/**
* Initialize lp_sampler_static_state object with the gallium sampler
* and texture state.
state->wrap_r = sampler->wrap_r;
state->min_img_filter = sampler->min_img_filter;
state->mag_img_filter = sampler->mag_img_filter;
- if (view->last_level) {
+
+ if (view->last_level && sampler->max_lod > 0.0f) {
state->min_mip_filter = sampler->min_mip_filter;
} else {
state->min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
}
- /* If min_lod == max_lod we can greatly simplify mipmap selection.
- * This is a case that occurs during automatic mipmap generation.
- */
- if (sampler->min_lod == sampler->max_lod) {
- state->min_max_lod_equal = 1;
+ if (state->min_mip_filter != PIPE_TEX_MIPFILTER_NONE) {
+ if (sampler->lod_bias != 0.0f) {
+ state->lod_bias_non_zero = 1;
+ }
+
+ /* If min_lod == max_lod we can greatly simplify mipmap selection.
+ * This is a case that occurs during automatic mipmap generation.
+ */
+ if (sampler->min_lod == sampler->max_lod) {
+ state->min_max_lod_equal = 1;
+ } else {
+ if (sampler->min_lod > 0.0f) {
+ state->apply_min_lod = 1;
+ }
+
+ if (sampler->max_lod < (float)view->last_level) {
+ state->apply_max_lod = 1;
+ }
+ }
}
state->compare_mode = sampler->compare_mode;
}
+/**
+ * Generate code to compute coordinate gradient (rho).
+ * \param ddx partial derivatives of (s, t, r, q) with respect to X
+ * \param ddy partial derivatives of (s, t, r, q) with respect to Y
+ *
+ * XXX: The resulting rho is scalar, so we ignore all but the first element of
+ * derivatives that are passed by the shader.
+ */
+static LLVMValueRef
+lp_build_rho(struct lp_build_sample_context *bld,
+ const LLVMValueRef ddx[4],
+ const LLVMValueRef ddy[4])
+{
+ struct lp_build_context *float_size_bld = &bld->float_size_bld;
+ struct lp_build_context *float_bld = &bld->float_bld;
+ const unsigned dims = bld->dims;
+ LLVMTypeRef i32t = LLVMInt32Type();
+ LLVMValueRef index0 = LLVMConstInt(i32t, 0, 0);
+ LLVMValueRef index1 = LLVMConstInt(i32t, 1, 0);
+ LLVMValueRef index2 = LLVMConstInt(i32t, 2, 0);
+ LLVMValueRef dsdx, dsdy, dtdx, dtdy, drdx, drdy;
+ LLVMValueRef rho_x, rho_y;
+ LLVMValueRef rho_vec;
+ LLVMValueRef float_size;
+ LLVMValueRef rho;
+
+ dsdx = ddx[0];
+ dsdy = ddy[0];
+
+ if (dims <= 1) {
+ rho_x = dsdx;
+ rho_y = dsdy;
+ }
+ else {
+ rho_x = float_size_bld->undef;
+ rho_y = float_size_bld->undef;
+
+ rho_x = LLVMBuildInsertElement(bld->builder, rho_x, dsdx, index0, "");
+ rho_y = LLVMBuildInsertElement(bld->builder, rho_y, dsdy, index0, "");
+
+ dtdx = ddx[1];
+ dtdy = ddy[1];
+
+ rho_x = LLVMBuildInsertElement(bld->builder, rho_x, dtdx, index1, "");
+ rho_y = LLVMBuildInsertElement(bld->builder, rho_y, dtdy, index1, "");
+
+ if (dims >= 3) {
+ drdx = ddx[2];
+ drdy = ddy[2];
+
+ rho_x = LLVMBuildInsertElement(bld->builder, rho_x, drdx, index2, "");
+ rho_y = LLVMBuildInsertElement(bld->builder, rho_y, drdy, index2, "");
+ }
+ }
+
+ rho_x = lp_build_abs(float_size_bld, rho_x);
+ rho_y = lp_build_abs(float_size_bld, rho_y);
+
+ rho_vec = lp_build_max(float_size_bld, rho_x, rho_y);
+
+ float_size = lp_build_int_to_float(float_size_bld, bld->int_size);
+
+ rho_vec = lp_build_mul(float_size_bld, rho_vec, float_size);
+
+ if (dims <= 1) {
+ rho = rho_vec;
+ }
+ else {
+ if (dims >= 2) {
+ LLVMValueRef rho_s, rho_t, rho_r;
+
+ rho_s = LLVMBuildExtractElement(bld->builder, rho_vec, index0, "");
+ rho_t = LLVMBuildExtractElement(bld->builder, rho_vec, index1, "");
+
+ rho = lp_build_max(float_bld, rho_s, rho_t);
+
+ if (dims >= 3) {
+ rho_r = LLVMBuildExtractElement(bld->builder, rho_vec, index0, "");
+ rho = lp_build_max(float_bld, rho, rho_r);
+ }
+ }
+ }
+
+ return rho;
+}
+
+
+/*
+ * Bri-linear lod computation
+ *
+ * Use a piece-wise linear approximation of log2 such that:
+ * - round to nearest, for values in the neighborhood of -1, 0, 1, 2, etc.
+ * - linear approximation for values in the neighborhood of 0.5, 1.5., etc,
+ * with the steepness specified in 'factor'
+ * - exact result for 0.5, 1.5, etc.
+ *
+ *
+ * 1.0 - /----*
+ * /
+ * /
+ * /
+ * 0.5 - *
+ * /
+ * /
+ * /
+ * 0.0 - *----/
+ *
+ * | |
+ * 2^0 2^1
+ *
+ * This is a technique also commonly used in hardware:
+ * - http://ixbtlabs.com/articles2/gffx/nv40-rx800-3.html
+ *
+ * TODO: For correctness, this should only be applied when texture is known to
+ * have regular mipmaps, i.e., mipmaps derived from the base level.
+ *
+ * TODO: This could be done in fixed point, where applicable.
+ */
+static void
+lp_build_brilinear_lod(struct lp_build_context *bld,
+ LLVMValueRef lod,
+ double factor,
+ LLVMValueRef *out_lod_ipart,
+ LLVMValueRef *out_lod_fpart)
+{
+ LLVMValueRef lod_fpart;
+ double pre_offset = (factor - 0.5)/factor - 0.5;
+ double post_offset = 1 - factor;
+
+ if (0) {
+ lp_build_printf(bld->builder, "lod = %f\n", lod);
+ }
+
+ lod = lp_build_add(bld, lod,
+ lp_build_const_vec(bld->type, pre_offset));
+
+ lp_build_ifloor_fract(bld, lod, out_lod_ipart, &lod_fpart);
+
+ lod_fpart = lp_build_mul(bld, lod_fpart,
+ lp_build_const_vec(bld->type, factor));
+
+ lod_fpart = lp_build_add(bld, lod_fpart,
+ lp_build_const_vec(bld->type, post_offset));
+
+ /*
+ * It's not necessary to clamp lod_fpart since:
+ * - the above expression will never produce numbers greater than one.
+ * - the mip filtering branch is only taken if lod_fpart is positive
+ */
+
+ *out_lod_fpart = lod_fpart;
+
+ if (0) {
+ lp_build_printf(bld->builder, "lod_ipart = %i\n", *out_lod_ipart);
+ lp_build_printf(bld->builder, "lod_fpart = %f\n\n", *out_lod_fpart);
+ }
+}
+
+
+/*
+ * Combined log2 and brilinear lod computation.
+ *
+ * It's in all identical to calling lp_build_fast_log2() and
+ * lp_build_brilinear_lod() above, but by combining we can compute the interger
+ * and fractional part independently.
+ */
+static void
+lp_build_brilinear_rho(struct lp_build_context *bld,
+ LLVMValueRef rho,
+ double factor,
+ LLVMValueRef *out_lod_ipart,
+ LLVMValueRef *out_lod_fpart)
+{
+ LLVMValueRef lod_ipart;
+ LLVMValueRef lod_fpart;
+
+ const double pre_factor = (2*factor - 0.5)/(M_SQRT2*factor);
+ const double post_offset = 1 - 2*factor;
+
+ assert(bld->type.floating);
+
+ assert(lp_check_value(bld->type, rho));
+
+ /*
+ * The pre factor will make the intersections with the exact powers of two
+ * happen precisely where we want then to be, which means that the integer
+ * part will not need any post adjustments.
+ */
+ rho = lp_build_mul(bld, rho,
+ lp_build_const_vec(bld->type, pre_factor));
+
+ /* ipart = ifloor(log2(rho)) */
+ lod_ipart = lp_build_extract_exponent(bld, rho, 0);
+
+ /* fpart = rho / 2**ipart */
+ lod_fpart = lp_build_extract_mantissa(bld, rho);
+
+ lod_fpart = lp_build_mul(bld, lod_fpart,
+ lp_build_const_vec(bld->type, factor));
+
+ lod_fpart = lp_build_add(bld, lod_fpart,
+ lp_build_const_vec(bld->type, post_offset));
+
+ /*
+ * Like lp_build_brilinear_lod, it's not necessary to clamp lod_fpart since:
+ * - the above expression will never produce numbers greater than one.
+ * - the mip filtering branch is only taken if lod_fpart is positive
+ */
+
+ *out_lod_ipart = lod_ipart;
+ *out_lod_fpart = lod_fpart;
+}
+
+
/**
* Generate code to compute texture level of detail (lambda).
* \param ddx partial derivatives of (s, t, r, q) with respect to X
* XXX: The resulting lod is scalar, so ignore all but the first element of
* derivatives, lod_bias, etc that are passed by the shader.
*/
-LLVMValueRef
+void
lp_build_lod_selector(struct lp_build_sample_context *bld,
unsigned unit,
const LLVMValueRef ddx[4],
const LLVMValueRef ddy[4],
LLVMValueRef lod_bias, /* optional */
LLVMValueRef explicit_lod, /* optional */
- LLVMValueRef width,
- LLVMValueRef height,
- LLVMValueRef depth)
+ unsigned mip_filter,
+ LLVMValueRef *out_lod_ipart,
+ LLVMValueRef *out_lod_fpart)
{
- LLVMValueRef min_lod =
- bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit);
+ struct lp_build_context *float_bld = &bld->float_bld;
+ LLVMValueRef lod;
+
+ *out_lod_ipart = bld->int_bld.zero;
+ *out_lod_fpart = bld->float_bld.zero;
if (bld->static_state->min_max_lod_equal) {
/* User is forcing sampling from a particular mipmap level.
* This is hit during mipmap generation.
*/
- return min_lod;
+ LLVMValueRef min_lod =
+ bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit);
+
+ lod = min_lod;
}
else {
- struct lp_build_context *float_bld = &bld->float_bld;
LLVMValueRef sampler_lod_bias =
bld->dynamic_state->lod_bias(bld->dynamic_state, bld->builder, unit);
- LLVMValueRef max_lod =
- bld->dynamic_state->max_lod(bld->dynamic_state, bld->builder, unit);
LLVMValueRef index0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
- LLVMValueRef lod;
if (explicit_lod) {
lod = LLVMBuildExtractElement(bld->builder, explicit_lod,
index0, "");
}
else {
- const int dims = texture_dims(bld->static_state->target);
- LLVMValueRef dsdx, dsdy;
- LLVMValueRef dtdx = NULL, dtdy = NULL, drdx = NULL, drdy = NULL;
LLVMValueRef rho;
- dsdx = LLVMBuildExtractElement(bld->builder, ddx[0], index0, "dsdx");
- dsdx = lp_build_abs(float_bld, dsdx);
- dsdy = LLVMBuildExtractElement(bld->builder, ddy[0], index0, "dsdy");
- dsdy = lp_build_abs(float_bld, dsdy);
- if (dims > 1) {
- dtdx = LLVMBuildExtractElement(bld->builder, ddx[1], index0, "dtdx");
- dtdx = lp_build_abs(float_bld, dtdx);
- dtdy = LLVMBuildExtractElement(bld->builder, ddy[1], index0, "dtdy");
- dtdy = lp_build_abs(float_bld, dtdy);
- if (dims > 2) {
- drdx = LLVMBuildExtractElement(bld->builder, ddx[2], index0, "drdx");
- drdx = lp_build_abs(float_bld, drdx);
- drdy = LLVMBuildExtractElement(bld->builder, ddy[2], index0, "drdy");
- drdy = lp_build_abs(float_bld, drdy);
- }
- }
+ rho = lp_build_rho(bld, ddx, ddy);
- /* Compute rho = max of all partial derivatives scaled by texture size.
- * XXX this could be vectorized somewhat
+ /*
+ * Compute lod = log2(rho)
*/
- rho = LLVMBuildFMul(bld->builder,
- lp_build_max(float_bld, dsdx, dsdy),
- lp_build_int_to_float(float_bld, width), "");
- if (dims > 1) {
- LLVMValueRef max;
- max = LLVMBuildFMul(bld->builder,
- lp_build_max(float_bld, dtdx, dtdy),
- lp_build_int_to_float(float_bld, height), "");
- rho = lp_build_max(float_bld, rho, max);
- if (dims > 2) {
- max = LLVMBuildFMul(bld->builder,
- lp_build_max(float_bld, drdx, drdy),
- lp_build_int_to_float(float_bld, depth), "");
- rho = lp_build_max(float_bld, rho, max);
+
+ if (!lod_bias &&
+ !bld->static_state->lod_bias_non_zero &&
+ !bld->static_state->apply_max_lod &&
+ !bld->static_state->apply_min_lod) {
+ /*
+ * Special case when there are no post-log2 adjustments, which
+ * saves instructions but keeping the integer and fractional lod
+ * computations separate from the start.
+ */
+
+ if (mip_filter == PIPE_TEX_MIPFILTER_NONE ||
+ mip_filter == PIPE_TEX_MIPFILTER_NEAREST) {
+ *out_lod_ipart = lp_build_ilog2(float_bld, rho);
+ *out_lod_fpart = bld->float_bld.zero;
+ return;
+ }
+ if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR &&
+ !(gallivm_debug & GALLIVM_DEBUG_NO_BRILINEAR)) {
+ lp_build_brilinear_rho(float_bld, rho, BRILINEAR_FACTOR,
+ out_lod_ipart, out_lod_fpart);
+ return;
}
}
- /* compute lod = log2(rho) */
- lod = lp_build_log2(float_bld, rho);
+ if (0) {
+ lod = lp_build_log2(float_bld, rho);
+ }
+ else {
+ lod = lp_build_fast_log2(float_bld, rho);
+ }
/* add shader lod bias */
if (lod_bias) {
}
/* add sampler lod bias */
- lod = LLVMBuildFAdd(bld->builder, lod, sampler_lod_bias, "sampler_lod_bias");
+ if (bld->static_state->lod_bias_non_zero)
+ lod = LLVMBuildFAdd(bld->builder, lod, sampler_lod_bias, "sampler_lod_bias");
+
/* clamp lod */
- lod = lp_build_clamp(float_bld, lod, min_lod, max_lod);
+ if (bld->static_state->apply_max_lod) {
+ LLVMValueRef max_lod =
+ bld->dynamic_state->max_lod(bld->dynamic_state, bld->builder, unit);
+
+ lod = lp_build_min(float_bld, lod, max_lod);
+ }
+ if (bld->static_state->apply_min_lod) {
+ LLVMValueRef min_lod =
+ bld->dynamic_state->min_lod(bld->dynamic_state, bld->builder, unit);
- return lod;
+ lod = lp_build_max(float_bld, lod, min_lod);
+ }
}
+
+ if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
+ if (!(gallivm_debug & GALLIVM_DEBUG_NO_BRILINEAR)) {
+ lp_build_brilinear_lod(float_bld, lod, BRILINEAR_FACTOR,
+ out_lod_ipart, out_lod_fpart);
+ }
+ else {
+ lp_build_ifloor_fract(float_bld, lod, out_lod_ipart, out_lod_fpart);
+ }
+
+ lp_build_name(*out_lod_fpart, "lod_fpart");
+ }
+ else {
+ *out_lod_ipart = lp_build_iround(float_bld, lod);
+ }
+
+ lp_build_name(*out_lod_ipart, "lod_ipart");
+
+ return;
}
void
lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
unsigned unit,
- LLVMValueRef lod,
+ LLVMValueRef lod_ipart,
LLVMValueRef *level_out)
{
- struct lp_build_context *float_bld = &bld->float_bld;
struct lp_build_context *int_bld = &bld->int_bld;
LLVMValueRef last_level, level;
bld->builder, unit);
/* convert float lod to integer */
- level = lp_build_iround(float_bld, lod);
+ level = lod_ipart;
/* clamp level to legal range of levels */
*level_out = lp_build_clamp(int_bld, level, zero, last_level);
void
lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
unsigned unit,
- LLVMValueRef lod,
+ LLVMValueRef lod_ipart,
+ LLVMValueRef *lod_fpart_inout,
LLVMValueRef *level0_out,
- LLVMValueRef *level1_out,
- LLVMValueRef *weight_out)
+ LLVMValueRef *level1_out)
{
- struct lp_build_context *float_bld = &bld->float_bld;
+ LLVMBuilderRef builder = bld->builder;
struct lp_build_context *int_bld = &bld->int_bld;
- LLVMValueRef last_level, level;
+ struct lp_build_context *float_bld = &bld->float_bld;
+ LLVMValueRef last_level;
+ LLVMValueRef clamp_min;
+ LLVMValueRef clamp_max;
+
+ *level0_out = lod_ipart;
+ *level1_out = lp_build_add(int_bld, lod_ipart, int_bld->one);
last_level = bld->dynamic_state->last_level(bld->dynamic_state,
bld->builder, unit);
- /* convert float lod to integer */
- level = lp_build_ifloor(float_bld, lod);
-
- /* compute level 0 and clamp to legal range of levels */
- *level0_out = lp_build_clamp(int_bld, level,
- int_bld->zero,
- last_level);
- /* compute level 1 and clamp to legal range of levels */
- level = lp_build_add(int_bld, level, int_bld->one);
- *level1_out = lp_build_clamp(int_bld, level,
- int_bld->zero,
- last_level);
-
- *weight_out = lp_build_fract(float_bld, lod);
+ /*
+ * Clamp both lod_ipart and lod_ipart + 1 to [0, last_level], with the
+ * minimum number of comparisons, and zeroing lod_fpart in the extreme
+ * ends in the process.
+ */
+
+ /* lod_ipart < 0 */
+ clamp_min = LLVMBuildICmp(builder, LLVMIntSLT,
+ lod_ipart, int_bld->zero,
+ "clamp_lod_to_zero");
+
+ *level0_out = LLVMBuildSelect(builder, clamp_min,
+ int_bld->zero, *level0_out, "");
+
+ *level1_out = LLVMBuildSelect(builder, clamp_min,
+ int_bld->zero, *level1_out, "");
+
+ *lod_fpart_inout = LLVMBuildSelect(builder, clamp_min,
+ float_bld->zero, *lod_fpart_inout, "");
+
+ /* lod_ipart >= last_level */
+ clamp_max = LLVMBuildICmp(builder, LLVMIntSGE,
+ lod_ipart, last_level,
+ "clamp_lod_to_last");
+
+ *level0_out = LLVMBuildSelect(builder, clamp_max,
+ last_level, *level0_out, "");
+
+ *level1_out = LLVMBuildSelect(builder, clamp_max,
+ last_level, *level1_out, "");
+
+ *lod_fpart_inout = LLVMBuildSelect(builder, clamp_max,
+ float_bld->zero, *lod_fpart_inout, "");
+
+ lp_build_name(*level0_out, "sampler%u_miplevel0", unit);
+ lp_build_name(*level1_out, "sampler%u_miplevel1", unit);
+ lp_build_name(*lod_fpart_inout, "sampler%u_mipweight", unit);
}
+/**
+ * Return pointer to a single mipmap level.
+ * \param data_array array of pointers to mipmap levels
+ * \param level integer mipmap level
+ */
LLVMValueRef
lp_build_get_mipmap_level(struct lp_build_sample_context *bld,
- LLVMValueRef data_array, LLVMValueRef level)
+ LLVMValueRef level)
{
LLVMValueRef indexes[2], data_ptr;
indexes[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indexes[1] = level;
- data_ptr = LLVMBuildGEP(bld->builder, data_array, indexes, 2, "");
+ data_ptr = LLVMBuildGEP(bld->builder, bld->data_array, indexes, 2, "");
data_ptr = LLVMBuildLoad(bld->builder, data_ptr, "");
return data_ptr;
}
LLVMValueRef
lp_build_get_const_mipmap_level(struct lp_build_sample_context *bld,
- LLVMValueRef data_array, int level)
+ int level)
{
LLVMValueRef lvl = LLVMConstInt(LLVMInt32Type(), level, 0);
- return lp_build_get_mipmap_level(bld, data_array, lvl);
+ return lp_build_get_mipmap_level(bld, lvl);
}
* Return max(1, base_size >> level);
*/
static LLVMValueRef
-lp_build_minify(struct lp_build_sample_context *bld,
+lp_build_minify(struct lp_build_context *bld,
LLVMValueRef base_size,
LLVMValueRef level)
{
- LLVMValueRef size = LLVMBuildLShr(bld->builder, base_size, level, "minify");
- size = lp_build_max(&bld->int_coord_bld, size, bld->int_coord_bld.one);
- return size;
+ assert(lp_check_value(bld->type, base_size));
+ assert(lp_check_value(bld->type, level));
+
+ if (level == bld->zero) {
+ /* if we're using mipmap level zero, no minification is needed */
+ return base_size;
+ }
+ else {
+ LLVMValueRef size =
+ LLVMBuildLShr(bld->builder, base_size, level, "minify");
+ assert(bld->type.sign);
+ size = lp_build_max(bld, size, bld->one);
+ return size;
+ }
}
*/
void
lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld,
- unsigned dims,
- LLVMValueRef width_vec,
- LLVMValueRef height_vec,
- LLVMValueRef depth_vec,
- LLVMValueRef ilevel0,
- LLVMValueRef ilevel1,
- LLVMValueRef row_stride_array,
- LLVMValueRef img_stride_array,
- LLVMValueRef *width0_vec,
- LLVMValueRef *width1_vec,
- LLVMValueRef *height0_vec,
- LLVMValueRef *height1_vec,
- LLVMValueRef *depth0_vec,
- LLVMValueRef *depth1_vec,
- LLVMValueRef *row_stride0_vec,
- LLVMValueRef *row_stride1_vec,
- LLVMValueRef *img_stride0_vec,
- LLVMValueRef *img_stride1_vec)
+ LLVMValueRef ilevel,
+ LLVMValueRef *out_size,
+ LLVMValueRef *row_stride_vec,
+ LLVMValueRef *img_stride_vec)
{
- const unsigned mip_filter = bld->static_state->min_mip_filter;
- LLVMValueRef ilevel0_vec, ilevel1_vec;
+ const unsigned dims = bld->dims;
+ LLVMValueRef ilevel_vec;
- ilevel0_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, ilevel0);
- if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR)
- ilevel1_vec = lp_build_broadcast_scalar(&bld->int_coord_bld, ilevel1);
+ ilevel_vec = lp_build_broadcast_scalar(&bld->int_size_bld, ilevel);
/*
- * Compute width, height, depth at mipmap level 'ilevel0'
+ * Compute width, height, depth at mipmap level 'ilevel'
*/
- *width0_vec = lp_build_minify(bld, width_vec, ilevel0_vec);
+ *out_size = lp_build_minify(&bld->int_size_bld, bld->int_size, ilevel_vec);
+
if (dims >= 2) {
- *height0_vec = lp_build_minify(bld, height_vec, ilevel0_vec);
- *row_stride0_vec = lp_build_get_level_stride_vec(bld,
- row_stride_array,
- ilevel0);
+ *row_stride_vec = lp_build_get_level_stride_vec(bld,
+ bld->row_stride_array,
+ ilevel);
if (dims == 3 || bld->static_state->target == PIPE_TEXTURE_CUBE) {
- *img_stride0_vec = lp_build_get_level_stride_vec(bld,
- img_stride_array,
- ilevel0);
- if (dims == 3) {
- *depth0_vec = lp_build_minify(bld, depth_vec, ilevel0_vec);
- }
+ *img_stride_vec = lp_build_get_level_stride_vec(bld,
+ bld->img_stride_array,
+ ilevel);
}
}
- if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
- /* compute width, height, depth for second mipmap level at 'ilevel1' */
- *width1_vec = lp_build_minify(bld, width_vec, ilevel1_vec);
- if (dims >= 2) {
- *height1_vec = lp_build_minify(bld, height_vec, ilevel1_vec);
- *row_stride1_vec = lp_build_get_level_stride_vec(bld,
- row_stride_array,
- ilevel1);
- if (dims == 3 || bld->static_state->target == PIPE_TEXTURE_CUBE) {
- *img_stride1_vec = lp_build_get_level_stride_vec(bld,
- img_stride_array,
- ilevel1);
- if (dims == 3) {
- *depth1_vec = lp_build_minify(bld, depth_vec, ilevel1_vec);
- }
- }
+}
+
+
+/**
+ * Extract and broadcast texture size.
+ *
+ * @param size_type type of the texture size vector (either
+ * bld->int_size_type or bld->float_size_type)
+ * @param coord_type type of the texture size vector (either
+ * bld->int_coord_type or bld->coord_type)
+ * @param int_size vector with the integer texture size (width, height,
+ * depth)
+ */
+void
+lp_build_extract_image_sizes(struct lp_build_sample_context *bld,
+ struct lp_type size_type,
+ struct lp_type coord_type,
+ LLVMValueRef size,
+ LLVMValueRef *out_width,
+ LLVMValueRef *out_height,
+ LLVMValueRef *out_depth)
+{
+ const unsigned dims = bld->dims;
+ LLVMTypeRef i32t = LLVMInt32Type();
+
+ *out_width = lp_build_extract_broadcast(bld->builder,
+ size_type,
+ coord_type,
+ size,
+ LLVMConstInt(i32t, 0, 0));
+ if (dims >= 2) {
+ *out_height = lp_build_extract_broadcast(bld->builder,
+ size_type,
+ coord_type,
+ size,
+ LLVMConstInt(i32t, 1, 0));
+ if (dims == 3) {
+ *out_depth = lp_build_extract_broadcast(bld->builder,
+ size_type,
+ coord_type,
+ size,
+ LLVMConstInt(i32t, 2, 0));
}
}
}
+/**
+ * Unnormalize coords.
+ *
+ * @param int_size vector with the integer texture size (width, height, depth)
+ */
+void
+lp_build_unnormalized_coords(struct lp_build_sample_context *bld,
+ LLVMValueRef flt_size,
+ LLVMValueRef *s,
+ LLVMValueRef *t,
+ LLVMValueRef *r)
+{
+ const unsigned dims = bld->dims;
+ LLVMValueRef width;
+ LLVMValueRef height;
+ LLVMValueRef depth;
+
+ lp_build_extract_image_sizes(bld,
+ bld->float_size_type,
+ bld->coord_type,
+ flt_size,
+ &width,
+ &height,
+ &depth);
+
+ /* s = s * width, t = t * height */
+ *s = lp_build_mul(&bld->coord_bld, *s, width);
+ if (dims >= 2) {
+ *t = lp_build_mul(&bld->coord_bld, *t, height);
+ if (dims >= 3) {
+ *r = lp_build_mul(&bld->coord_bld, *r, depth);
+ }
+ }
+}
+
/** Helper used by lp_build_cube_lookup() */
static LLVMValueRef
rz_pos = LLVMBuildFCmp(bld->builder, LLVMRealUGE, rz, float_bld->zero, "");
{
- struct lp_build_flow_context *flow_ctx;
struct lp_build_if_state if_ctx;
+ LLVMValueRef face_s_var;
+ LLVMValueRef face_t_var;
+ LLVMValueRef face_var;
- flow_ctx = lp_build_flow_create(bld->builder);
- lp_build_flow_scope_begin(flow_ctx);
-
- *face_s = bld->coord_bld.undef;
- *face_t = bld->coord_bld.undef;
- *face = bld->int_bld.undef;
+ face_s_var = lp_build_alloca(bld->builder, bld->coord_bld.vec_type, "face_s_var");
+ face_t_var = lp_build_alloca(bld->builder, bld->coord_bld.vec_type, "face_t_var");
+ face_var = lp_build_alloca(bld->builder, bld->int_bld.vec_type, "face_var");
- lp_build_name(*face_s, "face_s");
- lp_build_name(*face_t, "face_t");
- lp_build_name(*face, "face");
-
- lp_build_flow_scope_declare(flow_ctx, face_s);
- lp_build_flow_scope_declare(flow_ctx, face_t);
- lp_build_flow_scope_declare(flow_ctx, face);
-
- lp_build_if(&if_ctx, flow_ctx, bld->builder, arx_ge_ary_arz);
+ lp_build_if(&if_ctx, bld->builder, arx_ge_ary_arz);
{
/* +/- X face */
LLVMValueRef sign = lp_build_sgn(float_bld, rx);
*face = lp_build_cube_face(bld, rx,
PIPE_TEX_FACE_POS_X,
PIPE_TEX_FACE_NEG_X);
+ LLVMBuildStore(bld->builder, *face_s, face_s_var);
+ LLVMBuildStore(bld->builder, *face_t, face_t_var);
+ LLVMBuildStore(bld->builder, *face, face_var);
}
lp_build_else(&if_ctx);
{
- struct lp_build_flow_context *flow_ctx2;
struct lp_build_if_state if_ctx2;
- LLVMValueRef face_s2 = bld->coord_bld.undef;
- LLVMValueRef face_t2 = bld->coord_bld.undef;
- LLVMValueRef face2 = bld->int_bld.undef;
-
- flow_ctx2 = lp_build_flow_create(bld->builder);
- lp_build_flow_scope_begin(flow_ctx2);
- lp_build_flow_scope_declare(flow_ctx2, &face_s2);
- lp_build_flow_scope_declare(flow_ctx2, &face_t2);
- lp_build_flow_scope_declare(flow_ctx2, &face2);
-
ary_ge_arx_arz = LLVMBuildAnd(bld->builder, ary_ge_arx, ary_ge_arz, "");
- lp_build_if(&if_ctx2, flow_ctx2, bld->builder, ary_ge_arx_arz);
+ lp_build_if(&if_ctx2, bld->builder, ary_ge_arx_arz);
{
/* +/- Y face */
LLVMValueRef sign = lp_build_sgn(float_bld, ry);
LLVMValueRef ima = lp_build_cube_ima(coord_bld, t);
- face_s2 = lp_build_cube_coord(coord_bld, NULL, -1, s, ima);
- face_t2 = lp_build_cube_coord(coord_bld, sign, -1, r, ima);
- face2 = lp_build_cube_face(bld, ry,
+ *face_s = lp_build_cube_coord(coord_bld, NULL, -1, s, ima);
+ *face_t = lp_build_cube_coord(coord_bld, sign, -1, r, ima);
+ *face = lp_build_cube_face(bld, ry,
PIPE_TEX_FACE_POS_Y,
PIPE_TEX_FACE_NEG_Y);
+ LLVMBuildStore(bld->builder, *face_s, face_s_var);
+ LLVMBuildStore(bld->builder, *face_t, face_t_var);
+ LLVMBuildStore(bld->builder, *face, face_var);
}
lp_build_else(&if_ctx2);
{
/* +/- Z face */
LLVMValueRef sign = lp_build_sgn(float_bld, rz);
LLVMValueRef ima = lp_build_cube_ima(coord_bld, r);
- face_s2 = lp_build_cube_coord(coord_bld, sign, -1, s, ima);
- face_t2 = lp_build_cube_coord(coord_bld, NULL, +1, t, ima);
- face2 = lp_build_cube_face(bld, rz,
+ *face_s = lp_build_cube_coord(coord_bld, sign, -1, s, ima);
+ *face_t = lp_build_cube_coord(coord_bld, NULL, +1, t, ima);
+ *face = lp_build_cube_face(bld, rz,
PIPE_TEX_FACE_POS_Z,
PIPE_TEX_FACE_NEG_Z);
+ LLVMBuildStore(bld->builder, *face_s, face_s_var);
+ LLVMBuildStore(bld->builder, *face_t, face_t_var);
+ LLVMBuildStore(bld->builder, *face, face_var);
}
lp_build_endif(&if_ctx2);
- lp_build_flow_scope_end(flow_ctx2);
- lp_build_flow_destroy(flow_ctx2);
- *face_s = face_s2;
- *face_t = face_t2;
- *face = face2;
}
lp_build_endif(&if_ctx);
- lp_build_flow_scope_end(flow_ctx);
- lp_build_flow_destroy(flow_ctx);
+
+ *face_s = LLVMBuildLoad(bld->builder, face_s_var, "face_s");
+ *face_t = LLVMBuildLoad(bld->builder, face_t_var, "face_t");
+ *face = LLVMBuildLoad(bld->builder, face_var, "face");
}
}
unsigned compare_func:3;
unsigned normalized_coords:1;
unsigned min_max_lod_equal:1; /**< min_lod == max_lod ? */
+ unsigned lod_bias_non_zero:1;
+ unsigned apply_min_lod:1; /**< min_lod > 0 ? */
+ unsigned apply_max_lod:1; /**< max_lod < last_level ? */
};
struct lp_sampler_dynamic_state
{
- /** Obtain the base texture width. */
+ /** Obtain the base texture width (returns int32) */
LLVMValueRef
(*width)( const struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder,
unsigned unit);
- /** Obtain the base texture height. */
+ /** Obtain the base texture height (returns int32) */
LLVMValueRef
(*height)( const struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder,
unsigned unit);
- /** Obtain the base texture depth. */
+ /** Obtain the base texture depth (returns int32) */
LLVMValueRef
(*depth)( const struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder,
unsigned unit);
- /** Obtain the number of mipmap levels (minus one). */
+ /** Obtain the number of mipmap levels minus one (returns int32) */
LLVMValueRef
(*last_level)( const struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder,
unsigned unit);
+ /** Obtain stride in bytes between image rows/blocks (returns int32) */
LLVMValueRef
(*row_stride)( const struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder,
unsigned unit);
+ /** Obtain stride in bytes between image slices (returns int32) */
LLVMValueRef
(*img_stride)( const struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder,
unsigned unit);
+ /** Obtain pointer to array of pointers to mimpap levels */
LLVMValueRef
(*data_ptr)( const struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder,
unsigned unit);
- /** Obtain texture min lod */
+ /** Obtain texture min lod (returns float) */
LLVMValueRef
(*min_lod)(const struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder, unsigned unit);
- /** Obtain texture max lod */
+ /** Obtain texture max lod (returns float) */
LLVMValueRef
(*max_lod)(const struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder, unsigned unit);
- /** Obtain texture lod bias */
+ /** Obtain texture lod bias (returns float) */
LLVMValueRef
(*lod_bias)(const struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder, unsigned unit);
- /** Obtain texture border color */
+ /** Obtain texture border color (returns ptr to float[4]) */
LLVMValueRef
(*border_color)(const struct lp_sampler_dynamic_state *state,
LLVMBuilderRef builder, unsigned unit);
const struct util_format_description *format_desc;
+ /* See texture_dims() */
+ unsigned dims;
+
/** regular scalar float type */
struct lp_type float_type;
struct lp_build_context float_bld;
struct lp_type coord_type;
struct lp_build_context coord_bld;
- /** Unsigned integer coordinates */
- struct lp_type uint_coord_type;
- struct lp_build_context uint_coord_bld;
-
/** Signed integer coordinates */
struct lp_type int_coord_type;
struct lp_build_context int_coord_bld;
+ /** Unsigned integer texture size */
+ struct lp_type int_size_type;
+ struct lp_build_context int_size_bld;
+
+ /** Unsigned integer texture size */
+ struct lp_type float_size_type;
+ struct lp_build_context float_size_bld;
+
/** Output texels type and build context */
struct lp_type texel_type;
struct lp_build_context texel_bld;
+
+ /* Common dynamic state values */
+ LLVMValueRef width;
+ LLVMValueRef height;
+ LLVMValueRef depth;
+ LLVMValueRef row_stride_array;
+ LLVMValueRef img_stride_array;
+ LLVMValueRef data_array;
+
+ /** Integer vector with texture width, height, depth */
+ LLVMValueRef int_size;
};
}
-static INLINE int
+static INLINE unsigned
texture_dims(enum pipe_texture_target tex)
{
switch (tex) {
}
+boolean
+lp_sampler_wrap_mode_uses_border_color(unsigned mode,
+ unsigned min_img_filter,
+ unsigned mag_img_filter);
+
/**
* Derive the sampler static state.
*/
const struct pipe_sampler_state *sampler);
-LLVMValueRef
+void
lp_build_lod_selector(struct lp_build_sample_context *bld,
unsigned unit,
const LLVMValueRef ddx[4],
const LLVMValueRef ddy[4],
LLVMValueRef lod_bias, /* optional */
LLVMValueRef explicit_lod, /* optional */
- LLVMValueRef width,
- LLVMValueRef height,
- LLVMValueRef depth);
+ unsigned mip_filter,
+ LLVMValueRef *out_lod_ipart,
+ LLVMValueRef *out_lod_fpart);
void
lp_build_nearest_mip_level(struct lp_build_sample_context *bld,
void
lp_build_linear_mip_levels(struct lp_build_sample_context *bld,
unsigned unit,
- LLVMValueRef lod,
+ LLVMValueRef lod_ipart,
+ LLVMValueRef *lod_fpart_inout,
LLVMValueRef *level0_out,
- LLVMValueRef *level1_out,
- LLVMValueRef *weight_out);
+ LLVMValueRef *level1_out);
LLVMValueRef
lp_build_get_mipmap_level(struct lp_build_sample_context *bld,
- LLVMValueRef data_array, LLVMValueRef level);
+ LLVMValueRef level);
LLVMValueRef
lp_build_get_const_mipmap_level(struct lp_build_sample_context *bld,
- LLVMValueRef data_array, int level);
+ int level);
void
lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld,
- unsigned dims,
- LLVMValueRef width_vec,
- LLVMValueRef height_vec,
- LLVMValueRef depth_vec,
- LLVMValueRef ilevel0,
- LLVMValueRef ilevel1,
- LLVMValueRef row_stride_array,
- LLVMValueRef img_stride_array,
- LLVMValueRef *width0_vec,
- LLVMValueRef *width1_vec,
- LLVMValueRef *height0_vec,
- LLVMValueRef *height1_vec,
- LLVMValueRef *depth0_vec,
- LLVMValueRef *depth1_vec,
- LLVMValueRef *row_stride0_vec,
- LLVMValueRef *row_stride1_vec,
- LLVMValueRef *img_stride0_vec,
- LLVMValueRef *img_stride1_vec);
+ LLVMValueRef ilevel,
+ LLVMValueRef *out_size_vec,
+ LLVMValueRef *row_stride_vec,
+ LLVMValueRef *img_stride_vec);
+
+
+void
+lp_build_extract_image_sizes(struct lp_build_sample_context *bld,
+ struct lp_type size_type,
+ struct lp_type coord_type,
+ LLVMValueRef size,
+ LLVMValueRef *out_width,
+ LLVMValueRef *out_height,
+ LLVMValueRef *out_depth);
+
+
+void
+lp_build_unnormalized_coords(struct lp_build_sample_context *bld,
+ LLVMValueRef flt_size,
+ LLVMValueRef *s,
+ LLVMValueRef *t,
+ LLVMValueRef *r);
void
#include "lp_bld_const.h"
#include "lp_bld_conv.h"
#include "lp_bld_arit.h"
+#include "lp_bld_bitarit.h"
#include "lp_bld_logic.h"
#include "lp_bld_swizzle.h"
#include "lp_bld_pack.h"
LLVMValueRef *out_offset,
LLVMValueRef *out_i)
{
- struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld;
struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
LLVMValueRef length_minus_one;
- length_minus_one = lp_build_sub(uint_coord_bld, length, uint_coord_bld->one);
+ length_minus_one = lp_build_sub(int_coord_bld, length, int_coord_bld->one);
switch(wrap_mode) {
case PIPE_TEX_WRAP_REPEAT:
coord = LLVMBuildAnd(bld->builder, coord, length_minus_one, "");
else {
/* Add a bias to the texcoord to handle negative coords */
- LLVMValueRef bias = lp_build_mul_imm(uint_coord_bld, length, 1024);
+ LLVMValueRef bias = lp_build_mul_imm(int_coord_bld, length, 1024);
coord = LLVMBuildAdd(bld->builder, coord, bias, "");
coord = LLVMBuildURem(bld->builder, coord, length, "");
}
assert(0);
}
- lp_build_sample_partial_offset(uint_coord_bld, block_length, coord, stride,
+ lp_build_sample_partial_offset(int_coord_bld, block_length, coord, stride,
out_offset, out_i);
}
LLVMValueRef *i0,
LLVMValueRef *i1)
{
- struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld;
struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
LLVMValueRef length_minus_one;
LLVMValueRef lmask, umask, mask;
* multiplication.
*/
- *i0 = uint_coord_bld->zero;
- *i1 = uint_coord_bld->zero;
+ *i0 = int_coord_bld->zero;
+ *i1 = int_coord_bld->zero;
length_minus_one = lp_build_sub(int_coord_bld, length, int_coord_bld->one);
}
else {
/* Add a bias to the texcoord to handle negative coords */
- LLVMValueRef bias = lp_build_mul_imm(uint_coord_bld, length, 1024);
+ LLVMValueRef bias = lp_build_mul_imm(int_coord_bld, length, 1024);
coord0 = LLVMBuildAdd(bld->builder, coord0, bias, "");
coord0 = LLVMBuildURem(bld->builder, coord0, length, "");
}
mask = lp_build_compare(bld->builder, int_coord_bld->type,
PIPE_FUNC_NOTEQUAL, coord0, length_minus_one);
- *offset0 = lp_build_mul(uint_coord_bld, coord0, stride);
+ *offset0 = lp_build_mul(int_coord_bld, coord0, stride);
*offset1 = LLVMBuildAnd(bld->builder,
- lp_build_add(uint_coord_bld, *offset0, stride),
+ lp_build_add(int_coord_bld, *offset0, stride),
mask, "");
break;
mask = LLVMBuildAnd(bld->builder, lmask, umask, "");
- *offset0 = lp_build_mul(uint_coord_bld, coord0, stride);
- *offset1 = lp_build_add(uint_coord_bld,
+ *offset0 = lp_build_mul(int_coord_bld, coord0, stride);
+ *offset1 = lp_build_add(int_coord_bld,
*offset0,
LLVMBuildAnd(bld->builder, stride, mask, ""));
break;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
default:
assert(0);
- *offset0 = uint_coord_bld->zero;
- *offset1 = uint_coord_bld->zero;
+ *offset0 = int_coord_bld->zero;
+ *offset1 = int_coord_bld->zero;
break;
}
}
*/
static void
lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
- LLVMValueRef width_vec,
- LLVMValueRef height_vec,
- LLVMValueRef depth_vec,
+ LLVMValueRef int_size,
LLVMValueRef row_stride_vec,
LLVMValueRef img_stride_vec,
LLVMValueRef data_ptr,
LLVMValueRef *colors_lo,
LLVMValueRef *colors_hi)
{
- const int dims = texture_dims(bld->static_state->target);
+ const unsigned dims = bld->dims;
LLVMBuilderRef builder = bld->builder;
struct lp_build_context i32, h16, u8n;
LLVMTypeRef i32_vec_type, h16_vec_type, u8n_vec_type;
LLVMValueRef i32_c8;
+ LLVMValueRef width_vec, height_vec, depth_vec;
LLVMValueRef s_ipart, t_ipart, r_ipart;
LLVMValueRef x_stride;
LLVMValueRef x_offset, offset;
h16_vec_type = lp_build_vec_type(h16.type);
u8n_vec_type = lp_build_vec_type(u8n.type);
+ lp_build_extract_image_sizes(bld,
+ bld->int_size_type,
+ bld->int_coord_type,
+ int_size,
+ &width_vec,
+ &height_vec,
+ &depth_vec);
+
if (bld->static_state->normalized_coords) {
- /* s = s * width, t = t * height */
- LLVMTypeRef coord_vec_type = lp_build_vec_type(bld->coord_type);
- LLVMValueRef fp_width = LLVMBuildSIToFP(bld->builder, width_vec,
- coord_vec_type, "");
- s = lp_build_mul(&bld->coord_bld, s, fp_width);
- if (dims >= 2) {
- LLVMValueRef fp_height = LLVMBuildSIToFP(bld->builder, height_vec,
- coord_vec_type, "");
- t = lp_build_mul(&bld->coord_bld, t, fp_height);
- if (dims >= 3) {
- LLVMValueRef fp_depth = LLVMBuildSIToFP(bld->builder, depth_vec,
- coord_vec_type, "");
- r = lp_build_mul(&bld->coord_bld, r, fp_depth);
- }
- }
- }
+ LLVMValueRef scaled_size;
+ LLVMValueRef flt_size;
- /* scale coords by 256 (8 fractional bits) */
- s = lp_build_mul_imm(&bld->coord_bld, s, 256);
- if (dims >= 2)
- t = lp_build_mul_imm(&bld->coord_bld, t, 256);
- if (dims >= 3)
- r = lp_build_mul_imm(&bld->coord_bld, r, 256);
+ /* scale size by 256 (8 fractional bits) */
+ scaled_size = lp_build_shl_imm(&bld->int_size_bld, int_size, 8);
+
+ flt_size = lp_build_int_to_float(&bld->float_size_bld, scaled_size);
+
+ lp_build_unnormalized_coords(bld, flt_size, &s, &t, &r);
+ }
+ else {
+ /* scale coords by 256 (8 fractional bits) */
+ s = lp_build_mul_imm(&bld->coord_bld, s, 256);
+ if (dims >= 2)
+ t = lp_build_mul_imm(&bld->coord_bld, t, 256);
+ if (dims >= 3)
+ r = lp_build_mul_imm(&bld->coord_bld, r, 256);
+ }
/* convert float to int */
s = LLVMBuildFPToSI(builder, s, i32_vec_type, "");
r_ipart = LLVMBuildAShr(builder, r, i32_c8, "");
/* get pixel, row, image strides */
- x_stride = lp_build_const_vec(bld->uint_coord_bld.type,
+ x_stride = lp_build_const_vec(bld->int_coord_bld.type,
bld->format_desc->block.bits/8);
/* Do texcoord wrapping, compute texel offset */
bld->static_state->pot_height,
bld->static_state->wrap_t,
&y_offset, &y_subcoord);
- offset = lp_build_add(&bld->uint_coord_bld, offset, y_offset);
+ offset = lp_build_add(&bld->int_coord_bld, offset, y_offset);
if (dims >= 3) {
LLVMValueRef z_offset;
lp_build_sample_wrap_nearest_int(bld,
bld->static_state->pot_height,
bld->static_state->wrap_r,
&z_offset, &z_subcoord);
- offset = lp_build_add(&bld->uint_coord_bld, offset, z_offset);
+ offset = lp_build_add(&bld->int_coord_bld, offset, z_offset);
}
else if (bld->static_state->target == PIPE_TEXTURE_CUBE) {
LLVMValueRef z_offset;
/* The r coord is the cube face in [0,5] */
- z_offset = lp_build_mul(&bld->uint_coord_bld, r, img_stride_vec);
- offset = lp_build_add(&bld->uint_coord_bld, offset, z_offset);
+ z_offset = lp_build_mul(&bld->int_coord_bld, r, img_stride_vec);
+ offset = lp_build_add(&bld->int_coord_bld, offset, z_offset);
}
}
*/
static void
lp_build_sample_image_linear(struct lp_build_sample_context *bld,
- LLVMValueRef width_vec,
- LLVMValueRef height_vec,
- LLVMValueRef depth_vec,
+ LLVMValueRef int_size,
LLVMValueRef row_stride_vec,
LLVMValueRef img_stride_vec,
LLVMValueRef data_ptr,
LLVMValueRef *colors_lo,
LLVMValueRef *colors_hi)
{
- const int dims = texture_dims(bld->static_state->target);
+ const unsigned dims = bld->dims;
LLVMBuilderRef builder = bld->builder;
struct lp_build_context i32, h16, u8n;
LLVMTypeRef i32_vec_type, h16_vec_type, u8n_vec_type;
LLVMValueRef i32_c8, i32_c128, i32_c255;
+ LLVMValueRef width_vec, height_vec, depth_vec;
LLVMValueRef s_ipart, s_fpart, s_fpart_lo, s_fpart_hi;
LLVMValueRef t_ipart, t_fpart, t_fpart_lo, t_fpart_hi;
LLVMValueRef r_ipart, r_fpart, r_fpart_lo, r_fpart_hi;
h16_vec_type = lp_build_vec_type(h16.type);
u8n_vec_type = lp_build_vec_type(u8n.type);
+ lp_build_extract_image_sizes(bld,
+ bld->int_size_type,
+ bld->int_coord_type,
+ int_size,
+ &width_vec,
+ &height_vec,
+ &depth_vec);
+
if (bld->static_state->normalized_coords) {
- /* s = s * width, t = t * height */
- LLVMTypeRef coord_vec_type = lp_build_vec_type(bld->coord_type);
- LLVMValueRef fp_width = LLVMBuildSIToFP(bld->builder, width_vec,
- coord_vec_type, "");
- s = lp_build_mul(&bld->coord_bld, s, fp_width);
- if (dims >= 2) {
- LLVMValueRef fp_height = LLVMBuildSIToFP(bld->builder, height_vec,
- coord_vec_type, "");
- t = lp_build_mul(&bld->coord_bld, t, fp_height);
- }
- if (dims >= 3) {
- LLVMValueRef fp_depth = LLVMBuildSIToFP(bld->builder, depth_vec,
- coord_vec_type, "");
- r = lp_build_mul(&bld->coord_bld, r, fp_depth);
- }
- }
+ LLVMValueRef scaled_size;
+ LLVMValueRef flt_size;
- /* scale coords by 256 (8 fractional bits) */
- s = lp_build_mul_imm(&bld->coord_bld, s, 256);
- if (dims >= 2)
- t = lp_build_mul_imm(&bld->coord_bld, t, 256);
- if (dims >= 3)
- r = lp_build_mul_imm(&bld->coord_bld, r, 256);
+ /* scale size by 256 (8 fractional bits) */
+ scaled_size = lp_build_shl_imm(&bld->int_size_bld, int_size, 8);
+
+ flt_size = lp_build_int_to_float(&bld->float_size_bld, scaled_size);
+
+ lp_build_unnormalized_coords(bld, flt_size, &s, &t, &r);
+ }
+ else {
+ /* scale coords by 256 (8 fractional bits) */
+ s = lp_build_mul_imm(&bld->coord_bld, s, 256);
+ if (dims >= 2)
+ t = lp_build_mul_imm(&bld->coord_bld, t, 256);
+ if (dims >= 3)
+ r = lp_build_mul_imm(&bld->coord_bld, r, 256);
+ }
/* convert float to int */
s = LLVMBuildFPToSI(builder, s, i32_vec_type, "");
r_fpart = LLVMBuildAnd(builder, r, i32_c255, "");
/* get pixel, row and image strides */
- x_stride = lp_build_const_vec(bld->uint_coord_bld.type,
+ x_stride = lp_build_const_vec(bld->int_coord_bld.type,
bld->format_desc->block.bits/8);
y_stride = row_stride_vec;
z_stride = img_stride_vec;
for (z = 0; z < 2; z++) {
for (x = 0; x < 2; x++) {
- offset[z][0][x] = lp_build_add(&bld->uint_coord_bld,
+ offset[z][0][x] = lp_build_add(&bld->int_coord_bld,
offset[z][0][x], y_offset0);
- offset[z][1][x] = lp_build_add(&bld->uint_coord_bld,
+ offset[z][1][x] = lp_build_add(&bld->int_coord_bld,
offset[z][1][x], y_offset1);
}
}
&z_subcoord[0], &z_subcoord[1]);
for (y = 0; y < 2; y++) {
for (x = 0; x < 2; x++) {
- offset[0][y][x] = lp_build_add(&bld->uint_coord_bld,
+ offset[0][y][x] = lp_build_add(&bld->int_coord_bld,
offset[0][y][x], z_offset0);
- offset[1][y][x] = lp_build_add(&bld->uint_coord_bld,
+ offset[1][y][x] = lp_build_add(&bld->int_coord_bld,
offset[1][y][x], z_offset1);
}
}
}
else if (bld->static_state->target == PIPE_TEXTURE_CUBE) {
LLVMValueRef z_offset;
- z_offset = lp_build_mul(&bld->uint_coord_bld, r, img_stride_vec);
+ z_offset = lp_build_mul(&bld->int_coord_bld, r, img_stride_vec);
for (y = 0; y < 2; y++) {
for (x = 0; x < 2; x++) {
/* The r coord is the cube face in [0,5] */
- offset[0][y][x] = lp_build_add(&bld->uint_coord_bld,
+ offset[0][y][x] = lp_build_add(&bld->int_coord_bld,
offset[0][y][x], z_offset);
}
}
LLVMValueRef s,
LLVMValueRef t,
LLVMValueRef r,
+ LLVMValueRef ilevel0,
+ LLVMValueRef ilevel1,
LLVMValueRef lod_fpart,
- LLVMValueRef width0_vec,
- LLVMValueRef width1_vec,
- LLVMValueRef height0_vec,
- LLVMValueRef height1_vec,
- LLVMValueRef depth0_vec,
- LLVMValueRef depth1_vec,
- LLVMValueRef row_stride0_vec,
- LLVMValueRef row_stride1_vec,
- LLVMValueRef img_stride0_vec,
- LLVMValueRef img_stride1_vec,
- LLVMValueRef data_ptr0,
- LLVMValueRef data_ptr1,
- LLVMValueRef *colors_lo,
- LLVMValueRef *colors_hi)
+ LLVMValueRef colors_lo_var,
+ LLVMValueRef colors_hi_var)
{
+ LLVMBuilderRef builder = bld->builder;
+ LLVMValueRef size0;
+ LLVMValueRef size1;
+ LLVMValueRef row_stride0_vec;
+ LLVMValueRef row_stride1_vec;
+ LLVMValueRef img_stride0_vec;
+ LLVMValueRef img_stride1_vec;
+ LLVMValueRef data_ptr0;
+ LLVMValueRef data_ptr1;
LLVMValueRef colors0_lo, colors0_hi;
LLVMValueRef colors1_lo, colors1_hi;
+
+ /* sample the first mipmap level */
+ lp_build_mipmap_level_sizes(bld, ilevel0,
+ &size0,
+ &row_stride0_vec, &img_stride0_vec);
+ data_ptr0 = lp_build_get_mipmap_level(bld, ilevel0);
if (img_filter == PIPE_TEX_FILTER_NEAREST) {
- /* sample the first mipmap level */
lp_build_sample_image_nearest(bld,
- width0_vec, height0_vec, depth0_vec,
+ size0,
row_stride0_vec, img_stride0_vec,
data_ptr0, s, t, r,
&colors0_lo, &colors0_hi);
-
- if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
- /* sample the second mipmap level */
- lp_build_sample_image_nearest(bld,
- width1_vec, height1_vec, depth1_vec,
- row_stride1_vec, img_stride1_vec,
- data_ptr1, s, t, r,
- &colors1_lo, &colors1_hi);
- }
}
else {
assert(img_filter == PIPE_TEX_FILTER_LINEAR);
-
- /* sample the first mipmap level */
lp_build_sample_image_linear(bld,
- width0_vec, height0_vec, depth0_vec,
+ size0,
row_stride0_vec, img_stride0_vec,
data_ptr0, s, t, r,
&colors0_lo, &colors0_hi);
-
- if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
- /* sample the second mipmap level */
- lp_build_sample_image_linear(bld,
- width1_vec, height1_vec, depth1_vec,
- row_stride1_vec, img_stride1_vec,
- data_ptr1, s, t, r,
- &colors1_lo, &colors1_hi);
- }
}
+ /* Store the first level's colors in the output variables */
+ LLVMBuildStore(builder, colors0_lo, colors_lo_var);
+ LLVMBuildStore(builder, colors0_hi, colors_hi_var);
+
if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
- /* interpolate samples from the two mipmap levels */
- struct lp_build_context h16;
- lp_build_context_init(&h16, bld->builder, lp_type_ufixed(16));
-
- *colors_lo = lp_build_lerp(&h16, lod_fpart,
- colors0_lo, colors1_lo);
- *colors_hi = lp_build_lerp(&h16, lod_fpart,
- colors0_hi, colors1_hi);
- }
- else {
- /* use first/only level's colors */
- *colors_lo = colors0_lo;
- *colors_hi = colors0_hi;
+ LLVMValueRef h16_scale = LLVMConstReal(LLVMFloatType(), 256.0);
+ LLVMTypeRef i32_type = LLVMIntType(32);
+ struct lp_build_if_state if_ctx;
+ LLVMValueRef need_lerp;
+
+ lod_fpart = LLVMBuildFMul(builder, lod_fpart, h16_scale, "");
+ lod_fpart = LLVMBuildFPToSI(builder, lod_fpart, i32_type, "lod_fpart.fixed16");
+
+ /* need_lerp = lod_fpart > 0 */
+ need_lerp = LLVMBuildICmp(builder, LLVMIntSGT,
+ lod_fpart, LLVMConstNull(i32_type),
+ "need_lerp");
+
+ lp_build_if(&if_ctx, builder, need_lerp);
+ {
+ struct lp_build_context h16_bld;
+
+ lp_build_context_init(&h16_bld, builder, lp_type_ufixed(16));
+
+ /* sample the second mipmap level */
+ lp_build_mipmap_level_sizes(bld, ilevel1,
+ &size1,
+ &row_stride1_vec, &img_stride1_vec);
+ data_ptr1 = lp_build_get_mipmap_level(bld, ilevel1);
+ if (img_filter == PIPE_TEX_FILTER_NEAREST) {
+ lp_build_sample_image_nearest(bld,
+ size1,
+ row_stride1_vec, img_stride1_vec,
+ data_ptr1, s, t, r,
+ &colors1_lo, &colors1_hi);
+ }
+ else {
+ lp_build_sample_image_linear(bld,
+ size1,
+ row_stride1_vec, img_stride1_vec,
+ data_ptr1, s, t, r,
+ &colors1_lo, &colors1_hi);
+ }
+
+ /* interpolate samples from the two mipmap levels */
+
+ lod_fpart = LLVMBuildTrunc(builder, lod_fpart, h16_bld.elem_type, "");
+ lod_fpart = lp_build_broadcast_scalar(&h16_bld, lod_fpart);
+
+#if HAVE_LLVM == 0x208
+ /* This is a work-around for a bug in LLVM 2.8.
+ * Evidently, something goes wrong in the construction of the
+ * lod_fpart short[8] vector. Adding this no-effect shuffle seems
+ * to force the vector to be properly constructed.
+ * Tested with mesa-demos/src/tests/mipmap_limits.c (press t, f).
+ */
+ {
+ LLVMValueRef shuffles[8], shuffle;
+ int i;
+ assert(h16_bld.type.length <= Elements(shuffles));
+ for (i = 0; i < h16_bld.type.length; i++)
+ shuffles[i] = lp_build_const_int32(2 * (i & 1));
+ shuffle = LLVMConstVector(shuffles, h16_bld.type.length);
+ lod_fpart = LLVMBuildShuffleVector(builder,
+ lod_fpart, lod_fpart,
+ shuffle, "");
+ }
+#endif
+
+ colors0_lo = lp_build_lerp(&h16_bld, lod_fpart,
+ colors0_lo, colors1_lo);
+ colors0_hi = lp_build_lerp(&h16_bld, lod_fpart,
+ colors0_hi, colors1_hi);
+
+ LLVMBuildStore(builder, colors0_lo, colors_lo_var);
+ LLVMBuildStore(builder, colors0_hi, colors_hi_var);
+ }
+ lp_build_endif(&if_ctx);
}
}
const LLVMValueRef *ddy,
LLVMValueRef lod_bias, /* optional */
LLVMValueRef explicit_lod, /* optional */
- LLVMValueRef width,
- LLVMValueRef height,
- LLVMValueRef depth,
- LLVMValueRef width_vec,
- LLVMValueRef height_vec,
- LLVMValueRef depth_vec,
- LLVMValueRef row_stride_array,
- LLVMValueRef img_stride_array,
- LLVMValueRef data_array,
LLVMValueRef texel_out[4])
{
- struct lp_build_context *float_bld = &bld->float_bld;
+ struct lp_build_context *int_bld = &bld->int_bld;
LLVMBuilderRef builder = bld->builder;
const unsigned mip_filter = bld->static_state->min_mip_filter;
const unsigned min_filter = bld->static_state->min_img_filter;
const unsigned mag_filter = bld->static_state->mag_img_filter;
- const int dims = texture_dims(bld->static_state->target);
- LLVMValueRef lod = NULL, lod_fpart = NULL;
+ const unsigned dims = bld->dims;
+ LLVMValueRef lod_ipart = NULL, lod_fpart = NULL;
LLVMValueRef ilevel0, ilevel1 = NULL;
- LLVMValueRef width0_vec = NULL, height0_vec = NULL, depth0_vec = NULL;
- LLVMValueRef width1_vec = NULL, height1_vec = NULL, depth1_vec = NULL;
- LLVMValueRef row_stride0_vec = NULL, row_stride1_vec = NULL;
- LLVMValueRef img_stride0_vec = NULL, img_stride1_vec = NULL;
- LLVMValueRef data_ptr0, data_ptr1 = NULL;
LLVMValueRef packed, packed_lo, packed_hi;
LLVMValueRef unswizzled[4];
LLVMValueRef face_ddx[4], face_ddy[4];
- struct lp_build_context h16;
- LLVMTypeRef h16_vec_type;
+ struct lp_build_context h16_bld;
+ LLVMTypeRef i32t = LLVMInt32Type();
+ LLVMValueRef i32t_zero = LLVMConstInt(i32t, 0, 0);
/* we only support the common/simple wrap modes at this time */
assert(lp_is_simple_wrap_mode(bld->static_state->wrap_s));
/* make 16-bit fixed-pt builder context */
- lp_build_context_init(&h16, builder, lp_type_ufixed(16));
- h16_vec_type = lp_build_vec_type(h16.type);
-
+ lp_build_context_init(&h16_bld, builder, lp_type_ufixed(16));
/* cube face selection, compute pre-face coords, etc. */
if (bld->static_state->target == PIPE_TEXTURE_CUBE) {
r = lp_build_broadcast_scalar(&bld->int_coord_bld, face); /* vec */
/* recompute ddx, ddy using the new (s,t) face texcoords */
- face_ddx[0] = lp_build_ddx(&bld->coord_bld, s);
- face_ddx[1] = lp_build_ddx(&bld->coord_bld, t);
+ face_ddx[0] = lp_build_scalar_ddx(&bld->coord_bld, s);
+ face_ddx[1] = lp_build_scalar_ddx(&bld->coord_bld, t);
face_ddx[2] = NULL;
face_ddx[3] = NULL;
- face_ddy[0] = lp_build_ddy(&bld->coord_bld, s);
- face_ddy[1] = lp_build_ddy(&bld->coord_bld, t);
+ face_ddy[0] = lp_build_scalar_ddy(&bld->coord_bld, s);
+ face_ddy[1] = lp_build_scalar_ddy(&bld->coord_bld, t);
face_ddy[2] = NULL;
face_ddy[3] = NULL;
ddx = face_ddx;
ddy = face_ddy;
}
-
/*
* Compute the level of detail (float).
*/
/* Need to compute lod either to choose mipmap levels or to
* distinguish between minification/magnification with one mipmap level.
*/
- lod = lp_build_lod_selector(bld, unit, ddx, ddy,
- lod_bias, explicit_lod,
- width, height, depth);
+ lp_build_lod_selector(bld, unit, ddx, ddy,
+ lod_bias, explicit_lod,
+ mip_filter,
+ &lod_ipart, &lod_fpart);
+ } else {
+ lod_ipart = i32t_zero;
}
/*
* Compute integer mipmap level(s) to fetch texels from: ilevel0, ilevel1
- * If mipfilter=linear, also compute the weight between the two
- * mipmap levels: lod_fpart
*/
switch (mip_filter) {
default:
* We should be able to set ilevel0 = const(0) but that causes
* bad x86 code to be emitted.
*/
- lod = lp_build_const_elem(bld->coord_bld.type, 0.0);
- lp_build_nearest_mip_level(bld, unit, lod, &ilevel0);
+ assert(lod_ipart);
+ lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0);
}
else {
- ilevel0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
+ ilevel0 = i32t_zero;
}
break;
case PIPE_TEX_MIPFILTER_NEAREST:
- assert(lod);
- lp_build_nearest_mip_level(bld, unit, lod, &ilevel0);
+ assert(lod_ipart);
+ lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0);
break;
case PIPE_TEX_MIPFILTER_LINEAR:
- {
- LLVMValueRef f256 = LLVMConstReal(LLVMFloatType(), 256.0);
- LLVMValueRef i255 = lp_build_const_int32(255);
- LLVMTypeRef i16_type = LLVMIntType(16);
-
- assert(lod);
-
- lp_build_linear_mip_levels(bld, unit, lod, &ilevel0, &ilevel1,
- &lod_fpart);
- lod_fpart = LLVMBuildFMul(builder, lod_fpart, f256, "");
- lod_fpart = lp_build_ifloor(&bld->float_bld, lod_fpart);
- lod_fpart = LLVMBuildAnd(builder, lod_fpart, i255, "");
- lod_fpart = LLVMBuildTrunc(builder, lod_fpart, i16_type, "");
- lod_fpart = lp_build_broadcast_scalar(&h16, lod_fpart);
-
- /* the lod_fpart values will be fixed pt values in [0,1) */
- }
+ assert(lod_ipart);
+ assert(lod_fpart);
+ lp_build_linear_mip_levels(bld, unit,
+ lod_ipart, &lod_fpart,
+ &ilevel0, &ilevel1);
break;
}
- /* compute image size(s) of source mipmap level(s) */
- lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec,
- ilevel0, ilevel1,
- row_stride_array, img_stride_array,
- &width0_vec, &width1_vec,
- &height0_vec, &height1_vec,
- &depth0_vec, &depth1_vec,
- &row_stride0_vec, &row_stride1_vec,
- &img_stride0_vec, &img_stride1_vec);
-
/*
- * Get pointer(s) to image data for mipmap level(s).
+ * Get/interpolate texture colors.
*/
- data_ptr0 = lp_build_get_mipmap_level(bld, data_array, ilevel0);
- if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
- data_ptr1 = lp_build_get_mipmap_level(bld, data_array, ilevel1);
- }
+ packed_lo = lp_build_alloca(builder, h16_bld.vec_type, "packed_lo");
+ packed_hi = lp_build_alloca(builder, h16_bld.vec_type, "packed_hi");
- /*
- * Get/interpolate texture colors.
- */
if (min_filter == mag_filter) {
/* no need to distinquish between minification and magnification */
- lp_build_sample_mipmap(bld, min_filter, mip_filter,
- s, t, r, lod_fpart,
- width0_vec, width1_vec,
- height0_vec, height1_vec,
- depth0_vec, depth1_vec,
- row_stride0_vec, row_stride1_vec,
- img_stride0_vec, img_stride1_vec,
- data_ptr0, data_ptr1,
- &packed_lo, &packed_hi);
+ lp_build_sample_mipmap(bld,
+ min_filter, mip_filter,
+ s, t, r,
+ ilevel0, ilevel1, lod_fpart,
+ packed_lo, packed_hi);
}
else {
/* Emit conditional to choose min image filter or mag image filter
* depending on the lod being > 0 or <= 0, respectively.
*/
- struct lp_build_flow_context *flow_ctx;
struct lp_build_if_state if_ctx;
LLVMValueRef minify;
- flow_ctx = lp_build_flow_create(builder);
- lp_build_flow_scope_begin(flow_ctx);
+ /* minify = lod >= 0.0 */
+ minify = LLVMBuildICmp(builder, LLVMIntSGE,
+ lod_ipart, int_bld->zero, "");
- packed_lo = LLVMGetUndef(h16_vec_type);
- packed_hi = LLVMGetUndef(h16_vec_type);
-
- lp_build_flow_scope_declare(flow_ctx, &packed_lo);
- lp_build_flow_scope_declare(flow_ctx, &packed_hi);
-
- /* minify = lod > 0.0 */
- minify = LLVMBuildFCmp(builder, LLVMRealUGE,
- lod, float_bld->zero, "");
-
- lp_build_if(&if_ctx, flow_ctx, builder, minify);
+ lp_build_if(&if_ctx, builder, minify);
{
/* Use the minification filter */
- lp_build_sample_mipmap(bld, min_filter, mip_filter,
- s, t, r, lod_fpart,
- width0_vec, width1_vec,
- height0_vec, height1_vec,
- depth0_vec, depth1_vec,
- row_stride0_vec, row_stride1_vec,
- img_stride0_vec, img_stride1_vec,
- data_ptr0, data_ptr1,
- &packed_lo, &packed_hi);
+ lp_build_sample_mipmap(bld,
+ min_filter, mip_filter,
+ s, t, r,
+ ilevel0, ilevel1, lod_fpart,
+ packed_lo, packed_hi);
}
lp_build_else(&if_ctx);
{
/* Use the magnification filter */
- lp_build_sample_mipmap(bld, mag_filter, mip_filter,
- s, t, r, lod_fpart,
- width0_vec, width1_vec,
- height0_vec, height1_vec,
- depth0_vec, depth1_vec,
- row_stride0_vec, row_stride1_vec,
- img_stride0_vec, img_stride1_vec,
- data_ptr0, data_ptr1,
- &packed_lo, &packed_hi);
+ lp_build_sample_mipmap(bld,
+ mag_filter, PIPE_TEX_MIPFILTER_NONE,
+ s, t, r,
+ i32t_zero, NULL, NULL,
+ packed_lo, packed_hi);
}
lp_build_endif(&if_ctx);
-
- lp_build_flow_scope_end(flow_ctx);
- lp_build_flow_destroy(flow_ctx);
}
- /* combine 'packed_lo', 'packed_hi' into 'packed' */
- {
- struct lp_build_context h16, u8n;
-
- lp_build_context_init(&h16, builder, lp_type_ufixed(16));
- lp_build_context_init(&u8n, builder, lp_type_unorm(8));
-
- packed = lp_build_pack2(builder, h16.type, u8n.type,
- packed_lo, packed_hi);
- }
+ /*
+ * combine the values stored in 'packed_lo' and 'packed_hi' variables
+ * into 'packed'
+ */
+ packed = lp_build_pack2(builder,
+ h16_bld.type, lp_type_unorm(8),
+ LLVMBuildLoad(builder, packed_lo, ""),
+ LLVMBuildLoad(builder, packed_hi, ""));
/*
* Convert to SoA and swizzle.
const LLVMValueRef *ddy,
LLVMValueRef lod_bias, /* optional */
LLVMValueRef explicit_lod, /* optional */
- LLVMValueRef width,
- LLVMValueRef height,
- LLVMValueRef depth,
- LLVMValueRef width_vec,
- LLVMValueRef height_vec,
- LLVMValueRef depth_vec,
- LLVMValueRef row_stride_array,
- LLVMValueRef img_stride_array,
- LLVMValueRef data_array,
LLVMValueRef texel_out[4]);
#include "lp_bld_quad.h"
-/**
- * Does the given texture wrap mode allow sampling the texture border color?
- * XXX maybe move this into gallium util code.
- */
-static boolean
-wrap_mode_uses_border_color(unsigned mode)
-{
- switch (mode) {
- case PIPE_TEX_WRAP_REPEAT:
- case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
- case PIPE_TEX_WRAP_MIRROR_REPEAT:
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
- return FALSE;
- case PIPE_TEX_WRAP_CLAMP:
- case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
- case PIPE_TEX_WRAP_MIRROR_CLAMP:
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
- return TRUE;
- default:
- assert(0 && "unexpected wrap mode");
- return FALSE;
- }
-}
-
-
/**
* Generate code to fetch a texel from a texture at int coords (x, y, z).
* The computation depends on whether the texture is 1D, 2D or 3D.
LLVMValueRef data_ptr,
LLVMValueRef texel_out[4])
{
- const int dims = texture_dims(bld->static_state->target);
+ const struct lp_sampler_static_state *static_state = bld->static_state;
+ const unsigned dims = bld->dims;
struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
LLVMValueRef offset;
LLVMValueRef i, j;
LLVMValueRef use_border = NULL;
/* use_border = x < 0 || x >= width || y < 0 || y >= height */
- if (wrap_mode_uses_border_color(bld->static_state->wrap_s)) {
+ if (lp_sampler_wrap_mode_uses_border_color(static_state->wrap_s,
+ static_state->min_img_filter,
+ static_state->mag_img_filter)) {
LLVMValueRef b1, b2;
b1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, x, int_coord_bld->zero);
b2 = lp_build_cmp(int_coord_bld, PIPE_FUNC_GEQUAL, x, width);
use_border = LLVMBuildOr(bld->builder, b1, b2, "b1_or_b2");
}
- if (dims >= 2 && wrap_mode_uses_border_color(bld->static_state->wrap_t)) {
+ if (dims >= 2 &&
+ lp_sampler_wrap_mode_uses_border_color(static_state->wrap_t,
+ static_state->min_img_filter,
+ static_state->mag_img_filter)) {
LLVMValueRef b1, b2;
b1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, y, int_coord_bld->zero);
b2 = lp_build_cmp(int_coord_bld, PIPE_FUNC_GEQUAL, y, height);
}
}
- if (dims == 3 && wrap_mode_uses_border_color(bld->static_state->wrap_r)) {
+ if (dims == 3 &&
+ lp_sampler_wrap_mode_uses_border_color(static_state->wrap_r,
+ static_state->min_img_filter,
+ static_state->mag_img_filter)) {
LLVMValueRef b1, b2;
b1 = lp_build_cmp(int_coord_bld, PIPE_FUNC_LESS, z, int_coord_bld->zero);
b2 = lp_build_cmp(int_coord_bld, PIPE_FUNC_GEQUAL, z, depth);
}
/* convert x,y,z coords to linear offset from start of texture, in bytes */
- lp_build_sample_offset(&bld->uint_coord_bld,
+ lp_build_sample_offset(&bld->int_coord_bld,
bld->format_desc,
x, y, z, y_stride, z_stride,
&offset, &i, &j);
* coords which are out of bounds to become zero. Zero's guaranteed
* to be inside the texture image.
*/
- offset = lp_build_andnot(&bld->uint_coord_bld, offset, use_border);
+ offset = lp_build_andnot(&bld->int_coord_bld, offset, use_border);
}
lp_build_fetch_rgba_soa(bld->builder,
struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
LLVMValueRef fract, flr, isOdd;
- /* fract = coord - floor(coord) */
- fract = lp_build_sub(coord_bld, coord, lp_build_floor(coord_bld, coord));
-
- /* flr = ifloor(coord); */
- flr = lp_build_ifloor(coord_bld, coord);
+ lp_build_ifloor_fract(coord_bld, coord, &flr, &fract);
/* isOdd = flr & 1 */
isOdd = LLVMBuildAnd(bld->builder, flr, int_coord_bld->one, "");
lp_build_sample_wrap_linear(struct lp_build_sample_context *bld,
LLVMValueRef coord,
LLVMValueRef length,
+ LLVMValueRef length_f,
boolean is_pot,
unsigned wrap_mode,
LLVMValueRef *x0_out,
{
struct lp_build_context *coord_bld = &bld->coord_bld;
struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
- struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld;
LLVMValueRef half = lp_build_const_vec(coord_bld->type, 0.5);
- LLVMValueRef length_f = lp_build_int_to_float(coord_bld, length);
- LLVMValueRef length_minus_one = lp_build_sub(uint_coord_bld, length, uint_coord_bld->one);
+ LLVMValueRef length_minus_one = lp_build_sub(int_coord_bld, length, int_coord_bld->one);
LLVMValueRef coord0, coord1, weight;
switch(wrap_mode) {
/* mul by size and subtract 0.5 */
coord = lp_build_mul(coord_bld, coord, length_f);
coord = lp_build_sub(coord_bld, coord, half);
- /* convert to int */
- coord0 = lp_build_ifloor(coord_bld, coord);
- coord1 = lp_build_add(uint_coord_bld, coord0, uint_coord_bld->one);
- /* compute lerp weight */
- weight = lp_build_fract(coord_bld, coord);
+ /* convert to int, compute lerp weight */
+ lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight);
/* repeat wrap */
if (is_pot) {
+ coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one);
coord0 = LLVMBuildAnd(bld->builder, coord0, length_minus_one, "");
coord1 = LLVMBuildAnd(bld->builder, coord1, length_minus_one, "");
}
else {
/* Add a bias to the texcoord to handle negative coords */
- LLVMValueRef bias = lp_build_mul_imm(uint_coord_bld, length, 1024);
+ LLVMValueRef bias = lp_build_mul_imm(int_coord_bld, length, 1024);
+ LLVMValueRef mask;
coord0 = LLVMBuildAdd(bld->builder, coord0, bias, "");
- coord1 = LLVMBuildAdd(bld->builder, coord1, bias, "");
coord0 = LLVMBuildURem(bld->builder, coord0, length, "");
- coord1 = LLVMBuildURem(bld->builder, coord1, length, "");
+ mask = lp_build_compare(bld->builder, int_coord_bld->type,
+ PIPE_FUNC_NOTEQUAL, coord0, length_minus_one);
+ coord1 = LLVMBuildAnd(bld->builder,
+ lp_build_add(int_coord_bld, coord0, int_coord_bld->one),
+ mask, "");
}
break;
coord = lp_build_sub(coord_bld, coord, half);
- weight = lp_build_fract(coord_bld, coord);
- coord0 = lp_build_ifloor(coord_bld, coord);
+ /* convert to int, compute lerp weight */
+ lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight);
coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one);
break;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
- if (bld->static_state->normalized_coords) {
- /* clamp to [0,1] */
- coord = lp_build_clamp(coord_bld, coord, coord_bld->zero, coord_bld->one);
- /* mul by tex size and subtract 0.5 */
- coord = lp_build_mul(coord_bld, coord, length_f);
+ {
+ struct lp_build_context abs_coord_bld = bld->coord_bld;
+ abs_coord_bld.type.sign = FALSE;
+
+ if (bld->static_state->normalized_coords) {
+ /* mul by tex size */
+ coord = lp_build_mul(coord_bld, coord, length_f);
+ }
+ /* clamp to length max */
+ coord = lp_build_min(coord_bld, coord, length_f);
+ /* subtract 0.5 */
coord = lp_build_sub(coord_bld, coord, half);
+ /* clamp to [0, length - 0.5] */
+ coord = lp_build_max(coord_bld, coord, coord_bld->zero);
+ /* convert to int, compute lerp weight */
+ lp_build_ifloor_fract(&abs_coord_bld, coord, &coord0, &weight);
+ coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one);
+ /* coord1 = min(coord1, length-1) */
+ coord1 = lp_build_min(int_coord_bld, coord1, length_minus_one);
+ break;
}
- else {
- LLVMValueRef min, max;
- /* clamp to [0.5, length - 0.5] */
- min = half;
- max = lp_build_sub(coord_bld, length_f, min);
- coord = lp_build_clamp(coord_bld, coord, min, max);
- }
- /* compute lerp weight */
- weight = lp_build_fract(coord_bld, coord);
- /* coord0 = floor(coord); */
- coord0 = lp_build_ifloor(coord_bld, coord);
- coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one);
- /* coord0 = max(coord0, 0) */
- coord0 = lp_build_max(int_coord_bld, coord0, int_coord_bld->zero);
- /* coord1 = min(coord1, length-1) */
- coord1 = lp_build_min(int_coord_bld, coord1, length_minus_one);
- break;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
{
- LLVMValueRef min, max;
+ LLVMValueRef min;
if (bld->static_state->normalized_coords) {
/* scale coord to length */
coord = lp_build_mul(coord_bld, coord, length_f);
}
- /* clamp to [-0.5, length + 0.5] */
- min = lp_build_const_vec(coord_bld->type, -0.5F);
- max = lp_build_sub(coord_bld, length_f, min);
- coord = lp_build_clamp(coord_bld, coord, min, max);
+ /* was: clamp to [-0.5, length + 0.5], then sub 0.5 */
coord = lp_build_sub(coord_bld, coord, half);
- /* compute lerp weight */
- weight = lp_build_fract(coord_bld, coord);
- /* convert to int */
- coord0 = lp_build_ifloor(coord_bld, coord);
+ min = lp_build_const_vec(coord_bld->type, -1.0F);
+ coord = lp_build_clamp(coord_bld, coord, min, length_f);
+ /* convert to int, compute lerp weight */
+ lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight);
coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one);
}
break;
coord = lp_build_mul(coord_bld, coord, length_f);
coord = lp_build_sub(coord_bld, coord, half);
- /* compute lerp weight */
- weight = lp_build_fract(coord_bld, coord);
-
- /* convert to int coords */
- coord0 = lp_build_ifloor(coord_bld, coord);
+ /* convert to int, compute lerp weight */
+ lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight);
coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one);
/* coord0 = max(coord0, 0) */
coord = lp_build_sub(coord_bld, coord, half);
- weight = lp_build_fract(coord_bld, coord);
- coord0 = lp_build_ifloor(coord_bld, coord);
+ /* convert to int, compute lerp weight */
+ lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight);
coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one);
break;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
{
LLVMValueRef min, max;
-
+ struct lp_build_context abs_coord_bld = bld->coord_bld;
+ abs_coord_bld.type.sign = FALSE;
coord = lp_build_abs(coord_bld, coord);
if (bld->static_state->normalized_coords) {
coord = lp_build_sub(coord_bld, coord, half);
- weight = lp_build_fract(coord_bld, coord);
- coord0 = lp_build_ifloor(coord_bld, coord);
+ /* convert to int, compute lerp weight */
+ lp_build_ifloor_fract(&abs_coord_bld, coord, &coord0, &weight);
coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one);
}
break;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
{
- LLVMValueRef min, max;
-
coord = lp_build_abs(coord_bld, coord);
if (bld->static_state->normalized_coords) {
coord = lp_build_mul(coord_bld, coord, length_f);
}
- /* clamp to [-0.5, length + 0.5] */
- min = lp_build_negate(coord_bld, half);
- max = lp_build_sub(coord_bld, length_f, min);
- coord = lp_build_clamp(coord_bld, coord, min, max);
-
+ /* was: clamp to [-0.5, length + 0.5] then sub 0.5 */
+ /* skip -0.5 clamp (always positive), do sub first */
coord = lp_build_sub(coord_bld, coord, half);
+ coord = lp_build_min(coord_bld, coord, length_f);
- weight = lp_build_fract(coord_bld, coord);
- coord0 = lp_build_ifloor(coord_bld, coord);
+ /* convert to int, compute lerp weight */
+ lp_build_ifloor_fract(coord_bld, coord, &coord0, &weight);
coord1 = lp_build_add(int_coord_bld, coord0, int_coord_bld->one);
}
break;
lp_build_sample_wrap_nearest(struct lp_build_sample_context *bld,
LLVMValueRef coord,
LLVMValueRef length,
+ LLVMValueRef length_f,
boolean is_pot,
unsigned wrap_mode)
{
struct lp_build_context *coord_bld = &bld->coord_bld;
struct lp_build_context *int_coord_bld = &bld->int_coord_bld;
- struct lp_build_context *uint_coord_bld = &bld->uint_coord_bld;
- LLVMValueRef length_f = lp_build_int_to_float(coord_bld, length);
- LLVMValueRef length_minus_one = lp_build_sub(uint_coord_bld, length, uint_coord_bld->one);
+ LLVMValueRef length_minus_one = lp_build_sub(int_coord_bld, length, int_coord_bld->one);
LLVMValueRef icoord;
switch(wrap_mode) {
icoord = LLVMBuildAnd(bld->builder, icoord, length_minus_one, "");
else {
/* Add a bias to the texcoord to handle negative coords */
- LLVMValueRef bias = lp_build_mul_imm(uint_coord_bld, length, 1024);
+ LLVMValueRef bias = lp_build_mul_imm(int_coord_bld, length, 1024);
icoord = LLVMBuildAdd(bld->builder, icoord, bias, "");
icoord = LLVMBuildURem(bld->builder, icoord, length, "");
}
}
/* floor */
- icoord = lp_build_ifloor(coord_bld, coord);
+ /* use itrunc instead since we clamp to 0 anyway */
+ icoord = lp_build_itrunc(coord_bld, coord);
/* clamp to [0, length - 1]. */
icoord = lp_build_clamp(int_coord_bld, icoord, int_coord_bld->zero,
assert(bld->static_state->normalized_coords);
coord = lp_build_mul(coord_bld, coord, length_f);
- icoord = lp_build_ifloor(coord_bld, coord);
+ /* itrunc == ifloor here */
+ icoord = lp_build_itrunc(coord_bld, coord);
/* clamp to [0, length - 1] */
icoord = lp_build_min(int_coord_bld, icoord, length_minus_one);
coord = lp_build_mul(coord_bld, coord, length_f);
}
- icoord = lp_build_ifloor(coord_bld, coord);
+ /* itrunc == ifloor here */
+ icoord = lp_build_itrunc(coord_bld, coord);
/* clamp to [0, length - 1] */
icoord = lp_build_min(int_coord_bld, icoord, length_minus_one);
coord = lp_build_mul(coord_bld, coord, length_f);
}
- icoord = lp_build_ifloor(coord_bld, coord);
+ /* itrunc == ifloor here */
+ icoord = lp_build_itrunc(coord_bld, coord);
/* clamp to [0, length] */
icoord = lp_build_min(int_coord_bld, icoord, length);
static void
lp_build_sample_image_nearest(struct lp_build_sample_context *bld,
unsigned unit,
- LLVMValueRef width_vec,
- LLVMValueRef height_vec,
- LLVMValueRef depth_vec,
+ LLVMValueRef size,
LLVMValueRef row_stride_vec,
LLVMValueRef img_stride_vec,
LLVMValueRef data_ptr,
LLVMValueRef r,
LLVMValueRef colors_out[4])
{
- const int dims = texture_dims(bld->static_state->target);
+ const unsigned dims = bld->dims;
+ LLVMValueRef width_vec;
+ LLVMValueRef height_vec;
+ LLVMValueRef depth_vec;
+ LLVMValueRef flt_size;
+ LLVMValueRef flt_width_vec;
+ LLVMValueRef flt_height_vec;
+ LLVMValueRef flt_depth_vec;
LLVMValueRef x, y, z;
+ lp_build_extract_image_sizes(bld,
+ bld->int_size_type,
+ bld->int_coord_type,
+ size,
+ &width_vec, &height_vec, &depth_vec);
+
+ flt_size = lp_build_int_to_float(&bld->float_size_bld, size);
+
+ lp_build_extract_image_sizes(bld,
+ bld->float_size_type,
+ bld->coord_type,
+ flt_size,
+ &flt_width_vec, &flt_height_vec, &flt_depth_vec);
+
/*
* Compute integer texcoords.
*/
- x = lp_build_sample_wrap_nearest(bld, s, width_vec,
+ x = lp_build_sample_wrap_nearest(bld, s, width_vec, flt_width_vec,
bld->static_state->pot_width,
bld->static_state->wrap_s);
lp_build_name(x, "tex.x.wrapped");
if (dims >= 2) {
- y = lp_build_sample_wrap_nearest(bld, t, height_vec,
+ y = lp_build_sample_wrap_nearest(bld, t, height_vec, flt_height_vec,
bld->static_state->pot_height,
bld->static_state->wrap_t);
lp_build_name(y, "tex.y.wrapped");
if (dims == 3) {
- z = lp_build_sample_wrap_nearest(bld, r, depth_vec,
+ z = lp_build_sample_wrap_nearest(bld, r, depth_vec, flt_depth_vec,
bld->static_state->pot_depth,
bld->static_state->wrap_r);
lp_build_name(z, "tex.z.wrapped");
static void
lp_build_sample_image_linear(struct lp_build_sample_context *bld,
unsigned unit,
- LLVMValueRef width_vec,
- LLVMValueRef height_vec,
- LLVMValueRef depth_vec,
+ LLVMValueRef size,
LLVMValueRef row_stride_vec,
LLVMValueRef img_stride_vec,
LLVMValueRef data_ptr,
LLVMValueRef r,
LLVMValueRef colors_out[4])
{
- const int dims = texture_dims(bld->static_state->target);
+ const unsigned dims = bld->dims;
+ LLVMValueRef width_vec;
+ LLVMValueRef height_vec;
+ LLVMValueRef depth_vec;
+ LLVMValueRef flt_size;
+ LLVMValueRef flt_width_vec;
+ LLVMValueRef flt_height_vec;
+ LLVMValueRef flt_depth_vec;
LLVMValueRef x0, y0, z0, x1, y1, z1;
LLVMValueRef s_fpart, t_fpart, r_fpart;
LLVMValueRef neighbors[2][2][4];
int chan;
+ lp_build_extract_image_sizes(bld,
+ bld->int_size_type,
+ bld->int_coord_type,
+ size,
+ &width_vec, &height_vec, &depth_vec);
+
+ flt_size = lp_build_int_to_float(&bld->float_size_bld, size);
+
+ lp_build_extract_image_sizes(bld,
+ bld->float_size_type,
+ bld->coord_type,
+ flt_size,
+ &flt_width_vec, &flt_height_vec, &flt_depth_vec);
+
/*
* Compute integer texcoords.
*/
- lp_build_sample_wrap_linear(bld, s, width_vec,
+ lp_build_sample_wrap_linear(bld, s, width_vec, flt_width_vec,
bld->static_state->pot_width,
bld->static_state->wrap_s,
&x0, &x1, &s_fpart);
lp_build_name(x1, "tex.x1.wrapped");
if (dims >= 2) {
- lp_build_sample_wrap_linear(bld, t, height_vec,
+ lp_build_sample_wrap_linear(bld, t, height_vec, flt_height_vec,
bld->static_state->pot_height,
bld->static_state->wrap_t,
&y0, &y1, &t_fpart);
lp_build_name(y1, "tex.y1.wrapped");
if (dims == 3) {
- lp_build_sample_wrap_linear(bld, r, depth_vec,
+ lp_build_sample_wrap_linear(bld, r, depth_vec, flt_depth_vec,
bld->static_state->pot_depth,
bld->static_state->wrap_r,
&z0, &z1, &r_fpart);
LLVMValueRef s,
LLVMValueRef t,
LLVMValueRef r,
+ LLVMValueRef ilevel0,
+ LLVMValueRef ilevel1,
LLVMValueRef lod_fpart,
- LLVMValueRef width0_vec,
- LLVMValueRef width1_vec,
- LLVMValueRef height0_vec,
- LLVMValueRef height1_vec,
- LLVMValueRef depth0_vec,
- LLVMValueRef depth1_vec,
- LLVMValueRef row_stride0_vec,
- LLVMValueRef row_stride1_vec,
- LLVMValueRef img_stride0_vec,
- LLVMValueRef img_stride1_vec,
- LLVMValueRef data_ptr0,
- LLVMValueRef data_ptr1,
LLVMValueRef *colors_out)
{
+ LLVMBuilderRef builder = bld->builder;
+ LLVMValueRef size0;
+ LLVMValueRef size1;
+ LLVMValueRef row_stride0_vec;
+ LLVMValueRef row_stride1_vec;
+ LLVMValueRef img_stride0_vec;
+ LLVMValueRef img_stride1_vec;
+ LLVMValueRef data_ptr0;
+ LLVMValueRef data_ptr1;
LLVMValueRef colors0[4], colors1[4];
- int chan;
+ unsigned chan;
+ /* sample the first mipmap level */
+ lp_build_mipmap_level_sizes(bld, ilevel0,
+ &size0,
+ &row_stride0_vec, &img_stride0_vec);
+ data_ptr0 = lp_build_get_mipmap_level(bld, ilevel0);
if (img_filter == PIPE_TEX_FILTER_NEAREST) {
- /* sample the first mipmap level */
lp_build_sample_image_nearest(bld, unit,
- width0_vec, height0_vec, depth0_vec,
+ size0,
row_stride0_vec, img_stride0_vec,
- data_ptr0, s, t, r, colors0);
-
- if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
- /* sample the second mipmap level */
- lp_build_sample_image_nearest(bld, unit,
- width1_vec, height1_vec, depth1_vec,
- row_stride1_vec, img_stride1_vec,
- data_ptr1, s, t, r, colors1);
- }
+ data_ptr0, s, t, r,
+ colors0);
}
else {
assert(img_filter == PIPE_TEX_FILTER_LINEAR);
-
- /* sample the first mipmap level */
lp_build_sample_image_linear(bld, unit,
- width0_vec, height0_vec, depth0_vec,
+ size0,
row_stride0_vec, img_stride0_vec,
- data_ptr0, s, t, r, colors0);
+ data_ptr0, s, t, r,
+ colors0);
+ }
- if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
- /* sample the second mipmap level */
- lp_build_sample_image_linear(bld, unit,
- width1_vec, height1_vec, depth1_vec,
- row_stride1_vec, img_stride1_vec,
- data_ptr1, s, t, r, colors1);
- }
+ /* Store the first level's colors in the output variables */
+ for (chan = 0; chan < 4; chan++) {
+ LLVMBuildStore(builder, colors0[chan], colors_out[chan]);
}
if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
- /* interpolate samples from the two mipmap levels */
- for (chan = 0; chan < 4; chan++) {
- colors_out[chan] = lp_build_lerp(&bld->texel_bld, lod_fpart,
+ struct lp_build_if_state if_ctx;
+ LLVMValueRef need_lerp;
+
+ /* need_lerp = lod_fpart > 0 */
+ need_lerp = LLVMBuildFCmp(builder, LLVMRealUGT,
+ lod_fpart,
+ bld->float_bld.zero,
+ "need_lerp");
+
+ lp_build_if(&if_ctx, builder, need_lerp);
+ {
+ /* sample the second mipmap level */
+ lp_build_mipmap_level_sizes(bld, ilevel1,
+ &size1,
+ &row_stride1_vec, &img_stride1_vec);
+ data_ptr1 = lp_build_get_mipmap_level(bld, ilevel1);
+ if (img_filter == PIPE_TEX_FILTER_NEAREST) {
+ lp_build_sample_image_nearest(bld, unit,
+ size1,
+ row_stride1_vec, img_stride1_vec,
+ data_ptr1, s, t, r,
+ colors1);
+ }
+ else {
+ lp_build_sample_image_linear(bld, unit,
+ size1,
+ row_stride1_vec, img_stride1_vec,
+ data_ptr1, s, t, r,
+ colors1);
+ }
+
+ /* interpolate samples from the two mipmap levels */
+
+ lod_fpart = lp_build_broadcast_scalar(&bld->texel_bld, lod_fpart);
+
+ for (chan = 0; chan < 4; chan++) {
+ colors0[chan] = lp_build_lerp(&bld->texel_bld, lod_fpart,
colors0[chan], colors1[chan]);
+ LLVMBuildStore(builder, colors0[chan], colors_out[chan]);
+ }
}
- }
- else {
- /* use first/only level's colors */
- for (chan = 0; chan < 4; chan++) {
- colors_out[chan] = colors0[chan];
- }
+ lp_build_endif(&if_ctx);
}
}
const LLVMValueRef *ddy,
LLVMValueRef lod_bias, /* optional */
LLVMValueRef explicit_lod, /* optional */
- LLVMValueRef width,
- LLVMValueRef height,
- LLVMValueRef depth,
- LLVMValueRef width_vec,
- LLVMValueRef height_vec,
- LLVMValueRef depth_vec,
- LLVMValueRef row_stride_array,
- LLVMValueRef img_stride_array,
- LLVMValueRef data_array,
LLVMValueRef *colors_out)
{
- struct lp_build_context *float_bld = &bld->float_bld;
+ struct lp_build_context *int_bld = &bld->int_bld;
+ LLVMBuilderRef builder = bld->builder;
const unsigned mip_filter = bld->static_state->min_mip_filter;
const unsigned min_filter = bld->static_state->min_img_filter;
const unsigned mag_filter = bld->static_state->mag_img_filter;
- const int dims = texture_dims(bld->static_state->target);
- LLVMValueRef lod = NULL, lod_fpart = NULL;
+ LLVMValueRef lod_ipart = NULL, lod_fpart = NULL;
LLVMValueRef ilevel0, ilevel1 = NULL;
- LLVMValueRef width0_vec = NULL, height0_vec = NULL, depth0_vec = NULL;
- LLVMValueRef width1_vec = NULL, height1_vec = NULL, depth1_vec = NULL;
- LLVMValueRef row_stride0_vec = NULL, row_stride1_vec = NULL;
- LLVMValueRef img_stride0_vec = NULL, img_stride1_vec = NULL;
- LLVMValueRef data_ptr0, data_ptr1 = NULL;
LLVMValueRef face_ddx[4], face_ddy[4];
+ LLVMValueRef texels[4];
+ LLVMTypeRef i32t = LLVMInt32Type();
+ LLVMValueRef i32t_zero = LLVMConstInt(i32t, 0, 0);
+ unsigned chan;
/*
printf("%s mip %d min %d mag %d\n", __FUNCTION__,
r = lp_build_broadcast_scalar(&bld->int_coord_bld, face); /* vec */
/* recompute ddx, ddy using the new (s,t) face texcoords */
- face_ddx[0] = lp_build_ddx(&bld->coord_bld, s);
- face_ddx[1] = lp_build_ddx(&bld->coord_bld, t);
+ face_ddx[0] = lp_build_scalar_ddx(&bld->coord_bld, s);
+ face_ddx[1] = lp_build_scalar_ddx(&bld->coord_bld, t);
face_ddx[2] = NULL;
face_ddx[3] = NULL;
- face_ddy[0] = lp_build_ddy(&bld->coord_bld, s);
- face_ddy[1] = lp_build_ddy(&bld->coord_bld, t);
+ face_ddy[0] = lp_build_scalar_ddy(&bld->coord_bld, s);
+ face_ddy[1] = lp_build_scalar_ddy(&bld->coord_bld, t);
face_ddy[2] = NULL;
face_ddy[3] = NULL;
ddx = face_ddx;
/* Need to compute lod either to choose mipmap levels or to
* distinguish between minification/magnification with one mipmap level.
*/
- lod = lp_build_lod_selector(bld, unit, ddx, ddy,
- lod_bias, explicit_lod,
- width, height, depth);
+ lp_build_lod_selector(bld, unit, ddx, ddy,
+ lod_bias, explicit_lod,
+ mip_filter,
+ &lod_ipart, &lod_fpart);
+ } else {
+ lod_ipart = i32t_zero;
}
/*
- * Compute integer mipmap level(s) to fetch texels from.
+ * Compute integer mipmap level(s) to fetch texels from: ilevel0, ilevel1
*/
- if (mip_filter == PIPE_TEX_MIPFILTER_NONE) {
+ switch (mip_filter) {
+ default:
+ assert(0 && "bad mip_filter value in lp_build_sample_soa()");
+ /* fall-through */
+ case PIPE_TEX_MIPFILTER_NONE:
/* always use mip level 0 */
if (bld->static_state->target == PIPE_TEXTURE_CUBE) {
/* XXX this is a work-around for an apparent bug in LLVM 2.7.
* We should be able to set ilevel0 = const(0) but that causes
* bad x86 code to be emitted.
*/
- lod = lp_build_const_elem(bld->coord_bld.type, 0.0);
- lp_build_nearest_mip_level(bld, unit, lod, &ilevel0);
- }
- else {
- ilevel0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
- }
- }
- else {
- assert(lod);
- if (mip_filter == PIPE_TEX_MIPFILTER_NEAREST) {
- lp_build_nearest_mip_level(bld, unit, lod, &ilevel0);
+ assert(lod_ipart);
+ lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0);
}
else {
- assert(mip_filter == PIPE_TEX_MIPFILTER_LINEAR);
- lp_build_linear_mip_levels(bld, unit, lod, &ilevel0, &ilevel1,
- &lod_fpart);
- lod_fpart = lp_build_broadcast_scalar(&bld->coord_bld, lod_fpart);
+ ilevel0 = i32t_zero;
}
+ break;
+ case PIPE_TEX_MIPFILTER_NEAREST:
+ assert(lod_ipart);
+ lp_build_nearest_mip_level(bld, unit, lod_ipart, &ilevel0);
+ break;
+ case PIPE_TEX_MIPFILTER_LINEAR:
+ assert(lod_ipart);
+ assert(lod_fpart);
+ lp_build_linear_mip_levels(bld, unit,
+ lod_ipart, &lod_fpart,
+ &ilevel0, &ilevel1);
+ break;
}
- /* compute image size(s) of source mipmap level(s) */
- lp_build_mipmap_level_sizes(bld, dims, width_vec, height_vec, depth_vec,
- ilevel0, ilevel1,
- row_stride_array, img_stride_array,
- &width0_vec, &width1_vec,
- &height0_vec, &height1_vec,
- &depth0_vec, &depth1_vec,
- &row_stride0_vec, &row_stride1_vec,
- &img_stride0_vec, &img_stride1_vec);
-
/*
- * Get pointer(s) to image data for mipmap level(s).
+ * Get/interpolate texture colors.
*/
- data_ptr0 = lp_build_get_mipmap_level(bld, data_array, ilevel0);
- if (mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
- data_ptr1 = lp_build_get_mipmap_level(bld, data_array, ilevel1);
+
+ for (chan = 0; chan < 4; ++chan) {
+ texels[chan] = lp_build_alloca(builder, bld->texel_bld.vec_type, "");
+ lp_build_name(texels[chan], "sampler%u_texel_%c_var", unit, "xyzw"[chan]);
}
- /*
- * Get/interpolate texture colors.
- */
if (min_filter == mag_filter) {
/* no need to distinquish between minification and magnification */
lp_build_sample_mipmap(bld, unit,
- min_filter, mip_filter, s, t, r, lod_fpart,
- width0_vec, width1_vec,
- height0_vec, height1_vec,
- depth0_vec, depth1_vec,
- row_stride0_vec, row_stride1_vec,
- img_stride0_vec, img_stride1_vec,
- data_ptr0, data_ptr1,
- colors_out);
+ min_filter, mip_filter,
+ s, t, r,
+ ilevel0, ilevel1, lod_fpart,
+ texels);
}
else {
/* Emit conditional to choose min image filter or mag image filter
- * depending on the lod being >0 or <= 0, respectively.
+ * depending on the lod being > 0 or <= 0, respectively.
*/
- struct lp_build_flow_context *flow_ctx;
struct lp_build_if_state if_ctx;
LLVMValueRef minify;
- flow_ctx = lp_build_flow_create(bld->builder);
- lp_build_flow_scope_begin(flow_ctx);
-
- lp_build_flow_scope_declare(flow_ctx, &colors_out[0]);
- lp_build_flow_scope_declare(flow_ctx, &colors_out[1]);
- lp_build_flow_scope_declare(flow_ctx, &colors_out[2]);
- lp_build_flow_scope_declare(flow_ctx, &colors_out[3]);
-
- /* minify = lod > 0.0 */
- minify = LLVMBuildFCmp(bld->builder, LLVMRealUGE,
- lod, float_bld->zero, "");
+ /* minify = lod >= 0.0 */
+ minify = LLVMBuildICmp(builder, LLVMIntSGE,
+ lod_ipart, int_bld->zero, "");
- lp_build_if(&if_ctx, flow_ctx, bld->builder, minify);
+ lp_build_if(&if_ctx, builder, minify);
{
/* Use the minification filter */
lp_build_sample_mipmap(bld, unit,
min_filter, mip_filter,
- s, t, r, lod_fpart,
- width0_vec, width1_vec,
- height0_vec, height1_vec,
- depth0_vec, depth1_vec,
- row_stride0_vec, row_stride1_vec,
- img_stride0_vec, img_stride1_vec,
- data_ptr0, data_ptr1,
- colors_out);
+ s, t, r,
+ ilevel0, ilevel1, lod_fpart,
+ texels);
}
lp_build_else(&if_ctx);
{
/* Use the magnification filter */
lp_build_sample_mipmap(bld, unit,
- mag_filter, mip_filter,
- s, t, r, lod_fpart,
- width0_vec, width1_vec,
- height0_vec, height1_vec,
- depth0_vec, depth1_vec,
- row_stride0_vec, row_stride1_vec,
- img_stride0_vec, img_stride1_vec,
- data_ptr0, data_ptr1,
- colors_out);
+ mag_filter, PIPE_TEX_MIPFILTER_NONE,
+ s, t, r,
+ i32t_zero, NULL, NULL,
+ texels);
}
lp_build_endif(&if_ctx);
+ }
- lp_build_flow_scope_end(flow_ctx);
- lp_build_flow_destroy(flow_ctx);
+ for (chan = 0; chan < 4; ++chan) {
+ colors_out[chan] = LLVMBuildLoad(builder, texels[chan], "");
+ lp_build_name(colors_out[chan], "sampler%u_texel_%c", unit, "xyzw"[chan]);
}
}
LLVMValueRef explicit_lod, /* optional */
LLVMValueRef texel_out[4])
{
+ unsigned dims = texture_dims(static_state->target);
struct lp_build_sample_context bld;
- LLVMValueRef width, width_vec;
- LLVMValueRef height, height_vec;
- LLVMValueRef depth, depth_vec;
- LLVMValueRef row_stride_array, img_stride_array;
- LLVMValueRef data_array;
+ LLVMTypeRef i32t = LLVMInt32Type();
+
LLVMValueRef s;
LLVMValueRef t;
LLVMValueRef r;
bld.static_state = static_state;
bld.dynamic_state = dynamic_state;
bld.format_desc = util_format_description(static_state->format);
+ bld.dims = dims;
bld.float_type = lp_type_float(32);
bld.int_type = lp_type_int(32);
bld.coord_type = type;
- bld.uint_coord_type = lp_uint_type(type);
bld.int_coord_type = lp_int_type(type);
+ bld.float_size_type = lp_type_float(32);
+ bld.float_size_type.length = dims > 1 ? 4 : 1;
+ bld.int_size_type = lp_int_type(bld.float_size_type);
bld.texel_type = type;
float_vec_type = lp_type_float_vec(32);
lp_build_context_init(&bld.float_vec_bld, builder, float_vec_type);
lp_build_context_init(&bld.int_bld, builder, bld.int_type);
lp_build_context_init(&bld.coord_bld, builder, bld.coord_type);
- lp_build_context_init(&bld.uint_coord_bld, builder, bld.uint_coord_type);
lp_build_context_init(&bld.int_coord_bld, builder, bld.int_coord_type);
+ lp_build_context_init(&bld.int_size_bld, builder, bld.int_size_type);
+ lp_build_context_init(&bld.float_size_bld, builder, bld.float_size_type);
lp_build_context_init(&bld.texel_bld, builder, bld.texel_type);
/* Get the dynamic state */
- width = dynamic_state->width(dynamic_state, builder, unit);
- height = dynamic_state->height(dynamic_state, builder, unit);
- depth = dynamic_state->depth(dynamic_state, builder, unit);
- row_stride_array = dynamic_state->row_stride(dynamic_state, builder, unit);
- img_stride_array = dynamic_state->img_stride(dynamic_state, builder, unit);
- data_array = dynamic_state->data_ptr(dynamic_state, builder, unit);
+ bld.width = dynamic_state->width(dynamic_state, builder, unit);
+ bld.height = dynamic_state->height(dynamic_state, builder, unit);
+ bld.depth = dynamic_state->depth(dynamic_state, builder, unit);
+ bld.row_stride_array = dynamic_state->row_stride(dynamic_state, builder, unit);
+ bld.img_stride_array = dynamic_state->img_stride(dynamic_state, builder, unit);
+ bld.data_array = dynamic_state->data_ptr(dynamic_state, builder, unit);
/* Note that data_array is an array[level] of pointers to texture images */
s = coords[0];
t = coords[1];
r = coords[2];
- /* width, height, depth as uint vectors */
- width_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, width);
- height_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, height);
- depth_vec = lp_build_broadcast_scalar(&bld.uint_coord_bld, depth);
+ /* width, height, depth as single int vector */
+ if (dims <= 1) {
+ bld.int_size = bld.width;
+ }
+ else {
+ bld.int_size = LLVMBuildInsertElement(builder, bld.int_size_bld.undef,
+ bld.width, LLVMConstInt(i32t, 0, 0), "");
+ if (dims >= 2) {
+ bld.int_size = LLVMBuildInsertElement(builder, bld.int_size,
+ bld.height, LLVMConstInt(i32t, 1, 0), "");
+ if (dims >= 3) {
+ bld.int_size = LLVMBuildInsertElement(builder, bld.int_size,
+ bld.depth, LLVMConstInt(i32t, 2, 0), "");
+ }
+ }
+ }
if (0) {
/* For debug: no-op texture sampling */
/* do sampling/filtering with fixed pt arithmetic */
lp_build_sample_aos(&bld, unit, s, t, r, ddx, ddy,
lod_bias, explicit_lod,
- width, height, depth,
- width_vec, height_vec, depth_vec,
- row_stride_array, img_stride_array,
- data_array, texel_out);
+ texel_out);
}
else {
lp_build_sample_general(&bld, unit, s, t, r, ddx, ddy,
lod_bias, explicit_lod,
- width, height, depth,
- width_vec, height_vec, depth_vec,
- row_stride_array, img_stride_array,
- data_array,
texel_out);
}
}
+/**
+ * Combined extract and broadcast (or a mere shuffle when the two types match)
+ */
+LLVMValueRef
+lp_build_extract_broadcast(LLVMBuilderRef builder,
+ struct lp_type src_type,
+ struct lp_type dst_type,
+ LLVMValueRef vector,
+ LLVMValueRef index)
+{
+ LLVMTypeRef i32t = LLVMInt32Type();
+ LLVMValueRef res;
+
+ assert(src_type.floating == dst_type.floating);
+ assert(src_type.width == dst_type.width);
+
+ assert(lp_check_value(src_type, vector));
+ assert(LLVMTypeOf(index) == i32t);
+
+ if (src_type.length == 1) {
+ if (dst_type.length == 1) {
+ /*
+ * Trivial scalar -> scalar.
+ */
+
+ res = vector;
+ }
+ else {
+ /*
+ * Broadcast scalar -> vector.
+ */
+
+ res = lp_build_broadcast(builder,
+ lp_build_vec_type(dst_type),
+ vector);
+ }
+ }
+ else {
+ if (dst_type.length == src_type.length) {
+ /*
+ * Special shuffle of the same size.
+ */
+
+ LLVMValueRef shuffle;
+ shuffle = lp_build_broadcast(builder,
+ LLVMVectorType(i32t, dst_type.length),
+ index);
+ res = LLVMBuildShuffleVector(builder, vector,
+ LLVMGetUndef(lp_build_vec_type(dst_type)),
+ shuffle, "");
+ }
+ else {
+ LLVMValueRef scalar;
+ scalar = LLVMBuildExtractElement(builder, vector, index, "");
+ if (dst_type.length == 1) {
+ /*
+ * Trivial extract scalar from vector.
+ */
+
+ res = scalar;
+ }
+ else {
+ /*
+ * General case of different sized vectors.
+ */
+
+ res = lp_build_broadcast(builder,
+ lp_build_vec_type(dst_type),
+ vector);
+ }
+ }
+ }
+
+ return res;
+}
+
+
/**
* Swizzle one channel into all other three channels.
*/
LLVMValueRef scalar);
+LLVMValueRef
+lp_build_extract_broadcast(LLVMBuilderRef builder,
+ struct lp_type src_type,
+ struct lp_type dst_type,
+ LLVMValueRef vector,
+ LLVMValueRef index);
+
+
/**
* Broadcast one channel of a vector composed of arrays of XYZW structures into
* all four channel.
#define LP_BLD_TGSI_H
#include "gallivm/lp_bld.h"
+#include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
+#include "tgsi/tgsi_scan.h"
struct tgsi_token;
};
+/**
+ * Describe a channel of a register.
+ *
+ * The value can be a:
+ * - immediate value (i.e. derived from a IMM register)
+ * - CONST[n].x/y/z/w
+ * - IN[n].x/y/z/w
+ * - undetermined (when .file == TGSI_FILE_NULL)
+ *
+ * This is one of the analysis results, and is used to described
+ * the output color in terms of inputs.
+ */
+struct lp_tgsi_channel_info
+{
+ unsigned file:4; /* TGSI_FILE_* */
+ unsigned swizzle:3; /* PIPE_SWIZZLE_x */
+ union {
+ uint32_t index;
+ float value; /* for TGSI_FILE_IMMEDIATE */
+ } u;
+};
+
+
+/**
+ * Describe a texture sampler interpolator.
+ *
+ * The interpolation is described in terms of regular inputs.
+ */
+struct lp_tgsi_texture_info
+{
+ struct lp_tgsi_channel_info coord[4];
+ unsigned target:8; /* TGSI_TEXTURE_* */
+ unsigned unit:8; /* Sampler unit */
+ unsigned modifier:8; /* LP_BLD_TEX_MODIFIER_* */
+};
+
+
+struct lp_tgsi_info
+{
+ struct tgsi_shader_info base;
+
+ /*
+ * Whether any of the texture opcodes access a register file other than
+ * TGSI_FILE_INPUT.
+ *
+ * We could also handle TGSI_FILE_CONST/IMMEDIATE here, but there is little
+ * benefit.
+ */
+ unsigned indirect_textures:1;
+
+ /*
+ * Texture opcode description. Aimed at detecting and described direct
+ * texture opcodes.
+ */
+ unsigned num_texs;
+ struct lp_tgsi_texture_info tex[PIPE_MAX_SAMPLERS];
+
+ /*
+ * Output description. Aimed at detecting and describing simple blit
+ * shaders.
+ */
+ struct lp_tgsi_channel_info output[PIPE_MAX_SHADER_OUTPUTS][4];
+
+ /*
+ * Shortcut pointers into the above (for fragment shaders).
+ */
+ const struct lp_tgsi_channel_info *cbuf[PIPE_MAX_COLOR_BUFS];
+};
+
/**
* Sampler code generation interface.
*
};
+void
+lp_build_tgsi_info(const struct tgsi_token *tokens,
+ struct lp_tgsi_info *info);
+
+
void
lp_build_tgsi_soa(LLVMBuilderRef builder,
const struct tgsi_token *tokens,
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **************************************************************************/
+
+
+#include "util/u_memory.h"
+#include "util/u_math.h"
+#include "tgsi/tgsi_parse.h"
+#include "tgsi/tgsi_util.h"
+#include "tgsi/tgsi_dump.h"
+#include "lp_bld_debug.h"
+#include "lp_bld_tgsi.h"
+
+
+/**
+ * Analysis context.
+ *
+ * This is where we keep store the value of each channel of the IMM/TEMP/OUT
+ * register values, as we walk the shader.
+ */
+struct analysis_context
+{
+ struct lp_tgsi_info *info;
+
+ unsigned num_imms;
+ float imm[32][4];
+
+ struct lp_tgsi_channel_info temp[32][4];
+};
+
+
+/**
+ * Describe the specified channel of the src register.
+ */
+static void
+analyse_src(struct analysis_context *ctx,
+ struct lp_tgsi_channel_info *chan_info,
+ const struct tgsi_src_register *src,
+ unsigned chan)
+{
+ chan_info->file = TGSI_FILE_NULL;
+ if (!src->Indirect && !src->Absolute && !src->Negate) {
+ unsigned swizzle = tgsi_util_get_src_register_swizzle(src, chan);
+ if (src->File == TGSI_FILE_TEMPORARY) {
+ if (src->Index < Elements(ctx->temp)) {
+ *chan_info = ctx->temp[src->Index][swizzle];
+ }
+ } else {
+ chan_info->file = src->File;
+ if (src->File == TGSI_FILE_IMMEDIATE) {
+ assert(src->Index < Elements(ctx->imm));
+ if (src->Index < Elements(ctx->imm)) {
+ chan_info->u.value = ctx->imm[src->Index][swizzle];
+ }
+ } else {
+ chan_info->u.index = src->Index;
+ chan_info->swizzle = swizzle;
+ }
+ }
+ }
+}
+
+
+/**
+ * Whether this register channel refers to a specific immediate value.
+ */
+static boolean
+is_immediate(const struct lp_tgsi_channel_info *chan_info, float value)
+{
+ return chan_info->file == TGSI_FILE_IMMEDIATE &&
+ chan_info->u.value == value;
+}
+
+
+static void
+analyse_tex(struct analysis_context *ctx,
+ const struct tgsi_full_instruction *inst,
+ enum lp_build_tex_modifier modifier)
+{
+ struct lp_tgsi_info *info = ctx->info;
+ unsigned chan;
+
+ if (info->num_texs < Elements(info->tex)) {
+ struct lp_tgsi_texture_info *tex_info = &info->tex[info->num_texs];
+ bool indirect = FALSE;
+ unsigned readmask = 0;
+
+ tex_info->target = inst->Texture.Texture;
+ switch (inst->Texture.Texture) {
+ case TGSI_TEXTURE_1D:
+ readmask = TGSI_WRITEMASK_X;
+ break;
+ case TGSI_TEXTURE_2D:
+ case TGSI_TEXTURE_RECT:
+ readmask = TGSI_WRITEMASK_XY;
+ break;
+ case TGSI_TEXTURE_SHADOW1D:
+ case TGSI_TEXTURE_SHADOW2D:
+ case TGSI_TEXTURE_SHADOWRECT:
+ case TGSI_TEXTURE_3D:
+ case TGSI_TEXTURE_CUBE:
+ readmask = TGSI_WRITEMASK_XYZ;
+ break;
+ default:
+ assert(0);
+ return;
+ }
+
+ if (modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV) {
+ /* We don't track explicit derivatives, although we could */
+ indirect = TRUE;
+ tex_info->unit = inst->Src[3].Register.Index;
+ } else {
+ if (modifier == LP_BLD_TEX_MODIFIER_PROJECTED ||
+ modifier == LP_BLD_TEX_MODIFIER_LOD_BIAS ||
+ modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_LOD) {
+ readmask |= TGSI_WRITEMASK_W;
+ }
+ tex_info->unit = inst->Src[1].Register.Index;
+ }
+
+ for (chan = 0; chan < 4; ++chan) {
+ struct lp_tgsi_channel_info *chan_info = &tex_info->coord[chan];
+ if (readmask & (1 << chan)) {
+ analyse_src(ctx, chan_info, &inst->Src[0].Register, chan);
+ if (chan_info->file != TGSI_FILE_INPUT) {
+ indirect = TRUE;
+ }
+ } else {
+ memset(chan_info, 0, sizeof *chan_info);
+ }
+ }
+
+ if (indirect) {
+ info->indirect_textures = TRUE;
+ }
+
+ ++info->num_texs;
+ } else {
+ info->indirect_textures = TRUE;
+ }
+}
+
+
+/**
+ * Process an instruction, and update the register values accordingly.
+ */
+static void
+analyse_instruction(struct analysis_context *ctx,
+ struct tgsi_full_instruction *inst)
+{
+ struct lp_tgsi_info *info = ctx->info;
+ struct lp_tgsi_channel_info (*regs)[4];
+ unsigned max_regs;
+ unsigned i;
+ unsigned index;
+ unsigned chan;
+
+ for (i = 0; i < inst->Instruction.NumDstRegs; ++i) {
+ const struct tgsi_dst_register *dst = &inst->Dst[i].Register;
+
+ /*
+ * Get the lp_tgsi_channel_info array corresponding to the destination
+ * register file.
+ */
+
+ if (dst->File == TGSI_FILE_TEMPORARY) {
+ regs = ctx->temp;
+ max_regs = Elements(ctx->temp);
+ } else if (dst->File == TGSI_FILE_OUTPUT) {
+ regs = info->output;
+ max_regs = Elements(info->output);
+ } else if (dst->File == TGSI_FILE_ADDRESS ||
+ dst->File == TGSI_FILE_PREDICATE) {
+ continue;
+ } else {
+ assert(0);
+ continue;
+ }
+
+ /*
+ * Detect direct TEX instructions
+ */
+
+ switch (inst->Instruction.Opcode) {
+ case TGSI_OPCODE_TEX:
+ analyse_tex(ctx, inst, LP_BLD_TEX_MODIFIER_NONE);
+ break;
+ case TGSI_OPCODE_TXD:
+ analyse_tex(ctx, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV);
+ break;
+ case TGSI_OPCODE_TXB:
+ analyse_tex(ctx, inst, LP_BLD_TEX_MODIFIER_LOD_BIAS);
+ break;
+ case TGSI_OPCODE_TXL:
+ analyse_tex(ctx, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_LOD);
+ break;
+ case TGSI_OPCODE_TXP:
+ analyse_tex(ctx, inst, LP_BLD_TEX_MODIFIER_PROJECTED);
+ break;
+ default:
+ break;
+ }
+
+ /*
+ * Keep track of assignments and writes
+ */
+
+ if (dst->Indirect) {
+ /*
+ * It could be any register index so clear all register indices.
+ */
+
+ for (chan = 0; chan < 4; ++chan) {
+ if (dst->WriteMask & (1 << chan)) {
+ for (index = 0; index < max_regs; ++index) {
+ regs[index][chan].file = TGSI_FILE_NULL;
+ }
+ }
+ }
+ } else if (dst->Index < max_regs) {
+ /*
+ * Update this destination register value.
+ */
+
+ struct lp_tgsi_channel_info res[4];
+
+ memset(res, 0, sizeof res);
+
+ if (!inst->Instruction.Predicate &&
+ !inst->Instruction.Saturate) {
+ for (chan = 0; chan < 4; ++chan) {
+ if (dst->WriteMask & (1 << chan)) {
+ if (inst->Instruction.Opcode == TGSI_OPCODE_MOV) {
+ analyse_src(ctx, &res[chan],
+ &inst->Src[0].Register, chan);
+ } else if (inst->Instruction.Opcode == TGSI_OPCODE_MUL) {
+ /*
+ * Propagate values across 1.0 and 0.0 multiplications.
+ */
+
+ struct lp_tgsi_channel_info src0;
+ struct lp_tgsi_channel_info src1;
+
+ analyse_src(ctx, &src0, &inst->Src[0].Register, chan);
+ analyse_src(ctx, &src1, &inst->Src[1].Register, chan);
+
+ if (is_immediate(&src0, 0.0f)) {
+ res[chan] = src0;
+ } else if (is_immediate(&src1, 0.0f)) {
+ res[chan] = src1;
+ } else if (is_immediate(&src0, 1.0f)) {
+ res[chan] = src1;
+ } else if (is_immediate(&src1, 1.0f)) {
+ res[chan] = src0;
+ }
+ }
+ }
+ }
+ }
+
+ for (chan = 0; chan < 4; ++chan) {
+ if (dst->WriteMask & (1 << chan)) {
+ regs[dst->Index][chan] = res[chan];
+ }
+ }
+ }
+ }
+
+ /*
+ * Clear all temporaries information in presence of a control flow opcode.
+ */
+
+ switch (inst->Instruction.Opcode) {
+ case TGSI_OPCODE_IF:
+ case TGSI_OPCODE_IFC:
+ case TGSI_OPCODE_ELSE:
+ case TGSI_OPCODE_ENDIF:
+ case TGSI_OPCODE_BGNLOOP:
+ case TGSI_OPCODE_BRK:
+ case TGSI_OPCODE_BREAKC:
+ case TGSI_OPCODE_CONT:
+ case TGSI_OPCODE_ENDLOOP:
+ case TGSI_OPCODE_CALLNZ:
+ case TGSI_OPCODE_CAL:
+ case TGSI_OPCODE_BGNSUB:
+ case TGSI_OPCODE_ENDSUB:
+ case TGSI_OPCODE_SWITCH:
+ case TGSI_OPCODE_CASE:
+ case TGSI_OPCODE_DEFAULT:
+ case TGSI_OPCODE_ENDSWITCH:
+ case TGSI_OPCODE_RET:
+ case TGSI_OPCODE_END:
+ /* XXX: Are there more cases? */
+ memset(&ctx->temp, 0, sizeof ctx->temp);
+ memset(&info->output, 0, sizeof info->output);
+ default:
+ break;
+ }
+}
+
+
+static INLINE void
+dump_info(const struct tgsi_token *tokens,
+ struct lp_tgsi_info *info)
+{
+ unsigned index;
+ unsigned chan;
+
+ tgsi_dump(tokens, 0);
+
+ for (index = 0; index < info->num_texs; ++index) {
+ const struct lp_tgsi_texture_info *tex_info = &info->tex[index];
+ debug_printf("TEX[%u] =", index);
+ for (chan = 0; chan < 4; ++chan) {
+ const struct lp_tgsi_channel_info *chan_info =
+ &tex_info->coord[chan];
+ if (chan_info->file != TGSI_FILE_NULL) {
+ debug_printf(" %s[%u].%c",
+ tgsi_file_names[chan_info->file],
+ chan_info->u.index,
+ "xyzw01"[chan_info->swizzle]);
+ } else {
+ debug_printf(" _");
+ }
+ }
+ debug_printf(", SAMP[%u], %s\n",
+ tex_info->unit,
+ tgsi_texture_names[tex_info->target]);
+ }
+
+ for (index = 0; index < PIPE_MAX_SHADER_OUTPUTS; ++index) {
+ for (chan = 0; chan < 4; ++chan) {
+ const struct lp_tgsi_channel_info *chan_info =
+ &info->output[index][chan];
+ if (chan_info->file != TGSI_FILE_NULL) {
+ debug_printf("OUT[%u].%c = ", index, "xyzw"[chan]);
+ if (chan_info->file == TGSI_FILE_IMMEDIATE) {
+ debug_printf("%f", chan_info->u.value);
+ } else {
+ const char *file_name;
+ switch (chan_info->file) {
+ case TGSI_FILE_CONSTANT:
+ file_name = "CONST";
+ break;
+ case TGSI_FILE_INPUT:
+ file_name = "IN";
+ break;
+ default:
+ file_name = "???";
+ break;
+ }
+ debug_printf("%s[%u].%c",
+ file_name,
+ chan_info->u.index,
+ "xyzw01"[chan_info->swizzle]);
+ }
+ debug_printf("\n");
+ }
+ }
+ }
+}
+
+
+/**
+ * Detect any direct relationship between the output color
+ */
+void
+lp_build_tgsi_info(const struct tgsi_token *tokens,
+ struct lp_tgsi_info *info)
+{
+ struct tgsi_parse_context parse;
+ struct analysis_context ctx;
+ unsigned index;
+ unsigned chan;
+
+ memset(info, 0, sizeof *info);
+
+ tgsi_scan_shader(tokens, &info->base);
+
+ memset(&ctx, 0, sizeof ctx);
+ ctx.info = info;
+
+ tgsi_parse_init(&parse, tokens);
+
+ while (!tgsi_parse_end_of_tokens(&parse)) {
+ tgsi_parse_token(&parse);
+
+ switch (parse.FullToken.Token.Type) {
+ case TGSI_TOKEN_TYPE_DECLARATION:
+ break;
+
+ case TGSI_TOKEN_TYPE_INSTRUCTION:
+ {
+ struct tgsi_full_instruction *inst =
+ &parse.FullToken.FullInstruction;
+
+ if (inst->Instruction.Opcode == TGSI_OPCODE_END ||
+ inst->Instruction.Opcode == TGSI_OPCODE_BGNSUB) {
+ /* We reached the end of main function body. */
+ goto finished;
+ }
+
+ analyse_instruction(&ctx, inst);
+ }
+ break;
+
+ case TGSI_TOKEN_TYPE_IMMEDIATE:
+ {
+ const unsigned size =
+ parse.FullToken.FullImmediate.Immediate.NrTokens - 1;
+ assert(size <= 4);
+ if (ctx.num_imms < Elements(ctx.imm)) {
+ for (chan = 0; chan < size; ++chan) {
+ ctx.imm[ctx.num_imms][chan] =
+ parse.FullToken.FullImmediate.u[chan].Float;
+ }
+ ++ctx.num_imms;
+ }
+ }
+ break;
+
+ case TGSI_TOKEN_TYPE_PROPERTY:
+ break;
+
+ default:
+ assert(0);
+ }
+ }
+finished:
+
+ tgsi_parse_free(&parse);
+
+
+ /*
+ * Link the output color values.
+ */
+
+ for (index = 0; index < PIPE_MAX_COLOR_BUFS; ++index) {
+ const struct lp_tgsi_channel_info null_output[4];
+ info->cbuf[index] = null_output;
+ }
+
+ for (index = 0; index < info->base.num_outputs; ++index) {
+ unsigned semantic_name = info->base.output_semantic_name[index];
+ unsigned semantic_index = info->base.output_semantic_index[index];
+ if (semantic_name == TGSI_SEMANTIC_COLOR &&
+ semantic_index < PIPE_MAX_COLOR_BUFS) {
+ info->cbuf[semantic_index] = info->output[index];
+ }
+ }
+
+ if (gallivm_debug & GALLIVM_DEBUG_TGSI) {
+ dump_info(tokens, info);
+ }
+}
}
if (modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV) {
+ LLVMTypeRef i32t = LLVMInt32Type();
+ LLVMValueRef index0 = LLVMConstInt(i32t, 0, 0);
for (i = 0; i < num_coords; i++) {
- ddx[i] = emit_fetch( bld, inst, 1, i );
- ddy[i] = emit_fetch( bld, inst, 2, i );
+ LLVMValueRef src1 = emit_fetch( bld, inst, 1, i );
+ LLVMValueRef src2 = emit_fetch( bld, inst, 2, i );
+ ddx[i] = LLVMBuildExtractElement(bld->base.builder, src1, index0, "");
+ ddy[i] = LLVMBuildExtractElement(bld->base.builder, src2, index0, "");
}
unit = inst->Src[3].Register.Index;
} else {
for (i = 0; i < num_coords; i++) {
- ddx[i] = lp_build_ddx( &bld->base, coords[i] );
- ddy[i] = lp_build_ddy( &bld->base, coords[i] );
+ ddx[i] = lp_build_scalar_ddx( &bld->base, coords[i] );
+ ddy[i] = lp_build_scalar_ddy( &bld->base, coords[i] );
}
unit = inst->Src[1].Register.Index;
}
for (i = num_coords; i < 3; i++) {
- ddx[i] = bld->base.undef;
- ddy[i] = bld->base.undef;
+ ddx[i] = LLVMGetUndef(bld->base.elem_type);
+ ddy[i] = LLVMGetUndef(bld->base.elem_type);
}
bld->sampler->emit_fetch_texel(bld->sampler,
texel);
}
+static boolean
+near_end_of_shader(struct lp_build_tgsi_soa_context *bld,
+ int pc)
+{
+ int i;
+
+ for (i = 0; i < 5; i++) {
+ unsigned opcode;
+
+ if (pc + i >= bld->info->num_instructions)
+ return TRUE;
+
+ opcode = bld->instructions[pc + i].Instruction.Opcode;
+
+ if (opcode == TGSI_OPCODE_END)
+ return TRUE;
+
+ if (opcode == TGSI_OPCODE_TEX ||
+ opcode == TGSI_OPCODE_TXP ||
+ opcode == TGSI_OPCODE_TXD ||
+ opcode == TGSI_OPCODE_TXB ||
+ opcode == TGSI_OPCODE_TXL ||
+ opcode == TGSI_OPCODE_TXF ||
+ opcode == TGSI_OPCODE_TXQ ||
+ opcode == TGSI_OPCODE_CAL ||
+ opcode == TGSI_OPCODE_CALLNZ ||
+ opcode == TGSI_OPCODE_IF ||
+ opcode == TGSI_OPCODE_IFC ||
+ opcode == TGSI_OPCODE_BGNLOOP ||
+ opcode == TGSI_OPCODE_SWITCH)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
/**
* Kill fragment if any of the src register values are negative.
static void
emit_kil(
struct lp_build_tgsi_soa_context *bld,
- const struct tgsi_full_instruction *inst )
+ const struct tgsi_full_instruction *inst,
+ int pc)
{
const struct tgsi_full_src_register *reg = &inst->Src[0];
LLVMValueRef terms[NUM_CHANNELS];
}
}
- if(mask)
+ if(mask) {
lp_build_mask_update(bld->mask, mask);
+
+ if (!near_end_of_shader(bld, pc))
+ lp_build_mask_check(bld->mask);
+ }
}
*/
static void
emit_kilp(struct lp_build_tgsi_soa_context *bld,
- const struct tgsi_full_instruction *inst)
+ const struct tgsi_full_instruction *inst,
+ int pc)
{
LLVMValueRef mask;
mask = LLVMBuildNot(bld->base.builder, bld->exec_mask.exec_mask, "kilp");
}
else {
- mask = bld->base.zero;
+ LLVMValueRef zero = LLVMConstNull(bld->base.int_vec_type);
+ mask = zero;
}
lp_build_mask_update(bld->mask, mask);
+
+ if (!near_end_of_shader(bld, pc))
+ lp_build_mask_check(bld->mask);
}
static void
case TGSI_OPCODE_KILP:
/* predicated kill */
- emit_kilp( bld, inst );
+ emit_kilp( bld, inst, (*pc)-1 );
break;
case TGSI_OPCODE_KIL:
/* conditional kill */
- emit_kil( bld, inst );
+ emit_kil( bld, inst, (*pc)-1 );
break;
case TGSI_OPCODE_PK2H:
};
-static INLINE boolean
+static INLINE int
pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
pb_size size,
const struct pb_desc *desc)
void *map;
if(buf->base.base.size < size)
- return FALSE;
+ return 0;
/* be lenient with size */
if(buf->base.base.size >= 2*size)
- return FALSE;
+ return 0;
if(!pb_check_alignment(desc->alignment, buf->base.base.alignment))
- return FALSE;
+ return 0;
if(!pb_check_usage(desc->usage, buf->base.base.usage))
- return FALSE;
+ return 0;
map = pb_map(buf->buffer, PB_USAGE_DONTBLOCK, NULL);
if (!map) {
- return FALSE;
+ return -1;
}
pb_unmap(buf->buffer);
- return TRUE;
+ return 1;
}
struct pb_cache_buffer *curr_buf;
struct list_head *curr, *next;
int64_t now;
-
+ int ret = 0;
+
pipe_mutex_lock(mgr->mutex);
buf = NULL;
now = os_time_get();
while(curr != &mgr->delayed) {
curr_buf = LIST_ENTRY(struct pb_cache_buffer, curr, head);
- if(!buf && pb_cache_is_buffer_compat(curr_buf, size, desc))
- buf = curr_buf;
+ if(!buf && (ret = pb_cache_is_buffer_compat(curr_buf, size, desc) > 0))
+ buf = curr_buf;
else if(os_time_timeout(curr_buf->start, curr_buf->end, now))
- _pb_cache_buffer_destroy(curr_buf);
+ _pb_cache_buffer_destroy(curr_buf);
else
/* This buffer (and all hereafter) are still hot in cache */
break;
+ if (ret == -1)
+ break;
curr = next;
next = curr->next;
}
/* keep searching in the hot buffers */
- if(!buf) {
+ if(!buf && ret != -1) {
while(curr != &mgr->delayed) {
curr_buf = LIST_ENTRY(struct pb_cache_buffer, curr, head);
- if(pb_cache_is_buffer_compat(curr_buf, size, desc)) {
+ ret = pb_cache_is_buffer_compat(curr_buf, size, desc);
+ if (ret > 0) {
buf = curr_buf;
break;
}
+ if (ret == -1)
+ break;
/* no need to check the timeout here */
curr = next;
next = curr->next;
if(buf) {
LIST_DEL(&buf->head);
+ --mgr->numDelayed;
pipe_mutex_unlock(mgr->mutex);
/* Increase refcount */
pipe_reference_init(&buf->base.base.reference, 1);
#include <unistd.h>
#include <sys/mman.h>
-#include "os/os_thread.h"
#include "util/u_mm.h"
#define EXEC_HEAP_SIZE (10*1024*1024)
#include "cell/ppu/cell_public.h"
#endif
+
static INLINE struct pipe_screen *
-sw_screen_create(struct sw_winsys *winsys)
+sw_screen_create_named(struct sw_winsys *winsys, const char *driver)
{
- const char *default_driver;
- const char *driver;
struct pipe_screen *screen = NULL;
-#if defined(GALLIUM_CELL)
- default_driver = "cell";
-#elif defined(GALLIUM_LLVMPIPE)
- default_driver = "llvmpipe";
-#elif defined(GALLIUM_SOFTPIPE)
- default_driver = "softpipe";
-#else
- default_driver = "";
-#endif
-
- driver = debug_get_option("GALLIUM_DRIVER", default_driver);
-
#if defined(GALLIUM_CELL)
if (screen == NULL && strcmp(driver, "cell") == 0)
screen = cell_create_screen(winsys);
return screen;
}
+
+static INLINE struct pipe_screen *
+sw_screen_create(struct sw_winsys *winsys)
+{
+ const char *default_driver;
+ const char *driver;
+
+#if defined(GALLIUM_CELL)
+ default_driver = "cell";
+#elif defined(GALLIUM_LLVMPIPE)
+ default_driver = "llvmpipe";
+#elif defined(GALLIUM_SOFTPIPE)
+ default_driver = "softpipe";
+#else
+ default_driver = "";
+#endif
+
+ driver = debug_get_option("GALLIUM_DRIVER", default_driver);
+ return sw_screen_create_named(winsys, driver);
+}
+
+
#endif
sw_screen_wrap(struct pipe_screen *screen)
{
struct sw_winsys *sws;
- struct pipe_screen *sw_screen;
+ struct pipe_screen *sw_screen = NULL;
+ const char *driver;
- sws = wrapper_sw_winsys_warp_pipe_screen(screen);
+ driver = debug_get_option("GALLIUM_DRIVER", "native");
+ if (strcmp(driver, "native") == 0)
+ return screen;
+
+ sws = wrapper_sw_winsys_wrap_pipe_screen(screen);
if (!sws)
goto err;
- sw_screen = sw_screen_create(sws);
- if (sw_screen == screen)
+ sw_screen = sw_screen_create_named(sws, driver);
+
+ if (!sw_screen)
goto err_winsys;
return sw_screen;
err_winsys:
- sws->destroy(sws);
+ return wrapper_sw_winsys_dewrap_pipe_screen(sws);
err:
- return screen;
+ return screen;
}
#endif
"GEOM"
};
-static const char *file_names[TGSI_FILE_COUNT] =
+const char *
+tgsi_file_names[TGSI_FILE_COUNT] =
{
"NULL",
"CONST",
"FACE",
"EDGEFLAG",
"PRIM_ID",
- "INSTANCEID"
+ "INSTANCEID",
+ "STENCIL"
};
static const char *immediate_type_names[] =
"INT32"
};
-static const char *swizzle_names[] =
+const char *
+tgsi_swizzle_names[] =
{
"x",
"y",
"w"
};
-static const char *texture_names[] =
+const char *
+tgsi_texture_names[] =
{
"UNKNOWN",
"1D",
struct dump_ctx *ctx,
const struct tgsi_full_src_register *src )
{
- ENM(src->Register.File, file_names);
+ ENM(src->Register.File, tgsi_file_names);
if (src->Register.Dimension) {
if (src->Dimension.Indirect) {
CHR( '[' );
- ENM( src->DimIndirect.File, file_names );
+ ENM( src->DimIndirect.File, tgsi_file_names );
CHR( '[' );
SID( src->DimIndirect.Index );
TXT( "]." );
- ENM( src->DimIndirect.SwizzleX, swizzle_names );
+ ENM( src->DimIndirect.SwizzleX, tgsi_swizzle_names );
if (src->Dimension.Index != 0) {
if (src->Dimension.Index > 0)
CHR( '+' );
}
if (src->Register.Indirect) {
CHR( '[' );
- ENM( src->Indirect.File, file_names );
+ ENM( src->Indirect.File, tgsi_file_names );
CHR( '[' );
SID( src->Indirect.Index );
TXT( "]." );
- ENM( src->Indirect.SwizzleX, swizzle_names );
+ ENM( src->Indirect.SwizzleX, tgsi_swizzle_names );
if (src->Register.Index != 0) {
if (src->Register.Index > 0)
CHR( '+' );
struct dump_ctx *ctx,
const struct tgsi_full_dst_register *dst )
{
- ENM(dst->Register.File, file_names);
+ ENM(dst->Register.File, tgsi_file_names);
if (dst->Register.Dimension) {
if (dst->Dimension.Indirect) {
CHR( '[' );
- ENM( dst->DimIndirect.File, file_names );
+ ENM( dst->DimIndirect.File, tgsi_file_names );
CHR( '[' );
SID( dst->DimIndirect.Index );
TXT( "]." );
- ENM( dst->DimIndirect.SwizzleX, swizzle_names );
+ ENM( dst->DimIndirect.SwizzleX, tgsi_swizzle_names );
if (dst->Dimension.Index != 0) {
if (dst->Dimension.Index > 0)
CHR( '+' );
}
if (dst->Register.Indirect) {
CHR( '[' );
- ENM( dst->Indirect.File, file_names );
+ ENM( dst->Indirect.File, tgsi_file_names );
CHR( '[' );
SID( dst->Indirect.Index );
TXT( "]." );
- ENM( dst->Indirect.SwizzleX, swizzle_names );
+ ENM( dst->Indirect.SwizzleX, tgsi_swizzle_names );
if (dst->Register.Index != 0) {
if (dst->Register.Index > 0)
CHR( '+' );
TXT( "DCL " );
- ENM(decl->Declaration.File, file_names);
+ ENM(decl->Declaration.File, tgsi_file_names);
/* all geometry shader inputs are two dimensional */
if (decl->Declaration.File == TGSI_FILE_INPUT &&
inst->Predicate.SwizzleZ != TGSI_SWIZZLE_Z ||
inst->Predicate.SwizzleW != TGSI_SWIZZLE_W) {
CHR( '.' );
- ENM( inst->Predicate.SwizzleX, swizzle_names );
- ENM( inst->Predicate.SwizzleY, swizzle_names );
- ENM( inst->Predicate.SwizzleZ, swizzle_names );
- ENM( inst->Predicate.SwizzleW, swizzle_names );
+ ENM( inst->Predicate.SwizzleX, tgsi_swizzle_names );
+ ENM( inst->Predicate.SwizzleY, tgsi_swizzle_names );
+ ENM( inst->Predicate.SwizzleZ, tgsi_swizzle_names );
+ ENM( inst->Predicate.SwizzleW, tgsi_swizzle_names );
}
TXT( ") " );
src->Register.SwizzleZ != TGSI_SWIZZLE_Z ||
src->Register.SwizzleW != TGSI_SWIZZLE_W) {
CHR( '.' );
- ENM( src->Register.SwizzleX, swizzle_names );
- ENM( src->Register.SwizzleY, swizzle_names );
- ENM( src->Register.SwizzleZ, swizzle_names );
- ENM( src->Register.SwizzleW, swizzle_names );
+ ENM( src->Register.SwizzleX, tgsi_swizzle_names );
+ ENM( src->Register.SwizzleY, tgsi_swizzle_names );
+ ENM( src->Register.SwizzleZ, tgsi_swizzle_names );
+ ENM( src->Register.SwizzleW, tgsi_swizzle_names );
}
if (src->Register.Absolute)
if (inst->Instruction.Texture) {
TXT( ", " );
- ENM( inst->Texture.Texture, texture_names );
+ ENM( inst->Texture.Texture, tgsi_texture_names );
}
switch (inst->Instruction.Opcode) {
extern "C" {
#endif
+extern const char *
+tgsi_file_names[TGSI_FILE_COUNT];
+
+extern const char *
+tgsi_swizzle_names[];
+
+extern const char *
+tgsi_texture_names[];
+
void
tgsi_dump_str(
const struct tgsi_token *tokens,
info->input_semantic_name[reg] = (ubyte)fulldecl->Semantic.Name;
info->input_semantic_index[reg] = (ubyte)fulldecl->Semantic.Index;
info->input_interpolate[reg] = (ubyte)fulldecl->Declaration.Interpolate;
+ info->input_centroid[reg] = (ubyte)fulldecl->Declaration.Centroid;
info->input_cylindrical_wrap[reg] = (ubyte)fulldecl->Declaration.CylindricalWrap;
info->num_inputs++;
}
/* extra info for special outputs */
if (procType == TGSI_PROCESSOR_FRAGMENT &&
- fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION) {
- info->writes_z = TRUE;
- }
+ fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION)
+ info->writes_z = TRUE;
+ if (procType == TGSI_PROCESSOR_FRAGMENT &&
+ fulldecl->Semantic.Name == TGSI_SEMANTIC_STENCIL)
+ info->writes_stencil = TRUE;
if (procType == TGSI_PROCESSOR_VERTEX &&
fulldecl->Semantic.Name == TGSI_SEMANTIC_EDGEFLAG) {
info->writes_edgeflag = TRUE;
ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; /**< TGSI_SEMANTIC_x */
ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
ubyte input_interpolate[PIPE_MAX_SHADER_INPUTS];
+ ubyte input_centroid[PIPE_MAX_SHADER_INPUTS];
ubyte input_usage_mask[PIPE_MAX_SHADER_INPUTS];
ubyte input_cylindrical_wrap[PIPE_MAX_SHADER_INPUTS];
ubyte output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; /**< TGSI_SEMANTIC_x */
uint opcode_count[TGSI_OPCODE_LAST]; /**< opcode histogram */
boolean writes_z; /**< does fragment shader write Z value? */
+ boolean writes_stencil; /**< does fragment shader write stencil value? */
boolean writes_edgeflag; /**< vertex shader outputs edgeflag */
boolean uses_kill; /**< KIL or KILP instruction used? */
#define PIPE_ATOMIC_ASM_MSVC_X86
#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
#endif
+#if defined(PIPE_ATOMIC_ASM_GCC_X86_64)
+#define PIPE_ATOMIC "GCC x86_64 assembly"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define p_atomic_set(_v, _i) (*(_v) = (_i))
+#define p_atomic_read(_v) (*(_v))
+
+static INLINE boolean
+p_atomic_dec_zero(int32_t *v)
+{
+ unsigned char c;
+
+ __asm__ __volatile__("lock; decl %0; sete %1":"+m"(*v), "=qm"(c)
+ ::"memory");
+
+ return c != 0;
+}
+
+static INLINE void
+p_atomic_inc(int32_t *v)
+{
+ __asm__ __volatile__("lock; incl %0":"+m"(*v));
+}
+
+static INLINE void
+p_atomic_dec(int32_t *v)
+{
+ __asm__ __volatile__("lock; decl %0":"+m"(*v));
+}
+
+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);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PIPE_ATOMIC_ASM_GCC_X86_64 */
+
#if defined(PIPE_ATOMIC_ASM_GCC_X86)
PIPE_FORMAT_Z32_FLOAT , plain, 1, 1, f32 , , , , x___, zs
PIPE_FORMAT_Z24_UNORM_S8_USCALED , plain, 1, 1, un24, u8 , , , xy__, zs
PIPE_FORMAT_S8_USCALED_Z24_UNORM , plain, 1, 1, u8 , un24, , , yx__, zs
+PIPE_FORMAT_X24S8_USCALED , plain, 1, 1, x24, u8 , , , _y__, zs
+PIPE_FORMAT_S8X24_USCALED , plain, 1, 1, u8 , x24 , , , _x__, zs
PIPE_FORMAT_Z24X8_UNORM , plain, 1, 1, un24, x8 , , , x___, zs
PIPE_FORMAT_X8Z24_UNORM , plain, 1, 1, x8 , un24, , , y___, zs
PIPE_FORMAT_Z32_FLOAT_S8X24_USCALED , plain, 1, 1, f32, u8 , x24 , , xy__, zs
+PIPE_FORMAT_X32_S8X24_USCALED , plain, 1, 1, x32, u8 , x24 , , _y__, zs
# YUV formats
# http://www.fourcc.org/yuv.php#UYVY
}
}
+
+void
+util_format_x24s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_z24_unorm_s8_uscaled_unpack_s_8uscaled(dst_row, dst_stride,
+ src_row, src_stride,
+ width, height);
+}
+
+void
+util_format_x24s8_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_z24_unorm_s8_uscaled_pack_s_8uscaled(dst_row, dst_stride,
+ src_row, src_stride,
+ width, height);
+}
+
+void
+util_format_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_s8_uscaled_z24_unorm_unpack_s_8uscaled(dst_row, dst_stride,
+ src_row, src_stride,
+ width, height);
+}
+
+void
+util_format_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ util_format_s8_uscaled_z24_unorm_pack_s_8uscaled(dst_row, dst_stride,
+ src_row, src_stride,
+ width, height);
+}
+
+void
+util_format_x32_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height)
+{
+ util_format_z32_float_s8x24_uscaled_unpack_s_8uscaled(dst_row, dst_stride,
+ src_row, src_stride,
+ width, height);
+
+}
+
+void
+util_format_x32_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride,
+ const uint8_t *src_row, unsigned src_stride,
+ unsigned width, unsigned height)
+{
+ util_format_z32_float_s8x24_uscaled_pack_s_8uscaled(dst_row, dst_stride,
+ src_row, src_stride,
+ width, height);
+}
void
util_format_z32_float_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+void
+util_format_x24s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_x24s8_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+void
+util_format_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_x32_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+
+void
+util_format_x32_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_sride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
#endif /* U_FORMAT_ZS_H_ */
#endif
+#ifndef M_SQRT2
+#define M_SQRT2 1.41421356237309504880
+#endif
+
+
#if defined(_MSC_VER)
#if _MSC_VER < 1400 && !defined(__cplusplus) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
/* Integer versions of util_pack_z and util_pack_z_stencil - useful for
* constructing clear masks.
*/
-static INLINE uint
-util_pack_uint_z(enum pipe_format format, unsigned z)
+static INLINE uint32_t
+util_pack_mask_z(enum pipe_format format, uint32_t z)
{
switch (format) {
case PIPE_FORMAT_Z16_UNORM:
case PIPE_FORMAT_S8_USCALED:
return 0;
default:
- debug_print_format("gallium: unhandled format in util_pack_z()", format);
+ debug_print_format("gallium: unhandled format in util_pack_mask_z()", format);
assert(0);
return 0;
}
}
-static INLINE uint
-util_pack_uint_z_stencil(enum pipe_format format, double z, uint s)
+static INLINE uint32_t
+util_pack_mask_z_stencil(enum pipe_format format, uint32_t z, uint8_t s)
{
- unsigned packed = util_pack_uint_z(format, z);
-
- s &= 0xff;
+ uint32_t packed = util_pack_mask_z(format, z);
switch (format) {
case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
- return packed | (s << 24);
+ packed |= (uint32_t)s << 24;
+ break;
case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
- return packed | s;
+ packed |= s;
+ break;
case PIPE_FORMAT_S8_USCALED:
- return packed | s;
+ packed |= s;
+ break;
default:
- return packed;
+ break;
}
+
+ return packed;
}
/**
* Note: it's assumed that z is in [0,1]
*/
-static INLINE uint
+static INLINE uint32_t
util_pack_z(enum pipe_format format, double z)
{
+ union fi fui;
+
if (z == 0.0)
return 0;
case PIPE_FORMAT_Z16_UNORM:
if (z == 1.0)
return 0xffff;
- return (uint) (z * 0xffff);
+ return (uint32_t) (z * 0xffff);
case PIPE_FORMAT_Z32_UNORM:
/* special-case to avoid overflow */
if (z == 1.0)
return 0xffffffff;
- return (uint) (z * 0xffffffff);
+ return (uint32_t) (z * 0xffffffff);
case PIPE_FORMAT_Z32_FLOAT:
- return (uint)z;
+ fui.f = (float)z;
+ return fui.ui;
case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
case PIPE_FORMAT_Z24X8_UNORM:
if (z == 1.0)
return 0xffffff;
- return (uint) (z * 0xffffff);
+ return (uint32_t) (z * 0xffffff);
case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
if (z == 1.0)
return 0xffffff00;
- return ((uint) (z * 0xffffff)) << 8;
+ return ((uint32_t) (z * 0xffffff)) << 8;
case PIPE_FORMAT_S8_USCALED:
/* this case can get it via util_pack_z_stencil() */
return 0;
* Pack Z and/or stencil values into a 32-bit value described by format.
* Note: it's assumed that z is in [0,1] and s in [0,255]
*/
-static INLINE uint
-util_pack_z_stencil(enum pipe_format format, double z, uint s)
+static INLINE uint32_t
+util_pack_z_stencil(enum pipe_format format, double z, uint8_t s)
{
- unsigned packed = util_pack_z(format, z);
+ uint32_t packed = util_pack_z(format, z);
switch (format) {
case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
- packed |= s << 24;
+ packed |= (uint32_t)s << 24;
break;
case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
packed |= s;
#endif /* defined(_MSC_VER) && _MSC_VER < 1500 */
+union m128i {
+ __m128i m;
+ ubyte ub[16];
+ ushort us[8];
+ uint ui[4];
+};
+
+static INLINE void u_print_epi8(const char *name, __m128i r)
+{
+ union { __m128i m; ubyte ub[16]; } u;
+ u.m = r;
+
+ debug_printf("%s: "
+ "%02x/"
+ "%02x/"
+ "%02x/"
+ "%02x/"
+ "%02x/"
+ "%02x/"
+ "%02x/"
+ "%02x/"
+ "%02x/"
+ "%02x/"
+ "%02x/"
+ "%02x/"
+ "%02x/"
+ "%02x/"
+ "%02x/"
+ "%02x\n",
+ name,
+ u.ub[0], u.ub[1], u.ub[2], u.ub[3],
+ u.ub[4], u.ub[5], u.ub[6], u.ub[7],
+ u.ub[8], u.ub[9], u.ub[10], u.ub[11],
+ u.ub[12], u.ub[13], u.ub[14], u.ub[15]);
+}
+
+static INLINE void u_print_epi16(const char *name, __m128i r)
+{
+ union { __m128i m; ushort us[8]; } u;
+ u.m = r;
+
+ debug_printf("%s: "
+ "%04x/"
+ "%04x/"
+ "%04x/"
+ "%04x/"
+ "%04x/"
+ "%04x/"
+ "%04x/"
+ "%04x\n",
+ name,
+ u.us[0], u.us[1], u.us[2], u.us[3],
+ u.us[4], u.us[5], u.us[6], u.us[7]);
+}
+
+static INLINE void u_print_epi32(const char *name, __m128i r)
+{
+ union { __m128i m; uint ui[4]; } u;
+ u.m = r;
+
+ debug_printf("%s: "
+ "%08x/"
+ "%08x/"
+ "%08x/"
+ "%08x\n",
+ name,
+ u.ui[0], u.ui[1], u.ui[2], u.ui[3]);
+}
+
+static INLINE void u_print_ps(const char *name, __m128 r)
+{
+ union { __m128 m; float f[4]; } u;
+ u.m = r;
+
+ debug_printf("%s: "
+ "%f/"
+ "%f/"
+ "%f/"
+ "%f\n",
+ name,
+ u.f[0], u.f[1], u.f[2], u.f[3]);
+}
+
+
+#define U_DUMP_EPI32(a) u_print_epi32(#a, a)
+#define U_DUMP_EPI16(a) u_print_epi16(#a, a)
+#define U_DUMP_EPI8(a) u_print_epi8(#a, a)
+#define U_DUMP_PS(a) u_print_ps(#a, a)
+
+
#if defined(PIPE_ARCH_SSSE3)
#else /* !PIPE_ARCH_SSSE3 */
-#include <emmintrin.h>
-
/**
* Describe _mm_shuffle_epi8() with gcc extended inline assembly, for cases
* where -mssse3 is not supported/enabled.
#endif /* !PIPE_ARCH_SSSE3 */
-#endif /* PIPE_ARCH_X86 || PIPE_ARCH_X86_64 */
+
+
+/* Provide an SSE2 implementation of _mm_mullo_epi32() in terms of
+ * _mm_mul_epu32().
+ *
+ * I suspect this works fine for us because one of our operands is
+ * always positive, but not sure that this can be used for general
+ * signed integer multiplication.
+ *
+ * This seems close enough to the speed of SSE4 and the real
+ * _mm_mullo_epi32() intrinsic as to not justify adding an sse4
+ * dependency at this point.
+ */
+static INLINE __m128i mm_mullo_epi32(const __m128i a, const __m128i b)
+{
+ __m128i a4 = _mm_srli_epi64(a, 32); /* shift by one dword */
+ __m128i b4 = _mm_srli_epi64(b, 32); /* shift by one dword */
+ __m128i ba = _mm_mul_epu32(b, a); /* multply dwords 0, 2 */
+ __m128i b4a4 = _mm_mul_epu32(b4, a4); /* multiply dwords 1, 3 */
+
+ /* Interleave the results, either with shuffles or (slightly
+ * faster) direct bit operations:
+ */
+#if 0
+ __m128i ba8 = _mm_shuffle_epi32(ba, 8);
+ __m128i b4a48 = _mm_shuffle_epi32(b4a4, 8);
+ __m128i result = _mm_unpacklo_epi32(ba8, b4a48);
+#else
+ __m128i mask = _mm_setr_epi32(~0,0,~0,0);
+ __m128i ba_mask = _mm_and_si128(ba, mask);
+ __m128i b4a4_mask_shift = _mm_slli_epi64(b4a4, 32);
+ __m128i result = _mm_or_si128(ba_mask, b4a4_mask_shift);
+#endif
+
+ return result;
+}
+
+
+static INLINE void
+transpose4_epi32(const __m128i * restrict a,
+ const __m128i * restrict b,
+ const __m128i * restrict c,
+ const __m128i * restrict d,
+ __m128i * restrict o,
+ __m128i * restrict p,
+ __m128i * restrict q,
+ __m128i * restrict r)
+{
+ __m128i t0 = _mm_unpacklo_epi32(*a, *b);
+ __m128i t1 = _mm_unpacklo_epi32(*c, *d);
+ __m128i t2 = _mm_unpackhi_epi32(*a, *b);
+ __m128i t3 = _mm_unpackhi_epi32(*c, *d);
+
+ *o = _mm_unpacklo_epi64(t0, t1);
+ *p = _mm_unpackhi_epi64(t0, t1);
+ *q = _mm_unpacklo_epi64(t2, t3);
+ *r = _mm_unpackhi_epi64(t2, t3);
+}
+
+#define SCALAR_EPI32(m, i) _mm_shuffle_epi32((m), _MM_SHUFFLE(i,i,i,i))
+
+
+#endif /* PIPE_ARCH_SSE */
#endif /* U_SSE_H_ */
}
}
+/*** PIPE_FORMAT_S8X24_USCALED ***/
+
+/**
+ * Return S component as four uint32_t in [0..255]. Z part ignored.
+ */
+static void
+s8x24_get_tile_rgba(const unsigned *src,
+ unsigned w, unsigned h,
+ float *p,
+ unsigned dst_stride)
+{
+ unsigned i, j;
+
+ for (i = 0; i < h; i++) {
+ float *pRow = p;
+
+ for (j = 0; j < w; j++, pRow += 4) {
+ pRow[0] =
+ pRow[1] =
+ pRow[2] =
+ pRow[3] = (float)((*src++ >> 24) & 0xff);
+ }
+
+ p += dst_stride;
+ }
+}
+
+/*** PIPE_FORMAT_X24S8_USCALED ***/
+
+/**
+ * Return S component as four uint32_t in [0..255]. Z part ignored.
+ */
+static void
+x24s8_get_tile_rgba(const unsigned *src,
+ unsigned w, unsigned h,
+ float *p,
+ unsigned dst_stride)
+{
+ unsigned i, j;
+
+ for (i = 0; i < h; i++) {
+ float *pRow = p;
+ for (j = 0; j < w; j++, pRow += 4) {
+ pRow[0] =
+ pRow[1] =
+ pRow[2] =
+ pRow[3] = (float)(*src++ & 0xff);
+ }
+ p += dst_stride;
+ }
+}
+
+
+/**
+ * Return S component as four uint32_t in [0..255]. Z part ignored.
+ */
+static void
+s8_get_tile_rgba(const unsigned char *src,
+ unsigned w, unsigned h,
+ float *p,
+ unsigned dst_stride)
+{
+ unsigned i, j;
+
+ for (i = 0; i < h; i++) {
+ float *pRow = p;
+ for (j = 0; j < w; j++, pRow += 4) {
+ pRow[0] =
+ pRow[1] =
+ pRow[2] =
+ pRow[3] = (float)(*src++ & 0xff);
+ }
+ p += dst_stride;
+ }
+}
/*** PIPE_FORMAT_Z32_FLOAT ***/
case PIPE_FORMAT_Z24X8_UNORM:
s8z24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
+ case PIPE_FORMAT_S8_USCALED:
+ s8_get_tile_rgba((unsigned char *) src, w, h, dst, dst_stride);
+ break;
+ case PIPE_FORMAT_X24S8_USCALED:
+ s8x24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
+ break;
case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
z24s8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
break;
+ case PIPE_FORMAT_S8X24_USCALED:
+ x24s8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
+ break;
case PIPE_FORMAT_Z32_FLOAT:
z32f_get_tile_rgba((float *) src, w, h, dst, dst_stride);
break;
drawn when the polygon mode converts triangles/quads/polygons into
points or lines.
+TGSI_SEMANTIC_STENCIL
+""""""""""""""""""""""
+
+For fragment shaders, this semantic label indicates than an output
+is a writable stencil reference value. Only the Y component is writable.
+This allows the fragment shader to change the fragments stencilref value.
Properties
| Z | XXX TBD | (z, z, z, 1) | (0, z, 0, 1) |
| | | [#depth-tex-mode]_ | |
+--------------------+--------------+--------------------+--------------+
+| S | (s, s, s, s) | unknown | unknown |
++--------------------+--------------+--------------------+--------------+
.. [#envmap-bumpmap] http://www.opengl.org/registry/specs/ATI/envmap_bumpmap.txt
.. [#depth-tex-mode] the default is (z, z, z, 1) but may also be (0, 0, 0, z)
#include "i915_context.h"
#include "i915_batch.h"
#include "i915_debug.h"
-#include "i915_reg.h"
#include "i915_resource.h"
#include "pipe/p_context.h"
#include <stdint.h>
#include <string.h>
+#include "util/u_memory.h"
#include "util/u_string.h"
#include "intel_decode.h"
};
- for (opcode = 0; opcode < sizeof(opcodes_mi) / sizeof(opcodes_mi[0]);
- opcode++) {
+ for (opcode = 0; opcode < Elements(opcodes_mi); opcode++) {
if ((data[0] & 0x1f800000) >> 23 == opcodes_mi[opcode].opcode) {
unsigned int len = 1, i;
return len;
}
- for (opcode = 0; opcode < sizeof(opcodes_2d) / sizeof(opcodes_2d[0]);
- opcode++) {
+ for (opcode = 0; opcode < Elements(opcodes_2d); opcode++) {
if ((data[0] & 0x1fc00000) >> 22 == opcodes_2d[opcode].opcode) {
unsigned int i;
return len;
}
- for (opcode = 0; opcode < sizeof(opcodes_3d_1d) / sizeof(opcodes_3d_1d[0]);
- opcode++)
- {
+ for (opcode = 0; opcode < Elements(opcodes_3d_1d); opcode++) {
if (opcodes_3d_1d[opcode].i830_only && !i830)
continue;
return decode_3d_1c(data, count, hw_offset, failures);
}
- for (opcode = 0; opcode < sizeof(opcodes_3d) / sizeof(opcodes_3d[0]);
- opcode++) {
+ for (opcode = 0; opcode < Elements(opcodes_3d); opcode++) {
if ((data[0] & 0x1f000000) >> 24 == opcodes_3d[opcode].opcode) {
unsigned int len = 1, i;
return len;
}
- for (opcode = 0; opcode < sizeof(opcodes_3d) / sizeof(opcodes_3d[0]);
- opcode++) {
+ for (opcode = 0; opcode < Elements(opcodes_3d); opcode++) {
if ((data[0] & 0xffff0000) >> 16 == opcodes_3d[opcode].opcode) {
unsigned int i;
len = 1;
return decode_3d_1c(data, count, hw_offset, failures);
}
- for (opcode = 0; opcode < sizeof(opcodes_3d) / sizeof(opcodes_3d[0]);
- opcode++) {
+ for (opcode = 0; opcode < Elements(opcodes_3d); opcode++) {
if ((data[0] & 0x1f000000) >> 24 == opcodes_3d[opcode].opcode) {
unsigned int len = 1, i;
lp_scene_queue.c \
lp_screen.c \
lp_setup.c \
- lp_setup_coef.c \
- lp_setup_coef_intrin.c \
lp_setup_line.c \
lp_setup_point.c \
lp_setup_tri.c \
lp_state_clip.c \
lp_state_derived.c \
lp_state_fs.c \
+ lp_state_setup.c \
lp_state_gs.c \
lp_state_rasterizer.c \
lp_state_sampler.c \
# Need this for the lp_test_*.o files
CLEAN_EXTRA = *.o
+include ../../Makefile.template
+
lp_test_sincos.o : sse_mathfun.h
PROGS_DEPS := ../../auxiliary/libgallium.a
-include ../../Makefile.template
-
lp_tile_soa.c: lp_tile_soa.py ../../auxiliary/util/u_format_parse.py ../../auxiliary/util/u_format_pack.py ../../auxiliary/util/u_format.csv
python lp_tile_soa.py ../../auxiliary/util/u_format.csv > $@
])
-# Only enable SSSE3 for lp_tile_soa_sse3.c
-ssse3_env = env.Clone()
-if env['gcc'] \
- and distutils.version.LooseVersion(env['CCVERSION']) >= distutils.version.LooseVersion('4.3') \
- and env['machine'] in ('x86', 'x86_64') :
- ssse3_env.Append(CCFLAGS = ['-mssse3'])
-lp_tile_soa_os = ssse3_env.SharedObject('lp_tile_soa.c')
+lp_tile_soa_os = env.SharedObject('lp_tile_soa.c')
llvmpipe = env.ConvenienceLibrary(
'lp_setup_line.c',
'lp_setup_point.c',
'lp_setup_tri.c',
- 'lp_setup_coef.c',
- 'lp_setup_coef_intrin.c',
'lp_setup_vbuf.c',
'lp_state_blend.c',
'lp_state_clip.c',
'lp_state_derived.c',
'lp_state_fs.c',
+ 'lp_state_setup.c',
'lp_state_gs.c',
'lp_state_rasterizer.c',
'lp_state_sampler.c',
struct lp_type type,
struct lp_build_mask_context *mask,
LLVMValueRef alpha,
- LLVMValueRef ref)
+ LLVMValueRef ref,
+ boolean do_branch)
{
struct lp_build_context bld;
LLVMValueRef test;
lp_build_name(test, "alpha_mask");
lp_build_mask_update(mask, test);
+
+ if (do_branch)
+ lp_build_mask_check(mask);
}
struct lp_type type,
struct lp_build_mask_context *mask,
LLVMValueRef alpha,
- LLVMValueRef ref);
+ LLVMValueRef ref,
+ boolean do_branch);
#endif /* !LP_BLD_ALPHA_H */
/**************************************************************************
*
- * Copyright 2009 VMware, Inc.
+ * Copyright 2009-2010 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* ... ... ... ... ... ... ... ... ...
*
*
- * Stencil test:
- * Two-sided stencil test is supported but probably not as efficient as
- * it could be. Currently, we use if/then/else constructs to do the
- * operations for front vs. back-facing polygons. We could probably do
- * both the front and back arithmetic then use a Select() instruction to
- * choose the result depending on polyon orientation. We'd have to
- * measure performance both ways and see which is better.
- *
* @author Jose Fonseca <jfonseca@vmware.com>
+ * @author Brian Paul <jfonseca@vmware.com>
*/
#include "pipe/p_state.h"
#include "gallivm/lp_bld_arit.h"
#include "gallivm/lp_bld_bitarit.h"
#include "gallivm/lp_bld_const.h"
+#include "gallivm/lp_bld_conv.h"
#include "gallivm/lp_bld_logic.h"
#include "gallivm/lp_bld_flow.h"
#include "gallivm/lp_bld_intr.h"
/**
* Do the one or two-sided stencil test comparison.
* \sa lp_build_stencil_test_single
- * \param face an integer indicating front (+) or back (-) facing polygon.
- * If NULL, assume front-facing.
+ * \param front_facing an integer vector mask, indicating front (~0) or back
+ * (0) facing polygon. If NULL, assume front-facing.
*/
static LLVMValueRef
lp_build_stencil_test(struct lp_build_context *bld,
const struct pipe_stencil_state stencil[2],
LLVMValueRef stencilRefs[2],
LLVMValueRef stencilVals,
- LLVMValueRef face)
+ LLVMValueRef front_facing)
{
LLVMValueRef res;
assert(stencil[0].enabled);
- if (stencil[1].enabled && face) {
- /* do two-sided test */
- struct lp_build_flow_context *flow_ctx;
- struct lp_build_if_state if_ctx;
- LLVMValueRef front_facing;
- LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0);
- LLVMValueRef result = bld->undef;
-
- flow_ctx = lp_build_flow_create(bld->builder);
- lp_build_flow_scope_begin(flow_ctx);
+ /* do front face test */
+ res = lp_build_stencil_test_single(bld, &stencil[0],
+ stencilRefs[0], stencilVals);
- lp_build_flow_scope_declare(flow_ctx, &result);
+ if (stencil[1].enabled && front_facing) {
+ /* do back face test */
+ LLVMValueRef back_res;
- /* front_facing = face > 0.0 */
- front_facing = LLVMBuildFCmp(bld->builder, LLVMRealUGT, face, zero, "");
-
- lp_build_if(&if_ctx, flow_ctx, bld->builder, front_facing);
- {
- result = lp_build_stencil_test_single(bld, &stencil[0],
- stencilRefs[0], stencilVals);
- }
- lp_build_else(&if_ctx);
- {
- result = lp_build_stencil_test_single(bld, &stencil[1],
- stencilRefs[1], stencilVals);
- }
- lp_build_endif(&if_ctx);
+ back_res = lp_build_stencil_test_single(bld, &stencil[1],
+ stencilRefs[1], stencilVals);
- lp_build_flow_scope_end(flow_ctx);
- lp_build_flow_destroy(flow_ctx);
-
- res = result;
- }
- else {
- /* do single-side test */
- res = lp_build_stencil_test_single(bld, &stencil[0],
- stencilRefs[0], stencilVals);
+ res = lp_build_select(bld, front_facing, res, back_res);
}
return res;
const struct pipe_stencil_state *stencil,
enum stencil_op op,
LLVMValueRef stencilRef,
- LLVMValueRef stencilVals,
- LLVMValueRef mask)
+ LLVMValueRef stencilVals)
{
- const unsigned stencilMax = 255; /* XXX fix */
struct lp_type type = bld->type;
LLVMValueRef res;
- LLVMValueRef max = lp_build_const_int_vec(type, stencilMax);
+ LLVMValueRef max = lp_build_const_int_vec(type, 0xff);
unsigned stencil_op;
assert(type.sign);
break;
default:
assert(0 && "bad stencil op mode");
- res = NULL;
- }
-
- if (stencil->writemask != stencilMax) {
- /* mask &= stencil->writemask */
- LLVMValueRef writemask = lp_build_const_int_vec(type, stencil->writemask);
- mask = LLVMBuildAnd(bld->builder, mask, writemask, "");
- /* res = (res & mask) | (stencilVals & ~mask) */
- res = lp_build_select_bitwise(bld, writemask, res, stencilVals);
- }
- else {
- /* res = mask ? res : stencilVals */
- res = lp_build_select(bld, mask, res, stencilVals);
+ res = bld->undef;
}
return res;
LLVMValueRef stencilRefs[2],
LLVMValueRef stencilVals,
LLVMValueRef mask,
- LLVMValueRef face)
+ LLVMValueRef front_facing)
{
- assert(stencil[0].enabled);
-
- if (stencil[1].enabled && face) {
- /* do two-sided op */
- struct lp_build_flow_context *flow_ctx;
- struct lp_build_if_state if_ctx;
- LLVMValueRef front_facing;
- LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0);
- LLVMValueRef result = bld->undef;
+ LLVMValueRef res;
- flow_ctx = lp_build_flow_create(bld->builder);
- lp_build_flow_scope_begin(flow_ctx);
+ assert(stencil[0].enabled);
- lp_build_flow_scope_declare(flow_ctx, &result);
+ /* do front face op */
+ res = lp_build_stencil_op_single(bld, &stencil[0], op,
+ stencilRefs[0], stencilVals);
- /* front_facing = face > 0.0 */
- front_facing = LLVMBuildFCmp(bld->builder, LLVMRealUGT, face, zero, "");
+ if (stencil[1].enabled && front_facing) {
+ /* do back face op */
+ LLVMValueRef back_res;
- lp_build_if(&if_ctx, flow_ctx, bld->builder, front_facing);
- {
- result = lp_build_stencil_op_single(bld, &stencil[0], op,
- stencilRefs[0], stencilVals, mask);
- }
- lp_build_else(&if_ctx);
- {
- result = lp_build_stencil_op_single(bld, &stencil[1], op,
- stencilRefs[1], stencilVals, mask);
- }
- lp_build_endif(&if_ctx);
+ back_res = lp_build_stencil_op_single(bld, &stencil[1], op,
+ stencilRefs[1], stencilVals);
- lp_build_flow_scope_end(flow_ctx);
- lp_build_flow_destroy(flow_ctx);
+ res = lp_build_select(bld, front_facing, res, back_res);
+ }
- return result;
+ if (stencil->writemask != 0xff) {
+ /* mask &= stencil->writemask */
+ LLVMValueRef writemask = lp_build_const_int_vec(bld->type, stencil->writemask);
+ mask = LLVMBuildAnd(bld->builder, mask, writemask, "");
+ /* res = (res & mask) | (stencilVals & ~mask) */
+ res = lp_build_select_bitwise(bld, writemask, res, stencilVals);
}
else {
- /* do single-sided op */
- return lp_build_stencil_op_single(bld, &stencil[0], op,
- stencilRefs[0], stencilVals, mask);
+ /* res = mask ? res : stencilVals */
+ res = lp_build_select(bld, mask, res, stencilVals);
}
+
+ return res;
}
}
else if(format_desc->channel[swizzle].type == UTIL_FORMAT_TYPE_UNSIGNED) {
assert(format_desc->block.bits <= 32);
- if(format_desc->channel[swizzle].normalized)
- type.norm = TRUE;
+ assert(format_desc->channel[swizzle].normalized);
+ if (format_desc->channel[swizzle].size < format_desc->block.bits) {
+ /* Prefer signed integers when possible, as SSE has less support
+ * for unsigned comparison;
+ */
+ type.sign = TRUE;
+ }
}
else
assert(0);
*/
static boolean
get_z_shift_and_mask(const struct util_format_description *format_desc,
- unsigned *shift, unsigned *mask)
+ unsigned *shift, unsigned *width, unsigned *mask)
{
const unsigned total_bits = format_desc->block.bits;
unsigned z_swizzle;
if (z_swizzle == UTIL_FORMAT_SWIZZLE_NONE)
return FALSE;
+ *width = format_desc->channel[z_swizzle].size;
+
padding_right = 0;
for (chan = 0; chan < z_swizzle; ++chan)
padding_right += format_desc->channel[chan].size;
padding_left =
- total_bits - (padding_right + format_desc->channel[z_swizzle].size);
+ total_bits - (padding_right + *width);
if (padding_left || padding_right) {
unsigned long long mask_left = (1ULL << (total_bits - padding_left)) - 1;
*mask = 0xffffffff;
}
- *shift = padding_left;
+ *shift = padding_right;
return TRUE;
}
* \param maskvalue is the depth test mask.
* \param counter is a pointer of the uint32 counter.
*/
-static void
+void
lp_build_occlusion_count(LLVMBuilderRef builder,
struct lp_type type,
LLVMValueRef maskvalue,
* \param format_desc description of the depth/stencil surface
* \param mask the alive/dead pixel mask for the quad (vector)
* \param stencil_refs the front/back stencil ref values (scalar)
- * \param z_src the incoming depth/stencil values (a 2x2 quad)
+ * \param z_src the incoming depth/stencil values (a 2x2 quad, float32)
* \param zs_dst_ptr pointer to depth/stencil values in framebuffer
- * \param facing contains float value indicating front/back facing polygon
+ * \param facing contains boolean value indicating front/back facing polygon
*/
void
lp_build_depth_stencil_test(LLVMBuilderRef builder,
const struct pipe_depth_state *depth,
const struct pipe_stencil_state stencil[2],
- struct lp_type type,
+ struct lp_type z_src_type,
const struct util_format_description *format_desc,
struct lp_build_mask_context *mask,
LLVMValueRef stencil_refs[2],
LLVMValueRef z_src,
LLVMValueRef zs_dst_ptr,
LLVMValueRef face,
- LLVMValueRef counter)
+ LLVMValueRef *zs_value,
+ boolean do_branch)
{
- struct lp_build_context bld;
- struct lp_build_context sbld;
+ struct lp_type z_type;
+ struct lp_build_context z_bld;
+ struct lp_build_context s_bld;
struct lp_type s_type;
+ unsigned z_shift = 0, z_width = 0, z_mask = 0;
LLVMValueRef zs_dst, z_dst = NULL;
LLVMValueRef stencil_vals = NULL;
LLVMValueRef z_bitmask = NULL, stencil_shift = NULL;
LLVMValueRef z_pass = NULL, s_pass_mask = NULL;
- LLVMValueRef orig_mask = mask->value;
+ LLVMValueRef orig_mask = lp_build_mask_value(mask);
+ LLVMValueRef front_facing = NULL;
+
+
+ /*
+ * Depths are expected to be between 0 and 1, even if they are stored in
+ * floats. Setting these bits here will ensure that the lp_build_conv() call
+ * below won't try to unnecessarily clamp the incoming values.
+ */
+ if(z_src_type.floating) {
+ z_src_type.sign = FALSE;
+ z_src_type.norm = TRUE;
+ }
+ else {
+ assert(!z_src_type.sign);
+ assert(z_src_type.norm);
+ }
+
+ /* Pick the depth type. */
+ z_type = lp_depth_type(format_desc, z_src_type.width*z_src_type.length);
+
+ /* FIXME: Cope with a depth test type with a different bit width. */
+ assert(z_type.width == z_src_type.width);
+ assert(z_type.length == z_src_type.length);
/* Sanity checking */
{
}
assert(z_swizzle < 4);
- assert(format_desc->block.bits == type.width);
- if (type.floating) {
+ assert(format_desc->block.bits == z_type.width);
+ if (z_type.floating) {
assert(z_swizzle == 0);
assert(format_desc->channel[z_swizzle].type ==
UTIL_FORMAT_TYPE_FLOAT);
assert(format_desc->channel[z_swizzle].type ==
UTIL_FORMAT_TYPE_UNSIGNED);
assert(format_desc->channel[z_swizzle].normalized);
- assert(!type.fixed);
- assert(!type.sign);
- assert(type.norm);
+ assert(!z_type.fixed);
}
}
/* Setup build context for Z vals */
- lp_build_context_init(&bld, builder, type);
+ lp_build_context_init(&z_bld, builder, z_type);
/* Setup build context for stencil vals */
- s_type = lp_type_int_vec(type.width);
- lp_build_context_init(&sbld, builder, s_type);
+ s_type = lp_type_int_vec(z_type.width);
+ lp_build_context_init(&s_bld, builder, s_type);
/* Load current z/stencil value from z/stencil buffer */
+ zs_dst_ptr = LLVMBuildBitCast(builder,
+ zs_dst_ptr,
+ LLVMPointerType(z_bld.vec_type, 0), "");
zs_dst = LLVMBuildLoad(builder, zs_dst_ptr, "");
- lp_build_name(zs_dst, "zsbufval");
+ lp_build_name(zs_dst, "zs_dst");
/* Compute and apply the Z/stencil bitmasks and shifts.
*/
{
- unsigned z_shift, z_mask;
unsigned s_shift, s_mask;
- if (get_z_shift_and_mask(format_desc, &z_shift, &z_mask)) {
- if (z_shift) {
- LLVMValueRef shift = lp_build_const_int_vec(type, z_shift);
- z_src = LLVMBuildLShr(builder, z_src, shift, "");
- }
-
+ if (get_z_shift_and_mask(format_desc, &z_shift, &z_width, &z_mask)) {
if (z_mask != 0xffffffff) {
- LLVMValueRef mask = lp_build_const_int_vec(type, z_mask);
- z_src = LLVMBuildAnd(builder, z_src, mask, "");
- z_dst = LLVMBuildAnd(builder, zs_dst, mask, "");
- z_bitmask = mask; /* used below */
+ z_bitmask = lp_build_const_int_vec(z_type, z_mask);
}
- else {
+
+ /*
+ * Align the framebuffer Z 's LSB to the right.
+ */
+ if (z_shift) {
+ LLVMValueRef shift = lp_build_const_int_vec(z_type, z_shift);
+ z_dst = LLVMBuildLShr(builder, zs_dst, shift, "z_dst");
+ } else if (z_bitmask) {
+ /* TODO: Instead of loading a mask from memory and ANDing, it's
+ * probably faster to just shake the bits with two shifts. */
+ z_dst = LLVMBuildAnd(builder, zs_dst, z_bitmask, "z_dst");
+ } else {
z_dst = zs_dst;
+ lp_build_name(z_dst, "z_dst");
}
-
- lp_build_name(z_dst, "zsbuf.z");
}
if (get_s_shift_and_mask(format_desc, &s_shift, &s_mask)) {
if (s_shift) {
- LLVMValueRef shift = lp_build_const_int_vec(type, s_shift);
+ LLVMValueRef shift = lp_build_const_int_vec(s_type, s_shift);
stencil_vals = LLVMBuildLShr(builder, zs_dst, shift, "");
stencil_shift = shift; /* used below */
}
}
if (s_mask != 0xffffffff) {
- LLVMValueRef mask = lp_build_const_int_vec(type, s_mask);
+ LLVMValueRef mask = lp_build_const_int_vec(s_type, s_mask);
stencil_vals = LLVMBuildAnd(builder, stencil_vals, mask, "");
}
- lp_build_name(stencil_vals, "stencil");
+ lp_build_name(stencil_vals, "s_dst");
}
}
-
if (stencil[0].enabled) {
+
+ if (face) {
+ LLVMValueRef zero = LLVMConstInt(LLVMInt32Type(), 0, 0);
+
+ /* front_facing = face != 0 ? ~0 : 0 */
+ front_facing = LLVMBuildICmp(builder, LLVMIntNE, face, zero, "");
+ front_facing = LLVMBuildSExt(builder, front_facing,
+ LLVMIntType(s_bld.type.length*s_bld.type.width),
+ "");
+ front_facing = LLVMBuildBitCast(builder, front_facing,
+ s_bld.int_vec_type, "");
+ }
+
/* convert scalar stencil refs into vectors */
- stencil_refs[0] = lp_build_broadcast_scalar(&bld, stencil_refs[0]);
- stencil_refs[1] = lp_build_broadcast_scalar(&bld, stencil_refs[1]);
+ stencil_refs[0] = lp_build_broadcast_scalar(&s_bld, stencil_refs[0]);
+ stencil_refs[1] = lp_build_broadcast_scalar(&s_bld, stencil_refs[1]);
- s_pass_mask = lp_build_stencil_test(&sbld, stencil,
- stencil_refs, stencil_vals, face);
+ s_pass_mask = lp_build_stencil_test(&s_bld, stencil,
+ stencil_refs, stencil_vals,
+ front_facing);
/* apply stencil-fail operator */
{
- LLVMValueRef s_fail_mask = lp_build_andnot(&bld, orig_mask, s_pass_mask);
- stencil_vals = lp_build_stencil_op(&sbld, stencil, S_FAIL_OP,
+ LLVMValueRef s_fail_mask = lp_build_andnot(&s_bld, orig_mask, s_pass_mask);
+ stencil_vals = lp_build_stencil_op(&s_bld, stencil, S_FAIL_OP,
stencil_refs, stencil_vals,
- s_fail_mask, face);
+ s_fail_mask, front_facing);
}
}
if (depth->enabled) {
+ /*
+ * Convert fragment Z to the desired type, aligning the LSB to the right.
+ */
+
+ assert(z_type.width == z_src_type.width);
+ assert(z_type.length == z_src_type.length);
+ assert(lp_check_value(z_src_type, z_src));
+ if (z_src_type.floating) {
+ /*
+ * Convert from floating point values
+ */
+
+ if (!z_type.floating) {
+ z_src = lp_build_clamped_float_to_unsigned_norm(builder,
+ z_src_type,
+ z_width,
+ z_src);
+ }
+ } else {
+ /*
+ * Convert from unsigned normalized values.
+ */
+
+ assert(!z_src_type.sign);
+ assert(!z_src_type.fixed);
+ assert(z_src_type.norm);
+ assert(!z_type.floating);
+ if (z_src_type.width > z_width) {
+ LLVMValueRef shift = lp_build_const_int_vec(z_src_type,
+ z_src_type.width - z_width);
+ z_src = LLVMBuildLShr(builder, z_src, shift, "");
+ }
+ }
+ assert(lp_check_value(z_type, z_src));
+
+ lp_build_name(z_src, "z_src");
+
/* compare src Z to dst Z, returning 'pass' mask */
- z_pass = lp_build_cmp(&bld, depth->func, z_src, z_dst);
+ z_pass = lp_build_cmp(&z_bld, depth->func, z_src, z_dst);
if (!stencil[0].enabled) {
/* We can potentially skip all remaining operations here, but only
* buffer values. Don't need to update Z buffer values.
*/
lp_build_mask_update(mask, z_pass);
+
+ if (do_branch) {
+ lp_build_mask_check(mask);
+ do_branch = FALSE;
+ }
}
if (depth->writemask) {
- LLVMValueRef zselectmask = mask->value;
+ LLVMValueRef zselectmask;
/* mask off bits that failed Z test */
- zselectmask = LLVMBuildAnd(builder, zselectmask, z_pass, "");
+ zselectmask = LLVMBuildAnd(builder, orig_mask, z_pass, "");
/* mask off bits that failed stencil test */
if (s_pass_mask) {
zselectmask = LLVMBuildAnd(builder, zselectmask, s_pass_mask, "");
}
- /* if combined Z/stencil format, mask off the stencil bits */
- if (z_bitmask) {
- zselectmask = LLVMBuildAnd(builder, zselectmask, z_bitmask, "");
- }
-
/* Mix the old and new Z buffer values.
- * z_dst[i] = (zselectmask[i] & z_src[i]) | (~zselectmask[i] & z_dst[i])
+ * z_dst[i] = zselectmask[i] ? z_src[i] : z_dst[i]
*/
- z_dst = lp_build_select_bitwise(&bld, zselectmask, z_src, z_dst);
+ z_dst = lp_build_select(&z_bld, zselectmask, z_src, z_dst);
}
if (stencil[0].enabled) {
LLVMValueRef z_fail_mask, z_pass_mask;
/* apply Z-fail operator */
- z_fail_mask = lp_build_andnot(&bld, orig_mask, z_pass);
- stencil_vals = lp_build_stencil_op(&sbld, stencil, Z_FAIL_OP,
+ z_fail_mask = lp_build_andnot(&z_bld, orig_mask, z_pass);
+ stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_FAIL_OP,
stencil_refs, stencil_vals,
- z_fail_mask, face);
+ z_fail_mask, front_facing);
/* apply Z-pass operator */
- z_pass_mask = LLVMBuildAnd(bld.builder, orig_mask, z_pass, "");
- stencil_vals = lp_build_stencil_op(&sbld, stencil, Z_PASS_OP,
+ z_pass_mask = LLVMBuildAnd(z_bld.builder, orig_mask, z_pass, "");
+ stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_PASS_OP,
stencil_refs, stencil_vals,
- z_pass_mask, face);
+ z_pass_mask, front_facing);
}
}
else {
/* No depth test: apply Z-pass operator to stencil buffer values which
* passed the stencil test.
*/
- s_pass_mask = LLVMBuildAnd(bld.builder, orig_mask, s_pass_mask, "");
- stencil_vals = lp_build_stencil_op(&sbld, stencil, Z_PASS_OP,
+ s_pass_mask = LLVMBuildAnd(s_bld.builder, orig_mask, s_pass_mask, "");
+ stencil_vals = lp_build_stencil_op(&s_bld, stencil, Z_PASS_OP,
stencil_refs, stencil_vals,
- s_pass_mask, face);
+ s_pass_mask, front_facing);
}
- /* The Z bits are already in the right place but we may need to shift the
- * stencil bits before ORing Z with Stencil to make the final pixel value.
- */
+ /* Put Z and ztencil bits in the right place */
+ if (z_dst && z_shift) {
+ LLVMValueRef shift = lp_build_const_int_vec(z_type, z_shift);
+ z_dst = LLVMBuildShl(builder, z_dst, shift, "");
+ }
if (stencil_vals && stencil_shift)
- stencil_vals = LLVMBuildShl(bld.builder, stencil_vals,
+ stencil_vals = LLVMBuildShl(s_bld.builder, stencil_vals,
stencil_shift, "");
/* Finally, merge/store the z/stencil values */
(stencil[0].enabled && stencil[0].writemask)) {
if (z_dst && stencil_vals)
- zs_dst = LLVMBuildOr(bld.builder, z_dst, stencil_vals, "");
+ zs_dst = LLVMBuildOr(z_bld.builder, z_dst, stencil_vals, "");
else if (z_dst)
zs_dst = z_dst;
else
zs_dst = stencil_vals;
- LLVMBuildStore(builder, zs_dst, zs_dst_ptr);
+ *zs_value = zs_dst;
}
if (s_pass_mask)
if (depth->enabled && stencil[0].enabled)
lp_build_mask_update(mask, z_pass);
- if (counter)
- lp_build_occlusion_count(builder, type, mask->value, counter);
+ if (do_branch)
+ lp_build_mask_check(mask);
+
+}
+
+
+void
+lp_build_depth_write(LLVMBuilderRef builder,
+ const struct util_format_description *format_desc,
+ LLVMValueRef zs_dst_ptr,
+ LLVMValueRef zs_value)
+{
+ zs_dst_ptr = LLVMBuildBitCast(builder, zs_dst_ptr,
+ LLVMPointerType(LLVMTypeOf(zs_value), 0), "");
+
+ LLVMBuildStore(builder, zs_value, zs_dst_ptr);
+}
+
+
+void
+lp_build_deferred_depth_write(LLVMBuilderRef builder,
+ struct lp_type z_src_type,
+ const struct util_format_description *format_desc,
+ struct lp_build_mask_context *mask,
+ LLVMValueRef zs_dst_ptr,
+ LLVMValueRef zs_value)
+{
+ struct lp_type z_type;
+ struct lp_build_context z_bld;
+ LLVMValueRef z_dst;
+
+ /* XXX: pointlessly redo type logic:
+ */
+ z_type = lp_depth_type(format_desc, z_src_type.width*z_src_type.length);
+ lp_build_context_init(&z_bld, builder, z_type);
+
+ zs_dst_ptr = LLVMBuildBitCast(builder, zs_dst_ptr,
+ LLVMPointerType(z_bld.vec_type, 0), "");
+
+ z_dst = LLVMBuildLoad(builder, zs_dst_ptr, "zsbufval");
+ z_dst = lp_build_select(&z_bld, lp_build_mask_value(mask), zs_value, z_dst);
+
+ LLVMBuildStore(builder, z_dst, zs_dst_ptr);
}
LLVMValueRef zs_src,
LLVMValueRef zs_dst_ptr,
LLVMValueRef facing,
- LLVMValueRef counter);
+ LLVMValueRef *zs_value,
+ boolean do_branch);
+void
+lp_build_depth_write(LLVMBuilderRef builder,
+ const struct util_format_description *format_desc,
+ LLVMValueRef zs_dst_ptr,
+ LLVMValueRef zs_value);
+
+void
+lp_build_deferred_depth_write(LLVMBuilderRef builder,
+ struct lp_type z_src_type,
+ const struct util_format_description *format_desc,
+ struct lp_build_mask_context *mask,
+ LLVMValueRef zs_dst_ptr,
+ LLVMValueRef zs_value);
+
+void
+lp_build_occlusion_count(LLVMBuilderRef builder,
+ struct lp_type type,
+ LLVMValueRef maskvalue,
+ LLVMValueRef counter);
#endif /* !LP_BLD_DEPTH_H */
dadq2 = LLVMBuildFAdd(builder, dadq, dadq, "");
/*
- * a = a0 + x * dadx + y * dady
+ * a = a0 + (x * dadx + y * dady)
*/
if (attrib == 0 && chan == 0) {
a = a0;
if (interp != LP_INTERP_CONSTANT &&
interp != LP_INTERP_FACING) {
- LLVMValueRef tmp;
- tmp = LLVMBuildFMul(builder, bld->x, dadx, "");
- a = LLVMBuildFAdd(builder, a, tmp, "");
- tmp = LLVMBuildFMul(builder, bld->y, dady, "");
- a = LLVMBuildFAdd(builder, a, tmp, "");
+ LLVMValueRef ax, ay, axy;
+ ax = LLVMBuildFMul(builder, bld->x, dadx, "");
+ ay = LLVMBuildFMul(builder, bld->y, dady, "");
+ axy = LLVMBuildFAdd(builder, ax, ay, "");
+ a = LLVMBuildFAdd(builder, a, axy, "");
}
}
* This is called when we move from one quad to the next.
*/
static void
-attribs_update(struct lp_build_interp_soa_context *bld, int quad_index)
+attribs_update(struct lp_build_interp_soa_context *bld,
+ int quad_index,
+ int start,
+ int end)
{
struct lp_build_context *coeff_bld = &bld->coeff_bld;
LLVMValueRef shuffle = lp_build_const_int_vec(coeff_bld->type, quad_index);
assert(quad_index < 4);
- for(attrib = 0; attrib < bld->num_attribs; ++attrib) {
+ for(attrib = start; attrib < end; ++attrib) {
const unsigned mask = bld->mask[attrib];
const unsigned interp = bld->interp[attrib];
for(chan = 0; chan < NUM_CHANNELS; ++chan) {
}
#endif
+ if (attrib == 0 && chan == 2) {
+ /* FIXME: Depth values can exceed 1.0, due to the fact that
+ * setup interpolation coefficients refer to (0,0) which causes
+ * precision loss. So we must clamp to 1.0 here to avoid artifacts
+ */
+ a = lp_build_min(coeff_bld, a, coeff_bld->one);
+ }
+
attrib_name(a, attrib, chan, "");
}
bld->attribs[attrib][chan] = a;
pos_init(bld, x0, y0);
coeffs_init(bld, a0_ptr, dadx_ptr, dady_ptr);
-
- attribs_update(bld, 0);
}
* Advance the position and inputs to the given quad within the block.
*/
void
-lp_build_interp_soa_update(struct lp_build_interp_soa_context *bld,
- int quad_index)
+lp_build_interp_soa_update_inputs(struct lp_build_interp_soa_context *bld,
+ int quad_index)
+{
+ assert(quad_index < 4);
+
+ attribs_update(bld, quad_index, 1, bld->num_attribs);
+}
+
+void
+lp_build_interp_soa_update_pos(struct lp_build_interp_soa_context *bld,
+ int quad_index)
{
assert(quad_index < 4);
- attribs_update(bld, quad_index);
+ attribs_update(bld, quad_index, 0, 1);
}
+
#include "tgsi/tgsi_exec.h"
-#include "lp_setup.h"
+/**
+ * Describes how to compute the interpolation coefficients (a0, dadx, dady)
+ * from the vertices passed into our triangle/line/point functions by the
+ * draw module.
+ *
+ * Vertices are treated as an array of float[4] values, indexed by
+ * src_index.
+ *
+ * LP_INTERP_COLOR is translated to either LP_INTERP_CONSTANT or
+ * LINEAR depending on flatshade state.
+ */
+enum lp_interp {
+ LP_INTERP_CONSTANT,
+ LP_INTERP_COLOR,
+ LP_INTERP_LINEAR,
+ LP_INTERP_PERSPECTIVE,
+ LP_INTERP_POSITION,
+ LP_INTERP_FACING
+};
+
+struct lp_shader_input {
+ ushort interp:4; /* enum lp_interp */
+ ushort usage_mask:4; /* bitmask of TGSI_WRITEMASK_x flags */
+ ushort src_index:8; /* where to find values in incoming vertices */
+};
struct lp_build_interp_soa_context
LLVMValueRef y);
void
-lp_build_interp_soa_update(struct lp_build_interp_soa_context *bld,
+lp_build_interp_soa_update_inputs(struct lp_build_interp_soa_context *bld,
+ int quad_index);
+
+void
+lp_build_interp_soa_update_pos(struct lp_build_interp_soa_context *bld,
int quad_index);
}
}
+ lp_delete_setup_variants(llvmpipe);
+
align_free( llvmpipe );
}
memset(llvmpipe, 0, sizeof *llvmpipe);
make_empty_list(&llvmpipe->fs_variants_list);
+ make_empty_list(&llvmpipe->setup_variants_list);
llvmpipe->pipe.winsys = screen->winsys;
llvmpipe->pipe.screen = screen;
#include "lp_jit.h"
#include "lp_setup.h"
#include "lp_state_fs.h"
+#include "lp_state_setup.h"
struct llvmpipe_vbuf_render;
struct lp_vertex_shader;
struct lp_blend_state;
struct lp_setup_context;
+struct lp_setup_variant;
struct lp_velems_state;
struct llvmpipe_context {
/** Which vertex shader output slot contains point size */
int psize_slot;
- /** Fragment shader input interpolation info */
- unsigned num_inputs;
- struct lp_shader_input inputs[PIPE_MAX_SHADER_INPUTS];
-
/** The tiling engine */
struct lp_setup_context *setup;
+ struct lp_setup_variant setup_variant;
/** The primitive drawing context */
struct draw_context *draw;
struct lp_fs_variant_list_item fs_variants_list;
unsigned nr_fs_variants;
+
+ struct lp_setup_variant_list_item setup_variants_list;
+ unsigned nr_setup_variants;
};
struct pipe_context;
struct pipe_fence_handle;
+struct pipe_resource;
void
llvmpipe_flush(struct pipe_context *pipe,
void
lp_jit_screen_cleanup(struct llvmpipe_screen *screen)
{
- if(screen->engine)
- LLVMDisposeExecutionEngine(screen->engine);
-
if(screen->pass)
LLVMDisposePassManager(screen->pass);
}
(*lp_jit_frag_func)(const struct lp_jit_context *context,
uint32_t x,
uint32_t y,
- float facing,
+ uint32_t facing,
const void *a0,
const void *dadx,
const void *dady,
*/
#define LP_MAX_SHADER_VARIANTS 1024
+/**
+ * Max number of setup variants that will be kept around.
+ *
+ * These are determined by the combination of the fragment shader
+ * input signature and a small amount of rasterization state (eg
+ * flatshading). It is likely that many active fragment shaders will
+ * share the same setup variant.
+ */
+#define LP_MAX_SETUP_VARIANTS 64
+
#endif /* LP_LIMITS_H */
const union lp_rast_cmd_arg arg)
{
const struct lp_scene *scene = task->scene;
- unsigned clear_value = arg.clear_zstencil.value;
- unsigned clear_mask = arg.clear_zstencil.mask;
+ uint32_t clear_value = arg.clear_zstencil.value;
+ uint32_t clear_mask = arg.clear_zstencil.mask;
const unsigned height = TILE_SIZE / TILE_VECTOR_HEIGHT;
const unsigned width = TILE_SIZE * TILE_VECTOR_HEIGHT;
const unsigned block_size = scene->zsbuf.blocksize;
uint8_t *dst;
unsigned i, j;
- LP_DBG(DEBUG_RAST, "%s 0x%x%x\n", __FUNCTION__, clear_value, clear_mask);
+ LP_DBG(DEBUG_RAST, "%s: value=0x%08x, mask=0x%08x\n",
+ __FUNCTION__, clear_value, clear_mask);
/*
* Clear the aera of the swizzled depth/depth buffer matching this tile, in
dst = task->depth_tile;
+ clear_value &= clear_mask;
+
switch (block_size) {
case 1:
+ assert(clear_mask == 0xff);
memset(dst, (uint8_t) clear_value, height * width);
break;
case 2:
- for (i = 0; i < height; i++) {
- uint16_t *row = (uint16_t *)dst;
- for (j = 0; j < width; j++)
- *row++ = (uint16_t) clear_value;
- dst += dst_stride;
+ if (clear_mask == 0xffff) {
+ for (i = 0; i < height; i++) {
+ uint16_t *row = (uint16_t *)dst;
+ for (j = 0; j < width; j++)
+ *row++ = (uint16_t) clear_value;
+ dst += dst_stride;
+ }
+ }
+ else {
+ for (i = 0; i < height; i++) {
+ uint16_t *row = (uint16_t *)dst;
+ for (j = 0; j < width; j++) {
+ uint16_t tmp = ~clear_mask & *row;
+ *row++ = clear_value | tmp;
+ }
+ dst += dst_stride;
+ }
}
break;
case 4:
uint32_t *row = (uint32_t *)dst;
for (j = 0; j < width; j++) {
uint32_t tmp = ~clear_mask & *row;
- *row++ = (clear_value & clear_mask) | tmp;
+ *row++ = clear_value | tmp;
}
dst += dst_stride;
}
{
const struct lp_scene *scene = task->scene;
const struct lp_rast_shader_inputs *inputs = arg.shade_tile;
- const struct lp_rast_state *state = inputs->state;
+ const struct lp_rast_state *state = task->state;
struct lp_fragment_shader_variant *variant = state->variant;
const unsigned tile_x = task->x, tile_y = task->y;
unsigned x, y;
BEGIN_JIT_CALL(state);
variant->jit_function[RAST_WHOLE]( &state->jit_context,
tile_x + x, tile_y + y,
- inputs->facing,
- inputs->a0,
- inputs->dadx,
- inputs->dady,
+ inputs->frontfacing,
+ GET_A0(inputs),
+ GET_DADX(inputs),
+ GET_DADY(inputs),
color,
depth,
0xffff,
unsigned x, unsigned y,
unsigned mask)
{
- const struct lp_rast_state *state = inputs->state;
+ const struct lp_rast_state *state = task->state;
struct lp_fragment_shader_variant *variant = state->variant;
const struct lp_scene *scene = task->scene;
uint8_t *color[PIPE_MAX_COLOR_BUFS];
BEGIN_JIT_CALL(state);
variant->jit_function[RAST_EDGE_TEST](&state->jit_context,
x, y,
- inputs->facing,
- inputs->a0,
- inputs->dadx,
- inputs->dady,
+ inputs->frontfacing,
+ GET_A0(inputs),
+ GET_DADX(inputs),
+ GET_DADY(inputs),
color,
depth,
mask,
}
+void
+lp_rast_set_state(struct lp_rasterizer_task *task,
+ const union lp_rast_cmd_arg arg)
+{
+ task->state = arg.state;
+}
+
+
/**
* Set top row and left column of the tile's pixels to white. For debugging.
lp_rast_triangle_8,
lp_rast_triangle_3_4,
lp_rast_triangle_3_16,
+ lp_rast_triangle_4_16,
lp_rast_shade_tile,
lp_rast_shade_tile_opaque,
lp_rast_begin_query,
lp_rast_end_query,
+ lp_rast_set_state,
};
* These pointers point into the bin data buffer.
*/
struct lp_rast_shader_inputs {
- float facing; /** Positive for front-facing, negative for back-facing */
- unsigned disable:1; /** Partially binned, disable this command */
- unsigned opaque:1; /** Is opaque */
-
- float (*a0)[4];
- float (*dadx)[4];
- float (*dady)[4];
-
- const struct lp_rast_state *state;
+ unsigned frontfacing:1; /** True for front-facing */
+ unsigned disable:1; /** Partially binned, disable this command */
+ unsigned opaque:1; /** Is opaque */
+ unsigned pad0:29; /* wasted space */
+ unsigned stride; /* how much to advance data between a0, dadx, dady */
+ unsigned pad2; /* wasted space */
+ unsigned pad3; /* wasted space */
+ /* followed by a0, dadx, dady and planes[] */
};
-
+/* Note: the order of these values is important as they are loaded by
+ * sse code in rasterization:
+ */
struct lp_rast_plane {
- /* one-pixel sized trivial accept offsets for each plane */
- int ei;
-
- /* one-pixel sized trivial reject offsets for each plane */
- int eo;
-
/* edge function values at minx,miny ?? */
int c;
int dcdx;
int dcdy;
+
+ /* one-pixel sized trivial reject offsets for each plane */
+ int eo;
};
/**
* Objects of this type are put into the lp_setup_context::data buffer.
*/
struct lp_rast_triangle {
- /* inputs for the shader */
- struct lp_rast_shader_inputs inputs;
-
#ifdef DEBUG
float v[3][2];
+ float pad0;
+ float pad1;
#endif
- struct lp_rast_plane plane[8]; /* NOTE: may allocate fewer planes */
+ /* inputs for the shader */
+ struct lp_rast_shader_inputs inputs;
+ /* planes are also allocated here */
};
+#define GET_A0(inputs) ((float (*)[4])((inputs)+1))
+#define GET_DADX(inputs) ((float (*)[4])((char *)((inputs) + 1) + (inputs)->stride))
+#define GET_DADY(inputs) ((float (*)[4])((char *)((inputs) + 1) + 2 * (inputs)->stride))
+#define GET_PLANES(tri) ((struct lp_rast_plane *)((char *)(&(tri)->inputs + 1) + 3 * (tri)->inputs.stride))
+
+
struct lp_rasterizer *
lp_rast_create( unsigned num_threads );
const struct lp_rast_state *set_state;
uint8_t clear_color[4];
struct {
- unsigned value;
- unsigned mask;
+ uint32_t value;
+ uint32_t mask;
} clear_zstencil;
+ const struct lp_rast_state *state;
struct lp_fence *fence;
struct llvmpipe_query *query_obj;
};
#define LP_RAST_OP_TRIANGLE_8 0x9
#define LP_RAST_OP_TRIANGLE_3_4 0xa
#define LP_RAST_OP_TRIANGLE_3_16 0xb
-#define LP_RAST_OP_SHADE_TILE 0xc
-#define LP_RAST_OP_SHADE_TILE_OPAQUE 0xd
-#define LP_RAST_OP_BEGIN_QUERY 0xe
-#define LP_RAST_OP_END_QUERY 0xf
-
-#define LP_RAST_OP_MAX 0x10
+#define LP_RAST_OP_TRIANGLE_4_16 0xc
+#define LP_RAST_OP_SHADE_TILE 0xd
+#define LP_RAST_OP_SHADE_TILE_OPAQUE 0xe
+#define LP_RAST_OP_BEGIN_QUERY 0xf
+#define LP_RAST_OP_END_QUERY 0x10
+#define LP_RAST_OP_SET_STATE 0x11
+
+#define LP_RAST_OP_MAX 0x12
#define LP_RAST_OP_MASK 0xff
void
struct tile {
int coverage;
int overdraw;
+ const struct lp_rast_state *state;
char data[TILE_SIZE][TILE_SIZE];
};
"triangle_8",
"triangle_3_4",
"triangle_3_16",
+ "triangle_4_16",
"shade_tile",
"shade_tile_opaque",
"begin_query",
"end_query",
+ "set_state",
};
static const char *cmd_name(unsigned cmd)
}
static const struct lp_fragment_shader_variant *
-get_variant( const struct cmd_block *block,
- int k )
+get_variant( const struct lp_rast_state *state,
+ const struct cmd_block *block,
+ int k )
{
if (block->cmd[k] == LP_RAST_OP_SHADE_TILE ||
- block->cmd[k] == LP_RAST_OP_SHADE_TILE_OPAQUE)
- return block->arg[k].shade_tile->state->variant;
-
- if (block->cmd[k] == LP_RAST_OP_TRIANGLE_1 ||
+ block->cmd[k] == LP_RAST_OP_SHADE_TILE_OPAQUE ||
+ block->cmd[k] == LP_RAST_OP_TRIANGLE_1 ||
block->cmd[k] == LP_RAST_OP_TRIANGLE_2 ||
block->cmd[k] == LP_RAST_OP_TRIANGLE_3 ||
block->cmd[k] == LP_RAST_OP_TRIANGLE_4 ||
block->cmd[k] == LP_RAST_OP_TRIANGLE_5 ||
block->cmd[k] == LP_RAST_OP_TRIANGLE_6 ||
block->cmd[k] == LP_RAST_OP_TRIANGLE_7)
- return block->arg[k].triangle.tri->inputs.state->variant;
+ return state->variant;
return NULL;
}
static boolean
-is_blend( const struct cmd_block *block,
+is_blend( const struct lp_rast_state *state,
+ const struct cmd_block *block,
int k )
{
- const struct lp_fragment_shader_variant *variant = get_variant(block, k);
+ const struct lp_fragment_shader_variant *variant = get_variant(state, block, k);
if (variant)
return variant->key.blend.rt[0].blend_enable;
static void
debug_bin( const struct cmd_bin *bin )
{
+ const struct lp_rast_state *state = NULL;
const struct cmd_block *head = bin->head;
int i, j = 0;
while (head) {
for (i = 0; i < head->count; i++, j++) {
+ if (head->cmd[i] == LP_RAST_OP_SET_STATE)
+ state = head->arg[i].state;
+
debug_printf("%d: %s %s\n", j,
cmd_name(head->cmd[i]),
- is_blend(head, i) ? "blended" : "");
+ is_blend(state, head, i) ? "blended" : "");
}
head = head->next;
}
char val)
{
const struct lp_rast_shader_inputs *inputs = arg.shade_tile;
- boolean blend = inputs->state->variant->key.blend.rt[0].blend_enable;
+ boolean blend = tile->state->variant->key.blend.rt[0].blend_enable;
unsigned i,j;
if (inputs->disable)
{
const struct lp_rast_triangle *tri = arg.triangle.tri;
unsigned plane_mask = arg.triangle.plane_mask;
+ const struct lp_rast_plane *tri_plane = GET_PLANES(tri);
struct lp_rast_plane plane[8];
int x, y;
int count = 0;
unsigned i, nr_planes = 0;
- boolean blend = tri->inputs.state->variant->key.blend.rt[0].blend_enable;
+ boolean blend = tile->state->variant->key.blend.rt[0].blend_enable;
if (tri->inputs.disable) {
/* This triangle was partially binned and has been disabled */
}
while (plane_mask) {
- plane[nr_planes] = tri->plane[u_bit_scan(&plane_mask)];
+ plane[nr_planes] = tri_plane[u_bit_scan(&plane_mask)];
plane[nr_planes].c = (plane[nr_planes].c +
plane[nr_planes].dcdy * tiley -
plane[nr_planes].dcdx * tilex);
memset(tile->data, ' ', sizeof tile->data);
tile->coverage = 0;
tile->overdraw = 0;
+ tile->state = NULL;
for (block = bin->head; block; block = block->next) {
for (k = 0; k < block->count; k++, j++) {
- boolean blend = is_blend(block, k);
+ boolean blend = is_blend(tile->state, block, k);
char val = get_label(j);
int count = 0;
if (print_cmds)
debug_printf("%c: %15s", val, cmd_name(block->cmd[k]));
+
+ if (block->cmd[k] == LP_RAST_OP_SET_STATE)
+ tile->state = block->arg[k].state;
if (block->cmd[k] == LP_RAST_OP_CLEAR_COLOR ||
block->cmd[k] == LP_RAST_OP_CLEAR_ZSTENCIL)
struct lp_rasterizer_task
{
const struct cmd_bin *bin;
+ const struct lp_rast_state *state;
struct lp_scene *scene;
unsigned x, y; /**< Pos of this tile in framebuffer, in pixels */
unsigned x, unsigned y )
{
const struct lp_scene *scene = task->scene;
- const struct lp_rast_state *state = inputs->state;
+ const struct lp_rast_state *state = task->state;
struct lp_fragment_shader_variant *variant = state->variant;
uint8_t *color[PIPE_MAX_COLOR_BUFS];
void *depth;
BEGIN_JIT_CALL(state);
variant->jit_function[RAST_WHOLE]( &state->jit_context,
x, y,
- inputs->facing,
- inputs->a0,
- inputs->dadx,
- inputs->dady,
+ inputs->frontfacing,
+ GET_A0(inputs),
+ GET_DADX(inputs),
+ GET_DADY(inputs),
color,
depth,
0xffff,
void lp_rast_triangle_3_16( struct lp_rasterizer_task *,
const union lp_rast_cmd_arg );
+
+void lp_rast_triangle_4_16( struct lp_rasterizer_task *,
+ const union lp_rast_cmd_arg );
+
+void
+lp_rast_set_state(struct lp_rasterizer_task *task,
+ const union lp_rast_cmd_arg arg);
+
void
lp_debug_bin( const struct cmd_bin *bin );
lp_rast_triangle_3(task, arg2);
}
+void
+lp_rast_triangle_4_16(struct lp_rasterizer_task *task,
+ const union lp_rast_cmd_arg arg)
+{
+ union lp_rast_cmd_arg arg2;
+ arg2.triangle.tri = arg.triangle.tri;
+ arg2.triangle.plane_mask = (1<<4)-1;
+ lp_rast_triangle_3(task, arg2);
+}
+
void
lp_rast_triangle_3_4(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
}
-/* Special case for 3 plane triangle which is contained entirely
- * within a 16x16 block.
- */
+#define NR_PLANES 3
+
+
+
+
+
+
+
void
lp_rast_triangle_3_16(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
{
const struct lp_rast_triangle *tri = arg.triangle.tri;
- const struct lp_rast_plane *plane = tri->plane;
- unsigned mask = arg.triangle.plane_mask;
- const int x = task->x + (mask & 0xff);
- const int y = task->y + (mask >> 8);
- unsigned outmask, inmask, partmask, partial_mask;
- unsigned j;
- __m128i cstep4[3][4];
-
- outmask = 0; /* outside one or more trivial reject planes */
- partmask = 0; /* outside one or more trivial accept planes */
-
- for (j = 0; j < 3; j++) {
- const int dcdx = -plane[j].dcdx * 4;
- const int dcdy = plane[j].dcdy * 4;
- __m128i xdcdy = _mm_set1_epi32(dcdy);
-
- cstep4[j][0] = _mm_setr_epi32(0, dcdx, dcdx*2, dcdx*3);
- cstep4[j][1] = _mm_add_epi32(cstep4[j][0], xdcdy);
- cstep4[j][2] = _mm_add_epi32(cstep4[j][1], xdcdy);
- cstep4[j][3] = _mm_add_epi32(cstep4[j][2], xdcdy);
-
- {
- const int c = plane[j].c + plane[j].dcdy * y - plane[j].dcdx * x;
- const int cox = plane[j].eo * 4;
- const int cio = plane[j].ei * 4 - 1;
-
- outmask |= sign_bits4(cstep4[j], c + cox);
- partmask |= sign_bits4(cstep4[j], c + cio);
- }
- }
+ const struct lp_rast_plane *plane = GET_PLANES(tri);
+ int x = (arg.triangle.plane_mask & 0xff) + task->x;
+ int y = (arg.triangle.plane_mask >> 8) + task->y;
+ unsigned i, j;
+
+ struct { unsigned mask:16; unsigned i:8; unsigned j:8; } out[16];
+ unsigned nr = 0;
+
+ __m128i p0 = _mm_load_si128((__m128i *)&plane[0]); /* c, dcdx, dcdy, eo */
+ __m128i p1 = _mm_load_si128((__m128i *)&plane[1]); /* c, dcdx, dcdy, eo */
+ __m128i p2 = _mm_load_si128((__m128i *)&plane[2]); /* c, dcdx, dcdy, eo */
+ __m128i zero = _mm_setzero_si128();
+
+ __m128i c;
+ __m128i dcdx;
+ __m128i dcdy;
+ __m128i rej4;
+
+ __m128i dcdx2;
+ __m128i dcdx3;
+
+ __m128i span_0; /* 0,dcdx,2dcdx,3dcdx for plane 0 */
+ __m128i span_1; /* 0,dcdx,2dcdx,3dcdx for plane 1 */
+ __m128i span_2; /* 0,dcdx,2dcdx,3dcdx for plane 2 */
+ __m128i unused;
+
+ transpose4_epi32(&p0, &p1, &p2, &zero,
+ &c, &dcdx, &dcdy, &rej4);
+
+ /* Adjust dcdx;
+ */
+ dcdx = _mm_sub_epi32(zero, dcdx);
- if (outmask == 0xffff)
- return;
+ c = _mm_add_epi32(c, mm_mullo_epi32(dcdx, _mm_set1_epi32(x)));
+ c = _mm_add_epi32(c, mm_mullo_epi32(dcdy, _mm_set1_epi32(y)));
+ rej4 = _mm_slli_epi32(rej4, 2);
- /* Mask of sub-blocks which are inside all trivial accept planes:
- */
- inmask = ~partmask & 0xffff;
+ dcdx2 = _mm_add_epi32(dcdx, dcdx);
+ dcdx3 = _mm_add_epi32(dcdx2, dcdx);
- /* Mask of sub-blocks which are inside all trivial reject planes,
- * but outside at least one trivial accept plane:
- */
- partial_mask = partmask & ~outmask;
+ transpose4_epi32(&zero, &dcdx, &dcdx2, &dcdx3,
+ &span_0, &span_1, &span_2, &unused);
- assert((partial_mask & inmask) == 0);
+ for (i = 0; i < 4; i++) {
+ __m128i cx = c;
- /* Iterate over partials:
- */
- while (partial_mask) {
- int i = ffs(partial_mask) - 1;
- int ix = (i & 3) * 4;
- int iy = (i >> 2) * 4;
- int px = x + ix;
- int py = y + iy;
- unsigned mask = 0xffff;
-
- partial_mask &= ~(1 << i);
-
- for (j = 0; j < 3; j++) {
- const int cx = (plane[j].c
- - plane[j].dcdx * px
- + plane[j].dcdy * py) * 4;
-
- mask &= ~sign_bits4(cstep4[j], cx);
- }
+ for (j = 0; j < 4; j++) {
+ __m128i c4rej = _mm_add_epi32(cx, rej4);
+ __m128i rej_masks = _mm_srai_epi32(c4rej, 31);
- if (mask)
- lp_rast_shade_quads_mask(task, &tri->inputs, px, py, mask);
- }
+ /* if (is_zero(rej_masks)) */
+ if (_mm_movemask_epi8(rej_masks) == 0) {
+ __m128i c0_0 = _mm_add_epi32(SCALAR_EPI32(cx, 0), span_0);
+ __m128i c1_0 = _mm_add_epi32(SCALAR_EPI32(cx, 1), span_1);
+ __m128i c2_0 = _mm_add_epi32(SCALAR_EPI32(cx, 2), span_2);
- /* Iterate over fulls:
- */
- while (inmask) {
- int i = ffs(inmask) - 1;
- int ix = (i & 3) * 4;
- int iy = (i >> 2) * 4;
- int px = x + ix;
- int py = y + iy;
+ __m128i c_0 = _mm_or_si128(_mm_or_si128(c0_0, c1_0), c2_0);
+
+ __m128i c0_1 = _mm_add_epi32(c0_0, SCALAR_EPI32(dcdy, 0));
+ __m128i c1_1 = _mm_add_epi32(c1_0, SCALAR_EPI32(dcdy, 1));
+ __m128i c2_1 = _mm_add_epi32(c2_0, SCALAR_EPI32(dcdy, 2));
+
+ __m128i c_1 = _mm_or_si128(_mm_or_si128(c0_1, c1_1), c2_1);
+ __m128i c_01 = _mm_packs_epi32(c_0, c_1);
+
+ __m128i c0_2 = _mm_add_epi32(c0_1, SCALAR_EPI32(dcdy, 0));
+ __m128i c1_2 = _mm_add_epi32(c1_1, SCALAR_EPI32(dcdy, 1));
+ __m128i c2_2 = _mm_add_epi32(c2_1, SCALAR_EPI32(dcdy, 2));
+
+ __m128i c_2 = _mm_or_si128(_mm_or_si128(c0_2, c1_2), c2_2);
- inmask &= ~(1 << i);
+ __m128i c0_3 = _mm_add_epi32(c0_2, SCALAR_EPI32(dcdy, 0));
+ __m128i c1_3 = _mm_add_epi32(c1_2, SCALAR_EPI32(dcdy, 1));
+ __m128i c2_3 = _mm_add_epi32(c2_2, SCALAR_EPI32(dcdy, 2));
- block_full_4(task, tri, px, py);
+ __m128i c_3 = _mm_or_si128(_mm_or_si128(c0_3, c1_3), c2_3);
+ __m128i c_23 = _mm_packs_epi32(c_2, c_3);
+ __m128i c_0123 = _mm_packs_epi16(c_01, c_23);
+
+ unsigned mask = _mm_movemask_epi8(c_0123);
+
+ out[nr].i = i;
+ out[nr].j = j;
+ out[nr].mask = mask;
+ if (mask != 0xffff)
+ nr++;
+ }
+ cx = _mm_add_epi32(cx, _mm_slli_epi32(dcdx, 2));
+ }
+
+ c = _mm_add_epi32(c, _mm_slli_epi32(dcdy, 2));
}
+
+ for (i = 0; i < nr; i++)
+ lp_rast_shade_quads_mask(task,
+ &tri->inputs,
+ x + 4 * out[i].j,
+ y + 4 * out[i].i,
+ 0xffff & ~out[i].mask);
}
+
+
+
void
lp_rast_triangle_3_4(struct lp_rasterizer_task *task,
- const union lp_rast_cmd_arg arg)
+ const union lp_rast_cmd_arg arg)
{
const struct lp_rast_triangle *tri = arg.triangle.tri;
- const struct lp_rast_plane *plane = tri->plane;
- unsigned mask = arg.triangle.plane_mask;
- const int x = task->x + (mask & 0xff);
- const int y = task->y + (mask >> 8);
- unsigned j;
-
- /* Iterate over partials:
+ const struct lp_rast_plane *plane = GET_PLANES(tri);
+ int x = (arg.triangle.plane_mask & 0xff) + task->x;
+ int y = (arg.triangle.plane_mask >> 8) + task->y;
+
+ __m128i p0 = _mm_load_si128((__m128i *)&plane[0]); /* c, dcdx, dcdy, eo */
+ __m128i p1 = _mm_load_si128((__m128i *)&plane[1]); /* c, dcdx, dcdy, eo */
+ __m128i p2 = _mm_load_si128((__m128i *)&plane[2]); /* c, dcdx, dcdy, eo */
+ __m128i zero = _mm_setzero_si128();
+
+ __m128i c;
+ __m128i dcdx;
+ __m128i dcdy;
+
+ __m128i dcdx2;
+ __m128i dcdx3;
+
+ __m128i span_0; /* 0,dcdx,2dcdx,3dcdx for plane 0 */
+ __m128i span_1; /* 0,dcdx,2dcdx,3dcdx for plane 1 */
+ __m128i span_2; /* 0,dcdx,2dcdx,3dcdx for plane 2 */
+ __m128i unused;
+
+ transpose4_epi32(&p0, &p1, &p2, &zero,
+ &c, &dcdx, &dcdy, &unused);
+
+ /* Adjust dcdx;
*/
+ dcdx = _mm_sub_epi32(zero, dcdx);
+
+ c = _mm_add_epi32(c, mm_mullo_epi32(dcdx, _mm_set1_epi32(x)));
+ c = _mm_add_epi32(c, mm_mullo_epi32(dcdy, _mm_set1_epi32(y)));
+
+ dcdx2 = _mm_add_epi32(dcdx, dcdx);
+ dcdx3 = _mm_add_epi32(dcdx2, dcdx);
+
+ transpose4_epi32(&zero, &dcdx, &dcdx2, &dcdx3,
+ &span_0, &span_1, &span_2, &unused);
+
+
{
- unsigned mask = 0xffff;
+ __m128i c0_0 = _mm_add_epi32(SCALAR_EPI32(c, 0), span_0);
+ __m128i c1_0 = _mm_add_epi32(SCALAR_EPI32(c, 1), span_1);
+ __m128i c2_0 = _mm_add_epi32(SCALAR_EPI32(c, 2), span_2);
+
+ __m128i c_0 = _mm_or_si128(_mm_or_si128(c0_0, c1_0), c2_0);
- for (j = 0; j < 3; j++) {
- const int cx = (plane[j].c
- - plane[j].dcdx * x
- + plane[j].dcdy * y);
+ __m128i c0_1 = _mm_add_epi32(c0_0, SCALAR_EPI32(dcdy, 0));
+ __m128i c1_1 = _mm_add_epi32(c1_0, SCALAR_EPI32(dcdy, 1));
+ __m128i c2_1 = _mm_add_epi32(c2_0, SCALAR_EPI32(dcdy, 2));
- const int dcdx = -plane[j].dcdx;
- const int dcdy = plane[j].dcdy;
- __m128i xdcdy = _mm_set1_epi32(dcdy);
+ __m128i c_1 = _mm_or_si128(_mm_or_si128(c0_1, c1_1), c2_1);
+ __m128i c_01 = _mm_packs_epi32(c_0, c_1);
- __m128i cstep0 = _mm_setr_epi32(cx, cx + dcdx, cx + dcdx*2, cx + dcdx*3);
- __m128i cstep1 = _mm_add_epi32(cstep0, xdcdy);
- __m128i cstep2 = _mm_add_epi32(cstep1, xdcdy);
- __m128i cstep3 = _mm_add_epi32(cstep2, xdcdy);
+ __m128i c0_2 = _mm_add_epi32(c0_1, SCALAR_EPI32(dcdy, 0));
+ __m128i c1_2 = _mm_add_epi32(c1_1, SCALAR_EPI32(dcdy, 1));
+ __m128i c2_2 = _mm_add_epi32(c2_1, SCALAR_EPI32(dcdy, 2));
- __m128i cstep01 = _mm_packs_epi32(cstep0, cstep1);
- __m128i cstep23 = _mm_packs_epi32(cstep2, cstep3);
- __m128i result = _mm_packs_epi16(cstep01, cstep23);
+ __m128i c_2 = _mm_or_si128(_mm_or_si128(c0_2, c1_2), c2_2);
- /* Extract the sign bits
- */
- mask &= ~_mm_movemask_epi8(result);
- }
+ __m128i c0_3 = _mm_add_epi32(c0_2, SCALAR_EPI32(dcdy, 0));
+ __m128i c1_3 = _mm_add_epi32(c1_2, SCALAR_EPI32(dcdy, 1));
+ __m128i c2_3 = _mm_add_epi32(c2_2, SCALAR_EPI32(dcdy, 2));
- if (mask)
- lp_rast_shade_quads_mask(task, &tri->inputs, x, y, mask);
+ __m128i c_3 = _mm_or_si128(_mm_or_si128(c0_3, c1_3), c2_3);
+ __m128i c_23 = _mm_packs_epi32(c_2, c_3);
+ __m128i c_0123 = _mm_packs_epi16(c_01, c_23);
+
+ unsigned mask = _mm_movemask_epi8(c_0123);
+
+ if (mask != 0xffff)
+ lp_rast_shade_quads_mask(task,
+ &tri->inputs,
+ x,
+ y,
+ 0xffff & ~mask);
}
}
-
+#undef NR_PLANES
#endif
#define TAG(x) x##_3
#define NR_PLANES 3
+/*#define TRI_4 lp_rast_triangle_3_4*/
+/*#define TRI_16 lp_rast_triangle_3_16*/
#include "lp_rast_tri_tmp.h"
#define TAG(x) x##_4
#define NR_PLANES 4
+#define TRI_16 lp_rast_triangle_4_16
#include "lp_rast_tri_tmp.h"
#define TAG(x) x##_5
const int dcdx = -plane[j].dcdx * 4;
const int dcdy = plane[j].dcdy * 4;
const int cox = plane[j].eo * 4;
- const int cio = plane[j].ei * 4 - 1;
+ const int ei = plane[j].dcdy - plane[j].dcdx - plane[j].eo;
+ const int cio = ei * 4 - 1;
build_masks(c[j] + cox,
cio - cox,
{
const struct lp_rast_triangle *tri = arg.triangle.tri;
unsigned plane_mask = arg.triangle.plane_mask;
+ const struct lp_rast_plane *tri_plane = GET_PLANES(tri);
const int x = task->x, y = task->y;
struct lp_rast_plane plane[NR_PLANES];
int c[NR_PLANES];
while (plane_mask) {
int i = ffs(plane_mask) - 1;
- plane[j] = tri->plane[i];
+ plane[j] = tri_plane[i];
plane_mask &= ~(1 << i);
c[j] = plane[j].c + plane[j].dcdy * y - plane[j].dcdx * x;
const int dcdx = -plane[j].dcdx * 16;
const int dcdy = plane[j].dcdy * 16;
const int cox = plane[j].eo * 16;
- const int cio = plane[j].ei * 16 - 1;
+ const int ei = plane[j].dcdy - plane[j].dcdx - plane[j].eo;
+ const int cio = ei * 16 - 1;
build_masks(c[j] + cox,
cio - cox,
}
}
+#if defined(PIPE_ARCH_SSE) && defined(TRI_16)
+/* XXX: special case this when intersection is not required.
+ * - tile completely within bbox,
+ * - bbox completely within tile.
+ */
+void
+TRI_16(struct lp_rasterizer_task *task,
+ const union lp_rast_cmd_arg arg)
+{
+ const struct lp_rast_triangle *tri = arg.triangle.tri;
+ const struct lp_rast_plane *plane = GET_PLANES(tri);
+ unsigned mask = arg.triangle.plane_mask;
+ unsigned outmask, partial_mask;
+ unsigned j;
+ __m128i cstep4[NR_PLANES][4];
+
+ int x = (mask & 0xff);
+ int y = (mask >> 8);
+
+ outmask = 0; /* outside one or more trivial reject planes */
+
+ x += task->x;
+ y += task->y;
+
+ for (j = 0; j < NR_PLANES; j++) {
+ const int dcdx = -plane[j].dcdx * 4;
+ const int dcdy = plane[j].dcdy * 4;
+ __m128i xdcdy = _mm_set1_epi32(dcdy);
+
+ cstep4[j][0] = _mm_setr_epi32(0, dcdx, dcdx*2, dcdx*3);
+ cstep4[j][1] = _mm_add_epi32(cstep4[j][0], xdcdy);
+ cstep4[j][2] = _mm_add_epi32(cstep4[j][1], xdcdy);
+ cstep4[j][3] = _mm_add_epi32(cstep4[j][2], xdcdy);
+
+ {
+ const int c = plane[j].c + plane[j].dcdy * y - plane[j].dcdx * x;
+ const int cox = plane[j].eo * 4;
+
+ outmask |= sign_bits4(cstep4[j], c + cox);
+ }
+ }
+
+ if (outmask == 0xffff)
+ return;
+
+
+ /* Mask of sub-blocks which are inside all trivial reject planes,
+ * but outside at least one trivial accept plane:
+ */
+ partial_mask = 0xffff & ~outmask;
+
+ /* Iterate over partials:
+ */
+ while (partial_mask) {
+ int i = ffs(partial_mask) - 1;
+ int ix = (i & 3) * 4;
+ int iy = (i >> 2) * 4;
+ int px = x + ix;
+ int py = y + iy;
+ unsigned mask = 0xffff;
+
+ partial_mask &= ~(1 << i);
+
+ for (j = 0; j < NR_PLANES; j++) {
+ const int cx = (plane[j].c - 1
+ - plane[j].dcdx * px
+ + plane[j].dcdy * py) * 4;
+
+ mask &= ~sign_bits4(cstep4[j], cx);
+ }
+
+ if (mask)
+ lp_rast_shade_quads_mask(task, &tri->inputs, px, py, mask);
+ }
+}
+#endif
+
+#if defined(PIPE_ARCH_SSE) && defined(TRI_4)
+void
+TRI_4(struct lp_rasterizer_task *task,
+ const union lp_rast_cmd_arg arg)
+{
+ const struct lp_rast_triangle *tri = arg.triangle.tri;
+ const struct lp_rast_plane *plane = GET_PLANES(tri);
+ unsigned mask = arg.triangle.plane_mask;
+ const int x = task->x + (mask & 0xff);
+ const int y = task->y + (mask >> 8);
+ unsigned j;
+
+ /* Iterate over partials:
+ */
+ {
+ unsigned mask = 0xffff;
+
+ for (j = 0; j < NR_PLANES; j++) {
+ const int cx = (plane[j].c
+ - plane[j].dcdx * x
+ + plane[j].dcdy * y);
+
+ const int dcdx = -plane[j].dcdx;
+ const int dcdy = plane[j].dcdy;
+ __m128i xdcdy = _mm_set1_epi32(dcdy);
+
+ __m128i cstep0 = _mm_setr_epi32(cx, cx + dcdx, cx + dcdx*2, cx + dcdx*3);
+ __m128i cstep1 = _mm_add_epi32(cstep0, xdcdy);
+ __m128i cstep2 = _mm_add_epi32(cstep1, xdcdy);
+ __m128i cstep3 = _mm_add_epi32(cstep2, xdcdy);
+
+ __m128i cstep01 = _mm_packs_epi32(cstep0, cstep1);
+ __m128i cstep23 = _mm_packs_epi32(cstep2, cstep3);
+ __m128i result = _mm_packs_epi16(cstep01, cstep23);
+
+ /* Extract the sign bits
+ */
+ mask &= ~_mm_movemask_epi8(result);
+ }
+
+ if (mask)
+ lp_rast_shade_quads_mask(task, &tri->inputs, x, y, mask);
+ }
+}
+#endif
+
+
+
#undef TAG
+#undef TRI_4
+#undef TRI_16
#undef NR_PLANES
for (i = 0; i < scene->tiles_x; i++) {
for (j = 0; j < scene->tiles_y; j++) {
struct cmd_bin *bin = lp_scene_get_bin(scene, i, j);
- bin->head = bin->tail = NULL;
+ bin->head = NULL;
+ bin->tail = NULL;
+ bin->last_state = NULL;
}
}
#include "lp_debug.h"
struct lp_scene_queue;
+struct lp_rast_state;
/* We're limited to 2K by 2K for 32bit fixed point rasterization.
* Will need a 64-bit version for larger framebuffers.
struct cmd_bin {
ushort x;
ushort y;
+ const struct lp_rast_state *last_state; /* most recent state set in bin */
struct cmd_block *head;
struct cmd_block *tail;
};
assert(x < scene->tiles_x);
assert(y < scene->tiles_y);
- assert(cmd <= LP_RAST_OP_END_QUERY);
+ assert(cmd < LP_RAST_OP_MAX);
if (tail == NULL || tail->count == CMD_BLOCK_MAX) {
tail = lp_scene_new_cmd_block( scene, bin );
}
+static INLINE boolean
+lp_scene_bin_cmd_with_state( struct lp_scene *scene,
+ unsigned x, unsigned y,
+ const struct lp_rast_state *state,
+ unsigned cmd,
+ union lp_rast_cmd_arg arg )
+{
+ struct cmd_bin *bin = lp_scene_get_bin(scene, x, y);
+
+ if (state != bin->last_state) {
+ bin->last_state = state;
+ if (!lp_scene_bin_command(scene, x, y,
+ LP_RAST_OP_SET_STATE,
+ lp_rast_arg_state(state)))
+ return FALSE;
+ }
+
+ if (!lp_scene_bin_command( scene, x, y, cmd, arg ))
+ return FALSE;
+
+ return TRUE;
+}
+
+
/* Add a command to all active bins.
*/
static INLINE boolean
#include "draw/draw_vbuf.h"
-static void set_scene_state( struct lp_setup_context *, enum setup_state,
+static boolean set_scene_state( struct lp_setup_context *, enum setup_state,
const char *reason);
static boolean try_update_scene_state( struct lp_setup_context *setup );
-static void
+static boolean
begin_binning( struct lp_setup_context *setup )
{
struct lp_scene *scene = setup->scene;
/* Always create a fence:
*/
scene->fence = lp_fence_create(MAX2(1, setup->num_threads));
+ if (!scene->fence)
+ return FALSE;
/* Initialize the bin flags and x/y coords:
*/
}
ok = try_update_scene_state(setup);
- assert(ok);
+ if (!ok)
+ return FALSE;
if (setup->fb.zsbuf &&
((setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL) &&
ok = lp_scene_bin_everywhere( scene,
LP_RAST_OP_CLEAR_COLOR,
setup->clear.color );
- assert(ok);
+ if (!ok)
+ return FALSE;
}
}
if (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) {
if (!need_zsload)
scene->has_depthstencil_clear = TRUE;
+
ok = lp_scene_bin_everywhere( scene,
LP_RAST_OP_CLEAR_ZSTENCIL,
lp_rast_arg_clearzs(
setup->clear.zsvalue,
setup->clear.zsmask));
- assert(ok);
+ if (!ok)
+ return FALSE;
}
}
ok = lp_scene_bin_everywhere( scene,
LP_RAST_OP_BEGIN_QUERY,
lp_rast_arg_query(setup->active_query) );
- assert(ok);
+ if (!ok)
+ return FALSE;
}
-
setup->clear.flags = 0;
setup->clear.zsmask = 0;
setup->clear.zsvalue = 0;
LP_DBG(DEBUG_SETUP, "%s done\n", __FUNCTION__);
+ return TRUE;
}
*
* TODO: fast path for fullscreen clears and no triangles.
*/
-static void
+static boolean
execute_clears( struct lp_setup_context *setup )
{
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
- begin_binning( setup );
+ return begin_binning( setup );
}
const char *states[] = {
};
-static void
+static boolean
set_scene_state( struct lp_setup_context *setup,
enum setup_state new_state,
const char *reason)
unsigned old_state = setup->state;
if (old_state == new_state)
- return;
+ return TRUE;
if (LP_DEBUG & DEBUG_SCENE) {
debug_printf("%s old %s new %s%s%s\n",
break;
case SETUP_ACTIVE:
- begin_binning( setup );
+ if (!begin_binning( setup ))
+ goto fail;
break;
case SETUP_FLUSHED:
if (old_state == SETUP_CLEARED)
- execute_clears( setup );
+ if (!execute_clears( setup ))
+ goto fail;
lp_setup_rasterize_scene( setup );
assert(setup->scene == NULL);
default:
assert(0 && "invalid setup state mode");
+ goto fail;
}
setup->state = new_state;
+ return TRUE;
+
+fail:
+ if (setup->scene) {
+ lp_scene_end_rasterization(setup->scene);
+ setup->scene = NULL;
+ }
+
+ setup->state = SETUP_FLUSHED;
+ lp_setup_reset( setup );
+ return FALSE;
}
}
if (flags & PIPE_CLEAR_DEPTHSTENCIL) {
- unsigned zmask = (flags & PIPE_CLEAR_DEPTH) ? ~0 : 0;
- unsigned smask = (flags & PIPE_CLEAR_STENCIL) ? ~0 : 0;
+ uint32_t zmask = (flags & PIPE_CLEAR_DEPTH) ? ~0 : 0;
+ uint32_t smask = (flags & PIPE_CLEAR_STENCIL) ? ~0 : 0;
zsvalue = util_pack_z_stencil(setup->fb.zsbuf->format,
depth,
stencil);
- zsmask = util_pack_uint_z_stencil(setup->fb.zsbuf->format,
+
+ zsmask = util_pack_mask_z_stencil(setup->fb.zsbuf->format,
zmask,
smask);
+
+ zsvalue &= zsmask;
}
if (setup->state == SETUP_ACTIVE) {
if (flags & PIPE_CLEAR_COLOR) {
memcpy(setup->clear.color.clear_color,
&color_arg,
- sizeof color_arg);
+ sizeof setup->clear.color.clear_color);
}
}
}
void
-lp_setup_set_fs_inputs( struct lp_setup_context *setup,
- const struct lp_shader_input *input,
- unsigned nr )
+lp_setup_set_setup_variant( struct lp_setup_context *setup,
+ const struct lp_setup_variant *variant)
{
- LP_DBG(DEBUG_SETUP, "%s %p %u\n", __FUNCTION__, (void *) input, nr);
-
- memcpy( setup->fs.input, input, nr * sizeof input[0] );
- setup->fs.nr_inputs = nr;
+ LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
+
+ setup->setup.variant = variant;
}
void
void
lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
unsigned num,
- struct pipe_sampler_view **views,
- const struct pipe_sampler_state **samplers)
+ struct pipe_sampler_view **views)
{
unsigned i;
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
struct pipe_sampler_view *view = i < num ? views[i] : NULL;
- if(view) {
+ if (view) {
struct pipe_resource *tex = view->texture;
struct llvmpipe_resource *lp_tex = llvmpipe_resource(tex);
struct lp_jit_texture *jit_tex;
jit_tex->depth = tex->depth0;
jit_tex->last_level = tex->last_level;
- /* sampler state */
- jit_tex->min_lod = samplers[i]->min_lod;
- jit_tex->max_lod = samplers[i]->max_lod;
- jit_tex->lod_bias = samplers[i]->lod_bias;
- COPY_4V(jit_tex->border_color, samplers[i]->border_color);
-
/* We're referencing the texture's internal data, so save a
* reference to it.
*/
}
+/**
+ * Called during state validation when LP_NEW_SAMPLER is set.
+ */
+void
+lp_setup_set_fragment_sampler_state(struct lp_setup_context *setup,
+ unsigned num,
+ const struct pipe_sampler_state **samplers)
+{
+ unsigned i;
+
+ LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
+
+ assert(num <= PIPE_MAX_SAMPLERS);
+
+ for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
+ const struct pipe_sampler_state *sampler = i < num ? samplers[i] : NULL;
+
+ if (sampler) {
+ struct lp_jit_texture *jit_tex;
+ jit_tex = &setup->fs.current.jit_context.textures[i];
+
+ jit_tex->min_lod = sampler->min_lod;
+ jit_tex->max_lod = sampler->max_lod;
+ jit_tex->lod_bias = sampler->lod_bias;
+ COPY_4V(jit_tex->border_color, sampler->border_color);
+ }
+ }
+
+ setup->dirty |= LP_SETUP_NEW_FS;
+}
+
+
/**
* Is the given texture referenced by any scene?
* Note: we have to check all scenes including any scenes currently
return TRUE;
}
-void
+boolean
lp_setup_update_state( struct lp_setup_context *setup,
boolean update_scene )
{
setup->psize = lp->psize_slot;
assert(lp->dirty == 0);
+
+ assert(lp->setup_variant.key.size ==
+ setup->setup.variant->key.size);
+
+ assert(memcmp(&lp->setup_variant.key,
+ &setup->setup.variant->key,
+ setup->setup.variant->key.size) == 0);
}
- if (update_scene)
- set_scene_state( setup, SETUP_ACTIVE, __FUNCTION__ );
+ if (update_scene) {
+ if (!set_scene_state( setup, SETUP_ACTIVE, __FUNCTION__ ))
+ return FALSE;
+ }
/* Only call into update_scene_state() if we already have a
* scene:
*/
if (update_scene && setup->scene) {
assert(setup->state == SETUP_ACTIVE);
- if (!try_update_scene_state(setup)) {
- lp_setup_flush_and_restart(setup);
- if (!try_update_scene_state(setup))
- assert(0);
- }
+
+ if (try_update_scene_state(setup))
+ return TRUE;
+
+ /* Update failed, try to restart the scene.
+ *
+ * Cannot call lp_setup_flush_and_restart() directly here
+ * because of potential recursion.
+ */
+ if (!set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__))
+ return FALSE;
+
+ if (!set_scene_state(setup, SETUP_ACTIVE, __FUNCTION__))
+ return FALSE;
+
+ if (!setup->scene)
+ return FALSE;
+
+ return try_update_scene_state(setup);
}
+
+ return TRUE;
}
LP_RAST_OP_BEGIN_QUERY,
lp_rast_arg_query(pq))) {
- lp_setup_flush_and_restart(setup);
+ if (!lp_setup_flush_and_restart(setup))
+ return;
if (!lp_scene_bin_everywhere(setup->scene,
LP_RAST_OP_BEGIN_QUERY,
lp_rast_arg_query(pq))) {
- assert(0);
return;
}
}
}
-void
+boolean
lp_setup_flush_and_restart(struct lp_setup_context *setup)
{
if (0) debug_printf("%s\n", __FUNCTION__);
assert(setup->state == SETUP_ACTIVE);
- set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__);
- lp_setup_update_state(setup, TRUE);
+
+ if (!set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__))
+ return FALSE;
+
+ if (!lp_setup_update_state(setup, TRUE))
+ return FALSE;
+
+ return TRUE;
}
struct draw_context;
struct vertex_info;
-enum lp_interp {
- LP_INTERP_CONSTANT,
- LP_INTERP_LINEAR,
- LP_INTERP_PERSPECTIVE,
- LP_INTERP_POSITION,
- LP_INTERP_FACING
-};
-
-
-/**
- * Describes how to compute the interpolation coefficients (a0, dadx, dady)
- * from the vertices passed into our triangle/line/point functions by the
- * draw module.
- *
- * Vertices are treated as an array of float[4] values, indexed by
- * src_index.
- */
-struct lp_shader_input {
- enum lp_interp interp; /* how to interpolate values */
- unsigned src_index; /* where to find values in incoming vertices */
- unsigned usage_mask; /* bitmask of TGSI_WRITEMASK_x flags */
-};
struct pipe_resource;
struct pipe_query;
struct lp_jit_context;
struct llvmpipe_query;
struct pipe_fence_handle;
-
+struct lp_setup_variant;
struct lp_setup_context *
lp_setup_create( struct pipe_context *pipe,
uint sprite_coord_origin);
void
-lp_setup_set_fs_inputs( struct lp_setup_context *setup,
- const struct lp_shader_input *interp,
- unsigned nr );
+lp_setup_set_setup_variant( struct lp_setup_context *setup,
+ const struct lp_setup_variant *variant );
void
lp_setup_set_fs_variant( struct lp_setup_context *setup,
void
lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
unsigned num,
- struct pipe_sampler_view **views,
+ struct pipe_sampler_view **views);
+
+void
+lp_setup_set_fragment_sampler_state(struct lp_setup_context *setup,
+ unsigned num,
const struct pipe_sampler_state **samplers);
unsigned
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2010, VMware.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/*
- * Binning code for triangles
- */
-
-#include "util/u_math.h"
-#include "util/u_memory.h"
-#include "lp_perf.h"
-#include "lp_setup_context.h"
-#include "lp_setup_coef.h"
-#include "lp_rast.h"
-#include "lp_state_fs.h"
-
-#if !defined(PIPE_ARCH_SSE)
-
-/**
- * Compute a0 for a constant-valued coefficient (GL_FLAT shading).
- */
-static void constant_coef( struct lp_rast_shader_inputs *inputs,
- unsigned slot,
- const float value,
- unsigned i )
-{
- inputs->a0[slot][i] = value;
- inputs->dadx[slot][i] = 0.0f;
- inputs->dady[slot][i] = 0.0f;
-}
-
-
-
-static void linear_coef( struct lp_rast_shader_inputs *inputs,
- const struct lp_tri_info *info,
- unsigned slot,
- unsigned vert_attr,
- unsigned i)
-{
- float a0 = info->v0[vert_attr][i];
- float a1 = info->v1[vert_attr][i];
- float a2 = info->v2[vert_attr][i];
-
- float da01 = a0 - a1;
- float da20 = a2 - a0;
- float dadx = (da01 * info->dy20_ooa - info->dy01_ooa * da20);
- float dady = (da20 * info->dx01_ooa - info->dx20_ooa * da01);
-
- inputs->dadx[slot][i] = dadx;
- inputs->dady[slot][i] = dady;
-
- /* calculate a0 as the value which would be sampled for the
- * fragment at (0,0), taking into account that we want to sample at
- * pixel centers, in other words (0.5, 0.5).
- *
- * this is neat but unfortunately not a good way to do things for
- * triangles with very large values of dadx or dady as it will
- * result in the subtraction and re-addition from a0 of a very
- * large number, which means we'll end up loosing a lot of the
- * fractional bits and precision from a0. the way to fix this is
- * to define a0 as the sample at a pixel center somewhere near vmin
- * instead - i'll switch to this later.
- */
- inputs->a0[slot][i] = a0 - (dadx * info->x0_center +
- dady * info->y0_center);
-}
-
-
-/**
- * Compute a0, dadx and dady for a perspective-corrected interpolant,
- * for a triangle.
- * We basically multiply the vertex value by 1/w before computing
- * the plane coefficients (a0, dadx, dady).
- * Later, when we compute the value at a particular fragment position we'll
- * divide the interpolated value by the interpolated W at that fragment.
- */
-static void perspective_coef( struct lp_rast_shader_inputs *inputs,
- const struct lp_tri_info *info,
- unsigned slot,
- unsigned vert_attr,
- unsigned i)
-{
- /* premultiply by 1/w (v[0][3] is always 1/w):
- */
- float a0 = info->v0[vert_attr][i] * info->v0[0][3];
- float a1 = info->v1[vert_attr][i] * info->v1[0][3];
- float a2 = info->v2[vert_attr][i] * info->v2[0][3];
- float da01 = a0 - a1;
- float da20 = a2 - a0;
- float dadx = da01 * info->dy20_ooa - info->dy01_ooa * da20;
- float dady = da20 * info->dx01_ooa - info->dx20_ooa * da01;
-
- inputs->dadx[slot][i] = dadx;
- inputs->dady[slot][i] = dady;
- inputs->a0[slot][i] = a0 - (dadx * info->x0_center +
- dady * info->y0_center);
-}
-
-
-/**
- * Special coefficient setup for gl_FragCoord.
- * X and Y are trivial
- * Z and W are copied from position_coef which should have already been computed.
- * We could do a bit less work if we'd examine gl_FragCoord's swizzle mask.
- */
-static void
-setup_fragcoord_coef(struct lp_rast_shader_inputs *inputs,
- const struct lp_tri_info *info,
- unsigned slot,
- unsigned usage_mask)
-{
- /*X*/
- if (usage_mask & TGSI_WRITEMASK_X) {
- inputs->a0[slot][0] = 0.0;
- inputs->dadx[slot][0] = 1.0;
- inputs->dady[slot][0] = 0.0;
- }
-
- /*Y*/
- if (usage_mask & TGSI_WRITEMASK_Y) {
- inputs->a0[slot][1] = 0.0;
- inputs->dadx[slot][1] = 0.0;
- inputs->dady[slot][1] = 1.0;
- }
-
- /*Z*/
- if (usage_mask & TGSI_WRITEMASK_Z) {
- linear_coef(inputs, info, slot, 0, 2);
- }
-
- /*W*/
- if (usage_mask & TGSI_WRITEMASK_W) {
- linear_coef(inputs, info, slot, 0, 3);
- }
-}
-
-
-/**
- * Setup the fragment input attribute with the front-facing value.
- * \param frontface is the triangle front facing?
- */
-static void setup_facing_coef( struct lp_rast_shader_inputs *inputs,
- unsigned slot,
- boolean frontface,
- unsigned usage_mask)
-{
- /* convert TRUE to 1.0 and FALSE to -1.0 */
- if (usage_mask & TGSI_WRITEMASK_X)
- constant_coef( inputs, slot, 2.0f * frontface - 1.0f, 0 );
-
- if (usage_mask & TGSI_WRITEMASK_Y)
- constant_coef( inputs, slot, 0.0f, 1 ); /* wasted */
-
- if (usage_mask & TGSI_WRITEMASK_Z)
- constant_coef( inputs, slot, 0.0f, 2 ); /* wasted */
-
- if (usage_mask & TGSI_WRITEMASK_W)
- constant_coef( inputs, slot, 0.0f, 3 ); /* wasted */
-}
-
-
-/**
- * Compute the tri->coef[] array dadx, dady, a0 values.
- */
-void lp_setup_tri_coef( struct lp_setup_context *setup,
- struct lp_rast_shader_inputs *inputs,
- const float (*v0)[4],
- const float (*v1)[4],
- const float (*v2)[4],
- boolean frontfacing)
-{
- unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ;
- unsigned slot;
- unsigned i;
- struct lp_tri_info info;
- float dx01 = v0[0][0] - v1[0][0];
- float dy01 = v0[0][1] - v1[0][1];
- float dx20 = v2[0][0] - v0[0][0];
- float dy20 = v2[0][1] - v0[0][1];
- float oneoverarea = 1.0f / (dx01 * dy20 - dx20 * dy01);
-
- info.v0 = v0;
- info.v1 = v1;
- info.v2 = v2;
- info.frontfacing = frontfacing;
- info.x0_center = v0[0][0] - setup->pixel_offset;
- info.y0_center = v0[0][1] - setup->pixel_offset;
- info.dx01_ooa = dx01 * oneoverarea;
- info.dx20_ooa = dx20 * oneoverarea;
- info.dy01_ooa = dy01 * oneoverarea;
- info.dy20_ooa = dy20 * oneoverarea;
-
-
- /* setup interpolation for all the remaining attributes:
- */
- for (slot = 0; slot < setup->fs.nr_inputs; slot++) {
- unsigned vert_attr = setup->fs.input[slot].src_index;
- unsigned usage_mask = setup->fs.input[slot].usage_mask;
-
- switch (setup->fs.input[slot].interp) {
- case LP_INTERP_CONSTANT:
- if (setup->flatshade_first) {
- for (i = 0; i < NUM_CHANNELS; i++)
- if (usage_mask & (1 << i))
- constant_coef(inputs, slot+1, info.v0[vert_attr][i], i);
- }
- else {
- for (i = 0; i < NUM_CHANNELS; i++)
- if (usage_mask & (1 << i))
- constant_coef(inputs, slot+1, info.v2[vert_attr][i], i);
- }
- break;
-
- case LP_INTERP_LINEAR:
- for (i = 0; i < NUM_CHANNELS; i++)
- if (usage_mask & (1 << i))
- linear_coef(inputs, &info, slot+1, vert_attr, i);
- break;
-
- case LP_INTERP_PERSPECTIVE:
- for (i = 0; i < NUM_CHANNELS; i++)
- if (usage_mask & (1 << i))
- perspective_coef(inputs, &info, slot+1, vert_attr, i);
- fragcoord_usage_mask |= TGSI_WRITEMASK_W;
- break;
-
- case LP_INTERP_POSITION:
- /*
- * The generated pixel interpolators will pick up the coeffs from
- * slot 0, so all need to ensure that the usage mask is covers all
- * usages.
- */
- fragcoord_usage_mask |= usage_mask;
- break;
-
- case LP_INTERP_FACING:
- setup_facing_coef(inputs, slot+1, info.frontfacing, usage_mask);
- break;
-
- default:
- assert(0);
- }
- }
-
- /* The internal position input is in slot zero:
- */
- setup_fragcoord_coef(inputs, &info, 0, fragcoord_usage_mask);
-}
-
-#else
-extern void lp_setup_coef_dummy(void);
-void lp_setup_coef_dummy(void)
-{
-}
-
-#endif
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2010 VMware, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-/**
- * The setup code is concerned with point/line/triangle setup and
- * putting commands/data into the bins.
- */
-
-
-#ifndef LP_SETUP_COEF_H
-#define LP_SETUP_COEF_H
-
-
-struct lp_tri_info {
-
- float x0_center;
- float y0_center;
-
- /* turn these into an aligned float[4] */
- float dy01_ooa;
- float dy20_ooa;
- float dx01_ooa;
- float dx20_ooa;
-
- const float (*v0)[4];
- const float (*v1)[4];
- const float (*v2)[4];
-
- boolean frontfacing; /* remove eventually */
-};
-
-void lp_setup_tri_coef( struct lp_setup_context *setup,
- struct lp_rast_shader_inputs *inputs,
- const float (*v0)[4],
- const float (*v1)[4],
- const float (*v2)[4],
- boolean frontfacing);
-
-#endif
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2010 VMware.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/*
- * Binning code for triangles
- */
-
-#include "util/u_math.h"
-#include "util/u_memory.h"
-#include "lp_perf.h"
-#include "lp_setup_context.h"
-#include "lp_setup_coef.h"
-#include "lp_rast.h"
-
-#if defined(PIPE_ARCH_SSE)
-#include <emmintrin.h>
-
-
-static void constant_coef4( struct lp_rast_shader_inputs *inputs,
- const struct lp_tri_info *info,
- unsigned slot,
- const float *attr)
-{
- *(__m128 *)inputs->a0[slot] = *(__m128 *)attr;
- *(__m128 *)inputs->dadx[slot] = _mm_set1_ps(0.0);
- *(__m128 *)inputs->dady[slot] = _mm_set1_ps(0.0);
-}
-
-
-
-/**
- * Setup the fragment input attribute with the front-facing value.
- * \param frontface is the triangle front facing?
- */
-static void setup_facing_coef( struct lp_rast_shader_inputs *inputs,
- const struct lp_tri_info *info,
- unsigned slot )
-{
- /* XXX: just pass frontface directly to the shader, don't bother
- * treating it as an input.
- */
- __m128 a0 = _mm_setr_ps(info->frontfacing ? 1.0 : -1.0,
- 0, 0, 0);
-
- *(__m128 *)inputs->a0[slot] = a0;
- *(__m128 *)inputs->dadx[slot] = _mm_set1_ps(0.0);
- *(__m128 *)inputs->dady[slot] = _mm_set1_ps(0.0);
-}
-
-
-
-static void calc_coef4( struct lp_rast_shader_inputs *inputs,
- const struct lp_tri_info *info,
- unsigned slot,
- __m128 a0,
- __m128 a1,
- __m128 a2)
-{
- __m128 da01 = _mm_sub_ps(a0, a1);
- __m128 da20 = _mm_sub_ps(a2, a0);
-
- __m128 da01_dy20_ooa = _mm_mul_ps(da01, _mm_set1_ps(info->dy20_ooa));
- __m128 da20_dy01_ooa = _mm_mul_ps(da20, _mm_set1_ps(info->dy01_ooa));
- __m128 dadx = _mm_sub_ps(da01_dy20_ooa, da20_dy01_ooa);
-
- __m128 da01_dx20_ooa = _mm_mul_ps(da01, _mm_set1_ps(info->dx20_ooa));
- __m128 da20_dx01_ooa = _mm_mul_ps(da20, _mm_set1_ps(info->dx01_ooa));
- __m128 dady = _mm_sub_ps(da20_dx01_ooa, da01_dx20_ooa);
-
- __m128 dadx_x0 = _mm_mul_ps(dadx, _mm_set1_ps(info->x0_center));
- __m128 dady_y0 = _mm_mul_ps(dady, _mm_set1_ps(info->y0_center));
- __m128 attr_v0 = _mm_add_ps(dadx_x0, dady_y0);
- __m128 attr_0 = _mm_sub_ps(a0, attr_v0);
-
- *(__m128 *)inputs->a0[slot] = attr_0;
- *(__m128 *)inputs->dadx[slot] = dadx;
- *(__m128 *)inputs->dady[slot] = dady;
-}
-
-
-static void linear_coef( struct lp_rast_shader_inputs *inputs,
- const struct lp_tri_info *info,
- unsigned slot,
- unsigned vert_attr)
-{
- __m128 a0 = *(const __m128 *)info->v0[vert_attr];
- __m128 a1 = *(const __m128 *)info->v1[vert_attr];
- __m128 a2 = *(const __m128 *)info->v2[vert_attr];
-
- calc_coef4(inputs, info, slot, a0, a1, a2);
-}
-
-
-
-/**
- * Compute a0, dadx and dady for a perspective-corrected interpolant,
- * for a triangle.
- * We basically multiply the vertex value by 1/w before computing
- * the plane coefficients (a0, dadx, dady).
- * Later, when we compute the value at a particular fragment position we'll
- * divide the interpolated value by the interpolated W at that fragment.
- */
-static void perspective_coef( struct lp_rast_shader_inputs *inputs,
- const struct lp_tri_info *info,
- unsigned slot,
- unsigned vert_attr)
-{
- /* premultiply by 1/w (v[0][3] is always 1/w):
- */
- __m128 a0 = *(const __m128 *)info->v0[vert_attr];
- __m128 a1 = *(const __m128 *)info->v1[vert_attr];
- __m128 a2 = *(const __m128 *)info->v2[vert_attr];
-
- __m128 a0_oow = _mm_mul_ps(a0, _mm_set1_ps(info->v0[0][3]));
- __m128 a1_oow = _mm_mul_ps(a1, _mm_set1_ps(info->v1[0][3]));
- __m128 a2_oow = _mm_mul_ps(a2, _mm_set1_ps(info->v2[0][3]));
-
- calc_coef4(inputs, info, slot, a0_oow, a1_oow, a2_oow);
-}
-
-
-
-
-
-/**
- * Compute the inputs-> dadx, dady, a0 values.
- */
-void lp_setup_tri_coef( struct lp_setup_context *setup,
- struct lp_rast_shader_inputs *inputs,
- const float (*v0)[4],
- const float (*v1)[4],
- const float (*v2)[4],
- boolean frontfacing)
-{
- unsigned slot;
- struct lp_tri_info info;
- float dx01 = v0[0][0] - v1[0][0];
- float dy01 = v0[0][1] - v1[0][1];
- float dx20 = v2[0][0] - v0[0][0];
- float dy20 = v2[0][1] - v0[0][1];
- float oneoverarea = 1.0f / (dx01 * dy20 - dx20 * dy01);
-
- info.v0 = v0;
- info.v1 = v1;
- info.v2 = v2;
- info.frontfacing = frontfacing;
- info.x0_center = v0[0][0] - setup->pixel_offset;
- info.y0_center = v0[0][1] - setup->pixel_offset;
- info.dx01_ooa = dx01 * oneoverarea;
- info.dx20_ooa = dx20 * oneoverarea;
- info.dy01_ooa = dy01 * oneoverarea;
- info.dy20_ooa = dy20 * oneoverarea;
-
-
- /* The internal position input is in slot zero:
- */
- linear_coef(inputs, &info, 0, 0);
-
- /* setup interpolation for all the remaining attributes:
- */
- for (slot = 0; slot < setup->fs.nr_inputs; slot++) {
- unsigned vert_attr = setup->fs.input[slot].src_index;
-
- switch (setup->fs.input[slot].interp) {
- case LP_INTERP_CONSTANT:
- if (setup->flatshade_first) {
- constant_coef4(inputs, &info, slot+1, info.v0[vert_attr]);
- }
- else {
- constant_coef4(inputs, &info, slot+1, info.v2[vert_attr]);
- }
- break;
-
- case LP_INTERP_LINEAR:
- linear_coef(inputs, &info, slot+1, vert_attr);
- break;
-
- case LP_INTERP_PERSPECTIVE:
- perspective_coef(inputs, &info, slot+1, vert_attr);
- break;
-
- case LP_INTERP_POSITION:
- /*
- * The generated pixel interpolators will pick up the coeffs from
- * slot 0.
- */
- break;
-
- case LP_INTERP_FACING:
- setup_facing_coef(inputs, &info, slot+1);
- break;
-
- default:
- assert(0);
- }
- }
-}
-
-#else
-extern void lp_setup_coef_dummy(void);
-void lp_setup_coef_dummy(void)
-{
-}
-#endif
#include "lp_rast.h"
#include "lp_tile_soa.h" /* for TILE_SIZE */
#include "lp_scene.h"
+#include "lp_bld_interp.h" /* for struct lp_shader_input */
#include "draw/draw_vbuf.h"
#include "util/u_rect.h"
#define LP_SETUP_NEW_SCISSOR 0x08
+struct lp_setup_variant;
+
/** Max number of scenes */
#define MAX_SCENES 2
} state;
struct {
- struct lp_shader_input input[PIPE_MAX_ATTRIBS];
- unsigned nr_inputs;
-
const struct lp_rast_state *stored; /**< what's in the scene */
struct lp_rast_state current; /**< currently set state */
struct pipe_resource *current_tex[PIPE_MAX_SAMPLERS];
} blend_color;
+ struct {
+ const struct lp_setup_variant *variant;
+ } setup;
+
unsigned dirty; /**< bitmask of LP_SETUP_NEW_x bits */
void (*point)( struct lp_setup_context *,
void lp_setup_init_vbuf(struct lp_setup_context *setup);
-void lp_setup_update_state( struct lp_setup_context *setup,
+boolean lp_setup_update_state( struct lp_setup_context *setup,
boolean update_scene);
void lp_setup_destroy( struct lp_setup_context *setup );
-void lp_setup_flush_and_restart(struct lp_setup_context *setup);
+boolean lp_setup_flush_and_restart(struct lp_setup_context *setup);
void
lp_setup_print_triangle(struct lp_setup_context *setup,
struct lp_rast_triangle *
lp_setup_alloc_triangle(struct lp_scene *scene,
- unsigned nr_inputs,
+ unsigned num_inputs,
unsigned nr_planes,
unsigned *tri_size);
const struct u_rect *bbox,
int nr_planes );
-void lp_setup_flush_and_restart(struct lp_setup_context *setup);
-
#endif
#include "lp_setup_context.h"
#include "lp_rast.h"
#include "lp_state_fs.h"
+#include "lp_state_setup.h"
#define NUM_CHANNELS 4
const float (*v1)[4];
const float (*v2)[4];
+
+ float (*a0)[4];
+ float (*dadx)[4];
+ float (*dady)[4];
};
* Compute a0 for a constant-valued coefficient (GL_FLAT shading).
*/
static void constant_coef( struct lp_setup_context *setup,
- struct lp_rast_triangle *tri,
+ struct lp_line_info *info,
unsigned slot,
const float value,
unsigned i )
{
- tri->inputs.a0[slot][i] = value;
- tri->inputs.dadx[slot][i] = 0.0f;
- tri->inputs.dady[slot][i] = 0.0f;
+ info->a0[slot][i] = value;
+ info->dadx[slot][i] = 0.0f;
+ info->dady[slot][i] = 0.0f;
}
* for a triangle.
*/
static void linear_coef( struct lp_setup_context *setup,
- struct lp_rast_triangle *tri,
struct lp_line_info *info,
unsigned slot,
unsigned vert_attr,
float dadx = da21 * info->dx * info->oneoverarea;
float dady = da21 * info->dy * info->oneoverarea;
- tri->inputs.dadx[slot][i] = dadx;
- tri->inputs.dady[slot][i] = dady;
+ info->dadx[slot][i] = dadx;
+ info->dady[slot][i] = dady;
- tri->inputs.a0[slot][i] = (a1 -
+ info->a0[slot][i] = (a1 -
(dadx * (info->v1[0][0] - setup->pixel_offset) +
dady * (info->v1[0][1] - setup->pixel_offset)));
}
* divide the interpolated value by the interpolated W at that fragment.
*/
static void perspective_coef( struct lp_setup_context *setup,
- struct lp_rast_triangle *tri,
struct lp_line_info *info,
unsigned slot,
unsigned vert_attr,
float dadx = da21 * info->dx * info->oneoverarea;
float dady = da21 * info->dy * info->oneoverarea;
- tri->inputs.dadx[slot][i] = dadx;
- tri->inputs.dady[slot][i] = dady;
+ info->dadx[slot][i] = dadx;
+ info->dady[slot][i] = dady;
- tri->inputs.a0[slot][i] = (a1 -
- (dadx * (info->v1[0][0] - setup->pixel_offset) +
- dady * (info->v1[0][1] - setup->pixel_offset)));
+ info->a0[slot][i] = (a1 -
+ (dadx * (info->v1[0][0] - setup->pixel_offset) +
+ dady * (info->v1[0][1] - setup->pixel_offset)));
}
static void
setup_fragcoord_coef( struct lp_setup_context *setup,
- struct lp_rast_triangle *tri,
struct lp_line_info *info,
unsigned slot,
unsigned usage_mask)
{
/*X*/
if (usage_mask & TGSI_WRITEMASK_X) {
- tri->inputs.a0[slot][0] = 0.0;
- tri->inputs.dadx[slot][0] = 1.0;
- tri->inputs.dady[slot][0] = 0.0;
+ info->a0[slot][0] = 0.0;
+ info->dadx[slot][0] = 1.0;
+ info->dady[slot][0] = 0.0;
}
/*Y*/
if (usage_mask & TGSI_WRITEMASK_Y) {
- tri->inputs.a0[slot][1] = 0.0;
- tri->inputs.dadx[slot][1] = 0.0;
- tri->inputs.dady[slot][1] = 1.0;
+ info->a0[slot][1] = 0.0;
+ info->dadx[slot][1] = 0.0;
+ info->dady[slot][1] = 1.0;
}
/*Z*/
if (usage_mask & TGSI_WRITEMASK_Z) {
- linear_coef(setup, tri, info, slot, 0, 2);
+ linear_coef(setup, info, slot, 0, 2);
}
/*W*/
if (usage_mask & TGSI_WRITEMASK_W) {
- linear_coef(setup, tri, info, slot, 0, 3);
+ linear_coef(setup, info, slot, 0, 3);
}
}
* Compute the tri->coef[] array dadx, dady, a0 values.
*/
static void setup_line_coefficients( struct lp_setup_context *setup,
- struct lp_rast_triangle *tri,
struct lp_line_info *info)
{
+ const struct lp_setup_variant_key *key = &setup->setup.variant->key;
unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ;
unsigned slot;
/* setup interpolation for all the remaining attributes:
*/
- for (slot = 0; slot < setup->fs.nr_inputs; slot++) {
- unsigned vert_attr = setup->fs.input[slot].src_index;
- unsigned usage_mask = setup->fs.input[slot].usage_mask;
+ for (slot = 0; slot < key->num_inputs; slot++) {
+ unsigned vert_attr = key->inputs[slot].src_index;
+ unsigned usage_mask = key->inputs[slot].usage_mask;
unsigned i;
- switch (setup->fs.input[slot].interp) {
+ switch (key->inputs[slot].interp) {
case LP_INTERP_CONSTANT:
- if (setup->flatshade_first) {
+ if (key->flatshade_first) {
for (i = 0; i < NUM_CHANNELS; i++)
if (usage_mask & (1 << i))
- constant_coef(setup, tri, slot+1, info->v1[vert_attr][i], i);
+ constant_coef(setup, info, slot+1, info->v1[vert_attr][i], i);
}
else {
for (i = 0; i < NUM_CHANNELS; i++)
if (usage_mask & (1 << i))
- constant_coef(setup, tri, slot+1, info->v2[vert_attr][i], i);
+ constant_coef(setup, info, slot+1, info->v2[vert_attr][i], i);
}
break;
case LP_INTERP_LINEAR:
for (i = 0; i < NUM_CHANNELS; i++)
if (usage_mask & (1 << i))
- linear_coef(setup, tri, info, slot+1, vert_attr, i);
+ linear_coef(setup, info, slot+1, vert_attr, i);
break;
case LP_INTERP_PERSPECTIVE:
for (i = 0; i < NUM_CHANNELS; i++)
if (usage_mask & (1 << i))
- perspective_coef(setup, tri, info, slot+1, vert_attr, i);
+ perspective_coef(setup, info, slot+1, vert_attr, i);
fragcoord_usage_mask |= TGSI_WRITEMASK_W;
break;
case LP_INTERP_FACING:
for (i = 0; i < NUM_CHANNELS; i++)
if (usage_mask & (1 << i))
- constant_coef(setup, tri, slot+1, 1.0, i);
+ constant_coef(setup, info, slot+1, 1.0, i);
break;
default:
/* The internal position input is in slot zero:
*/
- setup_fragcoord_coef(setup, tri, info, 0,
+ setup_fragcoord_coef(setup, info, 0,
fragcoord_usage_mask);
}
const float (*v1)[4],
const float (*v2)[4])
{
+ const struct lp_setup_variant_key *key = &setup->setup.variant->key;
uint i;
debug_printf("llvmpipe line\n");
- for (i = 0; i < 1 + setup->fs.nr_inputs; i++) {
+ for (i = 0; i < 1 + key->num_inputs; i++) {
debug_printf(" v1[%d]: %f %f %f %f\n", i,
v1[i][0], v1[i][1], v1[i][2], v1[i][3]);
}
- for (i = 0; i < 1 + setup->fs.nr_inputs; i++) {
+ for (i = 0; i < 1 + key->num_inputs; i++) {
debug_printf(" v2[%d]: %f %f %f %f\n", i,
v2[i][0], v2[i][1], v2[i][2], v2[i][3]);
}
const float (*v2)[4])
{
struct lp_scene *scene = setup->scene;
+ const struct lp_setup_variant_key *key = &setup->setup.variant->key;
struct lp_rast_triangle *line;
+ struct lp_rast_plane *plane;
struct lp_line_info info;
float width = MAX2(1.0, setup->line_width);
struct u_rect bbox;
else {
/* do intersection test */
float xintersect = fracf(v2[0][0]) + y2diff * dxdy;
- draw_end = (xintersect < 1.0 && xintersect > 0.0);
+ draw_end = (xintersect < 1.0 && xintersect >= 0.0);
}
/* Are we already drawing start/end?
x_offset_end = y_offset_end * dxdy;
}
}
-
+
/* x/y positions in fixed point */
x[0] = subpixel_snap(v1[0][0] + x_offset - setup->pixel_offset) - fixed_width/2;
x[1] = subpixel_snap(v2[0][0] + x_offset_end - setup->pixel_offset) - fixed_width/2;
u_rect_find_intersection(&setup->draw_region, &bbox);
line = lp_setup_alloc_triangle(scene,
- setup->fs.nr_inputs,
+ key->num_inputs,
nr_planes,
&tri_bytes);
if (!line)
#endif
/* calculate the deltas */
- line->plane[0].dcdy = x[0] - x[1];
- line->plane[1].dcdy = x[1] - x[2];
- line->plane[2].dcdy = x[2] - x[3];
- line->plane[3].dcdy = x[3] - x[0];
+ plane = GET_PLANES(line);
+ plane[0].dcdy = x[0] - x[1];
+ plane[1].dcdy = x[1] - x[2];
+ plane[2].dcdy = x[2] - x[3];
+ plane[3].dcdy = x[3] - x[0];
- line->plane[0].dcdx = y[0] - y[1];
- line->plane[1].dcdx = y[1] - y[2];
- line->plane[2].dcdx = y[2] - y[3];
- line->plane[3].dcdx = y[3] - y[0];
+ plane[0].dcdx = y[0] - y[1];
+ plane[1].dcdx = y[1] - y[2];
+ plane[2].dcdx = y[2] - y[3];
+ plane[3].dcdx = y[3] - y[0];
/* Setup parameter interpolants:
*/
- setup_line_coefficients( setup, line, &info);
+ info.a0 = GET_A0(&line->inputs);
+ info.dadx = GET_DADX(&line->inputs);
+ info.dady = GET_DADY(&line->inputs);
+ setup_line_coefficients(setup, &info);
- line->inputs.facing = 1.0F;
- line->inputs.state = setup->fs.stored;
+ line->inputs.frontfacing = TRUE;
line->inputs.disable = FALSE;
line->inputs.opaque = FALSE;
for (i = 0; i < 4; i++) {
- struct lp_rast_plane *plane = &line->plane[i];
/* half-edge constants, will be interated over the whole render
* target.
*/
- plane->c = plane->dcdx * x[i] - plane->dcdy * y[i];
+ plane[i].c = plane[i].dcdx * x[i] - plane[i].dcdy * y[i];
/* correct for top-left vs. bottom-left fill convention.
* to its usual method, in which case it will probably want
* to use the opposite, top-left convention.
*/
- if (plane->dcdx < 0) {
+ if (plane[i].dcdx < 0) {
/* both fill conventions want this - adjust for left edges */
- plane->c++;
+ plane[i].c++;
}
- else if (plane->dcdx == 0) {
+ else if (plane[i].dcdx == 0) {
if (setup->pixel_offset == 0) {
/* correct for top-left fill convention:
*/
- if (plane->dcdy > 0) plane->c++;
+ if (plane[i].dcdy > 0) plane[i].c++;
}
else {
/* correct for bottom-left fill convention:
*/
- if (plane->dcdy < 0) plane->c++;
+ if (plane[i].dcdy < 0) plane[i].c++;
}
}
- plane->dcdx *= FIXED_ONE;
- plane->dcdy *= FIXED_ONE;
+ plane[i].dcdx *= FIXED_ONE;
+ plane[i].dcdy *= FIXED_ONE;
/* find trivial reject offsets for each edge for a single-pixel
* sized block. These will be scaled up at each recursive level to
* match the active blocksize. Scaling in this way works best if
* the blocks are square.
*/
- plane->eo = 0;
- if (plane->dcdx < 0) plane->eo -= plane->dcdx;
- if (plane->dcdy > 0) plane->eo += plane->dcdy;
-
- /* Calculate trivial accept offsets from the above.
- */
- plane->ei = plane->dcdy - plane->dcdx - plane->eo;
+ plane[i].eo = 0;
+ if (plane[i].dcdx < 0) plane[i].eo -= plane[i].dcdx;
+ if (plane[i].dcdy > 0) plane[i].eo += plane[i].dcdy;
}
* these planes elsewhere.
*/
if (nr_planes == 8) {
- line->plane[4].dcdx = -1;
- line->plane[4].dcdy = 0;
- line->plane[4].c = 1-bbox.x0;
- line->plane[4].ei = 0;
- line->plane[4].eo = 1;
-
- line->plane[5].dcdx = 1;
- line->plane[5].dcdy = 0;
- line->plane[5].c = bbox.x1+1;
- line->plane[5].ei = -1;
- line->plane[5].eo = 0;
-
- line->plane[6].dcdx = 0;
- line->plane[6].dcdy = 1;
- line->plane[6].c = 1-bbox.y0;
- line->plane[6].ei = 0;
- line->plane[6].eo = 1;
-
- line->plane[7].dcdx = 0;
- line->plane[7].dcdy = -1;
- line->plane[7].c = bbox.y1+1;
- line->plane[7].ei = -1;
- line->plane[7].eo = 0;
+ plane[4].dcdx = -1;
+ plane[4].dcdy = 0;
+ plane[4].c = 1-bbox.x0;
+ plane[4].eo = 1;
+
+ plane[5].dcdx = 1;
+ plane[5].dcdy = 0;
+ plane[5].c = bbox.x1+1;
+ plane[5].eo = 0;
+
+ plane[6].dcdx = 0;
+ plane[6].dcdy = 1;
+ plane[6].c = 1-bbox.y0;
+ plane[6].eo = 1;
+
+ plane[7].dcdx = 0;
+ plane[7].dcdy = -1;
+ plane[7].c = bbox.y1+1;
+ plane[7].eo = 0;
}
return lp_setup_bin_triangle(setup, line, &bbox, nr_planes);
{
if (!try_setup_line( setup, v0, v1 ))
{
- lp_setup_flush_and_restart(setup);
+ if (!lp_setup_flush_and_restart(setup))
+ return;
if (!try_setup_line( setup, v0, v1 ))
- assert(0);
+ return;
}
}
#include "util/u_math.h"
#include "util/u_memory.h"
#include "lp_perf.h"
-#include "lp_setup_context.h"
#include "lp_rast.h"
#include "lp_state_fs.h"
+#include "lp_state_setup.h"
#include "tgsi/tgsi_scan.h"
#define NUM_CHANNELS 4
int dx01, dx12;
const float (*v0)[4];
+
+ float (*a0)[4];
+ float (*dadx)[4];
+ float (*dady)[4];
};
*/
static void
constant_coef(struct lp_setup_context *setup,
- struct lp_rast_triangle *point,
+ struct point_info *info,
unsigned slot,
const float value,
unsigned i)
{
- point->inputs.a0[slot][i] = value;
- point->inputs.dadx[slot][i] = 0.0f;
- point->inputs.dady[slot][i] = 0.0f;
+ info->a0[slot][i] = value;
+ info->dadx[slot][i] = 0.0f;
+ info->dady[slot][i] = 0.0f;
+}
+
+
+static void
+point_persp_coeff(struct lp_setup_context *setup,
+ const struct point_info *info,
+ unsigned slot,
+ unsigned i)
+{
+ /*
+ * Fragment shader expects pre-multiplied w for LP_INTERP_PERSPECTIVE. A
+ * better stratergy would be to take the primitive in consideration when
+ * generating the fragment shader key, and therefore avoid the per-fragment
+ * perspective divide.
+ */
+
+ float w0 = info->v0[0][3];
+
+ assert(i < 4);
+
+ info->a0[slot][i] = info->v0[slot][i]*w0;
+ info->dadx[slot][i] = 0.0f;
+ info->dady[slot][i] = 0.0f;
}
* \param slot the vertex attribute slot to setup
* \param i the attribute channel in [0,3]
* \param sprite_coord_origin one of PIPE_SPRITE_COORD_x
- * \param perspective_proj will the TEX instruction do a divide by Q?
+ * \param perspective does the shader expects pre-multiplied w, i.e.,
+ * LP_INTERP_PERSPECTIVE is specified in the shader key
*/
static void
texcoord_coef(struct lp_setup_context *setup,
- struct lp_rast_triangle *point,
const struct point_info *info,
unsigned slot,
unsigned i,
unsigned sprite_coord_origin,
- boolean perspective_proj)
+ boolean perspective)
{
+ float w0 = info->v0[0][3];
+
assert(i < 4);
if (i == 0) {
float x0 = info->v0[0][0] - setup->pixel_offset;
float y0 = info->v0[0][1] - setup->pixel_offset;
- point->inputs.dadx[slot][0] = dadx;
- point->inputs.dady[slot][0] = dady;
- point->inputs.a0[slot][0] = 0.5 - (dadx * x0 + dady * y0);
+ info->dadx[slot][0] = dadx;
+ info->dady[slot][0] = dady;
+ info->a0[slot][0] = 0.5 - (dadx * x0 + dady * y0);
- if (!perspective_proj) {
- /* Divide coefficients by vertex.w here.
- *
- * It would be clearer to always multiply by w0 above and
- * then divide it out for perspective projection here, but
- * doing it this way involves less algebra.
- */
- float w0 = info->v0[0][3];
- point->inputs.dadx[slot][0] *= w0;
- point->inputs.dady[slot][0] *= w0;
- point->inputs.a0[slot][0] *= w0;
+ if (perspective) {
+ info->dadx[slot][0] *= w0;
+ info->dady[slot][0] *= w0;
+ info->a0[slot][0] *= w0;
}
}
else if (i == 1) {
dady = -dady;
}
- point->inputs.dadx[slot][1] = dadx;
- point->inputs.dady[slot][1] = dady;
- point->inputs.a0[slot][1] = 0.5 - (dadx * x0 + dady * y0);
+ info->dadx[slot][1] = dadx;
+ info->dady[slot][1] = dady;
+ info->a0[slot][1] = 0.5 - (dadx * x0 + dady * y0);
- if (!perspective_proj) {
- float w0 = info->v0[0][3];
- point->inputs.dadx[slot][1] *= w0;
- point->inputs.dady[slot][1] *= w0;
- point->inputs.a0[slot][1] *= w0;
+ if (perspective) {
+ info->dadx[slot][1] *= w0;
+ info->dady[slot][1] *= w0;
+ info->a0[slot][1] *= w0;
}
}
else if (i == 2) {
- point->inputs.a0[slot][2] = 0.0f;
- point->inputs.dadx[slot][2] = 0.0f;
- point->inputs.dady[slot][2] = 0.0f;
+ info->a0[slot][2] = 0.0f;
+ info->dadx[slot][2] = 0.0f;
+ info->dady[slot][2] = 0.0f;
}
else {
- point->inputs.a0[slot][3] = 1.0f;
- point->inputs.dadx[slot][3] = 0.0f;
- point->inputs.dady[slot][3] = 0.0f;
+ info->a0[slot][3] = perspective ? w0 : 1.0f;
+ info->dadx[slot][3] = 0.0f;
+ info->dady[slot][3] = 0.0f;
}
}
*/
static void
setup_point_fragcoord_coef(struct lp_setup_context *setup,
- struct lp_rast_triangle *point,
- const struct point_info *info,
+ struct point_info *info,
unsigned slot,
unsigned usage_mask)
{
/*X*/
if (usage_mask & TGSI_WRITEMASK_X) {
- point->inputs.a0[slot][0] = 0.0;
- point->inputs.dadx[slot][0] = 1.0;
- point->inputs.dady[slot][0] = 0.0;
+ info->a0[slot][0] = 0.0;
+ info->dadx[slot][0] = 1.0;
+ info->dady[slot][0] = 0.0;
}
/*Y*/
if (usage_mask & TGSI_WRITEMASK_Y) {
- point->inputs.a0[slot][1] = 0.0;
- point->inputs.dadx[slot][1] = 0.0;
- point->inputs.dady[slot][1] = 1.0;
+ info->a0[slot][1] = 0.0;
+ info->dadx[slot][1] = 0.0;
+ info->dady[slot][1] = 1.0;
}
/*Z*/
if (usage_mask & TGSI_WRITEMASK_Z) {
- constant_coef(setup, point, slot, info->v0[0][2], 2);
+ constant_coef(setup, info, slot, info->v0[0][2], 2);
}
/*W*/
if (usage_mask & TGSI_WRITEMASK_W) {
- constant_coef(setup, point, slot, info->v0[0][3], 3);
+ constant_coef(setup, info, slot, info->v0[0][3], 3);
}
}
*/
static void
setup_point_coefficients( struct lp_setup_context *setup,
- struct lp_rast_triangle *point,
- const struct point_info *info)
+ struct point_info *info)
{
+ const struct lp_setup_variant_key *key = &setup->setup.variant->key;
const struct lp_fragment_shader *shader = setup->fs.current.variant->shader;
unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ;
unsigned slot;
/* setup interpolation for all the remaining attributes:
*/
- for (slot = 0; slot < setup->fs.nr_inputs; slot++) {
- unsigned vert_attr = setup->fs.input[slot].src_index;
- unsigned usage_mask = setup->fs.input[slot].usage_mask;
+ for (slot = 0; slot < key->num_inputs; slot++) {
+ unsigned vert_attr = key->inputs[slot].src_index;
+ unsigned usage_mask = key->inputs[slot].usage_mask;
+ enum lp_interp interp = key->inputs[slot].interp;
+ boolean perspective = !!(interp == LP_INTERP_PERSPECTIVE);
unsigned i;
+
+ if (perspective & usage_mask) {
+ fragcoord_usage_mask |= TGSI_WRITEMASK_W;
+ }
- switch (setup->fs.input[slot].interp) {
+ switch (interp) {
case LP_INTERP_POSITION:
/*
* The generated pixel interpolators will pick up the coeffs from
case LP_INTERP_LINEAR:
/* Sprite tex coords may use linear interpolation someday */
/* fall-through */
-
case LP_INTERP_PERSPECTIVE:
/* check if the sprite coord flag is set for this attribute.
* If so, set it up so it up so x and y vary from 0 to 1.
*/
- if (shader->info.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) {
- const int index = shader->info.input_semantic_index[slot];
+ if (shader->info.base.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) {
+ unsigned semantic_index = shader->info.base.input_semantic_index[slot];
/* Note that sprite_coord enable is a bitfield of
* PIPE_MAX_SHADER_OUTPUTS bits.
*/
- if (index < PIPE_MAX_SHADER_OUTPUTS &&
- (setup->sprite_coord_enable & (1 << index))) {
- for (i = 0; i < NUM_CHANNELS; i++)
- if (usage_mask & (1 << i))
- texcoord_coef(setup, point, info, slot + 1, i,
+ if (semantic_index < PIPE_MAX_SHADER_OUTPUTS &&
+ (setup->sprite_coord_enable & (1 << semantic_index))) {
+ for (i = 0; i < NUM_CHANNELS; i++) {
+ if (usage_mask & (1 << i)) {
+ texcoord_coef(setup, info, slot + 1, i,
setup->sprite_coord_origin,
- (usage_mask & TGSI_WRITEMASK_W));
- fragcoord_usage_mask |= TGSI_WRITEMASK_W;
- break;
+ perspective);
+ }
+ }
+ break;
}
}
- /* FALLTHROUGH */
+ /* fall-through */
case LP_INTERP_CONSTANT:
for (i = 0; i < NUM_CHANNELS; i++) {
- if (usage_mask & (1 << i))
- constant_coef(setup, point, slot+1, info->v0[vert_attr][i], i);
+ if (usage_mask & (1 << i)) {
+ if (perspective) {
+ point_persp_coeff(setup, info, slot+1, i);
+ }
+ else {
+ constant_coef(setup, info, slot+1, info->v0[vert_attr][i], i);
+ }
+ }
}
break;
case LP_INTERP_FACING:
for (i = 0; i < NUM_CHANNELS; i++)
if (usage_mask & (1 << i))
- constant_coef(setup, point, slot+1, 1.0, i);
+ constant_coef(setup, info, slot+1, 1.0, i);
break;
default:
/* The internal position input is in slot zero:
*/
- setup_point_fragcoord_coef(setup, point, info, 0,
+ setup_point_fragcoord_coef(setup, info, 0,
fragcoord_usage_mask);
}
const float (*v0)[4] )
{
/* x/y positions in fixed point */
+ const struct lp_setup_variant_key *key = &setup->setup.variant->key;
const int sizeAttr = setup->psize;
const float size
= (setup->point_size_per_vertex && sizeAttr > 0) ? v0[sizeAttr][0]
u_rect_find_intersection(&setup->draw_region, &bbox);
point = lp_setup_alloc_triangle(scene,
- setup->fs.nr_inputs,
+ key->num_inputs,
nr_planes,
&bytes);
if (!point)
info.dx12 = fixed_width;
info.dy01 = fixed_width;
info.dy12 = 0;
+ info.a0 = GET_A0(&point->inputs);
+ info.dadx = GET_DADX(&point->inputs);
+ info.dady = GET_DADY(&point->inputs);
/* Setup parameter interpolants:
*/
- setup_point_coefficients(setup, point, &info);
+ setup_point_coefficients(setup, &info);
- point->inputs.facing = 1.0F;
- point->inputs.state = setup->fs.stored;
+ point->inputs.frontfacing = TRUE;
point->inputs.disable = FALSE;
point->inputs.opaque = FALSE;
{
- point->plane[0].dcdx = -1;
- point->plane[0].dcdy = 0;
- point->plane[0].c = 1-bbox.x0;
- point->plane[0].ei = 0;
- point->plane[0].eo = 1;
-
- point->plane[1].dcdx = 1;
- point->plane[1].dcdy = 0;
- point->plane[1].c = bbox.x1+1;
- point->plane[1].ei = -1;
- point->plane[1].eo = 0;
-
- point->plane[2].dcdx = 0;
- point->plane[2].dcdy = 1;
- point->plane[2].c = 1-bbox.y0;
- point->plane[2].ei = 0;
- point->plane[2].eo = 1;
-
- point->plane[3].dcdx = 0;
- point->plane[3].dcdy = -1;
- point->plane[3].c = bbox.y1+1;
- point->plane[3].ei = -1;
- point->plane[3].eo = 0;
+ struct lp_rast_plane *plane = GET_PLANES(point);
+
+ plane[0].dcdx = -1;
+ plane[0].dcdy = 0;
+ plane[0].c = 1-bbox.x0;
+ plane[0].eo = 1;
+
+ plane[1].dcdx = 1;
+ plane[1].dcdy = 0;
+ plane[1].c = bbox.x1+1;
+ plane[1].eo = 0;
+
+ plane[2].dcdx = 0;
+ plane[2].dcdy = 1;
+ plane[2].c = 1-bbox.y0;
+ plane[2].eo = 1;
+
+ plane[3].dcdx = 0;
+ plane[3].dcdy = -1;
+ plane[3].c = bbox.y1+1;
+ plane[3].eo = 0;
}
return lp_setup_bin_triangle(setup, point, &bbox, nr_planes);
{
if (!try_setup_point( setup, v0 ))
{
- lp_setup_flush_and_restart(setup);
+ if (!lp_setup_flush_and_restart(setup))
+ return;
if (!try_setup_point( setup, v0 ))
- assert(0);
+ return;
}
}
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_rect.h"
+#include "util/u_sse.h"
#include "lp_perf.h"
#include "lp_setup_context.h"
-#include "lp_setup_coef.h"
#include "lp_rast.h"
#include "lp_state_fs.h"
+#include "lp_state_setup.h"
#define NUM_CHANNELS 4
-
+#if defined(PIPE_ARCH_SSE)
+#include <emmintrin.h>
+#endif
static INLINE int
subpixel_snap(float a)
* immediately after it.
* The memory is allocated from the per-scene pool, not per-tile.
* \param tri_size returns number of bytes allocated
- * \param nr_inputs number of fragment shader inputs
+ * \param num_inputs number of fragment shader inputs
* \return pointer to triangle space
*/
struct lp_rast_triangle *
unsigned *tri_size)
{
unsigned input_array_sz = NUM_CHANNELS * (nr_inputs + 1) * sizeof(float);
+ unsigned plane_sz = nr_planes * sizeof(struct lp_rast_plane);
struct lp_rast_triangle *tri;
- unsigned tri_bytes, bytes;
- char *inputs;
- tri_bytes = align(Offset(struct lp_rast_triangle, plane[nr_planes]), 16);
- bytes = tri_bytes + (3 * input_array_sz);
+ *tri_size = (sizeof(struct lp_rast_triangle) +
+ 3 * input_array_sz +
+ plane_sz);
- tri = lp_scene_alloc_aligned( scene, bytes, 16 );
+ tri = lp_scene_alloc_aligned( scene, *tri_size, 16 );
+ if (tri == NULL)
+ return NULL;
- if (tri) {
- inputs = ((char *)tri) + tri_bytes;
- tri->inputs.a0 = (float (*)[4]) inputs;
- tri->inputs.dadx = (float (*)[4]) (inputs + input_array_sz);
- tri->inputs.dady = (float (*)[4]) (inputs + 2 * input_array_sz);
+ tri->inputs.stride = input_array_sz;
- *tri_size = bytes;
+ {
+ char *a = (char *)tri;
+ char *b = (char *)&GET_PLANES(tri)[nr_planes];
+ assert(b - a == *tri_size);
}
return tri;
const char *name,
const float (*v)[4])
{
+ const struct lp_setup_variant_key *key = &setup->setup.variant->key;
int i, j;
debug_printf(" wpos (%s[0]) xyzw %f %f %f %f\n",
name,
v[0][0], v[0][1], v[0][2], v[0][3]);
- for (i = 0; i < setup->fs.nr_inputs; i++) {
- const float *in = v[setup->fs.input[i].src_index];
+ for (i = 0; i < key->num_inputs; i++) {
+ const float *in = v[key->inputs[i].src_index];
debug_printf(" in[%d] (%s[%d]) %s%s%s%s ",
i,
- name, setup->fs.input[i].src_index,
- (setup->fs.input[i].usage_mask & 0x1) ? "x" : " ",
- (setup->fs.input[i].usage_mask & 0x2) ? "y" : " ",
- (setup->fs.input[i].usage_mask & 0x4) ? "z" : " ",
- (setup->fs.input[i].usage_mask & 0x8) ? "w" : " ");
+ name, key->inputs[i].src_index,
+ (key->inputs[i].usage_mask & 0x1) ? "x" : " ",
+ (key->inputs[i].usage_mask & 0x2) ? "y" : " ",
+ (key->inputs[i].usage_mask & 0x4) ? "z" : " ",
+ (key->inputs[i].usage_mask & 0x8) ? "w" : " ");
for (j = 0; j < 4; j++)
- if (setup->fs.input[i].usage_mask & (1<<j))
+ if (key->inputs[i].usage_mask & (1<<j))
debug_printf("%.5f ", in[j]);
debug_printf("\n");
}
LP_COUNT(nr_shade_opaque_64);
- return lp_scene_bin_command( scene, tx, ty,
- LP_RAST_OP_SHADE_TILE_OPAQUE,
- lp_rast_arg_inputs(inputs) );
+ return lp_scene_bin_cmd_with_state( scene, tx, ty,
+ setup->fs.stored,
+ LP_RAST_OP_SHADE_TILE_OPAQUE,
+ lp_rast_arg_inputs(inputs) );
} else {
LP_COUNT(nr_shade_64);
- return lp_scene_bin_command( scene, tx, ty,
- LP_RAST_OP_SHADE_TILE,
- lp_rast_arg_inputs(inputs) );
+ return lp_scene_bin_cmd_with_state( scene, tx, ty,
+ setup->fs.stored,
+ LP_RAST_OP_SHADE_TILE,
+ lp_rast_arg_inputs(inputs) );
}
}
boolean frontfacing )
{
struct lp_scene *scene = setup->scene;
+ const struct lp_setup_variant_key *key = &setup->setup.variant->key;
struct lp_rast_triangle *tri;
- int x[3];
- int y[3];
- int area;
+ struct lp_rast_plane *plane;
+ int x[4];
+ int y[4];
struct u_rect bbox;
unsigned tri_bytes;
- int i;
int nr_planes = 3;
if (0)
x[0] = subpixel_snap(v0[0][0] - setup->pixel_offset);
x[1] = subpixel_snap(v1[0][0] - setup->pixel_offset);
x[2] = subpixel_snap(v2[0][0] - setup->pixel_offset);
+ x[3] = 0;
y[0] = subpixel_snap(v0[0][1] - setup->pixel_offset);
y[1] = subpixel_snap(v1[0][1] - setup->pixel_offset);
y[2] = subpixel_snap(v2[0][1] - setup->pixel_offset);
-
+ y[3] = 0;
+
/* Bounding rectangle (in pixels) */
{
u_rect_find_intersection(&setup->draw_region, &bbox);
tri = lp_setup_alloc_triangle(scene,
- setup->fs.nr_inputs,
+ key->num_inputs,
nr_planes,
&tri_bytes);
if (!tri)
return FALSE;
-#ifdef DEBUG
+#if 0
tri->v[0][0] = v0[0][0];
tri->v[1][0] = v1[0][0];
tri->v[2][0] = v2[0][0];
tri->v[2][1] = v2[0][1];
#endif
- tri->plane[0].dcdy = x[0] - x[1];
- tri->plane[1].dcdy = x[1] - x[2];
- tri->plane[2].dcdy = x[2] - x[0];
-
- tri->plane[0].dcdx = y[0] - y[1];
- tri->plane[1].dcdx = y[1] - y[2];
- tri->plane[2].dcdx = y[2] - y[0];
-
- area = (tri->plane[0].dcdy * tri->plane[2].dcdx -
- tri->plane[2].dcdy * tri->plane[0].dcdx);
-
LP_COUNT(nr_tris);
- /* Cull non-ccw and zero-sized triangles.
- *
- * XXX: subject to overflow??
- */
- if (area <= 0) {
- lp_scene_putback_data( scene, tri_bytes );
- LP_COUNT(nr_culled_tris);
- return TRUE;
- }
-
/* Setup parameter interpolants:
*/
- lp_setup_tri_coef( setup, &tri->inputs, v0, v1, v2, frontfacing );
-
- tri->inputs.facing = frontfacing ? 1.0F : -1.0F;
+ setup->setup.variant->jit_function( v0,
+ v1,
+ v2,
+ frontfacing,
+ GET_A0(&tri->inputs),
+ GET_DADX(&tri->inputs),
+ GET_DADY(&tri->inputs) );
+
+ tri->inputs.frontfacing = frontfacing;
tri->inputs.disable = FALSE;
tri->inputs.opaque = setup->fs.current.variant->opaque;
- tri->inputs.state = setup->fs.stored;
-
- for (i = 0; i < 3; i++) {
- struct lp_rast_plane *plane = &tri->plane[i];
+ if (0)
+ lp_dump_setup_coef(&setup->setup.variant->key,
+ (const float (*)[4])GET_A0(&tri->inputs),
+ (const float (*)[4])GET_DADX(&tri->inputs),
+ (const float (*)[4])GET_DADY(&tri->inputs));
+
+ plane = GET_PLANES(tri);
+
+#if defined(PIPE_ARCH_SSE)
+ {
+ __m128i vertx, verty;
+ __m128i shufx, shufy;
+ __m128i dcdx, dcdy, c;
+ __m128i unused;
+ __m128i dcdx_neg_mask;
+ __m128i dcdy_neg_mask;
+ __m128i dcdx_zero_mask;
+ __m128i top_left_flag;
+ __m128i c_inc_mask, c_inc;
+ __m128i eo, p0, p1, p2;
+ __m128i zero = _mm_setzero_si128();
+
+ vertx = _mm_loadu_si128((__m128i *)x); /* vertex x coords */
+ verty = _mm_loadu_si128((__m128i *)y); /* vertex y coords */
+
+ shufx = _mm_shuffle_epi32(vertx, _MM_SHUFFLE(3,0,2,1));
+ shufy = _mm_shuffle_epi32(verty, _MM_SHUFFLE(3,0,2,1));
+
+ dcdx = _mm_sub_epi32(verty, shufy);
+ dcdy = _mm_sub_epi32(vertx, shufx);
+
+ dcdx_neg_mask = _mm_srai_epi32(dcdx, 31);
+ dcdx_zero_mask = _mm_cmpeq_epi32(dcdx, zero);
+ dcdy_neg_mask = _mm_srai_epi32(dcdy, 31);
+
+ top_left_flag = _mm_set1_epi32((setup->pixel_offset == 0) ? ~0 : 0);
- /* half-edge constants, will be interated over the whole render
- * target.
+ c_inc_mask = _mm_or_si128(dcdx_neg_mask,
+ _mm_and_si128(dcdx_zero_mask,
+ _mm_xor_si128(dcdy_neg_mask,
+ top_left_flag)));
+
+ c_inc = _mm_srli_epi32(c_inc_mask, 31);
+
+ c = _mm_sub_epi32(mm_mullo_epi32(dcdx, vertx),
+ mm_mullo_epi32(dcdy, verty));
+
+ c = _mm_add_epi32(c, c_inc);
+
+ /* Scale up to match c:
*/
- plane->c = plane->dcdx * x[i] - plane->dcdy * y[i];
-
- /* correct for top-left vs. bottom-left fill convention.
- *
- * note that we're overloading gl_rasterization_rules to mean
- * both (0.5,0.5) pixel centers *and* bottom-left filling
- * convention.
- *
- * GL actually has a top-left filling convention, but GL's
- * notion of "top" differs from gallium's...
- *
- * Also, sometimes (in FBO cases) GL will render upside down
- * to its usual method, in which case it will probably want
- * to use the opposite, top-left convention.
- */
- if (plane->dcdx < 0) {
- /* both fill conventions want this - adjust for left edges */
- plane->c++;
- }
- else if (plane->dcdx == 0) {
- if (setup->pixel_offset == 0) {
- /* correct for top-left fill convention:
- */
- if (plane->dcdy > 0) plane->c++;
+ dcdx = _mm_slli_epi32(dcdx, FIXED_ORDER);
+ dcdy = _mm_slli_epi32(dcdy, FIXED_ORDER);
+
+ /* Calculate trivial reject values:
+ */
+ eo = _mm_sub_epi32(_mm_andnot_si128(dcdy_neg_mask, dcdy),
+ _mm_and_si128(dcdx_neg_mask, dcdx));
+
+ /* ei = _mm_sub_epi32(_mm_sub_epi32(dcdy, dcdx), eo); */
+
+ /* Pointless transpose which gets undone immediately in
+ * rasterization:
+ */
+ transpose4_epi32(&c, &dcdx, &dcdy, &eo,
+ &p0, &p1, &p2, &unused);
+
+ _mm_store_si128((__m128i *)&plane[0], p0);
+ _mm_store_si128((__m128i *)&plane[1], p1);
+ _mm_store_si128((__m128i *)&plane[2], p2);
+ }
+#else
+ {
+ int i;
+ plane[0].dcdy = x[0] - x[1];
+ plane[1].dcdy = x[1] - x[2];
+ plane[2].dcdy = x[2] - x[0];
+ plane[0].dcdx = y[0] - y[1];
+ plane[1].dcdx = y[1] - y[2];
+ plane[2].dcdx = y[2] - y[0];
+
+ for (i = 0; i < 3; i++) {
+ /* half-edge constants, will be interated over the whole render
+ * target.
+ */
+ plane[i].c = plane[i].dcdx * x[i] - plane[i].dcdy * y[i];
+
+ /* correct for top-left vs. bottom-left fill convention.
+ *
+ * note that we're overloading gl_rasterization_rules to mean
+ * both (0.5,0.5) pixel centers *and* bottom-left filling
+ * convention.
+ *
+ * GL actually has a top-left filling convention, but GL's
+ * notion of "top" differs from gallium's...
+ *
+ * Also, sometimes (in FBO cases) GL will render upside down
+ * to its usual method, in which case it will probably want
+ * to use the opposite, top-left convention.
+ */
+ if (plane[i].dcdx < 0) {
+ /* both fill conventions want this - adjust for left edges */
+ plane[i].c++;
}
- else {
- /* correct for bottom-left fill convention:
- */
- if (plane->dcdy < 0) plane->c++;
+ else if (plane[i].dcdx == 0) {
+ if (setup->pixel_offset == 0) {
+ /* correct for top-left fill convention:
+ */
+ if (plane[i].dcdy > 0) plane[i].c++;
+ }
+ else {
+ /* correct for bottom-left fill convention:
+ */
+ if (plane[i].dcdy < 0) plane[i].c++;
+ }
}
- }
- plane->dcdx *= FIXED_ONE;
- plane->dcdy *= FIXED_ONE;
+ plane[i].dcdx *= FIXED_ONE;
+ plane[i].dcdy *= FIXED_ONE;
- /* find trivial reject offsets for each edge for a single-pixel
- * sized block. These will be scaled up at each recursive level to
- * match the active blocksize. Scaling in this way works best if
- * the blocks are square.
- */
- plane->eo = 0;
- if (plane->dcdx < 0) plane->eo -= plane->dcdx;
- if (plane->dcdy > 0) plane->eo += plane->dcdy;
+ /* find trivial reject offsets for each edge for a single-pixel
+ * sized block. These will be scaled up at each recursive level to
+ * match the active blocksize. Scaling in this way works best if
+ * the blocks are square.
+ */
+ plane[i].eo = 0;
+ if (plane[i].dcdx < 0) plane[i].eo -= plane[i].dcdx;
+ if (plane[i].dcdy > 0) plane[i].eo += plane[i].dcdy;
+ }
+ }
+#endif
- /* Calculate trivial accept offsets from the above.
- */
- plane->ei = plane->dcdy - plane->dcdx - plane->eo;
+ if (0) {
+ debug_printf("p0: %08x/%08x/%08x/%08x\n",
+ plane[0].c,
+ plane[0].dcdx,
+ plane[0].dcdy,
+ plane[0].eo);
+
+ debug_printf("p1: %08x/%08x/%08x/%08x\n",
+ plane[1].c,
+ plane[1].dcdx,
+ plane[1].dcdy,
+ plane[1].eo);
+
+ debug_printf("p0: %08x/%08x/%08x/%08x\n",
+ plane[2].c,
+ plane[2].dcdx,
+ plane[2].dcdy,
+ plane[2].eo);
}
* these planes elsewhere.
*/
if (nr_planes == 7) {
- tri->plane[3].dcdx = -1;
- tri->plane[3].dcdy = 0;
- tri->plane[3].c = 1-bbox.x0;
- tri->plane[3].ei = 0;
- tri->plane[3].eo = 1;
-
- tri->plane[4].dcdx = 1;
- tri->plane[4].dcdy = 0;
- tri->plane[4].c = bbox.x1+1;
- tri->plane[4].ei = -1;
- tri->plane[4].eo = 0;
-
- tri->plane[5].dcdx = 0;
- tri->plane[5].dcdy = 1;
- tri->plane[5].c = 1-bbox.y0;
- tri->plane[5].ei = 0;
- tri->plane[5].eo = 1;
-
- tri->plane[6].dcdx = 0;
- tri->plane[6].dcdy = -1;
- tri->plane[6].c = bbox.y1+1;
- tri->plane[6].ei = -1;
- tri->plane[6].eo = 0;
+ plane[3].dcdx = -1;
+ plane[3].dcdy = 0;
+ plane[3].c = 1-bbox.x0;
+ plane[3].eo = 1;
+
+ plane[4].dcdx = 1;
+ plane[4].dcdy = 0;
+ plane[4].c = bbox.x1+1;
+ plane[4].eo = 0;
+
+ plane[5].dcdx = 0;
+ plane[5].dcdy = 1;
+ plane[5].c = 1-bbox.y0;
+ plane[5].eo = 1;
+
+ plane[6].dcdx = 0;
+ plane[6].dcdy = -1;
+ plane[6].c = bbox.y1+1;
+ plane[6].eo = 0;
}
return lp_setup_bin_triangle( setup, tri, &bbox, nr_planes );
int sz = floor_pot((bbox->x1 - (bbox->x0 & ~3)) |
(bbox->y1 - (bbox->y0 & ~3)));
- if (nr_planes == 3) {
- if (sz < 4 && dx < 64)
- {
- /* Triangle is contained in a single 4x4 stamp:
- */
- int mask = (bbox->x0 & 63 & ~3) | ((bbox->y0 & 63 & ~3) << 8);
-
- return lp_scene_bin_command( scene,
- bbox->x0/64, bbox->y0/64,
- LP_RAST_OP_TRIANGLE_3_4,
- lp_rast_arg_triangle(tri, mask) );
- }
-
- if (sz < 16 && dx < 64)
- {
- int mask = (bbox->x0 & 63 & ~3) | ((bbox->y0 & 63 & ~3) << 8);
-
- /* Triangle is contained in a single 16x16 block:
- */
- return lp_scene_bin_command( scene,
- bbox->x0/64, bbox->y0/64,
- LP_RAST_OP_TRIANGLE_3_16,
- lp_rast_arg_triangle(tri, mask) );
- }
- }
-
-
/* Determine which tile(s) intersect the triangle's bounding box
*/
if (dx < TILE_SIZE)
{
int ix0 = bbox->x0 / TILE_SIZE;
int iy0 = bbox->y0 / TILE_SIZE;
+ int px = bbox->x0 & 63 & ~3;
+ int py = bbox->y0 & 63 & ~3;
+ int mask = px | (py << 8);
assert(iy0 == bbox->y1 / TILE_SIZE &&
ix0 == bbox->x1 / TILE_SIZE);
+ if (nr_planes == 3) {
+ if (sz < 4)
+ {
+ /* Triangle is contained in a single 4x4 stamp:
+ */
+ return lp_scene_bin_cmd_with_state( scene, ix0, iy0,
+ setup->fs.stored,
+ LP_RAST_OP_TRIANGLE_3_4,
+ lp_rast_arg_triangle(tri, mask) );
+ }
+
+ if (sz < 16)
+ {
+ /* Triangle is contained in a single 16x16 block:
+ */
+ return lp_scene_bin_cmd_with_state( scene, ix0, iy0,
+ setup->fs.stored,
+ LP_RAST_OP_TRIANGLE_3_16,
+ lp_rast_arg_triangle(tri, mask) );
+ }
+ }
+ else if (nr_planes == 4 && sz < 16)
+ {
+ return lp_scene_bin_cmd_with_state(scene, ix0, iy0,
+ setup->fs.stored,
+ LP_RAST_OP_TRIANGLE_4_16,
+ lp_rast_arg_triangle(tri, mask) );
+ }
+
+
/* Triangle is contained in a single tile:
*/
- return lp_scene_bin_command( scene, ix0, iy0,
- lp_rast_tri_tab[nr_planes],
- lp_rast_arg_triangle(tri, (1<<nr_planes)-1) );
+ return lp_scene_bin_cmd_with_state( scene, ix0, iy0, setup->fs.stored,
+ lp_rast_tri_tab[nr_planes],
+ lp_rast_arg_triangle(tri, (1<<nr_planes)-1) );
}
else
{
+ struct lp_rast_plane *plane = GET_PLANES(tri);
int c[MAX_PLANES];
int ei[MAX_PLANES];
int eo[MAX_PLANES];
int iy1 = bbox->y1 / TILE_SIZE;
for (i = 0; i < nr_planes; i++) {
- c[i] = (tri->plane[i].c +
- tri->plane[i].dcdy * iy0 * TILE_SIZE -
- tri->plane[i].dcdx * ix0 * TILE_SIZE);
-
- ei[i] = tri->plane[i].ei << TILE_ORDER;
- eo[i] = tri->plane[i].eo << TILE_ORDER;
- xstep[i] = -(tri->plane[i].dcdx << TILE_ORDER);
- ystep[i] = tri->plane[i].dcdy << TILE_ORDER;
+ c[i] = (plane[i].c +
+ plane[i].dcdy * iy0 * TILE_SIZE -
+ plane[i].dcdx * ix0 * TILE_SIZE);
+
+ ei[i] = (plane[i].dcdy -
+ plane[i].dcdx -
+ plane[i].eo) << TILE_ORDER;
+
+ eo[i] = plane[i].eo << TILE_ORDER;
+ xstep[i] = -(plane[i].dcdx << TILE_ORDER);
+ ystep[i] = plane[i].dcdy << TILE_ORDER;
}
*/
int count = util_bitcount(partial);
in = TRUE;
- if (!lp_scene_bin_command( scene, x, y,
- lp_rast_tri_tab[count],
- lp_rast_arg_triangle(tri, partial) ))
+
+ if (!lp_scene_bin_cmd_with_state( scene, x, y,
+ setup->fs.stored,
+ lp_rast_tri_tab[count],
+ lp_rast_arg_triangle(tri, partial) ))
goto fail;
LP_COUNT(nr_partially_covered_64);
/**
- * Draw triangle if it's CW, cull otherwise.
+ * Try to draw the triangle, restart the scene on failure.
*/
-static void triangle_cw( struct lp_setup_context *setup,
- const float (*v0)[4],
- const float (*v1)[4],
- const float (*v2)[4] )
+static void retry_triangle_ccw( struct lp_setup_context *setup,
+ const float (*v0)[4],
+ const float (*v1)[4],
+ const float (*v2)[4],
+ boolean front)
{
- if (!do_triangle_ccw( setup, v1, v0, v2, !setup->ccw_is_frontface ))
+ if (!do_triangle_ccw( setup, v0, v1, v2, front ))
{
- lp_setup_flush_and_restart(setup);
+ if (!lp_setup_flush_and_restart(setup))
+ return;
- if (!do_triangle_ccw( setup, v1, v0, v2, !setup->ccw_is_frontface ))
- assert(0);
+ if (!do_triangle_ccw( setup, v0, v1, v2, front ))
+ return;
}
}
+static INLINE float
+calc_area(const float (*v0)[4],
+ const float (*v1)[4],
+ const float (*v2)[4])
+{
+ float dx01 = v0[0][0] - v1[0][0];
+ float dy01 = v0[0][1] - v1[0][1];
+ float dx20 = v2[0][0] - v0[0][0];
+ float dy20 = v2[0][1] - v0[0][1];
+ return dx01 * dy20 - dx20 * dy01;
+}
+
/**
- * Draw triangle if it's CCW, cull otherwise.
+ * Draw triangle if it's CW, cull otherwise.
*/
-static void triangle_ccw( struct lp_setup_context *setup,
+static void triangle_cw( struct lp_setup_context *setup,
const float (*v0)[4],
const float (*v1)[4],
const float (*v2)[4] )
{
- if (!do_triangle_ccw( setup, v0, v1, v2, setup->ccw_is_frontface ))
- {
- lp_setup_flush_and_restart(setup);
- if (!do_triangle_ccw( setup, v0, v1, v2, setup->ccw_is_frontface ))
- assert(0);
- }
+ float area = calc_area(v0, v1, v2);
+
+ if (area < 0.0f)
+ retry_triangle_ccw(setup, v0, v2, v1, !setup->ccw_is_frontface);
}
+static void triangle_ccw( struct lp_setup_context *setup,
+ const float (*v0)[4],
+ const float (*v1)[4],
+ const float (*v2)[4])
+{
+ float area = calc_area(v0, v1, v2);
+
+ if (area > 0.0f)
+ retry_triangle_ccw(setup, v0, v1, v2, setup->ccw_is_frontface);
+}
/**
* Draw triangle whether it's CW or CCW.
const float (*v1)[4],
const float (*v2)[4] )
{
- /* edge vectors e = v0 - v2, f = v1 - v2 */
- const float ex = v0[0][0] - v2[0][0];
- const float ey = v0[0][1] - v2[0][1];
- const float fx = v1[0][0] - v2[0][0];
- const float fy = v1[0][1] - v2[0][1];
-
- /* det = cross(e,f).z */
- const float det = ex * fy - ey * fx;
- if (det < 0.0f)
- triangle_ccw( setup, v0, v1, v2 );
- else if (det > 0.0f)
- triangle_cw( setup, v0, v1, v2 );
+ float area = calc_area(v0, v1, v2);
+
+ if (area > 0.0f)
+ retry_triangle_ccw( setup, v0, v1, v2, setup->ccw_is_frontface );
+ else if (area < 0.0f)
+ retry_triangle_ccw( setup, v0, v2, v1, !setup->ccw_is_frontface );
}
const boolean flatshade_first = setup->flatshade_first;
unsigned i;
- lp_setup_update_state(setup, TRUE);
+ if (!lp_setup_update_state(setup, TRUE))
+ return;
switch (setup->prim) {
case PIPE_PRIM_POINTS:
const boolean flatshade_first = setup->flatshade_first;
unsigned i;
- lp_setup_update_state(setup, TRUE);
+ if (!lp_setup_update_state(setup, TRUE))
+ return;
switch (setup->prim) {
case PIPE_PRIM_POINTS:
void
llvmpipe_update_fs(struct llvmpipe_context *lp);
+void
+llvmpipe_update_setup(struct llvmpipe_context *lp);
+
void
llvmpipe_update_derived(struct llvmpipe_context *llvmpipe);
{
const struct lp_fragment_shader *lpfs = llvmpipe->fs;
struct vertex_info *vinfo = &llvmpipe->vertex_info;
- struct lp_shader_input *inputs = llvmpipe->inputs;
unsigned vs_index;
uint i;
/*
- * Match FS inputs against VS outputs, emitting the necessary attributes.
+ * Match FS inputs against VS outputs, emitting the necessary
+ * attributes. Could cache these structs and look them up with a
+ * combination of fragment shader, vertex shader ids.
*/
vinfo->num_attribs = 0;
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, vs_index);
- for (i = 0; i < lpfs->info.num_inputs; i++) {
+ for (i = 0; i < lpfs->info.base.num_inputs; i++) {
/*
* Search for each input in current vs output:
*/
vs_index = draw_find_shader_output(llvmpipe->draw,
- lpfs->info.input_semantic_name[i],
- lpfs->info.input_semantic_index[i]);
- if (vs_index < 0) {
- /*
- * This can happen with sprite coordinates - the vertex
- * shader doesn't need to provide an output as we generate
- * them internally. However, lets keep pretending that there
- * is something there to not confuse other code.
- */
- vs_index = 0;
- }
-
- /* This can be pre-computed, except for flatshade:
- */
- inputs[i].usage_mask = lpfs->info.input_usage_mask[i];
-
- switch (lpfs->info.input_interpolate[i]) {
- case TGSI_INTERPOLATE_CONSTANT:
- inputs[i].interp = LP_INTERP_CONSTANT;
- break;
- case TGSI_INTERPOLATE_LINEAR:
- inputs[i].interp = LP_INTERP_LINEAR;
- break;
- case TGSI_INTERPOLATE_PERSPECTIVE:
- inputs[i].interp = LP_INTERP_PERSPECTIVE;
- break;
- default:
- assert(0);
- break;
- }
-
- switch (lpfs->info.input_semantic_name[i]) {
- case TGSI_SEMANTIC_FACE:
- inputs[i].interp = LP_INTERP_FACING;
- break;
- case TGSI_SEMANTIC_POSITION:
- /* Position was already emitted above
- */
- inputs[i].interp = LP_INTERP_POSITION;
- inputs[i].src_index = 0;
- continue;
- case TGSI_SEMANTIC_COLOR:
- /* Colors are linearly inputs[i].interpolated in the fragment shader
- * even when flatshading is active. This just tells the
- * setup module to use coefficients with ddx==0 and
- * ddy==0.
- */
- if (llvmpipe->rasterizer->flatshade)
- inputs[i].interp = LP_INTERP_CONSTANT;
- break;
-
- default:
- break;
- }
+ lpfs->info.base.input_semantic_name[i],
+ lpfs->info.base.input_semantic_index[i]);
/*
* Emit the requested fs attribute for all but position.
*/
-
- inputs[i].src_index = vinfo->num_attribs;
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, vs_index);
}
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index);
}
- llvmpipe->num_inputs = lpfs->info.num_inputs;
-
draw_compute_vertex_size(vinfo);
-
lp_setup_set_vertex_info(llvmpipe->setup, vinfo);
-
- lp_setup_set_fs_inputs(llvmpipe->setup,
- inputs,
- lpfs->info.num_inputs);
}
LP_NEW_QUERY))
llvmpipe_update_fs( llvmpipe );
+ if (llvmpipe->dirty & (LP_NEW_FS |
+ LP_NEW_RASTERIZER))
+ llvmpipe_update_setup( llvmpipe );
+
if (llvmpipe->dirty & LP_NEW_BLEND_COLOR)
lp_setup_set_blend_color(llvmpipe->setup,
&llvmpipe->blend_color);
lp_setup_set_fs_constants(llvmpipe->setup,
llvmpipe->constants[PIPE_SHADER_FRAGMENT][0]);
- if (llvmpipe->dirty & (LP_NEW_SAMPLER_VIEW |
- LP_NEW_SAMPLER))
+ if (llvmpipe->dirty & (LP_NEW_SAMPLER_VIEW))
lp_setup_set_fragment_sampler_views(llvmpipe->setup,
llvmpipe->num_fragment_sampler_views,
- llvmpipe->fragment_sampler_views,
+ llvmpipe->fragment_sampler_views);
+
+ if (llvmpipe->dirty & (LP_NEW_SAMPLER))
+ lp_setup_set_fragment_sampler_state(llvmpipe->setup,
+ llvmpipe->num_samplers,
llvmpipe->sampler);
llvmpipe->dirty = 0;
#include <llvm-c/Analysis.h>
+#include <llvm-c/BitWriter.h>
static unsigned fs_no = 0;
-/**
- * Generate the depth /stencil test code.
- */
-static void
-generate_depth_stencil(LLVMBuilderRef builder,
- const struct lp_fragment_shader_variant_key *key,
- struct lp_type src_type,
- struct lp_build_mask_context *mask,
- LLVMValueRef stencil_refs[2],
- LLVMValueRef src,
- LLVMValueRef dst_ptr,
- LLVMValueRef facing,
- LLVMValueRef counter)
-{
- const struct util_format_description *format_desc;
- struct lp_type dst_type;
-
- if (!key->depth.enabled && !key->stencil[0].enabled && !key->stencil[1].enabled)
- return;
-
- format_desc = util_format_description(key->zsbuf_format);
- assert(format_desc);
-
- /*
- * Depths are expected to be between 0 and 1, even if they are stored in
- * floats. Setting these bits here will ensure that the lp_build_conv() call
- * below won't try to unnecessarily clamp the incoming values.
- */
- if(src_type.floating) {
- src_type.sign = FALSE;
- src_type.norm = TRUE;
- }
- else {
- assert(!src_type.sign);
- assert(src_type.norm);
- }
-
- /* Pick the depth type. */
- dst_type = lp_depth_type(format_desc, src_type.width*src_type.length);
-
- /* FIXME: Cope with a depth test type with a different bit width. */
- assert(dst_type.width == src_type.width);
- assert(dst_type.length == src_type.length);
-
- /* Convert fragment Z from float to integer */
- lp_build_conv(builder, src_type, dst_type, &src, 1, &src, 1);
-
- dst_ptr = LLVMBuildBitCast(builder,
- dst_ptr,
- LLVMPointerType(lp_build_vec_type(dst_type), 0), "");
- lp_build_depth_stencil_test(builder,
- &key->depth,
- key->stencil,
- dst_type,
- format_desc,
- mask,
- stencil_refs,
- src,
- dst_ptr,
- facing,
- counter);
-}
-
/**
* Expand the relevent bits of mask_input to a 4-dword mask for the
}
+#define EARLY_DEPTH_TEST 0x1
+#define LATE_DEPTH_TEST 0x2
+#define EARLY_DEPTH_WRITE 0x4
+#define LATE_DEPTH_WRITE 0x8
+
+static int
+find_output_by_semantic( const struct tgsi_shader_info *info,
+ unsigned semantic,
+ unsigned index )
+{
+ int i;
+
+ for (i = 0; i < info->num_outputs; i++)
+ if (info->output_semantic_name[i] == semantic &&
+ info->output_semantic_index[i] == index)
+ return i;
+
+ return -1;
+}
+
/**
* Generate the fragment shader, depth/stencil test, and alpha tests.
* \param partial_mask if 1, do mask_input testing
*/
static void
-generate_fs(struct llvmpipe_context *lp,
- struct lp_fragment_shader *shader,
+generate_fs(struct lp_fragment_shader *shader,
const struct lp_fragment_shader_variant_key *key,
LLVMBuilderRef builder,
struct lp_type type,
LLVMValueRef context_ptr,
unsigned i,
- const struct lp_build_interp_soa_context *interp,
+ struct lp_build_interp_soa_context *interp,
struct lp_build_sampler_soa *sampler,
LLVMValueRef *pmask,
LLVMValueRef (*color)[4],
LLVMValueRef mask_input,
LLVMValueRef counter)
{
+ const struct util_format_description *zs_format_desc = NULL;
const struct tgsi_token *tokens = shader->base.tokens;
LLVMTypeRef vec_type;
LLVMValueRef consts_ptr;
LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][NUM_CHANNELS];
- LLVMValueRef z = interp->pos[2];
+ LLVMValueRef z;
+ LLVMValueRef zs_value = NULL;
LLVMValueRef stencil_refs[2];
- struct lp_build_flow_context *flow;
struct lp_build_mask_context mask;
- boolean early_depth_stencil_test;
+ boolean simple_shader = (shader->info.base.file_count[TGSI_FILE_SAMPLER] == 0 &&
+ shader->info.base.num_inputs < 3 &&
+ shader->info.base.num_instructions < 8);
unsigned attrib;
unsigned chan;
unsigned cbuf;
+ unsigned depth_mode;
+
+ if (key->depth.enabled ||
+ key->stencil[0].enabled ||
+ key->stencil[1].enabled) {
+
+ zs_format_desc = util_format_description(key->zsbuf_format);
+ assert(zs_format_desc);
+
+ if (!shader->info.base.writes_z) {
+ if (key->alpha.enabled || shader->info.base.uses_kill)
+ /* With alpha test and kill, can do the depth test early
+ * and hopefully eliminate some quads. But need to do a
+ * special deferred depth write once the final mask value
+ * is known.
+ */
+ depth_mode = EARLY_DEPTH_TEST | LATE_DEPTH_WRITE;
+ else
+ depth_mode = EARLY_DEPTH_TEST | EARLY_DEPTH_WRITE;
+ }
+ else {
+ depth_mode = LATE_DEPTH_TEST | LATE_DEPTH_WRITE;
+ }
+
+ if (!(key->depth.enabled && key->depth.writemask) &&
+ !(key->stencil[0].enabled && key->stencil[0].writemask))
+ depth_mode &= ~(LATE_DEPTH_WRITE | EARLY_DEPTH_WRITE);
+ }
+ else {
+ depth_mode = 0;
+ }
assert(i < 4);
consts_ptr = lp_jit_context_constants(builder, context_ptr);
- flow = lp_build_flow_create(builder);
-
memset(outputs, 0, sizeof outputs);
- lp_build_flow_scope_begin(flow);
-
/* Declare the color and z variables */
for(cbuf = 0; cbuf < key->nr_cbufs; cbuf++) {
for(chan = 0; chan < NUM_CHANNELS; ++chan) {
- color[cbuf][chan] = LLVMGetUndef(vec_type);
- lp_build_flow_scope_declare(flow, &color[cbuf][chan]);
+ color[cbuf][chan] = lp_build_alloca(builder, vec_type, "color");
}
}
- lp_build_flow_scope_declare(flow, &z);
/* do triangle edge testing */
if (partial_mask) {
}
/* 'mask' will control execution based on quad's pixel alive/killed state */
- lp_build_mask_begin(&mask, flow, type, *pmask);
-
- early_depth_stencil_test =
- (key->depth.enabled || key->stencil[0].enabled) &&
- !key->alpha.enabled &&
- !shader->info.uses_kill &&
- !shader->info.writes_z;
-
- if (early_depth_stencil_test)
- generate_depth_stencil(builder, key,
- type, &mask,
- stencil_refs, z, depth_ptr, facing, counter);
+ lp_build_mask_begin(&mask, builder, type, *pmask);
+
+ if (!(depth_mode & EARLY_DEPTH_TEST) && !simple_shader)
+ lp_build_mask_check(&mask);
+
+ lp_build_interp_soa_update_pos(interp, i);
+ z = interp->pos[2];
+
+ if (depth_mode & EARLY_DEPTH_TEST) {
+ lp_build_depth_stencil_test(builder,
+ &key->depth,
+ key->stencil,
+ type,
+ zs_format_desc,
+ &mask,
+ stencil_refs,
+ z,
+ depth_ptr, facing,
+ &zs_value,
+ !simple_shader);
+
+ if (depth_mode & EARLY_DEPTH_WRITE) {
+ lp_build_depth_write(builder, zs_format_desc, depth_ptr, zs_value);
+ }
+ }
+ lp_build_interp_soa_update_inputs(interp, i);
+
+ /* Build the actual shader */
lp_build_tgsi_soa(builder, tokens, type, &mask,
consts_ptr, interp->pos, interp->inputs,
- outputs, sampler, &shader->info);
+ outputs, sampler, &shader->info.base);
- /* loop over fragment shader outputs/results */
- for (attrib = 0; attrib < shader->info.num_outputs; ++attrib) {
- for(chan = 0; chan < NUM_CHANNELS; ++chan) {
- if(outputs[attrib][chan]) {
- LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
- lp_build_name(out, "output%u.%u.%c", i, attrib, "xyzw"[chan]);
-
- switch (shader->info.output_semantic_name[attrib]) {
- case TGSI_SEMANTIC_COLOR:
- {
- unsigned cbuf = shader->info.output_semantic_index[attrib];
-
- lp_build_name(out, "color%u.%u.%c", i, attrib, "rgba"[chan]);
-
- /* Alpha test */
- /* XXX: should only test the final assignment to alpha */
- if (cbuf == 0 && chan == 3 && key->alpha.enabled) {
- LLVMValueRef alpha = out;
- LLVMValueRef alpha_ref_value;
- alpha_ref_value = lp_jit_context_alpha_ref_value(builder, context_ptr);
- alpha_ref_value = lp_build_broadcast(builder, vec_type, alpha_ref_value);
- lp_build_alpha_test(builder, key->alpha.func, type,
- &mask, alpha, alpha_ref_value);
- }
-
- color[cbuf][chan] = out;
- break;
- }
-
- case TGSI_SEMANTIC_POSITION:
- if(chan == 2)
- z = out;
- break;
- }
- }
+
+ /* Alpha test */
+ if (key->alpha.enabled) {
+ int color0 = find_output_by_semantic(&shader->info.base,
+ TGSI_SEMANTIC_COLOR,
+ 0);
+
+ if (color0 != -1 && outputs[color0][3]) {
+ LLVMValueRef alpha = LLVMBuildLoad(builder, outputs[color0][3], "alpha");
+ LLVMValueRef alpha_ref_value;
+
+ alpha_ref_value = lp_jit_context_alpha_ref_value(builder, context_ptr);
+ alpha_ref_value = lp_build_broadcast(builder, vec_type, alpha_ref_value);
+
+ lp_build_alpha_test(builder, key->alpha.func, type,
+ &mask, alpha, alpha_ref_value,
+ (depth_mode & LATE_DEPTH_TEST) != 0);
}
}
- if (!early_depth_stencil_test)
- generate_depth_stencil(builder, key,
- type, &mask,
- stencil_refs, z, depth_ptr, facing, counter);
+ /* Late Z test */
+ if (depth_mode & LATE_DEPTH_TEST) {
+ int pos0 = find_output_by_semantic(&shader->info.base,
+ TGSI_SEMANTIC_POSITION,
+ 0);
+
+ if (pos0 != -1 && outputs[pos0][2]) {
+ z = LLVMBuildLoad(builder, outputs[pos0][2], "output.z");
+ }
- lp_build_mask_end(&mask);
+ lp_build_depth_stencil_test(builder,
+ &key->depth,
+ key->stencil,
+ type,
+ zs_format_desc,
+ &mask,
+ stencil_refs,
+ z,
+ depth_ptr, facing,
+ &zs_value,
+ !simple_shader);
+ /* Late Z write */
+ if (depth_mode & LATE_DEPTH_WRITE) {
+ lp_build_depth_write(builder, zs_format_desc, depth_ptr, zs_value);
+ }
+ }
+ else if ((depth_mode & EARLY_DEPTH_TEST) &&
+ (depth_mode & LATE_DEPTH_WRITE))
+ {
+ /* Need to apply a reduced mask to the depth write. Reload the
+ * depth value, update from zs_value with the new mask value and
+ * write that out.
+ */
+ lp_build_deferred_depth_write(builder,
+ type,
+ zs_format_desc,
+ &mask,
+ depth_ptr,
+ zs_value);
+ }
- lp_build_flow_scope_end(flow);
- lp_build_flow_destroy(flow);
+ /* Color write */
+ for (attrib = 0; attrib < shader->info.base.num_outputs; ++attrib)
+ {
+ if (shader->info.base.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR &&
+ shader->info.base.output_semantic_index[attrib] < key->nr_cbufs)
+ {
+ unsigned cbuf = shader->info.base.output_semantic_index[attrib];
+ for(chan = 0; chan < NUM_CHANNELS; ++chan) {
+ if(outputs[attrib][chan]) {
+ /* XXX: just initialize outputs to point at colors[] and
+ * skip this.
+ */
+ LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
+ lp_build_name(out, "color%u.%u.%c", i, attrib, "rgba"[chan]);
+ LLVMBuildStore(builder, out, color[cbuf][chan]);
+ }
+ }
+ }
+ }
- *pmask = mask.value;
+ if (counter)
+ lp_build_occlusion_count(builder, type,
+ lp_build_mask_value(&mask), counter);
+ *pmask = lp_build_mask_end(&mask);
}
LLVMValueRef context_ptr,
LLVMValueRef mask,
LLVMValueRef *src,
- LLVMValueRef dst_ptr)
+ LLVMValueRef dst_ptr,
+ boolean do_branch)
{
struct lp_build_context bld;
- struct lp_build_flow_context *flow;
struct lp_build_mask_context mask_ctx;
LLVMTypeRef vec_type;
LLVMValueRef const_ptr;
lp_build_context_init(&bld, builder, type);
- flow = lp_build_flow_create(builder);
-
- /* we'll use this mask context to skip blending if all pixels are dead */
- lp_build_mask_begin(&mask_ctx, flow, type, mask);
+ lp_build_mask_begin(&mask_ctx, builder, type, mask);
+ if (do_branch)
+ lp_build_mask_check(&mask_ctx);
vec_type = lp_build_vec_type(type);
}
lp_build_mask_end(&mask_ctx);
- lp_build_flow_destroy(flow);
}
* 2x2 pixels.
*/
static void
-generate_fragment(struct llvmpipe_context *lp,
+generate_fragment(struct llvmpipe_screen *screen,
struct lp_fragment_shader *shader,
struct lp_fragment_shader_variant *variant,
unsigned partial_mask)
{
- struct llvmpipe_screen *screen = llvmpipe_screen(lp->pipe.screen);
const struct lp_fragment_shader_variant_key *key = &variant->key;
+ struct lp_shader_input inputs[PIPE_MAX_SHADER_INPUTS];
char func_name[256];
struct lp_type fs_type;
struct lp_type blend_type;
LLVMValueRef blend_mask;
LLVMValueRef function;
LLVMValueRef facing;
+ const struct util_format_description *zs_format_desc;
unsigned num_fs;
unsigned i;
unsigned chan;
unsigned cbuf;
+ /* Adjust color input interpolation according to flatshade state:
+ */
+ memcpy(inputs, shader->inputs, shader->info.base.num_inputs * sizeof inputs[0]);
+ for (i = 0; i < shader->info.base.num_inputs; i++) {
+ if (inputs[i].interp == LP_INTERP_COLOR) {
+ if (key->flatshade)
+ inputs[i].interp = LP_INTERP_CONSTANT;
+ else
+ inputs[i].interp = LP_INTERP_LINEAR;
+ }
+ }
+
/* TODO: actually pick these based on the fs and color buffer
* characteristics. */
arg_types[0] = screen->context_ptr_type; /* context */
arg_types[1] = LLVMInt32Type(); /* x */
arg_types[2] = LLVMInt32Type(); /* y */
- arg_types[3] = LLVMFloatType(); /* facing */
+ arg_types[3] = LLVMInt32Type(); /* facing */
arg_types[4] = LLVMPointerType(fs_elem_type, 0); /* a0 */
arg_types[5] = LLVMPointerType(fs_elem_type, 0); /* dadx */
arg_types[6] = LLVMPointerType(fs_elem_type, 0); /* dady */
arg_types[7] = LLVMPointerType(LLVMPointerType(blend_vec_type, 0), 0); /* color */
- arg_types[8] = LLVMPointerType(fs_int_vec_type, 0); /* depth */
+ arg_types[8] = LLVMPointerType(LLVMInt8Type(), 0); /* depth */
arg_types[9] = LLVMInt32Type(); /* mask_input */
arg_types[10] = LLVMPointerType(LLVMInt32Type(), 0);/* counter */
variant->function[partial_mask] = function;
-
/* XXX: need to propagate noalias down into color param now we are
* passing a pointer-to-pointer?
*/
* already included in the shader key.
*/
lp_build_interp_soa_init(&interp,
- lp->num_inputs,
- lp->inputs,
+ shader->info.base.num_inputs,
+ inputs,
builder, fs_type,
a0_ptr, dadx_ptr, dady_ptr,
x, y);
sampler = lp_llvm_sampler_soa_create(key->sampler, context_ptr);
/* loop over quads in the block */
+ zs_format_desc = util_format_description(key->zsbuf_format);
+
for(i = 0; i < num_fs; ++i) {
- LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+ LLVMValueRef depth_offset = LLVMConstInt(LLVMInt32Type(),
+ i*fs_type.length*zs_format_desc->block.bits/8,
+ 0);
LLVMValueRef out_color[PIPE_MAX_COLOR_BUFS][NUM_CHANNELS];
LLVMValueRef depth_ptr_i;
- if(i != 0)
- lp_build_interp_soa_update(&interp, i);
+ depth_ptr_i = LLVMBuildGEP(builder, depth_ptr, &depth_offset, 1, "");
- depth_ptr_i = LLVMBuildGEP(builder, depth_ptr, &index, 1, "");
-
- generate_fs(lp, shader, key,
+ generate_fs(shader, key,
builder,
fs_type,
context_ptr,
* Convert the fs's output color and mask to fit to the blending type.
*/
for(chan = 0; chan < NUM_CHANNELS; ++chan) {
+ LLVMValueRef fs_color_vals[LP_MAX_VECTOR_LENGTH];
+
+ for (i = 0; i < num_fs; i++) {
+ fs_color_vals[i] =
+ LLVMBuildLoad(builder, fs_out_color[cbuf][chan][i], "fs_color_vals");
+ }
+
lp_build_conv(builder, fs_type, blend_type,
- fs_out_color[cbuf][chan], num_fs,
+ fs_color_vals,
+ num_fs,
&blend_in_color[chan], 1);
+
lp_build_name(blend_in_color[chan], "color%d.%c", cbuf, "rgba"[chan]);
}
/*
* Blending.
*/
- generate_blend(&key->blend,
- rt,
- builder,
- blend_type,
- context_ptr,
- blend_mask,
- blend_in_color,
- color_ptr);
+ {
+ /* Could the 4x4 have been killed?
+ */
+ boolean do_branch = ((key->depth.enabled || key->stencil[0].enabled) &&
+ !key->alpha.enabled &&
+ !shader->info.base.uses_kill);
+
+ generate_blend(&key->blend,
+ rt,
+ builder,
+ blend_type,
+ context_ptr,
+ blend_mask,
+ blend_in_color,
+ color_ptr,
+ do_branch);
+ }
}
#ifdef PIPE_ARCH_X86
/* Apply optimizations to LLVM IR */
LLVMRunFunctionPassManager(screen->pass, function);
- if (gallivm_debug & GALLIVM_DEBUG_IR) {
+ if ((gallivm_debug & GALLIVM_DEBUG_IR) || (LP_DEBUG & DEBUG_FS)) {
/* Print the LLVM IR to stderr */
lp_debug_dump_value(function);
debug_printf("\n");
}
+ /* Dump byte code to a file */
+ if (0) {
+ LLVMWriteBitcodeToFile(lp_build_module, "llvmpipe.bc");
+ }
+
/*
* Translate the LLVM IR into machine code.
*/
variant->jit_function[partial_mask] = (lp_jit_frag_func)pointer_to_func(f);
- if (gallivm_debug & GALLIVM_DEBUG_ASM) {
+ if ((gallivm_debug & GALLIVM_DEBUG_ASM) || (LP_DEBUG & DEBUG_FS)) {
lp_disassemble(f);
}
lp_func_delete_body(function);
debug_printf("fs variant %p:\n", (void *) key);
+ if (key->flatshade) {
+ debug_printf("flatshade = 1\n");
+ }
for (i = 0; i < key->nr_cbufs; ++i) {
debug_printf("cbuf_format[%u] = %s\n", i, util_format_name(key->cbuf_format[i]));
}
debug_printf("alpha.func = %s\n", util_dump_func(key->alpha.func, TRUE));
}
+ if (key->occlusion_count) {
+ debug_printf("occlusion_count = 1\n");
+ }
+
if (key->blend.logicop_enable) {
debug_printf("blend.logicop_func = %s\n", util_dump_logicop(key->blend.logicop_func, TRUE));
}
debug_printf("blend.alpha_dst_factor = %s\n", util_dump_blend_factor(key->blend.rt[0].alpha_dst_factor, TRUE));
}
debug_printf("blend.colormask = 0x%x\n", key->blend.rt[0].colormask);
- for (i = 0; i < PIPE_MAX_SAMPLERS; ++i) {
- if (key->sampler[i].format) {
- debug_printf("sampler[%u] = \n", i);
- debug_printf(" .format = %s\n",
- util_format_name(key->sampler[i].format));
- debug_printf(" .target = %s\n",
- util_dump_tex_target(key->sampler[i].target, TRUE));
- debug_printf(" .pot = %u %u %u\n",
- key->sampler[i].pot_width,
- key->sampler[i].pot_height,
- key->sampler[i].pot_depth);
- debug_printf(" .wrap = %s %s %s\n",
- util_dump_tex_wrap(key->sampler[i].wrap_s, TRUE),
- util_dump_tex_wrap(key->sampler[i].wrap_t, TRUE),
- util_dump_tex_wrap(key->sampler[i].wrap_r, TRUE));
- debug_printf(" .min_img_filter = %s\n",
- util_dump_tex_filter(key->sampler[i].min_img_filter, TRUE));
- debug_printf(" .min_mip_filter = %s\n",
- util_dump_tex_mipfilter(key->sampler[i].min_mip_filter, TRUE));
- debug_printf(" .mag_img_filter = %s\n",
- util_dump_tex_filter(key->sampler[i].mag_img_filter, TRUE));
- if (key->sampler[i].compare_mode != PIPE_TEX_COMPARE_NONE)
- debug_printf(" .compare_func = %s\n", util_dump_func(key->sampler[i].compare_func, TRUE));
- debug_printf(" .normalized_coords = %u\n", key->sampler[i].normalized_coords);
- }
+ for (i = 0; i < key->nr_samplers; ++i) {
+ debug_printf("sampler[%u] = \n", i);
+ debug_printf(" .format = %s\n",
+ util_format_name(key->sampler[i].format));
+ debug_printf(" .target = %s\n",
+ util_dump_tex_target(key->sampler[i].target, TRUE));
+ debug_printf(" .pot = %u %u %u\n",
+ key->sampler[i].pot_width,
+ key->sampler[i].pot_height,
+ key->sampler[i].pot_depth);
+ debug_printf(" .wrap = %s %s %s\n",
+ util_dump_tex_wrap(key->sampler[i].wrap_s, TRUE),
+ util_dump_tex_wrap(key->sampler[i].wrap_t, TRUE),
+ util_dump_tex_wrap(key->sampler[i].wrap_r, TRUE));
+ debug_printf(" .min_img_filter = %s\n",
+ util_dump_tex_filter(key->sampler[i].min_img_filter, TRUE));
+ debug_printf(" .min_mip_filter = %s\n",
+ util_dump_tex_mipfilter(key->sampler[i].min_mip_filter, TRUE));
+ debug_printf(" .mag_img_filter = %s\n",
+ util_dump_tex_filter(key->sampler[i].mag_img_filter, TRUE));
+ if (key->sampler[i].compare_mode != PIPE_TEX_COMPARE_NONE)
+ debug_printf(" .compare_func = %s\n", util_dump_func(key->sampler[i].compare_func, TRUE));
+ debug_printf(" .normalized_coords = %u\n", key->sampler[i].normalized_coords);
+ debug_printf(" .min_max_lod_equal = %u\n", key->sampler[i].min_max_lod_equal);
+ debug_printf(" .lod_bias_non_zero = %u\n", key->sampler[i].lod_bias_non_zero);
+ debug_printf(" .apply_min_lod = %u\n", key->sampler[i].apply_min_lod);
+ debug_printf(" .apply_max_lod = %u\n", key->sampler[i].apply_max_lod);
}
}
}
static struct lp_fragment_shader_variant *
-generate_variant(struct llvmpipe_context *lp,
+generate_variant(struct llvmpipe_screen *screen,
struct lp_fragment_shader *shader,
const struct lp_fragment_shader_variant_key *key)
{
!key->stencil[0].enabled &&
!key->alpha.enabled &&
!key->depth.enabled &&
- !shader->info.uses_kill
+ !shader->info.base.uses_kill
? TRUE : FALSE;
lp_debug_fs_variant(variant);
}
- generate_fragment(lp, shader, variant, RAST_EDGE_TEST);
+ generate_fragment(screen, shader, variant, RAST_EDGE_TEST);
if (variant->opaque) {
/* Specialized shader, which doesn't need to read the color buffer. */
- generate_fragment(lp, shader, variant, RAST_WHOLE);
+ generate_fragment(screen, shader, variant, RAST_WHOLE);
} else {
variant->jit_function[RAST_WHOLE] = variant->jit_function[RAST_EDGE_TEST];
}
struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
struct lp_fragment_shader *shader;
int nr_samplers;
+ int i;
shader = CALLOC_STRUCT(lp_fragment_shader);
if (!shader)
make_empty_list(&shader->variants);
/* get/save the summary info for this shader */
- tgsi_scan_shader(templ->tokens, &shader->info);
+ lp_build_tgsi_info(templ->tokens, &shader->info);
/* we need to keep a local copy of the tokens */
shader->base.tokens = tgsi_dup_tokens(templ->tokens);
return NULL;
}
- nr_samplers = shader->info.file_max[TGSI_FILE_SAMPLER] + 1;
+ nr_samplers = shader->info.base.file_max[TGSI_FILE_SAMPLER] + 1;
shader->variant_key_size = Offset(struct lp_fragment_shader_variant_key,
sampler[nr_samplers]);
+ for (i = 0; i < shader->info.base.num_inputs; i++) {
+ shader->inputs[i].usage_mask = shader->info.base.input_usage_mask[i];
+
+ switch (shader->info.base.input_interpolate[i]) {
+ case TGSI_INTERPOLATE_CONSTANT:
+ shader->inputs[i].interp = LP_INTERP_CONSTANT;
+ break;
+ case TGSI_INTERPOLATE_LINEAR:
+ shader->inputs[i].interp = LP_INTERP_LINEAR;
+ break;
+ case TGSI_INTERPOLATE_PERSPECTIVE:
+ shader->inputs[i].interp = LP_INTERP_PERSPECTIVE;
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ switch (shader->info.base.input_semantic_name[i]) {
+ case TGSI_SEMANTIC_COLOR:
+ /* Colors may be either linearly or constant interpolated in
+ * the fragment shader, but that information isn't available
+ * here. Mark color inputs and fix them up later.
+ */
+ shader->inputs[i].interp = LP_INTERP_COLOR;
+ break;
+ case TGSI_SEMANTIC_FACE:
+ shader->inputs[i].interp = LP_INTERP_FACING;
+ break;
+ case TGSI_SEMANTIC_POSITION:
+ /* Position was already emitted above
+ */
+ shader->inputs[i].interp = LP_INTERP_POSITION;
+ shader->inputs[i].src_index = 0;
+ continue;
+ }
+
+ shader->inputs[i].src_index = i+1;
+ }
+
if (LP_DEBUG & DEBUG_TGSI) {
unsigned attrib;
debug_printf("llvmpipe: Create fragment shader #%u %p:\n", shader->no, (void *) shader);
tgsi_dump(templ->tokens, 0);
debug_printf("usage masks:\n");
- for (attrib = 0; attrib < shader->info.num_inputs; ++attrib) {
- unsigned usage_mask = shader->info.input_usage_mask[attrib];
+ for (attrib = 0; attrib < shader->info.base.num_inputs; ++attrib) {
+ unsigned usage_mask = shader->info.base.input_usage_mask[attrib];
debug_printf(" IN[%u].%s%s%s%s\n",
attrib,
usage_mask & TGSI_WRITEMASK_X ? "x" : "",
/* This value will be the same for all the variants of a given shader:
*/
- key->nr_samplers = shader->info.file_max[TGSI_FILE_SAMPLER] + 1;
+ key->nr_samplers = shader->info.base.file_max[TGSI_FILE_SAMPLER] + 1;
for(i = 0; i < key->nr_samplers; ++i) {
- if(shader->info.file_mask[TGSI_FILE_SAMPLER] & (1 << i)) {
+ if(shader->info.base.file_mask[TGSI_FILE_SAMPLER] & (1 << i)) {
lp_sampler_static_state(&key->sampler[i],
lp->fragment_sampler_views[i],
lp->sampler[i]);
void
llvmpipe_update_fs(struct llvmpipe_context *lp)
{
+ struct llvmpipe_screen *screen = llvmpipe_screen(lp->pipe.screen);
struct lp_fragment_shader *shader = lp->fs;
struct lp_fragment_shader_variant_key key;
struct lp_fragment_shader_variant *variant = NULL;
}
t0 = os_time_get();
- variant = generate_variant(lp, shader, &key);
+ variant = generate_variant(screen, shader, &key);
t1 = os_time_get();
dt = t1 - t0;
+
+
+
+
void
llvmpipe_init_fs_funcs(struct llvmpipe_context *llvmpipe)
{
#include "pipe/p_state.h"
#include "tgsi/tgsi_scan.h" /* for tgsi_shader_info */
#include "gallivm/lp_bld_sample.h" /* for struct lp_sampler_static_state */
+#include "gallivm/lp_bld_tgsi.h" /* for lp_tgsi_info */
+#include "lp_bld_interp.h" /* for struct lp_shader_input */
struct tgsi_token;
{
struct pipe_shader_state base;
- struct tgsi_shader_info info;
+ struct lp_tgsi_info info;
struct lp_fs_variant_list_item variants;
unsigned no;
unsigned variants_created;
unsigned variants_cached;
+
+ /** Fragment shader input interpolation info */
+ struct lp_shader_input inputs[PIPE_MAX_SHADER_INPUTS];
};
struct pipe_sampler_view **views)
{
unsigned i;
- uint32_t row_stride[DRAW_MAX_TEXTURE_LEVELS];
- uint32_t img_stride[DRAW_MAX_TEXTURE_LEVELS];
- const void *data[DRAW_MAX_TEXTURE_LEVELS];
+ uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS];
+ uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
+ const void *data[PIPE_MAX_TEXTURE_LEVELS];
assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
if (!num)
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2010 VMware.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "util/u_simple_list.h"
+#include "os/os_time.h"
+#include "gallivm/lp_bld_debug.h"
+#include "gallivm/lp_bld_init.h"
+#include "gallivm/lp_bld_intr.h"
+#include <llvm-c/Analysis.h> /* for LLVMVerifyFunction */
+
+#include "lp_perf.h"
+#include "lp_debug.h"
+#include "lp_flush.h"
+#include "lp_screen.h"
+#include "lp_context.h"
+#include "lp_setup_context.h"
+#include "lp_rast.h"
+#include "lp_state.h"
+#include "lp_state_fs.h"
+#include "lp_state_setup.h"
+
+
+
+/* currently organized to interpolate full float[4] attributes even
+ * when some elements are unused. Later, can pack vertex data more
+ * closely.
+ */
+
+
+struct lp_setup_args
+{
+ /* Function arguments:
+ */
+ LLVMValueRef v0;
+ LLVMValueRef v1;
+ LLVMValueRef v2;
+ LLVMValueRef facing; /* boolean */
+ LLVMValueRef a0;
+ LLVMValueRef dadx;
+ LLVMValueRef dady;
+
+ /* Derived:
+ */
+ LLVMValueRef x0_center;
+ LLVMValueRef y0_center;
+ LLVMValueRef dy20_ooa;
+ LLVMValueRef dy01_ooa;
+ LLVMValueRef dx20_ooa;
+ LLVMValueRef dx01_ooa;
+};
+
+static LLVMTypeRef type4f(void)
+{
+ return LLVMVectorType(LLVMFloatType(), 4);
+}
+
+
+/* Equivalent of _mm_setr_ps(a,b,c,d)
+ */
+static LLVMValueRef vec4f(LLVMBuilderRef bld,
+ LLVMValueRef a, LLVMValueRef b, LLVMValueRef c, LLVMValueRef d,
+ const char *name)
+{
+ LLVMValueRef i0 = LLVMConstInt(LLVMInt32Type(), 0, 0);
+ LLVMValueRef i1 = LLVMConstInt(LLVMInt32Type(), 1, 0);
+ LLVMValueRef i2 = LLVMConstInt(LLVMInt32Type(), 2, 0);
+ LLVMValueRef i3 = LLVMConstInt(LLVMInt32Type(), 3, 0);
+
+ LLVMValueRef res = LLVMGetUndef(type4f());
+
+ res = LLVMBuildInsertElement(bld, res, a, i0, "");
+ res = LLVMBuildInsertElement(bld, res, b, i1, "");
+ res = LLVMBuildInsertElement(bld, res, c, i2, "");
+ res = LLVMBuildInsertElement(bld, res, d, i3, name);
+
+ return res;
+}
+
+/* Equivalent of _mm_set1_ps(a)
+ */
+static LLVMValueRef vec4f_from_scalar(LLVMBuilderRef bld,
+ LLVMValueRef a,
+ const char *name)
+{
+ LLVMValueRef res = LLVMGetUndef(type4f());
+ int i;
+
+ for(i = 0; i < 4; ++i) {
+ LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
+ res = LLVMBuildInsertElement(bld, res, a, index, i == 3 ? name : "");
+ }
+
+ return res;
+}
+
+static void
+store_coef(LLVMBuilderRef builder,
+ struct lp_setup_args *args,
+ unsigned slot,
+ LLVMValueRef a0,
+ LLVMValueRef dadx,
+ LLVMValueRef dady)
+{
+ LLVMValueRef idx = LLVMConstInt(LLVMInt32Type(), slot, 0);
+
+ LLVMBuildStore(builder,
+ a0,
+ LLVMBuildGEP(builder, args->a0, &idx, 1, ""));
+
+ LLVMBuildStore(builder,
+ dadx,
+ LLVMBuildGEP(builder, args->dadx, &idx, 1, ""));
+
+ LLVMBuildStore(builder,
+ dady,
+ LLVMBuildGEP(builder, args->dady, &idx, 1, ""));
+}
+
+
+
+static void
+emit_constant_coef4( LLVMBuilderRef builder,
+ struct lp_setup_args *args,
+ unsigned slot,
+ LLVMValueRef vert,
+ unsigned attr)
+{
+ LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0);
+ LLVMValueRef zerovec = vec4f_from_scalar(builder, zero, "zero");
+ LLVMValueRef idx = LLVMConstInt(LLVMInt32Type(), attr, 0);
+ LLVMValueRef attr_ptr = LLVMBuildGEP(builder, vert, &idx, 1, "attr_ptr");
+ LLVMValueRef vert_attr = LLVMBuildLoad(builder, attr_ptr, "vert_attr");
+
+ store_coef(builder, args, slot, vert_attr, zerovec, zerovec);
+}
+
+
+
+/**
+ * Setup the fragment input attribute with the front-facing value.
+ * \param frontface is the triangle front facing?
+ */
+static void
+emit_facing_coef( LLVMBuilderRef builder,
+ struct lp_setup_args *args,
+ unsigned slot )
+{
+ LLVMValueRef a0_0 = args->facing;
+ LLVMValueRef a0_0f = LLVMBuildSIToFP(builder, a0_0, LLVMFloatType(), "");
+ LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0);
+ LLVMValueRef a0 = vec4f(builder, a0_0f, zero, zero, zero, "facing");
+ LLVMValueRef zerovec = vec4f_from_scalar(builder, zero, "zero");
+
+ store_coef(builder, args, slot, a0, zerovec, zerovec);
+}
+
+
+static LLVMValueRef
+vert_attrib(LLVMBuilderRef b,
+ LLVMValueRef vert,
+ int attr,
+ int elem,
+ const char *name)
+{
+ LLVMValueRef idx[2];
+ idx[0] = LLVMConstInt(LLVMInt32Type(), attr, 0);
+ idx[1] = LLVMConstInt(LLVMInt32Type(), elem, 0);
+ return LLVMBuildLoad(b, LLVMBuildGEP(b, vert, idx, 2, ""), name);
+}
+
+
+
+static void
+emit_coef4( LLVMBuilderRef b,
+ struct lp_setup_args *args,
+ unsigned slot,
+ LLVMValueRef a0,
+ LLVMValueRef a1,
+ LLVMValueRef a2)
+{
+ LLVMValueRef dy20_ooa = args->dy20_ooa;
+ LLVMValueRef dy01_ooa = args->dy01_ooa;
+ LLVMValueRef dx20_ooa = args->dx20_ooa;
+ LLVMValueRef dx01_ooa = args->dx01_ooa;
+ LLVMValueRef x0_center = args->x0_center;
+ LLVMValueRef y0_center = args->y0_center;
+
+ /* XXX: using fsub, fmul on vector types -- does this work??
+ */
+ LLVMValueRef da01 = LLVMBuildFSub(b, a0, a1, "da01");
+ LLVMValueRef da20 = LLVMBuildFSub(b, a2, a0, "da20");
+
+ /* Calculate dadx (vec4f)
+ */
+ LLVMValueRef da01_dy20_ooa = LLVMBuildFMul(b, da01, dy20_ooa, "da01_dy20_ooa");
+ LLVMValueRef da20_dy01_ooa = LLVMBuildFMul(b, da20, dy01_ooa, "da20_dy01_ooa");
+ LLVMValueRef dadx = LLVMBuildFSub(b, da01_dy20_ooa, da20_dy01_ooa, "dadx");
+
+ /* Calculate dady (vec4f)
+ */
+ LLVMValueRef da01_dx20_ooa = LLVMBuildFMul(b, da01, dx20_ooa, "da01_dx20_ooa");
+ LLVMValueRef da20_dx01_ooa = LLVMBuildFMul(b, da20, dx01_ooa, "da20_dx01_ooa");
+ LLVMValueRef dady = LLVMBuildFSub(b, da20_dx01_ooa, da01_dx20_ooa, "dady");
+
+ /* Calculate a0 - the attribute value at the origin
+ */
+ LLVMValueRef dadx_x0 = LLVMBuildFMul(b, dadx, x0_center, "dadx_x0");
+ LLVMValueRef dady_y0 = LLVMBuildFMul(b, dady, y0_center, "dady_y0");
+ LLVMValueRef attr_v0 = LLVMBuildFAdd(b, dadx_x0, dady_y0, "attr_v0");
+ LLVMValueRef attr_0 = LLVMBuildFSub(b, a0, attr_v0, "attr_0");
+
+ store_coef(b, args, slot, attr_0, dadx, dady);
+}
+
+
+static void
+emit_linear_coef( LLVMBuilderRef b,
+ struct lp_setup_args *args,
+ unsigned slot,
+ unsigned vert_attr)
+{
+ LLVMValueRef idx = LLVMConstInt(LLVMInt32Type(), vert_attr, 0);
+
+ LLVMValueRef a0 = LLVMBuildLoad(b, LLVMBuildGEP(b, args->v0, &idx, 1, ""), "v0a");
+ LLVMValueRef a1 = LLVMBuildLoad(b, LLVMBuildGEP(b, args->v1, &idx, 1, ""), "v1a");
+ LLVMValueRef a2 = LLVMBuildLoad(b, LLVMBuildGEP(b, args->v2, &idx, 1, ""), "v2a");
+
+ emit_coef4(b, args, slot, a0, a1, a2);
+}
+
+
+
+/**
+ * Compute a0, dadx and dady for a perspective-corrected interpolant,
+ * for a triangle.
+ * We basically multiply the vertex value by 1/w before computing
+ * the plane coefficients (a0, dadx, dady).
+ * Later, when we compute the value at a particular fragment position we'll
+ * divide the interpolated value by the interpolated W at that fragment.
+ */
+static void
+emit_perspective_coef( LLVMBuilderRef b,
+ struct lp_setup_args *args,
+ unsigned slot,
+ unsigned vert_attr)
+{
+ /* premultiply by 1/w (v[0][3] is always 1/w):
+ */
+ LLVMValueRef idx = LLVMConstInt(LLVMInt32Type(), vert_attr, 0);
+
+ LLVMValueRef v0a = LLVMBuildLoad(b, LLVMBuildGEP(b, args->v0, &idx, 1, ""), "v0a");
+ LLVMValueRef v1a = LLVMBuildLoad(b, LLVMBuildGEP(b, args->v1, &idx, 1, ""), "v1a");
+ LLVMValueRef v2a = LLVMBuildLoad(b, LLVMBuildGEP(b, args->v2, &idx, 1, ""), "v2a");
+
+ LLVMValueRef v0_oow = vec4f_from_scalar(b, vert_attrib(b, args->v0, 0, 3, ""), "v0_oow");
+ LLVMValueRef v1_oow = vec4f_from_scalar(b, vert_attrib(b, args->v1, 0, 3, ""), "v1_oow");
+ LLVMValueRef v2_oow = vec4f_from_scalar(b, vert_attrib(b, args->v2, 0, 3, ""), "v2_oow");
+
+ LLVMValueRef v0_oow_v0a = LLVMBuildFMul(b, v0a, v0_oow, "v0_oow_v0a");
+ LLVMValueRef v1_oow_v1a = LLVMBuildFMul(b, v1a, v1_oow, "v1_oow_v1a");
+ LLVMValueRef v2_oow_v2a = LLVMBuildFMul(b, v2a, v2_oow, "v2_oow_v2a");
+
+ emit_coef4(b, args, slot, v0_oow_v0a, v1_oow_v1a, v2_oow_v2a);
+}
+
+
+static void
+emit_position_coef( LLVMBuilderRef builder,
+ struct lp_setup_args *args,
+ int slot, int attrib )
+{
+ emit_linear_coef(builder, args, slot, attrib);
+}
+
+
+
+
+/**
+ * Compute the inputs-> dadx, dady, a0 values.
+ */
+static void
+emit_tri_coef( LLVMBuilderRef builder,
+ const struct lp_setup_variant_key *key,
+ struct lp_setup_args *args )
+{
+ unsigned slot;
+
+ /* The internal position input is in slot zero:
+ */
+ emit_position_coef(builder, args, 0, 0);
+
+ /* setup interpolation for all the remaining attributes:
+ */
+ for (slot = 0; slot < key->num_inputs; slot++) {
+ unsigned vert_attr = key->inputs[slot].src_index;
+
+ switch (key->inputs[slot].interp) {
+ case LP_INTERP_CONSTANT:
+ if (key->flatshade_first) {
+ emit_constant_coef4(builder, args, slot+1, args->v0, vert_attr);
+ }
+ else {
+ emit_constant_coef4(builder, args, slot+1, args->v2, vert_attr);
+ }
+ break;
+
+ case LP_INTERP_LINEAR:
+ emit_linear_coef(builder, args, slot+1, vert_attr);
+ break;
+
+ case LP_INTERP_PERSPECTIVE:
+ emit_perspective_coef(builder, args, slot+1, vert_attr);
+ break;
+
+ case LP_INTERP_POSITION:
+ /*
+ * The generated pixel interpolators will pick up the coeffs from
+ * slot 0.
+ */
+ break;
+
+ case LP_INTERP_FACING:
+ emit_facing_coef(builder, args, slot+1);
+ break;
+
+ default:
+ assert(0);
+ }
+ }
+}
+
+
+/* XXX: This is generic code, share with fs/vs codegen:
+ */
+static lp_jit_setup_triangle
+finalize_function(struct llvmpipe_screen *screen,
+ LLVMBuilderRef builder,
+ LLVMValueRef function)
+{
+ void *f;
+
+ /* Verify the LLVM IR. If invalid, dump and abort */
+#ifdef DEBUG
+ if (LLVMVerifyFunction(function, LLVMPrintMessageAction)) {
+ if (1)
+ lp_debug_dump_value(function);
+ abort();
+ }
+#endif
+
+ /* Apply optimizations to LLVM IR */
+ LLVMRunFunctionPassManager(screen->pass, function);
+
+ if (gallivm_debug & GALLIVM_DEBUG_IR)
+ {
+ /* Print the LLVM IR to stderr */
+ lp_debug_dump_value(function);
+ debug_printf("\n");
+ }
+
+ /*
+ * Translate the LLVM IR into machine code.
+ */
+ f = LLVMGetPointerToGlobal(screen->engine, function);
+
+ if (gallivm_debug & GALLIVM_DEBUG_ASM)
+ {
+ lp_disassemble(f);
+ }
+
+ lp_func_delete_body(function);
+
+ return f;
+}
+
+/* XXX: Generic code:
+ */
+static void
+lp_emit_emms(LLVMBuilderRef builder)
+{
+#ifdef PIPE_ARCH_X86
+ /* Avoid corrupting the FPU stack on 32bit OSes. */
+ lp_build_intrinsic(builder, "llvm.x86.mmx.emms", LLVMVoidType(), NULL, 0);
+#endif
+}
+
+
+/* XXX: generic code:
+ */
+static void
+set_noalias(LLVMBuilderRef builder,
+ LLVMValueRef function,
+ const LLVMTypeRef *arg_types,
+ int nr_args)
+{
+ int i;
+ for(i = 0; i < Elements(arg_types); ++i)
+ if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
+ LLVMAddAttribute(LLVMGetParam(function, i),
+ LLVMNoAliasAttribute);
+}
+
+static void
+init_args(LLVMBuilderRef b,
+ struct lp_setup_args *args,
+ const struct lp_setup_variant *variant)
+{
+ LLVMValueRef v0_x = vert_attrib(b, args->v0, 0, 0, "v0_x");
+ LLVMValueRef v0_y = vert_attrib(b, args->v0, 0, 1, "v0_y");
+
+ LLVMValueRef v1_x = vert_attrib(b, args->v1, 0, 0, "v1_x");
+ LLVMValueRef v1_y = vert_attrib(b, args->v1, 0, 1, "v1_y");
+
+ LLVMValueRef v2_x = vert_attrib(b, args->v2, 0, 0, "v2_x");
+ LLVMValueRef v2_y = vert_attrib(b, args->v2, 0, 1, "v2_y");
+
+ LLVMValueRef pixel_center = LLVMConstReal(LLVMFloatType(),
+ variant->key.pixel_center_half ? 0.5 : 0);
+
+ LLVMValueRef x0_center = LLVMBuildFSub(b, v0_x, pixel_center, "x0_center" );
+ LLVMValueRef y0_center = LLVMBuildFSub(b, v0_y, pixel_center, "y0_center" );
+
+ LLVMValueRef dx01 = LLVMBuildFSub(b, v0_x, v1_x, "dx01");
+ LLVMValueRef dy01 = LLVMBuildFSub(b, v0_y, v1_y, "dy01");
+ LLVMValueRef dx20 = LLVMBuildFSub(b, v2_x, v0_x, "dx20");
+ LLVMValueRef dy20 = LLVMBuildFSub(b, v2_y, v0_y, "dy20");
+
+ LLVMValueRef one = LLVMConstReal(LLVMFloatType(), 1.0);
+ LLVMValueRef e = LLVMBuildFMul(b, dx01, dy20, "e");
+ LLVMValueRef f = LLVMBuildFMul(b, dx20, dy01, "f");
+ LLVMValueRef ooa = LLVMBuildFDiv(b, one, LLVMBuildFSub(b, e, f, ""), "ooa");
+
+ LLVMValueRef dy20_ooa = LLVMBuildFMul(b, dy20, ooa, "dy20_ooa");
+ LLVMValueRef dy01_ooa = LLVMBuildFMul(b, dy01, ooa, "dy01_ooa");
+ LLVMValueRef dx20_ooa = LLVMBuildFMul(b, dx20, ooa, "dx20_ooa");
+ LLVMValueRef dx01_ooa = LLVMBuildFMul(b, dx01, ooa, "dx01_ooa");
+
+ args->dy20_ooa = vec4f_from_scalar(b, dy20_ooa, "dy20_ooa_4f");
+ args->dy01_ooa = vec4f_from_scalar(b, dy01_ooa, "dy01_ooa_4f");
+
+ args->dx20_ooa = vec4f_from_scalar(b, dx20_ooa, "dx20_ooa_4f");
+ args->dx01_ooa = vec4f_from_scalar(b, dx01_ooa, "dx01_ooa_4f");
+
+ args->x0_center = vec4f_from_scalar(b, x0_center, "x0_center_4f");
+ args->y0_center = vec4f_from_scalar(b, y0_center, "y0_center_4f");
+}
+
+/**
+ * Generate the runtime callable function for the coefficient calculation.
+ *
+ */
+static struct lp_setup_variant *
+generate_setup_variant(struct llvmpipe_screen *screen,
+ struct lp_setup_variant_key *key)
+{
+ struct lp_setup_variant *variant = NULL;
+ struct lp_setup_args args;
+ char func_name[256];
+ LLVMTypeRef vec4f_type;
+ LLVMTypeRef func_type;
+ LLVMTypeRef arg_types[7];
+ LLVMBasicBlockRef block;
+ LLVMBuilderRef builder;
+ int64_t t0, t1;
+
+ if (0)
+ goto fail;
+
+ variant = CALLOC_STRUCT(lp_setup_variant);
+ if (variant == NULL)
+ goto fail;
+
+ if (LP_DEBUG & DEBUG_COUNTERS) {
+ t0 = os_time_get();
+ }
+
+ memcpy(&variant->key, key, key->size);
+ variant->list_item_global.base = variant;
+
+ util_snprintf(func_name, sizeof(func_name), "fs%u_setup%u",
+ 0,
+ variant->no);
+
+ /* Currently always deal with full 4-wide vertex attributes from
+ * the vertices.
+ */
+
+ vec4f_type = LLVMVectorType(LLVMFloatType(), 4);
+
+ arg_types[0] = LLVMPointerType(vec4f_type, 0); /* v0 */
+ arg_types[1] = LLVMPointerType(vec4f_type, 0); /* v1 */
+ arg_types[2] = LLVMPointerType(vec4f_type, 0); /* v2 */
+ arg_types[3] = LLVMInt32Type(); /* facing */
+ arg_types[4] = LLVMPointerType(vec4f_type, 0); /* a0, aligned */
+ arg_types[5] = LLVMPointerType(vec4f_type, 0); /* dadx, aligned */
+ arg_types[6] = LLVMPointerType(vec4f_type, 0); /* dady, aligned */
+
+ func_type = LLVMFunctionType(LLVMVoidType(), arg_types, Elements(arg_types), 0);
+
+ variant->function = LLVMAddFunction(screen->module, func_name, func_type);
+ if (!variant->function)
+ goto fail;
+
+ LLVMSetFunctionCallConv(variant->function, LLVMCCallConv);
+
+ args.v0 = LLVMGetParam(variant->function, 0);
+ args.v1 = LLVMGetParam(variant->function, 1);
+ args.v2 = LLVMGetParam(variant->function, 2);
+ args.facing = LLVMGetParam(variant->function, 3);
+ args.a0 = LLVMGetParam(variant->function, 4);
+ args.dadx = LLVMGetParam(variant->function, 5);
+ args.dady = LLVMGetParam(variant->function, 6);
+
+ lp_build_name(args.v0, "in_v0");
+ lp_build_name(args.v1, "in_v1");
+ lp_build_name(args.v2, "in_v2");
+ lp_build_name(args.facing, "in_facing");
+ lp_build_name(args.a0, "out_a0");
+ lp_build_name(args.dadx, "out_dadx");
+ lp_build_name(args.dady, "out_dady");
+
+ /*
+ * Function body
+ */
+ block = LLVMAppendBasicBlock(variant->function, "entry");
+ builder = LLVMCreateBuilder();
+ LLVMPositionBuilderAtEnd(builder, block);
+
+ set_noalias(builder, variant->function, arg_types, Elements(arg_types));
+ init_args(builder, &args, variant);
+ emit_tri_coef(builder, &variant->key, &args);
+
+ lp_emit_emms(builder);
+ LLVMBuildRetVoid(builder);
+ LLVMDisposeBuilder(builder);
+
+ variant->jit_function = finalize_function(screen, builder,
+ variant->function);
+ if (!variant->jit_function)
+ goto fail;
+
+ /*
+ * Update timing information:
+ */
+ if (LP_DEBUG & DEBUG_COUNTERS) {
+ t1 = os_time_get();
+ LP_COUNT_ADD(llvm_compile_time, t1 - t0);
+ LP_COUNT_ADD(nr_llvm_compiles, 1);
+ }
+
+ return variant;
+
+fail:
+ if (variant) {
+ if (variant->function) {
+ if (variant->jit_function)
+ LLVMFreeMachineCodeForFunction(screen->engine,
+ variant->function);
+ LLVMDeleteFunction(variant->function);
+ }
+ FREE(variant);
+ }
+
+ return NULL;
+}
+
+
+
+static void
+lp_make_setup_variant_key(struct llvmpipe_context *lp,
+ struct lp_setup_variant_key *key)
+{
+ struct lp_fragment_shader *fs = lp->fs;
+ unsigned i;
+
+ assert(sizeof key->inputs[0] == sizeof(ushort));
+
+ key->num_inputs = fs->info.base.num_inputs;
+ key->flatshade_first = lp->rasterizer->flatshade_first;
+ key->pixel_center_half = lp->rasterizer->gl_rasterization_rules;
+ key->size = Offset(struct lp_setup_variant_key,
+ inputs[key->num_inputs]);
+ key->pad = 0;
+
+ memcpy(key->inputs, fs->inputs, key->num_inputs * sizeof key->inputs[0]);
+ for (i = 0; i < key->num_inputs; i++) {
+ if (key->inputs[i].interp == LP_INTERP_COLOR) {
+ if (lp->rasterizer->flatshade)
+ key->inputs[i].interp = LP_INTERP_CONSTANT;
+ else
+ key->inputs[i].interp = LP_INTERP_LINEAR;
+ }
+ }
+
+}
+
+
+static void
+remove_setup_variant(struct llvmpipe_context *lp,
+ struct lp_setup_variant *variant)
+{
+ struct llvmpipe_screen *screen = llvmpipe_screen(lp->pipe.screen);
+
+ if (gallivm_debug & GALLIVM_DEBUG_IR) {
+ debug_printf("llvmpipe: del setup_variant #%u total %u\n",
+ variant->no, lp->nr_setup_variants);
+ }
+
+ if (variant->function) {
+ if (variant->jit_function)
+ LLVMFreeMachineCodeForFunction(screen->engine,
+ variant->function);
+ LLVMDeleteFunction(variant->function);
+ }
+
+ remove_from_list(&variant->list_item_global);
+ lp->nr_setup_variants--;
+ FREE(variant);
+}
+
+
+
+/* When the number of setup variants exceeds a threshold, cull a
+ * fraction (currently a quarter) of them.
+ */
+static void
+cull_setup_variants(struct llvmpipe_context *lp)
+{
+ struct pipe_context *pipe = &lp->pipe;
+ int i;
+
+ /*
+ * XXX: we need to flush the context until we have some sort of reference
+ * counting in fragment shaders as they may still be binned
+ * Flushing alone might not be sufficient we need to wait on it too.
+ */
+ llvmpipe_finish(pipe, __FUNCTION__);
+
+ for (i = 0; i < LP_MAX_SETUP_VARIANTS / 4; i++) {
+ struct lp_setup_variant_list_item *item = last_elem(&lp->setup_variants_list);
+ remove_setup_variant(lp, item->base);
+ }
+}
+
+
+/**
+ * Update fragment/vertex shader linkage state. This is called just
+ * prior to drawing something when some fragment-related state has
+ * changed.
+ */
+void
+llvmpipe_update_setup(struct llvmpipe_context *lp)
+{
+ struct llvmpipe_screen *screen = llvmpipe_screen(lp->pipe.screen);
+
+ struct lp_setup_variant_key *key = &lp->setup_variant.key;
+ struct lp_setup_variant *variant = NULL;
+ struct lp_setup_variant_list_item *li;
+
+ lp_make_setup_variant_key(lp, key);
+
+ foreach(li, &lp->setup_variants_list) {
+ if(li->base->key.size == key->size &&
+ memcmp(&li->base->key, key, key->size) == 0) {
+ variant = li->base;
+ break;
+ }
+ }
+
+ if (variant) {
+ move_to_head(&lp->setup_variants_list, &variant->list_item_global);
+ }
+ else {
+ if (lp->nr_setup_variants >= LP_MAX_SETUP_VARIANTS) {
+ cull_setup_variants(lp);
+ }
+
+ variant = generate_setup_variant(screen, key);
+ insert_at_head(&lp->setup_variants_list, &variant->list_item_global);
+ lp->nr_setup_variants++;
+ }
+
+ lp_setup_set_setup_variant(lp->setup,
+ variant);
+}
+
+void
+lp_delete_setup_variants(struct llvmpipe_context *lp)
+{
+ struct lp_setup_variant_list_item *li;
+ li = first_elem(&lp->setup_variants_list);
+ while(!at_end(&lp->setup_variants_list, li)) {
+ struct lp_setup_variant_list_item *next = next_elem(li);
+ remove_setup_variant(lp, li->base);
+ li = next;
+ }
+}
+
+void
+lp_dump_setup_coef( const struct lp_setup_variant_key *key,
+ const float (*sa0)[4],
+ const float (*sdadx)[4],
+ const float (*sdady)[4])
+{
+ int i, slot;
+
+ for (i = 0; i < NUM_CHANNELS; i++) {
+ float a0 = sa0 [0][i];
+ float dadx = sdadx[0][i];
+ float dady = sdady[0][i];
+
+ debug_printf("POS.%c: a0 = %f, dadx = %f, dady = %f\n",
+ "xyzw"[i],
+ a0, dadx, dady);
+ }
+
+ for (slot = 0; slot < key->num_inputs; slot++) {
+ unsigned usage_mask = key->inputs[slot].usage_mask;
+ for (i = 0; i < NUM_CHANNELS; i++) {
+ if (usage_mask & (1 << i)) {
+ float a0 = sa0 [1 + slot][i];
+ float dadx = sdadx[1 + slot][i];
+ float dady = sdady[1 + slot][i];
+
+ debug_printf("IN[%u].%c: a0 = %f, dadx = %f, dady = %f\n",
+ slot,
+ "xyzw"[i],
+ a0, dadx, dady);
+ }
+ }
+ }
+}
--- /dev/null
+#ifndef LP_STATE_SETUP_H
+#define LP_STATE_SETUP_H
+
+#include "lp_bld_interp.h"
+
+
+struct llvmpipe_context;
+struct lp_setup_variant;
+
+struct lp_setup_variant_list_item
+{
+ struct lp_setup_variant *base;
+ struct lp_setup_variant_list_item *next, *prev;
+};
+
+
+struct lp_setup_variant_key {
+ unsigned num_inputs:8;
+ unsigned flatshade_first:1;
+ unsigned pixel_center_half:1;
+ unsigned pad:7;
+ unsigned size:16;
+ struct lp_shader_input inputs[PIPE_MAX_SHADER_INPUTS];
+};
+
+
+typedef void (*lp_jit_setup_triangle)( const float (*v0)[4],
+ const float (*v1)[4],
+ const float (*v2)[4],
+ boolean front_facing,
+ float (*a0)[4],
+ float (*dadx)[4],
+ float (*dady)[4] );
+
+
+
+
+/* At this stage, for a given variant key, we create a
+ * draw_vertex_info struct telling the draw module how to format the
+ * vertices, and an llvm-generated function which calculates the
+ * attribute interpolants (a0, dadx, dady) from three of those
+ * vertices.
+ */
+struct lp_setup_variant {
+ struct lp_setup_variant_key key;
+
+ struct lp_setup_variant_list_item list_item_global;
+
+ /* XXX: this is a pointer to the LLVM IR. Once jit_function is
+ * generated, we never need to use the IR again - need to find a
+ * way to release this data without destroying the generated
+ * assembly.
+ */
+ LLVMValueRef function;
+
+ /* The actual generated setup function:
+ */
+ lp_jit_setup_triangle jit_function;
+
+ unsigned no;
+};
+
+void lp_setup_tri_fallback( const float (*v0)[4],
+ const float (*v1)[4],
+ const float (*v2)[4],
+ boolean front_facing,
+ float (*a0)[4],
+ float (*dadx)[4],
+ float (*dady)[4],
+ const struct lp_setup_variant_key *key );
+
+void lp_delete_setup_variants(struct llvmpipe_context *lp);
+
+void
+lp_dump_setup_coef( const struct lp_setup_variant_key *key,
+ const float (*sa0)[4],
+ const float (*sdadx)[4],
+ const float (*sdady)[4]);
+
+#endif
LLVMValueRef ret;
struct lp_build_context bld;
- bld.builder = builder;
- bld.type.floating = 1;
- bld.type.width = 32;
- bld.type.length = 4;
+ lp_build_context_init(&bld, builder, lp_float32_vec4_type());
LLVMSetFunctionCallConv(func, LLVMCCallConv);
f[0], f[1], f[2], f[3]);
}
-static void
+static boolean
compare(v4sf x, v4sf y)
{
+ boolean success = TRUE;
float *xp = (float *) &x;
float *yp = (float *) &y;
if (xp[0] != yp[0] ||
xp[2] != yp[2] ||
xp[3] != yp[3]) {
printf(" Incorrect result! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ \n");
+ success = FALSE;
}
+ return success;
}
LLVMDumpModule(module);
for (i = 0; i < 3; i++) {
+ /* NOTE: There are several acceptable rules for x.5 rounding: ceiling,
+ * nearest even, etc. So we avoid testing such corner cases here.
+ */
v4sf xvals[3] = {
{-10.0, -1, 0, 12.0},
- {-1.5, -0.25, 1.25, 2.5},
+ {-1.49, -0.25, 1.25, 2.51},
{-0.99, -0.01, 0.01, 0.99}
};
v4sf x = xvals[i];
y = round_func(x);
printv("C round(x) ", ref);
printv("LLVM round(x)", y);
- compare(ref, y);
+ success = success && compare(ref, y);
refp[0] = trunc(xp[0]);
refp[1] = trunc(xp[1]);
y = trunc_func(x);
printv("C trunc(x) ", ref);
printv("LLVM trunc(x)", y);
- compare(ref, y);
+ success = success && compare(ref, y);
refp[0] = floor(xp[0]);
refp[1] = floor(xp[1]);
y = floor_func(x);
printv("C floor(x) ", ref);
printv("LLVM floor(x)", y);
- compare(ref, y);
+ success = success && compare(ref, y);
refp[0] = ceil(xp[0]);
refp[1] = ceil(xp[1]);
y = ceil_func(x);
printv("C ceil(x) ", ref);
printv("LLVM ceil(x) ", y);
- compare(ref, y);
+ success = success && compare(ref, y);
}
LLVMFreeMachineCodeForFunction(engine, test_round);
boolean
test_all(unsigned verbose, FILE *fp)
{
- boolean success = TRUE;
-
- test_round(verbose, fp);
-
- return success;
+ return test_round(verbose, fp);
}
LLVMValueRef ret;
struct lp_build_context bld;
- bld.builder = builder;
- bld.type.floating = 1;
- bld.type.width = 32;
- bld.type.length = 4;
+ lp_build_context_init(&bld, builder, lp_float32_vec4_type());
LLVMSetFunctionCallConv(func, LLVMCCallConv);
print
-def generate_ssse3():
+def generate_sse2():
print '''
#if defined(PIPE_ARCH_SSE)
#include "util/u_sse.h"
-static void
-lp_tile_b8g8r8a8_unorm_swizzle_4ub_ssse3(uint8_t *dst,
- const uint8_t *src, unsigned src_stride,
- unsigned x0, unsigned y0)
+static ALWAYS_INLINE void
+swz4( const __m128i * restrict x,
+ const __m128i * restrict y,
+ const __m128i * restrict z,
+ const __m128i * restrict w,
+ __m128i * restrict a,
+ __m128i * restrict b,
+ __m128i * restrict c,
+ __m128i * restrict d)
{
+ __m128i i, j, k, l;
+ __m128i m, n, o, p;
+ __m128i e, f, g, h;
+
+ m = _mm_unpacklo_epi8(*x,*y);
+ n = _mm_unpackhi_epi8(*x,*y);
+ o = _mm_unpacklo_epi8(*z,*w);
+ p = _mm_unpackhi_epi8(*z,*w);
+
+ i = _mm_unpacklo_epi16(m,n);
+ j = _mm_unpackhi_epi16(m,n);
+ k = _mm_unpacklo_epi16(o,p);
+ l = _mm_unpackhi_epi16(o,p);
+
+ e = _mm_unpacklo_epi8(i,j);
+ f = _mm_unpackhi_epi8(i,j);
+ g = _mm_unpacklo_epi8(k,l);
+ h = _mm_unpackhi_epi8(k,l);
+
+ *a = _mm_unpacklo_epi64(e,g);
+ *b = _mm_unpackhi_epi64(e,g);
+ *c = _mm_unpacklo_epi64(f,h);
+ *d = _mm_unpackhi_epi64(f,h);
+}
+
+static ALWAYS_INLINE void
+unswz4( const __m128i * restrict a,
+ const __m128i * restrict b,
+ const __m128i * restrict c,
+ const __m128i * restrict d,
+ __m128i * restrict x,
+ __m128i * restrict y,
+ __m128i * restrict z,
+ __m128i * restrict w)
+{
+ __m128i i, j, k, l;
+ __m128i m, n, o, p;
+
+ i = _mm_unpacklo_epi8(*a,*b);
+ j = _mm_unpackhi_epi8(*a,*b);
+ k = _mm_unpacklo_epi8(*c,*d);
+ l = _mm_unpackhi_epi8(*c,*d);
+
+ m = _mm_unpacklo_epi16(i,k);
+ n = _mm_unpackhi_epi16(i,k);
+ o = _mm_unpacklo_epi16(j,l);
+ p = _mm_unpackhi_epi16(j,l);
+
+ *x = _mm_unpacklo_epi64(m,n);
+ *y = _mm_unpackhi_epi64(m,n);
+ *z = _mm_unpacklo_epi64(o,p);
+ *w = _mm_unpackhi_epi64(o,p);
+}
+static void
+lp_tile_b8g8r8a8_unorm_swizzle_4ub_sse2(uint8_t * restrict dst,
+ const uint8_t * restrict src, unsigned src_stride,
+ unsigned x0, unsigned y0)
+{
+ __m128i *dst128 = (__m128i *) dst;
unsigned x, y;
- __m128i *pdst = (__m128i*) dst;
- const uint8_t *ysrc0 = src + y0*src_stride + x0*sizeof(uint32_t);
- unsigned int tile_stridex = src_stride*(TILE_VECTOR_HEIGHT - 1) - sizeof(uint32_t)*TILE_VECTOR_WIDTH;
- unsigned int tile_stridey = src_stride*TILE_VECTOR_HEIGHT;
-
- const __m128i shuffle00 = _mm_setr_epi8(0x02,0x06,0xff,0xff,0x0a,0x0e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff);
- const __m128i shuffle01 = _mm_setr_epi8(0x01,0x05,0xff,0xff,0x09,0x0d,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff);
- const __m128i shuffle02 = _mm_setr_epi8(0x00,0x04,0xff,0xff,0x08,0x0c,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff);
- const __m128i shuffle03 = _mm_setr_epi8(0x03,0x07,0xff,0xff,0x0b,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff);
-
- const __m128i shuffle10 = _mm_setr_epi8(0xff,0xff,0x02,0x06,0xff,0xff,0x0a,0x0e,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff);
- const __m128i shuffle11 = _mm_setr_epi8(0xff,0xff,0x01,0x05,0xff,0xff,0x09,0x0d,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff);
- const __m128i shuffle12 = _mm_setr_epi8(0xff,0xff,0x00,0x04,0xff,0xff,0x08,0x0c,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff);
- const __m128i shuffle13 = _mm_setr_epi8(0xff,0xff,0x03,0x07,0xff,0xff,0x0b,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff);
-
- const __m128i shuffle20 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x02,0x06,0xff,0xff,0x0a,0x0e,0xff,0xff);
- const __m128i shuffle21 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,0x05,0xff,0xff,0x09,0x0d,0xff,0xff);
- const __m128i shuffle22 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x04,0xff,0xff,0x08,0x0c,0xff,0xff);
- const __m128i shuffle23 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x07,0xff,0xff,0x0b,0x0f,0xff,0xff);
-
- const __m128i shuffle30 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x02,0x06,0xff,0xff,0x0a,0x0e);
- const __m128i shuffle31 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x01,0x05,0xff,0xff,0x09,0x0d);
- const __m128i shuffle32 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x04,0xff,0xff,0x08,0x0c);
- const __m128i shuffle33 = _mm_setr_epi8(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x07,0xff,0xff,0x0b,0x0f);
-
- for (y = 0; y < TILE_SIZE; y += TILE_VECTOR_HEIGHT) {
- __m128i line0 = *(__m128i*)ysrc0;
- const uint8_t *ysrc = ysrc0 + src_stride;
- ysrc0 += tile_stridey;
-
- for (x = 0; x < TILE_SIZE; x += TILE_VECTOR_WIDTH) {
- __m128i r, g, b, a, line1;
- line1 = *(__m128i*)ysrc;
- PIPE_READ_WRITE_BARRIER();
- ysrc += src_stride;
- r = _mm_shuffle_epi8(line0, shuffle00);
- g = _mm_shuffle_epi8(line0, shuffle01);
- b = _mm_shuffle_epi8(line0, shuffle02);
- a = _mm_shuffle_epi8(line0, shuffle03);
-
- line0 = *(__m128i*)ysrc;
- PIPE_READ_WRITE_BARRIER();
- ysrc += src_stride;
- r = _mm_or_si128(r, _mm_shuffle_epi8(line1, shuffle10));
- g = _mm_or_si128(g, _mm_shuffle_epi8(line1, shuffle11));
- b = _mm_or_si128(b, _mm_shuffle_epi8(line1, shuffle12));
- a = _mm_or_si128(a, _mm_shuffle_epi8(line1, shuffle13));
-
- line1 = *(__m128i*)ysrc;
- PIPE_READ_WRITE_BARRIER();
- ysrc -= tile_stridex;
- r = _mm_or_si128(r, _mm_shuffle_epi8(line0, shuffle20));
- g = _mm_or_si128(g, _mm_shuffle_epi8(line0, shuffle21));
- b = _mm_or_si128(b, _mm_shuffle_epi8(line0, shuffle22));
- a = _mm_or_si128(a, _mm_shuffle_epi8(line0, shuffle23));
-
- if (x + 1 < TILE_SIZE) {
- line0 = *(__m128i*)ysrc;
- ysrc += src_stride;
- }
-
- PIPE_READ_WRITE_BARRIER();
- r = _mm_or_si128(r, _mm_shuffle_epi8(line1, shuffle30));
- g = _mm_or_si128(g, _mm_shuffle_epi8(line1, shuffle31));
- b = _mm_or_si128(b, _mm_shuffle_epi8(line1, shuffle32));
- a = _mm_or_si128(a, _mm_shuffle_epi8(line1, shuffle33));
-
- *pdst++ = r;
- *pdst++ = g;
- *pdst++ = b;
- *pdst++ = a;
+
+ src += y0 * src_stride;
+ src += x0 * sizeof(uint32_t);
+
+ for (y = 0; y < TILE_SIZE; y += 4) {
+ const uint8_t *src_row = src;
+
+ for (x = 0; x < TILE_SIZE; x += 4) {
+ swz4((const __m128i *) (src_row + 0 * src_stride),
+ (const __m128i *) (src_row + 1 * src_stride),
+ (const __m128i *) (src_row + 2 * src_stride),
+ (const __m128i *) (src_row + 3 * src_stride),
+ dst128 + 2, /* b */
+ dst128 + 1, /* g */
+ dst128 + 0, /* r */
+ dst128 + 3); /* a */
+
+ dst128 += 4;
+ src_row += sizeof(__m128i);
}
- }
+ src += 4 * src_stride;
+ }
}
static void
-lp_tile_b8g8r8a8_unorm_unswizzle_4ub_ssse3(const uint8_t *src,
- uint8_t *dst, unsigned dst_stride,
+lp_tile_b8g8r8a8_unorm_unswizzle_4ub_sse2(const uint8_t * restrict src,
+ uint8_t * restrict dst, unsigned dst_stride,
unsigned x0, unsigned y0)
{
unsigned int x, y;
- const __m128i *psrc = (__m128i*) src;
- const __m128i *end = (__m128i*) (src + (y0 + TILE_SIZE - 1)*dst_stride + (x0 + TILE_SIZE - 1)*sizeof(uint32_t));
- uint8_t *pdst = dst + y0 * dst_stride + x0 * sizeof(uint32_t);
- __m128i c0 = *psrc++;
- __m128i c1;
-
- const __m128i shuffle00 = _mm_setr_epi8(0xff,0xff,0x00,0xff,0xff,0xff,0x01,0xff,0xff,0xff,0x04,0xff,0xff,0xff,0x05,0xff);
- const __m128i shuffle01 = _mm_setr_epi8(0xff,0xff,0x02,0xff,0xff,0xff,0x03,0xff,0xff,0xff,0x06,0xff,0xff,0xff,0x07,0xff);
- const __m128i shuffle02 = _mm_setr_epi8(0xff,0xff,0x08,0xff,0xff,0xff,0x09,0xff,0xff,0xff,0x0c,0xff,0xff,0xff,0x0d,0xff);
- const __m128i shuffle03 = _mm_setr_epi8(0xff,0xff,0x0a,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0x0e,0xff,0xff,0xff,0x0f,0xff);
-
- const __m128i shuffle10 = _mm_setr_epi8(0xff,0x00,0xff,0xff,0xff,0x01,0xff,0xff,0xff,0x04,0xff,0xff,0xff,0x05,0xff,0xff);
- const __m128i shuffle11 = _mm_setr_epi8(0xff,0x02,0xff,0xff,0xff,0x03,0xff,0xff,0xff,0x06,0xff,0xff,0xff,0x07,0xff,0xff);
- const __m128i shuffle12 = _mm_setr_epi8(0xff,0x08,0xff,0xff,0xff,0x09,0xff,0xff,0xff,0x0c,0xff,0xff,0xff,0x0d,0xff,0xff);
- const __m128i shuffle13 = _mm_setr_epi8(0xff,0x0a,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0x0e,0xff,0xff,0xff,0x0f,0xff,0xff);
-
- const __m128i shuffle20 = _mm_setr_epi8(0x00,0xff,0xff,0xff,0x01,0xff,0xff,0xff,0x04,0xff,0xff,0xff,0x05,0xff,0xff,0xff);
- const __m128i shuffle21 = _mm_setr_epi8(0x02,0xff,0xff,0xff,0x03,0xff,0xff,0xff,0x06,0xff,0xff,0xff,0x07,0xff,0xff,0xff);
- const __m128i shuffle22 = _mm_setr_epi8(0x08,0xff,0xff,0xff,0x09,0xff,0xff,0xff,0x0c,0xff,0xff,0xff,0x0d,0xff,0xff,0xff);
- const __m128i shuffle23 = _mm_setr_epi8(0x0a,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0x0e,0xff,0xff,0xff,0x0f,0xff,0xff,0xff);
-
- const __m128i shuffle30 = _mm_setr_epi8(0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x01,0xff,0xff,0xff,0x04,0xff,0xff,0xff,0x05);
- const __m128i shuffle31 = _mm_setr_epi8(0xff,0xff,0xff,0x02,0xff,0xff,0xff,0x03,0xff,0xff,0xff,0x06,0xff,0xff,0xff,0x07);
- const __m128i shuffle32 = _mm_setr_epi8(0xff,0xff,0xff,0x08,0xff,0xff,0xff,0x09,0xff,0xff,0xff,0x0c,0xff,0xff,0xff,0x0d);
- const __m128i shuffle33 = _mm_setr_epi8(0xff,0xff,0xff,0x0a,0xff,0xff,0xff,0x0b,0xff,0xff,0xff,0x0e,0xff,0xff,0xff,0x0f);
-
- for (y = 0; y < TILE_SIZE; y += TILE_VECTOR_HEIGHT) {
- __m128i *tile = (__m128i*) pdst;
- pdst += dst_stride * TILE_VECTOR_HEIGHT;
- for (x = 0; x < TILE_SIZE; x += TILE_VECTOR_WIDTH) {
- uint8_t *linep = (uint8_t*) (tile++);
- __m128i line0, line1, line2, line3;
-
- c1 = *psrc++; /* r */
- PIPE_READ_WRITE_BARRIER();
- line0 = _mm_shuffle_epi8(c0, shuffle00);
- line1 = _mm_shuffle_epi8(c0, shuffle01);
- line2 = _mm_shuffle_epi8(c0, shuffle02);
- line3 = _mm_shuffle_epi8(c0, shuffle03);
-
- c0 = *psrc++; /* g */
- PIPE_READ_WRITE_BARRIER();
- line0 = _mm_or_si128(line0, _mm_shuffle_epi8(c1, shuffle10));
- line1 = _mm_or_si128(line1, _mm_shuffle_epi8(c1, shuffle11));
- line2 = _mm_or_si128(line2, _mm_shuffle_epi8(c1, shuffle12));
- line3 = _mm_or_si128(line3, _mm_shuffle_epi8(c1, shuffle13));
-
- c1 = *psrc++; /* b */
- PIPE_READ_WRITE_BARRIER();
- line0 = _mm_or_si128(line0, _mm_shuffle_epi8(c0, shuffle20));
- line1 = _mm_or_si128(line1, _mm_shuffle_epi8(c0, shuffle21));
- line2 = _mm_or_si128(line2, _mm_shuffle_epi8(c0, shuffle22));
- line3 = _mm_or_si128(line3, _mm_shuffle_epi8(c0, shuffle23));
-
- if (psrc != end)
- c0 = *psrc++; /* a */
- PIPE_READ_WRITE_BARRIER();
- line0 = _mm_or_si128(line0, _mm_shuffle_epi8(c1, shuffle30));
- line1 = _mm_or_si128(line1, _mm_shuffle_epi8(c1, shuffle31));
- line2 = _mm_or_si128(line2, _mm_shuffle_epi8(c1, shuffle32));
- line3 = _mm_or_si128(line3, _mm_shuffle_epi8(c1, shuffle33));
-
- *(__m128i*) (linep) = line0;
- *(__m128i*) (((char*)linep) + dst_stride) = line1;
- *(__m128i*) (((char*)linep) + 2 * dst_stride) = line2;
- *(__m128i*) (((char*)linep) + 3 * dst_stride) = line3;
+ const __m128i *src128 = (const __m128i *) src;
+
+ dst += y0 * dst_stride;
+ dst += x0 * sizeof(uint32_t);
+
+ for (y = 0; y < TILE_SIZE; y += 4) {
+ const uint8_t *dst_row = dst;
+
+ for (x = 0; x < TILE_SIZE; x += 4) {
+ unswz4( &src128[2], /* b */
+ &src128[1], /* g */
+ &src128[0], /* r */
+ &src128[3], /* a */
+ (__m128i *) (dst_row + 0 * dst_stride),
+ (__m128i *) (dst_row + 1 * dst_stride),
+ (__m128i *) (dst_row + 2 * dst_stride),
+ (__m128i *) (dst_row + 3 * dst_stride));
+
+ src128 += 4;
+ dst_row += sizeof(__m128i);;
}
+
+ dst += 4 * dst_stride;
}
}
-#endif /* PIPE_ARCH_SSSE3 */
+#endif /* PIPE_ARCH_SSE */
'''
func_name = 'lp_tile_%s_swizzle_%s' % (format.short_name(), dst_suffix)
if format.name == 'PIPE_FORMAT_B8G8R8A8_UNORM':
print '#ifdef PIPE_ARCH_SSE'
- print ' func = util_cpu_caps.has_ssse3 ? %s_ssse3 : %s;' % (func_name, func_name)
+ print ' func = util_cpu_caps.has_sse2 ? %s_sse2 : %s;' % (func_name, func_name)
print '#else'
print ' func = %s;' % (func_name,)
print '#endif'
func_name = 'lp_tile_%s_unswizzle_%s' % (format.short_name(), src_suffix)
if format.name == 'PIPE_FORMAT_B8G8R8A8_UNORM':
print '#ifdef PIPE_ARCH_SSE'
- print ' func = util_cpu_caps.has_ssse3 ? %s_ssse3 : %s;' % (func_name, func_name)
+ print ' func = util_cpu_caps.has_sse2 ? %s_sse2 : %s;' % (func_name, func_name)
print '#else'
print ' func = %s;' % (func_name,)
print '#endif'
print '};'
print
- generate_ssse3()
+ generate_sse2()
channel = Channel(UNSIGNED, True, 8)
native_type = 'uint8_t'
int ret;
ret = nouveau_channel_alloc(dev, 0xbeef0201, 0xbeef0202,
- &screen->channel);
+ 512*1024, &screen->channel);
if (ret)
return ret;
screen->device = dev;
#define NOUVEAU_MSG(fmt, args...) \
fprintf(stderr, "nouveau: "fmt, ##args);
+#define nouveau_bo_tile_layout(nvbo) \
+ ((nvbo)->tile_flags & NOUVEAU_BO_TILE_LAYOUT_MASK)
+
/* Constant buffer assignment */
#define NV50_CB_PMISC 0
#define NV50_CB_PVP 1
if (nvi->opcode == NV_OP_SAT) {
mi = nvi->src[0]->value->insn;
- if (mi->opcode != NV_OP_ADD || mi->opcode != NV_OP_MAD)
+ if (mi->opcode != NV_OP_ADD && mi->opcode != NV_OP_MAD)
continue;
if (mi->flags_def || mi->def[0]->refc > 1)
continue;
return 1;
}
- if (!bo->tile_flags) {
+ if (!nouveau_bo_tile_layout(bo)) {
BEGIN_RING(chan, eng2d, mthd, 2);
OUT_RING (chan, format);
OUT_RING (chan, 1);
WAIT_RING (chan, 14);
- if (!src_bo->tile_flags) {
+ if (!nouveau_bo_tile_layout(src_bo)) {
BEGIN_RING(chan, m2mf,
NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_IN, 1);
OUT_RING (chan, 1);
OUT_RING (chan, sz); /* copying only 1 zslice per call */
}
- if (!dst_bo->tile_flags) {
+ if (!nouveau_bo_tile_layout(dst_bo)) {
BEGIN_RING(chan, m2mf,
NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_OUT, 1);
OUT_RING (chan, 1);
NV04_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 2);
OUT_RELOCl(chan, src_bo, src_offset, src_reloc);
OUT_RELOCl(chan, dst_bo, dst_offset, dst_reloc);
- if (src_bo->tile_flags) {
+ if (nouveau_bo_tile_layout(src_bo)) {
BEGIN_RING(chan, m2mf,
NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN, 1);
OUT_RING (chan, (sy << 16) | (sx * cpp));
} else {
src_offset += (line_count * src_pitch);
}
- if (dst_bo->tile_flags) {
+ if (nouveau_bo_tile_layout(dst_bo)) {
BEGIN_RING(chan, m2mf,
NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT, 1);
OUT_RING (chan, (dy << 16) | (dx * cpp));
MARK_RING (chan, 32, 2); /* flush on lack of space or relocs */
- if (bo->tile_flags) {
+ if (nouveau_bo_tile_layout(bo)) {
BEGIN_RING(chan, eng2d, NV50_2D_DST_FORMAT, 5);
OUT_RING (chan, dst_format);
OUT_RING (chan, 0);
struct nvfx_fragment_program_bo* next = fpbo->next;
nouveau_bo_unmap(fpbo->bo);
nouveau_bo_ref(0, &fpbo->bo);
- free(fpbo);
+ os_free_aligned(fpbo);
fpbo = next;
}
while(fpbo != fp->fpbo);
static const struct debug_named_value debug_options[] = {
{ "fp", DBG_FP, "Log fragment program compilation" },
{ "vp", DBG_VP, "Log vertex program compilation" },
+ { "pstat", DBG_P_STAT, "Log vertex/fragment program stats" },
{ "draw", DBG_DRAW, "Log draw calls" },
{ "swtcl", DBG_SWTCL, "Log SWTCL-specific info" },
{ "rsblock", DBG_RS_BLOCK, "Log rasterizer registers" },
/* Setup the compiler. */
memset(&compiler, 0, sizeof(compiler));
rc_init(&compiler.Base);
- compiler.Base.Debug = DBG_ON(r300, DBG_FP);
+ DBG_ON(r300, DBG_FP) ? compiler.Base.Debug |= RC_DBG_LOG : 0;
+ DBG_ON(r300, DBG_P_STAT) ? compiler.Base.Debug |= RC_DBG_STATS : 0;
compiler.code = &shader->code;
compiler.state = shader->compare_state;
find_output_registers(&compiler, shader);
- if (compiler.Base.Debug) {
+ if (compiler.Base.Debug & RC_DBG_LOG) {
DBG(r300, DBG_FP, "r300: Initial fragment program\n");
tgsi_dump(tokens, 0);
}
uint mode)
{
struct r300_context *r300 = r300_context(pipe);
- uint64_t result;
+ uint64_t result = 0;
boolean wait;
if (query) {
if (!r300_get_query_result(pipe, query, wait, &result)) {
r300->skip_rendering = FALSE;
+ } else {
+ r300->skip_rendering = result == 0;
}
-
- r300->skip_rendering = result == 0;
} else {
r300->skip_rendering = FALSE;
}
case PIPE_CAP_INDEP_BLEND_FUNC:
case PIPE_CAP_DEPTH_CLAMP: /* XXX implemented, but breaks Regnum Online */
case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
+ case PIPE_CAP_SHADER_STENCIL_EXPORT:
return 0;
/* Texturing. */
#define DBG_NO_CBZB (1 << 21)
/* Statistics. */
#define DBG_STATS (1 << 24)
+#define DBG_P_STAT (1 << 25)
/*@}*/
static INLINE boolean SCREEN_DBG_ON(struct r300_screen * screen, unsigned flags)
r300_translate_vertex_data_type(enum pipe_format format) {
uint32_t result = 0;
const struct util_format_description *desc;
+ unsigned i;
desc = util_format_description(format);
return R300_INVALID_FORMAT;
}
- switch (desc->channel[0].type) {
+ /* Find the first non-VOID channel. */
+ for (i = 0; i < 4; i++) {
+ if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
+ break;
+ }
+ }
+
+ switch (desc->channel[i].type) {
/* Half-floats, floats, doubles */
case UTIL_FORMAT_TYPE_FLOAT:
- switch (desc->channel[0].size) {
+ switch (desc->channel[i].size) {
case 16:
/* Supported only on RV350 and later. */
if (desc->nr_channels > 2) {
case UTIL_FORMAT_TYPE_UNSIGNED:
/* Signed ints */
case UTIL_FORMAT_TYPE_SIGNED:
- switch (desc->channel[0].size) {
+ switch (desc->channel[i].size) {
case 8:
result = R300_DATA_TYPE_BYTE;
break;
return R300_INVALID_FORMAT;
}
- if (desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) {
+ if (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED) {
result |= R300_SIGNED;
}
- if (desc->channel[0].normalized) {
+ if (desc->channel[i].normalized) {
result |= R300_NORMALIZE;
}
return ~0; /* Unsupported/unknown. */
}
+ /* Find the first non-VOID channel. */
+ for (i = 0; i < 4; i++) {
+ if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
+ break;
+ }
+ }
+
+ if (i == 4)
+ return ~0; /* Unsupported/unknown. */
+
/* And finally, uniform formats. */
- switch (desc->channel[0].type) {
+ switch (desc->channel[i].type) {
case UTIL_FORMAT_TYPE_UNSIGNED:
case UTIL_FORMAT_TYPE_SIGNED:
- if (!desc->channel[0].normalized &&
+ if (!desc->channel[i].normalized &&
desc->colorspace != UTIL_FORMAT_COLORSPACE_SRGB) {
return ~0;
}
- switch (desc->channel[0].size) {
+ switch (desc->channel[i].size) {
case 4:
switch (desc->nr_channels) {
case 2:
return ~0;
case UTIL_FORMAT_TYPE_FLOAT:
- switch (desc->channel[0].size) {
+ switch (desc->channel[i].size) {
case 16:
switch (desc->nr_channels) {
case 1:
return R300_COLOR_FORMAT_I8;
/* 16-bit buffers. */
+ case PIPE_FORMAT_L8A8_UNORM:
+ case PIPE_FORMAT_R8G8_UNORM:
+ case PIPE_FORMAT_R8G8_SNORM:
+ return R300_COLOR_FORMAT_UV88;
+
case PIPE_FORMAT_B5G6R5_UNORM:
return R300_COLOR_FORMAT_RGB565;
desc = util_format_description(format);
+ /* Find the first non-VOID channel. */
+ for (i = 0; i < 4; i++) {
+ if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
+ break;
+ }
+ }
+
+ if (i == 4)
+ return ~0; /* Unsupported/unknown. */
+
/* Specifies how the shader output is written to the fog unit. */
- if (desc->channel[0].type == UTIL_FORMAT_TYPE_FLOAT) {
- if (desc->channel[0].size == 32) {
+ if (desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT) {
+ if (desc->channel[i].size == 32) {
modifier |= R300_US_OUT_FMT_C4_32_FP;
} else {
modifier |= R300_US_OUT_FMT_C4_16_FP;
}
} else {
- if (desc->channel[0].size == 16) {
+ if (desc->channel[i].size == 16) {
modifier |= R300_US_OUT_FMT_C4_16;
} else {
/* C4_8 seems to be used for the formats whose pixel size
/* Add swizzles and return. */
switch (format) {
- /* 8-bit outputs.
+ /* 8-bit outputs, one channel.
* COLORFORMAT_I8 stores the C2 component. */
case PIPE_FORMAT_A8_UNORM:
return modifier | R300_C2_SEL_A;
case PIPE_FORMAT_R8_SNORM:
return modifier | R300_C2_SEL_R;
+ /* 16-bit outputs, two channels.
+ * COLORFORMAT_UV88 stores C2 and C0. */
+ case PIPE_FORMAT_L8A8_UNORM:
+ return modifier | R300_C0_SEL_A | R300_C2_SEL_R;
+ case PIPE_FORMAT_R8G8_UNORM:
+ case PIPE_FORMAT_R8G8_SNORM:
+ return modifier | R300_C0_SEL_G | R300_C2_SEL_R;
+
/* BGRA outputs. */
case PIPE_FORMAT_B5G6R5_UNORM:
case PIPE_FORMAT_B5G5R5A1_UNORM:
{{ 32, 1}, { 8, 4}, { 0, 0}}, /* 8 bits per pixel */
{{ 16, 1}, { 8, 2}, { 4, 4}}, /* 16 bits per pixel */
{{ 8, 1}, { 4, 2}, { 0, 0}}, /* 32 bits per pixel */
- {{ 4, 1}, { 0, 0}, { 2, 2}}, /* 64 bits per pixel */
+ {{ 4, 1}, { 2, 2}, { 0, 0}}, /* 64 bits per pixel */
{{ 2, 1}, { 0, 0}, { 0, 0}} /* 128 bits per pixel */
},
{
{{256, 8}, {64, 32}, { 0, 0}}, /* 8 bits per pixel */
{{128, 8}, {64, 16}, {32, 32}}, /* 16 bits per pixel */
{{ 64, 8}, {32, 16}, { 0, 0}}, /* 32 bits per pixel */
- {{ 32, 8}, { 0, 0}, {16, 16}}, /* 64 bits per pixel */
+ {{ 32, 8}, {16, 16}, { 0, 0}}, /* 64 bits per pixel */
{{ 16, 8}, { 0, 0}, { 0, 0}} /* 128 bits per pixel */
}
};
switch (util_format_get_blocksize(format)) {
case 1:
case 4:
+ case 8:
desc->microtile = R300_BUFFER_TILED;
break;
case 2:
- case 8:
if (rws->get_value(rws, R300_VID_SQUARE_TILING_SUPPORT)) {
desc->microtile = R300_BUFFER_SQUARETILED;
}
memset(&compiler, 0, sizeof(compiler));
rc_init(&compiler.Base);
- compiler.Base.Debug = DBG_ON(r300, DBG_VP);
+ DBG_ON(r300, DBG_VP) ? compiler.Base.Debug |= RC_DBG_LOG : 0;
+ DBG_ON(r300, DBG_P_STAT) ? compiler.Base.Debug |= RC_DBG_STATS : 0;
compiler.code = &vs->code;
compiler.UserData = vs;
compiler.Base.is_r500 = r300->screen->caps.is_r500;
compiler.Base.max_alu_insts = r300->screen->caps.is_r500 ? 1024 : 256;
compiler.Base.remove_unused_constants = TRUE;
- if (compiler.Base.Debug) {
+ if (compiler.Base.Debug & RC_DBG_LOG) {
DBG(r300, DBG_VP, "r300: Initial vertex program\n");
tgsi_dump(vs->state.tokens, 0);
}
$(shell pkg-config libdrm --cflags-only-I)
C_SOURCES = \
- r600_buffer.c \
- r600_state2.c \
- evergreen_state.c \
- r600_context.c \
- r600_shader.c \
- r600_draw.c \
+ r600_asm.c \
r600_blit.c \
+ r600_buffer.c \
r600_helper.c \
+ r600_pipe.c \
r600_query.c \
r600_resource.c \
- r600_screen.c \
+ r600_shader.c \
r600_state.c \
r600_texture.c \
- r600_asm.c \
r700_asm.c \
- r600_hw_states.c \
- eg_asm.c \
- eg_hw_states.c
+ evergreen_state.c \
+ eg_asm.c
include ../../Makefile.template
r600 = env.ConvenienceLibrary(
target = 'r600',
source = [
+ 'r600_asm.c',
'r600_buffer.c',
- 'r600_context.c',
- 'r600_draw.c',
'r600_blit.c',
'r600_helper.c',
+ 'r600_pipe.c',
'r600_query.c',
'r600_resource.c',
- 'r600_screen.c',
+ 'r600_shader.c',
'r600_state.c',
'r600_texture.c',
- 'r600_shader.c',
- 'r600_asm.c',
'r700_asm.c',
+ 'evergreen_state.c',
+ 'eg_asm.c',
])
Export('r600')
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "radeon.h"
-#include "r600_asm.h"
-#include "r600_context.h"
+#include <stdio.h>
+#include <errno.h>
#include "util/u_memory.h"
+#include "r600_pipe.h"
+#include "r600_asm.h"
#include "eg_sq.h"
#include "r600_opcodes.h"
-#include <stdio.h>
-#include <errno.h>
int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf)
{
bc->bytecode[id++] = S_SQ_CF_WORD0_ADDR(cf->cf_addr >> 1);
bc->bytecode[id++] = S_SQ_CF_WORD1_CF_INST(cf->inst) |
S_SQ_CF_WORD1_BARRIER(1) |
- S_SQ_CF_WORD1_COND(cf->cond) |
- S_SQ_CF_WORD1_POP_COUNT(cf->pop_count);
+ S_SQ_CF_WORD1_COND(cf->cond) |
+ S_SQ_CF_WORD1_POP_COUNT(cf->pop_count);
break;
default:
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- * 2010 Red Hat Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * 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.
- *
- * Authors:
- * Jerome Glisse
- * Dave Airlie
- */
-#include <util/u_inlines.h>
-#include <util/u_format.h>
-#include <util/u_memory.h>
-#include <util/u_blitter.h>
-#include "util/u_pack_color.h"
-#include "r600_screen.h"
-#include "r600_context.h"
-#include "r600_resource.h"
-#include "eg_state_inlines.h"
-#include "evergreend.h"
-
-#include "eg_states_inc.h"
-
-static void eg_blend(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_blend_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
- int i;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_BLEND, 0, 0);
- rstate->states[EG_BLEND__CB_BLEND_RED] = fui(rctx->blend_color.color[0]);
- rstate->states[EG_BLEND__CB_BLEND_GREEN] = fui(rctx->blend_color.color[1]);
- rstate->states[EG_BLEND__CB_BLEND_BLUE] = fui(rctx->blend_color.color[2]);
- rstate->states[EG_BLEND__CB_BLEND_ALPHA] = fui(rctx->blend_color.color[3]);
- rstate->states[EG_BLEND__CB_BLEND0_CONTROL] = 0x00000000;
- rstate->states[EG_BLEND__CB_BLEND1_CONTROL] = 0x00000000;
- rstate->states[EG_BLEND__CB_BLEND2_CONTROL] = 0x00000000;
- rstate->states[EG_BLEND__CB_BLEND3_CONTROL] = 0x00000000;
- rstate->states[EG_BLEND__CB_BLEND4_CONTROL] = 0x00000000;
- rstate->states[EG_BLEND__CB_BLEND5_CONTROL] = 0x00000000;
- rstate->states[EG_BLEND__CB_BLEND6_CONTROL] = 0x00000000;
- rstate->states[EG_BLEND__CB_BLEND7_CONTROL] = 0x00000000;
-
- for (i = 0; i < 8; i++) {
- unsigned eqRGB = state->rt[i].rgb_func;
- unsigned srcRGB = state->rt[i].rgb_src_factor;
- unsigned dstRGB = state->rt[i].rgb_dst_factor;
-
- unsigned eqA = state->rt[i].alpha_func;
- unsigned srcA = state->rt[i].alpha_src_factor;
- unsigned dstA = state->rt[i].alpha_dst_factor;
- uint32_t bc = 0;
-
- if (!state->rt[i].blend_enable)
- continue;
-
- bc |= S_028780_BLEND_CONTROL_ENABLE(1);
-
- bc |= S_028780_COLOR_COMB_FCN(r600_translate_blend_function(eqRGB));
- bc |= S_028780_COLOR_SRCBLEND(r600_translate_blend_factor(srcRGB));
- bc |= S_028780_COLOR_DESTBLEND(r600_translate_blend_factor(dstRGB));
-
- if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) {
- bc |= S_028780_SEPARATE_ALPHA_BLEND(1);
- bc |= S_028780_ALPHA_COMB_FCN(r600_translate_blend_function(eqA));
- bc |= S_028780_ALPHA_SRCBLEND(r600_translate_blend_factor(srcA));
- bc |= S_028780_ALPHA_DESTBLEND(r600_translate_blend_factor(dstA));
- }
-
- rstate->states[EG_BLEND__CB_BLEND0_CONTROL + i] = bc;
- }
-
- radeon_state_pm4(rstate);
-}
-
-static void eg_ucp(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_clip_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_UCP, 0, 0);
-
- for (int i = 0; i < state->nr; i++) {
- rstate->states[i * 4 + 0] = fui(state->ucp[i][0]);
- rstate->states[i * 4 + 1] = fui(state->ucp[i][1]);
- rstate->states[i * 4 + 2] = fui(state->ucp[i][2]);
- rstate->states[i * 4 + 3] = fui(state->ucp[i][3]);
- }
- radeon_state_pm4(rstate);
-}
-
-static void eg_cb(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_framebuffer_state *state, int cb)
-{
- struct r600_screen *rscreen = rctx->screen;
- struct r600_resource_texture *rtex;
- struct r600_resource *rbuffer;
- unsigned level = state->cbufs[cb]->level;
- unsigned pitch, slice;
- unsigned color_info;
- unsigned format, swap, ntype;
- const struct util_format_description *desc;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_CB0, cb, 0);
- rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
- rbuffer = &rtex->resource;
- radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo);
- rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM;
- rstate->nbo = 1;
- pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
- slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1;
-
- ntype = 0;
- desc = util_format_description(rtex->resource.base.b.format);
- if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
- ntype = V_028C70_NUMBER_SRGB;
-
- format = r600_translate_colorformat(rtex->resource.base.b.format);
- swap = r600_translate_colorswap(rtex->resource.base.b.format);
-
- color_info = S_028C70_FORMAT(format) |
- S_028C70_COMP_SWAP(swap) |
- S_028C70_BLEND_CLAMP(1) |
- S_028C70_SOURCE_FORMAT(1) |
- S_028C70_NUMBER_TYPE(ntype);
-
- rstate->states[EG_CB__CB_COLOR0_BASE] = state->cbufs[cb]->offset >> 8;
- rstate->states[EG_CB__CB_COLOR0_INFO] = color_info;
- rstate->states[EG_CB__CB_COLOR0_PITCH] = S_028C64_PITCH_TILE_MAX(pitch);
- rstate->states[EG_CB__CB_COLOR0_SLICE] = S_028C68_SLICE_TILE_MAX(slice);
- rstate->states[EG_CB__CB_COLOR0_VIEW] = 0x00000000;
- rstate->states[EG_CB__CB_COLOR0_ATTRIB] = S_028C74_NON_DISP_TILING_ORDER(1);
-
- radeon_state_pm4(rstate);
-}
-
-static void eg_db(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_framebuffer_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
- struct r600_resource_texture *rtex;
- struct r600_resource *rbuffer;
- unsigned level;
- unsigned pitch, slice, format;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_DB, 0, 0);
- if (state->zsbuf == NULL)
- return;
-
- rtex = (struct r600_resource_texture*)state->zsbuf->texture;
- rtex->tiled = 1;
- rtex->array_mode = 2;
- rtex->tile_type = 1;
- rtex->depth = 1;
- rbuffer = &rtex->resource;
-
- radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo);
- rstate->nbo = 1;
- rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM;
- level = state->zsbuf->level;
- pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
- slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1;
- format = r600_translate_dbformat(state->zsbuf->texture->format);
- rstate->states[EG_DB__DB_HTILE_DATA_BASE] = state->zsbuf->offset >> 8;
- rstate->states[EG_DB__DB_Z_READ_BASE] = state->zsbuf->offset >> 8;
- rstate->states[EG_DB__DB_Z_WRITE_BASE] = state->zsbuf->offset >> 8;
- rstate->states[EG_DB__DB_STENCIL_READ_BASE] = state->zsbuf->offset >> 8;
- rstate->states[EG_DB__DB_STENCIL_WRITE_BASE] = state->zsbuf->offset >> 8;
- rstate->states[EG_DB__DB_Z_INFO] = S_028040_ARRAY_MODE(rtex->array_mode) | S_028040_FORMAT(format);
- rstate->states[EG_DB__DB_DEPTH_VIEW] = 0x00000000;
- rstate->states[EG_DB__DB_DEPTH_SIZE] = S_028058_PITCH_TILE_MAX(pitch);
- rstate->states[EG_DB__DB_DEPTH_SLICE] = S_02805C_SLICE_TILE_MAX(slice);
- radeon_state_pm4(rstate);
-}
-
-static void eg_rasterizer(struct r600_context *rctx, struct radeon_state *rstate)
-{
- const struct pipe_rasterizer_state *state = &rctx->rasterizer->state.rasterizer;
- const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
- const struct pipe_clip_state *clip = NULL;
- struct r600_screen *rscreen = rctx->screen;
- float offset_units = 0, offset_scale = 0;
- char depth = 0;
- unsigned offset_db_fmt_cntl = 0;
- unsigned tmp;
- unsigned prov_vtx = 1;
- unsigned polygon_dual_mode;
-
- if (rctx->clip)
- clip = &rctx->clip->state.clip;
- if (fb->zsbuf) {
- offset_units = state->offset_units;
- offset_scale = state->offset_scale * 12.0f;
- switch (fb->zsbuf->texture->format) {
- case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
- depth = -24;
- offset_units *= 2.0f;
- break;
- case PIPE_FORMAT_Z32_FLOAT:
- depth = -23;
- offset_units *= 1.0f;
- offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_DB_IS_FLOAT_FMT(1);
- break;
- case PIPE_FORMAT_Z16_UNORM:
- depth = -16;
- offset_units *= 4.0f;
- break;
- default:
- R600_ERR("unsupported %d\n", fb->zsbuf->texture->format);
- return;
- }
- }
- offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(depth);
-
- if (state->flatshade_first)
- prov_vtx = 0;
-
- rctx->flat_shade = state->flatshade;
- radeon_state_init(rstate, rscreen->rw, R600_STATE_RASTERIZER, 0, 0);
- rstate->states[EG_RASTERIZER__SPI_INTERP_CONTROL_0] = 0x00000000;
- if (rctx->flat_shade)
- rstate->states[EG_RASTERIZER__SPI_INTERP_CONTROL_0] |= S_0286D4_FLAT_SHADE_ENA(1);
- if (state->sprite_coord_enable) {
- rstate->states[EG_RASTERIZER__SPI_INTERP_CONTROL_0] |=
- S_0286D4_PNT_SPRITE_ENA(1) |
- S_0286D4_PNT_SPRITE_OVRD_X(2) |
- S_0286D4_PNT_SPRITE_OVRD_Y(3) |
- S_0286D4_PNT_SPRITE_OVRD_Z(0) |
- S_0286D4_PNT_SPRITE_OVRD_W(1);
- if (state->sprite_coord_mode != PIPE_SPRITE_COORD_UPPER_LEFT) {
- rstate->states[EG_RASTERIZER__SPI_INTERP_CONTROL_0] |=
- S_0286D4_PNT_SPRITE_TOP_1(1);
- }
- }
- rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] = 0;
- if (clip) {
- rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] = S_028810_PS_UCP_MODE(3) | ((1 << clip->nr) - 1);
- rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_NEAR_DISABLE(clip->depth_clamp);
- rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_FAR_DISABLE(clip->depth_clamp);
- }
- polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL ||
- state->fill_back != PIPE_POLYGON_MODE_FILL);
-
- rstate->states[EG_RASTERIZER__PA_SU_SC_MODE_CNTL] =
- S_028814_PROVOKING_VTX_LAST(prov_vtx) |
- S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) |
- S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) |
- S_028814_FACE(!state->front_ccw) |
- S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) |
- S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) |
- S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri) |
- S_028814_POLY_MODE(polygon_dual_mode) |
- S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) |
- S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back));
- rstate->states[EG_RASTERIZER__PA_CL_VS_OUT_CNTL] =
- S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) |
- S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex);
- rstate->states[EG_RASTERIZER__PA_CL_NANINF_CNTL] = 0x00000000;
- /* point size 12.4 fixed point */
- tmp = (unsigned)(state->point_size * 8.0);
- rstate->states[EG_RASTERIZER__PA_SU_POINT_SIZE] = S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp);
- rstate->states[EG_RASTERIZER__PA_SU_POINT_MINMAX] = 0x80000000;
- rstate->states[EG_RASTERIZER__PA_SU_LINE_CNTL] = 0x00000008;
- rstate->states[EG_RASTERIZER__PA_SU_VTX_CNTL] = 0x00000005;
-
- rstate->states[EG_RASTERIZER__PA_SC_MPASS_PS_CNTL] = 0x00000000;
- rstate->states[EG_RASTERIZER__PA_SC_LINE_CNTL] = 0x00000400;
- rstate->states[EG_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ] = 0x3F800000;
- rstate->states[EG_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ] = 0x3F800000;
- rstate->states[EG_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ] = 0x3F800000;
- rstate->states[EG_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ] = 0x3F800000;
- rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL] = offset_db_fmt_cntl;
- rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP] = 0x00000000;
- rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE] = fui(offset_scale);
- rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET] = fui(offset_units);
- rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE] = fui(offset_scale);
- rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET] = fui(offset_units);
- radeon_state_pm4(rstate);
-}
-
-static void eg_scissor(struct r600_context *rctx, struct radeon_state *rstate)
-{
- const struct pipe_scissor_state *state = &rctx->scissor->state.scissor;
- const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
- struct r600_screen *rscreen = rctx->screen;
- unsigned minx, maxx, miny, maxy;
- u32 tl, br;
-
- if (state == NULL) {
- minx = 0;
- miny = 0;
- maxx = fb->cbufs[0]->width;
- maxy = fb->cbufs[0]->height;
- } else {
- minx = state->minx;
- miny = state->miny;
- maxx = state->maxx;
- maxy = state->maxy;
- }
- tl = S_028240_TL_X(minx) | S_028240_TL_Y(miny);
- br = S_028244_BR_X(maxx) | S_028244_BR_Y(maxy);
- radeon_state_init(rstate, rscreen->rw, R600_STATE_SCISSOR, 0, 0);
- /* screen scissor has no WINDOW OFFSET */
- rstate->states[EG_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = tl;
- rstate->states[EG_SCISSOR__PA_SC_SCREEN_SCISSOR_BR] = br;
- rstate->states[EG_SCISSOR__PA_SC_WINDOW_OFFSET] = 0x00000000;
- rstate->states[EG_SCISSOR__PA_SC_WINDOW_SCISSOR_TL] = tl | S_028204_WINDOW_OFFSET_DISABLE(1);
- rstate->states[EG_SCISSOR__PA_SC_WINDOW_SCISSOR_BR] = br;
- rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_RULE] = 0x0000FFFF;
- rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_0_TL] = tl;
- rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_0_BR] = br;
- rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_1_TL] = tl;
- rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_1_BR] = br;
- rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_2_TL] = tl;
- rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_2_BR] = br;
- rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_3_TL] = tl;
- rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_3_BR] = br;
- rstate->states[EG_SCISSOR__PA_SC_EDGERULE] = 0xAAAAAAAA;
- rstate->states[EG_SCISSOR__PA_SC_GENERIC_SCISSOR_TL] = tl | S_028240_WINDOW_OFFSET_DISABLE(1);
- rstate->states[EG_SCISSOR__PA_SC_GENERIC_SCISSOR_BR] = br;
- rstate->states[EG_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL] = tl | S_028240_WINDOW_OFFSET_DISABLE(1);
- rstate->states[EG_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR] = br;
- radeon_state_pm4(rstate);
-}
-
-static void eg_viewport(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_viewport_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_VIEWPORT, 0, 0);
- rstate->states[EG_VIEWPORT__PA_SC_VPORT_ZMIN_0] = 0x00000000;
- rstate->states[EG_VIEWPORT__PA_SC_VPORT_ZMAX_0] = 0x3F800000;
- rstate->states[EG_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui(state->scale[0]);
- rstate->states[EG_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui(state->scale[1]);
- rstate->states[EG_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = fui(state->scale[2]);
- rstate->states[EG_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = fui(state->translate[0]);
- rstate->states[EG_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui(state->translate[1]);
- rstate->states[EG_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = fui(state->translate[2]);
- rstate->states[EG_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F;
- radeon_state_pm4(rstate);
-}
-
-static void eg_dsa(struct r600_context *rctx, struct radeon_state *rstate)
-{
- const struct pipe_depth_stencil_alpha_state *state = &rctx->dsa->state.dsa;
- const struct pipe_stencil_ref *stencil_ref = &rctx->stencil_ref->state.stencil_ref;
- struct r600_screen *rscreen = rctx->screen;
- unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control;
- unsigned stencil_ref_mask, stencil_ref_mask_bf, db_render_override, db_render_control;
- unsigned db_count_control = 0;
- struct r600_shader *rshader;
- struct r600_query *rquery = NULL;
- boolean query_running;
- int i;
-
- if (rctx->ps_shader == NULL) {
- return;
- }
- radeon_state_init(rstate, rscreen->rw, R600_STATE_DSA, 0, 0);
-
- db_shader_control = 0;
- db_shader_control |= S_02880C_DUAL_EXPORT_ENABLE(1);
- db_shader_control |= S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z);
-
- rshader = &rctx->ps_shader->shader;
- if (rshader->uses_kill)
- db_shader_control |= S_02880C_KILL_ENABLE(1);
- for (i = 0; i < rshader->noutput; i++) {
- if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
- db_shader_control |= S_02880C_Z_EXPORT_ENABLE(1);
- }
- stencil_ref_mask = 0;
- stencil_ref_mask_bf = 0;
- db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) |
- S_028800_Z_WRITE_ENABLE(state->depth.writemask) |
- S_028800_ZFUNC(state->depth.func);
- /* set stencil enable */
-
- if (state->stencil[0].enabled) {
- db_depth_control |= S_028800_STENCIL_ENABLE(1);
- db_depth_control |= S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func));
- db_depth_control |= S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op));
- db_depth_control |= S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op));
- db_depth_control |= S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op));
-
- stencil_ref_mask = S_028430_STENCILMASK(state->stencil[0].valuemask) |
- S_028430_STENCILWRITEMASK(state->stencil[0].writemask);
- stencil_ref_mask |= S_028430_STENCILREF(stencil_ref->ref_value[0]);
- if (state->stencil[1].enabled) {
- db_depth_control |= S_028800_BACKFACE_ENABLE(1);
- db_depth_control |= S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func));
- db_depth_control |= S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op));
- db_depth_control |= S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op));
- db_depth_control |= S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op));
- stencil_ref_mask_bf = S_028434_STENCILMASK_BF(state->stencil[1].valuemask) |
- S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask);
- stencil_ref_mask_bf |= S_028430_STENCILREF(stencil_ref->ref_value[1]);
- }
- }
-
- alpha_test_control = 0;
- alpha_ref = 0;
- if (state->alpha.enabled) {
- alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func);
- alpha_test_control |= S_028410_ALPHA_TEST_ENABLE(1);
- alpha_ref = fui(state->alpha.ref_value);
- }
-
- db_render_control = 0;
-/// db_render_control = S_028D0C_STENCIL_COMPRESS_DISABLE(1) |
-/// S_028D0C_DEPTH_COMPRESS_DISABLE(1);
- db_render_override = S_02800C_FORCE_HIZ_ENABLE(V_02800C_FORCE_DISABLE) |
- S_02800C_FORCE_HIS_ENABLE0(V_02800C_FORCE_DISABLE) |
- S_02800C_FORCE_HIS_ENABLE1(V_02800C_FORCE_DISABLE);
-
- query_running = FALSE;
-
- LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) {
- if (rquery->state & R600_QUERY_STATE_STARTED) {
- query_running = TRUE;
- }
- }
-
- if (query_running) {
- db_render_override |= S_02800C_NOOP_CULL_DISABLE(1);
- db_count_control |= S_028004_PERFECT_ZPASS_COUNTS(1);
- }
-
- rstate->states[EG_DSA__DB_STENCIL_CLEAR] = 0x00000000;
- rstate->states[EG_DSA__DB_DEPTH_CLEAR] = 0x3F800000;
- rstate->states[EG_DSA__SX_ALPHA_TEST_CONTROL] = alpha_test_control;
- rstate->states[EG_DSA__DB_STENCILREFMASK] = stencil_ref_mask;
- rstate->states[EG_DSA__DB_STENCILREFMASK_BF] = stencil_ref_mask_bf;
- rstate->states[EG_DSA__SX_ALPHA_REF] = alpha_ref;
- // rstate->states[EG_DSA__SPI_FOG_FUNC_SCALE] = 0x00000000;
- // rstate->states[EG_DSA__SPI_FOG_FUNC_BIAS] = 0x00000000;
- rstate->states[EG_DSA__SPI_FOG_CNTL] = 0x00000000;
- rstate->states[EG_DSA__DB_DEPTH_CONTROL] = db_depth_control;
- rstate->states[EG_DSA__DB_SHADER_CONTROL] = db_shader_control;
- rstate->states[EG_DSA__DB_RENDER_CONTROL] = db_render_control;
- rstate->states[EG_DSA__DB_RENDER_OVERRIDE] = db_render_override;
- rstate->states[EG_DSA__DB_COUNT_CONTROL] = db_count_control;
- rstate->states[EG_DSA__DB_SRESULTS_COMPARE_STATE1] = 0x00000000;
- rstate->states[EG_DSA__DB_PRELOAD_CONTROL] = 0x00000000;
- rstate->states[EG_DSA__DB_ALPHA_TO_MASK] = 0x0000AA00;
- radeon_state_pm4(rstate);
-}
-
-
-static INLINE u32 S_FIXED(float value, u32 frac_bits)
-{
- return value * (1 << frac_bits);
-}
-
-static void eg_sampler_border(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_sampler_state *state, unsigned id)
-{
- struct r600_screen *rscreen = rctx->screen;
- union util_color uc;
-
- util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER_BORDER, id, R600_SHADER_PS);
- if (uc.ui) {
- rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_INDEX] = id;
- rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED] = fui(state->border_color[0]);
- rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN] = fui(state->border_color[1]);
- rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE] = fui(state->border_color[2]);
- rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA] = fui(state->border_color[3]);
- }
- radeon_state_pm4(rstate);
-}
-
-static void eg_sampler(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_sampler_state *state, unsigned id)
-{
- struct r600_screen *rscreen = rctx->screen;
- union util_color uc;
-
- util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER, id, R600_SHADER_PS);
- rstate->states[EG_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0] =
- S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) |
- S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) |
- S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) |
- S_03C000_XY_MAG_FILTER(r600_tex_filter(state->mag_img_filter)) |
- S_03C000_XY_MIN_FILTER(r600_tex_filter(state->min_img_filter)) |
- S_03C000_MIP_FILTER(r600_tex_mipfilter(state->min_mip_filter)) |
- S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) |
- S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0);
- /* FIXME LOD it depends on texture base level ... */
- rstate->states[EG_PS_SAMPLER__SQ_TEX_SAMPLER_WORD1_0] =
- S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) |
- S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6));
-
- rstate->states[EG_PS_SAMPLER__SQ_TEX_SAMPLER_WORD2_0] =
- S_03C008_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)) |
-S_03C008_TYPE(1);
- radeon_state_pm4(rstate);
-
-}
-
-
-static void eg_resource(struct pipe_context *ctx, struct radeon_state *rstate,
- const struct pipe_sampler_view *view, unsigned id)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_screen *rscreen = rctx->screen;
- const struct util_format_description *desc;
- struct r600_resource_texture *tmp;
- struct r600_resource *rbuffer;
- unsigned format;
- uint32_t word4 = 0, yuv_format = 0, pitch = 0;
- unsigned char swizzle[4];
-
- rstate->cpm4 = 0;
- swizzle[0] = view->swizzle_r;
- swizzle[1] = view->swizzle_g;
- swizzle[2] = view->swizzle_b;
- swizzle[3] = view->swizzle_a;
- format = r600_translate_texformat(view->texture->format,
- swizzle,
- &word4, &yuv_format);
- if (format == ~0) {
- return;
- }
- desc = util_format_description(view->texture->format);
- if (desc == NULL) {
- R600_ERR("unknow format %d\n", view->texture->format);
- return;
- }
- radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_PS);
- tmp = (struct r600_resource_texture*)view->texture;
- rbuffer = &tmp->resource;
- radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo);
- radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], rbuffer->bo);
-
- rstate->nbo = 2;
- rstate->placement[0] = RADEON_GEM_DOMAIN_GTT;
- rstate->placement[1] = RADEON_GEM_DOMAIN_GTT;
- rstate->placement[2] = RADEON_GEM_DOMAIN_GTT;
- rstate->placement[3] = RADEON_GEM_DOMAIN_GTT;
-
- pitch = align(tmp->pitch[0] / tmp->bpt, 8);
-
- /* FIXME properly handle first level != 0 */
- rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD0] =
- S_030000_DIM(r600_tex_dim(view->texture->target)) |
- S_030000_PITCH((pitch / 8) - 1) |
- S_030000_TEX_WIDTH(view->texture->width0 - 1);
- rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD1] =
- S_030004_TEX_HEIGHT(view->texture->height0 - 1) |
- S_030004_TEX_DEPTH(view->texture->depth0 - 1);
- rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD2] = tmp->offset[0] >> 8;
- rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD3] = tmp->offset[1] >> 8;
- rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD4] =
- word4 |
- S_030010_NUM_FORMAT_ALL(V_030010_SQ_NUM_FORMAT_NORM) |
- S_030010_SRF_MODE_ALL(V_030010_SFR_MODE_NO_ZERO) |
- S_030010_REQUEST_SIZE(1) |
- S_030010_BASE_LEVEL(view->first_level);
- rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD5] =
- S_030014_LAST_LEVEL(view->last_level) |
- S_030014_BASE_ARRAY(0) |
- S_030014_LAST_ARRAY(0);
- rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD6] = 0;
- rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD7] =
- S_03001C_DATA_FORMAT(format) |
- S_03001C_TYPE(V_03001C_SQ_TEX_VTX_VALID_TEXTURE);
- radeon_state_pm4(rstate);
-}
-
-static void eg_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate)
-{
- struct r600_screen *rscreen = rctx->screen;
- const struct pipe_blend_state *pbs = &rctx->blend->state.blend;
- int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs;
- uint32_t color_control, target_mask, shader_mask;
- int i;
-
- target_mask = 0;
- shader_mask = 0;
- color_control = S_028808_MODE(1);
-
- for (i = 0; i < nr_cbufs; i++) {
- shader_mask |= 0xf << (i * 4);
- }
-
- if (pbs->logicop_enable) {
- color_control |= (pbs->logicop_func << 16) | (pbs->logicop_func << 20);
- } else {
- color_control |= (0xcc << 16);
- }
-
- if (pbs->independent_blend_enable) {
- for (i = 0; i < nr_cbufs; i++) {
- target_mask |= (pbs->rt[i].colormask << (4 * i));
- }
- } else {
- for (i = 0; i < nr_cbufs; i++) {
- target_mask |= (pbs->rt[0].colormask << (4 * i));
- }
- }
- radeon_state_init(rstate, rscreen->rw, R600_STATE_CB_CNTL, 0, 0);
- rstate->states[EG_CB_CNTL__CB_SHADER_MASK] = shader_mask;
- rstate->states[EG_CB_CNTL__CB_TARGET_MASK] = target_mask;
- rstate->states[EG_CB_CNTL__CB_COLOR_CONTROL] = color_control;
- rstate->states[EG_CB_CNTL__PA_SC_AA_CONFIG] = 0x00000000;
- rstate->states[EG_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX] = 0x00000000;
- rstate->states[EG_CB_CNTL__PA_SC_AA_MASK] = 0xFFFFFFFF;
- radeon_state_pm4(rstate);
-}
-
-
-static void eg_init_config(struct r600_context *rctx)
-{
- int ps_prio;
- int vs_prio;
- int gs_prio;
- int es_prio;
- int hs_prio, cs_prio, ls_prio;
- int num_ps_gprs;
- int num_vs_gprs;
- int num_gs_gprs;
- int num_es_gprs;
- int num_hs_gprs;
- int num_ls_gprs;
- int num_temp_gprs;
- int num_ps_threads;
- int num_vs_threads;
- int num_gs_threads;
- int num_es_threads;
- int num_hs_threads;
- int num_ls_threads;
- int num_ps_stack_entries;
- int num_vs_stack_entries;
- int num_gs_stack_entries;
- int num_es_stack_entries;
- int num_hs_stack_entries;
- int num_ls_stack_entries;
- enum radeon_family family;
-
- family = radeon_get_family(rctx->rw);
- ps_prio = 0;
- vs_prio = 1;
- gs_prio = 2;
- es_prio = 3;
- hs_prio = 0;
- ls_prio = 0;
- cs_prio = 0;
-
- switch (family) {
- case CHIP_CEDAR:
- default:
- num_ps_gprs = 93;
- num_vs_gprs = 46;
- num_temp_gprs = 4;
- num_gs_gprs = 31;
- num_es_gprs = 31;
- num_hs_gprs = 23;
- num_ls_gprs = 23;
- num_ps_threads = 96;
- num_vs_threads = 16;
- num_gs_threads = 16;
- num_es_threads = 16;
- num_hs_threads = 16;
- num_ls_threads = 16;
- num_ps_stack_entries = 42;
- num_vs_stack_entries = 42;
- num_gs_stack_entries = 42;
- num_es_stack_entries = 42;
- num_hs_stack_entries = 42;
- num_ls_stack_entries = 42;
- break;
- case CHIP_REDWOOD:
- num_ps_gprs = 93;
- num_vs_gprs = 46;
- num_temp_gprs = 4;
- num_gs_gprs = 31;
- num_es_gprs = 31;
- num_hs_gprs = 23;
- num_ls_gprs = 23;
- num_ps_threads = 128;
- num_vs_threads = 20;
- num_gs_threads = 20;
- num_es_threads = 20;
- num_hs_threads = 20;
- num_ls_threads = 20;
- num_ps_stack_entries = 42;
- num_vs_stack_entries = 42;
- num_gs_stack_entries = 42;
- num_es_stack_entries = 42;
- num_hs_stack_entries = 42;
- num_ls_stack_entries = 42;
- break;
- case CHIP_JUNIPER:
- num_ps_gprs = 93;
- num_vs_gprs = 46;
- num_temp_gprs = 4;
- num_gs_gprs = 31;
- num_es_gprs = 31;
- num_hs_gprs = 23;
- num_ls_gprs = 23;
- num_ps_threads = 128;
- num_vs_threads = 20;
- num_gs_threads = 20;
- num_es_threads = 20;
- num_hs_threads = 20;
- num_ls_threads = 20;
- num_ps_stack_entries = 85;
- num_vs_stack_entries = 85;
- num_gs_stack_entries = 85;
- num_es_stack_entries = 85;
- num_hs_stack_entries = 85;
- num_ls_stack_entries = 85;
- break;
- case CHIP_CYPRESS:
- case CHIP_HEMLOCK:
- num_ps_gprs = 93;
- num_vs_gprs = 46;
- num_temp_gprs = 4;
- num_gs_gprs = 31;
- num_es_gprs = 31;
- num_hs_gprs = 23;
- num_ls_gprs = 23;
- num_ps_threads = 128;
- num_vs_threads = 20;
- num_gs_threads = 20;
- num_es_threads = 20;
- num_hs_threads = 20;
- num_ls_threads = 20;
- num_ps_stack_entries = 85;
- num_vs_stack_entries = 85;
- num_gs_stack_entries = 85;
- num_es_stack_entries = 85;
- num_hs_stack_entries = 85;
- num_ls_stack_entries = 85;
- break;
- }
-
- radeon_state_init(&rctx->config, rctx->rw, R600_STATE_CONFIG, 0, 0);
-
- rctx->config.states[EG_CONFIG__SQ_CONFIG] = 0x00000000;
- switch (family) {
- case CHIP_CEDAR:
- break;
- default:
- rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_VC_ENABLE(1);
- break;
- }
- rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_EXPORT_SRC_C(1);
- rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_CS_PRIO(cs_prio);
- rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_LS_PRIO(ls_prio);
- rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_HS_PRIO(hs_prio);
- rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_PS_PRIO(ps_prio);
- rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_VS_PRIO(vs_prio);
- rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_GS_PRIO(gs_prio);
- rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_ES_PRIO(es_prio);
-
- rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_1] = 0;
- rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_PS_GPRS(num_ps_gprs);
- rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_VS_GPRS(num_vs_gprs);
- rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs);
-
- rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_2] = 0;
- rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_gs_gprs);
- rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_ES_GPRS(num_es_gprs);
-
- rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_3] = 0;
- rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_3] |= S_008C0C_NUM_HS_GPRS(num_hs_gprs);
- rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_3] |= S_008C0C_NUM_LS_GPRS(num_ls_gprs);
-
- rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] = 0;
- rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] |= S_008C18_NUM_PS_THREADS(num_ps_threads);
- rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] |= S_008C18_NUM_VS_THREADS(num_vs_threads);
- rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] |= S_008C18_NUM_GS_THREADS(num_gs_threads);
- rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] |= S_008C18_NUM_ES_THREADS(num_es_threads);
-
- rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_2] = 0;
- rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_2] |= S_008C1C_NUM_HS_THREADS(num_hs_threads);
- rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_2] |= S_008C1C_NUM_LS_THREADS(num_ls_threads);
-
- rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_1] = 0;
- rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C20_NUM_PS_STACK_ENTRIES(num_ps_stack_entries);
- rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C20_NUM_VS_STACK_ENTRIES(num_vs_stack_entries);
-
- rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_2] = 0;
- rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C24_NUM_GS_STACK_ENTRIES(num_gs_stack_entries);
- rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C24_NUM_ES_STACK_ENTRIES(num_es_stack_entries);
-
- rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_3] = 0;
- rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_3] |= S_008C28_NUM_HS_STACK_ENTRIES(num_hs_stack_entries);
- rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_3] |= S_008C28_NUM_LS_STACK_ENTRIES(num_ls_stack_entries);
-
- rctx->config.states[EG_CONFIG__SPI_CONFIG_CNTL] = 0x00000000;
- rctx->config.states[EG_CONFIG__SPI_CONFIG_CNTL_1] = S_00913C_VTX_DONE_DELAY(4);
-
- rctx->config.states[EG_CONFIG__SX_MISC] = 0x00000000;
-
- rctx->config.states[EG_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00000000;
- rctx->config.states[EG_CONFIG__PA_SC_MODE_CNTL_0] = 0x0;
- rctx->config.states[EG_CONFIG__PA_SC_MODE_CNTL_1] = 0x0;
-
- rctx->config.states[EG_CONFIG__SQ_ESGS_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[EG_CONFIG__SQ_GSVS_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[EG_CONFIG__SQ_ESTMP_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[EG_CONFIG__SQ_GSTMP_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[EG_CONFIG__SQ_VSTMP_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[EG_CONFIG__SQ_PSTMP_RING_ITEMSIZE] = 0x00000000;
-
- rctx->config.states[EG_CONFIG__SQ_GS_VERT_ITEMSIZE] = 0x00000000;
- rctx->config.states[EG_CONFIG__SQ_GS_VERT_ITEMSIZE_1] = 0x00000000;
- rctx->config.states[EG_CONFIG__SQ_GS_VERT_ITEMSIZE_2] = 0x00000000;
- rctx->config.states[EG_CONFIG__SQ_GS_VERT_ITEMSIZE_3] = 0x00000000;
-
- rctx->config.states[EG_CONFIG__VGT_OUTPUT_PATH_CNTL] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_HOS_CNTL] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_HOS_MAX_TESS_LEVEL] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_HOS_MIN_TESS_LEVEL] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_HOS_REUSE_DEPTH] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_GROUP_PRIM_TYPE] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_GROUP_FIRST_DECR] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_GROUP_DECR] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_GROUP_VECT_0_CNTL] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_GROUP_VECT_1_CNTL] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_GS_MODE] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_STRMOUT_CONFIG] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_STRMOUT_BUFFER_CONFIG] = 0x00000000;
- rctx->config.states[EG_CONFIG__VGT_REUSE_OFF] = 0x00000001;
- rctx->config.states[EG_CONFIG__VGT_VTX_CNT_EN] = 0x00000000;
-// rctx->config.states[EG_CONFIG__VGT_CACHE_INVALIDATION] = 0x2;
-// rctx->config.states[EG_CONFIG__VGT_GS_VERTEX_REUSE] = 0x16;
- rctx->config.states[EG_CONFIG__PA_CL_ENHANCE] = (3 << 1) | 1;
-
- radeon_state_pm4(&rctx->config);
-}
-
-static int eg_vs_resource(struct r600_context *rctx, int id, struct r600_resource *rbuffer, uint32_t offset,
- uint32_t stride, uint32_t src_format)
-{
- struct radeon_state *vs_resource = &rctx->vs_resource[id];
- struct r600_screen *rscreen = rctx->screen;
- unsigned format, num_format = 0, format_comp = 0;
-
- format = r600_translate_colorformat(src_format);
-
- r600_translate_vertex_num_format(src_format, &num_format, &format_comp);
- format = S_030008_DATA_FORMAT(format) | S_030008_NUM_FORMAT_ALL(num_format) |
- S_030008_FORMAT_COMP_ALL(format_comp);
-
- radeon_state_init(vs_resource, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_VS);
-
- radeon_ws_bo_reference(rscreen->rw, &vs_resource->bo[0], rbuffer->bo);
- vs_resource->nbo = 1;
- vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD0] = offset;
- vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD1] = rbuffer->size - offset - 1;
- vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD2] = S_030008_STRIDE(stride) | format;
- vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD3] = S_03000C_DST_SEL_X(V_03000C_SQ_SEL_X) |
- S_03000C_DST_SEL_Y(V_03000C_SQ_SEL_Y) |
- S_03000C_DST_SEL_Z(V_03000C_SQ_SEL_Z) |
- S_03000C_DST_SEL_W(V_03000C_SQ_SEL_W);
-
- vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD4] = 0x00000000;
- vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD5] = 0x00000000;
- vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD6] = 0x00000000;
- vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD7] = 0xC0000000;
- vs_resource->placement[0] = RADEON_GEM_DOMAIN_GTT;
- vs_resource->placement[1] = RADEON_GEM_DOMAIN_GTT;
- return radeon_state_pm4(vs_resource);
-}
-
-static int eg_draw_vgt_init(struct r600_draw *draw,
- int vgt_draw_initiator)
-{
- struct r600_context *rctx = r600_context(draw->ctx);
- struct r600_screen *rscreen = rctx->screen;
- struct r600_resource *rbuffer = (struct r600_resource *)draw->index_buffer;
- radeon_state_init(&draw->draw, rscreen->rw, R600_STATE_DRAW, 0, 0);
- draw->draw.states[EG_DRAW__VGT_NUM_INDICES] = draw->count;
- draw->draw.states[EG_DRAW__VGT_DRAW_INITIATOR] = vgt_draw_initiator;
- draw->draw.states[EG_DRAW__VGT_DMA_BASE] = draw->index_buffer_offset;
- if (rbuffer) {
- radeon_ws_bo_reference(rscreen->rw, &draw->draw.bo[0], rbuffer->bo);
- draw->draw.placement[0] = RADEON_GEM_DOMAIN_GTT;
- draw->draw.placement[1] = RADEON_GEM_DOMAIN_GTT;
- draw->draw.nbo = 1;
- }
- return radeon_state_pm4(&draw->draw);
-}
-
-static int eg_draw_vgt_prim(struct r600_draw *draw,
- uint32_t prim, uint32_t vgt_dma_index_type)
-{
- struct r600_context *rctx = r600_context(draw->ctx);
- struct r600_screen *rscreen = rctx->screen;
- radeon_state_init(&draw->vgt, rscreen->rw, R600_STATE_VGT, 0, 0);
- draw->vgt.states[EG_VGT__VGT_PRIMITIVE_TYPE] = prim;
- draw->vgt.states[EG_VGT__VGT_MAX_VTX_INDX] = draw->max_index;
- draw->vgt.states[EG_VGT__VGT_MIN_VTX_INDX] = draw->min_index;
- draw->vgt.states[EG_VGT__VGT_INDX_OFFSET] = draw->index_bias;
- draw->vgt.states[EG_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type;
- draw->vgt.states[EG_VGT__VGT_PRIMITIVEID_EN] = 0x00000000;
- draw->vgt.states[EG_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001;
- draw->vgt.states[EG_VGT__VGT_MULTI_PRIM_IB_RESET_EN] = 0x00000000;
- draw->vgt.states[EG_VGT__VGT_INSTANCE_STEP_RATE_0] = 0x00000000;
- draw->vgt.states[EG_VGT__VGT_INSTANCE_STEP_RATE_1] = 0x00000000;
- return radeon_state_pm4(&draw->vgt);
-}
-
-
-static int eg_ps_shader(struct r600_context *rctx, struct r600_context_state *rpshader,
- struct radeon_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
- const struct pipe_rasterizer_state *rasterizer;
- struct r600_shader *rshader = &rpshader->shader;
- unsigned i, tmp, exports_ps, num_cout;
- boolean have_pos = FALSE, have_face = FALSE;
-
- rasterizer = &rctx->rasterizer->state.rasterizer;
-
- radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS);
- for (i = 0; i < rshader->ninput; i++) {
- tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(rctx, rshader, i));
- if (rshader->input[i].name == TGSI_SEMANTIC_POSITION)
- have_pos = TRUE;
- if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
- rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
- rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
- tmp |= S_028644_FLAT_SHADE(rshader->flat_shade);
- }
-
- if (rshader->input[i].name == TGSI_SEMANTIC_FACE)
- have_face = TRUE;
-
- if (rasterizer->sprite_coord_enable & (1 << i)) {
- tmp |= S_028644_PT_SPRITE_TEX(1);
- }
- state->states[EG_PS_SHADER__SPI_PS_INPUT_CNTL_0 + i] = tmp;
- }
-
- exports_ps = 0;
- num_cout = 0;
- for (i = 0; i < rshader->noutput; i++) {
- if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
- exports_ps |= 1;
- else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) {
- num_cout++;
- }
- }
- exports_ps |= (1 << num_cout);
- if (!exports_ps) {
- /* always at least export 1 component per pixel */
- exports_ps = 2;
- }
- state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_0] = S_0286CC_NUM_INTERP(rshader->ninput) |
- S_0286CC_PERSP_GRADIENT_ENA(1);
- if (have_pos) {
- state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_0] |= S_0286CC_POSITION_ENA(1);
- state->states[EG_PS_SHADER__SPI_INPUT_Z] |= 1;
- }
-
- state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000;
- state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_1] |= S_0286D0_FRONT_FACE_ENA(have_face);
-
- state->states[EG_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028844_NUM_GPRS(rshader->bc.ngpr) | S_028844_PRIME_CACHE_ON_DRAW(1) |
- S_028844_STACK_SIZE(rshader->bc.nstack);
- state->states[EG_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps;
- state->states[EG_PS_SHADER__SPI_BARYC_CNTL] = S_0286E0_PERSP_CENTROID_ENA(1) |
- S_0286E0_LINEAR_CENTROID_ENA(1);
- radeon_ws_bo_reference(rscreen->rw, &state->bo[0], rpshader->bo);
- state->nbo = 1;
- state->placement[0] = RADEON_GEM_DOMAIN_GTT;
- return radeon_state_pm4(state);
-}
-
-static int eg_vs_shader(struct r600_context *rctx, struct r600_context_state *rpshader,
- struct radeon_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
- struct r600_shader *rshader = &rpshader->shader;
- unsigned i, tmp;
-
- radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS);
- for (i = 0; i < 10; i++) {
- state->states[EG_VS_SHADER__SPI_VS_OUT_ID_0 + i] = 0;
- }
- /* so far never got proper semantic id from tgsi */
- for (i = 0; i < 32; i++) {
- tmp = i << ((i & 3) * 8);
- state->states[EG_VS_SHADER__SPI_VS_OUT_ID_0 + i / 4] |= tmp;
- }
- state->states[EG_VS_SHADER__SPI_VS_OUT_CONFIG] = S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2);
- state->states[EG_VS_SHADER__SQ_PGM_RESOURCES_VS] = S_028860_NUM_GPRS(rshader->bc.ngpr) |
- S_028860_STACK_SIZE(rshader->bc.nstack);
- radeon_ws_bo_reference(rscreen->rw, &state->bo[0], rpshader->bo);
- radeon_ws_bo_reference(rscreen->rw, &state->bo[1], rpshader->bo);
- state->nbo = 2;
- state->placement[0] = RADEON_GEM_DOMAIN_GTT;
- state->placement[2] = RADEON_GEM_DOMAIN_GTT;
- return radeon_state_pm4(state);
-
-}
-
-struct r600_context_hw_state_vtbl eg_hw_state_vtbl = {
- .blend = eg_blend,
- .ucp = eg_ucp,
- .cb = eg_cb,
- .db = eg_db,
- .rasterizer = eg_rasterizer,
- .scissor = eg_scissor,
- .viewport = eg_viewport,
- .dsa = eg_dsa,
- .sampler_border = eg_sampler_border,
- .sampler = eg_sampler,
- .resource = eg_resource,
- .cb_cntl = eg_cb_cntl,
- .vs_resource = eg_vs_resource,
- .vgt_init = eg_draw_vgt_init,
- .vgt_prim = eg_draw_vgt_prim,
- .vs_shader = eg_vs_shader,
- .ps_shader = eg_ps_shader,
- .init_config = eg_init_config,
-};
-
-void eg_set_constant_buffer(struct pipe_context *ctx,
- uint shader, uint index,
- struct pipe_resource *buffer)
-{
- struct r600_screen *rscreen = r600_screen(ctx->screen);
- struct r600_context *rctx = r600_context(ctx);
- unsigned nconstant = 0, type, shader_class, size;
- struct radeon_state *rstate, *rstates;
- struct r600_resource *rbuffer = (struct r600_resource*)buffer;
-
- type = R600_STATE_CBUF;
-
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- shader_class = R600_SHADER_VS;
- rstates = rctx->vs_constant;
- break;
- case PIPE_SHADER_FRAGMENT:
- shader_class = R600_SHADER_PS;
- rstates = rctx->ps_constant;
- break;
- default:
- R600_ERR("unsupported %d\n", shader);
- return;
- }
-
- rstate = &rstates[0];
-
-#define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y))
- nconstant = buffer->width0 / 16;
- size = ALIGN_DIVUP(nconstant, 16);
-
- radeon_state_init(rstate, rscreen->rw, type, 0, shader_class);
- rstate->states[EG_VS_CBUF__ALU_CONST_BUFFER_SIZE_VS_0] = size;
- rstate->states[EG_VS_CBUF__ALU_CONST_CACHE_VS_0] = 0;
-
- radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo);
- rstate->nbo = 1;
- rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM;
- if (radeon_state_pm4(rstate))
- return;
- radeon_draw_bind(&rctx->draw, rstate);
-}
#include "util/u_format.h"
#include "evergreend.h"
+#include "r600_formats.h"
static INLINE uint32_t r600_translate_blend_function(int blend_func)
{
}
}
+static inline uint32_t r600_translate_stencilformat(enum pipe_format format)
+{
+ if (format == PIPE_FORMAT_Z24_UNORM_S8_USCALED)
+ return 1;
+ else
+ return 0;
+}
+
static inline uint32_t r600_translate_colorswap(enum pipe_format format)
{
switch (format) {
case PIPE_FORMAT_Z16_UNORM:
return V_028C70_SWAP_STD;
+
+ case PIPE_FORMAT_R8G8_UNORM:
+ return V_028C70_SWAP_STD;
+
+ case PIPE_FORMAT_R16_UNORM:
+ return V_028C70_SWAP_STD;
/* 32-bit buffers. */
case PIPE_FORMAT_A8B8G8R8_SRGB:
case PIPE_FORMAT_R10SG10SB10SA2U_NORM:
return V_028C70_SWAP_STD_REV;
+ case PIPE_FORMAT_R16G16_UNORM:
+ return V_028C70_SWAP_STD;
+
/* 64-bit buffers. */
case PIPE_FORMAT_R16G16B16A16_UNORM:
case PIPE_FORMAT_R16G16B16A16_SNORM:
case PIPE_FORMAT_Z16_UNORM:
return V_028C70_COLOR_16;
+ case PIPE_FORMAT_R8G8_UNORM:
+ return V_028C70_COLOR_8_8;
+
+ case PIPE_FORMAT_R16_UNORM:
+ return V_028C70_COLOR_16;
+
/* 32-bit buffers. */
case PIPE_FORMAT_A8B8G8R8_SRGB:
case PIPE_FORMAT_A8B8G8R8_UNORM:
return V_028C70_COLOR_16_16_FLOAT;
case PIPE_FORMAT_R16G16_SSCALED:
+ case PIPE_FORMAT_R16G16_UNORM:
return V_028C70_COLOR_16_16;
/* 64-bit buffers. */
}
}
-static INLINE void r600_translate_vertex_num_format(enum pipe_format format, uint32_t *num_format_p,
- uint32_t *format_comp_p)
-{
- uint32_t num_format = 0, format_comp = 0;
- switch (format) {
- case PIPE_FORMAT_R16G16B16A16_SSCALED:
- case PIPE_FORMAT_R16G16B16_SSCALED:
- case PIPE_FORMAT_R16G16_SSCALED:
- case PIPE_FORMAT_R32G32_SSCALED:
- num_format = V_030008_SQ_NUM_FORMAT_SCALED;
- format_comp = 1;
- break;
- default:
- break;
- }
- *num_format_p = num_format;
- *format_comp_p = format_comp;
-}
-
static INLINE boolean r600_is_sampler_format_supported(enum pipe_format format)
{
return r600_translate_texformat(format, NULL, NULL, NULL) != ~0;
return r600_translate_colorformat(format) != ~0;
}
+static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format)
+{
+ uint32_t result = 0;
+ const struct util_format_description *desc;
+ unsigned i;
+
+ desc = util_format_description(format);
+ if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
+ goto out_unknown;
+ }
+
+ /* Find the first non-VOID channel. */
+ for (i = 0; i < 4; i++) {
+ if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
+ break;
+ }
+ }
+
+ switch (desc->channel[i].type) {
+ /* Half-floats, floats, doubles */
+ case UTIL_FORMAT_TYPE_FLOAT:
+ switch (desc->channel[i].size) {
+ case 16:
+ switch (desc->nr_channels) {
+ case 1:
+ result = FMT_16_FLOAT;
+ break;
+ case 2:
+ result = FMT_16_16_FLOAT;
+ break;
+ case 3:
+ result = FMT_16_16_16_FLOAT;
+ break;
+ case 4:
+ result = FMT_16_16_16_16_FLOAT;
+ break;
+ }
+ break;
+ case 32:
+ switch (desc->nr_channels) {
+ case 1:
+ result = FMT_32_FLOAT;
+ break;
+ case 2:
+ result = FMT_32_32_FLOAT;
+ break;
+ case 3:
+ result = FMT_32_32_32_FLOAT;
+ break;
+ case 4:
+ result = FMT_32_32_32_32_FLOAT;
+ break;
+ }
+ break;
+ default:
+ goto out_unknown;
+ }
+ break;
+ /* Unsigned ints */
+ case UTIL_FORMAT_TYPE_UNSIGNED:
+ /* Signed ints */
+ case UTIL_FORMAT_TYPE_SIGNED:
+ switch (desc->channel[i].size) {
+ case 8:
+ switch (desc->nr_channels) {
+ case 1:
+ result = FMT_8;
+ break;
+ case 2:
+ result = FMT_8_8;
+ break;
+ case 3:
+// result = V_038008_FMT_8_8_8; /* fails piglit draw-vertices test */
+// break;
+ case 4:
+ result = FMT_8_8_8_8;
+ break;
+ }
+ break;
+ case 16:
+ switch (desc->nr_channels) {
+ case 1:
+ result = FMT_16;
+ break;
+ case 2:
+ result = FMT_16_16;
+ break;
+ case 3:
+// result = V_038008_FMT_16_16_16; /* fails piglit draw-vertices test */
+// break;
+ case 4:
+ result = FMT_16_16_16_16;
+ break;
+ }
+ break;
+ case 32:
+ switch (desc->nr_channels) {
+ case 1:
+ result = FMT_32;
+ break;
+ case 2:
+ result = FMT_32_32;
+ break;
+ case 3:
+ result = FMT_32_32_32;
+ break;
+ case 4:
+ result = FMT_32_32_32_32;
+ break;
+ }
+ break;
+ default:
+ goto out_unknown;
+ }
+ break;
+ default:
+ goto out_unknown;
+ }
+
+ result = S_030008_DATA_FORMAT(result);
+
+ if (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED) {
+ result |= S_030008_FORMAT_COMP_ALL(1);
+ }
+ if (desc->channel[i].normalized) {
+ result |= S_030008_NUM_FORMAT_ALL(0);
+ } else {
+ result |= S_030008_NUM_FORMAT_ALL(2);
+ }
+ return result;
+out_unknown:
+ R600_ERR("unsupported vertex format %s\n", util_format_name(format));
+ return ~0;
+}
+
+static INLINE uint32_t r600_translate_vertex_data_swizzle(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+ unsigned i;
+ uint32_t word3;
+
+ assert(format);
+
+ if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
+ fprintf(stderr, "r600: Bad format %s in %s:%d\n",
+ util_format_short_name(format), __FUNCTION__, __LINE__);
+ return 0;
+ }
+
+ word3 = 0;
+ for (i = 0; i < desc->nr_channels; i++) {
+ switch (i) {
+ case 0:
+ word3 |= S_03000C_DST_SEL_X(desc->swizzle[0]);
+ break;
+ case 1:
+ word3 |= S_03000C_DST_SEL_Y(desc->swizzle[1]);
+ break;
+ case 2:
+ word3 |= S_03000C_DST_SEL_Z(desc->swizzle[2]);
+ break;
+ case 3:
+ word3 |= S_03000C_DST_SEL_W(desc->swizzle[3]);
+ break;
+ }
+ }
+ return word3;
+}
+
#endif
#include <util/u_pack_color.h>
#include <util/u_memory.h>
#include <util/u_inlines.h>
+#include <util/u_framebuffer.h>
#include <pipebuffer/pb_buffer.h>
#include "r600.h"
#include "evergreend.h"
-struct radeon_state {
- unsigned dummy;
-};
#include "r600_resource.h"
#include "r600_shader.h"
#include "r600_pipe.h"
return;
rstate->id = R600_PIPE_STATE_BLEND_COLOR;
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028414_CB_BLEND_RED, fui(state->color[0]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028418_CB_BLEND_GREEN, fui(state->color[1]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028414_CB_BLEND_RED, fui(state->color[0]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028418_CB_BLEND_GREEN, fui(state->color[1]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), 0xFFFFFFFF, NULL);
free(rctx->states[R600_PIPE_STATE_BLEND_COLOR]);
rctx->states[R600_PIPE_STATE_BLEND_COLOR] = rstate;
}
}
blend->cb_target_mask = target_mask;
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028808_CB_COLOR_CONTROL,
+ r600_pipe_state_add_reg(rstate, R_028808_CB_COLOR_CONTROL,
color_control, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C3C_PA_SC_AA_MASK, 0xFFFFFFFF, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C3C_PA_SC_AA_MASK, 0xFFFFFFFF, 0xFFFFFFFF, NULL);
for (int i = 0; i < 8; i++) {
unsigned eqRGB = state->rt[i].rgb_func;
}
}
for (int i = 0; i < 8; i++) {
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028780_CB_BLEND0_CONTROL + i * 4, blend_cntl[i], 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028780_CB_BLEND0_CONTROL + i * 4, blend_cntl[i], 0xFFFFFFFF, NULL);
}
return rstate;
S_02800C_FORCE_HIS_ENABLE0(V_02800C_FORCE_DISABLE) |
S_02800C_FORCE_HIS_ENABLE1(V_02800C_FORCE_DISABLE);
/* TODO db_render_override depends on query */
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028028_DB_STENCIL_CLEAR, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02802C_DB_DEPTH_CLEAR, 0x3F800000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028410_SX_ALPHA_TEST_CONTROL, alpha_test_control, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate, R_028028_DB_STENCIL_CLEAR, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02802C_DB_DEPTH_CLEAR, 0x3F800000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028410_SX_ALPHA_TEST_CONTROL, alpha_test_control, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
R_028430_DB_STENCILREFMASK, stencil_ref_mask,
0xFFFFFFFF & C_028430_STENCILREF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028434_DB_STENCILREFMASK_BF, stencil_ref_mask_bf,
0xFFFFFFFF & C_028434_STENCILREF_BF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028438_SX_ALPHA_REF, alpha_ref, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286DC_SPI_FOG_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028800_DB_DEPTH_CONTROL, db_depth_control, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02880C_DB_SHADER_CONTROL, db_shader_control, 0xFFFFFFBE, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028000_DB_RENDER_CONTROL, db_render_control, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02800C_DB_RENDER_OVERRIDE, db_render_override, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AC0_DB_SRESULTS_COMPARE_STATE0, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AC4_DB_SRESULTS_COMPARE_STATE1, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AC8_DB_PRELOAD_CONTROL, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B70_DB_ALPHA_TO_MASK, 0x0000AA00, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028438_SX_ALPHA_REF, alpha_ref, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0286DC_SPI_FOG_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028800_DB_DEPTH_CONTROL, db_depth_control, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02880C_DB_SHADER_CONTROL, db_shader_control, 0xFFFFFFBE, NULL);
+ r600_pipe_state_add_reg(rstate, R_028000_DB_RENDER_CONTROL, db_render_control, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02800C_DB_RENDER_OVERRIDE, db_render_override, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028AC0_DB_SRESULTS_COMPARE_STATE0, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028AC4_DB_SRESULTS_COMPARE_STATE1, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028AC8_DB_PRELOAD_CONTROL, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028B70_DB_ALPHA_TO_MASK, 0x0000AA00, 0xFFFFFFFF, NULL);
return rstate;
}
struct r600_pipe_state *rstate;
unsigned tmp;
unsigned prov_vtx = 1, polygon_dual_mode;
+ unsigned clip_rule;
if (rs == NULL) {
return NULL;
rs->flatshade = state->flatshade;
rs->sprite_coord_enable = state->sprite_coord_enable;
+ clip_rule = state->scissor ? 0xAAAA : 0xFFFF;
+
/* offset */
rs->offset_units = state->offset_units;
rs->offset_scale = state->offset_scale * 12.0f;
tmp |= S_0286D4_PNT_SPRITE_TOP_1(1);
}
}
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL);
polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL ||
state->fill_back != PIPE_POLYGON_MODE_FILL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028814_PA_SU_SC_MODE_CNTL,
+ r600_pipe_state_add_reg(rstate, R_028814_PA_SU_SC_MODE_CNTL,
S_028814_PROVOKING_VTX_LAST(prov_vtx) |
S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) |
S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) |
S_028814_POLY_MODE(polygon_dual_mode) |
S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) |
S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02881C_PA_CL_VS_OUT_CNTL,
+ r600_pipe_state_add_reg(rstate, R_02881C_PA_CL_VS_OUT_CNTL,
S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) |
S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028820_PA_CL_NANINF_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028820_PA_CL_NANINF_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
/* point size 12.4 fixed point */
tmp = (unsigned)(state->point_size * 8.0);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A04_PA_SU_POINT_MINMAX, 0x80000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A08_PA_SU_LINE_CNTL, 0x00000008, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C00_PA_SC_LINE_CNTL, 0x00000400, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C08_PA_SU_VTX_CNTL, 0x00000005, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A04_PA_SU_POINT_MINMAX, 0x80000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A08_PA_SU_LINE_CNTL, 0x00000008, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C00_PA_SC_LINE_CNTL, 0x00000400, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C08_PA_SU_VTX_CNTL, 0x00000005, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02820C_PA_SC_CLIPRECT_RULE, clip_rule, 0xFFFFFFFF, NULL);
return rstate;
}
rstate->id = R600_PIPE_STATE_SAMPLER;
util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER, R_03C000_SQ_TEX_SAMPLER_WORD0_0,
+ r600_pipe_state_add_reg(rstate, R_03C000_SQ_TEX_SAMPLER_WORD0_0,
S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) |
S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) |
S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) |
S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) |
S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0), 0xFFFFFFFF, NULL);
/* FIXME LOD it depends on texture base level ... */
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER, R_03C004_SQ_TEX_SAMPLER_WORD1_0,
+ r600_pipe_state_add_reg(rstate, R_03C004_SQ_TEX_SAMPLER_WORD1_0,
S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) |
S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)),
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_SAMPLER, R_03C008_SQ_TEX_SAMPLER_WORD2_0,
+ r600_pipe_state_add_reg(rstate, R_03C008_SQ_TEX_SAMPLER_WORD2_0,
S_03C008_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)) |
S_03C008_TYPE(1),
0xFFFFFFFF, NULL);
if (uc.ui) {
- /* TODO border color */
+ r600_pipe_state_add_reg(rstate, R_00A404_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color[0]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color[1]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color[2]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color[3]), 0xFFFFFFFF, NULL);
}
return rstate;
}
unsigned format;
uint32_t word4 = 0, yuv_format = 0, pitch = 0;
unsigned char swizzle[4];
- struct radeon_ws_bo *bo[2];
+ struct r600_bo *bo[2];
if (resource == NULL)
return NULL;
swizzle[1] = state->swizzle_g;
swizzle[2] = state->swizzle_b;
swizzle[3] = state->swizzle_a;
- format = r600_translate_texformat(texture->format,
+ format = r600_translate_texformat(state->format,
swizzle,
&word4, &yuv_format);
if (format == ~0) {
format = 0;
}
- desc = util_format_description(texture->format);
+ desc = util_format_description(state->format);
if (desc == NULL) {
- R600_ERR("unknow format %d\n", texture->format);
+ R600_ERR("unknow format %d\n", state->format);
}
tmp = (struct r600_resource_texture*)texture;
rbuffer = &tmp->resource;
bo[1] = rbuffer->bo;
/* FIXME depth texture decompression */
if (tmp->depth) {
-#if 0
- r = evergreen_texture_from_depth(ctx, tmp, view->first_level);
- if (r) {
- return;
- }
- bo[0] = radeon_ws_bo_incref(rscreen->rw, tmp->uncompressed);
- bo[1] = radeon_ws_bo_incref(rscreen->rw, tmp->uncompressed);
-#endif
+ r600_texture_depth_flush(ctx, texture);
+ tmp = (struct r600_resource_texture*)texture;
+ rbuffer = &tmp->flushed_depth_texture->resource;
+ bo[0] = rbuffer->bo;
+ bo[1] = rbuffer->bo;
}
- pitch = align(tmp->pitch[0] / tmp->bpt, 8);
+ pitch = align(tmp->pitch_in_pixels[0], 8);
/* FIXME properly handle first level != 0 */
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030000_RESOURCE0_WORD0,
+ r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0,
S_030000_DIM(r600_tex_dim(texture->target)) |
S_030000_PITCH((pitch / 8) - 1) |
S_030000_TEX_WIDTH(texture->width0 - 1), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030004_RESOURCE0_WORD1,
+ r600_pipe_state_add_reg(rstate, R_030004_RESOURCE0_WORD1,
S_030004_TEX_HEIGHT(texture->height0 - 1) |
S_030004_TEX_DEPTH(texture->depth0 - 1),
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030008_RESOURCE0_WORD2,
- tmp->offset[0] >> 8, 0xFFFFFFFF, bo[0]);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_03000C_RESOURCE0_WORD3,
- tmp->offset[1] >> 8, 0xFFFFFFFF, bo[1]);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030010_RESOURCE0_WORD4,
+ r600_pipe_state_add_reg(rstate, R_030008_RESOURCE0_WORD2,
+ (tmp->offset[0] + r600_bo_offset(bo[0])) >> 8, 0xFFFFFFFF, bo[0]);
+ r600_pipe_state_add_reg(rstate, R_03000C_RESOURCE0_WORD3,
+ (tmp->offset[1] + r600_bo_offset(bo[1])) >> 8, 0xFFFFFFFF, bo[1]);
+ r600_pipe_state_add_reg(rstate, R_030010_RESOURCE0_WORD4,
word4 | S_030010_NUM_FORMAT_ALL(V_030010_SQ_NUM_FORMAT_NORM) |
S_030010_SRF_MODE_ALL(V_030010_SFR_MODE_NO_ZERO) |
- S_030010_REQUEST_SIZE(1) |
S_030010_BASE_LEVEL(state->first_level), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030014_RESOURCE0_WORD5,
+ r600_pipe_state_add_reg(rstate, R_030014_RESOURCE0_WORD5,
S_030014_LAST_LEVEL(state->last_level) |
S_030014_BASE_ARRAY(0) |
S_030014_LAST_ARRAY(0), 0xffffffff, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030018_RESOURCE0_WORD6, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_03001C_RESOURCE0_WORD7,
+ r600_pipe_state_add_reg(rstate, R_030018_RESOURCE0_WORD6, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_03001C_RESOURCE0_WORD7,
S_03001C_DATA_FORMAT(format) |
S_03001C_TYPE(V_03001C_SQ_TEX_VTX_VALID_TEXTURE), 0xFFFFFFFF, NULL);
static void evergreen_set_vs_sampler_view(struct pipe_context *ctx, unsigned count,
struct pipe_sampler_view **views)
{
- /* TODO */
- assert(1);
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views;
+
+ for (int i = 0; i < count; i++) {
+ if (resource[i]) {
+ evergreen_context_pipe_state_set_vs_resource(&rctx->ctx, &resource[i]->state, i + PIPE_MAX_ATTRIBS);
+ }
+ }
}
static void evergreen_set_ps_sampler_view(struct pipe_context *ctx, unsigned count,
{
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views;
-
- for (int i = 0; i < count; i++) {
- if (resource[i]) {
- evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i);
+ int i;
+
+ for (i = 0; i < count; i++) {
+ if (&rctx->ps_samplers.views[i]->base != views[i]) {
+ if (resource[i])
+ evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i);
+ else
+ evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, NULL, i);
+
+ pipe_sampler_view_reference(
+ (struct pipe_sampler_view **)&rctx->ps_samplers.views[i],
+ views[i]);
+ }
+ }
+ for (i = count; i < NUM_TEX_UNITS; i++) {
+ if (rctx->ps_samplers.views[i]) {
+ evergreen_context_pipe_state_set_ps_resource(&rctx->ctx, NULL, i);
+ pipe_sampler_view_reference((struct pipe_sampler_view **)&rctx->ps_samplers.views[i], NULL);
}
}
+ rctx->ps_samplers.n_views = count;
}
static void evergreen_bind_state(struct pipe_context *ctx, void *state)
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
struct r600_pipe_state **rstates = (struct r600_pipe_state **)states;
+
+ memcpy(rctx->ps_samplers.samplers, states, sizeof(void*) * count);
+ rctx->ps_samplers.n_samplers = count;
+
for (int i = 0; i < count; i++) {
evergreen_context_pipe_state_set_ps_sampler(&rctx->ctx, rstates[i], i);
}
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
struct r600_pipe_state **rstates = (struct r600_pipe_state **)states;
- /* TODO implement */
for (int i = 0; i < count; i++) {
evergreen_context_pipe_state_set_vs_sampler(&rctx->ctx, rstates[i], i);
}
rctx->states[rstate->id] = NULL;
}
for (int i = 0; i < rstate->nregs; i++) {
- radeon_ws_bo_reference(rctx->radeon, &rstate->regs[i].bo, NULL);
+ r600_bo_reference(rctx->radeon, &rstate->regs[i].bo, NULL);
}
free(rstate);
}
rctx->clip = *state;
rstate->id = R600_PIPE_STATE_CLIP;
for (int i = 0; i < state->nr; i++) {
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_0285BC_PA_CL_UCP0_X + i * 4,
fui(state->ucp[i][0]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_0285C0_PA_CL_UCP0_Y + i * 4,
fui(state->ucp[i][1]) , 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_0285C4_PA_CL_UCP0_Z + i * 4,
fui(state->ucp[i][2]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_0285C8_PA_CL_UCP0_W + i * 4,
fui(state->ucp[i][3]), 0xFFFFFFFF, NULL);
}
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028810_PA_CL_CLIP_CNTL,
+ r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL,
S_028810_PS_UCP_MODE(3) | ((1 << state->nr) - 1) |
S_028810_ZCLIP_NEAR_DISABLE(state->depth_clamp) |
S_028810_ZCLIP_FAR_DISABLE(state->depth_clamp), 0xFFFFFFFF, NULL);
rstate->id = R600_PIPE_STATE_SCISSOR;
tl = S_028240_TL_X(state->minx) | S_028240_TL_Y(state->miny);
br = S_028244_BR_X(state->maxx) | S_028244_BR_Y(state->maxy);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
- R_028030_PA_SC_SCREEN_SCISSOR_TL, tl,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
- R_028034_PA_SC_SCREEN_SCISSOR_BR, br,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
- R_028204_PA_SC_WINDOW_SCISSOR_TL, tl,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
- R_028208_PA_SC_WINDOW_SCISSOR_BR, br,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028210_PA_SC_CLIPRECT_0_TL, tl,
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028214_PA_SC_CLIPRECT_0_BR, br,
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028218_PA_SC_CLIPRECT_1_TL, tl,
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_02821C_PA_SC_CLIPRECT_1_BR, br,
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028220_PA_SC_CLIPRECT_2_TL, tl,
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028224_PA_SC_CLIPRECT_2_BR, br,
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028228_PA_SC_CLIPRECT_3_TL, tl,
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_02822C_PA_SC_CLIPRECT_3_BR, br,
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
- R_028200_PA_SC_WINDOW_OFFSET, 0x00000000,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
- R_02820C_PA_SC_CLIPRECT_RULE, 0x0000FFFF,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
- R_028230_PA_SC_EDGERULE, 0xAAAAAAAA,
- 0xFFFFFFFF, NULL);
free(rctx->states[R600_PIPE_STATE_SCISSOR]);
rctx->states[R600_PIPE_STATE_SCISSOR] = rstate;
rctx->stencil_ref = *state;
rstate->id = R600_PIPE_STATE_STENCIL_REF;
tmp = S_028430_STENCILREF(state->ref_value[0]);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028430_DB_STENCILREFMASK, tmp,
~C_028430_STENCILREF, NULL);
tmp = S_028434_STENCILREF_BF(state->ref_value[1]);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028434_DB_STENCILREFMASK_BF, tmp,
~C_028434_STENCILREF_BF, NULL);
rctx->viewport = *state;
rstate->id = R600_PIPE_STATE_VIEWPORT;
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028818_PA_CL_VTE_CNTL, 0x0000043F, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028818_PA_CL_VTE_CNTL, 0x0000043F, 0xFFFFFFFF, NULL);
free(rctx->states[R600_PIPE_STATE_VIEWPORT]);
rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate;
unsigned color_info;
unsigned format, swap, ntype;
const struct util_format_description *desc;
- struct radeon_ws_bo *bo[3];
+ struct r600_bo *bo[3];
rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
rbuffer = &rtex->resource;
bo[1] = rbuffer->bo;
bo[2] = rbuffer->bo;
- pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
- slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1;
+ pitch = rtex->pitch_in_pixels[level] / 8 - 1;
+ slice = rtex->pitch_in_pixels[level] * state->cbufs[cb]->height / 64 - 1;
ntype = 0;
desc = util_format_description(rtex->resource.base.b.format);
if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
color_info |= S_028C70_SOURCE_FORMAT(1);
/* FIXME handle enabling of CB beyond BASE8 which has different offset */
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028C60_CB_COLOR0_BASE + cb * 0x3C,
- state->cbufs[cb]->offset >> 8, 0xFFFFFFFF, bo[0]);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ (state->cbufs[cb]->offset + r600_bo_offset(bo[0])) >> 8, 0xFFFFFFFF, bo[0]);
+ r600_pipe_state_add_reg(rstate,
R_028C78_CB_COLOR0_DIM + cb * 0x3C,
0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028C70_CB_COLOR0_INFO + cb * 0x3C,
color_info, 0xFFFFFFFF, bo[0]);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028C64_CB_COLOR0_PITCH + cb * 0x3C,
S_028C64_PITCH_TILE_MAX(pitch),
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028C68_CB_COLOR0_SLICE + cb * 0x3C,
S_028C68_SLICE_TILE_MAX(slice),
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028C6C_CB_COLOR0_VIEW + cb * 0x3C,
0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028C74_CB_COLOR0_ATTRIB + cb * 0x3C,
S_028C74_NON_DISP_TILING_ORDER(1),
- 0xFFFFFFFF, NULL);
+ 0xFFFFFFFF, bo[0]);
}
static void evergreen_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate,
struct r600_resource_texture *rtex;
struct r600_resource *rbuffer;
unsigned level;
- unsigned pitch, slice, format;
+ unsigned pitch, slice, format, stencil_format;
if (state->zsbuf == NULL)
return;
rbuffer = &rtex->resource;
level = state->zsbuf->level;
- pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
- slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1;
+ pitch = rtex->pitch_in_pixels[level] / 8 - 1;
+ slice = rtex->pitch_in_pixels[level] * state->zsbuf->height / 64 - 1;
format = r600_translate_dbformat(state->zsbuf->texture->format);
+ stencil_format = r600_translate_stencilformat(state->zsbuf->texture->format);
+
+ r600_pipe_state_add_reg(rstate, R_028048_DB_Z_READ_BASE,
+ (state->zsbuf->offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
+ r600_pipe_state_add_reg(rstate, R_028050_DB_Z_WRITE_BASE,
+ (state->zsbuf->offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
+
+ if (stencil_format) {
+ uint32_t stencil_offset;
+
+ stencil_offset = ((state->zsbuf->height * rtex->pitch_in_bytes[level]) + 255) & ~255;
+ r600_pipe_state_add_reg(rstate, R_02804C_DB_STENCIL_READ_BASE,
+ (state->zsbuf->offset + stencil_offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
+ r600_pipe_state_add_reg(rstate, R_028054_DB_STENCIL_WRITE_BASE,
+ (state->zsbuf->offset + stencil_offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
+ }
+
+ r600_pipe_state_add_reg(rstate, R_028008_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028044_DB_STENCIL_INFO,
+ S_028044_FORMAT(stencil_format), 0xFFFFFFFF, rbuffer->bo);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028048_DB_Z_READ_BASE,
- state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028050_DB_Z_WRITE_BASE,
- state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo);
-// r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028014_DB_HTILE_DATA_BASE, state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028008_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028040_DB_Z_INFO,
+ r600_pipe_state_add_reg(rstate, R_028040_DB_Z_INFO,
S_028040_ARRAY_MODE(rtex->array_mode) | S_028040_FORMAT(format),
0xFFFFFFFF, rbuffer->bo);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028058_DB_DEPTH_SIZE,
+ r600_pipe_state_add_reg(rstate, R_028058_DB_DEPTH_SIZE,
S_028058_PITCH_TILE_MAX(pitch),
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02805C_DB_DEPTH_SLICE,
+ r600_pipe_state_add_reg(rstate, R_02805C_DB_DEPTH_SLICE,
S_02805C_SLICE_TILE_MAX(slice),
0xFFFFFFFF, NULL);
}
/* unreference old buffer and reference new one */
rstate->id = R600_PIPE_STATE_FRAMEBUFFER;
- for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) {
- pipe_surface_reference(&rctx->framebuffer.cbufs[i], NULL);
- }
- for (int i = 0; i < state->nr_cbufs; i++) {
- pipe_surface_reference(&rctx->framebuffer.cbufs[i], state->cbufs[i]);
- }
- pipe_surface_reference(&rctx->framebuffer.zsbuf, state->zsbuf);
- rctx->framebuffer = *state;
+
+ util_copy_framebuffer_state(&rctx->framebuffer, state);
+
+ rctx->pframebuffer = &rctx->framebuffer;
/* build states */
for (int i = 0; i < state->nr_cbufs; i++) {
tl = S_028240_TL_X(0) | S_028240_TL_Y(0);
br = S_028244_BR_X(state->width) | S_028244_BR_Y(state->height);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028240_PA_SC_GENERIC_SCISSOR_TL, tl,
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028244_PA_SC_GENERIC_SCISSOR_BR, br,
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028250_PA_SC_VPORT_SCISSOR_0_TL, tl,
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028254_PA_SC_VPORT_SCISSOR_0_BR, br,
0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028030_PA_SC_SCREEN_SCISSOR_TL, tl,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028034_PA_SC_SCREEN_SCISSOR_BR, br,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028204_PA_SC_WINDOW_SCISSOR_TL, tl,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028208_PA_SC_WINDOW_SCISSOR_BR, br,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028200_PA_SC_WINDOW_OFFSET, 0x00000000,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028230_PA_SC_EDGERULE, 0xAAAAAAAA,
+ 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028238_CB_TARGET_MASK,
+ r600_pipe_state_add_reg(rstate, R_028238_CB_TARGET_MASK,
0x00000000, target_mask, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02823C_CB_SHADER_MASK,
+ r600_pipe_state_add_reg(rstate, R_02823C_CB_SHADER_MASK,
shader_mask, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C04_PA_SC_AA_CONFIG,
+ r600_pipe_state_add_reg(rstate, R_028C04_PA_SC_AA_CONFIG,
0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX,
+ r600_pipe_state_add_reg(rstate, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX,
0x00000000, 0xFFFFFFFF, NULL);
free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]);
switch (shader) {
case PIPE_SHADER_VERTEX:
rctx->vs_const_buffer.nregs = 0;
- r600_pipe_state_add_reg(&rctx->vs_const_buffer, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(&rctx->vs_const_buffer,
R_028180_ALU_CONST_BUFFER_SIZE_VS_0,
ALIGN_DIVUP(buffer->width0 >> 4, 16),
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&rctx->vs_const_buffer, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(&rctx->vs_const_buffer,
R_028980_ALU_CONST_CACHE_VS_0,
- 0, 0xFFFFFFFF, rbuffer->bo);
+ (r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_const_buffer);
break;
case PIPE_SHADER_FRAGMENT:
rctx->ps_const_buffer.nregs = 0;
- r600_pipe_state_add_reg(&rctx->ps_const_buffer, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(&rctx->ps_const_buffer,
R_028140_ALU_CONST_BUFFER_SIZE_PS_0,
ALIGN_DIVUP(buffer->width0 >> 4, 16),
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&rctx->ps_const_buffer, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(&rctx->ps_const_buffer,
R_028940_ALU_CONST_CACHE_PS_0,
- 0, 0xFFFFFFFF, rbuffer->bo);
+ (r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_const_buffer);
break;
default:
struct r600_pipe_shader *shader = CALLOC_STRUCT(r600_pipe_shader);
int r;
- shader->shader.use_mem_constant = TRUE;
- r = r600_pipe_shader_create2(ctx, shader, state->tokens);
+ r = r600_pipe_shader_create(ctx, shader, state->tokens);
if (r) {
return NULL;
}
free(shader);
}
-void evergreen_init_state_functions2(struct r600_pipe_context *rctx)
+void evergreen_init_state_functions(struct r600_pipe_context *rctx)
{
rctx->context.create_blend_state = evergreen_create_blend_state;
rctx->context.create_depth_stencil_alpha_state = evergreen_create_dsa_state;
rctx->context.sampler_view_destroy = evergreen_sampler_view_destroy;
}
-void evergreen_init_config2(struct r600_pipe_context *rctx)
+void evergreen_init_config(struct r600_pipe_context *rctx)
{
struct r600_pipe_state *rstate = &rctx->config;
int ps_prio;
tmp |= S_008C00_VS_PRIO(vs_prio);
tmp |= S_008C00_GS_PRIO(gs_prio);
tmp |= S_008C00_ES_PRIO(es_prio);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL);
tmp = 0;
tmp |= S_008C04_NUM_PS_GPRS(num_ps_gprs);
tmp |= S_008C04_NUM_VS_GPRS(num_vs_gprs);
tmp |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL);
tmp = 0;
tmp |= S_008C08_NUM_GS_GPRS(num_gs_gprs);
tmp |= S_008C08_NUM_ES_GPRS(num_es_gprs);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL);
tmp = 0;
tmp |= S_008C0C_NUM_HS_GPRS(num_hs_gprs);
tmp |= S_008C0C_NUM_LS_GPRS(num_ls_gprs);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C0C_SQ_GPR_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_008C0C_SQ_GPR_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL);
tmp = 0;
tmp |= S_008C18_NUM_PS_THREADS(num_ps_threads);
tmp |= S_008C18_NUM_VS_THREADS(num_vs_threads);
tmp |= S_008C18_NUM_GS_THREADS(num_gs_threads);
tmp |= S_008C18_NUM_ES_THREADS(num_es_threads);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C18_SQ_THREAD_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_008C18_SQ_THREAD_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL);
tmp = 0;
tmp |= S_008C1C_NUM_HS_THREADS(num_hs_threads);
tmp |= S_008C1C_NUM_LS_THREADS(num_ls_threads);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL);
tmp = 0;
tmp |= S_008C20_NUM_PS_STACK_ENTRIES(num_ps_stack_entries);
tmp |= S_008C20_NUM_VS_STACK_ENTRIES(num_vs_stack_entries);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C20_SQ_STACK_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_008C20_SQ_STACK_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL);
tmp = 0;
tmp |= S_008C24_NUM_GS_STACK_ENTRIES(num_gs_stack_entries);
tmp |= S_008C24_NUM_ES_STACK_ENTRIES(num_es_stack_entries);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C24_SQ_STACK_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_008C24_SQ_STACK_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL);
tmp = 0;
tmp |= S_008C28_NUM_HS_STACK_ENTRIES(num_hs_stack_entries);
tmp |= S_008C28_NUM_LS_STACK_ENTRIES(num_ls_stack_entries);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008C28_SQ_STACK_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL);
-
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_009100_SPI_CONFIG_CNTL, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_00913C_SPI_CONFIG_CNTL_1, S_00913C_VTX_DONE_DELAY(4), 0xFFFFFFFF, NULL);
-
-// r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028350_SX_MISC, 0x0, 0xFFFFFFFF, NULL);
-
-// r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A48_PA_SC_MODE_CNTL_0, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A4C_PA_SC_MODE_CNTL_1, 0x0, 0xFFFFFFFF, NULL);
-
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028900_SQ_ESGS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028904_SQ_GSVS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028908_SQ_ESTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02890C_SQ_GSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028910_SQ_VSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028914_SQ_PSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
-
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02891C_SQ_GS_VERT_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0x0, 0xFFFFFFFF, NULL);
-
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A14_VGT_HOS_CNTL, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A20_VGT_HOS_REUSE_DEPTH, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A24_VGT_GROUP_PRIM_TYPE, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A28_VGT_GROUP_FIRST_DECR, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A2C_VGT_GROUP_DECR, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A30_VGT_GROUP_VECT_0_CNTL, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A34_VGT_GROUP_VECT_1_CNTL, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028A40_VGT_GS_MODE, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B94_VGT_STRMOUT_CONFIG, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AB4_VGT_REUSE_OFF, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028AB8_VGT_VTX_CNT_EN, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONFIG, R_008A14_PA_CL_ENHANCE, (3 << 1) | 1, 0xFFFFFFFF, NULL);
-
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028380_SQ_VTX_SEMANTIC_0, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028384_SQ_VTX_SEMANTIC_1, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028388_SQ_VTX_SEMANTIC_2, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02838C_SQ_VTX_SEMANTIC_3, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028390_SQ_VTX_SEMANTIC_4, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028394_SQ_VTX_SEMANTIC_5, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028398_SQ_VTX_SEMANTIC_6, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_02839C_SQ_VTX_SEMANTIC_7, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283A0_SQ_VTX_SEMANTIC_8, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283A4_SQ_VTX_SEMANTIC_9, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283A8_SQ_VTX_SEMANTIC_10, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283AC_SQ_VTX_SEMANTIC_11, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283B0_SQ_VTX_SEMANTIC_12, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283B4_SQ_VTX_SEMANTIC_13, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283B8_SQ_VTX_SEMANTIC_14, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283BC_SQ_VTX_SEMANTIC_15, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283C0_SQ_VTX_SEMANTIC_16, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283C4_SQ_VTX_SEMANTIC_17, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283C8_SQ_VTX_SEMANTIC_18, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283CC_SQ_VTX_SEMANTIC_19, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283D0_SQ_VTX_SEMANTIC_20, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283D4_SQ_VTX_SEMANTIC_21, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283D8_SQ_VTX_SEMANTIC_22, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283DC_SQ_VTX_SEMANTIC_23, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283E0_SQ_VTX_SEMANTIC_24, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283E4_SQ_VTX_SEMANTIC_25, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283E8_SQ_VTX_SEMANTIC_26, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283EC_SQ_VTX_SEMANTIC_27, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283F0_SQ_VTX_SEMANTIC_28, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283F4_SQ_VTX_SEMANTIC_29, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283F8_SQ_VTX_SEMANTIC_30, 0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0283FC_SQ_VTX_SEMANTIC_31, 0x0, 0xFFFFFFFF, NULL);
-
-r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028810_PA_CL_CLIP_CNTL,
+ r600_pipe_state_add_reg(rstate, R_008C28_SQ_STACK_RESOURCE_MGMT_3, tmp, 0xFFFFFFFF, NULL);
+
+ r600_pipe_state_add_reg(rstate, R_009100_SPI_CONFIG_CNTL, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_00913C_SPI_CONFIG_CNTL_1, S_00913C_VTX_DONE_DELAY(4), 0xFFFFFFFF, NULL);
+
+// r600_pipe_state_add_reg(rstate, R_028350_SX_MISC, 0x0, 0xFFFFFFFF, NULL);
+
+// r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A48_PA_SC_MODE_CNTL_0, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A4C_PA_SC_MODE_CNTL_1, 0x0, 0xFFFFFFFF, NULL);
+
+ r600_pipe_state_add_reg(rstate, R_028900_SQ_ESGS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028904_SQ_GSVS_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028908_SQ_ESTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02890C_SQ_GSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028910_SQ_VSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028914_SQ_PSTMP_RING_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
+
+ r600_pipe_state_add_reg(rstate, R_02891C_SQ_GS_VERT_ITEMSIZE, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0x0, 0xFFFFFFFF, NULL);
+
+ r600_pipe_state_add_reg(rstate, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A14_VGT_HOS_CNTL, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A20_VGT_HOS_REUSE_DEPTH, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A24_VGT_GROUP_PRIM_TYPE, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A28_VGT_GROUP_FIRST_DECR, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A2C_VGT_GROUP_DECR, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A30_VGT_GROUP_VECT_0_CNTL, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A34_VGT_GROUP_VECT_1_CNTL, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A40_VGT_GS_MODE, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028B94_VGT_STRMOUT_CONFIG, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028AB4_VGT_REUSE_OFF, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028AB8_VGT_VTX_CNT_EN, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_008A14_PA_CL_ENHANCE, (3 << 1) | 1, 0xFFFFFFFF, NULL);
+
+ r600_pipe_state_add_reg(rstate, R_028380_SQ_VTX_SEMANTIC_0, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028384_SQ_VTX_SEMANTIC_1, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028388_SQ_VTX_SEMANTIC_2, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02838C_SQ_VTX_SEMANTIC_3, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028390_SQ_VTX_SEMANTIC_4, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028394_SQ_VTX_SEMANTIC_5, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028398_SQ_VTX_SEMANTIC_6, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02839C_SQ_VTX_SEMANTIC_7, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283A0_SQ_VTX_SEMANTIC_8, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283A4_SQ_VTX_SEMANTIC_9, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283A8_SQ_VTX_SEMANTIC_10, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283AC_SQ_VTX_SEMANTIC_11, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283B0_SQ_VTX_SEMANTIC_12, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283B4_SQ_VTX_SEMANTIC_13, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283B8_SQ_VTX_SEMANTIC_14, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283BC_SQ_VTX_SEMANTIC_15, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283C0_SQ_VTX_SEMANTIC_16, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283C4_SQ_VTX_SEMANTIC_17, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283C8_SQ_VTX_SEMANTIC_18, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283CC_SQ_VTX_SEMANTIC_19, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283D0_SQ_VTX_SEMANTIC_20, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283D4_SQ_VTX_SEMANTIC_21, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283D8_SQ_VTX_SEMANTIC_22, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283DC_SQ_VTX_SEMANTIC_23, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283E0_SQ_VTX_SEMANTIC_24, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283E4_SQ_VTX_SEMANTIC_25, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283E8_SQ_VTX_SEMANTIC_26, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283EC_SQ_VTX_SEMANTIC_27, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283F0_SQ_VTX_SEMANTIC_28, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283F4_SQ_VTX_SEMANTIC_29, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283F8_SQ_VTX_SEMANTIC_30, 0x0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0283FC_SQ_VTX_SEMANTIC_31, 0x0, 0xFFFFFFFF, NULL);
+
+r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL,
0x0, 0xFFFFFFFF, NULL);
r600_context_pipe_state_set(&rctx->ctx, rstate);
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
struct r600_pipe_state *rstate;
struct r600_resource *rbuffer;
- unsigned i, j, offset, format, prim;
+ unsigned i, j, offset, prim;
u32 vgt_dma_index_type, vgt_draw_initiator, mask;
struct pipe_vertex_buffer *vertex_buffer;
struct r600_draw rdraw;
struct r600_pipe_state vgt;
struct r600_drawl draw;
- assert(info->index_bias == 0);
-
if (rctx->any_user_vbs) {
- r600_upload_user_buffers2(rctx);
+ r600_upload_user_buffers(rctx);
rctx->any_user_vbs = FALSE;
}
memset(&draw, 0, sizeof(struct r600_drawl));
+ draw.ctx = ctx;
draw.mode = info->mode;
draw.start = info->start;
draw.count = info->count;
draw.max_index = info->max_index;
draw.index_bias = info->index_bias;
- r600_translate_index_buffer2(rctx, &rctx->index_buffer.buffer,
+ r600_translate_index_buffer(rctx, &rctx->index_buffer.buffer,
&rctx->index_buffer.index_size,
&draw.start,
info->count);
draw.index_size = rctx->index_buffer.index_size;
- draw.index_buffer = rctx->index_buffer.buffer;
+ pipe_resource_reference(&draw.index_buffer, rctx->index_buffer.buffer);
draw.index_buffer_offset = draw.start * draw.index_size;
draw.start = 0;
- r600_upload_index_buffer2(rctx, &draw);
+ r600_upload_index_buffer(rctx, &draw);
} else {
draw.index_size = 0;
draw.index_buffer = NULL;
return;
/* rebuild vertex shader if input format changed */
- if (r600_pipe_shader_update2(&rctx->context, rctx->vs_shader))
+ if (r600_pipe_shader_update(&rctx->context, rctx->vs_shader))
return;
- if (r600_pipe_shader_update2(&rctx->context, rctx->ps_shader))
+ if (r600_pipe_shader_update(&rctx->context, rctx->ps_shader))
return;
for (i = 0 ; i < rctx->vertex_elements->count; i++) {
- unsigned num_format = 0, format_comp = 0;
-
+ uint32_t word3, word2;
+ uint32_t format;
rstate = &rctx->vs_resource[i];
+
+ rstate->id = R600_PIPE_STATE_RESOURCE;
+ rstate->nregs = 0;
+
j = rctx->vertex_elements->elements[i].vertex_buffer_index;
vertex_buffer = &rctx->vertex_buffer[j];
rbuffer = (struct r600_resource*)vertex_buffer->buffer;
- offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset;
- format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format);
- rstate->id = R600_PIPE_STATE_RESOURCE;
- rstate->nregs = 0;
+ offset = rctx->vertex_elements->elements[i].src_offset +
+ vertex_buffer->buffer_offset +
+ r600_bo_offset(rbuffer->bo);
- r600_translate_vertex_num_format(rctx->vertex_elements->elements[i].src_format, &num_format, &format_comp);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE,
- R_030008_RESOURCE0_WORD2,
- S_030008_STRIDE(vertex_buffer->stride) |
- S_030008_DATA_FORMAT(format) |
- S_030008_NUM_FORMAT_ALL(num_format) |
- S_030008_FORMAT_COMP_ALL(format_comp),
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE,
- R_03000C_RESOURCE0_WORD3,
- S_03000C_DST_SEL_X(V_03000C_SQ_SEL_X) |
- S_03000C_DST_SEL_Y(V_03000C_SQ_SEL_Y) |
- S_03000C_DST_SEL_Z(V_03000C_SQ_SEL_Z) |
- S_03000C_DST_SEL_W(V_03000C_SQ_SEL_W),
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_030018_RESOURCE0_WORD6, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_RESOURCE, R_03001C_RESOURCE0_WORD7, 0xC0000000, 0xFFFFFFFF, NULL);
+ format = r600_translate_vertex_data_type(rctx->vertex_elements->elements[i].src_format);
+
+ word2 = format | S_030008_STRIDE(vertex_buffer->stride);
+
+ word3 = r600_translate_vertex_data_swizzle(rctx->vertex_elements->elements[i].src_format);
+
+ r600_pipe_state_add_reg(rstate, R_030000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo);
+ r600_pipe_state_add_reg(rstate, R_030004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_030008_RESOURCE0_WORD2, word2, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_03000C_RESOURCE0_WORD3, word3, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_030010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_030014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_030018_RESOURCE0_WORD6, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_03001C_RESOURCE0_WORD7, 0xC0000000, 0xFFFFFFFF, NULL);
evergreen_vs_resource_set(&rctx->ctx, rstate, i);
}
vgt.id = R600_PIPE_STATE_VGT;
vgt.nregs = 0;
- r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONFIG, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028408_VGT_INDX_OFFSET, draw.index_bias, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, draw.max_index, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT, R_028404_VGT_MIN_VTX_INDX, draw.min_index, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt, R_028408_VGT_INDX_OFFSET, draw.index_bias, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt, R_028400_VGT_MAX_VTX_INDX, draw.max_index, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt, R_028404_VGT_MIN_VTX_INDX, draw.min_index, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0xFFFFFFFF, NULL);
if (rctx->rasterizer && rctx->framebuffer.zsbuf) {
float offset_units = rctx->rasterizer->offset_units;
return;
}
offset_db_fmt_cntl |= S_028B78_POLY_OFFSET_NEG_NUM_DB_BITS(depth);
- r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(&vgt,
R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE,
fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(&vgt,
R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET,
fui(offset_units), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(&vgt,
R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE,
fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(&vgt,
R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET,
fui(offset_units), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(&vgt,
R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL,
offset_db_fmt_cntl, 0xFFFFFFFF, NULL);
}
rdraw.indices_bo_offset = draw.index_buffer_offset;
}
evergreen_context_draw(&rctx->ctx, &rdraw);
+
+ pipe_resource_reference(&draw.index_buffer, NULL);
}
void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader)
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
struct r600_pipe_state *rstate = &shader->rstate;
struct r600_shader *rshader = &shader->shader;
- unsigned i, tmp, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z;
- boolean have_pos = FALSE, have_face = FALSE;
+ unsigned i, tmp, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z, spi_ps_in_control_1;
+ int pos_index = -1, face_index = -1;
+ int ninterp = 0;
+ boolean have_linear = FALSE, have_centroid = FALSE, have_perspective = FALSE;
+ unsigned spi_baryc_cntl;
/* clear previous register */
rstate->nregs = 0;
for (i = 0; i < rshader->ninput; i++) {
- tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index2(&rctx->vs_shader->shader, rshader, i));
+ tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(&rctx->vs_shader->shader, rshader, i));
+ /* evergreen NUM_INTERP only contains values interpolated into the LDS,
+ POSITION goes via GPRs from the SC so isn't counted */
if (rshader->input[i].name == TGSI_SEMANTIC_POSITION)
- have_pos = TRUE;
+ pos_index = i;
+ else if (rshader->input[i].name == TGSI_SEMANTIC_FACE)
+ face_index = i;
+ else {
+ if (rshader->input[i].interpolate == TGSI_INTERPOLATE_LINEAR ||
+ rshader->input[i].interpolate == TGSI_INTERPOLATE_PERSPECTIVE)
+ ninterp++;
+ if (rshader->input[i].interpolate == TGSI_INTERPOLATE_LINEAR)
+ have_linear = TRUE;
+ if (rshader->input[i].interpolate == TGSI_INTERPOLATE_PERSPECTIVE)
+ have_perspective = TRUE;
+ if (rshader->input[i].centroid)
+ have_centroid = TRUE;
+ }
if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
tmp |= S_028644_FLAT_SHADE(rshader->flat_shade);
}
- if (rshader->input[i].name == TGSI_SEMANTIC_FACE)
- have_face = TRUE;
if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC &&
rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) {
tmp |= S_028644_PT_SPRITE_TEX(1);
}
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL);
}
for (i = 0; i < rshader->noutput; i++) {
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_02880C_DB_SHADER_CONTROL,
- S_02880C_Z_EXPORT_ENABLE(1),
- S_02880C_Z_EXPORT_ENABLE(1), NULL);
+ if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
+ r600_pipe_state_add_reg(rstate,
+ R_02880C_DB_SHADER_CONTROL,
+ S_02880C_Z_EXPORT_ENABLE(1),
+ S_02880C_Z_EXPORT_ENABLE(1), NULL);
+ if (rshader->output[i].name == TGSI_SEMANTIC_STENCIL)
+ r600_pipe_state_add_reg(rstate,
+ R_02880C_DB_SHADER_CONTROL,
+ S_02880C_STENCIL_EXPORT_ENABLE(1),
+ S_02880C_STENCIL_EXPORT_ENABLE(1), NULL);
}
exports_ps = 0;
num_cout = 0;
for (i = 0; i < rshader->noutput; i++) {
- if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
+ if (rshader->output[i].name == TGSI_SEMANTIC_POSITION ||
+ rshader->output[i].name == TGSI_SEMANTIC_STENCIL)
exports_ps |= 1;
else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) {
num_cout++;
exports_ps = 2;
}
- spi_ps_in_control_0 = S_0286CC_NUM_INTERP(rshader->ninput) |
- S_0286CC_PERSP_GRADIENT_ENA(1);
+ if (ninterp == 0) {
+ ninterp = 1;
+ have_perspective = TRUE;
+ }
+
+ spi_ps_in_control_0 = S_0286CC_NUM_INTERP(ninterp) |
+ S_0286CC_PERSP_GRADIENT_ENA(have_perspective) |
+ S_0286CC_LINEAR_GRADIENT_ENA(have_linear);
spi_input_z = 0;
- if (have_pos) {
- spi_ps_in_control_0 |= S_0286CC_POSITION_ENA(1);
+ if (pos_index != -1) {
+ spi_ps_in_control_0 |= S_0286CC_POSITION_ENA(1) |
+ S_0286CC_POSITION_CENTROID(rshader->input[pos_index].centroid) |
+ S_0286CC_POSITION_ADDR(rshader->input[pos_index].gpr);
spi_input_z |= 1;
}
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286CC_SPI_PS_IN_CONTROL_0,
+
+ spi_ps_in_control_1 = 0;
+ if (face_index != -1) {
+ spi_ps_in_control_1 |= S_0286D0_FRONT_FACE_ENA(1) |
+ S_0286D0_FRONT_FACE_ADDR(rshader->input[face_index].gpr);
+ }
+
+ spi_baryc_cntl = 0;
+ if (have_perspective)
+ spi_baryc_cntl |= S_0286E0_PERSP_CENTER_ENA(1) |
+ S_0286E0_PERSP_CENTROID_ENA(have_centroid);
+ if (have_linear)
+ spi_baryc_cntl |= S_0286E0_LINEAR_CENTER_ENA(1) |
+ S_0286E0_LINEAR_CENTROID_ENA(have_centroid);
+
+ r600_pipe_state_add_reg(rstate, R_0286CC_SPI_PS_IN_CONTROL_0,
spi_ps_in_control_0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286D0_SPI_PS_IN_CONTROL_1,
- S_0286D0_FRONT_FACE_ENA(have_face), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate, R_0286D0_SPI_PS_IN_CONTROL_1,
+ spi_ps_in_control_1, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0286E4_SPI_PS_IN_CONTROL_2,
+ 0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_0286E0_SPI_BARYC_CNTL,
+ spi_baryc_cntl,
+ 0xFFFFFFFF, NULL);
+
+ r600_pipe_state_add_reg(rstate,
R_028840_SQ_PGM_START_PS,
- 0x00000000, 0xFFFFFFFF, shader->bo);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ (r600_bo_offset(shader->bo)) >> 8, 0xFFFFFFFF, shader->bo);
+ r600_pipe_state_add_reg(rstate,
R_028844_SQ_PGM_RESOURCES_PS,
S_028844_NUM_GPRS(rshader->bc.ngpr) |
S_028844_PRIME_CACHE_ON_DRAW(1) |
S_028844_STACK_SIZE(rshader->bc.nstack),
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028848_SQ_PGM_RESOURCES_2_PS,
0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_02884C_SQ_PGM_EXPORTS_PS,
exports_ps, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
- R_0286E0_SPI_BARYC_CNTL,
- S_0286E0_PERSP_CENTROID_ENA(1) |
- S_0286E0_LINEAR_CENTROID_ENA(1),
- 0xFFFFFFFF, NULL);
if (rshader->uses_kill) {
/* only set some bits here, the other bits are set in the dsa state */
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_02880C_DB_SHADER_CONTROL,
S_02880C_KILL_ENABLE(1),
S_02880C_KILL_ENABLE(1), NULL);
}
+
+ r600_pipe_state_add_reg(rstate,
+ R_03A200_SQ_LOOP_CONST_0, 0x01000FFF,
+ 0xFFFFFFFF, NULL);
}
void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader)
spi_vs_out_id[i / 4] |= tmp;
}
for (i = 0; i < 10; i++) {
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_02861C_SPI_VS_OUT_ID_0 + i * 4,
spi_vs_out_id[i], 0xFFFFFFFF, NULL);
}
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_0286C4_SPI_VS_OUT_CONFIG,
S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2),
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028860_SQ_PGM_RESOURCES_VS,
S_028860_NUM_GPRS(rshader->bc.ngpr) |
S_028860_STACK_SIZE(rshader->bc.nstack),
0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_028864_SQ_PGM_RESOURCES_2_VS,
0x0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_0288A8_SQ_PGM_RESOURCES_FS,
0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ r600_pipe_state_add_reg(rstate,
R_02885C_SQ_PGM_START_VS,
- 0x00000000, 0xFFFFFFFF, shader->bo);
- r600_pipe_state_add_reg(rstate, EVERGREEN_GROUP_CONTEXT,
+ (r600_bo_offset(shader->bo)) >> 8, 0xFFFFFFFF, shader->bo);
+ r600_pipe_state_add_reg(rstate,
R_0288A4_SQ_PGM_START_FS,
- 0x00000000, 0xFFFFFFFF, shader->bo);
+ (r600_bo_offset(shader->bo)) >> 8, 0xFFFFFFFF, shader->bo);
+
+ r600_pipe_state_add_reg(rstate,
+ R_03A200_SQ_LOOP_CONST_0 + (32 * 4), 0x01000FFF,
+ 0xFFFFFFFF, NULL);
+}
+
+void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx)
+{
+ struct pipe_depth_stencil_alpha_state dsa;
+ struct r600_pipe_state *rstate;
+
+ memset(&dsa, 0, sizeof(dsa));
+
+ rstate = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa);
+ r600_pipe_state_add_reg(rstate,
+ R_02880C_DB_SHADER_CONTROL,
+ 0x0,
+ S_02880C_DUAL_EXPORT_ENABLE(1), NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028000_DB_RENDER_CONTROL,
+ S_028000_DEPTH_COPY_ENABLE(1) |
+ S_028000_STENCIL_COPY_ENABLE(1) |
+ S_028000_COPY_CENTROID(1),
+ S_028000_DEPTH_COPY_ENABLE(1) |
+ S_028000_STENCIL_COPY_ENABLE(1) |
+ S_028000_COPY_CENTROID(1), NULL);
+ return rstate;
}
#define EVERGREEN_SAMPLER_OFFSET 0X0003C000
#define EVERGREEN_SAMPLER_END 0X0003CFF0
+#define EVERGREEN_CTL_CONST_OFFSET 0x0003CFF0
+#define EVERGREEN_CTL_CONST_END 0x0003E200
+
#define EVENT_TYPE_ZPASS_DONE 0x15
#define EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT 0x16
#define S_02880C_Z_EXPORT_ENABLE(x) (((x) & 0x1) << 0)
#define G_02880C_Z_EXPORT_ENABLE(x) (((x) >> 0) & 0x1)
#define C_02880C_Z_EXPORT_ENABLE 0xFFFFFFFE
+#define S_02880C_STENCIL_EXPORT_ENABLE(x) (((x) & 0x1) << 1)
+#define G_02880C_STENCIL_EXPORT_ENABLE(x) (((x) >> 1) & 0x1)
+#define C_02880C_STENCIL_EXPORT_ENABLE 0xFFFFFFFD
#define S_02880C_Z_ORDER(x) (((x) & 0x3) << 4)
#define G_02880C_Z_ORDER(x) (((x) >> 4) & 0x3)
#define C_02880C_Z_ORDER 0xFFFFFCFF
#define S_030010_ENDIAN_SWAP(x) (((x) & 0x3) << 12)
#define G_030010_ENDIAN_SWAP(x) (((x) >> 12) & 0x3)
#define C_030010_ENDIAN_SWAP 0xFFFFCFFF
-#define S_030010_REQUEST_SIZE(x) (((x) & 0x3) << 14)
-#define G_030010_REQUEST_SIZE(x) (((x) >> 14) & 0x3)
-#define C_030010_REQUEST_SIZE 0xFFFF3FFF
#define S_030010_DST_SEL_X(x) (((x) & 0x7) << 16)
#define G_030010_DST_SEL_X(x) (((x) >> 16) & 0x7)
#define C_030010_DST_SEL_X 0xFFF8FFFF
#define S_030008_DATA_FORMAT(x) (((x) & 0x3F) << 20)
#define G_030008_DATA_FORMAT(x) (((x) >> 20) & 0x3F)
#define C_030008_DATA_FORMAT 0xFC0FFFFF
-#define V_030008_COLOR_INVALID 0x00000000
-#define V_030008_COLOR_8 0x00000001
-#define V_030008_COLOR_4_4 0x00000002
-#define V_030008_COLOR_3_3_2 0x00000003
-#define V_030008_COLOR_16 0x00000005
-#define V_030008_COLOR_16_FLOAT 0x00000006
-#define V_030008_COLOR_8_8 0x00000007
-#define V_030008_COLOR_5_6_5 0x00000008
-#define V_030008_COLOR_6_5_5 0x00000009
-#define V_030008_COLOR_1_5_5_5 0x0000000A
-#define V_030008_COLOR_4_4_4_4 0x0000000B
-#define V_030008_COLOR_5_5_5_1 0x0000000C
-#define V_030008_COLOR_32 0x0000000D
-#define V_030008_COLOR_32_FLOAT 0x0000000E
-#define V_030008_COLOR_16_16 0x0000000F
-#define V_030008_COLOR_16_16_FLOAT 0x00000010
-#define V_030008_COLOR_8_24 0x00000011
-#define V_030008_COLOR_8_24_FLOAT 0x00000012
-#define V_030008_COLOR_24_8 0x00000013
-#define V_030008_COLOR_24_8_FLOAT 0x00000014
-#define V_030008_COLOR_10_11_11 0x00000015
-#define V_030008_COLOR_10_11_11_FLOAT 0x00000016
-#define V_030008_COLOR_11_11_10 0x00000017
-#define V_030008_COLOR_11_11_10_FLOAT 0x00000018
-#define V_030008_COLOR_2_10_10_10 0x00000019
-#define V_030008_COLOR_8_8_8_8 0x0000001A
-#define V_030008_COLOR_10_10_10_2 0x0000001B
-#define V_030008_COLOR_X24_8_32_FLOAT 0x0000001C
-#define V_030008_COLOR_32_32 0x0000001D
-#define V_030008_COLOR_32_32_FLOAT 0x0000001E
-#define V_030008_COLOR_16_16_16_16 0x0000001F
-#define V_030008_COLOR_16_16_16_16_FLOAT 0x00000020
-#define V_030008_COLOR_32_32_32_32 0x00000022
-#define V_030008_COLOR_32_32_32_32_FLOAT 0x00000023
#define S_030008_NUM_FORMAT_ALL(x) (((x) & 0x3) << 26)
#define G_030008_NUM_FORMAT_ALL(x) (((x) >> 26) & 0x3)
#define C_030008_NUM_FORMAT_ALL 0xF3FFFFFF
#define R_008C0C_SQ_THREAD_RESOURCE_MGMT 0x00008C0C
#define R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 0x00008D8C
#define R_028000_DB_RENDER_CONTROL 0x00028000
+#define S_028000_DEPTH_CLEAR_ENABLE(x) (((x) & 0x1) << 0)
+#define S_028000_STENCIL_CLEAR_ENABLE(x) (((x) & 0x1) << 1)
+#define S_028000_DEPTH_COPY_ENABLE(x) (((x) & 0x1) << 2)
+#define S_028000_STENCIL_COPY_ENABLE(x) (((x) & 0x1) << 3)
+#define S_028000_RESUMMARIZE_ENABLE(x) (((x) & 0x1) << 4)
#define S_028000_STENCIL_COMPRESS_DISABLE(x) (((x) & 0x1) << 5)
#define S_028000_DEPTH_COMPRESS_DISABLE(x) (((x) & 0x1) << 6)
+#define S_028000_COPY_CENTROID(x) (((x) & 0x1) << 7)
+#define S_028000_COPY_SAMPLE(x) (((x) & 0x7) << 8)
+#define S_028000_COLOR_DISABLE(x) (((x) & 0x1) << 12)
#define R_028004_DB_COUNT_CONTROL 0x00028004
#define S_028004_ZPASS_INCREMENT_DISABLE (((x) & 0x1) << 0)
#define S_028004_PERFECT_ZPASS_COUNTS(x) (((x) & 0x1) << 1)
#define R_028CA8_CB_COLOR1_VIEW 0x00028CA8
#define R_028CAC_CB_COLOR1_INFO 0x00028CAC
#define R_028CB0_CB_COLOR1_ATTRIB 0x00028CB0
-#define R_028CB8_CB_COLOR1_DIM 0x00028CB8
+#define R_028CB4_CB_COLOR1_DIM 0x00028CB4
#define R_028CD8_CB_COLOR2_BASE 0x00028CD8
#define R_028CDC_CB_COLOR2_PITCH 0x00028CDC
#define R_028CE0_CB_COLOR2_SLICE 0x00028CE0
#define S_0085F0_DB_DEST_BASE_ENA(x) (((x) & 0x1) << 14)
#define G_0085F0_DB_DEST_BASE_ENA(x) (((x) >> 14) & 0x1)
#define C_0085F0_DB_DEST_BASE_ENA 0xFFFFBFFF
-#define S_0085F0_CR_DEST_BASE_ENA(x) (((x) & 0x1) << 15)
-#define G_0085F0_CR_DEST_BASE_ENA(x) (((x) >> 15) & 0x1)
-#define C_0085F0_CR_DEST_BASE_ENA 0xFFFF7FFF
+#define S_0085F0_CB8_DEST_BASE_ENA(x) (((x) & 0x1) << 15)
+#define G_0085F0_CB8_DEST_BASE_ENA(x) (((x) >> 15) & 0x1)
+
+#define S_0085F0_CB9_DEST_BASE_ENA(x) (((x) & 0x1) << 16)
+#define G_0085F0_CB9_DEST_BASE_ENA(x) (((x) >> 16) & 0x1)
+
+#define S_0085F0_CB10_DEST_BASE_ENA(x) (((x) & 0x1) << 17)
+#define G_0085F0_CB10_DEST_BASE_ENA(x) (((x) >> 17) & 0x1)
+
+#define S_0085F0_CB11_DEST_BASE_ENA(x) (((x) & 0x1) << 18)
+#define G_0085F0_CB11_DEST_BASE_ENA(x) (((x) >> 18) & 0x1)
+
#define S_0085F0_TC_ACTION_ENA(x) (((x) & 0x1) << 23)
#define G_0085F0_TC_ACTION_ENA(x) (((x) >> 23) & 0x1)
#define C_0085F0_TC_ACTION_ENA 0xFF7FFFFF
#define R_008970_VGT_NUM_INDICES 0x008970
#define R_0287F0_VGT_DRAW_INITIATOR 0x0287F0
+#define R_03CFF0_SQ_VTX_BASE_VTX_LOC 0x03CFF0
+#define R_03CFF4_SQ_VTX_START_INST_LOC 0x03CFF4
+
+#define R_03A200_SQ_LOOP_CONST_0 0x3A200
#endif
#ifndef R600_H
#define R600_H
+#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <util/u_double_list.h>
EVERGREEN,
};
+struct r600_tiling_info {
+ unsigned num_channels;
+ unsigned num_banks;
+ unsigned group_bytes;
+};
+
enum radeon_family r600_get_family(struct radeon *rw);
enum chip_class r600_get_family_class(struct radeon *radeon);
+struct r600_tiling_info *r600_get_tiling_info(struct radeon *radeon);
-/* lowlevel WS bo */
-struct radeon_ws_bo;
-struct radeon_ws_bo *radeon_ws_bo(struct radeon *radeon,
+/* r600_bo.c */
+struct r600_bo;
+struct r600_bo *r600_bo(struct radeon *radeon,
unsigned size, unsigned alignment, unsigned usage);
-struct radeon_ws_bo *radeon_ws_bo_handle(struct radeon *radeon,
- unsigned handle);
-void *radeon_ws_bo_map(struct radeon *radeon, struct radeon_ws_bo *bo, unsigned usage, void *ctx);
-void radeon_ws_bo_unmap(struct radeon *radeon, struct radeon_ws_bo *bo);
-void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst,
- struct radeon_ws_bo *src);
+struct r600_bo *r600_bo_handle(struct radeon *radeon,
+ unsigned handle, unsigned *array_mode);
+void *r600_bo_map(struct radeon *radeon, struct r600_bo *bo, unsigned usage, void *ctx);
+void r600_bo_unmap(struct radeon *radeon, struct r600_bo *bo);
+void r600_bo_reference(struct radeon *radeon, struct r600_bo **dst,
+ struct r600_bo *src);
+static INLINE unsigned r600_bo_offset(struct r600_bo *bo)
+{
+ return 0;
+}
+
/* R600/R700 STATES */
#define R600_GROUP_MAX 16
#define R600_BLOCK_MAX_BO 32
#define R600_BLOCK_MAX_REG 128
-enum r600_group_id {
- R600_GROUP_CONFIG = 0,
- R600_GROUP_CONTEXT,
- R600_GROUP_ALU_CONST,
- R600_GROUP_RESOURCE,
- R600_GROUP_SAMPLER,
- R600_GROUP_CTL_CONST,
- R600_GROUP_LOOP_CONST,
- R600_GROUP_BOOL_CONST,
- R600_NGROUPS
-};
-
-enum evergreen_group_id {
- EVERGREEN_GROUP_CONFIG = 0,
- EVERGREEN_GROUP_CONTEXT,
- EVERGREEN_GROUP_RESOURCE,
- EVERGREEN_GROUP_SAMPLER,
- EVERGREEN_GROUP_CTL_CONST,
- EVERGREEN_GROUP_LOOP_CONST,
- EVERGREEN_GROUP_BOOL_CONST,
- EVERGREEN_GROUP_SAMPLER_BORDER,
- EVERGREEN_NGROUPS
-};
-
struct r600_pipe_reg {
- unsigned group_id;
u32 offset;
u32 mask;
u32 value;
- struct radeon_ws_bo *bo;
+ struct r600_bo *bo;
};
struct r600_pipe_state {
};
static inline void r600_pipe_state_add_reg(struct r600_pipe_state *state,
- unsigned group_id, u32 offset,
- u32 value, u32 mask,
- struct radeon_ws_bo *bo)
+ u32 offset, u32 value, u32 mask,
+ struct r600_bo *bo)
{
- state->regs[state->nregs].group_id = group_id;
state->regs[state->nregs].offset = offset;
state->regs[state->nregs].value = value;
state->regs[state->nregs].mask = mask;
#define R600_BLOCK_STATUS_DIRTY (1 << 1)
struct r600_block_reloc {
- struct radeon_ws_bo *bo;
- unsigned nreloc;
- unsigned bo_pm4_index[R600_BLOCK_MAX_BO];
+ struct r600_bo *bo;
+ unsigned flush_flags;
+ unsigned flush_mask;
+ unsigned bo_pm4_index;
};
-struct r600_group_block {
+struct r600_block {
+ struct list_head list;
unsigned status;
unsigned start_offset;
unsigned pm4_ndwords;
+ unsigned pm4_flush_ndwords;
unsigned nbo;
unsigned nreg;
u32 *reg;
struct r600_block_reloc reloc[R600_BLOCK_MAX_BO];
};
-struct r600_group {
+struct r600_range {
unsigned start_offset;
unsigned end_offset;
- unsigned nblocks;
- struct r600_group_block *blocks;
- unsigned *offset_block_id;
+ struct r600_block **blocks;
};
/*
/* if we've flushed the query */
unsigned state;
/* The buffer where query results are stored. */
- struct radeon_ws_bo *buffer;
+ struct r600_bo *buffer;
unsigned buffer_size;
/* linked list of queries */
struct list_head list;
struct r600_context {
struct radeon *radeon;
- unsigned ngroups;
- struct r600_group groups[R600_GROUP_MAX];
+ unsigned hash_size;
+ unsigned hash_shift;
+ struct r600_range range[256];
+ unsigned nblocks;
+ struct r600_block **blocks;
+ struct list_head dirty;
unsigned pm4_ndwords;
unsigned pm4_cdwords;
unsigned pm4_dirty_cdwords;
u32 *pm4;
struct list_head query_list;
unsigned num_query_running;
+ unsigned fence;
+ struct list_head fenced_bo;
+ unsigned *cfence;
+ struct r600_bo *fence_bo;
};
struct r600_draw {
u32 vgt_index_type;
u32 vgt_draw_initiator;
u32 indices_bo_offset;
- struct radeon_ws_bo *indices;
+ struct r600_bo *indices;
};
int r600_context_init(struct r600_context *ctx, struct radeon *radeon);
boolean wait, void *vresult);
void r600_query_begin(struct r600_context *ctx, struct r600_query *query);
void r600_query_end(struct r600_context *ctx, struct r600_query *query);
+void r600_context_queries_suspend(struct r600_context *ctx);
+void r600_context_queries_resume(struct r600_context *ctx);
int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon);
void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw);
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "radeon.h"
-#include "r600_context.h"
+#include <stdio.h>
+#include <errno.h>
#include "util/u_memory.h"
+#include "r600_pipe.h"
#include "r600_sq.h"
#include "r600_opcodes.h"
#include "r600_asm.h"
-#include <stdio.h>
-#include <errno.h>
static inline unsigned int r600_bc_get_num_operands(struct r600_bc_alu *alu)
{
bc->cf_last->ndw += 2;
bc->ndw += 2;
- if (bc->use_mem_constant)
- bc->cf_last->kcache0_mode = 2;
+ bc->cf_last->kcache0_mode = 2;
/* process cur ALU instructions for bank swizzle */
if (alu->last) {
S_SQ_VTX_WORD1_DST_SEL_Y(vtx->dst_sel_y) |
S_SQ_VTX_WORD1_DST_SEL_Z(vtx->dst_sel_z) |
S_SQ_VTX_WORD1_DST_SEL_W(vtx->dst_sel_w) |
- S_SQ_VTX_WORD1_USE_CONST_FIELDS(1) |
+ S_SQ_VTX_WORD1_USE_CONST_FIELDS(vtx->use_const_fields) |
+ S_SQ_VTX_WORD1_DATA_FORMAT(vtx->data_format) |
+ S_SQ_VTX_WORD1_NUM_FORMAT_ALL(vtx->num_format_all) |
+ S_SQ_VTX_WORD1_FORMAT_COMP_ALL(vtx->format_comp_all) |
+ S_SQ_VTX_WORD1_SRF_MODE_ALL(vtx->srf_mode_all) |
S_SQ_VTX_WORD1_GPR_DST_GPR(vtx->dst_gpr);
bc->bytecode[id++] = S_SQ_VTX_WORD2_MEGA_FETCH(1);
bc->bytecode[id++] = 0;
unsigned bank_swizzle;
unsigned bank_swizzle_force;
u32 value[4];
- int hw_gpr[NUM_OF_CYCLES][NUM_OF_COMPONENTS];
+ int hw_gpr[NUM_OF_CYCLES][NUM_OF_COMPONENTS];
};
struct r600_bc_tex {
unsigned dst_sel_y;
unsigned dst_sel_z;
unsigned dst_sel_w;
+ unsigned use_const_fields;
+ unsigned data_format;
+ unsigned num_format_all;
+ unsigned format_comp_all;
+ unsigned srf_mode_all;
};
struct r600_bc_output {
struct r600_bc {
enum radeon_family family;
int chiprev; /* 0 - r600, 1 - r700, 2 - evergreen */
- unsigned use_mem_constant;
struct list_head cf;
struct r600_bc_cf *cf_last;
unsigned ndw;
struct r600_cf_callstack callstack[SQ_MAX_CALL_DEPTH];
};
+/* eg_asm.c */
+int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf);
+
+/* r600_asm.c */
int r600_bc_init(struct r600_bc *bc, enum radeon_family family);
int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu);
int r600_bc_add_literal(struct r600_bc *bc, const u32 *value);
int r600_bc_add_cfinst(struct r600_bc *bc, int inst);
int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int type);
+/* r700_asm.c */
+int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id);
+
#endif
/*
- * Copyright 2009 Marek Olšák <maraeo@gmail.com>
+ * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* 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:
- * Jerome Glisse
- * Marek Olšák
*/
-#include <errno.h>
-#include <pipe/p_screen.h>
+#include <util/u_surface.h>
#include <util/u_blitter.h>
-#include <util/u_inlines.h>
-#include <util/u_memory.h>
-#include "util/u_surface.h"
-#include "r600_screen.h"
-#include "r600_context.h"
+#include <util/u_format.h>
+#include "r600_pipe.h"
+
+enum r600_blitter_op /* bitmask */
+{
+ R600_CLEAR = 1,
+ R600_CLEAR_SURFACE = 2,
+ R600_COPY = 4
+};
-static void r600_blitter_save_states(struct pipe_context *ctx)
+static void r600_blitter_begin(struct pipe_context *ctx, enum r600_blitter_op op)
{
- struct r600_context *rctx = r600_context(ctx);
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- util_blitter_save_blend(rctx->blitter, rctx->blend);
- util_blitter_save_depth_stencil_alpha(rctx->blitter, rctx->dsa);
- if (rctx->stencil_ref) {
- util_blitter_save_stencil_ref(rctx->blitter,
- &rctx->stencil_ref->state.stencil_ref);
+ r600_context_queries_suspend(&rctx->ctx);
+
+ util_blitter_save_blend(rctx->blitter, rctx->states[R600_PIPE_STATE_BLEND]);
+ util_blitter_save_depth_stencil_alpha(rctx->blitter, rctx->states[R600_PIPE_STATE_DSA]);
+ if (rctx->states[R600_PIPE_STATE_STENCIL_REF]) {
+ util_blitter_save_stencil_ref(rctx->blitter, &rctx->stencil_ref);
}
- util_blitter_save_rasterizer(rctx->blitter, rctx->rasterizer);
+ util_blitter_save_rasterizer(rctx->blitter, rctx->states[R600_PIPE_STATE_RASTERIZER]);
util_blitter_save_fragment_shader(rctx->blitter, rctx->ps_shader);
util_blitter_save_vertex_shader(rctx->blitter, rctx->vs_shader);
util_blitter_save_vertex_elements(rctx->blitter, rctx->vertex_elements);
- if (rctx->viewport) {
- util_blitter_save_viewport(rctx->blitter, &rctx->viewport->state.viewport);
+ if (rctx->states[R600_PIPE_STATE_VIEWPORT]) {
+ util_blitter_save_viewport(rctx->blitter, &rctx->viewport);
}
- if (rctx->clip) {
- util_blitter_save_clip(rctx->blitter, &rctx->clip->state.clip);
+ if (rctx->states[R600_PIPE_STATE_CLIP]) {
+ util_blitter_save_clip(rctx->blitter, &rctx->clip);
}
- util_blitter_save_vertex_buffers(rctx->blitter, rctx->nvertex_buffer,
- rctx->vertex_buffer);
-
- /* remove ptr so they don't get deleted */
- rctx->blend = NULL;
- rctx->clip = NULL;
- rctx->vs_shader = NULL;
- rctx->ps_shader = NULL;
- rctx->rasterizer = NULL;
- rctx->dsa = NULL;
+ util_blitter_save_vertex_buffers(rctx->blitter, rctx->nvertex_buffer, rctx->vertex_buffer);
+
rctx->vertex_elements = NULL;
- /* suspend queries */
- r600_queries_suspend(ctx);
+ if (op & (R600_CLEAR_SURFACE | R600_COPY))
+ util_blitter_save_framebuffer(rctx->blitter, &rctx->framebuffer);
+
+ if (op & R600_COPY) {
+ util_blitter_save_fragment_sampler_states(
+ rctx->blitter, rctx->ps_samplers.n_samplers,
+ (void**)rctx->ps_samplers.samplers);
+
+ util_blitter_save_fragment_sampler_views(
+ rctx->blitter, rctx->ps_samplers.n_views,
+ (struct pipe_sampler_view**)rctx->ps_samplers.views);
+ }
+
+}
+
+static void r600_blitter_end(struct pipe_context *ctx)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ r600_context_queries_resume(&rctx->ctx);
+}
+
+int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct pipe_surface *zsurf, *cbsurf;
+ int level = 0;
+ float depth = 1.0f;
+
+ zsurf = ctx->screen->get_tex_surface(ctx->screen, &texture->resource.base.b, 0, level, 0,
+ PIPE_BIND_DEPTH_STENCIL);
+
+ cbsurf = ctx->screen->get_tex_surface(ctx->screen,
+ (struct pipe_resource*)texture->flushed_depth_texture,
+ 0, level, 0, PIPE_BIND_RENDER_TARGET);
+
+ if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 ||
+ rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635)
+ depth = 0.0f;
+
+ r600_blitter_begin(ctx, R600_CLEAR_SURFACE);
+ util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth);
+ r600_blitter_end(ctx);
+
+ pipe_surface_reference(&zsurf, NULL);
+ pipe_surface_reference(&cbsurf, NULL);
+
+
+ return 0;
}
static void r600_clear(struct pipe_context *ctx, unsigned buffers,
const float *rgba, double depth, unsigned stencil)
{
- struct r600_context *rctx = r600_context(ctx);
- struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct pipe_framebuffer_state *fb = &rctx->framebuffer;
- r600_blitter_save_states(ctx);
+ r600_blitter_begin(ctx, R600_CLEAR);
util_blitter_clear(rctx->blitter, fb->width, fb->height,
fb->nr_cbufs, buffers, rgba, depth,
stencil);
- /* resume queries */
- r600_queries_resume(ctx);
+ r600_blitter_end(ctx);
}
static void r600_clear_render_target(struct pipe_context *ctx,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height)
{
- struct r600_context *rctx = r600_context(ctx);
- struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
-
- r600_blitter_save_states(ctx);
- util_blitter_save_framebuffer(rctx->blitter, fb);
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ r600_blitter_begin(ctx, R600_CLEAR_SURFACE);
util_blitter_clear_render_target(rctx->blitter, dst, rgba,
dstx, dsty, width, height);
- /* resume queries */
- r600_queries_resume(ctx);
+ r600_blitter_end(ctx);
}
static void r600_clear_depth_stencil(struct pipe_context *ctx,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height)
{
- struct r600_context *rctx = r600_context(ctx);
- struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
-
- r600_blitter_save_states(ctx);
- util_blitter_save_framebuffer(rctx->blitter, fb);
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ r600_blitter_begin(ctx, R600_CLEAR_SURFACE);
util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil,
dstx, dsty, width, height);
- /* resume queries */
- r600_queries_resume(ctx);
+ r600_blitter_end(ctx);
}
+
+/* Copy a block of pixels from one surface to another using HW. */
+static void r600_hw_copy_region(struct pipe_context *ctx,
+ struct pipe_resource *dst,
+ struct pipe_subresource subdst,
+ unsigned dstx, unsigned dsty, unsigned dstz,
+ struct pipe_resource *src,
+ struct pipe_subresource subsrc,
+ unsigned srcx, unsigned srcy, unsigned srcz,
+ unsigned width, unsigned height)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+
+ r600_blitter_begin(ctx, R600_COPY);
+ util_blitter_copy_region(rctx->blitter, dst, subdst, dstx, dsty, dstz,
+ src, subsrc, srcx, srcy, srcz, width, height,
+ TRUE);
+ r600_blitter_end(ctx);
+}
+
static void r600_resource_copy_region(struct pipe_context *ctx,
struct pipe_resource *dst,
struct pipe_subresource subdst,
unsigned srcx, unsigned srcy, unsigned srcz,
unsigned width, unsigned height)
{
- util_resource_copy_region(ctx, dst, subdst, dstx, dsty, dstz,
- src, subsrc, srcx, srcy, srcz, width, height);
-}
+ boolean is_depth;
+ /* there is something wrong with depth resource copies at the moment so avoid them for now */
+ is_depth = util_format_get_component_bits(src->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0;
+ if (is_depth)
+ util_resource_copy_region(ctx, dst, subdst, dstx, dsty, dstz,
+ src, subsrc, srcx, srcy, srcz, width, height);
+ else
+ r600_hw_copy_region(ctx, dst, subdst, dstx, dsty, dstz,
+ src, subsrc, srcx, srcy, srcz, width, height);
-static void *r600_create_db_flush_dsa(struct r600_context *rctx)
-{
- struct r600_screen *rscreen = rctx->screen;
- struct pipe_depth_stencil_alpha_state dsa;
- struct r600_context_state *state;
- boolean quirk = false;
- enum radeon_family family;
-
- family = radeon_get_family(rscreen->rw);
- if (family == CHIP_RV610 || family == CHIP_RV630 || family == CHIP_RV620 ||
- family == CHIP_RV635)
- quirk = true;
-
- memset(&dsa, 0, sizeof(dsa));
-
- if (quirk) {
- dsa.depth.enabled = 1;
- dsa.depth.func = PIPE_FUNC_LEQUAL;
- dsa.stencil[0].enabled = 1;
- dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
- dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_KEEP;
- dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_INCR;
- dsa.stencil[0].writemask = 0xff;
- }
-
- state = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa);
- state->flags |= R600_STATE_FLAG_DSA_FLUSH;
- return state;
-
}
-void r600_init_blit_functions(struct r600_context *rctx)
+void r600_init_blit_functions(struct r600_pipe_context *rctx)
{
rctx->context.clear = r600_clear;
rctx->context.clear_render_target = r600_clear_render_target;
rctx->context.clear_depth_stencil = r600_clear_depth_stencil;
rctx->context.resource_copy_region = r600_resource_copy_region;
-
- /* create a custom depth stencil for DB flush */
- rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx);
-}
-
-int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct pipe_framebuffer_state *fb = rctx->pframebuffer;
- struct pipe_surface *zsurf, *cbsurf;
- int level = 0;
- float depth = 1.0f;
-
- zsurf = ctx->screen->get_tex_surface(ctx->screen, &texture->resource.base.b, 0, level, 0,
- PIPE_BIND_DEPTH_STENCIL);
-
- cbsurf = ctx->screen->get_tex_surface(ctx->screen, texture->flushed_depth_texture, 0, level, 0,
- PIPE_BIND_RENDER_TARGET);
-
- r600_blitter_save_states(ctx);
- util_blitter_save_framebuffer(rctx->blitter, fb);
-
- if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 ||
- rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635)
- depth = 0.0f;
-
- util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth);
-
- pipe_surface_reference(&zsurf, NULL);
- pipe_surface_reference(&cbsurf, NULL);
-
- /* resume queries */
- r600_queries_resume(ctx);
- return 0;
}
#include <util/u_memory.h>
#include <util/u_upload_mgr.h>
#include "state_tracker/drm_driver.h"
-#include "r600_screen.h"
-#include "r600_context.h"
-#include "r600_resource.h"
+#include <xf86drm.h>
+#include "radeon_drm.h"
+#include "r600.h"
+#include "r600_pipe.h"
extern struct u_resource_vtbl r600_buffer_vtbl;
u32 domain = RADEON_GEM_DOMAIN_GTT;
if (usage & PIPE_BIND_RENDER_TARGET) {
- domain |= RADEON_GEM_DOMAIN_VRAM;
+ domain |= RADEON_GEM_DOMAIN_VRAM;
}
if (usage & PIPE_BIND_DEPTH_STENCIL) {
- domain |= RADEON_GEM_DOMAIN_VRAM;
+ domain |= RADEON_GEM_DOMAIN_VRAM;
}
if (usage & PIPE_BIND_SAMPLER_VIEW) {
- domain |= RADEON_GEM_DOMAIN_VRAM;
+ domain |= RADEON_GEM_DOMAIN_VRAM;
}
/* also need BIND_BLIT_SOURCE/DESTINATION ? */
if (usage & PIPE_BIND_VERTEX_BUFFER) {
- domain |= RADEON_GEM_DOMAIN_GTT;
+ domain |= RADEON_GEM_DOMAIN_GTT;
}
if (usage & PIPE_BIND_INDEX_BUFFER) {
- domain |= RADEON_GEM_DOMAIN_GTT;
+ domain |= RADEON_GEM_DOMAIN_GTT;
}
if (usage & PIPE_BIND_CONSTANT_BUFFER) {
- domain |= RADEON_GEM_DOMAIN_VRAM;
+ domain |= RADEON_GEM_DOMAIN_VRAM;
}
return domain;
struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
const struct pipe_resource *templ)
{
- struct r600_screen *rscreen = r600_screen(screen);
struct r600_resource_buffer *rbuffer;
- struct radeon_ws_bo *bo;
+ struct r600_bo *bo;
/* XXX We probably want a different alignment for buffers and textures. */
unsigned alignment = 4096;
rbuffer->r.base.vtbl = &r600_buffer_vtbl;
rbuffer->r.size = rbuffer->r.base.b.width0;
rbuffer->r.domain = r600_domain_from_usage(rbuffer->r.base.b.bind);
- bo = radeon_ws_bo(rscreen->rw, rbuffer->r.base.b.width0, alignment, rbuffer->r.base.b.bind);
+ bo = r600_bo((struct radeon*)screen->winsys, rbuffer->r.base.b.width0, alignment, rbuffer->r.base.b.bind);
if (bo == NULL) {
FREE(rbuffer);
return NULL;
struct pipe_resource *buf)
{
struct r600_resource_buffer *rbuffer = r600_buffer(buf);
- struct r600_screen *rscreen = r600_screen(screen);
if (rbuffer->r.bo) {
- radeon_ws_bo_reference(rscreen->rw, &rbuffer->r.bo, NULL);
+ r600_bo_reference((struct radeon*)screen->winsys, &rbuffer->r.bo, NULL);
}
FREE(rbuffer);
}
struct pipe_transfer *transfer)
{
struct r600_resource_buffer *rbuffer = r600_buffer(transfer->resource);
- struct r600_screen *rscreen = r600_screen(pipe->screen);
int write = 0;
uint8_t *data;
int i;
flush = TRUE;
if (flush) {
- radeon_ws_bo_reference(rscreen->rw, &rbuffer->r.bo, NULL);
+ r600_bo_reference((struct radeon*)pipe->winsys, &rbuffer->r.bo, NULL);
rbuffer->num_ranges = 0;
- rbuffer->r.bo = radeon_ws_bo(rscreen->rw,
+ rbuffer->r.bo = r600_bo((struct radeon*)pipe->winsys,
rbuffer->r.base.b.width0, 0,
rbuffer->r.base.b.bind);
break;
if (transfer->usage & PIPE_TRANSFER_WRITE) {
write = 1;
}
- data = radeon_ws_bo_map(rscreen->rw, rbuffer->r.bo, transfer->usage, pipe);
+ data = r600_bo_map((struct radeon*)pipe->winsys, rbuffer->r.bo, transfer->usage, pipe);
if (!data)
return NULL;
struct pipe_transfer *transfer)
{
struct r600_resource_buffer *rbuffer = r600_buffer(transfer->resource);
- struct r600_screen *rscreen = r600_screen(pipe->screen);
if (rbuffer->r.bo)
- radeon_ws_bo_unmap(rscreen->rw, rbuffer->r.bo);
+ r600_bo_unmap((struct radeon*)pipe->winsys, rbuffer->r.bo);
}
static void r600_buffer_transfer_flush_region(struct pipe_context *pipe,
{
struct radeon *rw = (struct radeon*)screen->winsys;
struct r600_resource *rbuffer;
- struct radeon_ws_bo *bo = NULL;
+ struct r600_bo *bo = NULL;
- bo = radeon_ws_bo_handle(rw, whandle->handle);
+ bo = r600_bo_handle(rw, whandle->handle, NULL);
if (bo == NULL) {
return NULL;
}
rbuffer = CALLOC_STRUCT(r600_resource);
if (rbuffer == NULL) {
- radeon_ws_bo_reference(rw, &bo, NULL);
+ r600_bo_reference(rw, &bo, NULL);
return NULL;
}
u_default_transfer_inline_write /* transfer_inline_write */
};
-int r600_upload_index_buffer(struct r600_context *rctx,
- struct r600_draw *draw)
+int r600_upload_index_buffer(struct r600_pipe_context *rctx, struct r600_drawl *draw)
{
struct pipe_resource *upload_buffer = NULL;
unsigned index_offset = draw->index_buffer_offset;
goto done;
}
draw->index_buffer_offset = index_offset;
- draw->index_buffer = upload_buffer;
+
+ /* Transfer ownership. */
+ pipe_resource_reference(&draw->index_buffer, upload_buffer);
+ pipe_resource_reference(&upload_buffer, NULL);
}
done:
return ret;
}
-int r600_upload_user_buffers(struct r600_context *rctx)
+int r600_upload_user_buffers(struct r600_pipe_context *rctx)
{
enum pipe_error ret = PIPE_OK;
int i, nr;
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * 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.
- *
- * Authors:
- * Jerome Glisse
- * Corbin Simpson
- */
-#include <stdio.h>
-#include <util/u_inlines.h>
-#include <util/u_format.h>
-#include <util/u_memory.h>
-#include <util/u_upload_mgr.h>
-#include <util/u_blitter.h>
-#include "r600_screen.h"
-#include "r600_context.h"
-#include "r600_resource.h"
-
-static void r600_destroy_context(struct pipe_context *context)
-{
- struct r600_context *rctx = r600_context(context);
-
- rctx->rasterizer = r600_context_state_decref(rctx->rasterizer);
- rctx->poly_stipple = r600_context_state_decref(rctx->poly_stipple);
- rctx->scissor = r600_context_state_decref(rctx->scissor);
- rctx->clip = r600_context_state_decref(rctx->clip);
- rctx->ps_shader = r600_context_state_decref(rctx->ps_shader);
- rctx->vs_shader = r600_context_state_decref(rctx->vs_shader);
- rctx->depth = r600_context_state_decref(rctx->depth);
- rctx->stencil = r600_context_state_decref(rctx->stencil);
- rctx->alpha = r600_context_state_decref(rctx->alpha);
- rctx->dsa = r600_context_state_decref(rctx->dsa);
- rctx->blend = r600_context_state_decref(rctx->blend);
- rctx->stencil_ref = r600_context_state_decref(rctx->stencil_ref);
- rctx->viewport = r600_context_state_decref(rctx->viewport);
- rctx->framebuffer = r600_context_state_decref(rctx->framebuffer);
-
- free(rctx->ps_constant);
- free(rctx->vs_constant);
- free(rctx->vs_resource);
-
- util_blitter_destroy(rctx->blitter);
-
- u_upload_destroy(rctx->upload_vb);
- u_upload_destroy(rctx->upload_ib);
-
- radeon_ctx_fini(rctx->ctx);
- FREE(rctx);
-}
-
-void r600_flush(struct pipe_context *ctx, unsigned flags,
- struct pipe_fence_handle **fence)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_query *rquery = NULL;
-#if 0
- static int dc = 0;
- char dname[256];
-#endif
-
- /* flush upload buffers */
- u_upload_flush(rctx->upload_vb);
- u_upload_flush(rctx->upload_ib);
-
- /* suspend queries */
- r600_queries_suspend(ctx);
-
-
-#if 0
- sprintf(dname, "gallium-%08d.bof", dc);
- if (dc < 20) {
- radeon_ctx_dump_bof(rctx->ctx, dname);
- R600_ERR("dumped %s\n", dname);
- }
- dc++;
-#endif
-
- radeon_ctx_submit(rctx->ctx);
-
- LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) {
- rquery->flushed = TRUE;
- }
-
- radeon_ctx_clear(rctx->ctx);
- /* resume queries */
- r600_queries_resume(ctx);
-}
-
-struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv)
-{
- struct r600_context *rctx = CALLOC_STRUCT(r600_context);
- struct r600_screen* rscreen = r600_screen(screen);
-
- if (rctx == NULL)
- return NULL;
- rctx->context.winsys = rscreen->screen.winsys;
- rctx->context.screen = screen;
- rctx->context.priv = priv;
- rctx->context.destroy = r600_destroy_context;
- rctx->context.draw_vbo = r600_draw_vbo;
- rctx->context.flush = r600_flush;
-
- /* Easy accessing of screen/winsys. */
- rctx->screen = rscreen;
- rctx->rw = rscreen->rw;
-
- if (radeon_get_family_class(rscreen->rw) == EVERGREEN)
- rctx->vtbl = &eg_hw_state_vtbl;
- else
- rctx->vtbl = &r600_hw_state_vtbl;
-
- r600_init_query_functions(rctx);
- r600_init_state_functions(rctx);
- r600_init_context_resource_functions(rctx);
-
- r600_init_blit_functions(rctx);
-
- rctx->blitter = util_blitter_create(&rctx->context);
- if (rctx->blitter == NULL) {
- FREE(rctx);
- return NULL;
- }
-
- rctx->vtbl->init_config(rctx);
-
- rctx->upload_ib = u_upload_create(&rctx->context, 32 * 1024, 16,
- PIPE_BIND_INDEX_BUFFER);
- if (rctx->upload_ib == NULL) {
- goto out_free;
- }
-
- rctx->upload_vb = u_upload_create(&rctx->context, 128 * 1024, 16,
- PIPE_BIND_VERTEX_BUFFER);
- if (rctx->upload_vb == NULL) {
- goto out_free;
- }
-
- rctx->vs_constant = (struct radeon_state *)calloc(R600_MAX_CONSTANT, sizeof(struct radeon_state));
- if (!rctx->vs_constant) {
- goto out_free;
- }
-
- rctx->ps_constant = (struct radeon_state *)calloc(R600_MAX_CONSTANT, sizeof(struct radeon_state));
- if (!rctx->ps_constant) {
- goto out_free;
- }
-
- rctx->vs_resource = (struct radeon_state *)calloc(R600_MAX_RESOURCE, sizeof(struct radeon_state));
- if (!rctx->vs_resource) {
- goto out_free;
- }
-
- rctx->ctx = radeon_ctx_init(rscreen->rw);
- radeon_draw_init(&rctx->draw, rscreen->rw);
- r600_blit_uncompress_depth_ptr = r600_blit_uncompress_depth;
- return &rctx->context;
- out_free:
- FREE(rctx);
- return NULL;
-}
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * 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 R600_CONTEXT_H
-#define R600_CONTEXT_H
-
-#include <stdio.h>
-#include <pipe/p_state.h>
-#include <pipe/p_context.h>
-#include <tgsi/tgsi_scan.h>
-#include <tgsi/tgsi_parse.h>
-#include <tgsi/tgsi_util.h>
-#include <util/u_blitter.h>
-#include <util/u_double_list.h>
-#include "radeon.h"
-#include "r600_shader.h"
-
-struct u_upload_mgr;
-
-#define R600_QUERY_STATE_STARTED (1 << 0)
-#define R600_QUERY_STATE_ENDED (1 << 1)
-#define R600_QUERY_STATE_SUSPENDED (1 << 2)
-
-struct r600_query {
- u64 result;
- /* The kind of query. Currently only OQ is supported. */
- unsigned type;
- /* How many results have been written, in dwords. It's incremented
- * after end_query and flush. */
- unsigned num_results;
- /* if we've flushed the query */
- boolean flushed;
- unsigned state;
- /* The buffer where query results are stored. */
- struct radeon_ws_bo *buffer;
- unsigned buffer_size;
- /* linked list of queries */
- struct list_head list;
- struct radeon_state rstate;
-};
-
-/* XXX move this to a more appropriate place */
-union pipe_states {
- struct pipe_rasterizer_state rasterizer;
- struct pipe_poly_stipple poly_stipple;
- struct pipe_scissor_state scissor;
- struct pipe_clip_state clip;
- struct pipe_shader_state shader;
- struct pipe_depth_state depth;
- struct pipe_stencil_state stencil;
- struct pipe_alpha_state alpha;
- struct pipe_depth_stencil_alpha_state dsa;
- struct pipe_blend_state blend;
- struct pipe_blend_color blend_color;
- struct pipe_stencil_ref stencil_ref;
- struct pipe_framebuffer_state framebuffer;
- struct pipe_sampler_state sampler;
- struct pipe_sampler_view sampler_view;
- struct pipe_viewport_state viewport;
-};
-
-enum pipe_state_type {
- pipe_rasterizer_type = 1,
- pipe_poly_stipple_type,
- pipe_scissor_type,
- pipe_clip_type,
- pipe_shader_type,
- pipe_depth_type,
- pipe_stencil_type,
- pipe_alpha_type,
- pipe_dsa_type,
- pipe_blend_type,
- pipe_stencil_ref_type,
- pipe_framebuffer_type,
- pipe_sampler_type,
- pipe_sampler_view_type,
- pipe_viewport_type,
- pipe_type_count
-};
-
-#define R600_MAX_RSTATE 16
-#define R600_STATE_FLAG_DSA_FLUSH 1
-
-struct r600_context_state {
- union pipe_states state;
- unsigned refcount;
- unsigned type;
- struct radeon_state rstate[R600_MAX_RSTATE];
- struct r600_shader shader;
- struct radeon_ws_bo *bo;
- unsigned nrstate;
- unsigned flags;
-};
-
-struct r600_vertex_element
-{
- unsigned refcount;
- unsigned count;
- struct pipe_vertex_element elements[32];
-};
-
-struct r600_draw {
- struct pipe_context *ctx;
- struct radeon_state draw;
- struct radeon_state vgt;
- unsigned mode;
- unsigned start;
- unsigned count;
- unsigned index_size;
- struct pipe_resource *index_buffer;
- unsigned index_buffer_offset;
- unsigned min_index, max_index;
- unsigned index_bias;
-};
-
-struct r600_context_hw_states {
- struct radeon_state rasterizer;
- struct radeon_state scissor;
- struct radeon_state dsa;
- struct radeon_state cb_cntl;
-
- struct radeon_state db_flush;
- struct radeon_state cb_flush;
-};
-
-#define R600_MAX_CONSTANT 256 /* magic */
-#define R600_MAX_RESOURCE 160 /* magic */
-
-struct r600_shader_sampler_states {
- unsigned nsampler;
- unsigned nview;
- unsigned nborder;
- struct radeon_state *sampler[PIPE_MAX_ATTRIBS];
- struct radeon_state *view[PIPE_MAX_ATTRIBS];
- struct radeon_state *border[PIPE_MAX_ATTRIBS];
-};
-
-struct r600_context;
-struct r600_screen;
-struct r600_resource;
-struct r600_resource_texture;
-
-struct r600_context_hw_state_vtbl {
- void (*blend)(struct r600_context *rctx,
- struct radeon_state *rstate,
- const struct pipe_blend_state *state);
- void (*ucp)(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_clip_state *state);
- void (*cb)(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_framebuffer_state *state, int cb);
- void (*db)(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_framebuffer_state *state);
- void (*rasterizer)(struct r600_context *rctx, struct radeon_state *rstate);
- void (*scissor)(struct r600_context *rctx, struct radeon_state *rstate);
- void (*viewport)(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_viewport_state *state);
- void (*dsa)(struct r600_context *rctx, struct radeon_state *rstate);
- void (*sampler_border)(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_sampler_state *state, unsigned id);
- void (*sampler)(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_sampler_state *state, unsigned id);
- void (*resource)(struct pipe_context *ctx, struct radeon_state *rstate,
- const struct pipe_sampler_view *view, unsigned id);
- void (*cb_cntl)(struct r600_context *rctx, struct radeon_state *rstate);
- int (*vs_resource)(struct r600_context *rctx, int id, struct r600_resource *rbuffer, uint32_t offset,
- uint32_t stride, uint32_t format);
- int (*vgt_init)(struct r600_draw *draw,
- int vgt_draw_initiator);
- int (*vgt_prim)(struct r600_draw *draw,
- uint32_t prim, uint32_t vgt_dma_index_type);
-
- int (*ps_shader)(struct r600_context *rctx, struct r600_context_state *rshader,
- struct radeon_state *state);
- int (*vs_shader)(struct r600_context *rctx, struct r600_context_state *rpshader,
- struct radeon_state *state);
- void (*init_config)(struct r600_context *rctx);
-};
-extern struct r600_context_hw_state_vtbl r600_hw_state_vtbl;
-extern struct r600_context_hw_state_vtbl eg_hw_state_vtbl;
-
-struct r600_context {
- struct pipe_context context;
- struct blitter_context *blitter;
- struct pipe_framebuffer_state *pframebuffer;
- unsigned family;
- void *custom_dsa_flush;
- struct list_head query_list;
- struct r600_screen *screen;
- struct radeon *rw;
- struct radeon_ctx *ctx;
- struct radeon_draw draw;
- struct r600_context_hw_state_vtbl *vtbl;
- struct radeon_state config;
- boolean use_mem_constant;
- /* FIXME get rid of those vs_resource,vs/ps_constant */
- struct radeon_state *vs_resource;
- unsigned vs_nresource;
- struct radeon_state *vs_constant;
- struct radeon_state *ps_constant;
- /* hw states */
- struct r600_context_hw_states hw_states;
- /* pipe states */
- unsigned flat_shade;
-
- unsigned nvertex_buffer;
- struct r600_context_state *rasterizer;
- struct r600_context_state *poly_stipple;
- struct r600_context_state *scissor;
- struct r600_context_state *clip;
- struct r600_context_state *ps_shader;
- struct r600_context_state *vs_shader;
- struct r600_context_state *depth;
- struct r600_context_state *stencil;
- struct r600_context_state *alpha;
- struct r600_context_state *dsa;
- struct r600_context_state *blend;
- struct r600_context_state *stencil_ref;
- struct r600_context_state *viewport;
- struct r600_context_state *framebuffer;
- struct r600_shader_sampler_states vs_sampler;
- struct r600_shader_sampler_states ps_sampler;
- /* can add gs later */
- struct r600_vertex_element *vertex_elements;
- struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
- struct pipe_index_buffer index_buffer;
- struct pipe_blend_color blend_color;
-
- /* upload managers */
- struct u_upload_mgr *upload_vb;
- struct u_upload_mgr *upload_ib;
- bool any_user_vbs;
-};
-
-/* Convenience cast wrapper. */
-static INLINE struct r600_context *r600_context(struct pipe_context *pipe)
-{
- return (struct r600_context*)pipe;
-}
-
-static INLINE struct r600_query* r600_query(struct pipe_query* q)
-{
- return (struct r600_query*)q;
-}
-
-struct r600_context_state *r600_context_state_incref(struct r600_context_state *rstate);
-struct r600_context_state *r600_context_state_decref(struct r600_context_state *rstate);
-void r600_flush(struct pipe_context *ctx, unsigned flags,
- struct pipe_fence_handle **fence);
-
-int r600_context_hw_states(struct pipe_context *ctx);
-
-void r600_draw_vbo(struct pipe_context *ctx,
- const struct pipe_draw_info *info);
-
-void r600_init_blit_functions(struct r600_context *rctx);
-void r600_init_state_functions(struct r600_context *rctx);
-void r600_init_query_functions(struct r600_context* rctx);
-struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv);
-
-extern int r600_pipe_shader_create(struct pipe_context *ctx,
- struct r600_context_state *rstate,
- const struct tgsi_token *tokens);
-extern int r600_pipe_shader_update(struct pipe_context *ctx,
- struct r600_context_state *rstate);
-extern int r600_find_vs_semantic_index(struct r600_context *rctx, struct r600_shader *rshader, int id);
-
-#define R600_ERR(fmt, args...) \
- fprintf(stderr, "EE %s/%s:%d - "fmt, __FILE__, __func__, __LINE__, ##args)
-
-uint32_t r600_translate_texformat(enum pipe_format format,
- const unsigned char *swizzle_view,
- uint32_t *word4_p, uint32_t *yuv_format_p);
-
-/* query */
-extern void r600_queries_resume(struct pipe_context *ctx);
-extern void r600_queries_suspend(struct pipe_context *ctx);
-
-int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf);
-
-void r600_set_constant_buffer_file(struct pipe_context *ctx,
- uint shader, uint index,
- struct pipe_resource *buffer);
-void r600_set_constant_buffer_mem(struct pipe_context *ctx,
- uint shader, uint index,
- struct pipe_resource *buffer);
-void eg_set_constant_buffer(struct pipe_context *ctx,
- uint shader, uint index,
- struct pipe_resource *buffer);
-
-int r600_upload_index_buffer(struct r600_context *rctx,
- struct r600_draw *draw);
-int r600_upload_user_buffers(struct r600_context *rctx);
-
-#endif
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * 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.
- *
- * Authors:
- * Jerome Glisse
- * Corbin Simpson
- */
-#include <stdio.h>
-#include <errno.h>
-#include <pipe/p_screen.h>
-#include <util/u_format.h>
-#include <util/u_math.h>
-#include <util/u_inlines.h>
-#include <util/u_memory.h>
-#include <util/u_index_modify.h>
-#include "radeon.h"
-#include "r600_screen.h"
-#include "r600_context.h"
-#include "r600_resource.h"
-#include "r600_state_inlines.h"
-
-static void r600_translate_index_buffer(struct r600_context *r600,
- struct pipe_resource **index_buffer,
- unsigned *index_size,
- unsigned *start, unsigned count)
-{
- switch (*index_size) {
- case 1:
- util_shorten_ubyte_elts(&r600->context, index_buffer, 0, *start, count);
- *index_size = 2;
- *start = 0;
- break;
-
- case 2:
- if (*start % 2 != 0) {
- util_rebuild_ushort_elts(&r600->context, index_buffer, 0, *start, count);
- *start = 0;
- }
- break;
-
- case 4:
- break;
- }
-}
-
-static int r600_draw_common(struct r600_draw *draw)
-{
- struct r600_context *rctx = r600_context(draw->ctx);
- /* FIXME vs_resource */
- struct radeon_state *vs_resource;
- struct r600_resource *rbuffer;
- unsigned i, j, offset, prim;
- u32 vgt_dma_index_type, vgt_draw_initiator;
- struct pipe_vertex_buffer *vertex_buffer;
- int r;
-
- r = r600_context_hw_states(draw->ctx);
- if (r)
- return r;
- switch (draw->index_size) {
- case 2:
- vgt_draw_initiator = S_0287F0_SOURCE_SELECT(V_0287F0_DI_SRC_SEL_DMA);
- vgt_dma_index_type = 0;
- break;
- case 4:
- vgt_draw_initiator = S_0287F0_SOURCE_SELECT(V_0287F0_DI_SRC_SEL_DMA);
- vgt_dma_index_type = 1;
- break;
- case 0:
- vgt_draw_initiator = S_0287F0_SOURCE_SELECT(V_0287F0_DI_SRC_SEL_AUTO_INDEX);
- vgt_dma_index_type = 0;
- break;
- default:
- fprintf(stderr, "%s %d unsupported index size %d\n", __func__, __LINE__, draw->index_size);
- return -EINVAL;
- }
- r = r600_conv_pipe_prim(draw->mode, &prim);
- if (r)
- return r;
-
- /* rebuild vertex shader if input format changed */
- r = r600_pipe_shader_update(draw->ctx, rctx->vs_shader);
- if (r)
- return r;
- r = r600_pipe_shader_update(draw->ctx, rctx->ps_shader);
- if (r)
- return r;
- radeon_draw_bind(&rctx->draw, &rctx->vs_shader->rstate[0]);
- radeon_draw_bind(&rctx->draw, &rctx->ps_shader->rstate[0]);
-
- for (i = 0 ; i < rctx->vs_nresource; i++) {
- radeon_state_fini(&rctx->vs_resource[i]);
- }
- for (i = 0 ; i < rctx->vertex_elements->count; i++) {
- vs_resource = &rctx->vs_resource[i];
- j = rctx->vertex_elements->elements[i].vertex_buffer_index;
- vertex_buffer = &rctx->vertex_buffer[j];
- rbuffer = (struct r600_resource*)vertex_buffer->buffer;
- offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset;
-
- rctx->vtbl->vs_resource(rctx, i, rbuffer, offset, vertex_buffer->stride, rctx->vertex_elements->elements[i].src_format);
- radeon_draw_bind(&rctx->draw, vs_resource);
- }
- rctx->vs_nresource = rctx->vertex_elements->count;
- /* FIXME start need to change winsys */
- rctx->vtbl->vgt_init(draw, vgt_draw_initiator);
- radeon_draw_bind(&rctx->draw, &draw->draw);
-
- rctx->vtbl->vgt_prim(draw, prim, vgt_dma_index_type);
- radeon_draw_bind(&rctx->draw, &draw->vgt);
-
- r = radeon_ctx_set_draw(rctx->ctx, &rctx->draw);
- if (r == -EBUSY) {
- r600_flush(draw->ctx, 0, NULL);
- r = radeon_ctx_set_draw(rctx->ctx, &rctx->draw);
- }
-
- radeon_state_fini(&draw->draw);
-
- return r;
-}
-
-void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_draw draw;
- int r;
-
- memset(&draw, 0, sizeof(draw));
-
- if (rctx->any_user_vbs) {
- r600_upload_user_buffers(rctx);
- rctx->any_user_vbs = FALSE;
- }
-
- draw.ctx = ctx;
- draw.mode = info->mode;
- draw.start = info->start;
- draw.count = info->count;
- if (info->indexed && rctx->index_buffer.buffer) {
- draw.start += rctx->index_buffer.offset / rctx->index_buffer.index_size;
- draw.min_index = info->min_index;
- draw.max_index = info->max_index;
- draw.index_bias = info->index_bias;
-
- r600_translate_index_buffer(rctx, &rctx->index_buffer.buffer,
- &rctx->index_buffer.index_size,
- &draw.start,
- info->count);
-
- draw.index_size = rctx->index_buffer.index_size;
- draw.index_buffer = rctx->index_buffer.buffer;
- draw.index_buffer_offset = draw.start * draw.index_size;
- draw.start = 0;
- r600_upload_index_buffer(rctx, &draw);
- }
- else {
- draw.index_size = 0;
- draw.index_buffer = NULL;
- draw.min_index = 0;
- draw.max_index = 0xffffff;
- draw.index_buffer_offset = 0;
- draw.index_bias = draw.start;
- }
-
- r = r600_draw_common(&draw);
- if (r)
- fprintf(stderr,"draw common failed %d\n", r);
-}
--- /dev/null
+#ifndef R600_FORMATS_H
+#define R600_FORMATS_H
+
+/* list of formats from R700 ISA document - apply across GPUs in different registers */
+#define FMT_INVALID 0x00000000
+#define FMT_8 0x00000001
+#define FMT_4_4 0x00000002
+#define FMT_3_3_2 0x00000003
+#define FMT_16 0x00000005
+#define FMT_16_FLOAT 0x00000006
+#define FMT_8_8 0x00000007
+#define FMT_5_6_5 0x00000008
+#define FMT_6_5_5 0x00000009
+#define FMT_1_5_5_5 0x0000000A
+#define FMT_4_4_4_4 0x0000000B
+#define FMT_5_5_5_1 0x0000000C
+#define FMT_32 0x0000000D
+#define FMT_32_FLOAT 0x0000000E
+#define FMT_16_16 0x0000000F
+#define FMT_16_16_FLOAT 0x00000010
+#define FMT_8_24 0x00000011
+#define FMT_8_24_FLOAT 0x00000012
+#define FMT_24_8 0x00000013
+#define FMT_24_8_FLOAT 0x00000014
+#define FMT_10_11_11 0x00000015
+#define FMT_10_11_11_FLOAT 0x00000016
+#define FMT_11_11_10 0x00000017
+#define FMT_11_11_10_FLOAT 0x00000018
+#define FMT_2_10_10_10 0x00000019
+#define FMT_8_8_8_8 0x0000001A
+#define FMT_10_10_10_2 0x0000001B
+#define FMT_X24_8_32_FLOAT 0x0000001C
+#define FMT_32_32 0x0000001D
+#define FMT_32_32_FLOAT 0x0000001E
+#define FMT_16_16_16_16 0x0000001F
+#define FMT_16_16_16_16_FLOAT 0x00000020
+#define FMT_32_32_32_32 0x00000022
+#define FMT_32_32_32_32_FLOAT 0x00000023
+#define FMT_1 0x00000025
+#define FMT_GB_GR 0x00000027
+#define FMT_BG_RG 0x00000028
+#define FMT_32_AS_8 0x00000029
+#define FMT_32_AS_8_8 0x0000002a
+#define FMT_5_9_9_9_SHAREDEXP 0x0000002b
+#define FMT_8_8_8 0x0000002c
+#define FMT_16_16_16 0x0000002d
+#define FMT_16_16_16_FLOAT 0x0000002e
+#define FMT_32_32_32 0x0000002f
+#define FMT_32_32_32_FLOAT 0x00000030
+#define FMT_BC1 0x00000031
+#define FMT_BC2 0x00000032
+#define FMT_BC3 0x00000033
+#define FMT_BC4 0x00000034
+#define FMT_BC5 0x00000035
+
+#endif
#include <stdio.h>
#include <errno.h>
#include <util/u_inlines.h>
-#include "r600_screen.h"
-#include "r600_context.h"
+#include "r600_pipe.h"
#include "r600d.h"
int r600_conv_pipe_prim(unsigned pprim, unsigned *prim)
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- * 2010 Red Hat Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * 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.
- *
- * Authors:
- * Jerome Glisse
- * Dave Airlie
- */
-
-#include <util/u_inlines.h>
-#include <util/u_format.h>
-#include <util/u_memory.h>
-#include <util/u_blitter.h>
-#include "util/u_pack_color.h"
-#include "r600_screen.h"
-#include "r600_context.h"
-#include "r600_resource.h"
-#include "r600_state_inlines.h"
-#include "r600d.h"
-
-static void r600_blend(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_blend_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
- int i;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_BLEND, 0, 0);
- rstate->states[R600_BLEND__CB_BLEND_RED] = fui(rctx->blend_color.color[0]);
- rstate->states[R600_BLEND__CB_BLEND_GREEN] = fui(rctx->blend_color.color[1]);
- rstate->states[R600_BLEND__CB_BLEND_BLUE] = fui(rctx->blend_color.color[2]);
- rstate->states[R600_BLEND__CB_BLEND_ALPHA] = fui(rctx->blend_color.color[3]);
- rstate->states[R600_BLEND__CB_BLEND0_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND1_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND2_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND3_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND4_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND5_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND6_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND7_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND_CONTROL] = 0x00000000;
-
- for (i = 0; i < 8; i++) {
- unsigned eqRGB = state->rt[i].rgb_func;
- unsigned srcRGB = state->rt[i].rgb_src_factor;
- unsigned dstRGB = state->rt[i].rgb_dst_factor;
-
- unsigned eqA = state->rt[i].alpha_func;
- unsigned srcA = state->rt[i].alpha_src_factor;
- unsigned dstA = state->rt[i].alpha_dst_factor;
- uint32_t bc = 0;
-
- if (!state->rt[i].blend_enable)
- continue;
-
- bc |= S_028804_COLOR_COMB_FCN(r600_translate_blend_function(eqRGB));
- bc |= S_028804_COLOR_SRCBLEND(r600_translate_blend_factor(srcRGB));
- bc |= S_028804_COLOR_DESTBLEND(r600_translate_blend_factor(dstRGB));
-
- if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) {
- bc |= S_028804_SEPARATE_ALPHA_BLEND(1);
- bc |= S_028804_ALPHA_COMB_FCN(r600_translate_blend_function(eqA));
- bc |= S_028804_ALPHA_SRCBLEND(r600_translate_blend_factor(srcA));
- bc |= S_028804_ALPHA_DESTBLEND(r600_translate_blend_factor(dstA));
- }
-
- rstate->states[R600_BLEND__CB_BLEND0_CONTROL + i] = bc;
- if (i == 0)
- rstate->states[R600_BLEND__CB_BLEND_CONTROL] = bc;
- }
-
- radeon_state_pm4(rstate);
-}
-
-static void r600_ucp(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_clip_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_UCP, 0, 0);
-
- for (int i = 0; i < state->nr; i++) {
- rstate->states[i * 4 + 0] = fui(state->ucp[i][0]);
- rstate->states[i * 4 + 1] = fui(state->ucp[i][1]);
- rstate->states[i * 4 + 2] = fui(state->ucp[i][2]);
- rstate->states[i * 4 + 3] = fui(state->ucp[i][3]);
- }
- radeon_state_pm4(rstate);
-}
-
-static void r600_cb(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_framebuffer_state *state, int cb)
-{
- struct r600_screen *rscreen = rctx->screen;
- struct r600_resource_texture *rtex;
- struct r600_resource *rbuffer;
- unsigned level = state->cbufs[cb]->level;
- unsigned pitch, slice;
- unsigned color_info;
- unsigned format, swap, ntype;
- const struct util_format_description *desc;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_CB0 + cb, 0, 0);
- rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
- rbuffer = &rtex->resource;
- radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo);
- rstate->placement[0] = RADEON_GEM_DOMAIN_GTT;
- rstate->nbo = 1;
- pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
- slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1;
-
- ntype = 0;
- desc = util_format_description(rtex->resource.base.b.format);
- if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
- ntype = V_0280A0_NUMBER_SRGB;
-
- format = r600_translate_colorformat(rtex->resource.base.b.format);
- swap = r600_translate_colorswap(rtex->resource.base.b.format);
-
-
- color_info = S_0280A0_FORMAT(format) |
- S_0280A0_COMP_SWAP(swap) |
- S_0280A0_BLEND_CLAMP(1) |
- S_0280A0_NUMBER_TYPE(ntype);
-
- if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS)
- color_info |= S_0280A0_SOURCE_FORMAT(1);
- rstate->states[R600_CB0__CB_COLOR0_BASE] = state->cbufs[cb]->offset >> 8;
- rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info;
- rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) |
- S_028060_SLICE_TILE_MAX(slice);
- rstate->states[R600_CB0__CB_COLOR0_VIEW] = 0x00000000;
- rstate->states[R600_CB0__CB_COLOR0_FRAG] = 0x00000000;
- rstate->states[R600_CB0__CB_COLOR0_TILE] = 0x00000000;
- rstate->states[R600_CB0__CB_COLOR0_MASK] = 0x00000000;
- radeon_state_pm4(rstate);
-}
-
-static void r600_db(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_framebuffer_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
- struct r600_resource_texture *rtex;
- struct r600_resource *rbuffer;
- unsigned level;
- unsigned pitch, slice, format;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_DB, 0, 0);
- if (state->zsbuf == NULL)
- return;
-
- rtex = (struct r600_resource_texture*)state->zsbuf->texture;
- rtex->tiled = 1;
- rtex->array_mode = 2;
- rtex->tile_type = 1;
- rtex->depth = 1;
- rbuffer = &rtex->resource;
-
- radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo);
- rstate->nbo = 1;
- rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM;
- level = state->zsbuf->level;
- pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
- slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1;
- format = r600_translate_dbformat(state->zsbuf->texture->format);
- rstate->states[R600_DB__DB_DEPTH_BASE] = state->zsbuf->offset >> 8;
- rstate->states[R600_DB__DB_DEPTH_INFO] = S_028010_ARRAY_MODE(rtex->array_mode) |
- S_028010_FORMAT(format);
- rstate->states[R600_DB__DB_DEPTH_VIEW] = 0x00000000;
- rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (state->zsbuf->height / 8) -1;
- rstate->states[R600_DB__DB_DEPTH_SIZE] = S_028000_PITCH_TILE_MAX(pitch) |
- S_028000_SLICE_TILE_MAX(slice);
- radeon_state_pm4(rstate);
-}
-
-static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rstate)
-{
- const struct pipe_rasterizer_state *state = &rctx->rasterizer->state.rasterizer;
- const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
- const struct pipe_clip_state *clip = NULL;
- struct r600_screen *rscreen = rctx->screen;
- float offset_units = 0, offset_scale = 0;
- char depth = 0;
- unsigned offset_db_fmt_cntl = 0;
- unsigned point_size;
- unsigned prov_vtx = 1;
- unsigned polygon_dual_mode;
-
- if (rctx->clip)
- clip = &rctx->clip->state.clip;
- if (fb->zsbuf) {
- offset_units = state->offset_units;
- offset_scale = state->offset_scale * 12.0f;
- switch (fb->zsbuf->texture->format) {
- case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
- depth = -24;
- offset_units *= 2.0f;
- break;
- case PIPE_FORMAT_Z32_FLOAT:
- depth = -23;
- offset_units *= 1.0f;
- offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1);
- break;
- case PIPE_FORMAT_Z16_UNORM:
- depth = -16;
- offset_units *= 4.0f;
- break;
- default:
- R600_ERR("unsupported %d\n", fb->zsbuf->texture->format);
- return;
- }
- }
- offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth);
-
- if (state->flatshade_first)
- prov_vtx = 0;
-
- rctx->flat_shade = state->flatshade;
- radeon_state_init(rstate, rscreen->rw, R600_STATE_RASTERIZER, 0, 0);
- rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] =
- S_0286D4_FLAT_SHADE_ENA(1);
- if (state->sprite_coord_enable) {
- rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] |=
- S_0286D4_PNT_SPRITE_ENA(1) |
- S_0286D4_PNT_SPRITE_OVRD_X(2) |
- S_0286D4_PNT_SPRITE_OVRD_Y(3) |
- S_0286D4_PNT_SPRITE_OVRD_Z(0) |
- S_0286D4_PNT_SPRITE_OVRD_W(1);
- if (state->sprite_coord_mode != PIPE_SPRITE_COORD_UPPER_LEFT) {
- rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] |=
- S_0286D4_PNT_SPRITE_TOP_1(1);
- }
- }
- rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = 0;
- if (clip) {
- /* Clip plane enable bits are stashed in the lower six bits of
- * PA_CL_CLIP_CNTL, so just set all of the corresponding bits with a
- * pinch of bit twiddling.
- *
- * PS_UCP_MODE 3 is "expand and clip as trifan," which is the same
- * setting that we use on r300-r500. I believe that fglrx always uses
- * this mode as well. */
- rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] =
- ((1 << clip->nr) - 1) |
- S_028810_PS_UCP_MODE(3) |
- S_028810_ZCLIP_NEAR_DISABLE(clip->depth_clamp) |
- S_028810_ZCLIP_FAR_DISABLE(clip->depth_clamp);
- }
- polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL ||
- state->fill_back != PIPE_POLYGON_MODE_FILL);
-
- rstate->states[R600_RASTERIZER__PA_SU_SC_MODE_CNTL] =
- S_028814_PROVOKING_VTX_LAST(prov_vtx) |
- S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) |
- S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) |
- S_028814_FACE(!state->front_ccw) |
- S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) |
- S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) |
- S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri) |
- S_028814_POLY_MODE(polygon_dual_mode) |
- S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) |
- S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back));
- rstate->states[R600_RASTERIZER__PA_CL_VS_OUT_CNTL] =
- S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) |
- S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex);
- rstate->states[R600_RASTERIZER__PA_CL_NANINF_CNTL] = 0x00000000;
- /* Point size for PA_SU_POINT_SIZE and PA_SU_POINT_MINMAX is fixed-point,
- * 12.4.
- *
- * For some reason, maximum point size is set to 0x8000 (2048.0) instead
- * of the maximum value 0xFFF0 (4095.0). */
- point_size = (unsigned)(state->point_size * 8.0);
- rstate->states[R600_RASTERIZER__PA_SU_POINT_SIZE] =
- S_028A00_HEIGHT(point_size) | S_028A00_WIDTH(point_size);
- rstate->states[R600_RASTERIZER__PA_SU_POINT_MINMAX] =
- S_028A04_MIN_SIZE(0) | S_028A04_MAX_SIZE(0x8000);
- rstate->states[R600_RASTERIZER__PA_SU_LINE_CNTL] = S_028A08_WIDTH(8);
- rstate->states[R600_RASTERIZER__PA_SC_LINE_STIPPLE] = 0x00000005;
- rstate->states[R600_RASTERIZER__PA_SC_MPASS_PS_CNTL] = 0x00000000;
- rstate->states[R600_RASTERIZER__PA_SC_LINE_CNTL] = S_028C00_LAST_PIXEL(1);
- rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ] = fui(1);
- rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ] = fui(1);
- rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ] = fui(1);
- rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ] = fui(1);
- rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL] = offset_db_fmt_cntl;
- rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP] = 0x00000000;
- rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE] = fui(offset_scale);
- rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET] = fui(offset_units);
- rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE] = fui(offset_scale);
- rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET] = fui(offset_units);
- radeon_state_pm4(rstate);
-}
-
-static void r600_scissor(struct r600_context *rctx, struct radeon_state *rstate)
-{
- const struct pipe_scissor_state *state = &rctx->scissor->state.scissor;
- const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
- struct r600_screen *rscreen = rctx->screen;
- enum radeon_family family;
- unsigned minx, maxx, miny, maxy;
- u32 tl, br;
-
- family = radeon_get_family(rctx->rw);
-
- if (state == NULL) {
- minx = 0;
- miny = 0;
- maxx = fb->cbufs[0]->width;
- maxy = fb->cbufs[0]->height;
- } else {
- minx = state->minx;
- miny = state->miny;
- maxx = state->maxx;
- maxy = state->maxy;
- }
- tl = S_028240_TL_X(minx) | S_028240_TL_Y(miny) | S_028240_WINDOW_OFFSET_DISABLE(1);
- br = S_028244_BR_X(maxx) | S_028244_BR_Y(maxy);
- radeon_state_init(rstate, rscreen->rw, R600_STATE_SCISSOR, 0, 0);
- rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_BR] = br;
- rstate->states[R600_SCISSOR__PA_SC_WINDOW_OFFSET] = 0x00000000;
- rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR] = br;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_RULE] =
- S_02820C_CLIP_RULE(0xFFFF);
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_BR] = br;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_1_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_1_BR] = br;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_2_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_2_BR] = br;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_3_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_3_BR] = br;
-
- if (family >= CHIP_RV770)
- rstate->states[R600_SCISSOR__PA_SC_EDGERULE] = 0xAAAAAAAA;
-
- rstate->states[R600_SCISSOR__PA_SC_GENERIC_SCISSOR_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_GENERIC_SCISSOR_BR] = br;
- rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR] = br;
- radeon_state_pm4(rstate);
-}
-
-static void r600_viewport(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_viewport_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_VIEWPORT, 0, 0);
- rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMIN_0] = fui(0);
- rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = fui(1);
- rstate->states[R600_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui(state->scale[0]);
- rstate->states[R600_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui(state->scale[1]);
- rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = fui(state->scale[2]);
- rstate->states[R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = fui(state->translate[0]);
- rstate->states[R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui(state->translate[1]);
- rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = fui(state->translate[2]);
- rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] =
- S_028818_VPORT_X_SCALE_ENA(1) |
- S_028818_VPORT_X_OFFSET_ENA(1) |
- S_028818_VPORT_Y_SCALE_ENA(1) |
- S_028818_VPORT_Y_OFFSET_ENA(1) |
- S_028818_VPORT_Z_SCALE_ENA(1) |
- S_028818_VPORT_Z_OFFSET_ENA(1) |
- S_028818_VTX_W0_FMT(1);
- radeon_state_pm4(rstate);
-}
-
-static void r600_dsa(struct r600_context *rctx, struct radeon_state *rstate)
-{
- const struct pipe_depth_stencil_alpha_state *state = &rctx->dsa->state.dsa;
- const struct pipe_stencil_ref *stencil_ref = &rctx->stencil_ref->state.stencil_ref;
- struct r600_screen *rscreen = rctx->screen;
- unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control;
- unsigned stencil_ref_mask, stencil_ref_mask_bf, db_render_override, db_render_control;
- struct r600_shader *rshader;
- struct r600_query *rquery = NULL;
- boolean query_running;
- int i;
- bool flush_db = FALSE;
-
- if (rctx->ps_shader == NULL) {
- return;
- }
- if (rctx->dsa->flags & R600_STATE_FLAG_DSA_FLUSH)
- flush_db = TRUE;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_DSA, 0, 0);
-
- db_shader_control = S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z);
-
- if (!flush_db)
- db_shader_control = S_02880C_DUAL_EXPORT_ENABLE(1);
-
- rshader = &rctx->ps_shader->shader;
- if (rshader->uses_kill)
- db_shader_control |= S_02880C_KILL_ENABLE(1);
- for (i = 0; i < rshader->noutput; i++) {
- if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
- db_shader_control |= S_02880C_Z_EXPORT_ENABLE(1);
- }
- stencil_ref_mask = 0;
- stencil_ref_mask_bf = 0;
- db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) |
- S_028800_Z_WRITE_ENABLE(state->depth.writemask) |
- S_028800_ZFUNC(state->depth.func);
-
- /* set stencil enable */
- if (state->stencil[0].enabled) {
- db_depth_control |= S_028800_STENCIL_ENABLE(1) |
- S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func)) |
- S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op)) |
- S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op)) |
- S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op));
-
- stencil_ref_mask = S_028430_STENCILMASK(state->stencil[0].valuemask) |
- S_028430_STENCILWRITEMASK(state->stencil[0].writemask) |
- S_028430_STENCILREF(stencil_ref->ref_value[0]);
-
- if (state->stencil[1].enabled) {
- db_depth_control |= S_028800_BACKFACE_ENABLE(1) |
- S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func)) |
- S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op)) |
- S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op)) |
- S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op));
- stencil_ref_mask_bf =
- S_028434_STENCILMASK_BF(state->stencil[1].valuemask) |
- S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask) |
- S_028430_STENCILREF(stencil_ref->ref_value[1]);
- }
- }
-
- alpha_test_control = 0;
- alpha_ref = 0;
- if (state->alpha.enabled) {
- alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func) |
- S_028410_ALPHA_TEST_ENABLE(1);
- alpha_ref = fui(state->alpha.ref_value);
- }
-
- db_render_control = 0;
-
- if (flush_db)
- db_render_control = S_028D0C_DEPTH_COPY_ENABLE(1) |
- S_028D0C_STENCIL_COPY_ENABLE(1) |
- S_028D0C_COPY_CENTROID(1);
-
- db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) |
- S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) |
- S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE);
-
- query_running = FALSE;
-
- LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) {
- if (rquery->state & R600_QUERY_STATE_STARTED) {
- query_running = TRUE;
- }
- }
-
- if (query_running) {
- db_render_override |= S_028D10_NOOP_CULL_DISABLE(1);
- if (radeon_get_family_class(rscreen->rw) == R700)
- db_render_control |= S_028D0C_R700_PERFECT_ZPASS_COUNTS(1);
- }
-
- rstate->states[R600_DSA__DB_STENCIL_CLEAR] = 0x00000000;
- rstate->states[R600_DSA__DB_DEPTH_CLEAR] = fui(1);
- rstate->states[R600_DSA__SX_ALPHA_TEST_CONTROL] = alpha_test_control;
- rstate->states[R600_DSA__DB_STENCILREFMASK] = stencil_ref_mask;
- rstate->states[R600_DSA__DB_STENCILREFMASK_BF] = stencil_ref_mask_bf;
- rstate->states[R600_DSA__SX_ALPHA_REF] = alpha_ref;
- rstate->states[R600_DSA__SPI_FOG_FUNC_SCALE] = 0x00000000;
- rstate->states[R600_DSA__SPI_FOG_FUNC_BIAS] = 0x00000000;
- rstate->states[R600_DSA__SPI_FOG_CNTL] = 0x00000000;
- rstate->states[R600_DSA__DB_DEPTH_CONTROL] = db_depth_control;
- rstate->states[R600_DSA__DB_SHADER_CONTROL] = db_shader_control;
- rstate->states[R600_DSA__DB_RENDER_CONTROL] = db_render_control;
- rstate->states[R600_DSA__DB_RENDER_OVERRIDE] = db_render_override;
-
- rstate->states[R600_DSA__DB_SRESULTS_COMPARE_STATE1] = 0x00000000;
- rstate->states[R600_DSA__DB_PRELOAD_CONTROL] = 0x00000000;
- rstate->states[R600_DSA__DB_ALPHA_TO_MASK] = 0x0000AA00;
- radeon_state_pm4(rstate);
-}
-
-
-static INLINE u32 S_FIXED(float value, u32 frac_bits)
-{
- return value * (1 << frac_bits);
-}
-
-static void r600_sampler_border(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_sampler_state *state, unsigned id)
-{
- struct r600_screen *rscreen = rctx->screen;
- union util_color uc;
-
- util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER_BORDER, id, R600_SHADER_PS);
- if (uc.ui) {
- rstate->states[R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED] = fui(state->border_color[0]);
- rstate->states[R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN] = fui(state->border_color[1]);
- rstate->states[R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE] = fui(state->border_color[2]);
- rstate->states[R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA] = fui(state->border_color[3]);
- }
- radeon_state_pm4(rstate);
-}
-
-static void r600_sampler(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_sampler_state *state, unsigned id)
-{
- struct r600_screen *rscreen = rctx->screen;
- union util_color uc;
-
- util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER, id, R600_SHADER_PS);
- rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0] =
- S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) |
- S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) |
- S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) |
- S_03C000_XY_MAG_FILTER(r600_tex_filter(state->mag_img_filter)) |
- S_03C000_XY_MIN_FILTER(r600_tex_filter(state->min_img_filter)) |
- S_03C000_MIP_FILTER(r600_tex_mipfilter(state->min_mip_filter)) |
- S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) |
- S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0);
- /* FIXME LOD it depends on texture base level ... */
- rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD1_0] =
- S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) |
- S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)) |
- S_03C004_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6));
- rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD2_0] = S_03C008_TYPE(1);
- radeon_state_pm4(rstate);
-
-}
-
-
-static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate,
- const struct pipe_sampler_view *view, unsigned id)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_screen *rscreen = rctx->screen;
- const struct util_format_description *desc;
- struct r600_resource_texture *texture;
- struct r600_resource *rbuffer;
- unsigned format;
- uint32_t word4 = 0, yuv_format = 0, pitch = 0;
- unsigned char swizzle[4], array_mode = 0, tile_type = 0;
-
- rstate->cpm4 = 0;
- swizzle[0] = view->swizzle_r;
- swizzle[1] = view->swizzle_g;
- swizzle[2] = view->swizzle_b;
- swizzle[3] = view->swizzle_a;
- format = r600_translate_texformat(view->texture->format,
- swizzle,
- &word4, &yuv_format);
- if (format == ~0) {
- return;
- }
- desc = util_format_description(view->texture->format);
- if (desc == NULL) {
- R600_ERR("unknow format %d\n", view->texture->format);
- return;
- }
- radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_PS);
- texture = (struct r600_resource_texture*)view->texture;
- rbuffer = &texture->resource;
-
- if (texture->depth) {
- r600_texture_depth_flush(ctx, view->texture);
- rbuffer = &texture->flushed_depth_texture->resource;
- }
-
- radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo);
- radeon_ws_bo_reference(rscreen->rw, &rstate->bo[1], rbuffer->bo);
-
- rstate->nbo = 2;
- rstate->placement[0] = RADEON_GEM_DOMAIN_GTT;
- rstate->placement[1] = RADEON_GEM_DOMAIN_GTT;
- rstate->placement[2] = RADEON_GEM_DOMAIN_GTT;
- rstate->placement[3] = RADEON_GEM_DOMAIN_GTT;
-
- pitch = align(texture->pitch[0] / texture->bpt, 8);
-
- /* FIXME properly handle first level != 0 */
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD0] =
- S_038000_DIM(r600_tex_dim(view->texture->target)) |
- S_038000_TILE_MODE(array_mode) |
- S_038000_TILE_TYPE(tile_type) |
- S_038000_PITCH((pitch / 8) - 1) |
- S_038000_TEX_WIDTH(view->texture->width0 - 1);
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD1] =
- S_038004_TEX_HEIGHT(view->texture->height0 - 1) |
- S_038004_TEX_DEPTH(view->texture->depth0 - 1) |
- S_038004_DATA_FORMAT(format);
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = texture->offset[0] >> 8;
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = texture->offset[1] >> 8;
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD4] =
- word4 |
- S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) |
- S_038010_SRF_MODE_ALL(V_038010_SFR_MODE_NO_ZERO) |
- S_038010_REQUEST_SIZE(1) |
- S_038010_BASE_LEVEL(view->first_level);
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD5] =
- S_038014_LAST_LEVEL(view->last_level) |
- S_038014_BASE_ARRAY(0) |
- S_038014_LAST_ARRAY(0);
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD6] =
- S_038018_TYPE(V_038010_SQ_TEX_VTX_VALID_TEXTURE);
- radeon_state_pm4(rstate);
-}
-
-static void r600_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate)
-{
- struct r600_screen *rscreen = rctx->screen;
- const struct pipe_blend_state *pbs = &rctx->blend->state.blend;
- int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs;
- uint32_t color_control, target_mask, shader_mask, shader_control;
- int i;
-
- target_mask = 0;
- shader_mask = 0;
- shader_control = 0;
- color_control = S_028808_PER_MRT_BLEND(1);
-
- for (i = 0; i < nr_cbufs; i++) {
- shader_mask |= 0xf << (i * 4);
- shader_control |= (1 << i);
- }
-
- if (pbs->logicop_enable) {
- color_control |= (pbs->logicop_func << 16) | (pbs->logicop_func << 20);
- } else {
- color_control |= (0xcc << 16);
- }
-
- if (pbs->independent_blend_enable) {
- for (i = 0; i < nr_cbufs; i++) {
- if (pbs->rt[i].blend_enable) {
- color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i);
- }
- target_mask |= (pbs->rt[i].colormask << (4 * i));
- }
- } else {
- for (i = 0; i < nr_cbufs; i++) {
- if (pbs->rt[0].blend_enable) {
- color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i);
- }
- target_mask |= (pbs->rt[0].colormask << (4 * i));
- }
- }
- radeon_state_init(rstate, rscreen->rw, R600_STATE_CB_CNTL, 0, 0);
- rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = shader_mask;
- rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = target_mask;
- rstate->states[R600_CB_CNTL__CB_COLOR_CONTROL] = color_control;
- if (radeon_get_family_class(rscreen->rw) == R700)
- rstate->states[R600_CB_CNTL__CB_SHADER_CONTROL] = shader_control;
- rstate->states[R600_CB_CNTL__PA_SC_AA_CONFIG] = 0x00000000;
- rstate->states[R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX] = 0x00000000;
- rstate->states[R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX] = 0x00000000;
- rstate->states[R600_CB_CNTL__CB_CLRCMP_CONTROL] = 0x01000000;
- rstate->states[R600_CB_CNTL__CB_CLRCMP_SRC] = 0x00000000;
- rstate->states[R600_CB_CNTL__CB_CLRCMP_DST] = 0x000000FF;
- rstate->states[R600_CB_CNTL__CB_CLRCMP_MSK] = 0xFFFFFFFF;
- rstate->states[R600_CB_CNTL__PA_SC_AA_MASK] = 0xFFFFFFFF;
- radeon_state_pm4(rstate);
-}
-
-static void r600_init_config(struct r600_context *rctx)
-{
- int ps_prio;
- int vs_prio;
- int gs_prio;
- int es_prio;
- int num_ps_gprs;
- int num_vs_gprs;
- int num_gs_gprs;
- int num_es_gprs;
- int num_temp_gprs;
- int num_ps_threads;
- int num_vs_threads;
- int num_gs_threads;
- int num_es_threads;
- int num_ps_stack_entries;
- int num_vs_stack_entries;
- int num_gs_stack_entries;
- int num_es_stack_entries;
- enum radeon_family family;
-
- family = radeon_get_family(rctx->rw);
- ps_prio = 0;
- vs_prio = 1;
- gs_prio = 2;
- es_prio = 3;
- switch (family) {
- case CHIP_R600:
- num_ps_gprs = 192;
- num_vs_gprs = 56;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 136;
- num_vs_threads = 48;
- num_gs_threads = 4;
- num_es_threads = 4;
- num_ps_stack_entries = 128;
- num_vs_stack_entries = 128;
- num_gs_stack_entries = 0;
- num_es_stack_entries = 0;
- break;
- case CHIP_RV630:
- case CHIP_RV635:
- num_ps_gprs = 84;
- num_vs_gprs = 36;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 144;
- num_vs_threads = 40;
- num_gs_threads = 4;
- num_es_threads = 4;
- num_ps_stack_entries = 40;
- num_vs_stack_entries = 40;
- num_gs_stack_entries = 32;
- num_es_stack_entries = 16;
- break;
- case CHIP_RV610:
- case CHIP_RV620:
- case CHIP_RS780:
- case CHIP_RS880:
- default:
- num_ps_gprs = 84;
- num_vs_gprs = 36;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 136;
- num_vs_threads = 48;
- num_gs_threads = 4;
- num_es_threads = 4;
- num_ps_stack_entries = 40;
- num_vs_stack_entries = 40;
- num_gs_stack_entries = 32;
- num_es_stack_entries = 16;
- break;
- case CHIP_RV670:
- num_ps_gprs = 144;
- num_vs_gprs = 40;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 136;
- num_vs_threads = 48;
- num_gs_threads = 4;
- num_es_threads = 4;
- num_ps_stack_entries = 40;
- num_vs_stack_entries = 40;
- num_gs_stack_entries = 32;
- num_es_stack_entries = 16;
- break;
- case CHIP_RV770:
- num_ps_gprs = 192;
- num_vs_gprs = 56;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 188;
- num_vs_threads = 60;
- num_gs_threads = 0;
- num_es_threads = 0;
- num_ps_stack_entries = 256;
- num_vs_stack_entries = 256;
- num_gs_stack_entries = 0;
- num_es_stack_entries = 0;
- break;
- case CHIP_RV730:
- case CHIP_RV740:
- num_ps_gprs = 84;
- num_vs_gprs = 36;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 188;
- num_vs_threads = 60;
- num_gs_threads = 0;
- num_es_threads = 0;
- num_ps_stack_entries = 128;
- num_vs_stack_entries = 128;
- num_gs_stack_entries = 0;
- num_es_stack_entries = 0;
- break;
- case CHIP_RV710:
- num_ps_gprs = 192;
- num_vs_gprs = 56;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 144;
- num_vs_threads = 48;
- num_gs_threads = 0;
- num_es_threads = 0;
- num_ps_stack_entries = 128;
- num_vs_stack_entries = 128;
- num_gs_stack_entries = 0;
- num_es_stack_entries = 0;
- break;
- }
- radeon_state_init(&rctx->config, rctx->rw, R600_STATE_CONFIG, 0, 0);
-
- rctx->config.states[R600_CONFIG__SQ_CONFIG] = 0x00000000;
- switch (family) {
- case CHIP_RV610:
- case CHIP_RV620:
- case CHIP_RS780:
- case CHIP_RS880:
- case CHIP_RV710:
- break;
- default:
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_VC_ENABLE(1);
- break;
- }
-
- if (!rctx->screen->use_mem_constant)
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_DX9_CONSTS(1);
-
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_ALU_INST_PREFER_VECTOR(1);
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_PS_PRIO(ps_prio);
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_VS_PRIO(vs_prio);
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_GS_PRIO(gs_prio);
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_ES_PRIO(es_prio);
-
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] = 0;
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_PS_GPRS(num_ps_gprs);
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_VS_GPRS(num_vs_gprs);
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs);
-
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] = 0;
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_gs_gprs);
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_es_gprs);
-
- rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] = 0;
- rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_PS_THREADS(num_ps_threads);
- rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_VS_THREADS(num_vs_threads);
- rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_GS_THREADS(num_gs_threads);
- rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_ES_THREADS(num_es_threads);
-
- rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] = 0;
- rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C10_NUM_PS_STACK_ENTRIES(num_ps_stack_entries);
- rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C10_NUM_VS_STACK_ENTRIES(num_vs_stack_entries);
-
- rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] = 0;
- rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_GS_STACK_ENTRIES(num_gs_stack_entries);
- rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_ES_STACK_ENTRIES(num_es_stack_entries);
-
- rctx->config.states[R600_CONFIG__VC_ENHANCE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SX_MISC] = 0x00000000;
-
- if (family >= CHIP_RV770) {
- rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] =
- S_008D8C_VS_PC_LIMIT_ENABLE(1);
- rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000002;
- rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x00000000;
- rctx->config.states[R600_CONFIG__DB_WATERMARKS] =
- S_009838_DEPTH_FREE(4) |
- S_009838_DEPTH_FLUSH(16) |
- S_009838_DEPTH_PENDING_FREE(4) |
- S_009838_DEPTH_CACHELINE_FREE(4);
- rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = 0x00000000;
- rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00500000 |
- S_028A4C_FORCE_EOV_CNTDWN_ENABLE(1) |
- S_028A4C_FORCE_EOV_REZ_ENABLE(1);
- } else {
- rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00000000;
- rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000002 |
- S_009508_DISABLE_CUBE_WRAP(1);
- rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x82000000;
- rctx->config.states[R600_CONFIG__DB_WATERMARKS] =
- S_009838_DEPTH_FREE(4) |
- S_009838_DEPTH_FLUSH(16) |
- S_009838_DEPTH_PENDING_FREE(4) |
- S_009838_DEPTH_CACHELINE_FREE(16);
- rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] =
- S_0286C8_PS_GROUPING(1);
- rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] =
- S_028A4C_WALK_ORDER_ENABLE(1) |
- S_028A4C_FORCE_EOV_CNTDWN_ENABLE(1);
- }
- rctx->config.states[R600_CONFIG__SQ_ESGS_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_GSVS_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_FBUF_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_REDUC_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_GS_VERT_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_OUTPUT_PATH_CNTL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_HOS_CNTL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_HOS_REUSE_DEPTH] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_PRIM_TYPE] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_FIRST_DECR] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_DECR] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_0_CNTL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_1_CNTL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GS_MODE] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_STRMOUT_EN] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_REUSE_OFF] = S_028AB4_REUSE_OFF(1);
- rctx->config.states[R600_CONFIG__VGT_VTX_CNT_EN] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_STRMOUT_BUFFER_EN] = 0x00000000;
- radeon_state_pm4(&rctx->config);
-}
-
-static int r600_vs_resource(struct r600_context *rctx, int id, struct r600_resource *rbuffer, uint32_t offset,
- uint32_t stride, uint32_t src_format)
-{
- struct radeon_state *vs_resource = &rctx->vs_resource[id];
- struct r600_screen *rscreen = rctx->screen;
- unsigned format, num_format = 0, format_comp = 0;
-
- format = r600_translate_colorformat(src_format);
-
- r600_translate_vertex_num_format(src_format, &num_format, &format_comp);
-
- format = S_038008_DATA_FORMAT(format) | S_038008_NUM_FORMAT_ALL(num_format) | S_038008_FORMAT_COMP_ALL(format_comp);
-
- radeon_state_init(vs_resource, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_VS);
- radeon_ws_bo_reference(rscreen->rw, &vs_resource->bo[0], rbuffer->bo);
- vs_resource->nbo = 1;
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = offset;
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = rbuffer->size - offset - 1;
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = S_038008_STRIDE(stride) | format;
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = 0x00000000;
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD4] = 0x00000000;
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD5] = 0x00000000;
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD6] = 0xC0000000;
- vs_resource->placement[0] = RADEON_GEM_DOMAIN_GTT;
- vs_resource->placement[1] = RADEON_GEM_DOMAIN_GTT;
- return radeon_state_pm4(vs_resource);
-}
-
-static int r600_draw_vgt_init(struct r600_draw *draw,
- int vgt_draw_initiator)
-{
- struct r600_context *rctx = r600_context(draw->ctx);
- struct r600_screen *rscreen = rctx->screen;
- struct r600_resource *rbuffer = (struct r600_resource *)draw->index_buffer;
- radeon_state_init(&draw->draw, rscreen->rw, R600_STATE_DRAW, 0, 0);
- draw->draw.states[R600_DRAW__VGT_NUM_INDICES] = draw->count;
- draw->draw.states[R600_DRAW__VGT_DRAW_INITIATOR] = vgt_draw_initiator;
- draw->draw.states[R600_DRAW__VGT_DMA_BASE] = draw->index_buffer_offset;
- if (rbuffer) {
- radeon_ws_bo_reference(rscreen->rw, &draw->draw.bo[0], rbuffer->bo);
- draw->draw.placement[0] = RADEON_GEM_DOMAIN_GTT;
- draw->draw.placement[1] = RADEON_GEM_DOMAIN_GTT;
- draw->draw.nbo = 1;
- }
- return radeon_state_pm4(&draw->draw);
-}
-
-static int r600_draw_vgt_prim(struct r600_draw *draw,
- uint32_t prim, uint32_t vgt_dma_index_type)
-{
- struct r600_context *rctx = r600_context(draw->ctx);
- struct r600_screen *rscreen = rctx->screen;
- radeon_state_init(&draw->vgt, rscreen->rw, R600_STATE_VGT, 0, 0);
- draw->vgt.states[R600_VGT__VGT_PRIMITIVE_TYPE] = prim;
- draw->vgt.states[R600_VGT__VGT_MAX_VTX_INDX] = draw->max_index;
- draw->vgt.states[R600_VGT__VGT_MIN_VTX_INDX] = draw->min_index;
- draw->vgt.states[R600_VGT__VGT_INDX_OFFSET] = draw->index_bias;
- draw->vgt.states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX] = 0x00000000;
- draw->vgt.states[R600_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type;
- draw->vgt.states[R600_VGT__VGT_PRIMITIVEID_EN] = 0x00000000;
- draw->vgt.states[R600_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001;
- draw->vgt.states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_EN] = 0x00000000;
- draw->vgt.states[R600_VGT__VGT_INSTANCE_STEP_RATE_0] = 0x00000000;
- draw->vgt.states[R600_VGT__VGT_INSTANCE_STEP_RATE_1] = 0x00000000;
- return radeon_state_pm4(&draw->vgt);
-}
-
-static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state *rpshader,
- struct radeon_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
- const struct pipe_rasterizer_state *rasterizer;
- struct r600_shader *rshader = &rpshader->shader;
- unsigned i, tmp, exports_ps, num_cout;
- boolean have_pos = FALSE, have_face = FALSE;
-
- rasterizer = &rctx->rasterizer->state.rasterizer;
-
- radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS);
- for (i = 0; i < rshader->ninput; i++) {
- tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(rctx, rshader, i)) | S_028644_SEL_CENTROID(1);
- if (rshader->input[i].name == TGSI_SEMANTIC_POSITION)
- have_pos = TRUE;
- if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
- rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
- rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
- tmp |= S_028644_FLAT_SHADE(rshader->flat_shade);
- }
-
- if (rshader->input[i].name == TGSI_SEMANTIC_FACE)
- have_face = TRUE;
-
- if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC &&
- rasterizer->sprite_coord_enable & (1 << rshader->input[i].sid)) {
- tmp |= S_028644_PT_SPRITE_TEX(1);
- }
- state->states[R600_PS_SHADER__SPI_PS_INPUT_CNTL_0 + i] = tmp;
- }
-
- exports_ps = 0;
- num_cout = 0;
- for (i = 0; i < rshader->noutput; i++) {
- if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
- exports_ps |= S_028854_EXPORT_Z(1);
- else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) {
- num_cout++;
- }
- }
- exports_ps |= S_028854_EXPORT_COLORS(num_cout);
- if (exports_ps == 0) {
- /* Always at least export 1 color component per pixel. */
- exports_ps = S_028854_EXPORT_COLORS(1);
- }
- state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] =
- S_0286CC_NUM_INTERP(rshader->ninput) |
- S_0286CC_PERSP_GRADIENT_ENA(1);
-
- if (have_pos) {
- state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] |=
- S_0286CC_POSITION_ENA(1) |
- S_0286CC_BARYC_SAMPLE_CNTL(1);
- state->states[R600_PS_SHADER__SPI_INPUT_Z] |=
- S_0286D8_PROVIDE_Z_TO_SPI(1);
- }
-
- state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] =
- S_0286D0_FRONT_FACE_ENA(have_face);
-
- state->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] =
- S_028868_NUM_GPRS(rshader->bc.ngpr) |
- S_028868_STACK_SIZE(rshader->bc.nstack);
- state->states[R600_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps;
- radeon_ws_bo_reference(rscreen->rw, &state->bo[0], rpshader->bo);
- state->nbo = 1;
- state->placement[0] = RADEON_GEM_DOMAIN_GTT;
- return radeon_state_pm4(state);
-}
-
-static int r600_vs_shader(struct r600_context *rctx, struct r600_context_state *rpshader,
- struct radeon_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
- struct r600_shader *rshader = &rpshader->shader;
- unsigned i, tmp;
-
- radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS);
- for (i = 0; i < 10; i++) {
- state->states[R600_VS_SHADER__SPI_VS_OUT_ID_0 + i] = 0;
- }
- /* so far never got proper semantic id from tgsi */
- for (i = 0; i < 32; i++) {
- tmp = i << ((i & 3) * 8);
- state->states[R600_VS_SHADER__SPI_VS_OUT_ID_0 + i / 4] |= tmp;
- }
- state->states[R600_VS_SHADER__SPI_VS_OUT_CONFIG] =
- S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2);
- state->states[R600_VS_SHADER__SQ_PGM_RESOURCES_VS] =
- S_028868_NUM_GPRS(rshader->bc.ngpr) |
- S_028868_STACK_SIZE(rshader->bc.nstack);
- radeon_ws_bo_reference(rscreen->rw, &state->bo[0], rpshader->bo);
- radeon_ws_bo_reference(rscreen->rw, &state->bo[1], rpshader->bo);
- state->nbo = 2;
- state->placement[0] = RADEON_GEM_DOMAIN_GTT;
- state->placement[2] = RADEON_GEM_DOMAIN_GTT;
- return radeon_state_pm4(state);
-}
-
-struct r600_context_hw_state_vtbl r600_hw_state_vtbl = {
- .blend = r600_blend,
- .ucp = r600_ucp,
- .cb = r600_cb,
- .db = r600_db,
- .rasterizer = r600_rasterizer,
- .scissor = r600_scissor,
- .viewport = r600_viewport,
- .dsa = r600_dsa,
- .sampler_border = r600_sampler_border,
- .sampler = r600_sampler,
- .resource = r600_resource,
- .cb_cntl = r600_cb_cntl,
- .vs_resource = r600_vs_resource,
- .vgt_init = r600_draw_vgt_init,
- .vgt_prim = r600_draw_vgt_prim,
- .vs_shader = r600_vs_shader,
- .ps_shader = r600_ps_shader,
- .init_config = r600_init_config,
-};
-
-void r600_set_constant_buffer_file(struct pipe_context *ctx,
- uint shader, uint index,
- struct pipe_resource *buffer)
-{
- struct r600_screen *rscreen = r600_screen(ctx->screen);
- struct r600_context *rctx = r600_context(ctx);
- unsigned nconstant = 0, i, type, shader_class;
- struct radeon_state *rstate, *rstates;
- struct pipe_transfer *transfer;
- u32 *ptr;
-
- type = R600_STATE_CONSTANT;
-
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- shader_class = R600_SHADER_VS;
- rstates = rctx->vs_constant;
- break;
- case PIPE_SHADER_FRAGMENT:
- shader_class = R600_SHADER_PS;
- rstates = rctx->ps_constant;
- break;
- default:
- R600_ERR("unsupported %d\n", shader);
- return;
- }
- if (buffer && buffer->width0 > 0) {
- nconstant = buffer->width0 / 16;
- ptr = pipe_buffer_map(ctx, buffer, PIPE_TRANSFER_READ, &transfer);
- if (ptr == NULL)
- return;
- for (i = 0; i < nconstant; i++) {
- rstate = &rstates[i];
- radeon_state_init(rstate, rscreen->rw, type, i, shader_class);
- rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT0_0] = ptr[i * 4 + 0];
- rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT1_0] = ptr[i * 4 + 1];
- rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT2_0] = ptr[i * 4 + 2];
- rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT3_0] = ptr[i * 4 + 3];
- if (radeon_state_pm4(rstate))
- return;
- radeon_draw_bind(&rctx->draw, rstate);
- }
- pipe_buffer_unmap(ctx, buffer, transfer);
- }
-}
-
-void r600_set_constant_buffer_mem(struct pipe_context *ctx,
- uint shader, uint index,
- struct pipe_resource *buffer)
-{
- struct r600_screen *rscreen = r600_screen(ctx->screen);
- struct r600_context *rctx = r600_context(ctx);
- unsigned nconstant = 0, type, shader_class, size;
- struct radeon_state *rstate, *rstates;
- struct r600_resource *rbuffer = (struct r600_resource*)buffer;
-
- type = R600_STATE_CBUF;
-
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- shader_class = R600_SHADER_VS;
- rstates = rctx->vs_constant;
- break;
- case PIPE_SHADER_FRAGMENT:
- shader_class = R600_SHADER_PS;
- rstates = rctx->ps_constant;
- break;
- default:
- R600_ERR("unsupported %d\n", shader);
- return;
- }
-
- rstate = &rstates[0];
-
-#define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y))
-
- nconstant = buffer->width0 / 16;
- size = ALIGN_DIVUP(nconstant, 16);
-
- radeon_state_init(rstate, rscreen->rw, type, 0, shader_class);
- rstate->states[R600_VS_CBUF__ALU_CONST_BUFFER_SIZE_VS_0] = size;
- rstate->states[R600_VS_CBUF__ALU_CONST_CACHE_VS_0] = 0;
-
- radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rbuffer->bo);
- rstate->nbo = 1;
- rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM;
- if (radeon_state_pm4(rstate))
- return;
- radeon_draw_bind(&rctx->draw, rstate);
-}
-
#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CEIL 0x00000012
#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RNDNE 0x00000013
#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR 0x00000014
-/* same up to here */
-/*
-#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA 0x00000015
-#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR 0x00000016
-#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT 0x00000018
-*/
#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ASHR_INT 0x00000015
#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHR_INT 0x00000016
#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHL_INT 0x00000017
#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED_64 0x00000098
#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SQRT_64 0x00000099
/* TODO Fill in more ALU */
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR 0x000000B1
#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4 0x000000BE
#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4_IEEE 0x000000BF
#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE 0x000000C0
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT 0x000000CC
#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY 0x000000D6
#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_ZW 0x000000D7
--- /dev/null
+/*
+ * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include <stdio.h>
+#include <errno.h>
+#include <pipe/p_defines.h>
+#include <pipe/p_state.h>
+#include <pipe/p_context.h>
+#include <tgsi/tgsi_scan.h>
+#include <tgsi/tgsi_parse.h>
+#include <tgsi/tgsi_util.h>
+#include <util/u_blitter.h>
+#include <util/u_double_list.h>
+#include <util/u_transfer.h>
+#include <util/u_surface.h>
+#include <util/u_pack_color.h>
+#include <util/u_memory.h>
+#include <util/u_inlines.h>
+#include <util/u_upload_mgr.h>
+#include <pipebuffer/pb_buffer.h>
+#include "r600.h"
+#include "r600d.h"
+#include "r600_resource.h"
+#include "r600_shader.h"
+#include "r600_pipe.h"
+#include "r600_state_inlines.h"
+
+/*
+ * pipe_context
+ */
+static void r600_flush(struct pipe_context *ctx, unsigned flags,
+ struct pipe_fence_handle **fence)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+#if 0
+ static int dc = 0;
+ char dname[256];
+#endif
+
+ if (!rctx->ctx.pm4_cdwords)
+ return;
+
+ u_upload_flush(rctx->upload_vb);
+ u_upload_flush(rctx->upload_ib);
+
+#if 0
+ sprintf(dname, "gallium-%08d.bof", dc);
+ if (dc < 20) {
+ r600_context_dump_bof(&rctx->ctx, dname);
+ R600_ERR("dumped %s\n", dname);
+ }
+ dc++;
+#endif
+ r600_context_flush(&rctx->ctx);
+}
+
+static void r600_destroy_context(struct pipe_context *context)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)context;
+
+ r600_context_fini(&rctx->ctx);
+ for (int i = 0; i < R600_PIPE_NSTATES; i++) {
+ free(rctx->states[i]);
+ }
+
+ u_upload_destroy(rctx->upload_vb);
+ u_upload_destroy(rctx->upload_ib);
+
+ FREE(rctx->ps_resource);
+ FREE(rctx->vs_resource);
+ FREE(rctx);
+}
+
+static struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv)
+{
+ struct r600_pipe_context *rctx = CALLOC_STRUCT(r600_pipe_context);
+ struct r600_screen* rscreen = (struct r600_screen *)screen;
+ enum chip_class class;
+
+ if (rctx == NULL)
+ return NULL;
+ rctx->context.winsys = rscreen->screen.winsys;
+ rctx->context.screen = screen;
+ rctx->context.priv = priv;
+ rctx->context.destroy = r600_destroy_context;
+ rctx->context.flush = r600_flush;
+
+ /* Easy accessing of screen/winsys. */
+ rctx->screen = rscreen;
+ rctx->radeon = rscreen->radeon;
+ rctx->family = r600_get_family(rctx->radeon);
+
+ r600_init_blit_functions(rctx);
+ r600_init_query_functions(rctx);
+ r600_init_context_resource_functions(rctx);
+
+ switch (r600_get_family(rctx->radeon)) {
+ case CHIP_R600:
+ case CHIP_RV610:
+ case CHIP_RV630:
+ case CHIP_RV670:
+ case CHIP_RV620:
+ case CHIP_RV635:
+ case CHIP_RS780:
+ case CHIP_RS880:
+ case CHIP_RV770:
+ case CHIP_RV730:
+ case CHIP_RV710:
+ case CHIP_RV740:
+ rctx->context.draw_vbo = r600_draw_vbo;
+ r600_init_state_functions(rctx);
+ if (r600_context_init(&rctx->ctx, rctx->radeon)) {
+ r600_destroy_context(&rctx->context);
+ return NULL;
+ }
+ r600_init_config(rctx);
+ break;
+ case CHIP_CEDAR:
+ case CHIP_REDWOOD:
+ case CHIP_JUNIPER:
+ case CHIP_CYPRESS:
+ case CHIP_HEMLOCK:
+ rctx->context.draw_vbo = evergreen_draw;
+ evergreen_init_state_functions(rctx);
+ if (evergreen_context_init(&rctx->ctx, rctx->radeon)) {
+ r600_destroy_context(&rctx->context);
+ return NULL;
+ }
+ evergreen_init_config(rctx);
+ break;
+ default:
+ R600_ERR("unsupported family %d\n", r600_get_family(rctx->radeon));
+ r600_destroy_context(&rctx->context);
+ return NULL;
+ }
+
+ rctx->upload_ib = u_upload_create(&rctx->context, 32 * 1024, 16,
+ PIPE_BIND_INDEX_BUFFER);
+ if (rctx->upload_ib == NULL) {
+ r600_destroy_context(&rctx->context);
+ return NULL;
+ }
+
+ rctx->upload_vb = u_upload_create(&rctx->context, 128 * 1024, 16,
+ PIPE_BIND_VERTEX_BUFFER);
+ if (rctx->upload_vb == NULL) {
+ r600_destroy_context(&rctx->context);
+ return NULL;
+ }
+
+ rctx->blitter = util_blitter_create(&rctx->context);
+ if (rctx->blitter == NULL) {
+ FREE(rctx);
+ return NULL;
+ }
+
+ rctx->vs_resource = CALLOC(R600_RESOURCE_ARRAY_SIZE, sizeof(struct r600_pipe_state));
+ if (!rctx->vs_resource) {
+ FREE(rctx);
+ return NULL;
+ }
+
+ rctx->ps_resource = CALLOC(R600_RESOURCE_ARRAY_SIZE, sizeof(struct r600_pipe_state));
+ if (!rctx->ps_resource) {
+ FREE(rctx);
+ return NULL;
+ }
+
+ class = r600_get_family_class(rctx->radeon);
+ if (class == R600 || class == R700)
+ rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx);
+ else
+ rctx->custom_dsa_flush = evergreen_create_db_flush_dsa(rctx);
+
+ r600_blit_uncompress_depth_ptr = r600_blit_uncompress_depth;
+
+ return &rctx->context;
+}
+
+/*
+ * pipe_screen
+ */
+static const char* r600_get_vendor(struct pipe_screen* pscreen)
+{
+ return "X.Org";
+}
+
+static const char *r600_get_family_name(enum radeon_family family)
+{
+ switch(family) {
+ case CHIP_R600: return "R600";
+ case CHIP_RV610: return "RV610";
+ case CHIP_RV630: return "RV630";
+ case CHIP_RV670: return "RV670";
+ case CHIP_RV620: return "RV620";
+ case CHIP_RV635: return "RV635";
+ case CHIP_RS780: return "RS780";
+ case CHIP_RS880: return "RS880";
+ case CHIP_RV770: return "RV770";
+ case CHIP_RV730: return "RV730";
+ case CHIP_RV710: return "RV710";
+ case CHIP_RV740: return "RV740";
+ case CHIP_CEDAR: return "CEDAR";
+ case CHIP_REDWOOD: return "REDWOOD";
+ case CHIP_JUNIPER: return "JUNIPER";
+ case CHIP_CYPRESS: return "CYPRESS";
+ case CHIP_HEMLOCK: return "HEMLOCK";
+ default: return "unknown";
+ }
+}
+
+static const char* r600_get_name(struct pipe_screen* pscreen)
+{
+ struct r600_screen *rscreen = (struct r600_screen *)pscreen;
+ enum radeon_family family = r600_get_family(rscreen->radeon);
+
+ return r600_get_family_name(family);
+}
+
+static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
+{
+ switch (param) {
+ /* Supported features (boolean caps). */
+ case PIPE_CAP_NPOT_TEXTURES:
+ case PIPE_CAP_TWO_SIDED_STENCIL:
+ case PIPE_CAP_GLSL:
+ case PIPE_CAP_DUAL_SOURCE_BLEND:
+ case PIPE_CAP_ANISOTROPIC_FILTER:
+ case PIPE_CAP_POINT_SPRITE:
+ case PIPE_CAP_OCCLUSION_QUERY:
+ case PIPE_CAP_TEXTURE_SHADOW_MAP:
+ case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
+ case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
+ case PIPE_CAP_BLEND_EQUATION_SEPARATE:
+ case PIPE_CAP_SM3:
+ case PIPE_CAP_TEXTURE_SWIZZLE:
+ case PIPE_CAP_INDEP_BLEND_ENABLE:
+ case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
+ case PIPE_CAP_DEPTH_CLAMP:
+ case PIPE_CAP_SHADER_STENCIL_EXPORT:
+ return 1;
+
+ /* Unsupported features (boolean caps). */
+ case PIPE_CAP_TIMER_QUERY:
+ case PIPE_CAP_STREAM_OUTPUT:
+ case PIPE_CAP_INDEP_BLEND_FUNC: /* FIXME allow this */
+ return 0;
+
+ /* Texturing. */
+ case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
+ case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
+ case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
+ return 14;
+ case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
+ /* FIXME allow this once infrastructure is there */
+ return 16;
+ case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
+ case PIPE_CAP_MAX_COMBINED_SAMPLERS:
+ return 16;
+
+ /* Render targets. */
+ case PIPE_CAP_MAX_RENDER_TARGETS:
+ /* FIXME some r6xx are buggy and can only do 4 */
+ return 8;
+
+ /* Fragment coordinate conventions. */
+ case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
+ case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
+ return 1;
+ case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
+ case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
+ return 0;
+
+ default:
+ R600_ERR("r600: unknown param %d\n", param);
+ return 0;
+ }
+}
+
+static float r600_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param)
+{
+ switch (param) {
+ case PIPE_CAP_MAX_LINE_WIDTH:
+ case PIPE_CAP_MAX_LINE_WIDTH_AA:
+ case PIPE_CAP_MAX_POINT_WIDTH:
+ case PIPE_CAP_MAX_POINT_WIDTH_AA:
+ return 8192.0f;
+ case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
+ return 16.0f;
+ case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
+ return 16.0f;
+ default:
+ R600_ERR("r600: unsupported paramf %d\n", param);
+ return 0.0f;
+ }
+}
+
+static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param)
+{
+ switch(shader)
+ {
+ case PIPE_SHADER_FRAGMENT:
+ case PIPE_SHADER_VERTEX:
+ break;
+ case PIPE_SHADER_GEOMETRY:
+ /* TODO: support and enable geometry programs */
+ return 0;
+ default:
+ /* TODO: support tessellation on Evergreen */
+ return 0;
+ }
+
+ /* TODO: all these should be fixed, since r600 surely supports much more! */
+ switch (param) {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
+ return 16384;
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+ return 8; /* FIXME */
+ case PIPE_SHADER_CAP_MAX_INPUTS:
+ if(shader == PIPE_SHADER_FRAGMENT)
+ return 10;
+ else
+ return 16;
+ case PIPE_SHADER_CAP_MAX_TEMPS:
+ return 256; //max native temporaries
+ case PIPE_SHADER_CAP_MAX_ADDRS:
+ return 1; //max native address registers/* FIXME Isn't this equal to TEMPS? */
+ case PIPE_SHADER_CAP_MAX_CONSTS:
+ return 256; //max native parameters
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return 1;
+ case PIPE_SHADER_CAP_MAX_PREDS:
+ return 0; /* FIXME */
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+static boolean r600_is_format_supported(struct pipe_screen* screen,
+ enum pipe_format format,
+ enum pipe_texture_target target,
+ unsigned sample_count,
+ unsigned usage,
+ unsigned geom_flags)
+{
+ unsigned retval = 0;
+ if (target >= PIPE_MAX_TEXTURE_TYPES) {
+ R600_ERR("r600: unsupported texture type %d\n", target);
+ return FALSE;
+ }
+
+ /* Multisample */
+ if (sample_count > 1)
+ return FALSE;
+
+ if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
+ r600_is_sampler_format_supported(format)) {
+ retval |= PIPE_BIND_SAMPLER_VIEW;
+ }
+
+ if ((usage & (PIPE_BIND_RENDER_TARGET |
+ PIPE_BIND_DISPLAY_TARGET |
+ PIPE_BIND_SCANOUT |
+ PIPE_BIND_SHARED)) &&
+ r600_is_colorbuffer_format_supported(format)) {
+ retval |= usage &
+ (PIPE_BIND_RENDER_TARGET |
+ PIPE_BIND_DISPLAY_TARGET |
+ PIPE_BIND_SCANOUT |
+ PIPE_BIND_SHARED);
+ }
+
+ if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
+ r600_is_zs_format_supported(format)) {
+ retval |= PIPE_BIND_DEPTH_STENCIL;
+ }
+
+ if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
+ r600_is_vertex_format_supported(format))
+ retval |= PIPE_BIND_VERTEX_BUFFER;
+
+ if (usage & PIPE_BIND_TRANSFER_READ)
+ retval |= PIPE_BIND_TRANSFER_READ;
+ if (usage & PIPE_BIND_TRANSFER_WRITE)
+ retval |= PIPE_BIND_TRANSFER_WRITE;
+
+ return retval == usage;
+}
+
+static void r600_destroy_screen(struct pipe_screen* pscreen)
+{
+ struct r600_screen *rscreen = (struct r600_screen *)pscreen;
+
+ if (rscreen == NULL)
+ return;
+ FREE(rscreen);
+}
+
+
+struct pipe_screen *r600_screen_create(struct radeon *radeon)
+{
+ struct r600_screen *rscreen;
+
+ rscreen = CALLOC_STRUCT(r600_screen);
+ if (rscreen == NULL) {
+ return NULL;
+ }
+
+ rscreen->radeon = radeon;
+ rscreen->screen.winsys = (struct pipe_winsys*)radeon;
+ rscreen->screen.destroy = r600_destroy_screen;
+ rscreen->screen.get_name = r600_get_name;
+ rscreen->screen.get_vendor = r600_get_vendor;
+ rscreen->screen.get_param = r600_get_param;
+ rscreen->screen.get_shader_param = r600_get_shader_param;
+ rscreen->screen.get_paramf = r600_get_paramf;
+ rscreen->screen.is_format_supported = r600_is_format_supported;
+ rscreen->screen.context_create = r600_create_context;
+ r600_init_screen_texture_functions(&rscreen->screen);
+ r600_init_screen_resource_functions(&rscreen->screen);
+
+ rscreen->tiling_info = r600_get_tiling_info(radeon);
+
+ return &rscreen->screen;
+}
#ifndef R600_PIPE_H
#define R600_PIPE_H
+#include <pipe/p_state.h>
+#include <pipe/p_screen.h>
+#include <pipe/p_context.h>
+#include <util/u_math.h>
+#include "r600.h"
+#include "r600_public.h"
+#include "r600_shader.h"
+#include "r600_resource.h"
+
enum r600_pipe_state_id {
R600_PIPE_STATE_BLEND = 0,
R600_PIPE_STATE_BLEND_COLOR,
struct r600_screen {
struct pipe_screen screen;
struct radeon *radeon;
+ struct r600_tiling_info *tiling_info;
};
struct r600_pipe_sampler_view {
unsigned cb_target_mask;
};
-struct r600_pipe_shader {
- struct r600_shader shader;
- struct r600_pipe_state rstate;
- struct radeon_ws_bo *bo;
-};
-
struct r600_vertex_element
{
unsigned count;
struct pipe_vertex_element elements[32];
};
+struct r600_pipe_shader {
+ struct r600_shader shader;
+ struct r600_pipe_state rstate;
+ struct r600_bo *bo;
+ struct r600_vertex_element vertex_elements;
+};
+
+/* needed for blitter save */
+#define NUM_TEX_UNITS 16
+
+struct r600_textures_info {
+ struct r600_pipe_sampler_view *views[NUM_TEX_UNITS];
+ unsigned n_views;
+ void *samplers[NUM_TEX_UNITS];
+ unsigned n_samplers;
+};
+
+#define R600_CONSTANT_ARRAY_SIZE 256
+#define R600_RESOURCE_ARRAY_SIZE 160
+
struct r600_pipe_context {
struct pipe_context context;
struct blitter_context *blitter;
struct pipe_framebuffer_state *pframebuffer;
unsigned family;
void *custom_dsa_flush;
- struct list_head query_list; /* fake member for depth remove once merged */
struct r600_screen *screen;
struct radeon *radeon;
struct r600_pipe_state *states[R600_PIPE_NSTATES];
struct pipe_stencil_ref stencil_ref;
struct pipe_viewport_state viewport;
struct pipe_clip_state clip;
- unsigned vs_nconst;
- unsigned ps_nconst;
- struct r600_pipe_state vs_const[256];
- struct r600_pipe_state ps_const[256];
- struct r600_pipe_state vs_resource[160];
- struct r600_pipe_state ps_resource[160];
+ struct r600_pipe_state *vs_resource;
+ struct r600_pipe_state *ps_resource;
struct r600_pipe_state config;
struct r600_pipe_shader *ps_shader;
struct r600_pipe_shader *vs_shader;
struct u_upload_mgr *upload_vb;
struct u_upload_mgr *upload_ib;
unsigned any_user_vbs;
+ struct r600_textures_info ps_samplers;
+
};
struct r600_drawl {
struct pipe_resource *index_buffer;
};
-uint32_t r600_translate_texformat(enum pipe_format format,
- const unsigned char *swizzle_view,
- uint32_t *word4_p, uint32_t *yuv_format_p);
+/* evergreen_state.c */
+void evergreen_init_state_functions(struct r600_pipe_context *rctx);
+void evergreen_init_config(struct r600_pipe_context *rctx);
+void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info);
+void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader);
+void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader);
+void *evergreen_create_db_flush_dsa(struct r600_pipe_context *rctx);
+
+/* r600_blit.c */
+void r600_init_blit_functions(struct r600_pipe_context *rctx);
+int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture);
+
+/* r600_buffer.c */
+struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
+ const struct pipe_resource *templ);
+struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
+ void *ptr, unsigned bytes,
+ unsigned bind);
+unsigned r600_buffer_is_referenced_by_cs(struct pipe_context *context,
+ struct pipe_resource *buf,
+ unsigned face, unsigned level);
+struct pipe_resource *r600_buffer_from_handle(struct pipe_screen *screen,
+ struct winsys_handle *whandle);
+int r600_upload_index_buffer(struct r600_pipe_context *rctx, struct r600_drawl *draw);
+int r600_upload_user_buffers(struct r600_pipe_context *rctx);
-/* r600_state2.c */
-int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader *shader);
-int r600_pipe_shader_create2(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens);
-int r600_upload_index_buffer2(struct r600_pipe_context *rctx, struct r600_drawl *draw);
-int r600_upload_user_buffers2(struct r600_pipe_context *rctx);
-void r600_translate_index_buffer2(struct r600_pipe_context *r600,
+/* r600_query.c */
+void r600_init_query_functions(struct r600_pipe_context *rctx);
+
+/* r600_resource.c */
+void r600_init_context_resource_functions(struct r600_pipe_context *r600);
+
+/* r600_shader.c */
+int r600_pipe_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *shader);
+int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens);
+int r600_find_vs_semantic_index(struct r600_shader *vs,
+ struct r600_shader *ps, int id);
+
+/* r600_state.c */
+void r600_init_state_functions(struct r600_pipe_context *rctx);
+void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info);
+void r600_init_config(struct r600_pipe_context *rctx);
+void r600_translate_index_buffer(struct r600_pipe_context *r600,
struct pipe_resource **index_buffer,
unsigned *index_size,
unsigned *start, unsigned count);
-int r600_find_vs_semantic_index2(struct r600_shader *vs,
- struct r600_shader *ps, int id);
+void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx);
+/* r600_helper.h */
+int r600_conv_pipe_prim(unsigned pprim, unsigned *prim);
-/* evergreen_state.c */
-void evergreen_init_state_functions2(struct r600_pipe_context *rctx);
-void evergreen_init_config2(struct r600_pipe_context *rctx);
-void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info);
-void evergreen_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader);
-void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader);
+/* r600_texture.c */
+void r600_init_screen_texture_functions(struct pipe_screen *screen);
+uint32_t r600_translate_texformat(enum pipe_format format,
+ const unsigned char *swizzle_view,
+ uint32_t *word4_p, uint32_t *yuv_format_p);
+/*
+ * common helpers
+ */
static INLINE u32 S_FIXED(float value, u32 frac_bits)
{
return value * (1 << frac_bits);
-
+/*
+ * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
+ *
+ * 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 R600_PUBLIC_H
#define R600_PUBLIC_H
-struct radeon;
-
-struct pipe_screen* r600_screen_create(struct radeon *rw);
+struct pipe_screen *r600_screen_create(struct radeon *radeon);
#endif
* 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:
- * Jerome Glisse
- * Corbin Simpson
*/
-#include <errno.h>
-#include <util/u_inlines.h>
-#include <util/u_format.h>
-#include <util/u_memory.h>
-#include "r600_screen.h"
-#include "r600_context.h"
-
-static void r600_query_begin(struct r600_context *rctx, struct r600_query *rquery)
-{
- struct r600_screen *rscreen = rctx->screen;
- struct radeon_state *rstate = &rquery->rstate;
-
- radeon_state_fini(rstate);
- radeon_state_init(rstate, rscreen->rw, R600_STATE_QUERY_BEGIN, 0, 0);
- rstate->states[R600_QUERY__OFFSET] = rquery->num_results;
- radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rquery->buffer);
- rstate->nbo = 1;
- rstate->placement[0] = RADEON_GEM_DOMAIN_GTT;
- if (radeon_state_pm4(rstate)) {
- radeon_state_fini(rstate);
- }
-}
-
-static void r600_query_end(struct r600_context *rctx, struct r600_query *rquery)
-{
- struct r600_screen *rscreen = rctx->screen;
- struct radeon_state *rstate = &rquery->rstate;
-
- radeon_state_fini(rstate);
- radeon_state_init(rstate, rscreen->rw, R600_STATE_QUERY_END, 0, 0);
- rstate->states[R600_QUERY__OFFSET] = rquery->num_results + 8;
- radeon_ws_bo_reference(rscreen->rw, &rstate->bo[0], rquery->buffer);
- rstate->nbo = 1;
- rstate->placement[0] = RADEON_GEM_DOMAIN_GTT;
- if (radeon_state_pm4(rstate)) {
- radeon_state_fini(rstate);
- }
-}
+#include "r600_pipe.h"
static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned query_type)
{
- struct r600_screen *rscreen = r600_screen(ctx->screen);
- struct r600_context *rctx = r600_context(ctx);
- struct r600_query *q;
-
- if (query_type != PIPE_QUERY_OCCLUSION_COUNTER)
- return NULL;
-
- q = CALLOC_STRUCT(r600_query);
- if (!q)
- return NULL;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- q->type = query_type;
- q->buffer_size = 4096;
-
- q->buffer = radeon_ws_bo(rscreen->rw, q->buffer_size, 1, 0);
- if (!q->buffer) {
- FREE(q);
- return NULL;
- }
-
- LIST_ADDTAIL(&q->list, &rctx->query_list);
-
- return (struct pipe_query *)q;
-}
-
-static void r600_destroy_query(struct pipe_context *ctx,
- struct pipe_query *query)
-{
- struct r600_screen *rscreen = r600_screen(ctx->screen);
- struct r600_query *q = r600_query(query);
-
- radeon_ws_bo_reference(rscreen->rw, &q->buffer, NULL);
- LIST_DEL(&q->list);
- FREE(query);
+ return (struct pipe_query*)r600_context_query_create(&rctx->ctx, query_type);
}
-static void r600_query_result(struct pipe_context *ctx, struct r600_query *rquery)
+static void r600_destroy_query(struct pipe_context *ctx, struct pipe_query *query)
{
- struct r600_screen *rscreen = r600_screen(ctx->screen);
- u64 start, end;
- u32 *results;
- int i;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- results = radeon_ws_bo_map(rscreen->rw, rquery->buffer, 0, ctx);
- for (i = 0; i < rquery->num_results; i += 4) {
- start = (u64)results[i] | (u64)results[i + 1] << 32;
- end = (u64)results[i + 2] | (u64)results[i + 3] << 32;
- if ((start & 0x8000000000000000UL) && (end & 0x8000000000000000UL)) {
- rquery->result += end - start;
- }
- }
- radeon_ws_bo_unmap(rscreen->rw, rquery->buffer);
- rquery->num_results = 0;
-}
-
-static void r600_query_resume(struct pipe_context *ctx, struct r600_query *rquery)
-{
- struct r600_context *rctx = r600_context(ctx);
-
- if (rquery->num_results >= ((rquery->buffer_size >> 2) - 2)) {
- /* running out of space */
- if (!rquery->flushed) {
- ctx->flush(ctx, 0, NULL);
- }
- r600_query_result(ctx, rquery);
- }
- r600_query_begin(rctx, rquery);
- rquery->flushed = FALSE;
-}
-
-static void r600_query_suspend(struct pipe_context *ctx, struct r600_query *rquery)
-{
- struct r600_context *rctx = r600_context(ctx);
-
- r600_query_end(rctx, rquery);
- rquery->num_results += 16;
+ r600_context_query_destroy(&rctx->ctx, (struct r600_query *)query);
}
static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_query *rquery = r600_query(query);
- int r;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_query *rquery = (struct r600_query *)query;
- rquery->state = R600_QUERY_STATE_STARTED;
+ rquery->result = 0;
rquery->num_results = 0;
- rquery->flushed = FALSE;
- r600_query_resume(ctx, rquery);
- r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate);
- if (r == -EBUSY) {
- /* this shouldn't happen */
- R600_ERR("had to flush while emitting end query\n");
- ctx->flush(ctx, 0, NULL);
- r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate);
- }
+ r600_query_begin(&rctx->ctx, (struct r600_query *)query);
}
static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_query *rquery = r600_query(query);
- int r;
-
- rquery->state &= ~R600_QUERY_STATE_STARTED;
- rquery->state |= R600_QUERY_STATE_ENDED;
- r600_query_suspend(ctx, rquery);
- r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate);
- if (r == -EBUSY) {
- /* this shouldn't happen */
- R600_ERR("had to flush while emitting end query\n");
- ctx->flush(ctx, 0, NULL);
- r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate);
- }
-}
-
-void r600_queries_suspend(struct pipe_context *ctx)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_query *rquery;
- int r;
-
- LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) {
- if (rquery->state & R600_QUERY_STATE_STARTED) {
- r600_query_suspend(ctx, rquery);
- r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate);
- if (r == -EBUSY) {
- /* this shouldn't happen */
- R600_ERR("had to flush while emitting end query\n");
- ctx->flush(ctx, 0, NULL);
- r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate);
- }
- }
- rquery->state |= R600_QUERY_STATE_SUSPENDED;
- }
-}
-
-void r600_queries_resume(struct pipe_context *ctx)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_query *rquery;
- int r;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) {
- if (rquery->state & R600_QUERY_STATE_STARTED) {
- r600_query_resume(ctx, rquery);
- r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate);
- if (r == -EBUSY) {
- /* this shouldn't happen */
- R600_ERR("had to flush while emitting end query\n");
- ctx->flush(ctx, 0, NULL);
- r = radeon_ctx_set_query_state(rctx->ctx, &rquery->rstate);
- }
- }
- rquery->state &= ~R600_QUERY_STATE_SUSPENDED;
- }
+ r600_query_end(&rctx->ctx, (struct r600_query *)query);
}
static boolean r600_get_query_result(struct pipe_context *ctx,
struct pipe_query *query,
boolean wait, void *vresult)
{
- struct r600_query *rquery = r600_query(query);
- uint64_t *result = (uint64_t*)vresult;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_query *rquery = (struct r600_query *)query;
- if (!rquery->flushed) {
+ if (rquery->num_results) {
ctx->flush(ctx, 0, NULL);
- rquery->flushed = TRUE;
}
- r600_query_result(ctx, rquery);
- *result = rquery->result;
- rquery->result = 0;
- return TRUE;
+ return r600_context_query_result(&rctx->ctx, (struct r600_query *)query, wait, vresult);
}
-void r600_init_query_functions(struct r600_context* rctx)
+void r600_init_query_functions(struct r600_pipe_context *rctx)
{
- LIST_INITHEAD(&rctx->query_list);
-
rctx->context.create_query = r600_create_query;
rctx->context.destroy_query = r600_destroy_query;
rctx->context.begin_query = r600_begin_query;
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "r600_context.h"
-#include "r600_resource.h"
-#include "r600_screen.h"
+#include "r600_pipe.h"
static struct pipe_resource *r600_resource_create(struct pipe_screen *screen,
const struct pipe_resource *templ)
}
}
-void r600_init_context_resource_functions(struct r600_context *r600)
+void r600_init_screen_resource_functions(struct pipe_screen *screen)
+{
+ screen->resource_create = r600_resource_create;
+ screen->resource_from_handle = r600_resource_from_handle;
+ screen->resource_get_handle = u_resource_get_handle_vtbl;
+ screen->resource_destroy = u_resource_destroy_vtbl;
+ screen->user_buffer_create = r600_user_buffer_create;
+}
+
+void r600_init_context_resource_functions(struct r600_pipe_context *r600)
{
r600->context.get_transfer = u_get_transfer_vtbl;
r600->context.transfer_map = u_transfer_map_vtbl;
r600->context.transfer_inline_write = u_transfer_inline_write_vtbl;
r600->context.is_resource_referenced = u_is_resource_referenced_vtbl;
}
-
-void r600_init_screen_resource_functions(struct pipe_screen *screen)
-{
- screen->resource_create = r600_resource_create;
- screen->resource_from_handle = r600_resource_from_handle;
- screen->resource_get_handle = u_resource_get_handle_vtbl;
- screen->resource_destroy = u_resource_destroy_vtbl;
- screen->user_buffer_create = r600_user_buffer_create;
-}
#include "util/u_transfer.h"
-struct r600_context;
-struct r600_screen;
+/* Texture transfer. */
+struct r600_transfer {
+ /* Base class. */
+ struct pipe_transfer transfer;
+ /* Buffer transfer. */
+ struct pipe_transfer *buffer_transfer;
+ unsigned offset;
+ struct pipe_resource *linear_texture;
+};
/* This gets further specialized into either buffer or texture
* structures. Use the vtbl struct to choose between the two
*/
struct r600_resource {
struct u_resource base;
- struct radeon_ws_bo *bo;
+ struct r600_bo *bo;
u32 domain;
u32 flink;
u32 size;
struct r600_resource_texture {
struct r600_resource resource;
- unsigned long offset[PIPE_MAX_TEXTURE_LEVELS];
- unsigned long pitch[PIPE_MAX_TEXTURE_LEVELS];
- unsigned long width[PIPE_MAX_TEXTURE_LEVELS];
- unsigned long height[PIPE_MAX_TEXTURE_LEVELS];
- unsigned long layer_size[PIPE_MAX_TEXTURE_LEVELS];
- unsigned long pitch_override;
- unsigned long bpt;
- unsigned long size;
+ unsigned offset[PIPE_MAX_TEXTURE_LEVELS];
+ unsigned pitch_in_bytes[PIPE_MAX_TEXTURE_LEVELS];
+ unsigned pitch_in_pixels[PIPE_MAX_TEXTURE_LEVELS];
+ unsigned layer_size[PIPE_MAX_TEXTURE_LEVELS];
+ unsigned pitch_override;
+ unsigned size;
unsigned tiled;
unsigned array_mode;
unsigned tile_type;
struct r600_resource_texture *flushed_depth_texture;
};
-void r600_init_context_resource_functions(struct r600_context *r600);
void r600_init_screen_resource_functions(struct pipe_screen *screen);
/* r600_buffer */
struct pipe_resource *texture);
extern int (*r600_blit_uncompress_depth_ptr)(struct pipe_context *ctx, struct r600_resource_texture *texture);
+
+/* r600_texture.c texture transfer functions. */
+struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
+ struct pipe_resource *texture,
+ struct pipe_subresource sr,
+ unsigned usage,
+ const struct pipe_box *box);
+void r600_texture_transfer_destroy(struct pipe_context *ctx,
+ struct pipe_transfer *trans);
+void* r600_texture_transfer_map(struct pipe_context *ctx,
+ struct pipe_transfer* transfer);
+void r600_texture_transfer_unmap(struct pipe_context *ctx,
+ struct pipe_transfer* transfer);
+
#endif
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * 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.
- *
- * Authors:
- * Jerome Glisse
- * Corbin Simpson
- */
-#include <stdio.h>
-#include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_memory.h"
-#include "r600_screen.h"
-#include "r600_context.h"
-#include "r600_public.h"
-#include "r600_resource.h"
-#include "r600_state_inlines.h"
-
-static const char* r600_get_vendor(struct pipe_screen* pscreen)
-{
- return "X.Org";
-}
-
-static const char* r600_get_name(struct pipe_screen* pscreen)
-{
- struct r600_screen *screen = r600_screen(pscreen);
- enum radeon_family family = radeon_get_family(screen->rw);
-
- if (family >= CHIP_R600 && family < CHIP_RV770)
- return "R600 (HD2XXX,HD3XXX)";
- else if (family < CHIP_CEDAR)
- return "R700 (HD4XXX)";
- else
- return "EVERGREEN";
-}
-
-static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
-{
- switch (param) {
- /* Supported features (boolean caps). */
- case PIPE_CAP_NPOT_TEXTURES:
- case PIPE_CAP_TWO_SIDED_STENCIL:
- case PIPE_CAP_GLSL:
- case PIPE_CAP_DUAL_SOURCE_BLEND:
- case PIPE_CAP_ANISOTROPIC_FILTER:
- case PIPE_CAP_POINT_SPRITE:
- case PIPE_CAP_OCCLUSION_QUERY:
- case PIPE_CAP_TEXTURE_SHADOW_MAP:
- case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
- case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
- case PIPE_CAP_BLEND_EQUATION_SEPARATE:
- case PIPE_CAP_SM3:
- case PIPE_CAP_TEXTURE_SWIZZLE:
- case PIPE_CAP_INDEP_BLEND_ENABLE:
- case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
- case PIPE_CAP_DEPTH_CLAMP:
- return 1;
-
- /* Unsupported features (boolean caps). */
- case PIPE_CAP_TIMER_QUERY:
- case PIPE_CAP_STREAM_OUTPUT:
- case PIPE_CAP_INDEP_BLEND_FUNC: /* FIXME allow this */
- return 0;
-
- /* Texturing. */
- case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
- case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
- case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
- return 14;
- case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
- /* FIXME allow this once infrastructure is there */
- return 0;
- case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
- case PIPE_CAP_MAX_COMBINED_SAMPLERS:
- return 16;
-
- /* Render targets. */
- case PIPE_CAP_MAX_RENDER_TARGETS:
- /* FIXME some r6xx are buggy and can only do 4 */
- return 8;
-
- /* Fragment coordinate conventions. */
- case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
- case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
- return 1;
- case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
- case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
- return 0;
- default:
- R600_ERR("r600: unknown param %d\n", param);
- return 0;
- }
-}
-
-static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param)
-{
- switch(shader) {
- case PIPE_SHADER_FRAGMENT:
- case PIPE_SHADER_VERTEX:
- break;
- case PIPE_SHADER_GEOMETRY:
- /* TODO: support and enable geometry programs */
- return 0;
- default:
- /* TODO: support tessellation on Evergreen */
- return 0;
- }
-
- /* TODO: all these should be fixed, since r600 surely supports much more! */
- switch (param) {
- case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
- case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
- case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
- case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
- return 16384;
- case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
- return 8; /* FIXME */
- case PIPE_SHADER_CAP_MAX_INPUTS:
- if(shader == PIPE_SHADER_FRAGMENT)
- return 10;
- else
- return 16;
- case PIPE_SHADER_CAP_MAX_TEMPS:
- return 256; //max native temporaries
- case PIPE_SHADER_CAP_MAX_ADDRS:
- return 1; //max native address registers/* FIXME Isn't this equal to TEMPS? */
- case PIPE_SHADER_CAP_MAX_CONSTS:
- return 256; //max native parameters
- case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
- return 1;
- case PIPE_SHADER_CAP_MAX_PREDS:
- return 0; /* FIXME */
- case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
- return 1;
- default:
- return 0;
- }
-}
-
-static float r600_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param)
-{
- switch (param) {
- case PIPE_CAP_MAX_LINE_WIDTH:
- case PIPE_CAP_MAX_LINE_WIDTH_AA:
- case PIPE_CAP_MAX_POINT_WIDTH:
- case PIPE_CAP_MAX_POINT_WIDTH_AA:
- return 8192.0f;
- case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
- return 16.0f;
- case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
- return 16.0f;
- default:
- R600_ERR("r600: unsupported paramf %d\n", param);
- return 0.0f;
- }
-}
-
-static boolean r600_is_format_supported(struct pipe_screen* screen,
- enum pipe_format format,
- enum pipe_texture_target target,
- unsigned sample_count,
- unsigned usage,
- unsigned geom_flags)
-{
- unsigned retval = 0;
- if (target >= PIPE_MAX_TEXTURE_TYPES) {
- R600_ERR("r600: unsupported texture type %d\n", target);
- return FALSE;
- }
-
- /* Multisample */
- if (sample_count > 1)
- return FALSE;
-
- if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
- r600_is_sampler_format_supported(format)) {
- retval |= PIPE_BIND_SAMPLER_VIEW;
- }
-
- if ((usage & (PIPE_BIND_RENDER_TARGET |
- PIPE_BIND_DISPLAY_TARGET |
- PIPE_BIND_SCANOUT |
- PIPE_BIND_SHARED)) &&
- r600_is_colorbuffer_format_supported(format)) {
- retval |= usage &
- (PIPE_BIND_RENDER_TARGET |
- PIPE_BIND_DISPLAY_TARGET |
- PIPE_BIND_SCANOUT |
- PIPE_BIND_SHARED);
- }
-
- if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
- r600_is_zs_format_supported(format)) {
- retval |= PIPE_BIND_DEPTH_STENCIL;
- }
-
- if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
- r600_is_vertex_format_supported(format))
- retval |= PIPE_BIND_VERTEX_BUFFER;
-
- if (usage & PIPE_BIND_TRANSFER_READ)
- retval |= PIPE_BIND_TRANSFER_READ;
- if (usage & PIPE_BIND_TRANSFER_WRITE)
- retval |= PIPE_BIND_TRANSFER_WRITE;
-
- return retval == usage;
-}
-
-static void r600_destroy_screen(struct pipe_screen* pscreen)
-{
- struct r600_screen* rscreen = r600_screen(pscreen);
-
- if (rscreen == NULL)
- return;
- FREE(rscreen);
-}
-
-struct pipe_screen *r600_screen_create(struct radeon *rw)
-{
- struct r600_screen* rscreen;
-
- rscreen = CALLOC_STRUCT(r600_screen);
- if (rscreen == NULL) {
- return NULL;
- }
-
- /* don't enable mem constant for r600 yet */
- rscreen->use_mem_constant = FALSE;
- if (radeon_get_family_class(rw) == EVERGREEN) {
- rscreen->use_mem_constant = TRUE;
- }
-
- radeon_set_mem_constant(rw, rscreen->use_mem_constant);
- rscreen->rw = rw;
- rscreen->screen.winsys = (struct pipe_winsys*)rw;
- rscreen->screen.destroy = r600_destroy_screen;
- rscreen->screen.get_name = r600_get_name;
- rscreen->screen.get_vendor = r600_get_vendor;
- rscreen->screen.get_param = r600_get_param;
- rscreen->screen.get_shader_param = r600_get_shader_param;
- rscreen->screen.get_paramf = r600_get_paramf;
- rscreen->screen.is_format_supported = r600_is_format_supported;
- rscreen->screen.context_create = r600_create_context;
- r600_init_screen_texture_functions(&rscreen->screen);
- r600_init_screen_resource_functions(&rscreen->screen);
- return &rscreen->screen;
-}
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * 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 R600_SCREEN_H
-#define R600_SCREEN_H
-
-#include <pipe/p_state.h>
-#include <pipe/p_screen.h>
-#include <pipebuffer/pb_buffer.h>
-#include <xf86drm.h>
-#include <radeon_drm.h>
-#include "radeon.h"
-#include "util/u_transfer.h"
-#include "r600_resource.h"
-
-/* Texture transfer. */
-struct r600_transfer {
- /* Base class. */
- struct pipe_transfer transfer;
- /* Buffer transfer. */
- struct pipe_transfer *buffer_transfer;
- unsigned offset;
- struct pipe_resource *linear_texture;
-};
-
-struct r600_screen {
- struct pipe_screen screen;
- struct radeon *rw;
- boolean use_mem_constant;
-};
-
-static INLINE struct r600_screen *r600_screen(struct pipe_screen *screen)
-{
- return (struct r600_screen*)screen;
-}
-
-/* Buffer functions. */
-struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
- const struct pipe_resource *templ);
-struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
- void *ptr, unsigned bytes,
- unsigned bind);
-unsigned r600_buffer_is_referenced_by_cs(struct pipe_context *context,
- struct pipe_resource *buf,
- unsigned face, unsigned level);
-struct pipe_resource *r600_buffer_from_handle(struct pipe_screen *screen,
- struct winsys_handle *whandle);
-
-/* r600_texture.c texture transfer functions. */
-struct pipe_transfer* r600_texture_get_transfer(struct pipe_context *ctx,
- struct pipe_resource *texture,
- struct pipe_subresource sr,
- unsigned usage,
- const struct pipe_box *box);
-void r600_texture_transfer_destroy(struct pipe_context *ctx,
- struct pipe_transfer *trans);
-void* r600_texture_transfer_map(struct pipe_context *ctx,
- struct pipe_transfer* transfer);
-void r600_texture_transfer_unmap(struct pipe_context *ctx,
- struct pipe_transfer* transfer);
-
-/* r600_blit.c */
-int r600_blit_uncompress_depth(struct pipe_context *ctx, struct r600_resource_texture *texture);
-
-/* helpers */
-int r600_conv_pipe_format(unsigned pformat, unsigned *format);
-int r600_conv_pipe_prim(unsigned pprim, unsigned *prim);
-
-void r600_init_screen_texture_functions(struct pipe_screen *screen);
-
-#endif
#include "tgsi/tgsi_scan.h"
#include "tgsi/tgsi_dump.h"
#include "util/u_format.h"
-#include "r600_screen.h"
-#include "r600_context.h"
-#include "r600_shader.h"
+#include "r600_pipe.h"
#include "r600_asm.h"
#include "r600_sq.h"
#include "r600_opcodes.h"
#include <stdio.h>
#include <errno.h>
+static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader)
+{
+ struct r600_pipe_state *rstate = &shader->rstate;
+ struct r600_shader *rshader = &shader->shader;
+ unsigned spi_vs_out_id[10];
+ unsigned i, tmp;
+
+ /* clear previous register */
+ rstate->nregs = 0;
+
+ /* so far never got proper semantic id from tgsi */
+ for (i = 0; i < 10; i++) {
+ spi_vs_out_id[i] = 0;
+ }
+ for (i = 0; i < 32; i++) {
+ tmp = i << ((i & 3) * 8);
+ spi_vs_out_id[i / 4] |= tmp;
+ }
+ for (i = 0; i < 10; i++) {
+ r600_pipe_state_add_reg(rstate,
+ R_028614_SPI_VS_OUT_ID_0 + i * 4,
+ spi_vs_out_id[i], 0xFFFFFFFF, NULL);
+ }
+
+ r600_pipe_state_add_reg(rstate,
+ R_0286C4_SPI_VS_OUT_CONFIG,
+ S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2),
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028868_SQ_PGM_RESOURCES_VS,
+ S_028868_NUM_GPRS(rshader->bc.ngpr) |
+ S_028868_STACK_SIZE(rshader->bc.nstack),
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_0288A4_SQ_PGM_RESOURCES_FS,
+ 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_0288D0_SQ_PGM_CF_OFFSET_VS,
+ 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_0288DC_SQ_PGM_CF_OFFSET_FS,
+ 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028858_SQ_PGM_START_VS,
+ r600_bo_offset(shader->bo) >> 8, 0xFFFFFFFF, shader->bo);
+ r600_pipe_state_add_reg(rstate,
+ R_028894_SQ_PGM_START_FS,
+ r600_bo_offset(shader->bo) >> 8, 0xFFFFFFFF, shader->bo);
+
+ r600_pipe_state_add_reg(rstate,
+ R_03E200_SQ_LOOP_CONST_0 + (32 * 4), 0x01000FFF,
+ 0xFFFFFFFF, NULL);
-struct r600_shader_tgsi_instruction;
+}
-struct r600_shader_ctx {
- struct tgsi_shader_info info;
- struct tgsi_parse_context parse;
- const struct tgsi_token *tokens;
- unsigned type;
- unsigned file_offset[TGSI_FILE_COUNT];
- unsigned temp_reg;
- struct r600_shader_tgsi_instruction *inst_info;
- struct r600_bc *bc;
- struct r600_shader *shader;
- u32 value[4];
- u32 *literals;
- u32 nliterals;
- u32 max_driver_temp_used;
-};
+int r600_find_vs_semantic_index(struct r600_shader *vs,
+ struct r600_shader *ps, int id)
+{
+ struct r600_shader_io *input = &ps->input[id];
-struct r600_shader_tgsi_instruction {
- unsigned tgsi_opcode;
- unsigned is_op3;
- unsigned r600_opcode;
- int (*process)(struct r600_shader_ctx *ctx);
-};
+ for (int i = 0; i < vs->noutput; i++) {
+ if (input->name == vs->output[i].name &&
+ input->sid == vs->output[i].sid) {
+ return i - 1;
+ }
+ }
+ return 0;
+}
-static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[], eg_shader_tgsi_instruction[];
-static int tgsi_helper_tempx_replicate(struct r600_shader_ctx *ctx);
+static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_state *rstate = &shader->rstate;
+ struct r600_shader *rshader = &shader->shader;
+ unsigned i, tmp, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z, spi_ps_in_control_1;
+ int pos_index = -1, face_index = -1;
+
+ /* clear previous register */
+ rstate->nregs = 0;
+
+ for (i = 0; i < rshader->ninput; i++) {
+ tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index(&rctx->vs_shader->shader, rshader, i));
+ if (rshader->input[i].centroid)
+ tmp |= S_028644_SEL_CENTROID(1);
+ if (rshader->input[i].interpolate == TGSI_INTERPOLATE_LINEAR)
+ tmp |= S_028644_SEL_LINEAR(1);
+
+ if (rshader->input[i].name == TGSI_SEMANTIC_POSITION)
+ pos_index = i;
+ if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
+ rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
+ rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
+ tmp |= S_028644_FLAT_SHADE(rshader->flat_shade);
+ }
+ if (rshader->input[i].name == TGSI_SEMANTIC_FACE)
+ face_index = i;
+ if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC &&
+ rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) {
+ tmp |= S_028644_PT_SPRITE_TEX(1);
+ }
+ r600_pipe_state_add_reg(rstate, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL);
+ }
+ for (i = 0; i < rshader->noutput; i++) {
+ if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
+ r600_pipe_state_add_reg(rstate,
+ R_02880C_DB_SHADER_CONTROL,
+ S_02880C_Z_EXPORT_ENABLE(1),
+ S_02880C_Z_EXPORT_ENABLE(1), NULL);
+ if (rshader->output[i].name == TGSI_SEMANTIC_STENCIL)
+ r600_pipe_state_add_reg(rstate,
+ R_02880C_DB_SHADER_CONTROL,
+ S_02880C_STENCIL_REF_EXPORT_ENABLE(1),
+ S_02880C_STENCIL_REF_EXPORT_ENABLE(1), NULL);
+ }
+
+ exports_ps = 0;
+ num_cout = 0;
+ for (i = 0; i < rshader->noutput; i++) {
+ if (rshader->output[i].name == TGSI_SEMANTIC_POSITION || rshader->output[i].name == TGSI_SEMANTIC_STENCIL)
+ exports_ps |= 1;
+ else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) {
+ num_cout++;
+ }
+ }
+ exports_ps |= S_028854_EXPORT_COLORS(num_cout);
+ if (!exports_ps) {
+ /* always at least export 1 component per pixel */
+ exports_ps = 2;
+ }
+
+ spi_ps_in_control_0 = S_0286CC_NUM_INTERP(rshader->ninput) |
+ S_0286CC_PERSP_GRADIENT_ENA(1);
+ spi_input_z = 0;
+ if (pos_index != -1) {
+ spi_ps_in_control_0 |= (S_0286CC_POSITION_ENA(1) |
+ S_0286CC_POSITION_CENTROID(rshader->input[pos_index].centroid) |
+ S_0286CC_POSITION_ADDR(rshader->input[pos_index].gpr) |
+ S_0286CC_BARYC_SAMPLE_CNTL(1));
+ spi_input_z |= 1;
+ }
+
+ spi_ps_in_control_1 = 0;
+ if (face_index != -1) {
+ spi_ps_in_control_1 |= S_0286D0_FRONT_FACE_ENA(1) |
+ S_0286D0_FRONT_FACE_ADDR(rshader->input[face_index].gpr);
+ }
+
+ r600_pipe_state_add_reg(rstate, R_0286CC_SPI_PS_IN_CONTROL_0, spi_ps_in_control_0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0286D0_SPI_PS_IN_CONTROL_1, spi_ps_in_control_1, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028840_SQ_PGM_START_PS,
+ r600_bo_offset(shader->bo) >> 8, 0xFFFFFFFF, shader->bo);
+ r600_pipe_state_add_reg(rstate,
+ R_028850_SQ_PGM_RESOURCES_PS,
+ S_028868_NUM_GPRS(rshader->bc.ngpr) |
+ S_028868_STACK_SIZE(rshader->bc.nstack),
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028854_SQ_PGM_EXPORTS_PS,
+ exports_ps, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_0288CC_SQ_PGM_CF_OFFSET_PS,
+ 0x00000000, 0xFFFFFFFF, NULL);
+
+ if (rshader->uses_kill) {
+ /* only set some bits here, the other bits are set in the dsa state */
+ r600_pipe_state_add_reg(rstate,
+ R_02880C_DB_SHADER_CONTROL,
+ S_02880C_KILL_ENABLE(1),
+ S_02880C_KILL_ENABLE(1), NULL);
+ }
+ r600_pipe_state_add_reg(rstate,
+ R_03E200_SQ_LOOP_CONST_0, 0x01000FFF,
+ 0xFFFFFFFF, NULL);
+}
-/* called from hw states files to find VS->FS mapping */
-int r600_find_vs_semantic_index(struct r600_context *rctx, struct r600_shader *rshader, int id)
+static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader)
{
- int i;
- struct r600_shader *vs = &rctx->vs_shader->shader;
- struct r600_shader_io *input = &rshader->input[id];
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_shader *rshader = &shader->shader;
+ void *ptr;
- for (i = 0; i < vs->noutput; i++) {
- if (input->name == vs->output[i].name &&
- input->sid == vs->output[i].sid) {
- return i - 1;
+ /* copy new shader */
+ if (shader->bo == NULL) {
+ shader->bo = r600_bo(rctx->radeon, rshader->bc.ndw * 4, 4096, 0);
+ if (shader->bo == NULL) {
+ return -ENOMEM;
}
+ ptr = r600_bo_map(rctx->radeon, shader->bo, 0, NULL);
+ memcpy(ptr, rshader->bc.bytecode, rshader->bc.ndw * 4);
+ r600_bo_unmap(rctx->radeon, shader->bo);
}
+ /* build state */
+ rshader->flat_shade = rctx->flatshade;
+ switch (rshader->processor_type) {
+ case TGSI_PROCESSOR_VERTEX:
+ if (rshader->family >= CHIP_CEDAR) {
+ evergreen_pipe_shader_vs(ctx, shader);
+ } else {
+ r600_pipe_shader_vs(ctx, shader);
+ }
+ break;
+ case TGSI_PROCESSOR_FRAGMENT:
+ if (rshader->family >= CHIP_CEDAR) {
+ evergreen_pipe_shader_ps(ctx, shader);
+ } else {
+ r600_pipe_shader_ps(ctx, shader);
+ }
+ break;
+ default:
+ return -EINVAL;
+ }
+ r600_context_pipe_state_set(&rctx->ctx, &shader->rstate);
return 0;
}
-static int r600_shader_update(struct pipe_context *ctx, struct r600_shader *shader)
+static int r600_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *rshader)
{
- struct r600_context *rctx = r600_context(ctx);
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_shader *shader = &rshader->shader;
const struct util_format_description *desc;
enum pipe_format resource_format[160];
unsigned i, nresources = 0;
if (shader->processor_type != TGSI_PROCESSOR_VERTEX)
return 0;
+ /* doing a full memcmp fell over the refcount */
+ if ((rshader->vertex_elements.count == rctx->vertex_elements->count) &&
+ (!memcmp(&rshader->vertex_elements.elements, &rctx->vertex_elements->elements, 32 * sizeof(struct pipe_vertex_element)))) {
+ return 0;
+ }
+ rshader->vertex_elements = *rctx->vertex_elements;
for (i = 0; i < rctx->vertex_elements->count; i++) {
resource_format[nresources++] = rctx->vertex_elements->elements[i].src_format;
}
+ r600_bo_reference(rctx->radeon, &rshader->bo, NULL);
LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
switch (cf->inst) {
case V_SQ_CF_WORD1_SQ_CF_INST_VTX:
return r600_bc_build(&shader->bc);
}
-int r600_pipe_shader_create(struct pipe_context *ctx,
- struct r600_context_state *rpshader,
- const struct tgsi_token *tokens)
+int r600_pipe_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *shader)
{
- struct r600_screen *rscreen = r600_screen(ctx->screen);
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ int r;
+
+ if (shader == NULL)
+ return -EINVAL;
+ /* there should be enough input */
+ if (rctx->vertex_elements->count < shader->shader.bc.nresource) {
+ R600_ERR("%d resources provided, expecting %d\n",
+ rctx->vertex_elements->count, shader->shader.bc.nresource);
+ return -EINVAL;
+ }
+ r = r600_shader_update(ctx, shader);
+ if (r)
+ return r;
+ return r600_pipe_shader(ctx, shader);
+}
+
+int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader);
+int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
int r;
//fprintf(stderr, "--------------------------------------------------------------\n");
//tgsi_dump(tokens, 0);
- if (rpshader == NULL)
- return -ENOMEM;
- rpshader->shader.family = radeon_get_family(rscreen->rw);
- rpshader->shader.use_mem_constant = rscreen->use_mem_constant;
- r = r600_shader_from_tgsi(tokens, &rpshader->shader);
+ shader->shader.family = r600_get_family(rctx->radeon);
+ r = r600_shader_from_tgsi(tokens, &shader->shader);
if (r) {
R600_ERR("translation from TGSI failed !\n");
return r;
}
- r = r600_bc_build(&rpshader->shader.bc);
+ r = r600_bc_build(&shader->shader.bc);
if (r) {
R600_ERR("building bytecode failed !\n");
return r;
return 0;
}
-static int r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_context_state *rpshader)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct radeon_state *state;
-
- state = &rpshader->rstate[0];
- radeon_state_fini(&rpshader->rstate[0]);
-
- return rctx->vtbl->vs_shader(rctx, rpshader, state);
-}
-
-static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_state *rpshader)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct radeon_state *state;
-
- state = &rpshader->rstate[0];
- radeon_state_fini(state);
-
- return rctx->vtbl->ps_shader(rctx, rpshader, state);
-}
-
-static int r600_pipe_shader(struct pipe_context *ctx, struct r600_context_state *rpshader)
-{
- struct r600_screen *rscreen = r600_screen(ctx->screen);
- struct r600_context *rctx = r600_context(ctx);
- struct r600_shader *rshader = &rpshader->shader;
- int r;
- void *data;
+/*
+ * tgsi -> r600 shader
+ */
+struct r600_shader_tgsi_instruction;
- /* copy new shader */
- radeon_ws_bo_reference(rscreen->rw, &rpshader->bo, NULL);
- rpshader->bo = NULL;
- rpshader->bo = radeon_ws_bo(rscreen->rw, rshader->bc.ndw * 4,
- 4096, 0);
- if (rpshader->bo == NULL) {
- return -ENOMEM;
- }
- data = radeon_ws_bo_map(rscreen->rw, rpshader->bo, 0, ctx);
- memcpy(data, rshader->bc.bytecode, rshader->bc.ndw * 4);
- radeon_ws_bo_unmap(rscreen->rw, rpshader->bo);
- /* build state */
- rshader->flat_shade = rctx->flat_shade;
- switch (rshader->processor_type) {
- case TGSI_PROCESSOR_VERTEX:
- r = r600_pipe_shader_vs(ctx, rpshader);
- break;
- case TGSI_PROCESSOR_FRAGMENT:
- r = r600_pipe_shader_ps(ctx, rpshader);
- break;
- default:
- r = -EINVAL;
- break;
- }
- return r;
-}
+struct r600_shader_ctx {
+ struct tgsi_shader_info info;
+ struct tgsi_parse_context parse;
+ const struct tgsi_token *tokens;
+ unsigned type;
+ unsigned file_offset[TGSI_FILE_COUNT];
+ unsigned temp_reg;
+ struct r600_shader_tgsi_instruction *inst_info;
+ struct r600_bc *bc;
+ struct r600_shader *shader;
+ u32 value[4];
+ u32 *literals;
+ u32 nliterals;
+ u32 max_driver_temp_used;
+ /* needed for evergreen interpolation */
+ boolean input_centroid;
+ boolean input_linear;
+ boolean input_perspective;
+ int num_interp_gpr;
+};
-int r600_pipe_shader_update(struct pipe_context *ctx, struct r600_context_state *rpshader)
-{
- struct r600_context *rctx = r600_context(ctx);
- int r;
+struct r600_shader_tgsi_instruction {
+ unsigned tgsi_opcode;
+ unsigned is_op3;
+ unsigned r600_opcode;
+ int (*process)(struct r600_shader_ctx *ctx);
+};
- if (rpshader == NULL)
- return -EINVAL;
- /* there should be enough input */
- if (rctx->vertex_elements->count < rpshader->shader.bc.nresource) {
- R600_ERR("%d resources provided, expecting %d\n",
- rctx->vertex_elements->count, rpshader->shader.bc.nresource);
- return -EINVAL;
- }
- r = r600_shader_update(ctx, &rpshader->shader);
- if (r)
- return r;
- return r600_pipe_shader(ctx, rpshader);
-}
+static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[], eg_shader_tgsi_instruction[];
+static int tgsi_helper_tempx_replicate(struct r600_shader_ctx *ctx);
static int tgsi_is_supported(struct r600_shader_ctx *ctx)
{
}
#endif
for (j = 0; j < i->Instruction.NumSrcRegs; j++) {
- if (i->Src[j].Register.Dimension ||
- i->Src[j].Register.Absolute) {
- R600_ERR("unsupported src %d (dimension %d|absolute %d)\n", j,
- i->Src[j].Register.Dimension,
- i->Src[j].Register.Absolute);
+ if (i->Src[j].Register.Dimension) {
+ R600_ERR("unsupported src %d (dimension %d)\n", j,
+ i->Src[j].Register.Dimension);
return -EINVAL;
}
}
return 0;
}
-static int evergreen_interp_alu(struct r600_shader_ctx *ctx, int gpr)
+static int evergreen_interp_alu(struct r600_shader_ctx *ctx, int input)
{
int i, r;
struct r600_bc_alu alu;
+ int gpr = 0, base_chan = 0;
+ int ij_index = 0;
+
+ if (ctx->shader->input[input].interpolate == TGSI_INTERPOLATE_PERSPECTIVE) {
+ ij_index = 0;
+ if (ctx->shader->input[input].centroid)
+ ij_index++;
+ } else if (ctx->shader->input[input].interpolate == TGSI_INTERPOLATE_LINEAR) {
+ ij_index = 0;
+ /* if we have perspective add one */
+ if (ctx->input_perspective) {
+ ij_index++;
+ /* if we have perspective centroid */
+ if (ctx->input_centroid)
+ ij_index++;
+ }
+ if (ctx->shader->input[input].centroid)
+ ij_index++;
+ }
+
+ /* work out gpr and base_chan from index */
+ gpr = ij_index / 2;
+ base_chan = (2 * (ij_index % 2)) + 1;
for (i = 0; i < 8; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
alu.inst = EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY;
if ((i > 1) && (i < 6)) {
- alu.dst.sel = ctx->shader->input[gpr].gpr;
+ alu.dst.sel = ctx->shader->input[input].gpr;
alu.dst.write = 1;
}
alu.dst.chan = i % 4;
- alu.src[0].chan = (1 - (i % 2));
- alu.src[1].sel = V_SQ_ALU_SRC_PARAM_BASE + gpr;
+
+ alu.src[0].sel = gpr;
+ alu.src[0].chan = (base_chan - (i % 2));
+
+ alu.src[1].sel = V_SQ_ALU_SRC_PARAM_BASE + ctx->shader->input[input].lds_pos;
alu.bank_swizzle_force = SQ_ALU_VEC_210;
if ((i % 4) == 3)
ctx->shader->input[i].name = d->Semantic.Name;
ctx->shader->input[i].sid = d->Semantic.Index;
ctx->shader->input[i].interpolate = d->Declaration.Interpolate;
+ ctx->shader->input[i].centroid = d->Declaration.Centroid;
ctx->shader->input[i].gpr = ctx->file_offset[TGSI_FILE_INPUT] + i;
if (ctx->type == TGSI_PROCESSOR_VERTEX) {
/* turn input into fetch */
vtx.dst_sel_y = 1;
vtx.dst_sel_z = 2;
vtx.dst_sel_w = 3;
+ vtx.use_const_fields = 1;
r = r600_bc_add_vtx(ctx->bc, &vtx);
if (r)
return r;
}
if (ctx->type == TGSI_PROCESSOR_FRAGMENT && ctx->bc->chiprev == 2) {
/* turn input into interpolate on EG */
- evergreen_interp_alu(ctx, i);
+ if (ctx->shader->input[i].name != TGSI_SEMANTIC_POSITION) {
+ if (ctx->shader->input[i].interpolate > 0) {
+ ctx->shader->input[i].lds_pos = ctx->shader->nlds++;
+ evergreen_interp_alu(ctx, i);
+ }
+ }
}
break;
case TGSI_FILE_OUTPUT:
return ctx->temp_reg + ctx->max_driver_temp_used++;
}
+/*
+ * for evergreen we need to scan the shader to find the number of GPRs we need to
+ * reserve for interpolation.
+ *
+ * we need to know if we are going to emit
+ * any centroid inputs
+ * if perspective and linear are required
+*/
+static int evergreen_gpr_count(struct r600_shader_ctx *ctx)
+{
+ int i;
+ int num_baryc;
+
+ ctx->input_linear = FALSE;
+ ctx->input_perspective = FALSE;
+ ctx->input_centroid = FALSE;
+ ctx->num_interp_gpr = 1;
+
+ /* any centroid inputs */
+ for (i = 0; i < ctx->info.num_inputs; i++) {
+ /* skip position/face */
+ if (ctx->info.input_semantic_name[i] == TGSI_SEMANTIC_POSITION ||
+ ctx->info.input_semantic_name[i] == TGSI_SEMANTIC_FACE)
+ continue;
+ if (ctx->info.input_interpolate[i] == TGSI_INTERPOLATE_LINEAR)
+ ctx->input_linear = TRUE;
+ if (ctx->info.input_interpolate[i] == TGSI_INTERPOLATE_PERSPECTIVE)
+ ctx->input_perspective = TRUE;
+ if (ctx->info.input_centroid[i])
+ ctx->input_centroid = TRUE;
+ }
+
+ num_baryc = 0;
+ /* ignoring sample for now */
+ if (ctx->input_perspective)
+ num_baryc++;
+ if (ctx->input_linear)
+ num_baryc++;
+ if (ctx->input_centroid)
+ num_baryc *= 2;
+
+ ctx->num_interp_gpr += (num_baryc + 1) >> 1;
+
+ /* TODO PULL MODEL and LINE STIPPLE, FIXED PT POS */
+ return ctx->num_interp_gpr;
+}
+
int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader)
{
struct tgsi_full_immediate *immediate;
r = r600_bc_init(ctx.bc, shader->family);
if (r)
return r;
- ctx.bc->use_mem_constant = shader->use_mem_constant;
ctx.tokens = tokens;
tgsi_scan_shader(tokens, &ctx.info);
tgsi_parse_init(&ctx.parse, tokens);
if (ctx.type == TGSI_PROCESSOR_VERTEX) {
ctx.file_offset[TGSI_FILE_INPUT] = 1;
}
+ if (ctx.type == TGSI_PROCESSOR_FRAGMENT && ctx.bc->chiprev == 2) {
+ ctx.file_offset[TGSI_FILE_INPUT] = evergreen_gpr_count(&ctx);
+ }
ctx.file_offset[TGSI_FILE_OUTPUT] = ctx.file_offset[TGSI_FILE_INPUT] +
ctx.info.file_count[TGSI_FILE_INPUT];
ctx.file_offset[TGSI_FILE_TEMPORARY] = ctx.file_offset[TGSI_FILE_OUTPUT] +
ctx.info.file_count[TGSI_FILE_OUTPUT];
- if (ctx.shader->use_mem_constant)
- ctx.file_offset[TGSI_FILE_CONSTANT] = 128;
- else
- ctx.file_offset[TGSI_FILE_CONSTANT] = 256;
+
+ ctx.file_offset[TGSI_FILE_CONSTANT] = 128;
ctx.file_offset[TGSI_FILE_IMMEDIATE] = 253;
ctx.temp_reg = ctx.file_offset[TGSI_FILE_TEMPORARY] +
} else if (shader->output[i].name == TGSI_SEMANTIC_POSITION) {
output[i].array_base = 61;
output[i].swizzle_x = 2;
- output[i].swizzle_y = output[i].swizzle_z = output[i].swizzle_w = 7;
+ output[i].swizzle_y = 7;
+ output[i].swizzle_z = output[i].swizzle_w = 7;
+ output[i].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL;
+ } else if (shader->output[i].name == TGSI_SEMANTIC_STENCIL) {
+ output[i].array_base = 61;
+ output[i].swizzle_x = 7;
+ output[i].swizzle_y = 1;
+ output[i].swizzle_z = output[i].swizzle_w = 7;
output[i].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL;
} else {
R600_ERR("unsupported fragment output name %d\n", shader->output[i].name);
if (tgsi_src->Register.Indirect)
r600_src->rel = V_SQ_REL_RELATIVE;
r600_src->neg = tgsi_src->Register.Negate;
+ r600_src->abs = tgsi_src->Register.Absolute;
r600_src->sel += ctx->file_offset[tgsi_src->Register.File];
return 0;
}
}
}
for (i = 0, j = nconst - 1; i < inst->Instruction.NumSrcRegs; i++) {
- if (inst->Src[j].Register.File == TGSI_FILE_CONSTANT && j > 0) {
+ if (j > 0 && inst->Src[i].Register.File == TGSI_FILE_CONSTANT) {
int treg = r600_get_temp(ctx);
for (k = 0; k < 4; k++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
- alu.src[0].sel = r600_src[j].sel;
+ alu.src[0].sel = r600_src[i].sel;
alu.src[0].chan = k;
+ alu.src[0].rel = r600_src[i].rel;
alu.dst.sel = treg;
alu.dst.chan = k;
alu.dst.write = 1;
if (r)
return r;
}
- r600_src[j].sel = treg;
+ r600_src[i].sel = treg;
+ r600_src[i].rel =0;
j--;
}
}
nliteral++;
}
}
- for (i = 0, j = 0; i < inst->Instruction.NumSrcRegs; i++) {
- if (inst->Src[j].Register.File == TGSI_FILE_IMMEDIATE) {
+ for (i = 0, j = nliteral - 1; i < inst->Instruction.NumSrcRegs; i++) {
+ if (j > 0 && inst->Src[i].Register.File == TGSI_FILE_IMMEDIATE) {
int treg = r600_get_temp(ctx);
for (k = 0; k < 4; k++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
- alu.src[0].sel = r600_src[j].sel;
+ alu.src[0].sel = r600_src[i].sel;
alu.src[0].chan = k;
alu.dst.sel = treg;
alu.dst.chan = k;
if (r)
return r;
}
- r = r600_bc_add_literal(ctx->bc, ctx->value);
+ r = r600_bc_add_literal(ctx->bc, &ctx->literals[inst->Src[i].Register.Index * 4]);
if (r)
return r;
- r600_src[j].sel = treg;
- j++;
+ r600_src[i].sel = treg;
+ j--;
}
}
return 0;
}
r = tgsi_split_constant(ctx, r600_src);
+ if (r)
+ return r;
+ r = tgsi_split_literal_constant(ctx, r600_src);
if (r)
return r;
for (i = 0; i < lasti + 1; i++) {
memset(lit_vals, 0, 4*4);
r = tgsi_split_constant(ctx, r600_src);
+ if (r)
+ return r;
+ r = tgsi_split_literal_constant(ctx, r600_src);
if (r)
return r;
return tgsi_helper_tempx_replicate(ctx);
}
-static int tgsi_trans(struct r600_shader_ctx *ctx)
-{
- struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
- struct r600_bc_alu alu;
- int i, j, r;
-
- for (i = 0; i < 4; i++) {
- memset(&alu, 0, sizeof(struct r600_bc_alu));
- if (inst->Dst[0].Register.WriteMask & (1 << i)) {
- alu.inst = ctx->inst_info->r600_opcode;
- for (j = 0; j < inst->Instruction.NumSrcRegs; j++) {
- r = tgsi_src(ctx, &inst->Src[j], &alu.src[j]);
- if (r)
- return r;
- alu.src[j].chan = tgsi_chan(&inst->Src[j], i);
- }
- r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
- if (r)
- return r;
- alu.last = 1;
- r = r600_bc_add_alu(ctx->bc, &alu);
- if (r)
- return r;
- }
- }
- return 0;
-}
-
static int tgsi_helper_tempx_replicate(struct r600_shader_ctx *ctx)
{
struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
int i, r;
r = tgsi_split_constant(ctx, r600_src);
+ if (r)
+ return r;
+ r = tgsi_split_literal_constant(ctx, r600_src);
if (r)
return r;
int i, j, r;
r = tgsi_split_constant(ctx, r600_src);
+ if (r)
+ return r;
+ r = tgsi_split_literal_constant(ctx, r600_src);
if (r)
return r;
/* do it in 2 step as op3 doesn't support writemask */
int i, j, r;
r = tgsi_split_constant(ctx, r600_src);
+ if (r)
+ return r;
+ r = tgsi_split_literal_constant(ctx, r600_src);
if (r)
return r;
for (i = 0; i < 4; i++) {
r = r600_bc_add_alu(ctx->bc, &alu);
if (r)
return r;
-
+
for (i = 0; i < 3; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL);
memset(&alu, 0, sizeof(struct r600_bc_alu));
alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
alu.src[0].sel = src_gpr;
- alu.src[0].chan = i;
+ alu.src[0].chan = tgsi_chan(&inst->Src[0], i);
alu.dst.sel = ctx->temp_reg;
alu.dst.chan = i;
if (i == 3)
memset(&tex, 0, sizeof(struct r600_bc_tex));
tex.inst = opcode;
- tex.resource_id = ctx->file_offset[inst->Src[1].Register.File] + inst->Src[1].Register.Index;
- tex.sampler_id = tex.resource_id;
+ tex.sampler_id = ctx->file_offset[inst->Src[1].Register.File] + inst->Src[1].Register.Index;
+ tex.resource_id = tex.sampler_id;
+ if (ctx->shader->processor_type == TGSI_PROCESSOR_VERTEX)
+ tex.resource_id += PIPE_MAX_ATTRIBS;
tex.src_gpr = src_gpr;
tex.dst_gpr = ctx->file_offset[inst->Dst[0].Register.File] + inst->Dst[0].Register.Index;
- tex.dst_sel_x = 0;
- tex.dst_sel_y = 1;
- tex.dst_sel_z = 2;
- tex.dst_sel_w = 3;
+ tex.dst_sel_x = (inst->Dst[0].Register.WriteMask & 1) ? 0 : 7;
+ tex.dst_sel_y = (inst->Dst[0].Register.WriteMask & 2) ? 1 : 7;
+ tex.dst_sel_z = (inst->Dst[0].Register.WriteMask & 4) ? 2 : 7;
+ tex.dst_sel_w = (inst->Dst[0].Register.WriteMask & 8) ? 3 : 7;
tex.src_sel_x = 0;
tex.src_sel_y = 1;
tex.src_sel_z = 2;
int r;
r = tgsi_split_constant(ctx, r600_src);
+ if (r)
+ return r;
+ r = tgsi_split_literal_constant(ctx, r600_src);
if (r)
return r;
/* 1 - src0 */
int i, r;
r = tgsi_split_constant(ctx, r600_src);
+ if (r)
+ return r;
+ r = tgsi_split_literal_constant(ctx, r600_src);
if (r)
return r;
r = tgsi_split_constant(ctx, r600_src);
if (r)
return r;
-
+ r = tgsi_split_literal_constant(ctx, r600_src);
+ if (r)
+ return r;
+
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL);
}
/* r6/7 only for now */
-static int tgsi_arl(struct r600_shader_ctx *ctx)
+static int tgsi_eg_arl(struct r600_shader_ctx *ctx)
+{
+ struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
+ struct r600_bc_alu alu;
+ int r;
+
+ memset(&alu, 0, sizeof(struct r600_bc_alu));
+
+ alu.inst = EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT_FLOOR;
+ r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]);
+ if (r)
+ return r;
+ alu.src[0].chan = tgsi_chan(&inst->Src[0], 0);
+ alu.last = 1;
+ alu.dst.chan = 0;
+ alu.dst.sel = ctx->temp_reg;
+ alu.dst.write = 1;
+ r = r600_bc_add_alu_type(ctx->bc, &alu, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU));
+ if (r)
+ return r;
+ memset(&alu, 0, sizeof(struct r600_bc_alu));
+ alu.inst = EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT;
+ r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]);
+ if (r)
+ return r;
+ alu.src[0].sel = ctx->temp_reg;
+ alu.src[0].chan = 0;
+ alu.last = 1;
+ r = r600_bc_add_alu_type(ctx->bc, &alu, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU));
+ if (r)
+ return r;
+ return 0;
+}
+static int tgsi_r600_arl(struct r600_shader_ctx *ctx)
{
/* TODO from r600c, ar values don't persist between clauses */
struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
}
static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = {
- {TGSI_OPCODE_ARL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_arl},
+ {TGSI_OPCODE_ARL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_r600_arl},
{TGSI_OPCODE_MOV, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, tgsi_op2},
{TGSI_OPCODE_LIT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_lit},
{TGSI_OPCODE_NRM, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
{TGSI_OPCODE_DIV, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
{TGSI_OPCODE_DP2, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp},
- {TGSI_OPCODE_TXL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_TXL, 0, SQ_TEX_INST_SAMPLE_L, tgsi_tex},
{TGSI_OPCODE_BRK, 0, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK, tgsi_loop_brk_cont},
{TGSI_OPCODE_IF, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_if},
/* gap */
};
static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction[] = {
- {TGSI_OPCODE_ARL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_ARL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_eg_arl},
{TGSI_OPCODE_MOV, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, tgsi_op2},
{TGSI_OPCODE_LIT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_lit},
{TGSI_OPCODE_RCP, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE, tgsi_trans_srcx_replicate},
{TGSI_OPCODE_NRM, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
{TGSI_OPCODE_DIV, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
{TGSI_OPCODE_DP2, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp},
- {TGSI_OPCODE_TXL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_TXL, 0, SQ_TEX_INST_SAMPLE_L, tgsi_tex},
{TGSI_OPCODE_BRK, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK, tgsi_loop_brk_cont},
{TGSI_OPCODE_IF, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_if},
/* gap */
unsigned done;
int sid;
unsigned interpolate;
+ boolean centroid;
+ unsigned lds_pos; /* for evergreen */
};
struct r600_shader {
boolean flat_shade;
unsigned ninput;
unsigned noutput;
+ unsigned nlds;
struct r600_shader_io input[32];
struct r600_shader_io output[32];
enum radeon_family family;
boolean uses_kill;
- boolean use_mem_constant;
};
int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader);
* 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:
- * Jerome Glisse
+ */
+
+/* TODO:
+ * - fix mask for depth control & cull for query
*/
#include <stdio.h>
#include <errno.h>
-#include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_memory.h"
-#include "util/u_pack_color.h"
-#include "r600_screen.h"
-#include "r600_context.h"
+#include <pipe/p_defines.h>
+#include <pipe/p_state.h>
+#include <pipe/p_context.h>
+#include <tgsi/tgsi_scan.h>
+#include <tgsi/tgsi_parse.h>
+#include <tgsi/tgsi_util.h>
+#include <util/u_double_list.h>
+#include <util/u_pack_color.h>
+#include <util/u_memory.h>
+#include <util/u_inlines.h>
+#include <util/u_upload_mgr.h>
+#include <util/u_index_modify.h>
+#include <util/u_framebuffer.h>
+#include <pipebuffer/pb_buffer.h>
+#include "r600.h"
+#include "r600d.h"
#include "r600_resource.h"
+#include "r600_shader.h"
+#include "r600_pipe.h"
+#include "r600_state_inlines.h"
+
+static void r600_draw_common(struct r600_drawl *draw)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)draw->ctx;
+ struct r600_pipe_state *rstate;
+ struct r600_resource *rbuffer;
+ unsigned i, j, offset, prim;
+ u32 vgt_dma_index_type, vgt_draw_initiator, mask;
+ struct pipe_vertex_buffer *vertex_buffer;
+ struct r600_draw rdraw;
+ struct r600_pipe_state vgt;
+
+ switch (draw->index_size) {
+ case 2:
+ vgt_draw_initiator = 0;
+ vgt_dma_index_type = 0;
+ break;
+ case 4:
+ vgt_draw_initiator = 0;
+ vgt_dma_index_type = 1;
+ break;
+ case 0:
+ vgt_draw_initiator = 2;
+ vgt_dma_index_type = 0;
+ break;
+ default:
+ R600_ERR("unsupported index size %d\n", draw->index_size);
+ return;
+ }
+ if (r600_conv_pipe_prim(draw->mode, &prim))
+ return;
+
+
+ /* rebuild vertex shader if input format changed */
+ if (r600_pipe_shader_update(&rctx->context, rctx->vs_shader))
+ return;
+ if (r600_pipe_shader_update(&rctx->context, rctx->ps_shader))
+ return;
+
+ for (i = 0 ; i < rctx->vertex_elements->count; i++) {
+ uint32_t word2, format;
+
+ rstate = &rctx->vs_resource[i];
+ rstate->id = R600_PIPE_STATE_RESOURCE;
+ rstate->nregs = 0;
+
+ j = rctx->vertex_elements->elements[i].vertex_buffer_index;
+ vertex_buffer = &rctx->vertex_buffer[j];
+ rbuffer = (struct r600_resource*)vertex_buffer->buffer;
+ offset = rctx->vertex_elements->elements[i].src_offset +
+ vertex_buffer->buffer_offset +
+ r600_bo_offset(rbuffer->bo);
+
+ format = r600_translate_vertex_data_type(rctx->vertex_elements->elements[i].src_format);
+
+ word2 = format | S_038008_STRIDE(vertex_buffer->stride);
+
+ r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo);
+ r600_pipe_state_add_reg(rstate, R_038004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_038008_RESOURCE0_WORD2, word2, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_03800C_RESOURCE0_WORD3, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_038010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_038014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_038018_RESOURCE0_WORD6, 0xC0000000, 0xFFFFFFFF, NULL);
+ r600_context_pipe_state_set_vs_resource(&rctx->ctx, rstate, i);
+ }
-static void clean_flush(struct r600_context *rctx, struct radeon_state *flush);
-static int setup_cb_flush(struct r600_context *rctx, struct radeon_state *flush);
-static int setup_db_flush(struct r600_context *rctx, struct radeon_state *flush);
+ mask = 0;
+ for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) {
+ mask |= (0xF << (i * 4));
+ }
+
+ vgt.id = R600_PIPE_STATE_VGT;
+ vgt.nregs = 0;
+ r600_pipe_state_add_reg(&vgt, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt, R_028408_VGT_INDX_OFFSET, draw->index_bias, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt, R_028400_VGT_MAX_VTX_INDX, draw->max_index, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt, R_028404_VGT_MIN_VTX_INDX, draw->min_index, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0xFFFFFFFF, NULL);
+ /* build late state */
+ if (rctx->rasterizer && rctx->framebuffer.zsbuf) {
+ float offset_units = rctx->rasterizer->offset_units;
+ unsigned offset_db_fmt_cntl = 0, depth;
+
+ switch (rctx->framebuffer.zsbuf->texture->format) {
+ case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+ depth = -24;
+ offset_units *= 2.0f;
+ break;
+ case PIPE_FORMAT_Z32_FLOAT:
+ depth = -23;
+ offset_units *= 1.0f;
+ offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1);
+ break;
+ case PIPE_FORMAT_Z16_UNORM:
+ depth = -16;
+ offset_units *= 4.0f;
+ break;
+ default:
+ return;
+ }
+ offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth);
+ r600_pipe_state_add_reg(&vgt,
+ R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE,
+ fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt,
+ R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET,
+ fui(offset_units), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt,
+ R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE,
+ fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt,
+ R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET,
+ fui(offset_units), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&vgt,
+ R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL,
+ offset_db_fmt_cntl, 0xFFFFFFFF, NULL);
+ }
+ r600_context_pipe_state_set(&rctx->ctx, &vgt);
+
+ rdraw.vgt_num_indices = draw->count;
+ rdraw.vgt_num_instances = 1;
+ rdraw.vgt_index_type = vgt_dma_index_type;
+ rdraw.vgt_draw_initiator = vgt_draw_initiator;
+ rdraw.indices = NULL;
+ if (draw->index_buffer) {
+ rbuffer = (struct r600_resource*)draw->index_buffer;
+ rdraw.indices = rbuffer->bo;
+ rdraw.indices_bo_offset = draw->index_buffer_offset;
+ }
+ r600_context_draw(&rctx->ctx, &rdraw);
+}
+
+void r600_translate_index_buffer(struct r600_pipe_context *r600,
+ struct pipe_resource **index_buffer,
+ unsigned *index_size,
+ unsigned *start, unsigned count)
+{
+ switch (*index_size) {
+ case 1:
+ util_shorten_ubyte_elts(&r600->context, index_buffer, 0, *start, count);
+ *index_size = 2;
+ *start = 0;
+ break;
+
+ case 2:
+ if (*start % 2 != 0) {
+ util_rebuild_ushort_elts(&r600->context, index_buffer, 0, *start, count);
+ *start = 0;
+ }
+ break;
-static struct r600_context_state *r600_new_context_state(unsigned type)
+ case 4:
+ break;
+ }
+}
+
+void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
{
- struct r600_context_state *rstate = CALLOC_STRUCT(r600_context_state);
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_drawl draw;
+
+ if (rctx->any_user_vbs) {
+ r600_upload_user_buffers(rctx);
+ rctx->any_user_vbs = FALSE;
+ }
+
+ memset(&draw, 0, sizeof(struct r600_drawl));
+ draw.ctx = ctx;
+ draw.mode = info->mode;
+ draw.start = info->start;
+ draw.count = info->count;
+ if (info->indexed && rctx->index_buffer.buffer) {
+ draw.start += rctx->index_buffer.offset / rctx->index_buffer.index_size;
+ draw.min_index = info->min_index;
+ draw.max_index = info->max_index;
+ draw.index_bias = info->index_bias;
+
+ r600_translate_index_buffer(rctx, &rctx->index_buffer.buffer,
+ &rctx->index_buffer.index_size,
+ &draw.start,
+ info->count);
+
+ draw.index_size = rctx->index_buffer.index_size;
+ pipe_resource_reference(&draw.index_buffer, rctx->index_buffer.buffer);
+ draw.index_buffer_offset = draw.start * draw.index_size;
+ draw.start = 0;
+ r600_upload_index_buffer(rctx, &draw);
+ } else {
+ draw.index_size = 0;
+ draw.index_buffer = NULL;
+ draw.min_index = info->min_index;
+ draw.max_index = info->max_index;
+ draw.index_bias = info->start;
+ }
+ r600_draw_common(&draw);
+
+ pipe_resource_reference(&draw.index_buffer, NULL);
+}
+
+static void r600_set_blend_color(struct pipe_context *ctx,
+ const struct pipe_blend_color *state)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
+
if (rstate == NULL)
- return NULL;
- rstate->type = type;
- rstate->refcount = 1;
- return rstate;
+ return;
+
+ rstate->id = R600_PIPE_STATE_BLEND_COLOR;
+ r600_pipe_state_add_reg(rstate, R_028414_CB_BLEND_RED, fui(state->color[0]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028418_CB_BLEND_GREEN, fui(state->color[1]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), 0xFFFFFFFF, NULL);
+ free(rctx->states[R600_PIPE_STATE_BLEND_COLOR]);
+ rctx->states[R600_PIPE_STATE_BLEND_COLOR] = rstate;
+ r600_context_pipe_state_set(&rctx->ctx, rstate);
}
static void *r600_create_blend_state(struct pipe_context *ctx,
const struct pipe_blend_state *state)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate;
+ struct r600_pipe_blend *blend = CALLOC_STRUCT(r600_pipe_blend);
+ struct r600_pipe_state *rstate;
+ u32 color_control, target_mask;
- rstate = r600_new_context_state(pipe_blend_type);
- rstate->state.blend = *state;
- rctx->vtbl->blend(rctx, &rstate->rstate[0], &rstate->state.blend);
-
+ if (blend == NULL) {
+ return NULL;
+ }
+ rstate = &blend->rstate;
+
+ rstate->id = R600_PIPE_STATE_BLEND;
+
+ target_mask = 0;
+ color_control = S_028808_PER_MRT_BLEND(1);
+ if (state->logicop_enable) {
+ color_control |= (state->logicop_func << 16) | (state->logicop_func << 20);
+ } else {
+ color_control |= (0xcc << 16);
+ }
+ /* we pretend 8 buffer are used, CB_SHADER_MASK will disable unused one */
+ if (state->independent_blend_enable) {
+ for (int i = 0; i < 8; i++) {
+ if (state->rt[i].blend_enable) {
+ color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i);
+ }
+ target_mask |= (state->rt[i].colormask << (4 * i));
+ }
+ } else {
+ for (int i = 0; i < 8; i++) {
+ if (state->rt[0].blend_enable) {
+ color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i);
+ }
+ target_mask |= (state->rt[0].colormask << (4 * i));
+ }
+ }
+ blend->cb_target_mask = target_mask;
+ r600_pipe_state_add_reg(rstate, R_028808_CB_COLOR_CONTROL,
+ color_control, 0xFFFFFFFF, NULL);
+
+ for (int i = 0; i < 8; i++) {
+ unsigned eqRGB = state->rt[i].rgb_func;
+ unsigned srcRGB = state->rt[i].rgb_src_factor;
+ unsigned dstRGB = state->rt[i].rgb_dst_factor;
+
+ unsigned eqA = state->rt[i].alpha_func;
+ unsigned srcA = state->rt[i].alpha_src_factor;
+ unsigned dstA = state->rt[i].alpha_dst_factor;
+ uint32_t bc = 0;
+
+ if (!state->rt[i].blend_enable)
+ continue;
+
+ bc |= S_028804_COLOR_COMB_FCN(r600_translate_blend_function(eqRGB));
+ bc |= S_028804_COLOR_SRCBLEND(r600_translate_blend_factor(srcRGB));
+ bc |= S_028804_COLOR_DESTBLEND(r600_translate_blend_factor(dstRGB));
+
+ if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) {
+ bc |= S_028804_SEPARATE_ALPHA_BLEND(1);
+ bc |= S_028804_ALPHA_COMB_FCN(r600_translate_blend_function(eqA));
+ bc |= S_028804_ALPHA_SRCBLEND(r600_translate_blend_factor(srcA));
+ bc |= S_028804_ALPHA_DESTBLEND(r600_translate_blend_factor(dstA));
+ }
+
+ r600_pipe_state_add_reg(rstate, R_028780_CB_BLEND0_CONTROL + i * 4, bc, 0xFFFFFFFF, NULL);
+ if (i == 0) {
+ r600_pipe_state_add_reg(rstate, R_028804_CB_BLEND_CONTROL, bc, 0xFFFFFFFF, NULL);
+ }
+ }
return rstate;
}
+static void r600_bind_blend_state(struct pipe_context *ctx, void *state)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_blend *blend = (struct r600_pipe_blend *)state;
+ struct r600_pipe_state *rstate;
+
+ if (state == NULL)
+ return;
+ rstate = &blend->rstate;
+ rctx->states[rstate->id] = rstate;
+ rctx->cb_target_mask = blend->cb_target_mask;
+ r600_context_pipe_state_set(&rctx->ctx, rstate);
+}
+
static void *r600_create_dsa_state(struct pipe_context *ctx,
const struct pipe_depth_stencil_alpha_state *state)
{
- struct r600_context_state *rstate;
+ struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
+ unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control;
+ unsigned stencil_ref_mask, stencil_ref_mask_bf, db_render_override, db_render_control;
+
+ if (rstate == NULL) {
+ return NULL;
+ }
+
+ rstate->id = R600_PIPE_STATE_DSA;
+ /* depth TODO some of those db_shader_control field depend on shader adjust mask & add it to shader */
+ /* db_shader_control is 0xFFFFFFBE as Z_EXPORT_ENABLE (bit 0) will be
+ * set by fragment shader if it export Z and KILL_ENABLE (bit 6) will
+ * be set if shader use texkill instruction
+ */
+ db_shader_control = S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z);
+ stencil_ref_mask = 0;
+ stencil_ref_mask_bf = 0;
+ db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) |
+ S_028800_Z_WRITE_ENABLE(state->depth.writemask) |
+ S_028800_ZFUNC(state->depth.func);
+
+ /* stencil */
+ if (state->stencil[0].enabled) {
+ db_depth_control |= S_028800_STENCIL_ENABLE(1);
+ db_depth_control |= S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func));
+ db_depth_control |= S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op));
+ db_depth_control |= S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op));
+ db_depth_control |= S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op));
+
+
+ stencil_ref_mask = S_028430_STENCILMASK(state->stencil[0].valuemask) |
+ S_028430_STENCILWRITEMASK(state->stencil[0].writemask);
+ if (state->stencil[1].enabled) {
+ db_depth_control |= S_028800_BACKFACE_ENABLE(1);
+ db_depth_control |= S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func));
+ db_depth_control |= S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op));
+ db_depth_control |= S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op));
+ db_depth_control |= S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op));
+ stencil_ref_mask_bf = S_028434_STENCILMASK_BF(state->stencil[1].valuemask) |
+ S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask);
+ }
+ }
+
+ /* alpha */
+ alpha_test_control = 0;
+ alpha_ref = 0;
+ if (state->alpha.enabled) {
+ alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func);
+ alpha_test_control |= S_028410_ALPHA_TEST_ENABLE(1);
+ alpha_ref = fui(state->alpha.ref_value);
+ }
+
+ /* misc */
+ db_render_control = 0;
+ db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) |
+ S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) |
+ S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE);
+ /* TODO db_render_override depends on query */
+ r600_pipe_state_add_reg(rstate, R_028028_DB_STENCIL_CLEAR, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02802C_DB_DEPTH_CLEAR, 0x3F800000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028410_SX_ALPHA_TEST_CONTROL, alpha_test_control, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028430_DB_STENCILREFMASK, stencil_ref_mask,
+ 0xFFFFFFFF & C_028430_STENCILREF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028434_DB_STENCILREFMASK_BF, stencil_ref_mask_bf,
+ 0xFFFFFFFF & C_028434_STENCILREF_BF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028438_SX_ALPHA_REF, alpha_ref, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0286E0_SPI_FOG_FUNC_SCALE, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0286E4_SPI_FOG_FUNC_BIAS, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0286DC_SPI_FOG_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028800_DB_DEPTH_CONTROL, db_depth_control, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02880C_DB_SHADER_CONTROL, db_shader_control, 0xFFFFFFBE, NULL);
+ r600_pipe_state_add_reg(rstate, R_028D0C_DB_RENDER_CONTROL, db_render_control, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028D10_DB_RENDER_OVERRIDE, db_render_override, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028D2C_DB_SRESULTS_COMPARE_STATE1, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028D30_DB_PRELOAD_CONTROL, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028D44_DB_ALPHA_TO_MASK, 0x0000AA00, 0xFFFFFFFF, NULL);
- rstate = r600_new_context_state(pipe_dsa_type);
- rstate->state.dsa = *state;
return rstate;
}
static void *r600_create_rs_state(struct pipe_context *ctx,
const struct pipe_rasterizer_state *state)
{
- struct r600_context_state *rstate;
+ struct r600_pipe_rasterizer *rs = CALLOC_STRUCT(r600_pipe_rasterizer);
+ struct r600_pipe_state *rstate;
+ unsigned tmp;
+ unsigned prov_vtx = 1, polygon_dual_mode;
+ unsigned clip_rule;
+
+ if (rs == NULL) {
+ return NULL;
+ }
+
+ rstate = &rs->rstate;
+ rs->flatshade = state->flatshade;
+ rs->sprite_coord_enable = state->sprite_coord_enable;
+
+ clip_rule = state->scissor ? 0xAAAA : 0xFFFF;
+ /* offset */
+ rs->offset_units = state->offset_units;
+ rs->offset_scale = state->offset_scale * 12.0f;
+
+ rstate->id = R600_PIPE_STATE_RASTERIZER;
+ if (state->flatshade_first)
+ prov_vtx = 0;
+ tmp = 0x00000001;
+ if (state->sprite_coord_enable) {
+ tmp |= S_0286D4_PNT_SPRITE_ENA(1) |
+ S_0286D4_PNT_SPRITE_OVRD_X(2) |
+ S_0286D4_PNT_SPRITE_OVRD_Y(3) |
+ S_0286D4_PNT_SPRITE_OVRD_Z(0) |
+ S_0286D4_PNT_SPRITE_OVRD_W(1);
+ if (state->sprite_coord_mode != PIPE_SPRITE_COORD_UPPER_LEFT) {
+ tmp |= S_0286D4_PNT_SPRITE_TOP_1(1);
+ }
+ }
+ r600_pipe_state_add_reg(rstate, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL);
+
+ polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL ||
+ state->fill_back != PIPE_POLYGON_MODE_FILL);
+ r600_pipe_state_add_reg(rstate, R_028814_PA_SU_SC_MODE_CNTL,
+ S_028814_PROVOKING_VTX_LAST(prov_vtx) |
+ S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) |
+ S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) |
+ S_028814_FACE(!state->front_ccw) |
+ S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) |
+ S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) |
+ S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri) |
+ S_028814_POLY_MODE(polygon_dual_mode) |
+ S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) |
+ S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02881C_PA_CL_VS_OUT_CNTL,
+ S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) |
+ S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028820_PA_CL_NANINF_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
+ /* point size 12.4 fixed point */
+ tmp = (unsigned)(state->point_size * 8.0);
+ r600_pipe_state_add_reg(rstate, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A04_PA_SU_POINT_MINMAX, 0x80000000, 0xFFFFFFFF, NULL);
+
+ tmp = (unsigned)(state->line_width * 8.0);
+ r600_pipe_state_add_reg(rstate, R_028A08_PA_SU_LINE_CNTL, S_028A08_WIDTH(tmp), 0xFFFFFFFF, NULL);
+
+ r600_pipe_state_add_reg(rstate, R_028A0C_PA_SC_LINE_STIPPLE, 0x00000005, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A48_PA_SC_MPASS_PS_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C00_PA_SC_LINE_CNTL, 0x00000400, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02820C_PA_SC_CLIPRECT_RULE, clip_rule, 0xFFFFFFFF, NULL);
- rstate = r600_new_context_state(pipe_rasterizer_type);
- rstate->state.rasterizer = *state;
return rstate;
}
+static void r600_bind_rs_state(struct pipe_context *ctx, void *state)
+{
+ struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+
+ if (state == NULL)
+ return;
+
+ rctx->flatshade = rs->flatshade;
+ rctx->sprite_coord_enable = rs->sprite_coord_enable;
+ rctx->rasterizer = rs;
+
+ rctx->states[rs->rstate.id] = &rs->rstate;
+ r600_context_pipe_state_set(&rctx->ctx, &rs->rstate);
+}
+
+static void r600_delete_rs_state(struct pipe_context *ctx, void *state)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state;
+
+ if (rctx->rasterizer == rs) {
+ rctx->rasterizer = NULL;
+ }
+ if (rctx->states[rs->rstate.id] == &rs->rstate) {
+ rctx->states[rs->rstate.id] = NULL;
+ }
+ free(rs);
+}
+
static void *r600_create_sampler_state(struct pipe_context *ctx,
const struct pipe_sampler_state *state)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate;
+ struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
+ union util_color uc;
+
+ if (rstate == NULL) {
+ return NULL;
+ }
- rstate = r600_new_context_state(pipe_sampler_type);
- rstate->state.sampler = *state;
- rctx->vtbl->sampler(rctx, &rstate->rstate[0], &rstate->state.sampler, 0);
- rctx->vtbl->sampler_border(rctx, &rstate->rstate[1], &rstate->state.sampler, 0);
+ rstate->id = R600_PIPE_STATE_SAMPLER;
+ util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
+ r600_pipe_state_add_reg(rstate, R_03C000_SQ_TEX_SAMPLER_WORD0_0,
+ S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) |
+ S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) |
+ S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) |
+ S_03C000_XY_MAG_FILTER(r600_tex_filter(state->mag_img_filter)) |
+ S_03C000_XY_MIN_FILTER(r600_tex_filter(state->min_img_filter)) |
+ S_03C000_MIP_FILTER(r600_tex_mipfilter(state->min_mip_filter)) |
+ S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) |
+ S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0), 0xFFFFFFFF, NULL);
+ /* FIXME LOD it depends on texture base level ... */
+ r600_pipe_state_add_reg(rstate, R_03C004_SQ_TEX_SAMPLER_WORD1_0,
+ S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) |
+ S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)) |
+ S_03C004_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_03C008_SQ_TEX_SAMPLER_WORD2_0, S_03C008_TYPE(1), 0xFFFFFFFF, NULL);
+ if (uc.ui) {
+ r600_pipe_state_add_reg(rstate, R_00A400_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color[0]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color[1]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color[2]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color[3]), 0xFFFFFFFF, NULL);
+ }
return rstate;
}
-static void r600_remove_sampler_view(struct r600_shader_sampler_states *sampler,
- struct r600_context_state *rstate)
+static void *r600_create_vertex_elements(struct pipe_context *ctx,
+ unsigned count,
+ const struct pipe_vertex_element *elements)
{
- int i, j;
-
- for (i = 0; i < sampler->nview; i++) {
- for (j = 0; j < rstate->nrstate; j++) {
- if (sampler->view[i] == &rstate->rstate[j])
- sampler->view[i] = NULL;
- }
- }
+ struct r600_vertex_element *v = CALLOC_STRUCT(r600_vertex_element);
+
+ assert(count < 32);
+ v->count = count;
+ v->refcount = 1;
+ memcpy(v->elements, elements, count * sizeof(struct pipe_vertex_element));
+ return v;
}
+
static void r600_sampler_view_destroy(struct pipe_context *ctx,
struct pipe_sampler_view *state)
{
- struct r600_context_state *rstate = (struct r600_context_state *)state;
- struct r600_context *rctx = r600_context(ctx);
+ struct r600_pipe_sampler_view *resource = (struct r600_pipe_sampler_view *)state;
- /* need to search list of vs/ps sampler views and remove it from any - uggh */
- r600_remove_sampler_view(&rctx->ps_sampler, rstate);
- r600_remove_sampler_view(&rctx->vs_sampler, rstate);
- r600_context_state_decref(rstate);
+ pipe_resource_reference(&state->texture, NULL);
+ FREE(resource);
}
static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *ctx,
struct pipe_resource *texture,
const struct pipe_sampler_view *state)
{
- struct r600_context_state *rstate;
- struct r600_context *rctx = r600_context(ctx);
+ struct r600_pipe_sampler_view *resource = CALLOC_STRUCT(r600_pipe_sampler_view);
+ struct r600_pipe_state *rstate;
+ const struct util_format_description *desc;
+ struct r600_resource_texture *tmp;
+ struct r600_resource *rbuffer;
+ unsigned format;
+ uint32_t word4 = 0, yuv_format = 0, pitch = 0;
+ unsigned char swizzle[4], array_mode = 0, tile_type = 0;
+ struct r600_bo *bo[2];
- rstate = r600_new_context_state(pipe_sampler_view_type);
- rstate->state.sampler_view = *state;
- rstate->state.sampler_view.texture = NULL;
+ if (resource == NULL)
+ return NULL;
+ rstate = &resource->state;
+
+ /* initialize base object */
+ resource->base = *state;
+ resource->base.texture = NULL;
pipe_reference(NULL, &texture->reference);
- rstate->state.sampler_view.texture = texture;
- rstate->state.sampler_view.reference.count = 1;
- rstate->state.sampler_view.context = ctx;
- rctx->vtbl->resource(ctx, &rstate->rstate[0], &rstate->state.sampler_view, 0);
- return &rstate->state.sampler_view;
+ resource->base.texture = texture;
+ resource->base.reference.count = 1;
+ resource->base.context = ctx;
+
+ swizzle[0] = state->swizzle_r;
+ swizzle[1] = state->swizzle_g;
+ swizzle[2] = state->swizzle_b;
+ swizzle[3] = state->swizzle_a;
+ format = r600_translate_texformat(state->format,
+ swizzle,
+ &word4, &yuv_format);
+ if (format == ~0) {
+ format = 0;
+ }
+ desc = util_format_description(state->format);
+ if (desc == NULL) {
+ R600_ERR("unknow format %d\n", state->format);
+ }
+ tmp = (struct r600_resource_texture*)texture;
+ rbuffer = &tmp->resource;
+ bo[0] = rbuffer->bo;
+ bo[1] = rbuffer->bo;
+ /* FIXME depth texture decompression */
+ if (tmp->depth) {
+ r600_texture_depth_flush(ctx, texture);
+ tmp = (struct r600_resource_texture*)texture;
+ rbuffer = &tmp->flushed_depth_texture->resource;
+ bo[0] = rbuffer->bo;
+ bo[1] = rbuffer->bo;
+ }
+ pitch = align(tmp->pitch_in_pixels[0], 8);
+ if (tmp->tiled) {
+ array_mode = tmp->array_mode;
+ tile_type = tmp->tile_type;
+ }
+
+ /* FIXME properly handle first level != 0 */
+ r600_pipe_state_add_reg(rstate, R_038000_RESOURCE0_WORD0,
+ S_038000_DIM(r600_tex_dim(texture->target)) |
+ S_038000_TILE_MODE(array_mode) |
+ S_038000_TILE_TYPE(tile_type) |
+ S_038000_PITCH((pitch / 8) - 1) |
+ S_038000_TEX_WIDTH(texture->width0 - 1), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_038004_RESOURCE0_WORD1,
+ S_038004_TEX_HEIGHT(texture->height0 - 1) |
+ S_038004_TEX_DEPTH(texture->depth0 - 1) |
+ S_038004_DATA_FORMAT(format), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_038008_RESOURCE0_WORD2,
+ (tmp->offset[0] + r600_bo_offset(bo[0])) >> 8, 0xFFFFFFFF, bo[0]);
+ r600_pipe_state_add_reg(rstate, R_03800C_RESOURCE0_WORD3,
+ (tmp->offset[1] + r600_bo_offset(bo[1])) >> 8, 0xFFFFFFFF, bo[1]);
+ r600_pipe_state_add_reg(rstate, R_038010_RESOURCE0_WORD4,
+ word4 | S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) |
+ S_038010_SRF_MODE_ALL(V_038010_SFR_MODE_NO_ZERO) |
+ S_038010_REQUEST_SIZE(1) |
+ S_038010_BASE_LEVEL(state->first_level), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_038014_RESOURCE0_WORD5,
+ S_038014_LAST_LEVEL(state->last_level) |
+ S_038014_BASE_ARRAY(0) |
+ S_038014_LAST_ARRAY(0), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_038018_RESOURCE0_WORD6,
+ S_038018_TYPE(V_038010_SQ_TEX_VTX_VALID_TEXTURE), 0xFFFFFFFF, NULL);
+
+ return &resource->base;
}
-static void r600_set_sampler_view(struct pipe_context *ctx,
- unsigned count,
- struct pipe_sampler_view **views,
- struct r600_shader_sampler_states *sampler,
- unsigned shader_id)
+static void r600_set_vs_sampler_view(struct pipe_context *ctx, unsigned count,
+ struct pipe_sampler_view **views)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate;
- unsigned i;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views;
- for (i = 0; i < sampler->nview; i++) {
- radeon_draw_unbind(&rctx->draw, sampler->view[i]);
+ for (int i = 0; i < count; i++) {
+ if (resource[i]) {
+ r600_context_pipe_state_set_vs_resource(&rctx->ctx, &resource[i]->state, i + PIPE_MAX_ATTRIBS);
+ }
}
+}
+
+static void r600_set_ps_sampler_view(struct pipe_context *ctx, unsigned count,
+ struct pipe_sampler_view **views)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views;
+ int i;
for (i = 0; i < count; i++) {
- rstate = (struct r600_context_state *)views[i];
- if (rstate) {
- rstate->nrstate = 0;
+ if (&rctx->ps_samplers.views[i]->base != views[i]) {
+ if (resource[i])
+ r600_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i);
+ else
+ r600_context_pipe_state_set_ps_resource(&rctx->ctx, NULL, i);
+
+ pipe_sampler_view_reference(
+ (struct pipe_sampler_view **)&rctx->ps_samplers.views[i],
+ views[i]);
+
}
}
- for (i = 0; i < count; i++) {
- rstate = (struct r600_context_state *)views[i];
- if (rstate) {
- if (rstate->nrstate >= R600_MAX_RSTATE)
- continue;
- if (rstate->nrstate) {
- memcpy(&rstate->rstate[rstate->nrstate], &rstate->rstate[0], sizeof(struct radeon_state));
- }
- radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_RESOURCE, i, shader_id);
- sampler->view[i] = &rstate->rstate[rstate->nrstate];
- rstate->nrstate++;
+ for (i = count; i < NUM_TEX_UNITS; i++) {
+ if (rctx->ps_samplers.views[i]) {
+ r600_context_pipe_state_set_ps_resource(&rctx->ctx, NULL, i);
+ pipe_sampler_view_reference((struct pipe_sampler_view **)&rctx->ps_samplers.views[i], NULL);
}
}
- sampler->nview = count;
+ rctx->ps_samplers.n_views = count;
}
-static void r600_set_ps_sampler_view(struct pipe_context *ctx,
- unsigned count,
- struct pipe_sampler_view **views)
+static void r600_bind_state(struct pipe_context *ctx, void *state)
{
- struct r600_context *rctx = r600_context(ctx);
- r600_set_sampler_view(ctx, count, views, &rctx->ps_sampler, R600_SHADER_PS);
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_state *rstate = (struct r600_pipe_state *)state;
+
+ if (state == NULL)
+ return;
+ rctx->states[rstate->id] = rstate;
+ r600_context_pipe_state_set(&rctx->ctx, rstate);
}
-static void r600_set_vs_sampler_view(struct pipe_context *ctx,
- unsigned count,
- struct pipe_sampler_view **views)
+static void r600_bind_ps_sampler(struct pipe_context *ctx, unsigned count, void **states)
{
- struct r600_context *rctx = r600_context(ctx);
- r600_set_sampler_view(ctx, count, views, &rctx->vs_sampler, R600_SHADER_VS);
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_state **rstates = (struct r600_pipe_state **)states;
+
+ memcpy(rctx->ps_samplers.samplers, states, sizeof(void*) * count);
+ rctx->ps_samplers.n_samplers = count;
+
+ for (int i = 0; i < count; i++) {
+ r600_context_pipe_state_set_ps_sampler(&rctx->ctx, rstates[i], i);
+ }
}
-static void *r600_create_shader_state(struct pipe_context *ctx,
- const struct pipe_shader_state *state)
+static void r600_bind_vs_sampler(struct pipe_context *ctx, unsigned count, void **states)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate;
- int r;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_state **rstates = (struct r600_pipe_state **)states;
- rstate = r600_new_context_state(pipe_shader_type);
- rstate->state.shader = *state;
- r = r600_pipe_shader_create(&rctx->context, rstate, rstate->state.shader.tokens);
- if (r) {
- r600_context_state_decref(rstate);
- return NULL;
+ for (int i = 0; i < count; i++) {
+ r600_context_pipe_state_set_vs_sampler(&rctx->ctx, rstates[i], i);
}
- return rstate;
}
-static void *r600_create_vertex_elements(struct pipe_context *ctx,
- unsigned count,
- const struct pipe_vertex_element *elements)
+static void r600_delete_state(struct pipe_context *ctx, void *state)
{
- struct r600_vertex_element *v = CALLOC_STRUCT(r600_vertex_element);
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_state *rstate = (struct r600_pipe_state *)state;
- assert(count < 32);
- v->count = count;
- memcpy(v->elements, elements, count * sizeof(struct pipe_vertex_element));
- v->refcount = 1;
- return v;
+ if (rctx->states[rstate->id] == rstate) {
+ rctx->states[rstate->id] = NULL;
+ }
+ for (int i = 0; i < rstate->nregs; i++) {
+ r600_bo_reference(rctx->radeon, &rstate->regs[i].bo, NULL);
+ }
+ free(rstate);
}
static void r600_delete_vertex_element(struct pipe_context *ctx, void *state)
free(v);
}
+static void r600_set_clip_state(struct pipe_context *ctx,
+ const struct pipe_clip_state *state)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
+
+ if (rstate == NULL)
+ return;
+
+ rctx->clip = *state;
+ rstate->id = R600_PIPE_STATE_CLIP;
+ for (int i = 0; i < state->nr; i++) {
+ r600_pipe_state_add_reg(rstate,
+ R_028E20_PA_CL_UCP0_X + i * 4,
+ fui(state->ucp[i][0]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028E24_PA_CL_UCP0_Y + i * 4,
+ fui(state->ucp[i][1]) , 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028E28_PA_CL_UCP0_Z + i * 4,
+ fui(state->ucp[i][2]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028E2C_PA_CL_UCP0_W + i * 4,
+ fui(state->ucp[i][3]), 0xFFFFFFFF, NULL);
+ }
+ r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL,
+ S_028810_PS_UCP_MODE(3) | ((1 << state->nr) - 1) |
+ S_028810_ZCLIP_NEAR_DISABLE(state->depth_clamp) |
+ S_028810_ZCLIP_FAR_DISABLE(state->depth_clamp), 0xFFFFFFFF, NULL);
+
+ free(rctx->states[R600_PIPE_STATE_CLIP]);
+ rctx->states[R600_PIPE_STATE_CLIP] = rstate;
+ r600_context_pipe_state_set(&rctx->ctx, rstate);
+}
+
static void r600_bind_vertex_elements(struct pipe_context *ctx, void *state)
{
- struct r600_context *rctx = r600_context(ctx);
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
struct r600_vertex_element *v = (struct r600_vertex_element*)state;
r600_delete_vertex_element(ctx, rctx->vertex_elements);
rctx->vertex_elements = v;
if (v) {
v->refcount++;
+// rctx->vs_rebuild = TRUE;
}
}
-static void r600_bind_rasterizer_state(struct pipe_context *ctx, void *state)
+static void r600_set_polygon_stipple(struct pipe_context *ctx,
+ const struct pipe_poly_stipple *state)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate = (struct r600_context_state *)state;
-
- if (state == NULL)
- return;
- rctx->rasterizer = r600_context_state_decref(rctx->rasterizer);
- rctx->rasterizer = r600_context_state_incref(rstate);
}
-static void r600_bind_blend_state(struct pipe_context *ctx, void *state)
+static void r600_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate = (struct r600_context_state *)state;
-
- if (state == NULL)
- return;
- rctx->blend = r600_context_state_decref(rctx->blend);
- rctx->blend = r600_context_state_incref(rstate);
-
}
-static void r600_bind_dsa_state(struct pipe_context *ctx, void *state)
+static void r600_set_scissor_state(struct pipe_context *ctx,
+ const struct pipe_scissor_state *state)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate = (struct r600_context_state *)state;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
+ u32 tl, br;
- if (state == NULL)
+ if (rstate == NULL)
return;
- rctx->dsa = r600_context_state_decref(rctx->dsa);
- rctx->dsa = r600_context_state_incref(rstate);
-}
-
-static void r600_bind_ps_shader(struct pipe_context *ctx, void *state)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate = (struct r600_context_state *)state;
-
- rctx->ps_shader = r600_context_state_decref(rctx->ps_shader);
- rctx->ps_shader = r600_context_state_incref(rstate);
-}
-
-static void r600_bind_vs_shader(struct pipe_context *ctx, void *state)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate = (struct r600_context_state *)state;
- rctx->vs_shader = r600_context_state_decref(rctx->vs_shader);
- rctx->vs_shader = r600_context_state_incref(rstate);
+ rstate->id = R600_PIPE_STATE_SCISSOR;
+ tl = S_028240_TL_X(state->minx) | S_028240_TL_Y(state->miny) | S_028240_WINDOW_OFFSET_DISABLE(1);
+ br = S_028244_BR_X(state->maxx) | S_028244_BR_Y(state->maxy);
+ r600_pipe_state_add_reg(rstate,
+ R_028210_PA_SC_CLIPRECT_0_TL, tl,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028214_PA_SC_CLIPRECT_0_BR, br,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028218_PA_SC_CLIPRECT_1_TL, tl,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_02821C_PA_SC_CLIPRECT_1_BR, br,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028220_PA_SC_CLIPRECT_2_TL, tl,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028224_PA_SC_CLIPRECT_2_BR, br,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028228_PA_SC_CLIPRECT_3_TL, tl,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_02822C_PA_SC_CLIPRECT_3_BR, br,
+ 0xFFFFFFFF, NULL);
+
+ free(rctx->states[R600_PIPE_STATE_SCISSOR]);
+ rctx->states[R600_PIPE_STATE_SCISSOR] = rstate;
+ r600_context_pipe_state_set(&rctx->ctx, rstate);
}
-static void r600_bind_sampler_shader(struct pipe_context *ctx,
- unsigned count, void **states,
- struct r600_shader_sampler_states *sampler, unsigned shader_id)
+static void r600_set_stencil_ref(struct pipe_context *ctx,
+ const struct pipe_stencil_ref *state)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate;
- unsigned i;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
+ u32 tmp;
- for (i = 0; i < sampler->nsampler; i++) {
- radeon_draw_unbind(&rctx->draw, sampler->sampler[i]);
- }
- for (i = 0; i < sampler->nborder; i++) {
- radeon_draw_unbind(&rctx->draw, sampler->border[i]);
- }
- for (i = 0; i < count; i++) {
- rstate = (struct r600_context_state *)states[i];
- if (rstate) {
- rstate->nrstate = 0;
- }
- }
- for (i = 0; i < count; i++) {
- rstate = (struct r600_context_state *)states[i];
- if (rstate) {
- if (rstate->nrstate >= R600_MAX_RSTATE)
- continue;
- if (rstate->nrstate) {
- memcpy(&rstate->rstate[rstate->nrstate], &rstate->rstate[0], sizeof(struct radeon_state));
- memcpy(&rstate->rstate[rstate->nrstate+1], &rstate->rstate[1], sizeof(struct radeon_state));
- }
- radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_SAMPLER, i, shader_id);
- radeon_state_convert(&rstate->rstate[rstate->nrstate + 1], R600_STATE_SAMPLER_BORDER, i, shader_id);
- sampler->sampler[i] = &rstate->rstate[rstate->nrstate];
- sampler->border[i] = &rstate->rstate[rstate->nrstate + 1];
- rstate->nrstate += 2;
- }
- }
- sampler->nsampler = count;
- sampler->nborder = count;
-}
+ if (rstate == NULL)
+ return;
-static void r600_bind_ps_sampler(struct pipe_context *ctx,
- unsigned count, void **states)
-{
- struct r600_context *rctx = r600_context(ctx);
- r600_bind_sampler_shader(ctx, count, states, &rctx->ps_sampler, R600_SHADER_PS);
+ rctx->stencil_ref = *state;
+ rstate->id = R600_PIPE_STATE_STENCIL_REF;
+ tmp = S_028430_STENCILREF(state->ref_value[0]);
+ r600_pipe_state_add_reg(rstate,
+ R_028430_DB_STENCILREFMASK, tmp,
+ ~C_028430_STENCILREF, NULL);
+ tmp = S_028434_STENCILREF_BF(state->ref_value[1]);
+ r600_pipe_state_add_reg(rstate,
+ R_028434_DB_STENCILREFMASK_BF, tmp,
+ ~C_028434_STENCILREF_BF, NULL);
+
+ free(rctx->states[R600_PIPE_STATE_STENCIL_REF]);
+ rctx->states[R600_PIPE_STATE_STENCIL_REF] = rstate;
+ r600_context_pipe_state_set(&rctx->ctx, rstate);
}
-static void r600_bind_vs_sampler(struct pipe_context *ctx,
- unsigned count, void **states)
+static void r600_set_viewport_state(struct pipe_context *ctx,
+ const struct pipe_viewport_state *state)
{
- struct r600_context *rctx = r600_context(ctx);
- r600_bind_sampler_shader(ctx, count, states, &rctx->vs_sampler, R600_SHADER_VS);
-}
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
-static void r600_delete_state(struct pipe_context *ctx, void *state)
-{
- struct r600_context_state *rstate = (struct r600_context_state *)state;
+ if (rstate == NULL)
+ return;
- r600_context_state_decref(rstate);
+ rctx->viewport = *state;
+ rstate->id = R600_PIPE_STATE_VIEWPORT;
+ r600_pipe_state_add_reg(rstate, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028818_PA_CL_VTE_CNTL, 0x0000043F, 0xFFFFFFFF, NULL);
+
+ free(rctx->states[R600_PIPE_STATE_VIEWPORT]);
+ rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate;
+ r600_context_pipe_state_set(&rctx->ctx, rstate);
}
-static void r600_set_blend_color(struct pipe_context *ctx,
- const struct pipe_blend_color *color)
+static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate,
+ const struct pipe_framebuffer_state *state, int cb)
{
- struct r600_context *rctx = r600_context(ctx);
-
- rctx->blend_color = *color;
+ struct r600_resource_texture *rtex;
+ struct r600_resource *rbuffer;
+ unsigned level = state->cbufs[cb]->level;
+ unsigned pitch, slice;
+ unsigned color_info;
+ unsigned format, swap, ntype;
+ const struct util_format_description *desc;
+ struct r600_bo *bo[3];
+
+ rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
+ rbuffer = &rtex->resource;
+ bo[0] = rbuffer->bo;
+ bo[1] = rbuffer->bo;
+ bo[2] = rbuffer->bo;
+
+ pitch = rtex->pitch_in_pixels[level] / 8 - 1;
+ slice = rtex->pitch_in_pixels[level] * state->cbufs[cb]->height / 64 - 1;
+ ntype = 0;
+ desc = util_format_description(rtex->resource.base.b.format);
+ if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
+ ntype = V_0280A0_NUMBER_SRGB;
+
+ format = r600_translate_colorformat(rtex->resource.base.b.format);
+ swap = r600_translate_colorswap(rtex->resource.base.b.format);
+ color_info = S_0280A0_FORMAT(format) |
+ S_0280A0_COMP_SWAP(swap) |
+ S_0280A0_ARRAY_MODE(rtex->array_mode) |
+ S_0280A0_BLEND_CLAMP(1) |
+ S_0280A0_NUMBER_TYPE(ntype);
+ if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS)
+ color_info |= S_0280A0_SOURCE_FORMAT(1);
+
+ r600_pipe_state_add_reg(rstate,
+ R_028040_CB_COLOR0_BASE + cb * 4,
+ (state->cbufs[cb]->offset + r600_bo_offset(bo[0])) >> 8, 0xFFFFFFFF, bo[0]);
+ r600_pipe_state_add_reg(rstate,
+ R_0280A0_CB_COLOR0_INFO + cb * 4,
+ color_info, 0xFFFFFFFF, bo[0]);
+ r600_pipe_state_add_reg(rstate,
+ R_028060_CB_COLOR0_SIZE + cb * 4,
+ S_028060_PITCH_TILE_MAX(pitch) |
+ S_028060_SLICE_TILE_MAX(slice),
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028080_CB_COLOR0_VIEW + cb * 4,
+ 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_0280E0_CB_COLOR0_FRAG + cb * 4,
+ r600_bo_offset(bo[1]) >> 8, 0xFFFFFFFF, bo[1]);
+ r600_pipe_state_add_reg(rstate,
+ R_0280C0_CB_COLOR0_TILE + cb * 4,
+ r600_bo_offset(bo[2]) >> 8, 0xFFFFFFFF, bo[2]);
+ r600_pipe_state_add_reg(rstate,
+ R_028100_CB_COLOR0_MASK + cb * 4,
+ 0x00000000, 0xFFFFFFFF, NULL);
}
-static void r600_set_clip_state(struct pipe_context *ctx,
- const struct pipe_clip_state *state)
+static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate,
+ const struct pipe_framebuffer_state *state)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate;
+ struct r600_resource_texture *rtex;
+ struct r600_resource *rbuffer;
+ unsigned level;
+ unsigned pitch, slice, format;
- r600_context_state_decref(rctx->clip);
+ if (state->zsbuf == NULL)
+ return;
- rstate = r600_new_context_state(pipe_clip_type);
- rstate->state.clip = *state;
- rctx->vtbl->ucp(rctx, &rstate->rstate[0], &rstate->state.clip);
- rctx->clip = rstate;
+ rtex = (struct r600_resource_texture*)state->zsbuf->texture;
+ rtex->tiled = 1;
+ rtex->array_mode = 2;
+ rtex->tile_type = 1;
+ rtex->depth = 1;
+ rbuffer = &rtex->resource;
+
+ level = state->zsbuf->level;
+ pitch = rtex->pitch_in_pixels[level] / 8 - 1;
+ slice = rtex->pitch_in_pixels[level] * state->zsbuf->height / 64 - 1;
+ format = r600_translate_dbformat(state->zsbuf->texture->format);
+
+ r600_pipe_state_add_reg(rstate, R_02800C_DB_DEPTH_BASE,
+ (state->zsbuf->offset + r600_bo_offset(rbuffer->bo)) >> 8, 0xFFFFFFFF, rbuffer->bo);
+ r600_pipe_state_add_reg(rstate, R_028000_DB_DEPTH_SIZE,
+ S_028000_PITCH_TILE_MAX(pitch) | S_028000_SLICE_TILE_MAX(slice),
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028004_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028010_DB_DEPTH_INFO,
+ S_028010_ARRAY_MODE(rtex->array_mode) | S_028010_FORMAT(format),
+ 0xFFFFFFFF, rbuffer->bo);
+ r600_pipe_state_add_reg(rstate, R_028D34_DB_PREFETCH_LIMIT,
+ (state->zsbuf->height / 8) - 1, 0xFFFFFFFF, NULL);
}
static void r600_set_framebuffer_state(struct pipe_context *ctx,
const struct pipe_framebuffer_state *state)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate;
- int i;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
+ u32 shader_mask, tl, br, shader_control, target_mask;
- if (rctx->framebuffer) {
- for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++)
- radeon_draw_unbind(&rctx->draw, &rctx->framebuffer->rstate[i+1]);
- radeon_draw_unbind(&rctx->draw, &rctx->framebuffer->rstate[0]);
- }
- clean_flush(rctx, &rctx->hw_states.cb_flush);
- clean_flush(rctx, &rctx->hw_states.db_flush);
- rctx->pframebuffer = NULL;
- r600_context_state_decref(rctx->framebuffer);
+ if (rstate == NULL)
+ return;
- rstate = r600_new_context_state(pipe_framebuffer_type);
- rstate->state.framebuffer = *state;
- for (i = 0; i < rstate->state.framebuffer.nr_cbufs; i++) {
- pipe_reference(NULL, &state->cbufs[i]->reference);
- }
- pipe_reference(NULL, &state->zsbuf->reference);
- rctx->framebuffer = rstate;
- rctx->pframebuffer = &rstate->state.framebuffer;
- for (i = 0; i < state->nr_cbufs; i++) {
- rctx->vtbl->cb(rctx, &rstate->rstate[i+1], state, i);
+ /* unreference old buffer and reference new one */
+ rstate->id = R600_PIPE_STATE_FRAMEBUFFER;
+
+ util_copy_framebuffer_state(&rctx->framebuffer, state);
+
+ rctx->pframebuffer = &rctx->framebuffer;
+
+ /* build states */
+ for (int i = 0; i < state->nr_cbufs; i++) {
+ r600_cb(rctx, rstate, state, i);
}
if (state->zsbuf) {
- rctx->vtbl->db(rctx, &rstate->rstate[0], state);
+ r600_db(rctx, rstate, state);
}
- /* setup flush states */
- setup_cb_flush(rctx, &rctx->hw_states.cb_flush);
- setup_db_flush(rctx, &rctx->hw_states.db_flush);
-
- return;
-}
-
-static void r600_set_polygon_stipple(struct pipe_context *ctx,
- const struct pipe_poly_stipple *state)
-{
-}
-
-static void r600_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask)
-{
-}
-static void r600_set_scissor_state(struct pipe_context *ctx,
- const struct pipe_scissor_state *state)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate;
-
- r600_context_state_decref(rctx->scissor);
+ target_mask = 0x00000000;
+ target_mask = 0xFFFFFFFF;
+ shader_mask = 0;
+ shader_control = 0;
+ for (int i = 0; i < state->nr_cbufs; i++) {
+ target_mask ^= 0xf << (i * 4);
+ shader_mask |= 0xf << (i * 4);
+ shader_control |= 1 << i;
+ }
+ tl = S_028240_TL_X(0) | S_028240_TL_Y(0) | S_028240_WINDOW_OFFSET_DISABLE(1);
+ br = S_028244_BR_X(state->width) | S_028244_BR_Y(state->height);
+
+ r600_pipe_state_add_reg(rstate,
+ R_028030_PA_SC_SCREEN_SCISSOR_TL, tl,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028034_PA_SC_SCREEN_SCISSOR_BR, br,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028204_PA_SC_WINDOW_SCISSOR_TL, tl,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028208_PA_SC_WINDOW_SCISSOR_BR, br,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028240_PA_SC_GENERIC_SCISSOR_TL, tl,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028244_PA_SC_GENERIC_SCISSOR_BR, br,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028250_PA_SC_VPORT_SCISSOR_0_TL, tl,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028254_PA_SC_VPORT_SCISSOR_0_BR, br,
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028200_PA_SC_WINDOW_OFFSET, 0x00000000,
+ 0xFFFFFFFF, NULL);
+ if (rctx->family >= CHIP_RV770) {
+ r600_pipe_state_add_reg(rstate,
+ R_028230_PA_SC_EDGERULE, 0xAAAAAAAA,
+ 0xFFFFFFFF, NULL);
+ }
- rstate = r600_new_context_state(pipe_scissor_type);
- rstate->state.scissor = *state;
- rctx->scissor = rstate;
+ r600_pipe_state_add_reg(rstate, R_0287A0_CB_SHADER_CONTROL,
+ shader_control, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028238_CB_TARGET_MASK,
+ 0x00000000, target_mask, NULL);
+ r600_pipe_state_add_reg(rstate, R_02823C_CB_SHADER_MASK,
+ shader_mask, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C04_PA_SC_AA_CONFIG,
+ 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX,
+ 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX,
+ 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C30_CB_CLRCMP_CONTROL,
+ 0x01000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C34_CB_CLRCMP_SRC,
+ 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C38_CB_CLRCMP_DST,
+ 0x000000FF, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C3C_CB_CLRCMP_MSK,
+ 0xFFFFFFFF, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028C48_PA_SC_AA_MASK,
+ 0xFFFFFFFF, 0xFFFFFFFF, NULL);
+
+ free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]);
+ rctx->states[R600_PIPE_STATE_FRAMEBUFFER] = rstate;
+ r600_context_pipe_state_set(&rctx->ctx, rstate);
}
-static void r600_set_stencil_ref(struct pipe_context *ctx,
- const struct pipe_stencil_ref *state)
+static void r600_set_index_buffer(struct pipe_context *ctx,
+ const struct pipe_index_buffer *ib)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- r600_context_state_decref(rctx->stencil_ref);
+ if (ib) {
+ pipe_resource_reference(&rctx->index_buffer.buffer, ib->buffer);
+ memcpy(&rctx->index_buffer, ib, sizeof(rctx->index_buffer));
+ } else {
+ pipe_resource_reference(&rctx->index_buffer.buffer, NULL);
+ memset(&rctx->index_buffer, 0, sizeof(rctx->index_buffer));
+ }
- rstate = r600_new_context_state(pipe_stencil_ref_type);
- rstate->state.stencil_ref = *state;
- rctx->stencil_ref = rstate;
+ /* TODO make this more like a state */
}
-static void r600_set_vertex_buffers(struct pipe_context *ctx,
- unsigned count,
+static void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count,
const struct pipe_vertex_buffer *buffers)
{
- struct r600_context *rctx = r600_context(ctx);
- unsigned i;
- boolean any_user_buffers = FALSE;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- for (i = 0; i < rctx->nvertex_buffer; i++) {
+ for (int i = 0; i < rctx->nvertex_buffer; i++) {
pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL);
}
memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count);
- for (i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
rctx->vertex_buffer[i].buffer = NULL;
if (r600_buffer_is_user_buffer(buffers[i].buffer))
- any_user_buffers = TRUE;
+ rctx->any_user_vbs = TRUE;
pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer);
}
- rctx->any_user_vbs = any_user_buffers;
rctx->nvertex_buffer = count;
}
-static void r600_set_index_buffer(struct pipe_context *ctx,
- const struct pipe_index_buffer *ib)
+static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index,
+ struct pipe_resource *buffer)
{
- struct r600_context *rctx = r600_context(ctx);
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_resource *rbuffer = (struct r600_resource*)buffer;
+
+ switch (shader) {
+ case PIPE_SHADER_VERTEX:
+ rctx->vs_const_buffer.nregs = 0;
+ r600_pipe_state_add_reg(&rctx->vs_const_buffer,
+ R_028180_ALU_CONST_BUFFER_SIZE_VS_0,
+ ALIGN_DIVUP(buffer->width0 >> 4, 16),
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&rctx->vs_const_buffer,
+ R_028980_ALU_CONST_CACHE_VS_0,
+ r600_bo_offset(rbuffer->bo) >> 8, 0xFFFFFFFF, rbuffer->bo);
+ r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_const_buffer);
+ break;
+ case PIPE_SHADER_FRAGMENT:
+ rctx->ps_const_buffer.nregs = 0;
+ r600_pipe_state_add_reg(&rctx->ps_const_buffer,
+ R_028140_ALU_CONST_BUFFER_SIZE_PS_0,
+ ALIGN_DIVUP(buffer->width0 >> 4, 16),
+ 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(&rctx->ps_const_buffer,
+ R_028940_ALU_CONST_CACHE_PS_0,
+ r600_bo_offset(rbuffer->bo) >> 8, 0xFFFFFFFF, rbuffer->bo);
+ r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_const_buffer);
+ break;
+ default:
+ R600_ERR("unsupported %d\n", shader);
+ return;
+ }
+}
- if (ib) {
- pipe_resource_reference(&rctx->index_buffer.buffer, ib->buffer);
- memcpy(&rctx->index_buffer, ib, sizeof(rctx->index_buffer));
- } else {
- pipe_resource_reference(&rctx->index_buffer.buffer, NULL);
- memset(&rctx->index_buffer, 0, sizeof(rctx->index_buffer));
+static void *r600_create_shader_state(struct pipe_context *ctx,
+ const struct pipe_shader_state *state)
+{
+ struct r600_pipe_shader *shader = CALLOC_STRUCT(r600_pipe_shader);
+ int r;
+
+ r = r600_pipe_shader_create(ctx, shader, state->tokens);
+ if (r) {
+ return NULL;
}
+ return shader;
+}
- /* TODO make this more like a state */
+static void r600_bind_ps_shader(struct pipe_context *ctx, void *state)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+
+ /* TODO delete old shader */
+ rctx->ps_shader = (struct r600_pipe_shader *)state;
}
-static void r600_set_viewport_state(struct pipe_context *ctx,
- const struct pipe_viewport_state *state)
+static void r600_bind_vs_shader(struct pipe_context *ctx, void *state)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate;
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+
+ /* TODO delete old shader */
+ rctx->vs_shader = (struct r600_pipe_shader *)state;
+}
- r600_context_state_decref(rctx->viewport);
+static void r600_delete_ps_shader(struct pipe_context *ctx, void *state)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_shader *shader = (struct r600_pipe_shader *)state;
- rstate = r600_new_context_state(pipe_viewport_type);
- rstate->state.viewport = *state;
- rctx->vtbl->viewport(rctx, &rstate->rstate[0], &rstate->state.viewport);
- rctx->viewport = rstate;
+ if (rctx->ps_shader == shader) {
+ rctx->ps_shader = NULL;
+ }
+ /* TODO proper delete */
+ free(shader);
}
-void r600_init_state_functions(struct r600_context *rctx)
+static void r600_delete_vs_shader(struct pipe_context *ctx, void *state)
+{
+ struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+ struct r600_pipe_shader *shader = (struct r600_pipe_shader *)state;
+
+ if (rctx->vs_shader == shader) {
+ rctx->vs_shader = NULL;
+ }
+ /* TODO proper delete */
+ free(shader);
+}
+
+void r600_init_state_functions(struct r600_pipe_context *rctx)
{
rctx->context.create_blend_state = r600_create_blend_state;
rctx->context.create_depth_stencil_alpha_state = r600_create_dsa_state;
rctx->context.create_vertex_elements_state = r600_create_vertex_elements;
rctx->context.create_vs_state = r600_create_shader_state;
rctx->context.bind_blend_state = r600_bind_blend_state;
- rctx->context.bind_depth_stencil_alpha_state = r600_bind_dsa_state;
+ rctx->context.bind_depth_stencil_alpha_state = r600_bind_state;
rctx->context.bind_fragment_sampler_states = r600_bind_ps_sampler;
rctx->context.bind_fs_state = r600_bind_ps_shader;
- rctx->context.bind_rasterizer_state = r600_bind_rasterizer_state;
+ rctx->context.bind_rasterizer_state = r600_bind_rs_state;
rctx->context.bind_vertex_elements_state = r600_bind_vertex_elements;
rctx->context.bind_vertex_sampler_states = r600_bind_vs_sampler;
rctx->context.bind_vs_state = r600_bind_vs_shader;
rctx->context.delete_blend_state = r600_delete_state;
rctx->context.delete_depth_stencil_alpha_state = r600_delete_state;
- rctx->context.delete_fs_state = r600_delete_state;
- rctx->context.delete_rasterizer_state = r600_delete_state;
+ rctx->context.delete_fs_state = r600_delete_ps_shader;
+ rctx->context.delete_rasterizer_state = r600_delete_rs_state;
rctx->context.delete_sampler_state = r600_delete_state;
rctx->context.delete_vertex_elements_state = r600_delete_vertex_element;
- rctx->context.delete_vs_state = r600_delete_state;
+ rctx->context.delete_vs_state = r600_delete_vs_shader;
rctx->context.set_blend_color = r600_set_blend_color;
rctx->context.set_clip_state = r600_set_clip_state;
-
- if (radeon_get_family_class(rctx->rw) == EVERGREEN)
- rctx->context.set_constant_buffer = eg_set_constant_buffer;
- else if (rctx->screen->use_mem_constant)
- rctx->context.set_constant_buffer = r600_set_constant_buffer_mem;
- else
- rctx->context.set_constant_buffer = r600_set_constant_buffer_file;
-
+ rctx->context.set_constant_buffer = r600_set_constant_buffer;
rctx->context.set_fragment_sampler_views = r600_set_ps_sampler_view;
rctx->context.set_framebuffer_state = r600_set_framebuffer_state;
rctx->context.set_polygon_stipple = r600_set_polygon_stipple;
rctx->context.sampler_view_destroy = r600_sampler_view_destroy;
}
-struct r600_context_state *r600_context_state_incref(struct r600_context_state *rstate)
-{
- if (rstate == NULL)
- return NULL;
- rstate->refcount++;
- return rstate;
-}
-
-struct r600_context_state *r600_context_state_decref(struct r600_context_state *rstate)
+void r600_init_config(struct r600_pipe_context *rctx)
{
- unsigned i;
-
- if (rstate == NULL)
- return NULL;
- if (--rstate->refcount)
- return NULL;
- switch (rstate->type) {
- case pipe_sampler_view_type:
- pipe_resource_reference(&rstate->state.sampler_view.texture, NULL);
- break;
- case pipe_framebuffer_type:
- for (i = 0; i < rstate->state.framebuffer.nr_cbufs; i++) {
- pipe_surface_reference(&rstate->state.framebuffer.cbufs[i], NULL);
- radeon_state_fini(&rstate->rstate[i+1]);
- }
- pipe_surface_reference(&rstate->state.framebuffer.zsbuf, NULL);
+ int ps_prio;
+ int vs_prio;
+ int gs_prio;
+ int es_prio;
+ int num_ps_gprs;
+ int num_vs_gprs;
+ int num_gs_gprs;
+ int num_es_gprs;
+ int num_temp_gprs;
+ int num_ps_threads;
+ int num_vs_threads;
+ int num_gs_threads;
+ int num_es_threads;
+ int num_ps_stack_entries;
+ int num_vs_stack_entries;
+ int num_gs_stack_entries;
+ int num_es_stack_entries;
+ enum radeon_family family;
+ struct r600_pipe_state *rstate = &rctx->config;
+ u32 tmp;
+
+ family = r600_get_family(rctx->radeon);
+ ps_prio = 0;
+ vs_prio = 1;
+ gs_prio = 2;
+ es_prio = 3;
+ switch (family) {
+ case CHIP_R600:
+ num_ps_gprs = 192;
+ num_vs_gprs = 56;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 136;
+ num_vs_threads = 48;
+ num_gs_threads = 4;
+ num_es_threads = 4;
+ num_ps_stack_entries = 128;
+ num_vs_stack_entries = 128;
+ num_gs_stack_entries = 0;
+ num_es_stack_entries = 0;
break;
- case pipe_viewport_type:
- case pipe_depth_type:
- case pipe_rasterizer_type:
- case pipe_poly_stipple_type:
- case pipe_scissor_type:
- case pipe_clip_type:
- case pipe_stencil_type:
- case pipe_alpha_type:
- case pipe_dsa_type:
- case pipe_blend_type:
- case pipe_stencil_ref_type:
- case pipe_shader_type:
- case pipe_sampler_type:
+ case CHIP_RV630:
+ case CHIP_RV635:
+ num_ps_gprs = 84;
+ num_vs_gprs = 36;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 144;
+ num_vs_threads = 40;
+ num_gs_threads = 4;
+ num_es_threads = 4;
+ num_ps_stack_entries = 40;
+ num_vs_stack_entries = 40;
+ num_gs_stack_entries = 32;
+ num_es_stack_entries = 16;
break;
+ case CHIP_RV610:
+ case CHIP_RV620:
+ case CHIP_RS780:
+ case CHIP_RS880:
default:
- R600_ERR("invalid type %d\n", rstate->type);
- return NULL;
- }
- radeon_state_fini(&rstate->rstate[0]);
- FREE(rstate);
- return NULL;
-}
-
-static void r600_bind_shader_sampler(struct r600_context *rctx, struct r600_shader_sampler_states *sampler)
-{
- int i;
-
- for (i = 0; i < sampler->nsampler; i++) {
- if (sampler->sampler[i])
- radeon_draw_bind(&rctx->draw, sampler->sampler[i]);
- }
-
- for (i = 0; i < sampler->nborder; i++) {
- if (sampler->border[i])
- radeon_draw_bind(&rctx->draw, sampler->border[i]);
- }
-
- for (i = 0; i < sampler->nview; i++) {
- if (sampler->view[i])
- radeon_draw_bind(&rctx->draw, sampler->view[i]);
- }
-}
-
-static void clean_flush(struct r600_context *rctx, struct radeon_state *flush)
-{
- struct r600_screen *rscreen = rctx->screen;
- int i;
-
- for (i = 0 ; i < flush->nbo; i++) {
- radeon_ws_bo_reference(rscreen->rw, &flush->bo[i], NULL);
+ num_ps_gprs = 84;
+ num_vs_gprs = 36;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 136;
+ num_vs_threads = 48;
+ num_gs_threads = 4;
+ num_es_threads = 4;
+ num_ps_stack_entries = 40;
+ num_vs_stack_entries = 40;
+ num_gs_stack_entries = 32;
+ num_es_stack_entries = 16;
+ break;
+ case CHIP_RV670:
+ num_ps_gprs = 144;
+ num_vs_gprs = 40;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 136;
+ num_vs_threads = 48;
+ num_gs_threads = 4;
+ num_es_threads = 4;
+ num_ps_stack_entries = 40;
+ num_vs_stack_entries = 40;
+ num_gs_stack_entries = 32;
+ num_es_stack_entries = 16;
+ break;
+ case CHIP_RV770:
+ num_ps_gprs = 192;
+ num_vs_gprs = 56;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 188;
+ num_vs_threads = 60;
+ num_gs_threads = 0;
+ num_es_threads = 0;
+ num_ps_stack_entries = 256;
+ num_vs_stack_entries = 256;
+ num_gs_stack_entries = 0;
+ num_es_stack_entries = 0;
+ break;
+ case CHIP_RV730:
+ case CHIP_RV740:
+ num_ps_gprs = 84;
+ num_vs_gprs = 36;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 188;
+ num_vs_threads = 60;
+ num_gs_threads = 0;
+ num_es_threads = 0;
+ num_ps_stack_entries = 128;
+ num_vs_stack_entries = 128;
+ num_gs_stack_entries = 0;
+ num_es_stack_entries = 0;
+ break;
+ case CHIP_RV710:
+ num_ps_gprs = 192;
+ num_vs_gprs = 56;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 144;
+ num_vs_threads = 48;
+ num_gs_threads = 0;
+ num_es_threads = 0;
+ num_ps_stack_entries = 128;
+ num_vs_stack_entries = 128;
+ num_gs_stack_entries = 0;
+ num_es_stack_entries = 0;
+ break;
}
- flush->nbo = 0;
- radeon_state_fini(flush);
-}
-static int setup_cb_flush(struct r600_context *rctx, struct radeon_state *flush)
-{
- struct r600_screen *rscreen = rctx->screen;
- struct r600_resource_texture *rtex;
- struct r600_resource *rbuffer;
- struct pipe_surface *surf;
- int i;
-
- radeon_state_init(flush, rscreen->rw, R600_STATE_CB_FLUSH, 0, 0);
+ rstate->id = R600_PIPE_STATE_CONFIG;
- for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++) {
- surf = rctx->framebuffer->state.framebuffer.cbufs[i];
-
- rtex = (struct r600_resource_texture*)surf->texture;
- rbuffer = &rtex->resource;
- /* just need to the bo to the flush list */
- radeon_ws_bo_reference(rscreen->rw, &flush->bo[i], rbuffer->bo);
- flush->placement[i] = RADEON_GEM_DOMAIN_VRAM;
+ /* SQ_CONFIG */
+ tmp = 0;
+ switch (family) {
+ case CHIP_RV610:
+ case CHIP_RV620:
+ case CHIP_RS780:
+ case CHIP_RS880:
+ case CHIP_RV710:
+ break;
+ default:
+ tmp |= S_008C00_VC_ENABLE(1);
+ break;
}
- flush->nbo = rctx->framebuffer->state.framebuffer.nr_cbufs;
- return radeon_state_pm4(flush);
-}
-
-static int setup_db_flush(struct r600_context *rctx, struct radeon_state *flush)
-{
- struct r600_screen *rscreen = rctx->screen;
- struct r600_resource_texture *rtex;
- struct r600_resource *rbuffer;
- struct pipe_surface *surf;
-
- surf = rctx->framebuffer->state.framebuffer.zsbuf;
-
- radeon_state_init(flush, rscreen->rw, R600_STATE_DB_FLUSH, 0, 0);
-
- if (surf) {
- rtex = (struct r600_resource_texture*)surf->texture;
- rbuffer = &rtex->resource;
- /* just need to the bo to the flush list */
- radeon_ws_bo_reference(rscreen->rw, &flush->bo[0], rbuffer->bo);
- flush->placement[0] = RADEON_GEM_DOMAIN_VRAM;
-
- flush->nbo = 1;
+ tmp |= S_008C00_DX9_CONSTS(0);
+ tmp |= S_008C00_ALU_INST_PREFER_VECTOR(1);
+ tmp |= S_008C00_PS_PRIO(ps_prio);
+ tmp |= S_008C00_VS_PRIO(vs_prio);
+ tmp |= S_008C00_GS_PRIO(gs_prio);
+ tmp |= S_008C00_ES_PRIO(es_prio);
+ r600_pipe_state_add_reg(rstate, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL);
+
+ /* SQ_GPR_RESOURCE_MGMT_1 */
+ tmp = 0;
+ tmp |= S_008C04_NUM_PS_GPRS(num_ps_gprs);
+ tmp |= S_008C04_NUM_VS_GPRS(num_vs_gprs);
+ tmp |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs);
+ r600_pipe_state_add_reg(rstate, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL);
+
+ /* SQ_GPR_RESOURCE_MGMT_2 */
+ tmp = 0;
+ tmp |= S_008C08_NUM_GS_GPRS(num_gs_gprs);
+ tmp |= S_008C08_NUM_GS_GPRS(num_es_gprs);
+ r600_pipe_state_add_reg(rstate, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL);
+
+ /* SQ_THREAD_RESOURCE_MGMT */
+ tmp = 0;
+ tmp |= S_008C0C_NUM_PS_THREADS(num_ps_threads);
+ tmp |= S_008C0C_NUM_VS_THREADS(num_vs_threads);
+ tmp |= S_008C0C_NUM_GS_THREADS(num_gs_threads);
+ tmp |= S_008C0C_NUM_ES_THREADS(num_es_threads);
+ r600_pipe_state_add_reg(rstate, R_008C0C_SQ_THREAD_RESOURCE_MGMT, tmp, 0xFFFFFFFF, NULL);
+
+ /* SQ_STACK_RESOURCE_MGMT_1 */
+ tmp = 0;
+ tmp |= S_008C10_NUM_PS_STACK_ENTRIES(num_ps_stack_entries);
+ tmp |= S_008C10_NUM_VS_STACK_ENTRIES(num_vs_stack_entries);
+ r600_pipe_state_add_reg(rstate, R_008C10_SQ_STACK_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL);
+
+ /* SQ_STACK_RESOURCE_MGMT_2 */
+ tmp = 0;
+ tmp |= S_008C14_NUM_GS_STACK_ENTRIES(num_gs_stack_entries);
+ tmp |= S_008C14_NUM_ES_STACK_ENTRIES(num_es_stack_entries);
+ r600_pipe_state_add_reg(rstate, R_008C14_SQ_STACK_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL);
+
+ r600_pipe_state_add_reg(rstate, R_009714_VC_ENHANCE, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028350_SX_MISC, 0x00000000, 0xFFFFFFFF, NULL);
+
+ if (family >= CHIP_RV770) {
+ r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x00004000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_009508_TA_CNTL_AUX, 0x07000002, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_009830_DB_DEBUG, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_009838_DB_WATERMARKS, 0x00420204, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0286C8_SPI_THREAD_GROUPING, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A4C_PA_SC_MODE_CNTL, 0x00514002, 0xFFFFFFFF, NULL);
+ } else {
+ r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_009508_TA_CNTL_AUX, 0x07000003, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_009830_DB_DEBUG, 0x82000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_009838_DB_WATERMARKS, 0x01020204, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0286C8_SPI_THREAD_GROUPING, 0x00000001, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A4C_PA_SC_MODE_CNTL, 0x00004012, 0xFFFFFFFF, NULL);
}
- return radeon_state_pm4(flush);
+ r600_pipe_state_add_reg(rstate, R_0288A8_SQ_ESGS_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0288AC_SQ_GSVS_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0288B0_SQ_ESTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0288B4_SQ_GSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0288B8_SQ_VSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0288BC_SQ_PSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0288C0_SQ_FBUF_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0288C4_SQ_REDUC_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_0288C8_SQ_GS_VERT_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A14_VGT_HOS_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A20_VGT_HOS_REUSE_DEPTH, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A24_VGT_GROUP_PRIM_TYPE, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A28_VGT_GROUP_FIRST_DECR, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A2C_VGT_GROUP_DECR, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A30_VGT_GROUP_VECT_0_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A34_VGT_GROUP_VECT_1_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A40_VGT_GS_MODE, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028AB0_VGT_STRMOUT_EN, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028AB4_VGT_REUSE_OFF, 0x00000001, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028AB8_VGT_VTX_CNT_EN, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028B20_VGT_STRMOUT_BUFFER_EN, 0x00000000, 0xFFFFFFFF, NULL);
+
+ r600_pipe_state_add_reg(rstate, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A84_VGT_PRIMITIVEID_EN, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_pipe_state_add_reg(rstate, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0x00000000, 0xFFFFFFFF, NULL);
+ r600_context_pipe_state_set(&rctx->ctx, rstate);
}
-int r600_context_hw_states(struct pipe_context *ctx)
+void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx)
{
- struct r600_context *rctx = r600_context(ctx);
- unsigned i;
-
- /* build new states */
- rctx->vtbl->rasterizer(rctx, &rctx->hw_states.rasterizer);
- rctx->vtbl->scissor(rctx, &rctx->hw_states.scissor);
- rctx->vtbl->dsa(rctx, &rctx->hw_states.dsa);
- rctx->vtbl->cb_cntl(rctx, &rctx->hw_states.cb_cntl);
-
- /* bind states */
- radeon_draw_bind(&rctx->draw, &rctx->config);
-
- radeon_draw_bind(&rctx->draw, &rctx->hw_states.rasterizer);
- radeon_draw_bind(&rctx->draw, &rctx->hw_states.scissor);
- radeon_draw_bind(&rctx->draw, &rctx->hw_states.dsa);
- radeon_draw_bind(&rctx->draw, &rctx->hw_states.cb_cntl);
-
- radeon_draw_bind(&rctx->draw, &rctx->hw_states.db_flush);
- radeon_draw_bind(&rctx->draw, &rctx->hw_states.cb_flush);
-
- if (rctx->viewport) {
- radeon_draw_bind(&rctx->draw, &rctx->viewport->rstate[0]);
- }
- if (rctx->blend) {
- radeon_draw_bind(&rctx->draw, &rctx->blend->rstate[0]);
- }
- if (rctx->clip) {
- radeon_draw_bind(&rctx->draw, &rctx->clip->rstate[0]);
- }
- for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++) {
- radeon_draw_bind(&rctx->draw, &rctx->framebuffer->rstate[i+1]);
- }
- if (rctx->framebuffer->state.framebuffer.zsbuf) {
- radeon_draw_bind(&rctx->draw, &rctx->framebuffer->rstate[0]);
+ struct pipe_depth_stencil_alpha_state dsa;
+ struct r600_pipe_state *rstate;
+ boolean quirk = false;
+
+ if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 ||
+ rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635)
+ quirk = true;
+
+ memset(&dsa, 0, sizeof(dsa));
+
+ if (quirk) {
+ dsa.depth.enabled = 1;
+ dsa.depth.func = PIPE_FUNC_LEQUAL;
+ dsa.stencil[0].enabled = 1;
+ dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
+ dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_KEEP;
+ dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_INCR;
+ dsa.stencil[0].writemask = 0xff;
}
- r600_bind_shader_sampler(rctx, &rctx->vs_sampler);
- r600_bind_shader_sampler(rctx, &rctx->ps_sampler);
-
- return 0;
+ rstate = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa);
+ r600_pipe_state_add_reg(rstate,
+ R_02880C_DB_SHADER_CONTROL,
+ 0x0,
+ S_02880C_DUAL_EXPORT_ENABLE(1), NULL);
+ r600_pipe_state_add_reg(rstate,
+ R_028D0C_DB_RENDER_CONTROL,
+ S_028D0C_DEPTH_COPY_ENABLE(1) |
+ S_028D0C_STENCIL_COPY_ENABLE(1) |
+ S_028D0C_COPY_CENTROID(1),
+ S_028D0C_DEPTH_COPY_ENABLE(1) |
+ S_028D0C_STENCIL_COPY_ENABLE(1) |
+ S_028D0C_COPY_CENTROID(1), NULL);
+ return rstate;
}
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * 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.
- */
-
-/* TODO:
- * - fix mask for depth control & cull for query
- */
-#include <stdio.h>
-#include <errno.h>
-#include <pipe/p_defines.h>
-#include <pipe/p_state.h>
-#include <pipe/p_context.h>
-#include <tgsi/tgsi_scan.h>
-#include <tgsi/tgsi_parse.h>
-#include <tgsi/tgsi_util.h>
-#include <util/u_blitter.h>
-#include <util/u_double_list.h>
-#include <util/u_transfer.h>
-#include <util/u_surface.h>
-#include <util/u_pack_color.h>
-#include <util/u_memory.h>
-#include <util/u_inlines.h>
-#include <util/u_upload_mgr.h>
-#include <util/u_index_modify.h>
-#include <pipebuffer/pb_buffer.h>
-#include "r600.h"
-#include "r600d.h"
-#include "r700_sq.h"
-struct radeon_state {
- unsigned dummy;
-};
-#include "r600_resource.h"
-#include "r600_shader.h"
-#include "r600_pipe.h"
-#include "r600_state_inlines.h"
-
-/* r600_shader.c */
-static void r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_pipe_shader *shader)
-{
- struct r600_pipe_state *rstate = &shader->rstate;
- struct r600_shader *rshader = &shader->shader;
- unsigned spi_vs_out_id[10];
- unsigned i, tmp;
-
- /* clear previous register */
- rstate->nregs = 0;
-
- /* so far never got proper semantic id from tgsi */
- for (i = 0; i < 10; i++) {
- spi_vs_out_id[i] = 0;
- }
- for (i = 0; i < 32; i++) {
- tmp = i << ((i & 3) * 8);
- spi_vs_out_id[i / 4] |= tmp;
- }
- for (i = 0; i < 10; i++) {
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028614_SPI_VS_OUT_ID_0 + i * 4,
- spi_vs_out_id[i], 0xFFFFFFFF, NULL);
- }
-
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_0286C4_SPI_VS_OUT_CONFIG,
- S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2),
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028868_SQ_PGM_RESOURCES_VS,
- S_028868_NUM_GPRS(rshader->bc.ngpr) |
- S_028868_STACK_SIZE(rshader->bc.nstack),
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_0288A4_SQ_PGM_RESOURCES_FS,
- 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_0288D0_SQ_PGM_CF_OFFSET_VS,
- 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_0288DC_SQ_PGM_CF_OFFSET_FS,
- 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028858_SQ_PGM_START_VS,
- 0x00000000, 0xFFFFFFFF, shader->bo);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028894_SQ_PGM_START_FS,
- 0x00000000, 0xFFFFFFFF, shader->bo);
-}
-
-int r600_find_vs_semantic_index2(struct r600_shader *vs,
- struct r600_shader *ps, int id)
-{
- struct r600_shader_io *input = &ps->input[id];
-
- for (int i = 0; i < vs->noutput; i++) {
- if (input->name == vs->output[i].name &&
- input->sid == vs->output[i].sid) {
- return i - 1;
- }
- }
- return 0;
-}
-
-static void r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_pipe_shader *shader)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_state *rstate = &shader->rstate;
- struct r600_shader *rshader = &shader->shader;
- unsigned i, tmp, exports_ps, num_cout, spi_ps_in_control_0, spi_input_z;
- boolean have_pos = FALSE, have_face = FALSE;
-
- /* clear previous register */
- rstate->nregs = 0;
-
- for (i = 0; i < rshader->ninput; i++) {
- tmp = S_028644_SEMANTIC(r600_find_vs_semantic_index2(&rctx->vs_shader->shader, rshader, i));
- tmp |= S_028644_SEL_CENTROID(1);
- if (rshader->input[i].name == TGSI_SEMANTIC_POSITION)
- have_pos = TRUE;
- if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
- rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
- rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
- tmp |= S_028644_FLAT_SHADE(rshader->flat_shade);
- }
- if (rshader->input[i].name == TGSI_SEMANTIC_FACE)
- have_face = TRUE;
- if (rshader->input[i].name == TGSI_SEMANTIC_GENERIC &&
- rctx->sprite_coord_enable & (1 << rshader->input[i].sid)) {
- tmp |= S_028644_PT_SPRITE_TEX(1);
- }
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, tmp, 0xFFFFFFFF, NULL);
- }
- for (i = 0; i < rshader->noutput; i++) {
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_02880C_DB_SHADER_CONTROL,
- S_02880C_Z_EXPORT_ENABLE(1),
- S_02880C_Z_EXPORT_ENABLE(1), NULL);
- }
-
- exports_ps = 0;
- num_cout = 0;
- for (i = 0; i < rshader->noutput; i++) {
- if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
- exports_ps |= 1;
- else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) {
- num_cout++;
- }
- }
- exports_ps |= S_028854_EXPORT_COLORS(num_cout);
- if (!exports_ps) {
- /* always at least export 1 component per pixel */
- exports_ps = 2;
- }
-
- spi_ps_in_control_0 = S_0286CC_NUM_INTERP(rshader->ninput) |
- S_0286CC_PERSP_GRADIENT_ENA(1);
- spi_input_z = 0;
- if (have_pos) {
- spi_ps_in_control_0 |= S_0286CC_POSITION_ENA(1) |
- S_0286CC_BARYC_SAMPLE_CNTL(1);
- spi_input_z |= 1;
- }
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286CC_SPI_PS_IN_CONTROL_0, spi_ps_in_control_0, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D0_SPI_PS_IN_CONTROL_1, S_0286D0_FRONT_FACE_ENA(have_face), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D8_SPI_INPUT_Z, spi_input_z, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028840_SQ_PGM_START_PS,
- 0x00000000, 0xFFFFFFFF, shader->bo);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028850_SQ_PGM_RESOURCES_PS,
- S_028868_NUM_GPRS(rshader->bc.ngpr) |
- S_028868_STACK_SIZE(rshader->bc.nstack),
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028854_SQ_PGM_EXPORTS_PS,
- exports_ps, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_0288CC_SQ_PGM_CF_OFFSET_PS,
- 0x00000000, 0xFFFFFFFF, NULL);
-
- if (rshader->uses_kill) {
- /* only set some bits here, the other bits are set in the dsa state */
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_02880C_DB_SHADER_CONTROL,
- S_02880C_KILL_ENABLE(1),
- S_02880C_KILL_ENABLE(1), NULL);
- }
-}
-
-static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader *shader)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_shader *rshader = &shader->shader;
- void *ptr;
-
- /* copy new shader */
- if (shader->bo == NULL) {
- shader->bo = radeon_ws_bo(rctx->radeon, rshader->bc.ndw * 4, 4096, 0);
- if (shader->bo == NULL) {
- return -ENOMEM;
- }
- ptr = radeon_ws_bo_map(rctx->radeon, shader->bo, 0, NULL);
- memcpy(ptr, rshader->bc.bytecode, rshader->bc.ndw * 4);
- radeon_ws_bo_unmap(rctx->radeon, shader->bo);
- }
- /* build state */
- rshader->flat_shade = rctx->flatshade;
- switch (rshader->processor_type) {
- case TGSI_PROCESSOR_VERTEX:
- if (rshader->family >= CHIP_CEDAR) {
- evergreen_pipe_shader_vs(ctx, shader);
- } else {
- r600_pipe_shader_vs(ctx, shader);
- }
- break;
- case TGSI_PROCESSOR_FRAGMENT:
- if (rshader->family >= CHIP_CEDAR) {
- evergreen_pipe_shader_ps(ctx, shader);
- } else {
- r600_pipe_shader_ps(ctx, shader);
- }
- break;
- default:
- return -EINVAL;
- }
- r600_context_pipe_state_set(&rctx->ctx, &shader->rstate);
- return 0;
-}
-
-static int r600_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *rshader)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_shader *shader = &rshader->shader;
- const struct util_format_description *desc;
- enum pipe_format resource_format[160];
- unsigned i, nresources = 0;
- struct r600_bc *bc = &shader->bc;
- struct r600_bc_cf *cf;
- struct r600_bc_vtx *vtx;
-
- if (shader->processor_type != TGSI_PROCESSOR_VERTEX)
- return 0;
- for (i = 0; i < rctx->vertex_elements->count; i++) {
- resource_format[nresources++] = rctx->vertex_elements->elements[i].src_format;
- }
- radeon_ws_bo_reference(rctx->radeon, &rshader->bo, NULL);
- LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
- switch (cf->inst) {
- case V_SQ_CF_WORD1_SQ_CF_INST_VTX:
- case V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC:
- LIST_FOR_EACH_ENTRY(vtx, &cf->vtx, list) {
- desc = util_format_description(resource_format[vtx->buffer_id]);
- if (desc == NULL) {
- R600_ERR("unknown format %d\n", resource_format[vtx->buffer_id]);
- return -EINVAL;
- }
- vtx->dst_sel_x = desc->swizzle[0];
- vtx->dst_sel_y = desc->swizzle[1];
- vtx->dst_sel_z = desc->swizzle[2];
- vtx->dst_sel_w = desc->swizzle[3];
- }
- break;
- default:
- break;
- }
- }
- return r600_bc_build(&shader->bc);
-}
-
-int r600_pipe_shader_update2(struct pipe_context *ctx, struct r600_pipe_shader *shader)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- int r;
-
- if (shader == NULL)
- return -EINVAL;
- /* there should be enough input */
- if (rctx->vertex_elements->count < shader->shader.bc.nresource) {
- R600_ERR("%d resources provided, expecting %d\n",
- rctx->vertex_elements->count, shader->shader.bc.nresource);
- return -EINVAL;
- }
- r = r600_shader_update(ctx, shader);
- if (r)
- return r;
- return r600_pipe_shader(ctx, shader);
-}
-
-int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader);
-int r600_pipe_shader_create2(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- int r;
-
-//fprintf(stderr, "--------------------------------------------------------------\n");
-//tgsi_dump(tokens, 0);
- shader->shader.family = r600_get_family(rctx->radeon);
- r = r600_shader_from_tgsi(tokens, &shader->shader);
- if (r) {
- R600_ERR("translation from TGSI failed !\n");
- return r;
- }
- r = r600_bc_build(&shader->shader.bc);
- if (r) {
- R600_ERR("building bytecode failed !\n");
- return r;
- }
-//fprintf(stderr, "______________________________________________________________\n");
- return 0;
-}
-/* r600_shader.c END */
-
-static const char* r600_get_vendor(struct pipe_screen* pscreen)
-{
- return "X.Org";
-}
-
-static const char* r600_get_name(struct pipe_screen* pscreen)
-{
- struct r600_screen *rscreen = (struct r600_screen *)pscreen;
- enum radeon_family family = r600_get_family(rscreen->radeon);
-
- if (family >= CHIP_R600 && family < CHIP_RV770)
- return "R600 (HD2XXX,HD3XXX)";
- else
- return "R700 (HD4XXX)";
-}
-
-static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
-{
- switch (param) {
- /* Supported features (boolean caps). */
- case PIPE_CAP_NPOT_TEXTURES:
- case PIPE_CAP_TWO_SIDED_STENCIL:
- case PIPE_CAP_GLSL:
- case PIPE_CAP_DUAL_SOURCE_BLEND:
- case PIPE_CAP_ANISOTROPIC_FILTER:
- case PIPE_CAP_POINT_SPRITE:
- case PIPE_CAP_OCCLUSION_QUERY:
- case PIPE_CAP_TEXTURE_SHADOW_MAP:
- case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
- case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
- case PIPE_CAP_BLEND_EQUATION_SEPARATE:
- case PIPE_CAP_SM3:
- case PIPE_CAP_TEXTURE_SWIZZLE:
- case PIPE_CAP_INDEP_BLEND_ENABLE:
- case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
- case PIPE_CAP_DEPTH_CLAMP:
- return 1;
-
- /* Unsupported features (boolean caps). */
- case PIPE_CAP_TIMER_QUERY:
- case PIPE_CAP_STREAM_OUTPUT:
- case PIPE_CAP_INDEP_BLEND_FUNC: /* FIXME allow this */
- return 0;
-
- /* Texturing. */
- case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
- case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
- case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
- return 14;
- case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
- /* FIXME allow this once infrastructure is there */
- return 0;
- case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
- case PIPE_CAP_MAX_COMBINED_SAMPLERS:
- return 16;
-
- /* Render targets. */
- case PIPE_CAP_MAX_RENDER_TARGETS:
- /* FIXME some r6xx are buggy and can only do 4 */
- return 8;
-
- /* Fragment coordinate conventions. */
- case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
- case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
- return 1;
- case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
- case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
- return 0;
-
- default:
- R600_ERR("r600: unknown param %d\n", param);
- return 0;
- }
-}
-
-static float r600_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param)
-{
- switch (param) {
- case PIPE_CAP_MAX_LINE_WIDTH:
- case PIPE_CAP_MAX_LINE_WIDTH_AA:
- case PIPE_CAP_MAX_POINT_WIDTH:
- case PIPE_CAP_MAX_POINT_WIDTH_AA:
- return 8192.0f;
- case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
- return 16.0f;
- case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
- return 16.0f;
- default:
- R600_ERR("r600: unsupported paramf %d\n", param);
- return 0.0f;
- }
-}
-
-static boolean r600_is_format_supported(struct pipe_screen* screen,
- enum pipe_format format,
- enum pipe_texture_target target,
- unsigned sample_count,
- unsigned usage,
- unsigned geom_flags)
-{
- unsigned retval = 0;
- if (target >= PIPE_MAX_TEXTURE_TYPES) {
- R600_ERR("r600: unsupported texture type %d\n", target);
- return FALSE;
- }
-
- /* Multisample */
- if (sample_count > 1)
- return FALSE;
-
- if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
- r600_is_sampler_format_supported(format)) {
- retval |= PIPE_BIND_SAMPLER_VIEW;
- }
-
- if ((usage & (PIPE_BIND_RENDER_TARGET |
- PIPE_BIND_DISPLAY_TARGET |
- PIPE_BIND_SCANOUT |
- PIPE_BIND_SHARED)) &&
- r600_is_colorbuffer_format_supported(format)) {
- retval |= usage &
- (PIPE_BIND_RENDER_TARGET |
- PIPE_BIND_DISPLAY_TARGET |
- PIPE_BIND_SCANOUT |
- PIPE_BIND_SHARED);
- }
-
- if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
- r600_is_zs_format_supported(format)) {
- retval |= PIPE_BIND_DEPTH_STENCIL;
- }
-
- if ((usage & PIPE_BIND_VERTEX_BUFFER) &&
- r600_is_vertex_format_supported(format))
- retval |= PIPE_BIND_VERTEX_BUFFER;
-
- if (usage & PIPE_BIND_TRANSFER_READ)
- retval |= PIPE_BIND_TRANSFER_READ;
- if (usage & PIPE_BIND_TRANSFER_WRITE)
- retval |= PIPE_BIND_TRANSFER_WRITE;
-
- return retval == usage;
-}
-
-static void r600_destroy_screen(struct pipe_screen* pscreen)
-{
- struct r600_screen *rscreen = (struct r600_screen *)pscreen;
-
- if (rscreen == NULL)
- return;
- FREE(rscreen);
-}
-
-int r600_conv_pipe_prim(unsigned pprim, unsigned *prim);
-static void r600_draw_common(struct r600_drawl *draw)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)draw->ctx;
- struct r600_pipe_state *rstate;
- struct r600_resource *rbuffer;
- unsigned i, j, offset, format, prim;
- u32 vgt_dma_index_type, vgt_draw_initiator, mask;
- struct pipe_vertex_buffer *vertex_buffer;
- struct r600_draw rdraw;
- struct r600_pipe_state vgt;
-
- switch (draw->index_size) {
- case 2:
- vgt_draw_initiator = 0;
- vgt_dma_index_type = 0;
- break;
- case 4:
- vgt_draw_initiator = 0;
- vgt_dma_index_type = 1;
- break;
- case 0:
- vgt_draw_initiator = 2;
- vgt_dma_index_type = 0;
- break;
- default:
- R600_ERR("unsupported index size %d\n", draw->index_size);
- return;
- }
- if (r600_conv_pipe_prim(draw->mode, &prim))
- return;
-
-
- /* rebuild vertex shader if input format changed */
- if (r600_pipe_shader_update2(&rctx->context, rctx->vs_shader))
- return;
- if (r600_pipe_shader_update2(&rctx->context, rctx->ps_shader))
- return;
-
- for (i = 0 ; i < rctx->vertex_elements->count; i++) {
- unsigned num_format = 0, format_comp = 0;
-
- rstate = &rctx->vs_resource[i];
- j = rctx->vertex_elements->elements[i].vertex_buffer_index;
- vertex_buffer = &rctx->vertex_buffer[j];
- rbuffer = (struct r600_resource*)vertex_buffer->buffer;
- offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset;
- format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format);
- rstate->id = R600_PIPE_STATE_RESOURCE;
- rstate->nregs = 0;
-
- r600_translate_vertex_num_format(rctx->vertex_elements->elements[i].src_format, &num_format, &format_comp);
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038000_RESOURCE0_WORD0, offset, 0xFFFFFFFF, rbuffer->bo);
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038004_RESOURCE0_WORD1, rbuffer->size - offset - 1, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE,
- R_038008_RESOURCE0_WORD2,
- S_038008_STRIDE(vertex_buffer->stride) |
- S_038008_DATA_FORMAT(format) |
- S_038008_NUM_FORMAT_ALL(num_format) |
- S_038008_FORMAT_COMP_ALL(format_comp),
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_03800C_RESOURCE0_WORD3, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038010_RESOURCE0_WORD4, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038014_RESOURCE0_WORD5, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038018_RESOURCE0_WORD6, 0xC0000000, 0xFFFFFFFF, NULL);
- r600_context_pipe_state_set_vs_resource(&rctx->ctx, rstate, i);
- }
-
- mask = 0;
- for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) {
- mask |= (0xF << (i * 4));
- }
-
- vgt.id = R600_PIPE_STATE_VGT;
- vgt.nregs = 0;
- r600_pipe_state_add_reg(&vgt, R600_GROUP_CONFIG, R_008958_VGT_PRIMITIVE_TYPE, prim, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028408_VGT_INDX_OFFSET, draw->index_bias, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028400_VGT_MAX_VTX_INDX, draw->max_index, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028404_VGT_MIN_VTX_INDX, draw->min_index, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT, R_028238_CB_TARGET_MASK, rctx->cb_target_mask & mask, 0xFFFFFFFF, NULL);
- /* build late state */
- if (rctx->rasterizer && rctx->framebuffer.zsbuf) {
- float offset_units = rctx->rasterizer->offset_units;
- unsigned offset_db_fmt_cntl = 0, depth;
-
- switch (rctx->framebuffer.zsbuf->texture->format) {
- case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
- depth = -24;
- offset_units *= 2.0f;
- break;
- case PIPE_FORMAT_Z32_FLOAT:
- depth = -23;
- offset_units *= 1.0f;
- offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1);
- break;
- case PIPE_FORMAT_Z16_UNORM:
- depth = -16;
- offset_units *= 4.0f;
- break;
- default:
- return;
- }
- offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth);
- r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT,
- R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE,
- fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT,
- R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET,
- fui(offset_units), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT,
- R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE,
- fui(rctx->rasterizer->offset_scale), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT,
- R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET,
- fui(offset_units), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&vgt, R600_GROUP_CONTEXT,
- R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL,
- offset_db_fmt_cntl, 0xFFFFFFFF, NULL);
- }
- r600_context_pipe_state_set(&rctx->ctx, &vgt);
-
- rdraw.vgt_num_indices = draw->count;
- rdraw.vgt_num_instances = 1;
- rdraw.vgt_index_type = vgt_dma_index_type;
- rdraw.vgt_draw_initiator = vgt_draw_initiator;
- rdraw.indices = NULL;
- if (draw->index_buffer) {
- rbuffer = (struct r600_resource*)draw->index_buffer;
- rdraw.indices = rbuffer->bo;
- rdraw.indices_bo_offset = draw->index_buffer_offset;
- }
- r600_context_draw(&rctx->ctx, &rdraw);
-}
-
-void r600_translate_index_buffer2(struct r600_pipe_context *r600,
- struct pipe_resource **index_buffer,
- unsigned *index_size,
- unsigned *start, unsigned count)
-{
- switch (*index_size) {
- case 1:
- util_shorten_ubyte_elts(&r600->context, index_buffer, 0, *start, count);
- *index_size = 2;
- *start = 0;
- break;
-
- case 2:
- if (*start % 2 != 0) {
- util_rebuild_ushort_elts(&r600->context, index_buffer, 0, *start, count);
- *start = 0;
- }
- break;
-
- case 4:
- break;
- }
-}
-
-static void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info *info)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_drawl draw;
-
- assert(info->index_bias == 0);
-
- if (rctx->any_user_vbs) {
- r600_upload_user_buffers2(rctx);
- rctx->any_user_vbs = FALSE;
- }
-
- memset(&draw, 0, sizeof(struct r600_drawl));
- draw.ctx = ctx;
- draw.mode = info->mode;
- draw.start = info->start;
- draw.count = info->count;
- if (info->indexed && rctx->index_buffer.buffer) {
- draw.start += rctx->index_buffer.offset / rctx->index_buffer.index_size;
- draw.min_index = info->min_index;
- draw.max_index = info->max_index;
- draw.index_bias = info->index_bias;
-
- r600_translate_index_buffer2(rctx, &rctx->index_buffer.buffer,
- &rctx->index_buffer.index_size,
- &draw.start,
- info->count);
-
- draw.index_size = rctx->index_buffer.index_size;
- draw.index_buffer = rctx->index_buffer.buffer;
- draw.index_buffer_offset = draw.start * draw.index_size;
- draw.start = 0;
- r600_upload_index_buffer2(rctx, &draw);
- } else {
- draw.index_size = 0;
- draw.index_buffer = NULL;
- draw.min_index = info->min_index;
- draw.max_index = info->max_index;
- draw.index_bias = info->start;
- }
- r600_draw_common(&draw);
-}
-
-static void r600_flush2(struct pipe_context *ctx, unsigned flags,
- struct pipe_fence_handle **fence)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-#if 0
- static int dc = 0;
- char dname[256];
-#endif
-
- if (!rctx->ctx.pm4_cdwords)
- return;
-
- u_upload_flush(rctx->upload_vb);
- u_upload_flush(rctx->upload_ib);
-
-#if 0
- sprintf(dname, "gallium-%08d.bof", dc);
- if (dc < 20) {
- r600_context_dump_bof(&rctx->ctx, dname);
- R600_ERR("dumped %s\n", dname);
- }
- dc++;
-#endif
- r600_context_flush(&rctx->ctx);
-}
-
-static void r600_destroy_context(struct pipe_context *context)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)context;
-
- r600_context_fini(&rctx->ctx);
- for (int i = 0; i < R600_PIPE_NSTATES; i++) {
- free(rctx->states[i]);
- }
-
- u_upload_destroy(rctx->upload_vb);
- u_upload_destroy(rctx->upload_ib);
-
- FREE(rctx);
-}
-
-static void r600_blitter_save_states(struct pipe_context *ctx)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-
- util_blitter_save_blend(rctx->blitter, rctx->states[R600_PIPE_STATE_BLEND]);
- util_blitter_save_depth_stencil_alpha(rctx->blitter, rctx->states[R600_PIPE_STATE_DSA]);
- if (rctx->states[R600_PIPE_STATE_STENCIL_REF]) {
- util_blitter_save_stencil_ref(rctx->blitter, &rctx->stencil_ref);
- }
- util_blitter_save_rasterizer(rctx->blitter, rctx->states[R600_PIPE_STATE_RASTERIZER]);
- util_blitter_save_fragment_shader(rctx->blitter, rctx->ps_shader);
- util_blitter_save_vertex_shader(rctx->blitter, rctx->vs_shader);
- util_blitter_save_vertex_elements(rctx->blitter, rctx->vertex_elements);
- if (rctx->states[R600_PIPE_STATE_VIEWPORT]) {
- util_blitter_save_viewport(rctx->blitter, &rctx->viewport);
- }
- if (rctx->states[R600_PIPE_STATE_CLIP]) {
- util_blitter_save_clip(rctx->blitter, &rctx->clip);
- }
- util_blitter_save_vertex_buffers(rctx->blitter, rctx->nvertex_buffer, rctx->vertex_buffer);
-
- rctx->vertex_elements = NULL;
-
- /* TODO queries */
-}
-
-int r600_blit_uncompress_depth2(struct pipe_context *ctx, struct r600_resource_texture *texture)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct pipe_framebuffer_state fb = *rctx->pframebuffer;
- struct pipe_surface *zsurf, *cbsurf;
- int level = 0;
- float depth = 1.0f;
-
- for (int i = 0; i < fb.nr_cbufs; i++) {
- fb.cbufs[i] = NULL;
- pipe_surface_reference(&fb.cbufs[i], rctx->pframebuffer->cbufs[i]);
- }
- fb.zsbuf = NULL;
- pipe_surface_reference(&fb.zsbuf, rctx->pframebuffer->zsbuf);
-
- zsurf = ctx->screen->get_tex_surface(ctx->screen, &texture->resource.base.b, 0, level, 0,
- PIPE_BIND_DEPTH_STENCIL);
-
- cbsurf = ctx->screen->get_tex_surface(ctx->screen, texture->flushed_depth_texture, 0, level, 0,
- PIPE_BIND_RENDER_TARGET);
-
- r600_blitter_save_states(ctx);
- util_blitter_save_framebuffer(rctx->blitter, &fb);
-
- if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 ||
- rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635)
- depth = 0.0f;
-
- util_blitter_custom_depth_stencil(rctx->blitter, zsurf, cbsurf, rctx->custom_dsa_flush, depth);
-
- pipe_surface_reference(&zsurf, NULL);
- pipe_surface_reference(&cbsurf, NULL);
- for (int i = 0; i < fb.nr_cbufs; i++) {
- pipe_surface_reference(&fb.cbufs[i], NULL);
- }
- pipe_surface_reference(&fb.zsbuf, NULL);
-
- return 0;
-}
-
-static void r600_clear(struct pipe_context *ctx, unsigned buffers,
- const float *rgba, double depth, unsigned stencil)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct pipe_framebuffer_state *fb = &rctx->framebuffer;
-
- r600_blitter_save_states(ctx);
- util_blitter_clear(rctx->blitter, fb->width, fb->height,
- fb->nr_cbufs, buffers, rgba, depth,
- stencil);
-}
-
-static void r600_clear_render_target(struct pipe_context *ctx,
- struct pipe_surface *dst,
- const float *rgba,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct pipe_framebuffer_state *fb = &rctx->framebuffer;
-
- util_blitter_save_framebuffer(rctx->blitter, fb);
- util_blitter_clear_render_target(rctx->blitter, dst, rgba,
- dstx, dsty, width, height);
-}
-
-static void r600_clear_depth_stencil(struct pipe_context *ctx,
- struct pipe_surface *dst,
- unsigned clear_flags,
- double depth,
- unsigned stencil,
- unsigned dstx, unsigned dsty,
- unsigned width, unsigned height)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct pipe_framebuffer_state *fb = &rctx->framebuffer;
-
- util_blitter_save_framebuffer(rctx->blitter, fb);
- util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil,
- dstx, dsty, width, height);
-}
-
-
-static void r600_resource_copy_region(struct pipe_context *ctx,
- struct pipe_resource *dst,
- struct pipe_subresource subdst,
- unsigned dstx, unsigned dsty, unsigned dstz,
- struct pipe_resource *src,
- struct pipe_subresource subsrc,
- unsigned srcx, unsigned srcy, unsigned srcz,
- unsigned width, unsigned height)
-{
- util_resource_copy_region(ctx, dst, subdst, dstx, dsty, dstz,
- src, subsrc, srcx, srcy, srcz, width, height);
-}
-
-static void r600_init_blit_functions2(struct r600_pipe_context *rctx)
-{
- rctx->context.clear = r600_clear;
- rctx->context.clear_render_target = r600_clear_render_target;
- rctx->context.clear_depth_stencil = r600_clear_depth_stencil;
- rctx->context.resource_copy_region = r600_resource_copy_region;
-}
-
-static void r600_init_context_resource_functions2(struct r600_pipe_context *r600)
-{
- r600->context.get_transfer = u_get_transfer_vtbl;
- r600->context.transfer_map = u_transfer_map_vtbl;
- r600->context.transfer_flush_region = u_transfer_flush_region_vtbl;
- r600->context.transfer_unmap = u_transfer_unmap_vtbl;
- r600->context.transfer_destroy = u_transfer_destroy_vtbl;
- r600->context.transfer_inline_write = u_transfer_inline_write_vtbl;
- r600->context.is_resource_referenced = u_is_resource_referenced_vtbl;
-}
-
-static void r600_set_blend_color(struct pipe_context *ctx,
- const struct pipe_blend_color *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
-
- if (rstate == NULL)
- return;
-
- rstate->id = R600_PIPE_STATE_BLEND_COLOR;
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028414_CB_BLEND_RED, fui(state->color[0]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028418_CB_BLEND_GREEN, fui(state->color[1]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02841C_CB_BLEND_BLUE, fui(state->color[2]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028420_CB_BLEND_ALPHA, fui(state->color[3]), 0xFFFFFFFF, NULL);
- free(rctx->states[R600_PIPE_STATE_BLEND_COLOR]);
- rctx->states[R600_PIPE_STATE_BLEND_COLOR] = rstate;
- r600_context_pipe_state_set(&rctx->ctx, rstate);
-}
-
-static void *r600_create_blend_state(struct pipe_context *ctx,
- const struct pipe_blend_state *state)
-{
- struct r600_pipe_blend *blend = CALLOC_STRUCT(r600_pipe_blend);
- struct r600_pipe_state *rstate;
- u32 color_control, target_mask;
-
- if (blend == NULL) {
- return NULL;
- }
- rstate = &blend->rstate;
-
- rstate->id = R600_PIPE_STATE_BLEND;
-
- target_mask = 0;
- color_control = S_028808_PER_MRT_BLEND(1);
- if (state->logicop_enable) {
- color_control |= (state->logicop_func << 16) | (state->logicop_func << 20);
- } else {
- color_control |= (0xcc << 16);
- }
- /* we pretend 8 buffer are used, CB_SHADER_MASK will disable unused one */
- if (state->independent_blend_enable) {
- for (int i = 0; i < 8; i++) {
- if (state->rt[i].blend_enable) {
- color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i);
- }
- target_mask |= (state->rt[i].colormask << (4 * i));
- }
- } else {
- for (int i = 0; i < 8; i++) {
- if (state->rt[0].blend_enable) {
- color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i);
- }
- target_mask |= (state->rt[0].colormask << (4 * i));
- }
- }
- blend->cb_target_mask = target_mask;
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028808_CB_COLOR_CONTROL,
- color_control, 0xFFFFFFFF, NULL);
-
- for (int i = 0; i < 8; i++) {
- unsigned eqRGB = state->rt[i].rgb_func;
- unsigned srcRGB = state->rt[i].rgb_src_factor;
- unsigned dstRGB = state->rt[i].rgb_dst_factor;
-
- unsigned eqA = state->rt[i].alpha_func;
- unsigned srcA = state->rt[i].alpha_src_factor;
- unsigned dstA = state->rt[i].alpha_dst_factor;
- uint32_t bc = 0;
-
- if (!state->rt[i].blend_enable)
- continue;
-
- bc |= S_028804_COLOR_COMB_FCN(r600_translate_blend_function(eqRGB));
- bc |= S_028804_COLOR_SRCBLEND(r600_translate_blend_factor(srcRGB));
- bc |= S_028804_COLOR_DESTBLEND(r600_translate_blend_factor(dstRGB));
-
- if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) {
- bc |= S_028804_SEPARATE_ALPHA_BLEND(1);
- bc |= S_028804_ALPHA_COMB_FCN(r600_translate_blend_function(eqA));
- bc |= S_028804_ALPHA_SRCBLEND(r600_translate_blend_factor(srcA));
- bc |= S_028804_ALPHA_DESTBLEND(r600_translate_blend_factor(dstA));
- }
-
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028780_CB_BLEND0_CONTROL + i * 4, bc, 0xFFFFFFFF, NULL);
- if (i == 0) {
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028804_CB_BLEND_CONTROL, bc, 0xFFFFFFFF, NULL);
- }
- }
- return rstate;
-}
-
-static void r600_bind_blend_state(struct pipe_context *ctx, void *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_blend *blend = (struct r600_pipe_blend *)state;
- struct r600_pipe_state *rstate;
-
- if (state == NULL)
- return;
- rstate = &blend->rstate;
- rctx->states[rstate->id] = rstate;
- rctx->cb_target_mask = blend->cb_target_mask;
- r600_context_pipe_state_set(&rctx->ctx, rstate);
-}
-
-static void *r600_create_dsa_state(struct pipe_context *ctx,
- const struct pipe_depth_stencil_alpha_state *state)
-{
- struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
- unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control;
- unsigned stencil_ref_mask, stencil_ref_mask_bf, db_render_override, db_render_control;
-
- if (rstate == NULL) {
- return NULL;
- }
-
- rstate->id = R600_PIPE_STATE_DSA;
- /* depth TODO some of those db_shader_control field depend on shader adjust mask & add it to shader */
- /* db_shader_control is 0xFFFFFFBE as Z_EXPORT_ENABLE (bit 0) will be
- * set by fragment shader if it export Z and KILL_ENABLE (bit 6) will
- * be set if shader use texkill instruction
- */
- db_shader_control = S_02880C_Z_ORDER(V_02880C_EARLY_Z_THEN_LATE_Z);
- stencil_ref_mask = 0;
- stencil_ref_mask_bf = 0;
- db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) |
- S_028800_Z_WRITE_ENABLE(state->depth.writemask) |
- S_028800_ZFUNC(state->depth.func);
-
- /* stencil */
- if (state->stencil[0].enabled) {
- db_depth_control |= S_028800_STENCIL_ENABLE(1);
- db_depth_control |= S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func));
- db_depth_control |= S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op));
- db_depth_control |= S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op));
- db_depth_control |= S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op));
-
-
- stencil_ref_mask = S_028430_STENCILMASK(state->stencil[0].valuemask) |
- S_028430_STENCILWRITEMASK(state->stencil[0].writemask);
- if (state->stencil[1].enabled) {
- db_depth_control |= S_028800_BACKFACE_ENABLE(1);
- db_depth_control |= S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func));
- db_depth_control |= S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op));
- db_depth_control |= S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op));
- db_depth_control |= S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op));
- stencil_ref_mask_bf = S_028434_STENCILMASK_BF(state->stencil[1].valuemask) |
- S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask);
- }
- }
-
- /* alpha */
- alpha_test_control = 0;
- alpha_ref = 0;
- if (state->alpha.enabled) {
- alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func);
- alpha_test_control |= S_028410_ALPHA_TEST_ENABLE(1);
- alpha_ref = fui(state->alpha.ref_value);
- }
-
- /* misc */
- db_render_control = 0;
- db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) |
- S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) |
- S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE);
- /* TODO db_render_override depends on query */
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028028_DB_STENCIL_CLEAR, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02802C_DB_DEPTH_CLEAR, 0x3F800000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028410_SX_ALPHA_TEST_CONTROL, alpha_test_control, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028430_DB_STENCILREFMASK, stencil_ref_mask,
- 0xFFFFFFFF & C_028430_STENCILREF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028434_DB_STENCILREFMASK_BF, stencil_ref_mask_bf,
- 0xFFFFFFFF & C_028434_STENCILREF_BF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028438_SX_ALPHA_REF, alpha_ref, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286E0_SPI_FOG_FUNC_SCALE, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286E4_SPI_FOG_FUNC_BIAS, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286DC_SPI_FOG_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028800_DB_DEPTH_CONTROL, db_depth_control, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02880C_DB_SHADER_CONTROL, db_shader_control, 0xFFFFFFBE, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D0C_DB_RENDER_CONTROL, db_render_control, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D10_DB_RENDER_OVERRIDE, db_render_override, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D2C_DB_SRESULTS_COMPARE_STATE1, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D30_DB_PRELOAD_CONTROL, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D44_DB_ALPHA_TO_MASK, 0x0000AA00, 0xFFFFFFFF, NULL);
-
- return rstate;
-}
-
-static void *r600_create_rs_state(struct pipe_context *ctx,
- const struct pipe_rasterizer_state *state)
-{
- struct r600_pipe_rasterizer *rs = CALLOC_STRUCT(r600_pipe_rasterizer);
- struct r600_pipe_state *rstate;
- unsigned tmp;
- unsigned prov_vtx = 1, polygon_dual_mode;
-
- if (rs == NULL) {
- return NULL;
- }
-
- rstate = &rs->rstate;
- rs->flatshade = state->flatshade;
- rs->sprite_coord_enable = state->sprite_coord_enable;
-
- /* offset */
- rs->offset_units = state->offset_units;
- rs->offset_scale = state->offset_scale * 12.0f;
-
- rstate->id = R600_PIPE_STATE_RASTERIZER;
- if (state->flatshade_first)
- prov_vtx = 0;
- tmp = 0x00000001;
- if (state->sprite_coord_enable) {
- tmp |= S_0286D4_PNT_SPRITE_ENA(1) |
- S_0286D4_PNT_SPRITE_OVRD_X(2) |
- S_0286D4_PNT_SPRITE_OVRD_Y(3) |
- S_0286D4_PNT_SPRITE_OVRD_Z(0) |
- S_0286D4_PNT_SPRITE_OVRD_W(1);
- if (state->sprite_coord_mode != PIPE_SPRITE_COORD_UPPER_LEFT) {
- tmp |= S_0286D4_PNT_SPRITE_TOP_1(1);
- }
- }
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286D4_SPI_INTERP_CONTROL_0, tmp, 0xFFFFFFFF, NULL);
-
- polygon_dual_mode = (state->fill_front != PIPE_POLYGON_MODE_FILL ||
- state->fill_back != PIPE_POLYGON_MODE_FILL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028814_PA_SU_SC_MODE_CNTL,
- S_028814_PROVOKING_VTX_LAST(prov_vtx) |
- S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) |
- S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) |
- S_028814_FACE(!state->front_ccw) |
- S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) |
- S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) |
- S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri) |
- S_028814_POLY_MODE(polygon_dual_mode) |
- S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state->fill_front)) |
- S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state->fill_back)), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02881C_PA_CL_VS_OUT_CNTL,
- S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) |
- S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028820_PA_CL_NANINF_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
- /* point size 12.4 fixed point */
- tmp = (unsigned)(state->point_size * 8.0);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A00_PA_SU_POINT_SIZE, S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A04_PA_SU_POINT_MINMAX, 0x80000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A08_PA_SU_LINE_CNTL, 0x00000008, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A0C_PA_SC_LINE_STIPPLE, 0x00000005, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A48_PA_SC_MPASS_PS_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C00_PA_SC_LINE_CNTL, 0x00000400, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0x3F800000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, 0x00000000, 0xFFFFFFFF, NULL);
- return rstate;
-}
-
-static void r600_bind_rs_state(struct pipe_context *ctx, void *state)
-{
- struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state;
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-
- if (state == NULL)
- return;
-
- rctx->flatshade = rs->flatshade;
- rctx->sprite_coord_enable = rs->sprite_coord_enable;
- rctx->rasterizer = rs;
-
- rctx->states[rs->rstate.id] = &rs->rstate;
- r600_context_pipe_state_set(&rctx->ctx, &rs->rstate);
-}
-
-static void r600_delete_rs_state(struct pipe_context *ctx, void *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_rasterizer *rs = (struct r600_pipe_rasterizer *)state;
-
- if (rctx->rasterizer == rs) {
- rctx->rasterizer = NULL;
- }
- if (rctx->states[rs->rstate.id] == &rs->rstate) {
- rctx->states[rs->rstate.id] = NULL;
- }
- free(rs);
-}
-
-static void *r600_create_sampler_state(struct pipe_context *ctx,
- const struct pipe_sampler_state *state)
-{
- struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
- union util_color uc;
-
- if (rstate == NULL) {
- return NULL;
- }
-
- rstate->id = R600_PIPE_STATE_SAMPLER;
- util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
- r600_pipe_state_add_reg(rstate, R600_GROUP_SAMPLER, R_03C000_SQ_TEX_SAMPLER_WORD0_0,
- S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) |
- S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) |
- S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) |
- S_03C000_XY_MAG_FILTER(r600_tex_filter(state->mag_img_filter)) |
- S_03C000_XY_MIN_FILTER(r600_tex_filter(state->min_img_filter)) |
- S_03C000_MIP_FILTER(r600_tex_mipfilter(state->min_mip_filter)) |
- S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) |
- S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0), 0xFFFFFFFF, NULL);
- /* FIXME LOD it depends on texture base level ... */
- r600_pipe_state_add_reg(rstate, R600_GROUP_SAMPLER, R_03C004_SQ_TEX_SAMPLER_WORD1_0,
- S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) |
- S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)) |
- S_03C004_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_SAMPLER, R_03C008_SQ_TEX_SAMPLER_WORD2_0, S_03C008_TYPE(1), 0xFFFFFFFF, NULL);
- if (uc.ui) {
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_00A400_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color[0]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color[1]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color[2]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color[3]), 0xFFFFFFFF, NULL);
- }
- return rstate;
-}
-
-static void *r600_create_vertex_elements(struct pipe_context *ctx,
- unsigned count,
- const struct pipe_vertex_element *elements)
-{
- struct r600_vertex_element *v = CALLOC_STRUCT(r600_vertex_element);
-
- assert(count < 32);
- v->count = count;
- v->refcount = 1;
- memcpy(v->elements, elements, count * sizeof(struct pipe_vertex_element));
- return v;
-}
-
-static void r600_sampler_view_destroy(struct pipe_context *ctx,
- struct pipe_sampler_view *state)
-{
- struct r600_pipe_sampler_view *resource = (struct r600_pipe_sampler_view *)state;
-
- pipe_resource_reference(&state->texture, NULL);
- FREE(resource);
-}
-
-static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *ctx,
- struct pipe_resource *texture,
- const struct pipe_sampler_view *state)
-{
- struct r600_pipe_sampler_view *resource = CALLOC_STRUCT(r600_pipe_sampler_view);
- struct r600_pipe_state *rstate;
- const struct util_format_description *desc;
- struct r600_resource_texture *tmp;
- struct r600_resource *rbuffer;
- unsigned format;
- uint32_t word4 = 0, yuv_format = 0, pitch = 0;
- unsigned char swizzle[4], array_mode = 0, tile_type = 0;
- struct radeon_ws_bo *bo[2];
-
- if (resource == NULL)
- return NULL;
- rstate = &resource->state;
-
- /* initialize base object */
- resource->base = *state;
- resource->base.texture = NULL;
- pipe_reference(NULL, &texture->reference);
- resource->base.texture = texture;
- resource->base.reference.count = 1;
- resource->base.context = ctx;
-
- swizzle[0] = state->swizzle_r;
- swizzle[1] = state->swizzle_g;
- swizzle[2] = state->swizzle_b;
- swizzle[3] = state->swizzle_a;
- format = r600_translate_texformat(texture->format,
- swizzle,
- &word4, &yuv_format);
- if (format == ~0) {
- format = 0;
- }
- desc = util_format_description(texture->format);
- if (desc == NULL) {
- R600_ERR("unknow format %d\n", texture->format);
- }
- tmp = (struct r600_resource_texture*)texture;
- rbuffer = &tmp->resource;
- bo[0] = rbuffer->bo;
- bo[1] = rbuffer->bo;
- /* FIXME depth texture decompression */
- if (tmp->depth) {
- r600_texture_depth_flush(ctx, texture);
- tmp = (struct r600_resource_texture*)texture;
- rbuffer = &tmp->flushed_depth_texture->resource;
- bo[0] = rbuffer->bo;
- bo[1] = rbuffer->bo;
- }
- pitch = align(tmp->pitch[0] / tmp->bpt, 8);
-
- /* FIXME properly handle first level != 0 */
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038000_RESOURCE0_WORD0,
- S_038000_DIM(r600_tex_dim(texture->target)) |
- S_038000_TILE_MODE(array_mode) |
- S_038000_TILE_TYPE(tile_type) |
- S_038000_PITCH((pitch / 8) - 1) |
- S_038000_TEX_WIDTH(texture->width0 - 1), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038004_RESOURCE0_WORD1,
- S_038004_TEX_HEIGHT(texture->height0 - 1) |
- S_038004_TEX_DEPTH(texture->depth0 - 1) |
- S_038004_DATA_FORMAT(format), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038008_RESOURCE0_WORD2,
- tmp->offset[0] >> 8, 0xFFFFFFFF, bo[0]);
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_03800C_RESOURCE0_WORD3,
- tmp->offset[1] >> 8, 0xFFFFFFFF, bo[1]);
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038010_RESOURCE0_WORD4,
- word4 | S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) |
- S_038010_SRF_MODE_ALL(V_038010_SFR_MODE_NO_ZERO) |
- S_038010_REQUEST_SIZE(1) |
- S_038010_BASE_LEVEL(state->first_level), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038014_RESOURCE0_WORD5,
- S_038014_LAST_LEVEL(state->last_level) |
- S_038014_BASE_ARRAY(0) |
- S_038014_LAST_ARRAY(0), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_RESOURCE, R_038018_RESOURCE0_WORD6,
- S_038018_TYPE(V_038010_SQ_TEX_VTX_VALID_TEXTURE), 0xFFFFFFFF, NULL);
-
- return &resource->base;
-}
-
-static void r600_set_vs_sampler_view(struct pipe_context *ctx, unsigned count,
- struct pipe_sampler_view **views)
-{
- /* TODO */
- assert(1);
-}
-
-static void r600_set_ps_sampler_view(struct pipe_context *ctx, unsigned count,
- struct pipe_sampler_view **views)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_sampler_view **resource = (struct r600_pipe_sampler_view **)views;
-
- for (int i = 0; i < count; i++) {
- if (resource[i]) {
- r600_context_pipe_state_set_ps_resource(&rctx->ctx, &resource[i]->state, i);
- }
- }
-}
-
-static void r600_bind_state(struct pipe_context *ctx, void *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_state *rstate = (struct r600_pipe_state *)state;
-
- if (state == NULL)
- return;
- rctx->states[rstate->id] = rstate;
- r600_context_pipe_state_set(&rctx->ctx, rstate);
-}
-
-static void r600_bind_ps_sampler(struct pipe_context *ctx, unsigned count, void **states)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_state **rstates = (struct r600_pipe_state **)states;
-
- for (int i = 0; i < count; i++) {
- r600_context_pipe_state_set_ps_sampler(&rctx->ctx, rstates[i], i);
- }
-}
-
-static void r600_bind_vs_sampler(struct pipe_context *ctx, unsigned count, void **states)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_state **rstates = (struct r600_pipe_state **)states;
-
- /* TODO implement */
- for (int i = 0; i < count; i++) {
- r600_context_pipe_state_set_vs_sampler(&rctx->ctx, rstates[i], i);
- }
-}
-
-static void r600_delete_state(struct pipe_context *ctx, void *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_state *rstate = (struct r600_pipe_state *)state;
-
- if (rctx->states[rstate->id] == rstate) {
- rctx->states[rstate->id] = NULL;
- }
- for (int i = 0; i < rstate->nregs; i++) {
- radeon_ws_bo_reference(rctx->radeon, &rstate->regs[i].bo, NULL);
- }
- free(rstate);
-}
-
-static void r600_delete_vertex_element(struct pipe_context *ctx, void *state)
-{
- struct r600_vertex_element *v = (struct r600_vertex_element*)state;
-
- if (v == NULL)
- return;
- if (--v->refcount)
- return;
- free(v);
-}
-
-static void r600_set_clip_state(struct pipe_context *ctx,
- const struct pipe_clip_state *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
-
- if (rstate == NULL)
- return;
-
- rctx->clip = *state;
- rstate->id = R600_PIPE_STATE_CLIP;
- for (int i = 0; i < state->nr; i++) {
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028E20_PA_CL_UCP0_X + i * 4,
- fui(state->ucp[i][0]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028E24_PA_CL_UCP0_Y + i * 4,
- fui(state->ucp[i][1]) , 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028E28_PA_CL_UCP0_Z + i * 4,
- fui(state->ucp[i][2]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028E2C_PA_CL_UCP0_W + i * 4,
- fui(state->ucp[i][3]), 0xFFFFFFFF, NULL);
- }
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028810_PA_CL_CLIP_CNTL,
- S_028810_PS_UCP_MODE(3) | ((1 << state->nr) - 1) |
- S_028810_ZCLIP_NEAR_DISABLE(state->depth_clamp) |
- S_028810_ZCLIP_FAR_DISABLE(state->depth_clamp), 0xFFFFFFFF, NULL);
-
- free(rctx->states[R600_PIPE_STATE_CLIP]);
- rctx->states[R600_PIPE_STATE_CLIP] = rstate;
- r600_context_pipe_state_set(&rctx->ctx, rstate);
-}
-
-static void r600_bind_vertex_elements(struct pipe_context *ctx, void *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_vertex_element *v = (struct r600_vertex_element*)state;
-
- r600_delete_vertex_element(ctx, rctx->vertex_elements);
- rctx->vertex_elements = v;
- if (v) {
- v->refcount++;
-// rctx->vs_rebuild = TRUE;
- }
-}
-
-static void r600_set_polygon_stipple(struct pipe_context *ctx,
- const struct pipe_poly_stipple *state)
-{
-}
-
-static void r600_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask)
-{
-}
-
-static void r600_set_scissor_state(struct pipe_context *ctx,
- const struct pipe_scissor_state *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
- u32 tl, br;
-
- if (rstate == NULL)
- return;
-
- rstate->id = R600_PIPE_STATE_SCISSOR;
- tl = S_028240_TL_X(state->minx) | S_028240_TL_Y(state->miny) | S_028240_WINDOW_OFFSET_DISABLE(1);
- br = S_028244_BR_X(state->maxx) | S_028244_BR_Y(state->maxy);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028030_PA_SC_SCREEN_SCISSOR_TL, tl,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028034_PA_SC_SCREEN_SCISSOR_BR, br,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028204_PA_SC_WINDOW_SCISSOR_TL, tl,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028208_PA_SC_WINDOW_SCISSOR_BR, br,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028210_PA_SC_CLIPRECT_0_TL, tl,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028214_PA_SC_CLIPRECT_0_BR, br,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028218_PA_SC_CLIPRECT_1_TL, tl,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_02821C_PA_SC_CLIPRECT_1_BR, br,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028220_PA_SC_CLIPRECT_2_TL, tl,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028224_PA_SC_CLIPRECT_2_BR, br,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028228_PA_SC_CLIPRECT_3_TL, tl,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_02822C_PA_SC_CLIPRECT_3_BR, br,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028200_PA_SC_WINDOW_OFFSET, 0x00000000,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_02820C_PA_SC_CLIPRECT_RULE, 0x0000FFFF,
- 0xFFFFFFFF, NULL);
- if (rctx->family >= CHIP_RV770) {
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028230_PA_SC_EDGERULE, 0xAAAAAAAA,
- 0xFFFFFFFF, NULL);
- }
-
- free(rctx->states[R600_PIPE_STATE_SCISSOR]);
- rctx->states[R600_PIPE_STATE_SCISSOR] = rstate;
- r600_context_pipe_state_set(&rctx->ctx, rstate);
-}
-
-static void r600_set_stencil_ref(struct pipe_context *ctx,
- const struct pipe_stencil_ref *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
- u32 tmp;
-
- if (rstate == NULL)
- return;
-
- rctx->stencil_ref = *state;
- rstate->id = R600_PIPE_STATE_STENCIL_REF;
- tmp = S_028430_STENCILREF(state->ref_value[0]);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028430_DB_STENCILREFMASK, tmp,
- ~C_028430_STENCILREF, NULL);
- tmp = S_028434_STENCILREF_BF(state->ref_value[1]);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028434_DB_STENCILREFMASK_BF, tmp,
- ~C_028434_STENCILREF_BF, NULL);
-
- free(rctx->states[R600_PIPE_STATE_STENCIL_REF]);
- rctx->states[R600_PIPE_STATE_STENCIL_REF] = rstate;
- r600_context_pipe_state_set(&rctx->ctx, rstate);
-}
-
-static void r600_set_viewport_state(struct pipe_context *ctx,
- const struct pipe_viewport_state *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
-
- if (rstate == NULL)
- return;
-
- rctx->viewport = *state;
- rstate->id = R600_PIPE_STATE_VIEWPORT;
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028818_PA_CL_VTE_CNTL, 0x0000043F, 0xFFFFFFFF, NULL);
-
- free(rctx->states[R600_PIPE_STATE_VIEWPORT]);
- rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate;
- r600_context_pipe_state_set(&rctx->ctx, rstate);
-}
-
-static void r600_cb(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate,
- const struct pipe_framebuffer_state *state, int cb)
-{
- struct r600_resource_texture *rtex;
- struct r600_resource *rbuffer;
- unsigned level = state->cbufs[cb]->level;
- unsigned pitch, slice;
- unsigned color_info;
- unsigned format, swap, ntype;
- const struct util_format_description *desc;
- struct radeon_ws_bo *bo[3];
-
- rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
- rbuffer = &rtex->resource;
- bo[0] = rbuffer->bo;
- bo[1] = rbuffer->bo;
- bo[2] = rbuffer->bo;
-
- pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
- slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1;
- ntype = 0;
- desc = util_format_description(rtex->resource.base.b.format);
- if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
- ntype = V_0280A0_NUMBER_SRGB;
-
- format = r600_translate_colorformat(rtex->resource.base.b.format);
- swap = r600_translate_colorswap(rtex->resource.base.b.format);
- color_info = S_0280A0_FORMAT(format) |
- S_0280A0_COMP_SWAP(swap) |
- S_0280A0_BLEND_CLAMP(1) |
- S_0280A0_NUMBER_TYPE(ntype);
- if (desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS)
- color_info |= S_0280A0_SOURCE_FORMAT(1);
-
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028040_CB_COLOR0_BASE + cb * 4,
- state->cbufs[cb]->offset >> 8, 0xFFFFFFFF, bo[0]);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_0280A0_CB_COLOR0_INFO + cb * 4,
- color_info, 0xFFFFFFFF, bo[0]);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028060_CB_COLOR0_SIZE + cb * 4,
- S_028060_PITCH_TILE_MAX(pitch) |
- S_028060_SLICE_TILE_MAX(slice),
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028080_CB_COLOR0_VIEW + cb * 4,
- 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_0280E0_CB_COLOR0_FRAG + cb * 4,
- 0x00000000, 0xFFFFFFFF, bo[1]);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_0280C0_CB_COLOR0_TILE + cb * 4,
- 0x00000000, 0xFFFFFFFF, bo[2]);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028100_CB_COLOR0_MASK + cb * 4,
- 0x00000000, 0xFFFFFFFF, NULL);
-}
-
-static void r600_db(struct r600_pipe_context *rctx, struct r600_pipe_state *rstate,
- const struct pipe_framebuffer_state *state)
-{
- struct r600_resource_texture *rtex;
- struct r600_resource *rbuffer;
- unsigned level;
- unsigned pitch, slice, format;
-
- if (state->zsbuf == NULL)
- return;
-
- rtex = (struct r600_resource_texture*)state->zsbuf->texture;
- rtex->tiled = 1;
- rtex->array_mode = 2;
- rtex->tile_type = 1;
- rtex->depth = 1;
- rbuffer = &rtex->resource;
-
- level = state->zsbuf->level;
- pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
- slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1;
- format = r600_translate_dbformat(state->zsbuf->texture->format);
-
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02800C_DB_DEPTH_BASE,
- state->zsbuf->offset >> 8, 0xFFFFFFFF, rbuffer->bo);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028000_DB_DEPTH_SIZE,
- S_028000_PITCH_TILE_MAX(pitch) | S_028000_SLICE_TILE_MAX(slice),
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028004_DB_DEPTH_VIEW, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028010_DB_DEPTH_INFO,
- S_028010_ARRAY_MODE(rtex->array_mode) | S_028010_FORMAT(format),
- 0xFFFFFFFF, rbuffer->bo);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028D34_DB_PREFETCH_LIMIT,
- (state->zsbuf->height / 8) - 1, 0xFFFFFFFF, NULL);
-}
-
-static void r600_set_framebuffer_state(struct pipe_context *ctx,
- const struct pipe_framebuffer_state *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
- u32 shader_mask, tl, br, shader_control, target_mask;
-
- if (rstate == NULL)
- return;
-
- /* unreference old buffer and reference new one */
- rstate->id = R600_PIPE_STATE_FRAMEBUFFER;
- for (int i = 0; i < rctx->framebuffer.nr_cbufs; i++) {
- pipe_surface_reference(&rctx->framebuffer.cbufs[i], NULL);
- }
- for (int i = 0; i < state->nr_cbufs; i++) {
- pipe_surface_reference(&rctx->framebuffer.cbufs[i], state->cbufs[i]);
- }
- pipe_surface_reference(&rctx->framebuffer.zsbuf, state->zsbuf);
- rctx->framebuffer = *state;
- rctx->pframebuffer = &rctx->framebuffer;
-
- /* build states */
- for (int i = 0; i < state->nr_cbufs; i++) {
- r600_cb(rctx, rstate, state, i);
- }
- if (state->zsbuf) {
- r600_db(rctx, rstate, state);
- }
-
- target_mask = 0x00000000;
- target_mask = 0xFFFFFFFF;
- shader_mask = 0;
- shader_control = 0;
- for (int i = 0; i < state->nr_cbufs; i++) {
- target_mask ^= 0xf << (i * 4);
- shader_mask |= 0xf << (i * 4);
- shader_control |= 1 << i;
- }
- tl = S_028240_TL_X(0) | S_028240_TL_Y(0) | S_028240_WINDOW_OFFSET_DISABLE(1);
- br = S_028244_BR_X(state->width) | S_028244_BR_Y(state->height);
-
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028240_PA_SC_GENERIC_SCISSOR_TL, tl,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028244_PA_SC_GENERIC_SCISSOR_BR, br,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028250_PA_SC_VPORT_SCISSOR_0_TL, tl,
- 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028254_PA_SC_VPORT_SCISSOR_0_BR, br,
- 0xFFFFFFFF, NULL);
-
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0287A0_CB_SHADER_CONTROL,
- shader_control, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028238_CB_TARGET_MASK,
- 0x00000000, target_mask, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02823C_CB_SHADER_MASK,
- shader_mask, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C04_PA_SC_AA_CONFIG,
- 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX,
- 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX,
- 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C30_CB_CLRCMP_CONTROL,
- 0x01000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C34_CB_CLRCMP_SRC,
- 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C38_CB_CLRCMP_DST,
- 0x000000FF, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C3C_CB_CLRCMP_MSK,
- 0xFFFFFFFF, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028C48_PA_SC_AA_MASK,
- 0xFFFFFFFF, 0xFFFFFFFF, NULL);
-
- free(rctx->states[R600_PIPE_STATE_FRAMEBUFFER]);
- rctx->states[R600_PIPE_STATE_FRAMEBUFFER] = rstate;
- r600_context_pipe_state_set(&rctx->ctx, rstate);
-}
-
-static void r600_set_index_buffer(struct pipe_context *ctx,
- const struct pipe_index_buffer *ib)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-
- if (ib) {
- pipe_resource_reference(&rctx->index_buffer.buffer, ib->buffer);
- memcpy(&rctx->index_buffer, ib, sizeof(rctx->index_buffer));
- } else {
- pipe_resource_reference(&rctx->index_buffer.buffer, NULL);
- memset(&rctx->index_buffer, 0, sizeof(rctx->index_buffer));
- }
-
- /* TODO make this more like a state */
-}
-
-static void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count,
- const struct pipe_vertex_buffer *buffers)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-
- for (int i = 0; i < rctx->nvertex_buffer; i++) {
- pipe_resource_reference(&rctx->vertex_buffer[i].buffer, NULL);
- }
- memcpy(rctx->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count);
- for (int i = 0; i < count; i++) {
- rctx->vertex_buffer[i].buffer = NULL;
- if (r600_buffer_is_user_buffer(buffers[i].buffer))
- rctx->any_user_vbs = TRUE;
- pipe_resource_reference(&rctx->vertex_buffer[i].buffer, buffers[i].buffer);
- }
- rctx->nvertex_buffer = count;
-}
-
-static void r600_set_constant_buffer(struct pipe_context *ctx, uint shader, uint index,
- struct pipe_resource *buffer)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_state *rstate;
- struct pipe_transfer *transfer;
- unsigned *nconst = NULL;
- u32 *ptr, offset;
-
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- rstate = rctx->vs_const;
- nconst = &rctx->vs_nconst;
- offset = R_030000_SQ_ALU_CONSTANT0_0 + 0x1000;
- break;
- case PIPE_SHADER_FRAGMENT:
- rstate = rctx->ps_const;
- nconst = &rctx->ps_nconst;
- offset = R_030000_SQ_ALU_CONSTANT0_0;
- break;
- default:
- R600_ERR("unsupported %d\n", shader);
- return;
- }
- if (buffer && buffer->width0 > 0) {
- *nconst = buffer->width0 / 16;
- ptr = pipe_buffer_map(ctx, buffer, PIPE_TRANSFER_READ, &transfer);
- if (ptr == NULL)
- return;
- for (int i = 0; i < *nconst; i++, offset += 0x10) {
- rstate[i].nregs = 0;
- r600_pipe_state_add_reg(&rstate[i], R600_GROUP_ALU_CONST, offset + 0x0, ptr[i * 4 + 0], 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&rstate[i], R600_GROUP_ALU_CONST, offset + 0x4, ptr[i * 4 + 1], 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&rstate[i], R600_GROUP_ALU_CONST, offset + 0x8, ptr[i * 4 + 2], 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(&rstate[i], R600_GROUP_ALU_CONST, offset + 0xC, ptr[i * 4 + 3], 0xFFFFFFFF, NULL);
- r600_context_pipe_state_set(&rctx->ctx, &rstate[i]);
- }
- pipe_buffer_unmap(ctx, buffer, transfer);
- }
-}
-
-static void *r600_create_shader_state(struct pipe_context *ctx,
- const struct pipe_shader_state *state)
-{
- struct r600_pipe_shader *shader = CALLOC_STRUCT(r600_pipe_shader);
- int r;
-
- r = r600_pipe_shader_create2(ctx, shader, state->tokens);
- if (r) {
- return NULL;
- }
- return shader;
-}
-
-static void r600_bind_ps_shader(struct pipe_context *ctx, void *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-
- /* TODO delete old shader */
- rctx->ps_shader = (struct r600_pipe_shader *)state;
-}
-
-static void r600_bind_vs_shader(struct pipe_context *ctx, void *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-
- /* TODO delete old shader */
- rctx->vs_shader = (struct r600_pipe_shader *)state;
-}
-
-static void r600_delete_ps_shader(struct pipe_context *ctx, void *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_shader *shader = (struct r600_pipe_shader *)state;
-
- if (rctx->ps_shader == shader) {
- rctx->ps_shader = NULL;
- }
- /* TODO proper delete */
- free(shader);
-}
-
-static void r600_delete_vs_shader(struct pipe_context *ctx, void *state)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_pipe_shader *shader = (struct r600_pipe_shader *)state;
-
- if (rctx->vs_shader == shader) {
- rctx->vs_shader = NULL;
- }
- /* TODO proper delete */
- free(shader);
-}
-
-static void r600_init_state_functions2(struct r600_pipe_context *rctx)
-{
- rctx->context.create_blend_state = r600_create_blend_state;
- rctx->context.create_depth_stencil_alpha_state = r600_create_dsa_state;
- rctx->context.create_fs_state = r600_create_shader_state;
- rctx->context.create_rasterizer_state = r600_create_rs_state;
- rctx->context.create_sampler_state = r600_create_sampler_state;
- rctx->context.create_sampler_view = r600_create_sampler_view;
- rctx->context.create_vertex_elements_state = r600_create_vertex_elements;
- rctx->context.create_vs_state = r600_create_shader_state;
- rctx->context.bind_blend_state = r600_bind_blend_state;
- rctx->context.bind_depth_stencil_alpha_state = r600_bind_state;
- rctx->context.bind_fragment_sampler_states = r600_bind_ps_sampler;
- rctx->context.bind_fs_state = r600_bind_ps_shader;
- rctx->context.bind_rasterizer_state = r600_bind_rs_state;
- rctx->context.bind_vertex_elements_state = r600_bind_vertex_elements;
- rctx->context.bind_vertex_sampler_states = r600_bind_vs_sampler;
- rctx->context.bind_vs_state = r600_bind_vs_shader;
- rctx->context.delete_blend_state = r600_delete_state;
- rctx->context.delete_depth_stencil_alpha_state = r600_delete_state;
- rctx->context.delete_fs_state = r600_delete_ps_shader;
- rctx->context.delete_rasterizer_state = r600_delete_rs_state;
- rctx->context.delete_sampler_state = r600_delete_state;
- rctx->context.delete_vertex_elements_state = r600_delete_vertex_element;
- rctx->context.delete_vs_state = r600_delete_vs_shader;
- rctx->context.set_blend_color = r600_set_blend_color;
- rctx->context.set_clip_state = r600_set_clip_state;
- rctx->context.set_constant_buffer = r600_set_constant_buffer;
- rctx->context.set_fragment_sampler_views = r600_set_ps_sampler_view;
- rctx->context.set_framebuffer_state = r600_set_framebuffer_state;
- rctx->context.set_polygon_stipple = r600_set_polygon_stipple;
- rctx->context.set_sample_mask = r600_set_sample_mask;
- rctx->context.set_scissor_state = r600_set_scissor_state;
- rctx->context.set_stencil_ref = r600_set_stencil_ref;
- rctx->context.set_vertex_buffers = r600_set_vertex_buffers;
- rctx->context.set_index_buffer = r600_set_index_buffer;
- rctx->context.set_vertex_sampler_views = r600_set_vs_sampler_view;
- rctx->context.set_viewport_state = r600_set_viewport_state;
- rctx->context.sampler_view_destroy = r600_sampler_view_destroy;
-}
-
-static void r600_init_config2(struct r600_pipe_context *rctx)
-{
- int ps_prio;
- int vs_prio;
- int gs_prio;
- int es_prio;
- int num_ps_gprs;
- int num_vs_gprs;
- int num_gs_gprs;
- int num_es_gprs;
- int num_temp_gprs;
- int num_ps_threads;
- int num_vs_threads;
- int num_gs_threads;
- int num_es_threads;
- int num_ps_stack_entries;
- int num_vs_stack_entries;
- int num_gs_stack_entries;
- int num_es_stack_entries;
- enum radeon_family family;
- struct r600_pipe_state *rstate = &rctx->config;
- u32 tmp;
-
- family = r600_get_family(rctx->radeon);
- ps_prio = 0;
- vs_prio = 1;
- gs_prio = 2;
- es_prio = 3;
- switch (family) {
- case CHIP_R600:
- num_ps_gprs = 192;
- num_vs_gprs = 56;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 136;
- num_vs_threads = 48;
- num_gs_threads = 4;
- num_es_threads = 4;
- num_ps_stack_entries = 128;
- num_vs_stack_entries = 128;
- num_gs_stack_entries = 0;
- num_es_stack_entries = 0;
- break;
- case CHIP_RV630:
- case CHIP_RV635:
- num_ps_gprs = 84;
- num_vs_gprs = 36;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 144;
- num_vs_threads = 40;
- num_gs_threads = 4;
- num_es_threads = 4;
- num_ps_stack_entries = 40;
- num_vs_stack_entries = 40;
- num_gs_stack_entries = 32;
- num_es_stack_entries = 16;
- break;
- case CHIP_RV610:
- case CHIP_RV620:
- case CHIP_RS780:
- case CHIP_RS880:
- default:
- num_ps_gprs = 84;
- num_vs_gprs = 36;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 136;
- num_vs_threads = 48;
- num_gs_threads = 4;
- num_es_threads = 4;
- num_ps_stack_entries = 40;
- num_vs_stack_entries = 40;
- num_gs_stack_entries = 32;
- num_es_stack_entries = 16;
- break;
- case CHIP_RV670:
- num_ps_gprs = 144;
- num_vs_gprs = 40;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 136;
- num_vs_threads = 48;
- num_gs_threads = 4;
- num_es_threads = 4;
- num_ps_stack_entries = 40;
- num_vs_stack_entries = 40;
- num_gs_stack_entries = 32;
- num_es_stack_entries = 16;
- break;
- case CHIP_RV770:
- num_ps_gprs = 192;
- num_vs_gprs = 56;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 188;
- num_vs_threads = 60;
- num_gs_threads = 0;
- num_es_threads = 0;
- num_ps_stack_entries = 256;
- num_vs_stack_entries = 256;
- num_gs_stack_entries = 0;
- num_es_stack_entries = 0;
- break;
- case CHIP_RV730:
- case CHIP_RV740:
- num_ps_gprs = 84;
- num_vs_gprs = 36;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 188;
- num_vs_threads = 60;
- num_gs_threads = 0;
- num_es_threads = 0;
- num_ps_stack_entries = 128;
- num_vs_stack_entries = 128;
- num_gs_stack_entries = 0;
- num_es_stack_entries = 0;
- break;
- case CHIP_RV710:
- num_ps_gprs = 192;
- num_vs_gprs = 56;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 144;
- num_vs_threads = 48;
- num_gs_threads = 0;
- num_es_threads = 0;
- num_ps_stack_entries = 128;
- num_vs_stack_entries = 128;
- num_gs_stack_entries = 0;
- num_es_stack_entries = 0;
- break;
- }
-
- rstate->id = R600_PIPE_STATE_CONFIG;
-
- /* SQ_CONFIG */
- tmp = 0;
- switch (family) {
- case CHIP_RV610:
- case CHIP_RV620:
- case CHIP_RS780:
- case CHIP_RS880:
- case CHIP_RV710:
- break;
- default:
- tmp |= S_008C00_VC_ENABLE(1);
- break;
- }
- tmp |= S_008C00_DX9_CONSTS(1);
- tmp |= S_008C00_ALU_INST_PREFER_VECTOR(1);
- tmp |= S_008C00_PS_PRIO(ps_prio);
- tmp |= S_008C00_VS_PRIO(vs_prio);
- tmp |= S_008C00_GS_PRIO(gs_prio);
- tmp |= S_008C00_ES_PRIO(es_prio);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C00_SQ_CONFIG, tmp, 0xFFFFFFFF, NULL);
-
- /* SQ_GPR_RESOURCE_MGMT_1 */
- tmp = 0;
- tmp |= S_008C04_NUM_PS_GPRS(num_ps_gprs);
- tmp |= S_008C04_NUM_VS_GPRS(num_vs_gprs);
- tmp |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL);
-
- /* SQ_GPR_RESOURCE_MGMT_2 */
- tmp = 0;
- tmp |= S_008C08_NUM_GS_GPRS(num_gs_gprs);
- tmp |= S_008C08_NUM_GS_GPRS(num_es_gprs);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C08_SQ_GPR_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL);
-
- /* SQ_THREAD_RESOURCE_MGMT */
- tmp = 0;
- tmp |= S_008C0C_NUM_PS_THREADS(num_ps_threads);
- tmp |= S_008C0C_NUM_VS_THREADS(num_vs_threads);
- tmp |= S_008C0C_NUM_GS_THREADS(num_gs_threads);
- tmp |= S_008C0C_NUM_ES_THREADS(num_es_threads);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C0C_SQ_THREAD_RESOURCE_MGMT, tmp, 0xFFFFFFFF, NULL);
-
- /* SQ_STACK_RESOURCE_MGMT_1 */
- tmp = 0;
- tmp |= S_008C10_NUM_PS_STACK_ENTRIES(num_ps_stack_entries);
- tmp |= S_008C10_NUM_VS_STACK_ENTRIES(num_vs_stack_entries);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C10_SQ_STACK_RESOURCE_MGMT_1, tmp, 0xFFFFFFFF, NULL);
-
- /* SQ_STACK_RESOURCE_MGMT_2 */
- tmp = 0;
- tmp |= S_008C14_NUM_GS_STACK_ENTRIES(num_gs_stack_entries);
- tmp |= S_008C14_NUM_ES_STACK_ENTRIES(num_es_stack_entries);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008C14_SQ_STACK_RESOURCE_MGMT_2, tmp, 0xFFFFFFFF, NULL);
-
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009714_VC_ENHANCE, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028350_SX_MISC, 0x00000000, 0xFFFFFFFF, NULL);
-
- if (family >= CHIP_RV770) {
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x00004000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009508_TA_CNTL_AUX, 0x07000002, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009830_DB_DEBUG, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009838_DB_WATERMARKS, 0x00420204, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286C8_SPI_THREAD_GROUPING, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A4C_PA_SC_MODE_CNTL, 0x00514000, 0xFFFFFFFF, NULL);
- } else {
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009508_TA_CNTL_AUX, 0x07000003, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009830_DB_DEBUG, 0x82000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONFIG, R_009838_DB_WATERMARKS, 0x01020204, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0286C8_SPI_THREAD_GROUPING, 0x00000001, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A4C_PA_SC_MODE_CNTL, 0x00004010, 0xFFFFFFFF, NULL);
- }
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288A8_SQ_ESGS_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288AC_SQ_GSVS_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288B0_SQ_ESTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288B4_SQ_GSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288B8_SQ_VSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288BC_SQ_PSTMP_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288C0_SQ_FBUF_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288C4_SQ_REDUC_RING_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_0288C8_SQ_GS_VERT_ITEMSIZE, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A10_VGT_OUTPUT_PATH_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A14_VGT_HOS_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A20_VGT_HOS_REUSE_DEPTH, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A24_VGT_GROUP_PRIM_TYPE, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A28_VGT_GROUP_FIRST_DECR, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A2C_VGT_GROUP_DECR, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A30_VGT_GROUP_VECT_0_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A34_VGT_GROUP_VECT_1_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A40_VGT_GS_MODE, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028AB0_VGT_STRMOUT_EN, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028AB4_VGT_REUSE_OFF, 0x00000001, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028AB8_VGT_VTX_CNT_EN, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028B20_VGT_STRMOUT_BUFFER_EN, 0x00000000, 0xFFFFFFFF, NULL);
-
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A84_VGT_PRIMITIVEID_EN, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 0x00000000, 0xFFFFFFFF, NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0x00000000, 0xFFFFFFFF, NULL);
- r600_context_pipe_state_set(&rctx->ctx, rstate);
-}
-
-static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned query_type)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-
- return (struct pipe_query*)r600_context_query_create(&rctx->ctx, query_type);
-}
-
-static void r600_destroy_query(struct pipe_context *ctx, struct pipe_query *query)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-
- r600_context_query_destroy(&rctx->ctx, (struct r600_query *)query);
-}
-
-static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_query *rquery = (struct r600_query *)query;
-
- rquery->result = 0;
- rquery->num_results = 0;
- r600_query_begin(&rctx->ctx, (struct r600_query *)query);
-}
-
-static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
-
- r600_query_end(&rctx->ctx, (struct r600_query *)query);
-}
-
-static boolean r600_get_query_result(struct pipe_context *ctx,
- struct pipe_query *query,
- boolean wait, void *vresult)
-{
- struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
- struct r600_query *rquery = (struct r600_query *)query;
-
- if (rquery->num_results) {
- ctx->flush(ctx, 0, NULL);
- }
- return r600_context_query_result(&rctx->ctx, (struct r600_query *)query, wait, vresult);
-}
-
-static void r600_init_query_functions2(struct r600_pipe_context *rctx)
-{
- rctx->context.create_query = r600_create_query;
- rctx->context.destroy_query = r600_destroy_query;
- rctx->context.begin_query = r600_begin_query;
- rctx->context.end_query = r600_end_query;
- rctx->context.get_query_result = r600_get_query_result;
-}
-
-static void *r600_create_db_flush_dsa(struct r600_pipe_context *rctx)
-{
- struct pipe_depth_stencil_alpha_state dsa;
- struct r600_pipe_state *rstate;
- boolean quirk = false;
-
- if (rctx->family == CHIP_RV610 || rctx->family == CHIP_RV630 ||
- rctx->family == CHIP_RV620 || rctx->family == CHIP_RV635)
- quirk = true;
-
- memset(&dsa, 0, sizeof(dsa));
-
- if (quirk) {
- dsa.depth.enabled = 1;
- dsa.depth.func = PIPE_FUNC_LEQUAL;
- dsa.stencil[0].enabled = 1;
- dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
- dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_KEEP;
- dsa.stencil[0].zfail_op = PIPE_STENCIL_OP_INCR;
- dsa.stencil[0].writemask = 0xff;
- }
-
- rstate = rctx->context.create_depth_stencil_alpha_state(&rctx->context, &dsa);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_02880C_DB_SHADER_CONTROL,
- 0x0,
- S_02880C_DUAL_EXPORT_ENABLE(1), NULL);
- r600_pipe_state_add_reg(rstate, R600_GROUP_CONTEXT,
- R_028D0C_DB_RENDER_CONTROL,
- S_028D0C_DEPTH_COPY_ENABLE(1) |
- S_028D0C_STENCIL_COPY_ENABLE(1) |
- S_028D0C_COPY_CENTROID(1),
- S_028D0C_DEPTH_COPY_ENABLE(1) |
- S_028D0C_STENCIL_COPY_ENABLE(1) |
- S_028D0C_COPY_CENTROID(1), NULL);
- return rstate;
-}
-
-static struct pipe_context *r600_create_context2(struct pipe_screen *screen, void *priv)
-{
- struct r600_pipe_context *rctx = CALLOC_STRUCT(r600_pipe_context);
- struct r600_screen* rscreen = (struct r600_screen *)screen;
-
- if (rctx == NULL)
- return NULL;
- rctx->context.winsys = rscreen->screen.winsys;
- rctx->context.screen = screen;
- rctx->context.priv = priv;
- rctx->context.destroy = r600_destroy_context;
- rctx->context.flush = r600_flush2;
-
- /* Easy accessing of screen/winsys. */
- rctx->screen = rscreen;
- rctx->radeon = rscreen->radeon;
- rctx->family = r600_get_family(rctx->radeon);
-
- r600_init_blit_functions2(rctx);
- r600_init_query_functions2(rctx);
- r600_init_context_resource_functions2(rctx);
-
- switch (r600_get_family(rctx->radeon)) {
- case CHIP_R600:
- case CHIP_RV610:
- case CHIP_RV630:
- case CHIP_RV670:
- case CHIP_RV620:
- case CHIP_RV635:
- case CHIP_RS780:
- case CHIP_RS880:
- case CHIP_RV770:
- case CHIP_RV730:
- case CHIP_RV710:
- case CHIP_RV740:
- rctx->context.draw_vbo = r600_draw_vbo2;
- r600_init_state_functions2(rctx);
- if (r600_context_init(&rctx->ctx, rctx->radeon)) {
- r600_destroy_context(&rctx->context);
- return NULL;
- }
- r600_init_config2(rctx);
- break;
- case CHIP_CEDAR:
- case CHIP_REDWOOD:
- case CHIP_JUNIPER:
- case CHIP_CYPRESS:
- case CHIP_HEMLOCK:
- rctx->context.draw_vbo = evergreen_draw;
- evergreen_init_state_functions2(rctx);
- if (evergreen_context_init(&rctx->ctx, rctx->radeon)) {
- r600_destroy_context(&rctx->context);
- return NULL;
- }
- evergreen_init_config2(rctx);
- break;
- default:
- R600_ERR("unsupported family %d\n", r600_get_family(rctx->radeon));
- r600_destroy_context(&rctx->context);
- return NULL;
- }
-
- rctx->upload_ib = u_upload_create(&rctx->context, 32 * 1024, 16,
- PIPE_BIND_INDEX_BUFFER);
- if (rctx->upload_ib == NULL) {
- r600_destroy_context(&rctx->context);
- return NULL;
- }
-
- rctx->upload_vb = u_upload_create(&rctx->context, 128 * 1024, 16,
- PIPE_BIND_VERTEX_BUFFER);
- if (rctx->upload_vb == NULL) {
- r600_destroy_context(&rctx->context);
- return NULL;
- }
-
- rctx->blitter = util_blitter_create(&rctx->context);
- if (rctx->blitter == NULL) {
- FREE(rctx);
- return NULL;
- }
-
- LIST_INITHEAD(&rctx->query_list);
- rctx->custom_dsa_flush = r600_create_db_flush_dsa(rctx);
-
- r600_blit_uncompress_depth_ptr = r600_blit_uncompress_depth2;
-
- return &rctx->context;
-}
-
-static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param)
-{
- switch(shader)
- {
- case PIPE_SHADER_FRAGMENT:
- case PIPE_SHADER_VERTEX:
- break;
- case PIPE_SHADER_GEOMETRY:
- /* TODO: support and enable geometry programs */
- return 0;
- default:
- /* TODO: support tessellation on Evergreen */
- return 0;
- }
-
- /* TODO: all these should be fixed, since r600 surely supports much more! */
- switch (param) {
- case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
- case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
- case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
- case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
- return 16384;
- case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
- return 8; /* FIXME */
- case PIPE_SHADER_CAP_MAX_INPUTS:
- if(shader == PIPE_SHADER_FRAGMENT)
- return 10;
- else
- return 16;
- case PIPE_SHADER_CAP_MAX_TEMPS:
- return 256; //max native temporaries
- case PIPE_SHADER_CAP_MAX_ADDRS:
- return 1; //max native address registers/* FIXME Isn't this equal to TEMPS? */
- case PIPE_SHADER_CAP_MAX_CONSTS:
- return 256; //max native parameters
- case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
- return 1;
- case PIPE_SHADER_CAP_MAX_PREDS:
- return 0; /* FIXME */
- case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
- return 1;
- default:
- return 0;
- }
-}
-
-struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
- const struct pipe_resource *templ);
-struct pipe_resource *r600_user_buffer_create2(struct pipe_screen *screen,
- void *ptr, unsigned bytes,
- unsigned bind)
-{
- struct pipe_resource *resource;
- struct r600_resource *rresource;
- struct pipe_resource desc;
- struct radeon *radeon = (struct radeon *)screen->winsys;
- void *rptr;
-
- desc.screen = screen;
- desc.target = PIPE_BUFFER;
- desc.format = PIPE_FORMAT_R8_UNORM;
- desc.usage = PIPE_USAGE_IMMUTABLE;
- desc.bind = bind;
- desc.width0 = bytes;
- desc.height0 = 1;
- desc.depth0 = 1;
- desc.flags = 0;
- resource = r600_buffer_create(screen, &desc);
- if (resource == NULL) {
- return NULL;
- }
-
- rresource = (struct r600_resource *)resource;
- rptr = radeon_ws_bo_map(radeon, rresource->bo, 0, NULL);
- memcpy(rptr, ptr, bytes);
- radeon_ws_bo_unmap(radeon, rresource->bo);
-
- return resource;
-}
-
-void r600_init_screen_texture_functions(struct pipe_screen *screen);
-struct pipe_screen *r600_screen_create2(struct radeon *radeon)
-{
- struct r600_screen *rscreen;
-
- rscreen = CALLOC_STRUCT(r600_screen);
- if (rscreen == NULL) {
- return NULL;
- }
-
- rscreen->radeon = radeon;
- rscreen->screen.winsys = (struct pipe_winsys*)radeon;
- rscreen->screen.destroy = r600_destroy_screen;
- rscreen->screen.get_name = r600_get_name;
- rscreen->screen.get_vendor = r600_get_vendor;
- rscreen->screen.get_param = r600_get_param;
- rscreen->screen.get_shader_param = r600_get_shader_param;
- rscreen->screen.get_paramf = r600_get_paramf;
- rscreen->screen.is_format_supported = r600_is_format_supported;
- rscreen->screen.context_create = r600_create_context2;
- r600_init_screen_texture_functions(&rscreen->screen);
- r600_init_screen_resource_functions(&rscreen->screen);
-// rscreen->screen.user_buffer_create = r600_user_buffer_create2;
-
- return &rscreen->screen;
-}
-
-int r600_upload_index_buffer2(struct r600_pipe_context *rctx, struct r600_drawl *draw)
-{
- struct pipe_resource *upload_buffer = NULL;
- unsigned index_offset = draw->index_buffer_offset;
- int ret = 0;
-
- if (r600_buffer_is_user_buffer(draw->index_buffer)) {
- ret = u_upload_buffer(rctx->upload_ib,
- index_offset,
- draw->count * draw->index_size,
- draw->index_buffer,
- &index_offset,
- &upload_buffer);
- if (ret) {
- goto done;
- }
- draw->index_buffer_offset = index_offset;
- draw->index_buffer = upload_buffer;
- }
-
-done:
- return ret;
-}
-
-int r600_upload_user_buffers2(struct r600_pipe_context *rctx)
-{
- enum pipe_error ret = PIPE_OK;
- int i, nr;
-
- nr = rctx->vertex_elements->count;
-
- for (i = 0; i < nr; i++) {
- struct pipe_vertex_buffer *vb =
- &rctx->vertex_buffer[rctx->vertex_elements->elements[i].vertex_buffer_index];
-
- if (r600_buffer_is_user_buffer(vb->buffer)) {
- struct pipe_resource *upload_buffer = NULL;
- unsigned offset = 0; /*vb->buffer_offset * 4;*/
- unsigned size = vb->buffer->width0;
- unsigned upload_offset;
- ret = u_upload_buffer(rctx->upload_vb,
- offset, size,
- vb->buffer,
- &upload_offset, &upload_buffer);
- if (ret)
- return ret;
-
- pipe_resource_reference(&vb->buffer, NULL);
- vb->buffer = upload_buffer;
- vb->buffer_offset = upload_offset;
- }
- }
- return ret;
-}
#include "util/u_format.h"
#include "r600d.h"
+#include "r600_formats.h"
static INLINE uint32_t r600_translate_blend_function(int blend_func)
{
case PIPE_FORMAT_Z16_UNORM:
return V_0280A0_SWAP_STD;
+ case PIPE_FORMAT_L8A8_UNORM:
+ case PIPE_FORMAT_R8G8_UNORM:
+ return V_0280A0_SWAP_STD;
+
+ case PIPE_FORMAT_R16_UNORM:
+ return V_0280A0_SWAP_STD;
+
/* 32-bit buffers. */
case PIPE_FORMAT_A8B8G8R8_SRGB:
case PIPE_FORMAT_R10SG10SB10SA2U_NORM:
return V_0280A0_SWAP_STD_REV;
+ case PIPE_FORMAT_R16G16_UNORM:
+ return V_0280A0_SWAP_STD;
+
/* 64-bit buffers. */
case PIPE_FORMAT_R16G16B16A16_UNORM:
case PIPE_FORMAT_R16G16B16A16_SNORM:
- // return V_0280A0_COLOR_16_16_16_16;
+ // return FMT_16_16_16_16;
case PIPE_FORMAT_R16G16B16A16_FLOAT:
- // return V_0280A0_COLOR_16_16_16_16_FLOAT;
+ // return FMT_16_16_16_16_FLOAT;
/* 128-bit buffers. */
case PIPE_FORMAT_R32G32B32A32_FLOAT:
- // return V_0280A0_COLOR_32_32_32_32_FLOAT;
+ // return FMT_32_32_32_32_FLOAT;
return 0;
default:
R600_ERR("unsupported colorswap format %d\n", format);
case PIPE_FORMAT_Z16_UNORM:
return V_0280A0_COLOR_16;
+ case PIPE_FORMAT_L8A8_UNORM:
+ case PIPE_FORMAT_R8G8_UNORM:
+ return V_0280A0_COLOR_8_8;
+
+ case PIPE_FORMAT_R16_UNORM:
+ return V_0280A0_COLOR_16;
+
/* 32-bit buffers. */
case PIPE_FORMAT_A8B8G8R8_SRGB:
case PIPE_FORMAT_A8B8G8R8_UNORM:
return V_0280A0_COLOR_16_16_FLOAT;
case PIPE_FORMAT_R16G16_SSCALED:
+ case PIPE_FORMAT_R16G16_UNORM:
return V_0280A0_COLOR_16_16;
}
}
-static INLINE void r600_translate_vertex_num_format(enum pipe_format format, uint32_t *num_format_p,
- uint32_t *format_comp_p)
-{
- uint32_t num_format = 0, format_comp = 0;
- switch (format) {
- case PIPE_FORMAT_R16G16B16A16_SSCALED:
- case PIPE_FORMAT_R16G16B16_SSCALED:
- case PIPE_FORMAT_R16G16_SSCALED:
- case PIPE_FORMAT_R32G32_SSCALED:
- format_comp = 1;
- case PIPE_FORMAT_R16G16B16A16_USCALED:
- case PIPE_FORMAT_R16G16B16_USCALED:
- case PIPE_FORMAT_R16G16_USCALED:
- case PIPE_FORMAT_R32G32_USCALED:
- num_format = V_038008_SQ_NUM_FORMAT_SCALED;
- break;
- default:
- break;
- }
- *num_format_p = num_format;
- *format_comp_p = format_comp;
-}
-
static INLINE boolean r600_is_sampler_format_supported(enum pipe_format format)
{
return r600_translate_texformat(format, NULL, NULL, NULL) != ~0;
return r600_translate_colorformat(format) != ~0;
}
+static INLINE uint32_t r600_translate_vertex_data_type(enum pipe_format format)
+{
+ uint32_t result = 0;
+ const struct util_format_description *desc;
+ unsigned i;
+
+ desc = util_format_description(format);
+ if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
+ goto out_unknown;
+ }
+
+ /* Find the first non-VOID channel. */
+ for (i = 0; i < 4; i++) {
+ if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
+ break;
+ }
+ }
+
+ switch (desc->channel[i].type) {
+ /* Half-floats, floats, doubles */
+ case UTIL_FORMAT_TYPE_FLOAT:
+ switch (desc->channel[i].size) {
+ case 16:
+ switch (desc->nr_channels) {
+ case 1:
+ result = FMT_16_FLOAT;
+ break;
+ case 2:
+ result = FMT_16_16_FLOAT;
+ break;
+ case 3:
+ result = FMT_16_16_16_FLOAT;
+ break;
+ case 4:
+ result = FMT_16_16_16_16_FLOAT;
+ break;
+ }
+ break;
+ case 32:
+ switch (desc->nr_channels) {
+ case 1:
+ result = FMT_32_FLOAT;
+ break;
+ case 2:
+ result = FMT_32_32_FLOAT;
+ break;
+ case 3:
+ result = FMT_32_32_32_FLOAT;
+ break;
+ case 4:
+ result = FMT_32_32_32_32_FLOAT;
+ break;
+ }
+ break;
+ default:
+ goto out_unknown;
+ }
+ break;
+ /* Unsigned ints */
+ case UTIL_FORMAT_TYPE_UNSIGNED:
+ /* Signed ints */
+ case UTIL_FORMAT_TYPE_SIGNED:
+ switch (desc->channel[i].size) {
+ case 8:
+ switch (desc->nr_channels) {
+ case 1:
+ result = FMT_8;
+ break;
+ case 2:
+ result = FMT_8_8;
+ break;
+ case 3:
+ // result = FMT_8_8_8; /* fails piglit draw-vertices test */
+ // break;
+ case 4:
+ result = FMT_8_8_8_8;
+ break;
+ }
+ break;
+ case 16:
+ switch (desc->nr_channels) {
+ case 1:
+ result = FMT_16;
+ break;
+ case 2:
+ result = FMT_16_16;
+ break;
+ case 3:
+ // result = FMT_16_16_16; /* fails piglit draw-vertices test */
+ // break;
+ case 4:
+ result = FMT_16_16_16_16;
+ break;
+ }
+ break;
+ case 32:
+ switch (desc->nr_channels) {
+ case 1:
+ result = FMT_32;
+ break;
+ case 2:
+ result = FMT_32_32;
+ break;
+ case 3:
+ result = FMT_32_32_32;
+ break;
+ case 4:
+ result = FMT_32_32_32_32;
+ break;
+ }
+ break;
+ default:
+ goto out_unknown;
+ }
+ break;
+ default:
+ goto out_unknown;
+ }
+
+ result = S_038008_DATA_FORMAT(result);
+
+ if (desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED) {
+ result |= S_038008_FORMAT_COMP_ALL(1);
+ }
+ if (desc->channel[i].normalized) {
+ result |= S_038008_NUM_FORMAT_ALL(0);
+ } else {
+ result |= S_038008_NUM_FORMAT_ALL(2);
+ }
+ return result;
+out_unknown:
+ R600_ERR("unsupported vertex format %s\n", util_format_name(format));
+ return ~0;
+}
+
#endif
#include <util/u_inlines.h>
#include <util/u_memory.h>
#include "state_tracker/drm_driver.h"
-#include "r600_screen.h"
-#include "r600_context.h"
+#include "r600_pipe.h"
#include "r600_resource.h"
#include "r600_state_inlines.h"
#include "r600d.h"
+#include "r600_formats.h"
extern struct u_resource_vtbl r600_texture_vtbl;
transfer->box.width, transfer->box.height);
}
-static unsigned long r600_texture_get_offset(struct r600_resource_texture *rtex,
+
+/* Copy from a detiled texture to a tiled one. */
+static void r600_copy_into_tiled_texture(struct pipe_context *ctx, struct r600_transfer *rtransfer)
+{
+ struct pipe_transfer *transfer = (struct pipe_transfer*)rtransfer;
+ struct pipe_resource *texture = transfer->resource;
+ struct pipe_subresource subsrc;
+
+ subsrc.face = 0;
+ subsrc.level = 0;
+ ctx->resource_copy_region(ctx, texture, transfer->sr,
+ transfer->box.x, transfer->box.y, transfer->box.z,
+ rtransfer->linear_texture, subsrc,
+ 0, 0, 0,
+ transfer->box.width, transfer->box.height);
+
+ ctx->flush(ctx, 0, NULL);
+}
+
+static unsigned r600_texture_get_offset(struct r600_resource_texture *rtex,
unsigned level, unsigned zslice,
unsigned face)
{
- unsigned long offset = rtex->offset[level];
+ unsigned offset = rtex->offset[level];
switch (rtex->resource.base.b.target) {
case PIPE_TEXTURE_3D:
}
}
-static void r600_setup_miptree(struct r600_resource_texture *rtex, enum chip_class chipc)
+static unsigned r600_texture_get_stride(struct pipe_screen *screen,
+ struct r600_resource_texture *rtex,
+ unsigned level)
+{
+ struct pipe_resource *ptex = &rtex->resource.base.b;
+ struct radeon *radeon = (struct radeon *)screen->winsys;
+ enum chip_class chipc = r600_get_family_class(radeon);
+ unsigned width, stride;
+
+ if (rtex->pitch_override)
+ return rtex->pitch_override;
+
+ width = u_minify(ptex->width0, level);
+
+ stride = util_format_get_stride(ptex->format, align(width, 64));
+ if (chipc == EVERGREEN)
+ stride = align(stride, 512);
+ else
+ stride = align(stride, 256);
+ return stride;
+}
+
+static unsigned r600_texture_get_nblocksy(struct pipe_screen *screen,
+ struct r600_resource_texture *rtex,
+ unsigned level)
+{
+ struct pipe_resource *ptex = &rtex->resource.base.b;
+ unsigned height;
+
+ height = u_minify(ptex->height0, level);
+ height = util_next_power_of_two(height);
+ return util_format_get_nblocksy(ptex->format, height);
+}
+
+/* Get a width in pixels from a stride in bytes. */
+static unsigned pitch_to_width(enum pipe_format format,
+ unsigned pitch_in_bytes)
+{
+ return (pitch_in_bytes / util_format_get_blocksize(format)) *
+ util_format_get_blockwidth(format);
+}
+
+static void r600_setup_miptree(struct pipe_screen *screen,
+ struct r600_resource_texture *rtex)
{
struct pipe_resource *ptex = &rtex->resource.base.b;
- unsigned long w, h, pitch, size, layer_size, i, offset;
+ struct radeon *radeon = (struct radeon *)screen->winsys;
+ enum chip_class chipc = r600_get_family_class(radeon);
+ unsigned pitch, size, layer_size, i, offset;
+ unsigned nblocksy;
- rtex->bpt = util_format_get_blocksize(ptex->format);
for (i = 0, offset = 0; i <= ptex->last_level; i++) {
- w = u_minify(ptex->width0, i);
- h = u_minify(ptex->height0, i);
- h = util_next_power_of_two(h);
- pitch = util_format_get_stride(ptex->format, align(w, 64));
- if (chipc == EVERGREEN)
- pitch = align(pitch, 512);
- else
- pitch = align(pitch, 256);
- layer_size = pitch * h;
+ pitch = r600_texture_get_stride(screen, rtex, i);
+ nblocksy = r600_texture_get_nblocksy(screen, rtex, i);
+
+ layer_size = pitch * nblocksy;
+
if (ptex->target == PIPE_TEXTURE_CUBE) {
if (chipc >= R700)
size = layer_size * 8;
size = layer_size * u_minify(ptex->depth0, i);
rtex->offset[i] = offset;
rtex->layer_size[i] = layer_size;
- rtex->pitch[i] = pitch;
- rtex->width[i] = w;
- rtex->height[i] = h;
+ rtex->pitch_in_bytes[i] = pitch;
+ rtex->pitch_in_pixels[i] = pitch_to_width(ptex->format, pitch);
offset += size;
}
rtex->size = offset;
}
-struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
- const struct pipe_resource *templ)
+static struct r600_resource_texture *
+r600_texture_create_object(struct pipe_screen *screen,
+ const struct pipe_resource *base,
+ unsigned array_mode,
+ unsigned pitch_in_bytes_override,
+ unsigned max_buffer_size,
+ struct r600_bo *bo)
{
struct r600_resource_texture *rtex;
struct r600_resource *resource;
struct radeon *radeon = (struct radeon *)screen->winsys;
rtex = CALLOC_STRUCT(r600_resource_texture);
- if (!rtex) {
+ if (rtex == NULL)
return NULL;
- }
+
resource = &rtex->resource;
- resource->base.b = *templ;
+ resource->base.b = *base;
resource->base.vtbl = &r600_texture_vtbl;
pipe_reference_init(&resource->base.b.reference, 1);
resource->base.b.screen = screen;
- r600_setup_miptree(rtex, radeon_get_family_class(radeon));
-
- /* FIXME alignment 4096 enought ? too much ? */
+ resource->bo = bo;
resource->domain = r600_domain_from_usage(resource->base.b.bind);
+ rtex->pitch_override = pitch_in_bytes_override;
+ rtex->array_mode = array_mode;
+
+ if (array_mode)
+ rtex->tiled = 1;
+ r600_setup_miptree(screen, rtex);
+
resource->size = rtex->size;
- resource->bo = radeon_ws_bo(radeon, rtex->size, 4096, 0);
- if (resource->bo == NULL) {
- FREE(rtex);
- return NULL;
+
+ if (!resource->bo) {
+ resource->bo = r600_bo(radeon, rtex->size, 4096, 0);
+ if (!resource->bo) {
+ FREE(rtex);
+ return NULL;
+ }
}
- return &resource->base.b;
+ return rtex;
+}
+
+struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
+ const struct pipe_resource *templ)
+{
+ unsigned array_mode = 0;
+
+ return (struct pipe_resource *)r600_texture_create_object(screen, templ, array_mode,
+ 0, 0, NULL);
+
}
static void r600_texture_destroy(struct pipe_screen *screen,
pipe_resource_reference((struct pipe_resource **)&rtex->flushed_depth_texture, NULL);
if (resource->bo) {
- radeon_ws_bo_reference(radeon, &resource->bo, NULL);
+ r600_bo_reference(radeon, &resource->bo, NULL);
}
FREE(rtex);
}
{
struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
struct pipe_surface *surface = CALLOC_STRUCT(pipe_surface);
- unsigned long offset;
+ unsigned offset;
if (surface == NULL)
return NULL;
FREE(surface);
}
+
struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen,
const struct pipe_resource *templ,
struct winsys_handle *whandle)
{
struct radeon *rw = (struct radeon*)screen->winsys;
- struct r600_resource_texture *rtex;
- struct r600_resource *resource;
- struct radeon_ws_bo *bo = NULL;
+ struct r600_bo *bo = NULL;
+ unsigned array_mode = 0;
/* Support only 2D textures without mipmaps */
if ((templ->target != PIPE_TEXTURE_2D && templ->target != PIPE_TEXTURE_RECT) ||
templ->depth0 != 1 || templ->last_level != 0)
return NULL;
- rtex = CALLOC_STRUCT(r600_resource_texture);
- if (rtex == NULL)
- return NULL;
-
- bo = radeon_ws_bo_handle(rw, whandle->handle);
+ bo = r600_bo_handle(rw, whandle->handle, &array_mode);
if (bo == NULL) {
- FREE(rtex);
return NULL;
}
- resource = &rtex->resource;
- resource->base.b = *templ;
- resource->base.vtbl = &r600_texture_vtbl;
- pipe_reference_init(&resource->base.b.reference, 1);
- resource->base.b.screen = screen;
- resource->bo = bo;
- rtex->depth = 0;
- rtex->pitch_override = whandle->stride;
- rtex->bpt = util_format_get_blocksize(templ->format);
- rtex->pitch[0] = whandle->stride;
- rtex->width[0] = templ->width0;
- rtex->height[0] = templ->height0;
- rtex->offset[0] = 0;
- rtex->size = align(rtex->pitch[0] * templ->height0, 64);
-
- return &resource->base.b;
+ return (struct pipe_resource *)r600_texture_create_object(screen, templ, array_mode,
+ whandle->stride,
+ 0,
+ bo);
}
static unsigned int r600_texture_is_referenced(struct pipe_context *context,
resource.format = texture->format;
resource.width0 = texture->width0;
resource.height0 = texture->height0;
- resource.depth0 = 0;
+ resource.depth0 = 1;
resource.last_level = 0;
resource.nr_samples = 0;
resource.usage = PIPE_USAGE_DYNAMIC;
resource.bind = 0;
resource.flags = 0;
- resource.bind |= PIPE_BIND_RENDER_TARGET;
+ resource.bind |= PIPE_BIND_DEPTH_STENCIL;
rtex->flushed_depth_texture = (struct r600_resource_texture *)ctx->screen->resource_create(ctx->screen, &resource);
if (rtex->flushed_depth_texture == NULL) {
trans->transfer.sr = sr;
trans->transfer.usage = usage;
trans->transfer.box = *box;
- trans->transfer.stride = rtex->pitch[sr.level];
- trans->offset = r600_texture_get_offset(rtex, sr.level, box->z, sr.face);
if (rtex->depth) {
r = r600_texture_depth_flush(ctx, texture);
if (r < 0) {
resource.format = texture->format;
resource.width0 = box->width;
resource.height0 = box->height;
- resource.depth0 = 0;
+ resource.depth0 = 1;
resource.last_level = 0;
resource.nr_samples = 0;
resource.usage = PIPE_USAGE_DYNAMIC;
FREE(trans);
return NULL;
}
+
+ trans->transfer.stride =
+ ((struct r600_resource_texture *)trans->linear_texture)->pitch_in_bytes[0];
if (usage & PIPE_TRANSFER_READ) {
/* We cannot map a tiled texture directly because the data is
* in a different order, therefore we do detiling using a blit. */
/* Always referenced in the blit. */
ctx->flush(ctx, 0, NULL);
}
+ return &trans->transfer;
}
+ trans->transfer.stride = rtex->pitch_in_bytes[sr.level];
+ trans->offset = r600_texture_get_offset(rtex, sr.level, box->z, sr.face);
return &trans->transfer;
}
struct r600_resource_texture *rtex = (struct r600_resource_texture*)transfer->resource;
if (rtransfer->linear_texture) {
+ if (transfer->usage & PIPE_TRANSFER_WRITE) {
+ r600_copy_into_tiled_texture(ctx, rtransfer);
+ }
pipe_resource_reference(&rtransfer->linear_texture, NULL);
}
if (rtex->flushed_depth_texture) {
- if (transfer->usage & PIPE_TRANSFER_WRITE) {
- // TODO
- }
pipe_resource_reference((struct pipe_resource **)&rtex->flushed_depth_texture, NULL);
}
pipe_resource_reference(&transfer->resource, NULL);
struct pipe_transfer* transfer)
{
struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
- struct radeon_ws_bo *bo;
+ struct r600_bo *bo;
enum pipe_format format = transfer->resource->format;
struct radeon *radeon = (struct radeon *)ctx->screen->winsys;
- unsigned long offset = 0;
+ unsigned offset = 0;
char *map;
if (rtransfer->linear_texture) {
transfer->box.y / util_format_get_blockheight(format) * transfer->stride +
transfer->box.x / util_format_get_blockwidth(format) * util_format_get_blocksize(format);
}
- map = radeon_ws_bo_map(radeon, bo, 0, ctx);
+ map = r600_bo_map(radeon, bo, 0, ctx);
if (!map) {
return NULL;
}
{
struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
struct radeon *radeon = (struct radeon *)ctx->screen->winsys;
- struct radeon_ws_bo *bo;
+ struct r600_bo *bo;
if (rtransfer->linear_texture) {
bo = ((struct r600_resource *)rtransfer->linear_texture)->bo;
bo = ((struct r600_resource *)transfer->resource)->bo;
}
}
- radeon_ws_bo_unmap(radeon, bo);
+ r600_bo_unmap(radeon, bo);
}
struct u_resource_vtbl r600_texture_vtbl =
case UTIL_FORMAT_COLORSPACE_ZS:
switch (format) {
case PIPE_FORMAT_Z16_UNORM:
- result = V_0280A0_COLOR_16;
+ result = FMT_16;
goto out_word4;
+ case PIPE_FORMAT_X24S8_USCALED:
+ word4 |= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT);
case PIPE_FORMAT_Z24X8_UNORM:
case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
- result = V_0280A0_COLOR_8_24;
+ result = FMT_8_24;
goto out_word4;
+ case PIPE_FORMAT_S8X24_USCALED:
+ word4 |= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT);
case PIPE_FORMAT_X8Z24_UNORM:
case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
- result = V_0280A0_COLOR_24_8;
+ result = FMT_24_8;
+ goto out_word4;
+ case PIPE_FORMAT_S8_USCALED:
+ result = V_0280A0_COLOR_8;
+ word4 |= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT);
goto out_word4;
default:
goto out_unknown;
if (desc->channel[0].size == 5 &&
desc->channel[1].size == 6 &&
desc->channel[2].size == 5) {
- result = V_0280A0_COLOR_5_6_5;
+ result = FMT_5_6_5;
goto out_word4;
}
goto out_unknown;
desc->channel[1].size == 5 &&
desc->channel[2].size == 5 &&
desc->channel[3].size == 1) {
- result = V_0280A0_COLOR_1_5_5_5;
+ result = FMT_1_5_5_5;
goto out_word4;
}
if (desc->channel[0].size == 10 &&
desc->channel[1].size == 10 &&
desc->channel[2].size == 10 &&
desc->channel[3].size == 2) {
- result = V_0280A0_COLOR_10_10_10_2;
+ result = FMT_10_10_10_2;
goto out_word4;
}
goto out_unknown;
goto out_unknown;
}
+ /* Find the first non-VOID channel. */
+ for (i = 0; i < 4; i++) {
+ if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
+ break;
+ }
+ }
+
+ if (i == 4)
+ goto out_unknown;
+
/* uniform formats */
- switch (desc->channel[0].type) {
+ switch (desc->channel[i].type) {
case UTIL_FORMAT_TYPE_UNSIGNED:
case UTIL_FORMAT_TYPE_SIGNED:
- if (!desc->channel[0].normalized &&
+ if (!desc->channel[i].normalized &&
desc->colorspace != UTIL_FORMAT_COLORSPACE_SRGB) {
goto out_unknown;
}
- switch (desc->channel[0].size) {
+ switch (desc->channel[i].size) {
case 4:
switch (desc->nr_channels) {
case 2:
- result = V_0280A0_COLOR_4_4;
+ result = FMT_4_4;
goto out_word4;
case 4:
- result = V_0280A0_COLOR_4_4_4_4;
+ result = FMT_4_4_4_4;
goto out_word4;
}
goto out_unknown;
case 8:
switch (desc->nr_channels) {
case 1:
- result = V_0280A0_COLOR_8;
+ result = FMT_8;
goto out_word4;
case 2:
- result = V_0280A0_COLOR_8_8;
+ result = FMT_8_8;
goto out_word4;
case 4:
- result = V_0280A0_COLOR_8_8_8_8;
+ result = FMT_8_8_8_8;
goto out_word4;
}
goto out_unknown;
case 16:
switch (desc->nr_channels) {
case 1:
- result = V_0280A0_COLOR_16;
+ result = FMT_16;
goto out_word4;
case 2:
- result = V_0280A0_COLOR_16_16;
+ result = FMT_16_16;
goto out_word4;
case 4:
- result = V_0280A0_COLOR_16_16_16_16;
+ result = FMT_16_16_16_16;
goto out_word4;
}
}
goto out_unknown;
case UTIL_FORMAT_TYPE_FLOAT:
- switch (desc->channel[0].size) {
+ switch (desc->channel[i].size) {
case 16:
switch (desc->nr_channels) {
case 1:
- result = V_0280A0_COLOR_16_FLOAT;
+ result = FMT_16_FLOAT;
goto out_word4;
case 2:
- result = V_0280A0_COLOR_16_16_FLOAT;
+ result = FMT_16_16_FLOAT;
goto out_word4;
case 4:
- result = V_0280A0_COLOR_16_16_16_16_FLOAT;
+ result = FMT_16_16_16_16_FLOAT;
goto out_word4;
}
goto out_unknown;
case 32:
switch (desc->nr_channels) {
case 1:
- result = V_0280A0_COLOR_32_FLOAT;
+ result = FMT_32_FLOAT;
goto out_word4;
case 2:
- result = V_0280A0_COLOR_32_32_FLOAT;
+ result = FMT_32_32_FLOAT;
goto out_word4;
case 4:
- result = V_0280A0_COLOR_32_32_32_32_FLOAT;
+ result = FMT_32_32_32_32_FLOAT;
goto out_word4;
}
}
#define S_02880C_Z_EXPORT_ENABLE(x) (((x) & 0x1) << 0)
#define G_02880C_Z_EXPORT_ENABLE(x) (((x) >> 0) & 0x1)
#define C_02880C_Z_EXPORT_ENABLE 0xFFFFFFFE
+#define S_02880C_STENCIL_REF_EXPORT_ENABLE(x) (((x) & 0x1) << 1)
+#define G_02880C_STENCIL_REF_EXPORT_ENABLE(x) (((x) >> 1) & 0x1)
+#define C_02880C_STENCIL_REF_EXPORT_ENABLE 0xFFFFFFFD
#define S_02880C_Z_ORDER(x) (((x) & 0x3) << 4)
#define G_02880C_Z_ORDER(x) (((x) >> 4) & 0x3)
#define C_02880C_Z_ORDER 0xFFFFFCFF
#define S_038000_TILE_MODE(x) (((x) & 0xF) << 3)
#define G_038000_TILE_MODE(x) (((x) >> 3) & 0xF)
#define C_038000_TILE_MODE 0xFFFFFF87
+#define V_038000_ARRAY_LINEAR_GENERAL 0x00000000
+#define V_038000_ARRAY_LINEAR_ALIGNED 0x00000001
+#define V_038000_ARRAY_1D_TILED_THIN1 0x00000002
+#define V_038000_ARRAY_2D_TILED_THIN1 0x00000004
#define S_038000_TILE_TYPE(x) (((x) & 0x1) << 7)
#define G_038000_TILE_TYPE(x) (((x) >> 7) & 0x1)
#define C_038000_TILE_TYPE 0xFFFFFF7F
#define S_038008_DATA_FORMAT(x) (((x) & 0x3F) << 20)
#define G_038008_DATA_FORMAT(x) (((x) >> 20) & 0x3F)
#define C_038008_DATA_FORMAT 0xFC0FFFFF
-#define V_038008_COLOR_INVALID 0x00000000
-#define V_038008_COLOR_8 0x00000001
-#define V_038008_COLOR_4_4 0x00000002
-#define V_038008_COLOR_3_3_2 0x00000003
-#define V_038008_COLOR_16 0x00000005
-#define V_038008_COLOR_16_FLOAT 0x00000006
-#define V_038008_COLOR_8_8 0x00000007
-#define V_038008_COLOR_5_6_5 0x00000008
-#define V_038008_COLOR_6_5_5 0x00000009
-#define V_038008_COLOR_1_5_5_5 0x0000000A
-#define V_038008_COLOR_4_4_4_4 0x0000000B
-#define V_038008_COLOR_5_5_5_1 0x0000000C
-#define V_038008_COLOR_32 0x0000000D
-#define V_038008_COLOR_32_FLOAT 0x0000000E
-#define V_038008_COLOR_16_16 0x0000000F
-#define V_038008_COLOR_16_16_FLOAT 0x00000010
-#define V_038008_COLOR_8_24 0x00000011
-#define V_038008_COLOR_8_24_FLOAT 0x00000012
-#define V_038008_COLOR_24_8 0x00000013
-#define V_038008_COLOR_24_8_FLOAT 0x00000014
-#define V_038008_COLOR_10_11_11 0x00000015
-#define V_038008_COLOR_10_11_11_FLOAT 0x00000016
-#define V_038008_COLOR_11_11_10 0x00000017
-#define V_038008_COLOR_11_11_10_FLOAT 0x00000018
-#define V_038008_COLOR_2_10_10_10 0x00000019
-#define V_038008_COLOR_8_8_8_8 0x0000001A
-#define V_038008_COLOR_10_10_10_2 0x0000001B
-#define V_038008_COLOR_X24_8_32_FLOAT 0x0000001C
-#define V_038008_COLOR_32_32 0x0000001D
-#define V_038008_COLOR_32_32_FLOAT 0x0000001E
-#define V_038008_COLOR_16_16_16_16 0x0000001F
-#define V_038008_COLOR_16_16_16_16_FLOAT 0x00000020
-#define V_038008_COLOR_32_32_32_32 0x00000022
-#define V_038008_COLOR_32_32_32_32_FLOAT 0x00000023
+
#define S_038008_NUM_FORMAT_ALL(x) (((x) & 0x3) << 26)
#define G_038008_NUM_FORMAT_ALL(x) (((x) >> 26) & 0x3)
#define C_038008_NUM_FORMAT_ALL 0xF3FFFFFF
#define R_038014_RESOURCE0_WORD5 0x038014
#define R_038018_RESOURCE0_WORD6 0x038018
+#define R_028140_ALU_CONST_BUFFER_SIZE_PS_0 0x00028140
+#define R_028180_ALU_CONST_BUFFER_SIZE_VS_0 0x00028180
+#define R_028940_ALU_CONST_CACHE_PS_0 0x00028940
+#define R_028980_ALU_CONST_CACHE_VS_0 0x00028980
+
+#define R_03CFF0_SQ_VTX_BASE_VTX_LOC 0x03CFF0
+#define R_03CFF4_SQ_VTX_START_INST_LOC 0x03CFF4
+
+#define R_03E200_SQ_LOOP_CONST_0 0x3E200
+
#define SQ_TEX_INST_LD 0x03
#define SQ_TEX_INST_GET_GRADIENTS_H 0x7
#define SQ_TEX_INST_GET_GRADIENTS_V 0x8
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "radeon.h"
-#include "r600_context.h"
-#include "r600_asm.h"
+#include <stdio.h>
#include "util/u_memory.h"
+#include "r600_pipe.h"
+#include "r600_asm.h"
#include "r700_sq.h"
-#include <stdio.h>
int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id)
+++ /dev/null
-/*
- * Copyright © 2009 Jerome Glisse <glisse@freedesktop.org>
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-#ifndef RADEON_H
-#define RADEON_H
-
-#define RADEON_CTX_MAX_PM4 (64 * 1024 / 4)
-
-#include <stdint.h>
-
-#include <pipe/p_compiler.h>
-
-typedef uint64_t u64;
-typedef uint32_t u32;
-typedef uint16_t u16;
-typedef uint8_t u8;
-
-struct radeon;
-
-enum radeon_family {
- CHIP_UNKNOWN,
- CHIP_R100,
- CHIP_RV100,
- CHIP_RS100,
- CHIP_RV200,
- CHIP_RS200,
- CHIP_R200,
- CHIP_RV250,
- CHIP_RS300,
- CHIP_RV280,
- CHIP_R300,
- CHIP_R350,
- CHIP_RV350,
- CHIP_RV380,
- CHIP_R420,
- CHIP_R423,
- CHIP_RV410,
- CHIP_RS400,
- CHIP_RS480,
- CHIP_RS600,
- CHIP_RS690,
- CHIP_RS740,
- CHIP_RV515,
- CHIP_R520,
- CHIP_RV530,
- CHIP_RV560,
- CHIP_RV570,
- CHIP_R580,
- CHIP_R600,
- CHIP_RV610,
- CHIP_RV630,
- CHIP_RV670,
- CHIP_RV620,
- CHIP_RV635,
- CHIP_RS780,
- CHIP_RS880,
- CHIP_RV770,
- CHIP_RV730,
- CHIP_RV710,
- CHIP_RV740,
- CHIP_CEDAR,
- CHIP_REDWOOD,
- CHIP_JUNIPER,
- CHIP_CYPRESS,
- CHIP_HEMLOCK,
- CHIP_LAST,
-};
-
-enum chip_class {
- R600,
- R700,
- EVERGREEN,
-};
-
-enum {
- R600_SHADER_PS = 1,
- R600_SHADER_VS,
- R600_SHADER_GS,
- R600_SHADER_FS,
- R600_SHADER_MAX = R600_SHADER_FS,
-};
-
-enum radeon_family radeon_get_family(struct radeon *rw);
-enum chip_class radeon_get_family_class(struct radeon *radeon);
-void radeon_set_mem_constant(struct radeon *radeon, boolean state);
-
-/* lowlevel WS bo */
-struct radeon_ws_bo;
-struct radeon_ws_bo *radeon_ws_bo(struct radeon *radeon,
- unsigned size, unsigned alignment, unsigned usage);
-struct radeon_ws_bo *radeon_ws_bo_handle(struct radeon *radeon,
- unsigned handle);
-void *radeon_ws_bo_map(struct radeon *radeon, struct radeon_ws_bo *bo, unsigned usage, void *ctx);
-void radeon_ws_bo_unmap(struct radeon *radeon, struct radeon_ws_bo *bo);
-void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst,
- struct radeon_ws_bo *src);
-
-struct radeon_stype_info;
-
-/* currently limited to max buffers in a cb flush */
-#define RADEON_STATE_MAX_BO 8
-/*
- * states functions
- */
-struct radeon_state {
- struct radeon *radeon;
- unsigned refcount;
- struct radeon_stype_info *stype;
- unsigned state_id;
- unsigned id;
- unsigned shader_index;
- unsigned nstates;
- u32 states[64];
- unsigned npm4;
- unsigned cpm4;
- u32 pm4_crc;
- u32 pm4[128];
- unsigned nbo;
- struct radeon_ws_bo *bo[RADEON_STATE_MAX_BO];
- unsigned nreloc;
- unsigned reloc_pm4_id[8];
- unsigned reloc_bo_id[8];
- u32 placement[8];
- unsigned bo_dirty[4];
-};
-
-int radeon_state_init(struct radeon_state *rstate, struct radeon *radeon, u32 type, u32 id, u32 shader_class);
-void radeon_state_fini(struct radeon_state *state);
-int radeon_state_pm4(struct radeon_state *state);
-int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shader_type);
-
-/*
- * draw functions
- */
-struct radeon_draw {
- struct radeon *radeon;
- struct radeon_state **state;
-};
-
-int radeon_draw_init(struct radeon_draw *draw, struct radeon *radeon);
-void radeon_draw_bind(struct radeon_draw *draw, struct radeon_state *state);
-void radeon_draw_unbind(struct radeon_draw *draw, struct radeon_state *state);
-
-/*
- * radeon context functions
- */
-#pragma pack(1)
-struct radeon_cs_reloc {
- uint32_t handle;
- uint32_t read_domain;
- uint32_t write_domain;
- uint32_t flags;
-};
-#pragma pack()
-
-struct radeon_ctx;
-
-struct radeon_ctx *radeon_ctx_init(struct radeon *radeon);
-void radeon_ctx_fini(struct radeon_ctx *ctx);
-void radeon_ctx_clear(struct radeon_ctx *ctx);
-int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw);
-int radeon_ctx_submit(struct radeon_ctx *ctx);
-void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file);
-int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state);
-
-/*
- * R600/R700
- */
-
-enum r600_stype {
- R600_STATE_CONFIG,
- R600_STATE_CB_CNTL,
- R600_STATE_RASTERIZER,
- R600_STATE_VIEWPORT,
- R600_STATE_SCISSOR,
- R600_STATE_BLEND,
- R600_STATE_DSA,
- R600_STATE_SHADER, /* has PS,VS,GS,FS variants */
- R600_STATE_CONSTANT, /* has PS,VS,GS,FS variants */
- R600_STATE_CBUF, /* has PS,VS,GS,FS variants */
- R600_STATE_RESOURCE, /* has PS,VS,GS,FS variants */
- R600_STATE_SAMPLER, /* has PS,VS,GS,FS variants */
- R600_STATE_SAMPLER_BORDER, /* has PS,VS,GS,FS variants */
- R600_STATE_CB0,
- R600_STATE_CB1,
- R600_STATE_CB2,
- R600_STATE_CB3,
- R600_STATE_CB4,
- R600_STATE_CB5,
- R600_STATE_CB6,
- R600_STATE_CB7,
- R600_STATE_DB,
- R600_STATE_QUERY_BEGIN,
- R600_STATE_QUERY_END,
- R600_STATE_UCP,
- R600_STATE_VGT,
- R600_STATE_DRAW,
- R600_STATE_CB_FLUSH,
- R600_STATE_DB_FLUSH,
- R600_STATE_MAX,
-};
-
-#include "r600_states_inc.h"
-#include "eg_states_inc.h"
-
-/* R600 QUERY BEGIN/END */
-#define R600_QUERY__OFFSET 0
-#define R600_QUERY_SIZE 1
-#define R600_QUERY_PM4 128
-
-#endif
case TGSI_SEMANTIC_POSITION:
{
uint j;
- for (j = 0; j < 4; j++) {
+
+ for (j = 0; j < 4; j++)
quad->output.depth[j] = machine->Outputs[i].xyzw[2].f[j];
- }
+ }
+ break;
+ case TGSI_SEMANTIC_STENCIL:
+ {
+ uint j;
+
+ for (j = 0; j < 4; j++)
+ quad->output.stencil[j] = (unsigned)machine->Outputs[i].xyzw[1].f[j];
}
break;
}
case TGSI_SEMANTIC_POSITION:
{
uint j;
- for (j = 0; j < 4; j++) {
- quad->output.depth[j] = machine->Outputs[0].xyzw[2].f[j];
- }
+ for (j = 0; j < 4; j++)
+ quad->output.depth[j] = machine->Outputs[i].xyzw[2].f[j];
+ }
+ break;
+ case TGSI_SEMANTIC_STENCIL:
+ {
+ uint j;
+ for (j = 0; j < 4; j++)
+ quad->output.stencil[j] = machine->Outputs[i].xyzw[1].f[j];
}
break;
}
/** colors in SOA format (rrrr, gggg, bbbb, aaaa) */
float color[PIPE_MAX_COLOR_BUFS][NUM_CHANNELS][QUAD_SIZE];
float depth[QUAD_SIZE];
+ uint8_t stencil[QUAD_SIZE];
};
unsigned bzzzz[QUAD_SIZE]; /**< Z values fetched from depth buffer */
unsigned qzzzz[QUAD_SIZE]; /**< Z values from the quad */
ubyte stencilVals[QUAD_SIZE];
+ boolean use_shader_stencil_refs;
+ ubyte shader_stencil_refs[QUAD_SIZE];
struct softpipe_cached_tile *tile;
};
}
+/**
+ * Compute the depth_data::shader_stencil_refs[] values from the float fragment stencil values.
+ */
+static void
+convert_quad_stencil( struct depth_data *data,
+ const struct quad_header *quad )
+{
+ unsigned j;
+
+ data->use_shader_stencil_refs = TRUE;
+ /* Copy quads stencil values
+ */
+ switch (data->format) {
+ case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+ case PIPE_FORMAT_X8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
+ {
+ for (j = 0; j < QUAD_SIZE; j++) {
+ data->shader_stencil_refs[j] = ((unsigned)(quad->output.stencil[j]));
+ }
+ }
+ break;
+ default:
+ assert(0);
+ }
+}
/**
* Write data->bzzzz[] values and data->stencilVals into the Z/stencil buffer.
{
unsigned passMask = 0x0;
unsigned j;
+ ubyte refs[QUAD_SIZE];
- ref &= valMask;
+ for (j = 0; j < QUAD_SIZE; j++) {
+ if (data->use_shader_stencil_refs)
+ refs[j] = data->shader_stencil_refs[j] & valMask;
+ else
+ refs[j] = ref & valMask;
+ }
switch (func) {
case PIPE_FUNC_NEVER:
break;
case PIPE_FUNC_LESS:
for (j = 0; j < QUAD_SIZE; j++) {
- if (ref < (data->stencilVals[j] & valMask)) {
+ if (refs[j] < (data->stencilVals[j] & valMask)) {
passMask |= (1 << j);
}
}
break;
case PIPE_FUNC_EQUAL:
for (j = 0; j < QUAD_SIZE; j++) {
- if (ref == (data->stencilVals[j] & valMask)) {
+ if (refs[j] == (data->stencilVals[j] & valMask)) {
passMask |= (1 << j);
}
}
break;
case PIPE_FUNC_LEQUAL:
for (j = 0; j < QUAD_SIZE; j++) {
- if (ref <= (data->stencilVals[j] & valMask)) {
+ if (refs[j] <= (data->stencilVals[j] & valMask)) {
passMask |= (1 << j);
}
}
break;
case PIPE_FUNC_GREATER:
for (j = 0; j < QUAD_SIZE; j++) {
- if (ref > (data->stencilVals[j] & valMask)) {
+ if (refs[j] > (data->stencilVals[j] & valMask)) {
passMask |= (1 << j);
}
}
break;
case PIPE_FUNC_NOTEQUAL:
for (j = 0; j < QUAD_SIZE; j++) {
- if (ref != (data->stencilVals[j] & valMask)) {
+ if (refs[j] != (data->stencilVals[j] & valMask)) {
passMask |= (1 << j);
}
}
break;
case PIPE_FUNC_GEQUAL:
for (j = 0; j < QUAD_SIZE; j++) {
- if (ref >= (data->stencilVals[j] & valMask)) {
+ if (refs[j] >= (data->stencilVals[j] & valMask)) {
passMask |= (1 << j);
}
}
{
unsigned j;
ubyte newstencil[QUAD_SIZE];
+ ubyte refs[QUAD_SIZE];
for (j = 0; j < QUAD_SIZE; j++) {
newstencil[j] = data->stencilVals[j];
+ if (data->use_shader_stencil_refs)
+ refs[j] = data->shader_stencil_refs[j];
+ else
+ refs[j] = ref;
}
switch (op) {
case PIPE_STENCIL_OP_REPLACE:
for (j = 0; j < QUAD_SIZE; j++) {
if (mask & (1 << j)) {
- newstencil[j] = ref;
+ newstencil[j] = refs[j];
}
}
break;
unsigned i, pass = 0;
const struct sp_fragment_shader *fs = qs->softpipe->fs;
boolean interp_depth = !fs->info.writes_z;
+ boolean shader_stencil_ref = fs->info.writes_stencil;
struct depth_data data;
+ data.use_shader_stencil_refs = FALSE;
if (qs->softpipe->depth_stencil->alpha.enabled) {
nr = alpha_test_quads(qs, quads, nr);
}
if (qs->softpipe->depth_stencil->stencil[0].enabled) {
+ if (shader_stencil_ref)
+ convert_quad_stencil(&data, quads[i]);
+
depth_stencil_test_quad(qs, &data, quads[i]);
write_depth_stencil_values(&data, quads[i]);
}
sp->framebuffer.zsbuf &&
!sp->depth_stencil->alpha.enabled &&
!sp->fs->info.uses_kill &&
- !sp->fs->info.writes_z;
+ !sp->fs->info.writes_z &&
+ !sp->fs->info.writes_stencil;
sp->quad.first = sp->quad.blend;
return 1;
case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
return 0;
+ case PIPE_CAP_SHADER_STENCIL_EXPORT:
+ return 1;
default:
return 0;
}
#include "util/u_memory.h"
#include "util/u_inlines.h"
-#include "draw/draw_context.h"
#include "draw/draw_context.h"
#include "sp_context.h"
trace_dump_call_begin("pipe_context", "draw_vbo");
trace_dump_arg(ptr, pipe);
- trace_dump_arg(bool, info->indexed);
- trace_dump_arg(uint, info->mode);
- trace_dump_arg(uint, info->start);
- trace_dump_arg(uint, info->count);
- trace_dump_arg(uint, info->start_instance);
- trace_dump_arg(uint, info->instance_count);
- trace_dump_arg(int, info->index_bias);
- trace_dump_arg(uint, info->min_index);
- trace_dump_arg(uint, info->max_index);
+ trace_dump_arg(draw_info, info);
pipe->draw_vbo(pipe, info);
static INLINE void
trace_context_set_index_buffer(struct pipe_context *_pipe,
- const struct pipe_index_buffer *_ib)
+ const struct pipe_index_buffer *ib)
{
struct trace_context *tr_ctx = trace_context(_pipe);
struct pipe_context *pipe = tr_ctx->pipe;
- struct pipe_index_buffer unwrapped_ib, *ib = NULL;
-
- if (_ib) {
- unwrapped_ib = *_ib;
- unwrapped_ib.buffer = trace_resource_unwrap(tr_ctx, _ib->buffer);
- ib = &unwrapped_ib;
- }
trace_dump_call_begin("pipe_context", "set_index_buffer");
trace_dump_arg(ptr, pipe);
- trace_dump_arg(index_buffer, _ib);
+ trace_dump_arg(index_buffer, ib);
- pipe->set_index_buffer(pipe, ib);
+ if (ib) {
+ struct pipe_index_buffer _ib;
+ _ib = *ib;
+ _ib.buffer = trace_resource_unwrap(tr_ctx, ib->buffer);
+ pipe->set_index_buffer(pipe, &_ib);
+ } else {
+ pipe->set_index_buffer(pipe, NULL);
+ }
trace_dump_call_end();
}
trace_dump_struct_end();
}
+
+
+void trace_dump_draw_info(const struct pipe_draw_info *state)
+{
+ if (!trace_dumping_enabled_locked())
+ return;
+
+ if(!state) {
+ trace_dump_null();
+ return;
+ }
+
+ trace_dump_struct_begin("pipe_draw_info");
+
+ trace_dump_member(bool, state, indexed);
+
+ trace_dump_member(uint, state, mode);
+ trace_dump_member(uint, state, start);
+ trace_dump_member(uint, state, count);
+
+ trace_dump_member(uint, state, start_instance);
+ trace_dump_member(uint, state, instance_count);
+
+ trace_dump_member(int, state, index_bias);
+ trace_dump_member(uint, state, min_index);
+ trace_dump_member(uint, state, max_index);
+
+ trace_dump_struct_end();
+}
void trace_dump_vertex_element(const struct pipe_vertex_element *state);
+void trace_dump_draw_info(const struct pipe_draw_info *state);
+
#endif /* TR_STATE_H */
# endif
#endif
+/*
+ * Define the C99 restrict keyword.
+ *
+ * See also:
+ * - http://cellperformance.beyond3d.com/articles/2006/05/demystifying-the-restrict-keyword.html
+ */
+#ifndef restrict
+# if (__STDC_VERSION__ >= 199901L)
+ /* C99 */
+# elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
+ /* C99 */
+# elif defined(__GNUC__)
+# define restrict __restrict__
+# elif defined(_MSC_VER)
+# define restrict __restrict
+# else
+# define restrict /* */
+# endif
+#endif
+
+
/* Function visibility */
#ifndef PUBLIC
# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT,
PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER,
PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER,
- PIPE_CAP_DEPTH_CLAMP
+ PIPE_CAP_DEPTH_CLAMP,
+ PIPE_CAP_SHADER_STENCIL_EXPORT,
};
/* Shader caps not specific to any single stage */
PIPE_FORMAT_R8G8B8X8_UNORM = 134,
PIPE_FORMAT_B4G4R4X4_UNORM = 135,
+ /* some stencil samplers formats */
+ PIPE_FORMAT_X24S8_USCALED = 136,
+ PIPE_FORMAT_S8X24_USCALED = 137,
+ PIPE_FORMAT_X32_S8X24_USCALED = 138,
PIPE_FORMAT_COUNT
};
#define TGSI_SEMANTIC_EDGEFLAG 8
#define TGSI_SEMANTIC_PRIMID 9
#define TGSI_SEMANTIC_INSTANCEID 10
-#define TGSI_SEMANTIC_COUNT 11 /**< number of semantic values */
+#define TGSI_SEMANTIC_STENCIL 11
+#define TGSI_SEMANTIC_COUNT 12 /**< number of semantic values */
struct tgsi_declaration_semantic
{
}
GLboolean
-dri_create_context(gl_api api, const __GLcontextModes * visual,
+dri_create_context(gl_api api, const struct gl_config * visual,
__DRIcontext * cPriv, void *sharedContextPrivate)
{
__DRIscreen *sPriv = cPriv->driScreenPriv;
boolean
dri_create_context(gl_api api,
- const __GLcontextModes * visual,
+ const struct gl_config * visual,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
boolean
dri_create_buffer(__DRIscreen * sPriv,
__DRIdrawable * dPriv,
- const __GLcontextModes * visual, boolean isPixmap)
+ const struct gl_config * visual, boolean isPixmap)
{
struct dri_screen *screen = sPriv->private;
struct dri_drawable *drawable = NULL;
boolean
dri_create_buffer(__DRIscreen * sPriv,
__DRIdrawable * dPriv,
- const __GLcontextModes * visual, boolean isPixmap);
+ const struct gl_config * visual, boolean isPixmap);
void dri_destroy_buffer(__DRIdrawable * dPriv);
*/
void
dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
- const __GLcontextModes *mode)
+ const struct gl_config *mode)
{
memset(stvis, 0, sizeof(*stvis));
void
dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
- const __GLcontextModes *mode);
+ const struct gl_config *mode);
const __DRIconfig **
dri_init_screen_helper(struct dri_screen *screen,
/**
* This is the driver specific part of the createNewScreen entry point.
*
- * Returns the __GLcontextModes supported by this driver.
+ * Returns the struct gl_config supported by this driver.
*/
static const __DRIconfig **
dri2_init_screen(__DRIscreen * sPriv)
}
static boolean
-dri2_create_context(gl_api api, const __GLcontextModes * visual,
+dri2_create_context(gl_api api, const struct gl_config * visual,
__DRIcontext * cPriv, void *sharedContextPrivate)
{
struct dri_context *ctx = NULL;
static boolean
dri2_create_buffer(__DRIscreen * sPriv,
__DRIdrawable * dPriv,
- const __GLcontextModes * visual, boolean isPixmap)
+ const struct gl_config * visual, boolean isPixmap)
{
struct dri_drawable *drawable = NULL;
static boolean
drisw_create_buffer(__DRIscreen * sPriv,
__DRIdrawable * dPriv,
- const __GLcontextModes * visual, boolean isPixmap)
+ const struct gl_config * visual, boolean isPixmap)
{
struct dri_drawable *drawable = NULL;
if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT))
surface_type |= EGL_PBUFFER_BIT;
- SET_CONFIG_ATTRIB(conf, EGL_CONFORMANT, api_mask);
- SET_CONFIG_ATTRIB(conf, EGL_RENDERABLE_TYPE, api_mask);
+ conf->Conformant = api_mask;
+ conf->RenderableType = api_mask;
- SET_CONFIG_ATTRIB(conf, EGL_RED_SIZE, rgba[0]);
- SET_CONFIG_ATTRIB(conf, EGL_GREEN_SIZE, rgba[1]);
- SET_CONFIG_ATTRIB(conf, EGL_BLUE_SIZE, rgba[2]);
- SET_CONFIG_ATTRIB(conf, EGL_ALPHA_SIZE, rgba[3]);
- SET_CONFIG_ATTRIB(conf, EGL_BUFFER_SIZE, buffer_size);
+ conf->RedSize = rgba[0];
+ conf->GreenSize = rgba[1];
+ conf->BlueSize = rgba[2];
+ conf->AlphaSize = rgba[3];
+ conf->BufferSize = buffer_size;
- SET_CONFIG_ATTRIB(conf, EGL_DEPTH_SIZE, depth_stencil[0]);
- SET_CONFIG_ATTRIB(conf, EGL_STENCIL_SIZE, depth_stencil[1]);
+ conf->DepthSize = depth_stencil[0];
+ conf->StencilSize = depth_stencil[1];
- SET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE, surface_type);
+ conf->SurfaceType = surface_type;
- SET_CONFIG_ATTRIB(conf, EGL_NATIVE_RENDERABLE, EGL_TRUE);
+ conf->NativeRenderable = EGL_TRUE;
if (surface_type & EGL_WINDOW_BIT) {
- SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_ID, nconf->native_visual_id);
- SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE,
- nconf->native_visual_type);
+ conf->NativeVisualID = nconf->native_visual_id;
+ conf->NativeVisualType = nconf->native_visual_type;
}
if (surface_type & EGL_PBUFFER_BIT) {
- SET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE);
+ conf->BindToTextureRGB = EGL_TRUE;
if (rgba[3])
- SET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE);
+ conf->BindToTextureRGBA = EGL_TRUE;
- SET_CONFIG_ATTRIB(conf, EGL_MAX_PBUFFER_WIDTH, 4096);
- SET_CONFIG_ATTRIB(conf, EGL_MAX_PBUFFER_HEIGHT, 4096);
- SET_CONFIG_ATTRIB(conf, EGL_MAX_PBUFFER_PIXELS, 4096 * 4096);
+ conf->MaxPbufferWidth = 4096;
+ conf->MaxPbufferHeight = 4096;
+ conf->MaxPbufferPixels = 4096 * 4096;
}
- SET_CONFIG_ATTRIB(conf, EGL_LEVEL, nconf->level);
- SET_CONFIG_ATTRIB(conf, EGL_SAMPLES, nconf->samples);
- SET_CONFIG_ATTRIB(conf, EGL_SAMPLE_BUFFERS, 1);
+ conf->Level = nconf->level;
+ conf->Samples = nconf->samples;
+ conf->SampleBuffers = 0;
if (nconf->slow_config)
- SET_CONFIG_ATTRIB(conf, EGL_CONFIG_CAVEAT, EGL_SLOW_CONFIG);
+ conf->ConfigCaveat = EGL_SLOW_CONFIG;
if (nconf->transparent_rgb) {
- rgba[0] = nconf->transparent_rgb_values[0];
- rgba[1] = nconf->transparent_rgb_values[1];
- rgba[2] = nconf->transparent_rgb_values[2];
-
- SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_TYPE, EGL_TRANSPARENT_RGB);
- SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_RED_VALUE, rgba[0]);
- SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_GREEN_VALUE, rgba[1]);
- SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_BLUE_VALUE, rgba[2]);
+ conf->TransparentType = EGL_TRANSPARENT_RGB;
+ conf->TransparentRedValue = nconf->transparent_rgb_values[0];
+ conf->TransparentGreenValue = nconf->transparent_rgb_values[1];
+ conf->TransparentBlueValue = nconf->transparent_rgb_values[2];
}
return _eglValidateConfig(conf, EGL_FALSE);
EGLint buffer_mask, api_mask;
EGLBoolean valid;
+ /* skip single-buffered configs */
+ if (!(nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_BACK_LEFT)))
+ return EGL_FALSE;
+
buffer_mask = 0x0;
if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT))
buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK;
gctx->stctxi->flush(gctx->stctxi,
PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
- screen->fence_finish(screen, fence, 0);
- screen->fence_reference(screen, &fence, NULL);
+ if (fence) {
+ screen->fence_finish(screen, fence, 0);
+ screen->fence_reference(screen, &fence, NULL);
+ }
return EGL_TRUE;
}
static boolean
egl_g3d_st_manager_get_egl_image(struct st_manager *smapi,
- struct st_context_iface *stctx,
void *egl_image,
struct st_egl_image *out)
{
--- /dev/null
+#ifndef __gl_core_h_
+#define __gl_core_h_
+
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 Silicon Graphics, 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, 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 including the dates of first publication and
+ * either this permission notice or a reference to
+ * http://oss.sgi.com/projects/FreeB/
+ * 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
+ * SILICON GRAPHICS, INC. 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.
+ *
+ * Except as contained in this notice, the name of Silicon Graphics, Inc.
+ * shall not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization from
+ * Silicon Graphics, Inc.
+ */
+
+#if !defined(_WIN32_WCE)
+#include <sys/types.h>
+#endif
+
+#define GL_CORE_SGI 1
+#define GL_CORE_MESA 2
+#define GL_CORE_APPLE 4
+#define GL_CORE_WINDOWS 8
+
+typedef struct __GLcontextRec __GLcontext;
+
+/*
+** This file defines the interface between the GL core and the surrounding
+** "operating system" that supports it (currently the GLX or WGL extensions).
+**
+** Members (data and function pointers) are documented as imported or
+** exported according to how they are used by the core rendering functions.
+** Imported members are initialized by the "operating system" and used by
+** the core functions. Exported members are initialized by the core functions
+** and used by the "operating system".
+*/
+
+/**
+ * Mode and limit information for a context. This information is
+ * kept around in the context so that values can be used during
+ * command execution, and for returning information about the
+ * context to the application.
+ *
+ * Instances of this structure are shared by the driver and the loader. To
+ * maintain binary compatability, new fields \b must be added only to the
+ * end of the structure.
+ *
+ * \sa _gl_context_modes_create
+ */
+typedef struct __GLcontextModesRec {
+ struct __GLcontextModesRec * next;
+
+ GLboolean rgbMode;
+ GLboolean floatMode;
+ GLboolean colorIndexMode;
+ GLuint doubleBufferMode;
+ GLuint stereoMode;
+
+ GLboolean haveAccumBuffer;
+ GLboolean haveDepthBuffer;
+ GLboolean haveStencilBuffer;
+
+ GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */
+ GLuint redMask, greenMask, blueMask, alphaMask;
+ GLint rgbBits; /* total bits for rgb */
+ GLint indexBits; /* total bits for colorindex */
+
+ GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
+ GLint depthBits;
+ GLint stencilBits;
+
+ GLint numAuxBuffers;
+
+ GLint level;
+
+ GLint pixmapMode;
+
+ /* GLX */
+ GLint visualID;
+ GLint visualType; /**< One of the GLX X visual types. (i.e.,
+ * \c GLX_TRUE_COLOR, etc.)
+ */
+
+ /* EXT_visual_rating / GLX 1.2 */
+ GLint visualRating;
+
+ /* EXT_visual_info / GLX 1.2 */
+ GLint transparentPixel;
+ /* colors are floats scaled to ints */
+ GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
+ GLint transparentIndex;
+
+ /* ARB_multisample / SGIS_multisample */
+ GLint sampleBuffers;
+ GLint samples;
+
+ /* SGIX_fbconfig / GLX 1.3 */
+ GLint drawableType;
+ GLint renderType;
+ GLint xRenderable;
+ GLint fbconfigID;
+
+ /* SGIX_pbuffer / GLX 1.3 */
+ GLint maxPbufferWidth;
+ GLint maxPbufferHeight;
+ GLint maxPbufferPixels;
+ GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */
+ GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */
+
+ /* SGIX_visual_select_group */
+ GLint visualSelectGroup;
+
+ /* OML_swap_method */
+ GLint swapMethod;
+
+ GLint screen;
+
+ /* EXT_texture_from_pixmap */
+ GLint bindToTextureRgb;
+ GLint bindToTextureRgba;
+ GLint bindToMipmapTexture;
+ GLint bindToTextureTargets;
+ GLint yInverted;
+} __GLcontextModes;
+
+/* Several fields of __GLcontextModes can take these as values. Since
+ * GLX header files may not be available everywhere they need to be used,
+ * redefine them here.
+ */
+#define GLX_NONE 0x8000
+#define GLX_SLOW_CONFIG 0x8001
+#define GLX_TRUE_COLOR 0x8002
+#define GLX_DIRECT_COLOR 0x8003
+#define GLX_PSEUDO_COLOR 0x8004
+#define GLX_STATIC_COLOR 0x8005
+#define GLX_GRAY_SCALE 0x8006
+#define GLX_STATIC_GRAY 0x8007
+#define GLX_TRANSPARENT_RGB 0x8008
+#define GLX_TRANSPARENT_INDEX 0x8009
+#define GLX_NON_CONFORMANT_CONFIG 0x800D
+#define GLX_SWAP_EXCHANGE_OML 0x8061
+#define GLX_SWAP_COPY_OML 0x8062
+#define GLX_SWAP_UNDEFINED_OML 0x8063
+
+#define GLX_DONT_CARE 0xFFFFFFFF
+
+#define GLX_RGBA_BIT 0x00000001
+#define GLX_COLOR_INDEX_BIT 0x00000002
+#define GLX_WINDOW_BIT 0x00000001
+#define GLX_PIXMAP_BIT 0x00000002
+#define GLX_PBUFFER_BIT 0x00000004
+
+#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
+#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
+#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
+#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
+#define GLX_Y_INVERTED_EXT 0x20D4
+
+#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
+#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
+#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
+
+#endif /* __gl_core_h_ */
#include "GL/glxproto.h"
#include "GL/glxtokens.h"
#include "GL/gl.h" /* for GL types needed by __GLcontextModes */
-#include "GL/internal/glcore.h" /* for __GLcontextModes */
+#include "glcore.h" /* for __GLcontextModes */
#include "glxinit.h"
if (!(mode->renderType & GLX_RGBA_BIT) || !mode->rgbMode)
return FALSE;
- /* skip single-buffered configs */
- if (!mode->doubleBufferMode)
- return FALSE;
-
/* only interested in native renderable configs */
if (!mode->xRenderable || !mode->drawableType)
return FALSE;
#include <X11/Xutil.h>
#include <X11/extensions/dri2tokens.h>
#include "GL/gl.h" /* for GL types needed by __GLcontextModes */
-#include "GL/internal/glcore.h" /* for __GLcontextModes */
+#include "glcore.h" /* for __GLcontextModes */
#include "pipe/p_compiler.h"
#include "common/native.h"
/**
* Allocate a new XMesaBuffer object which corresponds to the given drawable.
- * Note that XMesaBuffer is derived from GLframebuffer.
+ * Note that XMesaBuffer is derived from struct gl_framebuffer.
* The new XMesaBuffer will not have any size (Width=Height=0).
*
* \param d the corresponding X drawable (window or pixmap)
/* RGB WINDOW:
* We support RGB rendering into almost any kind of visual.
*/
- const int xclass = v->mesa_visual.visualType;
+ const int xclass = v->visualType;
if (xclass != GLX_TRUE_COLOR && xclass == !GLX_DIRECT_COLOR) {
_mesa_warning(NULL,
"XMesa: RGB mode rendering not supported in given visual.\n");
v->mesa_visual.redMask = visinfo->red_mask;
v->mesa_visual.greenMask = visinfo->green_mask;
v->mesa_visual.blueMask = visinfo->blue_mask;
- v->mesa_visual.visualID = visinfo->visualid;
- v->mesa_visual.screen = visinfo->screen;
+ v->visualID = visinfo->visualid;
+ v->screen = visinfo->screen;
#if !(defined(__cplusplus) || defined(c_plusplus))
- v->mesa_visual.visualType = xmesa_convert_from_x_visual_type(visinfo->class);
+ v->visualType = xmesa_convert_from_x_visual_type(visinfo->class);
#else
- v->mesa_visual.visualType = xmesa_convert_from_x_visual_type(visinfo->c_class);
+ v->visualType = xmesa_convert_from_x_visual_type(visinfo->c_class);
#endif
v->mesa_visual.visualRating = visualCaveat;
(void) initialize_visual_and_buffer( v, NULL, rgb_flag, 0, 0 );
{
- const int xclass = v->mesa_visual.visualType;
+ const int xclass = v->visualType;
if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) {
red_bits = _mesa_bitcount(GET_REDMASK(v));
green_bits = _mesa_bitcount(GET_GREENMASK(v));
/* initialize visual */
{
- __GLcontextModes *vis = &v->mesa_visual;
+ struct gl_config *vis = &v->mesa_visual;
vis->rgbMode = GL_TRUE;
vis->doubleBufferMode = db_flag;
vis->numAuxBuffers = 0;
vis->level = 0;
- vis->pixmapMode = 0;
vis->sampleBuffers = 0;
vis->samples = 0;
}
if (!xmdpy)
return NULL;
- /* Note: the XMesaContext contains a Mesa GLcontext struct (inheritance) */
+ /* Note: the XMesaContext contains a Mesa struct gl_context struct (inheritance) */
c = (XMesaContext) CALLOC_STRUCT(xmesa_context);
if (!c)
return NULL;
* Basically corresponds to an XVisualInfo.
*/
struct xmesa_visual {
- GLvisual mesa_visual; /* Device independent visual parameters */
+ struct gl_config mesa_visual;/* Device independent visual parameters */
+ int screen, visualID, visualType;
Display *display; /* The X11 display */
XVisualInfo * visinfo; /* X's visual info (pointer to private copy) */
XVisualInfo *vishandle; /* Only used in fakeglx.c */
/**
+ * Check that a framebuffer's attachments match the window's size.
+ *
* Called via st_framebuffer_iface::validate()
+ *
+ * \param statts array of framebuffer attachments
+ * \param count number of framebuffer attachments in statts[]
+ * \param out returns resources for each of the attachments
*/
static boolean
xmesa_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
boolean resized;
boolean ret;
+ /* build mask of ST_ATTACHMENT bits */
statt_mask = 0x0;
for (i = 0; i < count; i++)
statt_mask |= 1 << statts[i];
+
/* record newly allocated textures */
new_mask = statt_mask & ~xstfb->texture_mask;
#include "pipe/p_shader_tokens.h"
#include "util/u_inlines.h"
#include "cso_cache/cso_context.h"
-#include "util/u_inlines.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_sampler.h"
#include "vg_context.h"
#include "vg_translate.h"
#include "api_consts.h"
-#include "image.h"
#include "api.h"
#include "pipe/p_context.h"
return NULL;
/* only 1.0 is supported */
- if (attribs->major != 1 || attribs->minor > 0)
+ if (attribs->major > 1 || (attribs->major == 1 && attribs->minor > 0))
return NULL;
pipe = smapi->screen->context_create(smapi->screen, NULL);
$(shell pkg-config libkms --atleast-version=1.0 \
&& echo "-DHAVE_LIBKMS") \
$(shell pkg-config libkms --silence-errors --cflags-only-I) \
- $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \
+ $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto dri2proto) \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/auxiliary \
-I$(TOP)/include \
64, 64, (void*)image, 64 * 4, 0, 0);
ms->ctx->transfer_unmap(ms->ctx, transfer);
ms->ctx->transfer_destroy(ms->ctx, transfer);
+
+ if (crtc->cursor_shown)
+ drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id,
+ crtcp->cursor_handle, 64, 64);
}
#if HAVE_LIBKMS
memcpy(ptr, image, 64*64*4);
kms_bo_unmap(crtcp->cursor_bo);
+ if (crtc->cursor_shown)
+ drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id,
+ crtcp->cursor_handle, 64, 64);
+
return;
err_bo_destroy:
drmModeFreeCrtc(crtcp->drm_crtc);
- xfree(crtcp);
+ free(crtcp);
crtc->driver_private = NULL;
}
if (crtc == NULL)
goto out;
- crtcp = xcalloc(1, sizeof(struct crtc_private));
+ crtcp = calloc(1, sizeof(struct crtc_private));
if (!crtcp) {
xf86CrtcDestroy(crtc);
goto out;
DRI2Buffer2Ptr buffer;
BufferPrivatePtr private;
- buffer = xcalloc(1, sizeof *buffer);
+ buffer = calloc(1, sizeof *buffer);
if (!buffer)
return NULL;
- private = xcalloc(1, sizeof *private);
+ private = calloc(1, sizeof *private);
if (!private) {
goto fail;
}
if (dri2_do_create_buffer(pDraw, (DRI2BufferPtr)buffer, format))
return buffer;
- xfree(private);
+ free(private);
fail:
- xfree(buffer);
+ free(buffer);
return NULL;
}
/* So far it is safe to downcast a DRI2Buffer2Ptr to DRI2BufferPtr */
dri2_do_destroy_buffer(pDraw, (DRI2BufferPtr)buffer);
- xfree(buffer->driverPrivate);
- xfree(buffer);
+ free(buffer->driverPrivate);
+ free(buffer);
}
#endif /* DRI2INFOREC_VERSION >= 2 */
DRI2BufferPtr buffers;
int i;
- buffers = xcalloc(count, sizeof *buffers);
+ buffers = calloc(count, sizeof *buffers);
if (!buffers)
goto fail_buffers;
- privates = xcalloc(count, sizeof *privates);
+ privates = calloc(count, sizeof *privates);
if (!privates)
goto fail_privates;
return buffers;
fail:
- xfree(privates);
+ free(privates);
fail_privates:
- xfree(buffers);
+ free(buffers);
fail_buffers:
return NULL;
}
}
if (buffers) {
- xfree(buffers[0].driverPrivate);
- xfree(buffers);
+ free(buffers[0].driverPrivate);
+ free(buffers);
}
}
#include "miscstruct.h"
#include "dixstruct.h"
#include "xf86xv.h"
+#include "xorgVersion.h"
#ifndef XSERVER_LIBPCIACCESS
#error "libpciaccess needed"
#endif
Bool
xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device)
{
- char *BusID = xalloc(64);
+ char *BusID = malloc(64);
sprintf(BusID, "pci:%04x:%02x:%02x.%d",
device->domain, device->bus,
device->dev, device->func);
if (drmCheckModesettingSupported(BusID)) {
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
"Drm modesetting not supported %s\n", BusID);
- xfree(BusID);
+ free(BusID);
return FALSE;
}
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 0,
"Drm modesetting supported on %s\n", BusID);
- xfree(BusID);
+ free(BusID);
return TRUE;
}
if (!pScrn->driverPrivate)
return;
- xfree(pScrn->driverPrivate);
+ free(pScrn->driverPrivate);
pScrn->driverPrivate = NULL;
}
if (ms->fd < 0) {
char *BusID;
- BusID = xalloc(64);
+ BusID = malloc(64);
sprintf(BusID, "PCI:%d:%d:%d",
((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
ms->PciInfo->dev, ms->PciInfo->func
ms->fd = drmOpen(driver_descriptor.driver_name, BusID);
ms->isMaster = TRUE;
- xfree(BusID);
+ free(BusID);
if (ms->fd >= 0)
return TRUE;
ms = modesettingPTR(pScrn);
ms->pEnt = pEnt;
ms->cust = cust;
+ ms->fb_id = -1;
pScrn->displayWidth = 640; /* default it */
if (!drv_init_drm(pScrn))
return FALSE;
- use3D = cust ? !cust->no_3d : TRUE;
- ms->from_3D = xf86GetOptValBool(ms->Options, OPTION_3D_ACCEL,
- &use3D) ?
- X_CONFIG : X_PROBED;
-
- ms->no3D = !use3D;
-
- if (!drv_init_resource_management(pScrn)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not init "
- "Gallium3D or libKMS.");
- return FALSE;
- }
-
pScrn->monitor = pScrn->confScreen->monitor;
pScrn->progClock = TRUE;
pScrn->rgbBits = 8;
/* Process the options */
xf86CollectOptions(pScrn, NULL);
- if (!(ms->Options = xalloc(sizeof(drv_options))))
+ if (!(ms->Options = malloc(sizeof(drv_options))))
return FALSE;
memcpy(ms->Options, drv_options, sizeof(drv_options));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->Options);
+ use3D = cust ? !cust->no_3d : TRUE;
+ ms->from_3D = xf86GetOptValBool(ms->Options, OPTION_3D_ACCEL,
+ &use3D) ?
+ X_CONFIG : X_PROBED;
+
+ ms->no3D = !use3D;
+
+ if (!drv_init_resource_management(pScrn)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not init "
+ "Gallium3D or libKMS.");
+ return FALSE;
+ }
+
/* Allocate an xf86CrtcConfig */
xf86CrtcConfigInit(pScrn, &crtc_config_funcs);
xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
if (!ms->SWCursor)
xf86_cursors_init(pScreen, 64, 64,
HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 |
- HARDWARE_CURSOR_ARGB);
+ HARDWARE_CURSOR_ARGB |
+ ((cust && cust->unhidden_hw_cursor_update) ?
+ HARDWARE_CURSOR_UPDATE_UNHIDDEN : 0));
/* Must force it before EnterVT, so we are in control of VT and
* later memory should be bound when allocating, e.g rotate_mem */
}
}
- drmModeRmFB(ms->fd, ms->fb_id);
- ms->fb_id = -1;
+ if (ms->fb_id != -1) {
+ drmModeRmFB(ms->fd, ms->fb_id);
+ ms->fb_id = -1;
+ }
/* idle hardware */
if (!ms->kms)
}
#endif
- drmModeRmFB(ms->fd, ms->fb_id);
ms->destroy_front_buffer(pScrn);
if (ms->exa)
stride,
ptr);
+#if (XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 9, 99, 1, 0))
+
/* This a hack to work around EnableDisableFBAccess setting the pointer
* the real fix would be to replace pScrn->EnableDisableFBAccess hook
* and set the rootPixmap->devPrivate.ptr to something valid before that.
*/
pScrn->pixmapPrivate.ptr = ptr;
+#endif
+
return TRUE;
err_destroy:
{
struct exa_pixmap_priv *priv;
- priv = xcalloc(1, sizeof(struct exa_pixmap_priv));
+ priv = calloc(1, sizeof(struct exa_pixmap_priv));
if (!priv)
return NULL;
pipe_resource_reference(&priv->tex, NULL);
- xfree(priv);
+ free(priv);
}
static Bool
ms->ctx = NULL;
exaDriverFini(pScrn->pScreen);
- xfree(exa);
+ free(exa);
ms->exa = NULL;
}
ExaDriverPtr pExa;
CustomizerPtr cust = ms->cust;
- exa = xcalloc(1, sizeof(struct exa_context));
+ exa = calloc(1, sizeof(struct exa_context));
if (!exa)
return NULL;
out_err:
xorg_exa_close(pScrn);
+ free(exa);
return NULL;
}
for (i = 0; i < drm_connector->count_modes; i++) {
drm_mode = &drm_connector->modes[i];
if (drm_mode) {
- mode = xcalloc(1, sizeof(DisplayModeRec));
+ mode = calloc(1, sizeof(DisplayModeRec));
if (!mode)
continue;
mode->Clock = drm_mode->clock;
{
struct output_private *priv = output->driver_private;
drmModeFreeConnector(priv->drm_connector);
- xfree(priv);
+ free(priv);
output->driver_private = NULL;
}
drm_connector->connector_type_id);
- priv = xcalloc(sizeof(*priv), 1);
+ priv = calloc(sizeof(*priv), 1);
if (!priv) {
continue;
}
output = xf86OutputCreate(pScrn, &output_funcs, name);
if (!output) {
- xfree(priv);
+ free(priv);
continue;
}
Bool dirty_throttling;
Bool swap_throttling;
Bool no_3d;
+ Bool unhidden_hw_cursor_update;
Bool (*winsys_pre_init) (struct _CustomizerRec *cust, int fd);
Bool (*winsys_screen_init)(struct _CustomizerRec *cust);
Bool (*winsys_screen_close)(struct _CustomizerRec *cust);
dst_surf = xorg_gpu_surface(pPriv->r->pipe->screen, dst);
hdtv = ((src_w >= RES_720P_X) && (src_h >= RES_720P_Y));
+#ifdef COMPOSITE
REGION_TRANSLATE(pScrn->pScreen, dstRegion, -pPixmap->screen_x,
-pPixmap->screen_y);
+#endif
dxo = dstRegion->extents.x1;
dyo = dstRegion->extents.y1;
int box_y2 = pbox->y2;
float diff_x = (float)src_w / (float)dst_w;
float diff_y = (float)src_h / (float)dst_h;
- float offset_x = box_x1 - dstX + pPixmap->screen_x;
- float offset_y = box_y1 - dstY + pPixmap->screen_y;
+ float offset_x = box_x1 - dstX;
+ float offset_y = box_y1 - dstY;
float offset_w;
float offset_h;
+#ifdef COMPOSITE
+ offset_x += pPixmap->screen_x;
+ offset_y += pPixmap->screen_y;
+#endif
+
x = box_x1;
y = box_y1;
w = box_x2 - box_x1;
LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET)
ifeq ($(MESA_LLVM),1)
-LD = g++
+LD = $(CXX)
LDFLAGS += $(LLVM_LDFLAGS)
USE_CXX=1
DRIVER_PIPES += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
default: depend $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)
$(LIBNAME): $(OBJECTS) Makefile ../Makefile.xorg $(LIBS) $(DRIVER_PIPES)
- $(MKLIB) -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
+ $(MKLIB) -linker $(CC) -noprefix -o $@ $(LDFLAGS) $(OBJECTS) $(DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $(DRIVER_LINKS)
depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURCES)
rm -f depend
if (!screen)
return NULL;
- if (debug_get_bool_option("I915_SOFTWARE", FALSE))
- screen = sw_screen_wrap(screen);
+ screen = sw_screen_wrap(screen);
screen = debug_screen_wrap(screen);
if (!screen)
return NULL;
- if (debug_get_bool_option("BRW_SOFTPIPE", FALSE))
- screen = sw_screen_wrap(screen);
+ screen = sw_screen_wrap(screen);
screen = debug_screen_wrap(screen);
-
#include "state_tracker/drm_driver.h"
#include "target-helpers/inline_debug_helper.h"
#include "r600/drm/r600_drm_public.h"
#include "r600/r600_public.h"
-#if 0
-static struct pipe_screen *
-create_screen(int fd)
-{
- struct radeon *rw;
- struct pipe_screen *screen;
-
- rw = r600_drm_winsys_create(fd);
- if (!rw)
- return NULL;
-
- screen = r600_screen_create(rw);
- if (!screen)
- return NULL;
-
- screen = debug_screen_wrap(screen);
-
- return screen;
-}
-#else
-struct radeon *r600_new(int fd, unsigned device);
-struct pipe_screen *r600_screen_create2(struct radeon *radeon);
-static struct pipe_screen *
-create_screen(int fd)
+static struct pipe_screen *create_screen(int fd)
{
struct radeon *radeon;
struct pipe_screen *screen;
if (!radeon)
return NULL;
- screen = r600_screen_create2(radeon);
+ screen = r600_screen_create(radeon);
if (!screen)
return NULL;
return screen;
}
-#endif
DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen)
-I$(TOP)/src/gallium/auxiliary \
-I$(TOP)/src/gallium/drivers \
-I$(TOP)/src/gallium/include \
- -I$(TOP)/src/gallium/winsys
+ -I$(TOP)/src/gallium/winsys \
+ $(LIBDRM_CFLAGS)
+
common_SYS :=
common_LIBS := \
$(TOP)/src/gallium/drivers/identity/libidentity.a \
egl_LIBS := $(TOP)/src/gallium/state_trackers/egl/libegl.a
ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
-egl_SYS += -lX11 -lXext -lXfixes
+egl_SYS += -lX11 -lXext -lXfixes $(LIBDRM_LIB)
egl_LIBS += $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a
endif
-ifneq ($(findstring kms, $(EGL_PLATFORMS)),)
-egl_SYS += -ldrm
+ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
+egl_SYS += $(LIBDRM_LIB)
endif
ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
egl_LIBS += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a
-#include "target-helpers/inline_wrapper_sw_helper.h"
#include "target-helpers/inline_debug_helper.h"
#include "state_tracker/drm_driver.h"
#include "i915/drm/i915_drm_public.h"
-#include "target-helpers/inline_wrapper_sw_helper.h"
#include "target-helpers/inline_debug_helper.h"
+#include "target-helpers/inline_wrapper_sw_helper.h"
#include "state_tracker/drm_driver.h"
#include "i965/drm/i965_drm_public.h"
#include "i965/brw_public.h"
if (!screen)
return NULL;
- if (debug_get_bool_option("BRW_SOFTPIPE", FALSE))
- screen = sw_screen_wrap(screen);
+ screen = sw_screen_wrap(screen);
screen = debug_screen_wrap(screen);
GL_MAJOR = 1
GL_MINOR = 5
-GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
+GL_TINY = 0$(MESA_MAJOR)$(MESA_MINOR)0$(MESA_TINY)
INCLUDE_DIRS = \
if (!screen)
return NULL;
- if (debug_get_bool_option("BRW_SOFTPIPE", FALSE))
- screen = sw_screen_wrap(screen);
+ screen = sw_screen_wrap(screen);
screen = debug_screen_wrap(screen);
* allows X clients to communicate with the driver.
*/
+#include <xorg-server.h>
#include "dixstruct.h"
#include "extnsionst.h"
#include <X11/X.h>
struct vmw_customizer *vmw = vmw_customizer(xorg_customizer(pScrn));
int i;
- rects = xcalloc(number, sizeof(*rects));
+ rects = calloc(number, sizeof(*rects));
if (!rects)
return FALSE;
vmw_ioctl_update_layout(vmw, number, rects);
- xfree(rects);
+ free(rects);
return TRUE;
}
struct drm_vmw_dmabuf_rep *rep = &arg.rep;
int ret;
- buf = xcalloc(1, sizeof(*buf));
+ buf = calloc(1, sizeof(*buf));
if (!buf)
goto err;
return buf;
err_free:
- xfree(buf);
+ free(buf);
err:
return NULL;
}
arg.handle = buf->handle;
drmCommandWrite(vmw->fd, DRM_VMW_UNREF_DMABUF, &arg, sizeof(arg));
- xfree(buf);
+ free(buf);
}
void *
cust->winsys_enter_vt = vmw_screen_enter_vt;
cust->winsys_leave_vt = vmw_screen_leave_vt;
cust->no_3d = TRUE;
+ cust->unhidden_hw_cursor_update = TRUE;
vmw->pScrn = pScrn;
pScrn->driverPrivate = cust;
numAdaptors = 1;
overlayAdaptors = &newAdaptor;
} else {
- newAdaptors = xalloc((numAdaptors + 1) *
+ newAdaptors = malloc((numAdaptors + 1) *
sizeof(XF86VideoAdaptorPtr*));
if (!newAdaptors) {
xf86XVFreeVideoAdaptorRec(newAdaptor);
}
if (newAdaptors) {
- xfree(newAdaptors);
+ free(newAdaptors);
}
debug_printf("Initialized VMware Xv extension successfully\n");
return NULL;
}
- video = xcalloc(1, sizeof(*video));
+ video = calloc(1, sizeof(*video));
if (!video) {
debug_printf("Not enough memory.\n");
xf86XVFreeVideoAdaptorRec(adaptor);
}
out->size = size;
- out->extra_data = xcalloc(1, size);
+ out->extra_data = calloc(1, size);
debug_printf("\t\t%s: allocated buffer %p of size %i\n", __func__, out, size);
if (out->size == 0)
return Success;
- xfree(out->extra_data);
+ free(out->extra_data);
vmw_ioctl_buffer_unmap(vmw, out->buf);
vmw_ioctl_buffer_destroy(vmw, out->buf);
#"pipe_texture": gallium.Texture,
'pipe_subresource': gallium.pipe_subresource,
'pipe_box': gallium.pipe_box,
+ 'pipe_draw_info': gallium.pipe_draw_info,
}
return minindex + ibias, maxindex + ibias
- def draw_arrays(self, mode, start, count):
- self.dump_vertices(start, count)
-
- self.real.draw_arrays(mode, start, count)
- self._set_dirty()
-
- def draw_elements(self, indexBuffer, indexSize, indexBias, mode, start, count):
- if self.interpreter.verbosity(2):
- minindex, maxindex = self.dump_indices(indexBuffer, indexSize, indexBias, start, count)
- self.dump_vertices(minindex, maxindex - minindex)
+ def set_index_buffer(self, ib):
+ if ib:
+ self.real.set_index_buffer(ib.index_size, ib.offset, ib.buffer)
+ else:
+ self.real.set_index_buffer(0, 0, None)
- self.real.draw_elements(indexBuffer, indexSize, indexBias, mode, start, count)
- self._set_dirty()
-
- def draw_range_elements(self, indexBuffer, indexSize, indexBias, minIndex, maxIndex, mode, start, count):
+ def draw_vbo(self, info):
if self.interpreter.verbosity(2):
- minindex, maxindex = self.dump_indices(indexBuffer, indexSize, indexBias, start, count)
- minindex = min(minindex, minIndex)
- maxindex = min(maxindex, maxIndex)
- self.dump_vertices(minindex, maxindex - minindex)
+ if 0:
+ minindex, maxindex = self.dump_indices(indexBuffer, indexSize, indexBias, start, count)
+
+ self.dump_vertices(info.minindex, info.maxindex + 1 - info.minindex)
- self.real.draw_range_elements(indexBuffer, indexSize, indexBias, minIndex, maxIndex, mode, start, count)
+ self.real.draw_vbo(info)
self._set_dirty()
-
+
def resource_copy_region(self, dst, subdst, dstx, dsty, dstz, src, subsrc, srcx, srcy, srcz, width, height):
if dst is not None and src is not None:
if self.interpreter.options.all:
_rgba[i] = rgba[i]
self.real.clear(buffers, _rgba, depth, stencil)
+ def clear_render_target(self, dst, rgba, dstx, dsty, width, height):
+ _rgba = gallium.FloatArray(4)
+ for i in range(4):
+ _rgba[i] = rgba[i]
+ self.real.clear_render_target(dst, _rgba, dstx, dsty, width, height)
+
+ def clear_depth_stencil(self, dst, clear_flags, depth, stencil, dstx, dsty, width, height):
+ self.real.clear_depth_stencil(dst, clear_flags, depth, stencil, dstx, dsty, width, height)
+
def _present(self):
self.real.flush()
--- /dev/null
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL IN[1], FACE, CONSTANT
+DCL OUT[0], COLOR
+DCL TEMP[0]
+IMM FLT32 { 0.5, 1.0, 0.0, 0.0 }
+
+MUL TEMP[0], IN[1].xxxx, IMM[0].xxxx
+ADD TEMP[0], TEMP[0], IMM[0].yyyy
+
+MOV OUT[0], TEMP[0]
+
+END
C_SOURCES = \
bof.c \
- r600_state.c \
- r600_state2.c \
- evergreen_state.c \
- r600.c \
- radeon_ctx.c \
- radeon_draw.c \
- radeon_state.c \
+ evergreen_hw_context.c \
radeon_bo.c \
+ radeon_bo_pb.c \
radeon_pciid.c \
- radeon.c \
+ r600.c \
+ r600_bo.c \
r600_drm.c \
- radeon_ws_bo.c \
- radeon_bo_pb.c
+ r600_hw_context.c
LIBRARY_INCLUDES = -I$(TOP)/src/gallium/drivers/r600 \
$(shell pkg-config libdrm --cflags-only-I)
r600_sources = [
'bof.c',
- 'r600_state.c',
- 'radeon_ctx.c',
- 'radeon_draw.c',
- 'radeon_state.c',
+ 'evergreen_hw_context.c',
'radeon_bo.c',
+ 'radeon_bo_pb.c',
'radeon_pciid.c',
- 'radeon.c',
- 'r600_drm.c'
+ 'r600.c',
+ 'r600_bo.c',
+ 'r600_drm.c',
+ 'r600_hw_context.c',
]
env.ParseConfig('pkg-config --cflags libdrm_radeon')
+++ /dev/null
-/*
- * Copyright © 2009 Jerome Glisse <glisse@freedesktop.org>
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-#ifndef EG_STATES_H
-#define EG_STATES_H
-
-static const struct radeon_register EG_names_CONFIG[] = {
- {0x00008C00, 0, 0, "SQ_CONFIG"},
- {0x00009100, 0, 0, "SPI_CONFIG_CNTL"},
- {0x0000913C, 0, 0, "SPI_CONFIG_CNTL_1"},
- {0x00008C04, 0, 0, "SQ_GPR_RESOURCE_MGMT_1"},
- {0x00008C08, 0, 0, "SQ_GPR_RESOURCE_MGMT_2"},
- {0x00008C0C, 0, 0, "SQ_GPR_RESOURCE_MGMT_3"},
- {0x00008C18, 0, 0, "SQ_THREAD_RESOURCE_MGMT_1"},
- {0x00008C1C, 0, 0, "SQ_THREAD_RESOURCE_MGMT_2"},
- {0x00008C20, 0, 0, "SQ_STACK_RESOURCE_MGMT_1"},
- {0x00008C24, 0, 0, "SQ_STACK_RESOURCE_MGMT_2"},
- {0x00008C28, 0, 0, "SQ_STACK_RESOURCE_MGMT_3"},
- {0x00008D8C, 0, 0, "SQ_DYN_GPR_CNTL_PS_FLUSH_REQ"},
- {0x00008A14, 0, 0, "PA_CL_ENHANCE"},
- {0x00028838, 0, 0, "SQ_DYN_GPR_RESOURCE_LIMIT_1"},
- {0x000288EC, 0, 0, "SQ_LDS_ALLOC_PS"},
- {0x00028350, 0, 0, "SX_MISC"},
- {0x00028900, 0, 0, "SQ_ESGS_RING_ITEMSIZE"},
- {0x00028904, 0, 0, "SQ_GSVS_RING_ITEMSIZE"},
- {0x00028908, 0, 0, "SQ_ESTMP_RING_ITEMSIZE"},
- {0x0002890C, 0, 0, "SQ_GSTMP_RING_ITEMSIZE"},
- {0x00028910, 0, 0, "SQ_VSTMP_RING_ITEMSIZE"},
- {0x00028914, 0, 0, "SQ_PSTMP_RING_ITEMSIZE"},
- {0x0002891C, 0, 0, "SQ_GS_VERT_ITEMSIZE"},
- {0x00028920, 0, 0, "SQ_GS_VERT_ITEMSIZE_1"},
- {0x00028924, 0, 0, "SQ_GS_VERT_ITEMSIZE_2"},
- {0x00028928, 0, 0, "SQ_GS_VERT_ITEMSIZE_3"},
- {0x00028A10, 0, 0, "VGT_OUTPUT_PATH_CNTL"},
- {0x00028A14, 0, 0, "VGT_HOS_CNTL"},
- {0x00028A18, 0, 0, "VGT_HOS_MAX_TESS_LEVEL"},
- {0x00028A1C, 0, 0, "VGT_HOS_MIN_TESS_LEVEL"},
- {0x00028A20, 0, 0, "VGT_HOS_REUSE_DEPTH"},
- {0x00028A24, 0, 0, "VGT_GROUP_PRIM_TYPE"},
- {0x00028A28, 0, 0, "VGT_GROUP_FIRST_DECR"},
- {0x00028A2C, 0, 0, "VGT_GROUP_DECR"},
- {0x00028A30, 0, 0, "VGT_GROUP_VECT_0_CNTL"},
- {0x00028A34, 0, 0, "VGT_GROUP_VECT_1_CNTL"},
- {0x00028A38, 0, 0, "VGT_GROUP_VECT_0_FMT_CNTL"},
- {0x00028A3C, 0, 0, "VGT_GROUP_VECT_1_FMT_CNTL"},
- {0x00028A40, 0, 0, "VGT_GS_MODE"},
- {0x00028A48, 0, 0, "PA_SC_MODE_CNTL_0"},
- {0x00028A4C, 0, 0, "PA_SC_MODE_CNTL_1"},
- {0x00028AB4, 0, 0, "VGT_REUSE_OFF"},
- {0x00028AB8, 0, 0, "VGT_VTX_CNT_EN"},
- {0x00028B54, 0, 0, "VGT_SHADER_STAGES_EN"},
- {0x00028B94, 0, 0, "VGT_STRMOUT_CONFIG"},
- {0x00028B98, 0, 0, "VGT_STRMOUT_BUFFER_CONFIG"},
-};
-
-static const struct radeon_register EG_names_CB_CNTL[] = {
- {0x00028238, 0, 0, "CB_TARGET_MASK"},
- {0x0002823C, 0, 0, "CB_SHADER_MASK"},
- {0x00028808, 0, 0, "CB_COLOR_CONTROL"},
- {0x00028C04, 0, 0, "PA_SC_AA_CONFIG"},
- {0x00028C1C, 0, 0, "PA_SC_AA_SAMPLE_LOCS_MCTX"},
- {0x00028C3C, 0, 0, "PA_SC_AA_MASK"},
-};
-
-static const struct radeon_register EG_names_RASTERIZER[] = {
- {0x000286D4, 0, 0, "SPI_INTERP_CONTROL_0"},
- {0x00028810, 0, 0, "PA_CL_CLIP_CNTL"},
- {0x00028814, 0, 0, "PA_SU_SC_MODE_CNTL"},
- {0x0002881C, 0, 0, "PA_CL_VS_OUT_CNTL"},
- {0x00028820, 0, 0, "PA_CL_NANINF_CNTL"},
- {0x00028A00, 0, 0, "PA_SU_POINT_SIZE"},
- {0x00028A04, 0, 0, "PA_SU_POINT_MINMAX"},
- {0x00028A08, 0, 0, "PA_SU_LINE_CNTL"},
- {0x00028A48, 0, 0, "PA_SC_MPASS_PS_CNTL"},
- {0x00028C00, 0, 0, "PA_SC_LINE_CNTL"},
- {0x00028C08, 0, 0, "PA_SU_VTX_CNTL"},
- {0x00028C0C, 0, 0, "PA_CL_GB_VERT_CLIP_ADJ"},
- {0x00028C10, 0, 0, "PA_CL_GB_VERT_DISC_ADJ"},
- {0x00028C14, 0, 0, "PA_CL_GB_HORZ_CLIP_ADJ"},
- {0x00028C18, 0, 0, "PA_CL_GB_HORZ_DISC_ADJ"},
- {0x00028B78, 0, 0, "PA_SU_POLY_OFFSET_DB_FMT_CNTL"},
- {0x00028B7C, 0, 0, "PA_SU_POLY_OFFSET_CLAMP"},
- {0x00028B80, 0, 0, "PA_SU_POLY_OFFSET_FRONT_SCALE"},
- {0x00028B84, 0, 0, "PA_SU_POLY_OFFSET_FRONT_OFFSET"},
- {0x00028B88, 0, 0, "PA_SU_POLY_OFFSET_BACK_SCALE"},
- {0x00028B8C, 0, 0, "PA_SU_POLY_OFFSET_BACK_OFFSET"},
-};
-
-/* Viewport states are same as r600 */
-static const struct radeon_register EG_names_VIEWPORT[] = {
- {0x000282D0, 0, 0, "PA_SC_VPORT_ZMIN_0"},
- {0x000282D4, 0, 0, "PA_SC_VPORT_ZMAX_0"},
- {0x0002843C, 0, 0, "PA_CL_VPORT_XSCALE_0"},
- {0x00028444, 0, 0, "PA_CL_VPORT_YSCALE_0"},
- {0x0002844C, 0, 0, "PA_CL_VPORT_ZSCALE_0"},
- {0x00028440, 0, 0, "PA_CL_VPORT_XOFFSET_0"},
- {0x00028448, 0, 0, "PA_CL_VPORT_YOFFSET_0"},
- {0x00028450, 0, 0, "PA_CL_VPORT_ZOFFSET_0"},
- {0x00028818, 0, 0, "PA_CL_VTE_CNTL"},
-};
-
-/* scissor is same as R600 */
-static const struct radeon_register EG_names_SCISSOR[] = {
- {0x00028030, 0, 0, "PA_SC_SCREEN_SCISSOR_TL"},
- {0x00028034, 0, 0, "PA_SC_SCREEN_SCISSOR_BR"},
- {0x00028200, 0, 0, "PA_SC_WINDOW_OFFSET"},
- {0x00028204, 0, 0, "PA_SC_WINDOW_SCISSOR_TL"},
- {0x00028208, 0, 0, "PA_SC_WINDOW_SCISSOR_BR"},
- {0x0002820C, 0, 0, "PA_SC_CLIPRECT_RULE"},
- {0x00028210, 0, 0, "PA_SC_CLIPRECT_0_TL"},
- {0x00028214, 0, 0, "PA_SC_CLIPRECT_0_BR"},
- {0x00028218, 0, 0, "PA_SC_CLIPRECT_1_TL"},
- {0x0002821C, 0, 0, "PA_SC_CLIPRECT_1_BR"},
- {0x00028220, 0, 0, "PA_SC_CLIPRECT_2_TL"},
- {0x00028224, 0, 0, "PA_SC_CLIPRECT_2_BR"},
- {0x00028228, 0, 0, "PA_SC_CLIPRECT_3_TL"},
- {0x0002822C, 0, 0, "PA_SC_CLIPRECT_3_BR"},
- {0x00028230, 0, 0, "PA_SC_EDGERULE"},
- {0x00028240, 0, 0, "PA_SC_GENERIC_SCISSOR_TL"},
- {0x00028244, 0, 0, "PA_SC_GENERIC_SCISSOR_BR"},
- {0x00028250, 0, 0, "PA_SC_VPORT_SCISSOR_0_TL"},
- {0x00028254, 0, 0, "PA_SC_VPORT_SCISSOR_0_BR"},
- {0x00028234, 0, 0, "PA_SU_HARDWARE_SCREEN_OFFSET"},
-};
-
-/* same as r700 i.e. no blend control */
-static const struct radeon_register EG_names_BLEND[] = {
- {0x00028414, 0, 0, "CB_BLEND_RED"},
- {0x00028418, 0, 0, "CB_BLEND_GREEN"},
- {0x0002841C, 0, 0, "CB_BLEND_BLUE"},
- {0x00028420, 0, 0, "CB_BLEND_ALPHA"},
- {0x00028780, 0, 0, "CB_BLEND0_CONTROL"},
- {0x00028784, 0, 0, "CB_BLEND1_CONTROL"},
- {0x00028788, 0, 0, "CB_BLEND2_CONTROL"},
- {0x0002878C, 0, 0, "CB_BLEND3_CONTROL"},
- {0x00028790, 0, 0, "CB_BLEND4_CONTROL"},
- {0x00028794, 0, 0, "CB_BLEND5_CONTROL"},
- {0x00028798, 0, 0, "CB_BLEND6_CONTROL"},
- {0x0002879C, 0, 0, "CB_BLEND7_CONTROL"},
-};
-
-/* different */
-static const struct radeon_register EG_names_DSA[] = {
- {0x00028028, 0, 0, "DB_STENCIL_CLEAR"},
- {0x0002802C, 0, 0, "DB_DEPTH_CLEAR"},
- {0x00028410, 0, 0, "SX_ALPHA_TEST_CONTROL"},
- {0x00028430, 0, 0, "DB_STENCILREFMASK"},
- {0x00028434, 0, 0, "DB_STENCILREFMASK_BF"},
- {0x00028438, 0, 0, "SX_ALPHA_REF"},
- {0x000286DC, 0, 0, "SPI_FOG_CNTL"},
- {0x00028800, 0, 0, "DB_DEPTH_CONTROL"},
- {0x0002880C, 0, 0, "DB_SHADER_CONTROL"},
- {0x00028000, 0, 0, "DB_RENDER_CONTROL"},
- {0x00028004, 0, 0, "DB_COUNT_CONTROL"},
- {0x0002800C, 0, 0, "DB_RENDER_OVERRIDE"},
- {0x00028010, 0, 0, "DB_RENDER_OVERRIDE2"},
- {0x00028AC0, 0, 0, "DB_SRESULTS_COMPARE_STATE0"},
- {0x00028AC4, 0, 0, "DB_SRESULTS_COMPARE_STATE1"},
- {0x00028AC8, 0, 0, "DB_PRELOAD_CONTROL"},
- {0x00028B70, 0, 0, "DB_ALPHA_TO_MASK"},
-};
-
-/* different */
-static const struct radeon_register EG_names_VS_SHADER[] = {
- {0x00028380, 0, 0, "SQ_VTX_SEMANTIC_0"},
- {0x00028384, 0, 0, "SQ_VTX_SEMANTIC_1"},
- {0x00028388, 0, 0, "SQ_VTX_SEMANTIC_2"},
- {0x0002838C, 0, 0, "SQ_VTX_SEMANTIC_3"},
- {0x00028390, 0, 0, "SQ_VTX_SEMANTIC_4"},
- {0x00028394, 0, 0, "SQ_VTX_SEMANTIC_5"},
- {0x00028398, 0, 0, "SQ_VTX_SEMANTIC_6"},
- {0x0002839C, 0, 0, "SQ_VTX_SEMANTIC_7"},
- {0x000283A0, 0, 0, "SQ_VTX_SEMANTIC_8"},
- {0x000283A4, 0, 0, "SQ_VTX_SEMANTIC_9"},
- {0x000283A8, 0, 0, "SQ_VTX_SEMANTIC_10"},
- {0x000283AC, 0, 0, "SQ_VTX_SEMANTIC_11"},
- {0x000283B0, 0, 0, "SQ_VTX_SEMANTIC_12"},
- {0x000283B4, 0, 0, "SQ_VTX_SEMANTIC_13"},
- {0x000283B8, 0, 0, "SQ_VTX_SEMANTIC_14"},
- {0x000283BC, 0, 0, "SQ_VTX_SEMANTIC_15"},
- {0x000283C0, 0, 0, "SQ_VTX_SEMANTIC_16"},
- {0x000283C4, 0, 0, "SQ_VTX_SEMANTIC_17"},
- {0x000283C8, 0, 0, "SQ_VTX_SEMANTIC_18"},
- {0x000283CC, 0, 0, "SQ_VTX_SEMANTIC_19"},
- {0x000283D0, 0, 0, "SQ_VTX_SEMANTIC_20"},
- {0x000283D4, 0, 0, "SQ_VTX_SEMANTIC_21"},
- {0x000283D8, 0, 0, "SQ_VTX_SEMANTIC_22"},
- {0x000283DC, 0, 0, "SQ_VTX_SEMANTIC_23"},
- {0x000283E0, 0, 0, "SQ_VTX_SEMANTIC_24"},
- {0x000283E4, 0, 0, "SQ_VTX_SEMANTIC_25"},
- {0x000283E8, 0, 0, "SQ_VTX_SEMANTIC_26"},
- {0x000283EC, 0, 0, "SQ_VTX_SEMANTIC_27"},
- {0x000283F0, 0, 0, "SQ_VTX_SEMANTIC_28"},
- {0x000283F4, 0, 0, "SQ_VTX_SEMANTIC_29"},
- {0x000283F8, 0, 0, "SQ_VTX_SEMANTIC_30"},
- {0x000283FC, 0, 0, "SQ_VTX_SEMANTIC_31"},
- {0x0002861C, 0, 0, "SPI_VS_OUT_ID_0"}, // all diff belwo
- {0x00028620, 0, 0, "SPI_VS_OUT_ID_1"},
- {0x00028624, 0, 0, "SPI_VS_OUT_ID_2"},
- {0x00028628, 0, 0, "SPI_VS_OUT_ID_3"},
- {0x0002862C, 0, 0, "SPI_VS_OUT_ID_4"},
- {0x00028630, 0, 0, "SPI_VS_OUT_ID_5"},
- {0x00028634, 0, 0, "SPI_VS_OUT_ID_6"},
- {0x00028638, 0, 0, "SPI_VS_OUT_ID_7"},
- {0x0002863C, 0, 0, "SPI_VS_OUT_ID_8"},
- {0x00028640, 0, 0, "SPI_VS_OUT_ID_9"},
- {0x000286C4, 0, 0, "SPI_VS_OUT_CONFIG"},
- {0x0002885C, 1, 0, "SQ_PGM_START_VS"},
- {0x00028860, 0, 0, "SQ_PGM_RESOURCES_VS"},
- {0x00028864, 0, 0, "SQ_PGM_RESOURCES_2_VS"},
- {0x000288A4, 1, 1, "SQ_PGM_START_FS"},
- {0x000288A8, 0, 0, "SQ_PGM_RESOURCES_FS"},
-};
-
-static const struct radeon_register EG_names_PS_SHADER[] = {
- {0x00028644, 0, 0, "SPI_PS_INPUT_CNTL_0"},
- {0x00028648, 0, 0, "SPI_PS_INPUT_CNTL_1"},
- {0x0002864C, 0, 0, "SPI_PS_INPUT_CNTL_2"},
- {0x00028650, 0, 0, "SPI_PS_INPUT_CNTL_3"},
- {0x00028654, 0, 0, "SPI_PS_INPUT_CNTL_4"},
- {0x00028658, 0, 0, "SPI_PS_INPUT_CNTL_5"},
- {0x0002865C, 0, 0, "SPI_PS_INPUT_CNTL_6"},
- {0x00028660, 0, 0, "SPI_PS_INPUT_CNTL_7"},
- {0x00028664, 0, 0, "SPI_PS_INPUT_CNTL_8"},
- {0x00028668, 0, 0, "SPI_PS_INPUT_CNTL_9"},
- {0x0002866C, 0, 0, "SPI_PS_INPUT_CNTL_10"},
- {0x00028670, 0, 0, "SPI_PS_INPUT_CNTL_11"},
- {0x00028674, 0, 0, "SPI_PS_INPUT_CNTL_12"},
- {0x00028678, 0, 0, "SPI_PS_INPUT_CNTL_13"},
- {0x0002867C, 0, 0, "SPI_PS_INPUT_CNTL_14"},
- {0x00028680, 0, 0, "SPI_PS_INPUT_CNTL_15"},
- {0x00028684, 0, 0, "SPI_PS_INPUT_CNTL_16"},
- {0x00028688, 0, 0, "SPI_PS_INPUT_CNTL_17"},
- {0x0002868C, 0, 0, "SPI_PS_INPUT_CNTL_18"},
- {0x00028690, 0, 0, "SPI_PS_INPUT_CNTL_19"},
- {0x00028694, 0, 0, "SPI_PS_INPUT_CNTL_20"},
- {0x00028698, 0, 0, "SPI_PS_INPUT_CNTL_21"},
- {0x0002869C, 0, 0, "SPI_PS_INPUT_CNTL_22"},
- {0x000286A0, 0, 0, "SPI_PS_INPUT_CNTL_23"},
- {0x000286A4, 0, 0, "SPI_PS_INPUT_CNTL_24"},
- {0x000286A8, 0, 0, "SPI_PS_INPUT_CNTL_25"},
- {0x000286AC, 0, 0, "SPI_PS_INPUT_CNTL_26"},
- {0x000286B0, 0, 0, "SPI_PS_INPUT_CNTL_27"},
- {0x000286B4, 0, 0, "SPI_PS_INPUT_CNTL_28"},
- {0x000286B8, 0, 0, "SPI_PS_INPUT_CNTL_29"},
- {0x000286BC, 0, 0, "SPI_PS_INPUT_CNTL_30"},
- {0x000286C0, 0, 0, "SPI_PS_INPUT_CNTL_31"},
- {0x000286C8, 0, 0, "SPI_THREAD_GROUPING"},
- {0x000286CC, 0, 0, "SPI_PS_IN_CONTROL_0"},
- {0x000286D0, 0, 0, "SPI_PS_IN_CONTROL_1"},
- {0x000286D8, 0, 0, "SPI_INPUT_Z"},
- {0x000286E0, 0, 0, "SPI_BARYC_CNTL"},
- {0x000286E4, 0, 0, "SPI_PS_IN_CONTROL_2"},
- {0x000286E8, 0, 0, "SPI_COMPUTE_INPUT_CNTL"},
- {0x00028840, 1, 0, "SQ_PGM_START_PS"}, // diff
- {0x00028844, 0, 0, "SQ_PGM_RESOURCES_PS"}, // diff
- {0x00028848, 0, 0, "SQ_PGM_RESOURCES_2_PS"}, // diff
- {0x0002884C, 0, 0, "SQ_PGM_EXPORTS_PS"}, // diff
-};
-
-/* different */
-static const struct radeon_register EG_names_UCP[] = {
- {0x000285BC, 0, 0, "PA_CL_UCP0_X"},
- {0x000285C0, 0, 0, "PA_CL_UCP0_Y"},
- {0x000285C4, 0, 0, "PA_CL_UCP0_Z"},
- {0x000285C8, 0, 0, "PA_CL_UCP0_W"},
- {0x000285CC, 0, 0, "PA_CL_UCP1_X"},
- {0x000285D0, 0, 0, "PA_CL_UCP1_Y"},
- {0x000285D4, 0, 0, "PA_CL_UCP1_Z"},
- {0x000285D8, 0, 0, "PA_CL_UCP1_W"},
- {0x000285DC, 0, 0, "PA_CL_UCP2_X"},
- {0x000285E0, 0, 0, "PA_CL_UCP2_Y"},
- {0x000285E4, 0, 0, "PA_CL_UCP2_Z"},
- {0x000285E8, 0, 0, "PA_CL_UCP2_W"},
- {0x000285EC, 0, 0, "PA_CL_UCP3_X"},
- {0x000285F0, 0, 0, "PA_CL_UCP3_Y"},
- {0x000285F4, 0, 0, "PA_CL_UCP3_Z"},
- {0x000285F8, 0, 0, "PA_CL_UCP3_W"},
- {0x000285FC, 0, 0, "PA_CL_UCP4_X"},
- {0x00028600, 0, 0, "PA_CL_UCP4_Y"},
- {0x00028604, 0, 0, "PA_CL_UCP4_Z"},
- {0x00028608, 0, 0, "PA_CL_UCP4_W"},
- {0x0002860C, 0, 0, "PA_CL_UCP5_X"},
- {0x00028610, 0, 0, "PA_CL_UCP5_Y"},
- {0x00028614, 0, 0, "PA_CL_UCP5_Z"},
- {0x00028618, 0, 0, "PA_CL_UCP5_W"},
-};
-
-static const struct radeon_register EG_names_VS_CBUF[] = {
- {0x00028180, 0, 0, "ALU_CONST_BUFFER_SIZE_VS_0"},
- {0x00028980, 1, 0, "ALU_CONST_CACHE_VS_0"},
-};
-
-static const struct radeon_register EG_names_PS_CBUF[] = {
- {0x00028140, 0, 0, "ALU_CONST_BUFFER_SIZE_PS_0"},
- {0x00028940, 1, 0, "ALU_CONST_CACHE_PS_0"},
-};
-
-static const struct radeon_register EG_names_PS_RESOURCE[] = {
- {0x00030000, 0, 0, "RESOURCE0_WORD0"},
- {0x00030004, 0, 0, "RESOURCE0_WORD1"},
- {0x00030008, 0, 0, "RESOURCE0_WORD2"},
- {0x0003000C, 0, 0, "RESOURCE0_WORD3"},
- {0x00030010, 0, 0, "RESOURCE0_WORD4"},
- {0x00030014, 0, 0, "RESOURCE0_WORD5"},
- {0x00030018, 0, 0, "RESOURCE0_WORD6"},
- {0x0003001c, 0, 0, "RESOURCE0_WORD7"},
-};
-
-static const struct radeon_register EG_names_VS_RESOURCE[] = {
- {0x00031600, 0, 0, "RESOURCE160_WORD0"},
- {0x00031604, 0, 0, "RESOURCE160_WORD1"},
- {0x00031608, 0, 0, "RESOURCE160_WORD2"},
- {0x0003160C, 0, 0, "RESOURCE160_WORD3"},
- {0x00031610, 0, 0, "RESOURCE160_WORD4"},
- {0x00031614, 0, 0, "RESOURCE160_WORD5"},
- {0x00031618, 0, 0, "RESOURCE160_WORD6"},
- {0x0003161c, 0, 0, "RESOURCE160_WORD7"},
-};
-
-static const struct radeon_register EG_names_FS_RESOURCE[] = {
- {0x0003A300, 0, 0, "RESOURCE320_WORD0"},
- {0x0003A304, 0, 0, "RESOURCE320_WORD1"},
- {0x0003A308, 0, 0, "RESOURCE320_WORD2"},
- {0x0003A30C, 0, 0, "RESOURCE320_WORD3"},
- {0x0003A310, 0, 0, "RESOURCE320_WORD4"},
- {0x0003A314, 0, 0, "RESOURCE320_WORD5"},
- {0x0003A318, 0, 0, "RESOURCE320_WORD6"},
- {0x0003A31C, 0, 0, "RESOURCE320_WORD7"},
-};
-
-static const struct radeon_register EG_names_GS_RESOURCE[] = {
- {0x0003A4C0, 0, 0, "RESOURCE336_WORD0"},
- {0x0003A4C4, 0, 0, "RESOURCE336_WORD1"},
- {0x0003A4C8, 0, 0, "RESOURCE336_WORD2"},
- {0x0003A4CC, 0, 0, "RESOURCE336_WORD3"},
- {0x0003A4D0, 0, 0, "RESOURCE336_WORD4"},
- {0x0003A4D4, 0, 0, "RESOURCE336_WORD5"},
- {0x0003A4D8, 0, 0, "RESOURCE336_WORD6"},
- {0x0003A4DC, 0, 0, "RESOURCE336_WORD7"},
-};
-
-static const struct radeon_register EG_names_PS_SAMPLER[] = {
- {0x0003C000, 0, 0, "SQ_TEX_SAMPLER_WORD0_0"},
- {0x0003C004, 0, 0, "SQ_TEX_SAMPLER_WORD1_0"},
- {0x0003C008, 0, 0, "SQ_TEX_SAMPLER_WORD2_0"},
-};
-
-static const struct radeon_register EG_names_VS_SAMPLER[] = {
- {0x0003C0D8, 0, 0, "SQ_TEX_SAMPLER_WORD0_18"},
- {0x0003C0DC, 0, 0, "SQ_TEX_SAMPLER_WORD1_18"},
- {0x0003C0E0, 0, 0, "SQ_TEX_SAMPLER_WORD2_18"},
-};
-
-static const struct radeon_register EG_names_GS_SAMPLER[] = {
- {0x0003C1B0, 0, 0, "SQ_TEX_SAMPLER_WORD0_36"},
- {0x0003C1B4, 0, 0, "SQ_TEX_SAMPLER_WORD1_36"},
- {0x0003C1B8, 0, 0, "SQ_TEX_SAMPLER_WORD2_36"},
-};
-
-static const struct radeon_register EG_names_PS_SAMPLER_BORDER[] = {
- {0x0000A400, 0, 0, "TD_PS_SAMPLER0_BORDER_INDEX"},
- {0x0000A404, 0, 0, "TD_PS_SAMPLER0_BORDER_RED"},
- {0x0000A408, 0, 0, "TD_PS_SAMPLER0_BORDER_GREEN"},
- {0x0000A40C, 0, 0, "TD_PS_SAMPLER0_BORDER_BLUE"},
- {0x0000A410, 0, 0, "TD_PS_SAMPLER0_BORDER_ALPHA"},
-};
-
-static const struct radeon_register EG_names_VS_SAMPLER_BORDER[] = {
- {0x0000A414, 0, 0, "TD_VS_SAMPLER0_BORDER_INDEX"},
- {0x0000A418, 0, 0, "TD_VS_SAMPLER0_BORDER_RED"},
- {0x0000A41C, 0, 0, "TD_VS_SAMPLER0_BORDER_GREEN"},
- {0x0000A420, 0, 0, "TD_VS_SAMPLER0_BORDER_BLUE"},
- {0x0000A424, 0, 0, "TD_VS_SAMPLER0_BORDER_ALPHA"},
-};
-
-static const struct radeon_register EG_names_GS_SAMPLER_BORDER[] = {
- {0x0000A428, 0, 0, "TD_GS_SAMPLER0_BORDER_INDEX"},
- {0x0000A42C, 0, 0, "TD_GS_SAMPLER0_BORDER_RED"},
- {0x0000A430, 0, 0, "TD_GS_SAMPLER0_BORDER_GREEN"},
- {0x0000A434, 0, 0, "TD_GS_SAMPLER0_BORDER_BLUE"},
- {0x0000A438, 0, 0, "TD_GS_SAMPLER0_BORDER_ALPHA"},
-};
-
-static const struct radeon_register EG_names_CB[] = {
- {0x00028C60, 1, 0, "CB_COLOR0_BASE"},
- {0x00028C64, 0, 0, "CB_COLOR0_PITCH"},
- {0x00028C68, 0, 0, "CB_COLOR0_SLICE"},
- {0x00028C6C, 0, 0, "CB_COLOR0_VIEW"},
- {0x00028C70, 1, 0, "CB_COLOR0_INFO"},
- {0x00028C74, 0, 0, "CB_COLOR0_ATTRIB"},
- {0x00028C78, 0, 0, "CB_COLOR0_DIM"},
-};
-
-/* different - TODO */
-static const struct radeon_register EG_names_DB[] = {
- {0x00028014, 1, 0, "DB_HTILE_DATA_BASE"},
- {0x00028040, 1, 0, "DB_Z_INFO"},
- {0x00028044, 0, 0, "DB_STENCIL_INFO"},
- {0x00028058, 0, 0, "DB_DEPTH_SIZE"},
- {0x0002805C, 0, 0, "DB_DEPTH_SLICE"},
- {0x00028008, 0, 0, "DB_DEPTH_VIEW"},
- {0x00028ABC, 0, 0, "DB_HTILE_SURFACE"},
- {0x00028048, 1, 0, "DB_Z_READ_BASE"},
- {0x0002804C, 1, 0, "DB_STENCIL_READ_BASE"},
- {0x00028050, 1, 0, "DB_Z_WRITE_BASE"},
- {0x00028054, 1, 0, "DB_STENCIL_WRITE_BASE"},
-};
-
-static const struct radeon_register EG_names_VGT[] = {
- {0x00008958, 0, 0, "VGT_PRIMITIVE_TYPE"}, //s
- {0x00028400, 0, 0, "VGT_MAX_VTX_INDX"}, //s
- {0x00028404, 0, 0, "VGT_MIN_VTX_INDX"}, //s
- {0x00028408, 0, 0, "VGT_INDX_OFFSET"}, //s
- {0x00028A7C, 0, 0, "VGT_DMA_INDEX_TYPE"}, //s
- {0x00028A84, 0, 0, "VGT_PRIMITIVEID_EN"}, //s
- {0x00028A88, 0, 0, "VGT_DMA_NUM_INSTANCES"}, //s
- {0x00028A94, 0, 0, "VGT_MULTI_PRIM_IB_RESET_EN"}, //s
- {0x00028AA0, 0, 0, "VGT_INSTANCE_STEP_RATE_0"}, //s
- {0x00028AA4, 0, 0, "VGT_INSTANCE_STEP_RATE_1"}, //s
-};
-
-static const struct radeon_register EG_names_DRAW[] = {
- {0x00008970, 0, 0, "VGT_NUM_INDICES"},
- {0x000287E4, 0, 0, "VGT_DMA_BASE_HI"}, //same
- {0x000287E8, 1, 0, "VGT_DMA_BASE"}, //same
- {0x000287F0, 0, 0, "VGT_DRAW_INITIATOR"}, //same
-};
-
-static const struct radeon_register EG_names_VGT_EVENT[] = {
- {0x00028A90, 1, 0, "VGT_EVENT_INITIATOR"}, //done
-};
-
-static const struct radeon_register EG_names_CB_FLUSH[] = {
-};
-
-static const struct radeon_register EG_names_DB_FLUSH[] = {
-};
-
-#endif
--- /dev/null
+/*
+ * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
+ *
+ * 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.
+ *
+ * Authors:
+ * Jerome Glisse
+ */
+#include <errno.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "xf86drm.h"
+#include "r600.h"
+#include "evergreend.h"
+#include "radeon_drm.h"
+#include "bof.h"
+#include "pipe/p_compiler.h"
+#include "util/u_inlines.h"
+#include "util/u_memory.h"
+#include <pipebuffer/pb_bufmgr.h>
+#include "r600_priv.h"
+
+#define GROUP_FORCE_NEW_BLOCK 0
+
+static const struct r600_reg evergreen_config_reg_list[] = {
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008958_VGT_PRIMITIVE_TYPE, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008A14_PA_CL_ENHANCE, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C00_SQ_CONFIG, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C04_SQ_GPR_RESOURCE_MGMT_1, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C08_SQ_GPR_RESOURCE_MGMT_2, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C0C_SQ_THREAD_RESOURCE_MGMT, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C18_SQ_THREAD_RESOURCE_MGMT_1, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C20_SQ_STACK_RESOURCE_MGMT_1, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C24_SQ_STACK_RESOURCE_MGMT_2, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008C28_SQ_STACK_RESOURCE_MGMT_3, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_009100_SPI_CONFIG_CNTL, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, EVERGREEN_CONFIG_REG_OFFSET, R_00913C_SPI_CONFIG_CNTL_1, 0, 0, 0},
+};
+
+static const struct r600_reg evergreen_ctl_const_list[] = {
+ {PKT3_SET_CTL_CONST, EVERGREEN_CTL_CONST_OFFSET, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0, 0},
+ {PKT3_SET_CTL_CONST, EVERGREEN_CTL_CONST_OFFSET, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0, 0},
+};
+
+static const struct r600_reg evergreen_context_reg_list[] = {
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028000_DB_RENDER_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028004_DB_COUNT_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028008_DB_DEPTH_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02800C_DB_RENDER_OVERRIDE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028010_DB_RENDER_OVERRIDE2, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028014_DB_HTILE_DATA_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028028_DB_STENCIL_CLEAR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02802C_DB_DEPTH_CLEAR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028030_PA_SC_SCREEN_SCISSOR_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028034_PA_SC_SCREEN_SCISSOR_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028040_DB_Z_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028044_DB_STENCIL_INFO, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028048_DB_Z_READ_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02804C_DB_STENCIL_READ_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028050_DB_Z_WRITE_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028054_DB_STENCIL_WRITE_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028058_DB_DEPTH_SIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02805C_DB_DEPTH_SLICE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028140_ALU_CONST_BUFFER_SIZE_PS_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028180_ALU_CONST_BUFFER_SIZE_VS_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028200_PA_SC_WINDOW_OFFSET, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028204_PA_SC_WINDOW_SCISSOR_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028208_PA_SC_WINDOW_SCISSOR_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02820C_PA_SC_CLIPRECT_RULE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028210_PA_SC_CLIPRECT_0_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028214_PA_SC_CLIPRECT_0_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028218_PA_SC_CLIPRECT_1_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02821C_PA_SC_CLIPRECT_1_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028220_PA_SC_CLIPRECT_2_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028224_PA_SC_CLIPRECT_2_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028228_PA_SC_CLIPRECT_3_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02822C_PA_SC_CLIPRECT_3_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028230_PA_SC_EDGERULE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028234_PA_SU_HARDWARE_SCREEN_OFFSET, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028238_CB_TARGET_MASK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02823C_CB_SHADER_MASK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028240_PA_SC_GENERIC_SCISSOR_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028244_PA_SC_GENERIC_SCISSOR_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028350_SX_MISC, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028380_SQ_VTX_SEMANTIC_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028384_SQ_VTX_SEMANTIC_1, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028388_SQ_VTX_SEMANTIC_2, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02838C_SQ_VTX_SEMANTIC_3, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028390_SQ_VTX_SEMANTIC_4, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028394_SQ_VTX_SEMANTIC_5, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028398_SQ_VTX_SEMANTIC_6, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02839C_SQ_VTX_SEMANTIC_7, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A0_SQ_VTX_SEMANTIC_8, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A4_SQ_VTX_SEMANTIC_9, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283A8_SQ_VTX_SEMANTIC_10, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283AC_SQ_VTX_SEMANTIC_11, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B0_SQ_VTX_SEMANTIC_12, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B4_SQ_VTX_SEMANTIC_13, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283B8_SQ_VTX_SEMANTIC_14, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283BC_SQ_VTX_SEMANTIC_15, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C0_SQ_VTX_SEMANTIC_16, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C4_SQ_VTX_SEMANTIC_17, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283C8_SQ_VTX_SEMANTIC_18, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283CC_SQ_VTX_SEMANTIC_19, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D0_SQ_VTX_SEMANTIC_20, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D4_SQ_VTX_SEMANTIC_21, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283D8_SQ_VTX_SEMANTIC_22, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283DC_SQ_VTX_SEMANTIC_23, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E0_SQ_VTX_SEMANTIC_24, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E4_SQ_VTX_SEMANTIC_25, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283E8_SQ_VTX_SEMANTIC_26, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283EC_SQ_VTX_SEMANTIC_27, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F0_SQ_VTX_SEMANTIC_28, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F4_SQ_VTX_SEMANTIC_29, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283F8_SQ_VTX_SEMANTIC_30, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0283FC_SQ_VTX_SEMANTIC_31, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0282D0_PA_SC_VPORT_ZMIN_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0282D4_PA_SC_VPORT_ZMAX_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028400_VGT_MAX_VTX_INDX, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028404_VGT_MIN_VTX_INDX, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028408_VGT_INDX_OFFSET, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028410_SX_ALPHA_TEST_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028414_CB_BLEND_RED, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028418_CB_BLEND_GREEN, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02841C_CB_BLEND_BLUE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028420_CB_BLEND_ALPHA, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028430_DB_STENCILREFMASK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028434_DB_STENCILREFMASK_BF, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028438_SX_ALPHA_REF, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02843C_PA_CL_VPORT_XSCALE_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028440_PA_CL_VPORT_XOFFSET_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028444_PA_CL_VPORT_YSCALE_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028448_PA_CL_VPORT_YOFFSET_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02844C_PA_CL_VPORT_ZSCALE_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028450_PA_CL_VPORT_ZOFFSET_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285BC_PA_CL_UCP0_X, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C0_PA_CL_UCP0_Y, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C4_PA_CL_UCP0_Z, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285C8_PA_CL_UCP0_W, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285CC_PA_CL_UCP1_X, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D0_PA_CL_UCP1_Y, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D4_PA_CL_UCP1_Z, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285D8_PA_CL_UCP1_W, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285DC_PA_CL_UCP2_X, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E0_PA_CL_UCP2_Y, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E4_PA_CL_UCP2_Z, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285E8_PA_CL_UCP2_W, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285EC_PA_CL_UCP3_X, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F0_PA_CL_UCP3_Y, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F4_PA_CL_UCP3_Z, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285F8_PA_CL_UCP3_W, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0285FC_PA_CL_UCP4_X, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028600_PA_CL_UCP4_Y, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028604_PA_CL_UCP4_Z, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028608_PA_CL_UCP4_W, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02860C_PA_CL_UCP5_X, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028610_PA_CL_UCP5_Y, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028614_PA_CL_UCP5_Z, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028618_PA_CL_UCP5_W, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02861C_SPI_VS_OUT_ID_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028620_SPI_VS_OUT_ID_1, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028624_SPI_VS_OUT_ID_2, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028628_SPI_VS_OUT_ID_3, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02862C_SPI_VS_OUT_ID_4, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028630_SPI_VS_OUT_ID_5, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028634_SPI_VS_OUT_ID_6, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028638_SPI_VS_OUT_ID_7, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02863C_SPI_VS_OUT_ID_8, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028640_SPI_VS_OUT_ID_9, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028644_SPI_PS_INPUT_CNTL_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028648_SPI_PS_INPUT_CNTL_1, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02864C_SPI_PS_INPUT_CNTL_2, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028650_SPI_PS_INPUT_CNTL_3, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028654_SPI_PS_INPUT_CNTL_4, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028658_SPI_PS_INPUT_CNTL_5, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02865C_SPI_PS_INPUT_CNTL_6, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028660_SPI_PS_INPUT_CNTL_7, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028664_SPI_PS_INPUT_CNTL_8, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028668_SPI_PS_INPUT_CNTL_9, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02866C_SPI_PS_INPUT_CNTL_10, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028670_SPI_PS_INPUT_CNTL_11, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028674_SPI_PS_INPUT_CNTL_12, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028678_SPI_PS_INPUT_CNTL_13, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02867C_SPI_PS_INPUT_CNTL_14, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028680_SPI_PS_INPUT_CNTL_15, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028684_SPI_PS_INPUT_CNTL_16, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028688_SPI_PS_INPUT_CNTL_17, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02868C_SPI_PS_INPUT_CNTL_18, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028690_SPI_PS_INPUT_CNTL_19, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028694_SPI_PS_INPUT_CNTL_20, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028698_SPI_PS_INPUT_CNTL_21, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02869C_SPI_PS_INPUT_CNTL_22, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A0_SPI_PS_INPUT_CNTL_23, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A4_SPI_PS_INPUT_CNTL_24, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286A8_SPI_PS_INPUT_CNTL_25, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286AC_SPI_PS_INPUT_CNTL_26, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B0_SPI_PS_INPUT_CNTL_27, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B4_SPI_PS_INPUT_CNTL_28, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286B8_SPI_PS_INPUT_CNTL_29, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286BC_SPI_PS_INPUT_CNTL_30, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C0_SPI_PS_INPUT_CNTL_31, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C4_SPI_VS_OUT_CONFIG, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286C8_SPI_THREAD_GROUPING, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286CC_SPI_PS_IN_CONTROL_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D0_SPI_PS_IN_CONTROL_1, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D4_SPI_INTERP_CONTROL_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286D8_SPI_INPUT_Z, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286DC_SPI_FOG_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E0_SPI_BARYC_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E4_SPI_PS_IN_CONTROL_2, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0286E8_SPI_COMPUTE_INPUT_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028780_CB_BLEND0_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028784_CB_BLEND1_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028788_CB_BLEND2_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02878C_CB_BLEND3_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028790_CB_BLEND4_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028794_CB_BLEND5_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028798_CB_BLEND6_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02879C_CB_BLEND7_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028800_DB_DEPTH_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02880C_DB_SHADER_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028808_CB_COLOR_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028810_PA_CL_CLIP_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028814_PA_SU_SC_MODE_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028818_PA_CL_VTE_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02881C_PA_CL_VS_OUT_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028820_PA_CL_NANINF_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028840_SQ_PGM_START_PS, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028844_SQ_PGM_RESOURCES_PS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028848_SQ_PGM_RESOURCES_2_PS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02884C_SQ_PGM_EXPORTS_PS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02885C_SQ_PGM_START_VS, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028860_SQ_PGM_RESOURCES_VS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028864_SQ_PGM_RESOURCES_2_VS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288A4_SQ_PGM_START_FS, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288A8_SQ_PGM_RESOURCES_FS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_0288EC_SQ_LDS_ALLOC_PS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028900_SQ_ESGS_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028904_SQ_GSVS_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028908_SQ_ESTMP_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02890C_SQ_GSTMP_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028910_SQ_VSTMP_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028914_SQ_PSTMP_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_02891C_SQ_GS_VERT_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028920_SQ_GS_VERT_ITEMSIZE_1, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028924_SQ_GS_VERT_ITEMSIZE_2, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028928_SQ_GS_VERT_ITEMSIZE_3, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028940_ALU_CONST_CACHE_PS_0, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028980_ALU_CONST_CACHE_VS_0, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A00_PA_SU_POINT_SIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A04_PA_SU_POINT_MINMAX, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A08_PA_SU_LINE_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A10_VGT_OUTPUT_PATH_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A14_VGT_HOS_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A20_VGT_HOS_REUSE_DEPTH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A24_VGT_GROUP_PRIM_TYPE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A28_VGT_GROUP_FIRST_DECR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A2C_VGT_GROUP_DECR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A30_VGT_GROUP_VECT_0_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A34_VGT_GROUP_VECT_1_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A40_VGT_GS_MODE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A48_PA_SC_MODE_CNTL_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028A4C_PA_SC_MODE_CNTL_1, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AB4_VGT_REUSE_OFF, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AB8_VGT_VTX_CNT_EN, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028ABC_DB_HTILE_SURFACE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC0_DB_SRESULTS_COMPARE_STATE0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC4_DB_SRESULTS_COMPARE_STATE1, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028AC8_DB_PRELOAD_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B54_VGT_SHADER_STAGES_EN, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B70_DB_ALPHA_TO_MASK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B94_VGT_STRMOUT_CONFIG, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C00_PA_SC_LINE_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C04_PA_SC_AA_CONFIG, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C08_PA_SU_VTX_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C3C_PA_SC_AA_MASK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C60_CB_COLOR0_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C64_CB_COLOR0_PITCH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C68_CB_COLOR0_SLICE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C6C_CB_COLOR0_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C70_CB_COLOR0_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C74_CB_COLOR0_ATTRIB, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C78_CB_COLOR0_DIM, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028C9C_CB_COLOR1_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA0_CB_COLOR1_PITCH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA4_CB_COLOR1_SLICE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CA8_CB_COLOR1_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CAC_CB_COLOR1_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB0_CB_COLOR1_ATTRIB, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CB4_CB_COLOR1_DIM, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CD8_CB_COLOR2_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CDC_CB_COLOR2_PITCH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE0_CB_COLOR2_SLICE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE4_CB_COLOR2_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CE8_CB_COLOR2_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CEC_CB_COLOR2_ATTRIB, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028CF0_CB_COLOR2_DIM, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D14_CB_COLOR3_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D18_CB_COLOR3_PITCH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D1C_CB_COLOR3_SLICE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D20_CB_COLOR3_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D24_CB_COLOR3_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D28_CB_COLOR3_ATTRIB, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D2C_CB_COLOR3_DIM, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D50_CB_COLOR4_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D54_CB_COLOR4_PITCH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D58_CB_COLOR4_SLICE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D5C_CB_COLOR4_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D60_CB_COLOR4_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D64_CB_COLOR4_ATTRIB, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D68_CB_COLOR4_DIM, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D8C_CB_COLOR5_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D90_CB_COLOR5_PITCH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D94_CB_COLOR5_SLICE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D98_CB_COLOR5_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028D9C_CB_COLOR5_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA0_CB_COLOR5_ATTRIB, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DA4_CB_COLOR5_DIM, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DC8_CB_COLOR6_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DCC_CB_COLOR6_PITCH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD0_CB_COLOR6_SLICE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD4_CB_COLOR6_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DD8_CB_COLOR6_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DDC_CB_COLOR6_ATTRIB, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028DE0_CB_COLOR6_DIM, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E04_CB_COLOR7_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E08_CB_COLOR7_PITCH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E0C_CB_COLOR7_SLICE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E10_CB_COLOR7_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E14_CB_COLOR7_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E18_CB_COLOR7_ATTRIB, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E1C_CB_COLOR7_DIM, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E40_CB_COLOR8_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E44_CB_COLOR8_PITCH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E48_CB_COLOR8_SLICE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E4C_CB_COLOR8_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E50_CB_COLOR8_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E54_CB_COLOR8_ATTRIB, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E58_CB_COLOR8_DIM, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E5C_CB_COLOR9_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E60_CB_COLOR9_PITCH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E64_CB_COLOR9_SLICE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E68_CB_COLOR9_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E6C_CB_COLOR9_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E70_CB_COLOR9_ATTRIB, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E74_CB_COLOR9_DIM, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E78_CB_COLOR10_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E7C_CB_COLOR10_PITCH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E80_CB_COLOR10_SLICE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E84_CB_COLOR10_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E88_CB_COLOR10_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E8C_CB_COLOR10_ATTRIB, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E90_CB_COLOR10_DIM, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E94_CB_COLOR11_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E98_CB_COLOR11_PITCH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028E9C_CB_COLOR11_SLICE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA0_CB_COLOR11_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA4_CB_COLOR11_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EA8_CB_COLOR11_ATTRIB, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, EVERGREEN_CONTEXT_REG_OFFSET, R_028EAC_CB_COLOR11_DIM, 0, 0, 0},
+};
+
+/* SHADER RESOURCE R600/R700 */
+static int evergreen_state_resource_init(struct r600_context *ctx, u32 offset)
+{
+ struct r600_reg r600_shader_resource[] = {
+ {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030000_RESOURCE0_WORD0, 0, 0, 0},
+ {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030004_RESOURCE0_WORD1, 0, 0, 0},
+ {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030008_RESOURCE0_WORD2, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+ {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03000C_RESOURCE0_WORD3, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+ {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030010_RESOURCE0_WORD4, 0, 0, 0},
+ {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030014_RESOURCE0_WORD5, 0, 0, 0},
+ {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_030018_RESOURCE0_WORD6, 0, 0, 0},
+ {PKT3_SET_RESOURCE, EVERGREEN_RESOURCE_OFFSET, R_03001C_RESOURCE0_WORD7, 0, 0, 0},
+ };
+ unsigned nreg = Elements(r600_shader_resource);
+
+ for (int i = 0; i < nreg; i++) {
+ r600_shader_resource[i].offset += offset;
+ }
+ return r600_context_add_block(ctx, r600_shader_resource, nreg);
+}
+
+/* SHADER SAMPLER R600/R700 */
+static int r600_state_sampler_init(struct r600_context *ctx, u32 offset)
+{
+ struct r600_reg r600_shader_sampler[] = {
+ {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C000_SQ_TEX_SAMPLER_WORD0_0, 0, 0, 0},
+ {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0, 0},
+ {PKT3_SET_SAMPLER, EVERGREEN_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0, 0},
+ };
+ unsigned nreg = Elements(r600_shader_sampler);
+
+ for (int i = 0; i < nreg; i++) {
+ r600_shader_sampler[i].offset += offset;
+ }
+ return r600_context_add_block(ctx, r600_shader_sampler, nreg);
+}
+
+/* SHADER SAMPLER BORDER R600/R700 */
+static int evergreen_state_sampler_border_init(struct r600_context *ctx, u32 offset, unsigned id)
+{
+ struct r600_reg r600_shader_sampler_border[] = {
+ {PKT3_SET_CONFIG_REG, 0, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, 0, R_00A404_TD_PS_SAMPLER0_BORDER_RED, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, 0, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, 0, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, 0, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0, 0},
+ };
+ unsigned nreg = Elements(r600_shader_sampler_border);
+ unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x100 + 0x40000 + id * 0x1C;
+ struct r600_range *range;
+ struct r600_block *block;
+ int r;
+
+ for (int i = 0; i < nreg; i++) {
+ r600_shader_sampler_border[i].offset -= R_00A400_TD_PS_SAMPLER0_BORDER_INDEX;
+ r600_shader_sampler_border[i].offset += fake_offset;
+ }
+ r = r600_context_add_block(ctx, r600_shader_sampler_border, nreg);
+ if (r) {
+ return r;
+ }
+ /* set proper offset */
+ range = &ctx->range[CTX_RANGE_ID(ctx, r600_shader_sampler_border[0].offset)];
+ block = range->blocks[CTX_BLOCK_ID(ctx, r600_shader_sampler_border[0].offset)];
+ block->pm4[1] = (offset - EVERGREEN_CONFIG_REG_OFFSET) >> 2;
+ return 0;
+}
+
+static int evergreen_loop_const_init(struct r600_context *ctx, u32 offset)
+{
+ unsigned nreg = 32;
+ struct r600_reg r600_loop_consts[32];
+ int i;
+
+ for (i = 0; i < nreg; i++) {
+ r600_loop_consts[i].opcode = PKT3_SET_LOOP_CONST;
+ r600_loop_consts[i].offset_base = EVERGREEN_LOOP_CONST_OFFSET;
+ r600_loop_consts[i].offset = EVERGREEN_LOOP_CONST_OFFSET + ((offset + i) * 4);
+ r600_loop_consts[i].need_bo = 0;
+ r600_loop_consts[i].flush_flags = 0;
+ }
+ return r600_context_add_block(ctx, r600_loop_consts, nreg);
+}
+
+int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon)
+{
+ int r;
+
+ memset(ctx, 0, sizeof(struct r600_context));
+ ctx->radeon = radeon;
+ LIST_INITHEAD(&ctx->query_list);
+
+ /* initialize hash */
+ ctx->hash_size = 19;
+ ctx->hash_shift = 11;
+ for (int i = 0; i < 256; i++) {
+ ctx->range[i].start_offset = i << ctx->hash_shift;
+ ctx->range[i].end_offset = ((i + 1) << ctx->hash_shift) - 1;
+ ctx->range[i].blocks = calloc(1 << ctx->hash_shift, sizeof(void*));
+ if (ctx->range[i].blocks == NULL) {
+ return -ENOMEM;
+ }
+ }
+
+ /* add blocks */
+ r = r600_context_add_block(ctx, evergreen_config_reg_list,
+ Elements(evergreen_config_reg_list));
+ if (r)
+ goto out_err;
+ r = r600_context_add_block(ctx, evergreen_context_reg_list,
+ Elements(evergreen_context_reg_list));
+ if (r)
+ goto out_err;
+ r = r600_context_add_block(ctx, evergreen_ctl_const_list,
+ Elements(evergreen_ctl_const_list));
+ if (r)
+ goto out_err;
+
+
+ /* PS SAMPLER */
+ for (int j = 0, offset = 0; j < 18; j++, offset += 0xC) {
+ r = r600_state_sampler_init(ctx, offset);
+ if (r)
+ goto out_err;
+ }
+ /* VS SAMPLER */
+ for (int j = 0, offset = 0xD8; j < 18; j++, offset += 0xC) {
+ r = r600_state_sampler_init(ctx, offset);
+ if (r)
+ goto out_err;
+ }
+ /* PS SAMPLER BORDER */
+ for (int j = 0; j < 18; j++) {
+ r = evergreen_state_sampler_border_init(ctx, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, j);
+ if (r)
+ goto out_err;
+ }
+ /* VS SAMPLER BORDER */
+ for (int j = 0; j < 18; j++) {
+ r = evergreen_state_sampler_border_init(ctx, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, j);
+ if (r)
+ goto out_err;
+ }
+ /* PS RESOURCE */
+ for (int j = 0, offset = 0; j < 176; j++, offset += 0x20) {
+ r = evergreen_state_resource_init(ctx, offset);
+ if (r)
+ goto out_err;
+ }
+ /* VS RESOURCE */
+ for (int j = 0, offset = 0x1600; j < 160; j++, offset += 0x20) {
+ r = evergreen_state_resource_init(ctx, offset);
+ if (r)
+ goto out_err;
+ }
+
+ /* PS loop const */
+ evergreen_loop_const_init(ctx, 0);
+ /* VS loop const */
+ evergreen_loop_const_init(ctx, 32);
+
+ /* setup block table */
+ ctx->blocks = calloc(ctx->nblocks, sizeof(void*));
+ for (int i = 0, c = 0; i < 256; i++) {
+ for (int j = 0; j < (1 << ctx->hash_shift); j++) {
+ if (ctx->range[i].blocks[j]) {
+ assert(c < ctx->nblocks);
+ ctx->blocks[c++] = ctx->range[i].blocks[j];
+ j += (ctx->range[i].blocks[j]->nreg << 2) - 1;
+ }
+ }
+ }
+
+ /* allocate cs variables */
+ ctx->nreloc = RADEON_CTX_MAX_PM4;
+ ctx->reloc = calloc(ctx->nreloc, sizeof(struct r600_reloc));
+ if (ctx->reloc == NULL) {
+ r = -ENOMEM;
+ goto out_err;
+ }
+ ctx->bo = calloc(ctx->nreloc, sizeof(void *));
+ if (ctx->bo == NULL) {
+ r = -ENOMEM;
+ goto out_err;
+ }
+ ctx->pm4_ndwords = RADEON_CTX_MAX_PM4;
+ ctx->pm4 = calloc(ctx->pm4_ndwords, 4);
+ if (ctx->pm4 == NULL) {
+ r = -ENOMEM;
+ goto out_err;
+ }
+ /* save 16dwords space for fence mecanism */
+ ctx->pm4_ndwords -= 16;
+
+ r = r600_context_init_fence(ctx);
+ if (r) {
+ goto out_err;
+ }
+
+ /* init dirty list */
+ LIST_INITHEAD(&ctx->dirty);
+ return 0;
+out_err:
+ r600_context_fini(ctx);
+ return r;
+}
+
+static inline void evergreen_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
+{
+ struct r600_range *range;
+ struct r600_block *block;
+
+ range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
+ block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
+ if (state == NULL) {
+ block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
+ r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
+ r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
+ LIST_DELINIT(&block->list);
+ return;
+ }
+ block->reg[0] = state->regs[0].value;
+ block->reg[1] = state->regs[1].value;
+ block->reg[2] = state->regs[2].value;
+ block->reg[3] = state->regs[3].value;
+ block->reg[4] = state->regs[4].value;
+ block->reg[5] = state->regs[5].value;
+ block->reg[6] = state->regs[6].value;
+ block->reg[7] = state->regs[7].value;
+ r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
+ r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
+ if (state->regs[0].bo) {
+ /* VERTEX RESOURCE, we preted there is 2 bo to relocate so
+ * we have single case btw VERTEX & TEXTURE resource
+ */
+ r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo);
+ r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo);
+ } else {
+ /* TEXTURE RESOURCE */
+ r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo);
+ r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo);
+ }
+ if (!(block->status & R600_BLOCK_STATUS_DIRTY)) {
+ block->status |= R600_BLOCK_STATUS_ENABLED;
+ block->status |= R600_BLOCK_STATUS_DIRTY;
+ ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords;
+ LIST_ADDTAIL(&block->list,&ctx->dirty);
+ }
+}
+
+void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
+{
+ unsigned offset = R_030000_SQ_TEX_RESOURCE_WORD0_0 + 0x20 * rid;
+
+ evergreen_context_pipe_state_set_resource(ctx, state, offset);
+}
+
+void evergreen_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
+{
+ unsigned offset = R_030000_SQ_TEX_RESOURCE_WORD0_0 + 0x1600 + 0x20 * rid;
+
+ evergreen_context_pipe_state_set_resource(ctx, state, offset);
+}
+
+static inline void evergreen_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
+{
+ struct r600_range *range;
+ struct r600_block *block;
+
+ range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
+ block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
+ if (state == NULL) {
+ block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
+ LIST_DELINIT(&block->list);
+ return;
+ }
+ block->reg[0] = state->regs[0].value;
+ block->reg[1] = state->regs[1].value;
+ block->reg[2] = state->regs[2].value;
+ if (!(block->status & R600_BLOCK_STATUS_DIRTY)) {
+ block->status |= R600_BLOCK_STATUS_ENABLED;
+ block->status |= R600_BLOCK_STATUS_DIRTY;
+ ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords;
+ LIST_ADDTAIL(&block->list,&ctx->dirty);
+ }
+}
+
+static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset, unsigned id)
+{
+ unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x100 + 0x40000 + id * 0x1C;
+ struct r600_range *range;
+ struct r600_block *block;
+
+ range = &ctx->range[CTX_RANGE_ID(ctx, fake_offset)];
+ block = range->blocks[CTX_BLOCK_ID(ctx, fake_offset)];
+ if (state == NULL) {
+ block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
+ LIST_DELINIT(&block->list);
+ return;
+ }
+ if (state->nregs <= 3) {
+ return;
+ }
+ block->reg[0] = id;
+ block->reg[1] = state->regs[3].value;
+ block->reg[2] = state->regs[4].value;
+ block->reg[3] = state->regs[5].value;
+ block->reg[4] = state->regs[6].value;
+ if (!(block->status & R600_BLOCK_STATUS_DIRTY)) {
+ block->status |= R600_BLOCK_STATUS_ENABLED;
+ block->status |= R600_BLOCK_STATUS_DIRTY;
+ ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords;
+ LIST_ADDTAIL(&block->list,&ctx->dirty);
+ }
+}
+
+void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id)
+{
+ unsigned offset;
+
+ offset = 0x0003C000 + id * 0xc;
+ evergreen_context_pipe_state_set_sampler(ctx, state, offset);
+ evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, id);
+}
+
+void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id)
+{
+ unsigned offset;
+
+ offset = 0x0003C0D8 + id * 0xc;
+ evergreen_context_pipe_state_set_sampler(ctx, state, offset);
+ evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, id);
+}
+
+
+void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw)
+{
+ struct r600_bo *cb[12];
+ struct r600_bo *db;
+ unsigned ndwords = 9, flush;
+ struct r600_block *dirty_block = NULL;
+ struct r600_block *next_block;
+
+ if (draw->indices) {
+ ndwords = 13;
+ /* make sure there is enough relocation space before scheduling draw */
+ if (ctx->creloc >= (ctx->nreloc - 1)) {
+ r600_context_flush(ctx);
+ }
+ }
+
+ /* find number of color buffer */
+ db = r600_context_reg_bo(ctx, R_028048_DB_Z_READ_BASE);
+ cb[0] = r600_context_reg_bo(ctx, R_028C60_CB_COLOR0_BASE);
+ cb[1] = r600_context_reg_bo(ctx, R_028C9C_CB_COLOR1_BASE);
+ cb[2] = r600_context_reg_bo(ctx, R_028CD8_CB_COLOR2_BASE);
+ cb[3] = r600_context_reg_bo(ctx, R_028D14_CB_COLOR3_BASE);
+ cb[4] = r600_context_reg_bo(ctx, R_028D50_CB_COLOR4_BASE);
+ cb[5] = r600_context_reg_bo(ctx, R_028D8C_CB_COLOR5_BASE);
+ cb[6] = r600_context_reg_bo(ctx, R_028DC8_CB_COLOR6_BASE);
+ cb[7] = r600_context_reg_bo(ctx, R_028E04_CB_COLOR7_BASE);
+ cb[8] = r600_context_reg_bo(ctx, R_028E40_CB_COLOR8_BASE);
+ cb[9] = r600_context_reg_bo(ctx, R_028E5C_CB_COLOR9_BASE);
+ cb[10] = r600_context_reg_bo(ctx, R_028E78_CB_COLOR10_BASE);
+ cb[11] = r600_context_reg_bo(ctx, R_028E94_CB_COLOR11_BASE);
+ for (int i = 0; i < 12; i++) {
+ if (cb[i]) {
+ ndwords += 7;
+ }
+ }
+ if (db)
+ ndwords += 7;
+
+ /* queries need some special values */
+ if (ctx->num_query_running) {
+ r600_context_reg(ctx,
+ R_028004_DB_COUNT_CONTROL,
+ S_028004_PERFECT_ZPASS_COUNTS(1),
+ S_028004_PERFECT_ZPASS_COUNTS(1));
+ r600_context_reg(ctx,
+ R_02800C_DB_RENDER_OVERRIDE,
+ S_02800C_NOOP_CULL_DISABLE(1),
+ S_02800C_NOOP_CULL_DISABLE(1));
+ }
+
+ if ((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) {
+ /* need to flush */
+ r600_context_flush(ctx);
+ }
+ /* at that point everythings is flushed and ctx->pm4_cdwords = 0 */
+ if ((ctx->pm4_dirty_cdwords + ndwords) > ctx->pm4_ndwords) {
+ R600_ERR("context is too big to be scheduled\n");
+ return;
+ }
+
+ /* enough room to copy packet */
+ LIST_FOR_EACH_ENTRY_SAFE(dirty_block, next_block, &ctx->dirty,list) {
+ r600_context_block_emit_dirty(ctx, dirty_block);
+ }
+
+ /* draw packet */
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0);
+ ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_index_type;
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NUM_INSTANCES, 0);
+ ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_instances;
+ if (draw->indices) {
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX, 3);
+ ctx->pm4[ctx->pm4_cdwords++] = draw->indices_bo_offset + r600_bo_offset(draw->indices);
+ ctx->pm4[ctx->pm4_cdwords++] = 0;
+ ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices;
+ ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator;
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
+ ctx->pm4[ctx->pm4_cdwords++] = 0;
+ r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], draw->indices);
+ } else {
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1);
+ ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices;
+ ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator;
+ }
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0);
+ ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT;
+
+ /* flush color buffer */
+ for (int i = 0; i < 12; i++) {
+ if (cb[i]) {
+ if (i > 7) {
+ flush = (S_0085F0_CB8_DEST_BASE_ENA(1) << (i - 8)) |
+ S_0085F0_CB_ACTION_ENA(1);
+ } else {
+ flush = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) |
+ S_0085F0_CB_ACTION_ENA(1);
+ }
+ r600_context_bo_flush(ctx, flush, 0, cb[i]);
+ }
+ }
+ if (db) {
+ r600_context_bo_flush(ctx,
+ S_0085F0_DB_ACTION_ENA(1) |
+ S_0085F0_DB_DEST_BASE_ENA(1),
+ 0, db);
+ }
+
+ /* all dirty state have been scheduled in current cs */
+ ctx->pm4_dirty_cdwords = 0;
+}
+
+static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
+{
+ struct r600_range *range;
+ struct r600_block *block;
+
+ range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
+ block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
+ block->reg[0] = state->regs[0].value;
+ block->reg[1] = state->regs[1].value;
+ block->reg[2] = state->regs[2].value;
+ block->reg[3] = state->regs[3].value;
+ block->reg[4] = state->regs[4].value;
+ block->reg[5] = state->regs[5].value;
+ block->reg[6] = state->regs[6].value;
+ block->reg[7] = state->regs[7].value;
+ r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
+ r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
+ if (state->regs[0].bo) {
+ /* VERTEX RESOURCE, we preted there is 2 bo to relocate so
+ * we have single case btw VERTEX & TEXTURE resource
+ */
+ r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo);
+ r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo);
+ } else {
+ /* TEXTURE RESOURCE */
+ r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo);
+ r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo);
+ }
+ if (!(block->status & R600_BLOCK_STATUS_DIRTY)) {
+ block->status |= R600_BLOCK_STATUS_ENABLED;
+ block->status |= R600_BLOCK_STATUS_DIRTY;
+ ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords;
+ LIST_ADDTAIL(&block->list,&ctx->dirty);
+ }
+}
+
+void evergreen_ps_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
+{
+ unsigned offset = R_030000_RESOURCE0_WORD0 + 0x20 * rid;
+
+ evergreen_resource_set(ctx, state, offset);
+}
+
+void evergreen_vs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
+{
+ unsigned offset = R_030000_RESOURCE0_WORD0 + 0x1600 + 0x20 * rid;
+
+ evergreen_resource_set(ctx, state, offset);
+}
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * 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.
- *
- * Authors:
- * Jerome Glisse
- */
-#include <errno.h>
-#include <stdint.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "xf86drm.h"
-#include "r600.h"
-#include "evergreend.h"
-#include "r600_priv.h"
-#include "radeon_drm.h"
-#include "bof.h"
-#include "pipe/p_compiler.h"
-#include "util/u_inlines.h"
-#include <pipebuffer/pb_bufmgr.h>
-
-struct radeon_bo {
- struct pipe_reference reference;
- unsigned handle;
- unsigned size;
- unsigned alignment;
- unsigned map_count;
- void *data;
-};
-struct radeon_ws_bo {
- struct pipe_reference reference;
- struct pb_buffer *pb;
-};
-struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf);
-
-struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned group_id, unsigned offset);
-void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group);
-void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo);
-int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg, unsigned opcode);
-int r600_group_init(struct r600_group *group, unsigned start_offset, unsigned end_offset);
-
-#define GROUP_FORCE_NEW_BLOCK 0
-static const struct r600_reg evergreen_config_reg_list[] = {
- {0, 0, R_008958_VGT_PRIMITIVE_TYPE},
- {0, 0, R_008A14_PA_CL_ENHANCE},
- {0, 0, R_008C00_SQ_CONFIG},
- {0, 0, R_008C04_SQ_GPR_RESOURCE_MGMT_1},
- {0, 0, R_008C08_SQ_GPR_RESOURCE_MGMT_2},
- {0, 0, R_008C0C_SQ_THREAD_RESOURCE_MGMT},
- {0, 0, R_008C18_SQ_THREAD_RESOURCE_MGMT_1},
- {0, 0, R_008C1C_SQ_THREAD_RESOURCE_MGMT_2},
- {0, 0, R_008C20_SQ_STACK_RESOURCE_MGMT_1},
- {0, 0, R_008C24_SQ_STACK_RESOURCE_MGMT_2},
- {0, 0, R_008C28_SQ_STACK_RESOURCE_MGMT_3},
- {0, 0, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ},
- {0, 0, R_009100_SPI_CONFIG_CNTL},
- {0, 0, R_00913C_SPI_CONFIG_CNTL_1},
-};
-
-static const struct r600_reg evergreen_context_reg_list[] = {
- {0, 0, R_028000_DB_RENDER_CONTROL},
- {0, 0, R_028004_DB_COUNT_CONTROL},
- {0, 0, R_028008_DB_DEPTH_VIEW},
- {0, 0, R_02800C_DB_RENDER_OVERRIDE},
- {0, 0, R_028010_DB_RENDER_OVERRIDE2},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028014_DB_HTILE_DATA_BASE},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {0, 0, R_028028_DB_STENCIL_CLEAR},
- {0, 0, R_02802C_DB_DEPTH_CLEAR},
- {0, 0, R_028030_PA_SC_SCREEN_SCISSOR_TL},
- {0, 0, R_028034_PA_SC_SCREEN_SCISSOR_BR},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028040_DB_Z_INFO},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {0, 0, R_028044_DB_STENCIL_INFO},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028048_DB_Z_READ_BASE},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_02804C_DB_STENCIL_READ_BASE},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028050_DB_Z_WRITE_BASE},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028054_DB_STENCIL_WRITE_BASE},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {0, 0, R_028058_DB_DEPTH_SIZE},
- {0, 0, R_02805C_DB_DEPTH_SLICE},
- {0, 0, R_028140_ALU_CONST_BUFFER_SIZE_PS_0},
- {0, 0, R_028180_ALU_CONST_BUFFER_SIZE_VS_0},
- {0, 0, R_028200_PA_SC_WINDOW_OFFSET},
- {0, 0, R_028204_PA_SC_WINDOW_SCISSOR_TL},
- {0, 0, R_028208_PA_SC_WINDOW_SCISSOR_BR},
- {0, 0, R_02820C_PA_SC_CLIPRECT_RULE},
- {0, 0, R_028210_PA_SC_CLIPRECT_0_TL},
- {0, 0, R_028214_PA_SC_CLIPRECT_0_BR},
- {0, 0, R_028218_PA_SC_CLIPRECT_1_TL},
- {0, 0, R_02821C_PA_SC_CLIPRECT_1_BR},
- {0, 0, R_028220_PA_SC_CLIPRECT_2_TL},
- {0, 0, R_028224_PA_SC_CLIPRECT_2_BR},
- {0, 0, R_028228_PA_SC_CLIPRECT_3_TL},
- {0, 0, R_02822C_PA_SC_CLIPRECT_3_BR},
- {0, 0, R_028230_PA_SC_EDGERULE},
- {0, 0, R_028234_PA_SU_HARDWARE_SCREEN_OFFSET},
- {0, 0, R_028238_CB_TARGET_MASK},
- {0, 0, R_02823C_CB_SHADER_MASK},
- {0, 0, R_028240_PA_SC_GENERIC_SCISSOR_TL},
- {0, 0, R_028244_PA_SC_GENERIC_SCISSOR_BR},
- {0, 0, R_028250_PA_SC_VPORT_SCISSOR_0_TL},
- {0, 0, R_028254_PA_SC_VPORT_SCISSOR_0_BR},
- {0, 0, R_028350_SX_MISC},
- {0, 0, R_028380_SQ_VTX_SEMANTIC_0},
- {0, 0, R_028384_SQ_VTX_SEMANTIC_1},
- {0, 0, R_028388_SQ_VTX_SEMANTIC_2},
- {0, 0, R_02838C_SQ_VTX_SEMANTIC_3},
- {0, 0, R_028390_SQ_VTX_SEMANTIC_4},
- {0, 0, R_028394_SQ_VTX_SEMANTIC_5},
- {0, 0, R_028398_SQ_VTX_SEMANTIC_6},
- {0, 0, R_02839C_SQ_VTX_SEMANTIC_7},
- {0, 0, R_0283A0_SQ_VTX_SEMANTIC_8},
- {0, 0, R_0283A4_SQ_VTX_SEMANTIC_9},
- {0, 0, R_0283A8_SQ_VTX_SEMANTIC_10},
- {0, 0, R_0283AC_SQ_VTX_SEMANTIC_11},
- {0, 0, R_0283B0_SQ_VTX_SEMANTIC_12},
- {0, 0, R_0283B4_SQ_VTX_SEMANTIC_13},
- {0, 0, R_0283B8_SQ_VTX_SEMANTIC_14},
- {0, 0, R_0283BC_SQ_VTX_SEMANTIC_15},
- {0, 0, R_0283C0_SQ_VTX_SEMANTIC_16},
- {0, 0, R_0283C4_SQ_VTX_SEMANTIC_17},
- {0, 0, R_0283C8_SQ_VTX_SEMANTIC_18},
- {0, 0, R_0283CC_SQ_VTX_SEMANTIC_19},
- {0, 0, R_0283D0_SQ_VTX_SEMANTIC_20},
- {0, 0, R_0283D4_SQ_VTX_SEMANTIC_21},
- {0, 0, R_0283D8_SQ_VTX_SEMANTIC_22},
- {0, 0, R_0283DC_SQ_VTX_SEMANTIC_23},
- {0, 0, R_0283E0_SQ_VTX_SEMANTIC_24},
- {0, 0, R_0283E4_SQ_VTX_SEMANTIC_25},
- {0, 0, R_0283E8_SQ_VTX_SEMANTIC_26},
- {0, 0, R_0283EC_SQ_VTX_SEMANTIC_27},
- {0, 0, R_0283F0_SQ_VTX_SEMANTIC_28},
- {0, 0, R_0283F4_SQ_VTX_SEMANTIC_29},
- {0, 0, R_0283F8_SQ_VTX_SEMANTIC_30},
- {0, 0, R_0283FC_SQ_VTX_SEMANTIC_31},
- {0, 0, R_0282D0_PA_SC_VPORT_ZMIN_0},
- {0, 0, R_0282D4_PA_SC_VPORT_ZMAX_0},
- {0, 0, R_028400_VGT_MAX_VTX_INDX},
- {0, 0, R_028404_VGT_MIN_VTX_INDX},
- {0, 0, R_028408_VGT_INDX_OFFSET},
- {0, 0, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX},
- {0, 0, R_028410_SX_ALPHA_TEST_CONTROL},
- {0, 0, R_028414_CB_BLEND_RED},
- {0, 0, R_028418_CB_BLEND_GREEN},
- {0, 0, R_02841C_CB_BLEND_BLUE},
- {0, 0, R_028420_CB_BLEND_ALPHA},
- {0, 0, R_028430_DB_STENCILREFMASK},
- {0, 0, R_028434_DB_STENCILREFMASK_BF},
- {0, 0, R_028438_SX_ALPHA_REF},
- {0, 0, R_02843C_PA_CL_VPORT_XSCALE_0},
- {0, 0, R_028440_PA_CL_VPORT_XOFFSET_0},
- {0, 0, R_028444_PA_CL_VPORT_YSCALE_0},
- {0, 0, R_028448_PA_CL_VPORT_YOFFSET_0},
- {0, 0, R_02844C_PA_CL_VPORT_ZSCALE_0},
- {0, 0, R_028450_PA_CL_VPORT_ZOFFSET_0},
- {0, 0, R_0285BC_PA_CL_UCP0_X},
- {0, 0, R_0285C0_PA_CL_UCP0_Y},
- {0, 0, R_0285C4_PA_CL_UCP0_Z},
- {0, 0, R_0285C8_PA_CL_UCP0_W},
- {0, 0, R_0285CC_PA_CL_UCP1_X},
- {0, 0, R_0285D0_PA_CL_UCP1_Y},
- {0, 0, R_0285D4_PA_CL_UCP1_Z},
- {0, 0, R_0285D8_PA_CL_UCP1_W},
- {0, 0, R_0285DC_PA_CL_UCP2_X},
- {0, 0, R_0285E0_PA_CL_UCP2_Y},
- {0, 0, R_0285E4_PA_CL_UCP2_Z},
- {0, 0, R_0285E8_PA_CL_UCP2_W},
- {0, 0, R_0285EC_PA_CL_UCP3_X},
- {0, 0, R_0285F0_PA_CL_UCP3_Y},
- {0, 0, R_0285F4_PA_CL_UCP3_Z},
- {0, 0, R_0285F8_PA_CL_UCP3_W},
- {0, 0, R_0285FC_PA_CL_UCP4_X},
- {0, 0, R_028600_PA_CL_UCP4_Y},
- {0, 0, R_028604_PA_CL_UCP4_Z},
- {0, 0, R_028608_PA_CL_UCP4_W},
- {0, 0, R_02860C_PA_CL_UCP5_X},
- {0, 0, R_028610_PA_CL_UCP5_Y},
- {0, 0, R_028614_PA_CL_UCP5_Z},
- {0, 0, R_028618_PA_CL_UCP5_W},
- {0, 0, R_02861C_SPI_VS_OUT_ID_0},
- {0, 0, R_028620_SPI_VS_OUT_ID_1},
- {0, 0, R_028624_SPI_VS_OUT_ID_2},
- {0, 0, R_028628_SPI_VS_OUT_ID_3},
- {0, 0, R_02862C_SPI_VS_OUT_ID_4},
- {0, 0, R_028630_SPI_VS_OUT_ID_5},
- {0, 0, R_028634_SPI_VS_OUT_ID_6},
- {0, 0, R_028638_SPI_VS_OUT_ID_7},
- {0, 0, R_02863C_SPI_VS_OUT_ID_8},
- {0, 0, R_028640_SPI_VS_OUT_ID_9},
- {0, 0, R_028644_SPI_PS_INPUT_CNTL_0},
- {0, 0, R_028648_SPI_PS_INPUT_CNTL_1},
- {0, 0, R_02864C_SPI_PS_INPUT_CNTL_2},
- {0, 0, R_028650_SPI_PS_INPUT_CNTL_3},
- {0, 0, R_028654_SPI_PS_INPUT_CNTL_4},
- {0, 0, R_028658_SPI_PS_INPUT_CNTL_5},
- {0, 0, R_02865C_SPI_PS_INPUT_CNTL_6},
- {0, 0, R_028660_SPI_PS_INPUT_CNTL_7},
- {0, 0, R_028664_SPI_PS_INPUT_CNTL_8},
- {0, 0, R_028668_SPI_PS_INPUT_CNTL_9},
- {0, 0, R_02866C_SPI_PS_INPUT_CNTL_10},
- {0, 0, R_028670_SPI_PS_INPUT_CNTL_11},
- {0, 0, R_028674_SPI_PS_INPUT_CNTL_12},
- {0, 0, R_028678_SPI_PS_INPUT_CNTL_13},
- {0, 0, R_02867C_SPI_PS_INPUT_CNTL_14},
- {0, 0, R_028680_SPI_PS_INPUT_CNTL_15},
- {0, 0, R_028684_SPI_PS_INPUT_CNTL_16},
- {0, 0, R_028688_SPI_PS_INPUT_CNTL_17},
- {0, 0, R_02868C_SPI_PS_INPUT_CNTL_18},
- {0, 0, R_028690_SPI_PS_INPUT_CNTL_19},
- {0, 0, R_028694_SPI_PS_INPUT_CNTL_20},
- {0, 0, R_028698_SPI_PS_INPUT_CNTL_21},
- {0, 0, R_02869C_SPI_PS_INPUT_CNTL_22},
- {0, 0, R_0286A0_SPI_PS_INPUT_CNTL_23},
- {0, 0, R_0286A4_SPI_PS_INPUT_CNTL_24},
- {0, 0, R_0286A8_SPI_PS_INPUT_CNTL_25},
- {0, 0, R_0286AC_SPI_PS_INPUT_CNTL_26},
- {0, 0, R_0286B0_SPI_PS_INPUT_CNTL_27},
- {0, 0, R_0286B4_SPI_PS_INPUT_CNTL_28},
- {0, 0, R_0286B8_SPI_PS_INPUT_CNTL_29},
- {0, 0, R_0286BC_SPI_PS_INPUT_CNTL_30},
- {0, 0, R_0286C0_SPI_PS_INPUT_CNTL_31},
- {0, 0, R_0286C4_SPI_VS_OUT_CONFIG},
- {0, 0, R_0286C8_SPI_THREAD_GROUPING},
- {0, 0, R_0286CC_SPI_PS_IN_CONTROL_0},
- {0, 0, R_0286D0_SPI_PS_IN_CONTROL_1},
- {0, 0, R_0286D4_SPI_INTERP_CONTROL_0},
- {0, 0, R_0286D8_SPI_INPUT_Z},
- {0, 0, R_0286DC_SPI_FOG_CNTL},
- {0, 0, R_0286E0_SPI_BARYC_CNTL},
- {0, 0, R_0286E4_SPI_PS_IN_CONTROL_2},
- {0, 0, R_0286E8_SPI_COMPUTE_INPUT_CNTL},
- {0, 0, R_028780_CB_BLEND0_CONTROL},
- {0, 0, R_028784_CB_BLEND1_CONTROL},
- {0, 0, R_028788_CB_BLEND2_CONTROL},
- {0, 0, R_02878C_CB_BLEND3_CONTROL},
- {0, 0, R_028790_CB_BLEND4_CONTROL},
- {0, 0, R_028794_CB_BLEND5_CONTROL},
- {0, 0, R_028798_CB_BLEND6_CONTROL},
- {0, 0, R_02879C_CB_BLEND7_CONTROL},
- {0, 0, R_028800_DB_DEPTH_CONTROL},
- {0, 0, R_02880C_DB_SHADER_CONTROL},
- {0, 0, R_028808_CB_COLOR_CONTROL},
- {0, 0, R_028810_PA_CL_CLIP_CNTL},
- {0, 0, R_028814_PA_SU_SC_MODE_CNTL},
- {0, 0, R_028818_PA_CL_VTE_CNTL},
- {0, 0, R_02881C_PA_CL_VS_OUT_CNTL},
- {0, 0, R_028820_PA_CL_NANINF_CNTL},
- {0, 0, R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1},
- {1, S_0085F0_SH_ACTION_ENA(1), R_028840_SQ_PGM_START_PS},
- {0, 0, R_028844_SQ_PGM_RESOURCES_PS},
- {0, 0, R_028848_SQ_PGM_RESOURCES_2_PS},
- {0, 0, R_02884C_SQ_PGM_EXPORTS_PS},
- {1, S_0085F0_SH_ACTION_ENA(1), R_02885C_SQ_PGM_START_VS},
- {0, 0, R_028860_SQ_PGM_RESOURCES_VS},
- {0, 0, R_028864_SQ_PGM_RESOURCES_2_VS},
- {1, S_0085F0_SH_ACTION_ENA(1), R_0288A4_SQ_PGM_START_FS},
- {0, 0, R_0288A8_SQ_PGM_RESOURCES_FS},
- {0, 0, R_0288EC_SQ_LDS_ALLOC_PS},
- {0, 0, R_028900_SQ_ESGS_RING_ITEMSIZE},
- {0, 0, R_028904_SQ_GSVS_RING_ITEMSIZE},
- {0, 0, R_028908_SQ_ESTMP_RING_ITEMSIZE},
- {0, 0, R_02890C_SQ_GSTMP_RING_ITEMSIZE},
- {0, 0, R_028910_SQ_VSTMP_RING_ITEMSIZE},
- {0, 0, R_028914_SQ_PSTMP_RING_ITEMSIZE},
- {0, 0, R_02891C_SQ_GS_VERT_ITEMSIZE},
- {0, 0, R_028920_SQ_GS_VERT_ITEMSIZE_1},
- {0, 0, R_028924_SQ_GS_VERT_ITEMSIZE_2},
- {0, 0, R_028928_SQ_GS_VERT_ITEMSIZE_3},
- {1, 0, R_028940_ALU_CONST_CACHE_PS_0},
- {1, 0, R_028980_ALU_CONST_CACHE_VS_0},
- {0, 0, R_028A00_PA_SU_POINT_SIZE},
- {0, 0, R_028A04_PA_SU_POINT_MINMAX},
- {0, 0, R_028A08_PA_SU_LINE_CNTL},
- {0, 0, R_028A10_VGT_OUTPUT_PATH_CNTL},
- {0, 0, R_028A14_VGT_HOS_CNTL},
- {0, 0, R_028A18_VGT_HOS_MAX_TESS_LEVEL},
- {0, 0, R_028A1C_VGT_HOS_MIN_TESS_LEVEL},
- {0, 0, R_028A20_VGT_HOS_REUSE_DEPTH},
- {0, 0, R_028A24_VGT_GROUP_PRIM_TYPE},
- {0, 0, R_028A28_VGT_GROUP_FIRST_DECR},
- {0, 0, R_028A2C_VGT_GROUP_DECR},
- {0, 0, R_028A30_VGT_GROUP_VECT_0_CNTL},
- {0, 0, R_028A34_VGT_GROUP_VECT_1_CNTL},
- {0, 0, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL},
- {0, 0, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL},
- {0, 0, R_028A40_VGT_GS_MODE},
- {0, 0, R_028A48_PA_SC_MODE_CNTL_0},
- {0, 0, R_028A4C_PA_SC_MODE_CNTL_1},
- {0, 0, R_028AB4_VGT_REUSE_OFF},
- {0, 0, R_028AB8_VGT_VTX_CNT_EN},
- {0, 0, R_028ABC_DB_HTILE_SURFACE},
- {0, 0, R_028AC0_DB_SRESULTS_COMPARE_STATE0},
- {0, 0, R_028AC4_DB_SRESULTS_COMPARE_STATE1},
- {0, 0, R_028AC8_DB_PRELOAD_CONTROL},
- {0, 0, R_028B54_VGT_SHADER_STAGES_EN},
- {0, 0, R_028B70_DB_ALPHA_TO_MASK},
- {0, 0, R_028B78_PA_SU_POLY_OFFSET_DB_FMT_CNTL},
- {0, 0, R_028B7C_PA_SU_POLY_OFFSET_CLAMP},
- {0, 0, R_028B80_PA_SU_POLY_OFFSET_FRONT_SCALE},
- {0, 0, R_028B84_PA_SU_POLY_OFFSET_FRONT_OFFSET},
- {0, 0, R_028B88_PA_SU_POLY_OFFSET_BACK_SCALE},
- {0, 0, R_028B8C_PA_SU_POLY_OFFSET_BACK_OFFSET},
- {0, 0, R_028B94_VGT_STRMOUT_CONFIG},
- {0, 0, R_028B98_VGT_STRMOUT_BUFFER_CONFIG},
- {0, 0, R_028C00_PA_SC_LINE_CNTL},
- {0, 0, R_028C04_PA_SC_AA_CONFIG},
- {0, 0, R_028C08_PA_SU_VTX_CNTL},
- {0, 0, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ},
- {0, 0, R_028C10_PA_CL_GB_VERT_DISC_ADJ},
- {0, 0, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ},
- {0, 0, R_028C18_PA_CL_GB_HORZ_DISC_ADJ},
- {0, 0, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX},
- {0, 0, R_028C3C_PA_SC_AA_MASK},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028C60_CB_COLOR0_BASE},
- {0, 0, R_028C64_CB_COLOR0_PITCH},
- {0, 0, R_028C68_CB_COLOR0_SLICE},
- {0, 0, R_028C6C_CB_COLOR0_VIEW},
- {1, 0, R_028C70_CB_COLOR0_INFO},
- {0, 0, R_028C74_CB_COLOR0_ATTRIB},
- {0, 0, R_028C78_CB_COLOR0_DIM},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028C9C_CB_COLOR1_BASE},
- {0, 0, R_028CA0_CB_COLOR1_PITCH},
- {0, 0, R_028CA4_CB_COLOR1_SLICE},
- {0, 0, R_028CA8_CB_COLOR1_VIEW},
- {1, 0, R_028CAC_CB_COLOR1_INFO},
- {0, 0, R_028CB0_CB_COLOR1_ATTRIB},
- {0, 0, R_028CB8_CB_COLOR1_DIM},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028CD8_CB_COLOR2_BASE},
- {0, 0, R_028CDC_CB_COLOR2_PITCH},
- {0, 0, R_028CE0_CB_COLOR2_SLICE},
- {0, 0, R_028CE4_CB_COLOR2_VIEW},
- {1, 0, R_028CE8_CB_COLOR2_INFO},
- {0, 0, R_028CEC_CB_COLOR2_ATTRIB},
- {0, 0, R_028CF0_CB_COLOR2_DIM},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028D14_CB_COLOR3_BASE},
- {0, 0, R_028D18_CB_COLOR3_PITCH},
- {0, 0, R_028D1C_CB_COLOR3_SLICE},
- {0, 0, R_028D20_CB_COLOR3_VIEW},
- {1, 0, R_028D24_CB_COLOR3_INFO},
- {0, 0, R_028D28_CB_COLOR3_ATTRIB},
- {0, 0, R_028D2C_CB_COLOR3_DIM},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028D50_CB_COLOR4_BASE},
- {0, 0, R_028D54_CB_COLOR4_PITCH},
- {0, 0, R_028D58_CB_COLOR4_SLICE},
- {0, 0, R_028D5C_CB_COLOR4_VIEW},
- {1, 0, R_028D60_CB_COLOR4_INFO},
- {0, 0, R_028D64_CB_COLOR4_ATTRIB},
- {0, 0, R_028D68_CB_COLOR4_DIM},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028D8C_CB_COLOR5_BASE},
- {0, 0, R_028D90_CB_COLOR5_PITCH},
- {0, 0, R_028D94_CB_COLOR5_SLICE},
- {0, 0, R_028D98_CB_COLOR5_VIEW},
- {1, 0, R_028D9C_CB_COLOR5_INFO},
- {0, 0, R_028DA0_CB_COLOR5_ATTRIB},
- {0, 0, R_028DA4_CB_COLOR5_DIM},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028DC8_CB_COLOR6_BASE},
- {0, 0, R_028DCC_CB_COLOR6_PITCH},
- {0, 0, R_028DD0_CB_COLOR6_SLICE},
- {0, 0, R_028DD4_CB_COLOR6_VIEW},
- {1, 0, R_028DD8_CB_COLOR6_INFO},
- {0, 0, R_028DDC_CB_COLOR6_ATTRIB},
- {0, 0, R_028DE0_CB_COLOR6_DIM},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028E04_CB_COLOR7_BASE},
- {0, 0, R_028E08_CB_COLOR7_PITCH},
- {0, 0, R_028E0C_CB_COLOR7_SLICE},
- {0, 0, R_028E10_CB_COLOR7_VIEW},
- {1, 0, R_028E14_CB_COLOR7_INFO},
- {0, 0, R_028E18_CB_COLOR7_ATTRIB},
- {0, 0, R_028E1C_CB_COLOR7_DIM},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028E40_CB_COLOR8_BASE},
- {0, 0, R_028E44_CB_COLOR8_PITCH},
- {0, 0, R_028E48_CB_COLOR8_SLICE},
- {0, 0, R_028E4C_CB_COLOR8_VIEW},
- {1, 0, R_028E50_CB_COLOR8_INFO},
- {0, 0, R_028E54_CB_COLOR8_ATTRIB},
- {0, 0, R_028E58_CB_COLOR8_DIM},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028E5C_CB_COLOR9_BASE},
- {0, 0, R_028E60_CB_COLOR9_PITCH},
- {0, 0, R_028E64_CB_COLOR9_SLICE},
- {0, 0, R_028E68_CB_COLOR9_VIEW},
- {1, 0, R_028E6C_CB_COLOR9_INFO},
- {0, 0, R_028E70_CB_COLOR9_ATTRIB},
- {0, 0, R_028E74_CB_COLOR9_DIM},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028E78_CB_COLOR10_BASE},
- {0, 0, R_028E7C_CB_COLOR10_PITCH},
- {0, 0, R_028E80_CB_COLOR10_SLICE},
- {0, 0, R_028E84_CB_COLOR10_VIEW},
- {1, 0, R_028E88_CB_COLOR10_INFO},
- {0, 0, R_028E8C_CB_COLOR10_ATTRIB},
- {0, 0, R_028E90_CB_COLOR10_DIM},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028E94_CB_COLOR11_BASE},
- {0, 0, R_028E98_CB_COLOR11_PITCH},
- {0, 0, R_028E9C_CB_COLOR11_SLICE},
- {0, 0, R_028EA0_CB_COLOR11_VIEW},
- {1, 0, R_028EA4_CB_COLOR11_INFO},
- {0, 0, R_028EA8_CB_COLOR11_ATTRIB},
- {0, 0, R_028EAC_CB_COLOR11_DIM},
-};
-
-/* SHADER RESOURCE R600/R700 */
-static int evergreen_state_resource_init(struct r600_context *ctx, u32 offset)
-{
- struct r600_reg r600_shader_resource[] = {
- {0, 0, R_030000_RESOURCE0_WORD0},
- {0, 0, R_030004_RESOURCE0_WORD1},
- {1, 0, R_030008_RESOURCE0_WORD2},
- {1, 0, R_03000C_RESOURCE0_WORD3},
- {0, 0, R_030010_RESOURCE0_WORD4},
- {0, 0, R_030014_RESOURCE0_WORD5},
- {0, 0, R_030018_RESOURCE0_WORD6},
- {0, 0, R_03001C_RESOURCE0_WORD7},
- };
- unsigned nreg = sizeof(r600_shader_resource)/sizeof(struct r600_reg);
-
- for (int i = 0; i < nreg; i++) {
- r600_shader_resource[i].offset += offset;
- }
- return r600_context_add_block(ctx, r600_shader_resource, nreg, PKT3_SET_RESOURCE);
-}
-
-/* SHADER SAMPLER R600/R700 */
-static int r600_state_sampler_init(struct r600_context *ctx, u32 offset)
-{
- struct r600_reg r600_shader_sampler[] = {
- {0, 0, R_03C000_SQ_TEX_SAMPLER_WORD0_0},
- {0, 0, R_03C004_SQ_TEX_SAMPLER_WORD1_0},
- {0, 0, R_03C008_SQ_TEX_SAMPLER_WORD2_0},
- };
- unsigned nreg = sizeof(r600_shader_sampler)/sizeof(struct r600_reg);
-
- for (int i = 0; i < nreg; i++) {
- r600_shader_sampler[i].offset += offset;
- }
- return r600_context_add_block(ctx, r600_shader_sampler, nreg, PKT3_SET_SAMPLER);
-}
-
-/* SHADER SAMPLER BORDER R600/R700 */
-static int evergreen_state_sampler_border_init(struct r600_context *ctx, u32 offset, unsigned id)
-{
- struct r600_reg r600_shader_sampler_border[] = {
- {0, 0, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX},
- {0, 0, R_00A404_TD_PS_SAMPLER0_BORDER_RED},
- {0, 0, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN},
- {0, 0, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE},
- {0, 0, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA},
- };
- unsigned nreg = sizeof(r600_shader_sampler_border)/sizeof(struct r600_reg);
- unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x10 + 0x40000 + id * 0x1C;
- struct r600_group_block *block;
- struct r600_group *group;
- int r;
-
- for (int i = 0; i < nreg; i++) {
- r600_shader_sampler_border[i].offset -= R_00A400_TD_PS_SAMPLER0_BORDER_INDEX;
- r600_shader_sampler_border[i].offset += fake_offset;
- }
- r = r600_context_add_block(ctx, r600_shader_sampler_border, nreg, PKT3_SET_CONFIG_REG);
- if (r) {
- return r;
- }
- /* set proper offset */
- group = &ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER];
- id = group->offset_block_id[((fake_offset - group->start_offset) >> 2)];
- block = &group->blocks[id];
- block->pm4[1] = (offset - EVERGREEN_CONFIG_REG_OFFSET) >> 2;
- return 0;
-}
-
-int evergreen_context_init(struct r600_context *ctx, struct radeon *radeon)
-{
- int r;
-
- memset(ctx, 0, sizeof(struct r600_context));
- radeon->use_mem_constant = TRUE;
- ctx->radeon = radeon;
- LIST_INITHEAD(&ctx->query_list);
- /* initialize groups */
- r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_CONFIG], EVERGREEN_CONFIG_REG_OFFSET, EVERGREEN_CONFIG_REG_END);
- if (r) {
- goto out_err;
- }
- r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_LOOP_CONST], EVERGREEN_LOOP_CONST_OFFSET, EVERGREEN_LOOP_CONST_END);
- if (r) {
- goto out_err;
- }
- r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_BOOL_CONST], EVERGREEN_BOOL_CONST_OFFSET, EVERGREEN_BOOL_CONST_END);
- if (r) {
- goto out_err;
- }
- r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_SAMPLER], EVERGREEN_SAMPLER_OFFSET, EVERGREEN_SAMPLER_END);
- if (r) {
- goto out_err;
- }
- r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_RESOURCE], EVERGREEN_RESOURCE_OFFSET, EVERGREEN_RESOURCE_END);
- if (r) {
- goto out_err;
- }
- r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_CONTEXT], EVERGREEN_CONTEXT_REG_OFFSET, EVERGREEN_CONTEXT_REG_END);
- if (r) {
- goto out_err;
- }
- /* we use unassigned range of GPU reg to fake border color register */
- r = r600_group_init(&ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER], 0x40000, 0x41000);
- if (r) {
- goto out_err;
- }
- ctx->ngroups = EVERGREEN_NGROUPS;
-
- /* add blocks */
- r = r600_context_add_block(ctx, evergreen_config_reg_list,
- sizeof(evergreen_config_reg_list)/sizeof(struct r600_reg),
- PKT3_SET_CONFIG_REG);
- if (r)
- goto out_err;
- r = r600_context_add_block(ctx, evergreen_context_reg_list,
- sizeof(evergreen_context_reg_list)/sizeof(struct r600_reg),
- PKT3_SET_CONTEXT_REG);
- if (r)
- goto out_err;
-
- /* PS SAMPLER */
- for (int j = 0, offset = 0; j < 18; j++, offset += 0xC) {
- r = r600_state_sampler_init(ctx, offset);
- if (r)
- goto out_err;
- }
- /* VS SAMPLER */
- for (int j = 0, offset = 0xD8; j < 18; j++, offset += 0xC) {
- r = r600_state_sampler_init(ctx, offset);
- if (r)
- goto out_err;
- }
- /* PS SAMPLER BORDER */
- for (int j = 0; j < 18; j++) {
- r = evergreen_state_sampler_border_init(ctx, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, j);
- if (r)
- goto out_err;
- }
- /* VS SAMPLER BORDER */
- for (int j = 0; j < 18; j++) {
- r = evergreen_state_sampler_border_init(ctx, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, j);
- if (r)
- goto out_err;
- }
- /* PS RESOURCE */
- for (int j = 0, offset = 0; j < 176; j++, offset += 0x20) {
- r = evergreen_state_resource_init(ctx, offset);
- if (r)
- goto out_err;
- }
- /* VS RESOURCE */
- for (int j = 0, offset = 0x1600; j < 160; j++, offset += 0x20) {
- r = evergreen_state_resource_init(ctx, offset);
- if (r)
- goto out_err;
- }
-
- /* allocate cs variables */
- ctx->nreloc = RADEON_CTX_MAX_PM4;
- ctx->reloc = calloc(ctx->nreloc, sizeof(struct r600_reloc));
- if (ctx->reloc == NULL) {
- r = -ENOMEM;
- goto out_err;
- }
- ctx->bo = calloc(ctx->nreloc, sizeof(void *));
- if (ctx->bo == NULL) {
- r = -ENOMEM;
- goto out_err;
- }
- ctx->pm4_ndwords = RADEON_CTX_MAX_PM4;
- ctx->pm4 = calloc(ctx->pm4_ndwords, 4);
- if (ctx->pm4 == NULL) {
- r = -ENOMEM;
- goto out_err;
- }
- return 0;
-out_err:
- r600_context_fini(ctx);
- return r;
-}
-
-static inline void evergreen_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
-{
- struct r600_group_block *block;
- unsigned id;
-
- offset -= ctx->groups[EVERGREEN_GROUP_RESOURCE].start_offset;
- id = ctx->groups[EVERGREEN_GROUP_RESOURCE].offset_block_id[offset >> 2];
- block = &ctx->groups[EVERGREEN_GROUP_RESOURCE].blocks[id];
- if (state == NULL) {
- block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
- radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
- return;
- }
- block->reg[0] = state->regs[0].value;
- block->reg[1] = state->regs[1].value;
- block->reg[2] = state->regs[2].value;
- block->reg[3] = state->regs[3].value;
- block->reg[4] = state->regs[4].value;
- block->reg[5] = state->regs[5].value;
- block->reg[6] = state->regs[6].value;
- block->reg[7] = state->regs[7].value;
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
- radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
- if (state->regs[0].bo) {
- /* VERTEX RESOURCE, we preted there is 2 bo to relocate so
- * we have single case btw VERTEX & TEXTURE resource
- */
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo);
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo);
- } else {
- /* TEXTURE RESOURCE */
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo);
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo);
- }
- block->status |= R600_BLOCK_STATUS_ENABLED;
- block->status |= R600_BLOCK_STATUS_DIRTY;
- ctx->pm4_dirty_cdwords += block->pm4_ndwords;
-}
-
-void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
-{
- unsigned offset = R_030000_SQ_TEX_RESOURCE_WORD0_0 + 0x20 * rid;
-
- evergreen_context_pipe_state_set_resource(ctx, state, offset);
-}
-
-void evergreen_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
-{
- unsigned offset = R_030000_SQ_TEX_RESOURCE_WORD0_0 + 0x1600 + 0x20 * rid;
-
- evergreen_context_pipe_state_set_resource(ctx, state, offset);
-}
-
-static inline void evergreen_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
-{
- struct r600_group_block *block;
- unsigned id;
-
- offset -= ctx->groups[EVERGREEN_GROUP_SAMPLER].start_offset;
- id = ctx->groups[EVERGREEN_GROUP_SAMPLER].offset_block_id[offset >> 2];
- block = &ctx->groups[EVERGREEN_GROUP_SAMPLER].blocks[id];
- if (state == NULL) {
- block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
- return;
- }
- block->reg[0] = state->regs[0].value;
- block->reg[1] = state->regs[1].value;
- block->reg[2] = state->regs[2].value;
- block->status |= R600_BLOCK_STATUS_ENABLED;
- block->status |= R600_BLOCK_STATUS_DIRTY;
- ctx->pm4_dirty_cdwords += block->pm4_ndwords;
-}
-
-static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset, unsigned id)
-{
- struct r600_group_block *block;
- unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x10 + 0x40000 + id * 0x1C;
-
- fake_offset -= ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].start_offset;
- id = ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].offset_block_id[fake_offset >> 2];
- block = &ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER].blocks[id];
- if (state == NULL) {
- block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
- return;
- }
- if (state->nregs <= 3) {
- return;
- }
- block->reg[0] = id;
- block->reg[1] = state->regs[3].value;
- block->reg[2] = state->regs[4].value;
- block->reg[3] = state->regs[5].value;
- block->status |= R600_BLOCK_STATUS_ENABLED;
- block->status |= R600_BLOCK_STATUS_DIRTY;
- ctx->pm4_dirty_cdwords += block->pm4_ndwords;
-}
-
-void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id)
-{
- unsigned offset;
-
- offset = 0x0003C000 + id * 0xc;
- evergreen_context_pipe_state_set_sampler(ctx, state, offset);
- evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A400_TD_PS_SAMPLER0_BORDER_INDEX, id);
-}
-
-void evergreen_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id)
-{
- unsigned offset;
-
- offset = 0x0003C0D8 + id * 0xc;
- evergreen_context_pipe_state_set_sampler(ctx, state, offset);
- evergreen_context_pipe_state_set_sampler_border(ctx, state, R_00A414_TD_VS_SAMPLER0_BORDER_INDEX, id);
-}
-
-
-void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *draw)
-{
- struct radeon_bo *cb[12];
- unsigned ndwords = 9;
-
- if (draw->indices) {
- ndwords = 13;
- /* make sure there is enough relocation space before scheduling draw */
- if (ctx->creloc >= (ctx->nreloc - 1)) {
- r600_context_flush(ctx);
- }
- }
-
- /* find number of color buffer */
- cb[0] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028C60_CB_COLOR0_BASE);
- cb[1] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028C9C_CB_COLOR1_BASE);
- cb[2] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028CD8_CB_COLOR2_BASE);
- cb[3] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028D14_CB_COLOR3_BASE);
- cb[4] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028D50_CB_COLOR4_BASE);
- cb[5] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028D8C_CB_COLOR5_BASE);
- cb[6] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028DC8_CB_COLOR6_BASE);
- cb[7] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E04_CB_COLOR7_BASE);
- cb[8] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E40_CB_COLOR8_BASE);
- cb[9] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E5C_CB_COLOR9_BASE);
- cb[10] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E78_CB_COLOR10_BASE);
- cb[11] = r600_context_reg_bo(ctx, EVERGREEN_GROUP_CONTEXT, R_028E94_CB_COLOR11_BASE);
- for (int i = 0; i < 12; i++) {
- if (cb[i]) {
- ndwords += 7;
- }
- }
-
- /* queries need some special values */
- if (ctx->num_query_running) {
- r600_context_reg(ctx, EVERGREEN_GROUP_CONTEXT,
- R_028004_DB_COUNT_CONTROL,
- S_028004_PERFECT_ZPASS_COUNTS(1),
- S_028004_PERFECT_ZPASS_COUNTS(1));
- r600_context_reg(ctx, EVERGREEN_GROUP_CONTEXT,
- R_02800C_DB_RENDER_OVERRIDE,
- S_02800C_NOOP_CULL_DISABLE(1),
- S_02800C_NOOP_CULL_DISABLE(1));
- }
-
- if ((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) {
- /* need to flush */
- r600_context_flush(ctx);
- }
- /* at that point everythings is flushed and ctx->pm4_cdwords = 0 */
- if ((ctx->pm4_dirty_cdwords + ndwords) > ctx->pm4_ndwords) {
- R600_ERR("context is too big to be scheduled\n");
- return;
- }
-
- /* enough room to copy packet */
- r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_CONFIG]);
- r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_CONTEXT]);
- r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_RESOURCE]);
- r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_SAMPLER]);
- r600_context_group_emit_dirty(ctx, &ctx->groups[EVERGREEN_GROUP_SAMPLER_BORDER]);
-
- /* draw packet */
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0);
- ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_index_type;
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NUM_INSTANCES, 0);
- ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_instances;
- if (draw->indices) {
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX, 3);
- ctx->pm4[ctx->pm4_cdwords++] = draw->indices_bo_offset;
- ctx->pm4[ctx->pm4_cdwords++] = 0;
- ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices;
- ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator;
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
- ctx->pm4[ctx->pm4_cdwords++] = 0;
- r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(draw->indices->pb));
- } else {
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1);
- ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices;
- ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator;
- }
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0);
- ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT;
-
- /* flush color buffer */
- for (int i = 0; i < 8; i++) {
- if (cb[i]) {
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3);
- ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) |
- S_0085F0_CB_ACTION_ENA(1);
- ctx->pm4[ctx->pm4_cdwords++] = (cb[i]->size + 255) >> 8;
- ctx->pm4[ctx->pm4_cdwords++] = 0x00000000;
- ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A;
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
- ctx->pm4[ctx->pm4_cdwords++] = 0;
- r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], cb[i]);
- }
- }
-
- /* all dirty state have been scheduled in current cs */
- ctx->pm4_dirty_cdwords = 0;
-}
-
-static inline void evergreen_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
-{
- struct r600_group_block *block;
- unsigned id;
-
- offset -= ctx->groups[EVERGREEN_GROUP_RESOURCE].start_offset;
- id = ctx->groups[EVERGREEN_GROUP_RESOURCE].offset_block_id[offset >> 2];
- block = &ctx->groups[EVERGREEN_GROUP_RESOURCE].blocks[id];
- block->reg[0] = state->regs[0].value;
- block->reg[1] = state->regs[1].value;
- block->reg[2] = state->regs[2].value;
- block->reg[3] = state->regs[3].value;
- block->reg[4] = state->regs[4].value;
- block->reg[5] = state->regs[5].value;
- block->reg[6] = state->regs[6].value;
- block->reg[7] = state->regs[7].value;
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
- radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
- if (state->regs[0].bo) {
- /* VERTEX RESOURCE, we preted there is 2 bo to relocate so
- * we have single case btw VERTEX & TEXTURE resource
- */
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo);
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo);
- } else {
- /* TEXTURE RESOURCE */
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo);
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo);
- }
- block->status |= R600_BLOCK_STATUS_ENABLED;
- block->status |= R600_BLOCK_STATUS_DIRTY;
- ctx->pm4_dirty_cdwords += block->pm4_ndwords;
-}
-
-void evergreen_ps_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
-{
- unsigned offset = R_030000_RESOURCE0_WORD0 + 0x20 * rid;
-
- evergreen_resource_set(ctx, state, offset);
-}
-
-void evergreen_vs_resource_set(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
-{
- unsigned offset = R_030000_RESOURCE0_WORD0 + 0x1600 + 0x20 * rid;
-
- evergreen_resource_set(ctx, state, offset);
-}
+++ /dev/null
-import os
-import re
-
-def main():
- fileIN = open('eg_states.h', 'r')
- line = fileIN.readline()
- next_is_reg = False
- count = 0
-
- print "/* This file is autogenerated from eg_states.h - do not edit directly */"
- print "/* autogenerating script is gen_eg_states.py */"
- print ""
- while line:
- if line[0:2] == "};":
- if next_is_reg == True:
- print "#define " + name + "_SIZE\t\t", count
- print "#define " + name + "_PM4 128\t\t"
- next_is_reg = False
- count = 0
- print ""
-
- if line[0:6] == "static":
- name = line.rstrip("\n")
- cline = name.split()
- name = cline[4].split('[')
- name = name[0].replace("_names", "")
- print "/* " + name + " */"
- next_is_reg = True
- elif next_is_reg == True:
- reg = line.split();
- reg = reg[3].replace("},", "")
- reg = reg.replace("\"", "")
- print "#define " + name + "__" + reg + "\t\t", count
- count = count + 1
-
- line = fileIN.readline()
-
-if __name__ == "__main__":
- main()
+++ /dev/null
-import os
-import re
-
-def main():
- fileIN = open('r600_states.h', 'r')
- line = fileIN.readline()
- next_is_reg = False
- count = 0
-
- print "/* This file is autogenerated from r600_states.h - do not edit directly */"
- print "/* autogenerating script is gen_r600_states.py */"
- print ""
- while line:
- if line[0:2] == "};":
- if next_is_reg == True:
- print "#define " + name + "_SIZE\t\t", count
- print "#define " + name + "_PM4 128\t\t"
- next_is_reg = False
- count = 0
- print ""
-
- if line[0:6] == "static":
- name = line.rstrip("\n")
- cline = name.split()
- name = cline[4].split('[')
- name = name[0].replace("_names", "")
- print "/* " + name + " */"
- next_is_reg = True
- elif next_is_reg == True:
- reg = line.split();
- reg = reg[3].replace("},", "")
- reg = reg.replace("\"", "")
- print "#define " + name + "__" + reg + "\t\t", count
- count = count + 1
-
- line = fileIN.readline()
-
-if __name__ == "__main__":
- main()
*/
#include "xf86drm.h"
#include "radeon_drm.h"
+#include "pipe/p_compiler.h"
+#include "util/u_inlines.h"
+#include <pipebuffer/pb_bufmgr.h>
#include "r600_priv.h"
enum radeon_family r600_get_family(struct radeon *r600)
return radeon->chip_class;
}
+struct r600_tiling_info *r600_get_tiling_info(struct radeon *radeon)
+{
+ return &radeon->tiling_info;
+}
+
static int r600_get_device(struct radeon *r600)
{
struct drm_radeon_info info;
--- /dev/null
+/*
+ * Copyright 2010 Dave Airlie
+ *
+ * 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.
+ *
+ * Authors:
+ * Dave Airlie
+ */
+#include <pipe/p_compiler.h>
+#include <pipe/p_screen.h>
+#include <pipebuffer/pb_bufmgr.h>
+#include "radeon_drm.h"
+#include "r600_priv.h"
+#include "r600d.h"
+
+struct r600_bo *r600_bo(struct radeon *radeon,
+ unsigned size, unsigned alignment, unsigned usage)
+{
+ struct r600_bo *ws_bo = calloc(1, sizeof(struct r600_bo));
+ struct pb_desc desc;
+ struct pb_manager *man;
+
+ desc.alignment = alignment;
+ desc.usage = usage;
+ ws_bo->size = size;
+
+ if (usage & (PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER))
+ man = radeon->cman;
+ else
+ man = radeon->kman;
+
+ ws_bo->pb = man->create_buffer(man, size, &desc);
+ if (ws_bo->pb == NULL) {
+ free(ws_bo);
+ return NULL;
+ }
+
+ pipe_reference_init(&ws_bo->reference, 1);
+ return ws_bo;
+}
+
+struct r600_bo *r600_bo_handle(struct radeon *radeon,
+ unsigned handle, unsigned *array_mode)
+{
+ struct r600_bo *ws_bo = calloc(1, sizeof(struct r600_bo));
+ struct radeon_bo *bo;
+
+ ws_bo->pb = radeon_bo_pb_create_buffer_from_handle(radeon->kman, handle);
+ if (!ws_bo->pb) {
+ free(ws_bo);
+ return NULL;
+ }
+ bo = radeon_bo_pb_get_bo(ws_bo->pb);
+ ws_bo->size = bo->size;
+ pipe_reference_init(&ws_bo->reference, 1);
+
+ radeon_bo_get_tiling_flags(radeon, bo, &ws_bo->tiling_flags,
+ &ws_bo->kernel_pitch);
+ if (array_mode) {
+ if (ws_bo->tiling_flags) {
+ if (ws_bo->tiling_flags & RADEON_TILING_MICRO)
+ *array_mode = V_0280A0_ARRAY_1D_TILED_THIN1;
+ if ((ws_bo->tiling_flags & (RADEON_TILING_MICRO | RADEON_TILING_MACRO)) ==
+ (RADEON_TILING_MICRO | RADEON_TILING_MACRO))
+ *array_mode = V_0280A0_ARRAY_2D_TILED_THIN1;
+ } else {
+ *array_mode = 0;
+ }
+ }
+ return ws_bo;
+}
+
+void *r600_bo_map(struct radeon *radeon, struct r600_bo *bo, unsigned usage, void *ctx)
+{
+ return pb_map(bo->pb, usage, ctx);
+}
+
+void r600_bo_unmap(struct radeon *radeon, struct r600_bo *bo)
+{
+ pb_unmap(bo->pb);
+}
+
+static void r600_bo_destroy(struct radeon *radeon, struct r600_bo *bo)
+{
+ if (bo->pb)
+ pb_reference(&bo->pb, NULL);
+ free(bo);
+}
+
+void r600_bo_reference(struct radeon *radeon, struct r600_bo **dst,
+ struct r600_bo *src)
+{
+ struct r600_bo *old = *dst;
+
+ if (pipe_reference(&(*dst)->reference, &src->reference)) {
+ r600_bo_destroy(radeon, old);
+ }
+ *dst = src;
+}
+
+unsigned r600_bo_get_handle(struct r600_bo *pb_bo)
+{
+ struct radeon_bo *bo;
+
+ bo = radeon_bo_pb_get_bo(pb_bo->pb);
+ if (!bo)
+ return 0;
+
+ return bo->handle;
+}
+
+unsigned r600_bo_get_size(struct r600_bo *pb_bo)
+{
+ struct radeon_bo *bo;
+
+ bo = radeon_bo_pb_get_bo(pb_bo->pb);
+ if (!bo)
+ return 0;
+
+ return bo->size;
+}
* Corbin Simpson <MostAwesomeDude@gmail.com>
* Joakim Sindholt <opensource@zhasha.com>
*/
+#include <stdio.h>
+#include <errno.h>
#include <sys/ioctl.h>
#include "util/u_inlines.h"
#include "util/u_debug.h"
-#include "radeon_priv.h"
+#include <pipebuffer/pb_bufmgr.h>
+#include "r600.h"
+#include "r600_priv.h"
#include "r600_drm_public.h"
+#include "xf86drm.h"
+#include "radeon_drm.h"
+
+#ifndef RADEON_INFO_TILING_CONFIG
+#define RADEON_INFO_TILING_CONFIG 0x6
+#endif
+static int radeon_get_device(struct radeon *radeon)
+{
+ struct drm_radeon_info info;
+ int r;
+
+ radeon->device = 0;
+ info.request = RADEON_INFO_DEVICE_ID;
+ info.value = (uintptr_t)&radeon->device;
+ r = drmCommandWriteRead(radeon->fd, DRM_RADEON_INFO, &info,
+ sizeof(struct drm_radeon_info));
+ return r;
+}
+
+static int radeon_drm_get_tiling(struct radeon *radeon)
+{
+ struct drm_radeon_info info;
+ int r;
+ uint32_t tiling_config;
+
+ info.request = RADEON_INFO_TILING_CONFIG;
+ info.value = (uintptr_t)&tiling_config;
+ r = drmCommandWriteRead(radeon->fd, DRM_RADEON_INFO, &info,
+ sizeof(struct drm_radeon_info));
+
+ if (r)
+ return r;
+
+ switch ((tiling_config & 0xe) >> 1) {
+ case 0:
+ radeon->tiling_info.num_channels = 1;
+ break;
+ case 1:
+ radeon->tiling_info.num_channels = 2;
+ break;
+ case 2:
+ radeon->tiling_info.num_channels = 4;
+ break;
+ case 3:
+ radeon->tiling_info.num_channels = 8;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ switch ((tiling_config & 0x30) >> 4) {
+ case 0:
+ radeon->tiling_info.num_banks = 4;
+ break;
+ case 1:
+ radeon->tiling_info.num_banks = 8;
+ break;
+ default:
+ return -EINVAL;
+
+ }
+ switch ((tiling_config & 0xc0) >> 6) {
+ case 0:
+ radeon->tiling_info.group_bytes = 256;
+ break;
+ case 1:
+ radeon->tiling_info.group_bytes = 512;
+ break;
+ default:
+ return -EINVAL;
+ }
+ return 0;
+}
+
+struct radeon *radeon_new(int fd, unsigned device)
+{
+ struct radeon *radeon;
+ int r;
+
+ radeon = calloc(1, sizeof(*radeon));
+ if (radeon == NULL) {
+ return NULL;
+ }
+ radeon->fd = fd;
+ radeon->device = device;
+ radeon->refcount = 1;
+ if (fd >= 0) {
+ r = radeon_get_device(radeon);
+ if (r) {
+ fprintf(stderr, "Failed to get device id\n");
+ return radeon_decref(radeon);
+ }
+ }
+ radeon->family = radeon_family_from_device(radeon->device);
+ if (radeon->family == CHIP_UNKNOWN) {
+ fprintf(stderr, "Unknown chipset 0x%04X\n", radeon->device);
+ return radeon_decref(radeon);
+ }
+ switch (radeon->family) {
+ case CHIP_R600:
+ case CHIP_RV610:
+ case CHIP_RV630:
+ case CHIP_RV670:
+ case CHIP_RV620:
+ case CHIP_RV635:
+ case CHIP_RS780:
+ case CHIP_RS880:
+ case CHIP_RV770:
+ case CHIP_RV730:
+ case CHIP_RV710:
+ case CHIP_RV740:
+ case CHIP_CEDAR:
+ case CHIP_REDWOOD:
+ case CHIP_JUNIPER:
+ case CHIP_CYPRESS:
+ case CHIP_HEMLOCK:
+ break;
+ case CHIP_R100:
+ case CHIP_RV100:
+ case CHIP_RS100:
+ case CHIP_RV200:
+ case CHIP_RS200:
+ case CHIP_R200:
+ case CHIP_RV250:
+ case CHIP_RS300:
+ case CHIP_RV280:
+ case CHIP_R300:
+ case CHIP_R350:
+ case CHIP_RV350:
+ case CHIP_RV380:
+ case CHIP_R420:
+ case CHIP_R423:
+ case CHIP_RV410:
+ case CHIP_RS400:
+ case CHIP_RS480:
+ case CHIP_RS600:
+ case CHIP_RS690:
+ case CHIP_RS740:
+ case CHIP_RV515:
+ case CHIP_R520:
+ case CHIP_RV530:
+ case CHIP_RV560:
+ case CHIP_RV570:
+ case CHIP_R580:
+ default:
+ fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n",
+ __func__, radeon->device);
+ break;
+ }
+
+ /* setup class */
+ switch (radeon->family) {
+ case CHIP_R600:
+ case CHIP_RV610:
+ case CHIP_RV630:
+ case CHIP_RV670:
+ case CHIP_RV620:
+ case CHIP_RV635:
+ case CHIP_RS780:
+ case CHIP_RS880:
+ radeon->chip_class = R600;
+ break;
+ case CHIP_RV770:
+ case CHIP_RV730:
+ case CHIP_RV710:
+ case CHIP_RV740:
+ radeon->chip_class = R700;
+ break;
+ case CHIP_CEDAR:
+ case CHIP_REDWOOD:
+ case CHIP_JUNIPER:
+ case CHIP_CYPRESS:
+ case CHIP_HEMLOCK:
+ radeon->chip_class = EVERGREEN;
+ break;
+ default:
+ fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n",
+ __func__, radeon->device);
+ break;
+ }
+
+ if (radeon->chip_class == R600 || radeon->chip_class == R700) {
+ if (radeon_drm_get_tiling(radeon))
+ return NULL;
+ }
+ radeon->kman = radeon_bo_pbmgr_create(radeon);
+ if (!radeon->kman)
+ return NULL;
+ radeon->cman = pb_cache_manager_create(radeon->kman, 100000);
+ if (!radeon->cman)
+ return NULL;
+ return radeon;
+}
struct radeon *r600_drm_winsys_create(int drmfd)
{
return radeon_new(drmfd, 0);
}
+struct radeon *radeon_decref(struct radeon *radeon)
+{
+ if (radeon == NULL)
+ return NULL;
+ if (--radeon->refcount > 0) {
+ return NULL;
+ }
+
+ if (radeon->cman)
+ radeon->cman->destroy(radeon->cman);
+
+ if (radeon->kman)
+ radeon->kman->destroy(radeon->kman);
+
+ if (radeon->fd >= 0)
+ drmClose(radeon->fd);
+
+ free(radeon);
+ return NULL;
+}
-
+/*
+ * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
+ *
+ * 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.
+ *
+ * Authors:
+ * Jerome Glisse
+ */
#ifndef R600_DRM_PUBLIC_H
#define R600_DRM_PUBLIC_H
--- /dev/null
+/*
+ * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
+ *
+ * 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.
+ *
+ * Authors:
+ * Jerome Glisse
+ */
+#include <errno.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "xf86drm.h"
+#include "r600.h"
+#include "r600d.h"
+#include "radeon_drm.h"
+#include "bof.h"
+#include "pipe/p_compiler.h"
+#include "util/u_inlines.h"
+#include "util/u_memory.h"
+#include <pipebuffer/pb_bufmgr.h>
+#include "r600_priv.h"
+
+#define GROUP_FORCE_NEW_BLOCK 0
+
+int r600_context_init_fence(struct r600_context *ctx)
+{
+ ctx->fence = 1;
+ ctx->fence_bo = r600_bo(ctx->radeon, 4096, 0, 0);
+ if (ctx->fence_bo == NULL) {
+ return -ENOMEM;
+ }
+ ctx->cfence = r600_bo_map(ctx->radeon, ctx->fence_bo, PB_USAGE_UNSYNCHRONIZED, NULL);
+ *ctx->cfence = 0;
+ LIST_INITHEAD(&ctx->fenced_bo);
+ return 0;
+}
+
+static void INLINE r600_context_update_fenced_list(struct r600_context *ctx)
+{
+ for (int i = 0; i < ctx->creloc; i++) {
+ if (!LIST_IS_EMPTY(&ctx->bo[i]->fencedlist))
+ LIST_DELINIT(&ctx->bo[i]->fencedlist);
+ LIST_ADDTAIL(&ctx->bo[i]->fencedlist, &ctx->fenced_bo);
+ ctx->bo[i]->fence = ctx->fence;
+ ctx->bo[i]->ctx = ctx;
+ }
+}
+
+static void INLINE r600_context_fence_wraparound(struct r600_context *ctx, unsigned fence)
+{
+ struct radeon_bo *bo = NULL;
+ struct radeon_bo *tmp;
+
+ LIST_FOR_EACH_ENTRY_SAFE(bo, tmp, &ctx->fenced_bo, fencedlist) {
+ if (bo->fence <= *ctx->cfence) {
+ LIST_DELINIT(&bo->fencedlist);
+ bo->fence = 0;
+ } else {
+ bo->fence = fence;
+ }
+ }
+}
+
+int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg)
+{
+ struct r600_block *block;
+ struct r600_range *range;
+ int offset;
+
+ for (unsigned i = 0, n = 0; i < nreg; i += n) {
+ u32 j;
+
+ /* ignore new block balise */
+ if (reg[i].offset == GROUP_FORCE_NEW_BLOCK) {
+ n = 1;
+ continue;
+ }
+
+ /* register that need relocation are in their own group */
+ /* find number of consecutive registers */
+ n = 0;
+ offset = reg[i].offset;
+ while (reg[i + n].offset == offset) {
+ n++;
+ offset += 4;
+ if ((n + i) >= nreg)
+ break;
+ if (n >= (R600_BLOCK_MAX_REG - 2))
+ break;
+ }
+
+ /* allocate new block */
+ block = calloc(1, sizeof(struct r600_block));
+ if (block == NULL) {
+ return -ENOMEM;
+ }
+ ctx->nblocks++;
+ for (int j = 0; j < n; j++) {
+ range = &ctx->range[CTX_RANGE_ID(ctx, reg[i + j].offset)];
+ range->blocks[CTX_BLOCK_ID(ctx, reg[i + j].offset)] = block;
+ }
+
+ /* initialize block */
+ block->start_offset = reg[i].offset;
+ block->pm4[block->pm4_ndwords++] = PKT3(reg[i].opcode, n);
+ block->pm4[block->pm4_ndwords++] = (block->start_offset - reg[i].offset_base) >> 2;
+ block->reg = &block->pm4[block->pm4_ndwords];
+ block->pm4_ndwords += n;
+ block->nreg = n;
+ LIST_INITHEAD(&block->list);
+
+ for (j = 0; j < n; j++) {
+ if (reg[i+j].need_bo) {
+ block->nbo++;
+ assert(block->nbo < R600_BLOCK_MAX_BO);
+ block->pm4_bo_index[j] = block->nbo;
+ block->pm4[block->pm4_ndwords++] = PKT3(PKT3_NOP, 0);
+ block->pm4[block->pm4_ndwords++] = 0x00000000;
+ block->reloc[block->nbo].flush_flags = reg[i+j].flush_flags;
+ block->reloc[block->nbo].flush_mask = reg[i+j].flush_mask;
+ block->reloc[block->nbo].bo_pm4_index = block->pm4_ndwords - 1;
+ }
+ }
+ for (j = 0; j < n; j++) {
+ if (reg[i+j].flush_flags) {
+ block->pm4_flush_ndwords += 7;
+ }
+ }
+ /* check that we stay in limit */
+ assert(block->pm4_ndwords < R600_BLOCK_MAX_REG);
+ }
+ return 0;
+}
+
+/* R600/R700 configuration */
+static const struct r600_reg r600_config_reg_list[] = {
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008958_VGT_PRIMITIVE_TYPE, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C00_SQ_CONFIG, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C04_SQ_GPR_RESOURCE_MGMT_1, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C08_SQ_GPR_RESOURCE_MGMT_2, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C0C_SQ_THREAD_RESOURCE_MGMT, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C10_SQ_STACK_RESOURCE_MGMT_1, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008C14_SQ_STACK_RESOURCE_MGMT_2, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009508_TA_CNTL_AUX, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009714_VC_ENHANCE, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009830_DB_DEBUG, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_009838_DB_WATERMARKS, 0, 0, 0},
+};
+
+static const struct r600_reg r600_ctl_const_list[] = {
+ {PKT3_SET_CTL_CONST, R600_CTL_CONST_OFFSET, R_03CFF0_SQ_VTX_BASE_VTX_LOC, 0, 0, 0},
+ {PKT3_SET_CTL_CONST, R600_CTL_CONST_OFFSET, R_03CFF4_SQ_VTX_START_INST_LOC, 0, 0, 0},
+};
+
+static const struct r600_reg r600_context_reg_list[] = {
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028350_SX_MISC, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C8_SPI_THREAD_GROUPING, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288A8_SQ_ESGS_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288AC_SQ_GSVS_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B0_SQ_ESTMP_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B4_SQ_GSTMP_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288B8_SQ_VSTMP_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288BC_SQ_PSTMP_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C0_SQ_FBUF_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C4_SQ_REDUC_RING_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288C8_SQ_GS_VERT_ITEMSIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A10_VGT_OUTPUT_PATH_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A14_VGT_HOS_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A18_VGT_HOS_MAX_TESS_LEVEL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A20_VGT_HOS_REUSE_DEPTH, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A24_VGT_GROUP_PRIM_TYPE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A28_VGT_GROUP_FIRST_DECR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A2C_VGT_GROUP_DECR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A30_VGT_GROUP_VECT_0_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A34_VGT_GROUP_VECT_1_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A40_VGT_GS_MODE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A4C_PA_SC_MODE_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB0_VGT_STRMOUT_EN, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB4_VGT_REUSE_OFF, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AB8_VGT_VTX_CNT_EN, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028B20_VGT_STRMOUT_BUFFER_EN, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028028_DB_STENCIL_CLEAR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02802C_DB_DEPTH_CLEAR, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028040_CB_COLOR0_BASE, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A0_CB_COLOR0_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028060_CB_COLOR0_SIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028080_CB_COLOR0_VIEW, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E0_CB_COLOR0_FRAG, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C0_CB_COLOR0_TILE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028100_CB_COLOR0_MASK, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028044_CB_COLOR1_BASE, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A4_CB_COLOR1_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028064_CB_COLOR1_SIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028084_CB_COLOR1_VIEW, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E4_CB_COLOR1_FRAG, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C4_CB_COLOR1_TILE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028104_CB_COLOR1_MASK, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028048_CB_COLOR2_BASE, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A8_CB_COLOR2_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028068_CB_COLOR2_SIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028088_CB_COLOR2_VIEW, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280E8_CB_COLOR2_FRAG, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280C8_CB_COLOR2_TILE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028108_CB_COLOR2_MASK, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02804C_CB_COLOR3_BASE, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280AC_CB_COLOR3_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02806C_CB_COLOR3_SIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02808C_CB_COLOR3_VIEW, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280EC_CB_COLOR3_FRAG, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280CC_CB_COLOR3_TILE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02810C_CB_COLOR3_MASK, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028050_CB_COLOR4_BASE, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B0_CB_COLOR4_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028070_CB_COLOR4_SIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028090_CB_COLOR4_VIEW, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F0_CB_COLOR4_FRAG, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D0_CB_COLOR4_TILE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028110_CB_COLOR4_MASK, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028054_CB_COLOR5_BASE, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B4_CB_COLOR5_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028074_CB_COLOR5_SIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028094_CB_COLOR5_VIEW, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F4_CB_COLOR5_FRAG, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D4_CB_COLOR5_TILE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028114_CB_COLOR5_MASK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028058_CB_COLOR6_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B8_CB_COLOR6_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028078_CB_COLOR6_SIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028098_CB_COLOR6_VIEW, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280F8_CB_COLOR6_FRAG, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D8_CB_COLOR6_TILE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028118_CB_COLOR6_MASK, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02805C_CB_COLOR7_BASE, 1, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280BC_CB_COLOR7_INFO, 1, 0, 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02807C_CB_COLOR7_SIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02809C_CB_COLOR7_VIEW, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280FC_CB_COLOR7_FRAG, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280DC_CB_COLOR7_TILE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02811C_CB_COLOR7_MASK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028120_CB_CLEAR_RED, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028124_CB_CLEAR_GREEN, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028128_CB_CLEAR_BLUE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02812C_CB_CLEAR_ALPHA, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028140_ALU_CONST_BUFFER_SIZE_PS_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028180_ALU_CONST_BUFFER_SIZE_VS_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028940_ALU_CONST_CACHE_PS_0, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028980_ALU_CONST_CACHE_VS_0, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02823C_CB_SHADER_MASK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028238_CB_TARGET_MASK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028410_SX_ALPHA_TEST_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028414_CB_BLEND_RED, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028418_CB_BLEND_GREEN, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02841C_CB_BLEND_BLUE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028420_CB_BLEND_ALPHA, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028424_CB_FOG_RED, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028428_CB_FOG_GREEN, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02842C_CB_FOG_BLUE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028430_DB_STENCILREFMASK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028434_DB_STENCILREFMASK_BF, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028438_SX_ALPHA_REF, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286DC_SPI_FOG_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286E0_SPI_FOG_FUNC_SCALE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286E4_SPI_FOG_FUNC_BIAS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028780_CB_BLEND0_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028784_CB_BLEND1_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028788_CB_BLEND2_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02878C_CB_BLEND3_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028790_CB_BLEND4_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028794_CB_BLEND5_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028798_CB_BLEND6_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02879C_CB_BLEND7_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0287A0_CB_SHADER_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028800_DB_DEPTH_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028804_CB_BLEND_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028808_CB_COLOR_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02880C_DB_SHADER_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C04_PA_SC_AA_CONFIG, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C30_CB_CLRCMP_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C34_CB_CLRCMP_SRC, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C38_CB_CLRCMP_DST, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C3C_CB_CLRCMP_MSK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C48_PA_SC_AA_MASK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D2C_DB_SRESULTS_COMPARE_STATE1, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D44_DB_ALPHA_TO_MASK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02800C_DB_DEPTH_BASE, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028000_DB_DEPTH_SIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028004_DB_DEPTH_VIEW, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028010_DB_DEPTH_INFO, 1, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D0C_DB_RENDER_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D10_DB_RENDER_OVERRIDE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D24_DB_HTILE_SURFACE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D30_DB_PRELOAD_CONTROL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028D34_DB_PREFETCH_LIMIT, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028030_PA_SC_SCREEN_SCISSOR_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028034_PA_SC_SCREEN_SCISSOR_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028200_PA_SC_WINDOW_OFFSET, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028204_PA_SC_WINDOW_SCISSOR_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028208_PA_SC_WINDOW_SCISSOR_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02820C_PA_SC_CLIPRECT_RULE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028210_PA_SC_CLIPRECT_0_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028214_PA_SC_CLIPRECT_0_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028218_PA_SC_CLIPRECT_1_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02821C_PA_SC_CLIPRECT_1_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028220_PA_SC_CLIPRECT_2_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028224_PA_SC_CLIPRECT_2_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028228_PA_SC_CLIPRECT_3_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02822C_PA_SC_CLIPRECT_3_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028230_PA_SC_EDGERULE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028240_PA_SC_GENERIC_SCISSOR_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028244_PA_SC_GENERIC_SCISSOR_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0282D0_PA_SC_VPORT_ZMIN_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0282D4_PA_SC_VPORT_ZMAX_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02843C_PA_CL_VPORT_XSCALE_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028440_PA_CL_VPORT_XOFFSET_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028444_PA_CL_VPORT_YSCALE_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028448_PA_CL_VPORT_YOFFSET_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02844C_PA_CL_VPORT_ZSCALE_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028450_PA_CL_VPORT_ZOFFSET_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D4_SPI_INTERP_CONTROL_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028810_PA_CL_CLIP_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028814_PA_SU_SC_MODE_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028818_PA_CL_VTE_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02881C_PA_CL_VS_OUT_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028820_PA_CL_NANINF_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A00_PA_SU_POINT_SIZE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A04_PA_SU_POINT_MINMAX, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A08_PA_SU_LINE_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A0C_PA_SC_LINE_STIPPLE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A48_PA_SC_MPASS_PS_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C00_PA_SC_LINE_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C10_PA_CL_GB_VERT_DISC_ADJ, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028C18_PA_CL_GB_HORZ_DISC_ADJ, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028DFC_PA_SU_POLY_OFFSET_CLAMP, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E20_PA_CL_UCP0_X, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E24_PA_CL_UCP0_Y, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E28_PA_CL_UCP0_Z, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E2C_PA_CL_UCP0_W, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E30_PA_CL_UCP1_X, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E34_PA_CL_UCP1_Y, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E38_PA_CL_UCP1_Z, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E3C_PA_CL_UCP1_W, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E40_PA_CL_UCP2_X, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E44_PA_CL_UCP2_Y, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E48_PA_CL_UCP2_Z, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E4C_PA_CL_UCP2_W, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E50_PA_CL_UCP3_X, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E54_PA_CL_UCP3_Y, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E58_PA_CL_UCP3_Z, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E5C_PA_CL_UCP3_W, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E60_PA_CL_UCP4_X, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E64_PA_CL_UCP4_Y, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E68_PA_CL_UCP4_Z, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E6C_PA_CL_UCP4_W, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E70_PA_CL_UCP5_X, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E74_PA_CL_UCP5_Y, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E78_PA_CL_UCP5_Z, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028E7C_PA_CL_UCP5_W, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028380_SQ_VTX_SEMANTIC_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028384_SQ_VTX_SEMANTIC_1, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028388_SQ_VTX_SEMANTIC_2, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02838C_SQ_VTX_SEMANTIC_3, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028390_SQ_VTX_SEMANTIC_4, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028394_SQ_VTX_SEMANTIC_5, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028398_SQ_VTX_SEMANTIC_6, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02839C_SQ_VTX_SEMANTIC_7, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A0_SQ_VTX_SEMANTIC_8, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A4_SQ_VTX_SEMANTIC_9, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283A8_SQ_VTX_SEMANTIC_10, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283AC_SQ_VTX_SEMANTIC_11, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B0_SQ_VTX_SEMANTIC_12, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B4_SQ_VTX_SEMANTIC_13, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283B8_SQ_VTX_SEMANTIC_14, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283BC_SQ_VTX_SEMANTIC_15, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C0_SQ_VTX_SEMANTIC_16, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C4_SQ_VTX_SEMANTIC_17, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283C8_SQ_VTX_SEMANTIC_18, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283CC_SQ_VTX_SEMANTIC_19, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D0_SQ_VTX_SEMANTIC_20, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D4_SQ_VTX_SEMANTIC_21, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283D8_SQ_VTX_SEMANTIC_22, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283DC_SQ_VTX_SEMANTIC_23, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E0_SQ_VTX_SEMANTIC_24, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E4_SQ_VTX_SEMANTIC_25, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283E8_SQ_VTX_SEMANTIC_26, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283EC_SQ_VTX_SEMANTIC_27, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F0_SQ_VTX_SEMANTIC_28, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F4_SQ_VTX_SEMANTIC_29, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283F8_SQ_VTX_SEMANTIC_30, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0283FC_SQ_VTX_SEMANTIC_31, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028614_SPI_VS_OUT_ID_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028618_SPI_VS_OUT_ID_1, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02861C_SPI_VS_OUT_ID_2, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028620_SPI_VS_OUT_ID_3, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028624_SPI_VS_OUT_ID_4, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028628_SPI_VS_OUT_ID_5, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02862C_SPI_VS_OUT_ID_6, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028630_SPI_VS_OUT_ID_7, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028634_SPI_VS_OUT_ID_8, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028638_SPI_VS_OUT_ID_9, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C4_SPI_VS_OUT_CONFIG, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028858_SQ_PGM_START_VS, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028868_SQ_PGM_RESOURCES_VS, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028894_SQ_PGM_START_FS, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288A4_SQ_PGM_RESOURCES_FS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288D0_SQ_PGM_CF_OFFSET_VS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288DC_SQ_PGM_CF_OFFSET_FS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028644_SPI_PS_INPUT_CNTL_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028648_SPI_PS_INPUT_CNTL_1, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02864C_SPI_PS_INPUT_CNTL_2, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028650_SPI_PS_INPUT_CNTL_3, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028654_SPI_PS_INPUT_CNTL_4, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028658_SPI_PS_INPUT_CNTL_5, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02865C_SPI_PS_INPUT_CNTL_6, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028660_SPI_PS_INPUT_CNTL_7, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028664_SPI_PS_INPUT_CNTL_8, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028668_SPI_PS_INPUT_CNTL_9, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02866C_SPI_PS_INPUT_CNTL_10, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028670_SPI_PS_INPUT_CNTL_11, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028674_SPI_PS_INPUT_CNTL_12, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028678_SPI_PS_INPUT_CNTL_13, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02867C_SPI_PS_INPUT_CNTL_14, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028680_SPI_PS_INPUT_CNTL_15, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028684_SPI_PS_INPUT_CNTL_16, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028688_SPI_PS_INPUT_CNTL_17, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02868C_SPI_PS_INPUT_CNTL_18, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028690_SPI_PS_INPUT_CNTL_19, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028694_SPI_PS_INPUT_CNTL_20, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028698_SPI_PS_INPUT_CNTL_21, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02869C_SPI_PS_INPUT_CNTL_22, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A0_SPI_PS_INPUT_CNTL_23, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A4_SPI_PS_INPUT_CNTL_24, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286A8_SPI_PS_INPUT_CNTL_25, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286AC_SPI_PS_INPUT_CNTL_26, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B0_SPI_PS_INPUT_CNTL_27, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B4_SPI_PS_INPUT_CNTL_28, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286B8_SPI_PS_INPUT_CNTL_29, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286BC_SPI_PS_INPUT_CNTL_30, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286C0_SPI_PS_INPUT_CNTL_31, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286CC_SPI_PS_IN_CONTROL_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D0_SPI_PS_IN_CONTROL_1, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0286D8_SPI_INPUT_Z, 0, 0, 0},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028840_SQ_PGM_START_PS, 1, S_0085F0_SH_ACTION_ENA(1), 0xFFFFFFFF},
+ {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028850_SQ_PGM_RESOURCES_PS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028854_SQ_PGM_EXPORTS_PS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0288CC_SQ_PGM_CF_OFFSET_PS, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028400_VGT_MAX_VTX_INDX, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028404_VGT_MIN_VTX_INDX, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028408_VGT_INDX_OFFSET, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A84_VGT_PRIMITIVEID_EN, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 0, 0, 0},
+ {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028AA4_VGT_INSTANCE_STEP_RATE_1, 0, 0, 0},
+};
+
+/* SHADER RESOURCE R600/R700 */
+static int r600_state_resource_init(struct r600_context *ctx, u32 offset)
+{
+ struct r600_reg r600_shader_resource[] = {
+ {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038000_RESOURCE0_WORD0, 0, 0, 0},
+ {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038004_RESOURCE0_WORD1, 0, 0, 0},
+ {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038008_RESOURCE0_WORD2, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+ {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_03800C_RESOURCE0_WORD3, 1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+ {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038010_RESOURCE0_WORD4, 0, 0, 0},
+ {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038014_RESOURCE0_WORD5, 0, 0, 0},
+ {PKT3_SET_RESOURCE, R600_RESOURCE_OFFSET, R_038018_RESOURCE0_WORD6, 0, 0, 0},
+ };
+ unsigned nreg = Elements(r600_shader_resource);
+
+ for (int i = 0; i < nreg; i++) {
+ r600_shader_resource[i].offset += offset;
+ }
+ return r600_context_add_block(ctx, r600_shader_resource, nreg);
+}
+
+/* SHADER SAMPLER R600/R700 */
+static int r600_state_sampler_init(struct r600_context *ctx, u32 offset)
+{
+ struct r600_reg r600_shader_sampler[] = {
+ {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C000_SQ_TEX_SAMPLER_WORD0_0, 0, 0, 0},
+ {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C004_SQ_TEX_SAMPLER_WORD1_0, 0, 0, 0},
+ {PKT3_SET_SAMPLER, R600_SAMPLER_OFFSET, R_03C008_SQ_TEX_SAMPLER_WORD2_0, 0, 0, 0},
+ };
+ unsigned nreg = Elements(r600_shader_sampler);
+
+ for (int i = 0; i < nreg; i++) {
+ r600_shader_sampler[i].offset += offset;
+ }
+ return r600_context_add_block(ctx, r600_shader_sampler, nreg);
+}
+
+/* SHADER SAMPLER BORDER R600/R700 */
+static int r600_state_sampler_border_init(struct r600_context *ctx, u32 offset)
+{
+ struct r600_reg r600_shader_sampler_border[] = {
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A400_TD_PS_SAMPLER0_BORDER_RED, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, 0, 0, 0},
+ {PKT3_SET_CONFIG_REG, R600_CONFIG_REG_OFFSET, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, 0, 0, 0},
+ };
+ unsigned nreg = Elements(r600_shader_sampler_border);
+
+ for (int i = 0; i < nreg; i++) {
+ r600_shader_sampler_border[i].offset += offset;
+ }
+ return r600_context_add_block(ctx, r600_shader_sampler_border, nreg);
+}
+
+static int r600_loop_const_init(struct r600_context *ctx, u32 offset)
+{
+ unsigned nreg = 32;
+ struct r600_reg r600_loop_consts[32];
+ int i;
+
+ for (i = 0; i < nreg; i++) {
+ r600_loop_consts[i].opcode = PKT3_SET_LOOP_CONST;
+ r600_loop_consts[i].offset_base = R600_LOOP_CONST_OFFSET;
+ r600_loop_consts[i].offset = R600_LOOP_CONST_OFFSET + ((offset + i) * 4);
+ r600_loop_consts[i].need_bo = 0;
+ r600_loop_consts[i].flush_flags = 0;
+ r600_loop_consts[i].flush_mask = 0;
+ }
+ return r600_context_add_block(ctx, r600_loop_consts, nreg);
+}
+
+/* initialize */
+void r600_context_fini(struct r600_context *ctx)
+{
+ struct r600_block *block;
+ struct r600_range *range;
+
+ for (int i = 0; i < 256; i++) {
+ for (int j = 0; j < (1 << ctx->hash_shift); j++) {
+ block = ctx->range[i].blocks[j];
+ if (block) {
+ for (int k = 0, offset = block->start_offset; k < block->nreg; k++, offset += 4) {
+ range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
+ range->blocks[CTX_BLOCK_ID(ctx, offset)] = NULL;
+ }
+ free(block);
+ }
+ }
+ free(ctx->range[i].blocks);
+ }
+ free(ctx->reloc);
+ free(ctx->pm4);
+ if (ctx->fence_bo) {
+ r600_bo_reference(ctx->radeon, &ctx->fence_bo, NULL);
+ }
+ memset(ctx, 0, sizeof(struct r600_context));
+}
+
+int r600_context_init(struct r600_context *ctx, struct radeon *radeon)
+{
+ int r;
+
+ memset(ctx, 0, sizeof(struct r600_context));
+ ctx->radeon = radeon;
+ LIST_INITHEAD(&ctx->query_list);
+
+ /* initialize hash */
+ ctx->hash_size = 19;
+ ctx->hash_shift = 11;
+ for (int i = 0; i < 256; i++) {
+ ctx->range[i].start_offset = i << ctx->hash_shift;
+ ctx->range[i].end_offset = ((i + 1) << ctx->hash_shift) - 1;
+ ctx->range[i].blocks = calloc(1 << ctx->hash_shift, sizeof(void*));
+ if (ctx->range[i].blocks == NULL) {
+ return -ENOMEM;
+ }
+ }
+
+ /* add blocks */
+ r = r600_context_add_block(ctx, r600_config_reg_list,
+ Elements(r600_config_reg_list));
+ if (r)
+ goto out_err;
+ r = r600_context_add_block(ctx, r600_context_reg_list,
+ Elements(r600_context_reg_list));
+ if (r)
+ goto out_err;
+ r = r600_context_add_block(ctx, r600_ctl_const_list,
+ Elements(r600_ctl_const_list));
+ if (r)
+ goto out_err;
+
+ /* PS SAMPLER BORDER */
+ for (int j = 0, offset = 0; j < 18; j++, offset += 0x10) {
+ r = r600_state_sampler_border_init(ctx, offset);
+ if (r)
+ goto out_err;
+ }
+
+ /* VS SAMPLER BORDER */
+ for (int j = 0, offset = 0x200; j < 18; j++, offset += 0x10) {
+ r = r600_state_sampler_border_init(ctx, offset);
+ if (r)
+ goto out_err;
+ }
+ /* PS SAMPLER */
+ for (int j = 0, offset = 0; j < 18; j++, offset += 0xC) {
+ r = r600_state_sampler_init(ctx, offset);
+ if (r)
+ goto out_err;
+ }
+ /* VS SAMPLER */
+ for (int j = 0, offset = 0xD8; j < 18; j++, offset += 0xC) {
+ r = r600_state_sampler_init(ctx, offset);
+ if (r)
+ goto out_err;
+ }
+ /* PS RESOURCE */
+ for (int j = 0, offset = 0; j < 160; j++, offset += 0x1C) {
+ r = r600_state_resource_init(ctx, offset);
+ if (r)
+ goto out_err;
+ }
+ /* VS RESOURCE */
+ for (int j = 0, offset = 0x1180; j < 160; j++, offset += 0x1C) {
+ r = r600_state_resource_init(ctx, offset);
+ if (r)
+ goto out_err;
+ }
+
+ /* PS loop const */
+ r600_loop_const_init(ctx, 0);
+ /* VS loop const */
+ r600_loop_const_init(ctx, 32);
+
+ /* setup block table */
+ ctx->blocks = calloc(ctx->nblocks, sizeof(void*));
+ for (int i = 0, c = 0; i < 256; i++) {
+ for (int j = 0, add; j < (1 << ctx->hash_shift); j++) {
+ if (ctx->range[i].blocks[j]) {
+ add = 1;
+ for (int k = 0; k < c; k++) {
+ if (ctx->blocks[k] == ctx->range[i].blocks[j]) {
+ add = 0;
+ break;
+ }
+ }
+ if (add) {
+ assert(c < ctx->nblocks);
+ ctx->blocks[c++] = ctx->range[i].blocks[j];
+ j += (ctx->range[i].blocks[j]->nreg << 2) - 1;
+ }
+ }
+ }
+ }
+
+ /* allocate cs variables */
+ ctx->nreloc = RADEON_CTX_MAX_PM4;
+ ctx->reloc = calloc(ctx->nreloc, sizeof(struct r600_reloc));
+ if (ctx->reloc == NULL) {
+ r = -ENOMEM;
+ goto out_err;
+ }
+ ctx->bo = calloc(ctx->nreloc, sizeof(void *));
+ if (ctx->bo == NULL) {
+ r = -ENOMEM;
+ goto out_err;
+ }
+ ctx->pm4_ndwords = RADEON_CTX_MAX_PM4;
+ ctx->pm4 = calloc(ctx->pm4_ndwords, 4);
+ if (ctx->pm4 == NULL) {
+ r = -ENOMEM;
+ goto out_err;
+ }
+ /* save 16dwords space for fence mecanism */
+ ctx->pm4_ndwords -= 16;
+
+ r = r600_context_init_fence(ctx);
+ if (r) {
+ goto out_err;
+ }
+
+ /* init dirty list */
+ LIST_INITHEAD(&ctx->dirty);
+ return 0;
+out_err:
+ r600_context_fini(ctx);
+ return r;
+}
+
+void r600_context_bo_flush(struct r600_context *ctx, unsigned flush_flags,
+ unsigned flush_mask, struct r600_bo *rbo)
+{
+ struct radeon_bo *bo;
+
+ bo = r600_bo_get_bo(rbo);
+ /* if bo has already been flush */
+ if (!(bo->last_flush ^ flush_flags)) {
+ bo->last_flush &= flush_mask;
+ return;
+ }
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3);
+ ctx->pm4[ctx->pm4_cdwords++] = flush_flags;
+ ctx->pm4[ctx->pm4_cdwords++] = (bo->size + 255) >> 8;
+ ctx->pm4[ctx->pm4_cdwords++] = 0x00000000;
+ ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A;
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
+ ctx->pm4[ctx->pm4_cdwords++] = bo->reloc_id;
+ bo->last_flush = (bo->last_flush | flush_flags) & flush_mask;
+}
+
+void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *rbo)
+{
+ struct radeon_bo *bo;
+
+ bo = r600_bo_get_bo(rbo);
+ assert(bo != NULL);
+ if (bo->reloc) {
+ *pm4 = bo->reloc_id;
+ return;
+ }
+ bo->reloc = &ctx->reloc[ctx->creloc];
+ bo->reloc_id = ctx->creloc * sizeof(struct r600_reloc) / 4;
+ ctx->reloc[ctx->creloc].handle = bo->handle;
+ ctx->reloc[ctx->creloc].read_domain = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM;
+ ctx->reloc[ctx->creloc].write_domain = RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM;
+ ctx->reloc[ctx->creloc].flags = 0;
+ radeon_bo_reference(ctx->radeon, &ctx->bo[ctx->creloc], bo);
+ ctx->creloc++;
+ /* set PKT3 to point to proper reloc */
+ *pm4 = bo->reloc_id;
+}
+
+void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_state *state)
+{
+ struct r600_range *range;
+ struct r600_block *block;
+
+ for (int i = 0; i < state->nregs; i++) {
+ unsigned id;
+
+ range = &ctx->range[CTX_RANGE_ID(ctx, state->regs[i].offset)];
+ block = range->blocks[CTX_BLOCK_ID(ctx, state->regs[i].offset)];
+ id = (state->regs[i].offset - block->start_offset) >> 2;
+ block->reg[id] &= ~state->regs[i].mask;
+ block->reg[id] |= state->regs[i].value;
+ if (block->pm4_bo_index[id]) {
+ /* find relocation */
+ id = block->pm4_bo_index[id];
+ r600_bo_reference(ctx->radeon, &block->reloc[id].bo, state->regs[i].bo);
+ }
+ if (!(block->status & R600_BLOCK_STATUS_DIRTY)) {
+ block->status |= R600_BLOCK_STATUS_ENABLED;
+ block->status |= R600_BLOCK_STATUS_DIRTY;
+ ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords;
+ LIST_ADDTAIL(&block->list,&ctx->dirty);
+ }
+ }
+}
+
+static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
+{
+ struct r600_range *range;
+ struct r600_block *block;
+
+ range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
+ block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
+ if (state == NULL) {
+ block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
+ r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
+ r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
+ LIST_DELINIT(&block->list);
+ return;
+ }
+ block->reg[0] = state->regs[0].value;
+ block->reg[1] = state->regs[1].value;
+ block->reg[2] = state->regs[2].value;
+ block->reg[3] = state->regs[3].value;
+ block->reg[4] = state->regs[4].value;
+ block->reg[5] = state->regs[5].value;
+ block->reg[6] = state->regs[6].value;
+ r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
+ r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
+ if (state->regs[0].bo) {
+ /* VERTEX RESOURCE, we preted there is 2 bo to relocate so
+ * we have single case btw VERTEX & TEXTURE resource
+ */
+ r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo);
+ r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo);
+ } else {
+ /* TEXTURE RESOURCE */
+ r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo);
+ r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo);
+ }
+ if (!(block->status & R600_BLOCK_STATUS_DIRTY)) {
+ block->status |= R600_BLOCK_STATUS_ENABLED;
+ block->status |= R600_BLOCK_STATUS_DIRTY;
+ ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords;
+ LIST_ADDTAIL(&block->list,&ctx->dirty);
+ }
+}
+
+void r600_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
+{
+ unsigned offset = R_038000_SQ_TEX_RESOURCE_WORD0_0 + 0x1C * rid;
+
+ r600_context_pipe_state_set_resource(ctx, state, offset);
+}
+
+void r600_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
+{
+ unsigned offset = R_038000_SQ_TEX_RESOURCE_WORD0_0 + 0x1180 + 0x1C * rid;
+
+ r600_context_pipe_state_set_resource(ctx, state, offset);
+}
+
+static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
+{
+ struct r600_range *range;
+ struct r600_block *block;
+
+ range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
+ block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
+ if (state == NULL) {
+ block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
+ LIST_DELINIT(&block->list);
+ return;
+ }
+ block->reg[0] = state->regs[0].value;
+ block->reg[1] = state->regs[1].value;
+ block->reg[2] = state->regs[2].value;
+ if (!(block->status & R600_BLOCK_STATUS_DIRTY)) {
+ block->status |= R600_BLOCK_STATUS_ENABLED;
+ block->status |= R600_BLOCK_STATUS_DIRTY;
+ ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords;
+ LIST_ADDTAIL(&block->list,&ctx->dirty);
+ }
+}
+
+static inline void r600_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
+{
+ struct r600_range *range;
+ struct r600_block *block;
+
+ range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
+ block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
+ if (state == NULL) {
+ block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
+ LIST_DELINIT(&block->list);
+ return;
+ }
+ if (state->nregs <= 3) {
+ return;
+ }
+ block->reg[0] = state->regs[3].value;
+ block->reg[1] = state->regs[4].value;
+ block->reg[2] = state->regs[5].value;
+ block->reg[3] = state->regs[6].value;
+ if (!(block->status & R600_BLOCK_STATUS_DIRTY)) {
+ block->status |= R600_BLOCK_STATUS_ENABLED;
+ block->status |= R600_BLOCK_STATUS_DIRTY;
+ ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords;
+ LIST_ADDTAIL(&block->list,&ctx->dirty);
+ }
+}
+
+void r600_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id)
+{
+ unsigned offset;
+
+ offset = 0x0003C000 + id * 0xc;
+ r600_context_pipe_state_set_sampler(ctx, state, offset);
+ offset = 0x0000A400 + id * 0x10;
+ r600_context_pipe_state_set_sampler_border(ctx, state, offset);
+}
+
+void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id)
+{
+ unsigned offset;
+
+ offset = 0x0003C0D8 + id * 0xc;
+ r600_context_pipe_state_set_sampler(ctx, state, offset);
+ offset = 0x0000A600 + id * 0x10;
+ r600_context_pipe_state_set_sampler_border(ctx, state, offset);
+}
+
+struct r600_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset)
+{
+ struct r600_range *range;
+ struct r600_block *block;
+ unsigned id;
+
+ range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
+ block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
+ offset -= block->start_offset;
+ id = block->pm4_bo_index[offset >> 2];
+ if (block->reloc[id].bo) {
+ return block->reloc[id].bo;
+ }
+ return NULL;
+}
+
+void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw)
+{
+ struct r600_bo *cb[8];
+ struct r600_bo *db;
+ unsigned ndwords = 9;
+ struct r600_block *dirty_block = NULL;
+ struct r600_block *next_block;
+
+ if (draw->indices) {
+ ndwords = 13;
+ /* make sure there is enough relocation space before scheduling draw */
+ if (ctx->creloc >= (ctx->nreloc - 1)) {
+ r600_context_flush(ctx);
+ }
+ }
+
+ /* find number of color buffer */
+ db = r600_context_reg_bo(ctx, R_02800C_DB_DEPTH_BASE);
+ cb[0] = r600_context_reg_bo(ctx, R_028040_CB_COLOR0_BASE);
+ cb[1] = r600_context_reg_bo(ctx, R_028044_CB_COLOR1_BASE);
+ cb[2] = r600_context_reg_bo(ctx, R_028048_CB_COLOR2_BASE);
+ cb[3] = r600_context_reg_bo(ctx, R_02804C_CB_COLOR3_BASE);
+ cb[4] = r600_context_reg_bo(ctx, R_028050_CB_COLOR4_BASE);
+ cb[5] = r600_context_reg_bo(ctx, R_028054_CB_COLOR5_BASE);
+ cb[6] = r600_context_reg_bo(ctx, R_028058_CB_COLOR6_BASE);
+ cb[7] = r600_context_reg_bo(ctx, R_02805C_CB_COLOR7_BASE);
+ for (int i = 0; i < 8; i++) {
+ if (cb[i]) {
+ ndwords += 7;
+ }
+ }
+ if (db)
+ ndwords += 7;
+
+ /* queries need some special values */
+ if (ctx->num_query_running) {
+ if (ctx->radeon->family >= CHIP_RV770) {
+ r600_context_reg(ctx,
+ R_028D0C_DB_RENDER_CONTROL,
+ S_028D0C_R700_PERFECT_ZPASS_COUNTS(1),
+ S_028D0C_R700_PERFECT_ZPASS_COUNTS(1));
+ }
+ r600_context_reg(ctx,
+ R_028D10_DB_RENDER_OVERRIDE,
+ S_028D10_NOOP_CULL_DISABLE(1),
+ S_028D10_NOOP_CULL_DISABLE(1));
+ }
+
+ if ((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) {
+ /* need to flush */
+ r600_context_flush(ctx);
+ }
+ /* at that point everythings is flushed and ctx->pm4_cdwords = 0 */
+ if ((ctx->pm4_dirty_cdwords + ndwords) > ctx->pm4_ndwords) {
+ R600_ERR("context is too big to be scheduled\n");
+ return;
+ }
+
+ /* enough room to copy packet */
+ LIST_FOR_EACH_ENTRY_SAFE(dirty_block, next_block, &ctx->dirty,list) {
+ r600_context_block_emit_dirty(ctx, dirty_block);
+ }
+
+ /* draw packet */
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0);
+ ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_index_type;
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NUM_INSTANCES, 0);
+ ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_instances;
+ if (draw->indices) {
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX, 3);
+ ctx->pm4[ctx->pm4_cdwords++] = draw->indices_bo_offset + r600_bo_offset(draw->indices);
+ ctx->pm4[ctx->pm4_cdwords++] = 0;
+ ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices;
+ ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator;
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
+ ctx->pm4[ctx->pm4_cdwords++] = 0;
+ r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], draw->indices);
+ } else {
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1);
+ ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices;
+ ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator;
+ }
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0);
+ ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT;
+
+ /* flush color buffer */
+ for (int i = 0; i < 8; i++) {
+ if (cb[i]) {
+ r600_context_bo_flush(ctx,
+ (S_0085F0_CB0_DEST_BASE_ENA(1) << i) |
+ S_0085F0_CB_ACTION_ENA(1),
+ 0, cb[i]);
+ }
+ }
+ if (db) {
+ r600_context_bo_flush(ctx, S_0085F0_DB_ACTION_ENA(1), 0, db);
+ }
+
+ /* all dirty state have been scheduled in current cs */
+ ctx->pm4_dirty_cdwords = 0;
+}
+
+void r600_context_flush(struct r600_context *ctx)
+{
+ struct drm_radeon_cs drmib;
+ struct drm_radeon_cs_chunk chunks[2];
+ uint64_t chunk_array[2];
+ unsigned fence;
+ int r;
+
+ if (!ctx->pm4_cdwords)
+ return;
+
+ /* suspend queries */
+ r600_context_queries_suspend(ctx);
+
+ radeon_bo_pbmgr_flush_maps(ctx->radeon->kman);
+
+ /* emit fence */
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE_EOP, 4);
+ ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT | (5 << 8);
+ ctx->pm4[ctx->pm4_cdwords++] = 0;
+ ctx->pm4[ctx->pm4_cdwords++] = (1 << 29) | (0 << 24);
+ ctx->pm4[ctx->pm4_cdwords++] = ctx->fence;
+ ctx->pm4[ctx->pm4_cdwords++] = 0;
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
+ ctx->pm4[ctx->pm4_cdwords++] = 0;
+ r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], ctx->fence_bo);
+
+#if 1
+ /* emit cs */
+ drmib.num_chunks = 2;
+ drmib.chunks = (uint64_t)(uintptr_t)chunk_array;
+ chunks[0].chunk_id = RADEON_CHUNK_ID_IB;
+ chunks[0].length_dw = ctx->pm4_cdwords;
+ chunks[0].chunk_data = (uint64_t)(uintptr_t)ctx->pm4;
+ chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS;
+ chunks[1].length_dw = ctx->creloc * sizeof(struct r600_reloc) / 4;
+ chunks[1].chunk_data = (uint64_t)(uintptr_t)ctx->reloc;
+ chunk_array[0] = (uint64_t)(uintptr_t)&chunks[0];
+ chunk_array[1] = (uint64_t)(uintptr_t)&chunks[1];
+ r = drmCommandWriteRead(ctx->radeon->fd, DRM_RADEON_CS, &drmib,
+ sizeof(struct drm_radeon_cs));
+#endif
+
+ r600_context_update_fenced_list(ctx);
+
+ fence = ctx->fence + 1;
+ if (fence < ctx->fence) {
+ /* wrap around */
+ fence = 1;
+ r600_context_fence_wraparound(ctx, fence);
+ }
+ ctx->fence = fence;
+
+ /* restart */
+ for (int i = 0; i < ctx->creloc; i++) {
+ ctx->bo[i]->reloc = NULL;
+ ctx->bo[i]->last_flush = 0;
+ radeon_bo_reference(ctx->radeon, &ctx->bo[i], NULL);
+ }
+ ctx->creloc = 0;
+ ctx->pm4_dirty_cdwords = 0;
+ ctx->pm4_cdwords = 0;
+
+ /* resume queries */
+ r600_context_queries_resume(ctx);
+
+ /* set all valid group as dirty so they get reemited on
+ * next draw command
+ */
+ for (int i = 0; i < ctx->nblocks; i++) {
+ if (ctx->blocks[i]->status & R600_BLOCK_STATUS_ENABLED) {
+ if(!(ctx->blocks[i]->status & R600_BLOCK_STATUS_DIRTY)) {
+ LIST_ADDTAIL(&ctx->blocks[i]->list,&ctx->dirty);
+ }
+ ctx->pm4_dirty_cdwords += ctx->blocks[i]->pm4_ndwords + ctx->blocks[i]->pm4_flush_ndwords;
+ ctx->blocks[i]->status |= R600_BLOCK_STATUS_DIRTY;
+ }
+ }
+}
+
+void r600_context_dump_bof(struct r600_context *ctx, const char *file)
+{
+ bof_t *bcs, *blob, *array, *bo, *size, *handle, *device_id, *root;
+ unsigned i;
+
+ root = device_id = bcs = blob = array = bo = size = handle = NULL;
+ root = bof_object();
+ if (root == NULL)
+ goto out_err;
+ device_id = bof_int32(ctx->radeon->device);
+ if (device_id == NULL)
+ goto out_err;
+ if (bof_object_set(root, "device_id", device_id))
+ goto out_err;
+ bof_decref(device_id);
+ device_id = NULL;
+ /* dump relocs */
+ blob = bof_blob(ctx->creloc * 16, ctx->reloc);
+ if (blob == NULL)
+ goto out_err;
+ if (bof_object_set(root, "reloc", blob))
+ goto out_err;
+ bof_decref(blob);
+ blob = NULL;
+ /* dump cs */
+ blob = bof_blob(ctx->pm4_cdwords * 4, ctx->pm4);
+ if (blob == NULL)
+ goto out_err;
+ if (bof_object_set(root, "pm4", blob))
+ goto out_err;
+ bof_decref(blob);
+ blob = NULL;
+ /* dump bo */
+ array = bof_array();
+ if (array == NULL)
+ goto out_err;
+ for (i = 0; i < ctx->creloc; i++) {
+ struct radeon_bo *rbo = ctx->bo[i];
+ bo = bof_object();
+ if (bo == NULL)
+ goto out_err;
+ size = bof_int32(rbo->size);
+ if (size == NULL)
+ goto out_err;
+ if (bof_object_set(bo, "size", size))
+ goto out_err;
+ bof_decref(size);
+ size = NULL;
+ handle = bof_int32(rbo->handle);
+ if (handle == NULL)
+ goto out_err;
+ if (bof_object_set(bo, "handle", handle))
+ goto out_err;
+ bof_decref(handle);
+ handle = NULL;
+ radeon_bo_map(ctx->radeon, rbo);
+ blob = bof_blob(rbo->size, rbo->data);
+ radeon_bo_unmap(ctx->radeon, rbo);
+ if (blob == NULL)
+ goto out_err;
+ if (bof_object_set(bo, "data", blob))
+ goto out_err;
+ bof_decref(blob);
+ blob = NULL;
+ if (bof_array_append(array, bo))
+ goto out_err;
+ bof_decref(bo);
+ bo = NULL;
+ }
+ if (bof_object_set(root, "bo", array))
+ goto out_err;
+ bof_dump_file(root, file);
+out_err:
+ bof_decref(blob);
+ bof_decref(array);
+ bof_decref(bo);
+ bof_decref(size);
+ bof_decref(handle);
+ bof_decref(device_id);
+ bof_decref(root);
+}
+
+static void r600_query_result(struct r600_context *ctx, struct r600_query *query)
+{
+ u64 start, end;
+ u32 *results;
+ int i;
+
+ results = r600_bo_map(ctx->radeon, query->buffer, 0, NULL);
+ for (i = 0; i < query->num_results; i += 4) {
+ start = (u64)results[i] | (u64)results[i + 1] << 32;
+ end = (u64)results[i + 2] | (u64)results[i + 3] << 32;
+ if ((start & 0x8000000000000000UL) && (end & 0x8000000000000000UL)) {
+ query->result += end - start;
+ }
+ }
+ r600_bo_unmap(ctx->radeon, query->buffer);
+ query->num_results = 0;
+}
+
+void r600_query_begin(struct r600_context *ctx, struct r600_query *query)
+{
+ /* query request needs 6 dwords for begin + 6 dwords for end */
+ if ((12 + ctx->pm4_cdwords) > ctx->pm4_ndwords) {
+ /* need to flush */
+ r600_context_flush(ctx);
+ }
+
+ /* if query buffer is full force a flush */
+ if (query->num_results >= ((query->buffer_size >> 2) - 2)) {
+ r600_context_flush(ctx);
+ r600_query_result(ctx, query);
+ }
+
+ /* emit begin query */
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2);
+ ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE;
+ ctx->pm4[ctx->pm4_cdwords++] = query->num_results + r600_bo_offset(query->buffer);
+ ctx->pm4[ctx->pm4_cdwords++] = 0;
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
+ ctx->pm4[ctx->pm4_cdwords++] = 0;
+ r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], query->buffer);
+
+ query->state |= R600_QUERY_STATE_STARTED;
+ query->state ^= R600_QUERY_STATE_ENDED;
+ ctx->num_query_running++;
+}
+
+void r600_query_end(struct r600_context *ctx, struct r600_query *query)
+{
+ /* emit begin query */
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2);
+ ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE;
+ ctx->pm4[ctx->pm4_cdwords++] = query->num_results + 8 + r600_bo_offset(query->buffer);
+ ctx->pm4[ctx->pm4_cdwords++] = 0;
+ ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
+ ctx->pm4[ctx->pm4_cdwords++] = 0;
+ r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], query->buffer);
+
+ query->num_results += 16;
+ query->state ^= R600_QUERY_STATE_STARTED;
+ query->state |= R600_QUERY_STATE_ENDED;
+ ctx->num_query_running--;
+}
+
+struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned query_type)
+{
+ struct r600_query *query;
+
+ if (query_type != PIPE_QUERY_OCCLUSION_COUNTER)
+ return NULL;
+
+ query = calloc(1, sizeof(struct r600_query));
+ if (query == NULL)
+ return NULL;
+
+ query->type = query_type;
+ query->buffer_size = 4096;
+
+ query->buffer = r600_bo(ctx->radeon, query->buffer_size, 1, 0);
+ if (!query->buffer) {
+ free(query);
+ return NULL;
+ }
+
+ LIST_ADDTAIL(&query->list, &ctx->query_list);
+
+ return query;
+}
+
+void r600_context_query_destroy(struct r600_context *ctx, struct r600_query *query)
+{
+ r600_bo_reference(ctx->radeon, &query->buffer, NULL);
+ LIST_DELINIT(&query->list);
+ free(query);
+}
+
+boolean r600_context_query_result(struct r600_context *ctx,
+ struct r600_query *query,
+ boolean wait, void *vresult)
+{
+ uint64_t *result = (uint64_t*)vresult;
+
+ if (query->num_results) {
+ r600_context_flush(ctx);
+ }
+ r600_query_result(ctx, query);
+ *result = query->result;
+ query->result = 0;
+ return TRUE;
+}
+
+void r600_context_queries_suspend(struct r600_context *ctx)
+{
+ struct r600_query *query;
+
+ LIST_FOR_EACH_ENTRY(query, &ctx->query_list, list) {
+ if (query->state & R600_QUERY_STATE_STARTED) {
+ r600_query_end(ctx, query);
+ query->state |= R600_QUERY_STATE_SUSPENDED;
+ }
+ }
+}
+
+void r600_context_queries_resume(struct r600_context *ctx)
+{
+ struct r600_query *query;
+
+ LIST_FOR_EACH_ENTRY(query, &ctx->query_list, list) {
+ if (query->state & R600_QUERY_STATE_SUSPENDED) {
+ r600_query_begin(ctx, query);
+ query->state ^= R600_QUERY_STATE_SUSPENDED;
+ }
+ }
+}
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
+#include <pipebuffer/pb_bufmgr.h>
+#include "util/u_double_list.h"
#include "r600.h"
-
struct radeon {
int fd;
int refcount;
unsigned device;
unsigned family;
enum chip_class chip_class;
- boolean use_mem_constant; /* true for evergreen */
+ struct pb_manager *kman; /* kernel bo manager */
+ struct pb_manager *cman; /* cached bo manager */
+ struct r600_tiling_info tiling_info;
};
struct radeon *r600_new(int fd, unsigned device);
void r600_delete(struct radeon *r600);
struct r600_reg {
+ unsigned opcode;
+ unsigned offset_base;
+ unsigned offset;
unsigned need_bo;
unsigned flush_flags;
- unsigned offset;
+ unsigned flush_mask;
+};
+
+struct radeon_bo {
+ struct pipe_reference reference;
+ unsigned handle;
+ unsigned size;
+ unsigned alignment;
+ unsigned map_count;
+ void *data;
+ struct list_head fencedlist;
+ unsigned fence;
+ struct r600_context *ctx;
+ boolean shared;
+ struct r600_reloc *reloc;
+ unsigned reloc_id;
+ unsigned last_flush;
+};
+
+struct r600_bo {
+ struct pipe_reference reference;
+ struct pb_buffer *pb;
+ unsigned size;
+ unsigned tiling_flags;
+ unsigned kernel_pitch;
};
+
/* radeon_pciid.c */
unsigned radeon_family_from_device(unsigned device);
+/* r600_drm.c */
+struct radeon *radeon_decref(struct radeon *radeon);
+
+/* radeon_bo.c */
+struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle,
+ unsigned size, unsigned alignment, void *ptr);
+void radeon_bo_reference(struct radeon *radeon, struct radeon_bo **dst,
+ struct radeon_bo *src);
+int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo);
+int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain);
+void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr);
+int radeon_bo_fencelist(struct radeon *radeon, struct radeon_bo **bolist, uint32_t num_bo);
+int radeon_bo_get_tiling_flags(struct radeon *radeon,
+ struct radeon_bo *bo,
+ uint32_t *tiling_flags,
+ uint32_t *pitch);
+
+/* radeon_bo_pb.c */
+struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf);
+struct pb_manager *radeon_bo_pbmgr_create(struct radeon *radeon);
+struct pb_buffer *radeon_bo_pb_create_buffer_from_handle(struct pb_manager *_mgr,
+ uint32_t handle);
+
+/* r600_hw_context.c */
+int r600_context_init_fence(struct r600_context *ctx);
+void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct r600_bo *rbo);
+void r600_context_bo_flush(struct r600_context *ctx, unsigned flush_flags,
+ unsigned flush_mask, struct r600_bo *rbo);
+struct r600_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned offset);
+int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg);
+
+/* r600_bo.c */
+unsigned r600_bo_get_handle(struct r600_bo *bo);
+unsigned r600_bo_get_size(struct r600_bo *bo);
+static INLINE struct radeon_bo *r600_bo_get_bo(struct r600_bo *bo)
+{
+ return radeon_bo_pb_get_bo(bo->pb);
+}
+
+#define CTX_RANGE_ID(ctx, offset) (((offset) >> (ctx)->hash_shift) & 255)
+#define CTX_BLOCK_ID(ctx, offset) ((offset) & ((1 << (ctx)->hash_shift) - 1))
-static void inline r600_context_reg(struct r600_context *ctx, unsigned group_id,
+static void inline r600_context_reg(struct r600_context *ctx,
unsigned offset, unsigned value,
unsigned mask)
{
- struct r600_group *group = &ctx->groups[group_id];
- struct r600_group_block *block;
+ struct r600_range *range;
+ struct r600_block *block;
unsigned id;
- id = group->offset_block_id[(offset - group->start_offset) >> 2];
- block = &group->blocks[id];
+ range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
+ block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
id = (offset - block->start_offset) >> 2;
block->reg[id] &= ~mask;
block->reg[id] |= value;
if (!(block->status & R600_BLOCK_STATUS_DIRTY)) {
ctx->pm4_dirty_cdwords += block->pm4_ndwords;
+ block->status |= R600_BLOCK_STATUS_ENABLED;
+ block->status |= R600_BLOCK_STATUS_DIRTY;
+ LIST_ADDTAIL(&block->list,&ctx->dirty);
+ }
+}
+
+static inline void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block)
+{
+ int id;
+
+ for (int j = 0; j < block->nreg; j++) {
+ if (block->pm4_bo_index[j]) {
+ /* find relocation */
+ id = block->pm4_bo_index[j];
+ r600_context_bo_reloc(ctx,
+ &block->pm4[block->reloc[id].bo_pm4_index],
+ block->reloc[id].bo);
+ r600_context_bo_flush(ctx,
+ block->reloc[id].flush_flags,
+ block->reloc[id].flush_mask,
+ block->reloc[id].bo);
+ }
}
- block->status |= R600_BLOCK_STATUS_ENABLED;
- block->status |= R600_BLOCK_STATUS_DIRTY;
+ memcpy(&ctx->pm4[ctx->pm4_cdwords], block->pm4, block->pm4_ndwords * 4);
+ ctx->pm4_cdwords += block->pm4_ndwords;
+ block->status ^= R600_BLOCK_STATUS_DIRTY;
+ LIST_DELINIT(&block->list);
+}
+
+static inline int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo)
+{
+ bo->map_count++;
+ return 0;
+}
+
+static inline void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo)
+{
+ bo->map_count--;
+ assert(bo->map_count >= 0);
}
#endif
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * 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.
- *
- * Authors:
- * Jerome Glisse
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include "radeon_priv.h"
-#include "r600d.h"
-
-#include "util/u_memory.h"
-
-static int r600_state_pm4_resource(struct radeon_state *state);
-static int r600_state_pm4_cb0(struct radeon_state *state);
-static int r600_state_pm4_vgt(struct radeon_state *state);
-static int r600_state_pm4_db(struct radeon_state *state);
-static int r600_state_pm4_shader(struct radeon_state *state);
-static int r600_state_pm4_draw(struct radeon_state *state);
-static int r600_state_pm4_config(struct radeon_state *state);
-static int r600_state_pm4_generic(struct radeon_state *state);
-static int r600_state_pm4_query_begin(struct radeon_state *state);
-static int r600_state_pm4_query_end(struct radeon_state *state);
-static int r700_state_pm4_config(struct radeon_state *state);
-static int r600_state_pm4_db_flush(struct radeon_state *state);
-static int r600_state_pm4_cb_flush(struct radeon_state *state);
-
-static int eg_state_pm4_vgt(struct radeon_state *state);
-
-#include "r600_states.h"
-#include "eg_states.h"
-
-
-#define SUB_NONE(param) { { 0, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) } }
-#define SUB_PS(param) { R600_SHADER_PS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) }
-#define SUB_VS(param) { R600_SHADER_VS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) }
-#define SUB_GS(param) { R600_SHADER_GS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) }
-#define SUB_FS(param) { R600_SHADER_FS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) }
-
-#define EG_SUB_NONE(param) { { 0, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) } }
-#define EG_SUB_PS(param) { R600_SHADER_PS, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) }
-#define EG_SUB_VS(param) { R600_SHADER_VS, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) }
-#define EG_SUB_GS(param) { R600_SHADER_GS, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) }
-#define EG_SUB_FS(param) { R600_SHADER_FS, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) }
-
-/* some of these are overriden at runtime for R700 */
-struct radeon_stype_info r600_stypes[] = {
- { R600_STATE_CONFIG, 1, 0, r600_state_pm4_config, SUB_NONE(CONFIG), },
- { R600_STATE_CB_CNTL, 1, 0, r600_state_pm4_generic, SUB_NONE(CB_CNTL) },
- { R600_STATE_RASTERIZER, 1, 0, r600_state_pm4_generic, SUB_NONE(RASTERIZER) },
- { R600_STATE_VIEWPORT, 1, 0, r600_state_pm4_generic, SUB_NONE(VIEWPORT) },
- { R600_STATE_SCISSOR, 1, 0, r600_state_pm4_generic, SUB_NONE(SCISSOR) },
- { R600_STATE_BLEND, 1, 0, r600_state_pm4_generic, SUB_NONE(BLEND), },
- { R600_STATE_DSA, 1, 0, r600_state_pm4_generic, SUB_NONE(DSA), },
- { R600_STATE_SHADER, 1, 0, r600_state_pm4_shader, { SUB_PS(PS_SHADER), SUB_VS(VS_SHADER) } },
- { R600_STATE_CBUF, 1, 0, r600_state_pm4_shader, { SUB_PS(PS_CBUF), SUB_VS(VS_CBUF) } },
- { R600_STATE_CONSTANT, 256, 0x10, r600_state_pm4_generic, { SUB_PS(PS_CONSTANT), SUB_VS(VS_CONSTANT) } },
- { R600_STATE_RESOURCE, 160, 0x1c, r600_state_pm4_resource, { SUB_PS(PS_RESOURCE), SUB_VS(VS_RESOURCE), SUB_GS(GS_RESOURCE), SUB_FS(FS_RESOURCE)} },
- { R600_STATE_SAMPLER, 18, 0xc, r600_state_pm4_generic, { SUB_PS(PS_SAMPLER), SUB_VS(VS_SAMPLER), SUB_GS(GS_SAMPLER) } },
- { R600_STATE_SAMPLER_BORDER, 18, 0x10, r600_state_pm4_generic, { SUB_PS(PS_SAMPLER_BORDER), SUB_VS(VS_SAMPLER_BORDER), SUB_GS(GS_SAMPLER_BORDER) } },
- { R600_STATE_CB0, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB0) },
- { R600_STATE_CB1, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB1) },
- { R600_STATE_CB2, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB2) },
- { R600_STATE_CB3, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB3) },
- { R600_STATE_CB4, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB4) },
- { R600_STATE_CB5, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB5) },
- { R600_STATE_CB6, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB6) },
- { R600_STATE_CB7, 1, 0, r600_state_pm4_cb0, SUB_NONE(CB7) },
- { R600_STATE_QUERY_BEGIN, 1, 0, r600_state_pm4_query_begin, SUB_NONE(VGT_EVENT) },
- { R600_STATE_QUERY_END, 1, 0, r600_state_pm4_query_end, SUB_NONE(VGT_EVENT) },
- { R600_STATE_DB, 1, 0, r600_state_pm4_db, SUB_NONE(DB) },
- { R600_STATE_UCP, 1, 0, r600_state_pm4_generic, SUB_NONE(UCP) },
- { R600_STATE_VGT, 1, 0, r600_state_pm4_vgt, SUB_NONE(VGT) },
- { R600_STATE_DRAW, 1, 0, r600_state_pm4_draw, SUB_NONE(DRAW) },
- { R600_STATE_CB_FLUSH, 1, 0, r600_state_pm4_cb_flush, SUB_NONE(CB_FLUSH) },
- { R600_STATE_DB_FLUSH, 1, 0, r600_state_pm4_db_flush, SUB_NONE(DB_FLUSH) },
-};
-#define STYPES_SIZE Elements(r600_stypes)
-
-struct radeon_stype_info eg_stypes[] = {
- { R600_STATE_CONFIG, 1, 0, r700_state_pm4_config, EG_SUB_NONE(CONFIG), },
- { R600_STATE_CB_CNTL, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(CB_CNTL) },
- { R600_STATE_RASTERIZER, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(RASTERIZER) },
- { R600_STATE_VIEWPORT, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(VIEWPORT) },
- { R600_STATE_SCISSOR, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(SCISSOR) },
- { R600_STATE_BLEND, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(BLEND), },
- { R600_STATE_DSA, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(DSA), },
- { R600_STATE_SHADER, 1, 0, r600_state_pm4_shader, { EG_SUB_PS(PS_SHADER), EG_SUB_VS(VS_SHADER) } },
- { R600_STATE_CBUF, 1, 0, r600_state_pm4_shader, { EG_SUB_PS(PS_CBUF), EG_SUB_VS(VS_CBUF) } },
- { R600_STATE_RESOURCE, 176, 0x20, r600_state_pm4_resource, { EG_SUB_PS(PS_RESOURCE), EG_SUB_VS(VS_RESOURCE), EG_SUB_GS(GS_RESOURCE), EG_SUB_FS(FS_RESOURCE)} },
- { R600_STATE_SAMPLER, 18, 0xc, r600_state_pm4_generic, { EG_SUB_PS(PS_SAMPLER), EG_SUB_VS(VS_SAMPLER), EG_SUB_GS(GS_SAMPLER) } },
- { R600_STATE_SAMPLER_BORDER, 18, 0, r600_state_pm4_generic, { EG_SUB_PS(PS_SAMPLER_BORDER), EG_SUB_VS(VS_SAMPLER_BORDER), EG_SUB_GS(GS_SAMPLER_BORDER) } },
- { R600_STATE_CB0, 11, 0x3c, r600_state_pm4_generic, EG_SUB_NONE(CB) },
- { R600_STATE_QUERY_BEGIN, 1, 0, r600_state_pm4_query_begin, EG_SUB_NONE(VGT_EVENT) },
- { R600_STATE_QUERY_END, 1, 0, r600_state_pm4_query_end, EG_SUB_NONE(VGT_EVENT) },
- { R600_STATE_DB, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(DB) },
- { R600_STATE_UCP, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(UCP) },
- { R600_STATE_VGT, 1, 0, eg_state_pm4_vgt, EG_SUB_NONE(VGT) },
- { R600_STATE_DRAW, 1, 0, r600_state_pm4_draw, EG_SUB_NONE(DRAW) },
- { R600_STATE_CB_FLUSH, 1, 0, r600_state_pm4_cb_flush, EG_SUB_NONE(CB_FLUSH) },
- { R600_STATE_DB_FLUSH, 1, 0, r600_state_pm4_db_flush, EG_SUB_NONE(DB_FLUSH) },
-
-};
-#define EG_STYPES_SIZE Elements(eg_stypes)
-
-static const struct radeon_register *get_regs(struct radeon_state *state)
-{
- return state->stype->reginfo[state->shader_index].regs;
-}
-
-/*
- * r600/r700 state functions
- */
-static int r600_state_pm4_bytecode(struct radeon_state *state, unsigned offset, unsigned id, unsigned nreg)
-{
- const struct radeon_register *regs = get_regs(state);
- unsigned i;
- int r;
-
- if (!offset) {
- fprintf(stderr, "%s invalid register for state %d %d\n",
- __func__, state->stype->stype, id);
- return -EINVAL;
- }
- if (offset >= R600_CONFIG_REG_OFFSET && offset < R600_CONFIG_REG_END) {
- state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, nreg);
- state->pm4[state->cpm4++] = (offset - R600_CONFIG_REG_OFFSET) >> 2;
- for (i = 0; i < nreg; i++) {
- state->pm4[state->cpm4++] = state->states[id + i];
- }
- for (i = 0; i < nreg; i++) {
- if (regs[id + i].need_reloc) {
- state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0);
- r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id);
- if (r)
- return r;
- state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[regs[id + i].bo_id]);
- }
- }
- return 0;
- }
- if (offset >= R600_CONTEXT_REG_OFFSET && offset < R600_CONTEXT_REG_END) {
- state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONTEXT_REG, nreg);
- state->pm4[state->cpm4++] = (offset - R600_CONTEXT_REG_OFFSET) >> 2;
- for (i = 0; i < nreg; i++) {
- state->pm4[state->cpm4++] = state->states[id + i];
- }
- for (i = 0; i < nreg; i++) {
- if (regs[id + i].need_reloc) {
- state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0);
- r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id);
- if (r)
- return r;
- state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[regs[id + i].bo_id]);
- }
- }
- return 0;
- }
- if (offset >= R600_ALU_CONST_OFFSET && offset < R600_ALU_CONST_END) {
- state->pm4[state->cpm4++] = PKT3(PKT3_SET_ALU_CONST, nreg);
- state->pm4[state->cpm4++] = (offset - R600_ALU_CONST_OFFSET) >> 2;
- for (i = 0; i < nreg; i++) {
- state->pm4[state->cpm4++] = state->states[id + i];
- }
- return 0;
- }
- if (offset >= R600_SAMPLER_OFFSET && offset < R600_SAMPLER_END) {
- state->pm4[state->cpm4++] = PKT3(PKT3_SET_SAMPLER, nreg);
- state->pm4[state->cpm4++] = (offset - R600_SAMPLER_OFFSET) >> 2;
- for (i = 0; i < nreg; i++) {
- state->pm4[state->cpm4++] = state->states[id + i];
- }
- return 0;
- }
- fprintf(stderr, "%s unsupported offset 0x%08X\n", __func__, offset);
- return -EINVAL;
-}
-
-static int eg_state_pm4_bytecode(struct radeon_state *state, unsigned offset, unsigned id, unsigned nreg)
-{
- const struct radeon_register *regs = get_regs(state);
- unsigned i;
- int r;
-
- if (!offset) {
- fprintf(stderr, "%s invalid register for state %d %d\n",
- __func__, state->stype->stype, id);
- return -EINVAL;
- }
- if (offset >= R600_CONFIG_REG_OFFSET && offset < R600_CONFIG_REG_END) {
- state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, nreg);
- state->pm4[state->cpm4++] = (offset - R600_CONFIG_REG_OFFSET) >> 2;
- for (i = 0; i < nreg; i++) {
- state->pm4[state->cpm4++] = state->states[id + i];
- }
- for (i = 0; i < nreg; i++) {
- if (regs[id + i].need_reloc) {
- state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0);
- r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id);
- if (r)
- return r;
- state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[regs[id + i].bo_id]);
- }
- }
- return 0;
- }
- if (offset >= R600_CONTEXT_REG_OFFSET && offset < R600_CONTEXT_REG_END) {
- state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONTEXT_REG, nreg);
- state->pm4[state->cpm4++] = (offset - R600_CONTEXT_REG_OFFSET) >> 2;
- for (i = 0; i < nreg; i++) {
- state->pm4[state->cpm4++] = state->states[id + i];
- }
- for (i = 0; i < nreg; i++) {
- if (regs[id + i].need_reloc) {
- state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0);
- r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id);
- if (r)
- return r;
- state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[regs[id + i].bo_id]);
- }
- }
- return 0;
- }
- if (offset >= EG_RESOURCE_OFFSET && offset < EG_RESOURCE_END) {
- state->pm4[state->cpm4++] = PKT3(PKT3_SET_RESOURCE, nreg);
- state->pm4[state->cpm4++] = (offset - EG_RESOURCE_OFFSET) >> 2;
- for (i = 0; i < nreg; i++) {
- state->pm4[state->cpm4++] = state->states[id + i];
- }
- return 0;
- }
- if (offset >= R600_SAMPLER_OFFSET && offset < R600_SAMPLER_END) {
- state->pm4[state->cpm4++] = PKT3(PKT3_SET_SAMPLER, nreg);
- state->pm4[state->cpm4++] = (offset - R600_SAMPLER_OFFSET) >> 2;
- for (i = 0; i < nreg; i++) {
- state->pm4[state->cpm4++] = state->states[id + i];
- }
- return 0;
- }
- fprintf(stderr, "%s unsupported offset 0x%08X\n", __func__, offset);
- return -EINVAL;
-}
-
-
-static int r600_state_pm4_generic(struct radeon_state *state)
-{
- const struct radeon_register *regs = get_regs(state);
- unsigned i, offset, nreg, coffset, loffset, soffset;
- unsigned start;
- int r;
-
- if (!state->nstates)
- return 0;
- soffset = state->id * state->stype->stride;
- offset = loffset = regs[0].offset + soffset;
- start = 0;
- for (i = 1, nreg = 1; i < state->nstates; i++) {
- coffset = regs[i].offset + soffset;
- if (coffset == (loffset + 4)) {
- nreg++;
- loffset = coffset;
- } else {
- if (state->radeon->family >= CHIP_CEDAR)
- r = eg_state_pm4_bytecode(state, offset, start, nreg);
- else
- r = r600_state_pm4_bytecode(state, offset, start, nreg);
- if (r) {
- fprintf(stderr, "%s invalid 0x%08X %d\n", __func__, start, nreg);
- return r;
- }
- offset = loffset = coffset;
- nreg = 1;
- start = i;
- }
- }
- if (state->radeon->family >= CHIP_CEDAR)
- r = eg_state_pm4_bytecode(state, offset, start, nreg);
- else
- r = r600_state_pm4_bytecode(state, offset, start, nreg);
- return r;
-}
-
-static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags, int bufs_are_cbs)
-{
- unsigned i, j, add, size;
- uint32_t flags_cb;
-
- state->nreloc = 0;
- for (i = 0; i < state->nbo; i++) {
- for (j = 0, add = 1; j < state->nreloc; j++) {
- if (state->bo[state->reloc_bo_id[j]] == state->bo[i]) {
- add = 0;
- break;
- }
- }
- if (add) {
- state->reloc_bo_id[state->nreloc++] = i;
- }
- }
- for (i = 0; i < state->nreloc; i++) {
- flags_cb = flags;
- size = (radeon_ws_bo_get_size(state->bo[state->reloc_bo_id[i]]) + 255) >> 8;
- state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_SYNC, 3);
- if (bufs_are_cbs)
- flags_cb |= S_0085F0_CB0_DEST_BASE_ENA(1 << i);
- state->pm4[state->cpm4++] = flags_cb;
- state->pm4[state->cpm4++] = size;
- state->pm4[state->cpm4++] = 0x00000000;
- state->pm4[state->cpm4++] = 0x0000000A;
- state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0);
- state->reloc_pm4_id[i] = state->cpm4;
- state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[state->reloc_bo_id[i]]);
- }
-}
-
-static int r600_state_pm4_cb0(struct radeon_state *state)
-{
- int r;
- uint32_t sbu;
- r = r600_state_pm4_generic(state);
- if (r)
- return r;
-
- sbu = (2 << (state->stype->stype - R600_STATE_CB0));
- state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_BASE_UPDATE, 0);
- state->pm4[state->cpm4++] = sbu;
- return 0;
-}
-
-static int r600_state_pm4_db(struct radeon_state *state)
-{
- int r;
-
- r = r600_state_pm4_generic(state);
- if (r)
- return r;
- state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_BASE_UPDATE, 0);
- state->pm4[state->cpm4++] = 0x00000001;
- return 0;
-}
-
-static int r600_state_pm4_config(struct radeon_state *state)
-{
- state->pm4[state->cpm4++] = PKT3(PKT3_START_3D_CMDBUF, 0);
- state->pm4[state->cpm4++] = 0x00000000;
- state->pm4[state->cpm4++] = PKT3(PKT3_CONTEXT_CONTROL, 1);
- state->pm4[state->cpm4++] = 0x80000000;
- state->pm4[state->cpm4++] = 0x80000000;
- state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0);
- state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT;
- state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, 1);
- state->pm4[state->cpm4++] = 0x00000010;
- state->pm4[state->cpm4++] = 0x00028000;
- return r600_state_pm4_generic(state);
-}
-
-static int r600_state_pm4_query_begin(struct radeon_state *state)
-{
- int r;
-
- state->cpm4 = 0;
- state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 2);
- state->pm4[state->cpm4++] = EVENT_TYPE_ZPASS_DONE;
- state->pm4[state->cpm4++] = state->states[0];
- state->pm4[state->cpm4++] = 0x0;
- state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0);
- r = radeon_state_reloc(state, state->cpm4, 0);
- if (r)
- return r;
- state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[0]);
- return 0;
-}
-
-static int r600_state_pm4_query_end(struct radeon_state *state)
-{
- int r;
-
- state->cpm4 = 0;
- state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 2);
- state->pm4[state->cpm4++] = EVENT_TYPE_ZPASS_DONE;
- state->pm4[state->cpm4++] = state->states[0];
- state->pm4[state->cpm4++] = 0x0;
- state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0);
- r = radeon_state_reloc(state, state->cpm4, 0);
- if (r)
- return r;
- state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[0]);
- return 0;
-}
-
-static int r700_state_pm4_config(struct radeon_state *state)
-{
- state->pm4[state->cpm4++] = PKT3(PKT3_CONTEXT_CONTROL, 1);
- state->pm4[state->cpm4++] = 0x80000000;
- state->pm4[state->cpm4++] = 0x80000000;
- state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0);
- state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT;
- state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, 1);
- state->pm4[state->cpm4++] = 0x00000010;
- state->pm4[state->cpm4++] = 0x00028000;
- return r600_state_pm4_generic(state);
-}
-
-static int r600_state_pm4_shader(struct radeon_state *state)
-{
- r600_state_pm4_with_flush(state, S_0085F0_SH_ACTION_ENA(1), 0);
- return r600_state_pm4_generic(state);
-}
-
-static int eg_state_pm4_vgt(struct radeon_state *state)
-{
- int r;
- r = eg_state_pm4_bytecode(state, R_028400_VGT_MAX_VTX_INDX, EG_VGT__VGT_MAX_VTX_INDX, 1);
- if (r)
- return r;
- r = eg_state_pm4_bytecode(state, R_028404_VGT_MIN_VTX_INDX, EG_VGT__VGT_MIN_VTX_INDX, 1);
- if (r)
- return r;
- r = eg_state_pm4_bytecode(state, R_028408_VGT_INDX_OFFSET, EG_VGT__VGT_INDX_OFFSET, 1);
- if (r)
- return r;
- r = eg_state_pm4_bytecode(state, R_008958_VGT_PRIMITIVE_TYPE, EG_VGT__VGT_PRIMITIVE_TYPE, 1);
- if (r)
- return r;
- state->pm4[state->cpm4++] = PKT3(PKT3_INDEX_TYPE, 0);
- state->pm4[state->cpm4++] = state->states[EG_VGT__VGT_DMA_INDEX_TYPE];
- state->pm4[state->cpm4++] = PKT3(PKT3_NUM_INSTANCES, 0);
- state->pm4[state->cpm4++] = state->states[EG_VGT__VGT_DMA_NUM_INSTANCES];
- return 0;
-}
-
-static int r600_state_pm4_vgt(struct radeon_state *state)
-{
- int r;
-
- r = r600_state_pm4_bytecode(state, R_028400_VGT_MAX_VTX_INDX, R600_VGT__VGT_MAX_VTX_INDX, 1);
- if (r)
- return r;
- r = r600_state_pm4_bytecode(state, R_028404_VGT_MIN_VTX_INDX, R600_VGT__VGT_MIN_VTX_INDX, 1);
- if (r)
- return r;
- r = r600_state_pm4_bytecode(state, R_028408_VGT_INDX_OFFSET, R600_VGT__VGT_INDX_OFFSET, 1);
- if (r)
- return r;
- r = r600_state_pm4_bytecode(state, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX, R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX, 1);
- if (r)
- return r;
- r = r600_state_pm4_bytecode(state, R_008958_VGT_PRIMITIVE_TYPE, R600_VGT__VGT_PRIMITIVE_TYPE, 1);
- if (r)
- return r;
- state->pm4[state->cpm4++] = PKT3(PKT3_INDEX_TYPE, 0);
- state->pm4[state->cpm4++] = state->states[R600_VGT__VGT_DMA_INDEX_TYPE];
- state->pm4[state->cpm4++] = PKT3(PKT3_NUM_INSTANCES, 0);
- state->pm4[state->cpm4++] = state->states[R600_VGT__VGT_DMA_NUM_INSTANCES];
- return 0;
-}
-
-static int r600_state_pm4_draw(struct radeon_state *state)
-{
- int r;
-
- if (state->nbo) {
- state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX, 3);
- state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DMA_BASE];
- state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DMA_BASE_HI];
- state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES];
- state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR];
- state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0);
- r = radeon_state_reloc(state, state->cpm4, 0);
- if (r)
- return r;
- state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[0]);
- } else {
- state->pm4[state->cpm4++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1);
- state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_NUM_INDICES];
- state->pm4[state->cpm4++] = state->states[R600_DRAW__VGT_DRAW_INITIATOR];
- }
- state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0);
- state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT;
-
- return 0;
-}
-
-static int r600_state_pm4_cb_flush(struct radeon_state *state)
-{
- if (!state->nbo)
- return 0;
-
- r600_state_pm4_with_flush(state, S_0085F0_CB_ACTION_ENA(1), 1);
-
- return 0;
-}
-
-static int r600_state_pm4_db_flush(struct radeon_state *state)
-{
- if (!state->nbo)
- return 0;
-
- r600_state_pm4_with_flush(state, S_0085F0_DB_ACTION_ENA(1) |
- S_0085F0_DB_DEST_BASE_ENA(1), 0);
-
- return 0;
-}
-
-static int r600_state_pm4_resource(struct radeon_state *state)
-{
- u32 flags, type, nbo, offset, soffset;
- int r, nres;
- const struct radeon_register *regs = get_regs(state);
-
- soffset = state->id * state->stype->stride;
- if (state->radeon->family >= CHIP_CEDAR)
- type = G_038018_TYPE(state->states[7]);
- else
- type = G_038018_TYPE(state->states[6]);
-
- switch (type) {
- case 2:
- flags = S_0085F0_TC_ACTION_ENA(1);
- nbo = 2;
- break;
- case 3:
- flags = S_0085F0_VC_ACTION_ENA(1);
- nbo = 1;
- break;
- default:
- return 0;
- }
- if (state->nbo != nbo) {
- fprintf(stderr, "%s need %d bo got %d\n", __func__, nbo, state->nbo);
- return -EINVAL;
- }
- r600_state_pm4_with_flush(state, flags, 0);
- offset = regs[0].offset + soffset;
- if (state->radeon->family >= CHIP_CEDAR)
- nres = 8;
- else
- nres = 7;
- state->pm4[state->cpm4++] = PKT3(PKT3_SET_RESOURCE, nres);
- if (state->radeon->family >= CHIP_CEDAR)
- state->pm4[state->cpm4++] = (offset - EG_RESOURCE_OFFSET) >> 2;
- else
- state->pm4[state->cpm4++] = (offset - R_038000_SQ_TEX_RESOURCE_WORD0_0) >> 2;
- state->pm4[state->cpm4++] = state->states[0];
- state->pm4[state->cpm4++] = state->states[1];
- state->pm4[state->cpm4++] = state->states[2];
- state->pm4[state->cpm4++] = state->states[3];
- state->pm4[state->cpm4++] = state->states[4];
- state->pm4[state->cpm4++] = state->states[5];
- state->pm4[state->cpm4++] = state->states[6];
- if (state->radeon->family >= CHIP_CEDAR)
- state->pm4[state->cpm4++] = state->states[7];
-
- state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0);
- r = radeon_state_reloc(state, state->cpm4, 0);
- if (r)
- return r;
- state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[0]);
- if (type == 2) {
- state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0);
- r = radeon_state_reloc(state, state->cpm4, 1);
- if (r)
- return r;
- state->pm4[state->cpm4++] = radeon_ws_bo_get_handle(state->bo[1]);
- }
- return 0;
-}
-
-
-static void r600_modify_type_array(struct radeon *radeon)
-{
- int i;
- switch (radeon->family) {
- case CHIP_RV770:
- case CHIP_RV730:
- case CHIP_RV710:
- case CHIP_RV740:
- break;
- default:
- return;
- }
-
- /* r700 needs some mods */
- for (i = 0; i < radeon->nstype; i++) {
- struct radeon_stype_info *info = &radeon->stype[i];
-
- switch(info->stype) {
- case R600_STATE_CONFIG:
- info->pm4 = r700_state_pm4_config;
- break;
- case R600_STATE_CB0:
- info->pm4 = r600_state_pm4_generic;
- break;
- case R600_STATE_DB:
- info->pm4 = r600_state_pm4_generic;
- break;
- };
- }
-}
-
-static void build_types_array(struct radeon *radeon, struct radeon_stype_info *types, int size)
-{
- int i, j;
- int id = 0;
-
- for (i = 0; i < size; i++) {
- types[i].base_id = id;
- types[i].npm4 = 128;
- if (types[i].reginfo[0].shader_type == 0) {
- id += types[i].num;
- } else {
- for (j = 0; j < R600_SHADER_MAX; j++) {
- if (types[i].reginfo[j].shader_type)
- id += types[i].num;
- }
- }
- }
- radeon->max_states = id;
- radeon->stype = types;
- radeon->nstype = size;
-}
-
-static void r600_build_types_array(struct radeon *radeon)
-{
- build_types_array(radeon, r600_stypes, STYPES_SIZE);
- r600_modify_type_array(radeon);
-}
-
-static void eg_build_types_array(struct radeon *radeon)
-{
- build_types_array(radeon, eg_stypes, EG_STYPES_SIZE);
-}
-
-int r600_init(struct radeon *radeon)
-{
- if (radeon->family >= CHIP_CEDAR)
- eg_build_types_array(radeon);
- else
- r600_build_types_array(radeon);
- return 0;
-}
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * 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.
- *
- * Authors:
- * Jerome Glisse
- */
-#include <errno.h>
-#include <stdint.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "xf86drm.h"
-#include "r600.h"
-#include "r600d.h"
-#include "r600_priv.h"
-#include "radeon_drm.h"
-#include "bof.h"
-#include "pipe/p_compiler.h"
-#include "util/u_inlines.h"
-#include <pipebuffer/pb_bufmgr.h>
-
-#define GROUP_FORCE_NEW_BLOCK 0
-struct radeon_ws_bo {
- struct pipe_reference reference;
- struct pb_buffer *pb;
-};
-
-struct radeon_bo {
- struct pipe_reference reference;
- unsigned handle;
- unsigned size;
- unsigned alignment;
- unsigned map_count;
- void *data;
-};
-struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf);
-int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo);
-void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo);
-void radeon_bo_reference(struct radeon *radeon,
- struct radeon_bo **dst,
- struct radeon_bo *src);
-
-unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo);
-
-/* queries */
-static void r600_context_queries_suspend(struct r600_context *ctx);
-static void r600_context_queries_resume(struct r600_context *ctx);
-
-static int r600_group_id_register_offset(struct r600_context *ctx, unsigned offset)
-{
- for (int i = 0; i < ctx->ngroups; i++) {
- if (offset >= ctx->groups[i].start_offset && offset < ctx->groups[i].end_offset) {
- return i;
- }
- }
- return -1;
-}
-
-int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg, unsigned nreg, unsigned opcode)
-{
- struct r600_group_block *block, *tmp;
- struct r600_group *group;
- int group_id, id;
-
- for (unsigned i = 0, n = 0; i < nreg; i += n) {
- u32 j, r;
-
- /* register that need relocation are in their own group */
- n = 1;
- if (!reg[i].need_bo) {
- /* find number of consecutive registers */
- for (j = i + 1, r = reg[i].offset + 4, n = 1; j < (nreg - i); j++, n++, r+=4) {
- if (reg[i].need_bo || r != reg[j].offset) {
- break;
- }
- }
- }
-
- /* ignore new block balise */
- if (reg[i].offset == GROUP_FORCE_NEW_BLOCK)
- continue;
-
- /* find into which group this block is */
- group_id = r600_group_id_register_offset(ctx, reg[i].offset);
- assert(group_id >= 0);
- group = &ctx->groups[group_id];
-
- /* allocate new block */
- tmp = realloc(group->blocks, (group->nblocks + 1) * sizeof(struct r600_group_block));
- if (tmp == NULL) {
- return -ENOMEM;
- }
- /* update reg pointer */
- if (tmp != group->blocks) {
- for (int j = 0; j < group->nblocks; j++) {
- tmp[j].reg = &tmp[j].pm4[2];
- }
- }
- group->blocks = tmp;
- block = &group->blocks[group->nblocks++];
- for (int j = 0; j < n; j++) {
- group->offset_block_id[((reg[i].offset - group->start_offset) >> 2) + j] = group->nblocks - 1;
- }
-
- /* initialize block */
- memset(block, 0, sizeof(struct r600_group_block));
- block->start_offset = reg[i].offset;
- block->pm4[block->pm4_ndwords++] = PKT3(opcode, n);
- block->pm4[block->pm4_ndwords++] = (block->start_offset - group->start_offset) >> 2;
- block->reg = &block->pm4[block->pm4_ndwords];
- block->pm4_ndwords += n;
- block->nreg = n;
- for (j = 0; j < n; j++) {
- if (reg[i+j].need_bo) {
- block->nbo++;
- assert(block->nbo < R600_BLOCK_MAX_BO);
- block->pm4_bo_index[j] = block->nbo;
- block->pm4[block->pm4_ndwords++] = PKT3(PKT3_NOP, 0);
- block->pm4[block->pm4_ndwords++] = 0x00000000;
- block->reloc[block->nbo].bo_pm4_index[block->reloc[block->nbo].nreloc++] = block->pm4_ndwords - 1;
- }
- }
- for (j = 0; j < n; j++) {
- if (reg[i+j].flush_flags) {
- block->pm4[block->pm4_ndwords++] = PKT3(PKT3_SURFACE_SYNC, 3);
- block->pm4[block->pm4_ndwords++] = reg[i+j].flush_flags;
- block->pm4[block->pm4_ndwords++] = 0xFFFFFFFF;
- block->pm4[block->pm4_ndwords++] = 0x00000000;
- block->pm4[block->pm4_ndwords++] = 0x0000000A;
- block->pm4[block->pm4_ndwords++] = PKT3(PKT3_NOP, 0);
- block->pm4[block->pm4_ndwords++] = 0x00000000;
- id = block->pm4_bo_index[j];
- block->reloc[id].bo_pm4_index[block->reloc[id].nreloc++] = block->pm4_ndwords - 1;
- }
- }
- /* check that we stay in limit */
- assert(block->pm4_ndwords < R600_BLOCK_MAX_REG);
- }
- return 0;
-}
-
-int r600_group_init(struct r600_group *group, unsigned start_offset, unsigned end_offset)
-{
- group->start_offset = start_offset;
- group->end_offset = end_offset;
- group->nblocks = 0;
- group->blocks = NULL;
- group->offset_block_id = calloc((end_offset - start_offset) >> 2, sizeof(unsigned));
- if (group->offset_block_id == NULL)
- return -ENOMEM;
- return 0;
-}
-
-static void r600_group_fini(struct r600_group *group)
-{
- free(group->offset_block_id);
- free(group->blocks);
-}
-
-/* R600/R700 configuration */
-static const struct r600_reg r600_config_reg_list[] = {
- {0, 0, R_008958_VGT_PRIMITIVE_TYPE},
- {0, 0, R_008C00_SQ_CONFIG},
- {0, 0, R_008C04_SQ_GPR_RESOURCE_MGMT_1},
- {0, 0, R_008C08_SQ_GPR_RESOURCE_MGMT_2},
- {0, 0, R_008C0C_SQ_THREAD_RESOURCE_MGMT},
- {0, 0, R_008C10_SQ_STACK_RESOURCE_MGMT_1},
- {0, 0, R_008C14_SQ_STACK_RESOURCE_MGMT_2},
- {0, 0, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ},
- {0, 0, R_009508_TA_CNTL_AUX},
- {0, 0, R_009714_VC_ENHANCE},
- {0, 0, R_009830_DB_DEBUG},
- {0, 0, R_009838_DB_WATERMARKS},
-};
-
-static const struct r600_reg r600_context_reg_list[] = {
- {0, 0, R_028350_SX_MISC},
- {0, 0, R_0286C8_SPI_THREAD_GROUPING},
- {0, 0, R_0288A8_SQ_ESGS_RING_ITEMSIZE},
- {0, 0, R_0288AC_SQ_GSVS_RING_ITEMSIZE},
- {0, 0, R_0288B0_SQ_ESTMP_RING_ITEMSIZE},
- {0, 0, R_0288B4_SQ_GSTMP_RING_ITEMSIZE},
- {0, 0, R_0288B8_SQ_VSTMP_RING_ITEMSIZE},
- {0, 0, R_0288BC_SQ_PSTMP_RING_ITEMSIZE},
- {0, 0, R_0288C0_SQ_FBUF_RING_ITEMSIZE},
- {0, 0, R_0288C4_SQ_REDUC_RING_ITEMSIZE},
- {0, 0, R_0288C8_SQ_GS_VERT_ITEMSIZE},
- {0, 0, R_028A10_VGT_OUTPUT_PATH_CNTL},
- {0, 0, R_028A14_VGT_HOS_CNTL},
- {0, 0, R_028A18_VGT_HOS_MAX_TESS_LEVEL},
- {0, 0, R_028A1C_VGT_HOS_MIN_TESS_LEVEL},
- {0, 0, R_028A20_VGT_HOS_REUSE_DEPTH},
- {0, 0, R_028A24_VGT_GROUP_PRIM_TYPE},
- {0, 0, R_028A28_VGT_GROUP_FIRST_DECR},
- {0, 0, R_028A2C_VGT_GROUP_DECR},
- {0, 0, R_028A30_VGT_GROUP_VECT_0_CNTL},
- {0, 0, R_028A34_VGT_GROUP_VECT_1_CNTL},
- {0, 0, R_028A38_VGT_GROUP_VECT_0_FMT_CNTL},
- {0, 0, R_028A3C_VGT_GROUP_VECT_1_FMT_CNTL},
- {0, 0, R_028A40_VGT_GS_MODE},
- {0, 0, R_028A4C_PA_SC_MODE_CNTL},
- {0, 0, R_028AB0_VGT_STRMOUT_EN},
- {0, 0, R_028AB4_VGT_REUSE_OFF},
- {0, 0, R_028AB8_VGT_VTX_CNT_EN},
- {0, 0, R_028B20_VGT_STRMOUT_BUFFER_EN},
- {0, 0, R_028028_DB_STENCIL_CLEAR},
- {0, 0, R_02802C_DB_DEPTH_CLEAR},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028040_CB_COLOR0_BASE},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280A0_CB_COLOR0_INFO},
- {0, 0, R_028060_CB_COLOR0_SIZE},
- {0, 0, R_028080_CB_COLOR0_VIEW},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280E0_CB_COLOR0_FRAG},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280C0_CB_COLOR0_TILE},
- {0, 0, R_028100_CB_COLOR0_MASK},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028044_CB_COLOR1_BASE},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280A4_CB_COLOR1_INFO},
- {0, 0, R_028064_CB_COLOR1_SIZE},
- {0, 0, R_028084_CB_COLOR1_VIEW},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280E4_CB_COLOR1_FRAG},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280C4_CB_COLOR1_TILE},
- {0, 0, R_028104_CB_COLOR1_MASK},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028048_CB_COLOR2_BASE},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280A8_CB_COLOR2_INFO},
- {0, 0, R_028068_CB_COLOR2_SIZE},
- {0, 0, R_028088_CB_COLOR2_VIEW},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280E8_CB_COLOR2_FRAG},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280C8_CB_COLOR2_TILE},
- {0, 0, R_028108_CB_COLOR2_MASK},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_02804C_CB_COLOR3_BASE},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280AC_CB_COLOR3_INFO},
- {0, 0, R_02806C_CB_COLOR3_SIZE},
- {0, 0, R_02808C_CB_COLOR3_VIEW},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280EC_CB_COLOR3_FRAG},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280CC_CB_COLOR3_TILE},
- {0, 0, R_02810C_CB_COLOR3_MASK},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028050_CB_COLOR4_BASE},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280B0_CB_COLOR4_INFO},
- {0, 0, R_028070_CB_COLOR4_SIZE},
- {0, 0, R_028090_CB_COLOR4_VIEW},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280F0_CB_COLOR4_FRAG},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280D0_CB_COLOR4_TILE},
- {0, 0, R_028110_CB_COLOR4_MASK},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028054_CB_COLOR5_BASE},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280B4_CB_COLOR5_INFO},
- {0, 0, R_028074_CB_COLOR5_SIZE},
- {0, 0, R_028094_CB_COLOR5_VIEW},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280F4_CB_COLOR5_FRAG},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280D4_CB_COLOR5_TILE},
- {0, 0, R_028114_CB_COLOR5_MASK},
- {1, 0, R_028058_CB_COLOR6_BASE},
- {1, 0, R_0280B8_CB_COLOR6_INFO},
- {0, 0, R_028078_CB_COLOR6_SIZE},
- {0, 0, R_028098_CB_COLOR6_VIEW},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280F8_CB_COLOR6_FRAG},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280D8_CB_COLOR6_TILE},
- {0, 0, R_028118_CB_COLOR6_MASK},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_02805C_CB_COLOR7_BASE},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_0280BC_CB_COLOR7_INFO},
- {0, 0, R_02807C_CB_COLOR7_SIZE},
- {0, 0, R_02809C_CB_COLOR7_VIEW},
- {1, 0, R_0280FC_CB_COLOR7_FRAG},
- {1, 0, R_0280DC_CB_COLOR7_TILE},
- {0, 0, R_02811C_CB_COLOR7_MASK},
- {0, 0, R_028120_CB_CLEAR_RED},
- {0, 0, R_028124_CB_CLEAR_GREEN},
- {0, 0, R_028128_CB_CLEAR_BLUE},
- {0, 0, R_02812C_CB_CLEAR_ALPHA},
- {0, 0, R_02823C_CB_SHADER_MASK},
- {0, 0, R_028238_CB_TARGET_MASK},
- {0, 0, R_028410_SX_ALPHA_TEST_CONTROL},
- {0, 0, R_028414_CB_BLEND_RED},
- {0, 0, R_028418_CB_BLEND_GREEN},
- {0, 0, R_02841C_CB_BLEND_BLUE},
- {0, 0, R_028420_CB_BLEND_ALPHA},
- {0, 0, R_028424_CB_FOG_RED},
- {0, 0, R_028428_CB_FOG_GREEN},
- {0, 0, R_02842C_CB_FOG_BLUE},
- {0, 0, R_028430_DB_STENCILREFMASK},
- {0, 0, R_028434_DB_STENCILREFMASK_BF},
- {0, 0, R_028438_SX_ALPHA_REF},
- {0, 0, R_0286DC_SPI_FOG_CNTL},
- {0, 0, R_0286E0_SPI_FOG_FUNC_SCALE},
- {0, 0, R_0286E4_SPI_FOG_FUNC_BIAS},
- {0, 0, R_028780_CB_BLEND0_CONTROL},
- {0, 0, R_028784_CB_BLEND1_CONTROL},
- {0, 0, R_028788_CB_BLEND2_CONTROL},
- {0, 0, R_02878C_CB_BLEND3_CONTROL},
- {0, 0, R_028790_CB_BLEND4_CONTROL},
- {0, 0, R_028794_CB_BLEND5_CONTROL},
- {0, 0, R_028798_CB_BLEND6_CONTROL},
- {0, 0, R_02879C_CB_BLEND7_CONTROL},
- {0, 0, R_0287A0_CB_SHADER_CONTROL},
- {0, 0, R_028800_DB_DEPTH_CONTROL},
- {0, 0, R_028804_CB_BLEND_CONTROL},
- {0, 0, R_028808_CB_COLOR_CONTROL},
- {0, 0, R_02880C_DB_SHADER_CONTROL},
- {0, 0, R_028C04_PA_SC_AA_CONFIG},
- {0, 0, R_028C1C_PA_SC_AA_SAMPLE_LOCS_MCTX},
- {0, 0, R_028C20_PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX},
- {0, 0, R_028C30_CB_CLRCMP_CONTROL},
- {0, 0, R_028C34_CB_CLRCMP_SRC},
- {0, 0, R_028C38_CB_CLRCMP_DST},
- {0, 0, R_028C3C_CB_CLRCMP_MSK},
- {0, 0, R_028C48_PA_SC_AA_MASK},
- {0, 0, R_028D2C_DB_SRESULTS_COMPARE_STATE1},
- {0, 0, R_028D44_DB_ALPHA_TO_MASK},
- {1, 0, R_02800C_DB_DEPTH_BASE},
- {0, 0, R_028000_DB_DEPTH_SIZE},
- {0, 0, R_028004_DB_DEPTH_VIEW},
- {0, 0, GROUP_FORCE_NEW_BLOCK},
- {1, 0, R_028010_DB_DEPTH_INFO},
- {0, 0, R_028D0C_DB_RENDER_CONTROL},
- {0, 0, R_028D10_DB_RENDER_OVERRIDE},
- {0, 0, R_028D24_DB_HTILE_SURFACE},
- {0, 0, R_028D30_DB_PRELOAD_CONTROL},
- {0, 0, R_028D34_DB_PREFETCH_LIMIT},
- {0, 0, R_028030_PA_SC_SCREEN_SCISSOR_TL},
- {0, 0, R_028034_PA_SC_SCREEN_SCISSOR_BR},
- {0, 0, R_028200_PA_SC_WINDOW_OFFSET},
- {0, 0, R_028204_PA_SC_WINDOW_SCISSOR_TL},
- {0, 0, R_028208_PA_SC_WINDOW_SCISSOR_BR},
- {0, 0, R_02820C_PA_SC_CLIPRECT_RULE},
- {0, 0, R_028210_PA_SC_CLIPRECT_0_TL},
- {0, 0, R_028214_PA_SC_CLIPRECT_0_BR},
- {0, 0, R_028218_PA_SC_CLIPRECT_1_TL},
- {0, 0, R_02821C_PA_SC_CLIPRECT_1_BR},
- {0, 0, R_028220_PA_SC_CLIPRECT_2_TL},
- {0, 0, R_028224_PA_SC_CLIPRECT_2_BR},
- {0, 0, R_028228_PA_SC_CLIPRECT_3_TL},
- {0, 0, R_02822C_PA_SC_CLIPRECT_3_BR},
- {0, 0, R_028230_PA_SC_EDGERULE},
- {0, 0, R_028240_PA_SC_GENERIC_SCISSOR_TL},
- {0, 0, R_028244_PA_SC_GENERIC_SCISSOR_BR},
- {0, 0, R_028250_PA_SC_VPORT_SCISSOR_0_TL},
- {0, 0, R_028254_PA_SC_VPORT_SCISSOR_0_BR},
- {0, 0, R_0282D0_PA_SC_VPORT_ZMIN_0},
- {0, 0, R_0282D4_PA_SC_VPORT_ZMAX_0},
- {0, 0, R_02843C_PA_CL_VPORT_XSCALE_0},
- {0, 0, R_028440_PA_CL_VPORT_XOFFSET_0},
- {0, 0, R_028444_PA_CL_VPORT_YSCALE_0},
- {0, 0, R_028448_PA_CL_VPORT_YOFFSET_0},
- {0, 0, R_02844C_PA_CL_VPORT_ZSCALE_0},
- {0, 0, R_028450_PA_CL_VPORT_ZOFFSET_0},
- {0, 0, R_0286D4_SPI_INTERP_CONTROL_0},
- {0, 0, R_028810_PA_CL_CLIP_CNTL},
- {0, 0, R_028814_PA_SU_SC_MODE_CNTL},
- {0, 0, R_028818_PA_CL_VTE_CNTL},
- {0, 0, R_02881C_PA_CL_VS_OUT_CNTL},
- {0, 0, R_028820_PA_CL_NANINF_CNTL},
- {0, 0, R_028A00_PA_SU_POINT_SIZE},
- {0, 0, R_028A04_PA_SU_POINT_MINMAX},
- {0, 0, R_028A08_PA_SU_LINE_CNTL},
- {0, 0, R_028A0C_PA_SC_LINE_STIPPLE},
- {0, 0, R_028A48_PA_SC_MPASS_PS_CNTL},
- {0, 0, R_028C00_PA_SC_LINE_CNTL},
- {0, 0, R_028C0C_PA_CL_GB_VERT_CLIP_ADJ},
- {0, 0, R_028C10_PA_CL_GB_VERT_DISC_ADJ},
- {0, 0, R_028C14_PA_CL_GB_HORZ_CLIP_ADJ},
- {0, 0, R_028C18_PA_CL_GB_HORZ_DISC_ADJ},
- {0, 0, R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL},
- {0, 0, R_028DFC_PA_SU_POLY_OFFSET_CLAMP},
- {0, 0, R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE},
- {0, 0, R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET},
- {0, 0, R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE},
- {0, 0, R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET},
- {0, 0, R_028E20_PA_CL_UCP0_X},
- {0, 0, R_028E24_PA_CL_UCP0_Y},
- {0, 0, R_028E28_PA_CL_UCP0_Z},
- {0, 0, R_028E2C_PA_CL_UCP0_W},
- {0, 0, R_028E30_PA_CL_UCP1_X},
- {0, 0, R_028E34_PA_CL_UCP1_Y},
- {0, 0, R_028E38_PA_CL_UCP1_Z},
- {0, 0, R_028E3C_PA_CL_UCP1_W},
- {0, 0, R_028E40_PA_CL_UCP2_X},
- {0, 0, R_028E44_PA_CL_UCP2_Y},
- {0, 0, R_028E48_PA_CL_UCP2_Z},
- {0, 0, R_028E4C_PA_CL_UCP2_W},
- {0, 0, R_028E50_PA_CL_UCP3_X},
- {0, 0, R_028E54_PA_CL_UCP3_Y},
- {0, 0, R_028E58_PA_CL_UCP3_Z},
- {0, 0, R_028E5C_PA_CL_UCP3_W},
- {0, 0, R_028E60_PA_CL_UCP4_X},
- {0, 0, R_028E64_PA_CL_UCP4_Y},
- {0, 0, R_028E68_PA_CL_UCP4_Z},
- {0, 0, R_028E6C_PA_CL_UCP4_W},
- {0, 0, R_028E70_PA_CL_UCP5_X},
- {0, 0, R_028E74_PA_CL_UCP5_Y},
- {0, 0, R_028E78_PA_CL_UCP5_Z},
- {0, 0, R_028E7C_PA_CL_UCP5_W},
- {0, 0, R_028380_SQ_VTX_SEMANTIC_0},
- {0, 0, R_028384_SQ_VTX_SEMANTIC_1},
- {0, 0, R_028388_SQ_VTX_SEMANTIC_2},
- {0, 0, R_02838C_SQ_VTX_SEMANTIC_3},
- {0, 0, R_028390_SQ_VTX_SEMANTIC_4},
- {0, 0, R_028394_SQ_VTX_SEMANTIC_5},
- {0, 0, R_028398_SQ_VTX_SEMANTIC_6},
- {0, 0, R_02839C_SQ_VTX_SEMANTIC_7},
- {0, 0, R_0283A0_SQ_VTX_SEMANTIC_8},
- {0, 0, R_0283A4_SQ_VTX_SEMANTIC_9},
- {0, 0, R_0283A8_SQ_VTX_SEMANTIC_10},
- {0, 0, R_0283AC_SQ_VTX_SEMANTIC_11},
- {0, 0, R_0283B0_SQ_VTX_SEMANTIC_12},
- {0, 0, R_0283B4_SQ_VTX_SEMANTIC_13},
- {0, 0, R_0283B8_SQ_VTX_SEMANTIC_14},
- {0, 0, R_0283BC_SQ_VTX_SEMANTIC_15},
- {0, 0, R_0283C0_SQ_VTX_SEMANTIC_16},
- {0, 0, R_0283C4_SQ_VTX_SEMANTIC_17},
- {0, 0, R_0283C8_SQ_VTX_SEMANTIC_18},
- {0, 0, R_0283CC_SQ_VTX_SEMANTIC_19},
- {0, 0, R_0283D0_SQ_VTX_SEMANTIC_20},
- {0, 0, R_0283D4_SQ_VTX_SEMANTIC_21},
- {0, 0, R_0283D8_SQ_VTX_SEMANTIC_22},
- {0, 0, R_0283DC_SQ_VTX_SEMANTIC_23},
- {0, 0, R_0283E0_SQ_VTX_SEMANTIC_24},
- {0, 0, R_0283E4_SQ_VTX_SEMANTIC_25},
- {0, 0, R_0283E8_SQ_VTX_SEMANTIC_26},
- {0, 0, R_0283EC_SQ_VTX_SEMANTIC_27},
- {0, 0, R_0283F0_SQ_VTX_SEMANTIC_28},
- {0, 0, R_0283F4_SQ_VTX_SEMANTIC_29},
- {0, 0, R_0283F8_SQ_VTX_SEMANTIC_30},
- {0, 0, R_0283FC_SQ_VTX_SEMANTIC_31},
- {0, 0, R_028614_SPI_VS_OUT_ID_0},
- {0, 0, R_028618_SPI_VS_OUT_ID_1},
- {0, 0, R_02861C_SPI_VS_OUT_ID_2},
- {0, 0, R_028620_SPI_VS_OUT_ID_3},
- {0, 0, R_028624_SPI_VS_OUT_ID_4},
- {0, 0, R_028628_SPI_VS_OUT_ID_5},
- {0, 0, R_02862C_SPI_VS_OUT_ID_6},
- {0, 0, R_028630_SPI_VS_OUT_ID_7},
- {0, 0, R_028634_SPI_VS_OUT_ID_8},
- {0, 0, R_028638_SPI_VS_OUT_ID_9},
- {0, 0, R_0286C4_SPI_VS_OUT_CONFIG},
- {1, 0, R_028858_SQ_PGM_START_VS},
- {0, S_0085F0_SH_ACTION_ENA(1), R_028868_SQ_PGM_RESOURCES_VS},
- {1, 0, R_028894_SQ_PGM_START_FS},
- {0, S_0085F0_SH_ACTION_ENA(1), R_0288A4_SQ_PGM_RESOURCES_FS},
- {0, 0, R_0288D0_SQ_PGM_CF_OFFSET_VS},
- {0, 0, R_0288DC_SQ_PGM_CF_OFFSET_FS},
- {0, 0, R_028644_SPI_PS_INPUT_CNTL_0},
- {0, 0, R_028648_SPI_PS_INPUT_CNTL_1},
- {0, 0, R_02864C_SPI_PS_INPUT_CNTL_2},
- {0, 0, R_028650_SPI_PS_INPUT_CNTL_3},
- {0, 0, R_028654_SPI_PS_INPUT_CNTL_4},
- {0, 0, R_028658_SPI_PS_INPUT_CNTL_5},
- {0, 0, R_02865C_SPI_PS_INPUT_CNTL_6},
- {0, 0, R_028660_SPI_PS_INPUT_CNTL_7},
- {0, 0, R_028664_SPI_PS_INPUT_CNTL_8},
- {0, 0, R_028668_SPI_PS_INPUT_CNTL_9},
- {0, 0, R_02866C_SPI_PS_INPUT_CNTL_10},
- {0, 0, R_028670_SPI_PS_INPUT_CNTL_11},
- {0, 0, R_028674_SPI_PS_INPUT_CNTL_12},
- {0, 0, R_028678_SPI_PS_INPUT_CNTL_13},
- {0, 0, R_02867C_SPI_PS_INPUT_CNTL_14},
- {0, 0, R_028680_SPI_PS_INPUT_CNTL_15},
- {0, 0, R_028684_SPI_PS_INPUT_CNTL_16},
- {0, 0, R_028688_SPI_PS_INPUT_CNTL_17},
- {0, 0, R_02868C_SPI_PS_INPUT_CNTL_18},
- {0, 0, R_028690_SPI_PS_INPUT_CNTL_19},
- {0, 0, R_028694_SPI_PS_INPUT_CNTL_20},
- {0, 0, R_028698_SPI_PS_INPUT_CNTL_21},
- {0, 0, R_02869C_SPI_PS_INPUT_CNTL_22},
- {0, 0, R_0286A0_SPI_PS_INPUT_CNTL_23},
- {0, 0, R_0286A4_SPI_PS_INPUT_CNTL_24},
- {0, 0, R_0286A8_SPI_PS_INPUT_CNTL_25},
- {0, 0, R_0286AC_SPI_PS_INPUT_CNTL_26},
- {0, 0, R_0286B0_SPI_PS_INPUT_CNTL_27},
- {0, 0, R_0286B4_SPI_PS_INPUT_CNTL_28},
- {0, 0, R_0286B8_SPI_PS_INPUT_CNTL_29},
- {0, 0, R_0286BC_SPI_PS_INPUT_CNTL_30},
- {0, 0, R_0286C0_SPI_PS_INPUT_CNTL_31},
- {0, 0, R_0286CC_SPI_PS_IN_CONTROL_0},
- {0, 0, R_0286D0_SPI_PS_IN_CONTROL_1},
- {0, 0, R_0286D8_SPI_INPUT_Z},
- {1, S_0085F0_SH_ACTION_ENA(1), R_028840_SQ_PGM_START_PS},
- {0, 0, R_028850_SQ_PGM_RESOURCES_PS},
- {0, 0, R_028854_SQ_PGM_EXPORTS_PS},
- {0, 0, R_0288CC_SQ_PGM_CF_OFFSET_PS},
- {0, 0, R_028400_VGT_MAX_VTX_INDX},
- {0, 0, R_028404_VGT_MIN_VTX_INDX},
- {0, 0, R_028408_VGT_INDX_OFFSET},
- {0, 0, R_02840C_VGT_MULTI_PRIM_IB_RESET_INDX},
- {0, 0, R_028A84_VGT_PRIMITIVEID_EN},
- {0, 0, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN},
- {0, 0, R_028AA0_VGT_INSTANCE_STEP_RATE_0},
- {0, 0, R_028AA4_VGT_INSTANCE_STEP_RATE_1},
-};
-
-/* SHADER CONSTANT R600/R700 */
-static int r600_state_constant_init(struct r600_context *ctx, u32 offset)
-{
- struct r600_reg r600_shader_constant[] = {
- {0, 0, R_030000_SQ_ALU_CONSTANT0_0},
- {0, 0, R_030004_SQ_ALU_CONSTANT1_0},
- {0, 0, R_030008_SQ_ALU_CONSTANT2_0},
- {0, 0, R_03000C_SQ_ALU_CONSTANT3_0},
- };
- unsigned nreg = sizeof(r600_shader_constant)/sizeof(struct r600_reg);
-
- for (int i = 0; i < nreg; i++) {
- r600_shader_constant[i].offset += offset;
- }
- return r600_context_add_block(ctx, r600_shader_constant, nreg, PKT3_SET_ALU_CONST);
-}
-
-/* SHADER RESOURCE R600/R700 */
-static int r600_state_resource_init(struct r600_context *ctx, u32 offset)
-{
- struct r600_reg r600_shader_resource[] = {
- {0, 0, R_038000_RESOURCE0_WORD0},
- {0, 0, R_038004_RESOURCE0_WORD1},
- {1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), R_038008_RESOURCE0_WORD2},
- {1, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), R_03800C_RESOURCE0_WORD3},
- {0, 0, R_038010_RESOURCE0_WORD4},
- {0, 0, R_038014_RESOURCE0_WORD5},
- {0, 0, R_038018_RESOURCE0_WORD6},
- };
- unsigned nreg = sizeof(r600_shader_resource)/sizeof(struct r600_reg);
-
- for (int i = 0; i < nreg; i++) {
- r600_shader_resource[i].offset += offset;
- }
- return r600_context_add_block(ctx, r600_shader_resource, nreg, PKT3_SET_RESOURCE);
-}
-
-/* SHADER SAMPLER R600/R700 */
-static int r600_state_sampler_init(struct r600_context *ctx, u32 offset)
-{
- struct r600_reg r600_shader_sampler[] = {
- {0, 0, R_03C000_SQ_TEX_SAMPLER_WORD0_0},
- {0, 0, R_03C004_SQ_TEX_SAMPLER_WORD1_0},
- {0, 0, R_03C008_SQ_TEX_SAMPLER_WORD2_0},
- };
- unsigned nreg = sizeof(r600_shader_sampler)/sizeof(struct r600_reg);
-
- for (int i = 0; i < nreg; i++) {
- r600_shader_sampler[i].offset += offset;
- }
- return r600_context_add_block(ctx, r600_shader_sampler, nreg, PKT3_SET_SAMPLER);
-}
-
-/* SHADER SAMPLER BORDER R600/R700 */
-static int r600_state_sampler_border_init(struct r600_context *ctx, u32 offset)
-{
- struct r600_reg r600_shader_sampler_border[] = {
- {0, 0, R_00A400_TD_PS_SAMPLER0_BORDER_RED},
- {0, 0, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN},
- {0, 0, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE},
- {0, 0, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA},
- };
- unsigned nreg = sizeof(r600_shader_sampler_border)/sizeof(struct r600_reg);
-
- for (int i = 0; i < nreg; i++) {
- r600_shader_sampler_border[i].offset += offset;
- }
- return r600_context_add_block(ctx, r600_shader_sampler_border, nreg, PKT3_SET_CONFIG_REG);
-}
-
-/* initialize */
-void r600_context_fini(struct r600_context *ctx)
-{
- for (int i = 0; i < ctx->ngroups; i++) {
- r600_group_fini(&ctx->groups[i]);
- }
- free(ctx->reloc);
- free(ctx->pm4);
- memset(ctx, 0, sizeof(struct r600_context));
-}
-
-int r600_context_init(struct r600_context *ctx, struct radeon *radeon)
-{
- int r;
-
- memset(ctx, 0, sizeof(struct r600_context));
- ctx->radeon = radeon;
- LIST_INITHEAD(&ctx->query_list);
- /* initialize groups */
- r = r600_group_init(&ctx->groups[R600_GROUP_CONFIG], R600_CONFIG_REG_OFFSET, R600_CONFIG_REG_END);
- if (r) {
- goto out_err;
- }
- r = r600_group_init(&ctx->groups[R600_GROUP_CTL_CONST], R600_CTL_CONST_OFFSET, R600_CTL_CONST_END);
- if (r) {
- goto out_err;
- }
- r = r600_group_init(&ctx->groups[R600_GROUP_LOOP_CONST], R600_LOOP_CONST_OFFSET, R600_LOOP_CONST_END);
- if (r) {
- goto out_err;
- }
- r = r600_group_init(&ctx->groups[R600_GROUP_BOOL_CONST], R600_BOOL_CONST_OFFSET, R600_BOOL_CONST_END);
- if (r) {
- goto out_err;
- }
- r = r600_group_init(&ctx->groups[R600_GROUP_SAMPLER], R600_SAMPLER_OFFSET, R600_SAMPLER_END);
- if (r) {
- goto out_err;
- }
- r = r600_group_init(&ctx->groups[R600_GROUP_RESOURCE], R600_RESOURCE_OFFSET, R600_RESOURCE_END);
- if (r) {
- goto out_err;
- }
- r = r600_group_init(&ctx->groups[R600_GROUP_ALU_CONST], R600_ALU_CONST_OFFSET, R600_ALU_CONST_END);
- if (r) {
- goto out_err;
- }
- r = r600_group_init(&ctx->groups[R600_GROUP_CONTEXT], R600_CONTEXT_REG_OFFSET, R600_CONTEXT_REG_END);
- if (r) {
- goto out_err;
- }
- ctx->ngroups = R600_NGROUPS;
-
- /* add blocks */
- r = r600_context_add_block(ctx, r600_config_reg_list,
- sizeof(r600_config_reg_list)/sizeof(struct r600_reg),
- PKT3_SET_CONFIG_REG);
- if (r)
- goto out_err;
- r = r600_context_add_block(ctx, r600_context_reg_list,
- sizeof(r600_context_reg_list)/sizeof(struct r600_reg),
- PKT3_SET_CONTEXT_REG);
- if (r)
- goto out_err;
-
- /* PS SAMPLER BORDER */
- for (int j = 0, offset = 0; j < 18; j++, offset += 0x10) {
- r = r600_state_sampler_border_init(ctx, offset);
- if (r)
- goto out_err;
- }
-
- /* VS SAMPLER BORDER */
- for (int j = 0, offset = 0x200; j < 18; j++, offset += 0x10) {
- r = r600_state_sampler_border_init(ctx, offset);
- if (r)
- goto out_err;
- }
- /* PS SAMPLER */
- for (int j = 0, offset = 0; j < 18; j++, offset += 0xC) {
- r = r600_state_sampler_init(ctx, offset);
- if (r)
- goto out_err;
- }
- /* VS SAMPLER */
- for (int j = 0, offset = 0xD8; j < 18; j++, offset += 0xC) {
- r = r600_state_sampler_init(ctx, offset);
- if (r)
- goto out_err;
- }
- /* PS RESOURCE */
- for (int j = 0, offset = 0; j < 160; j++, offset += 0x1C) {
- r = r600_state_resource_init(ctx, offset);
- if (r)
- goto out_err;
- }
- /* VS RESOURCE */
- for (int j = 0, offset = 0x1180; j < 160; j++, offset += 0x1C) {
- r = r600_state_resource_init(ctx, offset);
- if (r)
- goto out_err;
- }
- /* PS CONSTANT */
- for (int j = 0, offset = 0; j < 256; j++, offset += 0x10) {
- r = r600_state_constant_init(ctx, offset);
- if (r)
- goto out_err;
- }
- /* VS CONSTANT */
- for (int j = 0, offset = 0x1000; j < 256; j++, offset += 0x10) {
- r = r600_state_constant_init(ctx, offset);
- if (r)
- goto out_err;
- }
-
- /* allocate cs variables */
- ctx->nreloc = RADEON_CTX_MAX_PM4;
- ctx->reloc = calloc(ctx->nreloc, sizeof(struct r600_reloc));
- if (ctx->reloc == NULL) {
- r = -ENOMEM;
- goto out_err;
- }
- ctx->bo = calloc(ctx->nreloc, sizeof(void *));
- if (ctx->bo == NULL) {
- r = -ENOMEM;
- goto out_err;
- }
- ctx->pm4_ndwords = RADEON_CTX_MAX_PM4;
- ctx->pm4 = calloc(ctx->pm4_ndwords, 4);
- if (ctx->pm4 == NULL) {
- r = -ENOMEM;
- goto out_err;
- }
- return 0;
-out_err:
- r600_context_fini(ctx);
- return r;
-}
-
-void r600_context_bo_reloc(struct r600_context *ctx, u32 *pm4, struct radeon_bo *bo)
-{
- int i, reloc_id;
-
- assert(bo != NULL);
- for (i = 0, reloc_id = -1; i < ctx->creloc; i++) {
- if (ctx->reloc[i].handle == bo->handle) {
- reloc_id = i * sizeof(struct r600_reloc) / 4;
- /* set PKT3 to point to proper reloc */
- *pm4 = reloc_id;
- }
- }
- if (reloc_id == -1) {
- /* add new relocation */
- if (ctx->creloc >= ctx->nreloc) {
- r600_context_flush(ctx);
- }
- reloc_id = ctx->creloc * sizeof(struct r600_reloc) / 4;
- ctx->reloc[ctx->creloc].handle = bo->handle;
- ctx->reloc[ctx->creloc].read_domain = RADEON_GEM_DOMAIN_GTT;
- ctx->reloc[ctx->creloc].write_domain = RADEON_GEM_DOMAIN_GTT;
- ctx->reloc[ctx->creloc].flags = 0;
- radeon_bo_reference(ctx->radeon, &ctx->bo[ctx->creloc], bo);
- ctx->creloc++;
- /* set PKT3 to point to proper reloc */
- *pm4 = reloc_id;
- }
-}
-
-void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_state *state)
-{
- struct r600_group *group;
- struct r600_group_block *block;
-
- for (int i = 0; i < state->nregs; i++) {
- unsigned id;
- group = &ctx->groups[state->regs[i].group_id];
- id = group->offset_block_id[(state->regs[i].offset - group->start_offset) >> 2];
- block = &group->blocks[id];
- id = (state->regs[i].offset - block->start_offset) >> 2;
- block->reg[id] &= ~state->regs[i].mask;
- block->reg[id] |= state->regs[i].value;
- if (block->pm4_bo_index[id]) {
- /* find relocation */
- id = block->pm4_bo_index[id];
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[id].bo, state->regs[i].bo);
- }
- block->status |= R600_BLOCK_STATUS_ENABLED;
- block->status |= R600_BLOCK_STATUS_DIRTY;
- ctx->pm4_dirty_cdwords += block->pm4_ndwords;
- }
-}
-
-static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
-{
- struct r600_group_block *block;
- unsigned id;
-
- offset -= ctx->groups[R600_GROUP_RESOURCE].start_offset;
- id = ctx->groups[R600_GROUP_RESOURCE].offset_block_id[offset >> 2];
- block = &ctx->groups[R600_GROUP_RESOURCE].blocks[id];
- if (state == NULL) {
- block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
- radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
- return;
- }
- block->reg[0] = state->regs[0].value;
- block->reg[1] = state->regs[1].value;
- block->reg[2] = state->regs[2].value;
- block->reg[3] = state->regs[3].value;
- block->reg[4] = state->regs[4].value;
- block->reg[5] = state->regs[5].value;
- block->reg[6] = state->regs[6].value;
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
- radeon_ws_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
- if (state->regs[0].bo) {
- /* VERTEX RESOURCE, we preted there is 2 bo to relocate so
- * we have single case btw VERTEX & TEXTURE resource
- */
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[0].bo);
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[0].bo);
- } else {
- /* TEXTURE RESOURCE */
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo);
- radeon_ws_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo);
- }
- block->status |= R600_BLOCK_STATUS_ENABLED;
- block->status |= R600_BLOCK_STATUS_DIRTY;
- ctx->pm4_dirty_cdwords += block->pm4_ndwords;
-}
-
-void r600_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
-{
- unsigned offset = R_038000_SQ_TEX_RESOURCE_WORD0_0 + 0x1C * rid;
-
- r600_context_pipe_state_set_resource(ctx, state, offset);
-}
-
-void r600_context_pipe_state_set_vs_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
-{
- unsigned offset = R_038000_SQ_TEX_RESOURCE_WORD0_0 + 0x1180 + 0x1C * rid;
-
- r600_context_pipe_state_set_resource(ctx, state, offset);
-}
-
-static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
-{
- struct r600_group_block *block;
- unsigned id;
-
- offset -= ctx->groups[R600_GROUP_SAMPLER].start_offset;
- id = ctx->groups[R600_GROUP_SAMPLER].offset_block_id[offset >> 2];
- block = &ctx->groups[R600_GROUP_SAMPLER].blocks[id];
- if (state == NULL) {
- block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
- return;
- }
- block->reg[0] = state->regs[0].value;
- block->reg[1] = state->regs[1].value;
- block->reg[2] = state->regs[2].value;
- block->status |= R600_BLOCK_STATUS_ENABLED;
- block->status |= R600_BLOCK_STATUS_DIRTY;
- ctx->pm4_dirty_cdwords += block->pm4_ndwords;
-}
-
-static inline void r600_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset)
-{
- struct r600_group_block *block;
- unsigned id;
-
- offset -= ctx->groups[R600_GROUP_CONFIG].start_offset;
- id = ctx->groups[R600_GROUP_CONFIG].offset_block_id[offset >> 2];
- block = &ctx->groups[R600_GROUP_CONFIG].blocks[id];
- if (state == NULL) {
- block->status &= ~(R600_BLOCK_STATUS_ENABLED | R600_BLOCK_STATUS_DIRTY);
- return;
- }
- if (state->nregs <= 3) {
- return;
- }
- block->reg[0] = state->regs[3].value;
- block->reg[1] = state->regs[4].value;
- block->reg[2] = state->regs[5].value;
- block->reg[3] = state->regs[6].value;
- block->status |= R600_BLOCK_STATUS_ENABLED;
- block->status |= R600_BLOCK_STATUS_DIRTY;
- ctx->pm4_dirty_cdwords += block->pm4_ndwords;
-}
-
-void r600_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id)
-{
- unsigned offset;
-
- offset = 0x0003C000 + id * 0xc;
- r600_context_pipe_state_set_sampler(ctx, state, offset);
- offset = 0x0000A400 + id * 0x10;
- r600_context_pipe_state_set_sampler_border(ctx, state, offset);
-}
-
-void r600_context_pipe_state_set_vs_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id)
-{
- unsigned offset;
-
- offset = 0x0003C0D8 + id * 0xc;
- r600_context_pipe_state_set_sampler(ctx, state, offset);
- offset = 0x0000A600 + id * 0x10;
- r600_context_pipe_state_set_sampler_border(ctx, state, offset);
-}
-
-void r600_context_group_emit_dirty(struct r600_context *ctx, struct r600_group *group)
-{
- struct radeon_bo *bo;
- int id;
-
- for (int i = 0; i < group->nblocks; i++) {
- struct r600_group_block *block = &group->blocks[i];
- if (block->status & R600_BLOCK_STATUS_DIRTY) {
- for (int j = 0; j < block->nreg; j++) {
- if (block->pm4_bo_index[j]) {
- /* find relocation */
- id = block->pm4_bo_index[j];
- bo = radeon_bo_pb_get_bo(block->reloc[id].bo->pb);
- for (int k = 0; k < block->reloc[id].nreloc; k++) {
- r600_context_bo_reloc(ctx, &block->pm4[block->reloc[id].bo_pm4_index[k]], bo);
- }
- }
- }
-
- memcpy(&ctx->pm4[ctx->pm4_cdwords], block->pm4, block->pm4_ndwords * 4);
- ctx->pm4_cdwords += block->pm4_ndwords;
- block->status ^= R600_BLOCK_STATUS_DIRTY;
- }
- }
-}
-
-struct radeon_bo *r600_context_reg_bo(struct r600_context *ctx, unsigned group_id, unsigned offset)
-{
- struct r600_group_block *block;
- unsigned id;
-
- id = ctx->groups[group_id].offset_block_id[(offset - ctx->groups[group_id].start_offset) >> 2];
- block = &ctx->groups[group_id].blocks[id];
- offset -= block->start_offset;
- id = block->pm4_bo_index[offset >> 2];
- if (block->reloc[id].bo) {
- return radeon_bo_pb_get_bo(block->reloc[id].bo->pb);
- }
- return NULL;
-}
-
-void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw)
-{
- struct radeon_bo *cb[8];
- unsigned ndwords = 9;
-
- if (draw->indices) {
- ndwords = 13;
- /* make sure there is enough relocation space before scheduling draw */
- if (ctx->creloc >= (ctx->nreloc - 1)) {
- r600_context_flush(ctx);
- }
- }
-
- /* find number of color buffer */
- for (int i = 0; i < 8; i++) {
- cb[i] = r600_context_reg_bo(ctx, R600_GROUP_CONTEXT, R_028040_CB_COLOR0_BASE + (i << 2));
- if (cb[i]) {
- ndwords += 7;
- }
- }
-
- /* queries need some special values */
- if (ctx->num_query_running) {
- if (ctx->radeon->family >= CHIP_RV770) {
- r600_context_reg(ctx, R600_GROUP_CONTEXT,
- R_028D0C_DB_RENDER_CONTROL,
- S_028D0C_R700_PERFECT_ZPASS_COUNTS(1),
- S_028D0C_R700_PERFECT_ZPASS_COUNTS(1));
- }
- r600_context_reg(ctx, R600_GROUP_CONTEXT,
- R_028D10_DB_RENDER_OVERRIDE,
- S_028D10_NOOP_CULL_DISABLE(1),
- S_028D10_NOOP_CULL_DISABLE(1));
- }
-
- if ((ctx->pm4_dirty_cdwords + ndwords + ctx->pm4_cdwords) > ctx->pm4_ndwords) {
- /* need to flush */
- r600_context_flush(ctx);
- }
- /* at that point everythings is flushed and ctx->pm4_cdwords = 0 */
- if ((ctx->pm4_dirty_cdwords + ndwords) > ctx->pm4_ndwords) {
- R600_ERR("context is too big to be scheduled\n");
- return;
- }
-
- /* enough room to copy packet */
- r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_CONFIG]);
- r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_CONTEXT]);
- r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_ALU_CONST]);
- r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_RESOURCE]);
- r600_context_group_emit_dirty(ctx, &ctx->groups[R600_GROUP_SAMPLER]);
-
- /* draw packet */
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_INDEX_TYPE, 0);
- ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_index_type;
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NUM_INSTANCES, 0);
- ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_instances;
- if (draw->indices) {
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX, 3);
- ctx->pm4[ctx->pm4_cdwords++] = draw->indices_bo_offset;
- ctx->pm4[ctx->pm4_cdwords++] = 0;
- ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices;
- ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator;
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
- ctx->pm4[ctx->pm4_cdwords++] = 0;
- r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(draw->indices->pb));
- } else {
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_DRAW_INDEX_AUTO, 1);
- ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_num_indices;
- ctx->pm4[ctx->pm4_cdwords++] = draw->vgt_draw_initiator;
- }
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 0);
- ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT;
-
- /* flush color buffer */
- for (int i = 0; i < 8; i++) {
- if (cb[i]) {
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_SURFACE_SYNC, 3);
- ctx->pm4[ctx->pm4_cdwords++] = (S_0085F0_CB0_DEST_BASE_ENA(1) << i) |
- S_0085F0_CB_ACTION_ENA(1);
- ctx->pm4[ctx->pm4_cdwords++] = (cb[i]->size + 255) >> 8;
- ctx->pm4[ctx->pm4_cdwords++] = 0x00000000;
- ctx->pm4[ctx->pm4_cdwords++] = 0x0000000A;
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
- ctx->pm4[ctx->pm4_cdwords++] = 0;
- r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], cb[i]);
- }
- }
-
- /* all dirty state have been scheduled in current cs */
- ctx->pm4_dirty_cdwords = 0;
-}
-
-void r600_context_flush(struct r600_context *ctx)
-{
- struct drm_radeon_cs drmib;
- struct drm_radeon_cs_chunk chunks[2];
- uint64_t chunk_array[2];
- struct r600_group_block *block;
- int r;
-
- if (!ctx->pm4_cdwords)
- return;
-
- /* suspend queries */
- r600_context_queries_suspend(ctx);
-
-#if 1
- /* emit cs */
- drmib.num_chunks = 2;
- drmib.chunks = (uint64_t)(uintptr_t)chunk_array;
- chunks[0].chunk_id = RADEON_CHUNK_ID_IB;
- chunks[0].length_dw = ctx->pm4_cdwords;
- chunks[0].chunk_data = (uint64_t)(uintptr_t)ctx->pm4;
- chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS;
- chunks[1].length_dw = ctx->creloc * sizeof(struct r600_reloc) / 4;
- chunks[1].chunk_data = (uint64_t)(uintptr_t)ctx->reloc;
- chunk_array[0] = (uint64_t)(uintptr_t)&chunks[0];
- chunk_array[1] = (uint64_t)(uintptr_t)&chunks[1];
- r = drmCommandWriteRead(ctx->radeon->fd, DRM_RADEON_CS, &drmib,
- sizeof(struct drm_radeon_cs));
-#endif
- /* restart */
- for (int i = 0; i < ctx->creloc; i++) {
- radeon_bo_reference(ctx->radeon, &ctx->bo[i], NULL);
- }
- ctx->creloc = 0;
- ctx->pm4_dirty_cdwords = 0;
- ctx->pm4_cdwords = 0;
-
- /* resume queries */
- r600_context_queries_resume(ctx);
-
- /* set all valid group as dirty so they get reemited on
- * next draw command
- */
- for (int i = 0; i < ctx->ngroups; i++) {
- for (int j = 0; j < ctx->groups[i].nblocks; j++) {
- /* mark enabled block as dirty */
- block = &ctx->groups[i].blocks[j];
- if (block->status & R600_BLOCK_STATUS_ENABLED) {
- ctx->pm4_dirty_cdwords += block->pm4_ndwords;
- block->status |= R600_BLOCK_STATUS_DIRTY;
- }
- }
- }
-}
-
-void r600_context_dump_bof(struct r600_context *ctx, const char *file)
-{
- bof_t *bcs, *blob, *array, *bo, *size, *handle, *device_id, *root;
- unsigned i;
-
- root = device_id = bcs = blob = array = bo = size = handle = NULL;
- root = bof_object();
- if (root == NULL)
- goto out_err;
- device_id = bof_int32(ctx->radeon->device);
- if (device_id == NULL)
- goto out_err;
- if (bof_object_set(root, "device_id", device_id))
- goto out_err;
- bof_decref(device_id);
- device_id = NULL;
- /* dump relocs */
- blob = bof_blob(ctx->creloc * 16, ctx->reloc);
- if (blob == NULL)
- goto out_err;
- if (bof_object_set(root, "reloc", blob))
- goto out_err;
- bof_decref(blob);
- blob = NULL;
- /* dump cs */
- blob = bof_blob(ctx->pm4_cdwords * 4, ctx->pm4);
- if (blob == NULL)
- goto out_err;
- if (bof_object_set(root, "pm4", blob))
- goto out_err;
- bof_decref(blob);
- blob = NULL;
- /* dump bo */
- array = bof_array();
- if (array == NULL)
- goto out_err;
- for (i = 0; i < ctx->creloc; i++) {
- struct radeon_bo *rbo = ctx->bo[i];
- bo = bof_object();
- if (bo == NULL)
- goto out_err;
- size = bof_int32(rbo->size);
- if (size == NULL)
- goto out_err;
- if (bof_object_set(bo, "size", size))
- goto out_err;
- bof_decref(size);
- size = NULL;
- handle = bof_int32(rbo->handle);
- if (handle == NULL)
- goto out_err;
- if (bof_object_set(bo, "handle", handle))
- goto out_err;
- bof_decref(handle);
- handle = NULL;
- radeon_bo_map(ctx->radeon, rbo);
- blob = bof_blob(rbo->size, rbo->data);
- radeon_bo_unmap(ctx->radeon, rbo);
- if (blob == NULL)
- goto out_err;
- if (bof_object_set(bo, "data", blob))
- goto out_err;
- bof_decref(blob);
- blob = NULL;
- if (bof_array_append(array, bo))
- goto out_err;
- bof_decref(bo);
- bo = NULL;
- }
- if (bof_object_set(root, "bo", array))
- goto out_err;
- bof_dump_file(root, file);
-out_err:
- bof_decref(blob);
- bof_decref(array);
- bof_decref(bo);
- bof_decref(size);
- bof_decref(handle);
- bof_decref(device_id);
- bof_decref(root);
-}
-
-static void r600_query_result(struct r600_context *ctx, struct r600_query *query)
-{
- u64 start, end;
- u32 *results;
- int i;
-
- results = radeon_ws_bo_map(ctx->radeon, query->buffer, 0, NULL);
- for (i = 0; i < query->num_results; i += 4) {
- start = (u64)results[i] | (u64)results[i + 1] << 32;
- end = (u64)results[i + 2] | (u64)results[i + 3] << 32;
- if ((start & 0x8000000000000000UL) && (end & 0x8000000000000000UL)) {
- query->result += end - start;
- }
- }
- radeon_ws_bo_unmap(ctx->radeon, query->buffer);
- query->num_results = 0;
-}
-
-void r600_query_begin(struct r600_context *ctx, struct r600_query *query)
-{
- /* query request needs 6 dwords for begin + 6 dwords for end */
- if ((12 + ctx->pm4_cdwords) > ctx->pm4_ndwords) {
- /* need to flush */
- r600_context_flush(ctx);
- }
-
- /* if query buffer is full force a flush */
- if (query->num_results >= ((query->buffer_size >> 2) - 2)) {
- r600_context_flush(ctx);
- r600_query_result(ctx, query);
- }
-
- /* emit begin query */
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2);
- ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE;
- ctx->pm4[ctx->pm4_cdwords++] = query->num_results;
- ctx->pm4[ctx->pm4_cdwords++] = 0;
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
- ctx->pm4[ctx->pm4_cdwords++] = 0;
- r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(query->buffer->pb));
-
- query->state |= R600_QUERY_STATE_STARTED;
- query->state ^= R600_QUERY_STATE_ENDED;
- ctx->num_query_running++;
-}
-
-void r600_query_end(struct r600_context *ctx, struct r600_query *query)
-{
- /* emit begin query */
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 2);
- ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE_ZPASS_DONE;
- ctx->pm4[ctx->pm4_cdwords++] = query->num_results + 8;
- ctx->pm4[ctx->pm4_cdwords++] = 0;
- ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0);
- ctx->pm4[ctx->pm4_cdwords++] = 0;
- r600_context_bo_reloc(ctx, &ctx->pm4[ctx->pm4_cdwords - 1], radeon_bo_pb_get_bo(query->buffer->pb));
-
- query->num_results += 16;
- query->state ^= R600_QUERY_STATE_STARTED;
- query->state |= R600_QUERY_STATE_ENDED;
- ctx->num_query_running--;
-}
-
-struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned query_type)
-{
- struct r600_query *query;
-
- if (query_type != PIPE_QUERY_OCCLUSION_COUNTER)
- return NULL;
-
- query = calloc(1, sizeof(struct r600_query));
- if (query == NULL)
- return NULL;
-
- query->type = query_type;
- query->buffer_size = 4096;
-
- query->buffer = radeon_ws_bo(ctx->radeon, query->buffer_size, 1, 0);
- if (!query->buffer) {
- free(query);
- return NULL;
- }
-
- LIST_ADDTAIL(&query->list, &ctx->query_list);
-
- return query;
-}
-
-void r600_context_query_destroy(struct r600_context *ctx, struct r600_query *query)
-{
- radeon_ws_bo_reference(ctx->radeon, &query->buffer, NULL);
- LIST_DEL(&query->list);
- free(query);
-}
-
-boolean r600_context_query_result(struct r600_context *ctx,
- struct r600_query *query,
- boolean wait, void *vresult)
-{
- uint64_t *result = (uint64_t*)vresult;
-
- if (query->num_results) {
- r600_context_flush(ctx);
- }
- r600_query_result(ctx, query);
- *result = query->result;
- query->result = 0;
- return TRUE;
-}
-
-static void r600_context_queries_suspend(struct r600_context *ctx)
-{
- struct r600_query *query;
-
- LIST_FOR_EACH_ENTRY(query, &ctx->query_list, list) {
- if (query->state & R600_QUERY_STATE_STARTED) {
- r600_query_end(ctx, query);
- query->state |= R600_QUERY_STATE_SUSPENDED;
- }
- }
-}
-
-static void r600_context_queries_resume(struct r600_context *ctx)
-{
- struct r600_query *query;
-
- LIST_FOR_EACH_ENTRY(query, &ctx->query_list, list) {
- if (query->state & R600_QUERY_STATE_SUSPENDED) {
- r600_query_begin(ctx, query);
- query->state ^= R600_QUERY_STATE_SUSPENDED;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright © 2009 Jerome Glisse <glisse@freedesktop.org>
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-#ifndef R600_STATES_H
-#define R600_STATES_H
-
-static const struct radeon_register R600_names_CONFIG[] = {
- {0x00008C00, 0, 0, "SQ_CONFIG"},
- {0x00008C04, 0, 0, "SQ_GPR_RESOURCE_MGMT_1"},
- {0x00008C08, 0, 0, "SQ_GPR_RESOURCE_MGMT_2"},
- {0x00008C0C, 0, 0, "SQ_THREAD_RESOURCE_MGMT"},
- {0x00008C10, 0, 0, "SQ_STACK_RESOURCE_MGMT_1"},
- {0x00008C14, 0, 0, "SQ_STACK_RESOURCE_MGMT_2"},
- {0x00008D8C, 0, 0, "SQ_DYN_GPR_CNTL_PS_FLUSH_REQ"},
- {0x00009508, 0, 0, "TA_CNTL_AUX"},
- {0x00009714, 0, 0, "VC_ENHANCE"},
- {0x00009830, 0, 0, "DB_DEBUG"},
- {0x00009838, 0, 0, "DB_WATERMARKS"},
- {0x00028350, 0, 0, "SX_MISC"},
- {0x000286C8, 0, 0, "SPI_THREAD_GROUPING"},
- {0x000288A8, 0, 0, "SQ_ESGS_RING_ITEMSIZE"},
- {0x000288AC, 0, 0, "SQ_GSVS_RING_ITEMSIZE"},
- {0x000288B0, 0, 0, "SQ_ESTMP_RING_ITEMSIZE"},
- {0x000288B4, 0, 0, "SQ_GSTMP_RING_ITEMSIZE"},
- {0x000288B8, 0, 0, "SQ_VSTMP_RING_ITEMSIZE"},
- {0x000288BC, 0, 0, "SQ_PSTMP_RING_ITEMSIZE"},
- {0x000288C0, 0, 0, "SQ_FBUF_RING_ITEMSIZE"},
- {0x000288C4, 0, 0, "SQ_REDUC_RING_ITEMSIZE"},
- {0x000288C8, 0, 0, "SQ_GS_VERT_ITEMSIZE"},
- {0x00028A10, 0, 0, "VGT_OUTPUT_PATH_CNTL"},
- {0x00028A14, 0, 0, "VGT_HOS_CNTL"},
- {0x00028A18, 0, 0, "VGT_HOS_MAX_TESS_LEVEL"},
- {0x00028A1C, 0, 0, "VGT_HOS_MIN_TESS_LEVEL"},
- {0x00028A20, 0, 0, "VGT_HOS_REUSE_DEPTH"},
- {0x00028A24, 0, 0, "VGT_GROUP_PRIM_TYPE"},
- {0x00028A28, 0, 0, "VGT_GROUP_FIRST_DECR"},
- {0x00028A2C, 0, 0, "VGT_GROUP_DECR"},
- {0x00028A30, 0, 0, "VGT_GROUP_VECT_0_CNTL"},
- {0x00028A34, 0, 0, "VGT_GROUP_VECT_1_CNTL"},
- {0x00028A38, 0, 0, "VGT_GROUP_VECT_0_FMT_CNTL"},
- {0x00028A3C, 0, 0, "VGT_GROUP_VECT_1_FMT_CNTL"},
- {0x00028A40, 0, 0, "VGT_GS_MODE"},
- {0x00028A4C, 0, 0, "PA_SC_MODE_CNTL"},
- {0x00028AB0, 0, 0, "VGT_STRMOUT_EN"},
- {0x00028AB4, 0, 0, "VGT_REUSE_OFF"},
- {0x00028AB8, 0, 0, "VGT_VTX_CNT_EN"},
- {0x00028B20, 0, 0, "VGT_STRMOUT_BUFFER_EN"},
-};
-
-static const struct radeon_register R600_names_CB_CNTL[] = {
- {0x00028120, 0, 0, "CB_CLEAR_RED"},
- {0x00028124, 0, 0, "CB_CLEAR_GREEN"},
- {0x00028128, 0, 0, "CB_CLEAR_BLUE"},
- {0x0002812C, 0, 0, "CB_CLEAR_ALPHA"},
- {0x0002823C, 0, 0, "CB_SHADER_MASK"},
- {0x00028238, 0, 0, "CB_TARGET_MASK"},
- {0x00028424, 0, 0, "CB_FOG_RED"},
- {0x00028428, 0, 0, "CB_FOG_GREEN"},
- {0x0002842C, 0, 0, "CB_FOG_BLUE"},
- {0x00028808, 0, 0, "CB_COLOR_CONTROL"},
- {0x00028C04, 0, 0, "PA_SC_AA_CONFIG"},
- {0x00028C1C, 0, 0, "PA_SC_AA_SAMPLE_LOCS_MCTX"},
- {0x00028C20, 0, 0, "PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX"},
- {0x00028C30, 0, 0, "CB_CLRCMP_CONTROL"},
- {0x00028C34, 0, 0, "CB_CLRCMP_SRC"},
- {0x00028C38, 0, 0, "CB_CLRCMP_DST"},
- {0x00028C3C, 0, 0, "CB_CLRCMP_MSK"},
- {0x00028C48, 0, 0, "PA_SC_AA_MASK"},
- {0x000287A0, 0, 0, "CB_SHADER_CONTROL"},
-};
-
-static const struct radeon_register R600_names_RASTERIZER[] = {
- {0x000286D4, 0, 0, "SPI_INTERP_CONTROL_0"},
- {0x00028810, 0, 0, "PA_CL_CLIP_CNTL"},
- {0x00028814, 0, 0, "PA_SU_SC_MODE_CNTL"},
- {0x0002881C, 0, 0, "PA_CL_VS_OUT_CNTL"},
- {0x00028820, 0, 0, "PA_CL_NANINF_CNTL"},
- {0x00028A00, 0, 0, "PA_SU_POINT_SIZE"},
- {0x00028A04, 0, 0, "PA_SU_POINT_MINMAX"},
- {0x00028A08, 0, 0, "PA_SU_LINE_CNTL"},
- {0x00028A0C, 0, 0, "PA_SC_LINE_STIPPLE"},
- {0x00028A48, 0, 0, "PA_SC_MPASS_PS_CNTL"},
- {0x00028C00, 0, 0, "PA_SC_LINE_CNTL"},
- {0x00028C0C, 0, 0, "PA_CL_GB_VERT_CLIP_ADJ"},
- {0x00028C10, 0, 0, "PA_CL_GB_VERT_DISC_ADJ"},
- {0x00028C14, 0, 0, "PA_CL_GB_HORZ_CLIP_ADJ"},
- {0x00028C18, 0, 0, "PA_CL_GB_HORZ_DISC_ADJ"},
- {0x00028DF8, 0, 0, "PA_SU_POLY_OFFSET_DB_FMT_CNTL"},
- {0x00028DFC, 0, 0, "PA_SU_POLY_OFFSET_CLAMP"},
- {0x00028E00, 0, 0, "PA_SU_POLY_OFFSET_FRONT_SCALE"},
- {0x00028E04, 0, 0, "PA_SU_POLY_OFFSET_FRONT_OFFSET"},
- {0x00028E08, 0, 0, "PA_SU_POLY_OFFSET_BACK_SCALE"},
- {0x00028E0C, 0, 0, "PA_SU_POLY_OFFSET_BACK_OFFSET"},
-};
-
-static const struct radeon_register R600_names_VIEWPORT[] = {
- {0x000282D0, 0, 0, "PA_SC_VPORT_ZMIN_0"},
- {0x000282D4, 0, 0, "PA_SC_VPORT_ZMAX_0"},
- {0x0002843C, 0, 0, "PA_CL_VPORT_XSCALE_0"},
- {0x00028444, 0, 0, "PA_CL_VPORT_YSCALE_0"},
- {0x0002844C, 0, 0, "PA_CL_VPORT_ZSCALE_0"},
- {0x00028440, 0, 0, "PA_CL_VPORT_XOFFSET_0"},
- {0x00028448, 0, 0, "PA_CL_VPORT_YOFFSET_0"},
- {0x00028450, 0, 0, "PA_CL_VPORT_ZOFFSET_0"},
- {0x00028818, 0, 0, "PA_CL_VTE_CNTL"},
-};
-
-static const struct radeon_register R600_names_SCISSOR[] = {
- {0x00028030, 0, 0, "PA_SC_SCREEN_SCISSOR_TL"},
- {0x00028034, 0, 0, "PA_SC_SCREEN_SCISSOR_BR"},
- {0x00028200, 0, 0, "PA_SC_WINDOW_OFFSET"},
- {0x00028204, 0, 0, "PA_SC_WINDOW_SCISSOR_TL"},
- {0x00028208, 0, 0, "PA_SC_WINDOW_SCISSOR_BR"},
- {0x0002820C, 0, 0, "PA_SC_CLIPRECT_RULE"},
- {0x00028210, 0, 0, "PA_SC_CLIPRECT_0_TL"},
- {0x00028214, 0, 0, "PA_SC_CLIPRECT_0_BR"},
- {0x00028218, 0, 0, "PA_SC_CLIPRECT_1_TL"},
- {0x0002821C, 0, 0, "PA_SC_CLIPRECT_1_BR"},
- {0x00028220, 0, 0, "PA_SC_CLIPRECT_2_TL"},
- {0x00028224, 0, 0, "PA_SC_CLIPRECT_2_BR"},
- {0x00028228, 0, 0, "PA_SC_CLIPRECT_3_TL"},
- {0x0002822C, 0, 0, "PA_SC_CLIPRECT_3_BR"},
- {0x00028230, 0, 0, "PA_SC_EDGERULE"},
- {0x00028240, 0, 0, "PA_SC_GENERIC_SCISSOR_TL"},
- {0x00028244, 0, 0, "PA_SC_GENERIC_SCISSOR_BR"},
- {0x00028250, 0, 0, "PA_SC_VPORT_SCISSOR_0_TL"},
- {0x00028254, 0, 0, "PA_SC_VPORT_SCISSOR_0_BR"},
-};
-
-static const struct radeon_register R600_names_BLEND[] = {
- {0x00028414, 0, 0, "CB_BLEND_RED"},
- {0x00028418, 0, 0, "CB_BLEND_GREEN"},
- {0x0002841C, 0, 0, "CB_BLEND_BLUE"},
- {0x00028420, 0, 0, "CB_BLEND_ALPHA"},
- {0x00028780, 0, 0, "CB_BLEND0_CONTROL"},
- {0x00028784, 0, 0, "CB_BLEND1_CONTROL"},
- {0x00028788, 0, 0, "CB_BLEND2_CONTROL"},
- {0x0002878C, 0, 0, "CB_BLEND3_CONTROL"},
- {0x00028790, 0, 0, "CB_BLEND4_CONTROL"},
- {0x00028794, 0, 0, "CB_BLEND5_CONTROL"},
- {0x00028798, 0, 0, "CB_BLEND6_CONTROL"},
- {0x0002879C, 0, 0, "CB_BLEND7_CONTROL"},
- {0x00028804, 0, 0, "CB_BLEND_CONTROL"},
-};
-
-static const struct radeon_register R600_names_DSA[] = {
- {0x00028028, 0, 0, "DB_STENCIL_CLEAR"},
- {0x0002802C, 0, 0, "DB_DEPTH_CLEAR"},
- {0x00028410, 0, 0, "SX_ALPHA_TEST_CONTROL"},
- {0x00028430, 0, 0, "DB_STENCILREFMASK"},
- {0x00028434, 0, 0, "DB_STENCILREFMASK_BF"},
- {0x00028438, 0, 0, "SX_ALPHA_REF"},
- {0x000286E0, 0, 0, "SPI_FOG_FUNC_SCALE"},
- {0x000286E4, 0, 0, "SPI_FOG_FUNC_BIAS"},
- {0x000286DC, 0, 0, "SPI_FOG_CNTL"},
- {0x00028800, 0, 0, "DB_DEPTH_CONTROL"},
- {0x0002880C, 0, 0, "DB_SHADER_CONTROL"},
- {0x00028D0C, 0, 0, "DB_RENDER_CONTROL"},
- {0x00028D10, 0, 0, "DB_RENDER_OVERRIDE"},
- {0x00028D2C, 0, 0, "DB_SRESULTS_COMPARE_STATE1"},
- {0x00028D30, 0, 0, "DB_PRELOAD_CONTROL"},
- {0x00028D44, 0, 0, "DB_ALPHA_TO_MASK"},
-};
-
-static const struct radeon_register R600_names_VS_SHADER[] = {
- {0x00028380, 0, 0, "SQ_VTX_SEMANTIC_0"},
- {0x00028384, 0, 0, "SQ_VTX_SEMANTIC_1"},
- {0x00028388, 0, 0, "SQ_VTX_SEMANTIC_2"},
- {0x0002838C, 0, 0, "SQ_VTX_SEMANTIC_3"},
- {0x00028390, 0, 0, "SQ_VTX_SEMANTIC_4"},
- {0x00028394, 0, 0, "SQ_VTX_SEMANTIC_5"},
- {0x00028398, 0, 0, "SQ_VTX_SEMANTIC_6"},
- {0x0002839C, 0, 0, "SQ_VTX_SEMANTIC_7"},
- {0x000283A0, 0, 0, "SQ_VTX_SEMANTIC_8"},
- {0x000283A4, 0, 0, "SQ_VTX_SEMANTIC_9"},
- {0x000283A8, 0, 0, "SQ_VTX_SEMANTIC_10"},
- {0x000283AC, 0, 0, "SQ_VTX_SEMANTIC_11"},
- {0x000283B0, 0, 0, "SQ_VTX_SEMANTIC_12"},
- {0x000283B4, 0, 0, "SQ_VTX_SEMANTIC_13"},
- {0x000283B8, 0, 0, "SQ_VTX_SEMANTIC_14"},
- {0x000283BC, 0, 0, "SQ_VTX_SEMANTIC_15"},
- {0x000283C0, 0, 0, "SQ_VTX_SEMANTIC_16"},
- {0x000283C4, 0, 0, "SQ_VTX_SEMANTIC_17"},
- {0x000283C8, 0, 0, "SQ_VTX_SEMANTIC_18"},
- {0x000283CC, 0, 0, "SQ_VTX_SEMANTIC_19"},
- {0x000283D0, 0, 0, "SQ_VTX_SEMANTIC_20"},
- {0x000283D4, 0, 0, "SQ_VTX_SEMANTIC_21"},
- {0x000283D8, 0, 0, "SQ_VTX_SEMANTIC_22"},
- {0x000283DC, 0, 0, "SQ_VTX_SEMANTIC_23"},
- {0x000283E0, 0, 0, "SQ_VTX_SEMANTIC_24"},
- {0x000283E4, 0, 0, "SQ_VTX_SEMANTIC_25"},
- {0x000283E8, 0, 0, "SQ_VTX_SEMANTIC_26"},
- {0x000283EC, 0, 0, "SQ_VTX_SEMANTIC_27"},
- {0x000283F0, 0, 0, "SQ_VTX_SEMANTIC_28"},
- {0x000283F4, 0, 0, "SQ_VTX_SEMANTIC_29"},
- {0x000283F8, 0, 0, "SQ_VTX_SEMANTIC_30"},
- {0x000283FC, 0, 0, "SQ_VTX_SEMANTIC_31"},
- {0x00028614, 0, 0, "SPI_VS_OUT_ID_0"},
- {0x00028618, 0, 0, "SPI_VS_OUT_ID_1"},
- {0x0002861C, 0, 0, "SPI_VS_OUT_ID_2"},
- {0x00028620, 0, 0, "SPI_VS_OUT_ID_3"},
- {0x00028624, 0, 0, "SPI_VS_OUT_ID_4"},
- {0x00028628, 0, 0, "SPI_VS_OUT_ID_5"},
- {0x0002862C, 0, 0, "SPI_VS_OUT_ID_6"},
- {0x00028630, 0, 0, "SPI_VS_OUT_ID_7"},
- {0x00028634, 0, 0, "SPI_VS_OUT_ID_8"},
- {0x00028638, 0, 0, "SPI_VS_OUT_ID_9"},
- {0x000286C4, 0, 0, "SPI_VS_OUT_CONFIG"},
- {0x00028858, 1, 0, "SQ_PGM_START_VS"},
- {0x00028868, 0, 0, "SQ_PGM_RESOURCES_VS"},
- {0x00028894, 1, 1, "SQ_PGM_START_FS"},
- {0x000288A4, 0, 0, "SQ_PGM_RESOURCES_FS"},
- {0x000288D0, 0, 0, "SQ_PGM_CF_OFFSET_VS"},
- {0x000288DC, 0, 0, "SQ_PGM_CF_OFFSET_FS"},
-};
-
-static const struct radeon_register R600_names_PS_SHADER[] = {
- {0x00028644, 0, 0, "SPI_PS_INPUT_CNTL_0"},
- {0x00028648, 0, 0, "SPI_PS_INPUT_CNTL_1"},
- {0x0002864C, 0, 0, "SPI_PS_INPUT_CNTL_2"},
- {0x00028650, 0, 0, "SPI_PS_INPUT_CNTL_3"},
- {0x00028654, 0, 0, "SPI_PS_INPUT_CNTL_4"},
- {0x00028658, 0, 0, "SPI_PS_INPUT_CNTL_5"},
- {0x0002865C, 0, 0, "SPI_PS_INPUT_CNTL_6"},
- {0x00028660, 0, 0, "SPI_PS_INPUT_CNTL_7"},
- {0x00028664, 0, 0, "SPI_PS_INPUT_CNTL_8"},
- {0x00028668, 0, 0, "SPI_PS_INPUT_CNTL_9"},
- {0x0002866C, 0, 0, "SPI_PS_INPUT_CNTL_10"},
- {0x00028670, 0, 0, "SPI_PS_INPUT_CNTL_11"},
- {0x00028674, 0, 0, "SPI_PS_INPUT_CNTL_12"},
- {0x00028678, 0, 0, "SPI_PS_INPUT_CNTL_13"},
- {0x0002867C, 0, 0, "SPI_PS_INPUT_CNTL_14"},
- {0x00028680, 0, 0, "SPI_PS_INPUT_CNTL_15"},
- {0x00028684, 0, 0, "SPI_PS_INPUT_CNTL_16"},
- {0x00028688, 0, 0, "SPI_PS_INPUT_CNTL_17"},
- {0x0002868C, 0, 0, "SPI_PS_INPUT_CNTL_18"},
- {0x00028690, 0, 0, "SPI_PS_INPUT_CNTL_19"},
- {0x00028694, 0, 0, "SPI_PS_INPUT_CNTL_20"},
- {0x00028698, 0, 0, "SPI_PS_INPUT_CNTL_21"},
- {0x0002869C, 0, 0, "SPI_PS_INPUT_CNTL_22"},
- {0x000286A0, 0, 0, "SPI_PS_INPUT_CNTL_23"},
- {0x000286A4, 0, 0, "SPI_PS_INPUT_CNTL_24"},
- {0x000286A8, 0, 0, "SPI_PS_INPUT_CNTL_25"},
- {0x000286AC, 0, 0, "SPI_PS_INPUT_CNTL_26"},
- {0x000286B0, 0, 0, "SPI_PS_INPUT_CNTL_27"},
- {0x000286B4, 0, 0, "SPI_PS_INPUT_CNTL_28"},
- {0x000286B8, 0, 0, "SPI_PS_INPUT_CNTL_29"},
- {0x000286BC, 0, 0, "SPI_PS_INPUT_CNTL_30"},
- {0x000286C0, 0, 0, "SPI_PS_INPUT_CNTL_31"},
- {0x000286CC, 0, 0, "SPI_PS_IN_CONTROL_0"},
- {0x000286D0, 0, 0, "SPI_PS_IN_CONTROL_1"},
- {0x000286D8, 0, 0, "SPI_INPUT_Z"},
- {0x00028840, 1, 0, "SQ_PGM_START_PS"},
- {0x00028850, 0, 0, "SQ_PGM_RESOURCES_PS"},
- {0x00028854, 0, 0, "SQ_PGM_EXPORTS_PS"},
- {0x000288CC, 0, 0, "SQ_PGM_CF_OFFSET_PS"},
-};
-
-static const struct radeon_register R600_names_VS_CBUF[] = {
- {0x00028180, 0, 0, "ALU_CONST_BUFFER_SIZE_VS_0"},
- {0x00028980, 1, 0, "ALU_CONST_CACHE_VS_0"},
-};
-
-static const struct radeon_register R600_names_PS_CBUF[] = {
- {0x00028140, 0, 0, "ALU_CONST_BUFFER_SIZE_PS_0"},
- {0x00028940, 1, 0, "ALU_CONST_CACHE_PS_0"},
-};
-
-static const struct radeon_register R600_names_PS_CONSTANT[] = {
- {0x00030000, 0, 0, "SQ_ALU_CONSTANT0_0"},
- {0x00030004, 0, 0, "SQ_ALU_CONSTANT1_0"},
- {0x00030008, 0, 0, "SQ_ALU_CONSTANT2_0"},
- {0x0003000C, 0, 0, "SQ_ALU_CONSTANT3_0"},
-};
-
-static const struct radeon_register R600_names_VS_CONSTANT[] = {
- {0x00031000, 0, 0, "SQ_ALU_CONSTANT0_256"},
- {0x00031004, 0, 0, "SQ_ALU_CONSTANT1_256"},
- {0x00031008, 0, 0, "SQ_ALU_CONSTANT2_256"},
- {0x0003100C, 0, 0, "SQ_ALU_CONSTANT3_256"},
-};
-
-static const struct radeon_register R600_names_UCP[] = {
- {0x00028E20, 0, 0, "PA_CL_UCP0_X"},
- {0x00028E24, 0, 0, "PA_CL_UCP0_Y"},
- {0x00028E28, 0, 0, "PA_CL_UCP0_Z"},
- {0x00028E2C, 0, 0, "PA_CL_UCP0_W"},
- {0x00028E30, 0, 0, "PA_CL_UCP1_X"},
- {0x00028E34, 0, 0, "PA_CL_UCP1_Y"},
- {0x00028E38, 0, 0, "PA_CL_UCP1_Z"},
- {0x00028E3C, 0, 0, "PA_CL_UCP1_W"},
- {0x00028E40, 0, 0, "PA_CL_UCP2_X"},
- {0x00028E44, 0, 0, "PA_CL_UCP2_Y"},
- {0x00028E48, 0, 0, "PA_CL_UCP2_Z"},
- {0x00028E4C, 0, 0, "PA_CL_UCP2_W"},
- {0x00028E50, 0, 0, "PA_CL_UCP3_X"},
- {0x00028E54, 0, 0, "PA_CL_UCP3_Y"},
- {0x00028E58, 0, 0, "PA_CL_UCP3_Z"},
- {0x00028E5C, 0, 0, "PA_CL_UCP3_W"},
- {0x00028E60, 0, 0, "PA_CL_UCP4_X"},
- {0x00028E64, 0, 0, "PA_CL_UCP4_Y"},
- {0x00028E68, 0, 0, "PA_CL_UCP4_Z"},
- {0x00028E6C, 0, 0, "PA_CL_UCP4_W"},
- {0x00028E70, 0, 0, "PA_CL_UCP5_X"},
- {0x00028E74, 0, 0, "PA_CL_UCP5_Y"},
- {0x00028E78, 0, 0, "PA_CL_UCP5_Z"},
- {0x00028E7C, 0, 0, "PA_CL_UCP5_W"},
-};
-
-static const struct radeon_register R600_names_PS_RESOURCE[] = {
- {0x00038000, 0, 0, "RESOURCE0_WORD0"},
- {0x00038004, 0, 0, "RESOURCE0_WORD1"},
- {0x00038008, 0, 0, "RESOURCE0_WORD2"},
- {0x0003800C, 0, 0, "RESOURCE0_WORD3"},
- {0x00038010, 0, 0, "RESOURCE0_WORD4"},
- {0x00038014, 0, 0, "RESOURCE0_WORD5"},
- {0x00038018, 0, 0, "RESOURCE0_WORD6"},
-};
-
-static const struct radeon_register R600_names_VS_RESOURCE[] = {
- {0x00039180, 0, 0, "RESOURCE160_WORD0"},
- {0x00039184, 0, 0, "RESOURCE160_WORD1"},
- {0x00039188, 0, 0, "RESOURCE160_WORD2"},
- {0x0003918C, 0, 0, "RESOURCE160_WORD3"},
- {0x00039190, 0, 0, "RESOURCE160_WORD4"},
- {0x00039194, 0, 0, "RESOURCE160_WORD5"},
- {0x00039198, 0, 0, "RESOURCE160_WORD6"},
-};
-
-static const struct radeon_register R600_names_FS_RESOURCE[] = {
- {0x0003A300, 0, 0, "RESOURCE320_WORD0"},
- {0x0003A304, 0, 0, "RESOURCE320_WORD1"},
- {0x0003A308, 0, 0, "RESOURCE320_WORD2"},
- {0x0003A30C, 0, 0, "RESOURCE320_WORD3"},
- {0x0003A310, 0, 0, "RESOURCE320_WORD4"},
- {0x0003A314, 0, 0, "RESOURCE320_WORD5"},
- {0x0003A318, 0, 0, "RESOURCE320_WORD6"},
-};
-
-static const struct radeon_register R600_names_GS_RESOURCE[] = {
- {0x0003A4C0, 0, 0, "RESOURCE336_WORD0"},
- {0x0003A4C4, 0, 0, "RESOURCE336_WORD1"},
- {0x0003A4C8, 0, 0, "RESOURCE336_WORD2"},
- {0x0003A4CC, 0, 0, "RESOURCE336_WORD3"},
- {0x0003A4D0, 0, 0, "RESOURCE336_WORD4"},
- {0x0003A4D4, 0, 0, "RESOURCE336_WORD5"},
- {0x0003A4D8, 0, 0, "RESOURCE336_WORD6"},
-};
-
-static const struct radeon_register R600_names_PS_SAMPLER[] = {
- {0x0003C000, 0, 0, "SQ_TEX_SAMPLER_WORD0_0"},
- {0x0003C004, 0, 0, "SQ_TEX_SAMPLER_WORD1_0"},
- {0x0003C008, 0, 0, "SQ_TEX_SAMPLER_WORD2_0"},
-};
-
-static const struct radeon_register R600_names_VS_SAMPLER[] = {
- {0x0003C0D8, 0, 0, "SQ_TEX_SAMPLER_WORD0_18"},
- {0x0003C0DC, 0, 0, "SQ_TEX_SAMPLER_WORD1_18"},
- {0x0003C0E0, 0, 0, "SQ_TEX_SAMPLER_WORD2_18"},
-};
-
-static const struct radeon_register R600_names_GS_SAMPLER[] = {
- {0x0003C1B0, 0, 0, "SQ_TEX_SAMPLER_WORD0_36"},
- {0x0003C1B4, 0, 0, "SQ_TEX_SAMPLER_WORD1_36"},
- {0x0003C1B8, 0, 0, "SQ_TEX_SAMPLER_WORD2_36"},
-};
-
-static const struct radeon_register R600_names_PS_SAMPLER_BORDER[] = {
- {0x0000A400, 0, 0, "TD_PS_SAMPLER0_BORDER_RED"},
- {0x0000A404, 0, 0, "TD_PS_SAMPLER0_BORDER_GREEN"},
- {0x0000A408, 0, 0, "TD_PS_SAMPLER0_BORDER_BLUE"},
- {0x0000A40C, 0, 0, "TD_PS_SAMPLER0_BORDER_ALPHA"},
-};
-
-static const struct radeon_register R600_names_VS_SAMPLER_BORDER[] = {
- {0x0000A600, 0, 0, "TD_VS_SAMPLER0_BORDER_RED"},
- {0x0000A604, 0, 0, "TD_VS_SAMPLER0_BORDER_GREEN"},
- {0x0000A608, 0, 0, "TD_VS_SAMPLER0_BORDER_BLUE"},
- {0x0000A60C, 0, 0, "TD_VS_SAMPLER0_BORDER_ALPHA"},
-};
-
-static const struct radeon_register R600_names_GS_SAMPLER_BORDER[] = {
- {0x0000A800, 0, 0, "TD_GS_SAMPLER0_BORDER_RED"},
- {0x0000A804, 0, 0, "TD_GS_SAMPLER0_BORDER_GREEN"},
- {0x0000A808, 0, 0, "TD_GS_SAMPLER0_BORDER_BLUE"},
- {0x0000A80C, 0, 0, "TD_GS_SAMPLER0_BORDER_ALPHA"},
-};
-
-static const struct radeon_register R600_names_CB0[] = {
- {0x00028040, 1, 0, "CB_COLOR0_BASE"},
- {0x000280A0, 1, 0, "CB_COLOR0_INFO"},
- {0x00028060, 0, 0, "CB_COLOR0_SIZE"},
- {0x00028080, 0, 0, "CB_COLOR0_VIEW"},
- {0x000280E0, 1, 0, "CB_COLOR0_FRAG"},
- {0x000280C0, 1, 0, "CB_COLOR0_TILE"},
- {0x00028100, 0, 0, "CB_COLOR0_MASK"},
-};
-
-static const struct radeon_register R600_names_CB1[] = {
- {0x00028044, 1, 0, "CB_COLOR1_BASE"},
- {0x000280A4, 1, 0, "CB_COLOR1_INFO"},
- {0x00028064, 0, 0, "CB_COLOR1_SIZE"},
- {0x00028084, 0, 0, "CB_COLOR1_VIEW"},
- {0x000280E4, 1, 0, "CB_COLOR1_FRAG"},
- {0x000280C4, 1, 0, "CB_COLOR1_TILE"},
- {0x00028104, 0, 0, "CB_COLOR1_MASK"},
-};
-
-static const struct radeon_register R600_names_CB2[] = {
- {0x00028048, 1, 0, "CB_COLOR2_BASE"},
- {0x000280A8, 1, 0, "CB_COLOR2_INFO"},
- {0x00028068, 0, 0, "CB_COLOR2_SIZE"},
- {0x00028088, 0, 0, "CB_COLOR2_VIEW"},
- {0x000280E8, 1, 0, "CB_COLOR2_FRAG"},
- {0x000280C8, 1, 0, "CB_COLOR2_TILE"},
- {0x00028108, 0, 0, "CB_COLOR2_MASK"},
-};
-
-static const struct radeon_register R600_names_CB3[] = {
- {0x0002804C, 1, 0, "CB_COLOR3_BASE"},
- {0x000280AC, 1, 0, "CB_COLOR3_INFO"},
- {0x0002806C, 0, 0, "CB_COLOR3_SIZE"},
- {0x0002808C, 0, 0, "CB_COLOR3_VIEW"},
- {0x000280EC, 1, 0, "CB_COLOR3_FRAG"},
- {0x000280CC, 1, 0, "CB_COLOR3_TILE"},
- {0x0002810C, 0, 0, "CB_COLOR3_MASK"},
-};
-
-static const struct radeon_register R600_names_CB4[] = {
- {0x00028050, 1, 0, "CB_COLOR4_BASE"},
- {0x000280B0, 1, 0, "CB_COLOR4_INFO"},
- {0x00028070, 0, 0, "CB_COLOR4_SIZE"},
- {0x00028090, 0, 0, "CB_COLOR4_VIEW"},
- {0x000280F0, 1, 0, "CB_COLOR4_FRAG"},
- {0x000280D0, 1, 0, "CB_COLOR4_TILE"},
- {0x00028110, 0, 0, "CB_COLOR4_MASK"},
-};
-
-static const struct radeon_register R600_names_CB5[] = {
- {0x00028054, 1, 0, "CB_COLOR5_BASE"},
- {0x000280B4, 1, 0, "CB_COLOR5_INFO"},
- {0x00028074, 0, 0, "CB_COLOR5_SIZE"},
- {0x00028094, 0, 0, "CB_COLOR5_VIEW"},
- {0x000280F4, 1, 0, "CB_COLOR5_FRAG"},
- {0x000280D4, 1, 0, "CB_COLOR5_TILE"},
- {0x00028114, 0, 0, "CB_COLOR5_MASK"},
-};
-
-static const struct radeon_register R600_names_CB6[] = {
- {0x00028058, 1, 0, "CB_COLOR6_BASE"},
- {0x000280B8, 1, 0, "CB_COLOR6_INFO"},
- {0x00028078, 0, 0, "CB_COLOR6_SIZE"},
- {0x00028098, 0, 0, "CB_COLOR6_VIEW"},
- {0x000280F8, 1, 0, "CB_COLOR6_FRAG"},
- {0x000280D8, 1, 0, "CB_COLOR6_TILE"},
- {0x00028118, 0, 0, "CB_COLOR6_MASK"},
-};
-
-static const struct radeon_register R600_names_CB7[] = {
- {0x0002805C, 1, 0, "CB_COLOR7_BASE"},
- {0x000280BC, 1, 0, "CB_COLOR7_INFO"},
- {0x0002807C, 0, 0, "CB_COLOR7_SIZE"},
- {0x0002809C, 0, 0, "CB_COLOR7_VIEW"},
- {0x000280FC, 1, 0, "CB_COLOR7_FRAG"},
- {0x000280DC, 1, 0, "CB_COLOR7_TILE"},
- {0x0002811C, 0, 0, "CB_COLOR7_MASK"},
-};
-
-static const struct radeon_register R600_names_DB[] = {
- {0x0002800C, 1, 0, "DB_DEPTH_BASE"},
- {0x00028000, 0, 0, "DB_DEPTH_SIZE"},
- {0x00028004, 0, 0, "DB_DEPTH_VIEW"},
- {0x00028010, 1, 0, "DB_DEPTH_INFO"},
- {0x00028D24, 0, 0, "DB_HTILE_SURFACE"},
- {0x00028D34, 0, 0, "DB_PREFETCH_LIMIT"},
-};
-
-static const struct radeon_register R600_names_VGT[] = {
- {0x00008958, 0, 0, "VGT_PRIMITIVE_TYPE"},
- {0x00028400, 0, 0, "VGT_MAX_VTX_INDX"},
- {0x00028404, 0, 0, "VGT_MIN_VTX_INDX"},
- {0x00028408, 0, 0, "VGT_INDX_OFFSET"},
- {0x0002840C, 0, 0, "VGT_MULTI_PRIM_IB_RESET_INDX"},
- {0x00028A7C, 0, 0, "VGT_DMA_INDEX_TYPE"},
- {0x00028A84, 0, 0, "VGT_PRIMITIVEID_EN"},
- {0x00028A88, 0, 0, "VGT_DMA_NUM_INSTANCES"},
- {0x00028A94, 0, 0, "VGT_MULTI_PRIM_IB_RESET_EN"},
- {0x00028AA0, 0, 0, "VGT_INSTANCE_STEP_RATE_0"},
- {0x00028AA4, 0, 0, "VGT_INSTANCE_STEP_RATE_1"},
-};
-
-static const struct radeon_register R600_names_DRAW[] = {
- {0x00008970, 0, 0, "VGT_NUM_INDICES"},
- {0x000287E4, 0, 0, "VGT_DMA_BASE_HI"},
- {0x000287E8, 1, 0, "VGT_DMA_BASE"},
- {0x000287F0, 0, 0, "VGT_DRAW_INITIATOR"},
-};
-
-static const struct radeon_register R600_names_VGT_EVENT[] = {
- {0x00028A90, 1, 0, "VGT_EVENT_INITIATOR"},
-};
-
-static const struct radeon_register R600_names_CB_FLUSH[] = {
-};
-
-static const struct radeon_register R600_names_DB_FLUSH[] = {
-};
-
-#endif
#define PKT3_SET_CTL_CONST 0x6F
#define PKT3_SURFACE_BASE_UPDATE 0x73
+#define EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT 0x14
#define EVENT_TYPE_ZPASS_DONE 0x15
#define EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT 0x16
#define R_038014_RESOURCE0_WORD5 0x038014
#define R_038018_RESOURCE0_WORD6 0x038018
+#define R_028140_ALU_CONST_BUFFER_SIZE_PS_0 0x00028140
+#define R_028180_ALU_CONST_BUFFER_SIZE_VS_0 0x00028180
+#define R_028940_ALU_CONST_CACHE_PS_0 0x00028940
+#define R_028980_ALU_CONST_CACHE_VS_0 0x00028980
+
+#define R_03CFF0_SQ_VTX_BASE_VTX_LOC 0x03CFF0
+#define R_03CFF4_SQ_VTX_START_INST_LOC 0x03CFF4
+
#endif
+++ /dev/null
-/*
- * Copyright © 2009 Jerome Glisse <glisse@freedesktop.org>
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <pipebuffer/pb_bufmgr.h>
-#include "xf86drm.h"
-#include "radeon_priv.h"
-#include "radeon_drm.h"
-
-enum radeon_family radeon_get_family(struct radeon *radeon)
-{
- return radeon->family;
-}
-
-enum chip_class radeon_get_family_class(struct radeon *radeon)
-{
- return radeon->chip_class;
-}
-
-void radeon_set_mem_constant(struct radeon *radeon, boolean state)
-{
- radeon->use_mem_constant = state;
-}
-
-static int radeon_get_device(struct radeon *radeon)
-{
- struct drm_radeon_info info;
- int r;
-
- radeon->device = 0;
- info.request = RADEON_INFO_DEVICE_ID;
- info.value = (uintptr_t)&radeon->device;
- r = drmCommandWriteRead(radeon->fd, DRM_RADEON_INFO, &info,
- sizeof(struct drm_radeon_info));
- return r;
-}
-
-struct radeon *radeon_new(int fd, unsigned device)
-{
- struct radeon *radeon;
- int r;
-
- radeon = calloc(1, sizeof(*radeon));
- if (radeon == NULL) {
- return NULL;
- }
- radeon->fd = fd;
- radeon->device = device;
- radeon->refcount = 1;
- if (fd >= 0) {
- r = radeon_get_device(radeon);
- if (r) {
- fprintf(stderr, "Failed to get device id\n");
- return radeon_decref(radeon);
- }
- }
- radeon->family = radeon_family_from_device(radeon->device);
- if (radeon->family == CHIP_UNKNOWN) {
- fprintf(stderr, "Unknown chipset 0x%04X\n", radeon->device);
- return radeon_decref(radeon);
- }
- switch (radeon->family) {
- case CHIP_R600:
- case CHIP_RV610:
- case CHIP_RV630:
- case CHIP_RV670:
- case CHIP_RV620:
- case CHIP_RV635:
- case CHIP_RS780:
- case CHIP_RS880:
- case CHIP_RV770:
- case CHIP_RV730:
- case CHIP_RV710:
- case CHIP_RV740:
- case CHIP_CEDAR:
- case CHIP_REDWOOD:
- case CHIP_JUNIPER:
- case CHIP_CYPRESS:
- case CHIP_HEMLOCK:
- if (r600_init(radeon)) {
- return radeon_decref(radeon);
- }
- break;
- case CHIP_R100:
- case CHIP_RV100:
- case CHIP_RS100:
- case CHIP_RV200:
- case CHIP_RS200:
- case CHIP_R200:
- case CHIP_RV250:
- case CHIP_RS300:
- case CHIP_RV280:
- case CHIP_R300:
- case CHIP_R350:
- case CHIP_RV350:
- case CHIP_RV380:
- case CHIP_R420:
- case CHIP_R423:
- case CHIP_RV410:
- case CHIP_RS400:
- case CHIP_RS480:
- case CHIP_RS600:
- case CHIP_RS690:
- case CHIP_RS740:
- case CHIP_RV515:
- case CHIP_R520:
- case CHIP_RV530:
- case CHIP_RV560:
- case CHIP_RV570:
- case CHIP_R580:
- default:
- fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n",
- __func__, radeon->device);
- break;
- }
-
- /* setup class */
- switch (radeon->family) {
- case CHIP_R600:
- case CHIP_RV610:
- case CHIP_RV630:
- case CHIP_RV670:
- case CHIP_RV620:
- case CHIP_RV635:
- case CHIP_RS780:
- case CHIP_RS880:
- radeon->chip_class = R600;
- break;
- case CHIP_RV770:
- case CHIP_RV730:
- case CHIP_RV710:
- case CHIP_RV740:
- radeon->chip_class = R700;
- break;
- case CHIP_CEDAR:
- case CHIP_REDWOOD:
- case CHIP_JUNIPER:
- case CHIP_CYPRESS:
- case CHIP_HEMLOCK:
- radeon->chip_class = EVERGREEN;
- break;
- default:
- fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n",
- __func__, radeon->device);
- break;
- }
-
- radeon->mman = pb_malloc_bufmgr_create();
- if (!radeon->mman)
- return NULL;
- radeon->kman = radeon_bo_pbmgr_create(radeon);
- if (!radeon->kman)
- return NULL;
- radeon->cman = pb_cache_manager_create(radeon->kman, 100000);
- if (!radeon->cman)
- return NULL;
- return radeon;
-}
-
-struct radeon *radeon_incref(struct radeon *radeon)
-{
- if (radeon == NULL)
- return NULL;
- radeon->refcount++;
- return radeon;
-}
-
-struct radeon *radeon_decref(struct radeon *radeon)
-{
- if (radeon == NULL)
- return NULL;
- if (--radeon->refcount > 0) {
- return NULL;
- }
-
- radeon->mman->destroy(radeon->mman);
- radeon->cman->destroy(radeon->cman);
- radeon->kman->destroy(radeon->kman);
- drmClose(radeon->fd);
- free(radeon);
- return NULL;
-}
#include <string.h>
#include <sys/mman.h>
#include <errno.h>
-#include "radeon_priv.h"
+#include "r600_priv.h"
#include "xf86drm.h"
#include "radeon_drm.h"
+static int radeon_bo_fixed_map(struct radeon *radeon, struct radeon_bo *bo)
+{
+ struct drm_radeon_gem_mmap args;
+ void *ptr;
+ int r;
+
+ /* Zero out args to make valgrind happy */
+ memset(&args, 0, sizeof(args));
+ args.handle = bo->handle;
+ args.offset = 0;
+ args.size = (uint64_t)bo->size;
+ r = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_MMAP,
+ &args, sizeof(args));
+ if (r) {
+ fprintf(stderr, "error mapping %p 0x%08X (error = %d)\n",
+ bo, bo->handle, r);
+ return r;
+ }
+ ptr = mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED, radeon->fd, args.addr_ptr);
+ if (ptr == MAP_FAILED) {
+ fprintf(stderr, "%s failed to map bo\n", __func__);
+ return -errno;
+ }
+ bo->data = ptr;
+
+ bo->map_count++;
+ return 0;
+}
+
+static void radeon_bo_fixed_unmap(struct radeon *radeon, struct radeon_bo *bo)
+{
+ munmap(bo->data, bo->size);
+ bo->data = NULL;
+}
+
struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle,
unsigned size, unsigned alignment, void *ptr)
{
}
bo->handle = open_arg.handle;
bo->size = open_arg.size;
+ bo->shared = TRUE;
} else {
struct drm_radeon_gem_create args;
return NULL;
}
}
+ if (radeon_bo_fixed_map(radeon, bo)) {
+ R600_ERR("failed to map bo\n");
+ radeon_bo_reference(radeon, &bo, NULL);
+ return bo;
+ }
if (ptr) {
- if (radeon_bo_map(radeon, bo)) {
- fprintf(stderr, "%s failed to copy data into bo\n", __func__);
- radeon_bo_reference(radeon, &bo, NULL);
- return bo;
- }
memcpy(bo->data, ptr, size);
- radeon_bo_unmap(radeon, bo);
}
+ LIST_INITHEAD(&bo->fencedlist);
return bo;
}
-int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo)
-{
- struct drm_radeon_gem_mmap args;
- void *ptr;
- int r;
-
- if (bo->map_count != 0) {
- goto success;
- }
- /* Zero out args to make valgrind happy */
- memset(&args, 0, sizeof(args));
- args.handle = bo->handle;
- args.offset = 0;
- args.size = (uint64_t)bo->size;
- r = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_MMAP,
- &args, sizeof(args));
- if (r) {
- fprintf(stderr, "error mapping %p 0x%08X (error = %d)\n",
- bo, bo->handle, r);
- return r;
- }
- ptr = mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED, radeon->fd, args.addr_ptr);
- if (ptr == MAP_FAILED) {
- fprintf(stderr, "%s failed to map bo\n", __func__);
- return -errno;
- }
- bo->data = ptr;
-
-success:
- bo->map_count++;
-
- return 0;
-}
-
-void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo)
-{
- if (--bo->map_count > 0) {
- return;
- }
- munmap(bo->data, bo->size);
- bo->data = NULL;
-}
-
static void radeon_bo_destroy(struct radeon *radeon, struct radeon_bo *bo)
{
struct drm_gem_close args;
+ LIST_DEL(&bo->fencedlist);
+ radeon_bo_fixed_unmap(radeon, bo);
memset(&args, 0, sizeof(args));
args.handle = bo->handle;
drmIoctl(radeon->fd, DRM_IOCTL_GEM_CLOSE, &args);
struct drm_radeon_gem_wait_idle args;
int ret;
+ if (!bo->fence && !bo->shared)
+ return 0;
+
+ if (bo->fence <= *bo->ctx->cfence) {
+ LIST_DELINIT(&bo->fencedlist);
+ bo->fence = 0;
+ return 0;
+ }
+
/* Zero out args to make valgrind happy */
memset(&args, 0, sizeof(args));
args.handle = bo->handle;
int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain)
{
- struct drm_radeon_gem_busy args;
- int ret;
+ struct drm_radeon_gem_busy args;
+ int ret;
- memset(&args, 0, sizeof(args));
- args.handle = bo->handle;
- args.domain = 0;
+ if (!bo->shared) {
+ if (!bo->fence)
+ return 0;
+ if (bo->fence <= *bo->ctx->cfence) {
+ LIST_DELINIT(&bo->fencedlist);
+ bo->fence = 0;
+ return 0;
+ }
+ }
- ret = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_BUSY,
- &args, sizeof(args));
+ memset(&args, 0, sizeof(args));
+ args.handle = bo->handle;
+ args.domain = 0;
+
+ ret = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_BUSY,
+ &args, sizeof(args));
+
+ *domain = args.domain;
+ return ret;
+}
- *domain = args.domain;
- return ret;
+int radeon_bo_get_tiling_flags(struct radeon *radeon,
+ struct radeon_bo *bo,
+ uint32_t *tiling_flags,
+ uint32_t *pitch)
+{
+ struct drm_radeon_gem_get_tiling args;
+ int ret;
+
+ args.handle = bo->handle;
+ ret = drmCommandWriteRead(radeon->fd, DRM_RADEON_GEM_GET_TILING,
+ &args, sizeof(args));
+ if (ret)
+ return ret;
+
+ *tiling_flags = args.tiling_flags;
+ *pitch = args.pitch;
+ return ret;
}
-#include "radeon_priv.h"
-
-#include "util/u_inlines.h"
-#include "util/u_memory.h"
-#include "util/u_double_list.h"
-#include "pipebuffer/pb_buffer.h"
-#include "pipebuffer/pb_bufmgr.h"
+/*
+ * Copyright 2010 Dave Airlie
+ *
+ * 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.
+ *
+ * Authors:
+ * Dave Airlie
+ */
+#include <util/u_inlines.h>
+#include <util/u_memory.h>
+#include <util/u_double_list.h>
+#include <pipebuffer/pb_buffer.h>
+#include <pipebuffer/pb_bufmgr.h>
+#include "r600_priv.h"
struct radeon_bo_pb {
struct pb_buffer b;
uint32_t domain;
if (radeon_bo_busy(buf->mgr->radeon, buf->bo, &domain))
return NULL;
+ if (radeon_bo_map(buf->mgr->radeon, buf->bo)) {
+ return NULL;
+ }
+ goto out;
}
if (buf->bo->data != NULL) {
return NULL;
}
}
-
+out:
LIST_DELINIT(&buf->maplist);
return buf->bo->data;
}
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * 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.
- *
- * Authors:
- * Jerome Glisse
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "radeon_priv.h"
-#include "radeon_drm.h"
-#include "bof.h"
-
-static int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_ws_bo *bo)
-{
- if (ctx->nbo >= RADEON_CTX_MAX_PM4)
- return -EBUSY;
- /* take a reference to the kernel bo */
- radeon_bo_reference(ctx->radeon, &ctx->bo[ctx->nbo], radeon_bo_pb_get_bo(bo->pb));
- ctx->nbo++;
- return 0;
-}
-
-static void radeon_ctx_get_placement(struct radeon_ctx *ctx, unsigned reloc, u32 *placement)
-{
- struct radeon_cs_reloc *greloc;
- unsigned i;
-
- placement[0] = 0;
- placement[1] = 0;
- greloc = (void *)(((u8 *)ctx->reloc) + reloc * 4);
- for (i = 0; i < ctx->nbo; i++) {
- if (ctx->bo[i]->handle == greloc->handle) {
- placement[0] = greloc->read_domain | greloc->write_domain;
- placement[1] = placement[0];
- return;
- }
- }
-}
-
-void radeon_ctx_clear(struct radeon_ctx *ctx)
-{
- for (int i = 0; i < ctx->nbo; i++) {
- radeon_bo_reference(ctx->radeon, &ctx->bo[i], NULL);
- }
- ctx->ndwords = RADEON_CTX_MAX_PM4;
- ctx->cdwords = 0;
- ctx->nreloc = 0;
- ctx->nbo = 0;
-}
-
-struct radeon_ctx *radeon_ctx_init(struct radeon *radeon)
-{
- struct radeon_ctx *ctx;
- if (radeon == NULL)
- return NULL;
- ctx = calloc(1, sizeof(struct radeon_ctx));
- ctx->radeon = radeon_incref(radeon);
- radeon_ctx_clear(ctx);
- ctx->pm4 = malloc(RADEON_CTX_MAX_PM4 * 4);
- if (ctx->pm4 == NULL) {
- radeon_ctx_fini(ctx);
- return NULL;
- }
- ctx->reloc = malloc(sizeof(struct radeon_cs_reloc) * RADEON_CTX_MAX_PM4);
- if (ctx->reloc == NULL) {
- radeon_ctx_fini(ctx);
- return NULL;
- }
- ctx->bo = calloc(sizeof(void *), RADEON_CTX_MAX_PM4);
- if (ctx->bo == NULL) {
- radeon_ctx_fini(ctx);
- return NULL;
- }
- return ctx;
-}
-
-void radeon_ctx_fini(struct radeon_ctx *ctx)
-{
- unsigned i;
-
- if (ctx == NULL)
- return;
-
- for (i = 0; i < ctx->nbo; i++) {
- radeon_bo_reference(ctx->radeon, &ctx->bo[i], NULL);
- }
- ctx->radeon = radeon_decref(ctx->radeon);
- free(ctx->bo);
- free(ctx->pm4);
- free(ctx->reloc);
- free(ctx);
-}
-
-static int radeon_ctx_state_bo(struct radeon_ctx *ctx, struct radeon_state *state)
-{
- unsigned i, j;
- int r;
- struct radeon_bo *state_bo;
- if (state == NULL)
- return 0;
- for (i = 0; i < state->nbo; i++) {
- for (j = 0; j < ctx->nbo; j++) {
- state_bo = radeon_bo_pb_get_bo(state->bo[i]->pb);
- if (state_bo == ctx->bo[j])
- break;
- }
- if (j == ctx->nbo) {
- r = radeon_ctx_set_bo_new(ctx, state->bo[i]);
- if (r)
- return r;
- }
- }
- return 0;
-}
-
-
-int radeon_ctx_submit(struct radeon_ctx *ctx)
-{
- struct drm_radeon_cs drmib;
- struct drm_radeon_cs_chunk chunks[2];
- uint64_t chunk_array[2];
- int r = 0;
-
- if (!ctx->cdwords)
- return 0;
-
- radeon_bo_pbmgr_flush_maps(ctx->radeon->kman);
-#if 0
- for (r = 0; r < ctx->cdwords; r++) {
- fprintf(stderr, "0x%08X\n", ctx->pm4[r]);
- }
-#endif
- drmib.num_chunks = 2;
- drmib.chunks = (uint64_t)(uintptr_t)chunk_array;
- chunks[0].chunk_id = RADEON_CHUNK_ID_IB;
- chunks[0].length_dw = ctx->cdwords;
- chunks[0].chunk_data = (uint64_t)(uintptr_t)ctx->pm4;
- chunks[1].chunk_id = RADEON_CHUNK_ID_RELOCS;
- chunks[1].length_dw = ctx->nreloc * sizeof(struct radeon_cs_reloc) / 4;
- chunks[1].chunk_data = (uint64_t)(uintptr_t)ctx->reloc;
- chunk_array[0] = (uint64_t)(uintptr_t)&chunks[0];
- chunk_array[1] = (uint64_t)(uintptr_t)&chunks[1];
-#if 1
- r = drmCommandWriteRead(ctx->radeon->fd, DRM_RADEON_CS, &drmib,
- sizeof(struct drm_radeon_cs));
-#endif
- return r;
-}
-
-static int radeon_ctx_reloc(struct radeon_ctx *ctx, struct radeon_ws_bo *bo,
- unsigned id, unsigned *placement)
-{
- unsigned i;
- unsigned bo_handle = radeon_ws_bo_get_handle(bo);
-
- for (i = 0; i < ctx->nreloc; i++) {
- if (ctx->reloc[i].handle == bo_handle) {
- ctx->pm4[id] = i * sizeof(struct radeon_cs_reloc) / 4;
- return 0;
- }
- }
- if (ctx->nreloc >= RADEON_CTX_MAX_PM4) {
- return -EBUSY;
- }
- ctx->reloc[ctx->nreloc].handle = bo_handle;
- ctx->reloc[ctx->nreloc].read_domain = placement[0] | placement [1];
- ctx->reloc[ctx->nreloc].write_domain = placement[0] | placement [1];
- ctx->reloc[ctx->nreloc].flags = 0;
- ctx->pm4[id] = ctx->nreloc * sizeof(struct radeon_cs_reloc) / 4;
- ctx->nreloc++;
- return 0;
-}
-
-static int radeon_ctx_state_schedule(struct radeon_ctx *ctx, struct radeon_state *state)
-{
- unsigned i, rid, bid, cid;
- int r;
-
- if (state == NULL)
- return 0;
- if (state->cpm4 > ctx->ndwords) {
- return -EBUSY;
- }
- memcpy(&ctx->pm4[ctx->cdwords], state->pm4, state->cpm4 * 4);
- for (i = 0; i < state->nreloc; i++) {
- rid = state->reloc_pm4_id[i];
- bid = state->reloc_bo_id[i];
- cid = ctx->cdwords + rid;
- r = radeon_ctx_reloc(ctx, state->bo[bid], cid,
- &state->placement[bid * 2]);
- if (r) {
- fprintf(stderr, "%s state %d failed to reloc\n", __func__, state->stype->stype);
- return r;
- }
- }
- ctx->cdwords += state->cpm4;
- ctx->ndwords -= state->cpm4;
- return 0;
-}
-
-int radeon_ctx_set_query_state(struct radeon_ctx *ctx, struct radeon_state *state)
-{
- int r = 0;
-
- /* !!! ONLY ACCEPT QUERY STATE HERE !!! */
- r = radeon_state_pm4(state);
- if (r)
- return r;
- /* BEGIN/END query are balanced in the same cs so account for END
- * END query when scheduling BEGIN query
- */
- switch (state->stype->stype) {
- case R600_STATE_QUERY_BEGIN:
- /* is there enough place for begin & end */
- if ((state->cpm4 * 2) > ctx->ndwords)
- return -EBUSY;
- ctx->ndwords -= state->cpm4;
- break;
- case R600_STATE_QUERY_END:
- ctx->ndwords += state->cpm4;
- break;
- default:
- return -EINVAL;
- }
- return radeon_ctx_state_schedule(ctx, state);
-}
-
-int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw)
-{
- unsigned previous_cdwords;
- int r = 0;
- int i;
-
- for (i = 0; i < ctx->radeon->max_states; i++) {
- r = radeon_ctx_state_bo(ctx, draw->state[i]);
- if (r)
- return r;
- }
- previous_cdwords = ctx->cdwords;
- for (i = 0; i < ctx->radeon->max_states; i++) {
- if (draw->state[i]) {
- r = radeon_ctx_state_schedule(ctx, draw->state[i]);
- if (r) {
- ctx->cdwords = previous_cdwords;
- return r;
- }
- }
- }
-
- return 0;
-}
-
-#if 0
-int radeon_ctx_pm4(struct radeon_ctx *ctx)
-{
- unsigned i;
- int r;
-
- free(ctx->pm4);
- ctx->cpm4 = 0;
- ctx->pm4 = malloc(ctx->draw_cpm4 * 4);
- if (ctx->pm4 == NULL)
- return -EINVAL;
- for (i = 0, ctx->id = 0; i < ctx->nstate; i++) {
- }
- if (ctx->id != ctx->draw_cpm4) {
- fprintf(stderr, "%s miss predicted pm4 size %d for %d\n",
- __func__, ctx->draw_cpm4, ctx->id);
- return -EINVAL;
- }
- ctx->cpm4 = ctx->draw_cpm4;
- return 0;
-}
-#endif
-
-void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file)
-{
- bof_t *bcs, *blob, *array, *bo, *size, *handle, *device_id, *root;
- unsigned i;
- unsigned bo_size;
- root = device_id = bcs = blob = array = bo = size = handle = NULL;
- root = bof_object();
- if (root == NULL)
- goto out_err;
- device_id = bof_int32(ctx->radeon->device);
- if (device_id == NULL)
- return;
- if (bof_object_set(root, "device_id", device_id))
- goto out_err;
- bof_decref(device_id);
- device_id = NULL;
- /* dump relocs */
- blob = bof_blob(ctx->nreloc * 16, ctx->reloc);
- if (blob == NULL)
- goto out_err;
- if (bof_object_set(root, "reloc", blob))
- goto out_err;
- bof_decref(blob);
- blob = NULL;
- /* dump cs */
- blob = bof_blob(ctx->cdwords * 4, ctx->pm4);
- if (blob == NULL)
- goto out_err;
- if (bof_object_set(root, "pm4", blob))
- goto out_err;
- bof_decref(blob);
- blob = NULL;
- /* dump bo */
- array = bof_array();
- if (array == NULL)
- goto out_err;
- for (i = 0; i < ctx->nbo; i++) {
- bo = bof_object();
- if (bo == NULL)
- goto out_err;
- bo_size = ctx->bo[i]->size;
- size = bof_int32(bo_size);
- if (size == NULL)
- goto out_err;
- if (bof_object_set(bo, "size", size))
- goto out_err;
- bof_decref(size);
- size = NULL;
- handle = bof_int32(ctx->bo[i]->handle);
- if (handle == NULL)
- goto out_err;
- if (bof_object_set(bo, "handle", handle))
- goto out_err;
- bof_decref(handle);
- handle = NULL;
- radeon_bo_map(ctx->radeon, ctx->bo[i]);
- blob = bof_blob(bo_size, ctx->bo[i]->data);
- radeon_bo_unmap(ctx->radeon, ctx->bo[i]);
- if (blob == NULL)
- goto out_err;
- if (bof_object_set(bo, "data", blob))
- goto out_err;
- bof_decref(blob);
- blob = NULL;
- if (bof_array_append(array, bo))
- goto out_err;
- bof_decref(bo);
- bo = NULL;
- }
- if (bof_object_set(root, "bo", array))
- goto out_err;
- bof_dump_file(root, file);
-out_err:
- bof_decref(blob);
- bof_decref(array);
- bof_decref(bo);
- bof_decref(size);
- bof_decref(handle);
- bof_decref(device_id);
- bof_decref(root);
-}
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * 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.
- *
- * Authors:
- * Jerome Glisse
- */
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include "radeon_priv.h"
-
-/*
- * draw functions
- */
-int radeon_draw_init(struct radeon_draw *draw, struct radeon *radeon)
-{
- draw->radeon = radeon;
- draw->state = calloc(radeon->max_states, sizeof(void*));
- if (draw->state == NULL)
- return -ENOMEM;
- return 0;
-}
-
-void radeon_draw_bind(struct radeon_draw *draw, struct radeon_state *state)
-{
- if (state == NULL)
- return;
- draw->state[state->state_id] = state;
-}
-
-void radeon_draw_unbind(struct radeon_draw *draw, struct radeon_state *state)
-{
- if (state == NULL)
- return;
- if (draw->state[state->state_id] == state) {
- draw->state[state->state_id] = NULL;
- }
-}
* Jerome Glisse
*/
#include <stdlib.h>
-#include "radeon_priv.h"
+#include "r600.h"
struct pci_id {
unsigned vendor;
+++ /dev/null
-/*
- * Copyright © 2009 Jerome Glisse <glisse@freedesktop.org>
- *
- * This file is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-#ifndef RADEON_PRIV_H
-#define RADEON_PRIV_H
-
-#include <stdint.h>
-#include "xf86drm.h"
-#include "xf86drmMode.h"
-#include <errno.h>
-#include "radeon.h"
-
-#include "pipe/p_compiler.h"
-#include "util/u_inlines.h"
-#include "pipe/p_defines.h"
-
-struct radeon;
-struct radeon_ctx;
-
-
-/*
- * radeon functions
- */
-typedef int (*radeon_state_pm4_t)(struct radeon_state *state);
-struct radeon_register {
- unsigned offset;
- unsigned need_reloc;
- unsigned bo_id;
- char name[64];
-};
-
-struct radeon_bo {
- struct pipe_reference reference;
- unsigned handle;
- unsigned size;
- unsigned alignment;
- unsigned map_count;
- void *data;
-};
-
-struct radeon_sub_type {
- int shader_type;
- const struct radeon_register *regs;
- unsigned nstates;
-};
-
-struct radeon_stype_info {
- unsigned stype;
- unsigned num;
- unsigned stride;
- radeon_state_pm4_t pm4;
- struct radeon_sub_type reginfo[R600_SHADER_MAX];
- unsigned base_id;
- unsigned npm4;
-};
-
-struct radeon_ctx {
- struct radeon *radeon;
- u32 *pm4;
- int cdwords;
- int ndwords;
- unsigned nreloc;
- struct radeon_cs_reloc *reloc;
- unsigned nbo;
- struct radeon_bo **bo;
-};
-
-struct radeon {
- int fd;
- int refcount;
- unsigned device;
- unsigned family;
- enum chip_class chip_class;
- boolean use_mem_constant; /* true for evergreen */
- unsigned nstype;
- struct radeon_stype_info *stype;
- unsigned max_states;
- struct pb_manager *mman; /* malloc manager */
- struct pb_manager *kman; /* kernel bo manager */
- struct pb_manager *cman; /* cached bo manager */
-};
-
-struct radeon_ws_bo {
- struct pipe_reference reference;
- struct pb_buffer *pb;
-};
-
-extern struct radeon *radeon_new(int fd, unsigned device);
-extern struct radeon *radeon_incref(struct radeon *radeon);
-extern struct radeon *radeon_decref(struct radeon *radeon);
-extern unsigned radeon_family_from_device(unsigned device);
-extern int radeon_is_family_compatible(unsigned family1, unsigned family2);
-
-/*
- * r600/r700 context functions
- */
-extern int r600_init(struct radeon *radeon);
-extern int r600_ctx_draw(struct radeon_ctx *ctx);
-extern int r600_ctx_next_reloc(struct radeon_ctx *ctx, unsigned *reloc);
-
-/*
- * radeon state functions
- */
-extern u32 radeon_state_register_get(struct radeon_state *state, unsigned offset);
-extern int radeon_state_register_set(struct radeon_state *state, unsigned offset, u32 value);
-extern struct radeon_state *radeon_state_duplicate(struct radeon_state *state);
-extern int radeon_state_replace_always(struct radeon_state *ostate, struct radeon_state *nstate);
-extern int radeon_state_pm4_generic(struct radeon_state *state);
-extern int radeon_state_reloc(struct radeon_state *state, unsigned id, unsigned bo_id);
-
-/*
- * radeon draw functions
- */
-extern int radeon_draw_pm4(struct radeon_draw *draw);
-
-/* ws bo winsys only */
-unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *bo);
-unsigned radeon_ws_bo_get_size(struct radeon_ws_bo *bo);
-
-/* bo */
-struct radeon_bo *radeon_bo(struct radeon *radeon, unsigned handle,
- unsigned size, unsigned alignment, void *ptr);
-int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo);
-void radeon_bo_unmap(struct radeon *radeon, struct radeon_bo *bo);
-void radeon_bo_reference(struct radeon *radeon, struct radeon_bo **dst,
- struct radeon_bo *src);
-int radeon_bo_wait(struct radeon *radeon, struct radeon_bo *bo);
-int radeon_bo_busy(struct radeon *radeon, struct radeon_bo *bo, uint32_t *domain);
-
-/* pipebuffer kernel bo manager */
-struct pb_manager *radeon_bo_pbmgr_create(struct radeon *radeon);
-struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf);
-void radeon_bo_pbmgr_flush_maps(struct pb_manager *_mgr);
-struct pb_buffer *radeon_bo_pb_create_buffer_from_handle(struct pb_manager *_mgr,
- uint32_t handle);
-
-#endif
+++ /dev/null
-/*
- * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
- *
- * 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.
- *
- * Authors:
- * Jerome Glisse
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include "radeon_priv.h"
-
-/*
- * state core functions
- */
-int radeon_state_init(struct radeon_state *state, struct radeon *radeon, u32 stype, u32 id, u32 shader_type)
-{
- struct radeon_stype_info *found = NULL;
- int i, j, shader_index = -1;
-
- /* traverse the stype array */
- for (i = 0; i < radeon->nstype; i++) {
- /* if the type doesn't match, if the shader doesn't match */
- if (stype != radeon->stype[i].stype)
- continue;
- if (shader_type) {
- for (j = 0; j < 4; j++) {
- if (radeon->stype[i].reginfo[j].shader_type == shader_type) {
- shader_index = j;
- break;
- }
- }
- if (shader_index == -1)
- continue;
- } else {
- if (radeon->stype[i].reginfo[0].shader_type)
- continue;
- else
- shader_index = 0;
- }
- if (id > radeon->stype[i].num)
- continue;
-
- found = &radeon->stype[i];
- break;
- }
-
- if (!found) {
- fprintf(stderr, "%s invalid type %d/id %d/shader class %d\n", __func__, stype, id, shader_type);
- return -EINVAL;
- }
-
- memset(state, 0, sizeof(struct radeon_state));
- state->stype = found;
- state->state_id = state->stype->num * shader_index + state->stype->base_id + id;
- state->radeon = radeon;
- state->id = id;
- state->shader_index = shader_index;
- state->refcount = 1;
- state->npm4 = found->npm4;
- state->nstates = found->reginfo[shader_index].nstates;
- return 0;
-}
-
-int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shader_type)
-{
- struct radeon_stype_info *found = NULL;
- int i, j, shader_index = -1;
-
- if (state == NULL)
- return 0;
- /* traverse the stype array */
- for (i = 0; i < state->radeon->nstype; i++) {
- /* if the type doesn't match, if the shader doesn't match */
- if (stype != state->radeon->stype[i].stype)
- continue;
- if (shader_type) {
- for (j = 0; j < 4; j++) {
- if (state->radeon->stype[i].reginfo[j].shader_type == shader_type) {
- shader_index = j;
- break;
- }
- }
- if (shader_index == -1)
- continue;
- } else {
- if (state->radeon->stype[i].reginfo[0].shader_type)
- continue;
- else
- shader_index = 0;
- }
- if (id > state->radeon->stype[i].num)
- continue;
-
- found = &state->radeon->stype[i];
- break;
- }
-
- if (!found) {
- fprintf(stderr, "%s invalid type %d/id %d/shader class %d\n", __func__, stype, id, shader_type);
- return -EINVAL;
- }
-
- if (found->reginfo[shader_index].nstates != state->nstates) {
- fprintf(stderr, "invalid type change from (%d %d %d) to (%d %d %d)\n",
- state->stype->stype, state->id, state->shader_index, stype, id, shader_index);
- }
-
- state->stype = found;
- state->id = id;
- state->shader_index = shader_index;
- state->state_id = state->stype->num * shader_index + state->stype->base_id + id;
- return radeon_state_pm4(state);
-}
-
-void radeon_state_fini(struct radeon_state *state)
-{
- unsigned i;
-
- if (state == NULL)
- return;
- for (i = 0; i < state->nbo; i++) {
- radeon_ws_bo_reference(state->radeon, &state->bo[i], NULL);
- }
- memset(state, 0, sizeof(struct radeon_state));
-}
-
-int radeon_state_replace_always(struct radeon_state *ostate,
- struct radeon_state *nstate)
-{
- return 1;
-}
-
-int radeon_state_pm4_generic(struct radeon_state *state)
-{
- return -EINVAL;
-}
-
-static u32 crc32(void *d, size_t len)
-{
- u16 *data = (uint16_t*)d;
- u32 sum1 = 0xffff, sum2 = 0xffff;
-
- len = len >> 1;
- while (len) {
- unsigned tlen = len > 360 ? 360 : len;
- len -= tlen;
- do {
- sum1 += *data++;
- sum2 += sum1;
- } while (--tlen);
- sum1 = (sum1 & 0xffff) + (sum1 >> 16);
- sum2 = (sum2 & 0xffff) + (sum2 >> 16);
- }
- /* Second reduction step to reduce sums to 16 bits */
- sum1 = (sum1 & 0xffff) + (sum1 >> 16);
- sum2 = (sum2 & 0xffff) + (sum2 >> 16);
- return sum2 << 16 | sum1;
-}
-
-int radeon_state_pm4(struct radeon_state *state)
-{
- int r;
-
- if (state == NULL)
- return 0;
- state->cpm4 = 0;
- r = state->stype->pm4(state);
- if (r) {
- fprintf(stderr, "%s failed to build PM4 for state(%d %d)\n",
- __func__, state->stype->stype, state->id);
- return r;
- }
- state->pm4_crc = crc32(state->pm4, state->cpm4 * 4);
- return 0;
-}
-
-int radeon_state_reloc(struct radeon_state *state, unsigned id, unsigned bo_id)
-{
- state->reloc_pm4_id[state->nreloc] = id;
- state->reloc_bo_id[state->nreloc] = bo_id;
- state->nreloc++;
- return 0;
-}
+++ /dev/null
-#include <pipe/p_compiler.h>
-#include <pipe/p_screen.h>
-#include <pipebuffer/pb_bufmgr.h>
-#include "radeon_priv.h"
-
-struct radeon_ws_bo *radeon_ws_bo(struct radeon *radeon,
- unsigned size, unsigned alignment, unsigned usage)
-{
- struct radeon_ws_bo *ws_bo = calloc(1, sizeof(struct radeon_ws_bo));
- struct pb_desc desc;
- struct pb_manager *man;
-
- desc.alignment = alignment;
- desc.usage = usage;
-
- if (!radeon->use_mem_constant && (usage & PIPE_BIND_CONSTANT_BUFFER)) {
- man = radeon->mman;
- } else if (usage & (PIPE_BIND_CONSTANT_BUFFER | PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER))
- man = radeon->cman;
- else
- man = radeon->kman;
-
- ws_bo->pb = man->create_buffer(man, size, &desc);
- if (ws_bo->pb == NULL) {
- free(ws_bo);
- return NULL;
- }
-
- pipe_reference_init(&ws_bo->reference, 1);
- return ws_bo;
-}
-
-struct radeon_ws_bo *radeon_ws_bo_handle(struct radeon *radeon,
- unsigned handle)
-{
- struct radeon_ws_bo *ws_bo = calloc(1, sizeof(struct radeon_ws_bo));
-
- ws_bo->pb = radeon_bo_pb_create_buffer_from_handle(radeon->kman, handle);
- if (!ws_bo->pb) {
- free(ws_bo);
- return NULL;
- }
- pipe_reference_init(&ws_bo->reference, 1);
- return ws_bo;
-}
-
-void *radeon_ws_bo_map(struct radeon *radeon, struct radeon_ws_bo *bo, unsigned usage, void *ctx)
-{
- return pb_map(bo->pb, usage, ctx);
-}
-
-void radeon_ws_bo_unmap(struct radeon *radeon, struct radeon_ws_bo *bo)
-{
- pb_unmap(bo->pb);
-}
-
-static void radeon_ws_bo_destroy(struct radeon *radeon, struct radeon_ws_bo *bo)
-{
- if (bo->pb)
- pb_reference(&bo->pb, NULL);
- free(bo);
-}
-
-void radeon_ws_bo_reference(struct radeon *radeon, struct radeon_ws_bo **dst,
- struct radeon_ws_bo *src)
-{
- struct radeon_ws_bo *old = *dst;
-
- if (pipe_reference(&(*dst)->reference, &src->reference)) {
- radeon_ws_bo_destroy(radeon, old);
- }
- *dst = src;
-}
-
-unsigned radeon_ws_bo_get_handle(struct radeon_ws_bo *pb_bo)
-{
- struct radeon_bo *bo;
-
- bo = radeon_bo_pb_get_bo(pb_bo->pb);
- if (!bo)
- return 0;
-
- return bo->handle;
-}
-
-unsigned radeon_ws_bo_get_size(struct radeon_ws_bo *pb_bo)
-{
- struct radeon_bo *bo;
-
- bo = radeon_bo_pb_get_bo(pb_bo->pb);
- if (!bo)
- return 0;
-
- return bo->size;
-}
#include "util/u_format.h"
#include "vmw_screen.h"
-#include "vmw_screen.h"
#include "vmw_surface.h"
#include "svga_drm_public.h"
}
struct sw_winsys *
-wrapper_sw_winsys_warp_pipe_screen(struct pipe_screen *screen)
+wrapper_sw_winsys_wrap_pipe_screen(struct pipe_screen *screen)
{
struct wrapper_sw_winsys *wsw = CALLOC_STRUCT(wrapper_sw_winsys);
err:
return NULL;
}
+
+struct pipe_screen *
+wrapper_sw_winsys_dewrap_pipe_screen(struct sw_winsys *ws)
+{
+ struct wrapper_sw_winsys *wsw = wrapper_sw_winsys(ws);
+ struct pipe_screen *screen = wsw->screen;
+
+ wsw->pipe->destroy(wsw->pipe);
+ /* don't destroy the screen its needed later on */
+
+ FREE(wsw);
+ return screen;
+}
struct sw_winsys;
struct pipe_screen;
-struct sw_winsys *wrapper_sw_winsys_warp_pipe_screen(struct pipe_screen *screen);
+/*
+ * Wrap a pipe screen.
+ */
+struct sw_winsys *wrapper_sw_winsys_wrap_pipe_screen(struct pipe_screen *screen);
+
+/*
+ * Destroy the sw_winsys and return the wrapped pipe_screen.
+ * Not destroying it as sw_winsys::destroy does.
+ */
+struct pipe_screen *wrapper_sw_winsys_dewrap_pipe_screen(struct sw_winsys *sw_winsys);
#endif
loop_controls.cpp \
loop_unroll.cpp \
lower_noise.cpp \
+ lower_texture_projection.cpp \
lower_variable_index_to_cond_assign.cpp \
opt_redundant_jumps.cpp \
s_expression.cpp
};
struct ast_type_qualifier {
- unsigned invariant:1;
- unsigned constant:1;
- unsigned attribute:1;
- unsigned varying:1;
- unsigned in:1;
- unsigned out:1;
- unsigned centroid:1;
- unsigned uniform:1;
- unsigned smooth:1;
- unsigned flat:1;
- unsigned noperspective:1;
-
- /** \name Layout qualifiers for GL_ARB_fragment_coord_conventions */
- /*@{*/
- unsigned origin_upper_left:1;
- unsigned pixel_center_integer:1;
- /*@}*/
+ union {
+ struct {
+ unsigned invariant:1;
+ unsigned constant:1;
+ unsigned attribute:1;
+ unsigned varying:1;
+ unsigned in:1;
+ unsigned out:1;
+ unsigned centroid:1;
+ unsigned uniform:1;
+ unsigned smooth:1;
+ unsigned flat:1;
+ unsigned noperspective:1;
+
+ /** \name Layout qualifiers for GL_ARB_fragment_coord_conventions */
+ /*@{*/
+ unsigned origin_upper_left:1;
+ unsigned pixel_center_integer:1;
+ /*@}*/
+
+ /**
+ * Flag set if GL_ARB_explicit_attrib_location "location" layout
+ * qualifier is used.
+ */
+ unsigned explicit_location:1;
+ } q;
+ unsigned i;
+ } flags;
+
+ /**
+ * Location specified via GL_ARB_explicit_attrib_location layout
+ *
+ * \note
+ * This field is only valid if \c explicit_location is set.
+ */
+ unsigned location;
};
class ast_struct_specifier : public ast_node {
return type;
}
+/**
+ * \brief Return the result type of a bit-logic operation.
+ *
+ * If the given types to the bit-logic operator are invalid, return
+ * glsl_type::error_type.
+ *
+ * \param type_a Type of LHS of bit-logic op
+ * \param type_b Type of RHS of bit-logic op
+ */
+static const struct glsl_type *
+bit_logic_result_type(const struct glsl_type *type_a,
+ const struct glsl_type *type_b,
+ ast_operators op,
+ struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
+{
+ if (state->language_version < 130) {
+ _mesa_glsl_error(loc, state, "bit operations require GLSL 1.30");
+ return glsl_type::error_type;
+ }
+
+ /* From page 50 (page 56 of PDF) of GLSL 1.30 spec:
+ *
+ * "The bitwise operators and (&), exclusive-or (^), and inclusive-or
+ * (|). The operands must be of type signed or unsigned integers or
+ * integer vectors."
+ */
+ if (!type_a->is_integer()) {
+ _mesa_glsl_error(loc, state, "LHS of `%s' must be an integer",
+ ast_expression::operator_string(op));
+ return glsl_type::error_type;
+ }
+ if (!type_b->is_integer()) {
+ _mesa_glsl_error(loc, state, "RHS of `%s' must be an integer",
+ ast_expression::operator_string(op));
+ return glsl_type::error_type;
+ }
+
+ /* "The fundamental types of the operands (signed or unsigned) must
+ * match,"
+ */
+ if (type_a->base_type != type_b->base_type) {
+ _mesa_glsl_error(loc, state, "operands of `%s' must have the same "
+ "base type", ast_expression::operator_string(op));
+ return glsl_type::error_type;
+ }
+
+ /* "The operands cannot be vectors of differing size." */
+ if (type_a->is_vector() &&
+ type_b->is_vector() &&
+ type_a->vector_elements != type_b->vector_elements) {
+ _mesa_glsl_error(loc, state, "operands of `%s' cannot be vectors of "
+ "different sizes", ast_expression::operator_string(op));
+ return glsl_type::error_type;
+ }
+
+ /* "If one operand is a scalar and the other a vector, the scalar is
+ * applied component-wise to the vector, resulting in the same type as
+ * the vector. The fundamental types of the operands [...] will be the
+ * resulting fundamental type."
+ */
+ if (type_a->is_scalar())
+ return type_b;
+ else
+ return type_a;
+}
static const struct glsl_type *
modulus_result_type(const struct glsl_type *type_a,
return glsl_type::bool_type;
}
+/**
+ * \brief Return the result type of a bit-shift operation.
+ *
+ * If the given types to the bit-shift operator are invalid, return
+ * glsl_type::error_type.
+ *
+ * \param type_a Type of LHS of bit-shift op
+ * \param type_b Type of RHS of bit-shift op
+ */
+static const struct glsl_type *
+shift_result_type(const struct glsl_type *type_a,
+ const struct glsl_type *type_b,
+ ast_operators op,
+ struct _mesa_glsl_parse_state *state, YYLTYPE *loc)
+{
+ if (state->language_version < 130) {
+ _mesa_glsl_error(loc, state, "bit operations require GLSL 1.30");
+ return glsl_type::error_type;
+ }
+
+ /* From page 50 (page 56 of the PDF) of the GLSL 1.30 spec:
+ *
+ * "The shift operators (<<) and (>>). For both operators, the operands
+ * must be signed or unsigned integers or integer vectors. One operand
+ * can be signed while the other is unsigned."
+ */
+ if (!type_a->is_integer()) {
+ _mesa_glsl_error(loc, state, "LHS of operator %s must be an integer or "
+ "integer vector", ast_expression::operator_string(op));
+ return glsl_type::error_type;
+
+ }
+ if (!type_b->is_integer()) {
+ _mesa_glsl_error(loc, state, "RHS of operator %s must be an integer or "
+ "integer vector", ast_expression::operator_string(op));
+ return glsl_type::error_type;
+ }
+
+ /* "If the first operand is a scalar, the second operand has to be
+ * a scalar as well."
+ */
+ if (type_a->is_scalar() && !type_b->is_scalar()) {
+ _mesa_glsl_error(loc, state, "If the first operand of %s is scalar, the "
+ "second must be scalar as well",
+ ast_expression::operator_string(op));
+ return glsl_type::error_type;
+ }
+
+ /* If both operands are vectors, check that they have same number of
+ * elements.
+ */
+ if (type_a->is_vector() &&
+ type_b->is_vector() &&
+ type_a->vector_elements != type_b->vector_elements) {
+ _mesa_glsl_error(loc, state, "Vector operands to operator %s must "
+ "have same number of elements",
+ ast_expression::operator_string(op));
+ return glsl_type::error_type;
+ }
+
+ /* "In all cases, the resulting type will be the same type as the left
+ * operand."
+ */
+ return type_a;
+}
/**
* Validates that a value can be assigned to a location with a specified type
case ast_lshift:
case ast_rshift:
- _mesa_glsl_error(& loc, state, "FINISHME: implement bit-shift operators");
- error_emitted = true;
- break;
+ if (state->language_version < 130) {
+ _mesa_glsl_error(&loc, state, "operator %s requires GLSL 1.30",
+ operator_string(this->oper));
+ error_emitted = true;
+ }
+
+ op[0] = this->subexpressions[0]->hir(instructions, state);
+ op[1] = this->subexpressions[1]->hir(instructions, state);
+ type = shift_result_type(op[0]->type, op[1]->type, this->oper, state,
+ &loc);
+ result = new(ctx) ir_expression(operations[this->oper], type,
+ op[0], op[1]);
+ error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
+ break;
case ast_less:
case ast_greater:
case ast_bit_or:
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
-
- if (state->language_version < 130) {
- _mesa_glsl_error(&loc, state, "bit-wise operations require GLSL 1.30");
- error_emitted = true;
- }
-
- if (!op[0]->type->is_integer()) {
- _mesa_glsl_error(&loc, state, "LHS of `%s' must be an integer",
- operator_string(this->oper));
- error_emitted = true;
- }
-
- if (!op[1]->type->is_integer()) {
- _mesa_glsl_error(&loc, state, "RHS of `%s' must be an integer",
- operator_string(this->oper));
- error_emitted = true;
- }
-
- if (op[0]->type->base_type != op[1]->type->base_type) {
- _mesa_glsl_error(&loc, state, "operands of `%s' must have the same "
- "base type", operator_string(this->oper));
- error_emitted = true;
- }
-
- if (op[0]->type->is_vector() && op[1]->type->is_vector()
- && op[0]->type->vector_elements != op[1]->type->vector_elements) {
- _mesa_glsl_error(&loc, state, "operands of `%s' cannot be vectors of "
- "different sizes", operator_string(this->oper));
- error_emitted = true;
- }
-
- type = op[0]->type->is_scalar() ? op[1]->type : op[0]->type;
+ type = bit_logic_result_type(op[0]->type, op[1]->type, this->oper,
+ state, &loc);
result = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
}
case ast_ls_assign:
- case ast_rs_assign:
- _mesa_glsl_error(& loc, state,
- "FINISHME: implement bit-shift assignment operators");
- error_emitted = true;
+ case ast_rs_assign: {
+ op[0] = this->subexpressions[0]->hir(instructions, state);
+ op[1] = this->subexpressions[1]->hir(instructions, state);
+ type = shift_result_type(op[0]->type, op[1]->type, this->oper, state,
+ &loc);
+ ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
+ type, op[0], op[1]);
+ result = do_assignment(instructions, state, op[0]->clone(ctx, NULL),
+ temp_rhs,
+ this->subexpressions[0]->get_location());
+ error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
break;
+ }
case ast_and_assign:
case ast_xor_assign:
- case ast_or_assign:
- _mesa_glsl_error(& loc, state,
- "FINISHME: implement logic assignment operators");
- error_emitted = true;
+ case ast_or_assign: {
+ op[0] = this->subexpressions[0]->hir(instructions, state);
+ op[1] = this->subexpressions[1]->hir(instructions, state);
+ type = bit_logic_result_type(op[0]->type, op[1]->type, this->oper,
+ state, &loc);
+ ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
+ type, op[0], op[1]);
+ result = do_assignment(instructions, state, op[0]->clone(ctx, NULL),
+ temp_rhs,
+ this->subexpressions[0]->get_location());
+ error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
break;
+ }
case ast_conditional: {
op[0] = this->subexpressions[0]->hir(instructions, state);
struct _mesa_glsl_parse_state *state,
YYLTYPE *loc)
{
- if (qual->invariant)
+ if (qual->flags.q.invariant)
var->invariant = 1;
/* FINISHME: Mark 'in' variables at global scope as read-only. */
- if (qual->constant || qual->attribute || qual->uniform
- || (qual->varying && (state->target == fragment_shader)))
+ if (qual->flags.q.constant || qual->flags.q.attribute
+ || qual->flags.q.uniform
+ || (qual->flags.q.varying && (state->target == fragment_shader)))
var->read_only = 1;
- if (qual->centroid)
+ if (qual->flags.q.centroid)
var->centroid = 1;
- if (qual->attribute && state->target != vertex_shader) {
+ if (qual->flags.q.attribute && state->target != vertex_shader) {
var->type = glsl_type::error_type;
_mesa_glsl_error(loc, state,
"`attribute' variables may not be declared in the "
* float, vec2, vec3, vec4, mat2, mat3, and mat4, or arrays of
* these."
*/
- if (qual->varying) {
+ if (qual->flags.q.varying) {
const glsl_type *non_array_type;
if (var->type && var->type->is_array())
/* If there is no qualifier that changes the mode of the variable, leave
* the setting alone.
*/
- if (qual->in && qual->out)
+ if (qual->flags.q.in && qual->flags.q.out)
var->mode = ir_var_inout;
- else if (qual->attribute || qual->in
- || (qual->varying && (state->target == fragment_shader)))
+ else if (qual->flags.q.attribute || qual->flags.q.in
+ || (qual->flags.q.varying && (state->target == fragment_shader)))
var->mode = ir_var_in;
- else if (qual->out || (qual->varying && (state->target == vertex_shader)))
+ else if (qual->flags.q.out
+ || (qual->flags.q.varying && (state->target == vertex_shader)))
var->mode = ir_var_out;
- else if (qual->uniform)
+ else if (qual->flags.q.uniform)
var->mode = ir_var_uniform;
- if (qual->flat)
+ if (qual->flags.q.flat)
var->interpolation = ir_var_flat;
- else if (qual->noperspective)
+ else if (qual->flags.q.noperspective)
var->interpolation = ir_var_noperspective;
else
var->interpolation = ir_var_smooth;
- var->pixel_center_integer = qual->pixel_center_integer;
- var->origin_upper_left = qual->origin_upper_left;
- if ((qual->origin_upper_left || qual->pixel_center_integer)
+ var->pixel_center_integer = qual->flags.q.pixel_center_integer;
+ var->origin_upper_left = qual->flags.q.origin_upper_left;
+ if ((qual->flags.q.origin_upper_left || qual->flags.q.pixel_center_integer)
&& (strcmp(var->name, "gl_FragCoord") != 0)) {
- const char *const qual_string = (qual->origin_upper_left)
+ const char *const qual_string = (qual->flags.q.origin_upper_left)
? "origin_upper_left" : "pixel_center_integer";
_mesa_glsl_error(loc, state,
qual_string);
}
+ if (qual->flags.q.explicit_location) {
+ const bool global_scope = (state->current_function == NULL);
+ bool fail = false;
+ const char *string = "";
+
+ /* In the vertex shader only shader inputs can be given explicit
+ * locations.
+ *
+ * In the fragment shader only shader outputs can be given explicit
+ * locations.
+ */
+ switch (state->target) {
+ case vertex_shader:
+ if (!global_scope || (var->mode != ir_var_in)) {
+ fail = true;
+ string = "input";
+ }
+ break;
+
+ case geometry_shader:
+ _mesa_glsl_error(loc, state,
+ "geometry shader variables cannot be given "
+ "explicit locations\n");
+ break;
+
+ case fragment_shader:
+ if (!global_scope || (var->mode != ir_var_in)) {
+ fail = true;
+ string = "output";
+ }
+ break;
+ }
+
+ if (fail) {
+ _mesa_glsl_error(loc, state,
+ "only %s shader %s variables can be given an "
+ "explicit location\n",
+ _mesa_glsl_shader_target_name(state->target),
+ string);
+ } else {
+ var->explicit_location = true;
+
+ /* This bit of silliness is needed because invalid explicit locations
+ * are supposed to be flagged during linking. Small negative values
+ * biased by VERT_ATTRIB_GENERIC0 or FRAG_RESULT_DATA0 could alias
+ * built-in values (e.g., -16+VERT_ATTRIB_GENERIC0 = VERT_ATTRIB_POS).
+ * The linker needs to be able to differentiate these cases. This
+ * ensures that negative values stay negative.
+ */
+ if (qual->location >= 0) {
+ var->location = (state->target == vertex_shader)
+ ? (qual->location + VERT_ATTRIB_GENERIC0)
+ : (qual->location + FRAG_RESULT_DATA0);
+ } else {
+ var->location = qual->location;
+ }
+ }
+ }
+
if (var->type->is_array() && state->language_version != 110) {
var->array_lvalue = true;
}
* This is relaxed in GLSL 1.30.
*/
if (state->language_version < 120) {
- if (this->type->qualifier.out) {
+ if (this->type->qualifier.flags.q.out) {
_mesa_glsl_error(& loc, state,
"`out' qualifier in declaration of `%s' "
"only valid for function parameters in GLSL 1.10.",
decl->identifier);
}
- if (this->type->qualifier.in) {
+ if (this->type->qualifier.flags.q.in) {
_mesa_glsl_error(& loc, state,
"`in' qualifier in declaration of `%s' "
"only valid for function parameters in GLSL 1.10.",
apply_type_qualifier_to_variable(& this->type->qualifier, var, state,
& loc);
- if (this->type->qualifier.invariant) {
+ if (this->type->qualifier.flags.q.invariant) {
if ((state->target == vertex_shader) && !(var->mode == ir_var_out ||
var->mode == ir_var_inout)) {
/* FINISHME: Note that this doesn't work for invariant on
/* There is no need to check for 'inout' here because the parser will
* only allow that in function parameter lists.
*/
- if (this->type->qualifier.attribute) {
+ if (this->type->qualifier.flags.q.attribute) {
mode = "attribute";
- } else if (this->type->qualifier.uniform) {
+ } else if (this->type->qualifier.flags.q.uniform) {
mode = "uniform";
- } else if (this->type->qualifier.varying) {
+ } else if (this->type->qualifier.flags.q.varying) {
mode = "varying";
- } else if (this->type->qualifier.in) {
+ } else if (this->type->qualifier.flags.q.in) {
mode = "in";
extra = " or in function parameter list";
- } else if (this->type->qualifier.out) {
+ } else if (this->type->qualifier.flags.q.out) {
mode = "out";
extra = " or in function parameter list";
}
/* Calculate the constant value if this is a const or uniform
* declaration.
*/
- if (this->type->qualifier.constant || this->type->qualifier.uniform) {
+ if (this->type->qualifier.flags.q.constant
+ || this->type->qualifier.flags.q.uniform) {
ir_rvalue *new_rhs = validate_assignment(state, var->type, rhs);
if (new_rhs != NULL) {
rhs = new_rhs;
_mesa_glsl_error(& initializer_loc, state,
"initializer of %s variable `%s' must be a "
"constant expression",
- (this->type->qualifier.constant)
+ (this->type->qualifier.flags.q.constant)
? "const" : "uniform",
decl->identifier);
if (var->type->is_numeric()) {
if (rhs && !rhs->type->is_error()) {
bool temp = var->read_only;
- if (this->type->qualifier.constant)
+ if (this->type->qualifier.flags.q.constant)
var->read_only = false;
/* Never emit code to initialize a uniform.
*/
- if (!this->type->qualifier.uniform)
+ if (!this->type->qualifier.flags.q.uniform)
result = do_assignment(&initializer_instructions, state,
lhs, rhs,
this->get_location());
* its declaration, so they must be initialized when
* declared."
*/
- if (this->type->qualifier.constant && decl->initializer == NULL) {
+ if (this->type->qualifier.flags.q.constant && decl->initializer == NULL) {
_mesa_glsl_error(& loc, state,
"const declaration of `%s' must be initialized");
}
bool
ast_fully_specified_type::has_qualifiers() const
{
- return qualifier.invariant || qualifier.constant || qualifier.attribute
- || qualifier.varying || qualifier.in
- || qualifier.out || qualifier.centroid
- || qualifier.uniform || qualifier.smooth
- || qualifier.flat || qualifier.noperspective;
+ return this->qualifier.flags.i != 0;
}
#include "ast.h"
extern "C" struct gl_shader *
-_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
+_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
gl_shader *
read_builtins(GLenum target, const char *protos, const char **functions, unsigned count)
{
- GLcontext fakeCtx;
+ struct gl_context fakeCtx;
fakeCtx.API = API_OPENGL;
gl_shader *sh = _mesa_new_shader(NULL, 0, target);
struct _mesa_glsl_parse_state *st =
"))\n"
""
;
+static const char *builtin_round =
+ "((function round\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float arg0))\n"
+ " ((return (expression float round_even (var_ref arg0)))))\n"
+ "\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 arg0))\n"
+ " ((return (expression vec2 round_even (var_ref arg0)))))\n"
+ "\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 arg0))\n"
+ " ((return (expression vec3 round_even (var_ref arg0)))))\n"
+ "\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 arg0))\n"
+ " ((return (expression vec4 round_even (var_ref arg0)))))\n"
+ "))\n"
+ ""
+;
+static const char *builtin_roundEven =
+ "((function roundEven\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float arg0))\n"
+ " ((return (expression float round_even (var_ref arg0)))))\n"
+ "\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 arg0))\n"
+ " ((return (expression vec2 round_even (var_ref arg0)))))\n"
+ "\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 arg0))\n"
+ " ((return (expression vec3 round_even (var_ref arg0)))))\n"
+ "\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 arg0))\n"
+ " ((return (expression vec4 round_even (var_ref arg0)))))\n"
+ "))\n"
+ ""
+;
static const char *builtin_shadow1D =
"((function shadow1D\n"
" (signature vec4\n"
"\n"
""
;
+static const char *builtin_trunc =
+ "((function trunc\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float arg0))\n"
+ " ((return (expression float trunc (var_ref arg0)))))\n"
+ "\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 arg0))\n"
+ " ((return (expression vec2 trunc (var_ref arg0)))))\n"
+ "\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 arg0))\n"
+ " ((return (expression vec3 trunc (var_ref arg0)))))\n"
+ "\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 arg0))\n"
+ " ((return (expression vec4 trunc (var_ref arg0)))))\n"
+ "))\n"
+ ""
+;
static const char *prototypes_for_100_frag =
"(\n"
"(function radians\n"
" (parameters\n"
" (declare (in) vec4 x))\n"
" ()))\n"
+ "(function trunc\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function round\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function roundEven\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
"(function ceil\n"
" (signature float\n"
" (parameters\n"
builtin_radians,
builtin_reflect,
builtin_refract,
+ builtin_round,
+ builtin_roundEven,
builtin_shadow1D,
builtin_shadow1DLod,
builtin_shadow1DProj,
builtin_textureProjGrad,
builtin_textureProjLod,
builtin_transpose,
+ builtin_trunc,
};
static const char *prototypes_for_130_vert =
"(\n"
" (parameters\n"
" (declare (in) vec4 x))\n"
" ()))\n"
+ "(function trunc\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function round\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function roundEven\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
"(function ceil\n"
" (signature float\n"
" (parameters\n"
builtin_radians,
builtin_reflect,
builtin_refract,
+ builtin_round,
+ builtin_roundEven,
builtin_shadow1D,
builtin_shadow1DLod,
builtin_shadow1DProj,
builtin_textureProjGrad,
builtin_textureProjLod,
builtin_transpose,
+ builtin_trunc,
};
static const char *prototypes_for_ARB_texture_rectangle_frag =
"(\n"
};
const glsl_type *const glsl_type::uint_type = & builtin_130_types[0];
+const glsl_type *const glsl_type::uvec2_type = & builtin_130_types[1];
+const glsl_type *const glsl_type::uvec3_type = & builtin_130_types[2];
const glsl_type *const glsl_type::uvec4_type = & builtin_130_types[3];
/*@}*/
--- /dev/null
+((function round
+ (signature float
+ (parameters
+ (declare (in) float arg0))
+ ((return (expression float round_even (var_ref arg0)))))
+
+ (signature vec2
+ (parameters
+ (declare (in) vec2 arg0))
+ ((return (expression vec2 round_even (var_ref arg0)))))
+
+ (signature vec3
+ (parameters
+ (declare (in) vec3 arg0))
+ ((return (expression vec3 round_even (var_ref arg0)))))
+
+ (signature vec4
+ (parameters
+ (declare (in) vec4 arg0))
+ ((return (expression vec4 round_even (var_ref arg0)))))
+))
--- /dev/null
+((function roundEven
+ (signature float
+ (parameters
+ (declare (in) float arg0))
+ ((return (expression float round_even (var_ref arg0)))))
+
+ (signature vec2
+ (parameters
+ (declare (in) vec2 arg0))
+ ((return (expression vec2 round_even (var_ref arg0)))))
+
+ (signature vec3
+ (parameters
+ (declare (in) vec3 arg0))
+ ((return (expression vec3 round_even (var_ref arg0)))))
+
+ (signature vec4
+ (parameters
+ (declare (in) vec4 arg0))
+ ((return (expression vec4 round_even (var_ref arg0)))))
+))
--- /dev/null
+((function trunc
+ (signature float
+ (parameters
+ (declare (in) float arg0))
+ ((return (expression float trunc (var_ref arg0)))))
+
+ (signature vec2
+ (parameters
+ (declare (in) vec2 arg0))
+ ((return (expression vec2 trunc (var_ref arg0)))))
+
+ (signature vec3
+ (parameters
+ (declare (in) vec3 arg0))
+ ((return (expression vec3 trunc (var_ref arg0)))))
+
+ (signature vec4
+ (parameters
+ (declare (in) vec4 arg0))
+ ((return (expression vec4 trunc (var_ref arg0)))))
+))
vec3 floor(vec3 x);
vec4 floor(vec4 x);
+float trunc(float x);
+vec2 trunc(vec2 x);
+vec3 trunc(vec3 x);
+vec4 trunc(vec4 x);
+
+float round(float x);
+vec2 round(vec2 x);
+vec3 round(vec3 x);
+vec4 round(vec4 x);
+
+float roundEven(float x);
+vec2 roundEven(vec2 x);
+vec3 roundEven(vec3 x);
+vec4 roundEven(vec4 x);
+
float ceil(float x);
vec2 ceil(vec2 x);
vec3 ceil(vec3 x);
vec3 floor(vec3 x);
vec4 floor(vec4 x);
+float trunc(float x);
+vec2 trunc(vec2 x);
+vec3 trunc(vec3 x);
+vec4 trunc(vec4 x);
+
+float round(float x);
+vec2 round(vec2 x);
+vec3 round(vec3 x);
+vec4 round(vec4 x);
+
+float roundEven(float x);
+vec2 roundEven(vec2 x);
+vec3 roundEven(vec3 x);
+vec4 roundEven(vec4 x);
+
float ceil(float x);
vec2 ceil(vec2 x);
vec3 ceil(vec3 x);
#include "ast.h"
extern "C" struct gl_shader *
-_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
+_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
gl_shader *
read_builtins(GLenum target, const char *protos, const char **functions, unsigned count)
{
- GLcontext fakeCtx;
+ struct gl_context fakeCtx;
fakeCtx.API = API_OPENGL;
gl_shader *sh = _mesa_new_shader(NULL, 0, target);
struct _mesa_glsl_parse_state *st =
-/* A Bison parser, made by GNU Bison 2.4.3. */
+
+/* A Bison parser, made by GNU Bison 2.4.1. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.4.3"
+#define YYBISON_VERSION "2.4.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Line 189 of yacc.c */
-#line 223 "glcpp/glcpp-parse.c"
+#line 224 "glcpp/glcpp-parse.c"
/* Enabling traces. */
#ifndef YYDEBUG
/* Line 264 of yacc.c */
-#line 311 "glcpp/glcpp-parse.c"
+#line 312 "glcpp/glcpp-parse.c"
#ifdef short
# undef short
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
+# if YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. However,
- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
- discussed. */
+ Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
-#if defined YYFAIL
- /* This is here to suppress warnings from the GCC cpp's
- -Wunused-macros. Normally we don't worry about that warning, but
- some users do, and we want to make it easy for users to remove
- YYFAIL uses, which will produce warnings from Bison 2.5. */
-#endif
#define YYRECOVERING() (!!yyerrstatus)
we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+# if YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
YYLTYPE *yylsp;
/* The locations where the error started and ended. */
- YYLTYPE yyerror_range[3];
+ YYLTYPE yyerror_range[2];
YYSIZE_T yystacksize;
yyvsp = yyvs;
yylsp = yyls;
-#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+#if YYLTYPE_IS_TRIVIAL
/* Initialize the default location before parsing starts. */
yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = 1;
/* User initialization code. */
-/* Line 1251 of yacc.c */
+/* Line 1242 of yacc.c */
#line 155 "glcpp/glcpp-parse.y"
{
yylloc.first_line = 1;
yylloc.source = 0;
}
-/* Line 1251 of yacc.c */
-#line 1625 "glcpp/glcpp-parse.c"
+/* Line 1242 of yacc.c */
+#line 1617 "glcpp/glcpp-parse.c"
yylsp[0] = yylloc;
goto yysetstate;
{
case 4:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 194 "glcpp/glcpp-parse.y"
{
glcpp_print(parser->output, "\n");
case 5:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 197 "glcpp/glcpp-parse.y"
{
_glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list));
case 8:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 207 "glcpp/glcpp-parse.y"
{
_glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival));
case 9:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 210 "glcpp/glcpp-parse.y"
{
_glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival));
case 10:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 216 "glcpp/glcpp-parse.y"
{
_define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list));
case 11:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 219 "glcpp/glcpp-parse.y"
{
_define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list));
case 12:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 222 "glcpp/glcpp-parse.y"
{
_define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list));
case 13:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 225 "glcpp/glcpp-parse.y"
{
macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str));
case 14:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 233 "glcpp/glcpp-parse.y"
{
/* Be careful to only evaluate the 'if' expression if
case 15:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 252 "glcpp/glcpp-parse.y"
{
/* #if without an expression is only an error if we
case 16:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 262 "glcpp/glcpp-parse.y"
{
macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str));
case 17:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 267 "glcpp/glcpp-parse.y"
{
macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str));
case 18:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 272 "glcpp/glcpp-parse.y"
{
/* Be careful to only evaluate the 'elif' expression
case 19:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 291 "glcpp/glcpp-parse.y"
{
/* #elif without an expression is an error unless we
case 20:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 306 "glcpp/glcpp-parse.y"
{
_glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1);
case 21:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 309 "glcpp/glcpp-parse.y"
{
_glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)]));
case 22:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 312 "glcpp/glcpp-parse.y"
{
macro_t *macro = hash_table_find (parser->defines, "__VERSION__");
case 24:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 329 "glcpp/glcpp-parse.y"
{
if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) {
case 25:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 338 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (1)].ival);
case 27:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 344 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival);
case 28:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 347 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival);
case 29:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 350 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival);
case 30:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 353 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival);
case 31:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 356 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival);
case 32:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 359 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival);
case 33:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 362 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival);
case 34:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 365 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival);
case 35:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 368 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival);
case 36:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 371 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival);
case 37:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 374 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival);
case 38:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 377 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival);
case 39:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 380 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival);
case 40:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 383 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival);
case 41:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 386 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival);
case 42:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 389 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival);
case 43:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 392 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival);
case 44:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 395 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival);
case 45:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 398 "glcpp/glcpp-parse.y"
{
(yyval.ival) = ! (yyvsp[(2) - (2)].ival);
case 46:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 401 "glcpp/glcpp-parse.y"
{
(yyval.ival) = ~ (yyvsp[(2) - (2)].ival);
case 47:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 404 "glcpp/glcpp-parse.y"
{
(yyval.ival) = - (yyvsp[(2) - (2)].ival);
case 48:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 407 "glcpp/glcpp-parse.y"
{
(yyval.ival) = + (yyvsp[(2) - (2)].ival);
case 49:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 410 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(2) - (3)].ival);
case 50:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 416 "glcpp/glcpp-parse.y"
{
(yyval.string_list) = _string_list_create (parser);
case 51:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 421 "glcpp/glcpp-parse.y"
{
(yyval.string_list) = (yyvsp[(1) - (3)].string_list);
case 52:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 429 "glcpp/glcpp-parse.y"
{ (yyval.token_list) = NULL; ;}
break;
case 54:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 434 "glcpp/glcpp-parse.y"
{
yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #");
case 55:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 440 "glcpp/glcpp-parse.y"
{ (yyval.token_list) = NULL; ;}
break;
case 58:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 446 "glcpp/glcpp-parse.y"
{
glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive");
case 59:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 453 "glcpp/glcpp-parse.y"
{
int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0;
case 60:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 457 "glcpp/glcpp-parse.y"
{
int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0;
case 62:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 466 "glcpp/glcpp-parse.y"
{
parser->space_tokens = 1;
case 63:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 472 "glcpp/glcpp-parse.y"
{
(yyval.token_list) = (yyvsp[(1) - (2)].token_list);
case 64:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 480 "glcpp/glcpp-parse.y"
{
parser->space_tokens = 1;
case 65:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 486 "glcpp/glcpp-parse.y"
{
(yyval.token_list) = (yyvsp[(1) - (2)].token_list);
case 66:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 494 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str));
case 67:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 498 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str));
case 68:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 502 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival));
case 69:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 506 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str));
case 70:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 510 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_ival (parser, SPACE, SPACE);
case 71:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 517 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '['; ;}
break;
case 72:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 518 "glcpp/glcpp-parse.y"
{ (yyval.ival) = ']'; ;}
break;
case 73:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 519 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '('; ;}
break;
case 74:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 520 "glcpp/glcpp-parse.y"
{ (yyval.ival) = ')'; ;}
break;
case 75:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 521 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '{'; ;}
break;
case 76:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 522 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '}'; ;}
break;
case 77:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 523 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '.'; ;}
break;
case 78:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 524 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '&'; ;}
break;
case 79:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 525 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '*'; ;}
break;
case 80:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 526 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '+'; ;}
break;
case 81:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 527 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '-'; ;}
break;
case 82:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 528 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '~'; ;}
break;
case 83:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 529 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '!'; ;}
break;
case 84:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 530 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '/'; ;}
break;
case 85:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 531 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '%'; ;}
break;
case 86:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 532 "glcpp/glcpp-parse.y"
{ (yyval.ival) = LEFT_SHIFT; ;}
break;
case 87:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 533 "glcpp/glcpp-parse.y"
{ (yyval.ival) = RIGHT_SHIFT; ;}
break;
case 88:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 534 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '<'; ;}
break;
case 89:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 535 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '>'; ;}
break;
case 90:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 536 "glcpp/glcpp-parse.y"
{ (yyval.ival) = LESS_OR_EQUAL; ;}
break;
case 91:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 537 "glcpp/glcpp-parse.y"
{ (yyval.ival) = GREATER_OR_EQUAL; ;}
break;
case 92:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 538 "glcpp/glcpp-parse.y"
{ (yyval.ival) = EQUAL; ;}
break;
case 93:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 539 "glcpp/glcpp-parse.y"
{ (yyval.ival) = NOT_EQUAL; ;}
break;
case 94:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 540 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '^'; ;}
break;
case 95:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 541 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '|'; ;}
break;
case 96:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 542 "glcpp/glcpp-parse.y"
{ (yyval.ival) = AND; ;}
break;
case 97:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 543 "glcpp/glcpp-parse.y"
{ (yyval.ival) = OR; ;}
break;
case 98:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 544 "glcpp/glcpp-parse.y"
{ (yyval.ival) = ';'; ;}
break;
case 99:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 545 "glcpp/glcpp-parse.y"
{ (yyval.ival) = ','; ;}
break;
case 100:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 546 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '='; ;}
break;
case 101:
-/* Line 1464 of yacc.c */
+/* Line 1455 of yacc.c */
#line 547 "glcpp/glcpp-parse.y"
{ (yyval.ival) = PASTE; ;}
break;
-/* Line 1464 of yacc.c */
-#line 2656 "glcpp/glcpp-parse.c"
+/* Line 1455 of yacc.c */
+#line 2648 "glcpp/glcpp-parse.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
#endif
}
- yyerror_range[1] = yylloc;
+ yyerror_range[0] = yylloc;
if (yyerrstatus == 3)
{
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- yyerror_range[1] = yylsp[1-yylen];
+ yyerror_range[0] = yylsp[1-yylen];
/* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);
if (yyssp == yyss)
YYABORT;
- yyerror_range[1] = *yylsp;
+ yyerror_range[0] = *yylsp;
yydestruct ("Error: popping",
yystos[yystate], yyvsp, yylsp, parser);
YYPOPSTACK (1);
*++yyvsp = yylval;
- yyerror_range[2] = yylloc;
+ yyerror_range[1] = yylloc;
/* Using YYLLOC is tempting, but would change the location of
the lookahead. YYLOC is available though. */
- YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
+ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
*++yylsp = yyloc;
/* Shift the error token. */
-/* Line 1684 of yacc.c */
+/* Line 1675 of yacc.c */
#line 550 "glcpp/glcpp-parse.y"
if (extensions->ARB_fragment_coord_conventions)
add_builtin_define(parser, "GL_ARB_fragment_coord_conventions",
1);
+
+ if (extensions->ARB_explicit_attrib_location)
+ add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1);
}
language_version = 110;
-/* A Bison parser, made by GNU Bison 2.4.3. */
+
+/* A Bison parser, made by GNU Bison 2.4.1. */
/* Skeleton interface for Bison's Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
if (extensions->ARB_fragment_coord_conventions)
add_builtin_define(parser, "GL_ARB_fragment_coord_conventions",
1);
+
+ if (extensions->ARB_explicit_attrib_location)
+ add_builtin_define(parser, "GL_ARB_explicit_attrib_location", 1);
}
language_version = 110;
#include <errno.h>
#include "glcpp.h"
#include "main/mtypes.h"
+#include "main/shaderobj.h"
extern int yydebug;
+void
+_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
+ struct gl_shader *sh)
+{
+ *ptr = sh;
+}
+
/* Read from fd until EOF and return a string of everything read.
*/
static char *
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
#define UINT32_MAX (4294967295U)
#endif
+#endif /* ! C99 */
+
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 183
-#define YY_END_OF_BUFFER 184
+#define YY_NUM_RULES 189
+#define YY_END_OF_BUFFER 190
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[708] =
+static yyconst flex_int16_t yy_accept[716] =
{ 0,
- 0, 0, 15, 15, 0, 0, 184, 182, 1, 20,
- 182, 182, 182, 182, 182, 182, 182, 182, 96, 94,
- 182, 182, 182, 181, 182, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 182, 1, 182, 91, 183,
- 15, 19, 183, 18, 16, 17, 13, 12, 1, 80,
- 87, 81, 90, 84, 75, 86, 76, 93, 98, 85,
- 99, 96, 0, 0, 101, 0, 94, 0, 77, 79,
- 78, 0, 181, 83, 181, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 181, 28, 181, 181, 181,
-
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 32, 181, 181, 56, 181, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 92, 82, 1, 0, 0,
- 2, 0, 0, 0, 0, 15, 14, 18, 17, 0,
- 98, 97, 0, 99, 0, 100, 95, 88, 89, 181,
- 104, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 181, 31, 181, 181, 181, 181, 181, 181, 181,
-
- 181, 181, 181, 25, 181, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 57, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 181, 0, 0, 0, 0, 14, 0, 98, 0,
- 97, 0, 99, 100, 181, 181, 23, 181, 181, 144,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 30,
- 107, 181, 181, 181, 181, 63, 181, 181, 112, 126,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 123, 147, 44, 45, 46, 181, 181, 181, 181,
-
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 181, 110, 102, 181, 181,
- 181, 181, 181, 181, 181, 41, 42, 43, 73, 181,
- 181, 0, 0, 0, 0, 0, 97, 181, 181, 26,
- 35, 36, 37, 181, 105, 181, 22, 181, 181, 181,
- 181, 134, 135, 136, 181, 103, 181, 127, 24, 137,
- 138, 139, 149, 131, 132, 133, 181, 181, 181, 58,
- 129, 181, 181, 38, 39, 40, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 181, 124, 181, 181, 181, 181, 181, 181, 181,
-
- 181, 181, 181, 106, 181, 146, 181, 181, 29, 0,
- 0, 0, 0, 153, 181, 181, 151, 181, 181, 181,
- 125, 120, 156, 181, 181, 181, 181, 181, 181, 115,
- 181, 181, 74, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 181, 181, 181, 181, 130, 111, 181, 181,
- 118, 34, 181, 181, 143, 64, 119, 72, 154, 113,
- 181, 181, 181, 181, 181, 181, 181, 0, 0, 0,
- 0, 181, 181, 181, 114, 33, 181, 181, 181, 181,
- 181, 181, 157, 158, 159, 181, 181, 181, 181, 148,
- 181, 181, 181, 181, 181, 181, 181, 181, 108, 181,
-
- 181, 181, 181, 181, 59, 181, 60, 181, 0, 0,
- 0, 0, 0, 181, 61, 27, 121, 161, 162, 163,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 116, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 109, 165, 166, 167, 181, 181, 128, 117, 0,
- 0, 6, 0, 0, 0, 11, 3, 21, 181, 181,
- 181, 181, 181, 181, 181, 181, 181, 160, 122, 62,
- 145, 181, 152, 150, 180, 66, 67, 68, 181, 181,
- 181, 181, 181, 181, 0, 0, 0, 0, 0, 0,
- 181, 181, 181, 164, 181, 181, 181, 181, 181, 181,
-
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 168,
- 4, 0, 5, 0, 0, 0, 0, 0, 181, 181,
- 181, 181, 181, 181, 181, 177, 181, 181, 181, 181,
- 181, 181, 69, 181, 181, 181, 0, 0, 0, 181,
- 181, 178, 169, 181, 170, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 179, 0, 0, 171, 172, 175,
- 176, 65, 181, 140, 181, 141, 155, 173, 174, 0,
- 0, 181, 181, 181, 0, 0, 0, 70, 181, 71,
- 0, 0, 0, 181, 0, 0, 0, 181, 0, 0,
- 7, 0, 0, 181, 0, 8, 0, 0, 142, 0,
-
- 0, 0, 0, 9, 0, 10, 0
+ 0, 0, 15, 15, 0, 0, 190, 188, 1, 20,
+ 188, 188, 188, 188, 188, 188, 188, 188, 102, 100,
+ 188, 188, 188, 187, 188, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 188, 1, 188, 189, 15,
+ 19, 189, 18, 16, 17, 13, 12, 1, 84, 93,
+ 85, 96, 90, 79, 92, 80, 99, 104, 91, 105,
+ 102, 0, 0, 107, 0, 100, 88, 81, 83, 82,
+ 89, 187, 97, 87, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 29, 187, 187, 187,
+
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 33, 187, 187, 60, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 98, 86, 1, 0,
+ 0, 2, 0, 0, 0, 0, 15, 14, 18, 17,
+ 0, 104, 103, 0, 105, 0, 106, 101, 94, 95,
+ 187, 110, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 32, 187, 187, 187, 187, 187, 187,
+
+ 187, 187, 187, 187, 25, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 61, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 0, 0, 0, 0, 14,
+ 0, 104, 0, 103, 0, 105, 106, 187, 187, 23,
+ 187, 187, 150, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 31, 113, 187, 187, 187, 187, 67, 187,
+ 187, 118, 132, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 129, 153, 48, 49, 50, 187,
+
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 116,
+ 108, 187, 187, 26, 187, 187, 187, 187, 187, 187,
+ 45, 46, 47, 77, 187, 187, 0, 0, 0, 0,
+ 0, 103, 187, 187, 27, 36, 37, 38, 187, 111,
+ 187, 22, 187, 187, 187, 187, 140, 141, 142, 187,
+ 109, 187, 133, 24, 143, 144, 145, 155, 137, 138,
+ 139, 187, 187, 187, 62, 135, 187, 187, 39, 40,
+ 41, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 130, 187, 187,
+
+ 187, 187, 187, 187, 187, 187, 187, 187, 112, 187,
+ 152, 42, 43, 44, 187, 187, 30, 0, 0, 0,
+ 0, 159, 187, 187, 157, 187, 187, 187, 131, 126,
+ 162, 187, 187, 187, 187, 187, 187, 121, 187, 187,
+ 78, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 187, 187, 187, 187, 136, 117, 187, 187, 124, 35,
+ 187, 187, 149, 68, 125, 76, 160, 119, 187, 187,
+ 187, 187, 187, 187, 187, 0, 0, 0, 0, 187,
+ 187, 187, 120, 34, 187, 187, 187, 187, 187, 187,
+ 163, 164, 165, 187, 187, 187, 187, 154, 187, 187,
+
+ 187, 187, 187, 187, 187, 187, 114, 187, 187, 187,
+ 187, 187, 63, 187, 64, 187, 0, 0, 0, 0,
+ 0, 187, 65, 28, 127, 167, 168, 169, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 122,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 115,
+ 171, 172, 173, 187, 187, 134, 123, 0, 0, 6,
+ 0, 0, 0, 11, 3, 21, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 166, 128, 66, 151, 187,
+ 158, 156, 186, 70, 71, 72, 187, 187, 187, 187,
+ 187, 187, 0, 0, 0, 0, 0, 0, 187, 187,
+
+ 187, 170, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 174, 4, 0,
+ 5, 0, 0, 0, 0, 0, 187, 187, 187, 187,
+ 187, 187, 187, 183, 187, 187, 187, 187, 187, 187,
+ 73, 187, 187, 187, 0, 0, 0, 187, 187, 184,
+ 175, 187, 176, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 185, 0, 0, 177, 178, 181, 182, 69,
+ 187, 146, 187, 147, 161, 179, 180, 0, 0, 187,
+ 187, 187, 0, 0, 0, 74, 187, 75, 0, 0,
+ 0, 187, 0, 0, 0, 187, 0, 0, 7, 0,
+
+ 0, 187, 0, 8, 0, 0, 148, 0, 0, 0,
+ 0, 9, 0, 10, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
8, 7, 7, 1
} ;
-static yyconst flex_int16_t yy_base[719] =
+static yyconst flex_int16_t yy_base[727] =
{ 0,
- 0, 63, 88, 0, 1076, 1075, 1077, 1080, 64, 1080,
- 1051, 1050, 59, 1049, 58, 60, 58, 1048, 139, 187,
- 47, 1047, 56, 0, 1034, 121, 110, 137, 138, 134,
- 163, 1017, 173, 177, 115, 149, 140, 1011, 159, 121,
- 187, 194, 194, 172, 1022, 171, 249, 240, 1042, 1080,
- 250, 1080, 1051, 241, 1080, 0, 1080, 1080, 262, 1080,
- 1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080, 236, 1080,
- 238, 187, 286, 303, 1080, 0, 0, 1040, 1080, 1080,
- 1080, 1039, 0, 1080, 1006, 1011, 1004, 1007, 1016, 1015,
- 1001, 1004, 1016, 35, 1010, 997, 994, 1008, 994, 991,
-
- 991, 997, 215, 232, 991, 1002, 987, 993, 997, 998,
- 0, 989, 1000, 234, 995, 975, 226, 979, 993, 983,
- 119, 976, 234, 989, 991, 973, 969, 977, 974, 963,
- 972, 256, 970, 976, 971, 974, 962, 965, 967, 245,
- 970, 961, 974, 227, 967, 1080, 1080, 308, 294, 324,
- 1080, 952, 965, 956, 967, 329, 0, 338, 0, 368,
- 1080, 303, 379, 1080, 386, 393, 0, 1080, 1080, 962,
- 0, 953, 957, 967, 964, 947, 946, 946, 950, 216,
- 961, 958, 958, 956, 953, 944, 951, 937, 935, 948,
- 933, 950, 0, 947, 934, 942, 939, 943, 944, 937,
-
- 934, 922, 921, 935, 938, 935, 922, 929, 919, 320,
- 925, 928, 918, 926, 914, 918, 909, 924, 914, 905,
- 924, 907, 905, 916, 905, 900, 898, 912, 897, 899,
- 896, 908, 907, 910, 288, 901, 895, 884, 331, 903,
- 905, 893, 885, 889, 901, 884, 0, 400, 410, 427,
- 1080, 439, 446, 1080, 879, 890, 0, 887, 343, 0,
- 880, 878, 880, 875, 884, 872, 890, 878, 346, 0,
- 0, 872, 883, 882, 882, 0, 866, 350, 0, 0,
- 868, 353, 876, 877, 867, 861, 860, 861, 860, 357,
- 856, 0, 0, 852, 851, 850, 852, 853, 858, 852,
-
- 848, 862, 857, 856, 855, 846, 849, 849, 841, 844,
- 839, 848, 853, 838, 851, 841, 0, 0, 848, 844,
- 835, 835, 841, 840, 837, 0, 0, 0, 0, 826,
- 839, 838, 837, 834, 822, 453, 463, 834, 836, 0,
- 0, 0, 0, 822, 0, 822, 0, 821, 822, 816,
- 827, 0, 0, 0, 817, 0, 813, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 824, 469, 823, 0,
- 0, 821, 817, 0, 0, 0, 806, 415, 432, 473,
- 811, 807, 813, 803, 801, 815, 799, 799, 813, 801,
- 813, 808, 0, 806, 803, 807, 790, 792, 799, 805,
-
- 800, 799, 786, 0, 788, 0, 787, 791, 0, 785,
- 834, 784, 787, 0, 775, 785, 0, 773, 773, 787,
- 0, 789, 0, 482, 797, 796, 795, 766, 765, 0,
- 783, 782, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 766, 780, 766, 763, 0, 0, 769, 768,
- 0, 0, 766, 758, 0, 0, 0, 0, 0, 0,
- 755, 767, 485, 759, 766, 763, 757, 750, 503, 766,
- 751, 746, 760, 758, 0, 0, 750, 769, 768, 767,
- 738, 737, 301, 481, 0, 750, 753, 751, 739, 0,
- 749, 746, 745, 734, 733, 732, 509, 741, 0, 753,
-
- 752, 751, 722, 721, 0, 736, 0, 734, 729, 515,
- 527, 773, 722, 730, 0, 0, 0, 745, 744, 0,
- 726, 729, 713, 721, 711, 719, 720, 720, 719, 704,
- 717, 0, 718, 706, 705, 701, 725, 724, 723, 694,
- 693, 0, 723, 722, 0, 704, 707, 0, 0, 693,
- 537, 1080, 561, 0, 567, 340, 1080, 0, 690, 689,
- 699, 699, 686, 701, 684, 699, 694, 0, 0, 0,
- 0, 679, 0, 0, 0, 700, 389, 700, 689, 692,
- 676, 675, 685, 685, 675, 529, 589, 474, 683, 671,
- 669, 668, 679, 0, 682, 678, 680, 676, 662, 669,
-
- 669, 671, 667, 669, 667, 667, 654, 653, 664, 0,
- 1080, 531, 1080, 596, 0, 616, 666, 648, 665, 664,
- 647, 635, 643, 633, 634, 0, 627, 646, 635, 607,
- 604, 601, 0, 604, 603, 586, 533, 572, 580, 564,
- 563, 0, 0, 564, 0, 540, 554, 552, 516, 530,
- 505, 486, 453, 450, 0, 461, 443, 0, 0, 0,
- 0, 0, 400, 406, 385, 0, 0, 0, 0, 343,
- 389, 319, 267, 249, 487, 341, 235, 0, 200, 0,
- 507, 498, 184, 157, 150, 564, 559, 136, 565, 591,
- 1080, 593, 550, 112, 594, 1080, 569, 576, 0, 123,
-
- 619, 621, 637, 1080, 638, 1080, 1080, 648, 653, 658,
- 663, 665, 667, 673, 680, 685, 690, 695
+ 0, 63, 69, 0, 1083, 1082, 1084, 1087, 64, 1087,
+ 1058, 1057, 126, 1056, 123, 124, 122, 1055, 138, 186,
+ 121, 1054, 136, 0, 128, 122, 113, 134, 133, 133,
+ 162, 1025, 151, 172, 97, 128, 136, 1019, 156, 179,
+ 187, 193, 190, 211, 1030, 163, 254, 238, 1087, 189,
+ 1087, 1060, 249, 1087, 0, 1087, 1087, 249, 1087, 1087,
+ 1087, 1087, 1087, 1087, 1087, 1087, 1087, 230, 1087, 246,
+ 221, 284, 301, 1087, 0, 0, 1049, 1087, 1087, 1087,
+ 1048, 0, 1087, 1087, 1015, 1020, 1013, 1016, 1025, 1024,
+ 1010, 1013, 1025, 145, 1019, 1006, 1003, 1017, 1003, 1000,
+
+ 1000, 1006, 202, 233, 1000, 1011, 996, 1002, 1006, 1007,
+ 0, 998, 1009, 226, 1004, 984, 168, 988, 1002, 992,
+ 237, 985, 252, 998, 1000, 982, 978, 986, 983, 972,
+ 981, 204, 979, 985, 980, 983, 971, 974, 243, 240,
+ 980, 983, 970, 983, 261, 976, 1087, 1087, 327, 307,
+ 322, 1087, 961, 974, 965, 976, 328, 0, 318, 0,
+ 366, 1087, 310, 377, 1087, 327, 384, 0, 1087, 1087,
+ 971, 0, 962, 966, 976, 973, 956, 955, 955, 959,
+ 295, 970, 967, 967, 965, 962, 953, 960, 946, 944,
+ 957, 942, 959, 0, 956, 943, 951, 948, 952, 953,
+
+ 946, 943, 931, 930, 944, 947, 944, 931, 938, 928,
+ 340, 934, 937, 927, 935, 923, 927, 918, 933, 923,
+ 914, 933, 916, 914, 925, 914, 909, 907, 921, 906,
+ 908, 905, 917, 916, 919, 900, 311, 909, 903, 913,
+ 891, 349, 910, 912, 900, 892, 896, 908, 891, 0,
+ 391, 401, 418, 1087, 430, 437, 1087, 886, 897, 0,
+ 894, 355, 0, 887, 885, 887, 882, 891, 879, 897,
+ 885, 406, 0, 0, 879, 890, 889, 889, 0, 873,
+ 423, 0, 0, 875, 442, 883, 884, 874, 868, 867,
+ 868, 867, 445, 863, 0, 0, 859, 858, 857, 859,
+
+ 860, 865, 859, 855, 869, 864, 863, 862, 853, 856,
+ 856, 848, 851, 846, 855, 860, 845, 858, 848, 0,
+ 0, 855, 851, 0, 842, 842, 848, 847, 448, 844,
+ 0, 0, 0, 0, 833, 846, 845, 844, 841, 829,
+ 454, 466, 841, 843, 0, 0, 0, 0, 829, 0,
+ 829, 0, 828, 829, 823, 834, 0, 0, 0, 824,
+ 0, 820, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 831, 461, 830, 0, 0, 828, 824, 0, 0,
+ 0, 813, 473, 476, 481, 818, 814, 820, 810, 808,
+ 822, 806, 806, 820, 808, 820, 815, 0, 813, 810,
+
+ 814, 797, 799, 806, 812, 807, 806, 793, 0, 795,
+ 0, 0, 0, 0, 794, 798, 0, 792, 841, 791,
+ 794, 0, 782, 792, 0, 780, 780, 794, 0, 796,
+ 0, 485, 804, 803, 802, 773, 772, 0, 790, 789,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 773, 787, 773, 770, 0, 0, 776, 775, 0, 0,
+ 773, 765, 0, 0, 0, 0, 0, 0, 762, 774,
+ 488, 766, 773, 770, 764, 757, 506, 773, 758, 753,
+ 767, 765, 0, 0, 757, 776, 775, 774, 745, 744,
+ 335, 336, 0, 757, 760, 758, 746, 0, 756, 753,
+
+ 752, 741, 740, 739, 501, 748, 0, 760, 759, 758,
+ 729, 728, 0, 743, 0, 741, 736, 509, 530, 780,
+ 729, 737, 0, 0, 0, 752, 751, 0, 733, 736,
+ 720, 728, 718, 726, 727, 727, 726, 711, 724, 0,
+ 725, 713, 712, 708, 732, 731, 730, 701, 700, 0,
+ 730, 729, 0, 711, 714, 0, 0, 700, 537, 1087,
+ 558, 0, 564, 560, 1087, 0, 697, 696, 706, 706,
+ 693, 708, 691, 706, 701, 0, 0, 0, 0, 686,
+ 0, 0, 0, 707, 357, 707, 696, 699, 683, 682,
+ 692, 692, 682, 532, 587, 412, 690, 678, 676, 675,
+
+ 686, 0, 689, 685, 687, 683, 669, 676, 676, 678,
+ 674, 676, 674, 674, 661, 660, 671, 0, 1087, 534,
+ 1087, 598, 0, 608, 673, 655, 672, 671, 654, 646,
+ 654, 644, 652, 0, 645, 664, 661, 658, 655, 652,
+ 0, 648, 647, 630, 539, 618, 600, 584, 583, 0,
+ 0, 579, 0, 578, 594, 580, 564, 527, 506, 489,
+ 453, 447, 0, 452, 426, 0, 0, 0, 0, 0,
+ 391, 397, 376, 0, 0, 0, 0, 529, 380, 320,
+ 331, 296, 562, 273, 249, 0, 260, 0, 519, 521,
+ 192, 183, 169, 585, 589, 111, 586, 610, 1087, 590,
+
+ 541, 87, 621, 1087, 595, 588, 0, 23, 631, 632,
+ 633, 1087, 634, 1087, 1087, 648, 653, 658, 663, 665,
+ 667, 673, 680, 685, 690, 695
} ;
-static yyconst flex_int16_t yy_def[719] =
+static yyconst flex_int16_t yy_def[727] =
{ 0,
- 707, 1, 707, 3, 708, 708, 707, 707, 707, 707,
- 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
- 707, 707, 707, 709, 707, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 707, 707, 707, 707, 707,
- 707, 707, 707, 707, 707, 710, 707, 707, 707, 707,
- 707, 707, 707, 707, 707, 707, 707, 707, 711, 707,
- 712, 19, 707, 707, 707, 713, 20, 707, 707, 707,
- 707, 707, 709, 707, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
-
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 707, 707, 707, 707, 707,
- 707, 707, 707, 707, 707, 707, 714, 707, 710, 707,
- 707, 712, 707, 707, 707, 707, 713, 707, 707, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
-
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 707, 707, 707, 707, 714, 707, 707, 707,
- 707, 707, 707, 707, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
-
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 707, 707, 707, 707, 707, 707, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
-
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 707,
- 707, 707, 707, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 707, 707, 707,
- 707, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
-
- 709, 709, 709, 709, 709, 709, 709, 709, 707, 715,
- 707, 707, 707, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 707,
- 707, 707, 707, 716, 707, 707, 707, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 707, 717, 707, 716, 707, 707,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
-
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 707, 707, 707, 707, 718, 707, 707, 707, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 718, 707, 707, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
- 709, 709, 709, 709, 709, 707, 707, 709, 709, 709,
- 709, 709, 709, 709, 709, 709, 709, 709, 709, 707,
- 707, 709, 709, 709, 707, 707, 707, 709, 709, 709,
- 707, 707, 707, 709, 707, 707, 707, 709, 707, 707,
- 707, 707, 707, 709, 707, 707, 707, 707, 709, 707,
-
- 707, 707, 707, 707, 707, 707, 0, 707, 707, 707,
- 707, 707, 707, 707, 707, 707, 707, 707
+ 715, 1, 715, 3, 716, 716, 715, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715, 715, 715, 715, 715,
+ 715, 715, 715, 717, 715, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 715, 715, 715, 715, 715,
+ 715, 715, 715, 715, 718, 715, 715, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715, 715, 719, 715, 720,
+ 19, 715, 715, 715, 721, 20, 715, 715, 715, 715,
+ 715, 717, 715, 715, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 715, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715, 715, 722, 715, 718,
+ 715, 715, 720, 715, 715, 715, 715, 721, 715, 715,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 715, 715, 715, 715, 722,
+ 715, 715, 715, 715, 715, 715, 715, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 715, 715, 715, 715,
+ 715, 715, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 715, 715, 715,
+ 715, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 715, 715, 715, 715, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 715, 723, 715, 715,
+ 715, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 715, 715, 715,
+ 715, 724, 715, 715, 715, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 715, 725, 715, 724, 715, 715, 717, 717,
+
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 715, 715,
+ 715, 715, 726, 715, 715, 715, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 726, 715, 715, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 717, 717, 717,
+ 717, 717, 717, 715, 715, 717, 717, 717, 717, 717,
+ 717, 717, 717, 717, 717, 717, 717, 715, 715, 717,
+ 717, 717, 715, 715, 715, 717, 717, 717, 715, 715,
+ 715, 717, 715, 715, 715, 717, 715, 715, 715, 715,
+
+ 715, 717, 715, 715, 715, 715, 717, 715, 715, 715,
+ 715, 715, 715, 715, 0, 715, 715, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715
} ;
-static yyconst flex_int16_t yy_nxt[1145] =
+static yyconst flex_int16_t yy_nxt[1152] =
{ 0,
8, 9, 10, 9, 11, 8, 12, 13, 8, 8,
14, 15, 16, 17, 18, 19, 20, 20, 20, 20,
24, 24, 24, 24, 24, 24, 25, 24, 26, 27,
28, 29, 30, 31, 32, 33, 34, 24, 24, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- 24, 24, 24, 46, 47, 59, 62, 59, 48, 65,
- 78, 79, 67, 69, 69, 69, 69, 69, 69, 69,
- 81, 82, 66, 63, 68, 179, 180, 49, 50, 51,
- 52, 51, 50, 50, 50, 50, 50, 50, 50, 50,
-
- 50, 50, 53, 50, 54, 54, 54, 54, 54, 54,
- 55, 50, 50, 50, 56, 56, 56, 56, 56, 56,
- 56, 56, 56, 56, 50, 56, 56, 56, 56, 56,
- 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
- 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
- 56, 50, 71, 116, 72, 72, 72, 72, 72, 72,
- 73, 85, 88, 126, 89, 213, 702, 117, 90, 74,
- 75, 699, 214, 127, 76, 91, 86, 87, 120, 92,
- 95, 74, 75, 99, 96, 100, 93, 118, 694, 94,
- 97, 119, 121, 689, 101, 146, 98, 123, 688, 76,
-
- 71, 102, 77, 77, 77, 77, 77, 77, 77, 103,
- 142, 108, 104, 124, 143, 105, 125, 74, 75, 109,
- 111, 106, 707, 112, 144, 128, 687, 113, 114, 74,
- 75, 110, 129, 130, 147, 115, 135, 131, 684, 136,
- 139, 150, 151, 132, 133, 140, 134, 707, 137, 141,
- 148, 156, 59, 156, 149, 138, 158, 158, 158, 158,
- 158, 158, 158, 59, 189, 59, 160, 161, 163, 164,
- 191, 264, 265, 240, 216, 190, 241, 208, 160, 161,
- 163, 164, 152, 201, 192, 209, 202, 203, 217, 153,
- 204, 235, 205, 154, 226, 150, 151, 683, 155, 71,
-
- 236, 73, 73, 73, 73, 73, 73, 73, 680, 148,
- 227, 59, 679, 149, 165, 165, 74, 75, 166, 166,
- 166, 166, 166, 166, 166, 150, 151, 523, 74, 75,
- 156, 321, 156, 250, 251, 524, 152, 294, 295, 296,
- 322, 556, 681, 153, 675, 250, 251, 154, 326, 327,
- 328, 676, 155, 158, 158, 158, 158, 158, 158, 158,
- 341, 342, 343, 352, 353, 354, 152, 360, 361, 362,
- 364, 365, 366, 153, 374, 375, 376, 154, 678, 248,
- 248, 589, 155, 249, 249, 249, 249, 249, 249, 249,
- 252, 252, 590, 682, 253, 253, 253, 253, 253, 253,
-
- 253, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 249, 249, 249, 249, 249,
- 249, 249, 602, 603, 254, 249, 249, 249, 249, 249,
- 249, 249, 434, 435, 436, 677, 254, 674, 336, 336,
- 673, 161, 337, 337, 337, 337, 337, 337, 337, 437,
- 438, 439, 672, 161, 253, 253, 253, 253, 253, 253,
- 253, 253, 253, 253, 253, 253, 253, 253, 337, 337,
- 337, 337, 337, 337, 337, 551, 552, 164, 337, 337,
- 337, 337, 337, 337, 337, 425, 426, 427, 675, 164,
- 440, 441, 442, 671, 251, 676, 428, 429, 478, 479,
-
- 480, 500, 501, 502, 469, 670, 251, 525, 681, 481,
- 482, 669, 503, 504, 668, 526, 551, 552, 510, 511,
- 511, 511, 511, 511, 511, 537, 538, 539, 551, 552,
- 612, 613, 612, 613, 612, 613, 540, 541, 551, 552,
- 667, 685, 555, 555, 555, 555, 555, 555, 555, 686,
- 554, 697, 586, 587, 587, 587, 587, 587, 587, 682,
- 692, 666, 551, 552, 615, 690, 695, 693, 551, 552,
- 697, 665, 664, 691, 696, 554, 553, 553, 553, 553,
- 553, 553, 555, 555, 555, 555, 555, 555, 555, 615,
- 612, 613, 690, 663, 692, 695, 662, 612, 613, 661,
-
- 691, 693, 698, 696, 616, 616, 616, 616, 616, 616,
- 616, 614, 614, 614, 614, 614, 614, 612, 613, 700,
- 703, 698, 705, 660, 659, 658, 657, 701, 704, 656,
- 706, 616, 616, 616, 616, 616, 616, 616, 703, 705,
- 655, 654, 653, 652, 651, 650, 704, 706, 57, 57,
- 57, 57, 57, 57, 57, 57, 83, 83, 83, 83,
- 83, 159, 159, 159, 159, 159, 69, 69, 162, 162,
- 167, 167, 167, 247, 247, 649, 247, 247, 247, 247,
- 247, 553, 553, 553, 648, 647, 646, 553, 588, 588,
- 588, 614, 614, 614, 645, 644, 643, 614, 637, 637,
-
- 637, 642, 641, 640, 639, 638, 636, 635, 634, 633,
- 632, 631, 630, 629, 628, 627, 626, 625, 624, 623,
- 622, 621, 620, 619, 618, 617, 611, 610, 609, 608,
- 607, 606, 605, 604, 601, 600, 599, 598, 597, 596,
- 595, 594, 593, 592, 591, 585, 584, 583, 582, 581,
- 580, 579, 578, 577, 576, 575, 574, 573, 572, 571,
- 570, 569, 568, 567, 566, 565, 564, 563, 562, 561,
- 560, 559, 558, 557, 556, 550, 549, 548, 547, 546,
- 545, 544, 543, 542, 536, 535, 534, 533, 532, 531,
- 530, 529, 528, 527, 522, 521, 520, 519, 518, 517,
-
- 516, 515, 514, 513, 512, 509, 508, 507, 506, 505,
- 499, 498, 497, 496, 495, 494, 493, 492, 491, 490,
- 489, 488, 487, 486, 485, 484, 483, 477, 476, 475,
- 474, 473, 472, 471, 470, 469, 468, 467, 466, 465,
- 464, 463, 462, 461, 460, 459, 458, 457, 456, 455,
- 454, 453, 452, 451, 450, 449, 448, 447, 446, 445,
- 444, 443, 433, 432, 431, 430, 424, 423, 422, 421,
- 420, 419, 418, 417, 416, 415, 414, 413, 412, 411,
- 410, 409, 408, 407, 406, 405, 404, 403, 402, 401,
- 400, 399, 398, 397, 396, 395, 394, 393, 392, 391,
-
- 390, 389, 388, 387, 386, 385, 384, 383, 382, 381,
- 380, 379, 378, 377, 373, 372, 371, 370, 369, 368,
- 367, 363, 359, 358, 357, 356, 355, 351, 350, 349,
- 348, 347, 346, 345, 344, 340, 339, 338, 335, 334,
- 333, 332, 331, 330, 329, 325, 324, 323, 320, 319,
- 318, 317, 316, 315, 314, 313, 312, 311, 310, 309,
- 308, 307, 306, 305, 304, 303, 302, 301, 300, 299,
- 298, 297, 293, 292, 291, 290, 289, 288, 287, 286,
- 285, 284, 283, 282, 281, 280, 279, 278, 277, 276,
- 275, 274, 273, 272, 271, 270, 269, 268, 267, 266,
-
- 263, 262, 261, 260, 259, 258, 257, 256, 255, 246,
- 245, 244, 243, 242, 239, 238, 237, 234, 233, 232,
- 231, 230, 229, 228, 225, 224, 223, 222, 221, 220,
- 219, 218, 215, 212, 211, 210, 207, 206, 200, 199,
- 198, 197, 196, 195, 194, 193, 188, 187, 186, 185,
- 184, 183, 182, 181, 178, 177, 176, 175, 174, 173,
- 172, 171, 170, 169, 168, 157, 80, 145, 122, 107,
- 84, 80, 70, 64, 61, 60, 707, 58, 58, 7,
- 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
- 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
-
- 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
- 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
- 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
- 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
- 707, 707, 707, 707
+ 24, 24, 24, 46, 47, 58, 710, 58, 48, 49,
+ 50, 51, 50, 49, 49, 49, 49, 49, 49, 49,
+ 49, 49, 49, 52, 49, 53, 53, 53, 53, 53,
+ 53, 54, 49, 49, 49, 55, 55, 55, 55, 55,
+
+ 55, 55, 55, 55, 55, 49, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 49, 61, 64, 116, 66, 68, 68, 68,
+ 68, 68, 68, 68, 77, 78, 707, 65, 67, 117,
+ 62, 70, 83, 71, 71, 71, 71, 71, 71, 72,
+ 80, 81, 85, 702, 84, 88, 118, 89, 73, 74,
+ 119, 90, 91, 75, 120, 95, 92, 86, 87, 96,
+ 73, 74, 99, 93, 100, 97, 94, 147, 121, 108,
+ 157, 98, 157, 101, 123, 180, 181, 109, 75, 70,
+
+ 102, 76, 76, 76, 76, 76, 76, 76, 103, 110,
+ 124, 104, 697, 125, 105, 111, 73, 74, 112, 209,
+ 106, 126, 113, 114, 696, 128, 148, 210, 73, 74,
+ 115, 127, 129, 130, 695, 135, 139, 131, 136, 151,
+ 152, 140, 227, 132, 133, 141, 134, 137, 142, 143,
+ 58, 190, 58, 144, 138, 149, 715, 58, 228, 150,
+ 161, 162, 191, 145, 159, 159, 159, 159, 159, 159,
+ 159, 192, 161, 162, 689, 202, 164, 165, 203, 204,
+ 153, 715, 205, 214, 206, 193, 237, 154, 164, 165,
+ 215, 155, 217, 235, 236, 238, 156, 70, 692, 72,
+
+ 72, 72, 72, 72, 72, 72, 218, 243, 151, 152,
+ 244, 691, 166, 166, 73, 74, 167, 167, 167, 167,
+ 167, 167, 167, 151, 152, 690, 73, 74, 149, 157,
+ 58, 157, 150, 159, 159, 159, 159, 159, 159, 159,
+ 253, 254, 167, 167, 167, 167, 167, 167, 167, 153,
+ 267, 268, 253, 254, 325, 688, 154, 297, 298, 299,
+ 155, 531, 533, 326, 153, 156, 331, 332, 333, 532,
+ 534, 154, 346, 347, 348, 155, 687, 251, 251, 686,
+ 156, 252, 252, 252, 252, 252, 252, 252, 255, 255,
+ 610, 611, 256, 256, 256, 256, 256, 256, 256, 167,
+
+ 167, 167, 167, 167, 167, 167, 252, 252, 252, 252,
+ 252, 252, 252, 559, 560, 257, 252, 252, 252, 252,
+ 252, 252, 252, 357, 358, 359, 685, 257, 682, 341,
+ 341, 681, 162, 342, 342, 342, 342, 342, 342, 342,
+ 365, 366, 367, 680, 162, 256, 256, 256, 256, 256,
+ 256, 256, 256, 256, 256, 256, 256, 256, 256, 369,
+ 370, 371, 379, 380, 381, 412, 413, 414, 165, 342,
+ 342, 342, 342, 342, 342, 342, 679, 433, 434, 435,
+ 165, 342, 342, 342, 342, 342, 342, 342, 436, 437,
+ 442, 443, 444, 445, 446, 447, 678, 254, 448, 449,
+
+ 450, 486, 487, 488, 508, 509, 510, 477, 677, 254,
+ 559, 560, 489, 490, 676, 511, 512, 545, 546, 547,
+ 689, 518, 519, 519, 519, 519, 519, 519, 548, 549,
+ 683, 559, 560, 620, 621, 620, 621, 684, 559, 560,
+ 620, 621, 705, 675, 562, 563, 563, 563, 563, 563,
+ 563, 563, 594, 595, 595, 595, 595, 595, 595, 559,
+ 560, 564, 674, 683, 693, 559, 560, 623, 673, 562,
+ 684, 690, 694, 561, 561, 561, 561, 561, 561, 563,
+ 563, 563, 563, 563, 563, 563, 698, 703, 620, 621,
+ 700, 700, 623, 706, 699, 704, 705, 701, 701, 620,
+
+ 621, 597, 624, 624, 624, 624, 624, 624, 624, 620,
+ 621, 698, 598, 622, 622, 622, 622, 622, 622, 699,
+ 672, 671, 703, 624, 624, 624, 624, 624, 624, 624,
+ 704, 708, 711, 713, 711, 713, 670, 669, 668, 709,
+ 712, 714, 712, 714, 667, 666, 665, 706, 56, 56,
+ 56, 56, 56, 56, 56, 56, 82, 82, 82, 82,
+ 82, 160, 160, 160, 160, 160, 68, 68, 163, 163,
+ 168, 168, 168, 250, 250, 664, 250, 250, 250, 250,
+ 250, 561, 561, 561, 663, 662, 661, 561, 596, 596,
+ 596, 622, 622, 622, 660, 659, 658, 622, 645, 645,
+
+ 645, 657, 656, 655, 654, 653, 652, 651, 650, 649,
+ 648, 647, 646, 644, 643, 642, 641, 640, 639, 638,
+ 637, 636, 635, 634, 633, 632, 631, 630, 629, 628,
+ 627, 626, 625, 619, 618, 617, 616, 615, 614, 613,
+ 612, 609, 608, 607, 606, 605, 604, 603, 602, 601,
+ 600, 599, 593, 592, 591, 590, 589, 588, 587, 586,
+ 585, 584, 583, 582, 581, 580, 579, 578, 577, 576,
+ 575, 574, 573, 572, 571, 570, 569, 568, 567, 566,
+ 565, 564, 558, 557, 556, 555, 554, 553, 552, 551,
+ 550, 544, 543, 542, 541, 540, 539, 538, 537, 536,
+
+ 535, 530, 529, 528, 527, 526, 525, 524, 523, 522,
+ 521, 520, 517, 516, 515, 514, 513, 507, 506, 505,
+ 504, 503, 502, 501, 500, 499, 498, 497, 496, 495,
+ 494, 493, 492, 491, 485, 484, 483, 482, 481, 480,
+ 479, 478, 477, 476, 475, 474, 473, 472, 471, 470,
+ 469, 468, 467, 466, 465, 464, 463, 462, 461, 460,
+ 459, 458, 457, 456, 455, 454, 453, 452, 451, 441,
+ 440, 439, 438, 432, 431, 430, 429, 428, 427, 426,
+ 425, 424, 423, 422, 421, 420, 419, 418, 417, 416,
+ 415, 411, 410, 409, 408, 407, 406, 405, 404, 403,
+
+ 402, 401, 400, 399, 398, 397, 396, 395, 394, 393,
+ 392, 391, 390, 389, 388, 387, 386, 385, 384, 383,
+ 382, 378, 377, 376, 375, 374, 373, 372, 368, 364,
+ 363, 362, 361, 360, 356, 355, 354, 353, 352, 351,
+ 350, 349, 345, 344, 343, 340, 339, 338, 337, 336,
+ 335, 334, 330, 329, 328, 327, 324, 323, 322, 321,
+ 320, 319, 318, 317, 316, 315, 314, 313, 312, 311,
+ 310, 309, 308, 307, 306, 305, 304, 303, 302, 301,
+ 300, 296, 295, 294, 293, 292, 291, 290, 289, 288,
+ 287, 286, 285, 284, 283, 282, 281, 280, 279, 278,
+
+ 277, 276, 275, 274, 273, 272, 271, 270, 269, 266,
+ 265, 264, 263, 262, 261, 260, 259, 258, 249, 248,
+ 247, 246, 245, 242, 241, 240, 239, 234, 233, 232,
+ 231, 230, 229, 226, 225, 224, 223, 222, 221, 220,
+ 219, 216, 213, 212, 211, 208, 207, 201, 200, 199,
+ 198, 197, 196, 195, 194, 189, 188, 187, 186, 185,
+ 184, 183, 182, 179, 178, 177, 176, 175, 174, 173,
+ 172, 171, 170, 169, 158, 146, 122, 107, 79, 69,
+ 63, 60, 59, 715, 57, 57, 7, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715, 715, 715, 715, 715,
+
+ 715, 715, 715, 715, 715, 715, 715, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715, 715, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715, 715, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715, 715, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715, 715, 715, 715, 715,
+ 715
} ;
-static yyconst flex_int16_t yy_chk[1145] =
+static yyconst flex_int16_t yy_chk[1152] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 2, 9, 13, 9, 2, 15,
- 21, 21, 16, 17, 17, 17, 17, 17, 17, 17,
- 23, 23, 15, 13, 16, 94, 94, 2, 3, 3,
+ 1, 1, 1, 1, 2, 9, 708, 9, 2, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
-
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 19, 35, 19, 19, 19, 19, 19, 19,
- 19, 26, 27, 40, 27, 121, 700, 35, 27, 19,
- 19, 694, 121, 40, 19, 28, 26, 26, 37, 28,
- 29, 19, 19, 30, 29, 30, 28, 36, 688, 28,
- 29, 36, 37, 685, 30, 46, 29, 39, 684, 19,
-
- 20, 31, 20, 20, 20, 20, 20, 20, 20, 31,
- 44, 33, 31, 39, 44, 31, 39, 20, 20, 33,
- 34, 31, 72, 34, 44, 41, 683, 34, 34, 20,
- 20, 33, 41, 41, 46, 34, 42, 41, 679, 42,
- 43, 48, 48, 41, 41, 43, 41, 72, 42, 43,
- 47, 51, 47, 51, 47, 42, 54, 54, 54, 54,
- 54, 54, 54, 59, 103, 59, 69, 69, 71, 71,
- 104, 180, 180, 144, 123, 103, 144, 117, 69, 69,
- 71, 71, 48, 114, 104, 117, 114, 114, 123, 48,
- 114, 140, 114, 48, 132, 149, 149, 677, 48, 73,
-
- 140, 73, 73, 73, 73, 73, 73, 73, 674, 148,
- 132, 148, 673, 148, 74, 74, 73, 73, 74, 74,
- 74, 74, 74, 74, 74, 150, 150, 483, 73, 73,
- 156, 235, 156, 162, 162, 483, 149, 210, 210, 210,
- 235, 556, 676, 149, 670, 162, 162, 149, 239, 239,
- 239, 670, 149, 158, 158, 158, 158, 158, 158, 158,
- 259, 259, 259, 269, 269, 269, 150, 278, 278, 278,
- 282, 282, 282, 150, 290, 290, 290, 150, 672, 160,
- 160, 556, 150, 160, 160, 160, 160, 160, 160, 160,
- 163, 163, 556, 676, 163, 163, 163, 163, 163, 163,
-
- 163, 165, 165, 165, 165, 165, 165, 165, 166, 166,
- 166, 166, 166, 166, 166, 248, 248, 248, 248, 248,
- 248, 248, 577, 577, 166, 249, 249, 249, 249, 249,
- 249, 249, 378, 378, 378, 671, 166, 665, 250, 250,
- 664, 249, 250, 250, 250, 250, 250, 250, 250, 379,
- 379, 379, 663, 249, 252, 252, 252, 252, 252, 252,
- 252, 253, 253, 253, 253, 253, 253, 253, 336, 336,
- 336, 336, 336, 336, 336, 588, 588, 253, 337, 337,
- 337, 337, 337, 337, 337, 368, 368, 368, 675, 253,
- 380, 380, 380, 657, 337, 675, 368, 368, 424, 424,
-
- 424, 463, 463, 463, 469, 656, 337, 484, 681, 424,
- 424, 654, 463, 463, 653, 484, 510, 510, 469, 469,
- 469, 469, 469, 469, 469, 497, 497, 497, 511, 511,
- 586, 586, 612, 612, 637, 637, 497, 497, 551, 551,
- 652, 682, 511, 511, 511, 511, 511, 511, 511, 682,
- 510, 693, 551, 551, 551, 551, 551, 551, 551, 681,
- 687, 651, 553, 553, 586, 686, 689, 687, 555, 555,
- 697, 650, 649, 686, 689, 510, 553, 553, 553, 553,
- 553, 553, 555, 555, 555, 555, 555, 555, 555, 586,
- 587, 587, 690, 648, 692, 695, 647, 614, 614, 646,
-
- 690, 692, 693, 695, 587, 587, 587, 587, 587, 587,
- 587, 614, 614, 614, 614, 614, 614, 616, 616, 698,
- 701, 697, 702, 644, 641, 640, 639, 698, 701, 638,
- 702, 616, 616, 616, 616, 616, 616, 616, 703, 705,
- 636, 635, 634, 632, 631, 630, 703, 705, 708, 708,
- 708, 708, 708, 708, 708, 708, 709, 709, 709, 709,
- 709, 710, 710, 710, 710, 710, 711, 711, 712, 712,
- 713, 713, 713, 714, 714, 629, 714, 714, 714, 714,
- 714, 715, 715, 715, 628, 627, 625, 715, 716, 716,
- 716, 717, 717, 717, 624, 623, 622, 717, 718, 718,
-
- 718, 621, 620, 619, 618, 617, 609, 608, 607, 606,
- 605, 604, 603, 602, 601, 600, 599, 598, 597, 596,
- 595, 593, 592, 591, 590, 589, 585, 584, 583, 582,
- 581, 580, 579, 578, 576, 572, 567, 566, 565, 564,
- 563, 562, 561, 560, 559, 550, 547, 546, 544, 543,
- 541, 540, 539, 538, 537, 536, 535, 534, 533, 531,
- 530, 529, 528, 527, 526, 525, 524, 523, 522, 521,
- 519, 518, 514, 513, 512, 509, 508, 506, 504, 503,
- 502, 501, 500, 498, 496, 495, 494, 493, 492, 491,
- 489, 488, 487, 486, 482, 481, 480, 479, 478, 477,
-
- 474, 473, 472, 471, 470, 468, 467, 466, 465, 464,
- 462, 461, 454, 453, 450, 449, 446, 445, 444, 443,
- 432, 431, 429, 428, 427, 426, 425, 422, 420, 419,
- 418, 416, 415, 413, 412, 411, 410, 408, 407, 405,
- 403, 402, 401, 400, 399, 398, 397, 396, 395, 394,
- 392, 391, 390, 389, 388, 387, 386, 385, 384, 383,
- 382, 381, 377, 373, 372, 369, 367, 357, 355, 351,
- 350, 349, 348, 346, 344, 339, 338, 335, 334, 333,
- 332, 331, 330, 325, 324, 323, 322, 321, 320, 319,
- 316, 315, 314, 313, 312, 311, 310, 309, 308, 307,
+ 3, 3, 3, 13, 15, 35, 16, 17, 17, 17,
+ 17, 17, 17, 17, 21, 21, 702, 15, 16, 35,
+ 13, 19, 25, 19, 19, 19, 19, 19, 19, 19,
+ 23, 23, 26, 696, 25, 27, 36, 27, 19, 19,
+ 36, 27, 28, 19, 37, 29, 28, 26, 26, 29,
+ 19, 19, 30, 28, 30, 29, 28, 46, 37, 33,
+ 50, 29, 50, 30, 39, 94, 94, 33, 19, 20,
+
+ 31, 20, 20, 20, 20, 20, 20, 20, 31, 33,
+ 39, 31, 693, 39, 31, 34, 20, 20, 34, 117,
+ 31, 40, 34, 34, 692, 41, 46, 117, 20, 20,
+ 34, 40, 41, 41, 691, 42, 43, 41, 42, 48,
+ 48, 43, 132, 41, 41, 43, 41, 42, 43, 44,
+ 58, 103, 58, 44, 42, 47, 71, 47, 132, 47,
+ 68, 68, 103, 44, 53, 53, 53, 53, 53, 53,
+ 53, 104, 68, 68, 684, 114, 70, 70, 114, 114,
+ 48, 71, 114, 121, 114, 104, 140, 48, 70, 70,
+ 121, 48, 123, 139, 139, 140, 48, 72, 687, 72,
+
+ 72, 72, 72, 72, 72, 72, 123, 145, 150, 150,
+ 145, 685, 73, 73, 72, 72, 73, 73, 73, 73,
+ 73, 73, 73, 151, 151, 684, 72, 72, 149, 157,
+ 149, 157, 149, 159, 159, 159, 159, 159, 159, 159,
+ 163, 163, 166, 166, 166, 166, 166, 166, 166, 150,
+ 181, 181, 163, 163, 237, 682, 150, 211, 211, 211,
+ 150, 491, 492, 237, 151, 150, 242, 242, 242, 491,
+ 492, 151, 262, 262, 262, 151, 681, 161, 161, 680,
+ 151, 161, 161, 161, 161, 161, 161, 161, 164, 164,
+ 585, 585, 164, 164, 164, 164, 164, 164, 164, 167,
+
+ 167, 167, 167, 167, 167, 167, 251, 251, 251, 251,
+ 251, 251, 251, 596, 596, 167, 252, 252, 252, 252,
+ 252, 252, 252, 272, 272, 272, 679, 167, 673, 253,
+ 253, 672, 252, 253, 253, 253, 253, 253, 253, 253,
+ 281, 281, 281, 671, 252, 255, 255, 255, 255, 255,
+ 255, 255, 256, 256, 256, 256, 256, 256, 256, 285,
+ 285, 285, 293, 293, 293, 329, 329, 329, 256, 341,
+ 341, 341, 341, 341, 341, 341, 665, 373, 373, 373,
+ 256, 342, 342, 342, 342, 342, 342, 342, 373, 373,
+ 383, 383, 383, 384, 384, 384, 664, 342, 385, 385,
+
+ 385, 432, 432, 432, 471, 471, 471, 477, 662, 342,
+ 518, 518, 432, 432, 661, 471, 471, 505, 505, 505,
+ 689, 477, 477, 477, 477, 477, 477, 477, 505, 505,
+ 678, 519, 519, 594, 594, 620, 620, 678, 559, 559,
+ 645, 645, 701, 660, 518, 519, 519, 519, 519, 519,
+ 519, 519, 559, 559, 559, 559, 559, 559, 559, 561,
+ 561, 564, 659, 683, 690, 563, 563, 594, 658, 518,
+ 683, 689, 690, 561, 561, 561, 561, 561, 561, 563,
+ 563, 563, 563, 563, 563, 563, 694, 697, 595, 595,
+ 695, 700, 594, 701, 694, 697, 705, 695, 700, 622,
+
+ 622, 564, 595, 595, 595, 595, 595, 595, 595, 624,
+ 624, 698, 564, 622, 622, 622, 622, 622, 622, 698,
+ 657, 656, 703, 624, 624, 624, 624, 624, 624, 624,
+ 703, 706, 709, 710, 711, 713, 655, 654, 652, 706,
+ 709, 710, 711, 713, 649, 648, 647, 705, 716, 716,
+ 716, 716, 716, 716, 716, 716, 717, 717, 717, 717,
+ 717, 718, 718, 718, 718, 718, 719, 719, 720, 720,
+ 721, 721, 721, 722, 722, 646, 722, 722, 722, 722,
+ 722, 723, 723, 723, 644, 643, 642, 723, 724, 724,
+ 724, 725, 725, 725, 640, 639, 638, 725, 726, 726,
+
+ 726, 637, 636, 635, 633, 632, 631, 630, 629, 628,
+ 627, 626, 625, 617, 616, 615, 614, 613, 612, 611,
+ 610, 609, 608, 607, 606, 605, 604, 603, 601, 600,
+ 599, 598, 597, 593, 592, 591, 590, 589, 588, 587,
+ 586, 584, 580, 575, 574, 573, 572, 571, 570, 569,
+ 568, 567, 558, 555, 554, 552, 551, 549, 548, 547,
+ 546, 545, 544, 543, 542, 541, 539, 538, 537, 536,
+ 535, 534, 533, 532, 531, 530, 529, 527, 526, 522,
+ 521, 520, 517, 516, 514, 512, 511, 510, 509, 508,
+ 506, 504, 503, 502, 501, 500, 499, 497, 496, 495,
+
+ 494, 490, 489, 488, 487, 486, 485, 482, 481, 480,
+ 479, 478, 476, 475, 474, 473, 472, 470, 469, 462,
+ 461, 458, 457, 454, 453, 452, 451, 440, 439, 437,
+ 436, 435, 434, 433, 430, 428, 427, 426, 424, 423,
+ 421, 420, 419, 418, 416, 415, 410, 408, 407, 406,
+ 405, 404, 403, 402, 401, 400, 399, 397, 396, 395,
+ 394, 393, 392, 391, 390, 389, 388, 387, 386, 382,
+ 378, 377, 374, 372, 362, 360, 356, 355, 354, 353,
+ 351, 349, 344, 343, 340, 339, 338, 337, 336, 335,
+ 330, 328, 327, 326, 325, 323, 322, 319, 318, 317,
+ 316, 315, 314, 313, 312, 311, 310, 309, 308, 307,
306, 305, 304, 303, 302, 301, 300, 299, 298, 297,
- 296, 295, 294, 291, 289, 288, 287, 286, 285, 284,
- 283, 281, 277, 275, 274, 273, 272, 268, 267, 266,
- 265, 264, 263, 262, 261, 258, 256, 255, 246, 245,
- 244, 243, 242, 241, 240, 238, 237, 236, 234, 233,
+ 294, 292, 291, 290, 289, 288, 287, 286, 284, 280,
+ 278, 277, 276, 275, 271, 270, 269, 268, 267, 266,
+ 265, 264, 261, 259, 258, 249, 248, 247, 246, 245,
+ 244, 243, 241, 240, 239, 238, 236, 235, 234, 233,
232, 231, 230, 229, 228, 227, 226, 225, 224, 223,
222, 221, 220, 219, 218, 217, 216, 215, 214, 213,
- 212, 211, 209, 208, 207, 206, 205, 204, 203, 202,
- 201, 200, 199, 198, 197, 196, 195, 194, 192, 191,
- 190, 189, 188, 187, 186, 185, 184, 183, 182, 181,
-
- 179, 178, 177, 176, 175, 174, 173, 172, 170, 155,
- 154, 153, 152, 145, 143, 142, 141, 139, 138, 137,
- 136, 135, 134, 133, 131, 130, 129, 128, 127, 126,
- 125, 124, 122, 120, 119, 118, 116, 115, 113, 112,
- 110, 109, 108, 107, 106, 105, 102, 101, 100, 99,
- 98, 97, 96, 95, 93, 92, 91, 90, 89, 88,
- 87, 86, 85, 82, 78, 53, 49, 45, 38, 32,
- 25, 22, 18, 14, 12, 11, 7, 6, 5, 707,
- 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
- 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
-
- 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
- 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
- 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
- 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
- 707, 707, 707, 707
+ 212, 210, 209, 208, 207, 206, 205, 204, 203, 202,
+ 201, 200, 199, 198, 197, 196, 195, 193, 192, 191,
+
+ 190, 189, 188, 187, 186, 185, 184, 183, 182, 180,
+ 179, 178, 177, 176, 175, 174, 173, 171, 156, 155,
+ 154, 153, 146, 144, 143, 142, 141, 138, 137, 136,
+ 135, 134, 133, 131, 130, 129, 128, 127, 126, 125,
+ 124, 122, 120, 119, 118, 116, 115, 113, 112, 110,
+ 109, 108, 107, 106, 105, 102, 101, 100, 99, 98,
+ 97, 96, 95, 93, 92, 91, 90, 89, 88, 87,
+ 86, 85, 81, 77, 52, 45, 38, 32, 22, 18,
+ 14, 12, 11, 7, 6, 5, 715, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715, 715, 715, 715, 715,
+
+ 715, 715, 715, 715, 715, 715, 715, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715, 715, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715, 715, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715, 715, 715, 715, 715,
+ 715, 715, 715, 715, 715, 715, 715, 715, 715, 715,
+ 715
} ;
/* The intent behind this definition is that it'll catch
} \
} while (0)
-#line 990 "glsl_lexer.cpp"
+#line 1004 "glsl_lexer.cpp"
#define INITIAL 0
#define PP 1
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
- int n; \
+ size_t n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
#line 86 "glsl_lexer.lpp"
-#line 1227 "glsl_lexer.cpp"
+#line 1246 "glsl_lexer.cpp"
yylval = yylval_param;
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 708 )
+ if ( yy_current_state >= 716 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_current_state != 707 );
+ while ( yy_current_state != 715 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 165 "glsl_lexer.lpp"
-return BREAK;
+#line 164 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER(130, UINT_TOK);
YY_BREAK
case 27:
YY_RULE_SETUP
#line 166 "glsl_lexer.lpp"
-return CONTINUE;
+return BREAK;
YY_BREAK
case 28:
YY_RULE_SETUP
#line 167 "glsl_lexer.lpp"
-return DO;
+return CONTINUE;
YY_BREAK
case 29:
YY_RULE_SETUP
#line 168 "glsl_lexer.lpp"
-return WHILE;
+return DO;
YY_BREAK
case 30:
YY_RULE_SETUP
#line 169 "glsl_lexer.lpp"
-return ELSE;
+return WHILE;
YY_BREAK
case 31:
YY_RULE_SETUP
#line 170 "glsl_lexer.lpp"
-return FOR;
+return ELSE;
YY_BREAK
case 32:
YY_RULE_SETUP
#line 171 "glsl_lexer.lpp"
-return IF;
+return FOR;
YY_BREAK
case 33:
YY_RULE_SETUP
#line 172 "glsl_lexer.lpp"
-return DISCARD;
+return IF;
YY_BREAK
case 34:
YY_RULE_SETUP
#line 173 "glsl_lexer.lpp"
-return RETURN;
+return DISCARD;
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 175 "glsl_lexer.lpp"
-return BVEC2;
+#line 174 "glsl_lexer.lpp"
+return RETURN;
YY_BREAK
case 36:
YY_RULE_SETUP
#line 176 "glsl_lexer.lpp"
-return BVEC3;
+return BVEC2;
YY_BREAK
case 37:
YY_RULE_SETUP
#line 177 "glsl_lexer.lpp"
-return BVEC4;
+return BVEC3;
YY_BREAK
case 38:
YY_RULE_SETUP
#line 178 "glsl_lexer.lpp"
-return IVEC2;
+return BVEC4;
YY_BREAK
case 39:
YY_RULE_SETUP
#line 179 "glsl_lexer.lpp"
-return IVEC3;
+return IVEC2;
YY_BREAK
case 40:
YY_RULE_SETUP
#line 180 "glsl_lexer.lpp"
-return IVEC4;
+return IVEC3;
YY_BREAK
case 41:
YY_RULE_SETUP
#line 181 "glsl_lexer.lpp"
-return VEC2;
+return IVEC4;
YY_BREAK
case 42:
YY_RULE_SETUP
#line 182 "glsl_lexer.lpp"
-return VEC3;
+TOKEN_OR_IDENTIFIER(130, UVEC2);
YY_BREAK
case 43:
YY_RULE_SETUP
#line 183 "glsl_lexer.lpp"
-return VEC4;
+TOKEN_OR_IDENTIFIER(130, UVEC3);
YY_BREAK
case 44:
YY_RULE_SETUP
#line 184 "glsl_lexer.lpp"
-return MAT2X2;
+TOKEN_OR_IDENTIFIER(130, UVEC4);
YY_BREAK
case 45:
YY_RULE_SETUP
#line 185 "glsl_lexer.lpp"
-return MAT3X3;
+return VEC2;
YY_BREAK
case 46:
YY_RULE_SETUP
#line 186 "glsl_lexer.lpp"
-return MAT4X4;
+return VEC3;
YY_BREAK
case 47:
YY_RULE_SETUP
#line 187 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, MAT2X2);
+return VEC4;
YY_BREAK
case 48:
YY_RULE_SETUP
#line 188 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, MAT2X3);
+return MAT2X2;
YY_BREAK
case 49:
YY_RULE_SETUP
#line 189 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, MAT2X4);
+return MAT3X3;
YY_BREAK
case 50:
YY_RULE_SETUP
#line 190 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, MAT3X2);
+return MAT4X4;
YY_BREAK
case 51:
YY_RULE_SETUP
#line 191 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, MAT3X3);
+TOKEN_OR_IDENTIFIER(120, MAT2X2);
YY_BREAK
case 52:
YY_RULE_SETUP
#line 192 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, MAT3X4);
+TOKEN_OR_IDENTIFIER(120, MAT2X3);
YY_BREAK
case 53:
YY_RULE_SETUP
#line 193 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, MAT4X2);
+TOKEN_OR_IDENTIFIER(120, MAT2X4);
YY_BREAK
case 54:
YY_RULE_SETUP
#line 194 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, MAT4X3);
+TOKEN_OR_IDENTIFIER(120, MAT3X2);
YY_BREAK
case 55:
YY_RULE_SETUP
#line 195 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, MAT4X4);
+TOKEN_OR_IDENTIFIER(120, MAT3X3);
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 197 "glsl_lexer.lpp"
-return IN_TOK;
+#line 196 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER(120, MAT3X4);
YY_BREAK
case 57:
YY_RULE_SETUP
-#line 198 "glsl_lexer.lpp"
-return OUT_TOK;
+#line 197 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER(120, MAT4X2);
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 199 "glsl_lexer.lpp"
-return INOUT_TOK;
+#line 198 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER(120, MAT4X3);
YY_BREAK
case 59:
YY_RULE_SETUP
-#line 200 "glsl_lexer.lpp"
-return UNIFORM;
+#line 199 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER(120, MAT4X4);
YY_BREAK
case 60:
YY_RULE_SETUP
#line 201 "glsl_lexer.lpp"
-return VARYING;
+return IN_TOK;
YY_BREAK
case 61:
YY_RULE_SETUP
#line 202 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, CENTROID);
+return OUT_TOK;
YY_BREAK
case 62:
YY_RULE_SETUP
#line 203 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER_ES(120, INVARIANT);
+return INOUT_TOK;
YY_BREAK
case 63:
YY_RULE_SETUP
-#line 205 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER_ES(130, FLAT);
+#line 204 "glsl_lexer.lpp"
+return UNIFORM;
YY_BREAK
case 64:
YY_RULE_SETUP
-#line 206 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(130, SMOOTH);
+#line 205 "glsl_lexer.lpp"
+return VARYING;
YY_BREAK
case 65:
YY_RULE_SETUP
-#line 207 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(130, NOPERSPECTIVE);
+#line 206 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER(120, CENTROID);
YY_BREAK
case 66:
YY_RULE_SETUP
-#line 209 "glsl_lexer.lpp"
-return SAMPLER1D;
+#line 207 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER_ES(120, INVARIANT);
YY_BREAK
case 67:
YY_RULE_SETUP
-#line 210 "glsl_lexer.lpp"
-return SAMPLER2D;
+#line 209 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER_ES(130, FLAT);
YY_BREAK
case 68:
YY_RULE_SETUP
-#line 211 "glsl_lexer.lpp"
-return SAMPLER3D;
+#line 210 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER(130, SMOOTH);
YY_BREAK
case 69:
YY_RULE_SETUP
-#line 212 "glsl_lexer.lpp"
-return SAMPLERCUBE;
+#line 211 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER(130, NOPERSPECTIVE);
YY_BREAK
case 70:
YY_RULE_SETUP
#line 213 "glsl_lexer.lpp"
-return SAMPLER1DSHADOW;
+return SAMPLER1D;
YY_BREAK
case 71:
YY_RULE_SETUP
#line 214 "glsl_lexer.lpp"
-return SAMPLER2DSHADOW;
+return SAMPLER2D;
YY_BREAK
case 72:
YY_RULE_SETUP
-#line 216 "glsl_lexer.lpp"
-return STRUCT;
+#line 215 "glsl_lexer.lpp"
+return SAMPLER3D;
YY_BREAK
case 73:
YY_RULE_SETUP
+#line 216 "glsl_lexer.lpp"
+return SAMPLERCUBE;
+ YY_BREAK
+case 74:
+YY_RULE_SETUP
#line 217 "glsl_lexer.lpp"
+return SAMPLER1DSHADOW;
+ YY_BREAK
+case 75:
+YY_RULE_SETUP
+#line 218 "glsl_lexer.lpp"
+return SAMPLER2DSHADOW;
+ YY_BREAK
+case 76:
+YY_RULE_SETUP
+#line 220 "glsl_lexer.lpp"
+return STRUCT;
+ YY_BREAK
+case 77:
+YY_RULE_SETUP
+#line 221 "glsl_lexer.lpp"
return VOID_TOK;
YY_BREAK
-case 74:
+case 78:
YY_RULE_SETUP
-#line 219 "glsl_lexer.lpp"
+#line 223 "glsl_lexer.lpp"
{
if ((yyextra->language_version >= 140)
+ || yyextra->ARB_explicit_attrib_location_enable
|| (yyextra->ARB_fragment_coord_conventions_enable)){
return LAYOUT_TOK;
} else {
}
}
YY_BREAK
-case 75:
+case 79:
YY_RULE_SETUP
-#line 229 "glsl_lexer.lpp"
+#line 234 "glsl_lexer.lpp"
return INC_OP;
YY_BREAK
-case 76:
+case 80:
YY_RULE_SETUP
-#line 230 "glsl_lexer.lpp"
+#line 235 "glsl_lexer.lpp"
return DEC_OP;
YY_BREAK
-case 77:
+case 81:
YY_RULE_SETUP
-#line 231 "glsl_lexer.lpp"
+#line 236 "glsl_lexer.lpp"
return LE_OP;
YY_BREAK
-case 78:
+case 82:
YY_RULE_SETUP
-#line 232 "glsl_lexer.lpp"
+#line 237 "glsl_lexer.lpp"
return GE_OP;
YY_BREAK
-case 79:
+case 83:
YY_RULE_SETUP
-#line 233 "glsl_lexer.lpp"
+#line 238 "glsl_lexer.lpp"
return EQ_OP;
YY_BREAK
-case 80:
+case 84:
YY_RULE_SETUP
-#line 234 "glsl_lexer.lpp"
+#line 239 "glsl_lexer.lpp"
return NE_OP;
YY_BREAK
-case 81:
+case 85:
YY_RULE_SETUP
-#line 235 "glsl_lexer.lpp"
+#line 240 "glsl_lexer.lpp"
return AND_OP;
YY_BREAK
-case 82:
+case 86:
YY_RULE_SETUP
-#line 236 "glsl_lexer.lpp"
+#line 241 "glsl_lexer.lpp"
return OR_OP;
YY_BREAK
-case 83:
+case 87:
YY_RULE_SETUP
-#line 237 "glsl_lexer.lpp"
+#line 242 "glsl_lexer.lpp"
return XOR_OP;
YY_BREAK
-case 84:
+case 88:
YY_RULE_SETUP
-#line 239 "glsl_lexer.lpp"
+#line 243 "glsl_lexer.lpp"
+return LEFT_OP;
+ YY_BREAK
+case 89:
+YY_RULE_SETUP
+#line 244 "glsl_lexer.lpp"
+return RIGHT_OP;
+ YY_BREAK
+case 90:
+YY_RULE_SETUP
+#line 246 "glsl_lexer.lpp"
return MUL_ASSIGN;
YY_BREAK
-case 85:
+case 91:
YY_RULE_SETUP
-#line 240 "glsl_lexer.lpp"
+#line 247 "glsl_lexer.lpp"
return DIV_ASSIGN;
YY_BREAK
-case 86:
+case 92:
YY_RULE_SETUP
-#line 241 "glsl_lexer.lpp"
+#line 248 "glsl_lexer.lpp"
return ADD_ASSIGN;
YY_BREAK
-case 87:
+case 93:
YY_RULE_SETUP
-#line 242 "glsl_lexer.lpp"
+#line 249 "glsl_lexer.lpp"
return MOD_ASSIGN;
YY_BREAK
-case 88:
+case 94:
YY_RULE_SETUP
-#line 243 "glsl_lexer.lpp"
+#line 250 "glsl_lexer.lpp"
return LEFT_ASSIGN;
YY_BREAK
-case 89:
+case 95:
YY_RULE_SETUP
-#line 244 "glsl_lexer.lpp"
+#line 251 "glsl_lexer.lpp"
return RIGHT_ASSIGN;
YY_BREAK
-case 90:
+case 96:
YY_RULE_SETUP
-#line 245 "glsl_lexer.lpp"
+#line 252 "glsl_lexer.lpp"
return AND_ASSIGN;
YY_BREAK
-case 91:
+case 97:
YY_RULE_SETUP
-#line 246 "glsl_lexer.lpp"
+#line 253 "glsl_lexer.lpp"
return XOR_ASSIGN;
YY_BREAK
-case 92:
+case 98:
YY_RULE_SETUP
-#line 247 "glsl_lexer.lpp"
+#line 254 "glsl_lexer.lpp"
return OR_ASSIGN;
YY_BREAK
-case 93:
+case 99:
YY_RULE_SETUP
-#line 248 "glsl_lexer.lpp"
+#line 255 "glsl_lexer.lpp"
return SUB_ASSIGN;
YY_BREAK
-case 94:
+case 100:
YY_RULE_SETUP
-#line 250 "glsl_lexer.lpp"
+#line 257 "glsl_lexer.lpp"
{
yylval->n = strtol(yytext, NULL, 10);
return INTCONSTANT;
}
YY_BREAK
-case 95:
+case 101:
YY_RULE_SETUP
-#line 254 "glsl_lexer.lpp"
+#line 261 "glsl_lexer.lpp"
{
yylval->n = strtol(yytext + 2, NULL, 16);
return INTCONSTANT;
}
YY_BREAK
-case 96:
+case 102:
YY_RULE_SETUP
-#line 258 "glsl_lexer.lpp"
+#line 265 "glsl_lexer.lpp"
{
yylval->n = strtol(yytext, NULL, 8);
return INTCONSTANT;
}
YY_BREAK
-case 97:
+case 103:
YY_RULE_SETUP
-#line 263 "glsl_lexer.lpp"
+#line 270 "glsl_lexer.lpp"
{
yylval->real = strtod(yytext, NULL);
return FLOATCONSTANT;
}
YY_BREAK
-case 98:
+case 104:
YY_RULE_SETUP
-#line 267 "glsl_lexer.lpp"
+#line 274 "glsl_lexer.lpp"
{
yylval->real = strtod(yytext, NULL);
return FLOATCONSTANT;
}
YY_BREAK
-case 99:
+case 105:
YY_RULE_SETUP
-#line 271 "glsl_lexer.lpp"
+#line 278 "glsl_lexer.lpp"
{
yylval->real = strtod(yytext, NULL);
return FLOATCONSTANT;
}
YY_BREAK
-case 100:
+case 106:
YY_RULE_SETUP
-#line 275 "glsl_lexer.lpp"
+#line 282 "glsl_lexer.lpp"
{
yylval->real = strtod(yytext, NULL);
return FLOATCONSTANT;
}
YY_BREAK
-case 101:
+case 107:
YY_RULE_SETUP
-#line 279 "glsl_lexer.lpp"
+#line 286 "glsl_lexer.lpp"
{
yylval->real = strtod(yytext, NULL);
return FLOATCONSTANT;
}
YY_BREAK
-case 102:
+case 108:
YY_RULE_SETUP
-#line 284 "glsl_lexer.lpp"
+#line 291 "glsl_lexer.lpp"
{
yylval->n = 1;
return BOOLCONSTANT;
}
YY_BREAK
-case 103:
+case 109:
YY_RULE_SETUP
-#line 288 "glsl_lexer.lpp"
+#line 295 "glsl_lexer.lpp"
{
yylval->n = 0;
return BOOLCONSTANT;
}
YY_BREAK
/* Reserved words in GLSL 1.10. */
-case 104:
+case 110:
YY_RULE_SETUP
-#line 295 "glsl_lexer.lpp"
+#line 302 "glsl_lexer.lpp"
RESERVED_WORD(999, ASM);
YY_BREAK
-case 105:
+case 111:
YY_RULE_SETUP
-#line 296 "glsl_lexer.lpp"
+#line 303 "glsl_lexer.lpp"
RESERVED_WORD(999, CLASS);
YY_BREAK
-case 106:
+case 112:
YY_RULE_SETUP
-#line 297 "glsl_lexer.lpp"
+#line 304 "glsl_lexer.lpp"
RESERVED_WORD(999, UNION);
YY_BREAK
-case 107:
+case 113:
YY_RULE_SETUP
-#line 298 "glsl_lexer.lpp"
+#line 305 "glsl_lexer.lpp"
RESERVED_WORD(999, ENUM);
YY_BREAK
-case 108:
+case 114:
YY_RULE_SETUP
-#line 299 "glsl_lexer.lpp"
+#line 306 "glsl_lexer.lpp"
RESERVED_WORD(999, TYPEDEF);
YY_BREAK
-case 109:
+case 115:
YY_RULE_SETUP
-#line 300 "glsl_lexer.lpp"
+#line 307 "glsl_lexer.lpp"
RESERVED_WORD(999, TEMPLATE);
YY_BREAK
-case 110:
+case 116:
YY_RULE_SETUP
-#line 301 "glsl_lexer.lpp"
+#line 308 "glsl_lexer.lpp"
RESERVED_WORD(999, THIS);
YY_BREAK
-case 111:
+case 117:
YY_RULE_SETUP
-#line 302 "glsl_lexer.lpp"
+#line 309 "glsl_lexer.lpp"
RESERVED_WORD(999, PACKED_TOK);
YY_BREAK
-case 112:
+case 118:
YY_RULE_SETUP
-#line 303 "glsl_lexer.lpp"
+#line 310 "glsl_lexer.lpp"
RESERVED_WORD(999, GOTO);
YY_BREAK
-case 113:
+case 119:
YY_RULE_SETUP
-#line 304 "glsl_lexer.lpp"
+#line 311 "glsl_lexer.lpp"
RESERVED_WORD(130, SWITCH);
YY_BREAK
-case 114:
+case 120:
YY_RULE_SETUP
-#line 305 "glsl_lexer.lpp"
+#line 312 "glsl_lexer.lpp"
RESERVED_WORD(130, DEFAULT);
YY_BREAK
-case 115:
+case 121:
YY_RULE_SETUP
-#line 306 "glsl_lexer.lpp"
+#line 313 "glsl_lexer.lpp"
RESERVED_WORD(999, INLINE_TOK);
YY_BREAK
-case 116:
+case 122:
YY_RULE_SETUP
-#line 307 "glsl_lexer.lpp"
+#line 314 "glsl_lexer.lpp"
RESERVED_WORD(999, NOINLINE);
YY_BREAK
-case 117:
+case 123:
YY_RULE_SETUP
-#line 308 "glsl_lexer.lpp"
+#line 315 "glsl_lexer.lpp"
RESERVED_WORD(999, VOLATILE);
YY_BREAK
-case 118:
+case 124:
YY_RULE_SETUP
-#line 309 "glsl_lexer.lpp"
+#line 316 "glsl_lexer.lpp"
RESERVED_WORD(999, PUBLIC_TOK);
YY_BREAK
-case 119:
+case 125:
YY_RULE_SETUP
-#line 310 "glsl_lexer.lpp"
+#line 317 "glsl_lexer.lpp"
RESERVED_WORD(999, STATIC);
YY_BREAK
-case 120:
+case 126:
YY_RULE_SETUP
-#line 311 "glsl_lexer.lpp"
+#line 318 "glsl_lexer.lpp"
RESERVED_WORD(999, EXTERN);
YY_BREAK
-case 121:
+case 127:
YY_RULE_SETUP
-#line 312 "glsl_lexer.lpp"
+#line 319 "glsl_lexer.lpp"
RESERVED_WORD(999, EXTERNAL);
YY_BREAK
-case 122:
+case 128:
YY_RULE_SETUP
-#line 313 "glsl_lexer.lpp"
+#line 320 "glsl_lexer.lpp"
RESERVED_WORD(999, INTERFACE);
YY_BREAK
-case 123:
+case 129:
YY_RULE_SETUP
-#line 314 "glsl_lexer.lpp"
+#line 321 "glsl_lexer.lpp"
RESERVED_WORD(999, LONG_TOK);
YY_BREAK
-case 124:
+case 130:
YY_RULE_SETUP
-#line 315 "glsl_lexer.lpp"
+#line 322 "glsl_lexer.lpp"
RESERVED_WORD(999, SHORT_TOK);
YY_BREAK
-case 125:
+case 131:
YY_RULE_SETUP
-#line 316 "glsl_lexer.lpp"
+#line 323 "glsl_lexer.lpp"
RESERVED_WORD(999, DOUBLE_TOK);
YY_BREAK
-case 126:
+case 132:
YY_RULE_SETUP
-#line 317 "glsl_lexer.lpp"
+#line 324 "glsl_lexer.lpp"
RESERVED_WORD(999, HALF);
YY_BREAK
-case 127:
+case 133:
YY_RULE_SETUP
-#line 318 "glsl_lexer.lpp"
+#line 325 "glsl_lexer.lpp"
RESERVED_WORD(999, FIXED_TOK);
YY_BREAK
-case 128:
+case 134:
YY_RULE_SETUP
-#line 319 "glsl_lexer.lpp"
+#line 326 "glsl_lexer.lpp"
RESERVED_WORD(999, UNSIGNED);
YY_BREAK
-case 129:
+case 135:
YY_RULE_SETUP
-#line 320 "glsl_lexer.lpp"
+#line 327 "glsl_lexer.lpp"
RESERVED_WORD(999, INPUT_TOK);
YY_BREAK
-case 130:
+case 136:
YY_RULE_SETUP
-#line 321 "glsl_lexer.lpp"
+#line 328 "glsl_lexer.lpp"
RESERVED_WORD(999, OUTPUT);
YY_BREAK
-case 131:
+case 137:
YY_RULE_SETUP
-#line 322 "glsl_lexer.lpp"
+#line 329 "glsl_lexer.lpp"
RESERVED_WORD(999, HVEC2);
YY_BREAK
-case 132:
+case 138:
YY_RULE_SETUP
-#line 323 "glsl_lexer.lpp"
+#line 330 "glsl_lexer.lpp"
RESERVED_WORD(999, HVEC3);
YY_BREAK
-case 133:
+case 139:
YY_RULE_SETUP
-#line 324 "glsl_lexer.lpp"
+#line 331 "glsl_lexer.lpp"
RESERVED_WORD(999, HVEC4);
YY_BREAK
-case 134:
+case 140:
YY_RULE_SETUP
-#line 325 "glsl_lexer.lpp"
+#line 332 "glsl_lexer.lpp"
RESERVED_WORD(999, DVEC2);
YY_BREAK
-case 135:
+case 141:
YY_RULE_SETUP
-#line 326 "glsl_lexer.lpp"
+#line 333 "glsl_lexer.lpp"
RESERVED_WORD(999, DVEC3);
YY_BREAK
-case 136:
+case 142:
YY_RULE_SETUP
-#line 327 "glsl_lexer.lpp"
+#line 334 "glsl_lexer.lpp"
RESERVED_WORD(999, DVEC4);
YY_BREAK
-case 137:
+case 143:
YY_RULE_SETUP
-#line 328 "glsl_lexer.lpp"
+#line 335 "glsl_lexer.lpp"
RESERVED_WORD(999, FVEC2);
YY_BREAK
-case 138:
+case 144:
YY_RULE_SETUP
-#line 329 "glsl_lexer.lpp"
+#line 336 "glsl_lexer.lpp"
RESERVED_WORD(999, FVEC3);
YY_BREAK
-case 139:
+case 145:
YY_RULE_SETUP
-#line 330 "glsl_lexer.lpp"
+#line 337 "glsl_lexer.lpp"
RESERVED_WORD(999, FVEC4);
YY_BREAK
-case 140:
+case 146:
YY_RULE_SETUP
-#line 331 "glsl_lexer.lpp"
+#line 338 "glsl_lexer.lpp"
return SAMPLER2DRECT;
YY_BREAK
-case 141:
+case 147:
YY_RULE_SETUP
-#line 332 "glsl_lexer.lpp"
+#line 339 "glsl_lexer.lpp"
RESERVED_WORD(999, SAMPLER3DRECT);
YY_BREAK
-case 142:
+case 148:
YY_RULE_SETUP
-#line 333 "glsl_lexer.lpp"
+#line 340 "glsl_lexer.lpp"
return SAMPLER2DRECTSHADOW;
YY_BREAK
-case 143:
+case 149:
YY_RULE_SETUP
-#line 334 "glsl_lexer.lpp"
+#line 341 "glsl_lexer.lpp"
RESERVED_WORD(999, SIZEOF);
YY_BREAK
-case 144:
+case 150:
YY_RULE_SETUP
-#line 335 "glsl_lexer.lpp"
+#line 342 "glsl_lexer.lpp"
RESERVED_WORD(999, CAST);
YY_BREAK
-case 145:
+case 151:
YY_RULE_SETUP
-#line 336 "glsl_lexer.lpp"
+#line 343 "glsl_lexer.lpp"
RESERVED_WORD(999, NAMESPACE);
YY_BREAK
-case 146:
+case 152:
YY_RULE_SETUP
-#line 337 "glsl_lexer.lpp"
+#line 344 "glsl_lexer.lpp"
RESERVED_WORD(999, USING);
YY_BREAK
/* Additional reserved words in GLSL 1.20. */
-case 147:
+case 153:
YY_RULE_SETUP
-#line 340 "glsl_lexer.lpp"
+#line 347 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER_ES(120, LOWP);
YY_BREAK
-case 148:
+case 154:
YY_RULE_SETUP
-#line 341 "glsl_lexer.lpp"
+#line 348 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER_ES(120, MEDIUMP);
YY_BREAK
-case 149:
+case 155:
YY_RULE_SETUP
-#line 342 "glsl_lexer.lpp"
+#line 349 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER_ES(120, HIGHP);
YY_BREAK
-case 150:
+case 156:
YY_RULE_SETUP
-#line 343 "glsl_lexer.lpp"
+#line 350 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER_ES(120, PRECISION);
YY_BREAK
/* Additional reserved words in GLSL 1.30. */
-case 151:
+case 157:
YY_RULE_SETUP
-#line 346 "glsl_lexer.lpp"
+#line 353 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, COMMON);
YY_BREAK
-case 152:
+case 158:
YY_RULE_SETUP
-#line 347 "glsl_lexer.lpp"
+#line 354 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, PARTITION);
YY_BREAK
-case 153:
+case 159:
YY_RULE_SETUP
-#line 348 "glsl_lexer.lpp"
+#line 355 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, ACTIVE);
YY_BREAK
-case 154:
+case 160:
YY_RULE_SETUP
-#line 349 "glsl_lexer.lpp"
+#line 356 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER_ES(130, SUPERP);
YY_BREAK
-case 155:
+case 161:
YY_RULE_SETUP
-#line 350 "glsl_lexer.lpp"
+#line 357 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, SAMPLERBUFFER);
YY_BREAK
-case 156:
+case 162:
YY_RULE_SETUP
-#line 351 "glsl_lexer.lpp"
+#line 358 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, FILTER);
YY_BREAK
-case 157:
+case 163:
YY_RULE_SETUP
-#line 352 "glsl_lexer.lpp"
+#line 359 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE1D);
YY_BREAK
-case 158:
+case 164:
YY_RULE_SETUP
-#line 353 "glsl_lexer.lpp"
+#line 360 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE2D);
YY_BREAK
-case 159:
+case 165:
YY_RULE_SETUP
-#line 354 "glsl_lexer.lpp"
+#line 361 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE3D);
YY_BREAK
-case 160:
+case 166:
YY_RULE_SETUP
-#line 355 "glsl_lexer.lpp"
+#line 362 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGECUBE);
YY_BREAK
-case 161:
+case 167:
YY_RULE_SETUP
-#line 356 "glsl_lexer.lpp"
+#line 363 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGE1D);
YY_BREAK
-case 162:
+case 168:
YY_RULE_SETUP
-#line 357 "glsl_lexer.lpp"
+#line 364 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGE2D);
YY_BREAK
-case 163:
+case 169:
YY_RULE_SETUP
-#line 358 "glsl_lexer.lpp"
+#line 365 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGE3D);
YY_BREAK
-case 164:
+case 170:
YY_RULE_SETUP
-#line 359 "glsl_lexer.lpp"
+#line 366 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGECUBE);
YY_BREAK
-case 165:
+case 171:
YY_RULE_SETUP
-#line 360 "glsl_lexer.lpp"
+#line 367 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGE1D);
YY_BREAK
-case 166:
+case 172:
YY_RULE_SETUP
-#line 361 "glsl_lexer.lpp"
+#line 368 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGE2D);
YY_BREAK
-case 167:
+case 173:
YY_RULE_SETUP
-#line 362 "glsl_lexer.lpp"
+#line 369 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGE3D);
YY_BREAK
-case 168:
+case 174:
YY_RULE_SETUP
-#line 363 "glsl_lexer.lpp"
+#line 370 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGECUBE);
YY_BREAK
-case 169:
+case 175:
YY_RULE_SETUP
-#line 364 "glsl_lexer.lpp"
+#line 371 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE1DARRAY);
YY_BREAK
-case 170:
+case 176:
YY_RULE_SETUP
-#line 365 "glsl_lexer.lpp"
+#line 372 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE2DARRAY);
YY_BREAK
-case 171:
+case 177:
YY_RULE_SETUP
-#line 366 "glsl_lexer.lpp"
+#line 373 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGE1DARRAY);
YY_BREAK
-case 172:
+case 178:
YY_RULE_SETUP
-#line 367 "glsl_lexer.lpp"
+#line 374 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGE2DARRAY);
YY_BREAK
-case 173:
+case 179:
YY_RULE_SETUP
-#line 368 "glsl_lexer.lpp"
+#line 375 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGE1DARRAY);
YY_BREAK
-case 174:
+case 180:
YY_RULE_SETUP
-#line 369 "glsl_lexer.lpp"
+#line 376 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGE2DARRAY);
YY_BREAK
-case 175:
+case 181:
YY_RULE_SETUP
-#line 370 "glsl_lexer.lpp"
+#line 377 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE1DSHADOW);
YY_BREAK
-case 176:
+case 182:
YY_RULE_SETUP
-#line 371 "glsl_lexer.lpp"
+#line 378 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE2DSHADOW);
YY_BREAK
-case 177:
+case 183:
YY_RULE_SETUP
-#line 372 "glsl_lexer.lpp"
+#line 379 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGEBUFFER);
YY_BREAK
-case 178:
+case 184:
YY_RULE_SETUP
-#line 373 "glsl_lexer.lpp"
+#line 380 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGEBUFFER);
YY_BREAK
-case 179:
+case 185:
YY_RULE_SETUP
-#line 374 "glsl_lexer.lpp"
+#line 381 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGEBUFFER);
YY_BREAK
-case 180:
+case 186:
YY_RULE_SETUP
-#line 375 "glsl_lexer.lpp"
+#line 382 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, ROW_MAJOR);
YY_BREAK
-case 181:
+case 187:
YY_RULE_SETUP
-#line 377 "glsl_lexer.lpp"
+#line 384 "glsl_lexer.lpp"
{
struct _mesa_glsl_parse_state *state = yyextra;
void *ctx = state;
return IDENTIFIER;
}
YY_BREAK
-case 182:
+case 188:
YY_RULE_SETUP
-#line 384 "glsl_lexer.lpp"
+#line 391 "glsl_lexer.lpp"
{ return yytext[0]; }
YY_BREAK
-case 183:
+case 189:
YY_RULE_SETUP
-#line 386 "glsl_lexer.lpp"
+#line 393 "glsl_lexer.lpp"
ECHO;
YY_BREAK
-#line 2330 "glsl_lexer.cpp"
+#line 2380 "glsl_lexer.cpp"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(PP):
case YY_STATE_EOF(PRAGMA):
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 708 )
+ if ( yy_current_state >= 716 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 708 )
+ if ( yy_current_state >= 716 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 707);
+ yy_is_jam = (yy_current_state == 715);
return yy_is_jam ? 0 : yy_current_state;
}
/** Setup the input buffer state to scan the given bytes. The next call to _mesa_glsl_lex() will
* scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
#define YYTABLES_NAME "yytables"
-#line 386 "glsl_lexer.lpp"
+#line 393 "glsl_lexer.lpp"
bool return BOOL_TOK;
float return FLOAT_TOK;
int return INT_TOK;
+uint TOKEN_OR_IDENTIFIER(130, UINT_TOK);
break return BREAK;
continue return CONTINUE;
ivec2 return IVEC2;
ivec3 return IVEC3;
ivec4 return IVEC4;
+uvec2 TOKEN_OR_IDENTIFIER(130, UVEC2);
+uvec3 TOKEN_OR_IDENTIFIER(130, UVEC3);
+uvec4 TOKEN_OR_IDENTIFIER(130, UVEC4);
vec2 return VEC2;
vec3 return VEC3;
vec4 return VEC4;
layout {
if ((yyextra->language_version >= 140)
+ || yyextra->ARB_explicit_attrib_location_enable
|| (yyextra->ARB_fragment_coord_conventions_enable)){
return LAYOUT_TOK;
} else {
&& return AND_OP;
\|\| return OR_OP;
"^^" return XOR_OP;
+"<<" return LEFT_OP;
+">>" return RIGHT_OP;
\*= return MUL_ASSIGN;
\/= return DIV_ASSIGN;
\<\<= return LEFT_ASSIGN;
>>= return RIGHT_ASSIGN;
&= return AND_ASSIGN;
-^= return XOR_ASSIGN;
+"^=" return XOR_ASSIGN;
\|= return OR_ASSIGN;
-= return SUB_ASSIGN;
float real;
char *identifier;
- union {
- struct ast_type_qualifier q;
- unsigned i;
- } type_qualifier;
+ struct ast_type_qualifier type_qualifier;
ast_node *node;
ast_type_specifier *type_specifier;
/* Line 214 of yacc.c */
-#line 378 "glsl_parser.cpp"
+#line 375 "glsl_parser.cpp"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
/* Line 264 of yacc.c */
-#line 403 "glsl_parser.cpp"
+#line 400 "glsl_parser.cpp"
#ifdef short
# undef short
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 5
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 4005
+#define YYLAST 3692
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 215
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 88
+#define YYNNTS 87
/* YYNRULES -- Number of rules. */
-#define YYNRULES 274
+#define YYNRULES 278
/* YYNRULES -- Number of states. */
-#define YYNSTATES 409
+#define YYNSTATES 413
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
280, 285, 288, 290, 292, 295, 299, 303, 306, 312,
316, 319, 323, 326, 327, 329, 331, 333, 335, 337,
341, 347, 354, 362, 371, 377, 379, 382, 387, 393,
- 400, 408, 413, 416, 418, 421, 422, 424, 429, 431,
- 435, 437, 439, 441, 443, 445, 447, 450, 453, 455,
- 457, 460, 463, 466, 468, 471, 474, 476, 478, 481,
- 483, 487, 492, 494, 496, 498, 500, 502, 504, 506,
- 508, 510, 512, 514, 516, 518, 520, 522, 524, 526,
- 528, 530, 532, 534, 536, 538, 540, 542, 544, 546,
- 548, 550, 552, 554, 556, 558, 560, 562, 564, 566,
- 568, 570, 572, 574, 576, 578, 580, 582, 584, 586,
- 588, 590, 592, 594, 596, 598, 600, 602, 604, 606,
- 612, 617, 619, 622, 626, 628, 632, 634, 639, 641,
- 643, 645, 647, 649, 651, 653, 655, 657, 659, 661,
- 664, 668, 670, 672, 675, 679, 681, 684, 686, 689,
- 695, 699, 701, 703, 708, 714, 718, 721, 727, 735,
- 742, 744, 746, 748, 749, 752, 756, 759, 762, 765,
- 769, 772, 774, 776, 778
+ 400, 408, 413, 416, 418, 421, 426, 428, 432, 434,
+ 438, 440, 442, 444, 446, 448, 450, 453, 455, 458,
+ 461, 465, 467, 469, 471, 473, 476, 478, 480, 483,
+ 486, 488, 490, 493, 495, 499, 504, 506, 508, 510,
+ 512, 514, 516, 518, 520, 522, 524, 526, 528, 530,
+ 532, 534, 536, 538, 540, 542, 544, 546, 548, 550,
+ 552, 554, 556, 558, 560, 562, 564, 566, 568, 570,
+ 572, 574, 576, 578, 580, 582, 584, 586, 588, 590,
+ 592, 594, 596, 598, 600, 602, 604, 606, 608, 610,
+ 612, 614, 616, 618, 624, 629, 631, 634, 638, 640,
+ 644, 646, 651, 653, 655, 657, 659, 661, 663, 665,
+ 667, 669, 671, 673, 676, 680, 682, 684, 687, 691,
+ 693, 696, 698, 701, 707, 711, 713, 715, 720, 726,
+ 730, 733, 739, 747, 754, 756, 758, 760, 761, 764,
+ 768, 771, 774, 777, 781, 784, 786, 788, 790
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
216, 0, -1, -1, 218, 220, 217, 222, -1, -1,
109, 78, 113, -1, 116, 113, -1, 117, 113, -1,
118, 113, -1, 119, 113, -1, -1, 220, 221, -1,
- 110, 76, 112, 76, 113, -1, 301, -1, 222, 301,
+ 110, 76, 112, 76, 113, -1, 300, -1, 222, 300,
-1, 76, -1, 223, -1, 78, -1, 79, -1, 77,
-1, 80, -1, 191, 250, 192, -1, 224, -1, 225,
193, 226, 194, -1, 227, -1, 225, 195, 76, -1,
225, 84, -1, 225, 85, -1, 250, -1, 228, -1,
229, -1, 225, 195, 229, -1, 231, 192, -1, 230,
192, -1, 232, 74, -1, 232, -1, 232, 248, -1,
- 231, 196, 248, -1, 233, 191, -1, 272, -1, 76,
+ 231, 196, 248, -1, 233, 191, -1, 271, -1, 76,
-1, 81, -1, 225, -1, 84, 234, -1, 85, 234,
-1, 235, 234, -1, 197, -1, 198, -1, 199, -1,
200, -1, 234, -1, 236, 201, 234, -1, 236, 202,
96, -1, 95, -1, 102, -1, 97, -1, 98, -1,
99, -1, 100, -1, 101, -1, 248, -1, 250, 196,
248, -1, 247, -1, 253, 212, -1, 261, 212, -1,
- 108, 276, 273, 212, -1, 254, 192, -1, 256, -1,
+ 108, 275, 272, 212, -1, 254, 192, -1, 256, -1,
255, -1, 256, 258, -1, 255, 196, 258, -1, 263,
- 76, 191, -1, 272, 76, -1, 272, 76, 193, 251,
- 194, -1, 269, 259, 257, -1, 259, 257, -1, 269,
+ 76, 191, -1, 271, 76, -1, 271, 76, 193, 251,
+ 194, -1, 268, 259, 257, -1, 259, 257, -1, 268,
259, 260, -1, 259, 260, -1, -1, 33, -1, 34,
- -1, 35, -1, 272, -1, 262, -1, 261, 196, 76,
+ -1, 35, -1, 271, -1, 262, -1, 261, 196, 76,
-1, 261, 196, 76, 193, 194, -1, 261, 196, 76,
193, 251, 194, -1, 261, 196, 76, 193, 194, 211,
- 282, -1, 261, 196, 76, 193, 251, 194, 211, 282,
- -1, 261, 196, 76, 211, 282, -1, 263, -1, 263,
+ 281, -1, 261, 196, 76, 193, 251, 194, 211, 281,
+ -1, 261, 196, 76, 211, 281, -1, 263, -1, 263,
76, -1, 263, 76, 193, 194, -1, 263, 76, 193,
- 251, 194, -1, 263, 76, 193, 194, 211, 282, -1,
- 263, 76, 193, 251, 194, 211, 282, -1, 263, 76,
- 211, 282, -1, 103, 76, -1, 272, -1, 270, 272,
- -1, -1, 265, -1, 120, 191, 266, 192, -1, 267,
- -1, 266, 196, 267, -1, 76, -1, 40, -1, 39,
- -1, 38, -1, 4, -1, 271, -1, 268, 270, -1,
- 103, 270, -1, 4, -1, 3, -1, 264, 37, -1,
- 32, 37, -1, 264, 33, -1, 34, -1, 32, 33,
- -1, 32, 34, -1, 36, -1, 273, -1, 276, 273,
- -1, 274, -1, 274, 193, 194, -1, 274, 193, 251,
- 194, -1, 275, -1, 277, -1, 76, -1, 74, -1,
- 6, -1, 7, -1, 8, -1, 5, -1, 29, -1,
- 30, -1, 31, -1, 20, -1, 21, -1, 22, -1,
- 23, -1, 24, -1, 25, -1, 26, -1, 27, -1,
- 28, -1, 41, -1, 42, -1, 43, -1, 44, -1,
- 45, -1, 46, -1, 47, -1, 48, -1, 49, -1,
- 50, -1, 51, -1, 154, -1, 52, -1, 53, -1,
- 54, -1, 55, -1, 156, -1, 56, -1, 57, -1,
- 58, -1, 59, -1, 60, -1, 61, -1, 62, -1,
- 63, -1, 64, -1, 65, -1, 66, -1, 67, -1,
- 68, -1, 69, -1, 70, -1, 71, -1, 72, -1,
- 106, -1, 105, -1, 104, -1, 73, 76, 213, 278,
- 214, -1, 73, 213, 278, 214, -1, 279, -1, 278,
- 279, -1, 272, 280, 212, -1, 281, -1, 280, 196,
- 281, -1, 76, -1, 76, 193, 251, 194, -1, 248,
- -1, 252, -1, 286, -1, 285, -1, 283, -1, 290,
- -1, 291, -1, 294, -1, 295, -1, 296, -1, 300,
- -1, 213, 214, -1, 213, 289, 214, -1, 288, -1,
- 285, -1, 213, 214, -1, 213, 289, 214, -1, 284,
- -1, 289, 284, -1, 212, -1, 250, 212, -1, 14,
- 191, 250, 192, 292, -1, 284, 12, 284, -1, 284,
- -1, 250, -1, 263, 76, 211, 282, -1, 17, 191,
- 250, 192, 286, -1, 18, 250, 210, -1, 19, 210,
- -1, 75, 191, 293, 192, 287, -1, 11, 284, 75,
- 191, 250, 192, 212, -1, 13, 191, 297, 299, 192,
- 287, -1, 290, -1, 283, -1, 293, -1, -1, 298,
- 212, -1, 298, 212, 250, -1, 10, 212, -1, 9,
- 212, -1, 16, 212, -1, 16, 250, 212, -1, 15,
- 212, -1, 302, -1, 252, -1, 219, -1, 253, 288,
- -1
+ 251, 194, -1, 263, 76, 193, 194, 211, 281, -1,
+ 263, 76, 193, 251, 194, 211, 281, -1, 263, 76,
+ 211, 281, -1, 103, 76, -1, 271, -1, 269, 271,
+ -1, 120, 191, 265, 192, -1, 266, -1, 265, 196,
+ 266, -1, 76, -1, 76, 211, 78, -1, 40, -1,
+ 39, -1, 38, -1, 4, -1, 270, -1, 264, -1,
+ 264, 270, -1, 267, -1, 267, 270, -1, 103, 270,
+ -1, 103, 267, 270, -1, 103, -1, 4, -1, 3,
+ -1, 37, -1, 32, 37, -1, 33, -1, 34, -1,
+ 32, 33, -1, 32, 34, -1, 36, -1, 272, -1,
+ 275, 272, -1, 273, -1, 273, 193, 194, -1, 273,
+ 193, 251, 194, -1, 274, -1, 276, -1, 76, -1,
+ 74, -1, 6, -1, 7, -1, 8, -1, 5, -1,
+ 29, -1, 30, -1, 31, -1, 20, -1, 21, -1,
+ 22, -1, 23, -1, 24, -1, 25, -1, 26, -1,
+ 27, -1, 28, -1, 41, -1, 42, -1, 43, -1,
+ 44, -1, 45, -1, 46, -1, 47, -1, 48, -1,
+ 49, -1, 50, -1, 51, -1, 154, -1, 52, -1,
+ 53, -1, 54, -1, 55, -1, 156, -1, 56, -1,
+ 57, -1, 58, -1, 59, -1, 60, -1, 61, -1,
+ 62, -1, 63, -1, 64, -1, 65, -1, 66, -1,
+ 67, -1, 68, -1, 69, -1, 70, -1, 71, -1,
+ 72, -1, 106, -1, 105, -1, 104, -1, 73, 76,
+ 213, 277, 214, -1, 73, 213, 277, 214, -1, 278,
+ -1, 277, 278, -1, 271, 279, 212, -1, 280, -1,
+ 279, 196, 280, -1, 76, -1, 76, 193, 251, 194,
+ -1, 248, -1, 252, -1, 285, -1, 284, -1, 282,
+ -1, 289, -1, 290, -1, 293, -1, 294, -1, 295,
+ -1, 299, -1, 213, 214, -1, 213, 288, 214, -1,
+ 287, -1, 284, -1, 213, 214, -1, 213, 288, 214,
+ -1, 283, -1, 288, 283, -1, 212, -1, 250, 212,
+ -1, 14, 191, 250, 192, 291, -1, 283, 12, 283,
+ -1, 283, -1, 250, -1, 263, 76, 211, 281, -1,
+ 17, 191, 250, 192, 285, -1, 18, 250, 210, -1,
+ 19, 210, -1, 75, 191, 292, 192, 286, -1, 11,
+ 283, 75, 191, 250, 192, 212, -1, 13, 191, 296,
+ 298, 192, 286, -1, 289, -1, 282, -1, 292, -1,
+ -1, 297, 212, -1, 297, 212, 250, -1, 10, 212,
+ -1, 9, 212, -1, 16, 212, -1, 16, 250, 212,
+ -1, 15, 212, -1, 301, -1, 252, -1, 219, -1,
+ 253, 287, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 214, 214, 213, 220, 222, 242, 243, 244, 245,
- 248, 250, 254, 263, 271, 282, 286, 293, 300, 307,
- 314, 321, 328, 329, 335, 339, 346, 352, 361, 365,
- 369, 370, 379, 380, 384, 385, 389, 395, 407, 411,
- 417, 424, 435, 436, 442, 448, 458, 459, 460, 461,
- 465, 466, 472, 478, 487, 488, 494, 503, 504, 510,
- 519, 520, 526, 532, 538, 547, 548, 554, 563, 564,
- 573, 574, 583, 584, 593, 594, 603, 604, 613, 614,
- 623, 624, 633, 634, 643, 644, 645, 646, 647, 648,
- 649, 650, 651, 652, 653, 657, 661, 677, 681, 685,
- 689, 703, 707, 708, 712, 717, 725, 736, 746, 761,
- 768, 773, 784, 796, 797, 798, 799, 803, 807, 808,
- 817, 826, 835, 844, 853, 866, 877, 886, 895, 904,
- 913, 922, 931, 945, 952, 963, 964, 968, 975, 976,
- 983, 1017, 1018, 1019, 1023, 1027, 1028, 1032, 1040, 1041,
- 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1052, 1053, 1061,
- 1062, 1068, 1077, 1083, 1089, 1098, 1099, 1100, 1101, 1102,
- 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112,
- 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122,
- 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132,
- 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142,
- 1143, 1144, 1145, 1146, 1147, 1148, 1152, 1163, 1174, 1188,
- 1194, 1203, 1208, 1216, 1231, 1236, 1244, 1250, 1259, 1263,
- 1269, 1270, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1284,
- 1290, 1299, 1300, 1304, 1310, 1319, 1329, 1341, 1347, 1356,
- 1365, 1370, 1378, 1382, 1396, 1400, 1401, 1405, 1412, 1419,
- 1429, 1430, 1434, 1436, 1442, 1447, 1456, 1462, 1468, 1474,
- 1480, 1489, 1490, 1491, 1495
+ 0, 211, 211, 210, 217, 219, 239, 240, 241, 242,
+ 245, 247, 251, 260, 268, 279, 283, 290, 297, 304,
+ 311, 318, 325, 326, 332, 336, 343, 349, 358, 362,
+ 366, 367, 376, 377, 381, 382, 386, 392, 404, 408,
+ 414, 421, 432, 433, 439, 445, 455, 456, 457, 458,
+ 462, 463, 469, 475, 484, 485, 491, 500, 501, 507,
+ 516, 517, 523, 529, 535, 544, 545, 551, 560, 561,
+ 570, 571, 580, 581, 590, 591, 600, 601, 610, 611,
+ 620, 621, 630, 631, 640, 641, 642, 643, 644, 645,
+ 646, 647, 648, 649, 650, 654, 658, 674, 678, 682,
+ 686, 700, 704, 705, 709, 714, 722, 733, 743, 758,
+ 765, 770, 781, 794, 797, 802, 807, 816, 820, 821,
+ 830, 839, 848, 857, 866, 879, 890, 899, 908, 917,
+ 926, 935, 944, 958, 965, 976, 983, 984, 1003, 1032,
+ 1073, 1078, 1083, 1091, 1099, 1100, 1101, 1106, 1107, 1112,
+ 1117, 1123, 1131, 1136, 1141, 1146, 1152, 1157, 1162, 1167,
+ 1172, 1180, 1181, 1189, 1190, 1196, 1205, 1211, 1217, 1226,
+ 1227, 1228, 1229, 1230, 1231, 1232, 1233, 1234, 1235, 1236,
+ 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246,
+ 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256,
+ 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266,
+ 1267, 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276,
+ 1280, 1291, 1302, 1316, 1322, 1331, 1336, 1344, 1359, 1364,
+ 1372, 1378, 1387, 1391, 1397, 1398, 1402, 1403, 1404, 1405,
+ 1406, 1407, 1408, 1412, 1418, 1427, 1428, 1432, 1438, 1447,
+ 1457, 1469, 1475, 1484, 1493, 1498, 1506, 1510, 1524, 1528,
+ 1529, 1533, 1540, 1547, 1557, 1558, 1562, 1564, 1570, 1575,
+ 1584, 1590, 1596, 1602, 1608, 1617, 1618, 1619, 1623
};
#endif
"function_header", "parameter_declarator", "parameter_declaration",
"parameter_qualifier", "parameter_type_specifier",
"init_declarator_list", "single_declaration", "fully_specified_type",
- "opt_layout_qualifier", "layout_qualifier", "layout_qualifier_id_list",
- "layout_qualifier_id", "interpolation_qualifier",
- "parameter_type_qualifier", "type_qualifier", "storage_qualifier",
- "type_specifier", "type_specifier_no_prec", "type_specifier_nonarray",
- "basic_type_specifier_nonarray", "precision_qualifier",
- "struct_specifier", "struct_declaration_list", "struct_declaration",
- "struct_declarator_list", "struct_declarator", "initializer",
- "declaration_statement", "statement", "simple_statement",
+ "layout_qualifier", "layout_qualifier_id_list", "layout_qualifier_id",
+ "interpolation_qualifier", "parameter_type_qualifier", "type_qualifier",
+ "storage_qualifier", "type_specifier", "type_specifier_no_prec",
+ "type_specifier_nonarray", "basic_type_specifier_nonarray",
+ "precision_qualifier", "struct_specifier", "struct_declaration_list",
+ "struct_declaration", "struct_declarator_list", "struct_declarator",
+ "initializer", "declaration_statement", "statement", "simple_statement",
"compound_statement", "statement_no_new_scope",
"compound_statement_no_new_scope", "statement_list",
"expression_statement", "selection_statement",
252, 253, 254, 254, 255, 255, 256, 257, 257, 258,
258, 258, 258, 259, 259, 259, 259, 260, 261, 261,
261, 261, 261, 261, 261, 262, 262, 262, 262, 262,
- 262, 262, 262, 263, 263, 264, 264, 265, 266, 266,
- 267, 268, 268, 268, 269, 270, 270, 270, 271, 271,
- 271, 271, 271, 271, 271, 271, 271, 272, 272, 273,
- 273, 273, 274, 274, 274, 275, 275, 275, 275, 275,
- 275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
- 275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
- 275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
- 275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
- 275, 275, 275, 275, 275, 275, 276, 276, 276, 277,
- 277, 278, 278, 279, 280, 280, 281, 281, 282, 283,
- 284, 284, 285, 285, 285, 285, 285, 285, 285, 286,
- 286, 287, 287, 288, 288, 289, 289, 290, 290, 291,
- 292, 292, 293, 293, 294, 295, 295, 296, 296, 296,
- 297, 297, 298, 298, 299, 299, 300, 300, 300, 300,
- 300, 301, 301, 301, 302
+ 262, 262, 262, 263, 263, 264, 265, 265, 266, 266,
+ 267, 267, 267, 268, 269, 269, 269, 269, 269, 269,
+ 269, 269, 270, 270, 270, 270, 270, 270, 270, 270,
+ 270, 271, 271, 272, 272, 272, 273, 273, 273, 274,
+ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
+ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
+ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
+ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
+ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
+ 275, 275, 275, 276, 276, 277, 277, 278, 279, 279,
+ 280, 280, 281, 282, 283, 283, 284, 284, 284, 284,
+ 284, 284, 284, 285, 285, 286, 286, 287, 287, 288,
+ 288, 289, 289, 290, 291, 291, 292, 292, 293, 294,
+ 294, 295, 295, 295, 296, 296, 297, 297, 298, 298,
+ 299, 299, 299, 299, 299, 300, 300, 300, 301
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
4, 2, 1, 1, 2, 3, 3, 2, 5, 3,
2, 3, 2, 0, 1, 1, 1, 1, 1, 3,
5, 6, 7, 8, 5, 1, 2, 4, 5, 6,
- 7, 4, 2, 1, 2, 0, 1, 4, 1, 3,
- 1, 1, 1, 1, 1, 1, 2, 2, 1, 1,
- 2, 2, 2, 1, 2, 2, 1, 1, 2, 1,
- 3, 4, 1, 1, 1, 1, 1, 1, 1, 1,
+ 7, 4, 2, 1, 2, 4, 1, 3, 1, 3,
+ 1, 1, 1, 1, 1, 1, 2, 1, 2, 2,
+ 3, 1, 1, 1, 1, 2, 1, 1, 2, 2,
+ 1, 1, 2, 1, 3, 4, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 5,
- 4, 1, 2, 3, 1, 3, 1, 4, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
- 3, 1, 1, 2, 3, 1, 2, 1, 2, 5,
- 3, 1, 1, 4, 5, 3, 2, 5, 7, 6,
- 1, 1, 1, 0, 2, 3, 2, 2, 2, 3,
- 2, 1, 1, 1, 2
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 5, 4, 1, 2, 3, 1, 3,
+ 1, 4, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 2, 3, 1, 1, 2, 3, 1,
+ 2, 1, 2, 5, 3, 1, 1, 4, 5, 3,
+ 2, 5, 7, 6, 1, 1, 1, 0, 2, 3,
+ 2, 2, 2, 3, 2, 1, 1, 1, 2
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
means the default is an error. */
static const yytype_uint16 yydefact[] =
{
- 4, 0, 0, 10, 0, 1, 2, 5, 0, 135,
- 11, 0, 149, 148, 169, 166, 167, 168, 173, 174,
- 175, 176, 177, 178, 179, 180, 181, 170, 171, 172,
- 0, 153, 156, 143, 142, 141, 182, 183, 184, 185,
- 186, 187, 188, 189, 190, 191, 192, 194, 195, 196,
- 197, 199, 200, 201, 202, 203, 204, 205, 206, 207,
- 208, 209, 210, 211, 212, 213, 214, 215, 0, 165,
- 164, 135, 218, 217, 216, 0, 0, 0, 0, 0,
- 0, 193, 198, 273, 135, 272, 0, 0, 103, 113,
- 0, 118, 125, 0, 136, 135, 0, 145, 133, 157,
- 159, 162, 0, 163, 13, 271, 0, 154, 155, 151,
- 0, 0, 132, 135, 147, 0, 6, 7, 8, 9,
- 0, 14, 98, 135, 274, 101, 113, 144, 114, 115,
- 116, 104, 0, 113, 0, 99, 126, 152, 150, 146,
- 134, 0, 158, 0, 0, 0, 0, 221, 0, 140,
- 0, 138, 0, 0, 135, 0, 0, 0, 0, 0,
- 0, 0, 0, 15, 19, 17, 18, 20, 41, 0,
- 0, 0, 46, 47, 48, 49, 247, 135, 243, 16,
- 22, 42, 24, 29, 30, 0, 0, 35, 0, 50,
- 0, 54, 57, 60, 65, 68, 70, 72, 74, 76,
- 78, 80, 82, 95, 0, 229, 0, 133, 232, 245,
- 231, 230, 135, 233, 234, 235, 236, 237, 238, 105,
- 110, 112, 117, 0, 119, 106, 0, 0, 160, 50,
- 97, 0, 39, 12, 0, 226, 0, 224, 220, 222,
- 100, 137, 0, 267, 266, 0, 135, 0, 270, 268,
- 0, 0, 0, 256, 135, 43, 44, 0, 239, 135,
- 26, 27, 0, 0, 33, 32, 0, 165, 36, 38,
- 85, 86, 88, 87, 90, 91, 92, 93, 94, 89,
- 84, 0, 45, 0, 0, 0, 0, 0, 0, 0,
+ 4, 0, 0, 10, 0, 1, 2, 5, 0, 0,
+ 11, 0, 153, 152, 173, 170, 171, 172, 177, 178,
+ 179, 180, 181, 182, 183, 184, 185, 174, 175, 176,
+ 0, 156, 157, 160, 154, 142, 141, 140, 186, 187,
+ 188, 189, 190, 191, 192, 193, 194, 195, 196, 198,
+ 199, 200, 201, 203, 204, 205, 206, 207, 208, 209,
+ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+ 0, 169, 168, 151, 222, 221, 220, 0, 0, 0,
+ 0, 0, 0, 197, 202, 277, 3, 276, 0, 0,
+ 103, 113, 0, 118, 125, 145, 147, 0, 144, 133,
+ 161, 163, 166, 0, 167, 13, 275, 0, 158, 159,
+ 155, 0, 0, 132, 0, 149, 0, 6, 7, 8,
+ 9, 0, 14, 98, 0, 278, 101, 113, 143, 114,
+ 115, 116, 104, 0, 113, 0, 99, 126, 146, 148,
+ 134, 0, 162, 0, 0, 0, 0, 225, 150, 0,
+ 138, 0, 136, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 15, 19, 17, 18, 20, 41,
+ 0, 0, 0, 46, 47, 48, 49, 251, 0, 247,
+ 16, 22, 42, 24, 29, 30, 0, 0, 35, 0,
+ 50, 0, 54, 57, 60, 65, 68, 70, 72, 74,
+ 76, 78, 80, 82, 95, 0, 233, 0, 133, 236,
+ 249, 235, 234, 0, 237, 238, 239, 240, 241, 242,
+ 105, 110, 112, 117, 0, 119, 106, 0, 0, 164,
+ 50, 97, 0, 39, 12, 0, 230, 0, 228, 224,
+ 226, 100, 0, 135, 0, 271, 270, 0, 0, 0,
+ 274, 272, 0, 0, 0, 260, 0, 43, 44, 0,
+ 243, 0, 26, 27, 0, 0, 33, 32, 0, 169,
+ 36, 38, 85, 86, 88, 87, 90, 91, 92, 93,
+ 94, 89, 84, 0, 45, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 248, 244, 246, 107, 109, 111,
- 0, 0, 127, 0, 228, 131, 161, 219, 0, 0,
- 223, 139, 0, 261, 260, 135, 0, 269, 0, 255,
- 252, 0, 0, 21, 240, 0, 28, 25, 31, 37,
- 83, 51, 52, 53, 55, 56, 58, 59, 63, 64,
- 61, 62, 66, 67, 69, 71, 73, 75, 77, 79,
- 0, 96, 0, 120, 0, 124, 0, 128, 0, 225,
- 0, 262, 0, 0, 135, 0, 0, 135, 23, 0,
- 0, 0, 121, 129, 0, 227, 0, 264, 135, 251,
- 249, 254, 0, 242, 257, 241, 81, 108, 122, 0,
- 130, 0, 265, 259, 135, 253, 123, 258, 250
+ 0, 0, 0, 0, 0, 0, 252, 248, 250, 107,
+ 109, 111, 0, 0, 127, 0, 232, 131, 165, 223,
+ 0, 0, 227, 139, 137, 0, 265, 264, 267, 0,
+ 273, 0, 259, 151, 256, 0, 0, 21, 244, 0,
+ 28, 25, 31, 37, 83, 51, 52, 53, 55, 56,
+ 58, 59, 63, 64, 61, 62, 66, 67, 69, 71,
+ 73, 75, 77, 79, 0, 96, 0, 120, 0, 124,
+ 0, 128, 0, 229, 0, 266, 0, 0, 0, 0,
+ 0, 0, 23, 0, 0, 0, 121, 129, 0, 231,
+ 0, 268, 0, 255, 253, 258, 0, 246, 261, 245,
+ 81, 108, 122, 0, 130, 0, 269, 263, 0, 257,
+ 123, 262, 254
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 2, 9, 3, 83, 6, 10, 84, 179, 180,
- 181, 335, 182, 183, 184, 185, 186, 187, 188, 189,
- 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
- 200, 201, 202, 203, 281, 204, 231, 205, 206, 87,
- 88, 89, 220, 131, 132, 221, 90, 91, 92, 93,
- 94, 150, 151, 95, 133, 96, 97, 232, 99, 100,
- 101, 102, 103, 146, 147, 236, 237, 315, 208, 209,
- 210, 211, 394, 395, 212, 213, 214, 390, 332, 215,
- 216, 217, 325, 372, 373, 218, 104, 105
+ -1, 2, 9, 3, 85, 6, 10, 86, 180, 181,
+ 182, 339, 183, 184, 185, 186, 187, 188, 189, 190,
+ 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
+ 201, 202, 203, 204, 283, 205, 232, 206, 207, 89,
+ 90, 91, 221, 132, 133, 222, 92, 93, 94, 95,
+ 151, 152, 96, 134, 97, 98, 233, 100, 101, 102,
+ 103, 104, 146, 147, 237, 238, 317, 209, 210, 211,
+ 212, 398, 399, 213, 214, 215, 394, 336, 216, 217,
+ 218, 328, 376, 377, 219, 105, 106
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -329
+#define YYPACT_NINF -360
static const yytype_int16 yypact[] =
{
- -58, -22, 72, -329, -28, -329, -15, -329, 22, 3589,
- -329, -4, -329, -329, -329, -329, -329, -329, -329, -329,
- -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,
- 44, -329, -329, -329, -329, -329, -329, -329, -329, -329,
- -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,
- -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,
- -329, -329, -329, -329, -329, -329, -329, -329, -72, -329,
- -329, 6, -329, -329, -329, 14, -8, 9, 11, 26,
- -64, -329, -329, -329, 3470, -329, -159, -23, -12, -2,
- -149, -329, 105, 57, -329, 140, 3777, -329, -329, -329,
- 15, -329, 3849, -329, -329, -329, 131, -329, -329, -329,
- -3, 3777, -329, 140, -329, 3849, -329, -329, -329, -329,
- 133, -329, -329, 383, -329, -329, 32, -329, -329, -329,
- -329, -329, 3777, 158, 135, -329, -150, -329, -329, -329,
- -329, 2565, -329, 100, 3777, 141, 1954, -329, 4, -329,
- -95, -329, 7, 8, 1231, 27, 31, 12, 2186, 37,
- 3108, 13, 39, -59, -329, -329, -329, -329, -329, 3108,
- 3108, 3108, -329, -329, -329, -329, -329, 595, -329, -329,
- -329, -55, -329, -329, -329, 41, -92, 3289, 40, -75,
- 3108, -7, -118, 51, -74, 109, 28, 29, 30, 145,
- 147, -84, -329, -329, -148, -329, 34, 49, -329, -329,
- -329, -329, 807, -329, -329, -329, -329, -329, -329, -329,
- -329, -329, 166, 3777, -143, -329, 2746, 3108, -329, -329,
- -329, 53, -329, -329, 2070, 55, -139, -329, -329, -329,
- -329, -329, 133, -329, -329, 174, 1640, 3108, -329, -329,
- -138, 3108, -134, -329, 2384, -329, -329, -81, -329, 1019,
- -329, -329, 3108, 3705, -329, -329, 3108, 61, -329, -329,
- -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,
- -329, 3108, -329, 3108, 3108, 3108, 3108, 3108, 3108, 3108,
- 3108, 3108, 3108, 3108, 3108, 3108, 3108, 3108, 3108, 3108,
- 3108, 3108, 3108, 3108, -329, -329, -329, 62, -329, -329,
- 2927, 3108, 43, 63, -329, -329, -329, -329, 3108, 141,
- -329, -329, 65, -329, -329, 1838, -80, -329, -79, -329,
- 66, 182, 69, -329, -329, 70, 66, 74, -329, -329,
- -329, -329, -329, -329, -7, -7, -118, -118, 51, 51,
- 51, 51, -74, -74, 109, 28, 29, 30, 145, 147,
- -127, -329, 3108, 52, 75, -329, 3108, 59, 77, -329,
- 3108, -329, 54, 76, 1231, 60, 64, 1442, -329, 3108,
- 78, 3108, 67, -329, 3108, -329, -50, 3108, 1442, 262,
- -329, -329, 3108, -329, -329, -329, -329, -329, -329, 3108,
- -329, 71, 66, -329, 1231, -329, -329, -329, -329
+ -54, -53, 37, -360, -26, -360, -5, -360, 73, 3276,
+ -360, 63, -360, -360, -360, -360, -360, -360, -360, -360,
+ -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,
+ 105, -360, -360, -360, -360, -360, -360, -360, -360, -360,
+ -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,
+ -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,
+ -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,
+ -69, -360, -360, 42, -360, -360, -360, -74, 65, 79,
+ 83, 85, 16, -360, -360, -360, 3276, -360, -99, 9,
+ 13, 5, -152, -360, 134, 17, 17, 3464, -360, -360,
+ -360, 18, -360, 3536, -360, -360, -360, 136, -360, -360,
+ -360, 0, 3464, -360, 17, -360, 3536, -360, -360, -360,
+ -360, 138, -360, -360, 387, -360, -360, 24, -360, -360,
+ -360, -360, -360, 3464, 149, 141, -360, -150, -360, -360,
+ -360, 2371, -360, 106, 3464, 144, 1760, -360, -360, 11,
+ 14, -144, -360, 12, 20, 1235, 30, 31, 22, 1992,
+ 38, 2914, 26, 46, -59, -360, -360, -360, -360, -360,
+ 2914, 2914, 2914, -360, -360, -360, -360, -360, 599, -360,
+ -360, -360, -70, -360, -360, -360, 36, -56, 3095, 47,
+ -30, 2914, -8, -113, 39, -76, 45, 34, 23, 35,
+ 154, 153, -79, -360, -360, -123, -360, 41, 55, -360,
+ -360, -360, -360, 811, -360, -360, -360, -360, -360, -360,
+ -360, -360, -360, 172, 3464, -164, -360, 2552, 2914, -360,
+ -360, -360, 56, -360, -360, 1876, 58, -110, -360, -360,
+ -360, -360, 171, -360, 138, -360, -360, 179, 1644, 2914,
+ -360, -360, -101, 2914, -90, -360, 2190, -360, -360, -51,
+ -360, 1023, -360, -360, 2914, 3392, -360, -360, 2914, 64,
+ -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,
+ -360, -360, -360, 2914, -360, 2914, 2914, 2914, 2914, 2914,
+ 2914, 2914, 2914, 2914, 2914, 2914, 2914, 2914, 2914, 2914,
+ 2914, 2914, 2914, 2914, 2914, 2914, -360, -360, -360, 62,
+ -360, -360, 2733, 2914, 48, 66, -360, -360, -360, -360,
+ 2914, 144, -360, -360, -360, 67, -360, -360, 2190, -49,
+ -360, -22, -360, 238, 68, 187, 74, -360, -360, 71,
+ 68, 76, -360, -360, -360, -360, -360, -360, -8, -8,
+ -113, -113, 39, 39, 39, 39, -76, -76, 45, 34,
+ 23, 35, 154, 153, -84, -360, 2914, 57, 75, -360,
+ 2914, 69, 87, -360, 2914, -360, 70, 91, 1235, 72,
+ 78, 1446, -360, 2914, 90, 2914, 81, -360, 2914, -360,
+ -16, 2914, 1446, 267, -360, -360, 2914, -360, -360, -360,
+ -360, -360, -360, 2914, -360, 82, 68, -360, 1235, -360,
+ -360, -360, -360
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,
- -329, -329, -329, -329, 16, -329, -329, -329, -329, -135,
- -329, -87, -83, -104, -93, -20, -16, -21, -13, -11,
- -17, -329, -133, -99, -329, -155, -189, 2, 5, -329,
- -329, -329, 68, 161, 155, 73, -329, -329, -215, -329,
- -329, -329, 48, -329, -329, -43, -329, -9, -31, -329,
- -329, 217, -329, 150, -131, -329, -24, -140, 56, -153,
- -328, -78, -90, 213, 124, 58, -329, -329, -19, -329,
- -329, -329, -329, -329, -329, -329, 219, -329
+ -360, -360, -360, -360, -360, -360, -360, -360, -360, -360,
+ -360, -360, -360, -360, 25, -360, -360, -360, -360, -135,
+ -360, -89, -88, -104, -91, -11, -6, -4, -3, -7,
+ -2, -360, -133, -97, -360, -156, -193, 4, 10, -360,
+ -360, -360, 80, 170, 166, 84, -360, -360, -229, -360,
+ -360, 59, -71, -360, -360, -72, -9, 1, -360, -360,
+ 225, -360, 161, -128, -360, -14, -287, 61, -151, -359,
+ -68, -82, 224, 135, 77, -360, -360, -13, -360, -360,
+ -360, -360, -360, -360, -360, 228, -360
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -264
+#define YYTABLE_NINF -169
static const yytype_int16 yytable[] =
{
- 98, 245, 127, 250, 110, 252, 229, 301, 230, 12,
- 13, 85, 290, 291, 86, 239, 257, -164, 270, 271,
- 272, 273, 274, 275, 276, 277, 278, 279, 114, 260,
- 261, 128, 129, 130, 255, 256, 127, 313, 30, 331,
- 31, 225, 32, 226, 33, 34, 35, 134, 303, 393,
- 310, 1, 139, 122, 123, 282, 4, 319, 303, 306,
- 393, 227, 303, 135, 304, 128, 129, 130, 311, 303,
- 114, 142, 5, 320, 327, 98, 329, 107, 108, 286,
- 287, 109, 112, 379, 148, 7, 85, 140, 268, 86,
- 137, 229, 326, 230, 138, 8, 328, 241, 11, 330,
- 265, 242, 145, 239, 266, 116, 306, 336, 106, 113,
- 331, 333, 374, 375, 207, 303, 303, 303, 72, 73,
- 74, 364, 117, 222, 118, 302, 80, 120, 314, 368,
- 292, 293, -40, 288, 289, 145, 280, 145, 262, 119,
- 263, 111, 401, 12, 13, 207, 303, 360, 341, 342,
- 343, 229, 229, 229, 229, 229, 229, 229, 229, 229,
- 229, 229, 229, 229, 229, 229, 229, 339, 207, 125,
- 330, 365, 30, 380, 31, 229, 32, 230, 33, 34,
- 35, 136, 340, 229, 126, 230, 348, 349, 350, 351,
- -102, 128, 129, 130, 283, 284, 285, 294, 295, 344,
- 345, 352, 353, 207, 361, 346, 347, 143, 141, 149,
- 144, 224, 314, 233, 222, 386, 240, 235, 246, 243,
- 244, 389, 247, 253, 248, 145, 383, 229, 251, 230,
- 254, 269, 402, 264, 296, 299, 297, 207, 298, 300,
- -39, 398, 307, 113, 400, 207, 122, 316, 318, 322,
- 207, 408, 405, -34, 366, 362, 370, 367, 376, 406,
- 80, 377, 303, 381, 378, -40, 387, 314, 388, 382,
- 384, 385, 397, 177, 404, 392, 354, 356, 399, 338,
- 396, 355, 314, 407, 359, 314, 357, 219, 223, 358,
- 321, 308, 115, 314, 234, 369, 309, 391, 403, 124,
- 314, 259, 323, 121, 324, 0, 371, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 207, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 207, 0, 0, 207, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 207,
- 0, 0, 0, 0, 0, 0, 12, 13, 14, 15,
- 16, 17, 152, 153, 154, 207, 155, 156, 157, 158,
- 159, 160, 161, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 0, 31, 0, 32,
- 0, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 68, 69, 162, 163,
- 164, 165, 166, 167, 168, 0, 0, 169, 170, 0,
+ 99, 115, 114, 252, 247, 254, 230, 111, 231, 128,
+ 292, 293, 303, 87, 262, 263, 259, -168, 240, 88,
+ 12, 13, 397, 138, 139, 4, 369, 335, 128, 312,
+ 74, 75, 76, 397, 315, 257, 258, 5, 129, 130,
+ 131, 226, 148, 227, 135, 12, 13, 313, 243, 30,
+ 31, 32, 244, 33, 34, 1, 284, 129, 130, 131,
+ 136, 228, 308, 272, 273, 274, 275, 276, 277, 278,
+ 279, 280, 281, 305, 30, 31, 32, 99, 33, 34,
+ 35, 36, 37, 387, 288, 289, 321, 7, 140, 306,
+ 87, 270, 230, 329, 231, 305, 88, 331, 402, 335,
+ 334, 404, 322, 145, 142, 8, 305, 240, 340, 409,
+ 308, 330, 305, 123, 124, 208, 410, 149, 113, 368,
+ 332, 290, 291, 264, 223, 265, 383, 372, 294, 295,
+ 304, 316, -40, 296, 297, 145, 267, 145, 108, 109,
+ 268, 337, 110, 378, 112, 305, 208, 305, 364, 11,
+ 345, 346, 347, 230, 230, 230, 230, 230, 230, 230,
+ 230, 230, 230, 230, 230, 230, 230, 230, 230, 208,
+ 379, 343, 334, 384, 305, 107, 405, 230, 117, 231,
+ 305, 282, 129, 130, 131, 230, 344, 231, 352, 353,
+ 354, 355, 118, 285, 286, 287, 119, -102, 120, 348,
+ 349, 126, 350, 351, 208, 356, 357, 121, 365, 127,
+ 137, 141, 143, 144, 150, 223, 316, 225, 390, 234,
+ 236, 248, 249, 241, 245, 242, 145, 393, 266, 253,
+ 299, 230, 246, 231, 250, 406, 255, 256, 271, 208,
+ 298, 12, 13, 300, 301, 302, -39, 208, 309, 323,
+ 318, 320, 208, 123, 325, 366, -34, 412, 374, 370,
+ 371, 115, 114, 380, 305, 382, 381, -40, 385, 386,
+ 30, 31, 32, 316, 33, 34, 35, 36, 37, 408,
+ 388, 389, 391, 392, 401, 178, 400, 358, 316, 396,
+ 342, 316, 403, 359, 411, 362, 360, 220, 361, 316,
+ 224, 363, 116, 324, 310, 235, 316, 373, 311, 326,
+ 407, 395, 125, 261, 122, 375, 0, 0, 0, 208,
+ 0, 0, 0, 0, 0, 327, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 71, 72, 73, 74,
- 0, 75, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 81, 0, 82,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 171, 0, 0, 0, 0, 0,
- 172, 173, 174, 175, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 176, 177, 178, 12, 13,
- 14, 15, 16, 17, 152, 153, 154, 0, 155, 156,
- 157, 158, 159, 160, 161, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 0, 31,
- 0, 32, 0, 33, 34, 35, 36, 37, 38, 39,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 208,
+ 0, 0, 208, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 208, 0, 0, 0, 0, 0, 0,
+ 12, 13, 14, 15, 16, 17, 153, 154, 155, 208,
+ 156, 157, 158, 159, 160, 161, 162, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, 0, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 162, 163, 164, 165, 166, 167, 168, 0, 0, 169,
- 170, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 71, 72,
- 73, 74, 0, 75, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 80, 0, 0, 0, 0,
+ 70, 71, 163, 164, 165, 166, 167, 168, 169, 0,
+ 0, 170, 171, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 73, 74, 75, 76, 0, 77, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 82, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 81,
- 0, 82, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 171, 0, 0, 0,
- 0, 0, 172, 173, 174, 175, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 176, 177, 258,
- 12, 13, 14, 15, 16, 17, 152, 153, 154, 0,
- 155, 156, 157, 158, 159, 160, 161, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 0, 31, 0, 32, 0, 33, 34, 35, 36, 37,
+ 0, 83, 0, 84, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 172, 0,
+ 0, 0, 0, 0, 173, 174, 175, 176, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 177,
+ 178, 179, 12, 13, 14, 15, 16, 17, 153, 154,
+ 155, 0, 156, 157, 158, 159, 160, 161, 162, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 0, 33, 34, 35, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
- 68, 69, 162, 163, 164, 165, 166, 167, 168, 0,
- 0, 169, 170, 0, 0, 0, 0, 0, 0, 0,
+ 68, 69, 70, 71, 163, 164, 165, 166, 167, 168,
+ 169, 0, 0, 170, 171, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 71, 72, 73, 74, 0, 75, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 80, 0, 0,
+ 0, 0, 73, 74, 75, 76, 0, 77, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 82,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 81, 0, 82, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 83, 0, 84, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 171, 0,
- 0, 0, 0, 0, 172, 173, 174, 175, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 176,
- 177, 305, 12, 13, 14, 15, 16, 17, 152, 153,
- 154, 0, 155, 156, 157, 158, 159, 160, 161, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 0, 31, 0, 32, 0, 33, 34, 35,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 172, 0, 0, 0, 0, 0, 173, 174, 175, 176,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 177, 178, 260, 12, 13, 14, 15, 16, 17,
+ 153, 154, 155, 0, 156, 157, 158, 159, 160, 161,
+ 162, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 0, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 69, 162, 163, 164, 165, 166, 167,
- 168, 0, 0, 169, 170, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 71, 72, 73, 74, 0, 75, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 80,
+ 66, 67, 68, 69, 70, 71, 163, 164, 165, 166,
+ 167, 168, 169, 0, 0, 170, 171, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 73, 74, 75, 76, 0, 77,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 82, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 81, 0, 82, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 83, 0, 84, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 171, 0, 0, 0, 0, 0, 172, 173, 174, 175,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 176, 177, 334, 12, 13, 14, 15, 16, 17,
- 152, 153, 154, 0, 155, 156, 157, 158, 159, 160,
- 161, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 0, 31, 0, 32, 0, 33,
+ 0, 0, 172, 0, 0, 0, 0, 0, 173, 174,
+ 175, 176, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 177, 178, 307, 12, 13, 14, 15,
+ 16, 17, 153, 154, 155, 0, 156, 157, 158, 159,
+ 160, 161, 162, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 0, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 162, 163, 164, 165,
- 166, 167, 168, 0, 0, 169, 170, 0, 0, 0,
+ 64, 65, 66, 67, 68, 69, 70, 71, 163, 164,
+ 165, 166, 167, 168, 169, 0, 0, 170, 171, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 71, 72, 73, 74, 0, 75,
+ 0, 0, 0, 0, 0, 0, 73, 74, 75, 76,
+ 0, 77, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 82, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 80, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 83, 0, 84,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 81, 0, 82, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 172, 0, 0, 0, 0, 0,
+ 173, 174, 175, 176, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 177, 178, 338, 12, 13,
+ 14, 15, 16, 17, 153, 154, 155, 0, 156, 157,
+ 158, 159, 160, 161, 162, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ 0, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
+ 163, 164, 165, 166, 167, 168, 169, 0, 0, 170,
+ 171, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 73, 74,
+ 75, 76, 0, 77, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 82, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 171, 0, 0, 0, 0, 0, 172, 173,
- 174, 175, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 176, 177, 12, 13, 14, 15, 16,
- 17, 152, 153, 154, 0, 155, 156, 157, 158, 159,
- 160, 161, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 0, 31, 0, 32, 0,
- 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
- 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 162, 163, 164,
- 165, 166, 167, 168, 0, 0, 169, 170, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 71, 72, 73, 74, 0,
- 75, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 80, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 81, 0, 82, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 83,
+ 0, 84, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 171, 0, 0, 0, 0, 0, 172,
- 173, 174, 175, 12, 13, 14, 15, 16, 17, 0,
- 0, 0, 0, 0, 176, 123, 0, 0, 0, 0,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 0, 31, 0, 32, 0, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 0, 163, 164, 165, 166,
- 167, 168, 0, 0, 169, 170, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 172, 0, 0, 0,
+ 0, 0, 173, 174, 175, 176, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 177, 178, 12,
+ 13, 14, 15, 16, 17, 153, 154, 155, 0, 156,
+ 157, 158, 159, 160, 161, 162, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 0, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+ 71, 163, 164, 165, 166, 167, 168, 169, 0, 0,
+ 170, 171, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 73,
+ 74, 75, 76, 0, 77, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 82, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 71, 72, 73, 74, 0, 75, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 80, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 83, 0, 84, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 81, 0, 82, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 172, 0, 0,
+ 0, 0, 0, 173, 174, 175, 176, 12, 13, 14,
+ 15, 16, 17, 0, 0, 0, 0, 0, 177, 124,
+ 0, 0, 0, 0, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 32, 0,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 63, 64, 65, 66, 67, 68, 69, 70, 71, 0,
+ 164, 165, 166, 167, 168, 169, 0, 0, 170, 171,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 73, 74, 75,
+ 76, 0, 77, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 82, 14, 15, 16, 17, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 171, 0, 0, 0, 0, 0, 172, 173, 174,
- 175, 12, 13, 14, 15, 16, 17, 0, 0, 0,
- 0, 0, 176, 0, 0, 0, 0, 0, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 0, 31, 0, 32, 0, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 0, 0, 0, 0, 0, 0, 83, 0,
+ 84, 38, 39, 40, 41, 42, 43, 44, 45, 46,
47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 0, 163, 164, 165, 166, 167, 168,
- 0, 0, 169, 170, 0, 0, 0, 0, 0, 0,
+ 67, 68, 69, 70, 71, 172, 72, 0, 0, 0,
+ 0, 173, 174, 175, 176, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 177, 0, 0, 0,
+ 0, 0, 0, 0, 74, 75, 76, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 113, 72, 73, 74, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 80, 14,
- 15, 16, 17, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 0, 0, 0, 0,
- 0, 0, 81, 0, 82, 36, 37, 38, 39, 40,
+ 0, 14, 15, 16, 17, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 0, 0,
+ 0, 0, 0, 0, 83, 0, 84, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
- 61, 62, 63, 64, 65, 66, 67, 68, 69, 171,
- 70, 0, 0, 0, 0, 172, 173, 174, 175, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -263, 0, 0, 0, 0, 0, 0, 0, 72, 73,
- 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 14, 15, 16, 17, 0,
+ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+ 71, 0, 72, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 0, 0, 0, 0, 0, 0, 81, 0,
- 82, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 0, 0, 0, 0, 239, 0, 0, 0, 0, 0,
+ 74, 75, 76, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 14, 15, 16,
+ 17, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 0, 0, 0, 0, 0, 0,
+ 83, 0, 84, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 0, 70, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 238, 0,
- 0, 0, 0, 0, 72, 73, 74, 0, 0, 0,
+ 65, 66, 67, 68, 69, 70, 71, 0, 164, 165,
+ 166, 167, 168, 169, 0, 0, 170, 171, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 14, 15, 16, 17, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 0, 0,
- 0, 0, 0, 0, 81, 0, 82, 36, 37, 38,
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
- 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
- 69, 0, 163, 164, 165, 166, 167, 168, 0, 0,
- 169, 170, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 317, 0, 0, 0, 0, 0,
- 72, 73, 74, 0, 0, 0, 0, 0, 0, 0,
+ 319, 0, 0, 0, 0, 0, 74, 75, 76, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 81, 0, 82, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 83, 0, 84, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 171, 0, 0,
- 0, 0, 0, 172, 173, 174, 175, 12, 13, 14,
- 15, 16, 17, 0, 0, 0, 0, 0, 249, 0,
- 0, 0, 0, 0, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 0, 31, 0,
- 32, 0, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
- 61, 62, 63, 64, 65, 66, 67, 68, 69, 0,
- 163, 164, 165, 166, 167, 168, 0, 0, 169, 170,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 113, 72, 73,
- 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 80, 0, 0, 0, 0, 0,
+ 0, 0, 0, 172, 0, 0, 0, 0, 0, 173,
+ 174, 175, 176, 12, 13, 14, 15, 16, 17, 0,
+ 0, 0, 0, 0, 251, 0, 0, 0, 0, 0,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 31, 32, 0, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 70, 71, 0, 164, 165, 166, 167,
+ 168, 169, 0, 0, 170, 171, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 333, 74, 75, 76, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 81, 0,
82, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 14, 15, 16, 17, 0, 171, 0, 0, 0, 0,
- 0, 172, 173, 174, 175, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 0, 163, 164, 165, 166, 167, 168, 0, 0, 169,
- 170, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 72,
- 73, 74, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 83, 0, 84, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 14, 15, 16, 17,
+ 0, 172, 0, 0, 0, 0, 0, 173, 174, 175,
+ 176, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 38, 39, 40, 41, 42, 43, 44, 45,
+ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 70, 71, 0, 164, 165, 166,
+ 167, 168, 169, 0, 0, 170, 171, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 81,
- 0, 82, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 74, 75, 76, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 14, 15, 16, 17, 0, 171, 0, 0, 228,
- 0, 0, 172, 173, 174, 175, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 36, 37, 38,
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
- 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
- 69, 0, 163, 164, 165, 166, 167, 168, 0, 0,
- 169, 170, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 72, 73, 74, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 83, 0, 84, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 14, 15, 16,
+ 17, 0, 172, 0, 0, 229, 0, 0, 173, 174,
+ 175, 176, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 71, 0, 164, 165,
+ 166, 167, 168, 169, 0, 0, 170, 171, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 81, 0, 82, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 74, 75, 76, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 14, 15, 16, 17, 0, 171, 0, 0,
- 312, 0, 0, 172, 173, 174, 175, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 36, 37,
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
- 68, 69, 0, 163, 164, 165, 166, 167, 168, 0,
- 0, 169, 170, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 72, 73, 74, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 83, 0, 84, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 14, 15,
+ 16, 17, 0, 172, 0, 0, 314, 0, 0, 173,
+ 174, 175, 176, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, 71, 0, 164,
+ 165, 166, 167, 168, 169, 0, 0, 170, 171, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 81, 0, 82, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 74, 75, 76,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 14, 15, 16, 17, 0, 171, 0,
- 0, 363, 0, 0, 172, 173, 174, 175, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 0, 163, 164, 165, 166, 167, 168,
- 0, 0, 169, 170, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 72, 73, 74, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 83, 0, 84,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 14,
+ 15, 16, 17, 0, 172, 0, 0, 367, 0, 0,
+ 173, 174, 175, 176, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 63, 64, 65, 66, 67, 68, 69, 70, 71, 0,
+ 164, 165, 166, 167, 168, 169, 0, 0, 170, 171,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 81, 0, 82, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 74, 75,
+ 76, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 14, 15, 16, 17, 0, 171,
- 0, 0, 0, 0, 0, 172, 173, 174, 175, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 267, 0, 163, 164, 165, 166, 167,
- 168, 0, 0, 169, 170, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 72, 73, 74, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 83, 0,
+ 84, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 14, 15, 16, 17, 0, 172, 0, 0, 0, 0,
+ 0, 173, 174, 175, 176, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, 269,
+ 0, 164, 165, 166, 167, 168, 169, 0, 0, 170,
+ 171, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 74,
+ 75, 76, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 81, 0, 82, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 83,
+ 0, 84, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -3, 0, 0, 12, 13, 14, 15, 16, 17, 0,
- 171, 0, 0, 0, 0, 0, 172, 173, 174, 175,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 0, 31, 0, 32, 0, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 12,
+ 13, 14, 15, 16, 17, 0, 172, 0, 0, 0,
+ 0, 0, 173, 174, 175, 176, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 0, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+ 71, 0, 72, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 73,
+ 74, 75, 76, 0, 77, 0, 0, 0, 0, 0,
+ 0, 0, 78, 79, 80, 81, 82, 14, 15, 16,
+ 17, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 0, 0, 0, 0, 0, 0,
+ 83, 0, 84, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 0, 70, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 71, 72, 73, 74, 0, 75, 0,
- 0, 0, 0, 0, 0, 0, 76, 77, 78, 79,
- 80, 0, 12, 13, 14, 15, 16, 17, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 0, 31, 81, 32, 82, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 69, 0, 70, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 71, 72, 73, 74, 0, 75, 0, 0,
- 0, 0, 0, 0, 0, 76, 77, 78, 79, 80,
- 14, 15, 16, 17, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 0, 0, 0,
- 0, 0, 0, 81, 0, 82, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 0, 337, 14, 15, 16, 17, 168, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 72,
- 73, 74, 0, 0, 0, 0, 0, 0, 36, 37,
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
- 68, 69, 0, 70, 14, 15, 16, 17, 0, 81,
- 0, 82, 0, 0, 0, 0, 0, 0, 0, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 72, 73, 74, 0, 0, 0, 0, 0, 0,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 69, 0, 70, 0, 0, 0, 0,
- 0, 81, 0, 82, 0, 0, 0, 0, 0, 0,
+ 65, 66, 67, 68, 69, 70, 71, 0, 341, 14,
+ 15, 16, 17, 169, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 74, 75, 76, 0,
+ 0, 0, 0, 0, 0, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 63, 64, 65, 66, 67, 68, 69, 70, 71, 0,
+ 72, 14, 15, 16, 17, 0, 83, 0, 84, 0,
+ 0, 0, 0, 0, 0, 0, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 74, 75,
+ 76, 0, 0, 0, 0, 0, 0, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+ 71, 0, 72, 0, 0, 0, 0, 0, 83, 0,
+ 84, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 81, 0, 82
+ 83, 0, 84
};
static const yytype_int16 yycheck[] =
{
- 9, 154, 4, 158, 76, 160, 141, 91, 141, 3,
- 4, 9, 86, 87, 9, 146, 171, 76, 93, 94,
- 95, 96, 97, 98, 99, 100, 101, 102, 71, 84,
- 85, 33, 34, 35, 169, 170, 4, 226, 32, 254,
- 34, 191, 36, 193, 38, 39, 40, 196, 196, 377,
- 193, 109, 95, 212, 213, 190, 78, 196, 196, 212,
- 388, 211, 196, 212, 212, 33, 34, 35, 211, 196,
- 113, 102, 0, 212, 212, 84, 210, 33, 34, 197,
- 198, 37, 76, 210, 115, 113, 84, 96, 187, 84,
- 33, 226, 247, 226, 37, 110, 251, 192, 76, 254,
- 192, 196, 111, 234, 196, 113, 259, 262, 112, 103,
- 325, 192, 192, 192, 123, 196, 196, 196, 104, 105,
- 106, 310, 113, 132, 113, 209, 120, 191, 227, 318,
- 204, 205, 191, 82, 83, 144, 211, 146, 193, 113,
- 195, 213, 192, 3, 4, 154, 196, 302, 283, 284,
+ 9, 73, 73, 159, 155, 161, 141, 76, 141, 4,
+ 86, 87, 91, 9, 84, 85, 172, 76, 146, 9,
+ 3, 4, 381, 95, 96, 78, 313, 256, 4, 193,
+ 104, 105, 106, 392, 227, 170, 171, 0, 33, 34,
+ 35, 191, 114, 193, 196, 3, 4, 211, 192, 32,
+ 33, 34, 196, 36, 37, 109, 191, 33, 34, 35,
+ 212, 211, 213, 93, 94, 95, 96, 97, 98, 99,
+ 100, 101, 102, 196, 32, 33, 34, 86, 36, 37,
+ 38, 39, 40, 370, 197, 198, 196, 113, 97, 212,
+ 86, 188, 227, 249, 227, 196, 86, 253, 385, 328,
+ 256, 388, 212, 112, 103, 110, 196, 235, 264, 396,
+ 261, 212, 196, 212, 213, 124, 403, 116, 76, 312,
+ 210, 82, 83, 193, 133, 195, 210, 320, 204, 205,
+ 209, 228, 191, 88, 89, 144, 192, 146, 33, 34,
+ 196, 192, 37, 192, 213, 196, 155, 196, 304, 76,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, 301, 266, 177, 192,
- 325, 311, 32, 362, 34, 310, 36, 310, 38, 39,
- 40, 76, 281, 318, 196, 318, 290, 291, 292, 293,
- 192, 33, 34, 35, 201, 202, 203, 88, 89, 286,
- 287, 294, 295, 212, 303, 288, 289, 76, 193, 76,
- 213, 76, 311, 113, 223, 370, 212, 76, 191, 212,
- 212, 374, 191, 210, 212, 234, 366, 362, 191, 362,
- 191, 191, 387, 192, 206, 90, 207, 246, 208, 92,
- 191, 381, 76, 103, 384, 254, 212, 194, 193, 75,
- 259, 404, 392, 192, 211, 193, 191, 194, 76, 399,
- 120, 192, 196, 211, 194, 191, 212, 366, 192, 194,
- 211, 194, 194, 213, 12, 211, 296, 298, 211, 263,
- 379, 297, 381, 212, 301, 384, 299, 126, 133, 300,
- 242, 223, 75, 392, 144, 319, 223, 375, 388, 86,
- 399, 177, 246, 84, 246, -1, 325, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 325, -1, -1, -1,
+ 295, 296, 297, 298, 299, 300, 301, 302, 303, 178,
+ 192, 268, 328, 366, 196, 112, 192, 312, 113, 312,
+ 196, 211, 33, 34, 35, 320, 283, 320, 292, 293,
+ 294, 295, 113, 201, 202, 203, 113, 192, 113, 288,
+ 289, 192, 290, 291, 213, 296, 297, 191, 305, 196,
+ 76, 193, 76, 213, 76, 224, 313, 76, 374, 113,
+ 76, 191, 191, 212, 212, 211, 235, 378, 192, 191,
+ 207, 366, 212, 366, 212, 391, 210, 191, 191, 248,
+ 206, 3, 4, 208, 90, 92, 191, 256, 76, 78,
+ 194, 193, 261, 212, 75, 193, 192, 408, 191, 211,
+ 194, 333, 333, 76, 196, 194, 192, 191, 211, 194,
+ 32, 33, 34, 370, 36, 37, 38, 39, 40, 12,
+ 211, 194, 212, 192, 194, 213, 383, 298, 385, 211,
+ 265, 388, 211, 299, 212, 302, 300, 127, 301, 396,
+ 134, 303, 77, 244, 224, 144, 403, 321, 224, 248,
+ 392, 379, 88, 178, 86, 328, -1, -1, -1, 328,
+ -1, -1, -1, -1, -1, 248, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 374, -1, -1, 377, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 388,
- -1, -1, -1, -1, -1, -1, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 404, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, -1, 34, -1, 36,
- -1, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
- 77, 78, 79, 80, 81, -1, -1, 84, 85, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 103, 104, 105, 106,
- -1, 108, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 120, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 154, -1, 156,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 191, -1, -1, -1, -1, -1,
- 197, 198, 199, 200, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 212, 213, 214, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, -1, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, -1, 34,
- -1, 36, -1, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 77, 78, 79, 80, 81, -1, -1, 84,
- 85, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 103, 104,
- 105, 106, -1, 108, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 120, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 154,
- -1, 156, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 191, -1, -1, -1,
- -1, -1, 197, 198, 199, 200, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 212, 213, 214,
- 3, 4, 5, 6, 7, 8, 9, 10, 11, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 378,
+ -1, -1, 381, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 392, -1, -1, -1, -1, -1, -1,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 408,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- -1, 34, -1, 36, -1, 38, 39, 40, 41, 42,
+ 33, 34, -1, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
213, 214, 3, 4, 5, 6, 7, 8, 9, 10,
11, -1, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, -1, 34, -1, 36, -1, 38, 39, 40,
+ 31, 32, 33, 34, -1, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
-1, 212, 213, 214, 3, 4, 5, 6, 7, 8,
9, 10, 11, -1, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, -1, 34, -1, 36, -1, 38,
+ 29, 30, 31, 32, 33, 34, -1, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 191, -1, -1, -1, -1, -1, 197, 198,
199, 200, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 212, 213, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, -1, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, -1, 34, -1, 36, -1,
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
- 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- 78, 79, 80, 81, -1, -1, 84, 85, -1, -1,
+ -1, -1, -1, 212, 213, 214, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, -1, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, -1, 36,
+ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+ 77, 78, 79, 80, 81, -1, -1, 84, 85, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 103, 104, 105, 106, -1,
- 108, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 120, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 103, 104, 105, 106,
+ -1, 108, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 120, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 154, -1, 156, -1,
+ -1, -1, -1, -1, -1, -1, -1, 154, -1, 156,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 191, -1, -1, -1, -1, -1, 197,
- 198, 199, 200, 3, 4, 5, 6, 7, 8, -1,
- -1, -1, -1, -1, 212, 213, -1, -1, -1, -1,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, -1, 34, -1, 36, -1, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 70, 71, 72, 73, 74, -1, 76, 77, 78, 79,
- 80, 81, -1, -1, 84, 85, -1, -1, -1, -1,
+ -1, -1, -1, -1, 191, -1, -1, -1, -1, -1,
+ 197, 198, 199, 200, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 212, 213, 214, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, -1, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ -1, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, -1, -1, 84,
+ 85, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 103, 104,
+ 105, 106, -1, 108, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 120, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 103, 104, 105, 106, -1, 108, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 120, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 154,
+ -1, 156, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 154, -1, 156, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 191, -1, -1, -1,
+ -1, -1, 197, 198, 199, 200, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 212, 213, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, -1, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, -1, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
+ 74, 75, 76, 77, 78, 79, 80, 81, -1, -1,
+ 84, 85, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 103,
+ 104, 105, 106, -1, 108, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 120, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 191, -1, -1, -1, -1, -1, 197, 198, 199,
- 200, 3, 4, 5, 6, 7, 8, -1, -1, -1,
- -1, -1, 212, -1, -1, -1, -1, -1, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, -1, 34, -1, 36, -1, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, -1, 76, 77, 78, 79, 80, 81,
- -1, -1, 84, 85, -1, -1, -1, -1, -1, -1,
+ 154, -1, 156, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 103, 104, 105, 106, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 120, 5,
- 6, 7, 8, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 191, -1, -1,
+ -1, -1, -1, 197, 198, 199, 200, 3, 4, 5,
+ 6, 7, 8, -1, -1, -1, -1, -1, 212, 213,
-1, -1, -1, -1, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, -1, -1, -1, -1,
- -1, -1, 154, -1, 156, 41, 42, 43, 44, 45,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, -1,
+ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 69, 70, 71, 72, 73, 74, 191,
- 76, -1, -1, -1, -1, 197, 198, 199, 200, -1,
+ 66, 67, 68, 69, 70, 71, 72, 73, 74, -1,
+ 76, 77, 78, 79, 80, 81, -1, -1, 84, 85,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 212, -1, -1, -1, -1, -1, -1, -1, 104, 105,
- 106, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 5, 6, 7, 8, -1,
+ -1, -1, -1, -1, -1, -1, -1, 103, 104, 105,
+ 106, -1, 108, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 120, 5, 6, 7, 8, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, -1, -1, -1, -1, -1, -1, 154, -1,
156, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 70, 71, 72, 73, 74, -1, 76, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 214, -1,
+ 70, 71, 72, 73, 74, 191, 76, -1, -1, -1,
+ -1, 197, 198, 199, 200, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 212, -1, -1, -1,
-1, -1, -1, -1, 104, 105, 106, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 5, 6, 7, 8, -1, -1, -1, -1, -1,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
- 74, -1, 76, 77, 78, 79, 80, 81, -1, -1,
- 84, 85, -1, -1, -1, -1, -1, -1, -1, -1,
+ 74, -1, 76, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, 214, -1, -1, -1, -1, -1,
104, 105, 106, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 5, 6, 7,
+ 8, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 31, -1, -1, -1, -1, -1, -1,
+ 154, -1, 156, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
+ 68, 69, 70, 71, 72, 73, 74, -1, 76, 77,
+ 78, 79, 80, 81, -1, -1, 84, 85, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 214, -1, -1, -1, -1, -1, 104, 105, 106, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 154, -1, 156, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 191, -1, -1,
- -1, -1, -1, 197, 198, 199, 200, 3, 4, 5,
- 6, 7, 8, -1, -1, -1, -1, -1, 212, -1,
- -1, -1, -1, -1, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, -1, 34, -1,
- 36, -1, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 69, 70, 71, 72, 73, 74, -1,
- 76, 77, 78, 79, 80, 81, -1, -1, 84, 85,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 103, 104, 105,
- 106, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 120, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 154, -1, 156, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 154, -1,
- 156, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 191, -1, -1, -1, -1, -1, 197,
+ 198, 199, 200, 3, 4, 5, 6, 7, 8, -1,
+ -1, -1, -1, -1, 212, -1, -1, -1, -1, -1,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, -1, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ 70, 71, 72, 73, 74, -1, 76, 77, 78, 79,
+ 80, 81, -1, -1, 84, 85, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 5, 6, 7, 8, -1, 191, -1, -1, -1, -1,
- -1, 197, 198, 199, 200, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- -1, 76, 77, 78, 79, 80, 81, -1, -1, 84,
- 85, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 104,
- 105, 106, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 103, 104, 105, 106, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 120, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 154,
- -1, 156, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 154, -1, 156, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 5, 6, 7, 8, -1, 191, -1, -1, 194,
- -1, -1, 197, 198, 199, 200, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
- 74, -1, 76, 77, 78, 79, 80, 81, -1, -1,
- 84, 85, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 5, 6, 7, 8,
+ -1, 191, -1, -1, -1, -1, -1, 197, 198, 199,
+ 200, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 31, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
+ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
+ 69, 70, 71, 72, 73, 74, -1, 76, 77, 78,
+ 79, 80, 81, -1, -1, 84, 85, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 104, 105, 106, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 104, 105, 106, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 154, -1, 156, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 154, -1, 156, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 5, 6, 7, 8, -1, 191, -1, -1,
- 194, -1, -1, 197, 198, 199, 200, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 41, 42,
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
- 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
- 73, 74, -1, 76, 77, 78, 79, 80, 81, -1,
- -1, 84, 85, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 5, 6, 7,
+ 8, -1, 191, -1, -1, 194, -1, -1, 197, 198,
+ 199, 200, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 31, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
+ 68, 69, 70, 71, 72, 73, 74, -1, 76, 77,
+ 78, 79, 80, 81, -1, -1, 84, 85, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 104, 105, 106, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 104, 105, 106, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 154, -1, 156, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 154, -1, 156, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 5, 6, 7, 8, -1, 191, -1,
- -1, 194, -1, -1, 197, 198, 199, 200, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, -1, 76, 77, 78, 79, 80, 81,
- -1, -1, 84, 85, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 5, 6,
+ 7, 8, -1, 191, -1, -1, 194, -1, -1, 197,
+ 198, 199, 200, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 41, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 73, 74, -1, 76,
+ 77, 78, 79, 80, 81, -1, -1, 84, 85, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 104, 105, 106, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 104, 105, 106,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 154, -1, 156, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 154, -1, 156,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 5, 6, 7, 8, -1, 191,
- -1, -1, -1, -1, -1, 197, 198, 199, 200, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
- 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 73, 74, -1, 76, 77, 78, 79, 80,
- 81, -1, -1, 84, 85, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 5,
+ 6, 7, 8, -1, 191, -1, -1, 194, -1, -1,
+ 197, 198, 199, 200, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 41, 42, 43, 44, 45,
+ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 70, 71, 72, 73, 74, -1,
+ 76, 77, 78, 79, 80, 81, -1, -1, 84, 85,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 104, 105, 106, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 104, 105,
+ 106, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 154, -1,
+ 156, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 154, -1, 156, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 5, 6, 7, 8, -1, 191, -1, -1, -1, -1,
+ -1, 197, 198, 199, 200, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+ -1, 76, 77, 78, 79, 80, 81, -1, -1, 84,
+ 85, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 104,
+ 105, 106, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 0, -1, -1, 3, 4, 5, 6, 7, 8, -1,
- 191, -1, -1, -1, -1, -1, 197, 198, 199, 200,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, -1, 34, -1, 36, -1, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 70, 71, 72, 73, 74, -1, 76, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 103, 104, 105, 106, -1, 108, -1,
- -1, -1, -1, -1, -1, -1, 116, 117, 118, 119,
- 120, -1, 3, 4, 5, 6, 7, 8, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, -1, 34, 154, 36, 156, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
- 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 73, 74, -1, 76, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 154,
+ -1, 156, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 3,
+ 4, 5, 6, 7, 8, -1, 191, -1, -1, -1,
+ -1, -1, 197, 198, 199, 200, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, -1, 36, 37, 38, 39, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
+ 74, -1, 76, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 103, 104, 105, 106, -1, 108, -1, -1,
- -1, -1, -1, -1, -1, 116, 117, 118, 119, 120,
- 5, 6, 7, 8, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, -1, -1, -1,
- -1, -1, -1, 154, -1, 156, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- -1, 76, 5, 6, 7, 8, 81, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 104,
- 105, 106, -1, -1, -1, -1, -1, -1, 41, 42,
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
- 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
- 73, 74, -1, 76, 5, 6, 7, 8, -1, 154,
- -1, 156, -1, -1, -1, -1, -1, -1, -1, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 104, 105, 106, -1, -1, -1, -1, -1, -1,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
- 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 73, 74, -1, 76, -1, -1, -1, -1,
- -1, 154, -1, 156, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 103,
+ 104, 105, 106, -1, 108, -1, -1, -1, -1, -1,
+ -1, -1, 116, 117, 118, 119, 120, 5, 6, 7,
+ 8, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 31, -1, -1, -1, -1, -1, -1,
+ 154, -1, 156, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
+ 68, 69, 70, 71, 72, 73, 74, -1, 76, 5,
+ 6, 7, 8, 81, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 104, 105, 106, -1,
+ -1, -1, -1, -1, -1, 41, 42, 43, 44, 45,
+ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 70, 71, 72, 73, 74, -1,
+ 76, 5, 6, 7, 8, -1, 154, -1, 156, -1,
+ -1, -1, -1, -1, -1, -1, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 104, 105,
+ 106, -1, -1, -1, -1, -1, -1, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
+ 74, -1, 76, -1, -1, -1, -1, -1, 154, -1,
+ 156, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 154, -1, 156
+ 154, -1, 156
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
0, 109, 216, 218, 78, 0, 220, 113, 110, 217,
221, 76, 3, 4, 5, 6, 7, 8, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 34, 36, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- 76, 103, 104, 105, 106, 108, 116, 117, 118, 119,
- 120, 154, 156, 219, 222, 252, 253, 254, 255, 256,
- 261, 262, 263, 264, 265, 268, 270, 271, 272, 273,
- 274, 275, 276, 277, 301, 302, 112, 33, 34, 37,
- 76, 213, 76, 103, 270, 276, 113, 113, 113, 113,
- 191, 301, 212, 213, 288, 192, 196, 4, 33, 34,
- 35, 258, 259, 269, 196, 212, 76, 33, 37, 270,
- 272, 193, 273, 76, 213, 272, 278, 279, 273, 76,
- 266, 267, 9, 10, 11, 13, 14, 15, 16, 17,
- 18, 19, 75, 76, 77, 78, 79, 80, 81, 84,
- 85, 191, 197, 198, 199, 200, 212, 213, 214, 223,
- 224, 225, 227, 228, 229, 230, 231, 232, 233, 234,
- 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
- 245, 246, 247, 248, 250, 252, 253, 272, 283, 284,
- 285, 286, 289, 290, 291, 294, 295, 296, 300, 258,
- 257, 260, 272, 259, 76, 191, 193, 211, 194, 234,
- 247, 251, 272, 113, 278, 76, 280, 281, 214, 279,
- 212, 192, 196, 212, 212, 284, 191, 191, 212, 212,
- 250, 191, 250, 210, 191, 234, 234, 250, 214, 289,
- 84, 85, 193, 195, 192, 192, 196, 74, 248, 191,
- 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
- 211, 249, 234, 201, 202, 203, 197, 198, 82, 83,
- 86, 87, 204, 205, 88, 89, 206, 207, 208, 90,
- 92, 91, 209, 196, 212, 214, 284, 76, 257, 260,
- 193, 211, 194, 251, 248, 282, 194, 214, 193, 196,
- 212, 267, 75, 283, 290, 297, 250, 212, 250, 210,
- 250, 263, 293, 192, 214, 226, 250, 76, 229, 248,
- 248, 234, 234, 234, 236, 236, 237, 237, 238, 238,
- 238, 238, 239, 239, 240, 241, 242, 243, 244, 245,
- 250, 248, 193, 194, 251, 282, 211, 194, 251, 281,
- 191, 293, 298, 299, 192, 192, 76, 192, 194, 210,
- 251, 211, 194, 282, 211, 194, 250, 212, 192, 284,
- 292, 286, 211, 285, 287, 288, 248, 194, 282, 211,
- 282, 192, 250, 287, 12, 282, 282, 212, 284
+ 32, 33, 34, 36, 37, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 76, 103, 104, 105, 106, 108, 116, 117,
+ 118, 119, 120, 154, 156, 219, 222, 252, 253, 254,
+ 255, 256, 261, 262, 263, 264, 267, 269, 270, 271,
+ 272, 273, 274, 275, 276, 300, 301, 112, 33, 34,
+ 37, 76, 213, 76, 267, 270, 275, 113, 113, 113,
+ 113, 191, 300, 212, 213, 287, 192, 196, 4, 33,
+ 34, 35, 258, 259, 268, 196, 212, 76, 270, 270,
+ 271, 193, 272, 76, 213, 271, 277, 278, 270, 272,
+ 76, 265, 266, 9, 10, 11, 13, 14, 15, 16,
+ 17, 18, 19, 75, 76, 77, 78, 79, 80, 81,
+ 84, 85, 191, 197, 198, 199, 200, 212, 213, 214,
+ 223, 224, 225, 227, 228, 229, 230, 231, 232, 233,
+ 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
+ 244, 245, 246, 247, 248, 250, 252, 253, 271, 282,
+ 283, 284, 285, 288, 289, 290, 293, 294, 295, 299,
+ 258, 257, 260, 271, 259, 76, 191, 193, 211, 194,
+ 234, 247, 251, 271, 113, 277, 76, 279, 280, 214,
+ 278, 212, 211, 192, 196, 212, 212, 283, 191, 191,
+ 212, 212, 250, 191, 250, 210, 191, 234, 234, 250,
+ 214, 288, 84, 85, 193, 195, 192, 192, 196, 74,
+ 248, 191, 93, 94, 95, 96, 97, 98, 99, 100,
+ 101, 102, 211, 249, 234, 201, 202, 203, 197, 198,
+ 82, 83, 86, 87, 204, 205, 88, 89, 206, 207,
+ 208, 90, 92, 91, 209, 196, 212, 214, 283, 76,
+ 257, 260, 193, 211, 194, 251, 248, 281, 194, 214,
+ 193, 196, 212, 78, 266, 75, 282, 289, 296, 250,
+ 212, 250, 210, 103, 250, 263, 292, 192, 214, 226,
+ 250, 76, 229, 248, 248, 234, 234, 234, 236, 236,
+ 237, 237, 238, 238, 238, 238, 239, 239, 240, 241,
+ 242, 243, 244, 245, 250, 248, 193, 194, 251, 281,
+ 211, 194, 251, 280, 191, 292, 297, 298, 192, 192,
+ 76, 192, 194, 210, 251, 211, 194, 281, 211, 194,
+ 250, 212, 192, 283, 291, 285, 211, 284, 286, 287,
+ 248, 194, 281, 211, 281, 192, 250, 286, 12, 281,
+ 281, 212, 283
};
#define yyerrok (yyerrstatus = 0)
}
/* Line 1251 of yacc.c */
-#line 2691 "glsl_parser.cpp"
+#line 2629 "glsl_parser.cpp"
yylsp[0] = yylloc;
goto yysetstate;
case 2:
/* Line 1464 of yacc.c */
-#line 214 "glsl_parser.ypp"
+#line 211 "glsl_parser.ypp"
{
_mesa_glsl_initialize_types(state);
;}
case 5:
/* Line 1464 of yacc.c */
-#line 223 "glsl_parser.ypp"
+#line 220 "glsl_parser.ypp"
{
switch ((yyvsp[(2) - (3)].n)) {
case 100:
case 12:
/* Line 1464 of yacc.c */
-#line 255 "glsl_parser.ypp"
+#line 252 "glsl_parser.ypp"
{
if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) {
YYERROR;
case 13:
/* Line 1464 of yacc.c */
-#line 264 "glsl_parser.ypp"
+#line 261 "glsl_parser.ypp"
{
/* FINISHME: The NULL test is only required because 'precision'
* FINISHME: statements are not yet supported.
case 14:
/* Line 1464 of yacc.c */
-#line 272 "glsl_parser.ypp"
+#line 269 "glsl_parser.ypp"
{
/* FINISHME: The NULL test is only required because 'precision'
* FINISHME: statements are not yet supported.
case 16:
/* Line 1464 of yacc.c */
-#line 287 "glsl_parser.ypp"
+#line 284 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression(ast_identifier, NULL, NULL, NULL);
case 17:
/* Line 1464 of yacc.c */
-#line 294 "glsl_parser.ypp"
+#line 291 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression(ast_int_constant, NULL, NULL, NULL);
case 18:
/* Line 1464 of yacc.c */
-#line 301 "glsl_parser.ypp"
+#line 298 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression(ast_uint_constant, NULL, NULL, NULL);
case 19:
/* Line 1464 of yacc.c */
-#line 308 "glsl_parser.ypp"
+#line 305 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression(ast_float_constant, NULL, NULL, NULL);
case 20:
/* Line 1464 of yacc.c */
-#line 315 "glsl_parser.ypp"
+#line 312 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression(ast_bool_constant, NULL, NULL, NULL);
case 21:
/* Line 1464 of yacc.c */
-#line 322 "glsl_parser.ypp"
+#line 319 "glsl_parser.ypp"
{
(yyval.expression) = (yyvsp[(2) - (3)].expression);
;}
case 23:
/* Line 1464 of yacc.c */
-#line 330 "glsl_parser.ypp"
+#line 327 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression(ast_array_index, (yyvsp[(1) - (4)].expression), (yyvsp[(3) - (4)].expression), NULL);
case 24:
/* Line 1464 of yacc.c */
-#line 336 "glsl_parser.ypp"
+#line 333 "glsl_parser.ypp"
{
(yyval.expression) = (yyvsp[(1) - (1)].expression);
;}
case 25:
/* Line 1464 of yacc.c */
-#line 340 "glsl_parser.ypp"
+#line 337 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), NULL, NULL);
case 26:
/* Line 1464 of yacc.c */
-#line 347 "glsl_parser.ypp"
+#line 344 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression(ast_post_inc, (yyvsp[(1) - (2)].expression), NULL, NULL);
case 27:
/* Line 1464 of yacc.c */
-#line 353 "glsl_parser.ypp"
+#line 350 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression(ast_post_dec, (yyvsp[(1) - (2)].expression), NULL, NULL);
case 31:
/* Line 1464 of yacc.c */
-#line 371 "glsl_parser.ypp"
+#line 368 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression(ast_field_selection, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL);
case 36:
/* Line 1464 of yacc.c */
-#line 390 "glsl_parser.ypp"
+#line 387 "glsl_parser.ypp"
{
(yyval.expression) = (yyvsp[(1) - (2)].expression);
(yyval.expression)->set_location(yylloc);
case 37:
/* Line 1464 of yacc.c */
-#line 396 "glsl_parser.ypp"
+#line 393 "glsl_parser.ypp"
{
(yyval.expression) = (yyvsp[(1) - (3)].expression);
(yyval.expression)->set_location(yylloc);
case 39:
/* Line 1464 of yacc.c */
-#line 412 "glsl_parser.ypp"
+#line 409 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_function_expression((yyvsp[(1) - (1)].type_specifier));
case 40:
/* Line 1464 of yacc.c */
-#line 418 "glsl_parser.ypp"
+#line 415 "glsl_parser.ypp"
{
void *ctx = state;
ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier));
case 41:
/* Line 1464 of yacc.c */
-#line 425 "glsl_parser.ypp"
+#line 422 "glsl_parser.ypp"
{
void *ctx = state;
ast_expression *callee = new(ctx) ast_expression((yyvsp[(1) - (1)].identifier));
case 43:
/* Line 1464 of yacc.c */
-#line 437 "glsl_parser.ypp"
+#line 434 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression(ast_pre_inc, (yyvsp[(2) - (2)].expression), NULL, NULL);
case 44:
/* Line 1464 of yacc.c */
-#line 443 "glsl_parser.ypp"
+#line 440 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression(ast_pre_dec, (yyvsp[(2) - (2)].expression), NULL, NULL);
case 45:
/* Line 1464 of yacc.c */
-#line 449 "glsl_parser.ypp"
+#line 446 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression((yyvsp[(1) - (2)].n), (yyvsp[(2) - (2)].expression), NULL, NULL);
case 46:
/* Line 1464 of yacc.c */
-#line 458 "glsl_parser.ypp"
+#line 455 "glsl_parser.ypp"
{ (yyval.n) = ast_plus; ;}
break;
case 47:
/* Line 1464 of yacc.c */
-#line 459 "glsl_parser.ypp"
+#line 456 "glsl_parser.ypp"
{ (yyval.n) = ast_neg; ;}
break;
case 48:
/* Line 1464 of yacc.c */
-#line 460 "glsl_parser.ypp"
+#line 457 "glsl_parser.ypp"
{ (yyval.n) = ast_logic_not; ;}
break;
case 49:
/* Line 1464 of yacc.c */
-#line 461 "glsl_parser.ypp"
+#line 458 "glsl_parser.ypp"
{ (yyval.n) = ast_bit_not; ;}
break;
case 51:
/* Line 1464 of yacc.c */
-#line 467 "glsl_parser.ypp"
+#line 464 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_mul, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 52:
/* Line 1464 of yacc.c */
-#line 473 "glsl_parser.ypp"
+#line 470 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_div, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 53:
/* Line 1464 of yacc.c */
-#line 479 "glsl_parser.ypp"
+#line 476 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_mod, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 55:
/* Line 1464 of yacc.c */
-#line 489 "glsl_parser.ypp"
+#line 486 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_add, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 56:
/* Line 1464 of yacc.c */
-#line 495 "glsl_parser.ypp"
+#line 492 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_sub, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 58:
/* Line 1464 of yacc.c */
-#line 505 "glsl_parser.ypp"
+#line 502 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_lshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 59:
/* Line 1464 of yacc.c */
-#line 511 "glsl_parser.ypp"
+#line 508 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_rshift, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 61:
/* Line 1464 of yacc.c */
-#line 521 "glsl_parser.ypp"
+#line 518 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_less, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 62:
/* Line 1464 of yacc.c */
-#line 527 "glsl_parser.ypp"
+#line 524 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_greater, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 63:
/* Line 1464 of yacc.c */
-#line 533 "glsl_parser.ypp"
+#line 530 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_lequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 64:
/* Line 1464 of yacc.c */
-#line 539 "glsl_parser.ypp"
+#line 536 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_gequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 66:
/* Line 1464 of yacc.c */
-#line 549 "glsl_parser.ypp"
+#line 546 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_equal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 67:
/* Line 1464 of yacc.c */
-#line 555 "glsl_parser.ypp"
+#line 552 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_nequal, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 69:
/* Line 1464 of yacc.c */
-#line 565 "glsl_parser.ypp"
+#line 562 "glsl_parser.ypp"
{
void *ctx = state;
- (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
+ (yyval.expression) = new(ctx) ast_expression_bin(ast_bit_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
(yyval.expression)->set_location(yylloc);
;}
break;
case 71:
/* Line 1464 of yacc.c */
-#line 575 "glsl_parser.ypp"
+#line 572 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_bit_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 73:
/* Line 1464 of yacc.c */
-#line 585 "glsl_parser.ypp"
+#line 582 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_bit_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 75:
/* Line 1464 of yacc.c */
-#line 595 "glsl_parser.ypp"
+#line 592 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_logic_and, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 77:
/* Line 1464 of yacc.c */
-#line 605 "glsl_parser.ypp"
+#line 602 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_logic_xor, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 79:
/* Line 1464 of yacc.c */
-#line 615 "glsl_parser.ypp"
+#line 612 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression_bin(ast_logic_or, (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression));
case 81:
/* Line 1464 of yacc.c */
-#line 625 "glsl_parser.ypp"
+#line 622 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression(ast_conditional, (yyvsp[(1) - (5)].expression), (yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].expression));
case 83:
/* Line 1464 of yacc.c */
-#line 635 "glsl_parser.ypp"
+#line 632 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.expression) = new(ctx) ast_expression((yyvsp[(2) - (3)].n), (yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression), NULL);
case 84:
/* Line 1464 of yacc.c */
-#line 643 "glsl_parser.ypp"
+#line 640 "glsl_parser.ypp"
{ (yyval.n) = ast_assign; ;}
break;
case 85:
/* Line 1464 of yacc.c */
-#line 644 "glsl_parser.ypp"
+#line 641 "glsl_parser.ypp"
{ (yyval.n) = ast_mul_assign; ;}
break;
case 86:
/* Line 1464 of yacc.c */
-#line 645 "glsl_parser.ypp"
+#line 642 "glsl_parser.ypp"
{ (yyval.n) = ast_div_assign; ;}
break;
case 87:
/* Line 1464 of yacc.c */
-#line 646 "glsl_parser.ypp"
+#line 643 "glsl_parser.ypp"
{ (yyval.n) = ast_mod_assign; ;}
break;
case 88:
/* Line 1464 of yacc.c */
-#line 647 "glsl_parser.ypp"
+#line 644 "glsl_parser.ypp"
{ (yyval.n) = ast_add_assign; ;}
break;
case 89:
/* Line 1464 of yacc.c */
-#line 648 "glsl_parser.ypp"
+#line 645 "glsl_parser.ypp"
{ (yyval.n) = ast_sub_assign; ;}
break;
case 90:
/* Line 1464 of yacc.c */
-#line 649 "glsl_parser.ypp"
+#line 646 "glsl_parser.ypp"
{ (yyval.n) = ast_ls_assign; ;}
break;
case 91:
/* Line 1464 of yacc.c */
-#line 650 "glsl_parser.ypp"
+#line 647 "glsl_parser.ypp"
{ (yyval.n) = ast_rs_assign; ;}
break;
case 92:
/* Line 1464 of yacc.c */
-#line 651 "glsl_parser.ypp"
+#line 648 "glsl_parser.ypp"
{ (yyval.n) = ast_and_assign; ;}
break;
case 93:
/* Line 1464 of yacc.c */
-#line 652 "glsl_parser.ypp"
+#line 649 "glsl_parser.ypp"
{ (yyval.n) = ast_xor_assign; ;}
break;
case 94:
/* Line 1464 of yacc.c */
-#line 653 "glsl_parser.ypp"
+#line 650 "glsl_parser.ypp"
{ (yyval.n) = ast_or_assign; ;}
break;
case 95:
/* Line 1464 of yacc.c */
-#line 658 "glsl_parser.ypp"
+#line 655 "glsl_parser.ypp"
{
(yyval.expression) = (yyvsp[(1) - (1)].expression);
;}
case 96:
/* Line 1464 of yacc.c */
-#line 662 "glsl_parser.ypp"
+#line 659 "glsl_parser.ypp"
{
void *ctx = state;
if ((yyvsp[(1) - (3)].expression)->oper != ast_sequence) {
case 98:
/* Line 1464 of yacc.c */
-#line 682 "glsl_parser.ypp"
+#line 679 "glsl_parser.ypp"
{
(yyval.node) = (yyvsp[(1) - (2)].function);
;}
case 99:
/* Line 1464 of yacc.c */
-#line 686 "glsl_parser.ypp"
+#line 683 "glsl_parser.ypp"
{
(yyval.node) = (yyvsp[(1) - (2)].declarator_list);
;}
case 100:
/* Line 1464 of yacc.c */
-#line 690 "glsl_parser.ypp"
+#line 687 "glsl_parser.ypp"
{
if (((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_float)
&& ((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_int)) {
case 104:
/* Line 1464 of yacc.c */
-#line 713 "glsl_parser.ypp"
+#line 710 "glsl_parser.ypp"
{
(yyval.function) = (yyvsp[(1) - (2)].function);
(yyval.function)->parameters.push_tail(& (yyvsp[(2) - (2)].parameter_declarator)->link);
case 105:
/* Line 1464 of yacc.c */
-#line 718 "glsl_parser.ypp"
+#line 715 "glsl_parser.ypp"
{
(yyval.function) = (yyvsp[(1) - (3)].function);
(yyval.function)->parameters.push_tail(& (yyvsp[(3) - (3)].parameter_declarator)->link);
case 106:
/* Line 1464 of yacc.c */
-#line 726 "glsl_parser.ypp"
+#line 723 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.function) = new(ctx) ast_function();
case 107:
/* Line 1464 of yacc.c */
-#line 737 "glsl_parser.ypp"
+#line 734 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.parameter_declarator) = new(ctx) ast_parameter_declarator();
case 108:
/* Line 1464 of yacc.c */
-#line 747 "glsl_parser.ypp"
+#line 744 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.parameter_declarator) = new(ctx) ast_parameter_declarator();
case 109:
/* Line 1464 of yacc.c */
-#line 762 "glsl_parser.ypp"
+#line 759 "glsl_parser.ypp"
{
- (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i;
+ (yyvsp[(1) - (3)].type_qualifier).flags.i |= (yyvsp[(2) - (3)].type_qualifier).flags.i;
(yyval.parameter_declarator) = (yyvsp[(3) - (3)].parameter_declarator);
- (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (3)].type_qualifier).q;
+ (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (3)].type_qualifier);
;}
break;
case 110:
/* Line 1464 of yacc.c */
-#line 769 "glsl_parser.ypp"
+#line 766 "glsl_parser.ypp"
{
(yyval.parameter_declarator) = (yyvsp[(2) - (2)].parameter_declarator);
- (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier).q;
+ (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier);
;}
break;
case 111:
/* Line 1464 of yacc.c */
-#line 774 "glsl_parser.ypp"
+#line 771 "glsl_parser.ypp"
{
void *ctx = state;
- (yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i;
+ (yyvsp[(1) - (3)].type_qualifier).flags.i |= (yyvsp[(2) - (3)].type_qualifier).flags.i;
(yyval.parameter_declarator) = new(ctx) ast_parameter_declarator();
(yyval.parameter_declarator)->set_location(yylloc);
(yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type();
- (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (3)].type_qualifier).q;
+ (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (3)].type_qualifier);
(yyval.parameter_declarator)->type->specifier = (yyvsp[(3) - (3)].type_specifier);
;}
break;
case 112:
/* Line 1464 of yacc.c */
-#line 785 "glsl_parser.ypp"
+#line 782 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.parameter_declarator) = new(ctx) ast_parameter_declarator();
(yyval.parameter_declarator)->set_location(yylloc);
(yyval.parameter_declarator)->type = new(ctx) ast_fully_specified_type();
- (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier).q;
+ (yyval.parameter_declarator)->type->qualifier = (yyvsp[(1) - (2)].type_qualifier);
(yyval.parameter_declarator)->type->specifier = (yyvsp[(2) - (2)].type_specifier);
;}
break;
case 113:
/* Line 1464 of yacc.c */
-#line 796 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; ;}
+#line 794 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ ;}
break;
case 114:
/* Line 1464 of yacc.c */
-#line 797 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;}
+#line 798 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.in = 1;
+ ;}
break;
case 115:
/* Line 1464 of yacc.c */
-#line 798 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;}
+#line 803 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.out = 1;
+ ;}
break;
case 116:
/* Line 1464 of yacc.c */
-#line 799 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; (yyval.type_qualifier).q.out = 1; ;}
+#line 808 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.in = 1;
+ (yyval.type_qualifier).flags.q.out = 1;
+ ;}
break;
case 119:
/* Line 1464 of yacc.c */
-#line 809 "glsl_parser.ypp"
+#line 822 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (3)].identifier), false, NULL, NULL);
case 120:
/* Line 1464 of yacc.c */
-#line 818 "glsl_parser.ypp"
+#line 831 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), true, NULL, NULL);
case 121:
/* Line 1464 of yacc.c */
-#line 827 "glsl_parser.ypp"
+#line 840 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (6)].identifier), true, (yyvsp[(5) - (6)].expression), NULL);
case 122:
/* Line 1464 of yacc.c */
-#line 836 "glsl_parser.ypp"
+#line 849 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (7)].identifier), true, NULL, (yyvsp[(7) - (7)].expression));
case 123:
/* Line 1464 of yacc.c */
-#line 845 "glsl_parser.ypp"
+#line 858 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (8)].identifier), true, (yyvsp[(5) - (8)].expression), (yyvsp[(8) - (8)].expression));
case 124:
/* Line 1464 of yacc.c */
-#line 854 "glsl_parser.ypp"
+#line 867 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(3) - (5)].identifier), false, NULL, (yyvsp[(5) - (5)].expression));
case 125:
/* Line 1464 of yacc.c */
-#line 867 "glsl_parser.ypp"
+#line 880 "glsl_parser.ypp"
{
void *ctx = state;
if ((yyvsp[(1) - (1)].fully_specified_type)->specifier->type_specifier != ast_struct) {
case 126:
/* Line 1464 of yacc.c */
-#line 878 "glsl_parser.ypp"
+#line 891 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL);
case 127:
/* Line 1464 of yacc.c */
-#line 887 "glsl_parser.ypp"
+#line 900 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), true, NULL, NULL);
case 128:
/* Line 1464 of yacc.c */
-#line 896 "glsl_parser.ypp"
+#line 909 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (5)].identifier), true, (yyvsp[(4) - (5)].expression), NULL);
case 129:
/* Line 1464 of yacc.c */
-#line 905 "glsl_parser.ypp"
+#line 918 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (6)].identifier), true, NULL, (yyvsp[(6) - (6)].expression));
case 130:
/* Line 1464 of yacc.c */
-#line 914 "glsl_parser.ypp"
+#line 927 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (7)].identifier), true, (yyvsp[(4) - (7)].expression), (yyvsp[(7) - (7)].expression));
case 131:
/* Line 1464 of yacc.c */
-#line 923 "glsl_parser.ypp"
+#line 936 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression));
case 132:
/* Line 1464 of yacc.c */
-#line 932 "glsl_parser.ypp"
+#line 945 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (2)].identifier), false, NULL, NULL);
case 133:
/* Line 1464 of yacc.c */
-#line 946 "glsl_parser.ypp"
+#line 959 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.fully_specified_type) = new(ctx) ast_fully_specified_type();
case 134:
/* Line 1464 of yacc.c */
-#line 953 "glsl_parser.ypp"
+#line 966 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.fully_specified_type) = new(ctx) ast_fully_specified_type();
(yyval.fully_specified_type)->set_location(yylloc);
- (yyval.fully_specified_type)->qualifier = (yyvsp[(1) - (2)].type_qualifier).q;
+ (yyval.fully_specified_type)->qualifier = (yyvsp[(1) - (2)].type_qualifier);
(yyval.fully_specified_type)->specifier = (yyvsp[(2) - (2)].type_specifier);
;}
break;
case 135:
/* Line 1464 of yacc.c */
-#line 963 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; ;}
- break;
-
- case 137:
-
-/* Line 1464 of yacc.c */
-#line 969 "glsl_parser.ypp"
+#line 977 "glsl_parser.ypp"
{
(yyval.type_qualifier) = (yyvsp[(3) - (4)].type_qualifier);
;}
break;
- case 139:
+ case 137:
/* Line 1464 of yacc.c */
-#line 977 "glsl_parser.ypp"
+#line 985 "glsl_parser.ypp"
{
- (yyval.type_qualifier).i = (yyvsp[(1) - (3)].type_qualifier).i | (yyvsp[(3) - (3)].type_qualifier).i;
+ if (((yyvsp[(1) - (3)].type_qualifier).flags.i & (yyvsp[(3) - (3)].type_qualifier).flags.i) != 0) {
+ _mesa_glsl_error(& (yylsp[(3) - (3)]), state,
+ "duplicate layout qualifiers used\n");
+ YYERROR;
+ }
+
+ (yyval.type_qualifier).flags.i = (yyvsp[(1) - (3)].type_qualifier).flags.i | (yyvsp[(3) - (3)].type_qualifier).flags.i;
+
+ if ((yyvsp[(1) - (3)].type_qualifier).flags.q.explicit_location)
+ (yyval.type_qualifier).location = (yyvsp[(1) - (3)].type_qualifier).location;
+
+ if ((yyvsp[(3) - (3)].type_qualifier).flags.q.explicit_location)
+ (yyval.type_qualifier).location = (yyvsp[(3) - (3)].type_qualifier).location;
;}
break;
- case 140:
+ case 138:
/* Line 1464 of yacc.c */
-#line 984 "glsl_parser.ypp"
+#line 1004 "glsl_parser.ypp"
{
- (yyval.type_qualifier).i = 0;
+ bool got_one = false;
- if (state->ARB_fragment_coord_conventions_enable) {
- bool got_one = false;
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ if (state->ARB_fragment_coord_conventions_enable) {
if (strcmp((yyvsp[(1) - (1)].identifier), "origin_upper_left") == 0) {
got_one = true;
- (yyval.type_qualifier).q.origin_upper_left = 1;
+ (yyval.type_qualifier).flags.q.origin_upper_left = 1;
} else if (strcmp((yyvsp[(1) - (1)].identifier), "pixel_center_integer") == 0) {
got_one = true;
- (yyval.type_qualifier).q.pixel_center_integer = 1;
- }
-
- if (state->ARB_fragment_coord_conventions_warn && got_one) {
- _mesa_glsl_warning(& (yylsp[(1) - (1)]), state,
- "GL_ARB_fragment_coord_conventions layout "
- "identifier `%s' used\n", (yyvsp[(1) - (1)].identifier));
+ (yyval.type_qualifier).flags.q.pixel_center_integer = 1;
}
}
/* If the identifier didn't match any known layout identifiers,
* emit an error.
*/
- if ((yyval.type_qualifier).i == 0) {
+ if (!got_one) {
_mesa_glsl_error(& (yylsp[(1) - (1)]), state, "unrecognized layout identifier "
"`%s'\n", (yyvsp[(1) - (1)].identifier));
YYERROR;
+ } else if (state->ARB_fragment_coord_conventions_warn) {
+ _mesa_glsl_warning(& (yylsp[(1) - (1)]), state,
+ "GL_ARB_fragment_coord_conventions layout "
+ "identifier `%s' used\n", (yyvsp[(1) - (1)].identifier));
+ }
+ ;}
+ break;
+
+ case 139:
+
+/* Line 1464 of yacc.c */
+#line 1033 "glsl_parser.ypp"
+ {
+ bool got_one = false;
+
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+
+ if (state->ARB_explicit_attrib_location_enable) {
+ /* FINISHME: Handle 'index' once GL_ARB_blend_func_exteneded and
+ * FINISHME: GLSL 1.30 (or later) are supported.
+ */
+ if (strcmp("location", (yyvsp[(1) - (3)].identifier)) == 0) {
+ got_one = true;
+
+ (yyval.type_qualifier).flags.q.explicit_location = 1;
+
+ if ((yyvsp[(3) - (3)].n) >= 0) {
+ (yyval.type_qualifier).location = (yyvsp[(3) - (3)].n);
+ } else {
+ _mesa_glsl_error(& (yylsp[(3) - (3)]), state,
+ "invalid location %d specified\n", (yyvsp[(3) - (3)].n));
+ YYERROR;
+ }
+ }
+ }
+
+ /* If the identifier didn't match any known layout identifiers,
+ * emit an error.
+ */
+ if (!got_one) {
+ _mesa_glsl_error(& (yylsp[(1) - (3)]), state, "unrecognized layout identifier "
+ "`%s'\n", (yyvsp[(1) - (3)].identifier));
+ YYERROR;
+ } else if (state->ARB_explicit_attrib_location_warn) {
+ _mesa_glsl_warning(& (yylsp[(1) - (3)]), state,
+ "GL_ARB_explicit_attrib_location layout "
+ "identifier `%s' used\n", (yyvsp[(1) - (3)].identifier));
}
;}
break;
+ case 140:
+
+/* Line 1464 of yacc.c */
+#line 1074 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.smooth = 1;
+ ;}
+ break;
+
case 141:
/* Line 1464 of yacc.c */
-#line 1017 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.smooth = 1; ;}
+#line 1079 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.flat = 1;
+ ;}
break;
case 142:
/* Line 1464 of yacc.c */
-#line 1018 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.flat = 1; ;}
+#line 1084 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.noperspective = 1;
+ ;}
break;
case 143:
/* Line 1464 of yacc.c */
-#line 1019 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.noperspective = 1; ;}
+#line 1092 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.constant = 1;
+ ;}
+ break;
+
+ case 146:
+
+/* Line 1464 of yacc.c */
+#line 1102 "glsl_parser.ypp"
+ {
+ (yyval.type_qualifier) = (yyvsp[(1) - (2)].type_qualifier);
+ (yyval.type_qualifier).flags.i |= (yyvsp[(2) - (2)].type_qualifier).flags.i;
+ ;}
break;
- case 144:
+ case 148:
/* Line 1464 of yacc.c */
-#line 1023 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;}
+#line 1108 "glsl_parser.ypp"
+ {
+ (yyval.type_qualifier) = (yyvsp[(1) - (2)].type_qualifier);
+ (yyval.type_qualifier).flags.i |= (yyvsp[(2) - (2)].type_qualifier).flags.i;
+ ;}
+ break;
+
+ case 149:
+
+/* Line 1464 of yacc.c */
+#line 1113 "glsl_parser.ypp"
+ {
+ (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier);
+ (yyval.type_qualifier).flags.q.invariant = 1;
+ ;}
break;
- case 146:
+ case 150:
/* Line 1464 of yacc.c */
-#line 1029 "glsl_parser.ypp"
+#line 1118 "glsl_parser.ypp"
{
- (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i | (yyvsp[(2) - (2)].type_qualifier).i;
+ (yyval.type_qualifier) = (yyvsp[(2) - (3)].type_qualifier);
+ (yyval.type_qualifier).flags.i |= (yyvsp[(3) - (3)].type_qualifier).flags.i;
+ (yyval.type_qualifier).flags.q.invariant = 1;
;}
break;
- case 147:
+ case 151:
/* Line 1464 of yacc.c */
-#line 1033 "glsl_parser.ypp"
+#line 1124 "glsl_parser.ypp"
{
- (yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier);
- (yyval.type_qualifier).q.invariant = 1;
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.invariant = 1;
;}
break;
- case 148:
+ case 152:
/* Line 1464 of yacc.c */
-#line 1040 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;}
+#line 1132 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.constant = 1;
+ ;}
break;
- case 149:
+ case 153:
/* Line 1464 of yacc.c */
-#line 1041 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.attribute = 1; ;}
+#line 1137 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.attribute = 1;
+ ;}
break;
- case 150:
+ case 154:
/* Line 1464 of yacc.c */
-#line 1042 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i; (yyval.type_qualifier).q.varying = 1; ;}
+#line 1142 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.varying = 1;
+ ;}
break;
- case 151:
+ case 155:
/* Line 1464 of yacc.c */
-#line 1043 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.varying = 1; ;}
+#line 1147 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.centroid = 1;
+ (yyval.type_qualifier).flags.q.varying = 1;
+ ;}
break;
- case 152:
+ case 156:
/* Line 1464 of yacc.c */
-#line 1044 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;}
+#line 1153 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.in = 1;
+ ;}
break;
- case 153:
+ case 157:
/* Line 1464 of yacc.c */
-#line 1045 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;}
+#line 1158 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.out = 1;
+ ;}
break;
- case 154:
+ case 158:
/* Line 1464 of yacc.c */
-#line 1046 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.in = 1; ;}
+#line 1163 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.centroid = 1; (yyval.type_qualifier).flags.q.in = 1;
+ ;}
break;
- case 155:
+ case 159:
/* Line 1464 of yacc.c */
-#line 1047 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.out = 1; ;}
+#line 1168 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.centroid = 1; (yyval.type_qualifier).flags.q.out = 1;
+ ;}
break;
- case 156:
+ case 160:
/* Line 1464 of yacc.c */
-#line 1048 "glsl_parser.ypp"
- { (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.uniform = 1; ;}
+#line 1173 "glsl_parser.ypp"
+ {
+ memset(& (yyval.type_qualifier), 0, sizeof((yyval.type_qualifier)));
+ (yyval.type_qualifier).flags.q.uniform = 1;
+ ;}
break;
- case 158:
+ case 162:
/* Line 1464 of yacc.c */
-#line 1054 "glsl_parser.ypp"
+#line 1182 "glsl_parser.ypp"
{
(yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier);
(yyval.type_specifier)->precision = (yyvsp[(1) - (2)].n);
;}
break;
- case 160:
+ case 164:
/* Line 1464 of yacc.c */
-#line 1063 "glsl_parser.ypp"
+#line 1191 "glsl_parser.ypp"
{
(yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier);
(yyval.type_specifier)->is_array = true;
;}
break;
- case 161:
+ case 165:
/* Line 1464 of yacc.c */
-#line 1069 "glsl_parser.ypp"
+#line 1197 "glsl_parser.ypp"
{
(yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier);
(yyval.type_specifier)->is_array = true;
;}
break;
- case 162:
+ case 166:
/* Line 1464 of yacc.c */
-#line 1078 "glsl_parser.ypp"
+#line 1206 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].n));
;}
break;
- case 163:
+ case 167:
/* Line 1464 of yacc.c */
-#line 1084 "glsl_parser.ypp"
+#line 1212 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].struct_specifier));
;}
break;
- case 164:
+ case 168:
/* Line 1464 of yacc.c */
-#line 1090 "glsl_parser.ypp"
+#line 1218 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.type_specifier) = new(ctx) ast_type_specifier((yyvsp[(1) - (1)].identifier));
;}
break;
- case 165:
+ case 169:
/* Line 1464 of yacc.c */
-#line 1098 "glsl_parser.ypp"
+#line 1226 "glsl_parser.ypp"
{ (yyval.n) = ast_void; ;}
break;
- case 166:
+ case 170:
/* Line 1464 of yacc.c */
-#line 1099 "glsl_parser.ypp"
+#line 1227 "glsl_parser.ypp"
{ (yyval.n) = ast_float; ;}
break;
- case 167:
+ case 171:
/* Line 1464 of yacc.c */
-#line 1100 "glsl_parser.ypp"
+#line 1228 "glsl_parser.ypp"
{ (yyval.n) = ast_int; ;}
break;
- case 168:
+ case 172:
/* Line 1464 of yacc.c */
-#line 1101 "glsl_parser.ypp"
+#line 1229 "glsl_parser.ypp"
{ (yyval.n) = ast_uint; ;}
break;
- case 169:
+ case 173:
/* Line 1464 of yacc.c */
-#line 1102 "glsl_parser.ypp"
+#line 1230 "glsl_parser.ypp"
{ (yyval.n) = ast_bool; ;}
break;
- case 170:
+ case 174:
/* Line 1464 of yacc.c */
-#line 1103 "glsl_parser.ypp"
+#line 1231 "glsl_parser.ypp"
{ (yyval.n) = ast_vec2; ;}
break;
- case 171:
+ case 175:
/* Line 1464 of yacc.c */
-#line 1104 "glsl_parser.ypp"
+#line 1232 "glsl_parser.ypp"
{ (yyval.n) = ast_vec3; ;}
break;
- case 172:
+ case 176:
/* Line 1464 of yacc.c */
-#line 1105 "glsl_parser.ypp"
+#line 1233 "glsl_parser.ypp"
{ (yyval.n) = ast_vec4; ;}
break;
- case 173:
+ case 177:
/* Line 1464 of yacc.c */
-#line 1106 "glsl_parser.ypp"
+#line 1234 "glsl_parser.ypp"
{ (yyval.n) = ast_bvec2; ;}
break;
- case 174:
+ case 178:
/* Line 1464 of yacc.c */
-#line 1107 "glsl_parser.ypp"
+#line 1235 "glsl_parser.ypp"
{ (yyval.n) = ast_bvec3; ;}
break;
- case 175:
+ case 179:
/* Line 1464 of yacc.c */
-#line 1108 "glsl_parser.ypp"
+#line 1236 "glsl_parser.ypp"
{ (yyval.n) = ast_bvec4; ;}
break;
- case 176:
+ case 180:
/* Line 1464 of yacc.c */
-#line 1109 "glsl_parser.ypp"
+#line 1237 "glsl_parser.ypp"
{ (yyval.n) = ast_ivec2; ;}
break;
- case 177:
+ case 181:
/* Line 1464 of yacc.c */
-#line 1110 "glsl_parser.ypp"
+#line 1238 "glsl_parser.ypp"
{ (yyval.n) = ast_ivec3; ;}
break;
- case 178:
+ case 182:
/* Line 1464 of yacc.c */
-#line 1111 "glsl_parser.ypp"
+#line 1239 "glsl_parser.ypp"
{ (yyval.n) = ast_ivec4; ;}
break;
- case 179:
+ case 183:
/* Line 1464 of yacc.c */
-#line 1112 "glsl_parser.ypp"
+#line 1240 "glsl_parser.ypp"
{ (yyval.n) = ast_uvec2; ;}
break;
- case 180:
+ case 184:
/* Line 1464 of yacc.c */
-#line 1113 "glsl_parser.ypp"
+#line 1241 "glsl_parser.ypp"
{ (yyval.n) = ast_uvec3; ;}
break;
- case 181:
+ case 185:
/* Line 1464 of yacc.c */
-#line 1114 "glsl_parser.ypp"
+#line 1242 "glsl_parser.ypp"
{ (yyval.n) = ast_uvec4; ;}
break;
- case 182:
+ case 186:
/* Line 1464 of yacc.c */
-#line 1115 "glsl_parser.ypp"
+#line 1243 "glsl_parser.ypp"
{ (yyval.n) = ast_mat2; ;}
break;
- case 183:
+ case 187:
/* Line 1464 of yacc.c */
-#line 1116 "glsl_parser.ypp"
+#line 1244 "glsl_parser.ypp"
{ (yyval.n) = ast_mat2x3; ;}
break;
- case 184:
+ case 188:
/* Line 1464 of yacc.c */
-#line 1117 "glsl_parser.ypp"
+#line 1245 "glsl_parser.ypp"
{ (yyval.n) = ast_mat2x4; ;}
break;
- case 185:
+ case 189:
/* Line 1464 of yacc.c */
-#line 1118 "glsl_parser.ypp"
+#line 1246 "glsl_parser.ypp"
{ (yyval.n) = ast_mat3x2; ;}
break;
- case 186:
+ case 190:
/* Line 1464 of yacc.c */
-#line 1119 "glsl_parser.ypp"
+#line 1247 "glsl_parser.ypp"
{ (yyval.n) = ast_mat3; ;}
break;
- case 187:
+ case 191:
/* Line 1464 of yacc.c */
-#line 1120 "glsl_parser.ypp"
+#line 1248 "glsl_parser.ypp"
{ (yyval.n) = ast_mat3x4; ;}
break;
- case 188:
+ case 192:
/* Line 1464 of yacc.c */
-#line 1121 "glsl_parser.ypp"
+#line 1249 "glsl_parser.ypp"
{ (yyval.n) = ast_mat4x2; ;}
break;
- case 189:
+ case 193:
/* Line 1464 of yacc.c */
-#line 1122 "glsl_parser.ypp"
+#line 1250 "glsl_parser.ypp"
{ (yyval.n) = ast_mat4x3; ;}
break;
- case 190:
+ case 194:
/* Line 1464 of yacc.c */
-#line 1123 "glsl_parser.ypp"
+#line 1251 "glsl_parser.ypp"
{ (yyval.n) = ast_mat4; ;}
break;
- case 191:
+ case 195:
/* Line 1464 of yacc.c */
-#line 1124 "glsl_parser.ypp"
+#line 1252 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler1d; ;}
break;
- case 192:
+ case 196:
/* Line 1464 of yacc.c */
-#line 1125 "glsl_parser.ypp"
+#line 1253 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler2d; ;}
break;
- case 193:
+ case 197:
/* Line 1464 of yacc.c */
-#line 1126 "glsl_parser.ypp"
+#line 1254 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler2drect; ;}
break;
- case 194:
+ case 198:
/* Line 1464 of yacc.c */
-#line 1127 "glsl_parser.ypp"
+#line 1255 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler3d; ;}
break;
- case 195:
+ case 199:
/* Line 1464 of yacc.c */
-#line 1128 "glsl_parser.ypp"
+#line 1256 "glsl_parser.ypp"
{ (yyval.n) = ast_samplercube; ;}
break;
- case 196:
+ case 200:
/* Line 1464 of yacc.c */
-#line 1129 "glsl_parser.ypp"
+#line 1257 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler1dshadow; ;}
break;
- case 197:
+ case 201:
/* Line 1464 of yacc.c */
-#line 1130 "glsl_parser.ypp"
+#line 1258 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler2dshadow; ;}
break;
- case 198:
+ case 202:
/* Line 1464 of yacc.c */
-#line 1131 "glsl_parser.ypp"
+#line 1259 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler2drectshadow; ;}
break;
- case 199:
+ case 203:
/* Line 1464 of yacc.c */
-#line 1132 "glsl_parser.ypp"
+#line 1260 "glsl_parser.ypp"
{ (yyval.n) = ast_samplercubeshadow; ;}
break;
- case 200:
+ case 204:
/* Line 1464 of yacc.c */
-#line 1133 "glsl_parser.ypp"
+#line 1261 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler1darray; ;}
break;
- case 201:
+ case 205:
/* Line 1464 of yacc.c */
-#line 1134 "glsl_parser.ypp"
+#line 1262 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler2darray; ;}
break;
- case 202:
+ case 206:
/* Line 1464 of yacc.c */
-#line 1135 "glsl_parser.ypp"
+#line 1263 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler1darrayshadow; ;}
break;
- case 203:
+ case 207:
/* Line 1464 of yacc.c */
-#line 1136 "glsl_parser.ypp"
+#line 1264 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler2darrayshadow; ;}
break;
- case 204:
+ case 208:
/* Line 1464 of yacc.c */
-#line 1137 "glsl_parser.ypp"
+#line 1265 "glsl_parser.ypp"
{ (yyval.n) = ast_isampler1d; ;}
break;
- case 205:
+ case 209:
/* Line 1464 of yacc.c */
-#line 1138 "glsl_parser.ypp"
+#line 1266 "glsl_parser.ypp"
{ (yyval.n) = ast_isampler2d; ;}
break;
- case 206:
+ case 210:
/* Line 1464 of yacc.c */
-#line 1139 "glsl_parser.ypp"
+#line 1267 "glsl_parser.ypp"
{ (yyval.n) = ast_isampler3d; ;}
break;
- case 207:
+ case 211:
/* Line 1464 of yacc.c */
-#line 1140 "glsl_parser.ypp"
+#line 1268 "glsl_parser.ypp"
{ (yyval.n) = ast_isamplercube; ;}
break;
- case 208:
+ case 212:
/* Line 1464 of yacc.c */
-#line 1141 "glsl_parser.ypp"
+#line 1269 "glsl_parser.ypp"
{ (yyval.n) = ast_isampler1darray; ;}
break;
- case 209:
+ case 213:
/* Line 1464 of yacc.c */
-#line 1142 "glsl_parser.ypp"
+#line 1270 "glsl_parser.ypp"
{ (yyval.n) = ast_isampler2darray; ;}
break;
- case 210:
+ case 214:
/* Line 1464 of yacc.c */
-#line 1143 "glsl_parser.ypp"
+#line 1271 "glsl_parser.ypp"
{ (yyval.n) = ast_usampler1d; ;}
break;
- case 211:
+ case 215:
/* Line 1464 of yacc.c */
-#line 1144 "glsl_parser.ypp"
+#line 1272 "glsl_parser.ypp"
{ (yyval.n) = ast_usampler2d; ;}
break;
- case 212:
+ case 216:
/* Line 1464 of yacc.c */
-#line 1145 "glsl_parser.ypp"
+#line 1273 "glsl_parser.ypp"
{ (yyval.n) = ast_usampler3d; ;}
break;
- case 213:
+ case 217:
/* Line 1464 of yacc.c */
-#line 1146 "glsl_parser.ypp"
+#line 1274 "glsl_parser.ypp"
{ (yyval.n) = ast_usamplercube; ;}
break;
- case 214:
+ case 218:
/* Line 1464 of yacc.c */
-#line 1147 "glsl_parser.ypp"
+#line 1275 "glsl_parser.ypp"
{ (yyval.n) = ast_usampler1darray; ;}
break;
- case 215:
+ case 219:
/* Line 1464 of yacc.c */
-#line 1148 "glsl_parser.ypp"
+#line 1276 "glsl_parser.ypp"
{ (yyval.n) = ast_usampler2darray; ;}
break;
- case 216:
+ case 220:
/* Line 1464 of yacc.c */
-#line 1152 "glsl_parser.ypp"
+#line 1280 "glsl_parser.ypp"
{
if (!state->es_shader && state->language_version < 130)
_mesa_glsl_error(& (yylsp[(1) - (1)]), state,
;}
break;
- case 217:
+ case 221:
/* Line 1464 of yacc.c */
-#line 1163 "glsl_parser.ypp"
+#line 1291 "glsl_parser.ypp"
{
if (!state->es_shader && state->language_version < 130)
_mesa_glsl_error(& (yylsp[(1) - (1)]), state,
;}
break;
- case 218:
+ case 222:
/* Line 1464 of yacc.c */
-#line 1174 "glsl_parser.ypp"
+#line 1302 "glsl_parser.ypp"
{
if (!state->es_shader && state->language_version < 130)
_mesa_glsl_error(& (yylsp[(1) - (1)]), state,
;}
break;
- case 219:
+ case 223:
/* Line 1464 of yacc.c */
-#line 1189 "glsl_parser.ypp"
+#line 1317 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.struct_specifier) = new(ctx) ast_struct_specifier((yyvsp[(2) - (5)].identifier), (yyvsp[(4) - (5)].node));
;}
break;
- case 220:
+ case 224:
/* Line 1464 of yacc.c */
-#line 1195 "glsl_parser.ypp"
+#line 1323 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.struct_specifier) = new(ctx) ast_struct_specifier(NULL, (yyvsp[(3) - (4)].node));
;}
break;
- case 221:
+ case 225:
/* Line 1464 of yacc.c */
-#line 1204 "glsl_parser.ypp"
+#line 1332 "glsl_parser.ypp"
{
(yyval.node) = (ast_node *) (yyvsp[(1) - (1)].declarator_list);
(yyvsp[(1) - (1)].declarator_list)->link.self_link();
;}
break;
- case 222:
+ case 226:
/* Line 1464 of yacc.c */
-#line 1209 "glsl_parser.ypp"
+#line 1337 "glsl_parser.ypp"
{
(yyval.node) = (ast_node *) (yyvsp[(1) - (2)].node);
(yyval.node)->link.insert_before(& (yyvsp[(2) - (2)].declarator_list)->link);
;}
break;
- case 223:
+ case 227:
/* Line 1464 of yacc.c */
-#line 1217 "glsl_parser.ypp"
+#line 1345 "glsl_parser.ypp"
{
void *ctx = state;
ast_fully_specified_type *type = new(ctx) ast_fully_specified_type();
;}
break;
- case 224:
+ case 228:
/* Line 1464 of yacc.c */
-#line 1232 "glsl_parser.ypp"
+#line 1360 "glsl_parser.ypp"
{
(yyval.declaration) = (yyvsp[(1) - (1)].declaration);
(yyvsp[(1) - (1)].declaration)->link.self_link();
;}
break;
- case 225:
+ case 229:
/* Line 1464 of yacc.c */
-#line 1237 "glsl_parser.ypp"
+#line 1365 "glsl_parser.ypp"
{
(yyval.declaration) = (yyvsp[(1) - (3)].declaration);
(yyval.declaration)->link.insert_before(& (yyvsp[(3) - (3)].declaration)->link);
;}
break;
- case 226:
+ case 230:
/* Line 1464 of yacc.c */
-#line 1245 "glsl_parser.ypp"
+#line 1373 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (1)].identifier), false, NULL, NULL);
;}
break;
- case 227:
+ case 231:
/* Line 1464 of yacc.c */
-#line 1251 "glsl_parser.ypp"
+#line 1379 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.declaration) = new(ctx) ast_declaration((yyvsp[(1) - (4)].identifier), true, (yyvsp[(3) - (4)].expression), NULL);
;}
break;
- case 230:
+ case 234:
/* Line 1464 of yacc.c */
-#line 1269 "glsl_parser.ypp"
+#line 1397 "glsl_parser.ypp"
{ (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;}
break;
- case 235:
+ case 239:
/* Line 1464 of yacc.c */
-#line 1277 "glsl_parser.ypp"
+#line 1405 "glsl_parser.ypp"
{ (yyval.node) = NULL; ;}
break;
- case 236:
+ case 240:
/* Line 1464 of yacc.c */
-#line 1278 "glsl_parser.ypp"
+#line 1406 "glsl_parser.ypp"
{ (yyval.node) = NULL; ;}
break;
- case 239:
+ case 243:
/* Line 1464 of yacc.c */
-#line 1285 "glsl_parser.ypp"
+#line 1413 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL);
;}
break;
- case 240:
+ case 244:
/* Line 1464 of yacc.c */
-#line 1291 "glsl_parser.ypp"
+#line 1419 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node));
;}
break;
- case 241:
+ case 245:
/* Line 1464 of yacc.c */
-#line 1299 "glsl_parser.ypp"
+#line 1427 "glsl_parser.ypp"
{ (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;}
break;
- case 243:
+ case 247:
/* Line 1464 of yacc.c */
-#line 1305 "glsl_parser.ypp"
+#line 1433 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL);
;}
break;
- case 244:
+ case 248:
/* Line 1464 of yacc.c */
-#line 1311 "glsl_parser.ypp"
+#line 1439 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node));
;}
break;
- case 245:
+ case 249:
/* Line 1464 of yacc.c */
-#line 1320 "glsl_parser.ypp"
+#line 1448 "glsl_parser.ypp"
{
if ((yyvsp[(1) - (1)].node) == NULL) {
_mesa_glsl_error(& (yylsp[(1) - (1)]), state, "<nil> statement\n");
;}
break;
- case 246:
+ case 250:
/* Line 1464 of yacc.c */
-#line 1330 "glsl_parser.ypp"
+#line 1458 "glsl_parser.ypp"
{
if ((yyvsp[(2) - (2)].node) == NULL) {
_mesa_glsl_error(& (yylsp[(2) - (2)]), state, "<nil> statement\n");
;}
break;
- case 247:
+ case 251:
/* Line 1464 of yacc.c */
-#line 1342 "glsl_parser.ypp"
+#line 1470 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_expression_statement(NULL);
;}
break;
- case 248:
+ case 252:
/* Line 1464 of yacc.c */
-#line 1348 "glsl_parser.ypp"
+#line 1476 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression));
;}
break;
- case 249:
+ case 253:
/* Line 1464 of yacc.c */
-#line 1357 "glsl_parser.ypp"
+#line 1485 "glsl_parser.ypp"
{
(yyval.node) = new(state) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].selection_rest_statement).then_statement,
(yyvsp[(5) - (5)].selection_rest_statement).else_statement);
;}
break;
- case 250:
+ case 254:
/* Line 1464 of yacc.c */
-#line 1366 "glsl_parser.ypp"
+#line 1494 "glsl_parser.ypp"
{
(yyval.selection_rest_statement).then_statement = (yyvsp[(1) - (3)].node);
(yyval.selection_rest_statement).else_statement = (yyvsp[(3) - (3)].node);
;}
break;
- case 251:
+ case 255:
/* Line 1464 of yacc.c */
-#line 1371 "glsl_parser.ypp"
+#line 1499 "glsl_parser.ypp"
{
(yyval.selection_rest_statement).then_statement = (yyvsp[(1) - (1)].node);
(yyval.selection_rest_statement).else_statement = NULL;
;}
break;
- case 252:
+ case 256:
/* Line 1464 of yacc.c */
-#line 1379 "glsl_parser.ypp"
+#line 1507 "glsl_parser.ypp"
{
(yyval.node) = (ast_node *) (yyvsp[(1) - (1)].expression);
;}
break;
- case 253:
+ case 257:
/* Line 1464 of yacc.c */
-#line 1383 "glsl_parser.ypp"
+#line 1511 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression));
;}
break;
- case 257:
+ case 261:
/* Line 1464 of yacc.c */
-#line 1406 "glsl_parser.ypp"
+#line 1534 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while,
;}
break;
- case 258:
+ case 262:
/* Line 1464 of yacc.c */
-#line 1413 "glsl_parser.ypp"
+#line 1541 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while,
;}
break;
- case 259:
+ case 263:
/* Line 1464 of yacc.c */
-#line 1420 "glsl_parser.ypp"
+#line 1548 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for,
;}
break;
- case 263:
+ case 267:
/* Line 1464 of yacc.c */
-#line 1436 "glsl_parser.ypp"
+#line 1564 "glsl_parser.ypp"
{
(yyval.node) = NULL;
;}
break;
- case 264:
+ case 268:
/* Line 1464 of yacc.c */
-#line 1443 "glsl_parser.ypp"
+#line 1571 "glsl_parser.ypp"
{
(yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node);
(yyval.for_rest_statement).rest = NULL;
;}
break;
- case 265:
+ case 269:
/* Line 1464 of yacc.c */
-#line 1448 "glsl_parser.ypp"
+#line 1576 "glsl_parser.ypp"
{
(yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node);
(yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression);
;}
break;
- case 266:
+ case 270:
/* Line 1464 of yacc.c */
-#line 1457 "glsl_parser.ypp"
+#line 1585 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL);
;}
break;
- case 267:
+ case 271:
/* Line 1464 of yacc.c */
-#line 1463 "glsl_parser.ypp"
+#line 1591 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL);
;}
break;
- case 268:
+ case 272:
/* Line 1464 of yacc.c */
-#line 1469 "glsl_parser.ypp"
+#line 1597 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL);
;}
break;
- case 269:
+ case 273:
/* Line 1464 of yacc.c */
-#line 1475 "glsl_parser.ypp"
+#line 1603 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression));
;}
break;
- case 270:
+ case 274:
/* Line 1464 of yacc.c */
-#line 1481 "glsl_parser.ypp"
+#line 1609 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL);
;}
break;
- case 271:
+ case 275:
/* Line 1464 of yacc.c */
-#line 1489 "glsl_parser.ypp"
+#line 1617 "glsl_parser.ypp"
{ (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;}
break;
- case 272:
+ case 276:
/* Line 1464 of yacc.c */
-#line 1490 "glsl_parser.ypp"
+#line 1618 "glsl_parser.ypp"
{ (yyval.node) = (yyvsp[(1) - (1)].node); ;}
break;
- case 273:
+ case 277:
/* Line 1464 of yacc.c */
-#line 1491 "glsl_parser.ypp"
+#line 1619 "glsl_parser.ypp"
{ (yyval.node) = NULL; ;}
break;
- case 274:
+ case 278:
/* Line 1464 of yacc.c */
-#line 1496 "glsl_parser.ypp"
+#line 1624 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.function_definition) = new(ctx) ast_function_definition();
/* Line 1464 of yacc.c */
-#line 5016 "glsl_parser.cpp"
+#line 5084 "glsl_parser.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
float real;
char *identifier;
- union {
- struct ast_type_qualifier q;
- unsigned i;
- } type_qualifier;
+ struct ast_type_qualifier type_qualifier;
ast_node *node;
ast_type_specifier *type_specifier;
/* Line 1685 of yacc.c */
-#line 276 "glsl_parser.h"
+#line 273 "glsl_parser.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
float real;
char *identifier;
- union {
- struct ast_type_qualifier q;
- unsigned i;
- } type_qualifier;
+ struct ast_type_qualifier type_qualifier;
ast_node *node;
ast_type_specifier *type_specifier;
%type <type_qualifier> type_qualifier
%type <type_qualifier> storage_qualifier
%type <type_qualifier> interpolation_qualifier
-%type <type_qualifier> opt_layout_qualifier layout_qualifier
+%type <type_qualifier> layout_qualifier
%type <type_qualifier> layout_qualifier_id_list layout_qualifier_id
%type <type_specifier> type_specifier
%type <type_specifier> type_specifier_no_prec
| and_expression '&' equality_expression
{
void *ctx = state;
- $$ = new(ctx) ast_expression_bin(ast_bit_or, $1, $3);
+ $$ = new(ctx) ast_expression_bin(ast_bit_and, $1, $3);
$$->set_location(yylloc);
}
;
parameter_declaration:
parameter_type_qualifier parameter_qualifier parameter_declarator
{
- $1.i |= $2.i;
+ $1.flags.i |= $2.flags.i;
$$ = $3;
- $$->type->qualifier = $1.q;
+ $$->type->qualifier = $1;
}
| parameter_qualifier parameter_declarator
{
$$ = $2;
- $$->type->qualifier = $1.q;
+ $$->type->qualifier = $1;
}
| parameter_type_qualifier parameter_qualifier parameter_type_specifier
{
void *ctx = state;
- $1.i |= $2.i;
+ $1.flags.i |= $2.flags.i;
$$ = new(ctx) ast_parameter_declarator();
$$->set_location(yylloc);
$$->type = new(ctx) ast_fully_specified_type();
- $$->type->qualifier = $1.q;
+ $$->type->qualifier = $1;
$$->type->specifier = $3;
}
| parameter_qualifier parameter_type_specifier
$$ = new(ctx) ast_parameter_declarator();
$$->set_location(yylloc);
$$->type = new(ctx) ast_fully_specified_type();
- $$->type->qualifier = $1.q;
+ $$->type->qualifier = $1;
$$->type->specifier = $2;
}
;
parameter_qualifier:
- /* empty */ { $$.i = 0; }
- | IN_TOK { $$.i = 0; $$.q.in = 1; }
- | OUT_TOK { $$.i = 0; $$.q.out = 1; }
- | INOUT_TOK { $$.i = 0; $$.q.in = 1; $$.q.out = 1; }
+ /* empty */
+ {
+ memset(& $$, 0, sizeof($$));
+ }
+ | IN_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.in = 1;
+ }
+ | OUT_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.out = 1;
+ }
+ | INOUT_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.in = 1;
+ $$.flags.q.out = 1;
+ }
;
parameter_type_specifier:
void *ctx = state;
$$ = new(ctx) ast_fully_specified_type();
$$->set_location(yylloc);
- $$->qualifier = $1.q;
+ $$->qualifier = $1;
$$->specifier = $2;
}
;
-opt_layout_qualifier:
- { $$.i = 0; }
- | layout_qualifier
- ;
-
layout_qualifier:
LAYOUT_TOK '(' layout_qualifier_id_list ')'
{
layout_qualifier_id
| layout_qualifier_id_list ',' layout_qualifier_id
{
- $$.i = $1.i | $3.i;
+ if (($1.flags.i & $3.flags.i) != 0) {
+ _mesa_glsl_error(& @3, state,
+ "duplicate layout qualifiers used\n");
+ YYERROR;
+ }
+
+ $$.flags.i = $1.flags.i | $3.flags.i;
+
+ if ($1.flags.q.explicit_location)
+ $$.location = $1.location;
+
+ if ($3.flags.q.explicit_location)
+ $$.location = $3.location;
}
;
layout_qualifier_id:
IDENTIFIER
{
- $$.i = 0;
+ bool got_one = false;
- if (state->ARB_fragment_coord_conventions_enable) {
- bool got_one = false;
+ memset(& $$, 0, sizeof($$));
+ if (state->ARB_fragment_coord_conventions_enable) {
if (strcmp($1, "origin_upper_left") == 0) {
got_one = true;
- $$.q.origin_upper_left = 1;
+ $$.flags.q.origin_upper_left = 1;
} else if (strcmp($1, "pixel_center_integer") == 0) {
got_one = true;
- $$.q.pixel_center_integer = 1;
+ $$.flags.q.pixel_center_integer = 1;
}
+ }
- if (state->ARB_fragment_coord_conventions_warn && got_one) {
- _mesa_glsl_warning(& @1, state,
- "GL_ARB_fragment_coord_conventions layout "
- "identifier `%s' used\n", $1);
+ /* If the identifier didn't match any known layout identifiers,
+ * emit an error.
+ */
+ if (!got_one) {
+ _mesa_glsl_error(& @1, state, "unrecognized layout identifier "
+ "`%s'\n", $1);
+ YYERROR;
+ } else if (state->ARB_fragment_coord_conventions_warn) {
+ _mesa_glsl_warning(& @1, state,
+ "GL_ARB_fragment_coord_conventions layout "
+ "identifier `%s' used\n", $1);
+ }
+ }
+ | IDENTIFIER '=' INTCONSTANT
+ {
+ bool got_one = false;
+
+ memset(& $$, 0, sizeof($$));
+
+ if (state->ARB_explicit_attrib_location_enable) {
+ /* FINISHME: Handle 'index' once GL_ARB_blend_func_exteneded and
+ * FINISHME: GLSL 1.30 (or later) are supported.
+ */
+ if (strcmp("location", $1) == 0) {
+ got_one = true;
+
+ $$.flags.q.explicit_location = 1;
+
+ if ($3 >= 0) {
+ $$.location = $3;
+ } else {
+ _mesa_glsl_error(& @3, state,
+ "invalid location %d specified\n", $3);
+ YYERROR;
+ }
}
}
/* If the identifier didn't match any known layout identifiers,
* emit an error.
*/
- if ($$.i == 0) {
+ if (!got_one) {
_mesa_glsl_error(& @1, state, "unrecognized layout identifier "
"`%s'\n", $1);
YYERROR;
+ } else if (state->ARB_explicit_attrib_location_warn) {
+ _mesa_glsl_warning(& @1, state,
+ "GL_ARB_explicit_attrib_location layout "
+ "identifier `%s' used\n", $1);
}
}
;
interpolation_qualifier:
- SMOOTH { $$.i = 0; $$.q.smooth = 1; }
- | FLAT { $$.i = 0; $$.q.flat = 1; }
- | NOPERSPECTIVE { $$.i = 0; $$.q.noperspective = 1; }
+ SMOOTH
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.smooth = 1;
+ }
+ | FLAT
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.flat = 1;
+ }
+ | NOPERSPECTIVE
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.noperspective = 1;
+ }
;
parameter_type_qualifier:
- CONST_TOK { $$.i = 0; $$.q.constant = 1; }
+ CONST_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.constant = 1;
+ }
;
type_qualifier:
storage_qualifier
- | interpolation_qualifier type_qualifier
+ | layout_qualifier
+ | layout_qualifier storage_qualifier
{
- $$.i = $1.i | $2.i;
+ $$ = $1;
+ $$.flags.i |= $2.flags.i;
}
- | INVARIANT type_qualifier
+ | interpolation_qualifier
+ | interpolation_qualifier storage_qualifier
+ {
+ $$ = $1;
+ $$.flags.i |= $2.flags.i;
+ }
+ | INVARIANT storage_qualifier
+ {
+ $$ = $2;
+ $$.flags.q.invariant = 1;
+ }
+ | INVARIANT interpolation_qualifier storage_qualifier
{
$$ = $2;
- $$.q.invariant = 1;
+ $$.flags.i |= $3.flags.i;
+ $$.flags.q.invariant = 1;
+ }
+ | INVARIANT
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.invariant = 1;
}
;
storage_qualifier:
- CONST_TOK { $$.i = 0; $$.q.constant = 1; }
- | ATTRIBUTE { $$.i = 0; $$.q.attribute = 1; }
- | opt_layout_qualifier VARYING { $$.i = $1.i; $$.q.varying = 1; }
- | CENTROID VARYING { $$.i = 0; $$.q.centroid = 1; $$.q.varying = 1; }
- | opt_layout_qualifier IN_TOK { $$.i = 0; $$.q.in = 1; }
- | OUT_TOK { $$.i = 0; $$.q.out = 1; }
- | CENTROID IN_TOK { $$.i = 0; $$.q.centroid = 1; $$.q.in = 1; }
- | CENTROID OUT_TOK { $$.i = 0; $$.q.centroid = 1; $$.q.out = 1; }
- | UNIFORM { $$.i = 0; $$.q.uniform = 1; }
+ CONST_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.constant = 1;
+ }
+ | ATTRIBUTE
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.attribute = 1;
+ }
+ | VARYING
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.varying = 1;
+ }
+ | CENTROID VARYING
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.centroid = 1;
+ $$.flags.q.varying = 1;
+ }
+ | IN_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.in = 1;
+ }
+ | OUT_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.out = 1;
+ }
+ | CENTROID IN_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.centroid = 1; $$.flags.q.in = 1;
+ }
+ | CENTROID OUT_TOK
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.centroid = 1; $$.flags.q.out = 1;
+ }
+ | UNIFORM
+ {
+ memset(& $$, 0, sizeof($$));
+ $$.flags.q.uniform = 1;
+ }
;
type_specifier:
extern "C" {
#include <talloc.h>
-#include "main/core.h" /* for struct __GLcontextRec */
+#include "main/core.h" /* for struct gl_context */
}
#include "ast.h"
#include "ir_optimization.h"
#include "loop_analysis.h"
-_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct __GLcontextRec *ctx,
+_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx,
GLenum target, void *mem_ctx)
{
switch (target) {
state->ARB_draw_buffers_enable = (ext_mode != extension_disable);
state->ARB_draw_buffers_warn = (ext_mode == extension_warn);
}
+ } else if (strcmp(name, "GL_ARB_explicit_attrib_location") == 0) {
+ state->ARB_explicit_attrib_location_enable =
+ (ext_mode != extension_disable);
+ state->ARB_explicit_attrib_location_warn =
+ (ext_mode == extension_warn);
+
+ unsupported = !state->extensions->ARB_explicit_attrib_location;
} else if (strcmp(name, "GL_ARB_fragment_coord_conventions") == 0) {
state->ARB_fragment_coord_conventions_enable =
(ext_mode != extension_disable);
state->EXT_texture_array_warn = (ext_mode == extension_warn);
unsupported = !state->extensions->EXT_texture_array;
+ } else if (strcmp(name, "GL_ARB_shader_stencil_export") == 0) {
+ if (state->target != fragment_shader) {
+ unsupported = true;
+ } else {
+ state->ARB_shader_stencil_export_enable = (ext_mode != extension_disable);
+ state->ARB_shader_stencil_export_warn = (ext_mode == extension_warn);
+ unsupported = !state->extensions->ARB_shader_stencil_export;
+ }
} else {
unsupported = true;
}
void
_mesa_ast_type_qualifier_print(const struct ast_type_qualifier *q)
{
- if (q->constant)
+ if (q->flags.q.constant)
printf("const ");
- if (q->invariant)
+ if (q->flags.q.invariant)
printf("invariant ");
- if (q->attribute)
+ if (q->flags.q.attribute)
printf("attribute ");
- if (q->varying)
+ if (q->flags.q.varying)
printf("varying ");
- if (q->in && q->out)
+ if (q->flags.q.in && q->flags.q.out)
printf("inout ");
else {
- if (q->in)
+ if (q->flags.q.in)
printf("in ");
- if (q->out)
+ if (q->flags.q.out)
printf("out ");
}
- if (q->centroid)
+ if (q->flags.q.centroid)
printf("centroid ");
- if (q->uniform)
+ if (q->flags.q.uniform)
printf("uniform ");
- if (q->smooth)
+ if (q->flags.q.smooth)
printf("smooth ");
- if (q->flat)
+ if (q->flags.q.flat)
printf("flat ");
- if (q->noperspective)
+ if (q->flags.q.noperspective)
printf("noperspective ");
}
ir_shader
};
-struct __GLcontextRec;
+struct gl_context;
struct _mesa_glsl_parse_state {
- _mesa_glsl_parse_state(struct __GLcontextRec *ctx, GLenum target,
+ _mesa_glsl_parse_state(struct gl_context *ctx, GLenum target,
void *mem_ctx);
/* Callers of this talloc-based new need not call delete. It's
/*@{*/
unsigned ARB_draw_buffers_enable:1;
unsigned ARB_draw_buffers_warn:1;
+ unsigned ARB_explicit_attrib_location_enable:1;
+ unsigned ARB_explicit_attrib_location_warn:1;
unsigned ARB_fragment_coord_conventions_enable:1;
unsigned ARB_fragment_coord_conventions_warn:1;
unsigned ARB_texture_rectangle_enable:1;
unsigned ARB_texture_rectangle_warn:1;
unsigned EXT_texture_array_enable:1;
unsigned EXT_texture_array_warn:1;
+ unsigned ARB_shader_stencil_export_enable:1;
+ unsigned ARB_shader_stencil_export_warn:1;
/*@}*/
/** Extensions supported by the OpenGL implementation. */
static const glsl_type *const int_type;
static const glsl_type *const ivec4_type;
static const glsl_type *const uint_type;
+ static const glsl_type *const uvec2_type;
+ static const glsl_type *const uvec3_type;
static const glsl_type *const uvec4_type;
static const glsl_type *const float_type;
static const glsl_type *const vec2_type;
1, /* ir_unop_ceil */
1, /* ir_unop_floor */
1, /* ir_unop_fract */
+ 1, /* ir_unop_round_even */
1, /* ir_unop_sin */
1, /* ir_unop_cos */
"ceil",
"floor",
"fract",
+ "round_even",
"sin",
"cos",
"dFdx",
this->ir_type = ir_type_variable;
this->type = type;
this->name = talloc_strdup(this, name);
+ this->explicit_location = false;
this->location = -1;
this->warn_extension = NULL;
this->constant_value = NULL;
unsigned pixel_center_integer:1;
/*@}*/
+ /**
+ * Was the location explicitly set in the shader?
+ *
+ * If the location is explicitly set in the shader, it \b cannot be changed
+ * by the linker or by the API (e.g., calls to \c glBindAttribLocation have
+ * no effect).
+ */
+ unsigned explicit_location:1;
+
/**
* Storage location of the base of this variable
*
ir_unop_ceil,
ir_unop_floor,
ir_unop_fract,
+ ir_unop_round_even,
/*@}*/
/**
var->warn_extension = this->warn_extension;
var->origin_upper_left = this->origin_upper_left;
var->pixel_center_integer = this->pixel_center_integer;
+ var->explicit_location = this->explicit_location;
+ if (this->explicit_location)
+ var->location = this->location;
if (this->constant_value)
var->constant_value = this->constant_value->clone(mem_ctx, ht);
}
switch (this->operation) {
+ case ir_unop_bit_not:
+ switch (op[0]->type->base_type) {
+ case GLSL_TYPE_INT:
+ for (unsigned c = 0; c < components; c++)
+ data.i[c] = ~ op[0]->value.i[c];
+ break;
+ case GLSL_TYPE_UINT:
+ for (unsigned c = 0; c < components; c++)
+ data.u[c] = ~ op[0]->value.u[c];
+ break;
+ default:
+ assert(0);
+ }
+ break;
+
case ir_unop_logic_not:
assert(op[0]->type->base_type == GLSL_TYPE_BOOL);
for (unsigned c = 0; c < op[0]->type->components(); c++)
data.b[0] = !op[0]->has_value(op[1]);
break;
+ case ir_binop_lshift:
+ for (unsigned c = 0, c0 = 0, c1 = 0;
+ c < components;
+ c0 += c0_inc, c1 += c1_inc, c++) {
+
+ if (op[0]->type->base_type == GLSL_TYPE_INT &&
+ op[1]->type->base_type == GLSL_TYPE_INT) {
+ data.i[c] = op[0]->value.i[c0] << op[1]->value.i[c1];
+
+ } else if (op[0]->type->base_type == GLSL_TYPE_INT &&
+ op[1]->type->base_type == GLSL_TYPE_UINT) {
+ data.i[c] = op[0]->value.i[c0] << op[1]->value.u[c1];
+
+ } else if (op[0]->type->base_type == GLSL_TYPE_UINT &&
+ op[1]->type->base_type == GLSL_TYPE_INT) {
+ data.u[c] = op[0]->value.u[c0] << op[1]->value.i[c1];
+
+ } else if (op[0]->type->base_type == GLSL_TYPE_UINT &&
+ op[1]->type->base_type == GLSL_TYPE_UINT) {
+ data.u[c] = op[0]->value.u[c0] << op[1]->value.u[c1];
+ }
+ }
+ break;
+
+ case ir_binop_rshift:
+ for (unsigned c = 0, c0 = 0, c1 = 0;
+ c < components;
+ c0 += c0_inc, c1 += c1_inc, c++) {
+
+ if (op[0]->type->base_type == GLSL_TYPE_INT &&
+ op[1]->type->base_type == GLSL_TYPE_INT) {
+ data.i[c] = op[0]->value.i[c0] >> op[1]->value.i[c1];
+
+ } else if (op[0]->type->base_type == GLSL_TYPE_INT &&
+ op[1]->type->base_type == GLSL_TYPE_UINT) {
+ data.i[c] = op[0]->value.i[c0] >> op[1]->value.u[c1];
+
+ } else if (op[0]->type->base_type == GLSL_TYPE_UINT &&
+ op[1]->type->base_type == GLSL_TYPE_INT) {
+ data.u[c] = op[0]->value.u[c0] >> op[1]->value.i[c1];
+
+ } else if (op[0]->type->base_type == GLSL_TYPE_UINT &&
+ op[1]->type->base_type == GLSL_TYPE_UINT) {
+ data.u[c] = op[0]->value.u[c0] >> op[1]->value.u[c1];
+ }
+ }
+ break;
+
+ case ir_binop_bit_and:
+ for (unsigned c = 0, c0 = 0, c1 = 0;
+ c < components;
+ c0 += c0_inc, c1 += c1_inc, c++) {
+
+ switch (op[0]->type->base_type) {
+ case GLSL_TYPE_INT:
+ data.i[c] = op[0]->value.i[c0] & op[1]->value.i[c1];
+ break;
+ case GLSL_TYPE_UINT:
+ data.u[c] = op[0]->value.u[c0] & op[1]->value.u[c1];
+ break;
+ default:
+ assert(0);
+ }
+ }
+ break;
+
+ case ir_binop_bit_or:
+ for (unsigned c = 0, c0 = 0, c1 = 0;
+ c < components;
+ c0 += c0_inc, c1 += c1_inc, c++) {
+
+ switch (op[0]->type->base_type) {
+ case GLSL_TYPE_INT:
+ data.i[c] = op[0]->value.i[c0] | op[1]->value.i[c1];
+ break;
+ case GLSL_TYPE_UINT:
+ data.u[c] = op[0]->value.u[c0] | op[1]->value.u[c1];
+ break;
+ default:
+ assert(0);
+ }
+ }
+ break;
+
+ case ir_binop_bit_xor:
+ for (unsigned c = 0, c0 = 0, c1 = 0;
+ c < components;
+ c0 += c0_inc, c1 += c1_inc, c++) {
+
+ switch (op[0]->type->base_type) {
+ case GLSL_TYPE_INT:
+ data.i[c] = op[0]->value.i[c0] ^ op[1]->value.i[c1];
+ break;
+ case GLSL_TYPE_UINT:
+ data.u[c] = op[0]->value.u[c0] ^ op[1]->value.u[c1];
+ break;
+ default:
+ assert(0);
+ }
+ }
+ break;
+
default:
/* FINISHME: Should handle all expression types. */
return NULL;
*/
const unsigned mat_idx = column * column_type->vector_elements;
- ir_constant_data data;
+ ir_constant_data data = { { 0 } };
switch (column_type->base_type) {
case GLSL_TYPE_UINT:
/*
- * Constantright © 2010 Intel Corporation
+ * Copyright © 2010 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* constant of this software and associated documentation files (the "Software"),
} else {
parameters[i] = sig_param->clone(ctx, ht);
parameters[i]->mode = ir_var_auto;
+
+ /* Remove the read-only decoration becuase we're going to write
+ * directly to this variable. If the cloned variable is left
+ * read-only and the inlined function is inside a loop, the loop
+ * analysis code will get confused.
+ */
+ parameters[i]->read_only = false;
next_ir->insert_before(parameters[i]);
}
bool do_explog_to_explog2(exec_list *instructions);
bool do_function_inlining(exec_list *instructions);
bool do_lower_jumps(exec_list *instructions, bool pull_out_jumps = true, bool lower_sub_return = true, bool lower_main_return = false, bool lower_continue = false, bool lower_break = false);
+bool do_lower_texture_projection(exec_list *instructions);
bool do_if_simplification(exec_list *instructions);
bool do_if_to_cond_assign(exec_list *instructions);
bool do_mat_op_to_vec(exec_list *instructions);
break;
case ir_unop_trunc:
+ case ir_unop_round_even:
case ir_unop_ceil:
case ir_unop_floor:
case ir_unop_fract:
case ir_binop_lshift:
case ir_binop_rshift:
+ assert(ir->operands[0]->type->is_integer() &&
+ ir->operands[1]->type->is_integer());
+ if (ir->operands[0]->type->is_scalar()) {
+ assert(ir->operands[1]->type->is_scalar());
+ }
+ if (ir->operands[0]->type->is_vector() &&
+ ir->operands[1]->type->is_vector()) {
+ assert(ir->operands[0]->type->components() ==
+ ir->operands[1]->type->components());
+ }
+ assert(ir->type == ir->operands[0]->type);
+ break;
+
case ir_binop_bit_and:
case ir_binop_bit_xor:
case ir_binop_bit_or:
- assert(ir->operands[0]->type == ir->operands[1]->type);
- assert(ir->type == ir->operands[0]->type);
- assert(ir->type->base_type == GLSL_TYPE_INT ||
- ir->type->base_type == GLSL_TYPE_UINT);
- break;
+ assert(ir->operands[0]->type->base_type ==
+ ir->operands[1]->type->base_type);
+ assert(ir->type->is_integer());
+ if (ir->operands[0]->type->is_vector() &&
+ ir->operands[1]->type->is_vector()) {
+ assert(ir->operands[0]->type->vector_elements ==
+ ir->operands[1]->type->vector_elements);
+ }
+ break;
case ir_binop_logic_and:
case ir_binop_logic_xor:
}
var->location = slot;
+ var->explicit_location = (slot >= 0);
/* Once the variable is created an initialized, add it to the symbol table
* and add the declaration to the IR stream.
}
}
+static void
+generate_ARB_shader_stencil_export_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool warn)
+{
+ /* gl_FragStencilRefARB is only available in the fragment shader.
+ */
+ ir_variable *const fd =
+ add_variable("gl_FragStencilRefARB", ir_var_out, FRAG_RESULT_STENCIL,
+ glsl_type::int_type, instructions, state->symbols);
+
+ if (warn)
+ fd->warn_extension = "GL_ARB_shader_stencil_export";
+}
static void
generate_120_fs_variables(exec_list *instructions,
generate_130_fs_variables(instructions, state);
break;
}
+
+ if (state->ARB_shader_stencil_export_enable)
+ generate_ARB_shader_stencil_export_variables(instructions, state,
+ state->ARB_shader_stencil_export_warn);
}
void
#include "linker.h"
#include "ir_optimization.h"
+extern "C" {
+#include "main/shaderobj.h"
+}
+
/**
* Visitor that determines whether or not a variable is ever written.
*/
/* Only assign locations for generic attributes / varyings / etc.
*/
- if (var->location >= generic_base)
+ if ((var->location >= generic_base) && !var->explicit_location)
var->location = -1;
}
}
*/
glsl_symbol_table variables;
for (unsigned i = 0; i < num_shaders; i++) {
+ if (shader_list[i] == NULL)
+ continue;
+
foreach_list(node, shader_list[i]->ir) {
ir_variable *const var = ((ir_instruction *) node)->as_variable();
}
}
+ if (var->explicit_location) {
+ if (existing->explicit_location
+ && (var->location != existing->location)) {
+ linker_error_printf(prog, "explicit locations for %s "
+ "`%s' have differing values\n",
+ mode_string(var), var->name);
+ return false;
+ }
+
+ existing->location = var->location;
+ existing->explicit_location = true;
+ }
+
/* FINISHME: Handle non-constant initializers.
*/
if (var->constant_value != NULL) {
cross_validate_uniforms(struct gl_shader_program *prog)
{
return cross_validate_globals(prog, prog->_LinkedShaders,
- prog->_NumLinkedShaders, true);
+ MESA_SHADER_TYPES, true);
}
* shader is returned.
*/
static struct gl_shader *
-link_intrastage_shaders(GLcontext *ctx,
+link_intrastage_shaders(struct gl_context *ctx,
struct gl_shader_program *prog,
struct gl_shader **shader_list,
unsigned num_shaders)
return NULL;
}
- gl_shader *const linked = ctx->Driver.NewShader(NULL, 0, main->Type);
+ gl_shader *linked = ctx->Driver.NewShader(NULL, 0, main->Type);
linked->ir = new(linked) exec_list;
clone_ir_list(linked, linked->ir, main->ir);
assert(idx == num_linking_shaders);
- link_function_calls(prog, linked, linking_shaders, num_linking_shaders);
+ if (!link_function_calls(prog, linked, linking_shaders,
+ num_linking_shaders)) {
+ ctx->Driver.DeleteShader(ctx, linked);
+ linked = NULL;
+ }
free(linking_shaders);
*/
static void
-update_uniform_array_sizes(struct gl_shader_program *prog)
+update_array_sizes(struct gl_shader_program *prog)
{
- for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
+ for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+ if (prog->_LinkedShaders[i] == NULL)
+ continue;
+
foreach_list(node, prog->_LinkedShaders[i]->ir) {
ir_variable *const var = ((ir_instruction *) node)->as_variable();
- if ((var == NULL) || (var->mode != ir_var_uniform) ||
+ if ((var == NULL) || (var->mode != ir_var_uniform &&
+ var->mode != ir_var_in &&
+ var->mode != ir_var_out) ||
!var->type->is_array())
continue;
unsigned int size = var->max_array_access;
- for (unsigned j = 0; j < prog->_NumLinkedShaders; j++) {
+ for (unsigned j = 0; j < MESA_SHADER_TYPES; j++) {
+ if (prog->_LinkedShaders[j] == NULL)
+ continue;
+
foreach_list(node2, prog->_LinkedShaders[j]->ir) {
ir_variable *other_var = ((ir_instruction *) node2)->as_variable();
if (!other_var)
}
}
}
+
if (size + 1 != var->type->fields.array->length) {
var->type = glsl_type::get_array_instance(var->type->fields.array,
size + 1);
hash_table_string_compare);
void *mem_ctx = talloc_new(NULL);
- update_uniform_array_sizes(prog);
+ for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+ if (prog->_LinkedShaders[i] == NULL)
+ continue;
- for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
unsigned next_position = 0;
foreach_list(node, prog->_LinkedShaders[i]->ir) {
if ((var == NULL) || (var->mode != ir_var_in))
continue;
+ if (var->explicit_location) {
+ const unsigned slots = count_attribute_slots(var->type);
+ const unsigned use_mask = (1 << slots) - 1;
+ const int attr = var->location - VERT_ATTRIB_GENERIC0;
+
+ if ((var->location >= (int)(max_attribute_index + VERT_ATTRIB_GENERIC0))
+ || (var->location < 0)) {
+ linker_error_printf(prog,
+ "invalid explicit location %d specified for "
+ "`%s'\n",
+ (var->location < 0) ? var->location : attr,
+ var->name);
+ return false;
+ } else if (var->location >= VERT_ATTRIB_GENERIC0) {
+ used_locations |= (use_mask << attr);
+ }
+ }
+
/* The location was explicitly assigned, nothing to do here.
*/
if (var->location != -1)
/**
- * Demote shader outputs that are not read to being just plain global variables
+ * Demote shader inputs and outputs that are not used in other stages
*/
void
-demote_unread_shader_outputs(gl_shader *sh)
+demote_shader_inputs_and_outputs(gl_shader *sh, enum ir_variable_mode mode)
{
foreach_list(node, sh->ir) {
ir_variable *const var = ((ir_instruction *) node)->as_variable();
- if ((var == NULL) || (var->mode != ir_var_out))
+ if ((var == NULL) || (var->mode != int(mode)))
continue;
- /* An 'out' variable is only really a shader output if its value is read
- * by the following stage.
+ /* A shader 'in' or 'out' variable is only really an input or output if
+ * its value is used by other shader stages. This will cause the variable
+ * to have a location assigned.
*/
if (var->location == -1) {
var->mode = ir_var_auto;
}
}
- demote_unread_shader_outputs(producer);
-
foreach_list(node, consumer->ir) {
ir_variable *const var = ((ir_instruction *) node)->as_variable();
void
-link_shaders(GLcontext *ctx, struct gl_shader_program *prog)
+link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
{
prog->LinkStatus = false;
prog->Validated = false;
prog->Version = max_version;
- for (unsigned int i = 0; i < prog->_NumLinkedShaders; i++) {
- ctx->Driver.DeleteShader(ctx, prog->_LinkedShaders[i]);
+ for (unsigned int i = 0; i < MESA_SHADER_TYPES; i++) {
+ if (prog->_LinkedShaders[i] != NULL)
+ ctx->Driver.DeleteShader(ctx, prog->_LinkedShaders[i]);
+
+ prog->_LinkedShaders[i] = NULL;
}
/* Link all shaders for a particular stage and validate the result.
*/
- prog->_NumLinkedShaders = 0;
if (num_vert_shaders > 0) {
gl_shader *const sh =
link_intrastage_shaders(ctx, prog, vert_shader_list, num_vert_shaders);
goto done;
if (!validate_vertex_shader_executable(prog, sh))
- goto done;
+ goto done;
- prog->_LinkedShaders[prog->_NumLinkedShaders] = sh;
- prog->_NumLinkedShaders++;
+ _mesa_reference_shader(ctx, &prog->_LinkedShaders[MESA_SHADER_VERTEX],
+ sh);
}
if (num_frag_shaders > 0) {
goto done;
if (!validate_fragment_shader_executable(prog, sh))
- goto done;
+ goto done;
- prog->_LinkedShaders[prog->_NumLinkedShaders] = sh;
- prog->_NumLinkedShaders++;
+ _mesa_reference_shader(ctx, &prog->_LinkedShaders[MESA_SHADER_FRAGMENT],
+ sh);
}
/* Here begins the inter-stage linking phase. Some initial validation is
* varyings.
*/
if (cross_validate_uniforms(prog)) {
+ unsigned prev;
+
+ for (prev = 0; prev < MESA_SHADER_TYPES; prev++) {
+ if (prog->_LinkedShaders[prev] != NULL)
+ break;
+ }
+
/* Validate the inputs of each stage with the output of the preceeding
* stage.
*/
- for (unsigned i = 1; i < prog->_NumLinkedShaders; i++) {
+ for (unsigned i = prev + 1; i < MESA_SHADER_TYPES; i++) {
+ if (prog->_LinkedShaders[i] == NULL)
+ continue;
+
if (!cross_validate_outputs_to_inputs(prog,
- prog->_LinkedShaders[i - 1],
+ prog->_LinkedShaders[prev],
prog->_LinkedShaders[i]))
goto done;
+
+ prev = i;
}
prog->LinkStatus = true;
* uniforms, and varyings. Later optimization could possibly make
* some of that unused.
*/
- for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
+ for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+ if (prog->_LinkedShaders[i] == NULL)
+ continue;
+
while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, 32))
;
}
+ update_array_sizes(prog);
+
assign_uniform_locations(prog);
- if (prog->_NumLinkedShaders && prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) {
+ if (prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL) {
/* FINISHME: The value of the max_attribute_index parameter is
* FINISHME: implementation dependent based on the value of
* FINISHME: GL_MAX_VERTEX_ATTRIBS. GL_MAX_VERTEX_ATTRIBS must be
* FINISHME: at least 16, so hardcode 16 for now.
*/
- if (!assign_attribute_locations(prog, 16))
+ if (!assign_attribute_locations(prog, 16)) {
+ prog->LinkStatus = false;
goto done;
+ }
+ }
- if (prog->_NumLinkedShaders == 1)
- demote_unread_shader_outputs(prog->_LinkedShaders[0]);
+ unsigned prev;
+ for (prev = 0; prev < MESA_SHADER_TYPES; prev++) {
+ if (prog->_LinkedShaders[prev] != NULL)
+ break;
}
- for (unsigned i = 1; i < prog->_NumLinkedShaders; i++)
+ for (unsigned i = prev + 1; i < MESA_SHADER_TYPES; i++) {
+ if (prog->_LinkedShaders[i] == NULL)
+ continue;
+
assign_varying_locations(prog,
- prog->_LinkedShaders[i - 1],
+ prog->_LinkedShaders[prev],
prog->_LinkedShaders[i]);
+ prev = i;
+ }
+
+ if (prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL) {
+ demote_shader_inputs_and_outputs(prog->_LinkedShaders[MESA_SHADER_VERTEX],
+ ir_var_out);
+ }
+
+ if (prog->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL) {
+ gl_shader *const sh = prog->_LinkedShaders[MESA_SHADER_GEOMETRY];
+
+ demote_shader_inputs_and_outputs(sh, ir_var_in);
+ demote_shader_inputs_and_outputs(sh, ir_var_inout);
+ demote_shader_inputs_and_outputs(sh, ir_var_out);
+ }
+
+ if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] != NULL) {
+ gl_shader *const sh = prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
+
+ demote_shader_inputs_and_outputs(sh, ir_var_in);
+ }
/* FINISHME: Assign fragment shader output locations. */
/* Don't try to unroll loops that have zillions of iterations either.
*/
- if (iterations > max_iterations)
+ if (iterations > (int) max_iterations)
return visit_continue;
if (ls->num_loop_jumps > 1)
--- /dev/null
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file lower_texture_projection.cpp
+ *
+ * IR lower pass to perform the division of texture coordinates by the texture
+ * projector if present.
+ *
+ * Many GPUs have a texture sampling opcode that takes the projector
+ * and does the divide internally, thus the presence of the projector
+ * in the IR. For GPUs that don't, this saves the driver needing the
+ * logic for handling the divide.
+ *
+ * \author Eric Anholt <eric@anholt.net>
+ */
+
+#include "ir.h"
+
+class lower_texture_projection_visitor : public ir_hierarchical_visitor {
+public:
+ lower_texture_projection_visitor()
+ {
+ progress = false;
+ }
+
+ ir_visitor_status visit_leave(ir_texture *ir);
+
+ bool progress;
+};
+
+ir_visitor_status
+lower_texture_projection_visitor::visit_leave(ir_texture *ir)
+{
+ if (!ir->projector)
+ return visit_continue;
+
+ void *mem_ctx = talloc_parent(ir);
+
+ ir_variable *var = new(mem_ctx) ir_variable(ir->projector->type,
+ "projector", ir_var_auto);
+ base_ir->insert_before(var);
+ ir_dereference *deref = new(mem_ctx) ir_dereference_variable(var);
+ ir_expression *expr = new(mem_ctx) ir_expression(ir_unop_rcp,
+ ir->projector->type,
+ ir->projector,
+ NULL);
+ ir_assignment *assign = new(mem_ctx) ir_assignment(deref, expr, NULL);
+ base_ir->insert_before(assign);
+
+ deref = new(mem_ctx) ir_dereference_variable(var);
+ ir->coordinate = new(mem_ctx) ir_expression(ir_binop_mul,
+ ir->coordinate->type,
+ ir->coordinate,
+ deref);
+
+ if (ir->shadow_comparitor) {
+ deref = new(mem_ctx) ir_dereference_variable(var);
+ ir->shadow_comparitor = new(mem_ctx) ir_expression(ir_binop_mul,
+ ir->shadow_comparitor->type,
+ ir->shadow_comparitor,
+ deref);
+ }
+
+ ir->projector = NULL;
+
+ progress = true;
+ return visit_continue;
+}
+
+bool
+do_lower_texture_projection(exec_list *instructions)
+{
+ lower_texture_projection_visitor v;
+
+ visit_list_elements(&v, instructions);
+
+ return v.progress;
+}
#include "loop_analysis.h"
extern "C" struct gl_shader *
-_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
+_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
+
+extern "C" void
+_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
+ struct gl_shader *sh);
/* Copied from shader_api.c for the stand-alone compiler.
*/
+void
+_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
+ struct gl_shader *sh)
+{
+ *ptr = sh;
+}
+
struct gl_shader *
-_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type)
+_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
{
struct gl_shader *shader;
}
static void
-initialize_context(GLcontext *ctx, gl_api api)
+initialize_context(struct gl_context *ctx, gl_api api)
{
memset(ctx, 0, sizeof(*ctx));
};
void
-compile_shader(GLcontext *ctx, struct gl_shader *shader)
+compile_shader(struct gl_context *ctx, struct gl_shader *shader)
{
struct _mesa_glsl_parse_state *state =
new(shader) _mesa_glsl_parse_state(ctx, shader->Type, shader);
main(int argc, char **argv)
{
int status = EXIT_SUCCESS;
- GLcontext local_ctx;
- GLcontext *ctx = &local_ctx;
+ struct gl_context local_ctx;
+ struct gl_context *ctx = &local_ctx;
int c;
int idx = 0;
printf("Info log for linking:\n%s\n", whole_program->InfoLog);
}
- for (unsigned i = 0; i < whole_program->_NumLinkedShaders; i++)
+ for (unsigned i = 0; i < MESA_SHADER_TYPES; i++)
talloc_free(whole_program->_LinkedShaders[i]);
talloc_free(whole_program);
#include "main/core.h"
extern void
-link_shaders(GLcontext *ctx, struct gl_shader_program *prog);
+link_shaders(struct gl_context *ctx, struct gl_shader_program *prog);
GLU_MAJOR = 1
GLU_MINOR = 3
-GLU_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
+GLU_TINY = 0$(MESA_MAJOR)$(MESA_MINOR)0$(MESA_TINY)
INCDIRS = -I$(TOP)/include -Iinclude -Iinternals -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess
case GL_RGB:
case GL_BGR:
return 3;
+ case GL_RG:
case GL_422_EXT:
case GL_422_REV_EXT:
case GL_422_AVERAGE_EXT:
if (__glxHashLookup(priv->drawHash,
gc->currentDrawable, (void *) &pdraw) == 0) {
- if (pdraw->drawable == pdraw->xDrawable)
+ if (pdraw->drawable == pdraw->xDrawable) {
(*pdraw->destroyDrawable)(pdraw);
- __glxHashDelete(priv->drawHash, gc->currentDrawable);
+ __glxHashDelete(priv->drawHash, gc->currentDrawable);
+ }
}
if (gc->currentDrawable != gc->currentReadable &&
__glxHashLookup(priv->drawHash,
gc->currentReadable, (void *) &pdraw) == 0) {
- if (pdraw->drawable == pdraw->xDrawable)
+ if (pdraw->drawable == pdraw->xDrawable) {
(*pdraw->destroyDrawable)(pdraw);
- __glxHashDelete(priv->drawHash, gc->currentReadable);
+ __glxHashDelete(priv->drawHash, gc->currentReadable);
+ }
}
}
typedef struct __GLXDRIscreenRec __GLXDRIscreen;
typedef struct __GLXDRIdrawableRec __GLXDRIdrawable;
-#include "glxextensions.h"
-
struct __GLXDRIdisplayRec
{
/**
{ GL(ARB_texture_mirrored_repeat), VER(1,4), Y, N, N, N },
{ GL(ARB_texture_non_power_of_two), VER(1,5), Y, N, N, N },
{ GL(ARB_texture_rectangle), VER(0,0), Y, N, N, N },
+ { GL(ARB_texture_rg), VER(0,0), Y, N, N, N },
{ GL(ARB_transpose_matrix), VER(1,3), Y, N, Y, N },
{ GL(ARB_vertex_buffer_object), VER(1,5), N, N, N, N },
{ GL(ARB_vertex_program), VER(0,0), Y, N, N, N },
GL_ARB_texture_mirrored_repeat_bit,
GL_ARB_texture_non_power_of_two_bit,
GL_ARB_texture_rectangle_bit,
+ GL_ARB_texture_rg_bit,
GL_ARB_transpose_matrix_bit,
GL_ARB_vertex_buffer_object_bit,
GL_ARB_vertex_program_bit,
_GLAPI_EXPORT extern const void *_glapi_Context;
# define GET_DISPATCH() _glapi_tls_Dispatch
-# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_tls_Context
+# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_tls_Context
#else
# define GET_DISPATCH() \
(likely(_glapi_Dispatch) ? _glapi_Dispatch : _glapi_get_dispatch())
-# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) \
+# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) \
(likely(_glapi_Context) ? _glapi_Context : _glapi_get_context())
# else
# define GET_DISPATCH() _glapi_Dispatch
-# define GET_CURRENT_CONTEXT(C) GLcontext *C = (GLcontext *) _glapi_Context
+# define GET_CURRENT_CONTEXT(C) struct gl_context *C = (struct gl_context *) _glapi_Context
# endif
void
entry_patch(mapi_func entry, int slot)
{
- void *code = (void *) entry;
+ char *code = (char *) entry;
*((unsigned int *) (code + 12)) = slot * sizeof(mapi_func);
}
void
entry_patch(mapi_func entry, int slot)
{
- void *code = (void *) entry;
+ char *code = (char *) entry;
*((unsigned long *) (code + 8)) = slot * sizeof(mapi_func);
}
void
entry_patch(mapi_func entry, int slot)
{
- void *code = (void *) entry;
+ char *code = (char *) entry;
*((unsigned long *) (code + 11)) = slot * sizeof(mapi_func);
*((unsigned long *) (code + 22)) = slot * sizeof(mapi_func);
ES2_CPPFLAGS := -DFEATURE_ES2=1 $(DEFINES)
# append include dirs
-MESA_CPPFLAGS += $(INCLUDE_DIRS)
+MESA_CPPFLAGS += $(INCLUDE_DIRS) $(TALLOC_CFLAGS)
ES1_CPPFLAGS += -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS)
ES2_CPPFLAGS += -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS)
'program/prog_statevars.c',
'program/prog_uniform.c',
'program/programopt.c',
+ 'program/sampler.cpp',
'program/symbol_table.c',
]
MesaDriver();
~MesaDriver();
- void Init(BGLView * bglview, GLcontext * c, GLvisual * v, GLframebuffer * b);
+ void Init(BGLView * bglview, struct gl_context * c, struct gl_config * v, struct gl_framebuffer * b);
void LockGL();
void UnlockGL();
MesaDriver(const MesaDriver &rhs); // copy constructor illegal
MesaDriver &operator=(const MesaDriver &rhs); // assignment oper. illegal
- GLcontext * m_glcontext;
- GLvisual * m_glvisual;
- GLframebuffer * m_glframebuffer;
+ struct gl_context * m_glcontext;
+ struct gl_config * m_glvisual;
+ struct gl_framebuffer * m_glframebuffer;
BGLView * m_bglview;
BBitmap * m_bitmap;
GLuint m_height;
// Mesa Device Driver callback functions
- static void UpdateState(GLcontext *ctx, GLuint new_state);
- static void ClearIndex(GLcontext *ctx, GLuint index);
- static void ClearColor(GLcontext *ctx, const GLfloat color[4]);
- static void Clear(GLcontext *ctx, GLbitfield mask,
+ static void UpdateState(struct gl_context *ctx, GLuint new_state);
+ static void ClearIndex(struct gl_context *ctx, GLuint index);
+ static void ClearColor(struct gl_context *ctx, const GLfloat color[4]);
+ static void Clear(struct gl_context *ctx, GLbitfield mask,
GLboolean all, GLint x, GLint y,
GLint width, GLint height);
- static void ClearFront(GLcontext *ctx, GLboolean all, GLint x, GLint y,
+ static void ClearFront(struct gl_context *ctx, GLboolean all, GLint x, GLint y,
GLint width, GLint height);
- static void ClearBack(GLcontext *ctx, GLboolean all, GLint x, GLint y,
+ static void ClearBack(struct gl_context *ctx, GLboolean all, GLint x, GLint y,
GLint width, GLint height);
- static void Index(GLcontext *ctx, GLuint index);
- static void Color(GLcontext *ctx, GLubyte r, GLubyte g,
+ static void Index(struct gl_context *ctx, GLuint index);
+ static void Color(struct gl_context *ctx, GLubyte r, GLubyte g,
GLubyte b, GLubyte a);
- static void SetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
+ static void SetBuffer(struct gl_context *ctx, struct gl_framebuffer *colorBuffer,
GLenum mode);
- static void GetBufferSize(GLframebuffer * framebuffer, GLuint *width,
+ static void GetBufferSize(struct gl_framebuffer * framebuffer, GLuint *width,
GLuint *height);
- static void Error(GLcontext *ctx);
- static const GLubyte * GetString(GLcontext *ctx, GLenum name);
- static void Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
+ static void Error(struct gl_context *ctx);
+ static const GLubyte * GetString(struct gl_context *ctx, GLenum name);
+ static void Viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
// Front-buffer functions
- static void WriteRGBASpanFront(const GLcontext *ctx, GLuint n,
+ static void WriteRGBASpanFront(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
CONST GLubyte rgba[][4],
const GLubyte mask[]);
- static void WriteRGBSpanFront(const GLcontext *ctx, GLuint n,
+ static void WriteRGBSpanFront(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
CONST GLubyte rgba[][3],
const GLubyte mask[]);
- static void WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n,
+ static void WriteMonoRGBASpanFront(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
const GLchan color[4],
const GLubyte mask[]);
- static void WriteRGBAPixelsFront(const GLcontext *ctx, GLuint n,
+ static void WriteRGBAPixelsFront(const struct gl_context *ctx, GLuint n,
const GLint x[], const GLint y[],
CONST GLubyte rgba[][4],
const GLubyte mask[]);
- static void WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n,
+ static void WriteMonoRGBAPixelsFront(const struct gl_context *ctx, GLuint n,
const GLint x[], const GLint y[],
const GLchan color[4],
const GLubyte mask[]);
- static void WriteCI32SpanFront(const GLcontext *ctx, GLuint n,
+ static void WriteCI32SpanFront(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
const GLuint index[], const GLubyte mask[]);
- static void WriteCI8SpanFront(const GLcontext *ctx, GLuint n,
+ static void WriteCI8SpanFront(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
const GLubyte index[], const GLubyte mask[]);
- static void WriteMonoCISpanFront(const GLcontext *ctx, GLuint n,
+ static void WriteMonoCISpanFront(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
GLuint colorIndex, const GLubyte mask[]);
- static void WriteCI32PixelsFront(const GLcontext *ctx,
+ static void WriteCI32PixelsFront(const struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[]);
- static void WriteMonoCIPixelsFront(const GLcontext *ctx, GLuint n,
+ static void WriteMonoCIPixelsFront(const struct gl_context *ctx, GLuint n,
const GLint x[], const GLint y[],
GLuint colorIndex, const GLubyte mask[]);
- static void ReadCI32SpanFront(const GLcontext *ctx,
+ static void ReadCI32SpanFront(const struct gl_context *ctx,
GLuint n, GLint x, GLint y, GLuint index[]);
- static void ReadRGBASpanFront(const GLcontext *ctx, GLuint n,
+ static void ReadRGBASpanFront(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
GLubyte rgba[][4]);
- static void ReadCI32PixelsFront(const GLcontext *ctx,
+ static void ReadCI32PixelsFront(const struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
GLuint indx[], const GLubyte mask[]);
- static void ReadRGBAPixelsFront(const GLcontext *ctx,
+ static void ReadRGBAPixelsFront(const struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[]);
// Back buffer functions
- static void WriteRGBASpanBack(const GLcontext *ctx, GLuint n,
+ static void WriteRGBASpanBack(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
CONST GLubyte rgba[][4],
const GLubyte mask[]);
- static void WriteRGBSpanBack(const GLcontext *ctx, GLuint n,
+ static void WriteRGBSpanBack(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
CONST GLubyte rgba[][3],
const GLubyte mask[]);
- static void WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n,
+ static void WriteMonoRGBASpanBack(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
const GLchan color[4],
const GLubyte mask[]);
- static void WriteRGBAPixelsBack(const GLcontext *ctx, GLuint n,
+ static void WriteRGBAPixelsBack(const struct gl_context *ctx, GLuint n,
const GLint x[], const GLint y[],
CONST GLubyte rgba[][4],
const GLubyte mask[]);
- static void WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n,
+ static void WriteMonoRGBAPixelsBack(const struct gl_context *ctx, GLuint n,
const GLint x[], const GLint y[],
const GLchan color[4],
const GLubyte mask[]);
- static void WriteCI32SpanBack(const GLcontext *ctx, GLuint n,
+ static void WriteCI32SpanBack(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
const GLuint index[], const GLubyte mask[]);
- static void WriteCI8SpanBack(const GLcontext *ctx, GLuint n, GLint x, GLint y,
+ static void WriteCI8SpanBack(const struct gl_context *ctx, GLuint n, GLint x, GLint y,
const GLubyte index[], const GLubyte mask[]);
- static void WriteMonoCISpanBack(const GLcontext *ctx, GLuint n,
+ static void WriteMonoCISpanBack(const struct gl_context *ctx, GLuint n,
GLint x, GLint y, GLuint colorIndex,
const GLubyte mask[]);
- static void WriteCI32PixelsBack(const GLcontext *ctx,
+ static void WriteCI32PixelsBack(const struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[]);
- static void WriteMonoCIPixelsBack(const GLcontext *ctx,
+ static void WriteMonoCIPixelsBack(const struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
GLuint colorIndex, const GLubyte mask[]);
- static void ReadCI32SpanBack(const GLcontext *ctx,
+ static void ReadCI32SpanBack(const struct gl_context *ctx,
GLuint n, GLint x, GLint y, GLuint index[]);
- static void ReadRGBASpanBack(const GLcontext *ctx, GLuint n,
+ static void ReadRGBASpanBack(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
GLubyte rgba[][4]);
- static void ReadCI32PixelsBack(const GLcontext *ctx,
+ static void ReadCI32PixelsBack(const struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
GLuint indx[], const GLubyte mask[]);
- static void ReadRGBAPixelsBack(const GLcontext *ctx,
+ static void ReadRGBAPixelsBack(const struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[]);
MesaDriver * md = new MesaDriver();
// examine option flags and create gl_context struct
- GLvisual * visual = _mesa_create_visual( dblFlag,
+ struct gl_config * visual = _mesa_create_visual( dblFlag,
stereoFlag,
red, green, blue, alpha,
depth,
functions.Viewport = md->Viewport;
// create core context
- GLcontext *ctx = _mesa_create_context(visual, NULL, &functions, md);
+ struct gl_context *ctx = _mesa_create_context(visual, NULL, &functions, md);
if (! ctx) {
_mesa_destroy_visual(visual);
delete md;
// create core framebuffer
- GLframebuffer * buffer = _mesa_create_framebuffer(visual,
+ struct gl_framebuffer * buffer = _mesa_create_framebuffer(visual,
depth > 0 ? GL_TRUE : GL_FALSE,
stencil > 0 ? GL_TRUE: GL_FALSE,
accum > 0 ? GL_TRUE : GL_FALSE,
}
-void MesaDriver::Init(BGLView * bglview, GLcontext * ctx, GLvisual * visual, GLframebuffer * framebuffer)
+void MesaDriver::Init(BGLView * bglview, struct gl_context * ctx, struct gl_config * visual, struct gl_framebuffer * framebuffer)
{
m_bglview = bglview;
m_glcontext = ctx;
}
-void MesaDriver::Error(GLcontext *ctx)
+void MesaDriver::Error(struct gl_context *ctx)
{
MesaDriver *md = (MesaDriver *) ctx->DriverCtx;
if (md && md->m_bglview)
md->m_bglview->ErrorCallback((unsigned long) ctx->ErrorValue);
}
-void MesaDriver::UpdateState( GLcontext *ctx, GLuint new_state )
+void MesaDriver::UpdateState( struct gl_context *ctx, GLuint new_state )
{
struct swrast_device_driver * swdd = _swrast_GetDeviceDriverReference( ctx );
}
-void MesaDriver::ClearIndex(GLcontext *ctx, GLuint index)
+void MesaDriver::ClearIndex(struct gl_context *ctx, GLuint index)
{
MesaDriver *md = (MesaDriver *) ctx->DriverCtx;
md->m_clear_index = index;
}
-void MesaDriver::ClearColor(GLcontext *ctx, const GLfloat color[4])
+void MesaDriver::ClearColor(struct gl_context *ctx, const GLfloat color[4])
{
MesaDriver *md = (MesaDriver *) ctx->DriverCtx;
CLAMPED_FLOAT_TO_CHAN(md->m_clear_color[BE_RCOMP], color[0]);
}
-void MesaDriver::Clear(GLcontext *ctx, GLbitfield mask,
+void MesaDriver::Clear(struct gl_context *ctx, GLbitfield mask,
GLboolean all, GLint x, GLint y,
GLint width, GLint height)
{
}
-void MesaDriver::ClearFront(GLcontext *ctx,
+void MesaDriver::ClearFront(struct gl_context *ctx,
GLboolean all, GLint x, GLint y,
GLint width, GLint height)
{
}
-void MesaDriver::ClearBack(GLcontext *ctx,
+void MesaDriver::ClearBack(struct gl_context *ctx,
GLboolean all, GLint x, GLint y,
GLint width, GLint height)
{
}
-void MesaDriver::SetBuffer(GLcontext *ctx, GLframebuffer *buffer,
+void MesaDriver::SetBuffer(struct gl_context *ctx, struct gl_framebuffer *buffer,
GLenum mode)
{
/* TODO */
(void) mode;
}
-void MesaDriver::GetBufferSize(GLframebuffer * framebuffer, GLuint *width,
+void MesaDriver::GetBufferSize(struct gl_framebuffer * framebuffer, GLuint *width,
GLuint *height)
{
GET_CURRENT_CONTEXT(ctx);
}
-void MesaDriver::Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+void MesaDriver::Viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
/* poll for window size change and realloc software Z/stencil/etc if needed */
_mesa_ResizeBuffersMESA();
}
-const GLubyte *MesaDriver::GetString(GLcontext *ctx, GLenum name)
+const GLubyte *MesaDriver::GetString(struct gl_context *ctx, GLenum name)
{
switch (name) {
case GL_RENDERER:
}
-void MesaDriver::WriteRGBASpanFront(const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteRGBASpanFront(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
CONST GLubyte rgba[][4],
const GLubyte mask[])
}
}
-void MesaDriver::WriteRGBSpanFront(const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteRGBSpanFront(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
CONST GLubyte rgba[][3],
const GLubyte mask[])
}
}
-void MesaDriver::WriteMonoRGBASpanFront(const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteMonoRGBASpanFront(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
const GLchan color[4],
const GLubyte mask[])
}
}
-void MesaDriver::WriteRGBAPixelsFront(const GLcontext *ctx,
+void MesaDriver::WriteRGBAPixelsFront(const struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
CONST GLubyte rgba[][4],
const GLubyte mask[] )
}
-void MesaDriver::WriteMonoRGBAPixelsFront(const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteMonoRGBAPixelsFront(const struct gl_context *ctx, GLuint n,
const GLint x[], const GLint y[],
const GLchan color[4],
const GLubyte mask[])
}
-void MesaDriver::WriteCI32SpanFront( const GLcontext *ctx, GLuint n, GLint x, GLint y,
+void MesaDriver::WriteCI32SpanFront( const struct gl_context *ctx, GLuint n, GLint x, GLint y,
const GLuint index[], const GLubyte mask[] )
{
printf("WriteCI32SpanFront() not implemented yet!\n");
// TODO
}
-void MesaDriver::WriteCI8SpanFront( const GLcontext *ctx, GLuint n, GLint x, GLint y,
+void MesaDriver::WriteCI8SpanFront( const struct gl_context *ctx, GLuint n, GLint x, GLint y,
const GLubyte index[], const GLubyte mask[] )
{
printf("WriteCI8SpanFront() not implemented yet!\n");
// TODO
}
-void MesaDriver::WriteMonoCISpanFront( const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteMonoCISpanFront( const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
GLuint colorIndex, const GLubyte mask[] )
{
}
-void MesaDriver::WriteCI32PixelsFront( const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteCI32PixelsFront( const struct gl_context *ctx, GLuint n,
const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[] )
{
// TODO
}
-void MesaDriver::WriteMonoCIPixelsFront( const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteMonoCIPixelsFront( const struct gl_context *ctx, GLuint n,
const GLint x[], const GLint y[],
GLuint colorIndex, const GLubyte mask[] )
{
}
-void MesaDriver::ReadCI32SpanFront( const GLcontext *ctx,
+void MesaDriver::ReadCI32SpanFront( const struct gl_context *ctx,
GLuint n, GLint x, GLint y, GLuint index[] )
{
printf("ReadCI32SpanFront() not implemented yet!\n");
}
-void MesaDriver::ReadRGBASpanFront( const GLcontext *ctx, GLuint n,
+void MesaDriver::ReadRGBASpanFront( const struct gl_context *ctx, GLuint n,
GLint x, GLint y, GLubyte rgba[][4] )
{
printf("ReadRGBASpanFront() not implemented yet!\n");
}
-void MesaDriver::ReadCI32PixelsFront( const GLcontext *ctx,
+void MesaDriver::ReadCI32PixelsFront( const struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
GLuint indx[], const GLubyte mask[] )
{
}
-void MesaDriver::ReadRGBAPixelsFront( const GLcontext *ctx,
+void MesaDriver::ReadRGBAPixelsFront( const struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[] )
{
-void MesaDriver::WriteRGBASpanBack(const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteRGBASpanBack(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
CONST GLubyte rgba[][4],
const GLubyte mask[])
}
-void MesaDriver::WriteRGBSpanBack(const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteRGBSpanBack(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
CONST GLubyte rgb[][3],
const GLubyte mask[])
-void MesaDriver::WriteMonoRGBASpanBack(const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteMonoRGBASpanBack(const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
const GLchan color[4], const GLubyte mask[])
{
}
-void MesaDriver::WriteRGBAPixelsBack(const GLcontext *ctx,
+void MesaDriver::WriteRGBAPixelsBack(const struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
CONST GLubyte rgba[][4],
const GLubyte mask[] )
}
-void MesaDriver::WriteMonoRGBAPixelsBack(const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteMonoRGBAPixelsBack(const struct gl_context *ctx, GLuint n,
const GLint x[], const GLint y[],
const GLchan color[4],
const GLubyte mask[])
}
-void MesaDriver::WriteCI32SpanBack( const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteCI32SpanBack( const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
const GLuint index[], const GLubyte mask[] )
{
// TODO
}
-void MesaDriver::WriteCI8SpanBack( const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteCI8SpanBack( const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
const GLubyte index[], const GLubyte mask[] )
{
// TODO
}
-void MesaDriver::WriteMonoCISpanBack( const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteMonoCISpanBack( const struct gl_context *ctx, GLuint n,
GLint x, GLint y,
GLuint colorIndex, const GLubyte mask[] )
{
}
-void MesaDriver::WriteCI32PixelsBack( const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteCI32PixelsBack( const struct gl_context *ctx, GLuint n,
const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[] )
{
// TODO
}
-void MesaDriver::WriteMonoCIPixelsBack( const GLcontext *ctx, GLuint n,
+void MesaDriver::WriteMonoCIPixelsBack( const struct gl_context *ctx, GLuint n,
const GLint x[], const GLint y[],
GLuint colorIndex, const GLubyte mask[] )
{
}
-void MesaDriver::ReadCI32SpanBack( const GLcontext *ctx,
+void MesaDriver::ReadCI32SpanBack( const struct gl_context *ctx,
GLuint n, GLint x, GLint y, GLuint index[] )
{
printf("ReadCI32SpanBack() not implemented yet!\n");
}
-void MesaDriver::ReadRGBASpanBack( const GLcontext *ctx, GLuint n,
+void MesaDriver::ReadRGBASpanBack( const struct gl_context *ctx, GLuint n,
GLint x, GLint y, GLubyte rgba[][4] )
{
MesaDriver *md = (MesaDriver *) ctx->DriverCtx;
}
-void MesaDriver::ReadCI32PixelsBack( const GLcontext *ctx,
+void MesaDriver::ReadCI32PixelsBack( const struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
GLuint indx[], const GLubyte mask[] )
{
}
-void MesaDriver::ReadRGBAPixelsBack( const GLcontext *ctx,
+void MesaDriver::ReadRGBAPixelsBack( const struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[] )
{
* Only the Intel drivers use this so far.
*/
void
-_mesa_init_driver_state(GLcontext *ctx)
+_mesa_init_driver_state(struct gl_context *ctx)
{
ctx->Driver.AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef);
extern void
-_mesa_init_driver_state(GLcontext *ctx);
+_mesa_init_driver_state(struct gl_context *ctx);
#endif
* To be called once during context creation.
*/
void
-_mesa_meta_init(GLcontext *ctx)
+_mesa_meta_init(struct gl_context *ctx)
{
ASSERT(!ctx->Meta);
* To be called once during context destruction.
*/
void
-_mesa_meta_free(GLcontext *ctx)
+_mesa_meta_free(struct gl_context *ctx)
{
/* Note: Any textures, VBOs, etc, that we allocate should get
* freed by the normal context destruction code. But this would be
* to save and reset to their defaults
*/
static void
-_mesa_meta_begin(GLcontext *ctx, GLbitfield state)
+_mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
{
struct save_state *save = &ctx->Meta->Save;
* Leave meta state. This is like a light-weight version of glPopAttrib().
*/
static void
-_mesa_meta_end(GLcontext *ctx)
+_mesa_meta_end(struct gl_context *ctx)
{
struct save_state *save = &ctx->Meta->Save;
const GLbitfield state = save->SavedState;
* Choose tex target, compute max tex size, etc.
*/
static void
-init_temp_texture(GLcontext *ctx, struct temp_texture *tex)
+init_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
{
/* prefer texture rectangle */
if (ctx->Extensions.NV_texture_rectangle) {
* This does some one-time init if needed.
*/
static struct temp_texture *
-get_temp_texture(GLcontext *ctx)
+get_temp_texture(struct gl_context *ctx)
{
struct temp_texture *tex = &ctx->Meta->TempTex;
* allocation/deallocation.
*/
static struct temp_texture *
-get_bitmap_temp_texture(GLcontext *ctx)
+get_bitmap_temp_texture(struct gl_context *ctx)
{
struct temp_texture *tex = &ctx->Meta->Bitmap.Tex;
* Setup/load texture for glDrawPixels.
*/
static void
-setup_drawpix_texture(GLcontext *ctx,
+setup_drawpix_texture(struct gl_context *ctx,
struct temp_texture *tex,
GLboolean newTex,
GLenum texIntFormat,
* One-time init for drawing depth pixels.
*/
static void
-init_blit_depth_pixels(GLcontext *ctx)
+init_blit_depth_pixels(struct gl_context *ctx)
{
static const char *program =
"!!ARBfp1.0\n"
* normal path.
*/
static GLbitfield
-blitframebuffer_texture(GLcontext *ctx,
+blitframebuffer_texture(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter)
* of texture mapping and polygon rendering.
*/
void
-_mesa_meta_BlitFramebuffer(GLcontext *ctx,
+_mesa_meta_BlitFramebuffer(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter)
* Meta implementation of ctx->Driver.Clear() in terms of polygon rendering.
*/
void
-_mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers)
+_mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers)
{
struct clear_state *clear = &ctx->Meta->Clear;
struct vertex {
* of texture mapping and polygon rendering.
*/
void
-_mesa_meta_CopyPixels(GLcontext *ctx, GLint srcX, GLint srcY,
+_mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
GLsizei width, GLsizei height,
GLint dstX, GLint dstY, GLenum type)
{
* into tiles which fit into the max texture size.
*/
static void
-tiled_draw_pixels(GLcontext *ctx,
+tiled_draw_pixels(struct gl_context *ctx,
GLint tileSize,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
* One-time init for drawing stencil pixels.
*/
static void
-init_draw_stencil_pixels(GLcontext *ctx)
+init_draw_stencil_pixels(struct gl_context *ctx)
{
/* This program is run eight times, once for each stencil bit.
* The stencil values to draw are found in an 8-bit alpha texture.
* One-time init for drawing depth pixels.
*/
static void
-init_draw_depth_pixels(GLcontext *ctx)
+init_draw_depth_pixels(struct gl_context *ctx)
{
static const char *program =
"!!ARBfp1.0\n"
* of texture mapping and polygon rendering.
*/
void
-_mesa_meta_DrawPixels(GLcontext *ctx,
+_mesa_meta_DrawPixels(struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
* improve performance a lot.
*/
void
-_mesa_meta_Bitmap(GLcontext *ctx,
+_mesa_meta_Bitmap(struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap1)
* \return GL_TRUE if a fallback is needed, GL_FALSE otherwise
*/
GLboolean
-_mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target,
+_mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj)
{
const GLuint fboSave = ctx->DrawBuffer->Name;
* Note: texture borders and 3D texture support not yet complete.
*/
void
-_mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
+_mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj)
{
struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap;
* ReadPixels() and passed to Tex[Sub]Image().
*/
static GLenum
-get_temp_image_type(GLcontext *ctx, GLenum baseFormat)
+get_temp_image_type(struct gl_context *ctx, GLenum baseFormat)
{
switch (baseFormat) {
case GL_RGBA:
* Have to be careful with locking and meta state for pixel transfer.
*/
static void
-copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
+copy_tex_image(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
GLenum internalFormat, GLint x, GLint y,
GLsizei width, GLsizei height, GLint border)
{
void
-_mesa_meta_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexImage1D(struct gl_context *ctx, GLenum target, GLint level,
GLenum internalFormat, GLint x, GLint y,
GLsizei width, GLint border)
{
void
-_mesa_meta_CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLenum internalFormat, GLint x, GLint y,
GLsizei width, GLsizei height, GLint border)
{
* Have to be careful with locking and meta state for pixel transfer.
*/
static void
-copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
+copy_tex_sub_image(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y,
GLsizei width, GLsizei height)
void
-_mesa_meta_CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset,
GLint x, GLint y, GLsizei width)
{
void
-_mesa_meta_CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y,
GLsizei width, GLsizei height)
void
-_mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y,
GLsizei width, GLsizei height)
void
-_mesa_meta_CopyColorTable(GLcontext *ctx,
+_mesa_meta_CopyColorTable(struct gl_context *ctx,
GLenum target, GLenum internalformat,
GLint x, GLint y, GLsizei width)
{
void
-_mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start,
+_mesa_meta_CopyColorSubTable(struct gl_context *ctx,GLenum target, GLsizei start,
GLint x, GLint y, GLsizei width)
{
GLfloat *buf;
extern void
-_mesa_meta_init(GLcontext *ctx);
+_mesa_meta_init(struct gl_context *ctx);
extern void
-_mesa_meta_free(GLcontext *ctx);
+_mesa_meta_free(struct gl_context *ctx);
extern void
-_mesa_meta_BlitFramebuffer(GLcontext *ctx,
+_mesa_meta_BlitFramebuffer(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
extern void
-_mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers);
+_mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers);
extern void
-_mesa_meta_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
+_mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
GLint dstx, GLint dsty, GLenum type);
extern void
-_mesa_meta_DrawPixels(GLcontext *ctx,
+_mesa_meta_DrawPixels(struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
const GLvoid *pixels);
extern void
-_mesa_meta_Bitmap(GLcontext *ctx,
+_mesa_meta_Bitmap(struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap);
extern GLboolean
-_mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target,
+_mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj);
extern void
-_mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
+_mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj);
extern void
-_mesa_meta_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexImage1D(struct gl_context *ctx, GLenum target, GLint level,
GLenum internalFormat, GLint x, GLint y,
GLsizei width, GLint border);
extern void
-_mesa_meta_CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLenum internalFormat, GLint x, GLint y,
GLsizei width, GLsizei height, GLint border);
extern void
-_mesa_meta_CopyTexSubImage1D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset,
GLint x, GLint y, GLsizei width);
extern void
-_mesa_meta_CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y,
GLsizei width, GLsizei height);
extern void
-_mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level,
+_mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y,
GLsizei width, GLsizei height);
extern void
-_mesa_meta_CopyColorTable(GLcontext *ctx,
+_mesa_meta_CopyColorTable(struct gl_context *ctx,
GLenum target, GLenum internalformat,
GLint x, GLint y, GLsizei width);
extern void
-_mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start,
+_mesa_meta_CopyColorSubTable(struct gl_context *ctx,GLenum target, GLsizei start,
GLint x, GLint y, GLsizei width);
extern void
-_mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
+_mesa_meta_CopyConvolutionFilter1D(struct gl_context *ctx, GLenum target,
GLenum internalFormat,
GLint x, GLint y, GLsizei width);
extern void
-_mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
+_mesa_meta_CopyConvolutionFilter2D(struct gl_context *ctx, GLenum target,
GLenum internalFormat, GLint x, GLint y,
GLsizei width, GLsizei height);
#define HAVE_HW_DEPTH_PIXELS 0
#endif
-static void TAG(WriteDepthSpan)( GLcontext *ctx,
+static void TAG(WriteDepthSpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *values,
#if HAVE_HW_DEPTH_SPANS
/* implement MonoWriteDepthSpan() in terms of WriteDepthSpan() */
static void
-TAG(WriteMonoDepthSpan)( GLcontext *ctx, struct gl_renderbuffer *rb,
+TAG(WriteMonoDepthSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *value, const GLubyte mask[] )
{
TAG(WriteDepthSpan)(ctx, rb, n, x, y, depths, mask);
}
#else
-static void TAG(WriteMonoDepthSpan)( GLcontext *ctx,
+static void TAG(WriteMonoDepthSpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *value,
#endif
-static void TAG(WriteDepthPixels)( GLcontext *ctx,
+static void TAG(WriteDepthPixels)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[],
/* Read depth spans and pixels
*/
-static void TAG(ReadDepthSpan)( GLcontext *ctx,
+static void TAG(ReadDepthSpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
void *values )
HW_READ_UNLOCK();
}
-static void TAG(ReadDepthPixels)( GLcontext *ctx,
+static void TAG(ReadDepthPixels)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
void
meta_set_passthrough_transform(struct dri_metaops *meta)
{
- GLcontext *ctx = meta->ctx;
+ struct gl_context *ctx = meta->ctx;
meta->saved_vp_x = ctx->Viewport.X;
meta->saved_vp_y = ctx->Viewport.Y;
void
meta_set_passthrough_vertex_program(struct dri_metaops *meta)
{
- GLcontext *ctx = meta->ctx;
+ struct gl_context *ctx = meta->ctx;
static const char *vp =
"!!ARBvp1.0\n"
"TEMP vertexClip;\n"
void
meta_restore_vertex_program(struct dri_metaops *meta)
{
- GLcontext *ctx = meta->ctx;
+ struct gl_context *ctx = meta->ctx;
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
struct gl_fragment_program **prog,
const char *prog_string)
{
- GLcontext *ctx = meta->ctx;
+ struct gl_context *ctx = meta->ctx;
assert(meta->saved_fp == NULL);
_mesa_reference_fragprog(ctx, &meta->saved_fp,
void
meta_restore_fragment_program(struct dri_metaops *meta)
{
- GLcontext *ctx = meta->ctx;
+ struct gl_context *ctx = meta->ctx;
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
void
meta_set_default_texrect(struct dri_metaops *meta)
{
- GLcontext *ctx = meta->ctx;
+ struct gl_context *ctx = meta->ctx;
struct gl_client_array *old_texcoord_array;
meta->saved_active_texture = ctx->Texture.CurrentUnit;
void
meta_restore_texcoords(struct dri_metaops *meta)
{
- GLcontext *ctx = meta->ctx;
+ struct gl_context *ctx = meta->ctx;
/* Restore the old TexCoordPointer */
if (meta->saved_texcoord_vbo) {
}
-void meta_init_metaops(GLcontext *ctx, struct dri_metaops *meta)
+void meta_init_metaops(struct gl_context *ctx, struct dri_metaops *meta)
{
meta->ctx = ctx;
}
struct dri_metaops {
- GLcontext *ctx;
+ struct gl_context *ctx;
GLboolean internal_viewport_call;
struct gl_fragment_program *bitmap_fp;
struct gl_vertex_program *passthrough_vp;
void meta_restore_texcoords(struct dri_metaops *meta);
-void meta_init_metaops(GLcontext *ctx, struct dri_metaops *meta);
+void meta_init_metaops(struct gl_context *ctx, struct dri_metaops *meta);
void meta_destroy_metaops(struct dri_metaops *meta);
#endif
pdp->driScreenPriv = psp;
- if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes,
- renderType == GLX_PIXMAP_BIT)) {
+ if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes, 0)) {
free(pdp);
return NULL;
}
__DRIcontext *shared, void *data)
{
__DRIcontext *context;
- const __GLcontextModes *modes = (config != NULL) ? &config->modes : NULL;
+ const struct gl_config *modes = (config != NULL) ? &config->modes : NULL;
void *shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
gl_api mesa_api;
* This is the bootstrap function for the driver. libGL supplies all of the
* requisite information about the system, and the driver initializes itself.
* This routine also fills in the linked list pointed to by \c driver_modes
- * with the \c __GLcontextModes that the driver can support for windows or
+ * with the \c struct gl_config that the driver can support for windows or
* pbuffers.
*
* For legacy DRI.
#include "xmlconfig.h"
#include "main/glheader.h"
#include "main/mtypes.h"
-#include "GL/internal/glcore.h"
#include "GL/internal/dri_interface.h"
#define GLX_BAD_CONTEXT 5
* Context creation callback
*/
GLboolean (*CreateContext)(gl_api api,
- const __GLcontextModes *glVis,
+ const struct gl_config *glVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate);
*/
GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
- const __GLcontextModes *glVis,
+ const struct gl_config *glVis,
GLboolean pixmapBuffer);
/**
* be used.
*/
static GLboolean
-driRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb,
+driRenderbufferStorage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
rb->Width = width;
* gl_framebuffer object.
*/
void
-driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawable *dPriv)
+driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv)
{
struct gl_framebuffer *fb = (struct gl_framebuffer *) dPriv->driverPrivate;
if (fb && (dPriv->w != fb->Width || dPriv->h != fb->Height)) {
extern void
-driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawable *dPriv);
+driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv);
#endif /* DRIRENDERBUFFER_H */
#include "main/mtypes.h"
#include <GL/gl.h>
-#include <GL/internal/glcore.h>
#include <GL/internal/dri_interface.h>
typedef struct _drmLock drmLock;
void (*DestroyScreen)(__DRIscreen *driScrnPriv);
GLboolean (*CreateContext)(gl_api glapi,
- const __GLcontextModes *glVis,
+ const struct gl_config *glVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate);
GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
- const __GLcontextModes *glVis,
+ const struct gl_config *glVis,
GLboolean pixmapBuffer);
void (*DestroyBuffer)(__DRIdrawable *driDrawPriv);
#endif
-static void TAG(WriteRGBASpan)( GLcontext *ctx,
+static void TAG(WriteRGBASpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *values, const GLubyte mask[] )
HW_WRITE_UNLOCK();
}
-static void TAG(WriteRGBSpan)( GLcontext *ctx,
+static void TAG(WriteRGBSpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *values, const GLubyte mask[] )
HW_WRITE_UNLOCK();
}
-static void TAG(WriteRGBAPixels)( GLcontext *ctx,
+static void TAG(WriteRGBAPixels)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
const void *values, const GLubyte mask[] )
}
-static void TAG(WriteMonoRGBASpan)( GLcontext *ctx,
+static void TAG(WriteMonoRGBASpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *value,
}
-static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx,
+static void TAG(WriteMonoRGBAPixels)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
}
-static void TAG(ReadRGBASpan)( GLcontext *ctx,
+static void TAG(ReadRGBASpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
void *values)
}
-static void TAG(ReadRGBAPixels)( GLcontext *ctx,
+static void TAG(ReadRGBAPixels)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
void *values )
#include "x86/common_x86_asm.h"
#endif
-static void TAG(WriteRGBASpan)( GLcontext *ctx,
+static void TAG(WriteRGBASpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *values, const GLubyte mask[] )
HW_WRITE_UNLOCK();
}
-static void TAG(WriteRGBSpan)( GLcontext *ctx,
+static void TAG(WriteRGBSpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *values, const GLubyte mask[] )
HW_WRITE_UNLOCK();
}
-static void TAG(WriteRGBAPixels)( GLcontext *ctx,
+static void TAG(WriteRGBAPixels)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
const void *values, const GLubyte mask[] )
}
-static void TAG(WriteMonoRGBASpan)( GLcontext *ctx,
+static void TAG(WriteMonoRGBASpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *value, const GLubyte mask[] )
}
-static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx,
+static void TAG(WriteMonoRGBAPixels)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
}
-static void TAG(ReadRGBASpan)( GLcontext *ctx,
+static void TAG(ReadRGBASpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, void *values)
{
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \
((SPANTMP_PIXEL_FMT == GL_RGB) && \
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
-static void TAG2(ReadRGBASpan,_MMX)( GLcontext *ctx,
+static void TAG2(ReadRGBASpan,_MMX)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, void *values)
{
defined(USE_SSE_ASM) && \
(SPANTMP_PIXEL_FMT == GL_BGRA) && \
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
-static void TAG2(ReadRGBASpan,_SSE2)( GLcontext *ctx,
+static void TAG2(ReadRGBASpan,_SSE2)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
void *values)
defined(USE_SSE_ASM) && \
(SPANTMP_PIXEL_FMT == GL_BGRA) && \
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
-static void TAG2(ReadRGBASpan,_SSE)( GLcontext *ctx,
+static void TAG2(ReadRGBASpan,_SSE)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
void *values)
#endif
-static void TAG(ReadRGBAPixels)( GLcontext *ctx,
+static void TAG(ReadRGBAPixels)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
void *values )
#define HAVE_HW_STENCIL_PIXELS 0
#endif
-static void TAG(WriteStencilSpan)( GLcontext *ctx,
+static void TAG(WriteStencilSpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *values, const GLubyte mask[] )
#if HAVE_HW_STENCIL_SPANS
/* implement MonoWriteDepthSpan() in terms of WriteDepthSpan() */
static void
-TAG(WriteMonoStencilSpan)( GLcontext *ctx, struct gl_renderbuffer *rb,
+TAG(WriteMonoStencilSpan)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *value, const GLubyte mask[] )
{
TAG(WriteStencilSpan)(ctx, rb, n, x, y, stens, mask);
}
#else /* HAVE_HW_STENCIL_SPANS */
-static void TAG(WriteMonoStencilSpan)( GLcontext *ctx,
+static void TAG(WriteMonoStencilSpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *value,
#endif /* !HAVE_HW_STENCIL_SPANS */
-static void TAG(WriteStencilPixels)( GLcontext *ctx,
+static void TAG(WriteStencilPixels)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
/* Read stencil spans and pixels
*/
-static void TAG(ReadStencilSpan)( GLcontext *ctx,
+static void TAG(ReadStencilSpan)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
void *values)
HW_READ_UNLOCK();
}
-static void TAG(ReadStencilPixels)( GLcontext *ctx,
+static void TAG(ReadStencilPixels)( struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
void *values )
*/
GLboolean
-driIsTextureResident( GLcontext * ctx,
+driIsTextureResident( struct gl_context * ctx,
struct gl_texture_object * texObj )
{
driTextureObject * t;
* \param targets Bit-mask of value texture targets
*/
-void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped,
+void driInitTextureObjects( struct gl_context *ctx, driTextureObject * swapped,
GLuint targets )
{
struct gl_texture_object *texObj;
int driAllocateTexture( driTexHeap * const * heap_array, unsigned nr_heaps,
driTextureObject * t );
-GLboolean driIsTextureResident( GLcontext * ctx,
+GLboolean driIsTextureResident( struct gl_context * ctx,
struct gl_texture_object * texObj );
driTexHeap * driCreateTextureHeap( unsigned heap_id, void * context,
#define DRI_TEXMGR_DO_TEXTURE_CUBE 0x0008
#define DRI_TEXMGR_DO_TEXTURE_RECT 0x0010
-void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped,
+void driInitTextureObjects( struct gl_context *ctx, driTextureObject * swapped,
GLuint targets );
GLboolean driValidateTextureHeaps( driTexHeap * const * texture_heaps,
* we need to add entry-points (via \c driInitSingleExtension) for those
* new functions here.
*/
-void driInitExtensions( GLcontext * ctx,
+void driInitExtensions( struct gl_context * ctx,
const struct dri_extension * extensions_to_enable,
GLboolean enable_imaging )
{
*
* \sa driInitExtensions, _mesa_enable_extension, _mesa_map_function_array
*/
-void driInitSingleExtension( GLcontext * ctx,
+void driInitSingleExtension( struct gl_context * ctx,
const struct dri_extension * ext )
{
if ( ext->functions != NULL ) {
drmActual, drmExpected);
}
-GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer,
+GLboolean driClipRectToFramebuffer( const struct gl_framebuffer *buffer,
GLint *x, GLint *y,
GLsizei *width, GLsizei *height )
{
}
/**
- * Creates a set of \c __GLcontextModes that a driver will expose.
+ * Creates a set of \c struct gl_config that a driver will expose.
*
- * A set of \c __GLcontextModes will be created based on the supplied
+ * A set of \c struct gl_config will be created based on the supplied
* parameters. The number of modes processed will be 2 *
* \c num_depth_stencil_bits * \c num_db_modes.
*
* For the most part, data is just copied from \c depth_bits, \c stencil_bits,
- * \c db_modes, and \c visType into each \c __GLcontextModes element.
+ * \c db_modes, and \c visType into each \c struct gl_config element.
* However, the meanings of \c fb_format and \c fb_type require further
* explanation. The \c fb_format specifies which color components are in
* each pixel and what the default order is. For example, \c GL_RGB specifies
*
* One sublte issue is the combination of \c GL_RGB or \c GL_BGR and either
* of the \c GL_UNSIGNED_INT_8_8_8_8 modes. The resulting mask values in the
- * \c __GLcontextModes structure is \b identical to the \c GL_RGBA or
+ * \c struct gl_config structure is \b identical to the \c GL_RGBA or
* \c GL_BGRA case, except the \c alphaMask is zero. This means that, as
* far as this routine is concerned, \c GL_RGB with \c GL_UNSIGNED_INT_8_8_8_8
* still uses 32-bits.
* If in doubt, look at the tables used in the function.
*
* \param ptr_to_modes Pointer to a pointer to a linked list of
- * \c __GLcontextModes. Upon completion, a pointer to
+ * \c struct gl_config. Upon completion, a pointer to
* the next element to be process will be stored here.
* If the function fails and returns \c GL_FALSE, this
* value will be unmodified, but some elements in the
const uint32_t * masks;
int index;
__DRIconfig **configs, **c;
- __GLcontextModes *modes;
+ struct gl_config *modes;
unsigned i, j, k, h;
unsigned num_modes;
unsigned num_accum_bits = (enable_accum) ? 2 : 1;
modes->transparentBlue = GLX_DONT_CARE;
modes->transparentAlpha = GLX_DONT_CARE;
modes->transparentIndex = GLX_DONT_CARE;
- modes->visualType = GLX_DONT_CARE;
- modes->renderType = GLX_RGBA_BIT;
- modes->drawableType = GLX_WINDOW_BIT;
modes->rgbMode = GL_TRUE;
if ( db_modes[i] == GLX_NONE ) {
}
#define __ATTRIB(attrib, field) \
- { attrib, offsetof(__GLcontextModes, field) }
+ { attrib, offsetof(struct gl_config, field) }
static const struct { unsigned int attrib, offset; } attribMap[] = {
__ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
extern unsigned driGetRendererString( char * buffer,
const char * hardware_name, const char * driver_date, GLuint agp_mode );
-extern void driInitExtensions( GLcontext * ctx,
+extern void driInitExtensions( struct gl_context * ctx,
const struct dri_extension * card_extensions, GLboolean enable_imaging );
-extern void driInitSingleExtension( GLcontext * ctx,
+extern void driInitSingleExtension( struct gl_context * ctx,
const struct dri_extension * ext );
extern GLboolean driCheckDriDdxDrmVersions2(const char * driver_name,
const __DRIversion * ddxActual, const __DRIutilversion2 * ddxExpected,
const __DRIversion * drmActual, const __DRIversion * drmExpected);
-extern GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer,
+extern GLboolean driClipRectToFramebuffer( const struct gl_framebuffer *buffer,
GLint *x, GLint *y,
GLsizei *width, GLsizei *height );
struct __DRIconfigRec {
- __GLcontextModes modes;
+ struct gl_config modes;
};
extern __DRIconfig **
#include <unistd.h> /* for usleep() */
#include <sched.h> /* for sched_yield() */
-#ifdef linux
-#include <sched.h> /* for sched_yield() */
-#endif
-
#define DO_USLEEP(nr) \
do { \
if (0) fprintf(stderr, "%s: usleep for %u\n", __FUNCTION__, nr ); \
#define DRIVER_DATE "20050821"
-static const GLubyte *i810GetString( GLcontext *ctx, GLenum name )
+static const GLubyte *i810GetString( struct gl_context *ctx, GLenum name )
{
static char buffer[128];
}
}
-static void i810BufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
+static void i810BufferSize(struct gl_framebuffer *buffer, GLuint *width, GLuint *height)
{
GET_CURRENT_CONTEXT(ctx);
i810ContextPtr imesa = I810_CONTEXT(ctx);
GLboolean
i810CreateContext( gl_api api,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{
- GLcontext *ctx, *shareCtx;
+ struct gl_context *ctx, *shareCtx;
i810ContextPtr imesa;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
i810ScreenPrivate *i810Screen = (i810ScreenPrivate *)sPriv->private;
ctx->Const.PointSizeGranularity = 1.0;
/* reinitialize the context point state.
- * It depend on constants in __GLcontextRec::Const
+ * It depend on constants in __struct gl_contextRec::Const
*/
_mesa_init_point(ctx);
imesa->driDrawable = driDrawPriv;
_mesa_make_current(imesa->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
+ (struct gl_framebuffer *) driDrawPriv->driverPrivate,
+ (struct gl_framebuffer *) driReadPriv->driverPrivate);
/* Are these necessary?
*/
static void
i810UpdatePageFlipping( i810ContextPtr imesa )
{
- GLcontext *ctx = imesa->glCtx;
+ struct gl_context *ctx = imesa->glCtx;
int front = 0;
/* Determine current color drawing buffer */
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
i810ContextPtr imesa;
- GLcontext *ctx;
+ struct gl_context *ctx;
imesa = (i810ContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = imesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
struct i810_context_t {
GLint refcount;
- GLcontext *glCtx;
+ struct gl_context *glCtx;
/* Texture object bookkeeping
*/
/* DRI stuff
*/
GLuint needClip;
- GLframebuffer *glBuffer;
+ struct gl_framebuffer *glBuffer;
GLboolean doPageFlip;
/* These refer to the current draw (front vs. back) buffer:
#define DEPTH_SCALE ((1<<16)-1)
-static void i810Clear( GLcontext *ctx, GLbitfield mask )
+static void i810Clear( struct gl_context *ctx, GLbitfield mask )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
__DRIdrawable *dPriv = imesa->driDrawable;
return(drmCommandNone(fd, DRM_I810_DOCOPY));
}
-static void i810Flush( GLcontext *ctx )
+static void i810Flush( struct gl_context *ctx )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
I810_FIREVERTICES( imesa );
}
-static void i810Finish( GLcontext *ctx )
+static void i810Finish( struct gl_context *ctx )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
i810DmaFinish( imesa );
/**********************************************************************/
-static GLboolean i810_run_render( GLcontext *ctx,
+static GLboolean i810_run_render( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
unsigned stencil_bits, GLboolean have_back_buffer )
{
__DRIconfig **configs;
- __GLcontextModes * m;
+ struct gl_config * m;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
unsigned i;
static GLboolean
i810CreateBuffer( __DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
GLboolean isPixmap )
{
i810ScreenPrivate *screen = (i810ScreenPrivate *) driScrnPriv->private;
static void
i810DestroyBuffer(__DRIdrawable *driDrawPriv)
{
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
+ _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
const struct __DriverAPIRec driDriverAPI = {
extern GLboolean
i810CreateContext( gl_api api,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate );
/* Move locking out to get reasonable span performance.
*/
-void i810SpanRenderStart( GLcontext *ctx )
+void i810SpanRenderStart( struct gl_context *ctx )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
I810_FIREVERTICES(imesa);
i810RegetLockQuiescent( imesa );
}
-void i810SpanRenderFinish( GLcontext *ctx )
+void i810SpanRenderFinish( struct gl_context *ctx )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
_swrast_flush( ctx );
UNLOCK_HARDWARE( imesa );
}
-void i810InitSpanFuncs( GLcontext *ctx )
+void i810InitSpanFuncs( struct gl_context *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
swdd->SpanRenderStart = i810SpanRenderStart;
* Plug in the Get/Put routines for the given driRenderbuffer.
*/
void
-i810SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
+i810SetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis)
{
if (drb->Base.InternalFormat == GL_RGBA) {
/* always 565 RGB */
#include "drirenderbuffer.h"
-extern void i810InitSpanFuncs( GLcontext *ctx );
+extern void i810InitSpanFuncs( struct gl_context *ctx );
-extern void i810SpanRenderFinish( GLcontext *ctx );
-extern void i810SpanRenderStart( GLcontext *ctx );
+extern void i810SpanRenderFinish( struct gl_context *ctx );
+extern void i810SpanRenderStart( struct gl_context *ctx );
extern void
-i810SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
+i810SetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis);
#endif
}
-static void i810AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
+static void i810AlphaFunc(struct gl_context *ctx, GLenum func, GLfloat ref)
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
GLuint a = (ZA_UPDATE_ALPHAFUNC|ZA_UPDATE_ALPHAREF);
imesa->Setup[I810_CTXREG_ZA] |= a;
}
-static void i810BlendEquationSeparate(GLcontext *ctx,
+static void i810BlendEquationSeparate(struct gl_context *ctx,
GLenum modeRGB, GLenum modeA)
{
assert( modeRGB == modeA );
ctx->Color.LogicOp != GL_COPY));
}
-static void i810BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
+static void i810BlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB,
GLenum dfactorRGB, GLenum sfactorA,
GLenum dfactorA )
{
-static void i810DepthFunc(GLcontext *ctx, GLenum func)
+static void i810DepthFunc(struct gl_context *ctx, GLenum func)
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
int zmode;
imesa->Setup[I810_CTXREG_LCS] |= zmode;
}
-static void i810DepthMask(GLcontext *ctx, GLboolean flag)
+static void i810DepthMask(struct gl_context *ctx, GLboolean flag)
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
* The i810 supports a 4x4 stipple natively, GL wants 32x32.
* Fortunately stipple is usually a repeating pattern.
*/
-static void i810PolygonStipple( GLcontext *ctx, const GLubyte *mask )
+static void i810PolygonStipple( struct gl_context *ctx, const GLubyte *mask )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
const GLubyte *m = mask;
*/
-static void i810Scissor( GLcontext *ctx, GLint x, GLint y,
+static void i810Scissor( struct gl_context *ctx, GLint x, GLint y,
GLsizei w, GLsizei h )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
}
-static void i810LogicOp( GLcontext *ctx, GLenum opcode )
+static void i810LogicOp( struct gl_context *ctx, GLenum opcode )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
FALLBACK( imesa, I810_FALLBACK_LOGICOP,
/* Fallback to swrast for select and feedback.
*/
-static void i810RenderMode( GLcontext *ctx, GLenum mode )
+static void i810RenderMode( struct gl_context *ctx, GLenum mode )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
FALLBACK( imesa, I810_FALLBACK_RENDERMODE, (mode != GL_RENDER) );
}
-void i810DrawBuffer(GLcontext *ctx, GLenum mode )
+void i810DrawBuffer(struct gl_context *ctx, GLenum mode )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
int front = 0;
}
-static void i810ReadBuffer(GLcontext *ctx, GLenum mode )
+static void i810ReadBuffer(struct gl_context *ctx, GLenum mode )
{
/* XXX anything? */
}
-static void i810ClearColor(GLcontext *ctx, const GLfloat color[4] )
+static void i810ClearColor(struct gl_context *ctx, const GLfloat color[4] )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
GLubyte c[4];
* Culling - the i810 isn't quite as clean here as the rest of
* its interfaces, but it's not bad.
*/
-static void i810CullFaceFrontFace(GLcontext *ctx, GLenum unused)
+static void i810CullFaceFrontFace(struct gl_context *ctx, GLenum unused)
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
GLuint mode = LCS_CULL_BOTH;
}
-static void i810LineWidth( GLcontext *ctx, GLfloat widthf )
+static void i810LineWidth( struct gl_context *ctx, GLfloat widthf )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
/* AA, non-AA limits are same */
}
}
-static void i810PointSize( GLcontext *ctx, GLfloat sz )
+static void i810PointSize( struct gl_context *ctx, GLfloat sz )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
/* AA, non-AA limits are same */
* Color masks
*/
-static void i810ColorMask(GLcontext *ctx,
+static void i810ColorMask(struct gl_context *ctx,
GLboolean r, GLboolean g,
GLboolean b, GLboolean a )
{
/* Seperate specular not fully implemented on the i810.
*/
-static void i810LightModelfv(GLcontext *ctx, GLenum pname,
+static void i810LightModelfv(struct gl_context *ctx, GLenum pname,
const GLfloat *param)
{
if (pname == GL_LIGHT_MODEL_COLOR_CONTROL)
/* But the 815 has it...
*/
-static void i810LightModelfv_i815(GLcontext *ctx, GLenum pname,
+static void i810LightModelfv_i815(struct gl_context *ctx, GLenum pname,
const GLfloat *param)
{
if (pname == GL_LIGHT_MODEL_COLOR_CONTROL)
/* In Mesa 3.5 we can reliably do native flatshading.
*/
-static void i810ShadeModel(GLcontext *ctx, GLenum mode)
+static void i810ShadeModel(struct gl_context *ctx, GLenum mode)
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
/* =============================================================
* Fog
*/
-static void i810Fogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
+static void i810Fogfv(struct gl_context *ctx, GLenum pname, const GLfloat *param)
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
/* =============================================================
*/
-static void i810Enable(GLcontext *ctx, GLenum cap, GLboolean state)
+static void i810Enable(struct gl_context *ctx, GLenum cap, GLboolean state)
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
-static void i810CalcViewport( GLcontext *ctx )
+static void i810CalcViewport( struct gl_context *ctx )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
const GLfloat *v = ctx->Viewport._WindowMap.m;
m[MAT_TZ] = v[MAT_TZ] * (1.0 / 0xffff);
}
-static void i810Viewport( GLcontext *ctx,
+static void i810Viewport( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height )
{
i810CalcViewport( ctx );
}
-static void i810DepthRange( GLcontext *ctx,
+static void i810DepthRange( struct gl_context *ctx,
GLclampd nearval, GLclampd farval )
{
i810CalcViewport( ctx );
-void i810InitState( GLcontext *ctx )
+void i810InitState( struct gl_context *ctx )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
i810ScreenPrivate *i810Screen = imesa->i810Screen;
}
-static void i810InvalidateState( GLcontext *ctx, GLuint new_state )
+static void i810InvalidateState( struct gl_context *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
}
-void i810InitStateFuncs(GLcontext *ctx)
+void i810InitStateFuncs(struct gl_context *ctx)
{
/* Callbacks for internal Mesa events.
*/
#include "i810context.h"
-extern void i810InitState( GLcontext *ctx );
-extern void i810InitStateFuncs( GLcontext *ctx );
+extern void i810InitState( struct gl_context *ctx );
+extern void i810InitStateFuncs( struct gl_context *ctx );
extern void i810PrintDirty( const char *msg, GLuint state );
-extern void i810DrawBuffer(GLcontext *ctx, GLenum mode );
+extern void i810DrawBuffer(struct gl_context *ctx, GLenum mode );
extern void i810Fallback( i810ContextPtr imesa, GLuint bit, GLboolean mode );
#define FALLBACK( imesa, bit, mode ) i810Fallback( imesa, bit, mode )
#include "main/teximage.h"
#include "main/texobj.h"
#include "main/colormac.h"
-#include "main/texobj.h"
#include "main/mm.h"
#include "texmem.h"
static i810TextureObjectPtr
-i810AllocTexObj( GLcontext *ctx, struct gl_texture_object *texObj )
+i810AllocTexObj( struct gl_context *ctx, struct gl_texture_object *texObj )
{
i810TextureObjectPtr t;
i810ContextPtr imesa = I810_CONTEXT(ctx);
}
-static void i810TexParameter( GLcontext *ctx, GLenum target,
+static void i810TexParameter( struct gl_context *ctx, GLenum target,
struct gl_texture_object *tObj,
GLenum pname, const GLfloat *params )
{
* Determine whether or not \c param can be used instead of
* \c texUnit->EnvColor in the \c GL_TEXTURE_ENV_COLOR case.
*/
-static void i810TexEnv( GLcontext *ctx, GLenum target,
+static void i810TexEnv( struct gl_context *ctx, GLenum target,
GLenum pname, const GLfloat *param )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
#if 0
-static void i810TexImage1D( GLcontext *ctx, GLenum target, GLint level,
+static void i810TexImage1D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type,
}
}
-static void i810TexSubImage1D( GLcontext *ctx,
+static void i810TexSubImage1D( struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset,
#endif
-static void i810TexImage2D( GLcontext *ctx, GLenum target, GLint level,
+static void i810TexImage2D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
pixels, packing, texObj, texImage );
}
-static void i810TexSubImage2D( GLcontext *ctx,
+static void i810TexSubImage2D( struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
}
-static void i810BindTexture( GLcontext *ctx, GLenum target,
+static void i810BindTexture( struct gl_context *ctx, GLenum target,
struct gl_texture_object *tObj )
{
assert( (target != GL_TEXTURE_2D) || (tObj->DriverData != NULL) );
}
-static void i810DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
+static void i810DeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj )
{
driTextureObject * t = (driTextureObject *) tObj->DriverData;
if (t) {
* makes this routine pretty simple.
*/
static gl_format
-i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
+i810ChooseTextureFormat( struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
switch ( internalFormat ) {
* texture object from the core mesa gl_texture_object. Not done at this time.
*/
static struct gl_texture_object *
-i810NewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
+i810NewTextureObject( struct gl_context *ctx, GLuint name, GLenum target )
{
struct gl_texture_object *obj;
obj = _mesa_new_texture_object(ctx, name, target);
};
-void i810UpdateTextureState( GLcontext *ctx );
+void i810UpdateTextureState( struct gl_context *ctx );
void i810InitTextureFuncs( struct dd_function_table *functions );
void i810DestroyTexObj( i810ContextPtr imesa, i810TextureObjectPtr t );
* a reasonable place to make note of it.
*/
static GLboolean
-i810UpdateTexEnvCombine( GLcontext *ctx, GLuint unit,
+i810UpdateTexEnvCombine( struct gl_context *ctx, GLuint unit,
int * color_stage, int * alpha_stage )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
return GL_TRUE;
}
-static GLboolean enable_tex_common( GLcontext *ctx, GLuint unit )
+static GLboolean enable_tex_common( struct gl_context *ctx, GLuint unit )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
return GL_TRUE;
}
-static GLboolean enable_tex_rect( GLcontext *ctx, GLuint unit )
+static GLboolean enable_tex_rect( struct gl_context *ctx, GLuint unit )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
return GL_TRUE;
}
-static GLboolean enable_tex_2d( GLcontext *ctx, GLuint unit )
+static GLboolean enable_tex_2d( struct gl_context *ctx, GLuint unit )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
return GL_TRUE;
}
-static void disable_tex( GLcontext *ctx, GLuint unit )
+static void disable_tex( struct gl_context *ctx, GLuint unit )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
* 1D textures should be supported! Just use a 2D texture with the second
* texture coordinate value fixed at 0.0.
*/
-static void i810UpdateTexUnit( GLcontext *ctx, GLuint unit,
+static void i810UpdateTexUnit( struct gl_context *ctx, GLuint unit,
int * next_color_stage, int * next_alpha_stage )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
}
-void i810UpdateTextureState( GLcontext *ctx )
+void i810UpdateTextureState( struct gl_context *ctx )
{
static const unsigned color_pass[3] = {
GFX_OP_MAP_COLOR_STAGES | MC_STAGE_0 | MC_UPDATE_DEST | MC_DEST_CURRENT
#include "i810vb.h"
#include "i810ioctl.h"
-static void i810RenderPrimitive( GLcontext *ctx, GLenum prim );
+static void i810RenderPrimitive( struct gl_context *ctx, GLenum prim );
/***********************************************************************
* Emit primitives as inline vertices *
i810Vertex *v1,
i810Vertex *v2 )
{
- GLcontext *ctx = imesa->glCtx;
+ struct gl_context *ctx = imesa->glCtx;
SWvertex v[3];
i810_translate_vertex( ctx, v0, &v[0] );
i810_translate_vertex( ctx, v1, &v[1] );
i810Vertex *v0,
i810Vertex *v1 )
{
- GLcontext *ctx = imesa->glCtx;
+ struct gl_context *ctx = imesa->glCtx;
SWvertex v[2];
i810_translate_vertex( ctx, v0, &v[0] );
i810_translate_vertex( ctx, v1, &v[1] );
i810_fallback_point( i810ContextPtr imesa,
i810Vertex *v0 )
{
- GLcontext *ctx = imesa->glCtx;
+ struct gl_context *ctx = imesa->glCtx;
SWvertex v[1];
i810_translate_vertex( ctx, v0, &v[0] );
_swrast_Point( ctx, &v[0] );
-static void i810RenderClippedPoly( GLcontext *ctx, const GLuint *elts,
+static void i810RenderClippedPoly( struct gl_context *ctx, const GLuint *elts,
GLuint n )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
tnl->Driver.Render.PrimitiveNotify( ctx, prim );
}
-static void i810RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
+static void i810RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.Line( ctx, ii, jj );
}
-static void i810FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
+static void i810FastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts,
GLuint n )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
DD_TRI_STIPPLE)
#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-static void i810ChooseRenderState(GLcontext *ctx)
+static void i810ChooseRenderState(struct gl_context *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
i810ContextPtr imesa = I810_CONTEXT(ctx);
* which renders strips as strips, the equivalent calculations are
* performed in i810render.c.
*/
-static void i810RenderPrimitive( GLcontext *ctx, GLenum prim )
+static void i810RenderPrimitive( struct gl_context *ctx, GLenum prim )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
GLuint rprim = reduced_prim[prim];
}
}
-static void i810RunPipeline( GLcontext *ctx )
+static void i810RunPipeline( struct gl_context *ctx )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
_tnl_run_pipeline( ctx );
}
-static void i810RenderStart( GLcontext *ctx )
+static void i810RenderStart( struct gl_context *ctx )
{
/* Check for projective textureing. Make sure all texcoord
* pointers point to something. (fix in mesa?)
i810CheckTexSizes( ctx );
}
-static void i810RenderFinish( GLcontext *ctx )
+static void i810RenderFinish( struct gl_context *ctx )
{
if (I810_CONTEXT(ctx)->RenderIndex & I810_FALLBACK_BIT)
_swrast_flush( ctx );
/* System to flush dma and emit state changes based on the rasterized
* primitive.
*/
-void i810RasterPrimitive( GLcontext *ctx,
+void i810RasterPrimitive( struct gl_context *ctx,
GLenum rprim,
GLuint hwprim )
{
void i810Fallback( i810ContextPtr imesa, GLuint bit, GLboolean mode )
{
- GLcontext *ctx = imesa->glCtx;
+ struct gl_context *ctx = imesa->glCtx;
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint oldfallback = imesa->Fallback;
/**********************************************************************/
-void i810InitTriFuncs( GLcontext *ctx )
+void i810InitTriFuncs( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
static int firsttime = 1;
#include "main/mtypes.h"
extern void i810PrintRenderState( const char *msg, GLuint state );
-extern void i810InitTriFuncs( GLcontext *ctx );
-extern void i810RasterPrimitive( GLcontext *ctx, GLenum rprim, GLuint hwprim );
+extern void i810InitTriFuncs( struct gl_context *ctx );
+extern void i810RasterPrimitive( struct gl_context *ctx, GLenum rprim, GLuint hwprim );
#endif
#define I810_MAX_SETUP 0x80
static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
+ void (*emit)( struct gl_context *, GLuint, GLuint, void *, GLuint );
tnl_interp_func interp;
tnl_copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
+ GLboolean (*check_tex_sizes)( struct gl_context *ctx );
GLuint vertex_size;
GLuint vertex_format;
} setup_tab[I810_MAX_SETUP];
-void i810CheckTexSizes( GLcontext *ctx )
+void i810CheckTexSizes( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
i810ContextPtr imesa = I810_CONTEXT( ctx );
}
}
-void i810BuildVertices( GLcontext *ctx,
+void i810BuildVertices( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint newinputs )
}
}
-void i810ChooseVertexState( GLcontext *ctx )
+void i810ChooseVertexState( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
i810ContextPtr imesa = I810_CONTEXT( ctx );
-void *i810_emit_contiguous_verts( GLcontext *ctx,
+void *i810_emit_contiguous_verts( struct gl_context *ctx,
GLuint start,
GLuint count,
void *dest )
-void i810InitVB( GLcontext *ctx )
+void i810InitVB( struct gl_context *ctx )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
GLuint size = TNL_CONTEXT(ctx)->vb.Size;
}
-void i810FreeVB( GLcontext *ctx )
+void i810FreeVB( struct gl_context *ctx )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
if (imesa->verts) {
_NEW_FOG)
-extern void i810ChooseVertexState( GLcontext *ctx );
-extern void i810CheckTexSizes( GLcontext *ctx );
-extern void i810BuildVertices( GLcontext *ctx,
+extern void i810ChooseVertexState( struct gl_context *ctx );
+extern void i810CheckTexSizes( struct gl_context *ctx );
+extern void i810BuildVertices( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint newinputs );
-extern void *i810_emit_contiguous_verts( GLcontext *ctx,
+extern void *i810_emit_contiguous_verts( struct gl_context *ctx,
GLuint start,
GLuint count,
void *dest );
-extern void i810_translate_vertex( GLcontext *ctx,
+extern void i810_translate_vertex( struct gl_context *ctx,
const i810Vertex *src,
SWvertex *dst );
-extern void i810InitVB( GLcontext *ctx );
-extern void i810FreeVB( GLcontext *ctx );
+extern void i810InitVB( struct gl_context *ctx );
+extern void i810FreeVB( struct gl_context *ctx );
#endif
extern const struct tnl_pipeline_stage *intel_pipeline[];
GLboolean
-i830CreateContext(const __GLcontextModes * mesaVis,
+i830CreateContext(const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
struct dd_function_table functions;
struct i830_context *i830 = CALLOC_STRUCT(i830_context);
struct intel_context *intel = &i830->intel;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
if (!i830)
return GL_FALSE;
/* i830_context.c
*/
extern GLboolean
-i830CreateContext(const __GLcontextModes * mesaVis,
+i830CreateContext(const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
extern void i830EmitState(struct i830_context *i830);
extern void i830InitState(struct i830_context *i830);
-extern void i830_update_provoking_vertex(GLcontext *ctx);
+extern void i830_update_provoking_vertex(struct gl_context *ctx);
/*======================================================================
* Inline conversion functions. These are better-typed than the
* macros used previously:
*/
static INLINE struct i830_context *
-i830_context(GLcontext * ctx)
+i830_context(struct gl_context * ctx)
{
return (struct i830_context *) ctx;
}
#define FILE_DEBUG_FLAG DEBUG_STATE
static void
-i830StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref,
+i830StencilFuncSeparate(struct gl_context * ctx, GLenum face, GLenum func, GLint ref,
GLuint mask)
{
struct i830_context *i830 = i830_context(ctx);
}
static void
-i830StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask)
+i830StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask)
{
struct i830_context *i830 = i830_context(ctx);
}
static void
-i830StencilOpSeparate(GLcontext * ctx, GLenum face, GLenum fail, GLenum zfail,
+i830StencilOpSeparate(struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail,
GLenum zpass)
{
struct i830_context *i830 = i830_context(ctx);
}
static void
-i830AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref)
+i830AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref)
{
struct i830_context *i830 = i830_context(ctx);
int test = intel_translate_compare_func(func);
* I'm not sure which is correct.
*/
static void
-i830EvalLogicOpBlendState(GLcontext * ctx)
+i830EvalLogicOpBlendState(struct gl_context * ctx)
{
struct i830_context *i830 = i830_context(ctx);
}
static void
-i830BlendColor(GLcontext * ctx, const GLfloat color[4])
+i830BlendColor(struct gl_context * ctx, const GLfloat color[4])
{
struct i830_context *i830 = i830_context(ctx);
GLubyte r, g, b, a;
* change the interpretation of the blend function.
*/
static void
-i830_set_blend_state(GLcontext * ctx)
+i830_set_blend_state(struct gl_context * ctx)
{
struct i830_context *i830 = i830_context(ctx);
int funcA;
static void
-i830BlendEquationSeparate(GLcontext * ctx, GLenum modeRGB, GLenum modeA)
+i830BlendEquationSeparate(struct gl_context * ctx, GLenum modeRGB, GLenum modeA)
{
DBG("%s -> %s, %s\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(modeRGB),
static void
-i830BlendFuncSeparate(GLcontext * ctx, GLenum sfactorRGB,
+i830BlendFuncSeparate(struct gl_context * ctx, GLenum sfactorRGB,
GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA)
{
DBG("%s -> RGB(%s, %s) A(%s, %s)\n", __FUNCTION__,
static void
-i830DepthFunc(GLcontext * ctx, GLenum func)
+i830DepthFunc(struct gl_context * ctx, GLenum func)
{
struct i830_context *i830 = i830_context(ctx);
int test = intel_translate_compare_func(func);
}
static void
-i830DepthMask(GLcontext * ctx, GLboolean flag)
+i830DepthMask(struct gl_context * ctx, GLboolean flag)
{
struct i830_context *i830 = i830_context(ctx);
/** Called from ctx->Driver.Viewport() */
static void
-i830Viewport(GLcontext * ctx,
+i830Viewport(struct gl_context * ctx,
GLint x, GLint y, GLsizei width, GLsizei height)
{
intelCalcViewport(ctx);
/** Called from ctx->Driver.DepthRange() */
static void
-i830DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval)
+i830DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval)
{
intelCalcViewport(ctx);
}
* Fortunately stipple is usually a repeating pattern.
*/
static void
-i830PolygonStipple(GLcontext * ctx, const GLubyte * mask)
+i830PolygonStipple(struct gl_context * ctx, const GLubyte * mask)
{
struct i830_context *i830 = i830_context(ctx);
const GLubyte *m = mask;
* Hardware clipping
*/
static void
-i830Scissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+i830Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
struct i830_context *i830 = i830_context(ctx);
int x1, y1, x2, y2;
}
static void
-i830LogicOp(GLcontext * ctx, GLenum opcode)
+i830LogicOp(struct gl_context * ctx, GLenum opcode)
{
struct i830_context *i830 = i830_context(ctx);
int tmp = intel_translate_logic_op(opcode);
static void
-i830CullFaceFrontFace(GLcontext * ctx, GLenum unused)
+i830CullFaceFrontFace(struct gl_context * ctx, GLenum unused)
{
struct i830_context *i830 = i830_context(ctx);
GLuint mode;
}
static void
-i830LineWidth(GLcontext * ctx, GLfloat widthf)
+i830LineWidth(struct gl_context * ctx, GLfloat widthf)
{
struct i830_context *i830 = i830_context(ctx);
int width;
}
static void
-i830PointSize(GLcontext * ctx, GLfloat size)
+i830PointSize(struct gl_context * ctx, GLfloat size)
{
struct i830_context *i830 = i830_context(ctx);
GLint point_size = (int) size;
*/
static void
-i830ColorMask(GLcontext * ctx,
+i830ColorMask(struct gl_context * ctx,
GLboolean r, GLboolean g, GLboolean b, GLboolean a)
{
struct i830_context *i830 = i830_context(ctx);
}
static void
-update_specular(GLcontext * ctx)
+update_specular(struct gl_context * ctx)
{
struct i830_context *i830 = i830_context(ctx);
}
static void
-i830LightModelfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
+i830LightModelfv(struct gl_context * ctx, GLenum pname, const GLfloat * param)
{
DBG("%s\n", __FUNCTION__);
/* In Mesa 3.5 we can reliably do native flatshading.
*/
static void
-i830ShadeModel(GLcontext * ctx, GLenum mode)
+i830ShadeModel(struct gl_context * ctx, GLenum mode)
{
struct i830_context *i830 = i830_context(ctx);
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
* Fog
*/
static void
-i830Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
+i830Fogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param)
{
struct i830_context *i830 = i830_context(ctx);
*/
static void
-i830Enable(GLcontext * ctx, GLenum cap, GLboolean state)
+i830Enable(struct gl_context * ctx, GLenum cap, GLboolean state)
{
struct i830_context *i830 = i830_context(ctx);
}
void
-i830_update_provoking_vertex(GLcontext * ctx)
+i830_update_provoking_vertex(struct gl_context * ctx)
{
struct i830_context *i830 = i830_context(ctx);
void
i830InitState(struct i830_context *i830)
{
- GLcontext *ctx = &i830->intel.ctx;
+ struct gl_context *ctx = &i830->intel.ctx;
i830_init_packets(i830);
void
i830EmitTextureBlend(struct i830_context *i830)
{
- GLcontext *ctx = &i830->intel.ctx;
+ struct gl_context *ctx = &i830->intel.ctx;
GLuint unit, last_stage = 0, blendunit = 0;
I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND_ALL, GL_FALSE);
static GLboolean
i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
{
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
struct i830_context *i830 = i830_context(ctx);
struct gl_texture_unit *tUnit = &ctx->Texture.Unit[unit];
struct gl_texture_object *tObj = tUnit->_Current;
static void
i830_render_start(struct intel_context *intel)
{
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
struct i830_context *i830 = i830_context(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
GLuint num_regions)
{
struct i830_context *i830 = i830_context(&intel->ctx);
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
GLuint value;
{
struct i830_context *i830 = i830_context(&intel->ctx);
assert(!get_dirty(&i830->state));
+ (void) i830;
}
static void
#include "i915_reg.h"
#include "i915_program.h"
-#include "intel_tris.h"
#include "intel_span.h"
/***************************************
/* Override intel default.
*/
static void
-i915InvalidateState(GLcontext * ctx, GLuint new_state)
+i915InvalidateState(struct gl_context * ctx, GLuint new_state)
{
_swrast_InvalidateState(ctx, new_state);
_swsetup_InvalidateState(ctx, new_state);
GLboolean
i915CreateContext(int api,
- const __GLcontextModes * mesaVis,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
struct i915_context *i915 =
(struct i915_context *) CALLOC_STRUCT(i915_context);
struct intel_context *intel = &i915->intel;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
if (!i915)
return GL_FALSE;
/* TODO: split between the stored representation of a program and
* the state used to build that representation.
*/
- GLcontext *ctx;
+ struct gl_context *ctx;
/* declarations contains the packet header. */
GLuint declarations[I915_MAX_DECL_INSN * 3 + 1];
* i915_context.c
*/
extern GLboolean i915CreateContext(int api,
- const __GLcontextModes * mesaVis,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
*/
extern void i915InitStateFunctions(struct dd_function_table *functions);
extern void i915InitState(struct i915_context *i915);
-extern void i915_update_fog(GLcontext * ctx);
-extern void i915_update_stencil(GLcontext * ctx);
-extern void i915_update_provoking_vertex(GLcontext *ctx);
+extern void i915_update_fog(struct gl_context * ctx);
+extern void i915_update_stencil(struct gl_context * ctx);
+extern void i915_update_provoking_vertex(struct gl_context *ctx);
/*======================================================================
* macros used previously:
*/
static INLINE struct i915_context *
-i915_context(GLcontext * ctx)
+i915_context(struct gl_context * ctx)
{
return (struct i915_context *) ctx;
}
static void
-i915BindProgram(GLcontext * ctx, GLenum target, struct gl_program *prog)
+i915BindProgram(struct gl_context * ctx, GLenum target, struct gl_program *prog)
{
if (target == GL_FRAGMENT_PROGRAM_ARB) {
struct i915_context *i915 = I915_CONTEXT(ctx);
}
static struct gl_program *
-i915NewProgram(GLcontext * ctx, GLenum target, GLuint id)
+i915NewProgram(struct gl_context * ctx, GLenum target, GLuint id)
{
switch (target) {
case GL_VERTEX_PROGRAM_ARB:
}
static void
-i915DeleteProgram(GLcontext * ctx, struct gl_program *prog)
+i915DeleteProgram(struct gl_context * ctx, struct gl_program *prog)
{
if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) {
struct i915_context *i915 = I915_CONTEXT(ctx);
static GLboolean
-i915IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog)
+i915IsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog)
{
if (target == GL_FRAGMENT_PROGRAM_ARB) {
struct i915_fragment_program *p = (struct i915_fragment_program *) prog;
}
static GLboolean
-i915ProgramStringNotify(GLcontext * ctx,
+i915ProgramStringNotify(struct gl_context * ctx,
GLenum target, struct gl_program *prog)
{
if (target == GL_FRAGMENT_PROGRAM_ARB) {
}
void
-i915_update_program(GLcontext *ctx)
+i915_update_program(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
struct i915_context *i915 = i915_context(&intel->ctx);
void
i915ValidateFragmentProgram(struct i915_context *i915)
{
- GLcontext *ctx = &i915->intel.ctx;
+ struct gl_context *ctx = &i915->intel.ctx;
struct intel_context *intel = intel_context(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
void
i915_init_program(struct i915_context *i915, struct i915_fragment_program *p)
{
- GLcontext *ctx = &i915->intel.ctx;
+ struct gl_context *ctx = &i915->intel.ctx;
p->translated = 0;
p->params_uptodate = 0;
extern void i915_fini_program(struct i915_fragment_program *p);
-extern void i915_update_program(GLcontext *ctx);
+extern void i915_update_program(struct gl_context *ctx);
#endif
#define FILE_DEBUG_FLAG DEBUG_STATE
void
-i915_update_stencil(GLcontext * ctx)
+i915_update_stencil(struct gl_context * ctx)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
GLuint front_ref, front_writemask, front_mask;
}
static void
-i915StencilFuncSeparate(GLcontext * ctx, GLenum face, GLenum func, GLint ref,
+i915StencilFuncSeparate(struct gl_context * ctx, GLenum face, GLenum func, GLint ref,
GLuint mask)
{
}
static void
-i915StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask)
+i915StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask)
{
}
static void
-i915StencilOpSeparate(GLcontext * ctx, GLenum face, GLenum fail, GLenum zfail,
+i915StencilOpSeparate(struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail,
GLenum zpass)
{
}
static void
-i915AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref)
+i915AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
int test = intel_translate_compare_func(func);
* calls to glEnable.
*/
static void
-i915EvalLogicOpBlendState(GLcontext * ctx)
+i915EvalLogicOpBlendState(struct gl_context * ctx)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
}
static void
-i915BlendColor(GLcontext * ctx, const GLfloat color[4])
+i915BlendColor(struct gl_context * ctx, const GLfloat color[4])
{
struct i915_context *i915 = I915_CONTEXT(ctx);
GLubyte r, g, b, a;
}
static void
-i915UpdateBlendState(GLcontext * ctx)
+i915UpdateBlendState(struct gl_context * ctx)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
GLuint iab = (i915->state.Ctx[I915_CTXREG_IAB] &
static void
-i915BlendFuncSeparate(GLcontext * ctx, GLenum srcRGB,
+i915BlendFuncSeparate(struct gl_context * ctx, GLenum srcRGB,
GLenum dstRGB, GLenum srcA, GLenum dstA)
{
i915UpdateBlendState(ctx);
static void
-i915BlendEquationSeparate(GLcontext * ctx, GLenum eqRGB, GLenum eqA)
+i915BlendEquationSeparate(struct gl_context * ctx, GLenum eqRGB, GLenum eqA)
{
i915UpdateBlendState(ctx);
}
static void
-i915DepthFunc(GLcontext * ctx, GLenum func)
+i915DepthFunc(struct gl_context * ctx, GLenum func)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
int test = intel_translate_compare_func(func);
}
static void
-i915DepthMask(GLcontext * ctx, GLboolean flag)
+i915DepthMask(struct gl_context * ctx, GLboolean flag)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
* - window pos/size or FBO size
*/
void
-intelCalcViewport(GLcontext * ctx)
+intelCalcViewport(struct gl_context * ctx)
{
struct intel_context *intel = intel_context(ctx);
const GLfloat *v = ctx->Viewport._WindowMap.m;
/** Called from ctx->Driver.Viewport() */
static void
-i915Viewport(GLcontext * ctx,
+i915Viewport(struct gl_context * ctx,
GLint x, GLint y, GLsizei width, GLsizei height)
{
intelCalcViewport(ctx);
/** Called from ctx->Driver.DepthRange() */
static void
-i915DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval)
+i915DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval)
{
intelCalcViewport(ctx);
}
* Fortunately stipple is usually a repeating pattern.
*/
static void
-i915PolygonStipple(GLcontext * ctx, const GLubyte * mask)
+i915PolygonStipple(struct gl_context * ctx, const GLubyte * mask)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
const GLubyte *m;
* Hardware clipping
*/
static void
-i915Scissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+i915Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
int x1, y1, x2, y2;
}
static void
-i915LogicOp(GLcontext * ctx, GLenum opcode)
+i915LogicOp(struct gl_context * ctx, GLenum opcode)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
int tmp = intel_translate_logic_op(opcode);
static void
-i915CullFaceFrontFace(GLcontext * ctx, GLenum unused)
+i915CullFaceFrontFace(struct gl_context * ctx, GLenum unused)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
GLuint mode;
}
static void
-i915LineWidth(GLcontext * ctx, GLfloat widthf)
+i915LineWidth(struct gl_context * ctx, GLfloat widthf)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
int lis4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_LINE_WIDTH_MASK;
}
static void
-i915PointSize(GLcontext * ctx, GLfloat size)
+i915PointSize(struct gl_context * ctx, GLfloat size)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
int lis4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_POINT_WIDTH_MASK;
static void
-i915PointParameterfv(GLcontext * ctx, GLenum pname, const GLfloat *params)
+i915PointParameterfv(struct gl_context * ctx, GLenum pname, const GLfloat *params)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
*/
static void
-i915ColorMask(GLcontext * ctx,
+i915ColorMask(struct gl_context * ctx,
GLboolean r, GLboolean g, GLboolean b, GLboolean a)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
}
static void
-update_specular(GLcontext * ctx)
+update_specular(struct gl_context * ctx)
{
/* A hack to trigger the rebuild of the fragment program.
*/
}
static void
-i915LightModelfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
+i915LightModelfv(struct gl_context * ctx, GLenum pname, const GLfloat * param)
{
DBG("%s\n", __FUNCTION__);
}
static void
-i915ShadeModel(GLcontext * ctx, GLenum mode)
+i915ShadeModel(struct gl_context * ctx, GLenum mode)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
* Fog
*/
void
-i915_update_fog(GLcontext * ctx)
+i915_update_fog(struct gl_context * ctx)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
GLenum mode;
}
static void
-i915Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param)
+i915Fogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
}
static void
-i915Hint(GLcontext * ctx, GLenum target, GLenum state)
+i915Hint(struct gl_context * ctx, GLenum target, GLenum state)
{
switch (target) {
case GL_FOG_HINT:
*/
static void
-i915Enable(GLcontext * ctx, GLenum cap, GLboolean state)
+i915Enable(struct gl_context * ctx, GLenum cap, GLboolean state)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
}
void
-i915_update_provoking_vertex(GLcontext * ctx)
+i915_update_provoking_vertex(struct gl_context * ctx)
{
struct i915_context *i915 = I915_CONTEXT(ctx);
void
i915InitState(struct i915_context *i915)
{
- GLcontext *ctx = &i915->intel.ctx;
+ struct gl_context *ctx = &i915->intel.ctx;
i915_init_packets(i915);
static GLboolean
i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
{
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
struct i915_context *i915 = i915_context(ctx);
struct gl_texture_unit *tUnit = &ctx->Texture.Unit[unit];
struct gl_texture_object *tObj = tUnit->_Current;
GLuint num_regions)
{
struct i915_context *i915 = i915_context(&intel->ctx);
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0];
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
GLuint value;
struct i915_context *i915 = i915_context(&intel->ctx);
GLuint dirty = get_dirty(&i915->state);
assert(!dirty);
+ (void) dirty;
}
void
static GLboolean
-intel_run_render(GLcontext * ctx, struct tnl_pipeline_stage *stage)
+intel_run_render(struct gl_context * ctx, struct tnl_pipeline_stage *stage)
{
struct intel_context *intel = intel_context(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
#include "i830_context.h"
#include "i830_reg.h"
-static void intelRenderPrimitive(GLcontext * ctx, GLenum prim);
-static void intelRasterPrimitive(GLcontext * ctx, GLenum rprim,
+static void intelRenderPrimitive(struct gl_context * ctx, GLenum prim);
+static void intelRasterPrimitive(struct gl_context * ctx, GLenum rprim,
GLuint hwprim);
static void
static void
intel_atten_point(struct intel_context *intel, intelVertexPtr v0)
{
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
GLfloat psz[4], col[4], restore_psz, restore_alpha;
_tnl_get_attr(ctx, v0, _TNL_ATTRIB_POINTSIZE, psz);
intel_fallback_tri(struct intel_context *intel,
intelVertex * v0, intelVertex * v1, intelVertex * v2)
{
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
SWvertex v[3];
if (0)
intel_fallback_line(struct intel_context *intel,
intelVertex * v0, intelVertex * v1)
{
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
SWvertex v[2];
if (0)
intel_fallback_point(struct intel_context *intel,
intelVertex * v0)
{
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
SWvertex v[1];
if (0)
static void
-intelRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n)
+intelRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint n)
{
struct intel_context *intel = intel_context(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
static void
-intelRenderClippedLine(GLcontext * ctx, GLuint ii, GLuint jj)
+intelRenderClippedLine(struct gl_context * ctx, GLuint ii, GLuint jj)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
static void
-intelFastRenderClippedPoly(GLcontext * ctx, const GLuint * elts, GLuint n)
+intelFastRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint n)
{
struct intel_context *intel = intel_context(ctx);
const GLuint vertsize = intel->vertex_size;
#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET | DD_TRI_UNFILLED)
void
-intelChooseRenderState(GLcontext * ctx)
+intelChooseRenderState(struct gl_context * ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct intel_context *intel = intel_context(ctx);
static void
-intelRunPipeline(GLcontext * ctx)
+intelRunPipeline(struct gl_context * ctx)
{
struct intel_context *intel = intel_context(ctx);
}
static void
-intelRenderStart(GLcontext * ctx)
+intelRenderStart(struct gl_context * ctx)
{
struct intel_context *intel = intel_context(ctx);
}
static void
-intelRenderFinish(GLcontext * ctx)
+intelRenderFinish(struct gl_context * ctx)
{
struct intel_context *intel = intel_context(ctx);
* primitive.
*/
static void
-intelRasterPrimitive(GLcontext * ctx, GLenum rprim, GLuint hwprim)
+intelRasterPrimitive(struct gl_context * ctx, GLenum rprim, GLuint hwprim)
{
struct intel_context *intel = intel_context(ctx);
/*
*/
static void
-intelRenderPrimitive(GLcontext * ctx, GLenum prim)
+intelRenderPrimitive(struct gl_context * ctx, GLenum prim)
{
struct intel_context *intel = intel_context(ctx);
void
intelFallback(struct intel_context *intel, GLbitfield bit, GLboolean mode)
{
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
TNLcontext *tnl = TNL_CONTEXT(ctx);
const GLbitfield oldfallback = intel->Fallback;
void
-intelInitTriFuncs(GLcontext * ctx)
+intelInitTriFuncs(struct gl_context * ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
static int firsttime = 1;
_NEW_PROGRAM | \
_NEW_POLYGONSTIPPLE)
-extern void intelInitTriFuncs(GLcontext * ctx);
+extern void intelInitTriFuncs(struct gl_context * ctx);
-extern void intelChooseRenderState(GLcontext * ctx);
+extern void intelChooseRenderState(struct gl_context * ctx);
void intel_set_prim(struct intel_context *intel, uint32_t prim);
GLuint *intel_get_prim_space(struct intel_context *intel, unsigned int count);
$(DRIVER_SOURCES)
CXX_SOURCES = \
+ brw_cubemap_normalize.cpp \
brw_fs.cpp \
brw_fs_channel_expressions.cpp \
brw_fs_vector_splitting.cpp
void
brw_update_cc_vp(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct brw_cc_viewport ccv;
memset(&ccv, 0, sizeof(ccv));
static void upload_cc_unit(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct brw_cc_unit_state cc;
void *map;
static void upload_clip_prog(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
struct brw_clip_prog_key key;
memset(&key, 0, sizeof(key));
static void
clip_unit_populate_key(struct brw_context *brw, struct brw_clip_unit_key *key)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
memset(key, 0, sizeof(*key));
/* CACHE_NEW_CLIP_PROG */
}
GLboolean brwCreateContext( int api,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{
struct dd_function_table functions;
struct brw_context *brw = (struct brw_context *) CALLOC_STRUCT(brw_context);
struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
unsigned i;
if (!brw) {
(i == MESA_SHADER_FRAGMENT);
ctx->ShaderCompilerOptions[i].EmitNoIndirectTemp =
(i == MESA_SHADER_FRAGMENT);
+
+ if (intel->gen == 6)
+ ctx->ShaderCompilerOptions[i].EmitNoIfs = GL_TRUE;
}
ctx->Const.VertexProgram.MaxNativeInstructions = (16 * 1024);
* brw_context.c
*/
GLboolean brwCreateContext( int api,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate);
int brw_disasm (FILE *file, struct brw_instruction *inst, int gen);
/* brw_state.c */
-void brw_enable(GLcontext * ctx, GLenum cap, GLboolean state);
-void brw_depth_range(GLcontext *ctx, GLclampd nearval, GLclampd farval);
+void brw_enable(struct gl_context * ctx, GLenum cap, GLboolean state);
+void brw_depth_range(struct gl_context *ctx, GLclampd nearval, GLclampd farval);
/*======================================================================
* Inline conversion functions. These are better-typed than the
* macros used previously:
*/
static INLINE struct brw_context *
-brw_context( GLcontext *ctx )
+brw_context( struct gl_context *ctx )
{
return (struct brw_context *)ctx;
}
return (const struct brw_fragment_program *) p;
}
+GLboolean brw_do_cubemap_normalize(struct exec_list *instructions);
+
#endif
--- /dev/null
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file brw_cubemap_normalize.cpp
+ *
+ * IR lower pass to perform the normalization of the cubemap coordinates to
+ * have the largest magnitude component be -1.0 or 1.0.
+ *
+ * \author Eric Anholt <eric@anholt.net>
+ */
+
+#include "../glsl/glsl_types.h"
+#include "../glsl/ir.h"
+
+class brw_cubemap_normalize_visitor : public ir_hierarchical_visitor {
+public:
+ brw_cubemap_normalize_visitor()
+ {
+ progress = false;
+ }
+
+ ir_visitor_status visit_leave(ir_texture *ir);
+
+ bool progress;
+};
+
+ir_visitor_status
+brw_cubemap_normalize_visitor::visit_leave(ir_texture *ir)
+{
+ if (ir->sampler->type->sampler_dimensionality != GLSL_SAMPLER_DIM_CUBE)
+ return visit_continue;
+
+ void *mem_ctx = talloc_parent(ir);
+
+ ir_variable *var = new(mem_ctx) ir_variable(ir->coordinate->type,
+ "coordinate", ir_var_auto);
+ base_ir->insert_before(var);
+ ir_dereference *deref = new(mem_ctx) ir_dereference_variable(var);
+ ir_assignment *assign = new(mem_ctx) ir_assignment(deref, ir->coordinate,
+ NULL);
+ base_ir->insert_before(assign);
+
+ deref = new(mem_ctx) ir_dereference_variable(var);
+ ir_rvalue *swiz0 = new(mem_ctx) ir_swizzle(deref, 0, 0, 0, 0, 1);
+ deref = new(mem_ctx) ir_dereference_variable(var);
+ ir_rvalue *swiz1 = new(mem_ctx) ir_swizzle(deref, 1, 0, 0, 0, 1);
+ deref = new(mem_ctx) ir_dereference_variable(var);
+ ir_rvalue *swiz2 = new(mem_ctx) ir_swizzle(deref, 2, 0, 0, 0, 1);
+
+ swiz0 = new(mem_ctx) ir_expression(ir_unop_abs, swiz0->type, swiz0, NULL);
+ swiz1 = new(mem_ctx) ir_expression(ir_unop_abs, swiz1->type, swiz1, NULL);
+ swiz2 = new(mem_ctx) ir_expression(ir_unop_abs, swiz2->type, swiz2, NULL);
+
+ ir_expression *expr;
+ expr = new(mem_ctx) ir_expression(ir_binop_max,
+ glsl_type::float_type,
+ swiz0, swiz1);
+
+ expr = new(mem_ctx) ir_expression(ir_binop_max,
+ glsl_type::float_type,
+ expr, swiz2);
+
+ expr = new(mem_ctx) ir_expression(ir_unop_rcp,
+ glsl_type::float_type,
+ expr, NULL);
+
+ deref = new(mem_ctx) ir_dereference_variable(var);
+ ir->coordinate = new(mem_ctx) ir_expression(ir_binop_mul,
+ ir->coordinate->type,
+ deref,
+ expr);
+
+ progress = true;
+ return visit_continue;
+}
+
+extern "C" {
+
+GLboolean
+brw_do_cubemap_normalize(exec_list *instructions)
+{
+ brw_cubemap_normalize_visitor v;
+
+ visit_list_elements(&v, instructions);
+
+ return v.progress;
+}
+
+}
*/
static void calculate_curbe_offsets( struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
/* CACHE_NEW_WM_PROG */
const GLuint nr_fp_regs = (brw->wm.prog_data->nr_params + 15) / 16;
*/
static void prepare_constant_buffer(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
const struct brw_vertex_program *vp =
brw_vertex_program_const(brw->vertex_program);
const GLuint sz = brw->curbe.total_size;
#define BRW_MASK_ENABLE 0
#define BRW_MASK_DISABLE 1
-/* Sandybridge is WECtrl (Write enable control) */
+/** @{
+ *
+ * Gen6 has replaced "mask enable/disable" with WECtrl, which is
+ * effectively the same but much simpler to think about. Now, there
+ * are two contributors ANDed together to whether channels are
+ * executed: The predication on the instruction, and the channel write
+ * enable.
+ */
+/**
+ * This is the default value. It means that a channel's write enable is set
+ * if the per-channel IP is pointing at this instruction.
+ */
#define BRW_WE_NORMAL 0
-#define BRW_WE_KILL_PRED 1
+/**
+ * This is used like BRW_MASK_DISABLE, and causes all channels to have
+ * their write enable set. Note that predication still contributes to
+ * whether the channel actually gets written.
+ */
+#define BRW_WE_ALL 1
+/** @} */
#define BRW_OPCODE_MOV 1
#define BRW_OPCODE_SEL 2
};
char *wectrl[2] = {
- [0] = "WEnormal",
- [1] = "WEpredicted"
+ [0] = "WE_normal",
+ [1] = "WE_all"
};
char *exec_size[8] = {
string (file, ")");
}
- if (inst->header.opcode == BRW_OPCODE_SEND)
+ if (inst->header.opcode == BRW_OPCODE_SEND && gen < 6)
format (file, " %d", inst->header.destreg__conditionalmod);
if (opcode[inst->header.opcode].ndst > 0) {
pad (file, 16);
err |= dest (file, inst);
+ } else if (gen >= 6 && (inst->header.opcode == BRW_OPCODE_IF ||
+ inst->header.opcode == BRW_OPCODE_ELSE ||
+ inst->header.opcode == BRW_OPCODE_ENDIF)) {
+ format (file, " %d", inst->bits1.branch_gen6.jump_count);
}
+
if (opcode[inst->header.opcode].nsrc > 0) {
pad (file, 32);
err |= src0 (file, inst);
static GLuint brw_set_prim(struct brw_context *brw,
const struct _mesa_prim *prim)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
GLenum mode = prim->mode;
if (INTEL_DEBUG & DEBUG_PRIMS)
const struct _mesa_prim *prim,
GLuint nr_prims )
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
GLuint i;
/* If we don't require strict OpenGL conformance, never
/* May fail if out of video memory for texture or vbo upload, or on
* fallback conditions.
*/
-static GLboolean brw_try_draw_prims( GLcontext *ctx,
+static GLboolean brw_try_draw_prims( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
return retval;
}
-void brw_draw_prims( GLcontext *ctx,
+void brw_draw_prims( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
/* Decide if we want to rebase. If so we end up recursing once
* only into this function.
*/
- if (min_index != 0) {
+ if (min_index != 0 && !vbo_any_varyings_in_vbos(arrays)) {
vbo_rebase_prims(ctx, arrays,
prim, nr_prims,
ib, min_index, max_index,
void brw_draw_init( struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct vbo_context *vbo = vbo_context(ctx);
/* Register our drawing function:
#ifndef BRW_DRAW_H
#define BRW_DRAW_H
-#include "main/mtypes.h" /* for GLcontext... */
+#include "main/mtypes.h" /* for struct gl_context... */
#include "vbo/vbo.h"
struct brw_context;
-void brw_draw_prims( GLcontext *ctx,
+void brw_draw_prims( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prims,
GLuint nr_prims,
/* brw_draw_current.c
*/
-void brw_init_current_values(GLcontext *ctx,
+void brw_init_current_values(struct gl_context *ctx,
struct gl_client_array *arrays);
#endif
static void brw_prepare_vertices(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct intel_context *intel = intel_context(ctx);
GLbitfield vs_inputs = brw->vs.prog_data->inputs_read;
GLuint i;
*/
assert(input->offset < input->bo->size);
} else {
- input->count = input->glarray->StrideB ? max_index + 1 - min_index : 1;
+ input->count = input->glarray->StrideB ? max_index + 1 : 1;
if (input->bo != NULL) {
/* Already-uploaded vertex data is present from a previous
* prepare_vertices, but we had to re-validate state due to
}
upload[nr_uploads++] = input;
-
- /* We rebase drawing to start at element zero only when
- * varyings are not in vbos, which means we can end up
- * uploading non-varying arrays (stride != 0) when min_index
- * is zero. This doesn't matter as the amount to upload is
- * the same for these arrays whether the draw call is rebased
- * or not - we just have to upload the one element.
- */
- assert(min_index == 0 || input->glarray->StrideB == 0);
}
}
static void brw_emit_vertices(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct intel_context *intel = intel_context(ctx);
GLuint i;
static void brw_prepare_indices(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct intel_context *intel = &brw->intel;
const struct _mesa_index_buffer *index_buffer = brw->ib.ib;
GLuint ib_size;
struct brw_reg src0, \
struct brw_reg src1);
+#define ROUND(OP) \
+void brw_##OP(struct brw_compile *p, struct brw_reg dest, struct brw_reg src0);
+
+
ALU1(MOV)
ALU2(SEL)
ALU1(NOT)
ALU2(MUL)
ALU1(FRC)
ALU1(RNDD)
-ALU1(RNDZ)
ALU2(MAC)
ALU2(MACH)
ALU1(LZD)
ALU2(LINE)
ALU2(PLN)
+ROUND(RNDZ)
+ROUND(RNDE)
+
#undef ALU1
#undef ALU2
-
+#undef ROUND
/* Helpers for SEND instruction:
*/
struct brw_instruction *brw_IF(struct brw_compile *p,
GLuint execute_size);
+struct brw_instruction *brw_IF_gen6(struct brw_compile *p, uint32_t conditional,
+ struct brw_reg src0, struct brw_reg src1);
struct brw_instruction *brw_ELSE(struct brw_compile *p,
struct brw_instruction *if_insn);
GLuint msg_control,
GLuint msg_type,
GLuint msg_length,
+ GLboolean header_present,
GLuint pixel_scoreboard_clear,
GLuint response_length,
GLuint end_of_thread,
insn->bits3.dp_render_cache.pixel_scoreboard_clear = pixel_scoreboard_clear;
insn->bits3.dp_render_cache.msg_type = msg_type;
insn->bits3.dp_render_cache.send_commit_msg = send_commit_msg;
- insn->bits3.dp_render_cache.header_present = 0; /* XXX */
+ insn->bits3.dp_render_cache.header_present = header_present;
insn->bits3.dp_render_cache.response_length = response_length;
insn->bits3.dp_render_cache.msg_length = msg_length;
insn->bits3.dp_render_cache.end_of_thread = end_of_thread;
insn->bits3.dp_write_gen5.pixel_scoreboard_clear = pixel_scoreboard_clear;
insn->bits3.dp_write_gen5.msg_type = msg_type;
insn->bits3.dp_write_gen5.send_commit_msg = send_commit_msg;
- insn->bits3.dp_write_gen5.header_present = 1;
+ insn->bits3.dp_write_gen5.header_present = header_present;
insn->bits3.dp_write_gen5.response_length = response_length;
insn->bits3.dp_write_gen5.msg_length = msg_length;
insn->bits3.dp_write_gen5.end_of_thread = end_of_thread;
return brw_alu2(p, BRW_OPCODE_##OP, dest, src0, src1); \
}
+/* Rounding operations (other than RNDD) require two instructions - the first
+ * stores a rounded value (possibly the wrong way) in the dest register, but
+ * also sets a per-channel "increment bit" in the flag register. A predicated
+ * add of 1.0 fixes dest to contain the desired result.
+ */
+#define ROUND(OP) \
+void brw_##OP(struct brw_compile *p, \
+ struct brw_reg dest, \
+ struct brw_reg src) \
+{ \
+ struct brw_instruction *rnd, *add; \
+ rnd = next_insn(p, BRW_OPCODE_##OP); \
+ brw_set_dest(rnd, dest); \
+ brw_set_src0(rnd, src); \
+ rnd->header.destreg__conditionalmod = 0x7; /* turn on round-increments */ \
+ \
+ add = brw_ADD(p, dest, dest, brw_imm_f(1.0f)); \
+ add->header.predicate_control = BRW_PREDICATE_NORMAL; \
+}
+
ALU1(MOV)
ALU2(SEL)
ALU2(ASR)
ALU1(FRC)
ALU1(RNDD)
-ALU1(RNDZ)
ALU2(MAC)
ALU2(MACH)
ALU1(LZD)
ALU2(LINE)
ALU2(PLN)
+
+ROUND(RNDZ)
+ROUND(RNDE)
+
+
struct brw_instruction *brw_ADD(struct brw_compile *p,
struct brw_reg dest,
struct brw_reg src0,
*/
struct brw_instruction *brw_IF(struct brw_compile *p, GLuint execute_size)
{
+ struct intel_context *intel = &p->brw->intel;
struct brw_instruction *insn;
if (p->single_program_flow) {
/* Override the defaults for this instruction:
*/
- brw_set_dest(insn, brw_ip_reg());
- brw_set_src0(insn, brw_ip_reg());
- brw_set_src1(insn, brw_imm_d(0x0));
+ if (intel->gen < 6) {
+ brw_set_dest(insn, brw_ip_reg());
+ brw_set_src0(insn, brw_ip_reg());
+ brw_set_src1(insn, brw_imm_d(0x0));
+ } else {
+ brw_set_dest(insn, brw_imm_w(0));
+ insn->bits1.branch_gen6.jump_count = 0;
+ brw_set_src0(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
+ brw_set_src1(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
+ }
insn->header.execution_size = execute_size;
insn->header.compression_control = BRW_COMPRESSION_NONE;
return insn;
}
+struct brw_instruction *
+brw_IF_gen6(struct brw_compile *p, uint32_t conditional,
+ struct brw_reg src0, struct brw_reg src1)
+{
+ struct brw_instruction *insn;
+
+ insn = next_insn(p, BRW_OPCODE_IF);
+
+ brw_set_dest(insn, brw_imm_w(0));
+ insn->header.execution_size = BRW_EXECUTE_8;
+ insn->bits1.branch_gen6.jump_count = 0;
+ brw_set_src0(insn, src0);
+ brw_set_src1(insn, src1);
+
+ assert(insn->header.compression_control == BRW_COMPRESSION_NONE);
+ assert(insn->header.predicate_control == BRW_PREDICATE_NONE);
+ insn->header.destreg__conditionalmod = conditional;
+
+ if (!p->single_program_flow)
+ insn->header.thread_control = BRW_THREAD_SWITCH;
+
+ return insn;
+}
struct brw_instruction *brw_ELSE(struct brw_compile *p,
struct brw_instruction *if_insn)
insn = next_insn(p, BRW_OPCODE_ELSE);
}
- brw_set_dest(insn, brw_ip_reg());
- brw_set_src0(insn, brw_ip_reg());
- brw_set_src1(insn, brw_imm_d(0x0));
+ if (intel->gen < 6) {
+ brw_set_dest(insn, brw_ip_reg());
+ brw_set_src0(insn, brw_ip_reg());
+ brw_set_src1(insn, brw_imm_d(0x0));
+ } else {
+ brw_set_dest(insn, brw_imm_w(0));
+ insn->bits1.branch_gen6.jump_count = 0;
+ brw_set_src0(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
+ brw_set_src1(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
+ }
insn->header.compression_control = BRW_COMPRESSION_NONE;
insn->header.execution_size = if_insn->header.execution_size;
} else {
assert(if_insn->header.opcode == BRW_OPCODE_IF);
- if_insn->bits3.if_else.jump_count = br * (insn - if_insn);
- if_insn->bits3.if_else.pop_count = 0;
- if_insn->bits3.if_else.pad0 = 0;
+ if (intel->gen < 6) {
+ if_insn->bits3.if_else.jump_count = br * (insn - if_insn);
+ if_insn->bits3.if_else.pop_count = 0;
+ if_insn->bits3.if_else.pad0 = 0;
+ } else {
+ if_insn->bits1.branch_gen6.jump_count = br * (insn - if_insn + 1);
+ }
}
return insn;
} else {
struct brw_instruction *insn = next_insn(p, BRW_OPCODE_ENDIF);
- brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD));
- brw_set_src0(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD));
- brw_set_src1(insn, brw_imm_d(0x0));
+ if (intel->gen < 6) {
+ brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD));
+ brw_set_src0(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD));
+ brw_set_src1(insn, brw_imm_d(0x0));
+ } else {
+ brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_W));
+ brw_set_src0(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
+ brw_set_src1(insn, retype(brw_null_reg(), BRW_REGISTER_TYPE_D));
+ }
insn->header.compression_control = BRW_COMPRESSION_NONE;
insn->header.execution_size = patch_insn->header.execution_size;
insn->header.mask_control = BRW_MASK_ENABLE;
insn->header.thread_control = BRW_THREAD_SWITCH;
- assert(patch_insn->bits3.if_else.jump_count == 0);
+ if (intel->gen < 6)
+ assert(patch_insn->bits3.if_else.jump_count == 0);
+ else
+ assert(patch_insn->bits1.branch_gen6.jump_count == 0);
/* Patch the if or else instructions to point at this or the next
* instruction respectively.
*/
if (patch_insn->header.opcode == BRW_OPCODE_IF) {
- /* Automagically turn it into an IFF:
- */
- patch_insn->header.opcode = BRW_OPCODE_IFF;
- patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1);
- patch_insn->bits3.if_else.pop_count = 0;
- patch_insn->bits3.if_else.pad0 = 0;
- } else if (patch_insn->header.opcode == BRW_OPCODE_ELSE) {
- patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1);
- patch_insn->bits3.if_else.pop_count = 1;
- patch_insn->bits3.if_else.pad0 = 0;
+ if (intel->gen < 6) {
+ /* Turn it into an IFF, which means no mask stack operations for
+ * all-false and jumping past the ENDIF.
+ */
+ patch_insn->header.opcode = BRW_OPCODE_IFF;
+ patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1);
+ patch_insn->bits3.if_else.pop_count = 0;
+ patch_insn->bits3.if_else.pad0 = 0;
+ } else {
+ /* As of gen6, there is no IFF and IF must point to the ENDIF. */
+ patch_insn->bits1.branch_gen6.jump_count = br * (insn - patch_insn);
+ }
} else {
- assert(0);
+ assert(patch_insn->header.opcode == BRW_OPCODE_ELSE);
+ if (intel->gen < 6) {
+ /* BRW_OPCODE_ELSE pre-gen6 should point just past the
+ * matching ENDIF.
+ */
+ patch_insn->bits3.if_else.jump_count = br * (insn - patch_insn + 1);
+ patch_insn->bits3.if_else.pop_count = 1;
+ patch_insn->bits3.if_else.pad0 = 0;
+ } else {
+ /* BRW_OPCODE_ELSE on gen6 should point to the matching ENDIF. */
+ patch_insn->bits1.branch_gen6.jump_count = br * (insn - patch_insn);
+ }
}
/* Also pop item off the stack in the endif instruction:
*/
- insn->bits3.if_else.jump_count = 0;
- insn->bits3.if_else.pop_count = 1;
- insn->bits3.if_else.pad0 = 0;
+ if (intel->gen < 6) {
+ insn->bits3.if_else.jump_count = 0;
+ insn->bits3.if_else.pop_count = 1;
+ insn->bits3.if_else.pad0 = 0;
+ } else {
+ insn->bits1.branch_gen6.jump_count = 2;
+ }
}
}
if (intel->gen >= 6) {
struct brw_instruction *insn = next_insn(p, BRW_OPCODE_MATH);
+ assert(dest.file == BRW_GENERAL_REGISTER_FILE);
+ assert(src.file == BRW_GENERAL_REGISTER_FILE);
+
+ assert(dest.hstride == BRW_HORIZONTAL_STRIDE_1);
+ assert(src.hstride == BRW_HORIZONTAL_STRIDE_1);
+
+ if (function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT &&
+ function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER) {
+ assert(src.type == BRW_REGISTER_TYPE_F);
+ }
+
/* Math is the same ISA format as other opcodes, except that CondModifier
* becomes FC[3:0] and ThreadCtrl becomes FC[5:4].
*/
struct brw_instruction *insn = next_insn(p, BRW_OPCODE_MATH);
assert(intel->gen >= 6);
+ (void) intel;
+
+
+ assert(dest.file == BRW_GENERAL_REGISTER_FILE);
+ assert(src0.file == BRW_GENERAL_REGISTER_FILE);
+ assert(src1.file == BRW_GENERAL_REGISTER_FILE);
+
+ assert(dest.hstride == BRW_HORIZONTAL_STRIDE_1);
+ assert(src0.hstride == BRW_HORIZONTAL_STRIDE_1);
+ assert(src1.hstride == BRW_HORIZONTAL_STRIDE_1);
+
+ if (function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT &&
+ function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER) {
+ assert(src0.type == BRW_REGISTER_TYPE_F);
+ assert(src1.type == BRW_REGISTER_TYPE_F);
+ }
/* Math is the same ISA format as other opcodes, except that CondModifier
* becomes FC[3:0] and ThreadCtrl becomes FC[5:4].
BRW_DATAPORT_OWORD_BLOCK_4_OWORDS, /* msg_control */
BRW_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE, /* msg_type */
msg_length,
+ GL_TRUE, /* header_present */
0, /* pixel scoreboard */
send_commit_msg, /* response_length */
0, /* eot */
struct intel_context *intel = &p->brw->intel;
struct brw_instruction *insn;
GLuint msg_control, msg_type;
+ GLboolean header_present = GL_TRUE;
insn = next_insn(p, BRW_OPCODE_SEND);
insn->header.predicate_control = 0; /* XXX */
insn->header.compression_control = BRW_COMPRESSION_NONE;
if (intel->gen >= 6) {
+ if (msg_length == 4)
+ header_present = GL_FALSE;
+
/* headerless version, just submit color payload */
src0 = brw_message_reg(msg_reg_nr);
msg_control,
msg_type,
msg_length,
+ header_present,
1, /* pixel scoreboard */
response_length,
eot,
if (intel->gen >= 6) {
brw_push_insn_state(p);
brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_MOV(p, brw_message_reg(msg_reg_nr), src0);
+ brw_MOV(p, retype(brw_message_reg(msg_reg_nr), BRW_REGISTER_TYPE_UD),
+ retype(src0, BRW_REGISTER_TYPE_UD));
brw_pop_insn_state(p);
src0 = brw_message_reg(msg_reg_nr);
}
static GLboolean do_check_fallback(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
GLuint i;
if (brw->intel.no_rast) {
#ifndef BRW_FALLBACK_H
#define BRW_FALLBACK_H
-#include "main/mtypes.h" /* for GLcontext... */
+#include "main/mtypes.h" /* for struct gl_context... */
struct brw_context;
struct vbo_prim;
-void brw_fallback( GLcontext *ctx );
-void brw_unfallback( GLcontext *ctx );
+void brw_fallback( struct gl_context *ctx );
+void brw_unfallback( struct gl_context *ctx );
-void brw_loopback_vertex_list( GLcontext *ctx,
+void brw_loopback_vertex_list( struct gl_context *ctx,
const GLfloat *buffer,
const GLubyte *attrsz,
const struct vbo_prim *prim,
#include "main/macros.h"
#include "main/shaderobj.h"
+#include "main/uniforms.h"
#include "program/prog_parameter.h"
#include "program/prog_print.h"
#include "program/prog_optimize.h"
+#include "program/register_allocate.h"
+#include "program/sampler.h"
#include "program/hash_table.h"
#include "brw_context.h"
#include "brw_eu.h"
#include "brw_wm.h"
#include "talloc.h"
}
+#include "brw_fs.h"
#include "../glsl/glsl_types.h"
#include "../glsl/ir_optimization.h"
#include "../glsl/ir_print_visitor.h"
-enum register_file {
- ARF = BRW_ARCHITECTURE_REGISTER_FILE,
- GRF = BRW_GENERAL_REGISTER_FILE,
- MRF = BRW_MESSAGE_REGISTER_FILE,
- IMM = BRW_IMMEDIATE_VALUE,
- FIXED_HW_REG, /* a struct brw_reg */
- UNIFORM, /* prog_data->params[hw_reg] */
- BAD_FILE
-};
-
-enum fs_opcodes {
- FS_OPCODE_FB_WRITE = 256,
- FS_OPCODE_RCP,
- FS_OPCODE_RSQ,
- FS_OPCODE_SQRT,
- FS_OPCODE_EXP2,
- FS_OPCODE_LOG2,
- FS_OPCODE_POW,
- FS_OPCODE_SIN,
- FS_OPCODE_COS,
- FS_OPCODE_DDX,
- FS_OPCODE_DDY,
- FS_OPCODE_LINTERP,
- FS_OPCODE_TEX,
- FS_OPCODE_TXB,
- FS_OPCODE_TXL,
- FS_OPCODE_DISCARD,
-};
-
-static int using_new_fs = -1;
+static struct brw_reg brw_reg_from_fs_reg(class fs_reg *reg);
struct gl_shader *
-brw_new_shader(GLcontext *ctx, GLuint name, GLuint type)
+brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type)
{
struct brw_shader *shader;
}
struct gl_shader_program *
-brw_new_shader_program(GLcontext *ctx, GLuint name)
+brw_new_shader_program(struct gl_context *ctx, GLuint name)
{
struct brw_shader_program *prog;
prog = talloc_zero(NULL, struct brw_shader_program);
}
GLboolean
-brw_compile_shader(GLcontext *ctx, struct gl_shader *shader)
+brw_compile_shader(struct gl_context *ctx, struct gl_shader *shader)
{
if (!_mesa_ir_compile_shader(ctx, shader))
return GL_FALSE;
}
GLboolean
-brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog)
+brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
{
- if (using_new_fs == -1)
- using_new_fs = getenv("INTEL_NEW_FS") != NULL;
-
- for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
- struct brw_shader *shader = (struct brw_shader *)prog->_LinkedShaders[i];
-
- if (using_new_fs && shader->base.Type == GL_FRAGMENT_SHADER) {
- void *mem_ctx = talloc_new(NULL);
- bool progress;
-
- if (shader->ir)
- talloc_free(shader->ir);
- shader->ir = new(shader) exec_list;
- clone_ir_list(mem_ctx, shader->ir, shader->base.ir);
-
- do_mat_op_to_vec(shader->ir);
- do_mod_to_fract(shader->ir);
- do_div_to_mul_rcp(shader->ir);
- do_sub_to_add_neg(shader->ir);
- do_explog_to_explog2(shader->ir);
-
- do {
- progress = false;
-
- brw_do_channel_expressions(shader->ir);
- brw_do_vector_splitting(shader->ir);
-
- progress = do_lower_jumps(shader->ir, true, true,
- true, /* main return */
- false, /* continue */
- false /* loops */
- ) || progress;
-
- progress = do_common_optimization(shader->ir, true, 32) || progress;
-
- progress = lower_noise(shader->ir) || progress;
- progress =
- lower_variable_index_to_cond_assign(shader->ir,
- GL_TRUE, /* input */
- GL_TRUE, /* output */
- GL_TRUE, /* temp */
- GL_TRUE /* uniform */
- ) || progress;
- } while (progress);
+ struct intel_context *intel = intel_context(ctx);
+
+ struct brw_shader *shader =
+ (struct brw_shader *)prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
+ if (shader != NULL) {
+ void *mem_ctx = talloc_new(NULL);
+ bool progress;
+
+ if (shader->ir)
+ talloc_free(shader->ir);
+ shader->ir = new(shader) exec_list;
+ clone_ir_list(mem_ctx, shader->ir, shader->base.ir);
+
+ do_mat_op_to_vec(shader->ir);
+ do_mod_to_fract(shader->ir);
+ do_div_to_mul_rcp(shader->ir);
+ do_sub_to_add_neg(shader->ir);
+ do_explog_to_explog2(shader->ir);
+ do_lower_texture_projection(shader->ir);
+ brw_do_cubemap_normalize(shader->ir);
+
+ do {
+ progress = false;
+
+ brw_do_channel_expressions(shader->ir);
+ brw_do_vector_splitting(shader->ir);
+
+ progress = do_lower_jumps(shader->ir, true, true,
+ true, /* main return */
+ false, /* continue */
+ false /* loops */
+ ) || progress;
+
+ progress = do_common_optimization(shader->ir, true, 32) || progress;
+
+ progress = lower_noise(shader->ir) || progress;
+ progress =
+ lower_variable_index_to_cond_assign(shader->ir,
+ GL_TRUE, /* input */
+ GL_TRUE, /* output */
+ GL_TRUE, /* temp */
+ GL_TRUE /* uniform */
+ ) || progress;
+ if (intel->gen == 6) {
+ progress = do_if_to_cond_assign(shader->ir) || progress;
+ }
+ } while (progress);
- validate_ir_tree(shader->ir);
+ validate_ir_tree(shader->ir);
- reparent_ir(shader->ir, shader->ir);
- talloc_free(mem_ctx);
- }
+ reparent_ir(shader->ir, shader->ir);
+ talloc_free(mem_ctx);
}
if (!_mesa_ir_link_shader(ctx, prog))
case GLSL_TYPE_BOOL:
return type->components();
case GLSL_TYPE_ARRAY:
- /* FINISHME: uniform/varying arrays. */
return type_size(type->fields.array) * type->length;
case GLSL_TYPE_STRUCT:
size = 0;
}
}
-class fs_reg {
-public:
- /* Callers of this talloc-based new need not call delete. It's
- * easier to just talloc_free 'ctx' (or any of its ancestors). */
- static void* operator new(size_t size, void *ctx)
- {
- void *node;
-
- node = talloc_size(ctx, size);
- assert(node != NULL);
-
- return node;
- }
-
- void init()
- {
- this->reg = 0;
- this->reg_offset = 0;
- this->negate = 0;
- this->abs = 0;
- this->hw_reg = -1;
- }
-
- /** Generic unset register constructor. */
- fs_reg()
- {
- init();
- this->file = BAD_FILE;
- }
-
- /** Immediate value constructor. */
- fs_reg(float f)
- {
- init();
- this->file = IMM;
- this->type = BRW_REGISTER_TYPE_F;
- this->imm.f = f;
- }
-
- /** Immediate value constructor. */
- fs_reg(int32_t i)
- {
- init();
- this->file = IMM;
- this->type = BRW_REGISTER_TYPE_D;
- this->imm.i = i;
- }
-
- /** Immediate value constructor. */
- fs_reg(uint32_t u)
- {
- init();
- this->file = IMM;
- this->type = BRW_REGISTER_TYPE_UD;
- this->imm.u = u;
- }
-
- /** Fixed brw_reg Immediate value constructor. */
- fs_reg(struct brw_reg fixed_hw_reg)
- {
- init();
- this->file = FIXED_HW_REG;
- this->fixed_hw_reg = fixed_hw_reg;
- this->type = fixed_hw_reg.type;
- }
-
- fs_reg(enum register_file file, int hw_reg);
- fs_reg(class fs_visitor *v, const struct glsl_type *type);
-
- /** Register file: ARF, GRF, MRF, IMM. */
- enum register_file file;
- /** Abstract register number. 0 = fixed hw reg */
- int reg;
- /** Offset within the abstract register. */
- int reg_offset;
- /** HW register number. Generally unset until register allocation. */
- int hw_reg;
- /** Register type. BRW_REGISTER_TYPE_* */
- int type;
- bool negate;
- bool abs;
- struct brw_reg fixed_hw_reg;
-
- /** Value for file == BRW_IMMMEDIATE_FILE */
- union {
- int32_t i;
- uint32_t u;
- float f;
- } imm;
-};
-
static const fs_reg reg_undef;
-static const fs_reg reg_null(ARF, BRW_ARF_NULL);
-
-class fs_inst : public exec_node {
-public:
- /* Callers of this talloc-based new need not call delete. It's
- * easier to just talloc_free 'ctx' (or any of its ancestors). */
- static void* operator new(size_t size, void *ctx)
- {
- void *node;
-
- node = talloc_zero_size(ctx, size);
- assert(node != NULL);
-
- return node;
- }
-
- void init()
- {
- this->opcode = BRW_OPCODE_NOP;
- this->saturate = false;
- this->conditional_mod = BRW_CONDITIONAL_NONE;
- this->predicated = false;
- this->sampler = 0;
- this->shadow_compare = false;
- }
-
- fs_inst()
- {
- init();
- }
-
- fs_inst(int opcode)
- {
- init();
- this->opcode = opcode;
- }
-
- fs_inst(int opcode, fs_reg dst, fs_reg src0)
- {
- init();
- this->opcode = opcode;
- this->dst = dst;
- this->src[0] = src0;
- }
-
- fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1)
- {
- init();
- this->opcode = opcode;
- this->dst = dst;
- this->src[0] = src0;
- this->src[1] = src1;
- }
-
- fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1, fs_reg src2)
- {
- init();
- this->opcode = opcode;
- this->dst = dst;
- this->src[0] = src0;
- this->src[1] = src1;
- this->src[2] = src2;
- }
-
- int opcode; /* BRW_OPCODE_* or FS_OPCODE_* */
- fs_reg dst;
- fs_reg src[3];
- bool saturate;
- bool predicated;
- int conditional_mod; /**< BRW_CONDITIONAL_* */
-
- int mlen; /** SEND message length */
- int sampler;
- bool shadow_compare;
-
- /** @{
- * Annotation for the generated IR. One of the two can be set.
- */
- ir_instruction *ir;
- const char *annotation;
- /** @} */
-};
-
-class fs_visitor : public ir_visitor
-{
-public:
-
- fs_visitor(struct brw_wm_compile *c, struct brw_shader *shader)
- {
- this->c = c;
- this->p = &c->func;
- this->brw = p->brw;
- this->intel = &brw->intel;
- this->ctx = &intel->ctx;
- this->mem_ctx = talloc_new(NULL);
- this->shader = shader;
- this->fail = false;
- this->next_abstract_grf = 1;
- this->variable_ht = hash_table_ctor(0,
- hash_table_pointer_hash,
- hash_table_pointer_compare);
-
- this->frag_color = NULL;
- this->frag_data = NULL;
- this->frag_depth = NULL;
- this->first_non_payload_grf = 0;
-
- this->current_annotation = NULL;
- this->annotation_string = NULL;
- this->annotation_ir = NULL;
- this->base_ir = NULL;
- }
- ~fs_visitor()
- {
- talloc_free(this->mem_ctx);
- hash_table_dtor(this->variable_ht);
- }
-
- fs_reg *variable_storage(ir_variable *var);
-
- void visit(ir_variable *ir);
- void visit(ir_assignment *ir);
- void visit(ir_dereference_variable *ir);
- void visit(ir_dereference_record *ir);
- void visit(ir_dereference_array *ir);
- void visit(ir_expression *ir);
- void visit(ir_texture *ir);
- void visit(ir_if *ir);
- void visit(ir_constant *ir);
- void visit(ir_swizzle *ir);
- void visit(ir_return *ir);
- void visit(ir_loop *ir);
- void visit(ir_loop_jump *ir);
- void visit(ir_discard *ir);
- void visit(ir_call *ir);
- void visit(ir_function *ir);
- void visit(ir_function_signature *ir);
-
- fs_inst *emit(fs_inst inst);
- void assign_curb_setup();
- void assign_urb_setup();
- void assign_regs();
- void generate_code();
- void generate_fb_write(fs_inst *inst);
- void generate_linterp(fs_inst *inst, struct brw_reg dst,
- struct brw_reg *src);
- void generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src);
- void generate_math(fs_inst *inst, struct brw_reg dst, struct brw_reg *src);
- void generate_discard(fs_inst *inst);
- void generate_ddx(fs_inst *inst, struct brw_reg dst, struct brw_reg src);
- void generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src);
-
- void emit_dummy_fs();
- void emit_interpolation();
- void emit_pinterp(int location);
- void emit_fb_writes();
-
- struct brw_reg interp_reg(int location, int channel);
- int setup_uniform_values(int loc, const glsl_type *type);
-
- struct brw_context *brw;
- struct intel_context *intel;
- GLcontext *ctx;
- struct brw_wm_compile *c;
- struct brw_compile *p;
- struct brw_shader *shader;
- void *mem_ctx;
- exec_list instructions;
- int next_abstract_grf;
- struct hash_table *variable_ht;
- ir_variable *frag_color, *frag_data, *frag_depth;
- int first_non_payload_grf;
-
- /** @{ debug annotation info */
- const char *current_annotation;
- ir_instruction *base_ir;
- const char **annotation_string;
- ir_instruction **annotation_ir;
- /** @} */
-
- bool fail;
+static const fs_reg reg_null_f(ARF, BRW_ARF_NULL, BRW_REGISTER_TYPE_F);
+static const fs_reg reg_null_d(ARF, BRW_ARF_NULL, BRW_REGISTER_TYPE_D);
- /* Result of last visit() method. */
- fs_reg result;
-
- fs_reg pixel_x;
- fs_reg pixel_y;
- fs_reg pixel_w;
- fs_reg delta_x;
- fs_reg delta_y;
- fs_reg interp_attrs[64];
-
- int grf_used;
-
-};
+int
+fs_visitor::virtual_grf_alloc(int size)
+{
+ if (virtual_grf_array_size <= virtual_grf_next) {
+ if (virtual_grf_array_size == 0)
+ virtual_grf_array_size = 16;
+ else
+ virtual_grf_array_size *= 2;
+ virtual_grf_sizes = talloc_realloc(mem_ctx, virtual_grf_sizes,
+ int, virtual_grf_array_size);
+
+ /* This slot is always unused. */
+ virtual_grf_sizes[0] = 0;
+ }
+ virtual_grf_sizes[virtual_grf_next] = size;
+ return virtual_grf_next++;
+}
/** Fixed HW reg constructor. */
fs_reg::fs_reg(enum register_file file, int hw_reg)
this->type = BRW_REGISTER_TYPE_F;
}
+/** Fixed HW reg constructor. */
+fs_reg::fs_reg(enum register_file file, int hw_reg, uint32_t type)
+{
+ init();
+ this->file = file;
+ this->hw_reg = hw_reg;
+ this->type = type;
+}
+
int
brw_type_for_base_type(const struct glsl_type *type)
{
init();
this->file = GRF;
- this->reg = v->next_abstract_grf;
+ this->reg = v->virtual_grf_alloc(type_size(type));
this->reg_offset = 0;
- v->next_abstract_grf += type_size(type);
this->type = brw_type_for_base_type(type);
}
int
fs_visitor::setup_uniform_values(int loc, const glsl_type *type)
{
- const struct gl_program *fp = &this->brw->fragment_program->Base;
unsigned int offset = 0;
float *vec_values;
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
case GLSL_TYPE_BOOL:
- vec_values = fp->Parameters->ParameterValues[loc];
+ vec_values = fp->Base.Parameters->ParameterValues[loc];
for (unsigned int i = 0; i < type->vector_elements; i++) {
c->prog_data.param[c->prog_data.nr_params++] = &vec_values[i];
}
}
}
+
+/* Our support for builtin uniforms is even scarier than non-builtin.
+ * It sits on top of the PROG_STATE_VAR parameters that are
+ * automatically updated from GL context state.
+ */
+void
+fs_visitor::setup_builtin_uniform_values(ir_variable *ir)
+{
+ const struct gl_builtin_uniform_desc *statevar = NULL;
+
+ for (unsigned int i = 0; _mesa_builtin_uniform_desc[i].name; i++) {
+ statevar = &_mesa_builtin_uniform_desc[i];
+ if (strcmp(ir->name, _mesa_builtin_uniform_desc[i].name) == 0)
+ break;
+ }
+
+ if (!statevar->name) {
+ this->fail = true;
+ printf("Failed to find builtin uniform `%s'\n", ir->name);
+ return;
+ }
+
+ int array_count;
+ if (ir->type->is_array()) {
+ array_count = ir->type->length;
+ } else {
+ array_count = 1;
+ }
+
+ for (int a = 0; a < array_count; a++) {
+ for (unsigned int i = 0; i < statevar->num_elements; i++) {
+ struct gl_builtin_uniform_element *element = &statevar->elements[i];
+ int tokens[STATE_LENGTH];
+
+ memcpy(tokens, element->tokens, sizeof(element->tokens));
+ if (ir->type->is_array()) {
+ tokens[1] = a;
+ }
+
+ /* This state reference has already been setup by ir_to_mesa,
+ * but we'll get the same index back here.
+ */
+ int index = _mesa_add_state_reference(this->fp->Base.Parameters,
+ (gl_state_index *)tokens);
+ float *vec_values = this->fp->Base.Parameters->ParameterValues[index];
+
+ /* Add each of the unique swizzles of the element as a
+ * parameter. This'll end up matching the expected layout of
+ * the array/matrix/structure we're trying to fill in.
+ */
+ int last_swiz = -1;
+ for (unsigned int i = 0; i < 4; i++) {
+ int swiz = GET_SWZ(element->swizzle, i);
+ if (swiz == last_swiz)
+ break;
+ last_swiz = swiz;
+
+ c->prog_data.param[c->prog_data.nr_params++] = &vec_values[swiz];
+ }
+ }
+ }
+}
+
+fs_reg *
+fs_visitor::emit_fragcoord_interpolation(ir_variable *ir)
+{
+ fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type);
+ fs_reg wpos = *reg;
+ fs_reg neg_y = this->pixel_y;
+ neg_y.negate = true;
+
+ /* gl_FragCoord.x */
+ if (ir->pixel_center_integer) {
+ emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_x));
+ } else {
+ emit(fs_inst(BRW_OPCODE_ADD, wpos, this->pixel_x, fs_reg(0.5f)));
+ }
+ wpos.reg_offset++;
+
+ /* gl_FragCoord.y */
+ if (ir->origin_upper_left && ir->pixel_center_integer) {
+ emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_y));
+ } else {
+ fs_reg pixel_y = this->pixel_y;
+ float offset = (ir->pixel_center_integer ? 0.0 : 0.5);
+
+ if (!ir->origin_upper_left) {
+ pixel_y.negate = true;
+ offset += c->key.drawable_height - 1.0;
+ }
+
+ emit(fs_inst(BRW_OPCODE_ADD, wpos, pixel_y, fs_reg(offset)));
+ }
+ wpos.reg_offset++;
+
+ /* gl_FragCoord.z */
+ emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y,
+ interp_reg(FRAG_ATTRIB_WPOS, 2)));
+ wpos.reg_offset++;
+
+ /* gl_FragCoord.w: Already set up in emit_interpolation */
+ emit(fs_inst(BRW_OPCODE_MOV, wpos, this->wpos_w));
+
+ return reg;
+}
+
+fs_reg *
+fs_visitor::emit_general_interpolation(ir_variable *ir)
+{
+ fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type);
+ /* Interpolation is always in floating point regs. */
+ reg->type = BRW_REGISTER_TYPE_F;
+ fs_reg attr = *reg;
+
+ unsigned int array_elements;
+ const glsl_type *type;
+
+ if (ir->type->is_array()) {
+ array_elements = ir->type->length;
+ if (array_elements == 0) {
+ this->fail = true;
+ }
+ type = ir->type->fields.array;
+ } else {
+ array_elements = 1;
+ type = ir->type;
+ }
+
+ int location = ir->location;
+ for (unsigned int i = 0; i < array_elements; i++) {
+ for (unsigned int j = 0; j < type->matrix_columns; j++) {
+ if (urb_setup[location] == -1) {
+ /* If there's no incoming setup data for this slot, don't
+ * emit interpolation for it.
+ */
+ attr.reg_offset += type->vector_elements;
+ location++;
+ continue;
+ }
+
+ for (unsigned int c = 0; c < type->vector_elements; c++) {
+ struct brw_reg interp = interp_reg(location, c);
+ emit(fs_inst(FS_OPCODE_LINTERP,
+ attr,
+ this->delta_x,
+ this->delta_y,
+ fs_reg(interp)));
+ attr.reg_offset++;
+ }
+
+ if (intel->gen < 6) {
+ attr.reg_offset -= type->vector_elements;
+ for (unsigned int c = 0; c < type->vector_elements; c++) {
+ emit(fs_inst(BRW_OPCODE_MUL,
+ attr,
+ attr,
+ this->pixel_w));
+ attr.reg_offset++;
+ }
+ }
+ location++;
+ }
+ }
+
+ return reg;
+}
+
+fs_reg *
+fs_visitor::emit_frontfacing_interpolation(ir_variable *ir)
+{
+ fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type);
+
+ /* The frontfacing comes in as a bit in the thread payload. */
+ if (intel->gen >= 6) {
+ emit(fs_inst(BRW_OPCODE_ASR,
+ *reg,
+ fs_reg(retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_D)),
+ fs_reg(15)));
+ emit(fs_inst(BRW_OPCODE_NOT,
+ *reg,
+ *reg));
+ emit(fs_inst(BRW_OPCODE_AND,
+ *reg,
+ *reg,
+ fs_reg(1)));
+ } else {
+ fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type);
+ struct brw_reg r1_6ud = retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_UD);
+ /* bit 31 is "primitive is back face", so checking < (1 << 31) gives
+ * us front face
+ */
+ fs_inst *inst = emit(fs_inst(BRW_OPCODE_CMP,
+ *reg,
+ fs_reg(r1_6ud),
+ fs_reg(1u << 31)));
+ inst->conditional_mod = BRW_CONDITIONAL_L;
+ emit(fs_inst(BRW_OPCODE_AND, *reg, *reg, fs_reg(1u)));
+ }
+
+ return reg;
+}
+
+fs_inst *
+fs_visitor::emit_math(fs_opcodes opcode, fs_reg dst, fs_reg src)
+{
+ switch (opcode) {
+ case FS_OPCODE_RCP:
+ case FS_OPCODE_RSQ:
+ case FS_OPCODE_SQRT:
+ case FS_OPCODE_EXP2:
+ case FS_OPCODE_LOG2:
+ case FS_OPCODE_SIN:
+ case FS_OPCODE_COS:
+ break;
+ default:
+ assert(!"not reached: bad math opcode");
+ return NULL;
+ }
+
+ /* Can't do hstride == 0 args to gen6 math, so expand it out. We
+ * might be able to do better by doing execsize = 1 math and then
+ * expanding that result out, but we would need to be careful with
+ * masking.
+ */
+ if (intel->gen >= 6 && src.file == UNIFORM) {
+ fs_reg expanded = fs_reg(this, glsl_type::float_type);
+ emit(fs_inst(BRW_OPCODE_MOV, expanded, src));
+ src = expanded;
+ }
+
+ fs_inst *inst = emit(fs_inst(opcode, dst, src));
+
+ if (intel->gen < 6) {
+ inst->base_mrf = 2;
+ inst->mlen = 1;
+ }
+
+ return inst;
+}
+
+fs_inst *
+fs_visitor::emit_math(fs_opcodes opcode, fs_reg dst, fs_reg src0, fs_reg src1)
+{
+ int base_mrf = 2;
+ fs_inst *inst;
+
+ assert(opcode == FS_OPCODE_POW);
+
+ if (intel->gen >= 6) {
+ /* Can't do hstride == 0 args to gen6 math, so expand it out. */
+ if (src0.file == UNIFORM) {
+ fs_reg expanded = fs_reg(this, glsl_type::float_type);
+ emit(fs_inst(BRW_OPCODE_MOV, expanded, src0));
+ src0 = expanded;
+ }
+
+ if (src1.file == UNIFORM) {
+ fs_reg expanded = fs_reg(this, glsl_type::float_type);
+ emit(fs_inst(BRW_OPCODE_MOV, expanded, src1));
+ src1 = expanded;
+ }
+
+ inst = emit(fs_inst(opcode, dst, src0, src1));
+ } else {
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + 1), src1));
+ inst = emit(fs_inst(opcode, dst, src0, reg_null_f));
+
+ inst->base_mrf = base_mrf;
+ inst->mlen = 2;
+ }
+ return inst;
+}
+
void
fs_visitor::visit(ir_variable *ir)
{
fs_reg *reg = NULL;
+ if (variable_storage(ir))
+ return;
+
if (strcmp(ir->name, "gl_FragColor") == 0) {
this->frag_color = ir;
} else if (strcmp(ir->name, "gl_FragData") == 0) {
this->frag_data = ir;
} else if (strcmp(ir->name, "gl_FragDepth") == 0) {
this->frag_depth = ir;
- assert(!"FINISHME: this hangs currently.");
}
if (ir->mode == ir_var_in) {
- reg = &this->interp_attrs[ir->location];
+ if (!strcmp(ir->name, "gl_FragCoord")) {
+ reg = emit_fragcoord_interpolation(ir);
+ } else if (!strcmp(ir->name, "gl_FrontFacing")) {
+ reg = emit_frontfacing_interpolation(ir);
+ } else {
+ reg = emit_general_interpolation(ir);
+ }
+ assert(reg);
+ hash_table_insert(this->variable_ht, reg, ir);
+ return;
}
if (ir->mode == ir_var_uniform) {
int param_index = c->prog_data.nr_params;
- setup_uniform_values(ir->location, ir->type);
+ if (!strncmp(ir->name, "gl_", 3)) {
+ setup_builtin_uniform_values(ir);
+ } else {
+ setup_uniform_values(ir->location, ir->type);
+ }
reg = new(this->mem_ctx) fs_reg(UNIFORM, param_index);
}
ir->array->accept(this);
index = ir->array_index->as_constant();
- if (ir->type->is_matrix()) {
- element_size = ir->type->vector_elements;
- } else {
- element_size = type_size(ir->type);
- this->result.type = brw_type_for_base_type(ir->type);
- }
+ element_size = type_size(ir->type);
+ this->result.type = brw_type_for_base_type(ir->type);
if (index) {
assert(this->result.file == UNIFORM ||
this->result.reg != 0));
this->result.reg_offset += index->value.i[0] * element_size;
} else {
- assert(!"FINISHME: non-constant matrix column");
+ assert(!"FINISHME: non-constant array element");
}
}
{
unsigned int operand;
fs_reg op[2], temp;
- fs_reg result;
fs_inst *inst;
for (operand = 0; operand < ir->get_num_operands(); operand++) {
switch (ir->operation) {
case ir_unop_logic_not:
- emit(fs_inst(BRW_OPCODE_ADD, this->result, op[0], fs_reg(-1)));
+ /* Note that BRW_OPCODE_NOT is not appropriate here, since it is
+ * ones complement of the whole register, not just bit 0.
+ */
+ emit(fs_inst(BRW_OPCODE_XOR, this->result, op[0], fs_reg(1)));
break;
case ir_unop_neg:
op[0].negate = !op[0].negate;
emit(fs_inst(BRW_OPCODE_MOV, this->result, fs_reg(0.0f)));
- inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null, op[0], fs_reg(0.0f)));
+ inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_f, op[0], fs_reg(0.0f)));
inst->conditional_mod = BRW_CONDITIONAL_G;
inst = emit(fs_inst(BRW_OPCODE_MOV, this->result, fs_reg(1.0f)));
inst->predicated = true;
- inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null, op[0], fs_reg(0.0f)));
+ inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_f, op[0], fs_reg(0.0f)));
inst->conditional_mod = BRW_CONDITIONAL_L;
inst = emit(fs_inst(BRW_OPCODE_MOV, this->result, fs_reg(-1.0f)));
inst->predicated = true;
break;
case ir_unop_rcp:
- emit(fs_inst(FS_OPCODE_RCP, this->result, op[0]));
+ emit_math(FS_OPCODE_RCP, this->result, op[0]);
break;
case ir_unop_exp2:
- emit(fs_inst(FS_OPCODE_EXP2, this->result, op[0]));
+ emit_math(FS_OPCODE_EXP2, this->result, op[0]);
break;
case ir_unop_log2:
- emit(fs_inst(FS_OPCODE_LOG2, this->result, op[0]));
+ emit_math(FS_OPCODE_LOG2, this->result, op[0]);
break;
case ir_unop_exp:
case ir_unop_log:
assert(!"not reached: should be handled by ir_explog_to_explog2");
break;
case ir_unop_sin:
- emit(fs_inst(FS_OPCODE_SIN, this->result, op[0]));
+ emit_math(FS_OPCODE_SIN, this->result, op[0]);
break;
case ir_unop_cos:
- emit(fs_inst(FS_OPCODE_COS, this->result, op[0]));
+ emit_math(FS_OPCODE_COS, this->result, op[0]);
break;
case ir_unop_dFdx:
break;
case ir_unop_sqrt:
- emit(fs_inst(FS_OPCODE_SQRT, this->result, op[0]));
+ emit_math(FS_OPCODE_SQRT, this->result, op[0]);
break;
case ir_unop_rsq:
- emit(fs_inst(FS_OPCODE_RSQ, this->result, op[0]));
+ emit_math(FS_OPCODE_RSQ, this->result, op[0]);
break;
case ir_unop_i2f:
case ir_unop_b2f:
case ir_unop_b2i:
- emit(fs_inst(BRW_OPCODE_MOV, this->result, op[0]));
- break;
case ir_unop_f2i:
emit(fs_inst(BRW_OPCODE_MOV, this->result, op[0]));
break;
case ir_unop_i2b:
inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], fs_reg(0.0f)));
inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ inst = emit(fs_inst(BRW_OPCODE_AND, this->result,
+ this->result, fs_reg(1)));
+ break;
case ir_unop_trunc:
- emit(fs_inst(BRW_OPCODE_RNDD, this->result, op[0]));
+ emit(fs_inst(BRW_OPCODE_RNDZ, this->result, op[0]));
break;
case ir_unop_ceil:
- op[0].negate = ~op[0].negate;
+ op[0].negate = !op[0].negate;
inst = emit(fs_inst(BRW_OPCODE_RNDD, this->result, op[0]));
this->result.negate = true;
break;
case ir_unop_fract:
inst = emit(fs_inst(BRW_OPCODE_FRC, this->result, op[0]));
break;
+ case ir_unop_round_even:
+ emit(fs_inst(BRW_OPCODE_RNDE, this->result, op[0]));
+ break;
case ir_binop_min:
inst = emit(fs_inst(BRW_OPCODE_CMP, this->result, op[0], op[1]));
break;
case ir_binop_pow:
- inst = emit(fs_inst(FS_OPCODE_POW, this->result, op[0], op[1]));
+ emit_math(FS_OPCODE_POW, this->result, op[0], op[1]);
break;
case ir_unop_bit_not:
}
}
+void
+fs_visitor::emit_assignment_writes(fs_reg &l, fs_reg &r,
+ const glsl_type *type, bool predicated)
+{
+ switch (type->base_type) {
+ case GLSL_TYPE_FLOAT:
+ case GLSL_TYPE_UINT:
+ case GLSL_TYPE_INT:
+ case GLSL_TYPE_BOOL:
+ for (unsigned int i = 0; i < type->components(); i++) {
+ l.type = brw_type_for_base_type(type);
+ r.type = brw_type_for_base_type(type);
+
+ fs_inst *inst = emit(fs_inst(BRW_OPCODE_MOV, l, r));
+ inst->predicated = predicated;
+
+ l.reg_offset++;
+ r.reg_offset++;
+ }
+ break;
+ case GLSL_TYPE_ARRAY:
+ for (unsigned int i = 0; i < type->length; i++) {
+ emit_assignment_writes(l, r, type->fields.array, predicated);
+ }
+ break;
+
+ case GLSL_TYPE_STRUCT:
+ for (unsigned int i = 0; i < type->length; i++) {
+ emit_assignment_writes(l, r, type->fields.structure[i].type,
+ predicated);
+ }
+ break;
+
+ case GLSL_TYPE_SAMPLER:
+ break;
+
+ default:
+ assert(!"not reached");
+ break;
+ }
+}
+
void
fs_visitor::visit(ir_assignment *ir)
{
struct fs_reg l, r;
- int i;
- int write_mask;
fs_inst *inst;
/* FINISHME: arrays on the lhs */
ir->rhs->accept(this);
r = this->result;
- /* FINISHME: This should really set to the correct maximal writemask for each
- * FINISHME: component written (in the loops below). This case can only
- * FINISHME: occur for matrices, arrays, and structures.
- */
- if (ir->write_mask == 0) {
- assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector());
- write_mask = WRITEMASK_XYZW;
- } else {
- assert(ir->lhs->type->is_vector() || ir->lhs->type->is_scalar());
- write_mask = ir->write_mask;
- }
-
assert(l.file != BAD_FILE);
assert(r.file != BAD_FILE);
if (ir->condition) {
- /* Get the condition bool into the predicate. */
- ir->condition->accept(this);
- inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null, this->result, fs_reg(0)));
- inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ emit_bool_to_cond_code(ir->condition);
}
- for (i = 0; i < type_size(ir->lhs->type); i++) {
- if (i >= 4 || (write_mask & (1 << i))) {
- inst = emit(fs_inst(BRW_OPCODE_MOV, l, r));
- if (ir->condition)
- inst->predicated = true;
- r.reg_offset++;
+ if (ir->lhs->type->is_scalar() ||
+ ir->lhs->type->is_vector()) {
+ for (int i = 0; i < ir->lhs->type->vector_elements; i++) {
+ if (ir->write_mask & (1 << i)) {
+ inst = emit(fs_inst(BRW_OPCODE_MOV, l, r));
+ if (ir->condition)
+ inst->predicated = true;
+ r.reg_offset++;
+ }
+ l.reg_offset++;
}
- l.reg_offset++;
+ } else {
+ emit_assignment_writes(l, r, ir->lhs->type, ir->condition != NULL);
}
}
-void
-fs_visitor::visit(ir_texture *ir)
+fs_inst *
+fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate)
{
- int base_mrf = 2;
- fs_inst *inst = NULL;
- unsigned int mlen = 0;
-
- ir->coordinate->accept(this);
- fs_reg coordinate = this->result;
+ int mlen;
+ int base_mrf = 1;
+ bool simd16 = false;
+ fs_reg orig_dst;
- if (ir->projector) {
- fs_reg inv_proj = fs_reg(this, glsl_type::float_type);
-
- ir->projector->accept(this);
- emit(fs_inst(FS_OPCODE_RCP, inv_proj, this->result));
+ /* g0 header. */
+ mlen = 1;
- fs_reg proj_coordinate = fs_reg(this, ir->coordinate->type);
- for (unsigned int i = 0; i < ir->coordinate->type->vector_elements; i++) {
- emit(fs_inst(BRW_OPCODE_MUL, proj_coordinate, coordinate, inv_proj));
+ if (ir->shadow_comparitor) {
+ for (int i = 0; i < ir->coordinate->type->vector_elements; i++) {
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i),
+ coordinate));
coordinate.reg_offset++;
- proj_coordinate.reg_offset++;
}
- proj_coordinate.reg_offset = 0;
+ /* gen4's SIMD8 sampler always has the slots for u,v,r present. */
+ mlen += 3;
- coordinate = proj_coordinate;
- }
+ if (ir->op == ir_tex) {
+ /* There's no plain shadow compare message, so we use shadow
+ * compare with a bias of 0.0.
+ */
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen),
+ fs_reg(0.0f)));
+ mlen++;
+ } else if (ir->op == ir_txb) {
+ ir->lod_info.bias->accept(this);
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen),
+ this->result));
+ mlen++;
+ } else {
+ assert(ir->op == ir_txl);
+ ir->lod_info.lod->accept(this);
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen),
+ this->result));
+ mlen++;
+ }
- for (mlen = 0; mlen < ir->coordinate->type->vector_elements; mlen++) {
- emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), coordinate));
- coordinate.reg_offset++;
- }
+ ir->shadow_comparitor->accept(this);
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result));
+ mlen++;
+ } else if (ir->op == ir_tex) {
+ for (int i = 0; i < ir->coordinate->type->vector_elements; i++) {
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i),
+ coordinate));
+ coordinate.reg_offset++;
+ }
+ /* gen4's SIMD8 sampler always has the slots for u,v,r present. */
+ mlen += 3;
+ } else {
+ /* Oh joy. gen4 doesn't have SIMD8 non-shadow-compare bias/lod
+ * instructions. We'll need to do SIMD16 here.
+ */
+ assert(ir->op == ir_txb || ir->op == ir_txl);
- /* Pre-Ironlake, the 8-wide sampler always took u,v,r. */
- if (intel->gen < 5)
- mlen = 3;
+ for (int i = 0; i < ir->coordinate->type->vector_elements; i++) {
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i * 2),
+ coordinate));
+ coordinate.reg_offset++;
+ }
- if (ir->shadow_comparitor) {
- /* For shadow comparisons, we have to supply u,v,r. */
- mlen = 3;
+ /* lod/bias appears after u/v/r. */
+ mlen += 6;
+
+ if (ir->op == ir_txb) {
+ ir->lod_info.bias->accept(this);
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen),
+ this->result));
+ mlen++;
+ } else {
+ ir->lod_info.lod->accept(this);
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen),
+ this->result));
+ mlen++;
+ }
- ir->shadow_comparitor->accept(this);
- emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result));
+ /* The unused upper half. */
mlen++;
- }
- /* Do we ever want to handle writemasking on texture samples? Is it
- * performance relevant?
- */
- fs_reg dst = fs_reg(this, glsl_type::vec4_type);
+ /* Now, since we're doing simd16, the return is 2 interleaved
+ * vec4s where the odd-indexed ones are junk. We'll need to move
+ * this weirdness around to the expected layout.
+ */
+ simd16 = true;
+ orig_dst = dst;
+ dst = fs_reg(this, glsl_type::get_array_instance(glsl_type::vec4_type,
+ 2));
+ dst.type = BRW_REGISTER_TYPE_F;
+ }
+ fs_inst *inst = NULL;
switch (ir->op) {
case ir_tex:
- inst = emit(fs_inst(FS_OPCODE_TEX, dst, fs_reg(MRF, base_mrf)));
+ inst = emit(fs_inst(FS_OPCODE_TEX, dst));
break;
case ir_txb:
- ir->lod_info.bias->accept(this);
- emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result));
- mlen++;
-
- inst = emit(fs_inst(FS_OPCODE_TXB, dst, fs_reg(MRF, base_mrf)));
+ inst = emit(fs_inst(FS_OPCODE_TXB, dst));
break;
case ir_txl:
- ir->lod_info.lod->accept(this);
- emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result));
- mlen++;
-
- inst = emit(fs_inst(FS_OPCODE_TXL, dst, fs_reg(MRF, base_mrf)));
+ inst = emit(fs_inst(FS_OPCODE_TXL, dst));
break;
case ir_txd:
case ir_txf:
assert(!"GLSL 1.30 features unsupported");
break;
}
+ inst->base_mrf = base_mrf;
+ inst->mlen = mlen;
- this->result = dst;
+ if (simd16) {
+ for (int i = 0; i < 4; i++) {
+ emit(fs_inst(BRW_OPCODE_MOV, orig_dst, dst));
+ orig_dst.reg_offset++;
+ dst.reg_offset += 2;
+ }
+ }
- if (ir->shadow_comparitor)
- inst->shadow_compare = true;
+ return inst;
+}
+
+fs_inst *
+fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate)
+{
+ /* gen5's SIMD8 sampler has slots for u, v, r, array index, then
+ * optional parameters like shadow comparitor or LOD bias. If
+ * optional parameters aren't present, those base slots are
+ * optional and don't need to be included in the message.
+ *
+ * We don't fill in the unnecessary slots regardless, which may
+ * look surprising in the disassembly.
+ */
+ int mlen = 1; /* g0 header always present. */
+ int base_mrf = 1;
+
+ for (int i = 0; i < ir->coordinate->type->vector_elements; i++) {
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i),
+ coordinate));
+ coordinate.reg_offset++;
+ }
+ mlen += ir->coordinate->type->vector_elements;
+
+ if (ir->shadow_comparitor) {
+ mlen = MAX2(mlen, 5);
+
+ ir->shadow_comparitor->accept(this);
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result));
+ mlen++;
+ }
+
+ fs_inst *inst = NULL;
+ switch (ir->op) {
+ case ir_tex:
+ inst = emit(fs_inst(FS_OPCODE_TEX, dst));
+ break;
+ case ir_txb:
+ ir->lod_info.bias->accept(this);
+ mlen = MAX2(mlen, 5);
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result));
+ mlen++;
+
+ inst = emit(fs_inst(FS_OPCODE_TXB, dst));
+ break;
+ case ir_txl:
+ ir->lod_info.lod->accept(this);
+ mlen = MAX2(mlen, 5);
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result));
+ mlen++;
+
+ inst = emit(fs_inst(FS_OPCODE_TXL, dst));
+ break;
+ case ir_txd:
+ case ir_txf:
+ assert(!"GLSL 1.30 features unsupported");
+ break;
+ }
+ inst->base_mrf = base_mrf;
inst->mlen = mlen;
+
+ return inst;
+}
+
+void
+fs_visitor::visit(ir_texture *ir)
+{
+ int sampler;
+ fs_inst *inst = NULL;
+
+ ir->coordinate->accept(this);
+ fs_reg coordinate = this->result;
+
+ /* Should be lowered by do_lower_texture_projection */
+ assert(!ir->projector);
+
+ sampler = _mesa_get_sampler_uniform_value(ir->sampler,
+ ctx->Shader.CurrentProgram,
+ &brw->fragment_program->Base);
+ sampler = c->fp->program.Base.SamplerUnits[sampler];
+
+ /* The 965 requires the EU to do the normalization of GL rectangle
+ * texture coordinates. We use the program parameter state
+ * tracking to get the scaling factor.
+ */
+ if (ir->sampler->type->sampler_dimensionality == GLSL_SAMPLER_DIM_RECT) {
+ struct gl_program_parameter_list *params = c->fp->program.Base.Parameters;
+ int tokens[STATE_LENGTH] = {
+ STATE_INTERNAL,
+ STATE_TEXRECT_SCALE,
+ sampler,
+ 0,
+ 0
+ };
+
+ fs_reg scale_x = fs_reg(UNIFORM, c->prog_data.nr_params);
+ fs_reg scale_y = fs_reg(UNIFORM, c->prog_data.nr_params + 1);
+ GLuint index = _mesa_add_state_reference(params,
+ (gl_state_index *)tokens);
+ float *vec_values = this->fp->Base.Parameters->ParameterValues[index];
+
+ c->prog_data.param[c->prog_data.nr_params++] = &vec_values[0];
+ c->prog_data.param[c->prog_data.nr_params++] = &vec_values[1];
+
+ fs_reg dst = fs_reg(this, ir->coordinate->type);
+ fs_reg src = coordinate;
+ coordinate = dst;
+
+ emit(fs_inst(BRW_OPCODE_MUL, dst, src, scale_x));
+ dst.reg_offset++;
+ src.reg_offset++;
+ emit(fs_inst(BRW_OPCODE_MUL, dst, src, scale_y));
+ }
+
+ /* Writemasking doesn't eliminate channels on SIMD8 texture
+ * samples, so don't worry about them.
+ */
+ fs_reg dst = fs_reg(this, glsl_type::vec4_type);
+
+ if (intel->gen < 5) {
+ inst = emit_texture_gen4(ir, dst, coordinate);
+ } else {
+ inst = emit_texture_gen5(ir, dst, coordinate);
+ }
+
+ inst->sampler = sampler;
+
+ this->result = dst;
+
+ if (ir->shadow_comparitor)
+ inst->shadow_compare = true;
+
+ if (c->key.tex_swizzles[inst->sampler] != SWIZZLE_NOOP) {
+ fs_reg swizzle_dst = fs_reg(this, glsl_type::vec4_type);
+
+ for (int i = 0; i < 4; i++) {
+ int swiz = GET_SWZ(c->key.tex_swizzles[inst->sampler], i);
+ fs_reg l = swizzle_dst;
+ l.reg_offset += i;
+
+ if (swiz == SWIZZLE_ZERO) {
+ emit(fs_inst(BRW_OPCODE_MOV, l, fs_reg(0.0f)));
+ } else if (swiz == SWIZZLE_ONE) {
+ emit(fs_inst(BRW_OPCODE_MOV, l, fs_reg(1.0f)));
+ } else {
+ fs_reg r = dst;
+ r.reg_offset += GET_SWZ(c->key.tex_swizzles[inst->sampler], i);
+ emit(fs_inst(BRW_OPCODE_MOV, l, r));
+ }
+ }
+ this->result = swizzle_dst;
+ }
}
void
ir->val->accept(this);
fs_reg val = this->result;
+ if (ir->type->vector_elements == 1) {
+ this->result.reg_offset += ir->mask.x;
+ return;
+ }
+
fs_reg result = fs_reg(this, ir->type);
this->result = result;
void
fs_visitor::visit(ir_discard *ir)
{
+ fs_reg temp = fs_reg(this, glsl_type::uint_type);
+
assert(ir->condition == NULL); /* FINISHME */
- emit(fs_inst(FS_OPCODE_DISCARD));
+ emit(fs_inst(FS_OPCODE_DISCARD_NOT, temp, reg_null_d));
+ emit(fs_inst(FS_OPCODE_DISCARD_AND, reg_null_d, temp));
+ kill_emitted = true;
}
void
}
}
+void
+fs_visitor::emit_bool_to_cond_code(ir_rvalue *ir)
+{
+ ir_expression *expr = ir->as_expression();
+
+ if (expr) {
+ fs_reg op[2];
+ fs_inst *inst;
+
+ for (unsigned int i = 0; i < expr->get_num_operands(); i++) {
+ assert(expr->operands[i]->type->is_scalar());
+
+ expr->operands[i]->accept(this);
+ op[i] = this->result;
+ }
+
+ switch (expr->operation) {
+ case ir_unop_logic_not:
+ inst = emit(fs_inst(BRW_OPCODE_AND, reg_null_d, op[0], fs_reg(1)));
+ inst->conditional_mod = BRW_CONDITIONAL_Z;
+ break;
+
+ case ir_binop_logic_xor:
+ inst = emit(fs_inst(BRW_OPCODE_XOR, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ break;
+
+ case ir_binop_logic_or:
+ inst = emit(fs_inst(BRW_OPCODE_OR, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ break;
+
+ case ir_binop_logic_and:
+ inst = emit(fs_inst(BRW_OPCODE_AND, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ break;
+
+ case ir_unop_f2b:
+ if (intel->gen >= 6) {
+ inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d,
+ op[0], fs_reg(0.0f)));
+ } else {
+ inst = emit(fs_inst(BRW_OPCODE_MOV, reg_null_d, op[0]));
+ }
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ break;
+
+ case ir_unop_i2b:
+ if (intel->gen >= 6) {
+ inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], fs_reg(0)));
+ } else {
+ inst = emit(fs_inst(BRW_OPCODE_MOV, reg_null_d, op[0]));
+ }
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ break;
+
+ case ir_binop_greater:
+ inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_G;
+ break;
+ case ir_binop_gequal:
+ inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_GE;
+ break;
+ case ir_binop_less:
+ inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_L;
+ break;
+ case ir_binop_lequal:
+ inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_LE;
+ break;
+ case ir_binop_equal:
+ case ir_binop_all_equal:
+ inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_Z;
+ break;
+ case ir_binop_nequal:
+ case ir_binop_any_nequal:
+ inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ break;
+ default:
+ assert(!"not reached");
+ this->fail = true;
+ break;
+ }
+ return;
+ }
+
+ ir->accept(this);
+
+ if (intel->gen >= 6) {
+ fs_inst *inst = emit(fs_inst(BRW_OPCODE_AND, reg_null_d,
+ this->result, fs_reg(1)));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ } else {
+ fs_inst *inst = emit(fs_inst(BRW_OPCODE_MOV, reg_null_d, this->result));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ }
+}
+
+/**
+ * Emit a gen6 IF statement with the comparison folded into the IF
+ * instruction.
+ */
+void
+fs_visitor::emit_if_gen6(ir_if *ir)
+{
+ ir_expression *expr = ir->condition->as_expression();
+
+ if (expr) {
+ fs_reg op[2];
+ fs_inst *inst;
+ fs_reg temp;
+
+ for (unsigned int i = 0; i < expr->get_num_operands(); i++) {
+ assert(expr->operands[i]->type->is_scalar());
+
+ expr->operands[i]->accept(this);
+ op[i] = this->result;
+ }
+
+ switch (expr->operation) {
+ case ir_unop_logic_not:
+ inst = emit(fs_inst(BRW_OPCODE_IF, temp, op[0], fs_reg(1)));
+ inst->conditional_mod = BRW_CONDITIONAL_Z;
+ return;
+
+ case ir_binop_logic_xor:
+ inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ return;
+
+ case ir_binop_logic_or:
+ temp = fs_reg(this, glsl_type::bool_type);
+ emit(fs_inst(BRW_OPCODE_OR, temp, op[0], op[1]));
+ inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, temp, fs_reg(0)));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ return;
+
+ case ir_binop_logic_and:
+ temp = fs_reg(this, glsl_type::bool_type);
+ emit(fs_inst(BRW_OPCODE_AND, temp, op[0], op[1]));
+ inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, temp, fs_reg(0)));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ return;
+
+ case ir_unop_f2b:
+ inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_f, op[0], fs_reg(0)));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ return;
+
+ case ir_unop_i2b:
+ inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], fs_reg(0)));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ return;
+
+ case ir_binop_greater:
+ inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_G;
+ return;
+ case ir_binop_gequal:
+ inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_GE;
+ return;
+ case ir_binop_less:
+ inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_L;
+ return;
+ case ir_binop_lequal:
+ inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_LE;
+ return;
+ case ir_binop_equal:
+ case ir_binop_all_equal:
+ inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_Z;
+ return;
+ case ir_binop_nequal:
+ case ir_binop_any_nequal:
+ inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], op[1]));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ return;
+ default:
+ assert(!"not reached");
+ inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, op[0], fs_reg(0)));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ this->fail = true;
+ return;
+ }
+ return;
+ }
+
+ ir->condition->accept(this);
+
+ fs_inst *inst = emit(fs_inst(BRW_OPCODE_IF, reg_null_d, this->result, fs_reg(0)));
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+}
+
void
fs_visitor::visit(ir_if *ir)
{
*/
this->base_ir = ir->condition;
- /* Generate the condition into the condition code. */
- ir->condition->accept(this);
- inst = emit(fs_inst(BRW_OPCODE_MOV, fs_reg(brw_null_reg()), this->result));
- inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ if (intel->gen >= 6) {
+ emit_if_gen6(ir);
+ } else {
+ emit_bool_to_cond_code(ir->condition);
- inst = emit(fs_inst(BRW_OPCODE_IF));
- inst->predicated = true;
+ inst = emit(fs_inst(BRW_OPCODE_IF));
+ inst->predicated = true;
+ }
foreach_iter(exec_list_iterator, iter, ir->then_instructions) {
ir_instruction *ir = (ir_instruction *)iter.get();
void
fs_visitor::visit(ir_loop *ir)
{
- assert(!ir->from);
- assert(!ir->to);
- assert(!ir->increment);
- assert(!ir->counter);
+ fs_reg counter = reg_undef;
+
+ if (ir->counter) {
+ this->base_ir = ir->counter;
+ ir->counter->accept(this);
+ counter = *(variable_storage(ir->counter));
+
+ if (ir->from) {
+ this->base_ir = ir->from;
+ ir->from->accept(this);
+
+ emit(fs_inst(BRW_OPCODE_MOV, counter, this->result));
+ }
+ }
emit(fs_inst(BRW_OPCODE_DO));
- /* Start a safety counter. If the user messed up their loop
- * counting, we don't want to hang the GPU.
- */
- fs_reg max_iter = fs_reg(this, glsl_type::int_type);
- emit(fs_inst(BRW_OPCODE_MOV, max_iter, fs_reg(10000)));
+ if (ir->to) {
+ this->base_ir = ir->to;
+ ir->to->accept(this);
+
+ fs_inst *inst = emit(fs_inst(BRW_OPCODE_CMP, reg_null_d,
+ counter, this->result));
+ switch (ir->cmp) {
+ case ir_binop_equal:
+ inst->conditional_mod = BRW_CONDITIONAL_Z;
+ break;
+ case ir_binop_nequal:
+ inst->conditional_mod = BRW_CONDITIONAL_NZ;
+ break;
+ case ir_binop_gequal:
+ inst->conditional_mod = BRW_CONDITIONAL_GE;
+ break;
+ case ir_binop_lequal:
+ inst->conditional_mod = BRW_CONDITIONAL_LE;
+ break;
+ case ir_binop_greater:
+ inst->conditional_mod = BRW_CONDITIONAL_G;
+ break;
+ case ir_binop_less:
+ inst->conditional_mod = BRW_CONDITIONAL_L;
+ break;
+ default:
+ assert(!"not reached: unknown loop condition");
+ this->fail = true;
+ break;
+ }
+
+ inst = emit(fs_inst(BRW_OPCODE_BREAK));
+ inst->predicated = true;
+ }
foreach_iter(exec_list_iterator, iter, ir->body_instructions) {
ir_instruction *ir = (ir_instruction *)iter.get();
- fs_inst *inst;
this->base_ir = ir;
ir->accept(this);
+ }
- /* Check the maximum loop iters counter. */
- inst = emit(fs_inst(BRW_OPCODE_ADD, max_iter, max_iter, fs_reg(-1)));
- inst->conditional_mod = BRW_CONDITIONAL_Z;
-
- inst = emit(fs_inst(BRW_OPCODE_BREAK));
- inst->predicated = true;
+ if (ir->increment) {
+ this->base_ir = ir->increment;
+ ir->increment->accept(this);
+ emit(fs_inst(BRW_OPCODE_ADD, counter, counter, this->result));
}
emit(fs_inst(BRW_OPCODE_WHILE));
write = emit(fs_inst(FS_OPCODE_FB_WRITE,
fs_reg(0),
fs_reg(0)));
+ write->base_mrf = 0;
}
/* The register location here is relative to the start of the URB
struct brw_reg
fs_visitor::interp_reg(int location, int channel)
{
- int regnr = location * 2 + channel / 2;
+ int regnr = urb_setup[location] * 2 + channel / 2;
int stride = (channel & 1) * 4;
+ assert(urb_setup[location] != -1);
+
return brw_vec1_grf(regnr, stride);
}
/** Emits the interpolation for the varying inputs. */
void
-fs_visitor::emit_interpolation()
+fs_visitor::emit_interpolation_setup_gen4()
{
struct brw_reg g1_uw = retype(brw_vec1_grf(1, 0), BRW_REGISTER_TYPE_UW);
- /* For now, the source regs for the setup URB data will be unset,
- * since we don't know until codegen how many push constants we'll
- * use, and therefore what the setup URB offset is.
- */
- fs_reg src_reg = reg_undef;
this->current_annotation = "compute pixel centers";
this->pixel_x = fs_reg(this, glsl_type::uint_type);
fs_reg(brw_imm_v(0x11001100))));
this->current_annotation = "compute pixel deltas from v0";
- this->delta_x = fs_reg(this, glsl_type::float_type);
- this->delta_y = fs_reg(this, glsl_type::float_type);
+ if (brw->has_pln) {
+ this->delta_x = fs_reg(this, glsl_type::vec2_type);
+ this->delta_y = this->delta_x;
+ this->delta_y.reg_offset++;
+ } else {
+ this->delta_x = fs_reg(this, glsl_type::float_type);
+ this->delta_y = fs_reg(this, glsl_type::float_type);
+ }
emit(fs_inst(BRW_OPCODE_ADD,
this->delta_x,
this->pixel_x,
emit(fs_inst(BRW_OPCODE_ADD,
this->delta_y,
this->pixel_y,
- fs_reg(brw_vec1_grf(1, 1))));
+ fs_reg(negate(brw_vec1_grf(1, 1)))));
this->current_annotation = "compute pos.w and 1/pos.w";
- /* Compute wpos. Unlike many other varying inputs, we usually need it
- * to produce 1/w, and the varying variable wouldn't show up.
+ /* Compute wpos.w. It's always in our setup, since it's needed to
+ * interpolate the other attributes.
*/
- fs_reg wpos = fs_reg(this, glsl_type::vec4_type);
- this->interp_attrs[FRAG_ATTRIB_WPOS] = wpos;
- emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_x)); /* FINISHME: ARB_fcc */
- wpos.reg_offset++;
- emit(fs_inst(BRW_OPCODE_MOV, wpos, this->pixel_y)); /* FINISHME: ARB_fcc */
- wpos.reg_offset++;
- emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y,
- interp_reg(FRAG_ATTRIB_WPOS, 2)));
- wpos.reg_offset++;
- emit(fs_inst(FS_OPCODE_LINTERP, wpos, this->delta_x, this->delta_y,
+ this->wpos_w = fs_reg(this, glsl_type::float_type);
+ emit(fs_inst(FS_OPCODE_LINTERP, wpos_w, this->delta_x, this->delta_y,
interp_reg(FRAG_ATTRIB_WPOS, 3)));
- /* Compute the pixel W value from wpos.w. */
+ /* Compute the pixel 1/W value from wpos.w. */
this->pixel_w = fs_reg(this, glsl_type::float_type);
- emit(fs_inst(FS_OPCODE_RCP, this->pixel_w, wpos));
+ emit_math(FS_OPCODE_RCP, this->pixel_w, wpos_w);
+ this->current_annotation = NULL;
+}
- /* FINISHME: gl_FrontFacing */
+/** Emits the interpolation for the varying inputs. */
+void
+fs_visitor::emit_interpolation_setup_gen6()
+{
+ struct brw_reg g1_uw = retype(brw_vec1_grf(1, 0), BRW_REGISTER_TYPE_UW);
- foreach_iter(exec_list_iterator, iter, *this->shader->ir) {
- ir_instruction *ir = (ir_instruction *)iter.get();
- ir_variable *var = ir->as_variable();
+ /* If the pixel centers end up used, the setup is the same as for gen4. */
+ this->current_annotation = "compute pixel centers";
+ fs_reg int_pixel_x = fs_reg(this, glsl_type::uint_type);
+ fs_reg int_pixel_y = fs_reg(this, glsl_type::uint_type);
+ int_pixel_x.type = BRW_REGISTER_TYPE_UW;
+ int_pixel_y.type = BRW_REGISTER_TYPE_UW;
+ emit(fs_inst(BRW_OPCODE_ADD,
+ int_pixel_x,
+ fs_reg(stride(suboffset(g1_uw, 4), 2, 4, 0)),
+ fs_reg(brw_imm_v(0x10101010))));
+ emit(fs_inst(BRW_OPCODE_ADD,
+ int_pixel_y,
+ fs_reg(stride(suboffset(g1_uw, 5), 2, 4, 0)),
+ fs_reg(brw_imm_v(0x11001100))));
- if (!var)
- continue;
+ /* As of gen6, we can no longer mix float and int sources. We have
+ * to turn the integer pixel centers into floats for their actual
+ * use.
+ */
+ this->pixel_x = fs_reg(this, glsl_type::float_type);
+ this->pixel_y = fs_reg(this, glsl_type::float_type);
+ emit(fs_inst(BRW_OPCODE_MOV, this->pixel_x, int_pixel_x));
+ emit(fs_inst(BRW_OPCODE_MOV, this->pixel_y, int_pixel_y));
- if (var->mode != ir_var_in)
- continue;
+ this->current_annotation = "compute 1/pos.w";
+ this->wpos_w = fs_reg(brw_vec8_grf(c->key.source_w_reg, 0));
+ this->pixel_w = fs_reg(this, glsl_type::float_type);
+ emit_math(FS_OPCODE_RCP, this->pixel_w, wpos_w);
- /* If it's already set up (WPOS), skip. */
- if (var->location == 0)
- continue;
+ this->delta_x = fs_reg(brw_vec8_grf(2, 0));
+ this->delta_y = fs_reg(brw_vec8_grf(3, 0));
- this->current_annotation = talloc_asprintf(this->mem_ctx,
- "interpolate %s "
- "(FRAG_ATTRIB[%d])",
- var->name,
- var->location);
- emit_pinterp(var->location);
- }
this->current_annotation = NULL;
}
void
-fs_visitor::emit_pinterp(int location)
+fs_visitor::emit_fb_writes()
{
- fs_reg interp_attr = fs_reg(this, glsl_type::vec4_type);
- this->interp_attrs[location] = interp_attr;
+ this->current_annotation = "FB write header";
+ GLboolean header_present = GL_TRUE;
+ int nr = 0;
- for (unsigned int i = 0; i < 4; i++) {
- struct brw_reg interp = interp_reg(location, i);
- emit(fs_inst(FS_OPCODE_LINTERP,
- interp_attr,
- this->delta_x,
- this->delta_y,
- fs_reg(interp)));
- interp_attr.reg_offset++;
+ if (intel->gen >= 6 &&
+ !this->kill_emitted &&
+ c->key.nr_color_regions == 1) {
+ header_present = false;
}
- interp_attr.reg_offset -= 4;
- for (unsigned int i = 0; i < 4; i++) {
- emit(fs_inst(BRW_OPCODE_MUL,
- interp_attr,
- interp_attr,
- this->pixel_w));
- interp_attr.reg_offset++;
+ if (header_present) {
+ /* m0, m1 header */
+ nr += 2;
}
-}
-void
-fs_visitor::emit_fb_writes()
-{
- this->current_annotation = "FB write";
+ if (c->key.aa_dest_stencil_reg) {
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++),
+ fs_reg(brw_vec8_grf(c->key.aa_dest_stencil_reg, 0))));
+ }
+
+ /* Reserve space for color. It'll be filled in per MRT below. */
+ int color_mrf = nr;
+ nr += 4;
- assert(this->frag_color || !"FINISHME: MRT");
- fs_reg color = *(variable_storage(this->frag_color));
+ if (c->key.source_depth_to_render_target) {
+ if (c->key.computes_depth) {
+ /* Hand over gl_FragDepth. */
+ assert(this->frag_depth);
+ fs_reg depth = *(variable_storage(this->frag_depth));
- for (int i = 0; i < 4; i++) {
- emit(fs_inst(BRW_OPCODE_MOV,
- fs_reg(MRF, 2 + i),
- color));
- color.reg_offset++;
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++), depth));
+ } else {
+ /* Pass through the payload depth. */
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++),
+ fs_reg(brw_vec8_grf(c->key.source_depth_reg, 0))));
+ }
+ }
+
+ if (c->key.dest_depth_reg) {
+ emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, nr++),
+ fs_reg(brw_vec8_grf(c->key.dest_depth_reg, 0))));
+ }
+
+ fs_reg color = reg_undef;
+ if (this->frag_color)
+ color = *(variable_storage(this->frag_color));
+ else if (this->frag_data)
+ color = *(variable_storage(this->frag_data));
+
+ for (int target = 0; target < c->key.nr_color_regions; target++) {
+ this->current_annotation = talloc_asprintf(this->mem_ctx,
+ "FB write target %d",
+ target);
+ if (this->frag_color || this->frag_data) {
+ for (int i = 0; i < 4; i++) {
+ emit(fs_inst(BRW_OPCODE_MOV,
+ fs_reg(MRF, color_mrf + i),
+ color));
+ color.reg_offset++;
+ }
+ }
+
+ if (this->frag_color)
+ color.reg_offset -= 4;
+
+ fs_inst *inst = emit(fs_inst(FS_OPCODE_FB_WRITE,
+ reg_undef, reg_undef));
+ inst->target = target;
+ inst->base_mrf = 0;
+ inst->mlen = nr;
+ if (target == c->key.nr_color_regions - 1)
+ inst->eot = true;
+ inst->header_present = header_present;
}
- emit(fs_inst(FS_OPCODE_FB_WRITE,
- fs_reg(0),
- fs_reg(0)));
+ if (c->key.nr_color_regions == 0) {
+ fs_inst *inst = emit(fs_inst(FS_OPCODE_FB_WRITE,
+ reg_undef, reg_undef));
+ inst->base_mrf = 0;
+ inst->mlen = nr;
+ inst->eot = true;
+ inst->header_present = header_present;
+ }
this->current_annotation = NULL;
}
void
fs_visitor::generate_fb_write(fs_inst *inst)
{
- GLboolean eot = 1; /* FINISHME: MRT */
- /* FINISHME: AADS */
+ GLboolean eot = inst->eot;
+ struct brw_reg implied_header;
/* Header is 2 regs, g0 and g1 are the contents. g0 will be implied
* move, here's g1.
brw_push_insn_state(p);
brw_set_mask_control(p, BRW_MASK_DISABLE);
brw_set_compression_control(p, BRW_COMPRESSION_NONE);
- brw_MOV(p,
- brw_message_reg(1),
- brw_vec8_grf(1, 0));
- brw_pop_insn_state(p);
- int nr = 2 + 4;
+ if (inst->header_present) {
+ if (intel->gen >= 6) {
+ brw_MOV(p,
+ brw_message_reg(inst->base_mrf),
+ brw_vec8_grf(0, 0));
+ implied_header = brw_null_reg();
+ } else {
+ implied_header = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW);
+ }
+
+ brw_MOV(p,
+ brw_message_reg(inst->base_mrf + 1),
+ brw_vec8_grf(1, 0));
+ } else {
+ implied_header = brw_null_reg();
+ }
+
+ brw_pop_insn_state(p);
brw_fb_WRITE(p,
8, /* dispatch_width */
retype(vec8(brw_null_reg()), BRW_REGISTER_TYPE_UW),
- 0, /* base MRF */
- retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW),
- 0, /* FINISHME: MRT target */
- nr,
+ inst->base_mrf,
+ implied_header,
+ inst->target,
+ inst->mlen,
0,
eot);
}
break;
}
- if (inst->opcode == FS_OPCODE_POW) {
- brw_MOV(p, brw_message_reg(3), src[1]);
- }
+ if (intel->gen >= 6) {
+ assert(inst->mlen == 0);
- brw_math(p, dst,
- op,
- inst->saturate ? BRW_MATH_SATURATE_SATURATE :
- BRW_MATH_SATURATE_NONE,
- 2, src[0],
- BRW_MATH_DATA_VECTOR,
- BRW_MATH_PRECISION_FULL);
+ if (inst->opcode == FS_OPCODE_POW) {
+ brw_math2(p, dst, op, src[0], src[1]);
+ } else {
+ brw_math(p, dst,
+ op,
+ inst->saturate ? BRW_MATH_SATURATE_SATURATE :
+ BRW_MATH_SATURATE_NONE,
+ 0, src[0],
+ BRW_MATH_DATA_VECTOR,
+ BRW_MATH_PRECISION_FULL);
+ }
+ } else {
+ assert(inst->mlen >= 1);
+
+ brw_math(p, dst,
+ op,
+ inst->saturate ? BRW_MATH_SATURATE_SATURATE :
+ BRW_MATH_SATURATE_NONE,
+ inst->base_mrf, src[0],
+ BRW_MATH_DATA_VECTOR,
+ BRW_MATH_PRECISION_FULL);
+ }
}
void
-fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src)
+fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst)
{
int msg_type = -1;
int rlen = 4;
+ uint32_t simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD8;
- if (intel->gen == 5) {
+ if (intel->gen >= 5) {
switch (inst->opcode) {
case FS_OPCODE_TEX:
if (inst->shadow_compare) {
/* Note that G45 and older determines shadow compare and dispatch width
* from message length for most messages.
*/
+ msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE;
if (inst->shadow_compare) {
- msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE;
+ assert(inst->mlen == 6);
} else {
- msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE;
+ assert(inst->mlen <= 4);
}
+ break;
case FS_OPCODE_TXB:
if (inst->shadow_compare) {
- assert(!"FINISHME: shadow compare with bias.");
- msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS;
+ assert(inst->mlen == 6);
+ msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE;
} else {
+ assert(inst->mlen == 9);
msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS;
- rlen = 8;
+ simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD16;
}
break;
}
}
assert(msg_type != -1);
- /* g0 header. */
- src.nr--;
+ if (simd_mode == BRW_SAMPLER_SIMD_MODE_SIMD16) {
+ rlen = 8;
+ dst = vec16(dst);
+ }
brw_SAMPLE(p,
retype(dst, BRW_REGISTER_TYPE_UW),
- src.nr,
+ inst->base_mrf,
retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW),
SURF_INDEX_TEXTURE(inst->sampler),
inst->sampler,
WRITEMASK_XYZW,
msg_type,
rlen,
- inst->mlen + 1,
+ inst->mlen,
0,
1,
- BRW_SAMPLER_SIMD_MODE_SIMD8);
+ simd_mode);
}
}
void
-fs_visitor::generate_discard(fs_inst *inst)
+fs_visitor::generate_discard_not(fs_inst *inst, struct brw_reg mask)
{
- struct brw_reg g0 = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW);
brw_push_insn_state(p);
brw_set_mask_control(p, BRW_MASK_DISABLE);
- brw_NOT(p, c->emit_mask_reg, brw_mask_reg(1)); /* IMASK */
- brw_AND(p, g0, c->emit_mask_reg, g0);
+ brw_NOT(p, mask, brw_mask_reg(1)); /* IMASK */
brw_pop_insn_state(p);
}
-static void
-trivial_assign_reg(int header_size, fs_reg *reg)
+void
+fs_visitor::generate_discard_and(fs_inst *inst, struct brw_reg mask)
{
- if (reg->file == GRF && reg->reg != 0) {
- reg->hw_reg = header_size + reg->reg - 1 + reg->reg_offset;
- reg->reg = 0;
- }
+ struct brw_reg g0 = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW);
+ mask = brw_uw1_reg(mask.file, mask.nr, 0);
+
+ brw_push_insn_state(p);
+ brw_set_mask_control(p, BRW_MASK_DISABLE);
+ brw_AND(p, g0, mask, g0);
+ brw_pop_insn_state(p);
}
void
c->prog_data.first_curbe_grf = c->key.nr_payload_regs;
c->prog_data.curb_read_length = ALIGN(c->prog_data.nr_params, 8) / 8;
- if (intel->gen == 5 && (c->prog_data.first_curbe_grf +
- c->prog_data.curb_read_length) & 1) {
- /* Align the start of the interpolation coefficients so that we can use
- * the PLN instruction.
- */
- c->prog_data.first_curbe_grf++;
- }
-
/* Map the offsets in the UNIFORM file to fixed HW regs. */
foreach_iter(exec_list_iterator, iter, this->instructions) {
fs_inst *inst = (fs_inst *)iter.get();
}
void
-fs_visitor::assign_urb_setup()
+fs_visitor::calculate_urb_setup()
{
- int urb_start = c->prog_data.first_curbe_grf + c->prog_data.curb_read_length;
- int interp_reg_nr[FRAG_ATTRIB_MAX];
-
- c->prog_data.urb_read_length = 0;
-
- /* Figure out where each of the incoming setup attributes lands. */
for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) {
- interp_reg_nr[i] = -1;
+ urb_setup[i] = -1;
+ }
- if (i != FRAG_ATTRIB_WPOS &&
- !(brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(i)))
- continue;
-
- /* Each attribute is 4 setup channels, each of which is half a reg. */
- interp_reg_nr[i] = urb_start + c->prog_data.urb_read_length;
- c->prog_data.urb_read_length += 2;
+ int urb_next = 0;
+ /* Figure out where each of the incoming setup attributes lands. */
+ if (intel->gen >= 6) {
+ for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) {
+ if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(i)) {
+ urb_setup[i] = urb_next++;
+ }
+ }
+ } else {
+ /* FINISHME: The sf doesn't map VS->FS inputs for us very well. */
+ for (unsigned int i = 0; i < VERT_RESULT_MAX; i++) {
+ if (c->key.vp_outputs_written & BITFIELD64_BIT(i)) {
+ int fp_index;
+
+ if (i >= VERT_RESULT_VAR0)
+ fp_index = i - (VERT_RESULT_VAR0 - FRAG_ATTRIB_VAR0);
+ else if (i <= VERT_RESULT_TEX7)
+ fp_index = i;
+ else
+ fp_index = -1;
+
+ if (fp_index >= 0)
+ urb_setup[fp_index] = urb_next++;
+ }
+ }
}
- /* Map the register numbers for FS_OPCODE_LINTERP so that it uses
- * the correct setup input.
+ /* Each attribute is 4 setup channels, each of which is half a reg. */
+ c->prog_data.urb_read_length = urb_next * 2;
+}
+
+void
+fs_visitor::assign_urb_setup()
+{
+ int urb_start = c->prog_data.first_curbe_grf + c->prog_data.curb_read_length;
+
+ /* Offset all the urb_setup[] index by the actual position of the
+ * setup regs, now that the location of the constants has been chosen.
*/
foreach_iter(exec_list_iterator, iter, this->instructions) {
fs_inst *inst = (fs_inst *)iter.get();
assert(inst->src[2].file == FIXED_HW_REG);
- int location = inst->src[2].fixed_hw_reg.nr / 2;
- assert(interp_reg_nr[location] != -1);
- inst->src[2].fixed_hw_reg.nr = (interp_reg_nr[location] +
- (inst->src[2].fixed_hw_reg.nr & 1));
+ inst->src[2].fixed_hw_reg.nr += urb_start;
}
this->first_non_payload_grf = urb_start + c->prog_data.urb_read_length;
}
+static void
+assign_reg(int *reg_hw_locations, fs_reg *reg)
+{
+ if (reg->file == GRF && reg->reg != 0) {
+ assert(reg->reg_offset >= 0);
+ reg->hw_reg = reg_hw_locations[reg->reg] + reg->reg_offset;
+ reg->reg = 0;
+ }
+}
+
void
-fs_visitor::assign_regs()
+fs_visitor::assign_regs_trivial()
{
- int header_size = this->first_non_payload_grf;
int last_grf = 0;
+ int hw_reg_mapping[this->virtual_grf_next];
+ int i;
+
+ hw_reg_mapping[0] = 0;
+ hw_reg_mapping[1] = this->first_non_payload_grf;
+ for (i = 2; i < this->virtual_grf_next; i++) {
+ hw_reg_mapping[i] = (hw_reg_mapping[i - 1] +
+ this->virtual_grf_sizes[i - 1]);
+ }
+ last_grf = hw_reg_mapping[i - 1] + this->virtual_grf_sizes[i - 1];
- /* FINISHME: trivial assignment of register numbers */
foreach_iter(exec_list_iterator, iter, this->instructions) {
fs_inst *inst = (fs_inst *)iter.get();
- trivial_assign_reg(header_size, &inst->dst);
- trivial_assign_reg(header_size, &inst->src[0]);
- trivial_assign_reg(header_size, &inst->src[1]);
+ assign_reg(hw_reg_mapping, &inst->dst);
+ assign_reg(hw_reg_mapping, &inst->src[0]);
+ assign_reg(hw_reg_mapping, &inst->src[1]);
+ }
+
+ this->grf_used = last_grf + 1;
+}
+
+void
+fs_visitor::assign_regs()
+{
+ int last_grf = 0;
+ int hw_reg_mapping[this->virtual_grf_next + 1];
+ int base_reg_count = BRW_MAX_GRF - this->first_non_payload_grf;
+ int class_sizes[base_reg_count];
+ int class_count = 0;
+ int aligned_pair_class = -1;
+
+ /* Set up the register classes.
+ *
+ * The base registers store a scalar value. For texture samples,
+ * we get virtual GRFs composed of 4 contiguous hw register. For
+ * structures and arrays, we store them as contiguous larger things
+ * than that, though we should be able to do better most of the
+ * time.
+ */
+ class_sizes[class_count++] = 1;
+ if (brw->has_pln && intel->gen < 6) {
+ /* Always set up the (unaligned) pairs for gen5, so we can find
+ * them for making the aligned pair class.
+ */
+ class_sizes[class_count++] = 2;
+ }
+ for (int r = 1; r < this->virtual_grf_next; r++) {
+ int i;
+
+ for (i = 0; i < class_count; i++) {
+ if (class_sizes[i] == this->virtual_grf_sizes[r])
+ break;
+ }
+ if (i == class_count) {
+ if (this->virtual_grf_sizes[r] >= base_reg_count) {
+ fprintf(stderr, "Object too large to register allocate.\n");
+ this->fail = true;
+ }
- last_grf = MAX2(last_grf, inst->dst.hw_reg);
- last_grf = MAX2(last_grf, inst->src[0].hw_reg);
- last_grf = MAX2(last_grf, inst->src[1].hw_reg);
+ class_sizes[class_count++] = this->virtual_grf_sizes[r];
+ }
+ }
+
+ int ra_reg_count = 0;
+ int class_base_reg[class_count];
+ int class_reg_count[class_count];
+ int classes[class_count + 1];
+
+ for (int i = 0; i < class_count; i++) {
+ class_base_reg[i] = ra_reg_count;
+ class_reg_count[i] = base_reg_count - (class_sizes[i] - 1);
+ ra_reg_count += class_reg_count[i];
+ }
+
+ struct ra_regs *regs = ra_alloc_reg_set(ra_reg_count);
+ for (int i = 0; i < class_count; i++) {
+ classes[i] = ra_alloc_reg_class(regs);
+
+ for (int i_r = 0; i_r < class_reg_count[i]; i_r++) {
+ ra_class_add_reg(regs, classes[i], class_base_reg[i] + i_r);
+ }
+
+ /* Add conflicts between our contiguous registers aliasing
+ * base regs and other register classes' contiguous registers
+ * that alias base regs, or the base regs themselves for classes[0].
+ */
+ for (int c = 0; c <= i; c++) {
+ for (int i_r = 0; i_r < class_reg_count[i]; i_r++) {
+ for (int c_r = MAX2(0, i_r - (class_sizes[c] - 1));
+ c_r < MIN2(class_reg_count[c], i_r + class_sizes[i]);
+ c_r++) {
+
+ if (0) {
+ printf("%d/%d conflicts %d/%d\n",
+ class_sizes[i], this->first_non_payload_grf + i_r,
+ class_sizes[c], this->first_non_payload_grf + c_r);
+ }
+
+ ra_add_reg_conflict(regs,
+ class_base_reg[i] + i_r,
+ class_base_reg[c] + c_r);
+ }
+ }
+ }
+ }
+
+ /* Add a special class for aligned pairs, which we'll put delta_x/y
+ * in on gen5 so that we can do PLN.
+ */
+ if (brw->has_pln && intel->gen < 6) {
+ int reg_count = (base_reg_count - 1) / 2;
+ int unaligned_pair_class = 1;
+ assert(class_sizes[unaligned_pair_class] == 2);
+
+ aligned_pair_class = class_count;
+ classes[aligned_pair_class] = ra_alloc_reg_class(regs);
+ class_sizes[aligned_pair_class] = 2;
+ class_base_reg[aligned_pair_class] = 0;
+ class_reg_count[aligned_pair_class] = 0;
+ int start = (this->first_non_payload_grf & 1) ? 1 : 0;
+
+ for (int i = 0; i < reg_count; i++) {
+ ra_class_add_reg(regs, classes[aligned_pair_class],
+ class_base_reg[unaligned_pair_class] + i * 2 + start);
+ }
+ class_count++;
+ }
+
+ ra_set_finalize(regs);
+
+ struct ra_graph *g = ra_alloc_interference_graph(regs,
+ this->virtual_grf_next);
+ /* Node 0 is just a placeholder to keep virtual_grf[] mapping 1:1
+ * with nodes.
+ */
+ ra_set_node_class(g, 0, classes[0]);
+
+ for (int i = 1; i < this->virtual_grf_next; i++) {
+ for (int c = 0; c < class_count; c++) {
+ if (class_sizes[c] == this->virtual_grf_sizes[i]) {
+ if (aligned_pair_class >= 0 &&
+ this->delta_x.reg == i) {
+ ra_set_node_class(g, i, classes[aligned_pair_class]);
+ } else {
+ ra_set_node_class(g, i, classes[c]);
+ }
+ break;
+ }
+ }
+
+ for (int j = 1; j < i; j++) {
+ if (virtual_grf_interferes(i, j)) {
+ ra_add_node_interference(g, i, j);
+ }
+ }
+ }
+
+ /* FINISHME: Handle spilling */
+ if (!ra_allocate_no_spills(g)) {
+ fprintf(stderr, "Failed to allocate registers.\n");
+ this->fail = true;
+ return;
+ }
+
+ /* Get the chosen virtual registers for each node, and map virtual
+ * regs in the register classes back down to real hardware reg
+ * numbers.
+ */
+ hw_reg_mapping[0] = 0; /* unused */
+ for (int i = 1; i < this->virtual_grf_next; i++) {
+ int reg = ra_get_node_reg(g, i);
+ int hw_reg = -1;
+
+ for (int c = 0; c < class_count; c++) {
+ if (reg >= class_base_reg[c] &&
+ reg < class_base_reg[c] + class_reg_count[c]) {
+ hw_reg = reg - class_base_reg[c];
+ break;
+ }
+ }
+
+ assert(hw_reg >= 0);
+ hw_reg_mapping[i] = this->first_non_payload_grf + hw_reg;
+ last_grf = MAX2(last_grf,
+ hw_reg_mapping[i] + this->virtual_grf_sizes[i] - 1);
+ }
+
+ foreach_iter(exec_list_iterator, iter, this->instructions) {
+ fs_inst *inst = (fs_inst *)iter.get();
+
+ assign_reg(hw_reg_mapping, &inst->dst);
+ assign_reg(hw_reg_mapping, &inst->src[0]);
+ assign_reg(hw_reg_mapping, &inst->src[1]);
}
this->grf_used = last_grf + 1;
+
+ talloc_free(g);
+ talloc_free(regs);
+}
+
+/**
+ * Split large virtual GRFs into separate components if we can.
+ *
+ * This is mostly duplicated with what brw_fs_vector_splitting does,
+ * but that's really conservative because it's afraid of doing
+ * splitting that doesn't result in real progress after the rest of
+ * the optimization phases, which would cause infinite looping in
+ * optimization. We can do it once here, safely. This also has the
+ * opportunity to split interpolated values, or maybe even uniforms,
+ * which we don't have at the IR level.
+ *
+ * We want to split, because virtual GRFs are what we register
+ * allocate and spill (due to contiguousness requirements for some
+ * instructions), and they're what we naturally generate in the
+ * codegen process, but most virtual GRFs don't actually need to be
+ * contiguous sets of GRFs. If we split, we'll end up with reduced
+ * live intervals and better dead code elimination and coalescing.
+ */
+void
+fs_visitor::split_virtual_grfs()
+{
+ int num_vars = this->virtual_grf_next;
+ bool split_grf[num_vars];
+ int new_virtual_grf[num_vars];
+
+ /* Try to split anything > 0 sized. */
+ for (int i = 0; i < num_vars; i++) {
+ if (this->virtual_grf_sizes[i] != 1)
+ split_grf[i] = true;
+ else
+ split_grf[i] = false;
+ }
+
+ if (brw->has_pln) {
+ /* PLN opcodes rely on the delta_xy being contiguous. */
+ split_grf[this->delta_x.reg] = false;
+ }
+
+ foreach_iter(exec_list_iterator, iter, this->instructions) {
+ fs_inst *inst = (fs_inst *)iter.get();
+
+ /* Texturing produces 4 contiguous registers, so no splitting. */
+ if ((inst->opcode == FS_OPCODE_TEX ||
+ inst->opcode == FS_OPCODE_TXB ||
+ inst->opcode == FS_OPCODE_TXL) &&
+ inst->dst.file == GRF) {
+ split_grf[inst->dst.reg] = false;
+ }
+ }
+
+ /* Allocate new space for split regs. Note that the virtual
+ * numbers will be contiguous.
+ */
+ for (int i = 0; i < num_vars; i++) {
+ if (split_grf[i]) {
+ new_virtual_grf[i] = virtual_grf_alloc(1);
+ for (int j = 2; j < this->virtual_grf_sizes[i]; j++) {
+ int reg = virtual_grf_alloc(1);
+ assert(reg == new_virtual_grf[i] + j - 1);
+ }
+ this->virtual_grf_sizes[i] = 1;
+ }
+ }
+
+ foreach_iter(exec_list_iterator, iter, this->instructions) {
+ fs_inst *inst = (fs_inst *)iter.get();
+
+ if (inst->dst.file == GRF &&
+ split_grf[inst->dst.reg] &&
+ inst->dst.reg_offset != 0) {
+ inst->dst.reg = (new_virtual_grf[inst->dst.reg] +
+ inst->dst.reg_offset - 1);
+ inst->dst.reg_offset = 0;
+ }
+ for (int i = 0; i < 3; i++) {
+ if (inst->src[i].file == GRF &&
+ split_grf[inst->src[i].reg] &&
+ inst->src[i].reg_offset != 0) {
+ inst->src[i].reg = (new_virtual_grf[inst->src[i].reg] +
+ inst->src[i].reg_offset - 1);
+ inst->src[i].reg_offset = 0;
+ }
+ }
+ }
+}
+
+void
+fs_visitor::calculate_live_intervals()
+{
+ int num_vars = this->virtual_grf_next;
+ int *def = talloc_array(mem_ctx, int, num_vars);
+ int *use = talloc_array(mem_ctx, int, num_vars);
+ int loop_depth = 0;
+ int loop_start = 0;
+
+ for (int i = 0; i < num_vars; i++) {
+ def[i] = 1 << 30;
+ use[i] = -1;
+ }
+
+ int ip = 0;
+ foreach_iter(exec_list_iterator, iter, this->instructions) {
+ fs_inst *inst = (fs_inst *)iter.get();
+
+ if (inst->opcode == BRW_OPCODE_DO) {
+ if (loop_depth++ == 0)
+ loop_start = ip;
+ } else if (inst->opcode == BRW_OPCODE_WHILE) {
+ loop_depth--;
+
+ if (loop_depth == 0) {
+ /* FINISHME:
+ *
+ * Patches up any vars marked for use within the loop as
+ * live until the end. This is conservative, as there
+ * will often be variables defined and used inside the
+ * loop but dead at the end of the loop body.
+ */
+ for (int i = 0; i < num_vars; i++) {
+ if (use[i] == loop_start) {
+ use[i] = ip;
+ }
+ }
+ }
+ } else {
+ int eip = ip;
+
+ if (loop_depth)
+ eip = loop_start;
+
+ for (unsigned int i = 0; i < 3; i++) {
+ if (inst->src[i].file == GRF && inst->src[i].reg != 0) {
+ use[inst->src[i].reg] = MAX2(use[inst->src[i].reg], eip);
+ }
+ }
+ if (inst->dst.file == GRF && inst->dst.reg != 0) {
+ def[inst->dst.reg] = MIN2(def[inst->dst.reg], eip);
+ }
+ }
+
+ ip++;
+ }
+
+ talloc_free(this->virtual_grf_def);
+ talloc_free(this->virtual_grf_use);
+ this->virtual_grf_def = def;
+ this->virtual_grf_use = use;
+}
+
+/**
+ * Attempts to move immediate constants into the immediate
+ * constant slot of following instructions.
+ *
+ * Immediate constants are a bit tricky -- they have to be in the last
+ * operand slot, you can't do abs/negate on them,
+ */
+
+bool
+fs_visitor::propagate_constants()
+{
+ bool progress = false;
+
+ foreach_iter(exec_list_iterator, iter, this->instructions) {
+ fs_inst *inst = (fs_inst *)iter.get();
+
+ if (inst->opcode != BRW_OPCODE_MOV ||
+ inst->predicated ||
+ inst->dst.file != GRF || inst->src[0].file != IMM ||
+ inst->dst.type != inst->src[0].type)
+ continue;
+
+ /* Don't bother with cases where we should have had the
+ * operation on the constant folded in GLSL already.
+ */
+ if (inst->saturate)
+ continue;
+
+ /* Found a move of a constant to a GRF. Find anything else using the GRF
+ * before it's written, and replace it with the constant if we can.
+ */
+ exec_list_iterator scan_iter = iter;
+ scan_iter.next();
+ for (; scan_iter.has_next(); scan_iter.next()) {
+ fs_inst *scan_inst = (fs_inst *)scan_iter.get();
+
+ if (scan_inst->opcode == BRW_OPCODE_DO ||
+ scan_inst->opcode == BRW_OPCODE_WHILE ||
+ scan_inst->opcode == BRW_OPCODE_ELSE ||
+ scan_inst->opcode == BRW_OPCODE_ENDIF) {
+ break;
+ }
+
+ for (int i = 2; i >= 0; i--) {
+ if (scan_inst->src[i].file != GRF ||
+ scan_inst->src[i].reg != inst->dst.reg ||
+ scan_inst->src[i].reg_offset != inst->dst.reg_offset)
+ continue;
+
+ /* Don't bother with cases where we should have had the
+ * operation on the constant folded in GLSL already.
+ */
+ if (scan_inst->src[i].negate || scan_inst->src[i].abs)
+ continue;
+
+ switch (scan_inst->opcode) {
+ case BRW_OPCODE_MOV:
+ scan_inst->src[i] = inst->src[0];
+ progress = true;
+ break;
+
+ case BRW_OPCODE_MUL:
+ case BRW_OPCODE_ADD:
+ if (i == 1) {
+ scan_inst->src[i] = inst->src[0];
+ progress = true;
+ } else if (i == 0 && scan_inst->src[1].file != IMM) {
+ /* Fit this constant in by commuting the operands */
+ scan_inst->src[0] = scan_inst->src[1];
+ scan_inst->src[1] = inst->src[0];
+ }
+ break;
+ case BRW_OPCODE_CMP:
+ if (i == 1) {
+ scan_inst->src[i] = inst->src[0];
+ progress = true;
+ }
+ }
+ }
+
+ if (scan_inst->dst.file == GRF &&
+ scan_inst->dst.reg == inst->dst.reg &&
+ (scan_inst->dst.reg_offset == inst->dst.reg_offset ||
+ scan_inst->opcode == FS_OPCODE_TEX)) {
+ break;
+ }
+ }
+ }
+
+ return progress;
+}
+/**
+ * Must be called after calculate_live_intervales() to remove unused
+ * writes to registers -- register allocation will fail otherwise
+ * because something deffed but not used won't be considered to
+ * interfere with other regs.
+ */
+bool
+fs_visitor::dead_code_eliminate()
+{
+ bool progress = false;
+ int num_vars = this->virtual_grf_next;
+ bool dead[num_vars];
+
+ for (int i = 0; i < num_vars; i++) {
+ dead[i] = this->virtual_grf_def[i] >= this->virtual_grf_use[i];
+
+ if (dead[i]) {
+ /* Mark off its interval so it won't interfere with anything. */
+ this->virtual_grf_def[i] = -1;
+ this->virtual_grf_use[i] = -1;
+ }
+ }
+
+ foreach_iter(exec_list_iterator, iter, this->instructions) {
+ fs_inst *inst = (fs_inst *)iter.get();
+
+ if (inst->dst.file == GRF && dead[inst->dst.reg]) {
+ inst->remove();
+ progress = true;
+ }
+ }
+
+ return progress;
+}
+
+bool
+fs_visitor::register_coalesce()
+{
+ bool progress = false;
+
+ foreach_iter(exec_list_iterator, iter, this->instructions) {
+ fs_inst *inst = (fs_inst *)iter.get();
+
+ if (inst->opcode != BRW_OPCODE_MOV ||
+ inst->predicated ||
+ inst->saturate ||
+ inst->dst.file != GRF || inst->src[0].file != GRF ||
+ inst->dst.type != inst->src[0].type)
+ continue;
+
+ /* Found a move of a GRF to a GRF. Let's see if we can coalesce
+ * them: check for no writes to either one until the exit of the
+ * program.
+ */
+ bool interfered = false;
+ exec_list_iterator scan_iter = iter;
+ scan_iter.next();
+ for (; scan_iter.has_next(); scan_iter.next()) {
+ fs_inst *scan_inst = (fs_inst *)scan_iter.get();
+
+ if (scan_inst->opcode == BRW_OPCODE_DO ||
+ scan_inst->opcode == BRW_OPCODE_WHILE ||
+ scan_inst->opcode == BRW_OPCODE_ENDIF) {
+ interfered = true;
+ iter = scan_iter;
+ break;
+ }
+
+ if (scan_inst->dst.file == GRF) {
+ if (scan_inst->dst.reg == inst->dst.reg &&
+ (scan_inst->dst.reg_offset == inst->dst.reg_offset ||
+ scan_inst->opcode == FS_OPCODE_TEX)) {
+ interfered = true;
+ break;
+ }
+ if (scan_inst->dst.reg == inst->src[0].reg &&
+ (scan_inst->dst.reg_offset == inst->src[0].reg_offset ||
+ scan_inst->opcode == FS_OPCODE_TEX)) {
+ interfered = true;
+ break;
+ }
+ }
+ }
+ if (interfered) {
+ continue;
+ }
+
+ /* Update live interval so we don't have to recalculate. */
+ this->virtual_grf_use[inst->src[0].reg] = MAX2(virtual_grf_use[inst->src[0].reg],
+ virtual_grf_use[inst->dst.reg]);
+
+ /* Rewrite the later usage to point at the source of the move to
+ * be removed.
+ */
+ for (exec_list_iterator scan_iter = iter; scan_iter.has_next();
+ scan_iter.next()) {
+ fs_inst *scan_inst = (fs_inst *)scan_iter.get();
+
+ for (int i = 0; i < 3; i++) {
+ if (scan_inst->src[i].file == GRF &&
+ scan_inst->src[i].reg == inst->dst.reg &&
+ scan_inst->src[i].reg_offset == inst->dst.reg_offset) {
+ scan_inst->src[i].reg = inst->src[0].reg;
+ scan_inst->src[i].reg_offset = inst->src[0].reg_offset;
+ scan_inst->src[i].abs |= inst->src[0].abs;
+ scan_inst->src[i].negate ^= inst->src[0].negate;
+ }
+ }
+ }
+
+ inst->remove();
+ progress = true;
+ }
+
+ return progress;
+}
+
+
+bool
+fs_visitor::compute_to_mrf()
+{
+ bool progress = false;
+ int next_ip = 0;
+
+ foreach_iter(exec_list_iterator, iter, this->instructions) {
+ fs_inst *inst = (fs_inst *)iter.get();
+
+ int ip = next_ip;
+ next_ip++;
+
+ if (inst->opcode != BRW_OPCODE_MOV ||
+ inst->predicated ||
+ inst->dst.file != MRF || inst->src[0].file != GRF ||
+ inst->dst.type != inst->src[0].type ||
+ inst->src[0].abs || inst->src[0].negate)
+ continue;
+
+ /* Can't compute-to-MRF this GRF if someone else was going to
+ * read it later.
+ */
+ if (this->virtual_grf_use[inst->src[0].reg] > ip)
+ continue;
+
+ /* Found a move of a GRF to a MRF. Let's see if we can go
+ * rewrite the thing that made this GRF to write into the MRF.
+ */
+ bool found = false;
+ fs_inst *scan_inst;
+ for (scan_inst = (fs_inst *)inst->prev;
+ scan_inst->prev != NULL;
+ scan_inst = (fs_inst *)scan_inst->prev) {
+ /* We don't handle flow control here. Most computation of
+ * values that end up in MRFs are shortly before the MRF
+ * write anyway.
+ */
+ if (scan_inst->opcode == BRW_OPCODE_DO ||
+ scan_inst->opcode == BRW_OPCODE_WHILE ||
+ scan_inst->opcode == BRW_OPCODE_ENDIF) {
+ break;
+ }
+
+ /* You can't read from an MRF, so if someone else reads our
+ * MRF's source GRF that we wanted to rewrite, that stops us.
+ */
+ bool interfered = false;
+ for (int i = 0; i < 3; i++) {
+ if (scan_inst->src[i].file == GRF &&
+ scan_inst->src[i].reg == inst->src[0].reg &&
+ scan_inst->src[i].reg_offset == inst->src[0].reg_offset) {
+ interfered = true;
+ }
+ }
+ if (interfered)
+ break;
+
+ if (scan_inst->dst.file == MRF &&
+ scan_inst->dst.hw_reg == inst->dst.hw_reg) {
+ /* Somebody else wrote our MRF here, so we can't can't
+ * compute-to-MRF before that.
+ */
+ break;
+ }
+
+ if (scan_inst->mlen > 0) {
+ /* Found a SEND instruction, which will do some amount of
+ * implied write that may overwrite our MRF that we were
+ * hoping to compute-to-MRF somewhere above it. Nothing
+ * we have implied-writes more than 2 MRFs from base_mrf,
+ * though.
+ */
+ int implied_write_len = MIN2(scan_inst->mlen, 2);
+ if (inst->dst.hw_reg >= scan_inst->base_mrf &&
+ inst->dst.hw_reg < scan_inst->base_mrf + implied_write_len) {
+ break;
+ }
+ }
+
+ if (scan_inst->dst.file == GRF &&
+ scan_inst->dst.reg == inst->src[0].reg) {
+ /* Found the last thing to write our reg we want to turn
+ * into a compute-to-MRF.
+ */
+
+ if (scan_inst->opcode == FS_OPCODE_TEX) {
+ /* texturing writes several continuous regs, so we can't
+ * compute-to-mrf that.
+ */
+ break;
+ }
+
+ /* If it's predicated, it (probably) didn't populate all
+ * the channels.
+ */
+ if (scan_inst->predicated)
+ break;
+
+ /* SEND instructions can't have MRF as a destination. */
+ if (scan_inst->mlen)
+ break;
+
+ if (intel->gen >= 6) {
+ /* gen6 math instructions must have the destination be
+ * GRF, so no compute-to-MRF for them.
+ */
+ if (scan_inst->opcode == FS_OPCODE_RCP ||
+ scan_inst->opcode == FS_OPCODE_RSQ ||
+ scan_inst->opcode == FS_OPCODE_SQRT ||
+ scan_inst->opcode == FS_OPCODE_EXP2 ||
+ scan_inst->opcode == FS_OPCODE_LOG2 ||
+ scan_inst->opcode == FS_OPCODE_SIN ||
+ scan_inst->opcode == FS_OPCODE_COS ||
+ scan_inst->opcode == FS_OPCODE_POW) {
+ break;
+ }
+ }
+
+ if (scan_inst->dst.reg_offset == inst->src[0].reg_offset) {
+ /* Found the creator of our MRF's source value. */
+ found = true;
+ break;
+ }
+ }
+ }
+ if (found) {
+ scan_inst->dst.file = MRF;
+ scan_inst->dst.hw_reg = inst->dst.hw_reg;
+ scan_inst->saturate |= inst->saturate;
+ inst->remove();
+ progress = true;
+ }
+ }
+
+ return progress;
+}
+
+bool
+fs_visitor::virtual_grf_interferes(int a, int b)
+{
+ int start = MAX2(this->virtual_grf_def[a], this->virtual_grf_def[b]);
+ int end = MIN2(this->virtual_grf_use[a], this->virtual_grf_use[b]);
+
+ /* For dead code, just check if the def interferes with the other range. */
+ if (this->virtual_grf_use[a] == -1) {
+ return (this->virtual_grf_def[a] >= this->virtual_grf_def[b] &&
+ this->virtual_grf_def[a] < this->virtual_grf_use[b]);
+ }
+ if (this->virtual_grf_use[b] == -1) {
+ return (this->virtual_grf_def[b] >= this->virtual_grf_def[a] &&
+ this->virtual_grf_def[b] < this->virtual_grf_use[a]);
+ }
+
+ return start < end;
}
static struct brw_reg brw_reg_from_fs_reg(fs_reg *reg)
case BRW_OPCODE_RNDD:
brw_RNDD(p, dst, src[0]);
break;
+ case BRW_OPCODE_RNDE:
+ brw_RNDE(p, dst, src[0]);
+ break;
case BRW_OPCODE_RNDZ:
brw_RNDZ(p, dst, src[0]);
break;
case BRW_OPCODE_XOR:
brw_XOR(p, dst, src[0], src[1]);
break;
+ case BRW_OPCODE_NOT:
+ brw_NOT(p, dst, src[0]);
+ break;
+ case BRW_OPCODE_ASR:
+ brw_ASR(p, dst, src[0], src[1]);
+ break;
+ case BRW_OPCODE_SHR:
+ brw_SHR(p, dst, src[0], src[1]);
+ break;
+ case BRW_OPCODE_SHL:
+ brw_SHL(p, dst, src[0], src[1]);
+ break;
case BRW_OPCODE_CMP:
brw_CMP(p, dst, inst->conditional_mod, src[0], src[1]);
case BRW_OPCODE_IF:
assert(if_stack_depth < 16);
- if_stack[if_stack_depth] = brw_IF(p, BRW_EXECUTE_8);
+ if (inst->src[0].file != BAD_FILE) {
+ assert(intel->gen >= 6);
+ if_stack[if_stack_depth] = brw_IF_gen6(p, inst->conditional_mod, src[0], src[1]);
+ } else {
+ if_stack[if_stack_depth] = brw_IF(p, BRW_EXECUTE_8);
+ }
if_depth_in_loop[loop_stack_depth]++;
if_stack_depth++;
break;
+
case BRW_OPCODE_ELSE:
if_stack[if_stack_depth - 1] =
brw_ELSE(p, if_stack[if_stack_depth - 1]);
struct brw_instruction *inst0, *inst1;
GLuint br = 1;
- if (intel->gen == 5)
+ if (intel->gen >= 5)
br = 2;
assert(loop_stack_depth > 0);
case FS_OPCODE_TEX:
case FS_OPCODE_TXB:
case FS_OPCODE_TXL:
- generate_tex(inst, dst, src[0]);
+ generate_tex(inst, dst);
+ break;
+ case FS_OPCODE_DISCARD_NOT:
+ generate_discard_not(inst, dst);
break;
- case FS_OPCODE_DISCARD:
- generate_discard(inst);
+ case FS_OPCODE_DISCARD_AND:
+ generate_discard_and(inst, src[0]);
break;
case FS_OPCODE_DDX:
generate_ddx(inst, dst, src[0]);
{
struct brw_compile *p = &c->func;
struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &intel->ctx;
- struct brw_shader *shader = NULL;
+ struct gl_context *ctx = &intel->ctx;
struct gl_shader_program *prog = ctx->Shader.CurrentProgram;
if (!prog)
return GL_FALSE;
- if (!using_new_fs)
- return GL_FALSE;
-
- for (unsigned int i = 0; i < prog->_NumLinkedShaders; i++) {
- if (prog->_LinkedShaders[i]->Type == GL_FRAGMENT_SHADER) {
- shader = (struct brw_shader *)prog->_LinkedShaders[i];
- break;
- }
- }
+ struct brw_shader *shader =
+ (brw_shader *) prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
if (!shader)
return GL_FALSE;
if (0) {
v.emit_dummy_fs();
} else {
- v.emit_interpolation();
+ v.calculate_urb_setup();
+ if (intel->gen < 6)
+ v.emit_interpolation_setup_gen4();
+ else
+ v.emit_interpolation_setup_gen6();
/* Generate FS IR for main(). (the visitor only descends into
* functions called "main").
}
v.emit_fb_writes();
+
+ v.split_virtual_grfs();
+
v.assign_curb_setup();
v.assign_urb_setup();
- v.assign_regs();
+
+ bool progress;
+ do {
+ progress = false;
+ v.calculate_live_intervals();
+ progress = v.propagate_constants() || progress;
+ progress = v.register_coalesce() || progress;
+ progress = v.compute_to_mrf() || progress;
+ progress = v.dead_code_eliminate() || progress;
+ } while (progress);
+
+ if (0)
+ v.assign_regs_trivial();
+ else
+ v.assign_regs();
}
- v.generate_code();
+ if (!v.fail)
+ v.generate_code();
assert(!v.fail); /* FINISHME: Cleanly fail, tested at link time, etc. */
if (last_annotation_string)
printf(" %s\n", last_annotation_string);
}
+ if (0) {
+ printf("0x%08x 0x%08x 0x%08x 0x%08x ",
+ ((uint32_t *)&p->store[i])[3],
+ ((uint32_t *)&p->store[i])[2],
+ ((uint32_t *)&p->store[i])[1],
+ ((uint32_t *)&p->store[i])[0]);
+ }
brw_disasm(stdout, &p->store[i], intel->gen);
}
printf("\n");
--- /dev/null
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+extern "C" {
+
+#include <sys/types.h>
+
+#include "main/macros.h"
+#include "main/shaderobj.h"
+#include "main/uniforms.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
+#include "program/prog_optimize.h"
+#include "program/register_allocate.h"
+#include "program/sampler.h"
+#include "program/hash_table.h"
+#include "brw_context.h"
+#include "brw_eu.h"
+#include "brw_wm.h"
+#include "talloc.h"
+}
+#include "../glsl/glsl_types.h"
+#include "../glsl/ir.h"
+
+enum register_file {
+ ARF = BRW_ARCHITECTURE_REGISTER_FILE,
+ GRF = BRW_GENERAL_REGISTER_FILE,
+ MRF = BRW_MESSAGE_REGISTER_FILE,
+ IMM = BRW_IMMEDIATE_VALUE,
+ FIXED_HW_REG, /* a struct brw_reg */
+ UNIFORM, /* prog_data->params[hw_reg] */
+ BAD_FILE
+};
+
+enum fs_opcodes {
+ FS_OPCODE_FB_WRITE = 256,
+ FS_OPCODE_RCP,
+ FS_OPCODE_RSQ,
+ FS_OPCODE_SQRT,
+ FS_OPCODE_EXP2,
+ FS_OPCODE_LOG2,
+ FS_OPCODE_POW,
+ FS_OPCODE_SIN,
+ FS_OPCODE_COS,
+ FS_OPCODE_DDX,
+ FS_OPCODE_DDY,
+ FS_OPCODE_LINTERP,
+ FS_OPCODE_TEX,
+ FS_OPCODE_TXB,
+ FS_OPCODE_TXL,
+ FS_OPCODE_DISCARD_NOT,
+ FS_OPCODE_DISCARD_AND,
+};
+
+
+class fs_reg {
+public:
+ /* Callers of this talloc-based new need not call delete. It's
+ * easier to just talloc_free 'ctx' (or any of its ancestors). */
+ static void* operator new(size_t size, void *ctx)
+ {
+ void *node;
+
+ node = talloc_size(ctx, size);
+ assert(node != NULL);
+
+ return node;
+ }
+
+ void init()
+ {
+ this->reg = 0;
+ this->reg_offset = 0;
+ this->negate = 0;
+ this->abs = 0;
+ this->hw_reg = -1;
+ }
+
+ /** Generic unset register constructor. */
+ fs_reg()
+ {
+ init();
+ this->file = BAD_FILE;
+ }
+
+ /** Immediate value constructor. */
+ fs_reg(float f)
+ {
+ init();
+ this->file = IMM;
+ this->type = BRW_REGISTER_TYPE_F;
+ this->imm.f = f;
+ }
+
+ /** Immediate value constructor. */
+ fs_reg(int32_t i)
+ {
+ init();
+ this->file = IMM;
+ this->type = BRW_REGISTER_TYPE_D;
+ this->imm.i = i;
+ }
+
+ /** Immediate value constructor. */
+ fs_reg(uint32_t u)
+ {
+ init();
+ this->file = IMM;
+ this->type = BRW_REGISTER_TYPE_UD;
+ this->imm.u = u;
+ }
+
+ /** Fixed brw_reg Immediate value constructor. */
+ fs_reg(struct brw_reg fixed_hw_reg)
+ {
+ init();
+ this->file = FIXED_HW_REG;
+ this->fixed_hw_reg = fixed_hw_reg;
+ this->type = fixed_hw_reg.type;
+ }
+
+ fs_reg(enum register_file file, int hw_reg);
+ fs_reg(enum register_file file, int hw_reg, uint32_t type);
+ fs_reg(class fs_visitor *v, const struct glsl_type *type);
+
+ /** Register file: ARF, GRF, MRF, IMM. */
+ enum register_file file;
+ /** virtual register number. 0 = fixed hw reg */
+ int reg;
+ /** Offset within the virtual register. */
+ int reg_offset;
+ /** HW register number. Generally unset until register allocation. */
+ int hw_reg;
+ /** Register type. BRW_REGISTER_TYPE_* */
+ int type;
+ bool negate;
+ bool abs;
+ struct brw_reg fixed_hw_reg;
+
+ /** Value for file == BRW_IMMMEDIATE_FILE */
+ union {
+ int32_t i;
+ uint32_t u;
+ float f;
+ } imm;
+};
+
+class fs_inst : public exec_node {
+public:
+ /* Callers of this talloc-based new need not call delete. It's
+ * easier to just talloc_free 'ctx' (or any of its ancestors). */
+ static void* operator new(size_t size, void *ctx)
+ {
+ void *node;
+
+ node = talloc_zero_size(ctx, size);
+ assert(node != NULL);
+
+ return node;
+ }
+
+ void init()
+ {
+ this->opcode = BRW_OPCODE_NOP;
+ this->saturate = false;
+ this->conditional_mod = BRW_CONDITIONAL_NONE;
+ this->predicated = false;
+ this->sampler = 0;
+ this->target = 0;
+ this->eot = false;
+ this->header_present = false;
+ this->shadow_compare = false;
+ this->mlen = 0;
+ this->base_mrf = 0;
+ }
+
+ fs_inst()
+ {
+ init();
+ }
+
+ fs_inst(int opcode)
+ {
+ init();
+ this->opcode = opcode;
+ }
+
+ fs_inst(int opcode, fs_reg dst)
+ {
+ init();
+ this->opcode = opcode;
+ this->dst = dst;
+
+ if (dst.file == GRF)
+ assert(dst.reg_offset >= 0);
+ }
+
+ fs_inst(int opcode, fs_reg dst, fs_reg src0)
+ {
+ init();
+ this->opcode = opcode;
+ this->dst = dst;
+ this->src[0] = src0;
+
+ if (dst.file == GRF)
+ assert(dst.reg_offset >= 0);
+ if (src[0].file == GRF)
+ assert(src[0].reg_offset >= 0);
+ }
+
+ fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1)
+ {
+ init();
+ this->opcode = opcode;
+ this->dst = dst;
+ this->src[0] = src0;
+ this->src[1] = src1;
+
+ if (dst.file == GRF)
+ assert(dst.reg_offset >= 0);
+ if (src[0].file == GRF)
+ assert(src[0].reg_offset >= 0);
+ if (src[1].file == GRF)
+ assert(src[1].reg_offset >= 0);
+ }
+
+ fs_inst(int opcode, fs_reg dst, fs_reg src0, fs_reg src1, fs_reg src2)
+ {
+ init();
+ this->opcode = opcode;
+ this->dst = dst;
+ this->src[0] = src0;
+ this->src[1] = src1;
+ this->src[2] = src2;
+
+ if (dst.file == GRF)
+ assert(dst.reg_offset >= 0);
+ if (src[0].file == GRF)
+ assert(src[0].reg_offset >= 0);
+ if (src[1].file == GRF)
+ assert(src[1].reg_offset >= 0);
+ if (src[2].file == GRF)
+ assert(src[2].reg_offset >= 0);
+ }
+
+ int opcode; /* BRW_OPCODE_* or FS_OPCODE_* */
+ fs_reg dst;
+ fs_reg src[3];
+ bool saturate;
+ bool predicated;
+ int conditional_mod; /**< BRW_CONDITIONAL_* */
+
+ int mlen; /**< SEND message length */
+ int base_mrf; /**< First MRF in the SEND message, if mlen is nonzero. */
+ int sampler;
+ int target; /**< MRT target. */
+ bool eot;
+ bool header_present;
+ bool shadow_compare;
+
+ /** @{
+ * Annotation for the generated IR. One of the two can be set.
+ */
+ ir_instruction *ir;
+ const char *annotation;
+ /** @} */
+};
+
+class fs_visitor : public ir_visitor
+{
+public:
+
+ fs_visitor(struct brw_wm_compile *c, struct brw_shader *shader)
+ {
+ this->c = c;
+ this->p = &c->func;
+ this->brw = p->brw;
+ this->fp = brw->fragment_program;
+ this->intel = &brw->intel;
+ this->ctx = &intel->ctx;
+ this->mem_ctx = talloc_new(NULL);
+ this->shader = shader;
+ this->fail = false;
+ this->variable_ht = hash_table_ctor(0,
+ hash_table_pointer_hash,
+ hash_table_pointer_compare);
+
+ this->frag_color = NULL;
+ this->frag_data = NULL;
+ this->frag_depth = NULL;
+ this->first_non_payload_grf = 0;
+
+ this->current_annotation = NULL;
+ this->annotation_string = NULL;
+ this->annotation_ir = NULL;
+ this->base_ir = NULL;
+
+ this->virtual_grf_sizes = NULL;
+ this->virtual_grf_next = 1;
+ this->virtual_grf_array_size = 0;
+ this->virtual_grf_def = NULL;
+ this->virtual_grf_use = NULL;
+
+ this->kill_emitted = false;
+ }
+
+ ~fs_visitor()
+ {
+ talloc_free(this->mem_ctx);
+ hash_table_dtor(this->variable_ht);
+ }
+
+ fs_reg *variable_storage(ir_variable *var);
+ int virtual_grf_alloc(int size);
+
+ void visit(ir_variable *ir);
+ void visit(ir_assignment *ir);
+ void visit(ir_dereference_variable *ir);
+ void visit(ir_dereference_record *ir);
+ void visit(ir_dereference_array *ir);
+ void visit(ir_expression *ir);
+ void visit(ir_texture *ir);
+ void visit(ir_if *ir);
+ void visit(ir_constant *ir);
+ void visit(ir_swizzle *ir);
+ void visit(ir_return *ir);
+ void visit(ir_loop *ir);
+ void visit(ir_loop_jump *ir);
+ void visit(ir_discard *ir);
+ void visit(ir_call *ir);
+ void visit(ir_function *ir);
+ void visit(ir_function_signature *ir);
+
+ fs_inst *emit(fs_inst inst);
+ void assign_curb_setup();
+ void calculate_urb_setup();
+ void assign_urb_setup();
+ void assign_regs();
+ void assign_regs_trivial();
+ void split_virtual_grfs();
+ void calculate_live_intervals();
+ bool propagate_constants();
+ bool register_coalesce();
+ bool compute_to_mrf();
+ bool dead_code_eliminate();
+ bool virtual_grf_interferes(int a, int b);
+ void generate_code();
+ void generate_fb_write(fs_inst *inst);
+ void generate_linterp(fs_inst *inst, struct brw_reg dst,
+ struct brw_reg *src);
+ void generate_tex(fs_inst *inst, struct brw_reg dst);
+ void generate_math(fs_inst *inst, struct brw_reg dst, struct brw_reg *src);
+ void generate_discard_not(fs_inst *inst, struct brw_reg temp);
+ void generate_discard_and(fs_inst *inst, struct brw_reg temp);
+ void generate_ddx(fs_inst *inst, struct brw_reg dst, struct brw_reg src);
+ void generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src);
+
+ void emit_dummy_fs();
+ fs_reg *emit_fragcoord_interpolation(ir_variable *ir);
+ fs_reg *emit_frontfacing_interpolation(ir_variable *ir);
+ fs_reg *emit_general_interpolation(ir_variable *ir);
+ void emit_interpolation_setup_gen4();
+ void emit_interpolation_setup_gen6();
+ fs_inst *emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate);
+ fs_inst *emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate);
+ fs_inst *emit_math(fs_opcodes op, fs_reg dst, fs_reg src0);
+ fs_inst *emit_math(fs_opcodes op, fs_reg dst, fs_reg src0, fs_reg src1);
+ void emit_bool_to_cond_code(ir_rvalue *condition);
+ void emit_if_gen6(ir_if *ir);
+
+ void emit_fb_writes();
+ void emit_assignment_writes(fs_reg &l, fs_reg &r,
+ const glsl_type *type, bool predicated);
+
+ struct brw_reg interp_reg(int location, int channel);
+ int setup_uniform_values(int loc, const glsl_type *type);
+ void setup_builtin_uniform_values(ir_variable *ir);
+
+ struct brw_context *brw;
+ const struct gl_fragment_program *fp;
+ struct intel_context *intel;
+ struct gl_context *ctx;
+ struct brw_wm_compile *c;
+ struct brw_compile *p;
+ struct brw_shader *shader;
+ void *mem_ctx;
+ exec_list instructions;
+
+ int *virtual_grf_sizes;
+ int virtual_grf_next;
+ int virtual_grf_array_size;
+ int *virtual_grf_def;
+ int *virtual_grf_use;
+
+ struct hash_table *variable_ht;
+ ir_variable *frag_color, *frag_data, *frag_depth;
+ int first_non_payload_grf;
+ int urb_setup[FRAG_ATTRIB_MAX];
+ bool kill_emitted;
+
+ /** @{ debug annotation info */
+ const char *current_annotation;
+ ir_instruction *base_ir;
+ const char **annotation_string;
+ ir_instruction **annotation_ir;
+ /** @} */
+
+ bool fail;
+
+ /* Result of last visit() method. */
+ fs_reg result;
+
+ fs_reg pixel_x;
+ fs_reg pixel_y;
+ fs_reg wpos_w;
+ fs_reg pixel_w;
+ fs_reg delta_x;
+ fs_reg delta_y;
+
+ int grf_used;
+};
+
+GLboolean brw_do_channel_expressions(struct exec_list *instructions);
+GLboolean brw_do_vector_splitting(struct exec_list *instructions);
return false;
}
-extern "C" {
GLboolean
brw_do_channel_expressions(exec_list *instructions)
{
return v.progress;
}
-}
ir_rvalue *
ir_channel_expressions_visitor::get_element(ir_variable *var, unsigned int elem)
struct variable_entry *get_splitting_entry(ir_variable *var);
exec_list *variable_list;
- void *mem_ctx;
};
struct variable_entry *
}
ir->remove();
} else if (lhs) {
+ void *mem_ctx = lhs->mem_ctx;
int elem = -1;
switch (ir->write_mask) {
return visit_continue;
}
-extern "C" {
bool
brw_do_vector_splitting(exec_list *instructions)
{
return true;
}
-}
brw_gs_quad_strip( &c, key );
break;
case GL_LINE_LOOP:
- /* XXX fix GS hang issue */
- assert(intel->gen < 6);
brw_gs_lines( &c );
break;
case GL_LINES:
static void populate_key( struct brw_context *brw,
struct brw_gs_prog_key *key )
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
memset(key, 0, sizeof(*key));
/* CACHE_NEW_VS_PROG */
struct {
struct brw_reg R0;
struct brw_reg vertex[MAX_GS_VERTS];
+ struct brw_reg temp;
} reg;
/* 3 different ways of expressing vertex size:
i += c->nr_regs;
}
+ c->reg.temp = brw_vec8_grf(i, 0);
+
c->prog_data.urb_read_length = c->nr_regs;
c->prog_data.total_grf = i;
}
GLuint header)
{
struct brw_compile *p = &c->func;
+ struct intel_context *intel = &c->func.brw->intel;
GLboolean allocate = !last;
+ struct brw_reg temp;
+
+ if (intel->gen < 6)
+ temp = c->reg.R0;
+ else {
+ temp = c->reg.temp;
+ brw_MOV(p, retype(temp, BRW_REGISTER_TYPE_UD),
+ retype(c->reg.R0, BRW_REGISTER_TYPE_UD));
+ }
/* Overwrite PrimType and PrimStart in the message header, for
* each vertex in turn:
*/
- brw_MOV(p, get_element_ud(c->reg.R0, 2), brw_imm_ud(header));
+ brw_MOV(p, get_element_ud(temp, 2), brw_imm_ud(header));
/* Copy the vertex from vertn into m1..mN+1:
*/
* allocated each time.
*/
brw_urb_WRITE(p,
- allocate ? c->reg.R0 : retype(brw_null_reg(), BRW_REGISTER_TYPE_UD),
+ allocate ? temp : retype(brw_null_reg(), BRW_REGISTER_TYPE_UD),
0,
- c->reg.R0,
+ temp,
allocate,
1, /* used */
c->nr_regs + 1, /* msg length */
1, /* writes_complete */
0, /* urb offset */
BRW_URB_SWIZZLE_NONE);
+
+ if (intel->gen >= 6 && allocate)
+ brw_MOV(p, get_element_ud(c->reg.R0, 0), get_element_ud(temp, 0));
}
static void brw_gs_ff_sync(struct brw_gs_compile *c, int num_prim)
{
struct brw_compile *p = &c->func;
- brw_MOV(p, get_element_ud(c->reg.R0, 1), brw_imm_ud(num_prim));
- brw_ff_sync(p,
- c->reg.R0,
- 0,
- c->reg.R0,
- 1, /* allocate */
- 1, /* response length */
- 0 /* eot */);
+ struct intel_context *intel = &c->func.brw->intel;
+
+ if (intel->gen < 6) {
+ brw_MOV(p, get_element_ud(c->reg.R0, 1), brw_imm_ud(num_prim));
+ brw_ff_sync(p,
+ c->reg.R0,
+ 0,
+ c->reg.R0,
+ 1, /* allocate */
+ 1, /* response length */
+ 0 /* eot */);
+ } else {
+ brw_MOV(p, retype(c->reg.temp, BRW_REGISTER_TYPE_UD),
+ retype(c->reg.R0, BRW_REGISTER_TYPE_UD));
+ brw_MOV(p, get_element_ud(c->reg.temp, 1), brw_imm_ud(num_prim));
+ brw_ff_sync(p,
+ c->reg.temp,
+ 0,
+ c->reg.temp,
+ 1, /* allocate */
+ 1, /* response length */
+ 0 /* eot */);
+ brw_MOV(p, get_element_ud(c->reg.R0, 0),
+ get_element_ud(c->reg.temp, 0));
+ }
}
static void upload_blend_constant_color(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct brw_blend_constant_color bcc;
memset(&bcc, 0, sizeof(bcc));
static void upload_drawing_rect(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
BEGIN_BATCH(4);
OUT_BATCH(_3DSTATE_DRAWRECT_INFO_I965);
static void upload_polygon_stipple(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct brw_polygon_stipple bps;
GLuint i;
static void upload_polygon_stipple_offset(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct brw_polygon_stipple_offset bpso;
memset(&bpso, 0, sizeof(bpso));
static void upload_line_stipple(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct brw_line_stipple bls;
GLfloat tmp;
GLint tmpi;
if (intel->gen >= 6) {
int i;
- intel_batchbuffer_emit_mi_flush(intel->batch);
-
BEGIN_BATCH(3);
OUT_BATCH(CMD_3D_MULTISAMPLE << 16 | (3 - 2));
OUT_BATCH(MS_PIXEL_LOCATION_CENTER |
#include "brw_context.h"
#include "brw_wm.h"
-static void brwBindProgram( GLcontext *ctx,
+static void brwBindProgram( struct gl_context *ctx,
GLenum target,
struct gl_program *prog )
{
}
}
-static struct gl_program *brwNewProgram( GLcontext *ctx,
+static struct gl_program *brwNewProgram( struct gl_context *ctx,
GLenum target,
GLuint id )
{
}
}
-static void brwDeleteProgram( GLcontext *ctx,
+static void brwDeleteProgram( struct gl_context *ctx,
struct gl_program *prog )
{
_mesa_delete_program( ctx, prog );
}
-static GLboolean brwIsProgramNative( GLcontext *ctx,
+static GLboolean brwIsProgramNative( struct gl_context *ctx,
GLenum target,
struct gl_program *prog )
{
}
static void
-shader_error(GLcontext *ctx, struct gl_program *prog, const char *msg)
+shader_error(struct gl_context *ctx, struct gl_program *prog, const char *msg)
{
struct gl_shader_program *shader;
}
}
-static GLboolean brwProgramStringNotify( GLcontext *ctx,
+static GLboolean brwProgramStringNotify( struct gl_context *ctx,
GLenum target,
struct gl_program *prog )
{
* using the new FS backend.
*/
shader_program = _mesa_lookup_shader_program(ctx, prog->Id);
- if (shader_program) {
- for (i = 0; i < shader_program->_NumLinkedShaders; i++) {
- struct brw_shader *shader;
-
- shader = (struct brw_shader *)shader_program->_LinkedShaders[i];
- if (shader->base.Type == GL_FRAGMENT_SHADER && shader->ir) {
- return GL_TRUE;
- }
- }
+ if (shader_program
+ && shader_program->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
+ return GL_TRUE;
}
}
else if (target == GL_VERTEX_PROGRAM_ARB) {
}
static struct gl_query_object *
-brw_new_query_object(GLcontext *ctx, GLuint id)
+brw_new_query_object(struct gl_context *ctx, GLuint id)
{
struct brw_query_object *query;
}
static void
-brw_delete_query(GLcontext *ctx, struct gl_query_object *q)
+brw_delete_query(struct gl_context *ctx, struct gl_query_object *q)
{
struct brw_query_object *query = (struct brw_query_object *)q;
}
static void
-brw_begin_query(GLcontext *ctx, struct gl_query_object *q)
+brw_begin_query(struct gl_context *ctx, struct gl_query_object *q)
{
struct brw_context *brw = brw_context(ctx);
struct intel_context *intel = intel_context(ctx);
* Begin the ARB_occlusion_query query on a query object.
*/
static void
-brw_end_query(GLcontext *ctx, struct gl_query_object *q)
+brw_end_query(struct gl_context *ctx, struct gl_query_object *q)
{
struct brw_context *brw = brw_context(ctx);
struct intel_context *intel = intel_context(ctx);
}
}
-static void brw_wait_query(GLcontext *ctx, struct gl_query_object *q)
+static void brw_wait_query(struct gl_context *ctx, struct gl_query_object *q)
{
struct brw_query_object *query = (struct brw_query_object *)q;
query->Base.Ready = GL_TRUE;
}
-static void brw_check_query(GLcontext *ctx, struct gl_query_object *q)
+static void brw_check_query(struct gl_context *ctx, struct gl_query_object *q)
{
struct brw_query_object *query = (struct brw_query_object *)q;
*/
static void upload_sf_prog(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct brw_sf_prog_key key;
memset(&key, 0, sizeof(key));
static void upload_sf_vp(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
struct brw_sf_viewport sfv;
GLfloat y_scale, y_bias;
static void
sf_unit_populate_key(struct brw_context *brw, struct brw_sf_unit_key *key)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
memset(key, 0, sizeof(*key));
/* CACHE_NEW_SF_PROG */
#include "brw_context.h"
void
-brw_enable(GLcontext *ctx, GLenum cap, GLboolean state)
+brw_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
{
struct brw_context *brw = brw_context(ctx);
}
void
-brw_depth_range(GLcontext *ctx, GLclampd nearval, GLclampd farval)
+brw_depth_range(struct gl_context *ctx, GLclampd nearval, GLclampd farval)
{
struct brw_context *brw = brw_context(ctx);
*/
void brw_validate_state( struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct intel_context *intel = &brw->intel;
struct brw_state_flags *state = &brw->state.dirty;
GLuint i;
GLuint dest_horiz_stride:2;
GLuint dest_address_mode:1;
} ia16;
+
+ struct {
+ GLuint dest_reg_file:2;
+ GLuint dest_reg_type:3;
+ GLuint src0_reg_file:2;
+ GLuint src0_reg_type:3;
+ GLuint src1_reg_file:2;
+ GLuint src1_reg_type:3;
+ GLuint pad:1;
+
+ GLint jump_count:16;
+ } branch_gen6;
} bits1;
*/
void brw_validate_textures( struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct intel_context *intel = &brw->intel;
int i;
struct brw_vertex_program *vp,
struct brw_vs_prog_key *key )
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
GLuint program_size;
const GLuint *program;
struct brw_vs_compile c;
sizeof(c.prog_data));
assert(ctx->Const.VertexProgram.MaxNativeParameters ==
ARRAY_SIZE(c.constant_map));
+ (void) ctx;
aux_size = sizeof(c.prog_data);
if (c.vp->use_const_buffer)
static void brw_upload_vs_prog(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct brw_vs_prog_key key;
struct brw_vertex_program *vp =
(struct brw_vertex_program *)brw->vertex_program;
*/
static void calc_wm_input_sizes( struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
/* BRW_NEW_VERTEX_PROGRAM */
const struct brw_vertex_program *vp =
brw_vertex_program_const(brw->vertex_program);
struct brw_compile *p = &c->func;
struct intel_context *intel = &p->brw->intel;
struct brw_reg tmp = dst;
- GLboolean need_tmp = (intel->gen < 6 &&
- (dst.dw1.bits.writemask != 0xf ||
- dst.file != BRW_GENERAL_REGISTER_FILE));
+ GLboolean need_tmp = GL_FALSE;
- if (need_tmp)
+ if (dst.file != BRW_GENERAL_REGISTER_FILE)
+ need_tmp = GL_TRUE;
+
+ if (intel->gen < 6 && dst.dw1.bits.writemask != 0xf)
+ need_tmp = GL_TRUE;
+
+ if (need_tmp)
tmp = get_tmp(c);
brw_math(p,
struct brw_compile *p = &c->func;
struct intel_context *intel = &p->brw->intel;
struct brw_reg tmp = dst;
- GLboolean need_tmp = (intel->gen < 6 &&
- (dst.dw1.bits.writemask != 0xf ||
- dst.file != BRW_GENERAL_REGISTER_FILE));
+ GLboolean need_tmp = GL_FALSE;
+
+ if (dst.file != BRW_GENERAL_REGISTER_FILE)
+ need_tmp = GL_TRUE;
+
+ if (intel->gen < 6 && dst.dw1.bits.writemask != 0xf)
+ need_tmp = GL_TRUE;
if (need_tmp)
tmp = get_tmp(c);
assert(argIndex < 3);
+ assert(c->func.brw->intel.gen < 6); /* FINISHME */
+
if (c->current_const[argIndex].index != src->Index) {
/* Keep track of the last constant loaded in this slot, for reuse. */
c->current_const[argIndex].index = src->Index;
assert(argIndex < 3);
+ assert(c->func.brw->intel.gen < 6); /* FINISHME */
+
/* Can't reuse a reladdr constant load. */
c->current_const[argIndex].index = -1;
static void
vs_unit_populate_key(struct brw_context *brw, struct brw_vs_unit_key *key)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
memset(key, 0, sizeof(*key));
static void
prepare_vs_constants(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct intel_context *intel = &brw->intel;
struct brw_vertex_program *vp =
(struct brw_vertex_program *) brw->vertex_program;
* Sets brw->vs.surf_bo[surf] and brw->vp->const_buffer.
*/
static void
-brw_update_vs_constant_surface( GLcontext *ctx,
+brw_update_vs_constant_surface( struct gl_context *ctx,
GLuint surf)
{
struct brw_context *brw = brw_context(ctx);
*/
static void upload_vs_surfaces(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
uint32_t *bind;
int i;
#include "brw_defines.h"
#include "brw_state.h"
#include "brw_draw.h"
-#include "brw_state.h"
#include "brw_vs.h"
#include "brw_wm.h"
struct brw_wm_prog_key *key )
{
struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
/* BRW_NEW_FRAGMENT_PROGRAM */
const struct brw_fragment_program *fp =
(struct brw_fragment_program *)brw->fragment_program;
/* R31: MSAA position offsets. */
/* R32-: bary for 32-pixel. */
/* R58-59: interp W for 32-pixel. */
+
+ if (fp->program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
+ key->source_depth_to_render_target = GL_TRUE;
+ key->computes_depth = GL_TRUE;
+ }
+
} else {
brw_wm_lookup_iz(intel,
line_aa,
if (unit->_ReallyEnabled) {
const struct gl_texture_object *t = unit->_Current;
const struct gl_texture_image *img = t->Image[0][t->BaseLevel];
+ int swizzles[SWIZZLE_NIL + 1] = {
+ SWIZZLE_X,
+ SWIZZLE_Y,
+ SWIZZLE_Z,
+ SWIZZLE_W,
+ SWIZZLE_ZERO,
+ SWIZZLE_ONE,
+ SWIZZLE_NIL
+ };
+
+ key->tex_swizzles[i] = SWIZZLE_NOOP;
+
+ /* GL_DEPTH_TEXTURE_MODE is normally handled through
+ * brw_wm_surface_state, but it applies to shadow compares as
+ * well and our shadow compares always return the result in
+ * all 4 channels.
+ */
+ if (t->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) {
+ if (t->DepthMode == GL_ALPHA) {
+ swizzles[0] = SWIZZLE_ZERO;
+ swizzles[1] = SWIZZLE_ZERO;
+ swizzles[2] = SWIZZLE_ZERO;
+ } else if (t->DepthMode == GL_LUMINANCE) {
+ swizzles[3] = SWIZZLE_ONE;
+ }
+ }
+
if (img->InternalFormat == GL_YCBCR_MESA) {
key->yuvtex_mask |= 1 << i;
if (img->TexFormat == MESA_FORMAT_YCBCR)
key->yuvtex_swap_mask |= 1 << i;
}
- key->tex_swizzles[i] = t->_Swizzle;
+ key->tex_swizzles[i] =
+ MAKE_SWIZZLE4(swizzles[GET_SWZ(t->_Swizzle, 0)],
+ swizzles[GET_SWZ(t->_Swizzle, 1)],
+ swizzles[GET_SWZ(t->_Swizzle, 2)],
+ swizzles[GET_SWZ(t->_Swizzle, 3)]);
}
else {
key->tex_swizzles[i] = SWIZZLE_NOOP;
#ifndef BRW_WM_H
#define BRW_WM_H
+#include <stdbool.h>
#include "program/prog_instruction.h"
#include "brw_context.h"
#define MAX_WM_OPCODE (MAX_OPCODE + 9)
#define PROGRAM_PAYLOAD (PROGRAM_FILE_MAX)
+#define NUM_FILES (PROGRAM_PAYLOAD + 1)
+
#define PAYLOAD_DEPTH (FRAG_ATTRIB_MAX)
#define PAYLOAD_W (FRAG_ATTRIB_MAX + 1)
#define PAYLOAD_FP_REG_MAX (FRAG_ATTRIB_MAX + 2)
} payload;
- const struct brw_wm_ref *pass0_fp_reg[PAYLOAD_FP_REG_MAX][256][4];
+ const struct brw_wm_ref *pass0_fp_reg[NUM_FILES][256][4];
struct brw_wm_ref undef_ref;
struct brw_wm_value undef_value;
struct {
GLboolean inited;
struct brw_reg reg;
- } wm_regs[PAYLOAD_FP_REG_MAX][256][4];
+ } wm_regs[NUM_FILES][256][4];
GLboolean used_grf[BRW_WM_MAX_GRF];
GLuint first_free_grf;
const struct brw_reg *arg0,
const struct brw_reg *arg1);
-GLboolean brw_compile_shader(GLcontext *ctx,
+GLboolean brw_compile_shader(struct gl_context *ctx,
struct gl_shader *shader);
-GLboolean brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog);
-struct gl_shader *brw_new_shader(GLcontext *ctx, GLuint name, GLuint type);
-struct gl_shader_program *brw_new_shader_program(GLcontext *ctx, GLuint name);
+GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
+struct gl_shader *brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type);
+struct gl_shader_program *brw_new_shader_program(struct gl_context *ctx, GLuint name);
-GLboolean brw_do_channel_expressions(struct exec_list *instructions);
-GLboolean brw_do_vector_splitting(struct exec_list *instructions);
+bool brw_color_buffer_write_enabled(struct brw_context *brw);
#endif
break;
case OPCODE_TRUNC:
- emit_alu1(p, brw_RNDZ, dst, dst_flags, args[0]);
+ for (i = 0; i < 4; i++) {
+ if (dst_flags & (1<<i)) {
+ brw_RNDZ(p, dst[i], args[0][i]);
+ }
+ }
break;
case OPCODE_LRP:
reg.Negate = NEGATE_NONE;
reg.Abs = 0;
reg.HasIndex2 = 0;
+ reg.RelAddr2 = 0;
+ reg.Index2 = 0;
return reg;
}
if (c->func.brw->intel.gen >= 6)
return src_undef();
- if (!src_is_undef(c->pixel_w)) {
+ if (src_is_undef(c->pixel_w)) {
struct prog_dst_register pixel_w = get_temp(c);
struct prog_src_register deltas = get_delta_xy(c);
struct prog_src_register interp_wpos = src_reg(PROGRAM_PAYLOAD, FRAG_ATTRIB_WPOS);
tokens[2] = s2;
tokens[3] = s3;
tokens[4] = s4;
-
- for (idx = 0; idx < paramList->NumParameters; idx++) {
- if (paramList->Parameters[idx].Type == PROGRAM_STATE_VAR &&
- memcmp(paramList->Parameters[idx].StateIndexes, tokens, sizeof(tokens)) == 0)
- return src_reg(PROGRAM_STATE_VAR, idx);
- }
idx = _mesa_add_state_reference( paramList, tokens );
GLfloat values[4];
GLuint idx;
GLuint swizzle;
+ struct prog_src_register reg;
values[0] = s0;
values[1] = s1;
values[2] = s2;
values[3] = s3;
- /* Have to search, otherwise multiple compilations will each grow
- * the parameter list.
- */
- for (idx = 0; idx < paramList->NumParameters; idx++) {
- if (paramList->Parameters[idx].Type == PROGRAM_CONSTANT &&
- memcmp(paramList->ParameterValues[idx], values, sizeof(values)) == 0)
-
- /* XXX: this mimics the mesa bug which puts all constants and
- * parameters into the "PROGRAM_STATE_VAR" category:
- */
- return src_reg(PROGRAM_STATE_VAR, idx);
- }
-
idx = _mesa_add_unnamed_constant( paramList, values, 4, &swizzle );
- assert(swizzle == SWIZZLE_NOOP); /* Need to handle swizzle in reg setup */
- return src_reg(PROGRAM_STATE_VAR, idx);
+ reg = src_reg(PROGRAM_STATE_VAR, idx);
+ reg.Swizzle = swizzle;
+
+ return reg;
}
brw_wm_sampler_populate_key(struct brw_context *brw,
struct wm_sampler_key *key)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
int unit;
char *last_entry_end = ((char*)&key->sampler_count) +
sizeof(key->sampler_count);
*/
static void upload_wm_samplers( struct brw_context *brw )
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct wm_sampler_key key;
int i, sampler_key_size;
unsigned int nr_surfaces, sampler_count;
GLboolean uses_depth, computes_depth, uses_kill, is_glsl;
GLboolean polygon_stipple, stats_wm, line_stipple, offset_enable;
+ GLboolean color_write_enable;
GLfloat offset_units, offset_factor;
};
+bool
+brw_color_buffer_write_enabled(struct brw_context *brw)
+{
+ struct gl_context *ctx = &brw->intel.ctx;
+ const struct gl_fragment_program *fp = brw->fragment_program;
+ int i;
+
+ /* _NEW_BUFFERS */
+ for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
+ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
+
+ /* _NEW_COLOR */
+ if (rb &&
+ (fp->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR) ||
+ fp->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DATA0 + i)) &&
+ (ctx->Color.ColorMask[i][0] ||
+ ctx->Color.ColorMask[i][1] ||
+ ctx->Color.ColorMask[i][2] ||
+ ctx->Color.ColorMask[i][3])) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
static void
wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
const struct gl_fragment_program *fp = brw->fragment_program;
const struct brw_fragment_program *bfp = (struct brw_fragment_program *) fp;
struct intel_context *intel = &brw->intel;
if (brw->state.depth_region == NULL)
key->computes_depth = 0;
+ /* _NEW_BUFFERS | _NEW_COLOR */
+ key->color_write_enable = brw_color_buffer_write_enabled(brw);
+
/* _NEW_COLOR */
key->uses_kill = fp->UsesKill || ctx->Color.AlphaEnabled;
key->is_glsl = bfp->isGLSL;
* 8-wide.
*/
if (ctx->Shader.CurrentProgram) {
- int i;
-
- for (i = 0; i < ctx->Shader.CurrentProgram->_NumLinkedShaders; i++) {
- struct brw_shader *shader =
- (struct brw_shader *)ctx->Shader.CurrentProgram->_LinkedShaders[i];;
+ struct brw_shader *shader = (struct brw_shader *)
+ ctx->Shader.CurrentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT];
- if (shader->base.Type == GL_FRAGMENT_SHADER &&
- shader->ir != NULL) {
- key->is_glsl = GL_TRUE;
- }
+ if (shader != NULL && shader->ir != NULL) {
+ key->is_glsl = GL_TRUE;
}
}
wm.wm5.enable_16_pix = 1;
wm.wm5.max_threads = brw->wm_max_threads - 1;
- wm.wm5.thread_dispatch_enable = 1; /* AKA: color_write */
+
+ if (key->color_write_enable ||
+ key->uses_kill ||
+ key->computes_depth) {
+ wm.wm5.thread_dispatch_enable = 1;
+ }
+
wm.wm5.legacy_line_rast = 0;
wm.wm5.legacy_global_depth_bias = 0;
wm.wm5.early_depth_test = 1; /* never need to disable */
_NEW_POLYGONSTIPPLE |
_NEW_LINE |
_NEW_COLOR |
- _NEW_DEPTH),
+ _NEW_DEPTH |
+ _NEW_BUFFERS),
.brw = (BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_CURBE_OFFSETS |
case MESA_FORMAT_AL1616:
return BRW_SURFACEFORMAT_L16A16_UNORM;
+ case MESA_FORMAT_R8:
+ return BRW_SURFACEFORMAT_R8_UNORM;
+
+ case MESA_FORMAT_R16:
+ return BRW_SURFACEFORMAT_R16_UNORM;
+
+ case MESA_FORMAT_RG88:
+ return BRW_SURFACEFORMAT_R8G8_UNORM;
+
+ case MESA_FORMAT_RG1616:
+ return BRW_SURFACEFORMAT_R16G16_UNORM;
+
case MESA_FORMAT_RGB888:
assert(0); /* not supported for sampling */
return BRW_SURFACEFORMAT_R8G8B8_UNORM;
}
static void
-brw_update_texture_surface( GLcontext *ctx, GLuint unit )
+brw_update_texture_surface( struct gl_context *ctx, GLuint unit )
{
struct brw_context *brw = brw_context(ctx);
struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
static void
prepare_wm_constants(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
struct intel_context *intel = &brw->intel;
struct brw_fragment_program *fp =
(struct brw_fragment_program *) brw->fragment_program;
unsigned int unit)
{
struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
drm_intel_bo *region_bo = NULL;
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
struct intel_region *region = irb ? irb->region : NULL;
case MESA_FORMAT_A8:
key.surface_format = BRW_SURFACEFORMAT_A8_UNORM;
break;
+ case MESA_FORMAT_R8:
+ key.surface_format = BRW_SURFACEFORMAT_R8_UNORM;
+ break;
+ case MESA_FORMAT_R16:
+ key.surface_format = BRW_SURFACEFORMAT_R16_UNORM;
+ break;
+ case MESA_FORMAT_RG88:
+ key.surface_format = BRW_SURFACEFORMAT_R8G8_UNORM;
+ break;
+ case MESA_FORMAT_RG1616:
+ key.surface_format = BRW_SURFACEFORMAT_R16G16_UNORM;
+ break;
default:
_mesa_problem(ctx, "Bad renderbuffer format: %d\n", irb->Base.Format);
}
static void
prepare_wm_surfaces(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
int i;
int nr_surfaces = 0;
static void
upload_wm_surfaces(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
GLuint i;
/* _NEW_BUFFERS | _NEW_COLOR */
blend_state_populate_key(struct brw_context *brw,
struct gen6_blend_state_key *key)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
memset(key, 0, sizeof(*key));
color_calc_state_populate_key(struct brw_context *brw,
struct gen6_color_calc_state_key *key)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
memset(key, 0, sizeof(*key));
OUT_RELOC(brw->cc.depth_stencil_state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
OUT_RELOC(brw->cc.state_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 1);
ADVANCE_BATCH();
-
- intel_batchbuffer_emit_mi_flush(intel->batch);
}
upload_clip_state(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
uint32_t depth_clamp = 0;
uint32_t provoking;
depth_clamp |
provoking);
OUT_BATCH(GEN6_CLIP_FORCE_ZERO_RTAINDEX);
- OUT_BATCH(0);
ADVANCE_BATCH();
-
- intel_batchbuffer_emit_mi_flush(intel->batch);
}
const struct brw_tracked_state gen6_clip_state = {
depth_stencil_state_populate_key(struct brw_context *brw,
struct brw_depth_stencil_state_key *key)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
const unsigned back = ctx->Stencil._BackFace;
memset(key, 0, sizeof(*key));
OUT_BATCH(0);
ADVANCE_BATCH();
- intel_batchbuffer_emit_mi_flush(intel->batch);
-
if (brw->gs.prog_bo) {
BEGIN_BATCH(7);
OUT_BATCH(CMD_3D_GS_STATE << 16 | (7 - 2));
OUT_BATCH(0);
ADVANCE_BATCH();
-
- intel_batchbuffer_emit_mi_flush(intel->batch);
}
static void
prepare_scissor_state(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
const GLboolean render_to_fbo = (ctx->DrawBuffer->Name != 0);
struct gen6_scissor_rect scissor;
* Note that the hardware's coordinates are inclusive, while Mesa's min is
* inclusive but max is exclusive.
*/
- if (render_to_fbo) {
+ if (ctx->DrawBuffer->_Xmin == ctx->DrawBuffer->_Xmax ||
+ ctx->DrawBuffer->_Ymin == ctx->DrawBuffer->_Ymax) {
+ /* If the scissor was out of bounds and got clamped to 0
+ * width/height at the bounds, the subtraction of 1 from
+ * maximums could produce a negative number and thus not clip
+ * anything. Instead, just provide a min > max scissor inside
+ * the bounds, which produces the expected no rendering.
+ */
+ scissor.xmin = 1;
+ scissor.xmax = 0;
+ scissor.ymin = 1;
+ scissor.ymax = 0;
+ } else if (render_to_fbo) {
/* texmemory: Y=0=bottom */
scissor.xmin = ctx->DrawBuffer->_Xmin;
scissor.xmax = ctx->DrawBuffer->_Xmax - 1;
* for this output attribute. attr is currently a VERT_RESULT_* but should
* be FRAG_ATTRIB_*.
*/
- for (i = 0; i < vs_attr; i++) {
+ for (i = 1; i < vs_attr; i++) {
if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(i))
attr_index++;
}
upload_sf_state(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
/* CACHE_NEW_VS_PROG */
uint32_t num_inputs = brw_count_bits(brw->vs.prog_data->outputs_written);
uint32_t num_outputs = brw_count_bits(brw->fragment_program->Base.InputsRead);
int attr = 0;
dw1 =
+ GEN6_SF_SWIZZLE_ENABLE |
num_outputs << GEN6_SF_NUM_OUTPUTS_SHIFT |
(num_inputs + 1) / 2 << GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT |
1 << GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT;
}
/* _NEW_POINT */
- if (ctx->Point._Attenuated)
+ if (!(ctx->VertexProgram.PointSizeEnabled ||
+ ctx->Point._Attenuated))
dw4 |= GEN6_SF_USE_STATE_POINT_WIDTH;
dw4 |= U_FIXED(CLAMP(ctx->Point.Size, 0.125, 225.875), 3) <<
OUT_BATCH(0); /* wrapshortest enables 0-7 */
OUT_BATCH(0); /* wrapshortest enables 8-15 */
ADVANCE_BATCH();
-
- intel_batchbuffer_emit_mi_flush(intel->batch);
}
const struct brw_tracked_state gen6_sf_state = {
/* GS requirement */
assert(!brw->gs.prog_bo || brw->urb.vs_size < 5);
- intel_batchbuffer_emit_mi_flush(intel->batch);
-
BEGIN_BATCH(3);
OUT_BATCH(CMD_URB << 16 | (3 - 2));
OUT_BATCH(((brw->urb.vs_size - 1) << GEN6_URB_VS_SIZE_SHIFT) |
OUT_BATCH(((brw->urb.vs_size - 1) << GEN6_URB_GS_SIZE_SHIFT) |
((brw->urb.nr_gs_entries) << GEN6_URB_GS_ENTRIES_SHIFT));
ADVANCE_BATCH();
-
- intel_batchbuffer_emit_mi_flush(intel->batch);
}
const struct brw_tracked_state gen6_urb = {
static void
prepare_sf_vp(struct brw_context *brw)
{
- GLcontext *ctx = &brw->intel.ctx;
+ struct gl_context *ctx = &brw->intel.ctx;
const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
struct brw_sf_viewport sfv;
GLfloat y_scale, y_bias;
OUT_RELOC(brw->sf.vp_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
OUT_RELOC(brw->cc.vp_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
ADVANCE_BATCH();
-
- intel_batchbuffer_emit_mi_flush(intel->batch);
}
const struct brw_tracked_state gen6_viewport_state = {
upload_vs_state(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
const struct brw_vertex_program *vp =
brw_vertex_program_const(brw->vertex_program);
unsigned int nr_params = vp->program.Base.Parameters->NumParameters;
drm_intel_bo_unreference(constant_bo);
}
- intel_batchbuffer_emit_mi_flush(intel->batch);
-
BEGIN_BATCH(6);
OUT_BATCH(CMD_3D_VS_STATE << 16 | (6 - 2));
OUT_RELOC(brw->vs.prog_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, 0);
GEN6_VS_STATISTICS_ENABLE |
GEN6_VS_ENABLE);
ADVANCE_BATCH();
-
- intel_batchbuffer_emit_mi_flush(intel->batch);
}
const struct brw_tracked_state gen6_vs_state = {
#include "brw_state.h"
#include "brw_defines.h"
#include "brw_util.h"
+#include "brw_wm.h"
#include "program/prog_parameter.h"
#include "program/prog_statevars.h"
#include "intel_batchbuffer.h"
prepare_wm_constants(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
const struct brw_fragment_program *fp =
brw_fragment_program_const(brw->fragment_program);
upload_wm_state(struct brw_context *brw)
{
struct intel_context *intel = &brw->intel;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
const struct brw_fragment_program *fp =
brw_fragment_program_const(brw->fragment_program);
uint32_t dw2, dw4, dw5, dw6;
ADVANCE_BATCH();
}
- intel_batchbuffer_emit_mi_flush(intel->batch);
-
dw2 = dw4 = dw5 = dw6 = 0;
dw4 |= GEN6_WM_STATISTICS_ENABLE;
dw5 |= GEN6_WM_LINE_AA_WIDTH_1_0;
GEN6_WM_DISPATCH_START_GRF_SHIFT_0);
dw5 |= (40 - 1) << GEN6_WM_MAX_THREADS_SHIFT;
- dw5 |= GEN6_WM_DISPATCH_ENABLE;
/* BRW_NEW_FRAGMENT_PROGRAM */
if (fp->isGLSL)
if (fp->program.UsesKill || ctx->Color.AlphaEnabled)
dw5 |= GEN6_WM_KILL_ENABLE;
+ if (brw_color_buffer_write_enabled(brw) ||
+ dw5 & (GEN6_WM_KILL_ENABLE | GEN6_WM_COMPUTED_DEPTH)) {
+ dw5 |= GEN6_WM_DISPATCH_ENABLE;
+ }
+
dw6 |= GEN6_WM_PERSPECTIVE_PIXEL_BARYCENTRIC;
dw6 |= brw_count_bits(brw->fragment_program->Base.InputsRead) <<
OUT_BATCH(0); /* kernel 1 pointer */
OUT_BATCH(0); /* kernel 2 pointer */
ADVANCE_BATCH();
-
- intel_batchbuffer_emit_mi_flush(intel->batch);
}
const struct brw_tracked_state gen6_wm_state = {
.dirty = {
- .mesa = _NEW_LINE | _NEW_POLYGONSTIPPLE | _NEW_COLOR,
+ .mesa = (_NEW_LINE | _NEW_POLYGONSTIPPLE | _NEW_COLOR | _NEW_BUFFERS |
+ _NEW_PROGRAM_CONSTANTS),
.brw = (BRW_NEW_CURBE_OFFSETS |
BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_NR_WM_SURFACES |
* \param mask bitmask of BUFFER_BIT_* values indicating buffers to clear
*/
void
-intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
+intelClearWithBlit(struct gl_context *ctx, GLbitfield mask)
{
struct intel_context *intel = intel_context(ctx);
struct gl_framebuffer *fb = ctx->DrawBuffer;
extern void intelCopyBuffer(const __DRIdrawable * dpriv,
const drm_clip_rect_t * rect);
-extern void intelClearWithBlit(GLcontext * ctx, GLbitfield mask);
+extern void intelClearWithBlit(struct gl_context * ctx, GLbitfield mask);
GLboolean
intelEmitCopyBlit(struct intel_context *intel,
#include "intel_regions.h"
static GLboolean
-intel_bufferobj_unmap(GLcontext * ctx,
+intel_bufferobj_unmap(struct gl_context * ctx,
GLenum target, struct gl_buffer_object *obj);
/** Allocates a new drm_intel_bo to store the data for the buffer object. */
* internal structure where somehow shared.
*/
static struct gl_buffer_object *
-intel_bufferobj_alloc(GLcontext * ctx, GLuint name, GLenum target)
+intel_bufferobj_alloc(struct gl_context * ctx, GLuint name, GLenum target)
{
struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object);
* Called via glDeleteBuffersARB().
*/
static void
-intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj)
+intel_bufferobj_free(struct gl_context * ctx, struct gl_buffer_object *obj)
{
struct intel_context *intel = intel_context(ctx);
struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
* \return GL_TRUE for success, GL_FALSE if out of memory
*/
static GLboolean
-intel_bufferobj_data(GLcontext * ctx,
+intel_bufferobj_data(struct gl_context * ctx,
GLenum target,
GLsizeiptrARB size,
const GLvoid * data,
* Called via glBufferSubDataARB().
*/
static void
-intel_bufferobj_subdata(GLcontext * ctx,
+intel_bufferobj_subdata(struct gl_context * ctx,
GLenum target,
GLintptrARB offset,
GLsizeiptrARB size,
memcpy((char *)intel_obj->sys_buffer + offset, data, size);
else {
/* Flush any existing batchbuffer that might reference this data. */
- if (drm_intel_bo_busy(intel_obj->buffer) ||
- drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) {
- drm_intel_bo *temp_bo;
+ if (intel->gen < 6) {
+ if (drm_intel_bo_busy(intel_obj->buffer) ||
+ drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) {
+ drm_intel_bo *temp_bo;
- temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64);
+ temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64);
- drm_intel_bo_subdata(temp_bo, 0, size, data);
+ drm_intel_bo_subdata(temp_bo, 0, size, data);
- intel_emit_linear_blit(intel,
- intel_obj->buffer, offset,
- temp_bo, 0,
- size);
+ intel_emit_linear_blit(intel,
+ intel_obj->buffer, offset,
+ temp_bo, 0,
+ size);
- drm_intel_bo_unreference(temp_bo);
+ drm_intel_bo_unreference(temp_bo);
+ } else {
+ drm_intel_bo_subdata(intel_obj->buffer, offset, size, data);
+ }
} else {
+ if (drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) {
+ intel_batchbuffer_flush(intel->batch);
+ }
drm_intel_bo_subdata(intel_obj->buffer, offset, size, data);
}
}
* Called via glGetBufferSubDataARB().
*/
static void
-intel_bufferobj_get_subdata(GLcontext * ctx,
+intel_bufferobj_get_subdata(struct gl_context * ctx,
GLenum target,
GLintptrARB offset,
GLsizeiptrARB size,
* Called via glMapBufferARB().
*/
static void *
-intel_bufferobj_map(GLcontext * ctx,
+intel_bufferobj_map(struct gl_context * ctx,
GLenum target,
GLenum access, struct gl_buffer_object *obj)
{
* and blit it into the real BO at unmap time.
*/
static void *
-intel_bufferobj_map_range(GLcontext * ctx,
+intel_bufferobj_map_range(struct gl_context * ctx,
GLenum target, GLintptr offset, GLsizeiptr length,
GLbitfield access, struct gl_buffer_object *obj)
{
* would defeat the point.
*/
static void
-intel_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target,
+intel_bufferobj_flush_mapped_range(struct gl_context *ctx, GLenum target,
GLintptr offset, GLsizeiptr length,
struct gl_buffer_object *obj)
{
* Called via glUnmapBuffer().
*/
static GLboolean
-intel_bufferobj_unmap(GLcontext * ctx,
+intel_bufferobj_unmap(struct gl_context * ctx,
GLenum target, struct gl_buffer_object *obj)
{
struct intel_context *intel = intel_context(ctx);
}
static void
-intel_bufferobj_copy_subdata(GLcontext *ctx,
+intel_bufferobj_copy_subdata(struct gl_context *ctx,
struct gl_buffer_object *src,
struct gl_buffer_object *dst,
GLintptr read_offset, GLintptr write_offset,
return;
/* If we're in system memory, just map and memcpy. */
- if (intel_src->sys_buffer || intel_dst->sys_buffer) {
+ if (intel_src->sys_buffer || intel_dst->sys_buffer || intel->gen >= 6) {
/* The same buffer may be used, but note that regions copied may
* not overlap.
*/
intel_bufferobj_unmap(ctx, GL_COPY_READ_BUFFER, src);
intel_bufferobj_unmap(ctx, GL_COPY_WRITE_BUFFER, dst);
}
+ return;
}
/* Otherwise, we have real BOs, so blit them. */
#if FEATURE_APPLE_object_purgeable
static GLenum
-intel_buffer_purgeable(GLcontext * ctx,
+intel_buffer_purgeable(struct gl_context * ctx,
drm_intel_bo *buffer,
GLenum option)
{
}
static GLenum
-intel_buffer_object_purgeable(GLcontext * ctx,
+intel_buffer_object_purgeable(struct gl_context * ctx,
struct gl_buffer_object *obj,
GLenum option)
{
}
static GLenum
-intel_texture_object_purgeable(GLcontext * ctx,
+intel_texture_object_purgeable(struct gl_context * ctx,
struct gl_texture_object *obj,
GLenum option)
{
}
static GLenum
-intel_render_object_purgeable(GLcontext * ctx,
+intel_render_object_purgeable(struct gl_context * ctx,
struct gl_renderbuffer *obj,
GLenum option)
{
}
static GLenum
-intel_buffer_unpurgeable(GLcontext * ctx,
+intel_buffer_unpurgeable(struct gl_context * ctx,
drm_intel_bo *buffer,
GLenum option)
{
}
static GLenum
-intel_buffer_object_unpurgeable(GLcontext * ctx,
+intel_buffer_object_unpurgeable(struct gl_context * ctx,
struct gl_buffer_object *obj,
GLenum option)
{
}
static GLenum
-intel_texture_object_unpurgeable(GLcontext * ctx,
+intel_texture_object_unpurgeable(struct gl_context * ctx,
struct gl_texture_object *obj,
GLenum option)
{
}
static GLenum
-intel_render_object_unpurgeable(GLcontext * ctx,
+intel_render_object_unpurgeable(struct gl_context * ctx,
struct gl_renderbuffer *obj,
GLenum option)
{
* color buffers.
*/
void
-intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
+intel_draw_buffer(struct gl_context * ctx, struct gl_framebuffer *fb)
{
struct intel_context *intel = intel_context(ctx);
struct intel_region *colorRegions[MAX_DRAW_BUFFERS], *depthRegion = NULL;
static void
-intelDrawBuffer(GLcontext * ctx, GLenum mode)
+intelDrawBuffer(struct gl_context * ctx, GLenum mode)
{
if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) {
struct intel_context *const intel = intel_context(ctx);
static void
-intelReadBuffer(GLcontext * ctx, GLenum mode)
+intelReadBuffer(struct gl_context * ctx, GLenum mode)
{
if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) {
struct intel_context *const intel = intel_context(ctx);
extern void intel_check_front_buffer_rendering(struct intel_context *intel);
-extern void intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb);
+extern void intel_draw_buffer(struct gl_context * ctx, struct gl_framebuffer *fb);
extern void intelInitBufferFuncs(struct dd_function_table *functions);
unsigned int *num_cliprects,
int *x_off, int *y_off);
#ifdef I915
-void intelCalcViewport(GLcontext * ctx);
+void intelCalcViewport(struct gl_context * ctx);
#endif
#endif /* INTEL_BUFFERS_H */
* Called by ctx->Driver.Clear.
*/
static void
-intelClear(GLcontext *ctx, GLbitfield mask)
+intelClear(struct gl_context *ctx, GLbitfield mask)
{
struct intel_context *intel = intel_context(ctx);
const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask[0]);
static const GLubyte *
-intelGetString(GLcontext * ctx, GLenum name)
+intelGetString(struct gl_context * ctx, GLenum name)
{
const struct intel_context *const intel = intel_context(ctx);
const char *chipset;
case PCI_CHIP_ILM_G:
chipset = "Intel(R) Ironlake Mobile";
break;
+ case PCI_CHIP_SANDYBRIDGE_GT1:
+ case PCI_CHIP_SANDYBRIDGE_GT2:
+ case PCI_CHIP_SANDYBRIDGE_GT2_PLUS:
+ chipset = "Intel(R) Sandybridge Desktop";
+ break;
+ case PCI_CHIP_SANDYBRIDGE_M_GT1:
+ case PCI_CHIP_SANDYBRIDGE_M_GT2:
+ case PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS:
+ chipset = "Intel(R) Sandybridge Mobile";
+ break;
+ case PCI_CHIP_SANDYBRIDGE_S:
+ chipset = "Intel(R) Sandybridge Server";
+ break;
default:
chipset = "Unknown Intel Chipset";
break;
}
static void
-intel_flush_front(GLcontext *ctx)
+intel_flush_front(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
__DRIcontext *driContext = intel->driContext;
}
static void
-intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+intel_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
struct intel_context *intel = intel_context(ctx);
__DRIcontext *driContext = intel->driContext;
static void
-intelInvalidateState(GLcontext * ctx, GLuint new_state)
+intelInvalidateState(struct gl_context * ctx, GLuint new_state)
{
struct intel_context *intel = intel_context(ctx);
}
void
-intel_flush(GLcontext *ctx)
+intel_flush(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
}
static void
-intel_glFlush(GLcontext *ctx)
+intel_glFlush(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
}
void
-intelFinish(GLcontext * ctx)
+intelFinish(struct gl_context * ctx)
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
int i;
GLboolean
intelInitContext(struct intel_context *intel,
int api,
- const __GLcontextModes * mesaVis,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate,
struct dd_function_table *functions)
{
- GLcontext *ctx = &intel->ctx;
- GLcontext *shareCtx = (GLcontext *) sharedContextPrivate;
+ struct gl_context *ctx = &intel->ctx;
+ struct gl_context *shareCtx = (struct gl_context *) sharedContextPrivate;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
struct intel_screen *intelScreen = sPriv->private;
int bo_reuse_mode;
- __GLcontextModes visual;
+ struct gl_config visual;
/* we can't do anything without a connection to the device */
if (intelScreen->bufmgr == NULL)
ctx->Const.MaxSamples = 1.0;
/* reinitialize the context point state.
- * It depend on constants in __GLcontextRec::Const
+ * It depend on constants in __struct gl_contextRec::Const
*/
_mesa_init_point(ctx);
};
/**
- * intel_context is derived from Mesa's context class: GLcontext.
+ * intel_context is derived from Mesa's context class: struct gl_context.
*/
struct intel_context
{
- GLcontext ctx; /**< base class, must be first field */
+ struct gl_context ctx; /**< base class, must be first field */
struct
{
__DRIcontext *driContext;
struct intel_screen *intelScreen;
- void (*saved_viewport)(GLcontext * ctx,
+ void (*saved_viewport)(struct gl_context * ctx,
GLint x, GLint y, GLsizei width, GLsizei height);
/**
extern GLboolean intelInitContext(struct intel_context *intel,
int api,
- const __GLcontextModes * mesaVis,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate,
struct dd_function_table *functions);
-extern void intelFinish(GLcontext * ctx);
-extern void intel_flush(GLcontext * ctx);
+extern void intelFinish(struct gl_context * ctx);
+extern void intel_flush(struct gl_context * ctx);
extern void intelInitDriverFunctions(struct dd_function_table *functions);
* These are better-typed than the macros used previously:
*/
static INLINE struct intel_context *
-intel_context(GLcontext * ctx)
+intel_context(struct gl_context * ctx)
{
return (struct intel_context *) ctx;
}
*/
static const struct dri_extension card_extensions[] = {
{ "GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions },
+ { "GL_ARB_explicit_attrib_location", NULL },
{ "GL_ARB_half_float_pixel", NULL },
{ "GL_ARB_map_buffer_range", GL_ARB_map_buffer_range_functions },
{ "GL_ARB_multitexture", NULL },
{ "GL_ARB_shadow", NULL },
{ "GL_MESA_texture_signed_rgba", NULL },
{ "GL_ARB_texture_non_power_of_two", NULL },
+ { "GL_ARB_texture_rg", NULL },
{ "GL_EXT_draw_buffers2", GL_EXT_draw_buffers2_functions },
{ "GL_EXT_shadow_funcs", NULL },
{ "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions },
{ NULL, NULL }
};
+/**
+ * \brief Get GLSL version from the environment.
+ *
+ * If the environment variable INTEL_GLSL_VERSION is set, convert its value
+ * to an integer and return it. Otherwise, return the default version, 120.
+ */
+static GLuint
+get_glsl_version()
+{
+ const char * s = getenv("INTEL_GLSL_VERSION");
+ if (s == NULL)
+ return 120;
+ else
+ return (GLuint) atoi(s);
+}
+
/**
* Initializes potential list of extensions if ctx == NULL, or actually enables
* extensions for a context.
*/
void
-intelInitExtensions(GLcontext *ctx)
+intelInitExtensions(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
driInitExtensions(ctx, card_extensions, GL_FALSE);
_mesa_map_function_array(GL_VERSION_2_1_functions);
- ctx->Const.GLSLVersion = 120;
+
+ ctx->Const.GLSLVersion = get_glsl_version();
if (intel->gen >= 5)
driInitExtensions(ctx, ironlake_extensions, GL_FALSE);
extern void
-intelInitExtensions(GLcontext *ctx);
+intelInitExtensions(struct gl_context *ctx);
extern void
-intelInitExtensionsES2(GLcontext *ctx);
+intelInitExtensionsES2(struct gl_context *ctx);
#endif
"GL_ARB_depth_texture",
"GL_EXT_packed_depth_stencil",
"GL_EXT_framebuffer_object",
+ "GL_EXT_texture_format_BGRA8888",
#if FEATURE_OES_EGL_image
"GL_OES_EGL_image",
* extensions for a context.
*/
void
-intelInitExtensionsES2(GLcontext *ctx)
+intelInitExtensionsES2(struct gl_context *ctx)
{
int i;
* Create a new framebuffer object.
*/
static struct gl_framebuffer *
-intel_new_framebuffer(GLcontext * ctx, GLuint name)
+intel_new_framebuffer(struct gl_context * ctx, GLuint name)
{
/* Only drawable state in intel_framebuffer at this time, just use Mesa's
* class
* Return a pointer to a specific pixel in a renderbuffer.
*/
static void *
-intel_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb,
+intel_get_pointer(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLint x, GLint y)
{
/* By returning NULL we force all software rendering to go through
* storage for a user-created renderbuffer.
*/
static GLboolean
-intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
+intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width, GLuint height)
{
struct intel_context *intel = intel_context(ctx);
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
- int cpp;
+ int cpp, tiling;
ASSERT(rb->Name != 0);
switch (internalFormat) {
+ case GL_RED:
+ case GL_R8:
+ rb->Format = MESA_FORMAT_R8;
+ rb->DataType = GL_UNSIGNED_BYTE;
+ break;
+ case GL_R16:
+ rb->Format = MESA_FORMAT_R16;
+ rb->DataType = GL_UNSIGNED_SHORT;
+ break;
+ case GL_RG:
+ case GL_RG8:
+ rb->Format = MESA_FORMAT_RG88;
+ rb->DataType = GL_UNSIGNED_BYTE;
+ break;
+ case GL_RG16:
+ rb->Format = MESA_FORMAT_RG1616;
+ rb->DataType = GL_UNSIGNED_SHORT;
+ break;
case GL_R3_G3_B2:
case GL_RGB4:
case GL_RGB5:
/* alloc hardware renderbuffer */
DBG("Allocating %d x %d Intel RBO\n", width, height);
- irb->region = intel_region_alloc(intel->intelScreen, I915_TILING_NONE, cpp,
+ tiling = I915_TILING_NONE;
+
+ /* Gen6 requires depth must be tiling */
+ if (intel->gen >= 6 && rb->Format == MESA_FORMAT_S8_Z24)
+ tiling = I915_TILING_Y;
+
+ irb->region = intel_region_alloc(intel->intelScreen, tiling, cpp,
width, height, GL_TRUE);
if (!irb->region)
return GL_FALSE; /* out of memory? */
#if FEATURE_OES_EGL_image
static void
-intel_image_target_renderbuffer_storage(GLcontext *ctx,
+intel_image_target_renderbuffer_storage(struct gl_context *ctx,
struct gl_renderbuffer *rb,
void *image_handle)
{
* Not used for user-created renderbuffers!
*/
static GLboolean
-intel_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
+intel_alloc_window_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
ASSERT(rb->Name == 0);
static void
-intel_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb,
+intel_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint width, GLuint height)
{
int i;
/** Dummy function for gl_renderbuffer::AllocStorage() */
static GLboolean
-intel_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
+intel_nop_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
_mesa_problem(ctx, "intel_op_alloc_storage should never be called.");
irb->Base._BaseFormat = GL_ALPHA;
irb->Base.DataType = GL_UNSIGNED_BYTE;
break;
+ case MESA_FORMAT_R8:
+ irb->Base._BaseFormat = GL_RED;
+ irb->Base.DataType = GL_UNSIGNED_BYTE;
+ break;
+ case MESA_FORMAT_RG88:
+ irb->Base._BaseFormat = GL_RG;
+ irb->Base.DataType = GL_UNSIGNED_BYTE;
+ break;
default:
_mesa_problem(NULL,
"Unexpected intFormat in intel_create_renderbuffer");
* Typically called via glBindRenderbufferEXT().
*/
static struct gl_renderbuffer *
-intel_new_renderbuffer(GLcontext * ctx, GLuint name)
+intel_new_renderbuffer(struct gl_context * ctx, GLuint name)
{
/*struct intel_context *intel = intel_context(ctx); */
struct intel_renderbuffer *irb;
* Called via glBindFramebufferEXT().
*/
static void
-intel_bind_framebuffer(GLcontext * ctx, GLenum target,
+intel_bind_framebuffer(struct gl_context * ctx, GLenum target,
struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
{
if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) {
* Called via glFramebufferRenderbufferEXT().
*/
static void
-intel_framebuffer_renderbuffer(GLcontext * ctx,
+intel_framebuffer_renderbuffer(struct gl_context * ctx,
struct gl_framebuffer *fb,
GLenum attachment, struct gl_renderbuffer *rb)
{
static GLboolean
-intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
+intel_update_wrapper(struct gl_context *ctx, struct intel_renderbuffer *irb,
struct gl_texture_image *texImage)
{
if (texImage->TexFormat == MESA_FORMAT_ARGB8888) {
irb->Base.DataType = GL_UNSIGNED_BYTE;
DBG("Render to A8 texture OK\n");
}
+ else if (texImage->TexFormat == MESA_FORMAT_R8) {
+ irb->Base.DataType = GL_UNSIGNED_BYTE;
+ DBG("Render to R8 texture OK\n");
+ }
+ else if (texImage->TexFormat == MESA_FORMAT_RG88) {
+ irb->Base.DataType = GL_UNSIGNED_BYTE;
+ DBG("Render to RG88 texture OK\n");
+ }
+ else if (texImage->TexFormat == MESA_FORMAT_R16) {
+ irb->Base.DataType = GL_UNSIGNED_SHORT;
+ DBG("Render to R8 texture OK\n");
+ }
+ else if (texImage->TexFormat == MESA_FORMAT_RG1616) {
+ irb->Base.DataType = GL_UNSIGNED_SHORT;
+ DBG("Render to RG88 texture OK\n");
+ }
else if (texImage->TexFormat == MESA_FORMAT_Z16) {
irb->Base.DataType = GL_UNSIGNED_SHORT;
DBG("Render to DEPTH16 texture OK\n");
* This will have the region info needed for hardware rendering.
*/
static struct intel_renderbuffer *
-intel_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage)
+intel_wrap_texture(struct gl_context * ctx, struct gl_texture_image *texImage)
{
const GLuint name = ~0; /* not significant, but distinct for debugging */
struct intel_renderbuffer *irb;
* before intel_finish_render_texture() is ever called.
*/
static void
-intel_render_texture(GLcontext * ctx,
+intel_render_texture(struct gl_context * ctx,
struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att)
{
* Called by Mesa when rendering to a texture is done.
*/
static void
-intel_finish_render_texture(GLcontext * ctx,
+intel_finish_render_texture(struct gl_context * ctx,
struct gl_renderbuffer_attachment *att)
{
struct intel_context *intel = intel_context(ctx);
* Do additional "completeness" testing of a framebuffer object.
*/
static void
-intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
+intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
{
const struct intel_renderbuffer *depthRb =
intel_get_renderbuffer(fb, BUFFER_DEPTH);
case MESA_FORMAT_ARGB1555:
case MESA_FORMAT_ARGB4444:
case MESA_FORMAT_A8:
+ case MESA_FORMAT_R8:
+ case MESA_FORMAT_R16:
+ case MESA_FORMAT_RG88:
+ case MESA_FORMAT_RG1616:
break;
default:
fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT;
* glDraw/CopyPixels.
*/
GLboolean
-intel_check_blit_fragment_ops(GLcontext * ctx, GLboolean src_alpha_is_one)
+intel_check_blit_fragment_ops(struct gl_context * ctx, GLboolean src_alpha_is_one)
{
if (ctx->NewState)
_mesa_update_state(ctx);
#include "main/mtypes.h"
void intelInitPixelFuncs(struct dd_function_table *functions);
-GLboolean intel_check_blit_fragment_ops(GLcontext * ctx,
+GLboolean intel_check_blit_fragment_ops(struct gl_context * ctx,
GLboolean src_alpha_is_one);
GLboolean intel_check_blit_format(struct intel_region *region,
GLenum format, GLenum type);
-void intelReadPixels(GLcontext * ctx,
+void intelReadPixels(struct gl_context * ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack,
GLvoid * pixels);
-void intelDrawPixels(GLcontext * ctx,
+void intelDrawPixels(struct gl_context * ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format,
const struct gl_pixelstore_attrib *unpack,
const GLvoid * pixels);
-void intelCopyPixels(GLcontext * ctx,
+void intelCopyPixels(struct gl_context * ctx,
GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
GLint destx, GLint desty, GLenum type);
-void intelBitmap(GLcontext * ctx,
+void intelBitmap(struct gl_context * ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
* PBO bitmaps. I think they are probably pretty rare though - I
* wonder if Xgl uses them?
*/
-static const GLubyte *map_pbo( GLcontext *ctx,
+static const GLubyte *map_pbo( struct gl_context *ctx,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap )
* Render a bitmap.
*/
static GLboolean
-do_blit_bitmap( GLcontext *ctx,
+do_blit_bitmap( struct gl_context *ctx,
GLint dstx, GLint dsty,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
* - Chop bitmap up into 32x32 squares and render w/polygon stipple.
*/
void
-intelBitmap(GLcontext * ctx,
+intelBitmap(struct gl_context * ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
* we allow Scissor.
*/
static GLboolean
-intel_check_copypixel_blit_fragment_ops(GLcontext * ctx)
+intel_check_copypixel_blit_fragment_ops(struct gl_context * ctx)
{
if (ctx->NewState)
_mesa_update_state(ctx);
* CopyPixels with the blitter. Don't support zooming, pixel transfer, etc.
*/
static GLboolean
-do_blit_copypixels(GLcontext * ctx,
+do_blit_copypixels(struct gl_context * ctx,
GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
GLint dstx, GLint dsty, GLenum type)
void
-intelCopyPixels(GLcontext * ctx,
+intelCopyPixels(struct gl_context * ctx,
GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
GLint destx, GLint desty, GLenum type)
#include "intel_pixel.h"
void
-intelDrawPixels(GLcontext * ctx,
+intelDrawPixels(struct gl_context * ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format,
*/
static GLboolean
-do_blit_readpixels(GLcontext * ctx,
+do_blit_readpixels(struct gl_context * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
}
void
-intelReadPixels(GLcontext * ctx,
+intelReadPixels(struct gl_context * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
static GLboolean
intelCreateBuffer(__DRIscreen * driScrnPriv,
__DRIdrawable * driDrawPriv,
- const __GLcontextModes * mesaVis, GLboolean isPixmap)
+ const struct gl_config * mesaVis, GLboolean isPixmap)
{
struct intel_renderbuffer *rb;
* init-designated function to register chipids and createcontext
* functions.
*/
-extern GLboolean i830CreateContext(const __GLcontextModes * mesaVis,
+extern GLboolean i830CreateContext(const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
extern GLboolean i915CreateContext(int api,
- const __GLcontextModes * mesaVis,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
extern GLboolean brwCreateContext(int api,
- const __GLcontextModes * mesaVis,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
static GLboolean
intelCreateContext(gl_api api,
- const __GLcontextModes * mesaVis,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
* This is the driver specific part of the createNewScreen entry point.
* Called when using DRI2.
*
- * \return the __GLcontextModes supported by this driver
+ * \return the struct gl_config supported by this driver
*/
static const
__DRIconfig **intelInitScreen2(__DRIscreen *psp)
* Old note: Moved locking out to get reasonable span performance.
*/
void
-intelSpanRenderStart(GLcontext * ctx)
+intelSpanRenderStart(struct gl_context * ctx)
{
struct intel_context *intel = intel_context(ctx);
GLuint i;
* the above function.
*/
void
-intelSpanRenderFinish(GLcontext * ctx)
+intelSpanRenderFinish(struct gl_context * ctx)
{
struct intel_context *intel = intel_context(ctx);
GLuint i;
void
-intelInitSpanFuncs(GLcontext * ctx)
+intelInitSpanFuncs(struct gl_context * ctx)
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
swdd->SpanRenderStart = intelSpanRenderStart;
}
void
-intel_map_vertex_shader_textures(GLcontext *ctx)
+intel_map_vertex_shader_textures(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
int i;
}
void
-intel_unmap_vertex_shader_textures(GLcontext *ctx)
+intel_unmap_vertex_shader_textures(struct gl_context *ctx)
{
struct intel_context *intel = intel_context(ctx);
int i;
#ifndef _INTEL_SPAN_H
#define _INTEL_SPAN_H
-extern void intelInitSpanFuncs(GLcontext * ctx);
+extern void intelInitSpanFuncs(struct gl_context * ctx);
-extern void intelSpanRenderFinish(GLcontext * ctx);
-extern void intelSpanRenderStart(GLcontext * ctx);
+extern void intelSpanRenderFinish(struct gl_context * ctx);
+extern void intelSpanRenderStart(struct gl_context * ctx);
void intel_renderbuffer_map(struct intel_context *intel,
struct gl_renderbuffer *rb);
void intel_renderbuffer_unmap(struct intel_context *intel,
struct gl_renderbuffer *rb);
-void intel_map_vertex_shader_textures(GLcontext *ctx);
-void intel_unmap_vertex_shader_textures(GLcontext *ctx);
+void intel_map_vertex_shader_textures(struct gl_context *ctx);
+void intel_unmap_vertex_shader_textures(struct gl_context *ctx);
#endif
/* Fallback to swrast for select and feedback.
*/
static void
-intelRenderMode(GLcontext *ctx, GLenum mode)
+intelRenderMode(struct gl_context *ctx, GLenum mode)
{
struct intel_context *intel = intel_context(ctx);
FALLBACK(intel, INTEL_FALLBACK_RENDERMODE, (mode != GL_RENDER));
#include "intel_reg.h"
static struct gl_sync_object *
-intel_new_sync_object(GLcontext *ctx, GLuint id)
+intel_new_sync_object(struct gl_context *ctx, GLuint id)
{
struct intel_sync_object *sync;
}
static void
-intel_delete_sync_object(GLcontext *ctx, struct gl_sync_object *s)
+intel_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *s)
{
struct intel_sync_object *sync = (struct intel_sync_object *)s;
}
static void
-intel_fence_sync(GLcontext *ctx, struct gl_sync_object *s,
+intel_fence_sync(struct gl_context *ctx, struct gl_sync_object *s,
GLenum condition, GLbitfield flags)
{
struct intel_context *intel = intel_context(ctx);
* The fix would be a new kernel function to do the GTT transition with a
* timeout.
*/
-static void intel_client_wait_sync(GLcontext *ctx, struct gl_sync_object *s,
+static void intel_client_wait_sync(struct gl_context *ctx, struct gl_sync_object *s,
GLbitfield flags, GLuint64 timeout)
{
struct intel_sync_object *sync = (struct intel_sync_object *)s;
* any batchbuffers coming after this waitsync will naturally not occur until
* the previous one is done.
*/
-static void intel_server_wait_sync(GLcontext *ctx, struct gl_sync_object *s,
+static void intel_server_wait_sync(struct gl_context *ctx, struct gl_sync_object *s,
GLbitfield flags, GLuint64 timeout)
{
}
-static void intel_check_sync(GLcontext *ctx, struct gl_sync_object *s)
+static void intel_check_sync(struct gl_context *ctx, struct gl_sync_object *s)
{
struct intel_sync_object *sync = (struct intel_sync_object *)s;
#define FILE_DEBUG_FLAG DEBUG_TEXTURE
static struct gl_texture_image *
-intelNewTextureImage(GLcontext * ctx)
+intelNewTextureImage(struct gl_context * ctx)
{
DBG("%s\n", __FUNCTION__);
(void) ctx;
static struct gl_texture_object *
-intelNewTextureObject(GLcontext * ctx, GLuint name, GLenum target)
+intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target)
{
struct intel_texture_object *obj = CALLOC_STRUCT(intel_texture_object);
}
static void
-intelDeleteTextureObject(GLcontext *ctx,
+intelDeleteTextureObject(struct gl_context *ctx,
struct gl_texture_object *texObj)
{
struct intel_context *intel = intel_context(ctx);
static void
-intelFreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage)
+intelFreeTextureImageData(struct gl_context * ctx, struct gl_texture_image *texImage)
{
struct intel_context *intel = intel_context(ctx);
struct intel_texture_image *intelImage = intel_texture_image(texImage);
* map/unmap the base level texture image.
*/
static void
-intelGenerateMipmap(GLcontext *ctx, GLenum target,
+intelGenerateMipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj)
{
if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, texObj)) {
void intelInitTextureCopyImageFuncs(struct dd_function_table *functions);
-gl_format intelChooseTextureFormat(GLcontext *ctx, GLint internalFormat,
+gl_format intelChooseTextureFormat(struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type);
void intelSetTexBuffer(__DRIcontext *pDRICtx,
if (irb && irb->region && irb->region->cpp == 4)
return irb->region;
return NULL;
+ case 4:
case GL_RGBA:
case GL_RGBA8:
irb = intel_renderbuffer(intel->ctx.ReadBuffer->_ColorReadBuffer);
if (irb->Base._BaseFormat == GL_RGB)
return NULL;
return irb->region;
+ case 3:
case GL_RGB:
case GL_RGB8:
return intel_readbuf_region(intel);
GLint dstx, GLint dsty,
GLint x, GLint y, GLsizei width, GLsizei height)
{
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
const struct intel_region *src = get_teximage_source(intel, internalFormat);
if (!intelImage->mt || !src || !src->buffer) {
static void
-intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level,
+intelCopyTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y, GLsizei width, GLint border)
{
static void
-intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level,
+intelCopyTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y, GLsizei width, GLsizei height,
GLint border)
static void
-intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
+intelCopyTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset, GLint x, GLint y, GLsizei width)
{
struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
static void
-intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
+intelCopyTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y, GLsizei width, GLsizei height)
{
* immediately after sampling...
*/
gl_format
-intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
+intelChooseTextureFormat(struct gl_context * ctx, GLint internalFormat,
GLenum format, GLenum type)
{
struct intel_context *intel = intel_context(ctx);
case GL_LUMINANCE12_ALPHA4:
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
+ /* i915 could implement this mode using MT_32BIT_RG1616. However, this
+ * would require an extra swizzle instruction in the fragment shader to
+ * convert the { R, G, 1.0, 1.0 } to { R, R, R, G }.
+ */
#ifndef I915
return MESA_FORMAT_AL1616;
#else
case GL_RGBA_SNORM:
case GL_RGBA8_SNORM:
return MESA_FORMAT_SIGNED_RGBA8888_REV;
+
+ /* i915 can do a RG16, but it can't do any of the other RED or RG formats.
+ * In addition, it only implements the broken D3D mode where undefined
+ * components are read as 1.0. I'm not sure who thought reading
+ * { R, G, 1.0, 1.0 } from a red-green texture would be useful.
+ */
+ case GL_RED:
+ case GL_R8:
+ return MESA_FORMAT_R8;
+ case GL_R16:
+ return MESA_FORMAT_R16;
+ case GL_RG:
+ case GL_RG8:
+ return MESA_FORMAT_RG88;
+ case GL_RG16:
+ return MESA_FORMAT_RG1616;
#endif
default:
#include "main/texstore.h"
#include "main/texgetimage.h"
#include "main/texobj.h"
-#include "main/texstore.h"
#include "main/teximage.h"
#include "intel_context.h"
static void
-intelTexImage(GLcontext * ctx,
+intelTexImage(struct gl_context * ctx,
GLint dims,
GLenum target, GLint level,
GLint internalFormat,
static void
-intelTexImage3D(GLcontext * ctx,
+intelTexImage3D(struct gl_context * ctx,
GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth,
static void
-intelTexImage2D(GLcontext * ctx,
+intelTexImage2D(struct gl_context * ctx,
GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
static void
-intelTexImage1D(GLcontext * ctx,
+intelTexImage1D(struct gl_context * ctx,
GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
static void
-intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
+intelCompressedTexImage2D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLsizei imageSize, const GLvoid *data,
* then unmap it.
*/
static void
-intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
+intel_get_tex_image(struct gl_context * ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid * pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage, GLboolean compressed)
static void
-intelGetTexImage(GLcontext * ctx, GLenum target, GLint level,
+intelGetTexImage(struct gl_context * ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid * pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
static void
-intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
+intelGetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level,
GLvoid *pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
{
struct gl_framebuffer *fb = dPriv->driverPrivate;
struct intel_context *intel = pDRICtx->driverPrivate;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
struct intel_texture_object *intelObj;
struct intel_texture_image *intelImage;
struct intel_mipmap_tree *mt;
#if FEATURE_OES_EGL_image
static void
-intel_image_target_texture_2d(GLcontext *ctx, GLenum target,
+intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage,
GLeglImageOES image_handle)
#define FILE_DEBUG_FLAG DEBUG_TEXTURE
static void
-intelTexSubimage(GLcontext * ctx,
+intelTexSubimage(struct gl_context * ctx,
GLint dims,
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
static void
-intelTexSubImage3D(GLcontext * ctx,
+intelTexSubImage3D(struct gl_context * ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
static void
-intelTexSubImage2D(GLcontext * ctx,
+intelTexSubImage2D(struct gl_context * ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
static void
-intelTexSubImage1D(GLcontext * ctx,
+intelTexSubImage1D(struct gl_context * ctx,
GLenum target,
GLint level,
GLint xoffset,
}
static void
-intelCompressedTexSubImage2D(GLcontext * ctx,
+intelCompressedTexSubImage2D(struct gl_context * ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
/* Create the device specific context.
*/
GLboolean mach64CreateContext( gl_api api,
- const __GLcontextModes *glVisual,
+ const struct gl_config *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{
- GLcontext *ctx, *shareCtx;
+ struct gl_context *ctx, *shareCtx;
__DRIscreen *driScreen = driContextPriv->driScreenPriv;
struct dd_function_table functions;
mach64ContextPtr mmesa;
}
_mesa_make_current( newMach64Ctx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
+ (struct gl_framebuffer *) driDrawPriv->driverPrivate,
+ (struct gl_framebuffer *) driReadPriv->driverPrivate );
newMach64Ctx->new_state |= MACH64_NEW_CLIP;
typedef struct mach64_texture_object mach64TexObj, *mach64TexObjPtr;
struct mach64_context {
- GLcontext *glCtx;
+ struct gl_context *glCtx;
/* Driver and hardware state management
*/
extern GLboolean mach64CreateContext( gl_api api,
- const __GLcontextModes *glVisual,
+ const struct gl_config *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate );
/* Return the current color buffer size.
*/
-static void mach64DDGetBufferSize( GLframebuffer *buffer,
+static void mach64DDGetBufferSize( struct gl_framebuffer *buffer,
GLuint *width, GLuint *height )
{
GET_CURRENT_CONTEXT(ctx);
/* Return various strings for glGetString().
*/
-static const GLubyte *mach64DDGetString( GLcontext *ctx, GLenum name )
+static const GLubyte *mach64DDGetString( struct gl_context *ctx, GLenum name )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
static char buffer[128];
* hardware. All commands that are normally sent to the ring are
* already considered `flushed'.
*/
-static void mach64DDFlush( GLcontext *ctx )
+static void mach64DDFlush( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
/* Make sure all commands have been sent to the hardware and have
* completed processing.
*/
-static void mach64DDFinish( GLcontext *ctx )
+static void mach64DDFinish( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
* Buffer clear
*/
-static void mach64DDClear( GLcontext *ctx, GLbitfield mask )
+static void mach64DDClear( struct gl_context *ctx, GLbitfield mask )
{
mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
__DRIdrawable *dPriv = mmesa->driDrawable;
#define LOCALVARS
#endif
-void TAG(translate_vertex)(GLcontext *ctx,
+void TAG(translate_vertex)(struct gl_context *ctx,
const VERTEX *src,
SWvertex *dst)
{
-void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v )
+void TAG(print_vertex)( struct gl_context *ctx, const VERTEX *v )
{
LOCALVARS
GLuint format = GET_VERTEX_FORMAT();
#define GET_COLOR(ptr, idx) ((ptr)->data[idx])
-INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx,
+INTERP_QUALIFIER void TAG(interp_extras)( struct gl_context *ctx,
GLfloat t,
GLuint dst, GLuint out, GLuint in,
GLboolean force_boundary )
INTERP_VERTEX(ctx, t, dst, out, in, force_boundary);
}
-INTERP_QUALIFIER void TAG(copy_pv_extras)( GLcontext *ctx,
+INTERP_QUALIFIER void TAG(copy_pv_extras)( struct gl_context *ctx,
GLuint dst, GLuint src )
{
LOCALVARS
#define LOCALVARS
#endif
-static void TAG(emit)( GLcontext *ctx,
+static void TAG(emit)( struct gl_context *ctx,
GLuint start, GLuint end,
void *dest,
GLuint stride )
#if DO_XYZW && DO_RGBA
-static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
+static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx )
{
LOCALVARS
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
}
-static void TAG(interp)( GLcontext *ctx,
+static void TAG(interp)( struct gl_context *ctx,
GLfloat t,
GLuint edst, GLuint eout, GLuint ein,
GLboolean force_boundary )
#endif /* DO_RGBA && DO_XYZW */
-static void TAG(copy_pv)( GLcontext *ctx, GLuint edst, GLuint esrc )
+static void TAG(copy_pv)( struct gl_context *ctx, GLuint edst, GLuint esrc )
{
#if DO_SPEC || DO_FOG || DO_RGBA
LOCALVARS
unsigned stencil_bits, GLboolean have_back_buffer )
{
__DRIconfig **configs;
- __GLcontextModes * m;
+ struct gl_config * m;
GLenum fb_format;
GLenum fb_type;
unsigned depth_buffer_factor;
static GLboolean
mach64CreateBuffer( __DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
GLboolean isPixmap )
{
mach64ScreenPtr screen = (mach64ScreenPtr) driScrnPriv->private;
static void
mach64DestroyBuffer(__DRIdrawable *driDrawPriv)
{
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
+ _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
mach64ContextPtr mmesa;
- GLcontext *ctx;
+ struct gl_context *ctx;
mmesa = (mach64ContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = mmesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
*
* \todo maybe fold this into intelInitDriver
*
- * \return the __GLcontextModes supported by this driver
+ * \return the struct gl_config supported by this driver
*/
static const __DRIconfig **
mach64InitScreen(__DRIscreen *psp)
#include "depthtmp.h"
-static void mach64SpanRenderStart( GLcontext *ctx )
+static void mach64SpanRenderStart( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
LOCK_HARDWARE( mmesa );
FINISH_DMA_LOCKED( mmesa );
}
-static void mach64SpanRenderFinish( GLcontext *ctx )
+static void mach64SpanRenderFinish( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
_swrast_flush( ctx );
UNLOCK_HARDWARE( mmesa );
}
-void mach64DDInitSpanFuncs( GLcontext *ctx )
+void mach64DDInitSpanFuncs( struct gl_context *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
swdd->SpanRenderStart = mach64SpanRenderStart;
* Plug in the Get/Put routines for the given driRenderbuffer.
*/
void
-mach64SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
+mach64SetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis)
{
if (drb->Base.Format == MESA_FORMAT_RGB565) {
mach64InitPointers_RGB565(&drb->Base);
#include "drirenderbuffer.h"
-extern void mach64DDInitSpanFuncs( GLcontext *ctx );
+extern void mach64DDInitSpanFuncs( struct gl_context *ctx );
extern void
-mach64SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
+mach64SetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis);
#endif
* Alpha blending
*/
-static void mach64UpdateAlphaMode( GLcontext *ctx )
+static void mach64UpdateAlphaMode( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
GLuint a = mmesa->setup.alpha_tst_cntl;
}
}
-static void mach64DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
+static void mach64DDAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
mmesa->new_state |= MACH64_NEW_ALPHA;
}
-static void mach64DDBlendEquationSeparate( GLcontext *ctx,
+static void mach64DDBlendEquationSeparate( struct gl_context *ctx,
GLenum modeRGB, GLenum modeA )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
mmesa->new_state |= MACH64_NEW_ALPHA;
}
-static void mach64DDBlendFuncSeparate( GLcontext *ctx,
+static void mach64DDBlendFuncSeparate( struct gl_context *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
{
* Depth testing
*/
-static void mach64UpdateZMode( GLcontext *ctx )
+static void mach64UpdateZMode( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
GLuint z = mmesa->setup.z_cntl;
}
}
-static void mach64DDDepthFunc( GLcontext *ctx, GLenum func )
+static void mach64DDDepthFunc( struct gl_context *ctx, GLenum func )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
mmesa->new_state |= MACH64_NEW_DEPTH;
}
-static void mach64DDDepthMask( GLcontext *ctx, GLboolean flag )
+static void mach64DDDepthMask( struct gl_context *ctx, GLboolean flag )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
mmesa->new_state |= MACH64_NEW_DEPTH;
}
-static void mach64DDClearDepth( GLcontext *ctx, GLclampd d )
+static void mach64DDClearDepth( struct gl_context *ctx, GLclampd d )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
* Fog
*/
-static void mach64UpdateFogAttrib( GLcontext *ctx )
+static void mach64UpdateFogAttrib( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
}
-static void mach64DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
+static void mach64DDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
* Clipping
*/
-static void mach64UpdateClipping( GLcontext *ctx )
+static void mach64UpdateClipping( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
mach64ScreenPtr mach64Screen = mmesa->mach64Screen;
}
}
-static void mach64DDScissor( GLcontext *ctx,
+static void mach64DDScissor( struct gl_context *ctx,
GLint x, GLint y, GLsizei w, GLsizei h )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
* Culling
*/
-static void mach64UpdateCull( GLcontext *ctx )
+static void mach64UpdateCull( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
GLfloat backface_sign = 1;
}
-static void mach64DDCullFace( GLcontext *ctx, GLenum mode )
+static void mach64DDCullFace( struct gl_context *ctx, GLenum mode )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
mmesa->new_state |= MACH64_NEW_CULL;
}
-static void mach64DDFrontFace( GLcontext *ctx, GLenum mode )
+static void mach64DDFrontFace( struct gl_context *ctx, GLenum mode )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
* Masks
*/
-static void mach64UpdateMasks( GLcontext *ctx )
+static void mach64UpdateMasks( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
GLuint mask = 0xffffffff;
}
}
-static void mach64DDColorMask( GLcontext *ctx,
+static void mach64DDColorMask( struct gl_context *ctx,
GLboolean r, GLboolean g,
GLboolean b, GLboolean a )
{
* sense to break them out of the core texture state update routines.
*/
-static void mach64UpdateSpecularLighting( GLcontext *ctx )
+static void mach64UpdateSpecularLighting( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
GLuint a = mmesa->setup.alpha_tst_cntl;
}
}
-static void mach64DDLightModelfv( GLcontext *ctx, GLenum pname,
+static void mach64DDLightModelfv( struct gl_context *ctx, GLenum pname,
const GLfloat *param )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
}
}
-static void mach64DDShadeModel( GLcontext *ctx, GLenum mode )
+static void mach64DDShadeModel( struct gl_context *ctx, GLenum mode )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
GLuint s = mmesa->setup.setup_cntl;
*/
-void mach64CalcViewport( GLcontext *ctx )
+void mach64CalcViewport( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
const GLfloat *v = ctx->Viewport._WindowMap.m;
mmesa->SetupNewInputs = ~0;
}
-static void mach64Viewport( GLcontext *ctx,
+static void mach64Viewport( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height )
{
mach64CalcViewport( ctx );
}
-static void mach64DepthRange( GLcontext *ctx,
+static void mach64DepthRange( struct gl_context *ctx,
GLclampd nearval, GLclampd farval )
{
mach64CalcViewport( ctx );
* Miscellaneous
*/
-static void mach64DDClearColor( GLcontext *ctx,
+static void mach64DDClearColor( struct gl_context *ctx,
const GLfloat color[4] )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
c[0], c[1], c[2], c[3] );
}
-static void mach64DDLogicOpCode( GLcontext *ctx, GLenum opcode )
+static void mach64DDLogicOpCode( struct gl_context *ctx, GLenum opcode )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
}
}
-void mach64SetCliprects( GLcontext *ctx, GLenum mode )
+void mach64SetCliprects( struct gl_context *ctx, GLenum mode )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
__DRIdrawable *dPriv = mmesa->driDrawable;
mmesa->dirty |= MACH64_UPLOAD_CLIPRECTS;
}
-static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode )
+static void mach64DDDrawBuffer( struct gl_context *ctx, GLenum mode )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
mmesa->dirty |= MACH64_UPLOAD_DST_OFF_PITCH;
}
-static void mach64DDReadBuffer( GLcontext *ctx, GLenum mode )
+static void mach64DDReadBuffer( struct gl_context *ctx, GLenum mode )
{
/* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
}
* State enable/disable
*/
-static void mach64DDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
+static void mach64DDEnable( struct gl_context *ctx, GLenum cap, GLboolean state )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
* Render mode
*/
-static void mach64DDRenderMode( GLcontext *ctx, GLenum mode )
+static void mach64DDRenderMode( struct gl_context *ctx, GLenum mode )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
FALLBACK( mmesa, MACH64_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
}
/* Update the hardware state */
-void mach64DDUpdateHWState( GLcontext *ctx )
+void mach64DDUpdateHWState( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
int new_state = mmesa->new_state;
}
-static void mach64DDInvalidateState( GLcontext *ctx, GLuint new_state )
+static void mach64DDInvalidateState( struct gl_context *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
/* Initialize the driver's state functions.
*/
-void mach64DDInitStateFuncs( GLcontext *ctx )
+void mach64DDInitStateFuncs( struct gl_context *ctx )
{
ctx->Driver.UpdateState = mach64DDInvalidateState;
#include "mach64_context.h"
extern void mach64DDInitState( mach64ContextPtr mmesa );
-extern void mach64DDInitStateFuncs( GLcontext *ctx );
+extern void mach64DDInitStateFuncs( struct gl_context *ctx );
-extern void mach64SetCliprects( GLcontext *ctx, GLenum mode );
-extern void mach64CalcViewport( GLcontext *ctx );
+extern void mach64SetCliprects( struct gl_context *ctx, GLenum mode );
+extern void mach64CalcViewport( struct gl_context *ctx );
-extern void mach64DDUpdateState( GLcontext *ctx );
-extern void mach64DDUpdateHWState( GLcontext *ctx );
+extern void mach64DDUpdateState( struct gl_context *ctx );
+extern void mach64DDUpdateHWState( struct gl_context *ctx );
extern void mach64EmitHwStateLocked( mach64ContextPtr mmesa );
/* Called by the _mesa_store_teximage[123]d() functions. */
static gl_format
-mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
+mach64ChooseTextureFormat( struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
}
}
-static void mach64TexImage1D( GLcontext *ctx, GLenum target, GLint level,
+static void mach64TexImage1D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
mmesa->new_state |= MACH64_NEW_TEXTURE;
}
-static void mach64TexSubImage1D( GLcontext *ctx,
+static void mach64TexSubImage1D( struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset,
mmesa->new_state |= MACH64_NEW_TEXTURE;
}
-static void mach64TexImage2D( GLcontext *ctx, GLenum target, GLint level,
+static void mach64TexImage2D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
mmesa->new_state |= MACH64_NEW_TEXTURE;
}
-static void mach64TexSubImage2D( GLcontext *ctx,
+static void mach64TexSubImage2D( struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
* Device Driver API texture functions
*/
-static void mach64DDTexEnv( GLcontext *ctx, GLenum target,
+static void mach64DDTexEnv( struct gl_context *ctx, GLenum target,
GLenum pname, const GLfloat *param )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
}
}
-static void mach64DDTexParameter( GLcontext *ctx, GLenum target,
+static void mach64DDTexParameter( struct gl_context *ctx, GLenum target,
struct gl_texture_object *tObj,
GLenum pname, const GLfloat *params )
{
mmesa->new_state |= MACH64_NEW_TEXTURE;
}
-static void mach64DDBindTexture( GLcontext *ctx, GLenum target,
+static void mach64DDBindTexture( struct gl_context *ctx, GLenum target,
struct gl_texture_object *tObj )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
mmesa->new_state |= MACH64_NEW_TEXTURE;
}
-static void mach64DDDeleteTexture( GLcontext *ctx,
+static void mach64DDDeleteTexture( struct gl_context *ctx,
struct gl_texture_object *tObj )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
* texture object from the core mesa gl_texture_object. Not done at this time.
*/
static struct gl_texture_object *
-mach64NewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
+mach64NewTextureObject( struct gl_context *ctx, GLuint name, GLenum target )
{
struct gl_texture_object *obj;
obj = _mesa_new_texture_object(ctx, name, target);
#ifndef __MACH64_TEX_H__
#define __MACH64_TEX_H__
-extern void mach64UpdateTextureState( GLcontext *ctx );
+extern void mach64UpdateTextureState( struct gl_context *ctx );
extern void mach64UploadTexImages( mach64ContextPtr mach64ctx,
mach64TexObjPtr t );
t->maxLog2 = baseImage->MaxLog2;
}
-static void mach64UpdateTextureEnv( GLcontext *ctx, int unit )
+static void mach64UpdateTextureEnv( struct gl_context *ctx, int unit )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
GLint source = mmesa->tmu_source[unit];
}
-static void mach64UpdateTextureUnit( GLcontext *ctx, int unit )
+static void mach64UpdateTextureUnit( struct gl_context *ctx, int unit )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
int source = mmesa->tmu_source[unit];
/* Update the hardware texture state */
-void mach64UpdateTextureState( GLcontext *ctx )
+void mach64UpdateTextureState( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
MACH64_PRIM_POLYGON,
};
-static void mach64RasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void mach64RenderPrimitive( GLcontext *ctx, GLenum prim );
+static void mach64RasterPrimitive( struct gl_context *ctx, GLuint hwprim );
+static void mach64RenderPrimitive( struct gl_context *ctx, GLenum prim );
/* FIXME: Remove this when native template is finished. */
mach64VertexPtr v3 )
{
#if MACH64_NATIVE_VTXFMT
- GLcontext *ctx = mmesa->glCtx;
+ struct gl_context *ctx = mmesa->glCtx;
const GLuint vertsize = mmesa->vertex_size;
GLint a;
GLfloat ooa;
mach64VertexPtr v2 )
{
#if MACH64_NATIVE_VTXFMT
- GLcontext *ctx = mmesa->glCtx;
+ struct gl_context *ctx = mmesa->glCtx;
GLuint vertsize = mmesa->vertex_size;
GLint a;
GLfloat ooa;
mach64VertexPtr v1 )
{
#if MACH64_NATIVE_VTXFMT
- GLcontext *ctx = mmesa->glCtx;
+ struct gl_context *ctx = mmesa->glCtx;
const GLuint vertsize = mmesa->vertex_size;
/* 2 fractional bits for hardware: */
const int width = (int) (2.0 * CLAMP(mmesa->glCtx->Line.Width,
mach64VertexPtr v0 )
{
#if MACH64_NATIVE_VTXFMT
- GLcontext *ctx = mmesa->glCtx;
+ struct gl_context *ctx = mmesa->glCtx;
const GLuint vertsize = mmesa->vertex_size;
/* 2 fractional bits for hardware: */
GLint sz = (GLint) (2.0 * CLAMP(mmesa->glCtx->Point.Size,
mach64Vertex *v1,
mach64Vertex *v2 )
{
- GLcontext *ctx = mmesa->glCtx;
+ struct gl_context *ctx = mmesa->glCtx;
SWvertex v[3];
mach64_translate_vertex( ctx, v0, &v[0] );
mach64_translate_vertex( ctx, v1, &v[1] );
mach64Vertex *v0,
mach64Vertex *v1 )
{
- GLcontext *ctx = mmesa->glCtx;
+ struct gl_context *ctx = mmesa->glCtx;
SWvertex v[2];
mach64_translate_vertex( ctx, v0, &v[0] );
mach64_translate_vertex( ctx, v1, &v[1] );
mach64_fallback_point( mach64ContextPtr mmesa,
mach64Vertex *v0 )
{
- GLcontext *ctx = mmesa->glCtx;
+ struct gl_context *ctx = mmesa->glCtx;
SWvertex v[1];
mach64_translate_vertex( ctx, v0, &v[0] );
_swrast_Point( ctx, &v[0] );
/* Render clipped primitives */
/**********************************************************************/
-static void mach64RenderClippedPoly( GLcontext *ctx, const GLuint *elts,
+static void mach64RenderClippedPoly( struct gl_context *ctx, const GLuint *elts,
GLuint n )
{
mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
}
-static void mach64RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
+static void mach64RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.Line( ctx, ii, jj );
}
#if MACH64_NATIVE_VTXFMT
-static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
+static void mach64FastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts,
GLuint n )
{
mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
assert( vb == vbchk );
}
#else
-static void mach64FastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
+static void mach64FastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts,
GLuint n )
{
mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-static void mach64ChooseRenderState(GLcontext *ctx)
+static void mach64ChooseRenderState(struct gl_context *ctx)
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
GLuint flags = ctx->_TriangleCaps;
/* Validate state at pipeline start */
/**********************************************************************/
-static void mach64RunPipeline( GLcontext *ctx )
+static void mach64RunPipeline( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
* and lines, points and bitmaps.
*/
-static void mach64RasterPrimitive( GLcontext *ctx, GLuint hwprim )
+static void mach64RasterPrimitive( struct gl_context *ctx, GLuint hwprim )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
}
}
-static void mach64RenderPrimitive( GLcontext *ctx, GLenum prim )
+static void mach64RenderPrimitive( struct gl_context *ctx, GLenum prim )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
GLuint hw = hw_prim[prim];
}
-static void mach64RenderStart( GLcontext *ctx )
+static void mach64RenderStart( struct gl_context *ctx )
{
/* Check for projective texturing. Make sure all texcoord
* pointers point to something. (fix in mesa?)
mach64CheckTexSizes( ctx );
}
-static void mach64RenderFinish( GLcontext *ctx )
+static void mach64RenderFinish( struct gl_context *ctx )
{
if (MACH64_CONTEXT(ctx)->RenderIndex & MACH64_FALLBACK_BIT)
_swrast_flush( ctx );
return fallbackStrings[i];
}
-void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode )
+void mach64Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
/* Initialization. */
/**********************************************************************/
-void mach64InitTriFuncs( GLcontext *ctx )
+void mach64InitTriFuncs( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
static int firsttime = 1;
#include "main/mtypes.h"
-extern void mach64InitTriFuncs( GLcontext *ctx );
+extern void mach64InitTriFuncs( struct gl_context *ctx );
-extern void mach64Fallback( GLcontext *ctx, GLuint bit, GLboolean mode );
+extern void mach64Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode );
#define FALLBACK( mmesa, bit, mode ) mach64Fallback( mmesa->glCtx, bit, mode )
#define MACH64_MAX_SETUP 0x80
static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
+ void (*emit)( struct gl_context *, GLuint, GLuint, void *, GLuint );
tnl_interp_func interp;
tnl_copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
+ GLboolean (*check_tex_sizes)( struct gl_context *ctx );
GLuint vertex_size;
GLuint vertex_format;
} setup_tab[MACH64_MAX_SETUP];
-void mach64CheckTexSizes( GLcontext *ctx )
+void mach64CheckTexSizes( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
}
}
-void mach64BuildVertices( GLcontext *ctx,
+void mach64BuildVertices( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint newinputs )
}
}
-void mach64ChooseVertexState( GLcontext *ctx )
+void mach64ChooseVertexState( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
mach64ContextPtr mmesa = MACH64_CONTEXT( ctx );
#if 0
-void mach64_emit_contiguous_verts( GLcontext *ctx,
+void mach64_emit_contiguous_verts( struct gl_context *ctx,
GLuint start,
GLuint count )
{
#endif
-void mach64InitVB( GLcontext *ctx )
+void mach64InitVB( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
GLuint size = TNL_CONTEXT(ctx)->vb.Size;
}
-void mach64FreeVB( GLcontext *ctx )
+void mach64FreeVB( struct gl_context *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
if (mmesa->verts) {
_NEW_FOG)
-extern void mach64CheckTexSizes( GLcontext *ctx );
-extern void mach64ChooseVertexState( GLcontext *ctx );
+extern void mach64CheckTexSizes( struct gl_context *ctx );
+extern void mach64ChooseVertexState( struct gl_context *ctx );
-extern void mach64BuildVertices( GLcontext *ctx, GLuint start, GLuint count,
+extern void mach64BuildVertices( struct gl_context *ctx, GLuint start, GLuint count,
GLuint newinputs );
extern void mach64PrintSetupFlags(char *msg, GLuint flags );
-extern void mach64InitVB( GLcontext *ctx );
-extern void mach64FreeVB( GLcontext *ctx );
+extern void mach64InitVB( struct gl_context *ctx );
+extern void mach64FreeVB( struct gl_context *ctx );
#if 0
-extern void mach64_emit_contiguous_verts( GLcontext *ctx,
+extern void mach64_emit_contiguous_verts( struct gl_context *ctx,
GLuint start,
GLuint count );
-extern void mach64_emit_indexed_verts( GLcontext *ctx,
+extern void mach64_emit_indexed_verts( struct gl_context *ctx,
GLuint start,
GLuint count );
#endif
-extern void mach64_translate_vertex( GLcontext *ctx,
+extern void mach64_translate_vertex( struct gl_context *ctx,
const mach64Vertex *src,
SWvertex *dst );
-extern void mach64_print_vertex( GLcontext *ctx, const mach64Vertex *v );
+extern void mach64_print_vertex( struct gl_context *ctx, const mach64Vertex *v );
#endif /* __MACH64_VB_H__ */
#if (HAVE_HW_DIVIDE || DO_SPEC || DO_TEX0 || DO_FOG || !HAVE_TINY_VERTICES)
-static void TAG(emit)( GLcontext *ctx,
+static void TAG(emit)( struct gl_context *ctx,
GLuint start, GLuint end,
void *dest,
GLuint stride )
#error "cannot use tiny vertices with hw perspective divide"
#endif
-static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
+static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end,
void *dest, GLuint stride )
{
LOCALVARS
}
}
#else
-static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
+static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end,
void *dest, GLuint stride )
{
LOCALVARS
#if (HAVE_PTEX_VERTICES)
-static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
+static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx )
{
LOCALVARS
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
return GL_TRUE;
}
#else
-static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
+static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx )
{
LOCALVARS
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
#endif /* ptex */
-static void TAG(interp)( GLcontext *ctx,
+static void TAG(interp)( struct gl_context *ctx,
GLfloat t,
GLuint edst, GLuint eout, GLuint ein,
GLboolean force_boundary )
#define MGA_ARG2 1
#define MGA_ALPHA 2
-GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit )
+GLboolean mgaUpdateTextureEnvCombine( struct gl_context *ctx, int unit )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
const int source = mmesa->tmu_source[unit];
* Texture unit state management
*/
-static void mgaUpdateTextureEnvG200( GLcontext *ctx, GLuint unit )
+static void mgaUpdateTextureEnvG200( struct gl_context *ctx, GLuint unit )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
struct gl_texture_object *tObj = ctx->Texture.Unit[0]._Current;
},
};
-static GLboolean mgaUpdateTextureEnvBlend( GLcontext *ctx, int unit )
+static GLboolean mgaUpdateTextureEnvBlend( struct gl_context *ctx, int unit )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
const int source = mmesa->tmu_source[unit];
return GL_TRUE;
}
-static void mgaUpdateTextureEnvG400( GLcontext *ctx, GLuint unit )
+static void mgaUpdateTextureEnvG400( struct gl_context *ctx, GLuint unit )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
const int source = mmesa->tmu_source[unit];
}
}
-static void disable_tex( GLcontext *ctx, int unit )
+static void disable_tex( struct gl_context *ctx, int unit )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
mmesa->dirty |= MGA_UPLOAD_CONTEXT | (MGA_UPLOAD_TEX0 << unit);
}
-static GLboolean enable_tex( GLcontext *ctx, int unit )
+static GLboolean enable_tex( struct gl_context *ctx, int unit )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
const int source = mmesa->tmu_source[unit];
return GL_TRUE;
}
-static GLboolean update_tex_common( GLcontext *ctx, int unit )
+static GLboolean update_tex_common( struct gl_context *ctx, int unit )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
const int source = mmesa->tmu_source[unit];
}
-static GLboolean updateTextureUnit( GLcontext *ctx, int unit )
+static GLboolean updateTextureUnit( struct gl_context *ctx, int unit )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
const int source = mmesa->tmu_source[unit];
/* The G400 is now programmed quite differently wrt texture environment.
*/
-void mgaUpdateTextureState( GLcontext *ctx )
+void mgaUpdateTextureState( struct gl_context *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
GLboolean ok;
#include "mgatris.h"
#include "mgavb.h"
#include "mgapixel.h"
-#include "mga_xmesa.h"
#include "mga_dri.h"
#include "utils.h"
unsigned stencil_bits, GLboolean have_back_buffer )
{
__DRIconfig **configs;
- __GLcontextModes * m;
+ struct gl_config * m;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
GLenum fb_format;
static GLboolean
mgaCreateContext( gl_api api,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{
int i;
unsigned maxlevels;
- GLcontext *ctx, *shareCtx;
+ struct gl_context *ctx, *shareCtx;
mgaContextPtr mmesa;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private;
static GLboolean
mgaCreateBuffer( __DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
GLboolean isPixmap )
{
mgaScreenPrivate *screen = (mgaScreenPrivate *) driScrnPriv->private;
static void
mgaDestroyBuffer(__DRIdrawable *driDrawPriv)
{
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
+ _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
static void
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
mgaContextPtr mmesa;
- GLcontext *ctx;
+ struct gl_context *ctx;
mmesa = (mgaContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = mmesa->glCtx;
mmesa->driReadable = driReadPriv;
_mesa_make_current(mmesa->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate);
+ (struct gl_framebuffer *) driDrawPriv->driverPrivate,
+ (struct gl_framebuffer *) driReadPriv->driverPrivate);
}
else {
_mesa_make_current(NULL, NULL, NULL);
*
* \todo maybe fold this into intelInitDriver
*
- * \return the __GLcontextModes supported by this driver
+ * \return the struct gl_config supported by this driver
*/
static const __DRIconfig **mgaInitScreen(__DRIscreen *psp)
{
struct mga_context_t {
- GLcontext *glCtx;
+ struct gl_context *glCtx;
unsigned int lastStamp; /* fullscreen breaks dpriv->laststamp,
* need to shadow it here. */
***************************************/
-static const GLubyte *mgaGetString( GLcontext *ctx, GLenum name )
+static const GLubyte *mgaGetString( struct gl_context *ctx, GLenum name )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
static char buffer[128];
static void
-mgaClear( GLcontext *ctx, GLbitfield mask )
+mgaClear( struct gl_context *ctx, GLbitfield mask )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
__DRIdrawable *dPriv = mmesa->driDrawable;
*
* \sa glFinish, mgaFlush, mgaFlushDMA
*/
-static void mgaFinish( GLcontext *ctx )
+static void mgaFinish( struct gl_context *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
uint32_t fence;
*
* \sa glFlush, mgaFinish, mgaFlushDMA
*/
-static void mgaFlush( GLcontext *ctx )
+static void mgaFlush( struct gl_context *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
static GLboolean
-check_depth_stencil_24_8( const GLcontext *ctx, GLenum type,
+check_depth_stencil_24_8( const struct gl_context *ctx, GLenum type,
const struct gl_pixelstore_attrib *packing,
const void *pixels, GLint sz,
GLint pitch )
static GLboolean
-check_depth( const GLcontext *ctx, GLenum type,
+check_depth( const struct gl_context *ctx, GLenum type,
const struct gl_pixelstore_attrib *packing,
const void *pixels, GLint sz, GLint pitch )
{
static GLboolean
-check_color( const GLcontext *ctx, GLenum type, GLenum format,
+check_color( const struct gl_context *ctx, GLenum type, GLenum format,
const struct gl_pixelstore_attrib *packing,
const void *pixels, GLint sz, GLint pitch )
{
}
static GLboolean
-check_color_per_fragment_ops( const GLcontext *ctx )
+check_color_per_fragment_ops( const struct gl_context *ctx )
{
return (!( ctx->Color.AlphaEnabled ||
ctx->Depth.Test ||
}
static GLboolean
-check_depth_per_fragment_ops( const GLcontext *ctx )
+check_depth_per_fragment_ops( const struct gl_context *ctx )
{
return ( ctx->Current.RasterPosValid &&
ctx->Color.ColorMask[0][RCOMP] == 0 &&
*/
#if defined(MESA_packed_depth_stencil)
static GLboolean
-check_stencil_per_fragment_ops( const GLcontext *ctx )
+check_stencil_per_fragment_ops( const struct gl_context *ctx )
{
return ( !ctx->Pixel.IndexShift &&
!ctx->Pixel.IndexOffset );
static GLboolean
-clip_pixelrect( const GLcontext *ctx,
- const GLframebuffer *buffer,
+clip_pixelrect( const struct gl_context *ctx,
+ const struct gl_framebuffer *buffer,
GLint *x, GLint *y,
GLsizei *width, GLsizei *height,
GLint *skipPixels, GLint *skipRows,
}
static GLboolean
-mgaTryReadPixels( GLcontext *ctx,
+mgaTryReadPixels( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack,
}
static void
-mgaDDReadPixels( GLcontext *ctx,
+mgaDDReadPixels( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack,
-static void do_draw_pix( GLcontext *ctx,
+static void do_draw_pix( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLint pitch,
const void *pixels,
static GLboolean
-mgaTryDrawPixels( GLcontext *ctx,
+mgaTryDrawPixels( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
}
static void
-mgaDDDrawPixels( GLcontext *ctx,
+mgaDDDrawPixels( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
* the same block of agp space which isn't used for anything else at
* present.
*/
-void mgaDDInitPixelFuncs( GLcontext *ctx )
+void mgaDDInitPixelFuncs( struct gl_context *ctx )
{
#if 0
/* evidently, these functions don't always work */
#include "main/mtypes.h"
-extern void mgaDDInitPixelFuncs( GLcontext *ctx );
+extern void mgaDDInitPixelFuncs( struct gl_context *ctx );
#endif
#define HAVE_ELTS 0 /* for now */
-static void mgaDmaPrimitive( GLcontext *ctx, GLenum prim )
+static void mgaDmaPrimitive( struct gl_context *ctx, GLenum prim )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
GLuint hwprim;
/**********************************************************************/
-static GLboolean mga_run_render( GLcontext *ctx,
+static GLboolean mga_run_render( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
static void
-mgaSpanRenderStart( GLcontext *ctx )
+mgaSpanRenderStart( struct gl_context *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
FLUSH_BATCH( mmesa );
}
static void
-mgaSpanRenderFinish( GLcontext *ctx )
+mgaSpanRenderFinish( struct gl_context *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
_swrast_flush( ctx );
* write routines for 888 and 8888. We also need to determine whether or not
* the visual has destination alpha.
*/
-void mgaDDInitSpanFuncs( GLcontext *ctx )
+void mgaDDInitSpanFuncs( struct gl_context *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
swdd->SpanRenderStart = mgaSpanRenderStart;
* Plug in the Get/Put routines for the given driRenderbuffer.
*/
void
-mgaSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
+mgaSetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis)
{
if (drb->Base.Format == MESA_FORMAT_RGB565) {
mgaInitPointers_565(&drb->Base);
#include "drirenderbuffer.h"
-extern void mgaDDInitSpanFuncs( GLcontext *ctx );
+extern void mgaDDInitSpanFuncs( struct gl_context *ctx );
extern void
-mgaSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
+mgaSetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis);
#endif
#include "drirenderbuffer.h"
-static void updateSpecularLighting( GLcontext *ctx );
+static void updateSpecularLighting( struct gl_context *ctx );
static const GLuint mgarop_NoBLK[16] = {
DC_atype_rpl | 0x00000000, DC_atype_rstr | 0x00080000,
* Alpha blending
*/
-static void mgaDDAlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
+static void mgaDDAlphaFunc(struct gl_context *ctx, GLenum func, GLfloat ref)
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
GLubyte refByte;
mmesa->hw.alpha_func = a | MGA_FIELD( AC_atref, refByte );
}
-static void updateBlendLogicOp(GLcontext *ctx)
+static void updateBlendLogicOp(struct gl_context *ctx)
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
GLboolean logicOp = RGBA_LOGICOP_ENABLED(ctx);
mmesa->hw.blend_func == (AC_src_src_alpha_sat | AC_dst_zero) );
}
-static void mgaDDBlendEquationSeparate(GLcontext *ctx,
+static void mgaDDBlendEquationSeparate(struct gl_context *ctx,
GLenum modeRGB, GLenum modeA)
{
assert( modeRGB == modeA );
updateBlendLogicOp( ctx );
}
-static void mgaDDBlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
+static void mgaDDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB,
GLenum dfactorRGB, GLenum sfactorA,
GLenum dfactorA )
{
* Depth testing
*/
-static void mgaDDDepthFunc(GLcontext *ctx, GLenum func)
+static void mgaDDDepthFunc(struct gl_context *ctx, GLenum func)
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
int zmode;
mmesa->hw.zmode |= zmode;
}
-static void mgaDDDepthMask(GLcontext *ctx, GLboolean flag)
+static void mgaDDDepthMask(struct gl_context *ctx, GLboolean flag)
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
}
-static void mgaDDClearDepth(GLcontext *ctx, GLclampd d)
+static void mgaDDClearDepth(struct gl_context *ctx, GLclampd d)
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
*/
-static void mgaDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
+static void mgaDDFogfv(struct gl_context *ctx, GLenum pname, const GLfloat *param)
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
*/
-void mgaUpdateClipping(const GLcontext *ctx)
+void mgaUpdateClipping(const struct gl_context *ctx)
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
}
-static void mgaDDScissor( GLcontext *ctx, GLint x, GLint y,
+static void mgaDDScissor( struct gl_context *ctx, GLint x, GLint y,
GLsizei w, GLsizei h )
{
if ( ctx->Scissor.Enabled ) {
#define _CULL_NEGATIVE ((1<<11)|(1<<5)|(1<<16))
#define _CULL_POSITIVE (1<<11)
-static void mgaDDCullFaceFrontFace(GLcontext *ctx, GLenum unused)
+static void mgaDDCullFaceFrontFace(struct gl_context *ctx, GLenum unused)
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
* Masks
*/
-static void mgaDDColorMask(GLcontext *ctx,
+static void mgaDDColorMask(struct gl_context *ctx,
GLboolean r, GLboolean g,
GLboolean b, GLboolean a )
{
* \param mask Pointer to the 32x32 stipple mask
*/
-static void mgaDDPolygonStipple( GLcontext *ctx, const GLubyte *mask )
+static void mgaDDPolygonStipple( struct gl_context *ctx, const GLubyte *mask )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
const GLubyte *m = mask;
* sense to break them out of the core texture state update routines.
*/
-static void updateSpecularLighting( GLcontext *ctx )
+static void updateSpecularLighting( struct gl_context *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
unsigned int specen;
*/
-static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname,
+static void mgaDDLightModelfv(struct gl_context *ctx, GLenum pname,
const GLfloat *param)
{
if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
static void
-mgaDDStencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func, GLint ref,
+mgaDDStencilFuncSeparate(struct gl_context *ctx, GLenum face, GLenum func, GLint ref,
GLuint mask)
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
}
static void
-mgaDDStencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask)
+mgaDDStencilMaskSeparate(struct gl_context *ctx, GLenum face, GLuint mask)
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
}
static void
-mgaDDStencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail, GLenum zfail,
+mgaDDStencilOpSeparate(struct gl_context *ctx, GLenum face, GLenum fail, GLenum zfail,
GLenum zpass)
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
* Window position and viewport transformation
*/
-void mgaCalcViewport( GLcontext *ctx )
+void mgaCalcViewport( struct gl_context *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
const GLfloat *v = ctx->Viewport._WindowMap.m;
mmesa->SetupNewInputs = ~0;
}
-static void mgaViewport( GLcontext *ctx,
+static void mgaViewport( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height )
{
mgaCalcViewport( ctx );
}
-static void mgaDepthRange( GLcontext *ctx,
+static void mgaDepthRange( struct gl_context *ctx,
GLclampd nearval, GLclampd farval )
{
mgaCalcViewport( ctx );
* Miscellaneous
*/
-static void mgaDDClearColor(GLcontext *ctx,
+static void mgaDDClearColor(struct gl_context *ctx,
const GLfloat color[4] )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
/* Fallback to swrast for select and feedback.
*/
-static void mgaRenderMode( GLcontext *ctx, GLenum mode )
+static void mgaRenderMode( struct gl_context *ctx, GLenum mode )
{
FALLBACK( ctx, MGA_FALLBACK_RENDERMODE, (mode != GL_RENDER) );
}
-static void mgaDDLogicOp( GLcontext *ctx, GLenum opcode )
+static void mgaDDLogicOp( struct gl_context *ctx, GLenum opcode )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
}
-static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode )
+static void mgaDDDrawBuffer(struct gl_context *ctx, GLenum mode )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
}
-static void mgaDDReadBuffer(GLcontext *ctx, GLenum mode )
+static void mgaDDReadBuffer(struct gl_context *ctx, GLenum mode )
{
/* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
}
*/
-static void mgaDDEnable(GLcontext *ctx, GLenum cap, GLboolean state)
+static void mgaDDEnable(struct gl_context *ctx, GLenum cap, GLboolean state)
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
void mgaEmitHwStateLocked( mgaContextPtr mmesa )
{
drm_mga_sarea_t *sarea = mmesa->sarea;
- GLcontext * ctx = mmesa->glCtx;
+ struct gl_context * ctx = mmesa->glCtx;
if (MGA_DEBUG & DEBUG_VERBOSE_MSG)
mgaDDPrintDirty( __FUNCTION__, mmesa->dirty );
*/
-static void mgaDDValidateState( GLcontext *ctx )
+static void mgaDDValidateState( struct gl_context *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
}
-static void mgaDDInvalidateState( GLcontext *ctx, GLuint new_state )
+static void mgaDDInvalidateState( struct gl_context *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
}
-static void mgaRunPipeline( GLcontext *ctx )
+static void mgaRunPipeline( struct gl_context *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
void mgaInitState( mgaContextPtr mmesa )
{
mgaScreenPrivate *mgaScreen = mmesa->mgaScreen;
- GLcontext *ctx = mmesa->glCtx;
+ struct gl_context *ctx = mmesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
/* use back buffer by default */
}
-void mgaDDInitStateFuncs( GLcontext *ctx )
+void mgaDDInitStateFuncs( struct gl_context *ctx )
{
ctx->Driver.UpdateState = mgaDDInvalidateState;
ctx->Driver.Enable = mgaDDEnable;
#define _MGA_STATE_H
extern void mgaInitState( mgaContextPtr mmesa );
-extern void mgaDDInitStateFuncs(GLcontext *ctx);
-extern void mgaUpdateClipping(const GLcontext *ctx);
-extern void mgaUpdateCull( GLcontext *ctx );
-extern void mgaCalcViewport( GLcontext *ctx );
+extern void mgaDDInitStateFuncs(struct gl_context *ctx);
+extern void mgaUpdateClipping(const struct gl_context *ctx);
+extern void mgaUpdateCull( struct gl_context *ctx );
+extern void mgaCalcViewport( struct gl_context *ctx );
extern void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers );
#endif
static gl_format
-mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
+mgaChooseTextureFormat( struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
}
-static void mgaTexEnv( GLcontext *ctx, GLenum target,
+static void mgaTexEnv( struct gl_context *ctx, GLenum target,
GLenum pname, const GLfloat *param )
{
GLuint unit = ctx->Texture.CurrentUnit;
}
-static void mgaTexImage2D( GLcontext *ctx, GLenum target, GLint level,
+static void mgaTexImage2D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
t->dirty_images[0] |= (1UL << level);
}
-static void mgaTexSubImage2D( GLcontext *ctx,
+static void mgaTexSubImage2D( struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
*/
static void
-mgaTexParameter( GLcontext *ctx, GLenum target,
+mgaTexParameter( struct gl_context *ctx, GLenum target,
struct gl_texture_object *tObj,
GLenum pname, const GLfloat *params )
{
static void
-mgaBindTexture( GLcontext *ctx, GLenum target,
+mgaBindTexture( struct gl_context *ctx, GLenum target,
struct gl_texture_object *tObj )
{
assert( (target != GL_TEXTURE_2D && target != GL_TEXTURE_RECTANGLE_NV) ||
static void
-mgaDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
+mgaDeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
driTextureObject * t = (driTextureObject *) tObj->DriverData;
* texture object from the core mesa gl_texture_object. Not done at this time.
*/
static struct gl_texture_object *
-mgaNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
+mgaNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target )
{
struct gl_texture_object *obj;
obj = _mesa_new_texture_object(ctx, name, target);
* state is properly setup. Texture residence is checked later
* when we grab the lock.
*/
-void mgaUpdateTextureState( GLcontext *ctx );
+void mgaUpdateTextureState( struct gl_context *ctx );
int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t );
void mgaInitTextureFuncs( struct dd_function_table *functions );
-GLboolean mgaUpdateTextureEnvCombine( GLcontext *ctx, int unit );
+GLboolean mgaUpdateTextureEnvCombine( struct gl_context *ctx, int unit );
#endif
#include "mgavb.h"
-static void mgaRenderPrimitive( GLcontext *ctx, GLenum prim );
+static void mgaRenderPrimitive( struct gl_context *ctx, GLenum prim );
/***********************************************************************
* Functions to draw basic primitives *
mgaVertex *v1,
mgaVertex *v2 )
{
- GLcontext *ctx = mmesa->glCtx;
+ struct gl_context *ctx = mmesa->glCtx;
SWvertex v[3];
mga_translate_vertex( ctx, v0, &v[0] );
mga_translate_vertex( ctx, v1, &v[1] );
mgaVertex *v0,
mgaVertex *v1 )
{
- GLcontext *ctx = mmesa->glCtx;
+ struct gl_context *ctx = mmesa->glCtx;
SWvertex v[2];
mga_translate_vertex( ctx, v0, &v[0] );
mga_translate_vertex( ctx, v1, &v[1] );
mga_fallback_point( mgaContextPtr mmesa,
mgaVertex *v0 )
{
- GLcontext *ctx = mmesa->glCtx;
+ struct gl_context *ctx = mmesa->glCtx;
SWvertex v[1];
mga_translate_vertex( ctx, v0, &v[0] );
_swrast_Point( ctx, &v[0] );
-static void mgaRenderClippedPoly( GLcontext *ctx, const GLuint *elts, GLuint n )
+static void mgaRenderClippedPoly( struct gl_context *ctx, const GLuint *elts, GLuint n )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.PrimitiveNotify( ctx, prim );
}
-static void mgaRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
+static void mgaRenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.Line( ctx, ii, jj );
}
-static void mgaFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
+static void mgaFastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts,
GLuint n )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
#define ANY_RASTER_FLAGS (DD_FLATSHADE|DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET| \
DD_TRI_UNFILLED)
-void mgaChooseRenderState(GLcontext *ctx)
+void mgaChooseRenderState(struct gl_context *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
/* Always called between RenderStart and RenderFinish --> We already
* hold the lock.
*/
-void mgaRasterPrimitive( GLcontext *ctx, GLenum prim, GLuint hwprim )
+void mgaRasterPrimitive( struct gl_context *ctx, GLenum prim, GLuint hwprim )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
* which renders strips as strips, the equivalent calculations are
* performed in mgarender.c.
*/
-static void mgaRenderPrimitive( GLcontext *ctx, GLenum prim )
+static void mgaRenderPrimitive( struct gl_context *ctx, GLenum prim )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
GLuint rprim = reduced_prim[prim];
}
}
-static void mgaRenderFinish( GLcontext *ctx )
+static void mgaRenderFinish( struct gl_context *ctx )
{
if (MGA_CONTEXT(ctx)->RenderIndex & MGA_FALLBACK_BIT)
_swrast_flush( ctx );
}
-void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
+void mgaFallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
}
-void mgaDDInitTriFuncs( GLcontext *ctx )
+void mgaDDInitTriFuncs( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
#include "main/mtypes.h"
-extern void mgaDDInitTriFuncs( GLcontext *ctx );
-extern void mgaChooseRenderState( GLcontext *ctx );
-extern void mgaRasterPrimitive( GLcontext *ctx, GLenum prim, GLuint hwprim );
+extern void mgaDDInitTriFuncs( struct gl_context *ctx );
+extern void mgaChooseRenderState( struct gl_context *ctx );
+extern void mgaRasterPrimitive( struct gl_context *ctx, GLenum prim, GLuint hwprim );
-extern void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
+extern void mgaFallback( struct gl_context *ctx, GLuint bit, GLboolean mode );
#define FALLBACK( ctx, bit, mode ) mgaFallback( ctx, bit, mode )
#define _MGA_NEW_RENDERSTATE (_DD_NEW_POINT_SMOOTH | \
#define MGA_MAX_SETUP 0x80
static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint );
+ void (*emit)( struct gl_context *, GLuint, GLuint, void *, GLuint );
tnl_interp_func interp;
tnl_copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
+ GLboolean (*check_tex_sizes)( struct gl_context *ctx );
GLuint vertex_size;
GLuint vertex_format;
} setup_tab[MGA_MAX_SETUP];
}
-void mgaCheckTexSizes( GLcontext *ctx )
+void mgaCheckTexSizes( struct gl_context *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
-void mgaBuildVertices( GLcontext *ctx,
+void mgaBuildVertices( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint newinputs )
}
-void mgaChooseVertexState( GLcontext *ctx )
+void mgaChooseVertexState( struct gl_context *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
TNLcontext *tnl = TNL_CONTEXT(ctx);
-void *mga_emit_contiguous_verts( GLcontext *ctx,
+void *mga_emit_contiguous_verts( struct gl_context *ctx,
GLuint start,
GLuint count,
void *dest)
-void mgaInitVB( GLcontext *ctx )
+void mgaInitVB( struct gl_context *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
GLuint size = TNL_CONTEXT(ctx)->vb.Size;
}
-void mgaFreeVB( GLcontext *ctx )
+void mgaFreeVB( struct gl_context *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
if (mmesa->verts) {
_NEW_FOG)
-extern void mgaChooseVertexState( GLcontext *ctx );
-extern void mgaCheckTexSizes( GLcontext *ctx );
-extern void mgaBuildVertices( GLcontext *ctx,
+extern void mgaChooseVertexState( struct gl_context *ctx );
+extern void mgaCheckTexSizes( struct gl_context *ctx );
+extern void mgaBuildVertices( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint newinputs );
extern void mgaPrintSetupFlags(char *msg, GLuint flags );
-extern void mgaInitVB( GLcontext *ctx );
-extern void mgaFreeVB( GLcontext *ctx );
+extern void mgaInitVB( struct gl_context *ctx );
+extern void mgaFreeVB( struct gl_context *ctx );
-extern void *mga_emit_contiguous_verts( GLcontext *ctx,
+extern void *mga_emit_contiguous_verts( struct gl_context *ctx,
GLuint start,
GLuint count,
void *dest );
-extern void mga_translate_vertex(GLcontext *ctx,
+extern void mga_translate_vertex(struct gl_context *ctx,
const mgaVertex *src,
SWvertex *dst);
-extern void mga_print_vertex( GLcontext *ctx, const mgaVertex *v );
+extern void mga_print_vertex( struct gl_context *ctx, const mgaVertex *v );
#endif
#include "nouveau_context.h"
static GLboolean
-nouveau_bo_marker_emit(GLcontext *ctx, struct nouveau_bo_marker *m,
+nouveau_bo_marker_emit(struct gl_context *ctx, struct nouveau_bo_marker *m,
uint32_t flags)
{
struct nouveau_channel *chan = context_chan(ctx);
}
GLboolean
-nouveau_bo_state_emit(GLcontext *ctx)
+nouveau_bo_state_emit(struct gl_context *ctx)
{
struct nouveau_bo_state *s = &to_nouveau_context(ctx)->bo;
int i, j;
}
void
-nouveau_bo_state_init(GLcontext *ctx)
+nouveau_bo_state_init(struct gl_context *ctx)
{
struct nouveau_bo_state *s = &to_nouveau_context(ctx)->bo;
int i;
}
void
-nouveau_bo_state_destroy(GLcontext *ctx)
+nouveau_bo_state_destroy(struct gl_context *ctx)
{
struct nouveau_bo_state *s = &to_nouveau_context(ctx)->bo;
int i, j;
};
struct nouveau_bo_context {
- GLcontext *ctx;
+ struct gl_context *ctx;
struct nouveau_bo_marker *marker;
int allocated;
nouveau_bo_context_reset(struct nouveau_bo_context *bctx);
GLboolean
-nouveau_bo_state_emit(GLcontext *ctx);
+nouveau_bo_state_emit(struct gl_context *ctx);
void
-nouveau_bo_state_init(GLcontext *ctx);
+nouveau_bo_state_init(struct gl_context *ctx);
void
-nouveau_bo_state_destroy(GLcontext *ctx);
+nouveau_bo_state_destroy(struct gl_context *ctx);
#define __context_bctx(ctx, i) \
({ \
#include "main/bufferobj.h"
static struct gl_buffer_object *
-nouveau_bufferobj_new(GLcontext *ctx, GLuint buffer, GLenum target)
+nouveau_bufferobj_new(struct gl_context *ctx, GLuint buffer, GLenum target)
{
struct nouveau_bufferobj *nbo;
}
static void
-nouveau_bufferobj_del(GLcontext *ctx, struct gl_buffer_object *obj)
+nouveau_bufferobj_del(struct gl_context *ctx, struct gl_buffer_object *obj)
{
struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj);
}
static GLboolean
-nouveau_bufferobj_data(GLcontext *ctx, GLenum target, GLsizeiptrARB size,
+nouveau_bufferobj_data(struct gl_context *ctx, GLenum target, GLsizeiptrARB size,
const GLvoid *data, GLenum usage,
struct gl_buffer_object *obj)
{
}
static void
-nouveau_bufferobj_subdata(GLcontext *ctx, GLenum target, GLintptrARB offset,
+nouveau_bufferobj_subdata(struct gl_context *ctx, GLenum target, GLintptrARB offset,
GLsizeiptrARB size, const GLvoid *data,
struct gl_buffer_object *obj)
{
}
static void
-nouveau_bufferobj_get_subdata(GLcontext *ctx, GLenum target, GLintptrARB offset,
+nouveau_bufferobj_get_subdata(struct gl_context *ctx, GLenum target, GLintptrARB offset,
GLsizeiptrARB size, GLvoid *data,
struct gl_buffer_object *obj)
{
}
static void *
-nouveau_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
+nouveau_bufferobj_map(struct gl_context *ctx, GLenum target, GLenum access,
struct gl_buffer_object *obj)
{
return ctx->Driver.MapBufferRange(ctx, target, 0, obj->Size, access,
}
static void *
-nouveau_bufferobj_map_range(GLcontext *ctx, GLenum target, GLintptr offset,
+nouveau_bufferobj_map_range(struct gl_context *ctx, GLenum target, GLintptr offset,
GLsizeiptr length, GLenum access,
struct gl_buffer_object *obj)
{
}
static GLboolean
-nouveau_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj)
+nouveau_bufferobj_unmap(struct gl_context *ctx, GLenum target, struct gl_buffer_object *obj)
{
struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj);
#define NV17TCL_DMA_IN_MEMORY4 0x000001ac
#define NV17TCL_DMA_IN_MEMORY5 0x000001b0
#define NV17TCL_COLOR_MASK_ENABLE 0x000002bc
+#define NV17TCL_ZCLEAR_ENABLE 0x000003f8
+#define NV17TCL_ZCLEAR_VALUE 0x000003fc
+#define NV17TCL_ZCLEAR_VALUE_DEPTH_SHIFT 8
+#define NV17TCL_ZCLEAR_VALUE_DEPTH_MASK 0xffffff00
+#define NV17TCL_ZCLEAR_VALUE_SEQUENCE_SHIFT 0
+#define NV17TCL_ZCLEAR_VALUE_SEQUENCE_MASK 0x000000ff
#define NV17TCL_LMA_DEPTH_BUFFER_PITCH 0x00000d5c
#define NV17TCL_LMA_DEPTH_BUFFER_OFFSET 0x00000d60
#define NV17TCL_LMA_DEPTH_FILL_VALUE 0x00000d68
nouveau_channel_flush_notify(struct nouveau_channel *chan)
{
struct nouveau_context *nctx = chan->user_private;
- GLcontext *ctx = &nctx->base;
+ struct gl_context *ctx = &nctx->base;
if (nctx->fallback < SWRAST)
nouveau_bo_state_emit(ctx);
GLboolean
nouveau_context_create(gl_api api,
- const __GLcontextModes *visual, __DRIcontext *dri_ctx,
+ const struct gl_config *visual, __DRIcontext *dri_ctx,
void *share_ctx)
{
__DRIscreen *dri_screen = dri_ctx->driScreenPriv;
struct nouveau_screen *screen = dri_screen->private;
struct nouveau_context *nctx;
- GLcontext *ctx;
+ struct gl_context *ctx;
ctx = screen->driver->context_create(screen, visual, share_ctx);
if (!ctx)
}
GLboolean
-nouveau_context_init(GLcontext *ctx, struct nouveau_screen *screen,
- const GLvisual *visual, GLcontext *share_ctx)
+nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
+ const struct gl_config *visual, struct gl_context *share_ctx)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct dd_function_table functions;
/* Allocate a hardware channel. */
ret = nouveau_channel_alloc(context_dev(ctx), 0xbeef0201, 0xbeef0202,
- &nctx->hw.chan);
+ 512*1024, &nctx->hw.chan);
if (ret) {
nouveau_error("Error initializing the FIFO.\n");
return GL_FALSE;
}
void
-nouveau_context_deinit(GLcontext *ctx)
+nouveau_context_deinit(struct gl_context *ctx)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
nouveau_context_destroy(__DRIcontext *dri_ctx)
{
struct nouveau_context *nctx = dri_ctx->driverPrivate;
- GLcontext *ctx = &nctx->base;
+ struct gl_context *ctx = &nctx->base;
context_drv(ctx)->context_destroy(ctx);
}
void
nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw)
{
- GLcontext *ctx = dri_ctx->driverPrivate;
+ struct gl_context *ctx = dri_ctx->driverPrivate;
__DRIscreen *screen = dri_ctx->driScreenPriv;
struct gl_framebuffer *fb = draw->driverPrivate;
struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
update_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw,
int *stamp)
{
- GLcontext *ctx = dri_ctx->driverPrivate;
+ struct gl_context *ctx = dri_ctx->driverPrivate;
struct gl_framebuffer *fb = draw->driverPrivate;
*stamp = *draw->pStamp;
{
if (dri_ctx) {
struct nouveau_context *nctx = dri_ctx->driverPrivate;
- GLcontext *ctx = &nctx->base;
+ struct gl_context *ctx = &nctx->base;
/* Ask the X server for new renderbuffers. */
if (dri_draw->driverPrivate != ctx->WinSysDrawBuffer)
}
void
-nouveau_fallback(GLcontext *ctx, enum nouveau_fallback mode)
+nouveau_fallback(struct gl_context *ctx, enum nouveau_fallback mode)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
}
void
-nouveau_validate_framebuffer(GLcontext *ctx)
+nouveau_validate_framebuffer(struct gl_context *ctx)
{
__DRIcontext *dri_ctx = to_nouveau_context(ctx)->dri_context;
__DRIdrawable *dri_draw = dri_ctx->driDrawablePriv;
validate_framebuffer(dri_ctx, dri_read,
&dri_ctx->dri2.read_stamp);
- if (nouveau_next_dirty_state(ctx) >= 0) {
- nouveau_state_emit(ctx);
- FIRE_RING(context_chan(ctx));
- }
+ nouveau_state_emit(ctx);
}
};
struct nouveau_context {
- GLcontext base;
+ struct gl_context base;
__DRIcontext *dri_context;
struct nouveau_screen *screen;
struct nouveau_hw_state hw;
struct nouveau_bo_state bo;
struct nouveau_render_state render;
+
+ struct {
+ GLboolean clear_blocked;
+ int clear_seq;
+ } hierz;
};
#define to_nouveau_context(ctx) ((struct nouveau_context *)(ctx))
GLboolean
nouveau_context_create(gl_api api,
- const __GLcontextModes *visual, __DRIcontext *dri_ctx,
+ const struct gl_config *visual, __DRIcontext *dri_ctx,
void *share_ctx);
GLboolean
-nouveau_context_init(GLcontext *ctx, struct nouveau_screen *screen,
- const GLvisual *visual, GLcontext *share_ctx);
+nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
+ const struct gl_config *visual, struct gl_context *share_ctx);
void
-nouveau_context_deinit(GLcontext *ctx);
+nouveau_context_deinit(struct gl_context *ctx);
void
nouveau_context_destroy(__DRIcontext *dri_ctx);
nouveau_context_unbind(__DRIcontext *dri_ctx);
void
-nouveau_fallback(GLcontext *ctx, enum nouveau_fallback mode);
+nouveau_fallback(struct gl_context *ctx, enum nouveau_fallback mode);
void
-nouveau_validate_framebuffer(GLcontext *ctx);
+nouveau_validate_framebuffer(struct gl_context *ctx);
#endif
#include "drivers/common/meta.h"
static const GLubyte *
-nouveau_get_string(GLcontext *ctx, GLenum name)
+nouveau_get_string(struct gl_context *ctx, GLenum name)
{
static char buffer[128];
char hardware_name[32];
}
static void
-nouveau_flush(GLcontext *ctx)
+nouveau_flush(struct gl_context *ctx)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_channel *chan = context_chan(ctx);
}
static void
-nouveau_finish(GLcontext *ctx)
+nouveau_finish(struct gl_context *ctx)
{
nouveau_flush(ctx);
}
void
-nouveau_clear(GLcontext *ctx, GLbitfield buffers)
+nouveau_clear(struct gl_context *ctx, GLbitfield buffers)
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
int x, y, w, h;
#define DRIVER_AUTHOR "Nouveau"
struct nouveau_driver {
- GLcontext *(*context_create)(struct nouveau_screen *screen,
- const GLvisual *visual,
- GLcontext *share_ctx);
- void (*context_destroy)(GLcontext *ctx);
+ struct gl_context *(*context_create)(struct nouveau_screen *screen,
+ const struct gl_config *visual,
+ struct gl_context *share_ctx);
+ void (*context_destroy)(struct gl_context *ctx);
- void (*surface_copy)(GLcontext *ctx,
+ void (*surface_copy)(struct gl_context *ctx,
struct nouveau_surface *dst,
struct nouveau_surface *src,
int dx, int dy, int sx, int sy, int w, int h);
- void (*surface_fill)(GLcontext *ctx,
+ void (*surface_fill)(struct gl_context *ctx,
struct nouveau_surface *dst,
unsigned mask, unsigned value,
int dx, int dy, int w, int h);
fprintf(stderr, "%s: " format, __func__, ## __VA_ARGS__)
void
-nouveau_clear(GLcontext *ctx, GLbitfield buffers);
+nouveau_clear(struct gl_context *ctx, GLbitfield buffers);
void
-nouveau_span_functions_init(GLcontext *ctx);
+nouveau_span_functions_init(struct gl_context *ctx);
void
nouveau_driver_functions_init(struct dd_function_table *functions);
}
static GLboolean
-nouveau_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
+nouveau_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width, GLuint height)
{
}
static struct gl_renderbuffer *
-nouveau_renderbuffer_new(GLcontext *ctx, GLuint name)
+nouveau_renderbuffer_new(struct gl_context *ctx, GLuint name)
{
struct gl_renderbuffer *rb;
}
static GLboolean
-nouveau_renderbuffer_dri_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
+nouveau_renderbuffer_dri_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width, GLuint height)
{
}
static struct gl_framebuffer *
-nouveau_framebuffer_new(GLcontext *ctx, GLuint name)
+nouveau_framebuffer_new(struct gl_context *ctx, GLuint name)
{
struct nouveau_framebuffer *nfb;
}
struct gl_framebuffer *
-nouveau_framebuffer_dri_new(const GLvisual *visual)
+nouveau_framebuffer_dri_new(const struct gl_config *visual)
{
struct nouveau_framebuffer *nfb;
}
static void
-nouveau_bind_framebuffer(GLcontext *ctx, GLenum target,
+nouveau_bind_framebuffer(struct gl_context *ctx, GLenum target,
struct gl_framebuffer *dfb,
struct gl_framebuffer *rfb)
{
}
static void
-nouveau_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
+nouveau_framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLenum attachment, struct gl_renderbuffer *rb)
{
_mesa_framebuffer_renderbuffer(ctx, fb, attachment, rb);
}
static void
-nouveau_render_texture(GLcontext *ctx, struct gl_framebuffer *fb,
+nouveau_render_texture(struct gl_context *ctx, struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att)
{
struct gl_renderbuffer *rb = att->Renderbuffer;
}
static void
-nouveau_finish_render_texture(GLcontext *ctx,
+nouveau_finish_render_texture(struct gl_context *ctx,
struct gl_renderbuffer_attachment *att)
{
texture_dirty(att->Texture);
struct nouveau_framebuffer {
struct gl_framebuffer base;
- struct nouveau_bo *lma_bo;
GLboolean need_front;
+
+ struct {
+ struct nouveau_bo *bo;
+ uint32_t clear_value;
+ } hierz;
};
#define to_nouveau_framebuffer(x) ((struct nouveau_framebuffer *)(x))
#define to_nouveau_renderbuffer(x) ((struct nouveau_renderbuffer *)(x))
struct gl_framebuffer *
-nouveau_framebuffer_dri_new(const GLvisual *visual);
+nouveau_framebuffer_dri_new(const struct gl_config *visual);
struct gl_renderbuffer *
nouveau_renderbuffer_dri_new(GLenum format, __DRIdrawable *drawable);
struct nouveau_array_state;
-typedef void (*dispatch_t)(GLcontext *, unsigned int, int, unsigned int);
+typedef void (*dispatch_t)(struct gl_context *, unsigned int, int, unsigned int);
typedef unsigned (*extract_u_t)(struct nouveau_array_state *, int, int);
typedef float (*extract_f_t)(struct nouveau_array_state *, int, int);
int imm_method;
int imm_fields;
- void (*emit)(GLcontext *, struct nouveau_array_state *, const void *);
+ void (*emit)(struct gl_context *, struct nouveau_array_state *, const void *);
};
struct nouveau_array_state {
extract_f_t extract_f;
};
-#define RENDER_SCRATCH_COUNT 32
-#define RENDER_SCRATCH_SIZE 64*1024
+#define RENDER_SCRATCH_COUNT 2
+#define RENDER_SCRATCH_SIZE 2*1024*1024
struct nouveau_scratch_state {
struct nouveau_bo *bo[RENDER_SCRATCH_COUNT];
get_array_dispatch(struct nouveau_array_state *a, dispatch_t *dispatch)
{
if (!a->fields) {
- auto void f(GLcontext *, unsigned int, int, unsigned int);
+ auto void f(struct gl_context *, unsigned int, int, unsigned int);
- void f(GLcontext *ctx, unsigned int start, int delta,
+ void f(struct gl_context *ctx, unsigned int start, int delta,
unsigned int n) {
struct nouveau_channel *chan = context_chan(ctx);
RENDER_LOCALS(ctx);
*dispatch = f;
} else if (a->type == GL_UNSIGNED_INT) {
- auto void f(GLcontext *, unsigned int, int, unsigned int);
+ auto void f(struct gl_context *, unsigned int, int, unsigned int);
- void f(GLcontext *ctx, unsigned int start, int delta,
+ void f(struct gl_context *ctx, unsigned int start, int delta,
unsigned int n) {
struct nouveau_channel *chan = context_chan(ctx);
RENDER_LOCALS(ctx);
*dispatch = f;
} else {
- auto void f(GLcontext *, unsigned int, int, unsigned int);
+ auto void f(struct gl_context *, unsigned int, int, unsigned int);
- void f(GLcontext *ctx, unsigned int start, int delta,
+ void f(struct gl_context *ctx, unsigned int start, int delta,
unsigned int n) {
struct nouveau_channel *chan = context_chan(ctx);
RENDER_LOCALS(ctx);
* always be located right at the beginning of <bo>.
*/
static inline void *
-get_scratch_vbo(GLcontext *ctx, unsigned size, struct nouveau_bo **bo,
+get_scratch_vbo(struct gl_context *ctx, unsigned size, struct nouveau_bo **bo,
unsigned *offset)
{
struct nouveau_scratch_state *scratch = &to_render_state(ctx)->scratch;
* Returns how many vertices you can draw using <n> pushbuf dwords.
*/
static inline unsigned
-get_max_vertices(GLcontext *ctx, const struct _mesa_index_buffer *ib,
+get_max_vertices(struct gl_context *ctx, const struct _mesa_index_buffer *ib,
int n)
{
struct nouveau_render_state *render = to_render_state(ctx);
#include "nouveau_swtnl_t.c"
static void
-TAG(emit_material)(GLcontext *ctx, struct nouveau_array_state *a,
+TAG(emit_material)(struct gl_context *ctx, struct nouveau_array_state *a,
const void *v)
{
const int attr = a->attr - VERT_ATTRIB_GENERIC0;
}
static void
-TAG(render_prims)(GLcontext *ctx, const struct gl_client_array **arrays,
+TAG(render_prims)(struct gl_context *ctx, const struct gl_client_array **arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
}
void
-TAG(render_init)(GLcontext *ctx)
+TAG(render_init)(struct gl_context *ctx)
{
struct nouveau_render_state *render = to_render_state(ctx);
struct nouveau_scratch_state *scratch = &render->scratch;
}
void
-TAG(render_destroy)(GLcontext *ctx)
+TAG(render_destroy)(struct gl_context *ctx)
{
TAG(swtnl_destroy)(ctx);
}
static GLboolean
nouveau_create_buffer(__DRIscreen *dri_screen,
__DRIdrawable *drawable,
- const __GLcontextModes *visual,
+ const struct gl_config *visual,
GLboolean is_pixmap)
{
struct gl_renderbuffer *rb;
}
static void
-texture_unit_map_unmap(GLcontext *ctx, struct gl_texture_unit *u, GLboolean map)
+texture_unit_map_unmap(struct gl_context *ctx, struct gl_texture_unit *u, GLboolean map)
{
if (!u->_ReallyEnabled)
return;
}
static void
-span_map_unmap(GLcontext *ctx, GLboolean map)
+span_map_unmap(struct gl_context *ctx, GLboolean map)
{
int i;
}
static void
-nouveau_span_start(GLcontext *ctx)
+nouveau_span_start(struct gl_context *ctx)
{
nouveau_fallback(ctx, SWRAST);
span_map_unmap(ctx, GL_TRUE);
}
static void
-nouveau_span_finish(GLcontext *ctx)
+nouveau_span_finish(struct gl_context *ctx)
{
span_map_unmap(ctx, GL_FALSE);
nouveau_fallback(ctx, HWTNL);
}
void
-nouveau_span_functions_init(GLcontext *ctx)
+nouveau_span_functions_init(struct gl_context *ctx)
{
struct swrast_device_driver *swdd =
_swrast_GetDeviceDriverReference(ctx);
#include "tnl/tnl.h"
static void
-nouveau_alpha_func(GLcontext *ctx, GLenum func, GLfloat ref)
+nouveau_alpha_func(struct gl_context *ctx, GLenum func, GLfloat ref)
{
context_dirty(ctx, ALPHA_FUNC);
}
static void
-nouveau_blend_color(GLcontext *ctx, const GLfloat color[4])
+nouveau_blend_color(struct gl_context *ctx, const GLfloat color[4])
{
context_dirty(ctx, BLEND_COLOR);
}
static void
-nouveau_blend_equation_separate(GLcontext *ctx, GLenum modeRGB, GLenum modeA)
+nouveau_blend_equation_separate(struct gl_context *ctx, GLenum modeRGB, GLenum modeA)
{
context_dirty(ctx, BLEND_EQUATION);
}
static void
-nouveau_blend_func_separate(GLcontext *ctx, GLenum sfactorRGB,
+nouveau_blend_func_separate(struct gl_context *ctx, GLenum sfactorRGB,
GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA)
{
context_dirty(ctx, BLEND_FUNC);
}
static void
-nouveau_clip_plane(GLcontext *ctx, GLenum plane, const GLfloat *equation)
+nouveau_clip_plane(struct gl_context *ctx, GLenum plane, const GLfloat *equation)
{
context_dirty_i(ctx, CLIP_PLANE, plane - GL_CLIP_PLANE0);
}
static void
-nouveau_color_mask(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
+nouveau_color_mask(struct gl_context *ctx, GLboolean rmask, GLboolean gmask,
GLboolean bmask, GLboolean amask)
{
context_dirty(ctx, COLOR_MASK);
}
static void
-nouveau_color_material(GLcontext *ctx, GLenum face, GLenum mode)
+nouveau_color_material(struct gl_context *ctx, GLenum face, GLenum mode)
{
context_dirty(ctx, COLOR_MATERIAL);
context_dirty(ctx, MATERIAL_FRONT_AMBIENT);
}
static void
-nouveau_cull_face(GLcontext *ctx, GLenum mode)
+nouveau_cull_face(struct gl_context *ctx, GLenum mode)
{
context_dirty(ctx, CULL_FACE);
}
static void
-nouveau_front_face(GLcontext *ctx, GLenum mode)
+nouveau_front_face(struct gl_context *ctx, GLenum mode)
{
context_dirty(ctx, FRONT_FACE);
}
static void
-nouveau_depth_func(GLcontext *ctx, GLenum func)
+nouveau_depth_func(struct gl_context *ctx, GLenum func)
{
context_dirty(ctx, DEPTH);
}
static void
-nouveau_depth_mask(GLcontext *ctx, GLboolean flag)
+nouveau_depth_mask(struct gl_context *ctx, GLboolean flag)
{
context_dirty(ctx, DEPTH);
}
static void
-nouveau_depth_range(GLcontext *ctx, GLclampd nearval, GLclampd farval)
+nouveau_depth_range(struct gl_context *ctx, GLclampd nearval, GLclampd farval)
{
context_dirty(ctx, VIEWPORT);
}
static void
-nouveau_draw_buffers(GLcontext *ctx, GLsizei n, const GLenum *buffers)
+nouveau_draw_buffers(struct gl_context *ctx, GLsizei n, const GLenum *buffers)
{
nouveau_validate_framebuffer(ctx);
context_dirty(ctx, FRAMEBUFFER);
}
static void
-nouveau_enable(GLcontext *ctx, GLenum cap, GLboolean state)
+nouveau_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
{
int i;
}
static void
-nouveau_fog(GLcontext *ctx, GLenum pname, const GLfloat *params)
+nouveau_fog(struct gl_context *ctx, GLenum pname, const GLfloat *params)
{
context_dirty(ctx, FOG);
}
static void
-nouveau_light(GLcontext *ctx, GLenum light, GLenum pname, const GLfloat *params)
+nouveau_light(struct gl_context *ctx, GLenum light, GLenum pname, const GLfloat *params)
{
switch (pname) {
case GL_AMBIENT:
}
static void
-nouveau_light_model(GLcontext *ctx, GLenum pname, const GLfloat *params)
+nouveau_light_model(struct gl_context *ctx, GLenum pname, const GLfloat *params)
{
context_dirty(ctx, LIGHT_MODEL);
context_dirty(ctx, MODELVIEW);
}
static void
-nouveau_line_stipple(GLcontext *ctx, GLint factor, GLushort pattern )
+nouveau_line_stipple(struct gl_context *ctx, GLint factor, GLushort pattern )
{
context_dirty(ctx, LINE_STIPPLE);
}
static void
-nouveau_line_width(GLcontext *ctx, GLfloat width)
+nouveau_line_width(struct gl_context *ctx, GLfloat width)
{
context_dirty(ctx, LINE_MODE);
}
static void
-nouveau_logic_opcode(GLcontext *ctx, GLenum opcode)
+nouveau_logic_opcode(struct gl_context *ctx, GLenum opcode)
{
context_dirty(ctx, LOGIC_OPCODE);
}
static void
-nouveau_point_parameter(GLcontext *ctx, GLenum pname, const GLfloat *params)
+nouveau_point_parameter(struct gl_context *ctx, GLenum pname, const GLfloat *params)
{
context_dirty(ctx, POINT_PARAMETER);
}
static void
-nouveau_point_size(GLcontext *ctx, GLfloat size)
+nouveau_point_size(struct gl_context *ctx, GLfloat size)
{
context_dirty(ctx, POINT_MODE);
}
static void
-nouveau_polygon_mode(GLcontext *ctx, GLenum face, GLenum mode)
+nouveau_polygon_mode(struct gl_context *ctx, GLenum face, GLenum mode)
{
context_dirty(ctx, POLYGON_MODE);
}
static void
-nouveau_polygon_offset(GLcontext *ctx, GLfloat factor, GLfloat units)
+nouveau_polygon_offset(struct gl_context *ctx, GLfloat factor, GLfloat units)
{
context_dirty(ctx, POLYGON_OFFSET);
}
static void
-nouveau_polygon_stipple(GLcontext *ctx, const GLubyte *mask)
+nouveau_polygon_stipple(struct gl_context *ctx, const GLubyte *mask)
{
context_dirty(ctx, POLYGON_STIPPLE);
}
static void
-nouveau_render_mode(GLcontext *ctx, GLenum mode)
+nouveau_render_mode(struct gl_context *ctx, GLenum mode)
{
context_dirty(ctx, RENDER_MODE);
}
static void
-nouveau_scissor(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+nouveau_scissor(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
context_dirty(ctx, SCISSOR);
}
static void
-nouveau_shade_model(GLcontext *ctx, GLenum mode)
+nouveau_shade_model(struct gl_context *ctx, GLenum mode)
{
context_dirty(ctx, SHADE_MODEL);
}
static void
-nouveau_stencil_func_separate(GLcontext *ctx, GLenum face, GLenum func,
+nouveau_stencil_func_separate(struct gl_context *ctx, GLenum face, GLenum func,
GLint ref, GLuint mask)
{
context_dirty(ctx, STENCIL_FUNC);
}
static void
-nouveau_stencil_mask_separate(GLcontext *ctx, GLenum face, GLuint mask)
+nouveau_stencil_mask_separate(struct gl_context *ctx, GLenum face, GLuint mask)
{
context_dirty(ctx, STENCIL_MASK);
}
static void
-nouveau_stencil_op_separate(GLcontext *ctx, GLenum face, GLenum fail,
+nouveau_stencil_op_separate(struct gl_context *ctx, GLenum face, GLenum fail,
GLenum zfail, GLenum zpass)
{
context_dirty(ctx, STENCIL_OP);
}
static void
-nouveau_tex_gen(GLcontext *ctx, GLenum coord, GLenum pname,
+nouveau_tex_gen(struct gl_context *ctx, GLenum coord, GLenum pname,
const GLfloat *params)
{
switch (pname) {
}
static void
-nouveau_tex_env(GLcontext *ctx, GLenum target, GLenum pname,
+nouveau_tex_env(struct gl_context *ctx, GLenum target, GLenum pname,
const GLfloat *param)
{
switch (target) {
}
static void
-nouveau_tex_parameter(GLcontext *ctx, GLenum target,
+nouveau_tex_parameter(struct gl_context *ctx, GLenum target,
struct gl_texture_object *t, GLenum pname,
const GLfloat *params)
{
}
static void
-nouveau_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+nouveau_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
context_dirty(ctx, VIEWPORT);
}
void
-nouveau_emit_nothing(GLcontext *ctx, int emit)
+nouveau_emit_nothing(struct gl_context *ctx, int emit)
{
}
int
-nouveau_next_dirty_state(GLcontext *ctx)
+nouveau_next_dirty_state(struct gl_context *ctx)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
int i = BITSET_FFS(nctx->dirty) - 1;
}
void
-nouveau_state_emit(GLcontext *ctx)
+nouveau_state_emit(struct gl_context *ctx)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
const struct nouveau_driver *drv = context_drv(ctx);
}
static void
-nouveau_update_state(GLcontext *ctx, GLbitfield new_state)
+nouveau_update_state(struct gl_context *ctx, GLbitfield new_state)
{
int i;
}
void
-nouveau_state_init(GLcontext *ctx)
+nouveau_state_init(struct gl_context *ctx)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
MAX_NOUVEAU_STATE = NUM_NOUVEAU_STATE + 16,
};
-typedef void (*nouveau_state_func)(GLcontext *ctx, int emit);
+typedef void (*nouveau_state_func)(struct gl_context *ctx, int emit);
void
-nouveau_state_init(GLcontext *ctx);
+nouveau_state_init(struct gl_context *ctx);
void
-nouveau_emit_nothing(GLcontext *ctx, int emit);
+nouveau_emit_nothing(struct gl_context *ctx, int emit);
int
-nouveau_next_dirty_state(GLcontext *ctx);
+nouveau_next_dirty_state(struct gl_context *ctx);
void
-nouveau_state_emit(GLcontext *ctx);
+nouveau_state_emit(struct gl_context *ctx);
#endif
#include "nouveau_util.h"
void
-nouveau_surface_alloc(GLcontext *ctx, struct nouveau_surface *s,
+nouveau_surface_alloc(struct gl_context *ctx, struct nouveau_surface *s,
enum nouveau_surface_layout layout,
unsigned flags, unsigned format,
unsigned width, unsigned height)
{
- unsigned tile_mode, cpp = _mesa_get_format_bytes(format);
- int ret;
+ unsigned tile_mode = 0, tile_flags = 0;
+ int ret, cpp = _mesa_get_format_bytes(format);
nouveau_bo_ref(NULL, &s->bo);
if (layout == TILED) {
s->pitch = align(s->pitch, 256);
tile_mode = s->pitch;
+
+ if (cpp == 4)
+ tile_flags = NOUVEAU_BO_TILE_32BPP;
+ else if (cpp == 2)
+ tile_flags = NOUVEAU_BO_TILE_16BPP;
+
+ if (_mesa_get_format_bits(format, GL_DEPTH_BITS))
+ tile_flags |= NOUVEAU_BO_TILE_ZETA;
+
} else {
s->pitch = align(s->pitch, 64);
- tile_mode = 0;
}
ret = nouveau_bo_new_tile(context_dev(ctx), flags, 0, s->pitch * height,
- tile_mode, 0, &s->bo);
+ tile_mode, tile_flags, &s->bo);
assert(!ret);
}
};
void
-nouveau_surface_alloc(GLcontext *ctx, struct nouveau_surface *s,
+nouveau_surface_alloc(struct gl_context *ctx, struct nouveau_surface *s,
enum nouveau_surface_layout layout,
unsigned flags, unsigned format,
unsigned width, unsigned height);
};
static void
-swtnl_choose_attrs(GLcontext *ctx)
+swtnl_choose_attrs(struct gl_context *ctx)
{
struct nouveau_render_state *render = to_render_state(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
static void
-swtnl_alloc_vertices(GLcontext *ctx)
+swtnl_alloc_vertices(struct gl_context *ctx)
{
struct nouveau_swtnl_state *swtnl = &to_render_state(ctx)->swtnl;
}
static void
-swtnl_bind_vertices(GLcontext *ctx)
+swtnl_bind_vertices(struct gl_context *ctx)
{
struct nouveau_render_state *render = to_render_state(ctx);
struct nouveau_swtnl_state *swtnl = &render->swtnl;
}
static void
-swtnl_unbind_vertices(GLcontext *ctx)
+swtnl_unbind_vertices(struct gl_context *ctx)
{
struct nouveau_render_state *render = to_render_state(ctx);
int i;
}
static void
-swtnl_flush_vertices(GLcontext *ctx)
+swtnl_flush_vertices(struct gl_context *ctx)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_swtnl_state *swtnl = &to_render_state(ctx)->swtnl;
/* TnL renderer entry points */
static void
-swtnl_start(GLcontext *ctx)
+swtnl_start(struct gl_context *ctx)
{
swtnl_choose_attrs(ctx);
}
static void
-swtnl_finish(GLcontext *ctx)
+swtnl_finish(struct gl_context *ctx)
{
swtnl_flush_vertices(ctx);
swtnl_unbind_vertices(ctx);
}
static void
-swtnl_primitive(GLcontext *ctx, GLenum mode)
+swtnl_primitive(struct gl_context *ctx, GLenum mode)
{
}
static void
-swtnl_reset_stipple(GLcontext *ctx)
+swtnl_reset_stipple(struct gl_context *ctx)
{
}
} while (0)
static void
-swtnl_points(GLcontext *ctx, GLuint first, GLuint last)
+swtnl_points(struct gl_context *ctx, GLuint first, GLuint last)
{
int i, count;
}
static void
-swtnl_line(GLcontext *ctx, GLuint v1, GLuint v2)
+swtnl_line(struct gl_context *ctx, GLuint v1, GLuint v2)
{
BEGIN_PRIMITIVE(GL_LINES, 2);
OUT_VERTEX(v1);
}
static void
-swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3)
+swtnl_triangle(struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3)
{
BEGIN_PRIMITIVE(GL_TRIANGLES, 3);
OUT_VERTEX(v1);
}
static void
-swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4)
+swtnl_quad(struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4)
{
BEGIN_PRIMITIVE(GL_QUADS, 4);
OUT_VERTEX(v1);
/* TnL initialization. */
static void
-TAG(swtnl_init)(GLcontext *ctx)
+TAG(swtnl_init)(struct gl_context *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
static void
-TAG(swtnl_destroy)(GLcontext *ctx)
+TAG(swtnl_destroy)(struct gl_context *ctx)
{
nouveau_bo_ref(NULL, &to_render_state(ctx)->swtnl.vbo);
}
#include "drivers/common/meta.h"
static struct gl_texture_object *
-nouveau_texture_new(GLcontext *ctx, GLuint name, GLenum target)
+nouveau_texture_new(struct gl_context *ctx, GLuint name, GLenum target)
{
struct nouveau_texture *nt = CALLOC_STRUCT(nouveau_texture);
}
static void
-nouveau_texture_free(GLcontext *ctx, struct gl_texture_object *t)
+nouveau_texture_free(struct gl_context *ctx, struct gl_texture_object *t)
{
struct nouveau_texture *nt = to_nouveau_texture(t);
int i;
}
static struct gl_texture_image *
-nouveau_teximage_new(GLcontext *ctx)
+nouveau_teximage_new(struct gl_context *ctx)
{
struct nouveau_teximage *nti = CALLOC_STRUCT(nouveau_teximage);
}
static void
-nouveau_teximage_free(GLcontext *ctx, struct gl_texture_image *ti)
+nouveau_teximage_free(struct gl_context *ctx, struct gl_texture_image *ti)
{
struct nouveau_teximage *nti = to_nouveau_teximage(ti);
}
static void
-nouveau_teximage_map(GLcontext *ctx, struct gl_texture_image *ti)
+nouveau_teximage_map(struct gl_context *ctx, struct gl_texture_image *ti)
{
struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
int ret;
}
static void
-nouveau_teximage_unmap(GLcontext *ctx, struct gl_texture_image *ti)
+nouveau_teximage_unmap(struct gl_context *ctx, struct gl_texture_image *ti)
{
struct nouveau_surface *s = &to_nouveau_teximage(ti)->surface;
}
static gl_format
-nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat,
+nouveau_choose_tex_format(struct gl_context *ctx, GLint internalFormat,
GLenum srcFormat, GLenum srcType)
{
switch (internalFormat) {
}
static GLboolean
-validate_teximage(GLcontext *ctx, struct gl_texture_object *t,
+validate_teximage(struct gl_context *ctx, struct gl_texture_object *t,
int level, int x, int y, int z,
int width, int height, int depth)
{
}
static void
-relayout_texture(GLcontext *ctx, struct gl_texture_object *t)
+relayout_texture(struct gl_context *ctx, struct gl_texture_object *t)
{
struct gl_texture_image *base = t->Image[0][t->BaseLevel];
}
GLboolean
-nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t)
+nouveau_texture_validate(struct gl_context *ctx, struct gl_texture_object *t)
{
struct nouveau_texture *nt = to_nouveau_texture(t);
int i, last = get_last_level(t);
}
void
-nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t)
+nouveau_texture_reallocate(struct gl_context *ctx, struct gl_texture_object *t)
{
if (!teximage_fits(t, t->BaseLevel) ||
!teximage_fits(t, get_last_level(t))) {
}
static void
-nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
+nouveau_teximage(struct gl_context *ctx, GLint dims, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
}
static void
-nouveau_teximage_1d(GLcontext *ctx, GLenum target, GLint level,
+nouveau_teximage_1d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
}
static void
-nouveau_teximage_2d(GLcontext *ctx, GLenum target, GLint level,
+nouveau_teximage_2d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
}
static void
-nouveau_teximage_3d(GLcontext *ctx, GLenum target, GLint level,
+nouveau_teximage_3d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
}
static void
-nouveau_texsubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
+nouveau_texsubimage(struct gl_context *ctx, GLint dims, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
GLenum format, GLenum type, const void *pixels,
}
static void
-nouveau_texsubimage_3d(GLcontext *ctx, GLenum target, GLint level,
+nouveau_texsubimage_3d(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
GLenum format, GLenum type, const void *pixels,
}
static void
-nouveau_texsubimage_2d(GLcontext *ctx, GLenum target, GLint level,
+nouveau_texsubimage_2d(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint width, GLint height,
GLenum format, GLenum type, const void *pixels,
}
static void
-nouveau_texsubimage_1d(GLcontext *ctx, GLenum target, GLint level,
+nouveau_texsubimage_1d(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint width,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *packing,
}
static void
-nouveau_get_teximage(GLcontext *ctx, GLenum target, GLint level,
+nouveau_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid *pixels,
struct gl_texture_object *t,
struct gl_texture_image *ti)
}
static void
-nouveau_bind_texture(GLcontext *ctx, GLenum target,
+nouveau_bind_texture(struct gl_context *ctx, GLenum target,
struct gl_texture_object *t)
{
context_dirty_i(ctx, TEX_OBJ, ctx->Texture.CurrentUnit);
__DRIdrawable *draw)
{
struct nouveau_context *nctx = dri_ctx->driverPrivate;
- GLcontext *ctx = &nctx->base;
+ struct gl_context *ctx = &nctx->base;
struct gl_framebuffer *fb = draw->driverPrivate;
struct gl_renderbuffer *rb =
fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
}
static void
-nouveau_texture_map(GLcontext *ctx, struct gl_texture_object *t)
+nouveau_texture_map(struct gl_context *ctx, struct gl_texture_object *t)
{
int i;
}
static void
-nouveau_texture_unmap(GLcontext *ctx, struct gl_texture_object *t)
+nouveau_texture_unmap(struct gl_context *ctx, struct gl_texture_object *t)
{
int i;
}
static void
-store_mipmap(GLcontext *ctx, GLenum target, int first, int last,
+store_mipmap(struct gl_context *ctx, GLenum target, int first, int last,
struct gl_texture_object *t)
{
struct gl_pixelstore_attrib packing = {
}
static void
-nouveau_generate_mipmap(GLcontext *ctx, GLenum target,
+nouveau_generate_mipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *t)
{
if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, t)) {
__DRIdrawable *draw);
GLboolean
-nouveau_texture_validate(GLcontext *ctx, struct gl_texture_object *t);
+nouveau_texture_validate(struct gl_context *ctx, struct gl_texture_object *t);
void
-nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t);
+nouveau_texture_reallocate(struct gl_context *ctx, struct gl_texture_object *t);
#endif
}
static inline void
-get_viewport_scale(GLcontext *ctx, float a[16])
+get_viewport_scale(struct gl_context *ctx, float a[16])
{
struct gl_viewport_attrib *vp = &ctx->Viewport;
struct gl_framebuffer *fb = ctx->DrawBuffer;
}
static inline void
-get_viewport_translate(GLcontext *ctx, float a[4])
+get_viewport_translate(struct gl_context *ctx, float a[4])
{
struct gl_viewport_attrib *vp = &ctx->Viewport;
struct gl_framebuffer *fb = ctx->DrawBuffer;
/* Arbitrary pushbuf length we can assume we can get with a single
* WAIT_RING. */
-#define PUSHBUF_DWORDS 2048
+#define PUSHBUF_DWORDS 65536
/* Functions to set up struct nouveau_array_state from something like
* a GL array or index buffer. */
}
static int
-get_array_stride(GLcontext *ctx, const struct gl_client_array *a)
+get_array_stride(struct gl_context *ctx, const struct gl_client_array *a)
{
struct nouveau_render_state *render = to_render_state(ctx);
}
static void
-vbo_init_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib,
+vbo_init_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib,
const struct gl_client_array **arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
}
static void
-vbo_deinit_arrays(GLcontext *ctx, const struct _mesa_index_buffer *ib,
+vbo_deinit_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib,
const struct gl_client_array **arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
/* Make some rendering decisions from the GL context. */
static void
-vbo_choose_render_mode(GLcontext *ctx, const struct gl_client_array **arrays)
+vbo_choose_render_mode(struct gl_context *ctx, const struct gl_client_array **arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
int i;
}
static void
-vbo_emit_attr(GLcontext *ctx, const struct gl_client_array **arrays, int attr)
+vbo_emit_attr(struct gl_context *ctx, const struct gl_client_array **arrays, int attr)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_render_state *render = to_render_state(ctx);
#define MAT(a) (VERT_ATTRIB_GENERIC0 + MAT_ATTRIB_##a)
static void
-vbo_choose_attrs(GLcontext *ctx, const struct gl_client_array **arrays)
+vbo_choose_attrs(struct gl_context *ctx, const struct gl_client_array **arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
int i;
}
static int
-get_max_client_stride(GLcontext *ctx, const struct gl_client_array **arrays)
+get_max_client_stride(struct gl_context *ctx, const struct gl_client_array **arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
int i, s = 0;
}
static void
-TAG(vbo_render_prims)(GLcontext *ctx, const struct gl_client_array **arrays,
+TAG(vbo_render_prims)(struct gl_context *ctx, const struct gl_client_array **arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
GLuint min_index, GLuint max_index);
static GLboolean
-vbo_maybe_split(GLcontext *ctx, const struct gl_client_array **arrays,
+vbo_maybe_split(struct gl_context *ctx, const struct gl_client_array **arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLuint min_index, GLuint max_index)
/* VBO rendering path. */
static void
-vbo_bind_vertices(GLcontext *ctx, const struct gl_client_array **arrays,
+vbo_bind_vertices(struct gl_context *ctx, const struct gl_client_array **arrays,
GLint basevertex, GLuint min_index, GLuint max_index)
{
struct nouveau_render_state *render = to_render_state(ctx);
}
static void
-vbo_draw_vbo(GLcontext *ctx, const struct gl_client_array **arrays,
+vbo_draw_vbo(struct gl_context *ctx, const struct gl_client_array **arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib, GLuint min_index,
GLuint max_index)
}
static void
-vbo_draw_imm(GLcontext *ctx, const struct gl_client_array **arrays,
+vbo_draw_imm(struct gl_context *ctx, const struct gl_client_array **arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib, GLuint min_index,
GLuint max_index)
/* draw_prims entry point when we're doing hw-tnl. */
static void
-TAG(vbo_render_prims)(GLcontext *ctx, const struct gl_client_array **arrays,
+TAG(vbo_render_prims)(struct gl_context *ctx, const struct gl_client_array **arrays,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
}
struct nouveau_grobj *
-nv04_context_engine(GLcontext *ctx)
+nv04_context_engine(struct gl_context *ctx)
{
struct nv04_context *nctx = to_nv04_context(ctx);
struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
nv04_channel_flush_notify(struct nouveau_channel *chan)
{
struct nouveau_context *nctx = chan->user_private;
- GLcontext *ctx = &nctx->base;
+ struct gl_context *ctx = &nctx->base;
if (nctx->fallback < SWRAST) {
nouveau_bo_state_emit(ctx);
}
static void
-nv04_hwctx_init(GLcontext *ctx)
+nv04_hwctx_init(struct gl_context *ctx)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
}
static void
-init_dummy_texture(GLcontext *ctx)
+init_dummy_texture(struct gl_context *ctx)
{
struct nouveau_surface *s = &to_nv04_context(ctx)->dummy_texture;
}
static void
-nv04_context_destroy(GLcontext *ctx)
+nv04_context_destroy(struct gl_context *ctx)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
FREE(ctx);
}
-static GLcontext *
-nv04_context_create(struct nouveau_screen *screen, const GLvisual *visual,
- GLcontext *share_ctx)
+static struct gl_context *
+nv04_context_create(struct nouveau_screen *screen, const struct gl_config *visual,
+ struct gl_context *share_ctx)
{
struct nv04_context *nctx;
struct nouveau_hw_state *hw;
- GLcontext *ctx;
+ struct gl_context *ctx;
int ret;
nctx = CALLOC_STRUCT(nv04_context);
#define nv04_mtex_engine(obj) ((obj)->grclass == NV04_MULTITEX_TRIANGLE)
struct nouveau_grobj *
-nv04_context_engine(GLcontext *ctx);
+nv04_context_engine(struct gl_context *ctx);
extern const struct nouveau_driver nv04_driver;
/* nv04_render.c */
void
-nv04_render_init(GLcontext *ctx);
+nv04_render_init(struct gl_context *ctx);
void
-nv04_render_destroy(GLcontext *ctx);
+nv04_render_destroy(struct gl_context *ctx);
/* nv04_surface.c */
GLboolean
-nv04_surface_init(GLcontext *ctx);
+nv04_surface_init(struct gl_context *ctx);
void
-nv04_surface_takedown(GLcontext *ctx);
+nv04_surface_takedown(struct gl_context *ctx);
void
-nv04_surface_copy(GLcontext *ctx,
+nv04_surface_copy(struct gl_context *ctx,
struct nouveau_surface *dst, struct nouveau_surface *src,
int dx, int dy, int sx, int sy, int w, int h);
void
-nv04_surface_fill(GLcontext *ctx,
+nv04_surface_fill(struct gl_context *ctx,
struct nouveau_surface *dst,
unsigned mask, unsigned value,
int dx, int dy, int w, int h);
/* nv04_state_fb.c */
void
-nv04_emit_framebuffer(GLcontext *ctx, int emit);
+nv04_emit_framebuffer(struct gl_context *ctx, int emit);
void
-nv04_emit_scissor(GLcontext *ctx, int emit);
+nv04_emit_scissor(struct gl_context *ctx, int emit);
/* nv04_state_raster.c */
void
-nv04_defer_control(GLcontext *ctx, int emit);
+nv04_defer_control(struct gl_context *ctx, int emit);
void
-nv04_emit_control(GLcontext *ctx, int emit);
+nv04_emit_control(struct gl_context *ctx, int emit);
void
-nv04_defer_blend(GLcontext *ctx, int emit);
+nv04_defer_blend(struct gl_context *ctx, int emit);
void
-nv04_emit_blend(GLcontext *ctx, int emit);
+nv04_emit_blend(struct gl_context *ctx, int emit);
/* nv04_state_frag.c */
void
-nv04_emit_tex_env(GLcontext *ctx, int emit);
+nv04_emit_tex_env(struct gl_context *ctx, int emit);
/* nv04_state_tex.c */
void
-nv04_emit_tex_obj(GLcontext *ctx, int emit);
+nv04_emit_tex_obj(struct gl_context *ctx, int emit);
#endif
#define NUM_VERTEX_ATTRS 6
static void
-swtnl_update_viewport(GLcontext *ctx)
+swtnl_update_viewport(struct gl_context *ctx)
{
float *viewport = to_nv04_context(ctx)->viewport;
struct gl_framebuffer *fb = ctx->DrawBuffer;
}
static void
-swtnl_emit_attr(GLcontext *ctx, struct tnl_attr_map *m, int attr, int emit)
+swtnl_emit_attr(struct gl_context *ctx, struct tnl_attr_map *m, int attr, int emit)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
static void
-swtnl_choose_attrs(GLcontext *ctx)
+swtnl_choose_attrs(struct gl_context *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct nouveau_grobj *fahrenheit = nv04_context_engine(ctx);
/* TnL renderer entry points */
static void
-swtnl_start(GLcontext *ctx)
+swtnl_start(struct gl_context *ctx)
{
swtnl_choose_attrs(ctx);
}
static void
-swtnl_finish(GLcontext *ctx)
+swtnl_finish(struct gl_context *ctx)
{
FIRE_RING(context_chan(ctx));
}
static void
-swtnl_primitive(GLcontext *ctx, GLenum mode)
+swtnl_primitive(struct gl_context *ctx, GLenum mode)
{
}
static void
-swtnl_reset_stipple(GLcontext *ctx)
+swtnl_reset_stipple(struct gl_context *ctx)
{
}
}
static void
-swtnl_points(GLcontext *ctx, GLuint first, GLuint last)
+swtnl_points(struct gl_context *ctx, GLuint first, GLuint last)
{
}
static void
-swtnl_line(GLcontext *ctx, GLuint v1, GLuint v2)
+swtnl_line(struct gl_context *ctx, GLuint v1, GLuint v2)
{
}
static void
-swtnl_triangle(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3)
+swtnl_triangle(struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3)
{
BEGIN_PRIMITIVE(3);
OUT_VERTEX(v1);
}
static void
-swtnl_quad(GLcontext *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4)
+swtnl_quad(struct gl_context *ctx, GLuint v1, GLuint v2, GLuint v3, GLuint v4)
{
BEGIN_PRIMITIVE(4);
OUT_VERTEX(v1);
/* TnL initialization. */
void
-nv04_render_init(GLcontext *ctx)
+nv04_render_init(struct gl_context *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
void
-nv04_render_destroy(GLcontext *ctx)
+nv04_render_destroy(struct gl_context *ctx)
{
}
}
void
-nv04_emit_framebuffer(GLcontext *ctx, int emit)
+nv04_emit_framebuffer(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
}
void
-nv04_emit_scissor(GLcontext *ctx, int emit)
+nv04_emit_scissor(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ALPHA0
struct combiner_state {
- GLcontext *ctx;
+ struct gl_context *ctx;
int unit;
GLboolean alpha;
GLboolean premodulate;
}
void
-nv04_emit_tex_env(GLcontext *ctx, int emit)
+nv04_emit_tex_env(struct gl_context *ctx, int emit)
{
const int i = emit - NOUVEAU_STATE_TEX_ENV0;
struct nouveau_channel *chan = context_chan(ctx);
}
void
-nv04_defer_control(GLcontext *ctx, int emit)
+nv04_defer_control(struct gl_context *ctx, int emit)
{
context_dirty(ctx, CONTROL);
}
void
-nv04_emit_control(GLcontext *ctx, int emit)
+nv04_emit_control(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *fahrenheit = nv04_context_engine(ctx);
}
void
-nv04_defer_blend(GLcontext *ctx, int emit)
+nv04_defer_blend(struct gl_context *ctx, int emit)
{
context_dirty(ctx, BLEND);
}
void
-nv04_emit_blend(GLcontext *ctx, int emit)
+nv04_emit_blend(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *fahrenheit = nv04_context_engine(ctx);
}
void
-nv04_emit_tex_obj(GLcontext *ctx, int emit)
+nv04_emit_tex_obj(struct gl_context *ctx, int emit)
{
const int i = emit - NOUVEAU_STATE_TEX_OBJ0;
struct nouveau_channel *chan = context_chan(ctx);
}
static void
-nv04_surface_copy_swizzle(GLcontext *ctx,
+nv04_surface_copy_swizzle(struct gl_context *ctx,
struct nouveau_surface *dst,
struct nouveau_surface *src,
int dx, int dy, int sx, int sy,
}
static void
-nv04_surface_copy_m2mf(GLcontext *ctx,
+nv04_surface_copy_m2mf(struct gl_context *ctx,
struct nouveau_surface *dst,
struct nouveau_surface *src,
int dx, int dy, int sx, int sy,
}
static void
-nv04_surface_copy_cpu(GLcontext *ctx,
+nv04_surface_copy_cpu(struct gl_context *ctx,
struct nouveau_surface *dst,
struct nouveau_surface *src,
int dx, int dy, int sx, int sy,
}
void
-nv04_surface_copy(GLcontext *ctx,
+nv04_surface_copy(struct gl_context *ctx,
struct nouveau_surface *dst,
struct nouveau_surface *src,
int dx, int dy, int sx, int sy,
}
void
-nv04_surface_fill(GLcontext *ctx,
+nv04_surface_fill(struct gl_context *ctx,
struct nouveau_surface *dst,
unsigned mask, unsigned value,
int dx, int dy, int w, int h)
}
void
-nv04_surface_takedown(GLcontext *ctx)
+nv04_surface_takedown(struct gl_context *ctx)
{
struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
}
GLboolean
-nv04_surface_init(GLcontext *ctx)
+nv04_surface_init(struct gl_context *ctx)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw;
{ NULL, NULL }
};
+static GLboolean
+use_fast_zclear(struct gl_context *ctx, GLbitfield buffers)
+{
+ struct nouveau_context *nctx = to_nouveau_context(ctx);
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+
+ if (buffers & BUFFER_BIT_STENCIL) {
+ /*
+ * The stencil test is bypassed when fast Z clears are
+ * enabled.
+ */
+ nctx->hierz.clear_blocked = GL_TRUE;
+ context_dirty(ctx, ZCLEAR);
+ return GL_FALSE;
+ }
+
+ return !nctx->hierz.clear_blocked &&
+ fb->_Xmax == fb->Width && fb->_Xmin == 0 &&
+ fb->_Ymax == fb->Height && fb->_Ymin == 0;
+}
+
+GLboolean
+nv10_use_viewport_zclear(struct gl_context *ctx)
+{
+ struct nouveau_context *nctx = to_nouveau_context(ctx);
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+
+ return context_chipset(ctx) < 0x17 &&
+ !nctx->hierz.clear_blocked && fb->_DepthBuffer &&
+ (_mesa_get_format_bits(fb->_DepthBuffer->Format,
+ GL_DEPTH_BITS) >= 24);
+}
+
+float
+nv10_transform_depth(struct gl_context *ctx, float z)
+{
+ struct nouveau_context *nctx = to_nouveau_context(ctx);
+
+ if (nv10_use_viewport_zclear(ctx))
+ return 2097152.0 * (z + (nctx->hierz.clear_seq & 7));
+ else
+ return ctx->DrawBuffer->_DepthMaxF * z;
+}
+
static void
-nv10_clear(GLcontext *ctx, GLbitfield buffers)
+nv10_zclear(struct gl_context *ctx, GLbitfield *buffers)
{
+ /*
+ * Pre-nv17 cards don't have native support for fast Z clears,
+ * but in some cases we can still "clear" the Z buffer without
+ * actually blitting to it if we're willing to sacrifice a few
+ * bits of depth precision.
+ *
+ * Each time a clear is requested we modify the viewport
+ * transform in such a way that the old contents of the depth
+ * buffer are clamped to the requested clear value when
+ * they're read by the GPU.
+ */
+ struct nouveau_context *nctx = to_nouveau_context(ctx);
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+ struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(fb);
+ struct nouveau_surface *s = &to_nouveau_renderbuffer(
+ fb->_DepthBuffer->Wrapped)->surface;
+
+ if (nv10_use_viewport_zclear(ctx)) {
+ int x, y, w, h;
+ float z = ctx->Depth.Clear;
+ uint32_t value = pack_zs_f(s->format, z, 0);
+
+ get_scissors(fb, &x, &y, &w, &h);
+ *buffers &= ~BUFFER_BIT_DEPTH;
+
+ if (use_fast_zclear(ctx, *buffers)) {
+ if (nfb->hierz.clear_value != value) {
+ /* Don't fast clear if we're changing
+ * the depth value. */
+ nfb->hierz.clear_value = value;
+
+ } else if (z == 0.0) {
+ nctx->hierz.clear_seq++;
+ context_dirty(ctx, ZCLEAR);
+
+ if ((nctx->hierz.clear_seq & 7) != 0 &&
+ nctx->hierz.clear_seq != 1)
+ /* We didn't wrap around -- no need to
+ * clear the depth buffer for real. */
+ return;
+
+ } else if (z == 1.0) {
+ nctx->hierz.clear_seq--;
+ context_dirty(ctx, ZCLEAR);
+
+ if ((nctx->hierz.clear_seq & 7) != 7)
+ /* No wrap around */
+ return;
+ }
+ }
+
+ value = pack_zs_f(s->format,
+ (z + (nctx->hierz.clear_seq & 7)) / 8, 0);
+ context_drv(ctx)->surface_fill(ctx, s, ~0, value, x, y, w, h);
+ }
+}
+
+static void
+nv17_zclear(struct gl_context *ctx, GLbitfield *buffers)
+{
+ struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
struct nouveau_framebuffer *nfb = to_nouveau_framebuffer(
ctx->DrawBuffer);
+ struct nouveau_surface *s = &to_nouveau_renderbuffer(
+ nfb->base._DepthBuffer->Wrapped)->surface;
- nouveau_validate_framebuffer(ctx);
+ /* Clear the hierarchical depth buffer */
+ BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_FILL_VALUE, 1);
+ OUT_RING(chan, pack_zs_f(s->format, ctx->Depth.Clear, 0));
+ BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_BUFFER_CLEAR, 1);
+ OUT_RING(chan, 1);
- /* Clear the LMA depth buffer, if present. */
- if ((buffers & BUFFER_BIT_DEPTH) && ctx->Depth.Mask &&
- nfb->lma_bo) {
- struct nouveau_surface *s = &to_nouveau_renderbuffer(
- nfb->base._DepthBuffer->Wrapped)->surface;
+ /* Mark the depth buffer as cleared */
+ if (use_fast_zclear(ctx, *buffers)) {
+ if (nctx->hierz.clear_seq)
+ *buffers &= ~BUFFER_BIT_DEPTH;
- BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_FILL_VALUE, 1);
- OUT_RING(chan, pack_zs_f(s->format, ctx->Depth.Clear, 0));
- BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_BUFFER_CLEAR, 1);
- OUT_RING(chan, 1);
+ nfb->hierz.clear_value =
+ pack_zs_f(s->format, ctx->Depth.Clear, 0);
+ nctx->hierz.clear_seq++;
+
+ context_dirty(ctx, ZCLEAR);
+ }
+}
+
+static void
+nv10_clear(struct gl_context *ctx, GLbitfield buffers)
+{
+ nouveau_validate_framebuffer(ctx);
+
+ if ((buffers & BUFFER_BIT_DEPTH) && ctx->Depth.Mask) {
+ if (context_chipset(ctx) >= 0x17)
+ nv17_zclear(ctx, &buffers);
+ else
+ nv10_zclear(ctx, &buffers);
}
nouveau_clear(ctx, buffers);
}
static void
-nv10_hwctx_init(GLcontext *ctx)
+nv10_hwctx_init(struct gl_context *ctx)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
OUT_RING(chan, 1);
BEGIN_RING(chan, celsius, NV10TCL_DEPTH_RANGE_NEAR, 2);
- OUT_RING(chan, 0.0);
+ OUT_RINGf(chan, 0.0);
OUT_RINGf(chan, 16777216.0);
FIRE_RING(chan);
}
static void
-nv10_context_destroy(GLcontext *ctx)
+nv10_context_destroy(struct gl_context *ctx)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
FREE(ctx);
}
-static GLcontext *
-nv10_context_create(struct nouveau_screen *screen, const GLvisual *visual,
- GLcontext *share_ctx)
+static struct gl_context *
+nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visual,
+ struct gl_context *share_ctx)
{
struct nouveau_context *nctx;
- GLcontext *ctx;
+ struct gl_context *ctx;
unsigned celsius_class;
int ret;
nv10_emit_tex_obj,
nouveau_emit_nothing,
nouveau_emit_nothing,
- nv10_emit_viewport
+ nv10_emit_viewport,
+ nv10_emit_zclear
},
- .num_emit = NUM_NOUVEAU_STATE,
+ .num_emit = NUM_NV10_STATE,
};
#ifndef __NV10_DRIVER_H__
#define __NV10_DRIVER_H__
+enum {
+ NOUVEAU_STATE_ZCLEAR = NUM_NOUVEAU_STATE,
+ NUM_NV10_STATE
+};
+
#define NV10_TEXTURE_UNITS 2
/* nv10_context.c */
extern const struct nouveau_driver nv10_driver;
+GLboolean
+nv10_use_viewport_zclear(struct gl_context *ctx);
+
+float
+nv10_transform_depth(struct gl_context *ctx, float z);
+
/* nv10_render.c */
void
-nv10_render_init(GLcontext *ctx);
+nv10_render_init(struct gl_context *ctx);
void
-nv10_render_destroy(GLcontext *ctx);
+nv10_render_destroy(struct gl_context *ctx);
/* nv10_state_fb.c */
void
-nv10_emit_framebuffer(GLcontext *ctx, int emit);
+nv10_emit_framebuffer(struct gl_context *ctx, int emit);
+
+void
+nv10_emit_render_mode(struct gl_context *ctx, int emit);
void
-nv10_emit_render_mode(GLcontext *ctx, int emit);
+nv10_emit_scissor(struct gl_context *ctx, int emit);
void
-nv10_emit_scissor(GLcontext *ctx, int emit);
+nv10_emit_viewport(struct gl_context *ctx, int emit);
void
-nv10_emit_viewport(GLcontext *ctx, int emit);
+nv10_emit_zclear(struct gl_context *ctx, int emit);
/* nv10_state_polygon.c */
void
-nv10_emit_cull_face(GLcontext *ctx, int emit);
+nv10_emit_cull_face(struct gl_context *ctx, int emit);
void
-nv10_emit_front_face(GLcontext *ctx, int emit);
+nv10_emit_front_face(struct gl_context *ctx, int emit);
void
-nv10_emit_line_mode(GLcontext *ctx, int emit);
+nv10_emit_line_mode(struct gl_context *ctx, int emit);
void
-nv10_emit_line_stipple(GLcontext *ctx, int emit);
+nv10_emit_line_stipple(struct gl_context *ctx, int emit);
void
-nv10_emit_point_mode(GLcontext *ctx, int emit);
+nv10_emit_point_mode(struct gl_context *ctx, int emit);
void
-nv10_emit_polygon_mode(GLcontext *ctx, int emit);
+nv10_emit_polygon_mode(struct gl_context *ctx, int emit);
void
-nv10_emit_polygon_offset(GLcontext *ctx, int emit);
+nv10_emit_polygon_offset(struct gl_context *ctx, int emit);
void
-nv10_emit_polygon_stipple(GLcontext *ctx, int emit);
+nv10_emit_polygon_stipple(struct gl_context *ctx, int emit);
/* nv10_state_raster.c */
void
-nv10_emit_alpha_func(GLcontext *ctx, int emit);
+nv10_emit_alpha_func(struct gl_context *ctx, int emit);
void
-nv10_emit_blend_color(GLcontext *ctx, int emit);
+nv10_emit_blend_color(struct gl_context *ctx, int emit);
void
-nv10_emit_blend_equation(GLcontext *ctx, int emit);
+nv10_emit_blend_equation(struct gl_context *ctx, int emit);
void
-nv10_emit_blend_func(GLcontext *ctx, int emit);
+nv10_emit_blend_func(struct gl_context *ctx, int emit);
void
-nv10_emit_color_mask(GLcontext *ctx, int emit);
+nv10_emit_color_mask(struct gl_context *ctx, int emit);
void
-nv10_emit_depth(GLcontext *ctx, int emit);
+nv10_emit_depth(struct gl_context *ctx, int emit);
void
-nv10_emit_dither(GLcontext *ctx, int emit);
+nv10_emit_dither(struct gl_context *ctx, int emit);
void
-nv10_emit_logic_opcode(GLcontext *ctx, int emit);
+nv10_emit_logic_opcode(struct gl_context *ctx, int emit);
void
-nv10_emit_shade_model(GLcontext *ctx, int emit);
+nv10_emit_shade_model(struct gl_context *ctx, int emit);
void
-nv10_emit_stencil_func(GLcontext *ctx, int emit);
+nv10_emit_stencil_func(struct gl_context *ctx, int emit);
void
-nv10_emit_stencil_mask(GLcontext *ctx, int emit);
+nv10_emit_stencil_mask(struct gl_context *ctx, int emit);
void
-nv10_emit_stencil_op(GLcontext *ctx, int emit);
+nv10_emit_stencil_op(struct gl_context *ctx, int emit);
/* nv10_state_frag.c */
void
-nv10_get_general_combiner(GLcontext *ctx, int i,
+nv10_get_general_combiner(struct gl_context *ctx, int i,
uint32_t *a_in, uint32_t *a_out,
uint32_t *c_in, uint32_t *c_out, uint32_t *k);
void
-nv10_get_final_combiner(GLcontext *ctx, uint64_t *in, int *n);
+nv10_get_final_combiner(struct gl_context *ctx, uint64_t *in, int *n);
void
-nv10_emit_tex_env(GLcontext *ctx, int emit);
+nv10_emit_tex_env(struct gl_context *ctx, int emit);
void
-nv10_emit_frag(GLcontext *ctx, int emit);
+nv10_emit_frag(struct gl_context *ctx, int emit);
/* nv10_state_tex.c */
void
-nv10_emit_tex_gen(GLcontext *ctx, int emit);
+nv10_emit_tex_gen(struct gl_context *ctx, int emit);
void
-nv10_emit_tex_mat(GLcontext *ctx, int emit);
+nv10_emit_tex_mat(struct gl_context *ctx, int emit);
void
-nv10_emit_tex_obj(GLcontext *ctx, int emit);
+nv10_emit_tex_obj(struct gl_context *ctx, int emit);
/* nv10_state_tnl.c */
void
-nv10_get_fog_coeff(GLcontext *ctx, float k[3]);
+nv10_get_fog_coeff(struct gl_context *ctx, float k[3]);
void
nv10_get_spot_coeff(struct gl_light *l, float k[7]);
nv10_get_shininess_coeff(float s, float k[6]);
void
-nv10_emit_clip_plane(GLcontext *ctx, int emit);
+nv10_emit_clip_plane(struct gl_context *ctx, int emit);
void
-nv10_emit_color_material(GLcontext *ctx, int emit);
+nv10_emit_color_material(struct gl_context *ctx, int emit);
void
-nv10_emit_fog(GLcontext *ctx, int emit);
+nv10_emit_fog(struct gl_context *ctx, int emit);
void
-nv10_emit_light_enable(GLcontext *ctx, int emit);
+nv10_emit_light_enable(struct gl_context *ctx, int emit);
void
-nv10_emit_light_model(GLcontext *ctx, int emit);
+nv10_emit_light_model(struct gl_context *ctx, int emit);
void
-nv10_emit_light_source(GLcontext *ctx, int emit);
+nv10_emit_light_source(struct gl_context *ctx, int emit);
void
-nv10_emit_material_ambient(GLcontext *ctx, int emit);
+nv10_emit_material_ambient(struct gl_context *ctx, int emit);
void
-nv10_emit_material_diffuse(GLcontext *ctx, int emit);
+nv10_emit_material_diffuse(struct gl_context *ctx, int emit);
void
-nv10_emit_material_specular(GLcontext *ctx, int emit);
+nv10_emit_material_specular(struct gl_context *ctx, int emit);
void
-nv10_emit_material_shininess(GLcontext *ctx, int emit);
+nv10_emit_material_shininess(struct gl_context *ctx, int emit);
void
-nv10_emit_modelview(GLcontext *ctx, int emit);
+nv10_emit_modelview(struct gl_context *ctx, int emit);
void
-nv10_emit_point_parameter(GLcontext *ctx, int emit);
+nv10_emit_point_parameter(struct gl_context *ctx, int emit);
void
-nv10_emit_projection(GLcontext *ctx, int emit);
+nv10_emit_projection(struct gl_context *ctx, int emit);
#endif
#define NUM_VERTEX_ATTRS 8
static void
-nv10_emit_material(GLcontext *ctx, struct nouveau_array_state *a,
+nv10_emit_material(struct gl_context *ctx, struct nouveau_array_state *a,
const void *v);
/* Vertex attribute format. */
}
static void
-nv10_render_set_format(GLcontext *ctx)
+nv10_render_set_format(struct gl_context *ctx)
{
struct nouveau_render_state *render = to_render_state(ctx);
struct nouveau_channel *chan = context_chan(ctx);
}
static void
-nv10_render_bind_vertices(GLcontext *ctx)
+nv10_render_bind_vertices(struct gl_context *ctx)
{
struct nouveau_render_state *render = to_render_state(ctx);
struct nouveau_bo_context *bctx = context_bctx(ctx, VERTEX);
#define BATCH_BEGIN(prim) \
BEGIN_RING(chan, celsius, NV10TCL_VERTEX_BUFFER_BEGIN_END, 1); \
- OUT_RING(chan, prim);
+ OUT_RING(chan, prim)
#define BATCH_END() \
BEGIN_RING(chan, celsius, NV10TCL_VERTEX_BUFFER_BEGIN_END, 1); \
- OUT_RING(chan, 0);
+ OUT_RING(chan, 0)
#define MAX_PACKET 0x400
#define MAX_OUT_L 0x100
#define BATCH_PACKET_L(n) \
- BEGIN_RING_NI(chan, celsius, NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS, n);
+ BEGIN_RING_NI(chan, celsius, NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS, n)
#define BATCH_OUT_L(i, n) \
- OUT_RING(chan, ((n) - 1) << 24 | (i));
+ OUT_RING(chan, ((n) - 1) << 24 | (i))
#define MAX_OUT_I16 0x2
#define BATCH_PACKET_I16(n) \
- BEGIN_RING_NI(chan, celsius, NV10TCL_VB_ELEMENT_U16, n);
+ BEGIN_RING_NI(chan, celsius, NV10TCL_VB_ELEMENT_U16, n)
#define BATCH_OUT_I16(i0, i1) \
- OUT_RING(chan, (i1) << 16 | (i0));
+ OUT_RING(chan, (i1) << 16 | (i0))
#define MAX_OUT_I32 0x1
#define BATCH_PACKET_I32(n) \
- BEGIN_RING_NI(chan, celsius, NV10TCL_VB_ELEMENT_U32, n);
+ BEGIN_RING_NI(chan, celsius, NV10TCL_VB_ELEMENT_U32, n)
#define BATCH_OUT_I32(i) \
- OUT_RING(chan, i);
+ OUT_RING(chan, i)
#define IMM_PACKET(m, n) \
- BEGIN_RING(chan, celsius, m, n);
+ BEGIN_RING(chan, celsius, m, n)
#define IMM_OUT(x) \
- OUT_RINGf(chan, x);
+ OUT_RINGf(chan, x)
#define TAG(x) nv10_##x
#include "nouveau_render_t.c"
}
static void
-setup_lma_buffer(GLcontext *ctx)
+setup_lma_buffer(struct gl_context *ctx)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
height = align(fb->Height, 2),
size = pitch * height;
- if (!nfb->lma_bo || nfb->lma_bo->size != size) {
- nouveau_bo_ref(NULL, &nfb->lma_bo);
- nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_VRAM, 0, size,
- &nfb->lma_bo);
+ if (!nfb->hierz.bo || nfb->hierz.bo->size != size) {
+ nouveau_bo_ref(NULL, &nfb->hierz.bo);
+ nouveau_bo_new_tile(context_dev(ctx), NOUVEAU_BO_VRAM, 0, size,
+ 0, NOUVEAU_BO_TILE_ZETA, &nfb->hierz.bo);
}
nouveau_bo_markl(bctx, celsius, NV17TCL_LMA_DEPTH_BUFFER_OFFSET,
- nfb->lma_bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
+ nfb->hierz.bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
WAIT_RING(chan, 9);
BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_WINDOW_X, 4);
}
void
-nv10_emit_framebuffer(GLcontext *ctx, int emit)
+nv10_emit_framebuffer(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
nouveau_bo_markl(bctx, celsius, NV10TCL_ZETA_OFFSET,
s->bo, 0, bo_flags);
- if (context_chipset(ctx) >= 0x17)
+ if (context_chipset(ctx) >= 0x17) {
setup_lma_buffer(ctx);
+ context_dirty(ctx, ZCLEAR);
+ }
}
BEGIN_RING(chan, celsius, NV10TCL_RT_FORMAT, 2);
}
void
-nv10_emit_render_mode(GLcontext *ctx, int emit)
+nv10_emit_render_mode(struct gl_context *ctx, int emit)
{
}
void
-nv10_emit_scissor(GLcontext *ctx, int emit)
+nv10_emit_scissor(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_viewport(GLcontext *ctx, int emit)
+nv10_emit_viewport(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
+ struct gl_viewport_attrib *vp = &ctx->Viewport;
struct gl_framebuffer *fb = ctx->DrawBuffer;
float a[4] = {};
get_viewport_translate(ctx, a);
a[0] -= 2048;
a[1] -= 2048;
+ if (nv10_use_viewport_zclear(ctx))
+ a[2] = nv10_transform_depth(ctx, (vp->Far + vp->Near) / 2);
BEGIN_RING(chan, celsius, NV10TCL_VIEWPORT_TRANSLATE_X, 4);
OUT_RINGp(chan, a, 4);
context_dirty(ctx, PROJECTION);
}
+
+void
+nv10_emit_zclear(struct gl_context *ctx, int emit)
+{
+ struct nouveau_context *nctx = to_nouveau_context(ctx);
+ struct nouveau_channel *chan = context_chan(ctx);
+ struct nouveau_grobj *celsius = context_eng3d(ctx);
+ struct nouveau_framebuffer *nfb =
+ to_nouveau_framebuffer(ctx->DrawBuffer);
+
+ if (nfb->hierz.bo) {
+ BEGIN_RING(chan, celsius, NV17TCL_ZCLEAR_ENABLE, 2);
+ OUT_RING(chan, nctx->hierz.clear_blocked ? 0 : 1);
+ OUT_RING(chan, nfb->hierz.clear_value |
+ (nctx->hierz.clear_seq & 0xff));
+ } else {
+ BEGIN_RING(chan, celsius, NV10TCL_DEPTH_RANGE_NEAR, 2);
+ OUT_RINGf(chan, nv10_transform_depth(ctx, 0));
+ OUT_RINGf(chan, nv10_transform_depth(ctx, 1));
+ context_dirty(ctx, VIEWPORT);
+ }
+}
#define RC_OUT_SUM NV10TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE0
struct combiner_state {
- GLcontext *ctx;
+ struct gl_context *ctx;
int unit;
GLboolean premodulate;
}
void
-nv10_get_general_combiner(GLcontext *ctx, int i,
+nv10_get_general_combiner(struct gl_context *ctx, int i,
uint32_t *a_in, uint32_t *a_out,
uint32_t *c_in, uint32_t *c_out, uint32_t *k)
{
}
void
-nv10_get_final_combiner(GLcontext *ctx, uint64_t *in, int *n)
+nv10_get_final_combiner(struct gl_context *ctx, uint64_t *in, int *n)
{
struct combiner_state rc = {};
}
void
-nv10_emit_tex_env(GLcontext *ctx, int emit)
+nv10_emit_tex_env(struct gl_context *ctx, int emit)
{
const int i = emit - NOUVEAU_STATE_TEX_ENV0;
struct nouveau_channel *chan = context_chan(ctx);
}
void
-nv10_emit_frag(GLcontext *ctx, int emit)
+nv10_emit_frag(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
#include "nv10_driver.h"
void
-nv10_emit_cull_face(GLcontext *ctx, int emit)
+nv10_emit_cull_face(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_front_face(GLcontext *ctx, int emit)
+nv10_emit_front_face(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_line_mode(GLcontext *ctx, int emit)
+nv10_emit_line_mode(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_line_stipple(GLcontext *ctx, int emit)
+nv10_emit_line_stipple(struct gl_context *ctx, int emit)
{
}
void
-nv10_emit_point_mode(GLcontext *ctx, int emit)
+nv10_emit_point_mode(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_polygon_mode(GLcontext *ctx, int emit)
+nv10_emit_polygon_mode(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_polygon_offset(GLcontext *ctx, int emit)
+nv10_emit_polygon_offset(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_polygon_stipple(GLcontext *ctx, int emit)
+nv10_emit_polygon_stipple(struct gl_context *ctx, int emit)
{
}
#include "nv10_driver.h"
void
-nv10_emit_alpha_func(GLcontext *ctx, int emit)
+nv10_emit_alpha_func(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_blend_color(GLcontext *ctx, int emit)
+nv10_emit_blend_color(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_blend_equation(GLcontext *ctx, int emit)
+nv10_emit_blend_equation(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_blend_func(GLcontext *ctx, int emit)
+nv10_emit_blend_func(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_color_mask(GLcontext *ctx, int emit)
+nv10_emit_color_mask(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_depth(GLcontext *ctx, int emit)
+nv10_emit_depth(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_dither(GLcontext *ctx, int emit)
+nv10_emit_dither(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_logic_opcode(GLcontext *ctx, int emit)
+nv10_emit_logic_opcode(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_shade_model(GLcontext *ctx, int emit)
+nv10_emit_shade_model(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_stencil_func(GLcontext *ctx, int emit)
+nv10_emit_stencil_func(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_stencil_mask(GLcontext *ctx, int emit)
+nv10_emit_stencil_mask(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_stencil_op(GLcontext *ctx, int emit)
+nv10_emit_stencil_op(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
#define TX_MATRIX(i) (NV10TCL_TX0_MATRIX(0) + 64 * (i))
void
-nv10_emit_tex_gen(GLcontext *ctx, int emit)
+nv10_emit_tex_gen(struct gl_context *ctx, int emit)
{
const int i = emit - NOUVEAU_STATE_TEX_GEN0;
struct nouveau_context *nctx = to_nouveau_context(ctx);
}
void
-nv10_emit_tex_mat(GLcontext *ctx, int emit)
+nv10_emit_tex_mat(struct gl_context *ctx, int emit)
{
const int i = emit - NOUVEAU_STATE_TEX_MAT0;
struct nouveau_context *nctx = to_nouveau_context(ctx);
}
void
-nv10_emit_tex_obj(GLcontext *ctx, int emit)
+nv10_emit_tex_obj(struct gl_context *ctx, int emit)
{
const int i = emit - NOUVEAU_STATE_TEX_OBJ0;
struct nouveau_channel *chan = context_chan(ctx);
#include "nv10_driver.h"
void
-nv10_emit_clip_plane(GLcontext *ctx, int emit)
+nv10_emit_clip_plane(struct gl_context *ctx, int emit)
{
}
}
void
-nv10_emit_color_material(GLcontext *ctx, int emit)
+nv10_emit_color_material(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_get_fog_coeff(GLcontext *ctx, float k[3])
+nv10_get_fog_coeff(struct gl_context *ctx, float k[3])
{
struct gl_fog_attrib *f = &ctx->Fog;
}
void
-nv10_emit_fog(GLcontext *ctx, int emit)
+nv10_emit_fog(struct gl_context *ctx, int emit)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_channel *chan = context_chan(ctx);
}
void
-nv10_emit_light_enable(GLcontext *ctx, int emit)
+nv10_emit_light_enable(struct gl_context *ctx, int emit)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_channel *chan = context_chan(ctx);
}
void
-nv10_emit_light_model(GLcontext *ctx, int emit)
+nv10_emit_light_model(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_light_source(GLcontext *ctx, int emit)
+nv10_emit_light_source(struct gl_context *ctx, int emit)
{
const int i = emit - NOUVEAU_STATE_LIGHT_SOURCE0;
struct nouveau_channel *chan = context_chan(ctx);
ctx->Light.ColorMaterialBitmask & (1 << MAT_ATTRIB_FRONT_##attr))
void
-nv10_emit_material_ambient(GLcontext *ctx, int emit)
+nv10_emit_material_ambient(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_material_diffuse(GLcontext *ctx, int emit)
+nv10_emit_material_diffuse(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_material_specular(GLcontext *ctx, int emit)
+nv10_emit_material_specular(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_material_shininess(GLcontext *ctx, int emit)
+nv10_emit_material_shininess(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *celsius = context_eng3d(ctx);
}
void
-nv10_emit_modelview(GLcontext *ctx, int emit)
+nv10_emit_modelview(struct gl_context *ctx, int emit)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_channel *chan = context_chan(ctx);
}
void
-nv10_emit_point_parameter(GLcontext *ctx, int emit)
+nv10_emit_point_parameter(struct gl_context *ctx, int emit)
{
}
void
-nv10_emit_projection(GLcontext *ctx, int emit)
+nv10_emit_projection(struct gl_context *ctx, int emit)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_channel *chan = context_chan(ctx);
_math_matrix_ctr(&m);
get_viewport_scale(ctx, m.m);
+ if (nv10_use_viewport_zclear(ctx))
+ m.m[MAT_SZ] /= 8;
+
if (nctx->fallback == HWTNL)
_math_matrix_mul_matrix(&m, &m, &ctx->_ModelProjectMatrix);
};
static void
-nv20_hwctx_init(GLcontext *ctx)
+nv20_hwctx_init(struct gl_context *ctx)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
}
static void
-nv20_context_destroy(GLcontext *ctx)
+nv20_context_destroy(struct gl_context *ctx)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
FREE(ctx);
}
-static GLcontext *
-nv20_context_create(struct nouveau_screen *screen, const GLvisual *visual,
- GLcontext *share_ctx)
+static struct gl_context *
+nv20_context_create(struct nouveau_screen *screen, const struct gl_config *visual,
+ struct gl_context *share_ctx)
{
struct nouveau_context *nctx;
- GLcontext *ctx;
+ struct gl_context *ctx;
unsigned kelvin_class;
int ret;
/* nv20_render.c */
void
-nv20_render_init(GLcontext *ctx);
+nv20_render_init(struct gl_context *ctx);
void
-nv20_render_destroy(GLcontext *ctx);
+nv20_render_destroy(struct gl_context *ctx);
/* nv20_state_fb.c */
void
-nv20_emit_framebuffer(GLcontext *ctx, int emit);
+nv20_emit_framebuffer(struct gl_context *ctx, int emit);
void
-nv20_emit_viewport(GLcontext *ctx, int emit);
+nv20_emit_viewport(struct gl_context *ctx, int emit);
/* nv20_state_polygon.c */
void
-nv20_emit_point_mode(GLcontext *ctx, int emit);
+nv20_emit_point_mode(struct gl_context *ctx, int emit);
/* nv20_state_raster.c */
void
-nv20_emit_logic_opcode(GLcontext *ctx, int emit);
+nv20_emit_logic_opcode(struct gl_context *ctx, int emit);
/* nv20_state_frag.c */
void
-nv20_emit_tex_env(GLcontext *ctx, int emit);
+nv20_emit_tex_env(struct gl_context *ctx, int emit);
void
-nv20_emit_frag(GLcontext *ctx, int emit);
+nv20_emit_frag(struct gl_context *ctx, int emit);
/* nv20_state_tex.c */
void
-nv20_emit_tex_gen(GLcontext *ctx, int emit);
+nv20_emit_tex_gen(struct gl_context *ctx, int emit);
void
-nv20_emit_tex_mat(GLcontext *ctx, int emit);
+nv20_emit_tex_mat(struct gl_context *ctx, int emit);
void
-nv20_emit_tex_obj(GLcontext *ctx, int emit);
+nv20_emit_tex_obj(struct gl_context *ctx, int emit);
void
-nv20_emit_tex_shader(GLcontext *ctx, int emit);
+nv20_emit_tex_shader(struct gl_context *ctx, int emit);
/* nv20_state_tnl.c */
void
-nv20_emit_clip_plane(GLcontext *ctx, int emit);
+nv20_emit_clip_plane(struct gl_context *ctx, int emit);
void
-nv20_emit_color_material(GLcontext *ctx, int emit);
+nv20_emit_color_material(struct gl_context *ctx, int emit);
void
-nv20_emit_fog(GLcontext *ctx, int emit);
+nv20_emit_fog(struct gl_context *ctx, int emit);
void
-nv20_emit_light_model(GLcontext *ctx, int emit);
+nv20_emit_light_model(struct gl_context *ctx, int emit);
void
-nv20_emit_light_source(GLcontext *ctx, int emit);
+nv20_emit_light_source(struct gl_context *ctx, int emit);
void
-nv20_emit_material_ambient(GLcontext *ctx, int emit);
+nv20_emit_material_ambient(struct gl_context *ctx, int emit);
void
-nv20_emit_material_diffuse(GLcontext *ctx, int emit);
+nv20_emit_material_diffuse(struct gl_context *ctx, int emit);
void
-nv20_emit_material_specular(GLcontext *ctx, int emit);
+nv20_emit_material_specular(struct gl_context *ctx, int emit);
void
-nv20_emit_material_shininess(GLcontext *ctx, int emit);
+nv20_emit_material_shininess(struct gl_context *ctx, int emit);
void
-nv20_emit_modelview(GLcontext *ctx, int emit);
+nv20_emit_modelview(struct gl_context *ctx, int emit);
void
-nv20_emit_projection(GLcontext *ctx, int emit);
+nv20_emit_projection(struct gl_context *ctx, int emit);
#endif
#define NUM_VERTEX_ATTRS 16
static void
-nv20_emit_material(GLcontext *ctx, struct nouveau_array_state *a,
+nv20_emit_material(struct gl_context *ctx, struct nouveau_array_state *a,
const void *v);
/* Vertex attribute format. */
}
static void
-nv20_render_set_format(GLcontext *ctx)
+nv20_render_set_format(struct gl_context *ctx)
{
struct nouveau_render_state *render = to_render_state(ctx);
struct nouveau_channel *chan = context_chan(ctx);
}
static void
-nv20_render_bind_vertices(GLcontext *ctx)
+nv20_render_bind_vertices(struct gl_context *ctx)
{
struct nouveau_render_state *render = to_render_state(ctx);
struct nouveau_bo_context *bctx = context_bctx(ctx, VERTEX);
#define BATCH_BEGIN(prim) \
BEGIN_RING(chan, kelvin, NV20TCL_VERTEX_BEGIN_END, 1); \
- OUT_RING(chan, prim);
+ OUT_RING(chan, prim)
#define BATCH_END() \
BEGIN_RING(chan, kelvin, NV20TCL_VERTEX_BEGIN_END, 1); \
- OUT_RING(chan, 0);
+ OUT_RING(chan, 0)
#define MAX_PACKET 0x400
#define MAX_OUT_L 0x100
#define BATCH_PACKET_L(n) \
- BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_VERTEX_BATCH, n);
+ BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_VERTEX_BATCH, n)
#define BATCH_OUT_L(i, n) \
- OUT_RING(chan, ((n) - 1) << 24 | (i));
+ OUT_RING(chan, ((n) - 1) << 24 | (i))
#define MAX_OUT_I16 0x2
#define BATCH_PACKET_I16(n) \
- BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_ELEMENT_U16, n);
+ BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_ELEMENT_U16, n)
#define BATCH_OUT_I16(i0, i1) \
- OUT_RING(chan, (i1) << 16 | (i0));
+ OUT_RING(chan, (i1) << 16 | (i0))
#define MAX_OUT_I32 0x1
#define BATCH_PACKET_I32(n) \
- BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_ELEMENT_U32, n);
+ BEGIN_RING_NI(chan, kelvin, NV20TCL_VB_ELEMENT_U32, n)
#define BATCH_OUT_I32(i) \
- OUT_RING(chan, i);
+ OUT_RING(chan, i)
#define IMM_PACKET(m, n) \
- BEGIN_RING(chan, kelvin, m, n);
+ BEGIN_RING(chan, kelvin, m, n)
#define IMM_OUT(x) \
- OUT_RINGf(chan, x);
+ OUT_RINGf(chan, x)
#define TAG(x) nv20_##x
#include "nouveau_render_t.c"
}
void
-nv20_emit_framebuffer(GLcontext *ctx, int emit)
+nv20_emit_framebuffer(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
}
void
-nv20_emit_viewport(GLcontext *ctx, int emit)
+nv20_emit_viewport(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
#include "nv20_driver.h"
void
-nv20_emit_tex_env(GLcontext *ctx, int emit)
+nv20_emit_tex_env(struct gl_context *ctx, int emit)
{
const int i = emit - NOUVEAU_STATE_TEX_ENV0;
struct nouveau_channel *chan = context_chan(ctx);
}
void
-nv20_emit_frag(GLcontext *ctx, int emit)
+nv20_emit_frag(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
#include "nv20_driver.h"
void
-nv20_emit_point_mode(GLcontext *ctx, int emit)
+nv20_emit_point_mode(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
#include "nv20_driver.h"
void
-nv20_emit_logic_opcode(GLcontext *ctx, int emit)
+nv20_emit_logic_opcode(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
#define TX_MATRIX(i) (NV20TCL_TX0_MATRIX(0) + 64 * (i))
void
-nv20_emit_tex_gen(GLcontext *ctx, int emit)
+nv20_emit_tex_gen(struct gl_context *ctx, int emit)
{
const int i = emit - NOUVEAU_STATE_TEX_GEN0;
struct nouveau_context *nctx = to_nouveau_context(ctx);
}
void
-nv20_emit_tex_mat(GLcontext *ctx, int emit)
+nv20_emit_tex_mat(struct gl_context *ctx, int emit)
{
const int i = emit - NOUVEAU_STATE_TEX_MAT0;
struct nouveau_context *nctx = to_nouveau_context(ctx);
}
void
-nv20_emit_tex_obj(GLcontext *ctx, int emit)
+nv20_emit_tex_obj(struct gl_context *ctx, int emit)
{
const int i = emit - NOUVEAU_STATE_TEX_OBJ0;
struct nouveau_channel *chan = context_chan(ctx);
}
void
-nv20_emit_tex_shader(GLcontext *ctx, int emit)
+nv20_emit_tex_shader(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
NV20TCL_FRONT_MATERIAL_SHININESS(0))
void
-nv20_emit_clip_plane(GLcontext *ctx, int emit)
+nv20_emit_clip_plane(struct gl_context *ctx, int emit)
{
}
}
void
-nv20_emit_color_material(GLcontext *ctx, int emit)
+nv20_emit_color_material(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
}
void
-nv20_emit_fog(GLcontext *ctx, int emit)
+nv20_emit_fog(struct gl_context *ctx, int emit)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_channel *chan = context_chan(ctx);
}
void
-nv20_emit_light_model(GLcontext *ctx, int emit)
+nv20_emit_light_model(struct gl_context *ctx, int emit)
{
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
}
void
-nv20_emit_light_source(GLcontext *ctx, int emit)
+nv20_emit_light_source(struct gl_context *ctx, int emit)
{
const int i = emit - NOUVEAU_STATE_LIGHT_SOURCE0;
struct nouveau_channel *chan = context_chan(ctx);
ctx->Light.ColorMaterialBitmask & (1 << MAT_ATTRIB_##attr(side)))
void
-nv20_emit_material_ambient(GLcontext *ctx, int emit)
+nv20_emit_material_ambient(struct gl_context *ctx, int emit)
{
const int side = emit - NOUVEAU_STATE_MATERIAL_FRONT_AMBIENT;
struct nouveau_channel *chan = context_chan(ctx);
}
void
-nv20_emit_material_diffuse(GLcontext *ctx, int emit)
+nv20_emit_material_diffuse(struct gl_context *ctx, int emit)
{
const int side = emit - NOUVEAU_STATE_MATERIAL_FRONT_DIFFUSE;
struct nouveau_channel *chan = context_chan(ctx);
}
void
-nv20_emit_material_specular(GLcontext *ctx, int emit)
+nv20_emit_material_specular(struct gl_context *ctx, int emit)
{
const int side = emit - NOUVEAU_STATE_MATERIAL_FRONT_SPECULAR;
struct nouveau_channel *chan = context_chan(ctx);
}
void
-nv20_emit_material_shininess(GLcontext *ctx, int emit)
+nv20_emit_material_shininess(struct gl_context *ctx, int emit)
{
const int side = emit - NOUVEAU_STATE_MATERIAL_FRONT_SHININESS;
struct nouveau_channel *chan = context_chan(ctx);
}
void
-nv20_emit_modelview(GLcontext *ctx, int emit)
+nv20_emit_modelview(struct gl_context *ctx, int emit)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_channel *chan = context_chan(ctx);
}
void
-nv20_emit_projection(GLcontext *ctx, int emit)
+nv20_emit_projection(struct gl_context *ctx, int emit)
{
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_channel *chan = context_chan(ctx);
/* Create the device specific context.
*/
GLboolean r128CreateContext( gl_api api,
- const __GLcontextModes *glVisual,
+ const struct gl_config *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{
- GLcontext *ctx, *shareCtx;
+ struct gl_context *ctx, *shareCtx;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
struct dd_function_table functions;
r128ContextPtr rmesa;
newR128Ctx->driDrawable = driDrawPriv;
_mesa_make_current( newR128Ctx->glCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
+ (struct gl_framebuffer *) driDrawPriv->driverPrivate,
+ (struct gl_framebuffer *) driReadPriv->driverPrivate );
newR128Ctx->new_state |= R128_NEW_WINDOW | R128_NEW_CLIP;
} else {
struct r128_context {
- GLcontext *glCtx; /* Mesa context */
+ struct gl_context *glCtx; /* Mesa context */
/* Driver and hardware state management
*/
extern GLboolean r128CreateContext( gl_api api,
- const __GLcontextModes *glVisual,
+ const struct gl_config *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate );
/* Return the width and height of the current color buffer.
*/
-static void r128GetBufferSize( GLframebuffer *buffer,
+static void r128GetBufferSize( struct gl_framebuffer *buffer,
GLuint *width, GLuint *height )
{
GET_CURRENT_CONTEXT(ctx);
/* Return various strings for glGetString().
*/
-static const GLubyte *r128GetString( GLcontext *ctx, GLenum name )
+static const GLubyte *r128GetString( struct gl_context *ctx, GLenum name )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
static char buffer[128];
* hardware. All commands that are normally sent to the ring are
* already considered `flushed'.
*/
-static void r128Flush( GLcontext *ctx )
+static void r128Flush( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
/* Make sure all commands have been sent to the hardware and have
* completed processing.
*/
-static void r128Finish( GLcontext *ctx )
+static void r128Finish( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
* Buffer clear
*/
-static void r128Clear( GLcontext *ctx, GLbitfield mask )
+static void r128Clear( struct gl_context *ctx, GLbitfield mask )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
__DRIdrawable *dPriv = rmesa->driDrawable;
static GLboolean
r128CreateBuffer( __DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
GLboolean isPixmap )
{
r128ScreenPtr screen = (r128ScreenPtr) driScrnPriv->private;
static void
r128DestroyBuffer(__DRIdrawable *driDrawPriv)
{
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
+ _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
r128ContextPtr rmesa;
- GLcontext *ctx;
+ struct gl_context *ctx;
rmesa = (r128ContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = rmesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
unsigned stencil_bits, GLboolean have_back_buffer )
{
__DRIconfig **configs;
- __GLcontextModes * m;
+ struct gl_config * m;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
GLenum fb_format;
*
* \todo maybe fold this into intelInitDriver
*
- * \return the __GLcontextModes supported by this driver
+ * \return the struct gl_config supported by this driver
*/
static const __DRIconfig **
r128InitScreen(__DRIscreen *psp)
#include "stenciltmp.h"
static void
-r128SpanRenderStart( GLcontext *ctx )
+r128SpanRenderStart( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
FLUSH_BATCH(rmesa);
}
static void
-r128SpanRenderFinish( GLcontext *ctx )
+r128SpanRenderFinish( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
_swrast_flush( ctx );
UNLOCK_HARDWARE( rmesa );
}
-void r128DDInitSpanFuncs( GLcontext *ctx )
+void r128DDInitSpanFuncs( struct gl_context *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
swdd->SpanRenderStart = r128SpanRenderStart;
* Plug in the Get/Put routines for the given driRenderbuffer.
*/
void
-r128SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
+r128SetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis)
{
if (drb->Base.Format == MESA_FORMAT_RGB565) {
r128InitPointers_RGB565(&drb->Base);
#include "drirenderbuffer.h"
-extern void r128DDInitSpanFuncs( GLcontext *ctx );
+extern void r128DDInitSpanFuncs( struct gl_context *ctx );
extern void
-r128SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
+r128SetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis);
#endif
}
-static void r128UpdateAlphaMode( GLcontext *ctx )
+static void r128UpdateAlphaMode( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint a = rmesa->setup.misc_3d_state_cntl_reg;
}
}
-static void r128DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
+static void r128DDAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
rmesa->new_state |= R128_NEW_ALPHA;
}
-static void r128DDBlendEquationSeparate( GLcontext *ctx,
+static void r128DDBlendEquationSeparate( struct gl_context *ctx,
GLenum modeRGB, GLenum modeA )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
rmesa->new_state |= R128_NEW_ALPHA;
}
-static void r128DDBlendFuncSeparate( GLcontext *ctx,
+static void r128DDBlendFuncSeparate( struct gl_context *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
{
*/
static void
-r128DDStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func,
+r128DDStencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func,
GLint ref, GLuint mask )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
}
static void
-r128DDStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask )
+r128DDStencilMaskSeparate( struct gl_context *ctx, GLenum face, GLuint mask )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint refmask = (((ctx->Stencil.Ref[0] & 0xff) << 0) |
}
}
-static void r128DDStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail,
+static void r128DDStencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum fail,
GLenum zfail, GLenum zpass )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
}
}
-static void r128DDClearStencil( GLcontext *ctx, GLint s )
+static void r128DDClearStencil( struct gl_context *ctx, GLint s )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
* Depth testing
*/
-static void r128UpdateZMode( GLcontext *ctx )
+static void r128UpdateZMode( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint z = rmesa->setup.z_sten_cntl_c;
}
}
-static void r128DDDepthFunc( GLcontext *ctx, GLenum func )
+static void r128DDDepthFunc( struct gl_context *ctx, GLenum func )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
rmesa->new_state |= R128_NEW_DEPTH;
}
-static void r128DDDepthMask( GLcontext *ctx, GLboolean flag )
+static void r128DDDepthMask( struct gl_context *ctx, GLboolean flag )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
rmesa->new_state |= R128_NEW_DEPTH;
}
-static void r128DDClearDepth( GLcontext *ctx, GLclampd d )
+static void r128DDClearDepth( struct gl_context *ctx, GLclampd d )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
* Fog
*/
-static void r128UpdateFogAttrib( GLcontext *ctx )
+static void r128UpdateFogAttrib( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint t = rmesa->setup.tex_cntl_c;
}
}
-static void r128DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
+static void r128DDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
* Clipping
*/
-static void r128UpdateClipping( GLcontext *ctx )
+static void r128UpdateClipping( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
}
}
-static void r128DDScissor( GLcontext *ctx,
+static void r128DDScissor( struct gl_context *ctx,
GLint x, GLint y, GLsizei w, GLsizei h )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
* Culling
*/
-static void r128UpdateCull( GLcontext *ctx )
+static void r128UpdateCull( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint f = rmesa->setup.pm4_vc_fpu_setup;
}
}
-static void r128DDCullFace( GLcontext *ctx, GLenum mode )
+static void r128DDCullFace( struct gl_context *ctx, GLenum mode )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
rmesa->new_state |= R128_NEW_CULL;
}
-static void r128DDFrontFace( GLcontext *ctx, GLenum mode )
+static void r128DDFrontFace( struct gl_context *ctx, GLenum mode )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
* Masks
*/
-static void r128UpdateMasks( GLcontext *ctx )
+static void r128UpdateMasks( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
}
}
-static void r128DDColorMask( GLcontext *ctx,
+static void r128DDColorMask( struct gl_context *ctx,
GLboolean r, GLboolean g,
GLboolean b, GLboolean a )
{
* sense to break them out of the core texture state update routines.
*/
-static void updateSpecularLighting( GLcontext *ctx )
+static void updateSpecularLighting( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint t = rmesa->setup.tex_cntl_c;
}
-static void r128DDLightModelfv( GLcontext *ctx, GLenum pname,
+static void r128DDLightModelfv( struct gl_context *ctx, GLenum pname,
const GLfloat *param )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
}
}
-static void r128DDShadeModel( GLcontext *ctx, GLenum mode )
+static void r128DDShadeModel( struct gl_context *ctx, GLenum mode )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint s = rmesa->setup.pm4_vc_fpu_setup;
* Window position
*/
-static void r128UpdateWindow( GLcontext *ctx )
+static void r128UpdateWindow( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
int x = rmesa->driDrawable->x;
* Viewport
*/
-static void r128CalcViewport( GLcontext *ctx )
+static void r128CalcViewport( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
const GLfloat *v = ctx->Viewport._WindowMap.m;
m[MAT_TZ] = v[MAT_TZ] * rmesa->depth_scale;
}
-static void r128Viewport( GLcontext *ctx,
+static void r128Viewport( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height )
{
r128CalcViewport( ctx );
}
-static void r128DepthRange( GLcontext *ctx,
+static void r128DepthRange( struct gl_context *ctx,
GLclampd nearval, GLclampd farval )
{
r128CalcViewport( ctx );
* Miscellaneous
*/
-static void r128DDClearColor( GLcontext *ctx,
+static void r128DDClearColor( struct gl_context *ctx,
const GLfloat color[4] )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
c[0], c[1], c[2], c[3] );
}
-static void r128DDLogicOpCode( GLcontext *ctx, GLenum opcode )
+static void r128DDLogicOpCode( struct gl_context *ctx, GLenum opcode )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
}
}
-static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode )
+static void r128DDDrawBuffer( struct gl_context *ctx, GLenum mode )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
rmesa->new_state |= R128_NEW_WINDOW;
}
-static void r128DDReadBuffer( GLcontext *ctx, GLenum mode )
+static void r128DDReadBuffer( struct gl_context *ctx, GLenum mode )
{
/* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
}
* Polygon stipple
*/
-static void r128DDPolygonStipple( GLcontext *ctx, const GLubyte *mask )
+static void r128DDPolygonStipple( struct gl_context *ctx, const GLubyte *mask )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint stipple[32], i;
* Render mode
*/
-static void r128DDRenderMode( GLcontext *ctx, GLenum mode )
+static void r128DDRenderMode( struct gl_context *ctx, GLenum mode )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
FALLBACK( rmesa, R128_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
* State enable/disable
*/
-static void r128DDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
+static void r128DDEnable( struct gl_context *ctx, GLenum cap, GLboolean state )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
(flags & R128_NEW_WINDOW) ? "window, " : "" );
}
-void r128DDUpdateHWState( GLcontext *ctx )
+void r128DDUpdateHWState( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
int new_state = rmesa->new_state;
}
-static void r128DDInvalidateState( GLcontext *ctx, GLuint new_state )
+static void r128DDInvalidateState( struct gl_context *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
/* Initialize the driver's state functions.
*/
-void r128DDInitStateFuncs( GLcontext *ctx )
+void r128DDInitStateFuncs( struct gl_context *ctx )
{
ctx->Driver.UpdateState = r128DDInvalidateState;
#include "r128_context.h"
extern void r128DDInitState( r128ContextPtr rmesa );
-extern void r128DDInitStateFuncs( GLcontext *ctx );
+extern void r128DDInitStateFuncs( struct gl_context *ctx );
-extern void r128DDUpdateState( GLcontext *ctx );
-extern void r128DDUpdateHWState( GLcontext *ctx );
+extern void r128DDUpdateState( struct gl_context *ctx );
+extern void r128DDUpdateHWState( struct gl_context *ctx );
extern void r128EmitHwStateLocked( r128ContextPtr rmesa );
#include "main/teximage.h"
#include "main/texobj.h"
#include "main/imports.h"
-#include "main/texobj.h"
#include "main/macros.h"
#include "xmlpool.h"
/* Called by the _mesa_store_teximage[123]d() functions. */
static gl_format
-r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
+r128ChooseTextureFormat( struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
}
-static void r128TexImage1D( GLcontext *ctx, GLenum target, GLint level,
+static void r128TexImage1D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
}
-static void r128TexSubImage1D( GLcontext *ctx,
+static void r128TexSubImage1D( struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset,
}
-static void r128TexImage2D( GLcontext *ctx, GLenum target, GLint level,
+static void r128TexImage2D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
}
-static void r128TexSubImage2D( GLcontext *ctx,
+static void r128TexSubImage2D( struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
}
-static void r128TexEnv( GLcontext *ctx, GLenum target,
+static void r128TexEnv( struct gl_context *ctx, GLenum target,
GLenum pname, const GLfloat *param )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
}
-static void r128TexParameter( GLcontext *ctx, GLenum target,
+static void r128TexParameter( struct gl_context *ctx, GLenum target,
struct gl_texture_object *tObj,
GLenum pname, const GLfloat *params )
{
}
}
-static void r128BindTexture( GLcontext *ctx, GLenum target,
+static void r128BindTexture( struct gl_context *ctx, GLenum target,
struct gl_texture_object *tObj )
{
if ( R128_DEBUG & DEBUG_VERBOSE_API ) {
}
-static void r128DeleteTexture( GLcontext *ctx,
+static void r128DeleteTexture( struct gl_context *ctx,
struct gl_texture_object *tObj )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
* texture object from the core mesa gl_texture_object. Not done at this time.
*/
static struct gl_texture_object *
-r128NewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
+r128NewTextureObject( struct gl_context *ctx, GLuint name, GLenum target )
{
struct gl_texture_object *obj;
obj = _mesa_new_texture_object(ctx, name, target);
#ifndef __R128_TEX_H__
#define __R128_TEX_H__
-extern void r128UpdateTextureState( GLcontext *ctx );
+extern void r128UpdateTextureState( struct gl_context *ctx );
extern void r128UploadTexImages( r128ContextPtr rmesa, r128TexObjPtr t );
#define INPUT_PREVIOUS (R128_INPUT_FACTOR_PREV_COLOR | \
R128_INP_FACTOR_A_PREV_ALPHA)
-static GLboolean r128UpdateTextureEnv( GLcontext *ctx, int unit )
+static GLboolean r128UpdateTextureEnv( struct gl_context *ctx, int unit )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLint source = rmesa->tmu_source[unit];
return GL_TRUE;
}
-static void disable_tex( GLcontext *ctx, int unit )
+static void disable_tex( struct gl_context *ctx, int unit )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
rmesa->blend_flags &= ~R128_BLEND_MULTITEX;
}
-static GLboolean enable_tex_2d( GLcontext *ctx, int unit )
+static GLboolean enable_tex_2d( struct gl_context *ctx, int unit )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
const int source = rmesa->tmu_source[unit];
return GL_TRUE;
}
-static GLboolean update_tex_common( GLcontext *ctx, int unit )
+static GLboolean update_tex_common( struct gl_context *ctx, int unit )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
const int source = rmesa->tmu_source[unit];
return r128UpdateTextureEnv( ctx, unit );
}
-static GLboolean updateTextureUnit( GLcontext *ctx, int unit )
+static GLboolean updateTextureUnit( struct gl_context *ctx, int unit )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
const int source = rmesa->tmu_source[unit];
}
-void r128UpdateTextureState( GLcontext *ctx )
+void r128UpdateTextureState( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLboolean ok;
R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST,
};
-static void r128RasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void r128RenderPrimitive( GLcontext *ctx, GLenum prim );
+static void r128RasterPrimitive( struct gl_context *ctx, GLuint hwprim );
+static void r128RenderPrimitive( struct gl_context *ctx, GLenum prim );
/***********************************************************************
r128Vertex *v1,
r128Vertex *v2 )
{
- GLcontext *ctx = rmesa->glCtx;
+ struct gl_context *ctx = rmesa->glCtx;
SWvertex v[3];
_swsetup_Translate( ctx, v0, &v[0] );
_swsetup_Translate( ctx, v1, &v[1] );
r128Vertex *v0,
r128Vertex *v1 )
{
- GLcontext *ctx = rmesa->glCtx;
+ struct gl_context *ctx = rmesa->glCtx;
SWvertex v[2];
_swsetup_Translate( ctx, v0, &v[0] );
_swsetup_Translate( ctx, v1, &v[1] );
r128_fallback_point( r128ContextPtr rmesa,
r128Vertex *v0 )
{
- GLcontext *ctx = rmesa->glCtx;
+ struct gl_context *ctx = rmesa->glCtx;
SWvertex v[1];
_swsetup_Translate( ctx, v0, &v[0] );
_swrast_Point( ctx, &v[0] );
#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
#define _R128_NEW_RENDER_STATE (ANY_FALLBACK_FLAGS | ANY_RASTER_FLAGS)
-void r128ChooseRenderState(GLcontext *ctx)
+void r128ChooseRenderState(struct gl_context *ctx)
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint flags = ctx->_TriangleCaps;
/* Validate state at pipeline start */
/**********************************************************************/
-static void r128RunPipeline( GLcontext *ctx )
+static void r128RunPipeline( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
* primitives.
*/
-static void r128RasterPrimitive( GLcontext *ctx, GLuint hwprim )
+static void r128RasterPrimitive( struct gl_context *ctx, GLuint hwprim )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
}
}
-static void r128SetupAntialias( GLcontext *ctx, GLenum prim )
+static void r128SetupAntialias( struct gl_context *ctx, GLenum prim )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
}
}
-static void r128RenderPrimitive( GLcontext *ctx, GLenum prim )
+static void r128RenderPrimitive( struct gl_context *ctx, GLenum prim )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
GLuint hw = hw_prim[prim];
offset += (SIZE); \
} while (0)
-static void r128RenderStart( GLcontext *ctx )
+static void r128RenderStart( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
}
-static void r128RenderFinish( GLcontext *ctx )
+static void r128RenderFinish( struct gl_context *ctx )
{
if (R128_CONTEXT(ctx)->RenderIndex & R128_FALLBACK_BIT)
_swrast_flush( ctx );
return fallbackStrings[i];
}
-void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode )
+void r128Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
r128ContextPtr rmesa = R128_CONTEXT(ctx);
/* Initialization. */
/**********************************************************************/
-void r128InitTriFuncs( GLcontext *ctx )
+void r128InitTriFuncs( struct gl_context *ctx )
{
r128ContextPtr rmesa = R128_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
#include "main/mtypes.h"
-extern void r128InitTriFuncs( GLcontext *ctx );
-extern void r128ChooseRenderState( GLcontext *ctx );
+extern void r128InitTriFuncs( struct gl_context *ctx );
+extern void r128ChooseRenderState( struct gl_context *ctx );
-extern void r128Fallback( GLcontext *ctx, GLuint bit, GLboolean mode );
+extern void r128Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode );
#define FALLBACK( rmesa, bit, mode ) r128Fallback( rmesa->glCtx, bit, mode )
* @param[in] height region height
* @param[in] flip_y set if y coords of the source image need to be flipped
*/
-unsigned r200_blit(GLcontext *ctx,
+unsigned r200_blit(struct gl_context *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
gl_format src_mesaformat,
unsigned r200_check_blit(gl_format mesa_format);
-unsigned r200_blit(GLcontext *ctx,
+unsigned r200_blit(struct gl_context *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
gl_format src_mesaformat,
}
}
-void r200FlushElts(GLcontext *ctx)
+void r200FlushElts(struct gl_context *ctx)
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
int nr, elt_used = rmesa->tcl.elt_used;
/* Return various strings for glGetString().
*/
-static const GLubyte *r200GetString( GLcontext *ctx, GLenum name )
+static const GLubyte *r200GetString( struct gl_context *ctx, GLenum name )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
static char buffer[128];
/* Create the device specific rendering context.
*/
GLboolean r200CreateContext( gl_api api,
- const __GLcontextModes *glVisual,
+ const struct gl_config *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{
radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private);
struct dd_function_table functions;
r200ContextPtr rmesa;
- GLcontext *ctx;
+ struct gl_context *ctx;
int i;
int tcl_mode;
extern void r200DestroyContext( __DRIcontext *driContextPriv );
extern GLboolean r200CreateContext( gl_api api,
- const __GLcontextModes *glVisual,
+ const struct gl_config *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate);
extern GLboolean r200MakeCurrent( __DRIcontext *driContextPriv,
R200_TXC_OUTPUT_MASK_RGB
};
-static void r200UpdateFSArith( GLcontext *ctx )
+static void r200UpdateFSArith( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint *afs_cmd;
rmesa->afs_loaded = ctx->ATIFragmentShader.Current;
}
-static void r200UpdateFSRouting( GLcontext *ctx ) {
+static void r200UpdateFSRouting( struct gl_context *ctx ) {
r200ContextPtr rmesa = R200_CONTEXT(ctx);
const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current;
GLuint reg;
}
}
-static void r200UpdateFSConstants( GLcontext *ctx )
+static void r200UpdateFSConstants( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current;
* stored in some DriverData object attached to the mesa atifs object, i.e. binding a
* shader wouldn't force us to "recompile" the shader).
*/
-void r200UpdateFragmentShader( GLcontext *ctx )
+void r200UpdateFragmentShader( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
#define R200_TIMEOUT 512
#define R200_IDLE_RETRY 16
-static void r200KernelClear(GLcontext *ctx, GLuint flags)
+static void r200KernelClear(struct gl_context *ctx, GLuint flags)
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
/* ================================================================
* Buffer clear
*/
-static void r200Clear( GLcontext *ctx, GLbitfield mask )
+static void r200Clear( struct gl_context *ctx, GLbitfield mask )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
GLuint primitive,
GLuint vertex_nr );
-extern void r200FlushElts(GLcontext *ctx);
+extern void r200FlushElts(struct gl_context *ctx);
extern GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa,
GLuint primitive,
#include "r200_context.h"
-extern void r200EmitArrays( GLcontext *ctx, GLubyte *vimap_rev );
+extern void r200EmitArrays( struct gl_context *ctx, GLubyte *vimap_rev );
#endif
} while (0)
#endif
-static void r200_emit_vecfog(GLcontext *ctx, struct radeon_aos *aos,
+static void r200_emit_vecfog(struct gl_context *ctx, struct radeon_aos *aos,
GLvoid *data, int stride, int count)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
/* Emit any changed arrays to new GART memory, re-emit a packet to
* update the arrays.
*/
-void r200EmitArrays( GLcontext *ctx, GLubyte *vimap_rev )
+void r200EmitArrays( struct gl_context *ctx, GLubyte *vimap_rev )
{
r200ContextPtr rmesa = R200_CONTEXT( ctx );
struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
* Alpha blending
*/
-static void r200AlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
+static void r200AlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
int pp_misc = rmesa->hw.ctx.cmd[CTX_PP_MISC];
rmesa->hw.ctx.cmd[CTX_PP_MISC] = pp_misc;
}
-static void r200BlendColor( GLcontext *ctx, const GLfloat cf[4] )
+static void r200BlendColor( struct gl_context *ctx, const GLfloat cf[4] )
{
GLubyte color[4];
r200ContextPtr rmesa = R200_CONTEXT(ctx);
* and GL_FUNC_REVERSE_SUBTRACT will cause wrong results otherwise for
* unknown reasons.
*/
-static void r200_set_blend_state( GLcontext * ctx )
+static void r200_set_blend_state( struct gl_context * ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint cntl = rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &
}
-static void r200BlendEquationSeparate( GLcontext *ctx,
+static void r200BlendEquationSeparate( struct gl_context *ctx,
GLenum modeRGB, GLenum modeA )
{
r200_set_blend_state( ctx );
}
-static void r200BlendFuncSeparate( GLcontext *ctx,
+static void r200BlendFuncSeparate( struct gl_context *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
{
* Depth testing
*/
-static void r200DepthFunc( GLcontext *ctx, GLenum func )
+static void r200DepthFunc( struct gl_context *ctx, GLenum func )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
}
}
-static void r200ClearDepth( GLcontext *ctx, GLclampd d )
+static void r200ClearDepth( struct gl_context *ctx, GLclampd d )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint format = (rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &
}
}
-static void r200DepthMask( GLcontext *ctx, GLboolean flag )
+static void r200DepthMask( struct gl_context *ctx, GLboolean flag )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
R200_STATECHANGE( rmesa, ctx );
*/
-static void r200Fogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
+static void r200Fogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
union { int i; float f; } c, d;
* Culling
*/
-static void r200CullFace( GLcontext *ctx, GLenum unused )
+static void r200CullFace( struct gl_context *ctx, GLenum unused )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL];
}
}
-static void r200FrontFace( GLcontext *ctx, GLenum mode )
+static void r200FrontFace( struct gl_context *ctx, GLenum mode )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
/* =============================================================
* Point state
*/
-static void r200PointSize( GLcontext *ctx, GLfloat size )
+static void r200PointSize( struct gl_context *ctx, GLfloat size )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLfloat *fcmd = (GLfloat *)rmesa->hw.ptp.cmd;
fcmd[PTP_VPORT_SCALE_PTSIZE] = ctx->Point.Size;
}
-static void r200PointParameter( GLcontext *ctx, GLenum pname, const GLfloat *params)
+static void r200PointParameter( struct gl_context *ctx, GLenum pname, const GLfloat *params)
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLfloat *fcmd = (GLfloat *)rmesa->hw.ptp.cmd;
/* =============================================================
* Line state
*/
-static void r200LineWidth( GLcontext *ctx, GLfloat widthf )
+static void r200LineWidth( struct gl_context *ctx, GLfloat widthf )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
}
}
-static void r200LineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
+static void r200LineStipple( struct gl_context *ctx, GLint factor, GLushort pattern )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
/* =============================================================
* Masks
*/
-static void r200ColorMask( GLcontext *ctx,
+static void r200ColorMask( struct gl_context *ctx,
GLboolean r, GLboolean g,
GLboolean b, GLboolean a )
{
* Polygon state
*/
-static void r200PolygonOffset( GLcontext *ctx,
+static void r200PolygonOffset( struct gl_context *ctx,
GLfloat factor, GLfloat units )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = constant.ui32;
}
-static void r200PolygonMode( GLcontext *ctx, GLenum face, GLenum mode )
+static void r200PolygonMode( struct gl_context *ctx, GLenum face, GLenum mode )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0;
/* Examine lighting and texture state to determine if separate specular
* should be enabled.
*/
-static void r200UpdateSpecular( GLcontext *ctx )
+static void r200UpdateSpecular( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
uint32_t p = rmesa->hw.ctx.cmd[CTX_PP_CNTL];
/* Update on colormaterial, material emmissive/ambient,
* lightmodel.globalambient
*/
-static void update_global_ambient( GLcontext *ctx )
+static void update_global_ambient( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
float *fcmd = (float *)R200_DB_STATE( glt );
* - light[p].colors
* - light[p].enabled
*/
-static void update_light_colors( GLcontext *ctx, GLuint p )
+static void update_light_colors( struct gl_context *ctx, GLuint p )
{
struct gl_light *l = &ctx->Light.Light[p];
}
}
-static void r200ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode )
+static void r200ColorMaterial( struct gl_context *ctx, GLenum face, GLenum mode )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint light_model_ctl1 = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_1];
}
-void r200UpdateMaterial( GLcontext *ctx )
+void r200UpdateMaterial( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
* lighting space (model or eye), hence dependencies on _NEW_MODELVIEW
* and _MESA_NEW_NEED_EYE_COORDS.
*/
-static void update_light( GLcontext *ctx )
+static void update_light( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
}
}
-static void r200Lightfv( GLcontext *ctx, GLenum light,
+static void r200Lightfv( struct gl_context *ctx, GLenum light,
GLenum pname, const GLfloat *params )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
}
}
-static void r200UpdateLocalViewer ( GLcontext *ctx )
+static void r200UpdateLocalViewer ( struct gl_context *ctx )
{
/* It looks like for the texgen modes GL_SPHERE_MAP, GL_NORMAL_MAP and
GL_REFLECTION_MAP we need R200_LOCAL_VIEWER set (fglrx does exactly that
rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL_0] &= ~R200_LOCAL_VIEWER;
}
-static void r200LightModelfv( GLcontext *ctx, GLenum pname,
+static void r200LightModelfv( struct gl_context *ctx, GLenum pname,
const GLfloat *param )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
}
}
-static void r200ShadeModel( GLcontext *ctx, GLenum mode )
+static void r200ShadeModel( struct gl_context *ctx, GLenum mode )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL];
* User clip planes
*/
-static void r200ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq )
+static void r200ClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq )
{
GLint p = (GLint) plane - (GLint) GL_CLIP_PLANE0;
r200ContextPtr rmesa = R200_CONTEXT(ctx);
rmesa->hw.ucp[p].cmd[UCP_W] = ip[3];
}
-static void r200UpdateClipPlanes( GLcontext *ctx )
+static void r200UpdateClipPlanes( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint p;
*/
static void
-r200StencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func,
+r200StencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func,
GLint ref, GLuint mask )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
}
static void
-r200StencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask )
+r200StencilMaskSeparate( struct gl_context *ctx, GLenum face, GLuint mask )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
}
static void
-r200StencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail,
+r200StencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum fail,
GLenum zfail, GLenum zpass )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
}
}
-static void r200ClearStencil( GLcontext *ctx, GLint s )
+static void r200ClearStencil( struct gl_context *ctx, GLint s )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
* Called when window size or position changes or viewport or depth range
* state is changed. We update the hardware viewport state here.
*/
-void r200UpdateWindow( GLcontext *ctx )
+void r200UpdateWindow( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
rmesa->hw.vpt.cmd[VPT_SE_VPORT_ZOFFSET] = tz.ui32;
}
-void r200_vtbl_update_scissor( GLcontext *ctx )
+void r200_vtbl_update_scissor( struct gl_context *ctx )
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
unsigned x1, y1, x2, y2;
}
-static void r200Viewport( GLcontext *ctx, GLint x, GLint y,
+static void r200Viewport( struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height )
{
/* Don't pipeline viewport changes, conflict with window offset
radeon_viewport(ctx, x, y, width, height);
}
-static void r200DepthRange( GLcontext *ctx, GLclampd nearval,
+static void r200DepthRange( struct gl_context *ctx, GLclampd nearval,
GLclampd farval )
{
r200UpdateWindow( ctx );
}
-void r200UpdateViewportOffset( GLcontext *ctx )
+void r200UpdateViewportOffset( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
* Miscellaneous
*/
-static void r200ClearColor( GLcontext *ctx, const GLfloat c[4] )
+static void r200ClearColor( struct gl_context *ctx, const GLfloat c[4] )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLubyte color[4];
}
-static void r200RenderMode( GLcontext *ctx, GLenum mode )
+static void r200RenderMode( struct gl_context *ctx, GLenum mode )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
FALLBACK( rmesa, R200_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
R200_ROP_SET,
};
-static void r200LogicOpCode( GLcontext *ctx, GLenum opcode )
+static void r200LogicOpCode( struct gl_context *ctx, GLenum opcode )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint rop = (GLuint)opcode - GL_CLEAR;
* State enable/disable
*/
-static void r200Enable( GLcontext *ctx, GLenum cap, GLboolean state )
+static void r200Enable( struct gl_context *ctx, GLenum cap, GLboolean state )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint p, flag;
}
-void r200LightingSpaceChange( GLcontext *ctx )
+void r200LightingSpaceChange( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLboolean tmp;
}
-static void update_texturematrix( GLcontext *ctx )
+static void update_texturematrix( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT( ctx );
GLuint tpc = rmesa->hw.tcg.cmd[TCG_TEX_PROC_CTL_0];
}
}
-static GLboolean r200ValidateBuffers(GLcontext *ctx)
+static GLboolean r200ValidateBuffers(struct gl_context *ctx)
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
struct radeon_renderbuffer *rrb;
return GL_TRUE;
}
-GLboolean r200ValidateState( GLcontext *ctx )
+GLboolean r200ValidateState( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint new_state = rmesa->radeon.NewGLState;
}
-static void r200InvalidateState( GLcontext *ctx, GLuint new_state )
+static void r200InvalidateState( struct gl_context *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
* Should map to inputs just like the generic vertex arrays for vertex progs.
* In theory there could still be too many and we'd still need a fallback.
*/
-static GLboolean check_material( GLcontext *ctx )
+static GLboolean check_material( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLint i;
return GL_FALSE;
}
-static void r200WrapRunPipeline( GLcontext *ctx )
+static void r200WrapRunPipeline( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLboolean has_material;
}
-static void r200PolygonStipple( GLcontext *ctx, const GLubyte *mask )
+static void r200PolygonStipple( struct gl_context *ctx, const GLubyte *mask )
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
GLint i;
}
-void r200InitTnlFuncs( GLcontext *ctx )
+void r200InitTnlFuncs( struct gl_context *ctx )
{
TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange = r200UpdateMaterial;
TNL_CONTEXT(ctx)->Driver.RunPipeline = r200WrapRunPipeline;
extern void r200InitState( r200ContextPtr rmesa );
extern void r200InitStateFuncs( radeonContextPtr radeon, struct dd_function_table *functions );
-extern void r200InitTnlFuncs( GLcontext *ctx );
+extern void r200InitTnlFuncs( struct gl_context *ctx );
-extern void r200UpdateMaterial( GLcontext *ctx );
+extern void r200UpdateMaterial( struct gl_context *ctx );
-extern void r200UpdateViewportOffset( GLcontext *ctx );
-extern void r200UpdateWindow( GLcontext *ctx );
-extern void r200UpdateDrawBuffer(GLcontext *ctx);
+extern void r200UpdateViewportOffset( struct gl_context *ctx );
+extern void r200UpdateWindow( struct gl_context *ctx );
+extern void r200UpdateDrawBuffer(struct gl_context *ctx);
-extern GLboolean r200ValidateState( GLcontext *ctx );
+extern GLboolean r200ValidateState( struct gl_context *ctx );
-extern void r200_vtbl_update_scissor( GLcontext *ctx );
+extern void r200_vtbl_update_scissor( struct gl_context *ctx );
-extern void r200Fallback( GLcontext *ctx, GLuint bit, GLboolean mode );
+extern void r200Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode );
#define FALLBACK( rmesa, bit, mode ) do { \
if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n", \
__FUNCTION__, bit, mode ); \
r200Fallback( rmesa->radeon.glCtx, bit, mode ); \
} while (0)
-extern void r200LightingSpaceChange( GLcontext *ctx );
+extern void r200LightingSpaceChange( struct gl_context *ctx );
#endif
* If it is active check function returns maximum emit size.
*/
#define CHECK( NM, FLAG, ADD ) \
-static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom) \
+static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom) \
{ \
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
(void) rmesa; \
}
#define TCL_CHECK( NM, FLAG, ADD ) \
-static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom) \
+static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom) \
{ \
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
return (!rmesa->radeon.TclFallback && !ctx->VertexProgram._Enabled && (FLAG)) ? atom->cmd_size + (ADD) : 0; \
}
#define TCL_OR_VP_CHECK( NM, FLAG, ADD ) \
-static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \
+static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom ) \
{ \
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
return (!rmesa->radeon.TclFallback && (FLAG)) ? atom->cmd_size + (ADD) : 0; \
}
#define VP_CHECK( NM, FLAG, ADD ) \
-static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \
+static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom ) \
{ \
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
(void) atom; \
OUT_BATCH(CP_PACKET0_ONE(R200_SE_TCL_SCALAR_DATA_REG, h.scalars.count - 1)); \
OUT_BATCH_TABLE((data), h.scalars.count); \
} while(0)
-static int check_rrb(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_rrb(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
struct radeon_renderbuffer *rrb;
return atom->cmd_size;
}
-static int check_polygon_stipple(GLcontext *ctx,
+static int check_polygon_stipple(struct gl_context *ctx,
struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
return 0;
}
-static void mtl_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void mtl_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
BATCH_LOCALS(&r200->radeon);
END_BATCH();
}
-static void lit_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void lit_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
BATCH_LOCALS(&r200->radeon);
END_BATCH();
}
-static void ptp_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void ptp_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
BATCH_LOCALS(&r200->radeon);
END_BATCH();
}
-static void veclinear_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void veclinear_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
BATCH_LOCALS(&r200->radeon);
OUT_VECLINEAR(atom->cmd[0], atom->cmd+1);
}
-static void scl_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void scl_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
BATCH_LOCALS(&r200->radeon);
}
-static void vec_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void vec_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
BATCH_LOCALS(&r200->radeon);
END_BATCH();
}
-static void ctx_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void ctx_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
BATCH_LOCALS(&r200->radeon);
END_BATCH();
}
-static int check_always_ctx( GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_always_ctx( struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
struct radeon_renderbuffer *rrb, *drb;
return dwords;
}
-static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom)
+static void ctx_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
BATCH_LOCALS(&r200->radeon);
END_BATCH();
}
-static int get_tex_size(GLcontext* ctx, struct radeon_state_atom *atom)
+static int get_tex_size(struct gl_context* ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
uint32_t dwords = atom->cmd_size + 2;
return dwords;
}
-static int check_tex_pair(GLcontext* ctx, struct radeon_state_atom *atom)
+static int check_tex_pair(struct gl_context* ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
/** XOR is bit flip operation so use it for finding pair */
return get_tex_size(ctx, atom);
}
-static int check_tex(GLcontext* ctx, struct radeon_state_atom *atom)
+static int check_tex(struct gl_context* ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
if (!(r200->state.texture.unit[atom->idx].unitneeded))
}
-static void tex_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void tex_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
BATCH_LOCALS(&r200->radeon);
END_BATCH();
}
-static int get_tex_mm_size(GLcontext* ctx, struct radeon_state_atom *atom)
+static int get_tex_mm_size(struct gl_context* ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
uint32_t dwords = atom->cmd_size + 2;
return dwords;
}
-static int check_tex_pair_mm(GLcontext* ctx, struct radeon_state_atom *atom)
+static int check_tex_pair_mm(struct gl_context* ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
/** XOR is bit flip operation so use it for finding pair */
return get_tex_mm_size(ctx, atom);
}
-static int check_tex_mm(GLcontext* ctx, struct radeon_state_atom *atom)
+static int check_tex_mm(struct gl_context* ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
if (!(r200->state.texture.unit[atom->idx].unitneeded))
}
-static void tex_emit_mm(GLcontext *ctx, struct radeon_state_atom *atom)
+static void tex_emit_mm(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
BATCH_LOCALS(&r200->radeon);
}
-static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void cube_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
BATCH_LOCALS(&r200->radeon);
END_BATCH();
}
-static void cube_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom)
+static void cube_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r200ContextPtr r200 = R200_CONTEXT(ctx);
BATCH_LOCALS(&r200->radeon);
*/
void r200InitState( r200ContextPtr rmesa )
{
- GLcontext *ctx = rmesa->radeon.glCtx;
+ struct gl_context *ctx = rmesa->radeon.glCtx;
GLuint i;
rmesa->radeon.state.color.clear = 0x00000000;
rmesa->radeon.swtcl.vertex_attr_count++; \
} while (0)
-static void r200SetVertexFormat( GLcontext *ctx )
+static void r200SetVertexFormat( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT( ctx );
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
-static void r200RenderStart( GLcontext *ctx )
+static void r200RenderStart( struct gl_context *ctx )
{
r200SetVertexFormat( ctx );
if (RADEON_DEBUG & RADEON_VERTS)
* determine in advance whether or not the hardware can / should do the
* projection divide or Mesa should do it.
*/
-void r200ChooseVertexState( GLcontext *ctx )
+void r200ChooseVertexState( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT( ctx );
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
}
-void r200_swtcl_flush(GLcontext *ctx, uint32_t current_offset)
+void r200_swtcl_flush(struct gl_context *ctx, uint32_t current_offset)
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
if (RADEON_DEBUG & RADEON_VERTS)
/**************************************************************************/
-static INLINE GLuint reduced_hw_prim( GLcontext *ctx, GLuint prim)
+static INLINE GLuint reduced_hw_prim( struct gl_context *ctx, GLuint prim)
{
switch (prim) {
case GL_POINTS:
}
-static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void r200RenderPrimitive( GLcontext *ctx, GLenum prim );
-static void r200ResetLineStipple( GLcontext *ctx );
+static void r200RasterPrimitive( struct gl_context *ctx, GLuint hwprim );
+static void r200RenderPrimitive( struct gl_context *ctx, GLenum prim );
+static void r200ResetLineStipple( struct gl_context *ctx );
/***********************************************************************
* Emit primitives as inline vertices *
/* Choose render functions */
/**********************************************************************/
-void r200ChooseRenderState( GLcontext *ctx )
+void r200ChooseRenderState( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
r200ContextPtr rmesa = R200_CONTEXT(ctx);
/**********************************************************************/
-static void r200RasterPrimitive( GLcontext *ctx, GLuint hwprim )
+static void r200RasterPrimitive( struct gl_context *ctx, GLuint hwprim )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
radeon_prepare_render(&rmesa->radeon);
+ if (rmesa->radeon.NewGLState)
+ r200ValidateState( ctx );
+
if (rmesa->radeon.swtcl.hw_primitive != hwprim) {
/* need to disable perspective-correct texturing for point sprites */
}
}
-static void r200RenderPrimitive( GLcontext *ctx, GLenum prim )
+static void r200RenderPrimitive( struct gl_context *ctx, GLenum prim )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
rmesa->radeon.swtcl.render_primitive = prim;
r200RasterPrimitive( ctx, reduced_hw_prim(ctx, prim) );
}
-static void r200RenderFinish( GLcontext *ctx )
+static void r200RenderFinish( struct gl_context *ctx )
{
}
-static void r200ResetLineStipple( GLcontext *ctx )
+static void r200ResetLineStipple( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
R200_STATECHANGE( rmesa, lin );
}
-void r200Fallback( GLcontext *ctx, GLuint bit, GLboolean mode )
+void r200Fallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
* NV_texture_rectangle).
*/
void
-r200PointsBitmap( GLcontext *ctx, GLint px, GLint py,
+r200PointsBitmap( struct gl_context *ctx, GLint px, GLint py,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap )
/* Initialization. */
/**********************************************************************/
-void r200InitSwtcl( GLcontext *ctx )
+void r200InitSwtcl( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
r200ContextPtr rmesa = R200_CONTEXT(ctx);
#include "swrast/swrast.h"
#include "r200_context.h"
-extern void r200InitSwtcl( GLcontext *ctx );
+extern void r200InitSwtcl( struct gl_context *ctx );
-extern void r200ChooseRenderState( GLcontext *ctx );
-extern void r200ChooseVertexState( GLcontext *ctx );
+extern void r200ChooseRenderState( struct gl_context *ctx );
+extern void r200ChooseVertexState( struct gl_context *ctx );
-extern void r200CheckTexSizes( GLcontext *ctx );
+extern void r200CheckTexSizes( struct gl_context *ctx );
-extern void r200BuildVertices( GLcontext *ctx, GLuint start, GLuint count,
+extern void r200BuildVertices( struct gl_context *ctx, GLuint start, GLuint count,
GLuint newinputs );
extern void r200PrintSetupFlags(char *msg, GLuint flags );
-extern void r200_translate_vertex( GLcontext *ctx,
+extern void r200_translate_vertex( struct gl_context *ctx,
const radeonVertex *src,
SWvertex *dst );
-extern void r200_print_vertex( GLcontext *ctx, const radeonVertex *v );
+extern void r200_print_vertex( struct gl_context *ctx, const radeonVertex *v );
-extern void r200_import_float_colors( GLcontext *ctx );
-extern void r200_import_float_spec_colors( GLcontext *ctx );
+extern void r200_import_float_colors( struct gl_context *ctx );
+extern void r200_import_float_spec_colors( struct gl_context *ctx );
-extern void r200PointsBitmap( GLcontext *ctx, GLint px, GLint py,
+extern void r200PointsBitmap( struct gl_context *ctx, GLint px, GLint py,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap );
-void r200_swtcl_flush(GLcontext *ctx, uint32_t current_offset);
+void r200_swtcl_flush(struct gl_context *ctx, uint32_t current_offset);
#endif
* discrete and there are no intervening state changes. (Somewhat
* duplicates changes to DrawArrays code)
*/
-static void r200EmitPrim( GLcontext *ctx,
+static void r200EmitPrim( struct gl_context *ctx,
GLenum prim,
GLuint hwprim,
GLuint start,
/* External entrypoints */
/**********************************************************************/
-void r200EmitPrimitive( GLcontext *ctx,
+void r200EmitPrimitive( struct gl_context *ctx,
GLuint first,
GLuint last,
GLuint flags )
tcl_render_tab_verts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
}
-void r200EmitEltPrimitive( GLcontext *ctx,
+void r200EmitEltPrimitive( struct gl_context *ctx,
GLuint first,
GLuint last,
GLuint flags )
tcl_render_tab_elts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
}
-void r200TclPrimitive( GLcontext *ctx,
+void r200TclPrimitive( struct gl_context *ctx,
GLenum prim,
int hw_prim )
{
GLuint newprim = hw_prim | R200_VF_TCL_OUTPUT_VTX_ENABLE;
radeon_prepare_render(&rmesa->radeon);
+ if (rmesa->radeon.NewGLState)
+ r200ValidateState( ctx );
if (newprim != rmesa->tcl.hw_primitive ||
!discrete_prim[hw_prim&0xf]) {
* Fog blend factors are in the range [0,1].
*/
float
-r200ComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord )
+r200ComputeFogBlendFactor( struct gl_context *ctx, GLfloat fogcoord )
{
GLfloat end = ctx->Fog.End;
GLfloat d, temp;
* Predict total emit size for next rendering operation so there is no flush in middle of rendering
* Prediction has to aim towards the best possible value that is worse than worst case scenario
*/
-static GLuint r200EnsureEmitSize( GLcontext * ctx , GLubyte* vimap_rev )
+static GLuint r200EnsureEmitSize( struct gl_context * ctx , GLubyte* vimap_rev )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
/* TCL render.
*/
-static GLboolean r200_run_tcl_render( GLcontext *ctx,
+static GLboolean r200_run_tcl_render( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
*/
-static void transition_to_swtnl( GLcontext *ctx )
+static void transition_to_swtnl( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL] &= ~(R200_VAP_TCL_ENABLE|R200_VAP_PROG_VTX_SHADER_ENABLE);
}
-static void transition_to_hwtnl( GLcontext *ctx )
+static void transition_to_hwtnl( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
-void r200TclFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
+void r200TclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint oldfallback = rmesa->radeon.TclFallback;
#include "r200_context.h"
-extern void r200TclPrimitive( GLcontext *ctx, GLenum prim, int hw_prim );
-extern void r200EmitEltPrimitive( GLcontext *ctx, GLuint first, GLuint last,
+extern void r200TclPrimitive( struct gl_context *ctx, GLenum prim, int hw_prim );
+extern void r200EmitEltPrimitive( struct gl_context *ctx, GLuint first, GLuint last,
GLuint flags );
-extern void r200EmitPrimitive( GLcontext *ctx, GLuint first, GLuint last,
+extern void r200EmitPrimitive( struct gl_context *ctx, GLuint first, GLuint last,
GLuint flags );
-extern void r200TclFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
+extern void r200TclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode );
extern void r200InitStaticFogData( void );
-extern float r200ComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord );
+extern float r200ComputeFogBlendFactor( struct gl_context *ctx, GLfloat fogcoord );
#define R200_TCL_FALLBACK_RASTER 0x1 /* rasterization */
#define R200_TCL_FALLBACK_UNFILLED 0x2 /* unfilled tris */
t->pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] );
}
-static void r200TexEnv( GLcontext *ctx, GLenum target,
+static void r200TexEnv( struct gl_context *ctx, GLenum target,
GLenum pname, const GLfloat *param )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
* next UpdateTextureState
*/
-static void r200TexParameter( GLcontext *ctx, GLenum target,
+static void r200TexParameter( struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat *params )
{
}
-static void r200DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj)
+static void r200DeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj)
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
radeonTexObj* t = radeon_tex_obj(texObj);
* Basically impossible to do this on the fly - just collect some
* basic info & do the checks from ValidateState().
*/
-static void r200TexGen( GLcontext *ctx,
+static void r200TexGen( struct gl_context *ctx,
GLenum coord,
GLenum pname,
const GLfloat *params )
* allocate the default texture objects.
* Fixup MaxAnisotropy according to user preference.
*/
-static struct gl_texture_object *r200NewTextureObject(GLcontext * ctx,
+static struct gl_texture_object *r200NewTextureObject(struct gl_context * ctx,
GLuint name,
GLenum target)
{
unsigned long long offset, GLint depth,
GLuint pitch);
-extern void r200UpdateTextureState( GLcontext *ctx );
+extern void r200UpdateTextureState( struct gl_context *ctx );
extern int r200UploadTexImages( r200ContextPtr rmesa, radeonTexObjPtr t, GLuint face );
extern void r200InitTextureFuncs( radeonContextPtr radeon, struct dd_function_table *functions );
-extern void r200UpdateFragmentShader( GLcontext *ctx );
+extern void r200UpdateFragmentShader( struct gl_context *ctx );
-extern void set_re_cntl_d3d( GLcontext *ctx, int unit, GLboolean use_d3d );
+extern void set_re_cntl_d3d( struct gl_context *ctx, int unit, GLboolean use_d3d );
#endif /* __R200_TEX_H__ */
* Texture unit state management
*/
-static GLboolean r200UpdateTextureEnv( GLcontext *ctx, int unit, int slot, GLuint replaceargs )
+static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slot, GLuint replaceargs )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
#define REF_COLOR 1
#define REF_ALPHA 2
-static GLboolean r200UpdateAllTexEnv( GLcontext *ctx )
+static GLboolean r200UpdateAllTexEnv( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLint i, j, currslot;
/*
* Returns GL_FALSE if fallback required.
*/
-static GLboolean r200_validate_texgen( GLcontext *ctx, GLuint unit )
+static GLboolean r200_validate_texgen( struct gl_context *ctx, GLuint unit )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
return GL_TRUE;
}
-void set_re_cntl_d3d( GLcontext *ctx, int unit, GLboolean use_d3d )
+void set_re_cntl_d3d( struct gl_context *ctx, int unit, GLboolean use_d3d )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
}
-static GLboolean r200_validate_texture(GLcontext *ctx, struct gl_texture_object *texObj, int unit)
+static GLboolean r200_validate_texture(struct gl_context *ctx, struct gl_texture_object *texObj, int unit)
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
radeonTexObj *t = radeon_tex_obj(texObj);
return !t->border_fallback;
}
-static GLboolean r200UpdateTextureUnit(GLcontext *ctx, int unit)
+static GLboolean r200UpdateTextureUnit(struct gl_context *ctx, int unit)
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint unitneeded = rmesa->state.texture.unit[unit].unitneeded;
}
-void r200UpdateTextureState( GLcontext *ctx )
+void r200UpdateTextureState( struct gl_context *ctx )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLboolean ok;
};
#undef OPN
-static GLboolean r200VertexProgUpdateParams(GLcontext *ctx, struct r200_vertex_program *vp)
+static GLboolean r200VertexProgUpdateParams(struct gl_context *ctx, struct r200_vertex_program *vp)
{
r200ContextPtr rmesa = R200_CONTEXT( ctx );
GLfloat *fcmd = (GLfloat *)&rmesa->hw.vpp[0].cmd[VPP_CMD_0 + 1];
*
* \return GL_TRUE for success, GL_FALSE for failure.
*/
-static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_vertex_program *vp)
+static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r200_vertex_program *vp)
{
struct gl_vertex_program *mesa_vp = &vp->mesa_program;
struct prog_instruction *vpi;
return GL_TRUE;
}
-void r200SetupVertexProg( GLcontext *ctx ) {
+void r200SetupVertexProg( struct gl_context *ctx ) {
r200ContextPtr rmesa = R200_CONTEXT(ctx);
struct r200_vertex_program *vp = (struct r200_vertex_program *)ctx->VertexProgram.Current;
GLboolean fallback;
static void
-r200BindProgram(GLcontext *ctx, GLenum target, struct gl_program *prog)
+r200BindProgram(struct gl_context *ctx, GLenum target, struct gl_program *prog)
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
}
static struct gl_program *
-r200NewProgram(GLcontext *ctx, GLenum target, GLuint id)
+r200NewProgram(struct gl_context *ctx, GLenum target, GLuint id)
{
struct r200_vertex_program *vp;
static void
-r200DeleteProgram(GLcontext *ctx, struct gl_program *prog)
+r200DeleteProgram(struct gl_context *ctx, struct gl_program *prog)
{
_mesa_delete_program(ctx, prog);
}
static GLboolean
-r200ProgramStringNotify(GLcontext *ctx, GLenum target, struct gl_program *prog)
+r200ProgramStringNotify(struct gl_context *ctx, GLenum target, struct gl_program *prog)
{
struct r200_vertex_program *vp = (void *)prog;
r200ContextPtr rmesa = R200_CONTEXT(ctx);
}
static GLboolean
-r200IsProgramNative(GLcontext *ctx, GLenum target, struct gl_program *prog)
+r200IsProgramNative(struct gl_context *ctx, GLenum target, struct gl_program *prog)
{
struct r200_vertex_program *vp = (void *)prog;
} VERTEX_SHADER_INSTRUCTION;
extern void r200InitShaderFuncs(struct dd_function_table *functions);
-extern void r200SetupVertexProg( GLcontext *ctx );
+extern void r200SetupVertexProg( struct gl_context *ctx );
#define VSF_FLAG_X 1
#define VSF_FLAG_Y 2
C_SOURCES = \
radeon_code.c \
radeon_compiler.c \
+ radeon_compiler_util.c \
radeon_emulate_branches.c \
radeon_emulate_loops.c \
radeon_program.c \
source = [
'radeon_code.c',
'radeon_compiler.c',
+ 'radeon_compiler_util.c',
'radeon_program.c',
'radeon_program_print.c',
'radeon_opcodes.c',
*/
static int emit_alu(struct r300_emit_state * emit, struct rc_pair_instruction* inst)
{
+ int ip;
+ int j;
PROG_CODE;
if (code->alu.length >= c->Base.max_alu_insts) {
return 0;
}
- int ip = code->alu.length++;
- int j;
+ ip = code->alu.length++;
code->alu.inst[ip].rgb_inst = translate_rgb_opcode(c, inst->RGB.Opcode);
code->alu.inst[ip].alpha_inst = translate_alpha_opcode(c, inst->Alpha.Opcode);
for(j = 0; j < 3; ++j) {
unsigned int src = use_source(code, inst->RGB.Src[j]);
+ unsigned int arg;
code->alu.inst[ip].rgb_addr |= src << (6*j);
src = use_source(code, inst->Alpha.Src[j]);
code->alu.inst[ip].alpha_addr |= src << (6*j);
- unsigned int arg = r300FPTranslateRGBSwizzle(inst->RGB.Arg[j].Source, inst->RGB.Arg[j].Swizzle);
+ arg = r300FPTranslateRGBSwizzle(inst->RGB.Arg[j].Source, inst->RGB.Arg[j].Swizzle);
arg |= inst->RGB.Arg[j].Abs << 6;
arg |= inst->RGB.Arg[j].Negate << 5;
code->alu.inst[ip].rgb_inst |= arg << (7*j);
{
struct r300_fragment_program_compiler * c = emit->compiler;
struct r300_fragment_program_code *code = &emit->compiler->code->code.r300;
+ unsigned alu_offset;
+ unsigned alu_end;
+ unsigned tex_offset;
+ unsigned tex_end;
if (code->alu.length == emit->node_first_alu) {
/* Generate a single NOP for this node */
return 0;
}
- unsigned alu_offset = emit->node_first_alu;
- unsigned alu_end = code->alu.length - alu_offset - 1;
- unsigned tex_offset = emit->node_first_tex;
- unsigned tex_end = code->tex.length - tex_offset - 1;
+ alu_offset = emit->node_first_alu;
+ alu_end = code->alu.length - alu_offset - 1;
+ tex_offset = emit->node_first_tex;
+ tex_end = code->tex.length - tex_offset - 1;
if (code->tex.length == emit->node_first_tex) {
if (emit->current_node > 0) {
static int emit_tex(struct r300_emit_state * emit, struct rc_instruction * inst)
{
+ unsigned int unit;
+ unsigned int dest;
+ unsigned int opcode;
PROG_CODE;
if (code->tex.length >= R300_PFS_MAX_TEX_INST) {
return 0;
}
- unsigned int unit = inst->U.I.TexSrcUnit;
- unsigned int dest = inst->U.I.DstReg.Index;
- unsigned int opcode;
+ unit = inst->U.I.TexSrcUnit;
+ dest = inst->U.I.DstReg.Index;
switch(inst->U.I.Opcode) {
case RC_OPCODE_KIL: opcode = R300_TEX_OP_KIL; break;
*/
static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg)
{
+ unsigned int relevant;
+ int j;
+
if (reg.Abs)
reg.Negate = RC_MASK_NONE;
opcode == RC_OPCODE_TEX ||
opcode == RC_OPCODE_TXB ||
opcode == RC_OPCODE_TXP) {
- int j;
-
if (reg.Abs || reg.Negate)
return 0;
return 1;
}
- unsigned int relevant = 0;
- int j;
+ relevant = 0;
for(j = 0; j < 3; ++j)
if (GET_SWZ(reg.Swizzle, j) != RC_SWIZZLE_UNUSED)
unsigned int matchcount = 0;
unsigned int matchmask = 0;
for(comp = 0; comp < 3; ++comp) {
+ unsigned int swz;
if (!GET_BIT(mask, comp))
continue;
- unsigned int swz = GET_SWZ(src.Swizzle, comp);
+ swz = GET_SWZ(src.Swizzle, comp);
if (swz == RC_SWIZZLE_UNUSED)
continue;
if (swz == GET_SWZ(sd->hash, comp)) {
{"final code validation", 0, 1, rc_validate_final_shader, NULL},
{"machine code generation", 0, is_r500, r500BuildFragmentProgramHwCode, NULL},
{"machine code generation", 0, !is_r500, r300BuildFragmentProgramHwCode, NULL},
- {"dump machine code", 0, is_r500 && c->Base.Debug, r500FragmentProgramDump, NULL},
- {"dump machine code", 0, !is_r500 && c->Base.Debug, r300FragmentProgramDump, NULL},
+ {"dump machine code", 0, is_r500 && (c->Base.Debug & RC_DBG_LOG), r500FragmentProgramDump, NULL},
+ {"dump machine code", 0, !is_r500 && (c->Base.Debug & RC_DBG_LOG), r300FragmentProgramDump, NULL},
{NULL, 0, 0, NULL, NULL}
};
* don't already have one. */
if (!compiler->PredicateMask) {
unsigned int writemasks[RC_REGISTER_MAX_INDEX];
- memset(writemasks, 0, sizeof(writemasks));
struct rc_instruction * inst;
unsigned int i;
+ memset(writemasks, 0, sizeof(writemasks));
for(inst = compiler->Base.Program.Instructions.Next;
inst != &compiler->Base.Program.Instructions;
inst = inst->Next) {
{"dead constants", 1, kill_consts, rc_remove_unused_constants, &c->code->constants_remap_table},
{"final code validation", 0, 1, rc_validate_final_shader, NULL},
{"machine code generation", 0, 1, translate_vertex_program, NULL},
- {"dump machine code", 0,c->Base.Debug,r300_vertex_program_dump, NULL},
+ {"dump machine code", 0, c->Base.Debug & RC_DBG_LOG, r300_vertex_program_dump, NULL},
{NULL, 0, 0, NULL, NULL}
};
struct rc_instruction * inst,
void* data)
{
+ struct rc_instruction * inst_mov;
+
if (inst->U.I.Opcode != RC_OPCODE_IF)
return 0;
- struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst->Prev);
+ inst_mov = rc_insert_new_instruction(c, inst->Prev);
inst_mov->U.I.Opcode = RC_OPCODE_MOV;
inst_mov->U.I.DstReg.WriteMask = 0;
inst_mov->U.I.WriteALUResult = RC_ALURESULT_W;
{
struct r300_fragment_program_compiler *compiler = (struct r300_fragment_program_compiler*)c;
struct r500_fragment_program_code *code = &compiler->code->code.r500;
- fprintf(stderr, "R500 Fragment Program:\n--------\n");
-
int n, i;
uint32_t inst;
uint32_t inst0;
char *str = NULL;
+ fprintf(stderr, "R500 Fragment Program:\n--------\n");
for (n = 0; n < code->inst_end+1; n++) {
inst0 = inst = code->inst[n].inst0;
*/
static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair_instruction *inst)
{
+ int ip;
PROG_CODE;
if (code->inst_end >= c->Base.max_alu_insts-1) {
return;
}
- int ip = ++code->inst_end;
+ ip = ++code->inst_end;
/* Quirk: MDH/MDV (DDX/DDY) need a NOP on previous non-TEX instructions. */
if (inst->RGB.Opcode == RC_OPCODE_DDX || inst->Alpha.Opcode == RC_OPCODE_DDX ||
if (inst->RGB.OutputWriteMask || inst->Alpha.OutputWriteMask || inst->Alpha.DepthWriteMask) {
code->inst[ip].inst0 = R500_INST_TYPE_OUT;
if (inst->WriteALUResult) {
- error("%s: cannot write output and ALU result at the same time");
+ error("Cannot write output and ALU result at the same time");
return;
}
} else {
*/
static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_instruction *inst)
{
+ int ip;
PROG_CODE;
if (code->inst_end >= c->Base.max_alu_insts-1) {
return 0;
}
- int ip = ++code->inst_end;
+ ip = ++code->inst_end;
code->inst[ip].inst0 = R500_INST_TYPE_TEX
| (inst->DstReg.WriteMask << 11)
static void emit_flowcontrol(struct emit_state * s, struct rc_instruction * inst)
{
+ unsigned int newip;
+
if (s->Code->inst_end >= s->C->max_alu_insts-1) {
rc_error(s->C, "emit_tex: Too many instructions");
return;
}
- unsigned int newip = ++s->Code->inst_end;
+ newip = ++s->Code->inst_end;
/* Currently all loops use the same integer constant to intialize
* the loop variables. */
if (code->inst_end == -1 ||
(code->inst[code->inst_end].inst0 & R500_INST_TYPE_MASK) != R500_INST_TYPE_OUT) {
+ int ip;
+
/* This may happen when dead-code elimination is disabled or
* when most of the fragment program logic is leading to a KIL */
if (code->inst_end >= compiler->Base.max_alu_insts-1) {
return;
}
- int ip = ++code->inst_end;
+ ip = ++code->inst_end;
code->inst[ip].inst0 = R500_INST_TYPE_OUT | R500_INST_TEX_SEM_WAIT;
}
#include <stdio.h>
#include <stdlib.h>
+#include "radeon_dataflow.h"
#include "radeon_program.h"
+#include "radeon_program_pair.h"
void rc_init(struct radeon_compiler * c)
{
va_list ap;
- if (!c->Debug)
+ if (!(c->Debug & RC_DBG_LOG))
return;
va_start(ap, fmt);
}
}
- if (c->Debug) {
+ if (c->Debug & RC_DBG_LOG) {
fprintf(stderr, "r300compiler error: ");
va_start(ap, fmt);
}
}
+static void reg_count_callback(void * userdata, struct rc_instruction * inst,
+ rc_register_file file, unsigned int index, unsigned int mask)
+{
+ unsigned int * max_reg = userdata;
+ if (file == RC_FILE_TEMPORARY)
+ index > *max_reg ? *max_reg = index : 0;
+}
+
+static void print_stats(struct radeon_compiler * c)
+{
+ struct rc_instruction * tmp;
+ unsigned max_reg, insts, fc, tex, alpha, rgb, presub;
+ max_reg = insts = fc = tex = alpha = rgb = presub = 0;
+ for(tmp = c->Program.Instructions.Next; tmp != &c->Program.Instructions;
+ tmp = tmp->Next){
+ const struct rc_opcode_info * info;
+ rc_for_all_reads_mask(tmp, reg_count_callback, &max_reg);
+ if (tmp->Type == RC_INSTRUCTION_NORMAL) {
+ if (tmp->U.I.PreSub.Opcode != RC_PRESUB_NONE)
+ presub++;
+ info = rc_get_opcode_info(tmp->U.I.Opcode);
+ } else {
+ if (tmp->U.P.RGB.Src[RC_PAIR_PRESUB_SRC].Used)
+ presub++;
+ if (tmp->U.P.Alpha.Src[RC_PAIR_PRESUB_SRC].Used)
+ presub++;
+ /* Assuming alpha will never be a flow control or
+ * a tex instruction. */
+ if (tmp->U.P.Alpha.Opcode != RC_OPCODE_NOP)
+ alpha++;
+ if (tmp->U.P.RGB.Opcode != RC_OPCODE_NOP)
+ rgb++;
+ info = rc_get_opcode_info(tmp->U.P.RGB.Opcode);
+ }
+ if (info->IsFlowControl)
+ fc++;
+ if (info->HasTexture)
+ tex++;
+ insts++;
+ }
+ if (insts < 4)
+ return;
+ fprintf(stderr,"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
+ "~%4u Instructions\n"
+ "~%4u Vector Instructions (RGB)\n"
+ "~%4u Scalar Instructions (Alpha)\n"
+ "~%4u Flow Control Instructions\n"
+ "~%4u Texture Instructions\n"
+ "~%4u Presub Operations\n"
+ "~%4u Temporary Registers\n"
+ "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
+ insts, rgb, alpha, fc, tex, presub, max_reg + 1);
+}
+
/* Executes a list of compiler passes given in the parameter 'list'. */
void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *list,
const char *shader_name)
{
- if (c->Debug) {
+ if (c->Debug & RC_DBG_LOG) {
fprintf(stderr, "%s: before compilation\n", shader_name);
rc_print_program(&c->Program);
}
if (c->Error)
return;
- if (c->Debug && list[i].dump) {
+ if ((c->Debug & RC_DBG_LOG) && list[i].dump) {
fprintf(stderr, "%s: after '%s'\n", shader_name, list[i].name);
rc_print_program(&c->Program);
}
}
}
+ if (c->Debug & RC_DBG_STATS)
+ print_stats(c);
}
void rc_validate_final_shader(struct radeon_compiler *c, void *user)
#include "radeon_program.h"
#include "radeon_emulate_loops.h"
+#define RC_DBG_LOG (1 << 0)
+#define RC_DBG_STATS (1 << 1)
+
struct rc_swizzle_caps;
struct radeon_compiler {
struct memory_pool Pool;
struct rc_program Program;
- unsigned Debug:1;
+ unsigned Debug:2;
unsigned Error:1;
char * ErrorMsg;
--- /dev/null
+/*
+ * Copyright 2010 Tom Stellard <tstellar@gmail.com>
+ *
+ * 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 (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 COPYRIGHT OWNER(S) 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.
+ *
+ */
+
+/**
+ * \file
+ */
+
+#include "radeon_compiler_util.h"
+
+/**
+ */
+unsigned int rc_swizzle_to_writemask(unsigned int swz)
+{
+ unsigned int mask = 0;
+ unsigned int i;
+
+ for(i = 0; i < 4; i++) {
+ mask |= 1 << GET_SWZ(swz, i);
+ }
+ mask &= RC_MASK_XYZW;
+
+ return mask;
+}
+
+unsigned int rc_src_reads_dst_mask(
+ rc_register_file src_file,
+ unsigned int src_idx,
+ unsigned int src_swz,
+ rc_register_file dst_file,
+ unsigned int dst_idx,
+ unsigned int dst_mask)
+{
+ if (src_file != dst_file || src_idx != dst_idx) {
+ return RC_MASK_NONE;
+ }
+ return dst_mask & rc_swizzle_to_writemask(src_swz);
+}
--- /dev/null
+#include "radeon_program_constants.h"
+
+#ifndef RADEON_PROGRAM_UTIL_H
+#define RADEON_PROGRAM_UTIL_H
+
+unsigned int rc_swizzle_to_writemask(unsigned int swz);
+
+unsigned int rc_src_reads_dst_mask(
+ rc_register_file src_file,
+ unsigned int src_idx,
+ unsigned int src_swz,
+ rc_register_file dst_file,
+ unsigned int dst_idx,
+ unsigned int dst_mask);
+
+#endif /* RADEON_PROGRAM_UTIL_H */
/*
* Copyright (C) 2009 Nicolai Haehnle.
+ * Copyright 2010 Tom Stellard <tstellar@gmail.com>
*
* All Rights Reserved.
*
#include "radeon_dataflow.h"
+#include "radeon_compiler.h"
+#include "radeon_compiler_util.h"
#include "radeon_program.h"
struct read_write_mask_data {
else
remap_pair_instruction(inst, cb, userdata);
}
+
+/**
+ * @return RC_OPCODE_NOOP if inst is not a flow control instruction.
+ * @return The opcode of inst if it is a flow control instruction.
+ */
+static rc_opcode get_flow_control_inst(struct rc_instruction * inst)
+{
+ const struct rc_opcode_info * info;
+ if (inst->Type == RC_INSTRUCTION_NORMAL) {
+ info = rc_get_opcode_info(inst->U.I.Opcode);
+ } else {
+ info = rc_get_opcode_info(inst->U.P.RGB.Opcode);
+ /*A flow control instruction shouldn't have an alpha
+ * instruction.*/
+ assert(!info->IsFlowControl ||
+ inst->U.P.Alpha.Opcode == RC_OPCODE_NOP);
+ }
+
+ if (info->IsFlowControl)
+ return info->Opcode;
+ else
+ return RC_OPCODE_NOP;
+
+}
+
+struct get_readers_callback_data {
+ struct radeon_compiler * C;
+ struct rc_reader_data * ReaderData;
+ rc_read_src_fn ReadCB;
+ rc_read_write_mask_fn WriteCB;
+ unsigned int AliveWriteMask;
+};
+
+static void add_reader(
+ struct memory_pool * pool,
+ struct rc_reader_data * data,
+ struct rc_instruction * inst,
+ unsigned int mask,
+ struct rc_src_register * src)
+{
+ struct rc_reader * new;
+ memory_pool_array_reserve(pool, struct rc_reader, data->Readers,
+ data->ReaderCount, data->ReadersReserved, 1);
+ new = &data->Readers[data->ReaderCount++];
+ new->Inst = inst;
+ new->WriteMask = mask;
+ new->Src = src;
+}
+
+/**
+ * This function is used by rc_get_readers_normal() to determine whether inst
+ * is a reader of userdata->ReaderData->Writer
+ */
+static void get_readers_normal_read_callback(
+ void * userdata,
+ struct rc_instruction * inst,
+ struct rc_src_register * src)
+{
+ struct get_readers_callback_data * d = userdata;
+ unsigned int read_mask;
+
+ if (src->RelAddr)
+ d->ReaderData->Abort = 1;
+
+ unsigned int shared_mask = rc_src_reads_dst_mask(src->File, src->Index,
+ src->Swizzle,
+ d->ReaderData->Writer->U.I.DstReg.File,
+ d->ReaderData->Writer->U.I.DstReg.Index,
+ d->AliveWriteMask);
+
+ if (shared_mask == RC_MASK_NONE)
+ return;
+
+ /* If we make it this far, it means that this source reads from the
+ * same register written to by d->ReaderData->Writer. */
+
+ if (d->ReaderData->AbortOnRead) {
+ d->ReaderData->Abort = 1;
+ return;
+ }
+
+ read_mask = rc_swizzle_to_writemask(src->Swizzle);
+ /* XXX The behavior in this case should be configurable. */
+ if ((read_mask & d->AliveWriteMask) != read_mask) {
+ d->ReaderData->Abort = 1;
+ return;
+ }
+
+ d->ReadCB(d->ReaderData, inst, src);
+ if (d->ReaderData->Abort)
+ return;
+
+ add_reader(&d->C->Pool, d->ReaderData, inst, shared_mask, src);
+}
+
+/**
+ * This function is used by rc_get_readers_normal() to determine when
+ * userdata->ReaderData->Writer is dead (i. e. All compontents of its
+ * destination register have been overwritten by other instructions).
+ */
+static void get_readers_write_callback(
+ void *userdata,
+ struct rc_instruction * inst,
+ rc_register_file file,
+ unsigned int index,
+ unsigned int mask)
+{
+ struct get_readers_callback_data * d = userdata;
+
+ if (index == d->ReaderData->Writer->U.I.DstReg.Index
+ && file == d->ReaderData->Writer->U.I.DstReg.File) {
+ unsigned int shared_mask = mask
+ & d->ReaderData->Writer->U.I.DstReg.WriteMask;
+ if (d->ReaderData->InElse) {
+ if (shared_mask & d->AliveWriteMask) {
+ /* We set AbortOnRead here because the
+ * destination register of d->ReaderData->Writer
+ * is written to in both the IF and the
+ * ELSE block of this IF/ELSE statement.
+ * This means that readers of this
+ * destination register that follow this IF/ELSE
+ * statement use the value of different
+ * instructions depending on the control flow
+ * decisions made by the program. */
+ d->ReaderData->AbortOnRead = 1;
+ }
+ } else {
+ d->AliveWriteMask &= ~shared_mask;
+ }
+ }
+
+ d->WriteCB(d->ReaderData, inst, file, index, mask);
+}
+
+/**
+ * This function will create a list of readers via the rc_reader_data struct.
+ * This function will abort (set the flag data->Abort) and return if it
+ * encounters an instruction that reads from @param writer and also a different
+ * instruction. Here are some examples:
+ *
+ * writer = instruction 0;
+ * 0 MOV TEMP[0].xy, TEMP[1].xy
+ * 1 MOV TEMP[0].zw, TEMP[2].xy
+ * 2 MOV TEMP[3], TEMP[0]
+ * The Abort flag will be set on instruction 2, because it reads values written
+ * by instructions 0 and 1.
+ *
+ * writer = instruction 1;
+ * 0 IF TEMP[0].x
+ * 1 MOV TEMP[1], TEMP[2]
+ * 2 ELSE
+ * 3 MOV TEMP[1], TEMP[2]
+ * 4 ENDIF
+ * 5 MOV TEMP[3], TEMP[1]
+ * The Abort flag will be set on instruction 5, because it could read from the
+ * value written by either instruction 1 or 3, depending on the jump decision
+ * made at instruction 0.
+ *
+ * writer = instruction 0;
+ * 0 MOV TEMP[0], TEMP[1]
+ * 2 BGNLOOP
+ * 3 ADD TEMP[0], TEMP[0], none.1
+ * 4 ENDLOOP
+ * The Abort flag will be set on instruction 3, because in the first iteration
+ * of the loop it reads the value written by instruction 0 and in all other
+ * iterations it reads the value written by instruction 3.
+ *
+ * @param read_cb This function will be called for for every instruction that
+ * has been determined to be a reader of writer.
+ * @param write_cb This function will be called for every instruction after
+ * writer.
+ */
+void rc_get_readers_normal(
+ struct radeon_compiler * c,
+ struct rc_instruction * writer,
+ struct rc_reader_data * data,
+ rc_read_src_fn read_cb,
+ rc_read_write_mask_fn write_cb)
+{
+ struct rc_instruction * tmp;
+ struct get_readers_callback_data d;
+ unsigned int branch_depth = 0;
+
+ data->Writer = writer;
+ data->Abort = 0;
+ data->AbortOnRead = 0;
+ data->InElse = 0;
+ data->ReaderCount = 0;
+ data->ReadersReserved = 0;
+ data->Readers = NULL;
+
+ d.C = c;
+ d.AliveWriteMask = writer->U.I.DstReg.WriteMask;
+ d.ReaderData = data;
+ d.ReadCB = read_cb;
+ d.WriteCB = write_cb;
+
+ if (!writer->U.I.DstReg.WriteMask)
+ return;
+
+ for(tmp = writer->Next; tmp != &c->Program.Instructions;
+ tmp = tmp->Next){
+ rc_opcode opcode = get_flow_control_inst(tmp);
+ switch(opcode) {
+ case RC_OPCODE_BGNLOOP:
+ /* XXX We can do better when we see a BGNLOOP if we
+ * add a flag called AbortOnWrite to struct
+ * rc_reader_data and leave it set until the next
+ * ENDLOOP. */
+ case RC_OPCODE_ENDLOOP:
+ /* XXX We can do better when we see an ENDLOOP by
+ * searching backwards from writer and looking for
+ * readers of writer's destination index. If we find a
+ * reader before we get to the BGNLOOP, we must abort
+ * unless there is another writer between that reader
+ * and the BGNLOOP. */
+ data->Abort = 1;
+ return;
+ case RC_OPCODE_IF:
+ branch_depth++;
+ break;
+ case RC_OPCODE_ELSE:
+ if (branch_depth == 0)
+ data->InElse = 1;
+ break;
+ case RC_OPCODE_ENDIF:
+ if (branch_depth == 0) {
+ data->AbortOnRead = 1;
+ data->InElse = 0;
+ }
+ else {
+ branch_depth--;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (!data->InElse)
+ rc_for_all_reads_src(tmp, get_readers_normal_read_callback, &d);
+ rc_for_all_writes_mask(tmp, get_readers_write_callback, &d);
+
+ if (data->Abort)
+ return;
+
+ if (!d.AliveWriteMask)
+ return;
+ }
+}
/*
* Copyright (C) 2009 Nicolai Haehnle.
+ * Copyright 2010 Tom Stellard <tstellar@gmail.com>
*
* All Rights Reserved.
*
struct rc_swizzle_caps;
struct rc_src_register;
struct rc_pair_instruction_arg;
+struct rc_compiler;
/**
void rc_remap_registers(struct rc_instruction * inst, rc_remap_register_fn cb, void * userdata);
/*@}*/
+struct rc_reader {
+ struct rc_instruction * Inst;
+ unsigned int WriteMask;
+ struct rc_src_register * Src;
+};
+
+struct rc_reader_data {
+ unsigned int Abort;
+ unsigned int AbortOnRead;
+ unsigned int InElse;
+ struct rc_instruction * Writer;
+
+ unsigned int ReaderCount;
+ unsigned int ReadersReserved;
+ struct rc_reader * Readers;
+
+ void * CbData;
+};
+
+void rc_get_readers_normal(
+ struct radeon_compiler * c,
+ struct rc_instruction * inst,
+ struct rc_reader_data * data,
+ /*XXX: These should be their own function types. */
+ rc_read_src_fn read_cb,
+ rc_read_write_mask_fn write_cb);
/**
* Compiler passes based on dataflow analysis.
static void push_branch(struct deadcode_state * s)
{
+ struct branchinfo * branch;
+
memory_pool_array_reserve(&s->C->Pool, struct branchinfo, s->BranchStack,
s->BranchStackSize, s->BranchStackReserved, 1);
- struct branchinfo * branch = &s->BranchStack[s->BranchStackSize++];
+ branch = &s->BranchStack[s->BranchStackSize++];
branch->HaveElse = 0;
memcpy(&branch->StoreEndif, &s->R, sizeof(s->R));
}
const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
struct instruction_state * insts = &s->Instructions[inst->IP];
unsigned int usedmask = 0;
+ unsigned int srcmasks[3];
if (opcode->HasDstReg) {
unsigned char * pused = get_used_ptr(s, inst->U.I.DstReg.File, inst->U.I.DstReg.Index);
}
}
- unsigned int srcmasks[3];
rc_compute_sources_for_writemask(inst, usedmask, srcmasks);
for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) {
unsigned int nr_instructions;
unsigned has_temp_reladdr_src = 0;
rc_dataflow_mark_outputs_fn dce = (rc_dataflow_mark_outputs_fn)user;
+ unsigned int ip;
/* Give up if there is relative addressing of destination operands. */
for(struct rc_instruction * inst = c->Program.Instructions.Next;
update_instruction(&s, inst);
}
- unsigned int ip = 0;
+ ip = 0;
for(struct rc_instruction * inst = c->Program.Instructions.Next;
inst != &c->Program.Instructions;
inst = inst->Next, ++ip) {
const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
int dead = 1;
+ unsigned int srcmasks[3];
+ unsigned int usemask;
if (!opcode->HasDstReg) {
dead = 0;
continue;
}
- unsigned int srcmasks[3];
- unsigned int usemask = s.Instructions[ip].WriteMask;
+ usemask = s.Instructions[ip].WriteMask;
if (inst->U.I.WriteALUResult == RC_ALURESULT_X)
usemask |= RC_MASK_X;
static void handle_if(struct emulate_branch_state * s, struct rc_instruction * inst)
{
+ struct branch_info * branch;
+ struct rc_instruction * inst_mov;
+
memory_pool_array_reserve(&s->C->Pool, struct branch_info,
s->Branches, s->BranchCount, s->BranchReserved, 1);
DBG("%s\n", __FUNCTION__);
- struct branch_info * branch = &s->Branches[s->BranchCount++];
+ branch = &s->Branches[s->BranchCount++];
memset(branch, 0, sizeof(struct branch_info));
branch->If = inst;
/* Make a safety copy of the decision register, because we will need
* it at ENDIF time and it might be overwritten in both branches. */
- struct rc_instruction * inst_mov = rc_insert_new_instruction(s->C, inst->Prev);
+ inst_mov = rc_insert_new_instruction(s->C, inst->Prev);
inst_mov->U.I.Opcode = RC_OPCODE_MOV;
inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY;
inst_mov->U.I.DstReg.Index = rc_find_free_temporary(s->C);
static void handle_else(struct emulate_branch_state * s, struct rc_instruction * inst)
{
+ struct branch_info * branch;
+
if (!s->BranchCount) {
rc_error(s->C, "Encountered ELSE outside of branches");
return;
DBG("%s\n", __FUNCTION__);
- struct branch_info * branch = &s->Branches[s->BranchCount - 1];
+ branch = &s->Branches[s->BranchCount - 1];
branch->Else = inst;
}
static void handle_endif(struct emulate_branch_state * s, struct rc_instruction * inst)
{
+ struct branch_info * branch;
+ struct register_proxies IfProxies;
+ struct register_proxies ElseProxies;
+
if (!s->BranchCount) {
rc_error(s->C, "Encountered ENDIF outside of branches");
return;
DBG("%s\n", __FUNCTION__);
- struct branch_info * branch = &s->Branches[s->BranchCount - 1];
- struct register_proxies IfProxies;
- struct register_proxies ElseProxies;
+ branch = &s->Branches[s->BranchCount - 1];
memset(&IfProxies, 0, sizeof(IfProxies));
memset(&ElseProxies, 0, sizeof(ElseProxies));
*/
static void fix_output_writes(struct emulate_branch_state * s, struct rc_instruction * inst)
{
+ const struct rc_opcode_info * opcode;
+
if (!s->BranchCount)
return;
- const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
+ opcode = rc_get_opcode_info(inst->U.I.Opcode);
if (!opcode->HasDstReg)
return;
if (inst->U.I.DstReg.File == RC_FILE_OUTPUT) {
struct remap_output_data remap;
+ struct rc_instruction * inst_mov;
remap.Output = inst->U.I.DstReg.Index;
remap.Temporary = rc_find_free_temporary(s->C);
rc_remap_registers(inst, &remap_output_function, &remap);
}
- struct rc_instruction * inst_mov = rc_insert_new_instruction(s->C, s->C->Program.Instructions.Prev);
+ inst_mov = rc_insert_new_instruction(s->C, s->C->Program.Instructions.Prev);
inst_mov->U.I.Opcode = RC_OPCODE_MOV;
inst_mov->U.I.DstReg.File = RC_FILE_OUTPUT;
inst_mov->U.I.DstReg.Index = remap.Output;
void rc_emulate_branches(struct radeon_compiler *c, void *user)
{
struct emulate_branch_state s;
+ struct rc_instruction * ptr;
memset(&s, 0, sizeof(s));
s.C = c;
/* Untypical loop because we may remove the current instruction */
- struct rc_instruction * ptr = c->Program.Instructions.Next;
+ ptr = c->Program.Instructions.Next;
while(ptr != &c->Program.Instructions) {
struct rc_instruction * inst = ptr;
ptr = ptr->Next;
case RC_OPCODE_SNE:
break;
default:
- rc_error(c, "%s: expected conditional",
- __FUNCTION__);
return 0;
}
loop->Cond = loop->If->Prev;
loop = &s->Loops[s->LoopCount++];
- if (!build_loop_info(s->C, loop, inst))
+ if (!build_loop_info(s->C, loop, inst)) {
+ rc_error(s->C, "Failed to build loop info\n");
return 0;
+ }
if(try_unroll_loop(s->C, loop)){
return 1;
* loops are unrolled first.
*/
for( i = s->LoopCount - 1; i >= 0; i-- ){
+ unsigned int iterations;
+
if(!s->Loops[i].EndLoop){
continue;
}
- unsigned int iterations = loop_max_possible_iterations(
- s->C, &s->Loops[i]);
+ iterations = loop_max_possible_iterations(s->C, &s->Loops[i]);
unroll_loop(s->C, &s->Loops[i], iterations);
}
}
/*
* Copyright (C) 2009 Nicolai Haehnle.
+ * Copyright 2010 Tom Stellard <tstellar@gmail.com>
*
* All Rights Reserved.
*
#include "radeon_dataflow.h"
#include "radeon_compiler.h"
+#include "radeon_compiler_util.h"
#include "radeon_swizzle.h"
struct peephole_state {
int BranchDepth;
};
-/**
- * This is a callback function that is meant to be passed to
- * rc_for_all_reads_mask. This function will be called once for each source
- * register in inst.
- * @param inst The instruction that the source register belongs to.
- * @param file The register file of the source register.
- * @param index The index of the source register.
- * @param mask The components of the source register that are being read from.
- */
static void copy_propagate_scan_read(void * data, struct rc_instruction * inst,
- rc_register_file file, unsigned int index, unsigned int mask)
+ struct rc_src_register * src)
{
- struct copy_propagate_state * s = data;
+ rc_register_file file = src->File;
+ struct rc_reader_data * reader_data = data;
+ const struct rc_opcode_info * info = rc_get_opcode_info(inst->U.I.Opcode);
- /* XXX This could probably be handled better. */
- if (file == RC_FILE_ADDRESS) {
- s->Conflict = 1;
+ /* It is possible to do copy propigation in this situation,
+ * just not right now, see peephole_add_presub_inv() */
+ if (reader_data->Writer->U.I.PreSub.Opcode != RC_PRESUB_NONE &&
+ (info->NumSrcRegs > 2 || info->HasTexture)) {
+ reader_data->Abort = 1;
return;
}
- if (file != RC_FILE_TEMPORARY || index != s->Mov->U.I.DstReg.Index)
+ /* XXX This could probably be handled better. */
+ if (file == RC_FILE_ADDRESS) {
+ reader_data->Abort = 1;
return;
+ }
/* These instructions cannot read from the constants file.
* see radeonTransformTEX()
*/
- if(s->Mov->U.I.SrcReg[0].File != RC_FILE_TEMPORARY &&
- s->Mov->U.I.SrcReg[0].File != RC_FILE_INPUT &&
+ if(reader_data->Writer->U.I.SrcReg[0].File != RC_FILE_TEMPORARY &&
+ reader_data->Writer->U.I.SrcReg[0].File != RC_FILE_INPUT &&
(inst->U.I.Opcode == RC_OPCODE_TEX ||
inst->U.I.Opcode == RC_OPCODE_TXB ||
inst->U.I.Opcode == RC_OPCODE_TXP ||
inst->U.I.Opcode == RC_OPCODE_KIL)){
- s->Conflict = 1;
+ reader_data->Abort = 1;
return;
}
- if ((mask & s->MovMask) == mask) {
- if (s->SourceClobbered) {
- s->Conflict = 1;
- }
- } else if ((mask & s->DefinedMask) == mask) {
- /* read from something entirely written by other instruction: this is okay */
- } else {
- /* read from component combination that is not well-defined without
- * the MOV: cannot remove it */
- s->Conflict = 1;
- }
}
static void copy_propagate_scan_write(void * data, struct rc_instruction * inst,
rc_register_file file, unsigned int index, unsigned int mask)
{
- struct copy_propagate_state * s = data;
-
- if (s->BranchDepth < 0)
- return;
+ struct rc_reader_data * reader_data = data;
+ struct copy_propagate_state * s = reader_data->CbData;
- if (file == s->Mov->U.I.DstReg.File && index == s->Mov->U.I.DstReg.Index) {
- s->MovMask &= ~mask;
- if (s->BranchDepth == 0)
- s->DefinedMask |= mask;
- else
- s->DefinedMask &= ~mask;
- }
- if (file == s->Mov->U.I.SrcReg[0].File && index == s->Mov->U.I.SrcReg[0].Index) {
+ if (file == reader_data->Writer->U.I.SrcReg[0].File && index == reader_data->Writer->U.I.SrcReg[0].Index) {
if (mask & s->SourcedMask)
- s->SourceClobbered = 1;
+ reader_data->AbortOnRead = 1;
} else if (s->Mov->U.I.SrcReg[0].RelAddr && file == RC_FILE_ADDRESS) {
- s->SourceClobbered = 1;
+ reader_data->AbortOnRead = 1;
}
}
static void copy_propagate(struct radeon_compiler * c, struct rc_instruction * inst_mov)
{
struct copy_propagate_state s;
+ struct rc_reader_data reader_data;
+ unsigned int i;
if (inst_mov->U.I.DstReg.File != RC_FILE_TEMPORARY ||
inst_mov->U.I.DstReg.RelAddr ||
s.MovMask = inst_mov->U.I.DstReg.WriteMask;
s.DefinedMask = RC_MASK_XYZW & ~s.MovMask;
+ reader_data.CbData = &s;
+
for(unsigned int chan = 0; chan < 4; ++chan) {
unsigned int swz = GET_SWZ(inst_mov->U.I.SrcReg[0].Swizzle, chan);
s.SourcedMask |= (1 << swz) & RC_MASK_XYZW;
}
- /* 1st pass: Check whether all subsequent readers can be changed */
- for(struct rc_instruction * inst = inst_mov->Next;
- inst != &c->Program.Instructions;
- inst = inst->Next) {
- const struct rc_opcode_info * info = rc_get_opcode_info(inst->U.I.Opcode);
- /* XXX In the future we might be able to make the optimizer
- * smart enough to handle loops. */
- if(inst->U.I.Opcode == RC_OPCODE_BGNLOOP
- || inst->U.I.Opcode == RC_OPCODE_ENDLOOP){
- return;
- }
+ /* Get a list of all the readers of this MOV instruction. */
+ rc_get_readers_normal(c, inst_mov, &reader_data,
+ copy_propagate_scan_read, copy_propagate_scan_write);
- /* It is possible to do copy propigation in this situation,
- * just not right now, see peephole_add_presub_inv() */
- if (inst_mov->U.I.PreSub.Opcode != RC_PRESUB_NONE &&
- (info->NumSrcRegs > 2 || info->HasTexture)) {
- return;
- }
-
- rc_for_all_reads_mask(inst, copy_propagate_scan_read, &s);
- rc_for_all_writes_mask(inst, copy_propagate_scan_write, &s);
- if (s.Conflict)
- return;
-
- if (s.BranchDepth >= 0) {
- if (inst->U.I.Opcode == RC_OPCODE_IF) {
- s.BranchDepth++;
- } else if (inst->U.I.Opcode == RC_OPCODE_ENDIF
- || inst->U.I.Opcode == RC_OPCODE_ELSE) {
- s.BranchDepth--;
- if (s.BranchDepth < 0) {
- s.DefinedMask &= ~s.MovMask;
- s.MovMask = 0;
- }
- }
- }
- }
-
- if (s.Conflict)
+ if (reader_data.Abort || reader_data.ReaderCount == 0)
return;
- /* 2nd pass: We can satisfy all readers, so switch them over all at once */
- s.MovMask = inst_mov->U.I.DstReg.WriteMask;
- s.BranchDepth = 0;
-
- for(struct rc_instruction * inst = inst_mov->Next;
- inst != &c->Program.Instructions;
- inst = inst->Next) {
- const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
- for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) {
- if (inst->U.I.SrcReg[src].File == RC_FILE_TEMPORARY &&
- inst->U.I.SrcReg[src].Index == s.Mov->U.I.DstReg.Index) {
- unsigned int refmask = 0;
-
- for(unsigned int chan = 0; chan < 4; ++chan) {
- unsigned int swz = GET_SWZ(inst->U.I.SrcReg[src].Swizzle, chan);
- refmask |= (1 << swz) & RC_MASK_XYZW;
- }
+ /* Propagate the MOV instruction. */
+ for (i = 0; i < reader_data.ReaderCount; i++) {
+ struct rc_instruction * inst = reader_data.Readers[i].Inst;
+ *reader_data.Readers[i].Src = chain_srcregs(*reader_data.Readers[i].Src, s.Mov->U.I.SrcReg[0]);
- if ((refmask & s.MovMask) == refmask) {
- inst->U.I.SrcReg[src] = chain_srcregs(inst->U.I.SrcReg[src], s.Mov->U.I.SrcReg[0]);
- if (s.Mov->U.I.SrcReg[0].File == RC_FILE_PRESUB)
- inst->U.I.PreSub = s.Mov->U.I.PreSub;
- }
- }
- }
-
- if (opcode->HasDstReg) {
- if (inst->U.I.DstReg.File == RC_FILE_TEMPORARY &&
- inst->U.I.DstReg.Index == s.Mov->U.I.DstReg.Index) {
- s.MovMask &= ~inst->U.I.DstReg.WriteMask;
- }
- }
-
- if (s.BranchDepth >= 0) {
- if (inst->U.I.Opcode == RC_OPCODE_IF) {
- s.BranchDepth++;
- } else if (inst->U.I.Opcode == RC_OPCODE_ENDIF
- || inst->U.I.Opcode == RC_OPCODE_ELSE) {
- s.BranchDepth--;
- if (s.BranchDepth < 0)
- break; /* no more readers after this point */
- }
- }
+ if (s.Mov->U.I.SrcReg[0].File == RC_FILE_PRESUB)
+ inst->U.I.PreSub = s.Mov->U.I.PreSub;
}
/* Finally, remove the original MOV instruction */
static void constant_folding(struct radeon_compiler * c, struct rc_instruction * inst)
{
const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
+ unsigned int i;
/* Replace 0.0, 1.0 and 0.5 immediates by their explicit swizzles */
for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) {
+ struct rc_constant * constant;
+ struct rc_src_register newsrc;
+ int have_real_reference;
+
if (inst->U.I.SrcReg[src].File != RC_FILE_CONSTANT ||
inst->U.I.SrcReg[src].RelAddr ||
inst->U.I.SrcReg[src].Index >= c->Program.Constants.Count)
continue;
- struct rc_constant * constant =
+ constant =
&c->Program.Constants.Constants[inst->U.I.SrcReg[src].Index];
if (constant->Type != RC_CONSTANT_IMMEDIATE)
continue;
- struct rc_src_register newsrc = inst->U.I.SrcReg[src];
- int have_real_reference = 0;
+ newsrc = inst->U.I.SrcReg[src];
+ have_real_reference = 0;
for(unsigned int chan = 0; chan < 4; ++chan) {
unsigned int swz = GET_SWZ(newsrc.Swizzle, chan);
+ unsigned int newswz;
+ float imm;
+ float baseimm;
+
if (swz >= 4)
continue;
- unsigned int newswz;
- float imm = constant->u.Immediate[swz];
- float baseimm = imm;
+ imm = constant->u.Immediate[swz];
+ baseimm = imm;
if (imm < 0.0)
baseimm = -baseimm;
constant_folding_mul(inst);
else if (inst->U.I.Opcode == RC_OPCODE_ADD)
constant_folding_add(inst);
+
+ /* In case this instruction has been converted, make sure all of the
+ * registers that are no longer used are empty. */
+ opcode = rc_get_opcode_info(inst->U.I.Opcode);
+ for(i = opcode->NumSrcRegs; i < 3; i++) {
+ memset(&inst->U.I.SrcReg[i], 0, sizeof(struct rc_src_register));
+ }
}
/**
static unsigned int src_reads_dst_mask(struct rc_src_register src,
struct rc_dst_register dst)
{
- unsigned int mask = 0;
- unsigned int i;
if (dst.File != src.File || dst.Index != src.Index) {
return 0;
}
-
- for(i = 0; i < 4; i++) {
- mask |= 1 << GET_SWZ(src.Swizzle, i);
- }
- mask &= RC_MASK_XYZW;
-
- return mask;
+ return rc_swizzle_to_writemask(src.Swizzle);
}
/* Return 1 if the source registers has a constant swizzle (e.g. 0, 0.5, 1.0)
{
struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)cc;
struct regalloc_state s;
+ int temp_reg_offset;
compute_live_intervals(cc, &s);
c->AllocateHwInputs(c, &alloc_input, &s);
- int temp_reg_offset = 0;
+ temp_reg_offset = 0;
for (unsigned i = 0; i < RC_REGISTER_MAX_INDEX; i++) {
if (s.Input[i].Allocated && temp_reg_offset <= s.Input[i].Index)
temp_reg_offset = s.Input[i].Index + 1;
static void emit_all_tex(struct schedule_state * s, struct rc_instruction * before)
{
struct schedule_instruction *readytex;
+ struct rc_instruction * inst_begin;
assert(s->ReadyTEX);
/* Node marker for R300 */
- struct rc_instruction * inst_begin = rc_insert_new_instruction(s->C, before->Prev);
+ inst_begin = rc_insert_new_instruction(s->C, before->Prev);
inst_begin->U.I.Opcode = RC_OPCODE_BEGIN_TEX;
/* Link texture instructions back in */
}
}
+/* This is a helper function for destructive_merge_instructions(). It helps
+ * merge presubtract sources from two instructions and makes sure the
+ * presubtract sources end up in the correct spot. This function assumes that
+ * dst_full is an rgb instruction, meaning that it has a vector instruction(rgb)
+ * but no scalar instruction (alpha).
+ * @return 0 if merging the presubtract sources fails.
+ * @retrun 1 if merging the presubtract sources succeeds.
+ */
+static int merge_presub_sources(
+ struct rc_pair_instruction * dst_full,
+ struct rc_pair_sub_instruction src,
+ unsigned int type)
+{
+ unsigned int srcp_src, srcp_regs, is_rgb, is_alpha;
+ struct rc_pair_sub_instruction * dst_sub;
+
+ assert(dst_full->Alpha.Opcode == RC_OPCODE_NOP);
+
+ switch(type) {
+ case RC_PAIR_SOURCE_RGB:
+ is_rgb = 1;
+ is_alpha = 0;
+ dst_sub = &dst_full->RGB;
+ break;
+ case RC_PAIR_SOURCE_ALPHA:
+ is_rgb = 0;
+ is_alpha = 1;
+ dst_sub = &dst_full->Alpha;
+ break;
+ default:
+ assert(0);
+ return 0;
+ }
+
+ const struct rc_opcode_info * info =
+ rc_get_opcode_info(dst_full->RGB.Opcode);
+ if (dst_sub->Src[RC_PAIR_PRESUB_SRC].Used)
+ return 0;
+
+ srcp_regs = rc_presubtract_src_reg_count(
+ src.Src[RC_PAIR_PRESUB_SRC].Index);
+ for(srcp_src = 0; srcp_src < srcp_regs; srcp_src++) {
+ unsigned int arg;
+ int free_source;
+ unsigned int one_way = 0;
+ struct rc_pair_instruction_source srcp = src.Src[srcp_src];
+ struct rc_pair_instruction_source temp;
+
+ free_source = rc_pair_alloc_source(dst_full, is_rgb, is_alpha,
+ srcp.File, srcp.Index);
+
+ /* If free_source < 0 then there are no free source
+ * slots. */
+ if (free_source < 0)
+ return 0;
+
+ temp = dst_sub->Src[srcp_src];
+ dst_sub->Src[srcp_src] = dst_sub->Src[free_source];
+
+ /* srcp needs src0 and src1 to be the same */
+ if (free_source < srcp_src) {
+ if (!temp.Used)
+ continue;
+ free_source = rc_pair_alloc_source(dst_full, is_rgb,
+ is_alpha, temp.File, temp.Index);
+ one_way = 1;
+ } else {
+ dst_sub->Src[free_source] = temp;
+ }
+
+ /* If free_source == srcp_src, then the presubtract
+ * source is already in the correct place. */
+ if (free_source == srcp_src)
+ continue;
+
+ /* Shuffle the sources, so we can put the
+ * presubtract source in the correct place. */
+ for(arg = 0; arg < info->NumSrcRegs; arg++) {
+ /*If this arg does not read from an rgb source,
+ * do nothing. */
+ if (!(rc_source_type_that_arg_reads(
+ dst_full->RGB.Arg[arg].Source,
+ dst_full->RGB.Arg[arg].Swizzle) & type)) {
+ continue;
+ }
+ if (dst_full->RGB.Arg[arg].Source == srcp_src)
+ dst_full->RGB.Arg[arg].Source = free_source;
+ /* We need to do this just in case register
+ * is one of the sources already, but in the
+ * wrong spot. */
+ else if(dst_full->RGB.Arg[arg].Source == free_source
+ && !one_way) {
+ dst_full->RGB.Arg[arg].Source = srcp_src;
+ }
+ }
+ }
+ return 1;
+}
+
+/* This function assumes that rgb.Alpha and alpha.RGB are unused */
static int destructive_merge_instructions(
struct rc_pair_instruction * rgb,
struct rc_pair_instruction * alpha)
{
const struct rc_opcode_info * opcode;
+
assert(rgb->Alpha.Opcode == RC_OPCODE_NOP);
assert(alpha->RGB.Opcode == RC_OPCODE_NOP);
* src1. */
/* Merge the rgb presubtract registers. */
- const struct rc_opcode_info * rgb_info =
- rc_get_opcode_info(rgb->RGB.Opcode);
if (alpha->RGB.Src[RC_PAIR_PRESUB_SRC].Used) {
- unsigned int srcp_src;
- unsigned int srcp_regs;
- if (rgb->RGB.Src[RC_PAIR_PRESUB_SRC].Used)
+ if (!merge_presub_sources(rgb, alpha->RGB, RC_PAIR_SOURCE_RGB)) {
return 0;
- srcp_regs = rc_presubtract_src_reg_count(
- alpha->RGB.Src[RC_PAIR_PRESUB_SRC].Index);
- for(srcp_src = 0; srcp_src < srcp_regs; srcp_src++) {
- unsigned int arg;
- int free_source;
- unsigned int one_way = 0;
- struct rc_pair_instruction_source srcp =
- alpha->RGB.Src[srcp_src];
- struct rc_pair_instruction_source temp;
- /* 2nd arg of 1 means this is an rgb source.
- * 3rd arg of 0 means this is not an alpha source. */
- free_source = rc_pair_alloc_source(rgb, 1, 0,
- srcp.File, srcp.Index);
- /* If free_source < 0 then there are no free source
- * slots. */
- if (free_source < 0)
- return 0;
-
- temp = rgb->RGB.Src[srcp_src];
- rgb->RGB.Src[srcp_src] = rgb->RGB.Src[free_source];
- /* srcp needs src0 and src1 to be the same */
- if (free_source < srcp_src) {
- if (!temp.Used)
- continue;
- free_source = rc_pair_alloc_source(rgb, 1, 0,
- srcp.File, srcp.Index);
- one_way = 1;
- } else {
- rgb->RGB.Src[free_source] = temp;
- }
- /* If free_source == srcp_src, then the presubtract
- * source is already in the correct place. */
- if (free_source == srcp_src)
- continue;
- /* Shuffle the sources, so we can put the
- * presubtract source in the correct place. */
- for (arg = 0; arg < rgb_info->NumSrcRegs; arg++) {
- /*If this arg does not read from an rgb source,
- * do nothing. */
- if (rc_source_type_that_arg_reads(
- rgb->RGB.Arg[arg].Source,
- rgb->RGB.Arg[arg].Swizzle, 3)
- != RC_PAIR_SOURCE_RGB) {
- continue;
- }
- if (rgb->RGB.Arg[arg].Source == srcp_src)
- rgb->RGB.Arg[arg].Source = free_source;
- /* We need to do this just in case register
- * is one of the sources already, but in the
- * wrong spot. */
- else if(rgb->RGB.Arg[arg].Source == free_source
- && !one_way) {
- rgb->RGB.Arg[arg].Source = srcp_src;
- }
- }
}
}
-
/* Merge the alpha presubtract registers */
if (alpha->Alpha.Src[RC_PAIR_PRESUB_SRC].Used) {
- unsigned int srcp_src;
- unsigned int srcp_regs;
- if(rgb->Alpha.Src[RC_PAIR_PRESUB_SRC].Used)
+ if(!merge_presub_sources(rgb, alpha->Alpha, RC_PAIR_SOURCE_ALPHA)){
return 0;
-
- srcp_regs = rc_presubtract_src_reg_count(
- alpha->Alpha.Src[RC_PAIR_PRESUB_SRC].Index);
- for(srcp_src = 0; srcp_src < srcp_regs; srcp_src++) {
- unsigned int arg;
- int free_source;
- unsigned int one_way = 0;
- struct rc_pair_instruction_source srcp =
- alpha->Alpha.Src[srcp_src];
- struct rc_pair_instruction_source temp;
- /* 2nd arg of 0 means this is not an rgb source.
- * 3rd arg of 1 means this is an alpha source. */
- free_source = rc_pair_alloc_source(rgb, 0, 1,
- srcp.File, srcp.Index);
- /* If free_source < 0 then there are no free source
- * slots. */
- if (free_source < 0)
- return 0;
-
- temp = rgb->Alpha.Src[srcp_src];
- rgb->Alpha.Src[srcp_src] = rgb->Alpha.Src[free_source];
- /* srcp needs src0 and src1 to be the same. */
- if (free_source < srcp_src) {
- if (!temp.Used)
- continue;
- free_source = rc_pair_alloc_source(rgb, 0, 1,
- temp.File, temp.Index);
- one_way = 1;
- } else {
- rgb->Alpha.Src[free_source] = temp;
- }
- /* If free_source == srcp_src, then the presubtract
- * source is already in the correct place. */
- if (free_source == srcp_src)
- continue;
- /* Shuffle the sources, so we can put the
- * presubtract source in the correct place. */
- for(arg = 0; arg < rgb_info->NumSrcRegs; arg++) {
- /*If this arg does not read from an alpha
- * source, do nothing. */
- if (rc_source_type_that_arg_reads(
- rgb->RGB.Arg[arg].Source,
- rgb->RGB.Arg[arg].Swizzle, 3)
- != RC_PAIR_SOURCE_ALPHA) {
- continue;
- }
- if (rgb->RGB.Arg[arg].Source == srcp_src)
- rgb->RGB.Arg[arg].Source = free_source;
- else if (rgb->RGB.Arg[arg].Source == free_source
- && !one_way) {
- rgb->RGB.Arg[arg].Source = srcp_src;
- }
- }
}
}
unsigned int oldsrc = alpha->Alpha.Arg[arg].Source;
rc_register_file file = 0;
unsigned int index = 0;
+ int source;
if (alpha->Alpha.Arg[arg].Swizzle < 3) {
srcrgb = 1;
index = alpha->Alpha.Src[oldsrc].Index;
}
- int source = rc_pair_alloc_source(rgb, srcrgb, srcalpha, file, index);
+ source = rc_pair_alloc_source(rgb, srcrgb, srcalpha, file, index);
if (source < 0)
return 0;
{
struct rc_pair_instruction backup;
+ /*Instructions can't write output registers and ALU result at the
+ * same time. */
+ if ((rgb->WriteALUResult && alpha->Alpha.OutputWriteMask)
+ || (rgb->RGB.OutputWriteMask && alpha->WriteALUResult)) {
+ return 0;
+ }
memcpy(&backup, rgb, sizeof(struct rc_pair_instruction));
if (destructive_merge_instructions(rgb, alpha))
{
struct schedule_state * s = data;
struct reg_value * v = get_reg_value(s, file, index, chan);
+ struct reg_value_reader * reader;
if (!v)
return;
DBG("%i: read %i[%i] chan %i\n", s->Current->Instruction->IP, file, index, chan);
- struct reg_value_reader * reader = memory_pool_malloc(&s->C->Pool, sizeof(*reader));
+ reader = memory_pool_malloc(&s->C->Pool, sizeof(*reader));
reader->Reader = s->Current;
reader->Next = v->Readers;
v->Readers = reader;
{
struct schedule_state * s = data;
struct reg_value ** pv = get_reg_valuep(s, file, index, chan);
+ struct reg_value * newv;
if (!pv)
return;
DBG("%i: write %i[%i] chan %i\n", s->Current->Instruction->IP, file, index, chan);
- struct reg_value * newv = memory_pool_malloc(&s->C->Pool, sizeof(*newv));
+ newv = memory_pool_malloc(&s->C->Pool, sizeof(*newv));
memset(newv, 0, sizeof(*newv));
newv->Writer = s->Current;
struct rc_instruction * begin, struct rc_instruction * end)
{
struct schedule_state s;
+ unsigned int ip;
memset(&s, 0, sizeof(s));
s.C = &c->Base;
/* Scan instructions for data dependencies */
- unsigned int ip = 0;
+ ip = 0;
for(struct rc_instruction * inst = begin; inst != end; inst = inst->Next) {
s.Current = memory_pool_malloc(&c->Base.Pool, sizeof(*s.Current));
memset(s.Current, 0, sizeof(struct schedule_instruction));
struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)cc;
struct rc_instruction * inst = c->Base.Program.Instructions.Next;
while(inst != &c->Base.Program.Instructions) {
+ struct rc_instruction * first;
+
if (is_controlflow(inst)) {
inst = inst->Next;
continue;
}
- struct rc_instruction * first = inst;
+ first = inst;
while(inst != &c->Base.Program.Instructions && !is_controlflow(inst))
inst = inst->Next;
struct rc_pair_instruction * pair,
struct rc_sub_instruction * inst)
{
+ int needrgb, needalpha, istranscendent;
+ const struct rc_opcode_info * opcode;
+ int i;
+
memset(pair, 0, sizeof(struct rc_pair_instruction));
- int needrgb, needalpha, istranscendent;
classify_instruction(inst, &needrgb, &needalpha, &istranscendent);
if (needrgb) {
pair->Alpha.Saturate = 1;
}
- const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode);
- int i;
+ opcode = rc_get_opcode_info(inst->Opcode);
/* Presubtract handling:
* We need to make sure that the values used by the presubtract
for(struct rc_instruction * inst = c->Base.Program.Instructions.Next;
inst != &c->Base.Program.Instructions;
inst = inst->Next) {
+ const struct rc_opcode_info * opcode;
+ struct rc_sub_instruction copy;
+
if (inst->Type != RC_INSTRUCTION_NORMAL)
continue;
- const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
+ opcode = rc_get_opcode_info(inst->U.I.Opcode);
if (opcode->HasTexture || opcode->IsFlowControl || opcode->Opcode == RC_OPCODE_KIL)
continue;
- struct rc_sub_instruction copy = inst->U.I;
+ copy = inst->U.I;
check_opcode_support(c, ©);
struct rc_instruction* inst,
void* unused)
{
+ unsigned int constants[2];
+ unsigned int tempreg;
+
if (inst->U.I.Opcode != RC_OPCODE_COS &&
inst->U.I.Opcode != RC_OPCODE_SIN &&
inst->U.I.Opcode != RC_OPCODE_SCS)
return 0;
- unsigned int constants[2];
- unsigned int tempreg = rc_find_free_temporary(c);
+ tempreg = rc_find_free_temporary(c);
sincos_constants(c, constants);
swizzle_wwww(srcreg(RC_FILE_TEMPORARY, tempreg)),
constants);
} else {
+ struct rc_dst_register dst;
+
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_XY),
swizzle_xxxx(inst->U.I.SrcReg[0]),
swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[1])),
swizzle_wwww(srcreg(RC_FILE_CONSTANT, constants[1])),
negate(swizzle_zzzz(srcreg(RC_FILE_CONSTANT, constants[0]))));
- struct rc_dst_register dst = inst->U.I.DstReg;
+ dst = inst->U.I.DstReg;
dst.WriteMask = inst->U.I.DstReg.WriteMask & RC_MASK_X;
sin_approx(c, inst, dst,
struct rc_instruction* inst,
void* unused)
{
- if (inst->U.I.Opcode != RC_OPCODE_COS &&
- inst->U.I.Opcode != RC_OPCODE_SIN &&
- inst->U.I.Opcode != RC_OPCODE_SCS)
- return 0;
-
static const float RCP_2PI = 0.15915494309189535;
unsigned int temp;
unsigned int constant;
unsigned int constant_swizzle;
+ if (inst->U.I.Opcode != RC_OPCODE_COS &&
+ inst->U.I.Opcode != RC_OPCODE_SIN &&
+ inst->U.I.Opcode != RC_OPCODE_SCS)
+ return 0;
+
temp = rc_find_free_temporary(c);
constant = rc_constants_add_immediate_scalar(&c->Program.Constants, RCP_2PI, &constant_swizzle);
struct rc_instruction *inst,
void *unused)
{
+ static const float cons[4] = {0.15915494309189535, 0.5, 6.28318530717959, -3.14159265358979};
+ unsigned int temp;
+ unsigned int constant;
+
if (inst->U.I.Opcode != RC_OPCODE_COS &&
inst->U.I.Opcode != RC_OPCODE_SIN &&
inst->U.I.Opcode != RC_OPCODE_SCS)
* repeat(x) = frac(x / 2PI + 0.5) * 2PI - PI
*/
- static const float cons[4] = {0.15915494309189535, 0.5, 6.28318530717959, -3.14159265358979};
- unsigned int temp;
- unsigned int constant;
-
temp = rc_find_free_temporary(c);
constant = rc_constants_add_immediate_vec4(&c->Program.Constants, cons);
/*return 0 for rgb, 1 for alpha -1 for error. */
-rc_pair_source_type rc_source_type_that_arg_reads(
+unsigned int rc_source_type_that_arg_reads(
unsigned int source,
- unsigned int swizzle,
- unsigned int channels)
+ unsigned int swizzle)
{
unsigned int chan;
unsigned int swz = RC_SWIZZLE_UNUSED;
- int isRGB = 0;
- int isAlpha = 0;
- /* Find a swizzle that is either X,Y,Z,or W. We assume here
- * that if one channel swizzles X,Y, or Z, then none of the
- * other channels swizzle W, and vice-versa. */
- for(chan = 0; chan < channels; chan++) {
+ unsigned int ret = RC_PAIR_SOURCE_NONE;
+
+ for(chan = 0; chan < 3; chan++) {
swz = GET_SWZ(swizzle, chan);
if (swz == RC_SWIZZLE_W) {
- isAlpha = 1;
+ ret |= RC_PAIR_SOURCE_ALPHA;
} else if (swz == RC_SWIZZLE_X || swz == RC_SWIZZLE_Y
|| swz == RC_SWIZZLE_Z) {
- isRGB = 1;
+ ret |= RC_PAIR_SOURCE_RGB;
}
}
- assert(!isRGB || !isAlpha);
-
- if(!isRGB && !isAlpha)
- return RC_PAIR_SOURCE_NONE;
-
- if (isRGB)
- return RC_PAIR_SOURCE_RGB;
- /*isAlpha*/
- return RC_PAIR_SOURCE_ALPHA;
+ return ret;
}
*/
#define RC_PAIR_PRESUB_SRC 3
+#define RC_PAIR_SOURCE_NONE 0x0
+#define RC_PAIR_SOURCE_RGB 0x1
+#define RC_PAIR_SOURCE_ALPHA 0x2
+
struct rc_pair_instruction_source {
unsigned int Used:1;
unsigned int File:3;
typedef void (*rc_pair_foreach_src_fn)
(void *, struct rc_pair_instruction_source *);
-typedef enum {
- RC_PAIR_SOURCE_NONE = 0,
- RC_PAIR_SOURCE_RGB,
- RC_PAIR_SOURCE_ALPHA
-} rc_pair_source_type;
-
/**
* General helper functions for dealing with the paired instruction format.
*/
void * data,
rc_pair_foreach_src_fn cb);
-rc_pair_source_type rc_source_type_that_arg_reads(
+unsigned int rc_source_type_that_arg_reads(
unsigned int source,
- unsigned int swizzle,
- unsigned int channels);
+ unsigned int swizzle);
/*@}*/
unsigned are_externals_remapped = 0;
struct rc_constant *constants = c->Program.Constants.Constants;
struct mark_used_data d;
+ unsigned new_count;
if (!c->Program.Constants.Count) {
*out_remap_table = NULL;
* This pass removes unused constants simply by overwriting them by other constants. */
remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned));
inv_remap_table = malloc(c->Program.Constants.Count * sizeof(unsigned));
- unsigned new_count = 0;
+ new_count = 0;
for (unsigned i = 0; i < c->Program.Constants.Count; i++) {
if (const_used[i]) {
free(const_used);
free(inv_remap_table);
- if (c->Debug)
+ if (c->Debug & RC_DBG_LOG)
rc_constants_print(&c->Program.Constants);
}
inst != &c->Program.Instructions;
inst = inst->Next) {
const struct rc_opcode_info * info;
+ unsigned int old_index, temp_index;
+ struct rc_dst_register * dst;
if(inst->Type != RC_INSTRUCTION_NORMAL) {
rc_error(c, "%s only works with normal instructions.",
__FUNCTION__);
return;
}
- unsigned int old_index, temp_index;
- struct rc_dst_register * dst = &inst->U.I.DstReg;
+ dst = &inst->U.I.DstReg;
info = rc_get_opcode_info(inst->U.I.Opcode);
if(!info->HasDstReg || dst->File != RC_FILE_TEMPORARY) {
continue;
* @param[in] height region height
* @param[in] flip_y set if y coords of the source image need to be flipped
*/
-unsigned r300_blit(GLcontext *ctx,
+unsigned r300_blit(struct gl_context *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
gl_format src_mesaformat,
unsigned r300_check_blit(gl_format mesa_format);
-unsigned r300_blit(GLcontext *ctx,
+unsigned r300_blit(struct gl_context *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
gl_format src_mesaformat,
#define vpu_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count)
#define r500fp_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->r500fp.count)
-static int check_vpu(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_vpu(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
int cnt;
return cnt ? (cnt * 4) + extra : 0;
}
-static int check_vpp(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_vpp(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
int cnt;
END_BATCH();
}
-static void emit_vpu_state(GLcontext *ctx, struct radeon_state_atom * atom)
+static void emit_vpu_state(struct gl_context *ctx, struct radeon_state_atom * atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
drm_r300_cmd_header_t cmd;
r300_emit_vpu(r300, &atom->cmd[1], vpu_count(atom->cmd) * 4, addr);
}
-static void emit_vpp_state(GLcontext *ctx, struct radeon_state_atom * atom)
+static void emit_vpp_state(struct gl_context *ctx, struct radeon_state_atom * atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
drm_r300_cmd_header_t cmd;
END_BATCH();
}
-static void emit_r500fp_atom(GLcontext *ctx, struct radeon_state_atom * atom)
+static void emit_r500fp_atom(struct gl_context *ctx, struct radeon_state_atom * atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
drm_r300_cmd_header_t cmd;
r500_emit_fp(r300, &atom->cmd[1], count, addr, type, clamp);
}
-static int check_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom)
+static int check_tex_offsets(struct gl_context *ctx, struct radeon_state_atom * atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
int numtmus = packet0_count(r300, r300->hw.tex.offset.cmd);
return dw;
}
-static void emit_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom)
+static void emit_tex_offsets(struct gl_context *ctx, struct radeon_state_atom * atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
BATCH_LOCALS(&r300->radeon);
}
}
-void r300_emit_scissor(GLcontext *ctx)
+void r300_emit_scissor(struct gl_context *ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
BATCH_LOCALS(&r300->radeon);
OUT_BATCH((x2 << R300_SCISSORS_X_SHIFT)|(y2 << R300_SCISSORS_Y_SHIFT));
END_BATCH();
}
-static int check_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom)
+static int check_cb_offset(struct gl_context *ctx, struct radeon_state_atom * atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
uint32_t dw = 6 + 3 + 16;
END_BATCH();
}
-static void emit_cb_offset_atom(GLcontext *ctx, struct radeon_state_atom * atom)
+static void emit_cb_offset_atom(struct gl_context *ctx, struct radeon_state_atom * atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
struct radeon_renderbuffer *rrb;
}
}
-static int check_zb_offset(GLcontext *ctx, struct radeon_state_atom * atom)
+static int check_zb_offset(struct gl_context *ctx, struct radeon_state_atom * atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
uint32_t dw;
return dw;
}
-static void emit_zb_offset(GLcontext *ctx, struct radeon_state_atom * atom)
+static void emit_zb_offset(struct gl_context *ctx, struct radeon_state_atom * atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
BATCH_LOCALS(&r300->radeon);
END_BATCH();
}
-static void emit_zstencil_format(GLcontext *ctx, struct radeon_state_atom * atom)
+static void emit_zstencil_format(struct gl_context *ctx, struct radeon_state_atom * atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
BATCH_LOCALS(&r300->radeon);
END_BATCH();
}
-static int check_never(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_never(struct gl_context *ctx, struct radeon_state_atom *atom)
{
return 0;
}
-static int check_always(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_always(struct gl_context *ctx, struct radeon_state_atom *atom)
{
return atom->cmd_size;
}
-static int check_variable(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_variable(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
int cnt;
return cnt ? cnt + 1 : 0;
}
-static int check_r500fp(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_r500fp(struct gl_context *ctx, struct radeon_state_atom *atom)
{
int cnt;
r300ContextPtr r300 = R300_CONTEXT(ctx);
return cnt ? (cnt * 6) + extra : 0;
}
-static int check_r500fp_const(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_r500fp_const(struct gl_context *ctx, struct radeon_state_atom *atom)
{
int cnt;
r300ContextPtr r300 = R300_CONTEXT(ctx);
#define SCISSORS_BUFSZ (3)
void r300InitCmdBuf(r300ContextPtr r300);
-void r300_emit_scissor(GLcontext *ctx);
+void r300_emit_scissor(struct gl_context *ctx);
void r300_emit_vpu(struct r300_context *ctx,
uint32_t *data,
end_3d(radeon);
}
-static void r300_fallback(GLcontext *ctx, GLuint bit, GLboolean mode)
+static void r300_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
if (mode)
}
}
-static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
+static void r300InitConstValues(struct gl_context *ctx, radeonScreenPtr screen)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
r300->options = options;
}
-static void r300InitGLExtensions(GLcontext *ctx)
+static void r300InitGLExtensions(struct gl_context *ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
/* Create the device specific rendering context.
*/
GLboolean r300CreateContext(gl_api api,
- const __GLcontextModes * glVisual,
+ const struct gl_config * glVisual,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
struct dd_function_table functions;
r300ContextPtr r300;
- GLcontext *ctx;
+ struct gl_context *ctx;
assert(glVisual);
assert(driContextPriv);
};
struct r300_vtable {
- void (* SetupRSUnit)(GLcontext *ctx);
- void (* SetupFragmentShaderTextures)(GLcontext *ctx, int *tmu_mappings);
- void (* SetupPixelShader)(GLcontext *ctx);
+ void (* SetupRSUnit)(struct gl_context *ctx);
+ void (* SetupFragmentShaderTextures)(struct gl_context *ctx, int *tmu_mappings);
+ void (* SetupPixelShader)(struct gl_context *ctx);
};
struct r300_vertex_buffer {
extern void r300DestroyContext(__DRIcontext * driContextPriv);
extern GLboolean r300CreateContext(gl_api api,
- const __GLcontextModes * glVisual,
+ const struct gl_config * glVisual,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
extern void r300InitShaderFunctions(r300ContextPtr r300);
-extern void r300InitDraw(GLcontext *ctx);
+extern void r300InitDraw(struct gl_context *ctx);
#define r300PackFloat32 radeonPackFloat32
#define r300PackFloat24 radeonPackFloat24
}
}
-static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf)
+static void r300FixupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
GLvoid *src_ptr;
}
-static void r300SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf)
+static void r300SetupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
* Convert attribute data type to float
* If the attribute uses named buffer object replace the bo with newly allocated bo
*/
-static void r300ConvertAttrib(GLcontext *ctx, int count, const struct gl_client_array *input, struct vertex_attribute *attr)
+static void r300ConvertAttrib(struct gl_context *ctx, int count, const struct gl_client_array *input, struct vertex_attribute *attr)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
const GLvoid *src_ptr;
}
}
-static void r300AlignDataToDword(GLcontext *ctx, const struct gl_client_array *input, int count, struct vertex_attribute *attr)
+static void r300AlignDataToDword(struct gl_context *ctx, const struct gl_client_array *input, int count, struct vertex_attribute *attr)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
const int dst_stride = (input->StrideB + 3) & ~3;
attr->stride = dst_stride;
}
-static void r300TranslateAttrib(GLcontext *ctx, GLuint attr, int count, const struct gl_client_array *input)
+static void r300TranslateAttrib(struct gl_context *ctx, GLuint attr, int count, const struct gl_client_array *input)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
struct r300_vertex_buffer *vbuf = &r300->vbuf;
++vbuf->num_attribs;
}
-static void r300SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count)
+static void r300SetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
struct r300_vertex_buffer *vbuf = &r300->vbuf;
return;
}
-static void r300AllocDmaRegions(GLcontext *ctx, const struct gl_client_array *input[], int count)
+static void r300AllocDmaRegions(struct gl_context *ctx, const struct gl_client_array *input[], int count)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
struct r300_vertex_buffer *vbuf = &r300->vbuf;
}
-static void r300FreeData(GLcontext *ctx)
+static void r300FreeData(struct gl_context *ctx)
{
/* Need to zero tcl.aos[n].bo and tcl.elt_dma_bo
* to prevent double unref in radeonReleaseArrays
}
}
-static GLuint r300PredictTryDrawPrimsSize(GLcontext *ctx,
+static GLuint r300PredictTryDrawPrimsSize(struct gl_context *ctx,
GLuint nr_prims, const struct _mesa_prim *prim)
{
struct r300_context *r300 = R300_CONTEXT(ctx);
return dwords;
}
-static GLboolean r300TryDrawPrims(GLcontext *ctx,
+static GLboolean r300TryDrawPrims(struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
return GL_TRUE;
}
-static void r300DrawPrims(GLcontext *ctx,
+static void r300DrawPrims(struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
_tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
}
-void r300InitDraw(GLcontext *ctx)
+void r300InitDraw(struct gl_context *ctx)
{
struct vbo_context *vbo = vbo_context(ctx);
#include "r300_emit.h"
-GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead)
+GLuint r300VAPInputCntl0(struct gl_context * ctx, GLuint InputsRead)
{
/* No idea what this value means. I have seen other values written to
* this register... */
return 0x5555;
}
-GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead)
+GLuint r300VAPInputCntl1(struct gl_context * ctx, GLuint InputsRead)
{
GLuint i, vic_1 = 0;
return vic_1;
}
-GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes)
+GLuint r300VAPOutputCntl0(struct gl_context * ctx, GLuint vp_writes)
{
GLuint ret = 0;
return ret;
}
-GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes)
+GLuint r300VAPOutputCntl1(struct gl_context * ctx, GLuint vp_writes)
{
GLuint i, ret = 0, first_free_texcoord = 0;
extern void r300EmitCacheFlush(r300ContextPtr rmesa);
-extern GLuint r300VAPInputCntl0(GLcontext * ctx, GLuint InputsRead);
-extern GLuint r300VAPInputCntl1(GLcontext * ctx, GLuint InputsRead);
-extern GLuint r300VAPOutputCntl0(GLcontext * ctx, GLuint vp_writes);
-extern GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint vp_writes);
+extern GLuint r300VAPInputCntl0(struct gl_context * ctx, GLuint InputsRead);
+extern GLuint r300VAPInputCntl1(struct gl_context * ctx, GLuint InputsRead);
+extern GLuint r300VAPOutputCntl0(struct gl_context * ctx, GLuint vp_writes);
+extern GLuint r300VAPOutputCntl1(struct gl_context * ctx, GLuint vp_writes);
#endif
}
-static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_program_cont *cont, struct r300_fragment_program *fp)
+static void translate_fragment_program(struct gl_context *ctx, struct r300_fragment_program_cont *cont, struct r300_fragment_program *fp)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
struct r300_fragment_program_compiler compiler;
rc_destroy(&compiler.Base);
}
-struct r300_fragment_program *r300SelectAndTranslateFragmentShader(GLcontext *ctx)
+struct r300_fragment_program *r300SelectAndTranslateFragmentShader(struct gl_context *ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
struct r300_fragment_program_cont *fp_list;
#include "r300_context.h"
-struct r300_fragment_program *r300SelectAndTranslateFragmentShader(GLcontext *ctx);
+struct r300_fragment_program *r300SelectAndTranslateFragmentShader(struct gl_context *ctx);
#endif
END_BATCH();
}
-void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim)
+void r300RunRenderPrimitive(struct gl_context * ctx, int start, int end, int prim)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
BATCH_LOCALS(&rmesa->radeon);
}
}
-void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode)
+void r300SwitchFallback(struct gl_context *ctx, uint32_t bit, GLboolean mode)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
r300ContextPtr rmesa = R300_CONTEXT(ctx);
extern const struct tnl_pipeline_stage _r300_render_stage;
-extern void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode);
+extern void r300SwitchFallback(struct gl_context *ctx, uint32_t bit, GLboolean mode);
-extern void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim);
+extern void r300RunRenderPrimitive(struct gl_context * ctx, int start, int end, int prim);
#endif
#include "r300_context.h"
#include "r300_fragprog_common.h"
-static void freeFragProgCache(GLcontext *ctx, struct r300_fragment_program_cont *cache)
+static void freeFragProgCache(struct gl_context *ctx, struct r300_fragment_program_cont *cache)
{
struct r300_fragment_program *tmp, *fp = cache->progs;
}
}
-static void freeVertProgCache(GLcontext *ctx, struct r300_vertex_program_cont *cache)
+static void freeVertProgCache(struct gl_context *ctx, struct r300_vertex_program_cont *cache)
{
struct r300_vertex_program *tmp, *vp = cache->progs;
}
}
-static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target,
+static struct gl_program *r300NewProgram(struct gl_context * ctx, GLenum target,
GLuint id)
{
struct r300_vertex_program_cont *vp;
return NULL;
}
-static void r300DeleteProgram(GLcontext * ctx, struct gl_program *prog)
+static void r300DeleteProgram(struct gl_context * ctx, struct gl_program *prog)
{
struct r300_vertex_program_cont *vp = (struct r300_vertex_program_cont *)prog;
struct r300_fragment_program_cont *fp = (struct r300_fragment_program_cont *)prog;
}
static GLboolean
-r300ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog)
+r300ProgramStringNotify(struct gl_context * ctx, GLenum target, struct gl_program *prog)
{
struct r300_vertex_program_cont *vp = (struct r300_vertex_program_cont *)prog;
struct r300_fragment_program_cont *fp = (struct r300_fragment_program_cont *)prog;
}
static GLboolean
-r300IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog)
+r300IsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog)
{
if (target == GL_FRAGMENT_PROGRAM_ARB) {
struct r300_fragment_program *fp = r300SelectAndTranslateFragmentShader(ctx);
#include "r300_render.h"
#include "r300_vertprog.h"
-static void r300BlendColor(GLcontext * ctx, const GLfloat cf[4])
+static void r300BlendColor(struct gl_context * ctx, const GLfloat cf[4])
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
}
}
-static void r300SetBlendState(GLcontext * ctx)
+static void r300SetBlendState(struct gl_context * ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
int func = (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) |
R300_ALPHA_BLEND_ENABLE), funcA, eqnA);
}
-static void r300BlendEquationSeparate(GLcontext * ctx,
+static void r300BlendEquationSeparate(struct gl_context * ctx,
GLenum modeRGB, GLenum modeA)
{
r300SetBlendState(ctx);
}
-static void r300BlendFuncSeparate(GLcontext * ctx,
+static void r300BlendFuncSeparate(struct gl_context * ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA)
{
* Used internally to update the r300->hw hardware state to match the
* current OpenGL state.
*/
-static void r300SetLogicOpState(GLcontext *ctx)
+static void r300SetLogicOpState(struct gl_context *ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
R300_STATECHANGE(r300, rop);
* Called by Mesa when an application program changes the LogicOp state
* via glLogicOp.
*/
-static void r300LogicOpcode(GLcontext *ctx, GLenum logicop)
+static void r300LogicOpcode(struct gl_context *ctx, GLenum logicop)
{
if (RGBA_LOGICOP_ENABLED(ctx))
r300SetLogicOpState(ctx);
}
-static void r300ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq )
+static void r300ClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq )
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
GLint p;
rmesa->hw.vpucp[p].cmd[R300_VPUCP_W] = ip[3];
}
-static void r300SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state)
+static void r300SetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
GLuint p;
/**
* Update our tracked culling state based on Mesa's state.
*/
-static void r300UpdateCulling(GLcontext * ctx)
+static void r300UpdateCulling(struct gl_context * ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
uint32_t val = 0;
r300->hw.cul.cmd[R300_CUL_CULL] = val;
}
-static void r300SetPolygonOffsetState(GLcontext * ctx, GLboolean state)
+static void r300SetPolygonOffsetState(struct gl_context * ctx, GLboolean state)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
}
}
-static GLboolean current_fragment_program_writes_depth(GLcontext* ctx)
+static GLboolean current_fragment_program_writes_depth(struct gl_context* ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
return ctx->FragmentProgram._Current && r300->selected_fp->code.writes_depth;
}
-static void r300SetEarlyZState(GLcontext * ctx)
+static void r300SetEarlyZState(struct gl_context * ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
GLuint topZ = R300_ZTOP_ENABLE;
}
}
-static void r300SetAlphaState(GLcontext * ctx)
+static void r300SetAlphaState(struct gl_context * ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
GLubyte refByte;
r300->hw.at.cmd[R300_AT_UNKNOWN] = 0;
}
-static void r300AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref)
+static void r300AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref)
{
(void)func;
(void)ref;
return 0;
}
-static void r300SetDepthState(GLcontext * ctx)
+static void r300SetDepthState(struct gl_context * ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
}
}
-static void r300CatchStencilFallback(GLcontext *ctx)
+static void r300CatchStencilFallback(struct gl_context *ctx)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
const unsigned back = ctx->Stencil._BackFace;
}
}
-static void r300SetStencilState(GLcontext * ctx, GLboolean state)
+static void r300SetStencilState(struct gl_context * ctx, GLboolean state)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
GLboolean hw_stencil = GL_FALSE;
}
}
-static void r300UpdatePolygonMode(GLcontext * ctx)
+static void r300UpdatePolygonMode(struct gl_context * ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
uint32_t hw_mode = R300_GA_POLY_MODE_DISABLE;
*
* \note Mesa already filters redundant calls to this function.
*/
-static void r300CullFace(GLcontext * ctx, GLenum mode)
+static void r300CullFace(struct gl_context * ctx, GLenum mode)
{
(void)mode;
*
* \note Mesa already filters redundant calls to this function.
*/
-static void r300FrontFace(GLcontext * ctx, GLenum mode)
+static void r300FrontFace(struct gl_context * ctx, GLenum mode)
{
(void)mode;
*
* \note Mesa already filters redundant calls to this function.
*/
-static void r300DepthFunc(GLcontext * ctx, GLenum func)
+static void r300DepthFunc(struct gl_context * ctx, GLenum func)
{
(void)func;
r300SetDepthState(ctx);
*
* \note Mesa already filters redundant calls to this function.
*/
-static void r300DepthMask(GLcontext * ctx, GLboolean mask)
+static void r300DepthMask(struct gl_context * ctx, GLboolean mask)
{
(void)mask;
r300SetDepthState(ctx);
/**
* Handle glColorMask()
*/
-static void r300ColorMask(GLcontext * ctx,
+static void r300ColorMask(struct gl_context * ctx,
GLboolean r, GLboolean g, GLboolean b, GLboolean a)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
/* =============================================================
* Point state
*/
-static void r300PointSize(GLcontext * ctx, GLfloat size)
+static void r300PointSize(struct gl_context * ctx, GLfloat size)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
((int)(size * 6) << R300_POINTSIZE_Y_SHIFT);
}
-static void r300PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * param)
+static void r300PointParameter(struct gl_context * ctx, GLenum pname, const GLfloat * param)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
/* =============================================================
* Line state
*/
-static void r300LineWidth(GLcontext * ctx, GLfloat widthf)
+static void r300LineWidth(struct gl_context * ctx, GLfloat widthf)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
R300_LINE_CNT_HO | R300_LINE_CNT_VE | (int)(widthf * 6.0);
}
-static void r300PolygonMode(GLcontext * ctx, GLenum face, GLenum mode)
+static void r300PolygonMode(struct gl_context * ctx, GLenum face, GLenum mode)
{
(void)face;
(void)mode;
return 0;
}
-static void r300ShadeModel(GLcontext * ctx, GLenum mode)
+static void r300ShadeModel(struct gl_context * ctx, GLenum mode)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
rmesa->hw.shade2.cmd[3] = 0x00000000;
}
-static void r300StencilFuncSeparate(GLcontext * ctx, GLenum face,
+static void r300StencilFuncSeparate(struct gl_context * ctx, GLenum face,
GLenum func, GLint ref, GLuint mask)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
}
}
-static void r300StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask)
+static void r300StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
const unsigned back = ctx->Stencil._BackFace;
}
}
-static void r300StencilOpSeparate(GLcontext * ctx, GLenum face,
+static void r300StencilOpSeparate(struct gl_context * ctx, GLenum face,
GLenum fail, GLenum zfail, GLenum zpass)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
* Window position and viewport transformation
*/
-static void r300UpdateWindow(GLcontext * ctx)
+static void r300UpdateWindow(struct gl_context * ctx)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
rmesa->hw.vpt.cmd[R300_VPT_ZOFFSET] = r300PackFloat32(tz);
}
-static void r300Viewport(GLcontext * ctx, GLint x, GLint y,
+static void r300Viewport(struct gl_context * ctx, GLint x, GLint y,
GLsizei width, GLsizei height)
{
/* Don't pipeline viewport changes, conflict with window offset
radeon_viewport(ctx, x, y, width, height);
}
-static void r300DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval)
+static void r300DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval)
{
r300UpdateWindow(ctx);
}
-void r300UpdateViewportOffset(GLcontext * ctx)
+void r300UpdateViewportOffset(struct gl_context * ctx)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
* Update R300's own internal state parameters.
* For now just STATE_R300_WINDOW_DIMENSION
*/
-static void r300UpdateStateParameters(GLcontext * ctx, GLuint new_state)
+static void r300UpdateStateParameters(struct gl_context * ctx, GLuint new_state)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct gl_program_parameter_list *paramList;
/* =============================================================
* Polygon state
*/
-static void r300PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units)
+static void r300PolygonOffset(struct gl_context * ctx, GLfloat factor, GLfloat units)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
GLfloat constant = units;
return f;
}
-static void r300SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings)
+static void r300SetupFragmentShaderTextures(struct gl_context *ctx, int *tmu_mappings)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
int i;
R300_US_TEX_INST_0, code->tex.length);
}
-static void r500SetupFragmentShaderTextures(GLcontext *ctx, int *tmu_mappings)
+static void r500SetupFragmentShaderTextures(struct gl_context *ctx, int *tmu_mappings)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
int i;
}
-static void r300SetupTextures(GLcontext * ctx)
+static void r300SetupTextures(struct gl_context * ctx)
{
int i, mtu;
struct radeon_tex_obj *t;
((hw_tcl_on) ? (ow).vp_outputs & (1 << (vp_result)) : \
RENDERINPUTS_TEST( (ow.index_bitset), (tnl_attrib) ))
-static void r300SetupRSUnit(GLcontext * ctx)
+static void r300SetupRSUnit(struct gl_context * ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
union r300_outputs_written OutputsWritten;
WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead);
}
-static void r500SetupRSUnit(GLcontext * ctx)
+static void r500SetupRSUnit(struct gl_context * ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
union r300_outputs_written OutputsWritten;
*
* \note Mesa already filters redundant calls to this function.
*/
-static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state)
+static void r300Enable(struct gl_context * ctx, GLenum cap, GLboolean state)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
if (RADEON_DEBUG & RADEON_STATE)
*/
static void r300ResetHwState(r300ContextPtr r300)
{
- GLcontext *ctx = r300->radeon.glCtx;
+ struct gl_context *ctx = r300->radeon.glCtx;
int has_tcl;
has_tcl = r300->options.hw_tcl_enabled;
void r300UpdateShaders(r300ContextPtr rmesa)
{
- GLcontext *ctx = rmesa->radeon.glCtx;
+ struct gl_context *ctx = rmesa->radeon.glCtx;
/* should only happenen once, just after context is created */
/* TODO: shouldn't we fallback to sw here? */
rmesa->radeon.NewGLState = 0;
}
-static const GLfloat *get_fragmentprogram_constant(GLcontext *ctx, GLuint index, GLfloat * buffer)
+static const GLfloat *get_fragmentprogram_constant(struct gl_context *ctx, GLuint index, GLfloat * buffer)
{
static const GLfloat dummy[4] = { 0, 0, 0, 0 };
r300ContextPtr rmesa = R300_CONTEXT(ctx);
}
-static void r300SetupPixelShader(GLcontext *ctx)
+static void r300SetupPixelShader(struct gl_context *ctx)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct r300_fragment_program *fp = rmesa->selected_fp;
if(_nc>_p->r500fp.count)_p->r500fp.count=_nc;\
} while(0)
-static void r500SetupPixelShader(GLcontext *ctx)
+static void r500SetupPixelShader(struct gl_context *ctx)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct r300_fragment_program *fp = rmesa->selected_fp;
bump_r500fp_const_count(rmesa->hw.r500fp_const.cmd, fp->code.constants.Count * 4);
}
-void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten)
+void r300SetupVAP(struct gl_context *ctx, GLuint InputsRead, GLuint OutputsWritten)
{
r300ContextPtr rmesa = R300_CONTEXT( ctx );
struct vertex_attribute *attrs = rmesa->vbuf.attribs;
void r300UpdateShaderStates(r300ContextPtr rmesa)
{
- GLcontext *ctx;
+ struct gl_context *ctx;
ctx = rmesa->radeon.glCtx;
/* should only happenen once, just after context is created */
#define EASY_US_OUT_FMT(comps, c0, c1, c2, c3) \
(R500_OUT_FMT_##comps | R500_C0_SEL_##c0 | R500_C1_SEL_##c1 | \
R500_C2_SEL_##c2 | R500_C3_SEL_##c3)
-static void r300SetupUsOutputFormat(GLcontext *ctx)
+static void r300SetupUsOutputFormat(struct gl_context *ctx)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
uint32_t hw_format;
break;
default:
assert(!"Unsupported format");
+ hw_format = 0;
break;
}
/**
* Called by Mesa after an internal state update.
*/
-static void r300InvalidateState(GLcontext * ctx, GLuint new_state)
+static void r300InvalidateState(struct gl_context * ctx, GLuint new_state)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
r300ResetHwState(r300);
}
-static void r300RenderMode(GLcontext * ctx, GLenum mode)
+static void r300RenderMode(struct gl_context * ctx, GLenum mode)
{
r300SwitchFallback(ctx, R300_FALLBACK_RENDER_MODE, ctx->RenderMode != GL_RENDER);
}
r300->radeon.hw.is_dirty = GL_TRUE; \
} while(0)
-void r300UpdateViewportOffset (GLcontext * ctx);
-void r300UpdateDrawBuffer (GLcontext * ctx);
+void r300UpdateViewportOffset (struct gl_context * ctx);
+void r300UpdateDrawBuffer (struct gl_context * ctx);
void r300UpdateShaders (r300ContextPtr rmesa);
void r300UpdateShaderStates (r300ContextPtr rmesa);
void r300InitState (r300ContextPtr r300);
void r300InitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions);
void r300VapCntl(r300ContextPtr rmesa, GLuint input_count, GLuint output_count, GLuint temp_count);
-void r300SetupVAP(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten);
+void r300SetupVAP(struct gl_context *ctx, GLuint InputsRead, GLuint OutputsWritten);
#endif /* __R300_STATE_H__ */
++num_attrs; \
} while (0)
-void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_OutputsWritten)
+void r300ChooseSwtclVertexFormat(struct gl_context *ctx, GLuint *_InputsRead, GLuint *_OutputsWritten)
{
r300ContextPtr rmesa = R300_CONTEXT( ctx );
TNLcontext *tnl = TNL_CONTEXT(ctx);
RENDERINPUTS_COPY(rmesa->render_inputs_bitset, tnl->render_inputs_bitset);
}
-static void r300PrepareVertices(GLcontext *ctx)
+static void r300PrepareVertices(struct gl_context *ctx)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
GLuint InputsRead, OutputsWritten;
GL_TRIANGLES,
};
-static void r300RasterPrimitive( GLcontext *ctx, GLuint prim );
+static void r300RasterPrimitive( struct gl_context *ctx, GLuint prim );
/***********************************************************************
* Emit primitives as inline vertices *
/**********************************************************************/
/* Choose render functions */
/**********************************************************************/
-static void r300ChooseRenderState( GLcontext *ctx )
+static void r300ChooseRenderState( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
r300ContextPtr rmesa = R300_CONTEXT(ctx);
}
}
-void r300RenderStart(GLcontext *ctx)
+void r300RenderStart(struct gl_context *ctx)
{
radeon_print(RADEON_SWRENDER, RADEON_VERBOSE, "%s\n", __func__);
r300ContextPtr rmesa = R300_CONTEXT( ctx );
}
}
-void r300RenderFinish(GLcontext *ctx)
+void r300RenderFinish(struct gl_context *ctx)
{
}
-static void r300RasterPrimitive( GLcontext *ctx, GLuint hwprim )
+static void r300RasterPrimitive( struct gl_context *ctx, GLuint hwprim )
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
radeon_print(RADEON_SWRENDER, RADEON_TRACE, "%s\n", __func__);
}
}
-void r300RenderPrimitive(GLcontext *ctx, GLenum prim)
+void r300RenderPrimitive(struct gl_context *ctx, GLenum prim)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
r300RasterPrimitive( ctx, reduced_prim[prim] );
}
-void r300ResetLineStipple(GLcontext *ctx)
+void r300ResetLineStipple(struct gl_context *ctx)
{
if (RADEON_DEBUG & RADEON_VERTS)
fprintf(stderr, "%s\n", __func__);
}
-void r300InitSwtcl(GLcontext *ctx)
+void r300InitSwtcl(struct gl_context *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
r300ContextPtr rmesa = R300_CONTEXT(ctx);
_tnl_need_projected_coords( ctx, GL_FALSE );
}
-void r300DestroySwtcl(GLcontext *ctx)
+void r300DestroySwtcl(struct gl_context *ctx)
{
}
END_BATCH();
}
-void r300_swtcl_flush(GLcontext *ctx, uint32_t current_offset)
+void r300_swtcl_flush(struct gl_context *ctx, uint32_t current_offset)
{
radeon_print(RADEON_SWRENDER, RADEON_TRACE, "%s\n", __func__);
r300ContextPtr rmesa = R300_CONTEXT(ctx);
#define SWTCL_OVM_TEX(n) ((n) + 6)
#define SWTCL_OVM_POINT_SIZE 15
-extern void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *InputsRead, GLuint *OutputsWritten);
+extern void r300ChooseSwtclVertexFormat(struct gl_context *ctx, GLuint *InputsRead, GLuint *OutputsWritten);
-extern void r300InitSwtcl( GLcontext *ctx );
-extern void r300DestroySwtcl( GLcontext *ctx );
+extern void r300InitSwtcl( struct gl_context *ctx );
+extern void r300DestroySwtcl( struct gl_context *ctx );
-extern void r300RenderStart(GLcontext *ctx);
-extern void r300RenderFinish(GLcontext *ctx);
-extern void r300RenderPrimitive(GLcontext *ctx, GLenum prim);
-extern void r300ResetLineStipple(GLcontext *ctx);
+extern void r300RenderStart(struct gl_context *ctx);
+extern void r300RenderFinish(struct gl_context *ctx);
+extern void r300RenderPrimitive(struct gl_context *ctx, GLenum prim);
+extern void r300ResetLineStipple(struct gl_context *ctx);
-extern void r300_swtcl_flush(GLcontext *ctx, uint32_t current_offset);
+extern void r300_swtcl_flush(struct gl_context *ctx, uint32_t current_offset);
#endif
* next UpdateTextureState
*/
-static void r300TexParameter(GLcontext * ctx, GLenum target,
+static void r300TexParameter(struct gl_context * ctx, GLenum target,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat * params)
{
}
}
-static void r300DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj)
+static void r300DeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
radeonTexObj* t = radeon_tex_obj(texObj);
* allocate the default texture objects.
* Fixup MaxAnisotropy according to user preference.
*/
-static struct gl_texture_object *r300NewTextureObject(GLcontext * ctx,
+static struct gl_texture_object *r300NewTextureObject(struct gl_context * ctx,
GLuint name,
GLenum target)
{
unsigned long long offset, GLint depth,
GLuint pitch);
-extern GLboolean r300ValidateBuffers(GLcontext * ctx);
+extern GLboolean r300ValidateBuffers(struct gl_context * ctx);
extern void r300InitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions);
*
* Mostly this means populating the texture object's mipmap tree.
*/
-static GLboolean r300_validate_texture(GLcontext * ctx, struct gl_texture_object *texObj)
+static GLboolean r300_validate_texture(struct gl_context * ctx, struct gl_texture_object *texObj)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
radeonTexObj *t = radeon_tex_obj(texObj);
/**
* Ensure all enabled and complete textures are uploaded along with any buffers being used.
*/
-GLboolean r300ValidateBuffers(GLcontext * ctx)
+GLboolean r300ValidateBuffers(struct gl_context * ctx)
{
r300ContextPtr rmesa = R300_CONTEXT(ctx);
struct radeon_renderbuffer *rrb;
* Write parameter array for the given vertex program into dst.
* Return the total number of components written.
*/
-static int r300VertexProgUpdateParams(GLcontext * ctx, struct r300_vertex_program *vp, float *dst)
+static int r300VertexProgUpdateParams(struct gl_context * ctx, struct r300_vertex_program *vp, float *dst)
{
int i;
inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_0000;
}
-static struct r300_vertex_program *build_program(GLcontext *ctx,
+static struct r300_vertex_program *build_program(struct gl_context *ctx,
struct r300_vertex_program_key *wanted_key,
const struct gl_vertex_program *mesa_vp)
{
return vp;
}
-struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx)
+struct r300_vertex_program * r300SelectAndTranslateVertexShader(struct gl_context *ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
struct r300_vertex_program_key wanted_key = { 0 };
void r300SetupVertexProgram(r300ContextPtr rmesa)
{
- GLcontext *ctx = rmesa->radeon.glCtx;
+ struct gl_context *ctx = rmesa->radeon.glCtx;
struct r300_vertex_program *prog = rmesa->selected_vp;
int inst_count = 0;
int param_count = 0;
void r300SetupVertexProgram(r300ContextPtr rmesa);
-struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx);
+struct r300_vertex_program * r300SelectAndTranslateVertexShader(struct gl_context *ctx);
#endif
#include "drm.h"
#include "dri_util.h"
-#include "radeon_screen.h"
-
#define FALLBACK( radeon, bit, mode ) fprintf(stderr, "%s:%s\n", __LINE__, __FILE__);
/* TCL fallbacks */
-extern void radeonTclFallback(GLcontext * ctx, GLuint bit, GLboolean mode);
+extern void radeonTclFallback(struct gl_context * ctx, GLuint bit, GLboolean mode);
#define TCL_FALLBACK( ctx, bit, mode ) ;
}
-static inline void eg_load_shaders(GLcontext * ctx)
+static inline void eg_load_shaders(struct gl_context * ctx)
{
radeonContextPtr radeonctx = RADEON_CONTEXT(ctx);
return GL_TRUE;
}
-unsigned evergreen_blit(GLcontext *ctx,
+unsigned evergreen_blit(struct gl_context *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
gl_format src_mesaformat,
unsigned evergreen_check_blit(gl_format mesa_format);
-unsigned evergreen_blit(GLcontext *ctx,
+unsigned evergreen_blit(struct gl_context *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
gl_format src_mesaformat,
insert_at_tail(&context->radeon.hw.atomlist, &context->evergreen_atoms.ATOM); \
} while (0)
-static int check_queryobj(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_query_object *query = radeon->query.current;
return count;
}
-static void evergreenSendQueryBegin(GLcontext *ctx, struct radeon_state_atom *atom)
+static void evergreenSendQueryBegin(struct gl_context *ctx, struct radeon_state_atom *atom)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_query_object *query = radeon->query.current;
}
-static int check_always(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_always(struct gl_context *ctx, struct radeon_state_atom *atom)
{
return atom->cmd_size;
}
-static void evergreenSendTexState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void evergreenSendTexState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
}
}
-static int check_evergreen_tx(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_evergreen_tx(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
unsigned int i, count = 0;
return count * 37 + 6;
}
-static void evergreenSendSQConfig(GLcontext *ctx, struct radeon_state_atom *atom)
+static void evergreenSendSQConfig(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
}
extern int evergreen_getTypeSize(GLenum type);
-static void evergreenSetupVTXConstants(GLcontext * ctx,
+static void evergreenSetupVTXConstants(struct gl_context * ctx,
void * pAos,
StreamDesc * pStreamDesc)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
struct radeon_aos * paos = (struct radeon_aos *)pAos;
- unsigned int nVBsize;
BATCH_LOCALS(&context->radeon);
unsigned int uSQ_VTX_CONSTANT_WORD0_0;
r700SyncSurf(context, paos->bo, RADEON_GEM_DOMAIN_GTT, 0, VC_ACTION_ENA_bit);
- if(0 == pStreamDesc->stride)
- {
- nVBsize = paos->count * pStreamDesc->size * getTypeSize(pStreamDesc->type);
- }
- else
- {
- nVBsize = (paos->count - 1) * pStreamDesc->stride
- + pStreamDesc->size * getTypeSize(pStreamDesc->type);
- }
-
//uSQ_VTX_CONSTANT_WORD0_0
uSQ_VTX_CONSTANT_WORD0_0 = paos->offset;
//uSQ_VTX_CONSTANT_WORD1_0
- uSQ_VTX_CONSTANT_WORD1_0 = nVBsize;
+ uSQ_VTX_CONSTANT_WORD1_0 = paos->bo->size - paos->offset - 1;
//uSQ_VTX_CONSTANT_WORD2_0
SETfield(uSQ_VTX_CONSTANT_WORD2_0,
COMMIT_BATCH();
}
-static int check_evergreen_vtx(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_evergreen_vtx(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
int count = context->radeon.tcl.aos_count * 12;
return count;
}
-static void evergreenSendVTX(GLcontext *ctx, struct radeon_state_atom *atom)
+static void evergreenSendVTX(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
struct evergreen_vertex_program *vp = (struct evergreen_vertex_program *)(context->selected_vp);
if (context->radeon.tcl.aos_count == 0)
return;
- BEGIN_BATCH_NO_AUTOSTATE(6);
- R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1));
- R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX);
- R600_OUT_BATCH(0);
-
- R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1));
- R600_OUT_BATCH(mmSQ_VTX_START_INST_LOC - ASIC_CTL_CONST_BASE_INDEX);
- R600_OUT_BATCH(0);
- END_BATCH();
- COMMIT_BATCH();
-
for(i=0; i<VERT_ATTRIB_MAX; i++) {
if(vp->mesa_program->Base.InputsRead & (1 << i))
{
&(context->stream_desc[j]));
j++;
}
- }
+ }
}
-static void evergreenSendPA(GLcontext *ctx, struct radeon_state_atom *atom)
+static void evergreenSendPA(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
COMMIT_BATCH();
}
-static void evergreenSendTP(GLcontext *ctx, struct radeon_state_atom *atom)
+static void evergreenSendTP(struct gl_context *ctx, struct radeon_state_atom *atom)
{
/*
context_t *context = EVERGREEN_CONTEXT(ctx);
*/
}
-static void evergreenSendPSresource(GLcontext *ctx)
+static void evergreenSendPSresource(struct gl_context *ctx)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
COMMIT_BATCH();
}
-static void evergreenSendVSresource(GLcontext *ctx, struct radeon_state_atom *atom)
+static void evergreenSendVSresource(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
COMMIT_BATCH();
}
-static void evergreenSendSQ(GLcontext *ctx, struct radeon_state_atom *atom)
+static void evergreenSendSQ(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
COMMIT_BATCH();
}
-static void evergreenSendSPI(GLcontext *ctx, struct radeon_state_atom *atom)
+static void evergreenSendSPI(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
COMMIT_BATCH();
}
-static void evergreenSendSX(GLcontext *ctx, struct radeon_state_atom *atom)
+static void evergreenSendSX(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
{
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
struct radeon_renderbuffer *rrb;
- unsigned int nPitchInPixel, height;
+ unsigned int nPitchInPixel, height, offtostencil;
rrb = radeon_get_depthbuffer(&context->radeon);
if (!rrb)
if(4 == rrb->cpp)
{
- SETfield(evergreen->DB_Z_INFO.u32All, DEPTH_8_24,
+ SETfield(evergreen->DB_Z_INFO.u32All, EG_Z_24,
EG_DB_Z_INFO__FORMAT_shift,
EG_DB_Z_INFO__FORMAT_mask);
}
else
{
- SETfield(evergreen->DB_Z_INFO.u32All, DEPTH_16,
+ SETfield(evergreen->DB_Z_INFO.u32All, EG_Z_16,
EG_DB_Z_INFO__FORMAT_shift,
EG_DB_Z_INFO__FORMAT_mask);
}
SETfield(evergreen->DB_Z_INFO.u32All, ARRAY_1D_TILED_THIN1,
EG_DB_Z_INFO__ARRAY_MODE_shift,
EG_DB_Z_INFO__ARRAY_MODE_mask);
+
+
+ offtostencil = ((height * rrb->pitch) + 255) & ~255;
+ evergreen->DB_STENCIL_WRITE_BASE.u32All = offtostencil >> 8;
+ evergreen->DB_STENCIL_READ_BASE.u32All = offtostencil >> 8;
+
}
-static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom)
+static void evergreenSendDB(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
END_BATCH();
rrb = radeon_get_depthbuffer(&context->radeon);
+
if( (rrb != NULL) && (rrb->bo != NULL) )
{
/* make the hw happy */
BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
- EVERGREEN_OUT_BATCH_REGVAL(EG_DB_HTILE_DATA_BASE, evergreen->DB_HTILE_DATA_BASE.u32All);
- R600_OUT_BATCH_RELOC(evergreen->DB_HTILE_DATA_BASE.u32All,
+ EVERGREEN_OUT_BATCH_REGVAL(EG_DB_HTILE_DATA_BASE, evergreen->DB_HTILE_DATA_BASE.u32All);
+ R600_OUT_BATCH_RELOC(evergreen->DB_HTILE_DATA_BASE.u32All,
rrb->bo,
evergreen->DB_HTILE_DATA_BASE.u32All,
0, RADEON_GEM_DOMAIN_VRAM, 0);
- END_BATCH();
+ END_BATCH();
//5
BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
END_BATCH();
}
}
-/*
+
if (ctx->DrawBuffer)
{
rrb = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL);
if((rrb != NULL) && (rrb->bo != NULL))
- {
+ {
//5
BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
- EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_INFO, evergreen->DB_Z_INFO.u32All);
+ EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_INFO, evergreen->DB_STENCIL_INFO.u32All);
R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_INFO.u32All,
rrb->bo,
evergreen->DB_STENCIL_INFO.u32All,
0, RADEON_GEM_DOMAIN_VRAM, 0);
END_BATCH();
+
+ //4
+ BEGIN_BATCH_NO_AUTOSTATE(4);
+ R600_OUT_BATCH_REGSEQ(DB_STENCILREFMASK, 2);
+ R600_OUT_BATCH(evergreen->DB_STENCILREFMASK.u32All);
+ R600_OUT_BATCH(evergreen->DB_STENCILREFMASK_BF.u32All);
+ END_BATCH();
+ //------------------------
//10
if((evergreen->DB_DEPTH_CONTROL.u32All & STENCIL_ENABLE_bit) > 0)
{
- BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
+
+ BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
EVERGREEN_OUT_BATCH_REGVAL(EG_DB_STENCIL_READ_BASE, evergreen->DB_STENCIL_READ_BASE.u32All);
R600_OUT_BATCH_RELOC(evergreen->DB_STENCIL_READ_BASE.u32All,
rrb->bo,
}
}
}
-*/
+
COMMIT_BATCH();
}
evergreen->render_target[id].enabled = GL_TRUE;
}
-static void evergreenSendCB(GLcontext *ctx, struct radeon_state_atom *atom)
+static void evergreenSendCB(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_VIEW.u32All);
END_BATCH();
- BEGIN_BATCH_NO_AUTOSTATE(4);
- EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_ATTRIB, 2);
+ BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_ATTRIB, 1);
R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_ATTRIB.u32All);
+ R600_OUT_BATCH_RELOC(0,
+ rrb->bo,
+ 0,
+ 0, RADEON_GEM_DOMAIN_VRAM, 0);
+ END_BATCH();
+
+ BEGIN_BATCH_NO_AUTOSTATE(3);
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_DIM, 1);
R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_DIM.u32All);
/*
R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_CMASK.u32All);
COMMIT_BATCH();
}
-static void evergreenSendVGT(GLcontext *ctx, struct radeon_state_atom *atom)
+static void evergreenSendVGT(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
context->radeon.hw.atomlist.name = "atom-list";
EVERGREEN_ALLOC_STATE(init, always, 19, evergreenSendSQConfig);
- EVERGREEN_ALLOC_STATE(vtx, evergreen_vtx, (6 + (VERT_ATTRIB_MAX * 12)), evergreenSendVTX);
+ EVERGREEN_ALLOC_STATE(vtx, evergreen_vtx, (VERT_ATTRIB_MAX * 12), evergreenSendVTX);
EVERGREEN_ALLOC_STATE(pa, always, 124, evergreenSendPA);
EVERGREEN_ALLOC_STATE(tp, always, 0, evergreenSendTP);
EVERGREEN_ALLOC_STATE(sq, always, 86, evergreenSendSQ); /* 85 */
EVERGREEN_ALLOC_STATE(spi, always, 59, evergreenSendSPI);
EVERGREEN_ALLOC_STATE(sx, always, 9, evergreenSendSX);
EVERGREEN_ALLOC_STATE(tx, evergreen_tx, (R700_TEXTURE_NUMBERUNITS * (21+5) + 6), evergreenSendTexState); /* 21 for resource, 5 for sampler */
- EVERGREEN_ALLOC_STATE(db, always, 65, evergreenSendDB);
- EVERGREEN_ALLOC_STATE(cb, always, 33, evergreenSendCB);
+ EVERGREEN_ALLOC_STATE(db, always, 69, evergreenSendDB);
+ EVERGREEN_ALLOC_STATE(cb, always, 37, evergreenSendCB);
EVERGREEN_ALLOC_STATE(vgt, always, 29, evergreenSendVGT);
evergreen_init_query_stateobj(&context->radeon, 6 * 2);
r700Start3D((context_t *)radeon);
}
-static void evergreen_fallback(GLcontext *ctx, GLuint bit, GLboolean mode)
+static void evergreen_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
if (mode)
#include "evergreen_vertprog.h"
#include "evergreen_fragprog.h"
-void evergreen_insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog)
+void evergreen_insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog)
{
static const gl_state_index winstate[STATE_LENGTH]
= { STATE_INTERNAL, STATE_FB_SIZE, 0, 0, 0};
//TODO : Validate FP input with VP output.
void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm,
struct gl_fragment_program *mesa_fp,
- GLcontext *ctx)
+ struct gl_context *ctx)
{
unsigned int unBit;
unsigned int i;
GLboolean evergreenTranslateFragmentShader(struct evergreen_fragment_program *fp,
struct gl_fragment_program *mesa_fp,
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLuint number_of_colors_exported;
GLboolean z_enabled = GL_FALSE;
return GL_TRUE;
}
-void evergreenSelectFragmentShader(GLcontext *ctx)
+void evergreenSelectFragmentShader(struct gl_context *ctx)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *)
evergreenTranslateFragmentShader(fp, &(fp->mesa_program), ctx);
}
-void * evergreenGetActiveFpShaderBo(GLcontext * ctx)
+void * evergreenGetActiveFpShaderBo(struct gl_context * ctx)
{
struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *)
(ctx->FragmentProgram._Current);
return fp->shaderbo;
}
-void * evergreenGetActiveFpShaderConstBo(GLcontext * ctx)
+void * evergreenGetActiveFpShaderConstBo(struct gl_context * ctx)
{
struct evergreen_fragment_program *fp = (struct evergreen_fragment_program *)
(ctx->FragmentProgram._Current);
return fp->constbo0;
}
-GLboolean evergreenSetupFragmentProgram(GLcontext * ctx)
+GLboolean evergreenSetupFragmentProgram(struct gl_context * ctx)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
return GL_TRUE;
}
-GLboolean evergreenSetupFPconstants(GLcontext * ctx)
+GLboolean evergreenSetupFPconstants(struct gl_context * ctx)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
};
/* Internal */
-void evergreen_insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog);
+void evergreen_insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog);
void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm,
struct gl_fragment_program *mesa_fp,
- GLcontext *ctx);
+ struct gl_context *ctx);
GLboolean evergreen_Find_Instruction_Dependencies_fp(struct evergreen_fragment_program *fp,
struct gl_fragment_program *mesa_fp);
GLboolean evergreenTranslateFragmentShader(struct evergreen_fragment_program *fp,
struct gl_fragment_program *mesa_vp,
- GLcontext *ctx);
+ struct gl_context *ctx);
/* Interface */
-extern void evergreenSelectFragmentShader(GLcontext *ctx);
+extern void evergreenSelectFragmentShader(struct gl_context *ctx);
-extern GLboolean evergreenSetupFragmentProgram(GLcontext * ctx);
+extern GLboolean evergreenSetupFragmentProgram(struct gl_context * ctx);
-extern GLboolean evergreenSetupFPconstants(GLcontext * ctx);
+extern GLboolean evergreenSetupFPconstants(struct gl_context * ctx);
-extern void * evergreenGetActiveFpShaderBo(GLcontext * ctx);
+extern void * evergreenGetActiveFpShaderBo(struct gl_context * ctx);
-extern void * evergreenGetActiveFpShaderConstBo(GLcontext * ctx);
+extern void * evergreenGetActiveFpShaderConstBo(struct gl_context * ctx);
#endif /*_EVERGREEN_FRAGPROG_H_*/
#include "r700_clear.h"
-void evergreenClear(GLcontext * ctx, GLbitfield mask)
+void evergreenClear(struct gl_context * ctx, GLbitfield mask)
{
r700Clear(ctx, mask);
}
#include "r600_context.h"
#include "radeon_drm.h"
-extern void evergreenClear(GLcontext * ctx, GLbitfield mask);
+extern void evergreenClear(struct gl_context * ctx, GLbitfield mask);
extern void evergreenInitIoctlFuncs(struct dd_function_table *functions);
#endif /* _EVERGREEN_IOCTL_H_ */
#include "evergreen_vertprog.h"
-static void evergreen_freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *cache)
+static void evergreen_freeVertProgCache(struct gl_context *ctx, struct r700_vertex_program_cont *cache)
{
struct evergreen_vertex_program *tmp, *vp = cache->progs;
}
}
-static struct gl_program *evergreenNewProgram(GLcontext * ctx,
+static struct gl_program *evergreenNewProgram(struct gl_context * ctx,
GLenum target,
GLuint id)
{
return pProgram;
}
-static void evergreenDeleteProgram(GLcontext * ctx, struct gl_program *prog)
+static void evergreenDeleteProgram(struct gl_context * ctx, struct gl_program *prog)
{
struct evergreen_vertex_program_cont *vpc = (struct evergreen_vertex_program_cont *)prog;
struct evergreen_fragment_program * fp;
}
static GLboolean
-evergreenProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog)
+evergreenProgramStringNotify(struct gl_context * ctx, GLenum target, struct gl_program *prog)
{
struct evergreen_vertex_program_cont *vpc = (struct evergreen_vertex_program_cont *)prog;
struct evergreen_fragment_program * fp = (struct evergreen_fragment_program*)prog;
return GL_TRUE;
}
-static GLboolean evergreenIsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog)
+static GLboolean evergreenIsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog)
{
return GL_TRUE;
return num_verts - verts_off;
}
-static void evergreenRunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) //same
+static void evergreenRunRenderPrimitive(struct gl_context * ctx, int start, int end, int prim,
+ GLint basevertex) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
BATCH_LOCALS(&context->radeon);
total_emit = 3 /* VGT_PRIMITIVE_TYPE */
+ 2 /* VGT_INDEX_TYPE */
+ 2 /* NUM_INSTANCES */
+ + 4 /* VTX_BASE_VTX_LOC + VTX_START_INST_LOC */
+ 5 + 2; /* DRAW_INDEX */
BEGIN_BATCH_NO_AUTOSTATE(total_emit);
// num instances
R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0));
R600_OUT_BATCH(1);
+ /* offset */
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 2));
+ R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX);
+ R600_OUT_BATCH(basevertex); //VTX_BASE_VTX_LOC
+ R600_OUT_BATCH(0); //VTX_START_INST_LOC
// draw packet
R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX, 3));
R600_OUT_BATCH(context->ind_buf.bo_offset);
COMMIT_BATCH();
}
-static void evergreenRunRenderPrimitiveImmediate(GLcontext * ctx, int start, int end, int prim) //same
+static void evergreenRunRenderPrimitiveImmediate(struct gl_context * ctx, int start, int end, int prim) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
BATCH_LOCALS(&context->radeon);
total_emit += 3 /* VGT_PRIMITIVE_TYPE */
+ 2 /* VGT_INDEX_TYPE */
+ 2 /* NUM_INSTANCES */
+ + 4 /* VTX_BASE_VTX_LOC + VTX_START_INST_LOC */
+ 3; /* DRAW */
BEGIN_BATCH_NO_AUTOSTATE(total_emit);
// num instances
R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0));
R600_OUT_BATCH(1);
+ /* offset */
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 2));
+ R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX);
+ R600_OUT_BATCH(0); //VTX_BASE_VTX_LOC
+ R600_OUT_BATCH(0); //VTX_START_INST_LOC
// draw packet
if(start == 0)
{
* Convert attribute data type to float
* If the attribute uses named buffer object replace the bo with newly allocated bo
*/
-static void evergreenConvertAttrib(GLcontext *ctx, int count,
+static void evergreenConvertAttrib(struct gl_context *ctx, int count,
const struct gl_client_array *input,
struct StreamDesc *attr)
{
}
}
-static void evergreenFixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf)
+static void evergreenFixupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
GLvoid *src_ptr;
}
}
-static GLboolean evergreen_check_fallbacks(GLcontext *ctx) //same
+static GLboolean evergreen_check_fallbacks(struct gl_context *ctx) //same
{
if (ctx->RenderMode != GL_RENDER)
return GL_TRUE;
/* start 3d, idle, cb/db flush */
#define PRE_EMIT_STATE_BUFSZ 5 + 5 + 14
-static GLuint evergreenPredictRenderSize(GLcontext* ctx,
+static GLuint evergreenPredictRenderSize(struct gl_context* ctx,
const struct _mesa_prim *prim,
const struct _mesa_index_buffer *ib,
GLuint nr_prims)
dwords = PRE_EMIT_STATE_BUFSZ;
if (ib)
- dwords += nr_prims * 14;
+ dwords += nr_prims * 18;
else {
for (i = 0; i < nr_prims; ++i)
{
if (prim[i].start == 0)
- dwords += 10;
+ dwords += 14;
else if (prim[i].count > 0xffff)
- dwords += prim[i].count + 10;
+ dwords += prim[i].count + 14;
else
- dwords += ((prim[i].count + 1) / 2) + 10;
+ dwords += ((prim[i].count + 1) / 2) + 14;
}
}
}
-static void evergreenSetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf)
+static void evergreenSetupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
}
}
-static void evergreenAlignDataToDword(GLcontext *ctx,
+static void evergreenAlignDataToDword(struct gl_context *ctx,
const struct gl_client_array *input,
int count,
struct StreamDesc *attr)
attr->stride = dst_stride;
}
-static void evergreenSetupStreams(GLcontext *ctx, const struct gl_client_array *input[], int count)
+static void evergreenSetupStreams(struct gl_context *ctx, const struct gl_client_array *input[], int count)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
GLuint stride;
stride = (input[i]->StrideB == 0) ? getTypeSize(input[i]->Type) * input[i]->Size : input[i]->StrideB;
- if (input[i]->Type == GL_DOUBLE || input[i]->Type == GL_UNSIGNED_INT || input[i]->Type == GL_INT ||
+ if (input[i]->Type == GL_DOUBLE || input[i]->Type == GL_UNSIGNED_INT || input[i]->Type == GL_INT
#if MESA_BIG_ENDIAN
- getTypeSize(input[i]->Type) != 4 ||
+ || getTypeSize(input[i]->Type) != 4
#endif
- stride < 4)
+ )
{
evergreenConvertAttrib(ctx, count, input[i], &context->stream_desc[index]);
}
{
if (input[i]->BufferObj->Name)
{
- if (stride % 4 != 0)
- {
- assert(((intptr_t) input[i]->Ptr) % input[i]->StrideB == 0);
- evergreenAlignDataToDword(ctx, input[i], count, &context->stream_desc[index]);
- context->stream_desc[index].is_named_bo = GL_FALSE;
- }
- else
- {
- context->stream_desc[index].stride = input[i]->StrideB;
- context->stream_desc[index].bo_offset = (intptr_t) input[i]->Ptr;
- context->stream_desc[index].bo = get_radeon_buffer_object(input[i]->BufferObj)->bo;
- context->stream_desc[index].is_named_bo = GL_TRUE;
- }
+ context->stream_desc[index].stride = input[i]->StrideB;
+ context->stream_desc[index].bo_offset = (intptr_t) input[i]->Ptr;
+ context->stream_desc[index].bo = get_radeon_buffer_object(input[i]->BufferObj)->bo;
+ context->stream_desc[index].is_named_bo = GL_TRUE;
}
else
{
RADEON_GEM_DOMAIN_GTT, 0);
}
-static void evergreenFreeData(GLcontext *ctx)
+static void evergreenFreeData(struct gl_context *ctx)
{
/* Need to zero tcl.aos[n].bo and tcl.elt_dma_bo
* to prevent double unref in radeonReleaseArrays
}
}
-static GLboolean evergreenTryDrawPrims(GLcontext *ctx,
+static GLboolean evergreenTryDrawPrims(struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
evergreenRunRenderPrimitive(ctx,
prim[i].start,
prim[i].start + prim[i].count,
- prim[i].mode);
+ prim[i].mode,
+ prim[i].basevertex);
else
evergreenRunRenderPrimitiveImmediate(ctx,
prim[i].start,
return GL_TRUE;
}
-static void evergreenDrawPrims(GLcontext *ctx,
+static void evergreenDrawPrims(struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
/* This check should get folded into just the places that
* min/max index are really needed.
*/
- if (!index_bounds_valid) {
- vbo_get_minmax_index(ctx, prim, ib, &min_index, &max_index);
- }
-
- if (min_index) {
- vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, evergreenDrawPrims );
- return;
+ if (!vbo_all_varyings_in_vbos(arrays)) {
+ if (!index_bounds_valid)
+ vbo_get_minmax_index(ctx, prim, ib, &min_index, &max_index);
+ /* do we want to rebase, minimizes the
+ * amount of data to upload? */
+ if (min_index) {
+ vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, evergreenDrawPrims );
+ return;
+ }
}
-
/* Make an attempt at drawing */
retval = evergreenTryDrawPrims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
}
}
-void evergreenInitDraw(GLcontext *ctx)
+void evergreenInitDraw(struct gl_context *ctx)
{
struct vbo_context *vbo = vbo_context(ctx);
#include "evergreen_fragprog.h"
#include "evergreen_tex.h"
-void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state); //same
+void evergreenUpdateStateParameters(struct gl_context * ctx, GLuint new_state); //same
-void evergreenUpdateShaders(GLcontext * ctx)
+void evergreenUpdateShaders(struct gl_context * ctx)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
context->radeon.NewGLState = 0;
}
-void evergreeUpdateShaders(GLcontext * ctx)
+void evergreeUpdateShaders(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
/*
* To correctly position primitives:
*/
-void evergreenUpdateViewportOffset(GLcontext * ctx) //------------------
+void evergreenUpdateViewportOffset(struct gl_context * ctx) //------------------
{
context_t *context = R700_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
radeonUpdateScissor(ctx);
}
-void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state) //same
+void evergreenUpdateStateParameters(struct gl_context * ctx, GLuint new_state) //same
{
struct evergreen_fragment_program *fp =
(struct evergreen_fragment_program *)ctx->FragmentProgram._Current;
/**
* Called by Mesa after an internal state update.
*/
-static void evergreenInvalidateState(GLcontext * ctx, GLuint new_state) //same
+static void evergreenInvalidateState(struct gl_context * ctx, GLuint new_state) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
context->radeon.NewGLState |= new_state;
}
-static void evergreenSetAlphaState(GLcontext * ctx) //same
+static void evergreenSetAlphaState(struct gl_context * ctx) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
}
}
-static void evergreenAlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) //same
+static void evergreenAlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) //same
{
(void)func;
(void)ref;
evergreenSetAlphaState(ctx);
}
-static void evergreenBlendColor(GLcontext * ctx, const GLfloat cf[4]) //same
+static void evergreenBlendColor(struct gl_context * ctx, const GLfloat cf[4]) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
}
}
-static void evergreenSetBlendState(GLcontext * ctx) //diff : CB_COLOR_CONTROL, CB_BLEND0_CONTROL bits
+static void evergreenSetBlendState(struct gl_context * ctx) //diff : CB_COLOR_CONTROL, CB_BLEND0_CONTROL bits
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
evergreen->CB_BLEND0_CONTROL.u32All = blend_reg;
}
-static void evergreenBlendEquationSeparate(GLcontext * ctx,
+static void evergreenBlendEquationSeparate(struct gl_context * ctx,
GLenum modeRGB, GLenum modeA) //same
{
evergreenSetBlendState(ctx);
}
-static void evergreenBlendFuncSeparate(GLcontext * ctx,
+static void evergreenBlendFuncSeparate(struct gl_context * ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA) //same
{
}
}
-static void evergreenSetLogicOpState(GLcontext *ctx) //diff : CB_COLOR_CONTROL.ROP3 is actually same bits.
+static void evergreenSetLogicOpState(struct gl_context *ctx) //diff : CB_COLOR_CONTROL.ROP3 is actually same bits.
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
EG_CB_COLOR_CONTROL__ROP3_mask);
}
-static void evergreenClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq ) //same , but PA_CL_UCP_0_ offset diff
+static void evergreenClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq ) //same , but PA_CL_UCP_0_ offset diff
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
evergreen->ucp[p].PA_CL_UCP_0_W.u32All = ip[3];
}
-static void evergreenSetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state) //diff in func calls
+static void evergreenSetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state) //diff in func calls
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
}
}
-static void evergreenSetDBRenderState(GLcontext * ctx)
+static void evergreenSetDBRenderState(struct gl_context * ctx)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
}
}
-void evergreenUpdateShaderStates(GLcontext * ctx)
+void evergreenUpdateShaderStates(struct gl_context * ctx)
{
evergreenSetDBRenderState(ctx);
evergreenUpdateTextureState(ctx);
}
-static void evergreenSetDepthState(GLcontext * ctx) //same
+static void evergreenSetDepthState(struct gl_context * ctx) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
}
}
-static void evergreenSetStencilState(GLcontext * ctx, GLboolean state) //same
+static void evergreenSetStencilState(struct gl_context * ctx, GLboolean state) //same
{
- context_t *context = EVERGREEN_CONTEXT(ctx);
- EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
- GLboolean hw_stencil = GL_FALSE;
+ context_t *context = EVERGREEN_CONTEXT(ctx);
+ EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
+ GLboolean hw_stencil = GL_FALSE;
- if (ctx->DrawBuffer) {
- struct radeon_renderbuffer *rrbStencil
- = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL);
- hw_stencil = (rrbStencil && rrbStencil->bo);
- }
+ if (ctx->DrawBuffer) {
+ struct radeon_renderbuffer *rrbStencil
+ = radeon_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL);
+ hw_stencil = (rrbStencil && rrbStencil->bo);
+ }
- if (hw_stencil) {
- EVERGREEN_STATECHANGE(context, db);
- if (state) {
- SETbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit);
- SETbit(evergreen->DB_DEPTH_CONTROL.u32All, BACKFACE_ENABLE_bit);
- } else
- CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit);
- }
+ if (hw_stencil) {
+ EVERGREEN_STATECHANGE(context, db);
+ if (state) {
+ SETbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit);
+ SETbit(evergreen->DB_DEPTH_CONTROL.u32All, BACKFACE_ENABLE_bit);
+ SETbit(evergreen->DB_STENCIL_INFO.u32All, EG_DB_STENCIL_INFO__FORMAT_bit);
+ } else
+ CLEARbit(evergreen->DB_DEPTH_CONTROL.u32All, STENCIL_ENABLE_bit);
+ }
}
-static void evergreenUpdateCulling(GLcontext * ctx) //same
+static void evergreenUpdateCulling(struct gl_context * ctx) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
evergreen->PA_SU_SC_MODE_CNTL.u32All ^= FACE_bit;
}
-static void evergreenSetPolygonOffsetState(GLcontext * ctx, GLboolean state) //same
+static void evergreenSetPolygonOffsetState(struct gl_context * ctx, GLboolean state) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
}
}
-static void evergreenUpdateLineStipple(GLcontext * ctx) //diff
+static void evergreenUpdateLineStipple(struct gl_context * ctx) //diff
{
/* TODO */
}
evergreen->viewport[id].enabled = GL_TRUE;
}
-static void evergreenUpdateWindow(GLcontext * ctx, int id) //diff in calling evergreenSetScissor
+static void evergreenUpdateWindow(struct gl_context * ctx, int id) //diff in calling evergreenSetScissor
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
evergreenSetScissor(context);
}
-static void evergreenEnable(GLcontext * ctx, GLenum cap, GLboolean state) //diff in func calls
+static void evergreenEnable(struct gl_context * ctx, GLenum cap, GLboolean state) //diff in func calls
{
context_t *context = EVERGREEN_CONTEXT(ctx);
}
-static void evergreenColorMask(GLcontext * ctx,
+static void evergreenColorMask(struct gl_context * ctx,
GLboolean r, GLboolean g, GLboolean b, GLboolean a) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
}
}
-static void evergreenDepthFunc(GLcontext * ctx, GLenum func) //same
+static void evergreenDepthFunc(struct gl_context * ctx, GLenum func) //same
{
evergreenSetDepthState(ctx);
}
-static void evergreenDepthMask(GLcontext * ctx, GLboolean mask) //same
+static void evergreenDepthMask(struct gl_context * ctx, GLboolean mask) //same
{
evergreenSetDepthState(ctx);
}
-static void evergreenCullFace(GLcontext * ctx, GLenum mode) //same
+static void evergreenCullFace(struct gl_context * ctx, GLenum mode) //same
{
evergreenUpdateCulling(ctx);
}
-static void evergreenFogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) //same
+static void evergreenFogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) //same
{
}
-static void evergreenUpdatePolygonMode(GLcontext * ctx) //same
+static void evergreenUpdatePolygonMode(struct gl_context * ctx) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
}
}
-static void evergreenFrontFace(GLcontext * ctx, GLenum mode) //same
+static void evergreenFrontFace(struct gl_context * ctx, GLenum mode) //same
{
evergreenUpdateCulling(ctx);
evergreenUpdatePolygonMode(ctx);
}
-static void evergreenShadeModel(GLcontext * ctx, GLenum mode) //same
+static void evergreenShadeModel(struct gl_context * ctx, GLenum mode) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
}
}
-static void evergreenLogicOpcode(GLcontext *ctx, GLenum logicop) //diff
+static void evergreenLogicOpcode(struct gl_context *ctx, GLenum logicop) //diff
{
if (RGBA_LOGICOP_ENABLED(ctx))
evergreenSetLogicOpState(ctx);
}
-static void evergreenPointSize(GLcontext * ctx, GLfloat size) //same
+static void evergreenPointSize(struct gl_context * ctx, GLfloat size) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
}
-static void evergreenPointParameter(GLcontext * ctx, GLenum pname, const GLfloat * param) //same
+static void evergreenPointParameter(struct gl_context * ctx, GLenum pname, const GLfloat * param) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
return 0;
}
-static void evergreenStencilFuncSeparate(GLcontext * ctx, GLenum face,
+static void evergreenStencilFuncSeparate(struct gl_context * ctx, GLenum face,
GLenum func, GLint ref, GLuint mask) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
STENCILFUNC_BF_shift, STENCILFUNC_BF_mask);
}
-static void evergreenStencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) //same
+static void evergreenStencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
return 0;
}
-static void evergreenStencilOpSeparate(GLcontext * ctx, GLenum face,
+static void evergreenStencilOpSeparate(struct gl_context * ctx, GLenum face,
GLenum fail, GLenum zfail, GLenum zpass) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
STENCILZPASS_BF_shift, STENCILZPASS_BF_mask);
}
-static void evergreenViewport(GLcontext * ctx,
+static void evergreenViewport(struct gl_context * ctx,
GLint x,
GLint y,
GLsizei width,
radeon_viewport(ctx, x, y, width, height);
}
-static void evergreenDepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) //diff in evergreenUpdateWindow
+static void evergreenDepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) //diff in evergreenUpdateWindow
{
evergreenUpdateWindow(ctx, 0);
}
-static void evergreenLineWidth(GLcontext * ctx, GLfloat widthf) //same
+static void evergreenLineWidth(struct gl_context * ctx, GLfloat widthf) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
PA_SU_LINE_CNTL__WIDTH_shift, PA_SU_LINE_CNTL__WIDTH_mask);
}
-static void evergreenLineStipple(GLcontext *ctx, GLint factor, GLushort pattern) //same
+static void evergreenLineStipple(struct gl_context *ctx, GLint factor, GLushort pattern) //same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
SETfield(evergreen->PA_SC_LINE_STIPPLE.u32All, 1, AUTO_RESET_CNTL_shift, AUTO_RESET_CNTL_mask);
}
-static void evergreenPolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) //diff :
+static void evergreenPolygonOffset(struct gl_context * ctx, GLfloat factor, GLfloat units) //diff :
//all register here offset diff, bits same
{
context_t *context = EVERGREEN_CONTEXT(ctx);
evergreen->PA_SU_POLY_OFFSET_BACK_OFFSET.f32All = constant;
}
-static void evergreenPolygonMode(GLcontext * ctx, GLenum face, GLenum mode) //same
+static void evergreenPolygonMode(struct gl_context * ctx, GLenum face, GLenum mode) //same
{
(void)face;
(void)mode;
evergreenUpdatePolygonMode(ctx);
}
-static void evergreenRenderMode(GLcontext * ctx, GLenum mode) //same
+static void evergreenRenderMode(struct gl_context * ctx, GLenum mode) //same
{
}
//TODO : move to kernel.
-static void evergreenInitSQConfig(GLcontext * ctx)
+static void evergreenInitSQConfig(struct gl_context * ctx)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
NUM_CLIP_SEQ_mask);
}
-void evergreenInitState(GLcontext * ctx) //diff
+void evergreenInitState(struct gl_context * ctx) //diff
{
context_t *context = R700_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
evergreen->DB_STENCIL_INFO.u32All = 0;
CLEARbit(evergreen->DB_STENCIL_INFO.u32All, EG_DB_STENCIL_INFO__FORMAT_bit);
- SETfield(evergreen->DB_STENCIL_INFO.u32All, EG_ADDR_SURF_TILE_SPLIT_256B,
+ SETfield(evergreen->DB_STENCIL_INFO.u32All, 0,
EG_DB_STENCIL_INFO__TILE_SPLIT_shift, EG_DB_STENCIL_INFO__TILE_SPLIT_mask);
evergreen->DB_RENDER_CONTROL.u32All = 0;
SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE0_shift, FORCE_HIS_ENABLE0_mask);
SETfield(evergreen->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE1_shift, FORCE_HIS_ENABLE1_mask);
+ /* stencil */
+ evergreenEnable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled);
+ evergreenStencilMaskSeparate(ctx, 0, ctx->Stencil.WriteMask[0]);
+ evergreenStencilFuncSeparate(ctx, 0, ctx->Stencil.Function[0],
+ ctx->Stencil.Ref[0], ctx->Stencil.ValueMask[0]);
+ evergreenStencilOpSeparate(ctx, 0, ctx->Stencil.FailFunc[0],
+ ctx->Stencil.ZFailFunc[0],
+ ctx->Stencil.ZPassFunc[0]);
+
// Disable ROP3 modes by setting src to dst copy:
SETfield(evergreen->CB_COLOR_CONTROL.u32All, 0xCC,
EG_CB_COLOR_CONTROL__ROP3_shift,
#include "r600_context.h"
-extern void evergreenUpdateStateParameters(GLcontext * ctx, GLuint new_state);
-extern void evergreenUpdateShaders(GLcontext * ctx);
-extern void evergreenUpdateShaderStates(GLcontext * ctx);
+extern void evergreenUpdateStateParameters(struct gl_context * ctx, GLuint new_state);
+extern void evergreenUpdateShaders(struct gl_context * ctx);
+extern void evergreenUpdateShaderStates(struct gl_context * ctx);
-extern void evergreeUpdateShaders(GLcontext * ctx);
+extern void evergreeUpdateShaders(struct gl_context * ctx);
-extern void evergreenUpdateViewportOffset(GLcontext * ctx);
+extern void evergreenUpdateViewportOffset(struct gl_context * ctx);
-extern void evergreenInitState(GLcontext * ctx);
+extern void evergreenInitState(struct gl_context * ctx);
extern void evergreenInitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions);
extern void evergreenSetScissor(context_t *context);
return value * (1 << frac_bits);
}
-static GLboolean evergreen_setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit)
+static GLboolean evergreen_setup_hardware_state(struct gl_context * ctx, struct gl_texture_object *texObj, int unit)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
radeonTexObj *t = radeon_tex_obj(texObj);
return;
}
-void evergreenUpdateTextureState(GLcontext * ctx)
+void evergreenUpdateTextureState(struct gl_context * ctx)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT * evergreen = GET_EVERGREEN_CHIP(context);
}
}
-static GLboolean evergreen_validate_texture(GLcontext * ctx, struct gl_texture_object *texObj, int unit)
+static GLboolean evergreen_validate_texture(struct gl_context * ctx, struct gl_texture_object *texObj, int unit)
{
radeonTexObj *t = radeon_tex_obj(texObj);
return GL_TRUE;
}
-GLboolean evergreenValidateBuffers(GLcontext * ctx)
+GLboolean evergreenValidateBuffers(struct gl_context * ctx)
{
context_t *rmesa = EVERGREEN_CONTEXT(ctx);
struct radeon_renderbuffer *rrb;
return GL_TRUE;
}
-static struct gl_texture_object *evergreenNewTextureObject(GLcontext * ctx,
+static struct gl_texture_object *evergreenNewTextureObject(struct gl_context * ctx,
GLuint name,
GLenum target)
{
return &t->base;
}
-static void evergreenDeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj)
+static void evergreenDeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj)
{
context_t * rmesa = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT * evergreen = GET_EVERGREEN_CHIP(rmesa);
_mesa_delete_texture_object(ctx, texObj);
}
-static void evergreenTexParameter(GLcontext * ctx, GLenum target,
+static void evergreenTexParameter(struct gl_context * ctx, GLenum target,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat * params)
{
#ifndef _EVERGREEN_TEX_H_
#define _EVERGREEN_TEX_H_
-extern GLboolean evergreenValidateBuffers(GLcontext * ctx);
+extern GLboolean evergreenValidateBuffers(struct gl_context * ctx);
-extern void evergreenUpdateTextureState(GLcontext * ctx);
+extern void evergreenUpdateTextureState(struct gl_context * ctx);
extern void evergreenInitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions);
extern void evergreenSetTexOffset(__DRIcontext * pDRICtx, GLint texname,
unsigned long long offset, GLint depth, GLuint pitch);
}
GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions2(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct evergreen_vertex_program *vp,
struct gl_vertex_program *mesa_vp)
{
return GL_TRUE;
}
-void evergreen_Map_Vertex_Program(GLcontext *ctx,
+void evergreen_Map_Vertex_Program(struct gl_context *ctx,
struct evergreen_vertex_program *vp,
struct gl_vertex_program *mesa_vp)
{
return GL_TRUE;
}
-struct evergreen_vertex_program* evergreenTranslateVertexShader(GLcontext *ctx,
+struct evergreen_vertex_program* evergreenTranslateVertexShader(struct gl_context *ctx,
struct gl_vertex_program *mesa_vp)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
return vp;
}
-void evergreenSelectVertexShader(GLcontext *ctx)
+void evergreenSelectVertexShader(struct gl_context *ctx)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
struct evergreen_vertex_program_cont *vpc;
}
}
-static void evergreenTranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, const struct gl_client_array *input)
+static void evergreenTranslateAttrib(struct gl_context *ctx, GLuint unLoc, int count, const struct gl_client_array *input)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
stride = (input->StrideB == 0) ? evergreen_getTypeSize(input->Type) * input->Size
: input->StrideB;
- if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT ||
+ if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT
#if MESA_BIG_ENDIAN
- evergreen_getTypeSize(input->Type) != 4 ||
+ || evergreen_getTypeSize(input->Type) != 4
#endif
- stride < 4)
+ )
{
pStreamDesc->type = GL_FLOAT;
context->nNumActiveAos++;
}
-void evergreenSetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count)
+void evergreenSetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
struct evergreen_vertex_program *vpc
context->radeon.tcl.aos_count = context->nNumActiveAos;
}
-void * evergreenGetActiveVpShaderBo(GLcontext * ctx)
+void * evergreenGetActiveVpShaderBo(struct gl_context * ctx)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
struct evergreen_vertex_program *vp = context->selected_vp;;
return NULL;
}
-void * evergreenGetActiveVpShaderConstBo(GLcontext * ctx)
+void * evergreenGetActiveVpShaderConstBo(struct gl_context * ctx)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
struct evergreen_vertex_program *vp = context->selected_vp;;
return NULL;
}
-GLboolean evergreenSetupVertexProgram(GLcontext * ctx)
+GLboolean evergreenSetupVertexProgram(struct gl_context * ctx)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
return GL_TRUE;
}
-GLboolean evergreenSetupVPconstants(GLcontext * ctx)
+GLboolean evergreenSetupVPconstants(struct gl_context * ctx)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
struct evergreen_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
GLboolean evergreen_Process_Vertex_Program_Vfetch_Instructions2(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct evergreen_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
-void evergreen_Map_Vertex_Program(GLcontext *ctx,
+void evergreen_Map_Vertex_Program(struct gl_context *ctx,
struct evergreen_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
GLboolean evergreen_Find_Instruction_Dependencies_vp(struct evergreen_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
-struct evergreen_vertex_program* evergreenTranslateVertexShader(GLcontext *ctx,
+struct evergreen_vertex_program* evergreenTranslateVertexShader(struct gl_context *ctx,
struct gl_vertex_program *mesa_vp);
/* Interface */
-extern void evergreenSelectVertexShader(GLcontext *ctx);
-extern void evergreenSetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count);
+extern void evergreenSelectVertexShader(struct gl_context *ctx);
+extern void evergreenSetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count);
-extern GLboolean evergreenSetupVertexProgram(GLcontext * ctx);
+extern GLboolean evergreenSetupVertexProgram(struct gl_context * ctx);
-extern GLboolean evergreenSetupVPconstants(GLcontext * ctx);
+extern GLboolean evergreenSetupVPconstants(struct gl_context * ctx);
-extern void * evergreenGetActiveVpShaderBo(GLcontext * ctx);
+extern void * evergreenGetActiveVpShaderBo(struct gl_context * ctx);
-extern void * evergreenGetActiveVpShaderConstBo(GLcontext * ctx);
+extern void * evergreenGetActiveVpShaderConstBo(struct gl_context * ctx);
extern int evergreen_getTypeSize(GLenum type);
}
-static inline void load_shaders(GLcontext * ctx)
+static inline void load_shaders(struct gl_context * ctx)
{
radeonContextPtr radeonctx = RADEON_CONTEXT(ctx);
return GL_TRUE;
}
-unsigned r600_blit(GLcontext *ctx,
+unsigned r600_blit(struct gl_context *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
gl_format src_mesaformat,
unsigned r600_check_blit(gl_format mesa_format);
-unsigned r600_blit(GLcontext *ctx,
+unsigned r600_blit(struct gl_context *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
gl_format src_mesaformat,
#include "radeon_reg.h"
#include "r600_cmdbuf.h"
#include "radeon_bocs_wrapper.h"
-#include "radeon_reg.h"
#ifdef HAVE_LIBDRM_RADEON
#include "radeon_cs_int.h"
r700Start3D((context_t *)radeon);
}
-static void r600_fallback(GLcontext *ctx, GLuint bit, GLboolean mode)
+static void r600_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode)
{
context_t *context = R700_CONTEXT(ctx);
if (mode)
radeon->vtbl.is_format_renderable = r600IsFormatRenderable;
}
-static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
+static void r600InitConstValues(struct gl_context *ctx, radeonScreenPtr screen)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
}
-static void r600InitGLExtensions(GLcontext *ctx)
+static void r600InitGLExtensions(struct gl_context *ctx)
{
context_t *r600 = R700_CONTEXT(ctx);
#ifdef R600_ENABLE_GLSL_TEST
/* Create the device specific rendering context.
*/
GLboolean r600CreateContext(gl_api api,
- const __GLcontextModes * glVisual,
+ const struct gl_config * glVisual,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
struct dd_function_table functions;
context_t *r600;
- GLcontext *ctx;
+ struct gl_context *ctx;
assert(glVisual);
assert(driContextPriv);
#define EVERGREEN_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx))
#define R700_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx))
-#define GL_CONTEXT(context) ((GLcontext *)(context->radeon.glCtx))
+#define GL_CONTEXT(context) ((struct gl_context *)(context->radeon.glCtx))
#define GET_EVERGREEN_CHIP(context) ((EVERGREEN_CHIP_CONTEXT*)(context->pChip))
extern GLboolean r600CreateContext(gl_api api,
- const __GLcontextModes * glVisual,
+ const struct gl_config * glVisual,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
extern void r700Start3D(context_t *context);
extern void r600InitAtoms(context_t *context);
-extern void r700InitDraw(GLcontext *ctx);
+extern void r700InitDraw(struct gl_context *ctx);
extern void evergreenInitAtoms(context_t *context);
-extern void evergreenInitDraw(GLcontext *ctx);
+extern void evergreenInitDraw(struct gl_context *ctx);
#define RADEON_D_CAPTURE 0
#define RADEON_D_PLAYBACK 1
{
}
-GLboolean r600AllocShaderConsts(GLcontext * ctx,
+GLboolean r600AllocShaderConsts(struct gl_context * ctx,
void ** constbo,
int sizeinBYTE,
char * szShaderUsage)
return GL_TRUE;
}
-GLboolean r600EmitShaderConsts(GLcontext * ctx,
+GLboolean r600EmitShaderConsts(struct gl_context * ctx,
void * constbo,
int bo_offset,
GLvoid * data,
return GL_TRUE;
}
-GLboolean r600EmitShader(GLcontext * ctx,
+GLboolean r600EmitShader(struct gl_context * ctx,
void ** shaderbo,
GLvoid * data,
int sizeinDWORD,
return GL_TRUE;
}
-GLboolean r600DeleteShader(GLcontext * ctx,
+GLboolean r600DeleteShader(struct gl_context * ctx,
void * shaderbo)
{
struct radeon_bo * pbo = (struct radeon_bo *)shaderbo;
void r600EmitCacheFlush(context_t *rmesa);
-extern GLboolean r600EmitShader(GLcontext * ctx,
+extern GLboolean r600EmitShader(struct gl_context * ctx,
void ** shaderbo,
GLvoid * data,
int sizeinDWORD,
char * szShaderUsage);
-extern GLboolean r600DeleteShader(GLcontext * ctx,
+extern GLboolean r600DeleteShader(struct gl_context * ctx,
void * shaderbo);
-extern GLboolean r600AllocShaderConsts(GLcontext * ctx,
+extern GLboolean r600AllocShaderConsts(struct gl_context * ctx,
void ** constbo,
int sizeinBYTE,
char * szShaderUsage);
-GLboolean r600EmitShaderConsts(GLcontext * ctx,
+GLboolean r600EmitShaderConsts(struct gl_context * ctx,
void * constbo,
int bo_offset,
GLvoid * data,
* next UpdateTextureState
*/
-static void r600TexParameter(GLcontext * ctx, GLenum target,
+static void r600TexParameter(struct gl_context * ctx, GLenum target,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat * params)
{
}
}
-static void r600DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj)
+static void r600DeleteTexture(struct gl_context * ctx, struct gl_texture_object *texObj)
{
context_t* rmesa = R700_CONTEXT(ctx);
radeonTexObj* t = radeon_tex_obj(texObj);
* allocate the default texture objects.
* Fixup MaxAnisotropy according to user preference.
*/
-static struct gl_texture_object *r600NewTextureObject(GLcontext * ctx,
+static struct gl_texture_object *r600NewTextureObject(struct gl_context * ctx,
GLuint name,
GLenum target)
{
unsigned long long offset, GLint depth,
GLuint pitch);
-extern GLboolean r600ValidateBuffers(GLcontext * ctx);
+extern GLboolean r600ValidateBuffers(struct gl_context * ctx);
extern void r600InitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions);
#include "evergreen_tex.h"
-void r600UpdateTextureState(GLcontext * ctx);
+void r600UpdateTextureState(struct gl_context * ctx);
-void r600UpdateTextureState(GLcontext * ctx)
+void r600UpdateTextureState(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
* \param rmesa Context pointer
* \param t the r300 texture object
*/
-static GLboolean setup_hardware_state(GLcontext * ctx, struct gl_texture_object *texObj, int unit)
+static GLboolean setup_hardware_state(struct gl_context * ctx, struct gl_texture_object *texObj, int unit)
{
context_t *rmesa = R700_CONTEXT(ctx);
radeonTexObj *t = radeon_tex_obj(texObj);
*
* Mostly this means populating the texture object's mipmap tree.
*/
-static GLboolean r600_validate_texture(GLcontext * ctx, struct gl_texture_object *texObj, int unit)
+static GLboolean r600_validate_texture(struct gl_context * ctx, struct gl_texture_object *texObj, int unit)
{
radeonTexObj *t = radeon_tex_obj(texObj);
/**
* Ensure all enabled and complete textures are uploaded along with any buffers being used.
*/
-GLboolean r600ValidateBuffers(GLcontext * ctx)
+GLboolean r600ValidateBuffers(struct gl_context * ctx)
{
context_t *rmesa = R700_CONTEXT(ctx);
struct radeon_renderbuffer *rrb;
#include "radeon_mipmap_tree.h"
-static void r700SendTexState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendTexState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
#define SAMPLER_STRIDE 3
-static void r700SendTexSamplerState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendTexSamplerState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
}
}
-static void r700SendTexBorderColorState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendTexBorderColorState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
}
extern int getTypeSize(GLenum type);
-static void r700SetupVTXConstants(GLcontext * ctx,
+static void r700SetupVTXConstants(struct gl_context * ctx,
void * pAos,
StreamDesc * pStreamDesc)
{
}
-static void r700SendVTXState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendVTXState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
struct r700_vertex_program *vp = context->selected_vp;
/* r700->DB_PREFETCH_LIMIT.bits.DEPTH_HEIGHT_TILE_MAX = (context->currentDraw->h >> 3) - 1; */ /* z buffer sie may much bigger than what need, so use actual used h. */
}
-static void r700SendDepthTargetState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendDepthTargetState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
}
-static void r700SendRenderTargetState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendRenderTargetState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
}
-static void r700SendPSState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendPSState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
}
-static void r700SendVSState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendVSState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendFSState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendFSState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
}
-static void r700SendViewportState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendViewportState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
}
-static void r700SendSQConfig(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendSQConfig(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendUCPState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendUCPState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
}
}
-static void r700SendSPIState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendSPIState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendVGTState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendVGTState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendSXState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendSXState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendDBState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendDBState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendStencilState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendStencilState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendCBState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendCBState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendCBCLRCMPState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendCBCLRCMPState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendCBBlendState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendCBBlendState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendCBBlendColorState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendCBBlendColorState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendSUState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendSUState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
}
-static void r700SendPolyState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendPolyState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
}
-static void r700SendCLState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendCLState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendGBState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendGBState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendScissorState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendScissorState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendSCState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendSCState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendAAState(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendAAState(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendPSConsts(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendPSConsts(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendVSConsts(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendVSConsts(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context);
COMMIT_BATCH();
}
-static void r700SendQueryBegin(GLcontext *ctx, struct radeon_state_atom *atom)
+static void r700SendQueryBegin(struct gl_context *ctx, struct radeon_state_atom *atom)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_query_object *query = radeon->query.current;
query->emitted_begin = GL_TRUE;
}
-static int check_always(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_always(struct gl_context *ctx, struct radeon_state_atom *atom)
{
return atom->cmd_size;
}
-static int check_cb(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_cb(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
int count = 7;
return count;
}
-static int check_blnd(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_blnd(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
return count;
}
-static int check_ucp(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_ucp(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
return count;
}
-static int check_vtx(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_vtx(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
int count = context->radeon.tcl.aos_count * 18;
return count;
}
-static int check_tx(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_tx(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
unsigned int i, count = 0;
return count * 31;
}
-static int check_ps_consts(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_ps_consts(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
return count;
}
-static int check_vs_consts(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_vs_consts(struct gl_context *ctx, struct radeon_state_atom *atom)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
return count;
}
-static int check_queryobj(GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_query_object *query = radeon->query.current;
return GL_FALSE;
}
-void r700Clear(GLcontext * ctx, GLbitfield mask)
+void r700Clear(struct gl_context * ctx, GLbitfield mask)
{
context_t *context = R700_CONTEXT(ctx);
radeonContextPtr radeon = &context->radeon;
#ifndef __r700_CLEAR_H__
#define __r700_CLEAR_H__
-extern void r700Clear(GLcontext * ctx, GLbitfield mask);
+extern void r700Clear(struct gl_context * ctx, GLbitfield mask);
#endif /* __r700_CLEAR_H__ */
#include "r700_debug.h"
-void insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog)
+void insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog)
{
static const gl_state_index winstate[STATE_LENGTH]
= { STATE_INTERNAL, STATE_FB_SIZE, 0, 0, 0};
//TODO : Validate FP input with VP output.
void Map_Fragment_Program(r700_AssemblerBase *pAsm,
struct gl_fragment_program *mesa_fp,
- GLcontext *ctx)
+ struct gl_context *ctx)
{
unsigned int unBit;
unsigned int i;
GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp,
struct gl_fragment_program *mesa_fp,
- GLcontext *ctx)
+ struct gl_context *ctx)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
return GL_TRUE;
}
-void r700SelectFragmentShader(GLcontext *ctx)
+void r700SelectFragmentShader(struct gl_context *ctx)
{
context_t *context = R700_CONTEXT(ctx);
struct r700_fragment_program *fp = (struct r700_fragment_program *)
r700TranslateFragmentShader(fp, &(fp->mesa_program), ctx);
}
-void * r700GetActiveFpShaderBo(GLcontext * ctx)
+void * r700GetActiveFpShaderBo(struct gl_context * ctx)
{
struct r700_fragment_program *fp = (struct r700_fragment_program *)
(ctx->FragmentProgram._Current);
return fp->shaderbo;
}
-void * r700GetActiveFpShaderConstBo(GLcontext * ctx)
+void * r700GetActiveFpShaderConstBo(struct gl_context * ctx)
{
struct r700_fragment_program *fp = (struct r700_fragment_program *)
(ctx->FragmentProgram._Current);
return fp->constbo0;
}
-GLboolean r700SetupFragmentProgram(GLcontext * ctx)
+GLboolean r700SetupFragmentProgram(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
};
/* Internal */
-void insert_wpos_code(GLcontext *ctx, struct gl_fragment_program *fprog);
+void insert_wpos_code(struct gl_context *ctx, struct gl_fragment_program *fprog);
void Map_Fragment_Program(r700_AssemblerBase *pAsm,
struct gl_fragment_program *mesa_fp,
- GLcontext *ctx);
+ struct gl_context *ctx);
GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp,
struct gl_fragment_program *mesa_fp);
GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp,
struct gl_fragment_program *mesa_vp,
- GLcontext *ctx);
+ struct gl_context *ctx);
/* Interface */
-extern void r700SelectFragmentShader(GLcontext *ctx);
+extern void r700SelectFragmentShader(struct gl_context *ctx);
-extern GLboolean r700SetupFragmentProgram(GLcontext * ctx);
+extern GLboolean r700SetupFragmentProgram(struct gl_context * ctx);
-extern void * r700GetActiveFpShaderBo(GLcontext * ctx);
+extern void * r700GetActiveFpShaderBo(struct gl_context * ctx);
-extern void * r700GetActiveFpShaderConstBo(GLcontext * ctx);
+extern void * r700GetActiveFpShaderConstBo(struct gl_context * ctx);
#endif /*_R700_FRAGPROG_H_*/
#include "r700_vertprog.h"
-static void freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *cache)
+static void freeVertProgCache(struct gl_context *ctx, struct r700_vertex_program_cont *cache)
{
struct r700_vertex_program *tmp, *vp = cache->progs;
}
}
-static struct gl_program *r700NewProgram(GLcontext * ctx,
+static struct gl_program *r700NewProgram(struct gl_context * ctx,
GLenum target,
GLuint id)
{
return pProgram;
}
-static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog)
+static void r700DeleteProgram(struct gl_context * ctx, struct gl_program *prog)
{
struct r700_vertex_program_cont *vpc = (struct r700_vertex_program_cont *)prog;
struct r700_fragment_program * fp;
}
static GLboolean
-r700ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog)
+r700ProgramStringNotify(struct gl_context * ctx, GLenum target, struct gl_program *prog)
{
struct r700_vertex_program_cont *vpc = (struct r700_vertex_program_cont *)prog;
struct r700_fragment_program * fp = (struct r700_fragment_program*)prog;
return GL_TRUE;
}
-static GLboolean r700IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog)
+static GLboolean r700IsProgramNative(struct gl_context * ctx, GLenum target, struct gl_program *prog)
{
return GL_TRUE;
return num_verts - verts_off;
}
-static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end,
+static void r700RunRenderPrimitive(struct gl_context * ctx, int start, int end,
int prim, GLint basevertex)
{
context_t *context = R700_CONTEXT(ctx);
COMMIT_BATCH();
}
-static void r700RunRenderPrimitiveImmediate(GLcontext * ctx, int start, int end, int prim)
+static void r700RunRenderPrimitiveImmediate(struct gl_context * ctx, int start, int end, int prim)
{
context_t *context = R700_CONTEXT(ctx);
BATCH_LOCALS(&context->radeon);
/* start 3d, idle, cb/db flush */
#define PRE_EMIT_STATE_BUFSZ 5 + 5 + 14
-static GLuint r700PredictRenderSize(GLcontext* ctx,
+static GLuint r700PredictRenderSize(struct gl_context* ctx,
const struct _mesa_prim *prim,
const struct _mesa_index_buffer *ib,
GLuint nr_prims)
* Convert attribute data type to float
* If the attribute uses named buffer object replace the bo with newly allocated bo
*/
-static void r700ConvertAttrib(GLcontext *ctx, int count,
+static void r700ConvertAttrib(struct gl_context *ctx, int count,
const struct gl_client_array *input,
struct StreamDesc *attr)
{
}
}
-static void r700AlignDataToDword(GLcontext *ctx,
+static void r700AlignDataToDword(struct gl_context *ctx,
const struct gl_client_array *input,
int count,
struct StreamDesc *attr)
attr->stride = dst_stride;
}
-static void r700SetupStreams(GLcontext *ctx, const struct gl_client_array *input[], int count)
+static void r700SetupStreams(struct gl_context *ctx, const struct gl_client_array *input[], int count)
{
context_t *context = R700_CONTEXT(ctx);
GLuint stride;
RADEON_GEM_DOMAIN_GTT, 0);
}
-static void r700FreeData(GLcontext *ctx)
+static void r700FreeData(struct gl_context *ctx)
{
/* Need to zero tcl.aos[n].bo and tcl.elt_dma_bo
* to prevent double unref in radeonReleaseArrays
}
}
-static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf)
+static void r700FixupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf)
{
context_t *context = R700_CONTEXT(ctx);
GLvoid *src_ptr;
}
}
-static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf)
+static void r700SetupIndexBuffer(struct gl_context *ctx, const struct _mesa_index_buffer *mesa_ind_buf)
{
context_t *context = R700_CONTEXT(ctx);
}
}
-static GLboolean check_fallbacks(GLcontext *ctx)
+static GLboolean check_fallbacks(struct gl_context *ctx)
{
if (ctx->RenderMode != GL_RENDER)
return GL_TRUE;
return GL_FALSE;
}
-static GLboolean r700TryDrawPrims(GLcontext *ctx,
+static GLboolean r700TryDrawPrims(struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
return GL_TRUE;
}
-static void r700DrawPrims(GLcontext *ctx,
+static void r700DrawPrims(struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
}
}
-void r700InitDraw(GLcontext *ctx)
+void r700InitDraw(struct gl_context *ctx)
{
struct vbo_context *vbo = vbo_context(ctx);
#include "r700_shader.h"
-void r700ShaderInit(GLcontext * ctx)
+void r700ShaderInit(struct gl_context * ctx)
{
}
#include "r700_shaderinst.h"
-void r700ShaderInit(GLcontext * ctx);
+void r700ShaderInit(struct gl_context * ctx);
typedef enum R700ShaderType
{
#include "r700_fragprog.h"
#include "r700_vertprog.h"
-void r600UpdateTextureState(GLcontext * ctx);
-static void r700SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state);
-static void r700UpdatePolygonMode(GLcontext * ctx);
-static void r700SetPolygonOffsetState(GLcontext * ctx, GLboolean state);
-static void r700SetStencilState(GLcontext * ctx, GLboolean state);
-static void r700UpdateWindow(GLcontext * ctx, int id);
-
-void r700UpdateShaders(GLcontext * ctx)
+void r600UpdateTextureState(struct gl_context * ctx);
+static void r700SetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state);
+static void r700UpdatePolygonMode(struct gl_context * ctx);
+static void r700SetPolygonOffsetState(struct gl_context * ctx, GLboolean state);
+static void r700SetStencilState(struct gl_context * ctx, GLboolean state);
+static void r700UpdateWindow(struct gl_context * ctx, int id);
+
+void r700UpdateShaders(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
/*
* To correctly position primitives:
*/
-void r700UpdateViewportOffset(GLcontext * ctx) //------------------
+void r700UpdateViewportOffset(struct gl_context * ctx) //------------------
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
radeonUpdateScissor(ctx);
}
-void r700UpdateStateParameters(GLcontext * ctx, GLuint new_state) //--------------------
+void r700UpdateStateParameters(struct gl_context * ctx, GLuint new_state) //--------------------
{
struct r700_fragment_program *fp =
(struct r700_fragment_program *)ctx->FragmentProgram._Current;
/**
* Called by Mesa after an internal state update.
*/
-static void r700InvalidateState(GLcontext * ctx, GLuint new_state) //-------------------
+static void r700InvalidateState(struct gl_context * ctx, GLuint new_state) //-------------------
{
context_t *context = R700_CONTEXT(ctx);
context->radeon.NewGLState |= new_state;
}
-static void r700SetDBRenderState(GLcontext * ctx)
+static void r700SetDBRenderState(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
}
}
-void r700UpdateShaderStates(GLcontext * ctx)
+void r700UpdateShaderStates(struct gl_context * ctx)
{
r700SetDBRenderState(ctx);
r600UpdateTextureState(ctx);
}
-static void r700SetDepthState(GLcontext * ctx)
+static void r700SetDepthState(struct gl_context * ctx)
{
struct radeon_renderbuffer *rrb;
context_t *context = R700_CONTEXT(ctx);
}
}
-static void r700SetAlphaState(GLcontext * ctx)
+static void r700SetAlphaState(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
}
-static void r700AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref) //---------------
+static void r700AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) //---------------
{
(void)func;
(void)ref;
}
-static void r700BlendColor(GLcontext * ctx, const GLfloat cf[4]) //----------------
+static void r700BlendColor(struct gl_context * ctx, const GLfloat cf[4]) //----------------
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
}
}
-static void r700SetBlendState(GLcontext * ctx)
+static void r700SetBlendState(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
}
-static void r700BlendEquationSeparate(GLcontext * ctx,
+static void r700BlendEquationSeparate(struct gl_context * ctx,
GLenum modeRGB, GLenum modeA) //-----------------
{
r700SetBlendState(ctx);
}
-static void r700BlendFuncSeparate(GLcontext * ctx,
+static void r700BlendFuncSeparate(struct gl_context * ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA) //------------------------
{
* Used internally to update the r300->hw hardware state to match the
* current OpenGL state.
*/
-static void r700SetLogicOpState(GLcontext *ctx)
+static void r700SetLogicOpState(struct gl_context *ctx)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw);
* Called by Mesa when an application program changes the LogicOp state
* via glLogicOp.
*/
-static void r700LogicOpcode(GLcontext *ctx, GLenum logicop)
+static void r700LogicOpcode(struct gl_context *ctx, GLenum logicop)
{
if (RGBA_LOGICOP_ENABLED(ctx))
r700SetLogicOpState(ctx);
}
-static void r700UpdateCulling(GLcontext * ctx)
+static void r700UpdateCulling(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw);
r700->PA_SU_SC_MODE_CNTL.u32All ^= FACE_bit;
}
-static void r700UpdateLineStipple(GLcontext * ctx)
+static void r700UpdateLineStipple(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw);
}
}
-static void r700Enable(GLcontext * ctx, GLenum cap, GLboolean state) //------------------
+static void r700Enable(struct gl_context * ctx, GLenum cap, GLboolean state) //------------------
{
context_t *context = R700_CONTEXT(ctx);
/**
* Handle glColorMask()
*/
-static void r700ColorMask(GLcontext * ctx,
+static void r700ColorMask(struct gl_context * ctx,
GLboolean r, GLboolean g, GLboolean b, GLboolean a) //------------------
{
context_t *context = R700_CONTEXT(ctx);
*
* \note Mesa already filters redundant calls to this function.
*/
-static void r700DepthFunc(GLcontext * ctx, GLenum func) //--------------------
+static void r700DepthFunc(struct gl_context * ctx, GLenum func) //--------------------
{
r700SetDepthState(ctx);
}
*
* \note Mesa already filters redundant calls to this function.
*/
-static void r700DepthMask(GLcontext * ctx, GLboolean mask) //------------------
+static void r700DepthMask(struct gl_context * ctx, GLboolean mask) //------------------
{
r700SetDepthState(ctx);
}
*
* \note Mesa already filters redundant calls to this function.
*/
-static void r700CullFace(GLcontext * ctx, GLenum mode) //-----------------
+static void r700CullFace(struct gl_context * ctx, GLenum mode) //-----------------
{
r700UpdateCulling(ctx);
}
/* =============================================================
* Fog
*/
-static void r700Fogfv(GLcontext * ctx, GLenum pname, const GLfloat * param) //--------------
+static void r700Fogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) //--------------
{
}
*
* \note Mesa already filters redundant calls to this function.
*/
-static void r700FrontFace(GLcontext * ctx, GLenum mode) //------------------
+static void r700FrontFace(struct gl_context * ctx, GLenum mode) //------------------
{
r700UpdateCulling(ctx);
r700UpdatePolygonMode(ctx);
}
-static void r700ShadeModel(GLcontext * ctx, GLenum mode) //--------------------
+static void r700ShadeModel(struct gl_context * ctx, GLenum mode) //--------------------
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
/* =============================================================
* Point state
*/
-static void r700PointSize(GLcontext * ctx, GLfloat size)
+static void r700PointSize(struct gl_context * ctx, GLfloat size)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
}
-static void r700PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * param) //---------------
+static void r700PointParameter(struct gl_context * ctx, GLenum pname, const GLfloat * param) //---------------
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
return 0;
}
-static void r700SetStencilState(GLcontext * ctx, GLboolean state)
+static void r700SetStencilState(struct gl_context * ctx, GLboolean state)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
}
}
-static void r700StencilFuncSeparate(GLcontext * ctx, GLenum face,
+static void r700StencilFuncSeparate(struct gl_context * ctx, GLenum face,
GLenum func, GLint ref, GLuint mask) //---------------------
{
context_t *context = R700_CONTEXT(ctx);
}
-static void r700StencilMaskSeparate(GLcontext * ctx, GLenum face, GLuint mask) //--------------
+static void r700StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) //--------------
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
}
-static void r700StencilOpSeparate(GLcontext * ctx, GLenum face,
+static void r700StencilOpSeparate(struct gl_context * ctx, GLenum face,
GLenum fail, GLenum zfail, GLenum zpass) //--------------------
{
context_t *context = R700_CONTEXT(ctx);
STENCILZPASS_BF_shift, STENCILZPASS_BF_mask);
}
-static void r700UpdateWindow(GLcontext * ctx, int id) //--------------------
+static void r700UpdateWindow(struct gl_context * ctx, int id) //--------------------
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
}
-static void r700Viewport(GLcontext * ctx,
+static void r700Viewport(struct gl_context * ctx,
GLint x,
GLint y,
GLsizei width,
radeon_viewport(ctx, x, y, width, height);
}
-static void r700DepthRange(GLcontext * ctx, GLclampd nearval, GLclampd farval) //-------------
+static void r700DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) //-------------
{
r700UpdateWindow(ctx, 0);
}
-static void r700LineWidth(GLcontext * ctx, GLfloat widthf) //---------------
+static void r700LineWidth(struct gl_context * ctx, GLfloat widthf) //---------------
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
PA_SU_LINE_CNTL__WIDTH_shift, PA_SU_LINE_CNTL__WIDTH_mask);
}
-static void r700LineStipple(GLcontext *ctx, GLint factor, GLushort pattern)
+static void r700LineStipple(struct gl_context *ctx, GLint factor, GLushort pattern)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
SETfield(r700->PA_SC_LINE_STIPPLE.u32All, 1, AUTO_RESET_CNTL_shift, AUTO_RESET_CNTL_mask);
}
-static void r700SetPolygonOffsetState(GLcontext * ctx, GLboolean state)
+static void r700SetPolygonOffsetState(struct gl_context * ctx, GLboolean state)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
}
}
-static void r700PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) //--------------
+static void r700PolygonOffset(struct gl_context * ctx, GLfloat factor, GLfloat units) //--------------
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
r700->PA_SU_POLY_OFFSET_BACK_OFFSET.f32All = constant;
}
-static void r700UpdatePolygonMode(GLcontext * ctx)
+static void r700UpdatePolygonMode(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
}
}
-static void r700PolygonMode(GLcontext * ctx, GLenum face, GLenum mode) //------------------
+static void r700PolygonMode(struct gl_context * ctx, GLenum face, GLenum mode) //------------------
{
(void)face;
(void)mode;
r700UpdatePolygonMode(ctx);
}
-static void r700RenderMode(GLcontext * ctx, GLenum mode) //---------------------
+static void r700RenderMode(struct gl_context * ctx, GLenum mode) //---------------------
{
}
-static void r700ClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq )
+static void r700ClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq )
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
r700->ucp[p].PA_CL_UCP_0_W.u32All = ip[3];
}
-static void r700SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state)
+static void r700SetClipPlaneState(struct gl_context * ctx, GLenum cap, GLboolean state)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
r700->viewport[id].enabled = GL_TRUE;
}
-static void r700InitSQConfig(GLcontext * ctx)
+static void r700InitSQConfig(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
* Assumes that the command buffer and state atoms have been
* initialized already.
*/
-void r700InitState(GLcontext * ctx) //-------------------
+void r700InitState(struct gl_context * ctx) //-------------------
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
#include "r700_chip.h"
-extern void r700UpdateStateParameters(GLcontext * ctx, GLuint new_state);
-extern void r700UpdateShaders (GLcontext * ctx);
-extern void r700UpdateShaderStates(GLcontext * ctx);
+extern void r700UpdateStateParameters(struct gl_context * ctx, GLuint new_state);
+extern void r700UpdateShaders (struct gl_context * ctx);
+extern void r700UpdateShaderStates(struct gl_context * ctx);
-extern void r700UpdateViewportOffset(GLcontext * ctx);
+extern void r700UpdateViewportOffset(struct gl_context * ctx);
-extern void r700InitState (GLcontext * ctx);
+extern void r700InitState (struct gl_context * ctx);
extern void r700InitStateFuncs (radeonContextPtr radeon, struct dd_function_table *functions);
extern void r700SetScissor(context_t *context);
}
GLboolean Process_Vertex_Program_Vfetch_Instructions2(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct r700_vertex_program *vp,
struct gl_vertex_program *mesa_vp)
{
return GL_TRUE;
}
-void Map_Vertex_Program(GLcontext *ctx,
+void Map_Vertex_Program(struct gl_context *ctx,
struct r700_vertex_program *vp,
struct gl_vertex_program *mesa_vp)
{
return GL_TRUE;
}
-struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx,
+struct r700_vertex_program* r700TranslateVertexShader(struct gl_context *ctx,
struct gl_vertex_program *mesa_vp)
{
context_t *context = R700_CONTEXT(ctx);
return vp;
}
-void r700SelectVertexShader(GLcontext *ctx)
+void r700SelectVertexShader(struct gl_context *ctx)
{
context_t *context = R700_CONTEXT(ctx);
struct r700_vertex_program_cont *vpc;
}
}
-static void r700TranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, const struct gl_client_array *input)
+static void r700TranslateAttrib(struct gl_context *ctx, GLuint unLoc, int count, const struct gl_client_array *input)
{
context_t *context = R700_CONTEXT(ctx);
context->nNumActiveAos++;
}
-void r700SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count)
+void r700SetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count)
{
context_t *context = R700_CONTEXT(ctx);
struct r700_vertex_program *vpc
context->radeon.tcl.aos_count = context->nNumActiveAos;
}
-void * r700GetActiveVpShaderBo(GLcontext * ctx)
+void * r700GetActiveVpShaderBo(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
struct r700_vertex_program *vp = context->selected_vp;;
return NULL;
}
-void * r700GetActiveVpShaderConstBo(GLcontext * ctx)
+void * r700GetActiveVpShaderConstBo(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
struct r700_vertex_program *vp = context->selected_vp;;
return NULL;
}
-GLboolean r700SetupVertexProgram(GLcontext * ctx)
+GLboolean r700SetupVertexProgram(struct gl_context * ctx)
{
context_t *context = R700_CONTEXT(ctx);
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
struct r700_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
GLboolean Process_Vertex_Program_Vfetch_Instructions2(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct r700_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
-void Map_Vertex_Program(GLcontext *ctx,
+void Map_Vertex_Program(struct gl_context *ctx,
struct r700_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp,
struct gl_vertex_program *mesa_vp);
-struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx,
+struct r700_vertex_program* r700TranslateVertexShader(struct gl_context *ctx,
struct gl_vertex_program *mesa_vp);
/* Interface */
-extern void r700SelectVertexShader(GLcontext *ctx);
-extern void r700SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count);
+extern void r700SelectVertexShader(struct gl_context *ctx);
+extern void r700SetVertexFormat(struct gl_context *ctx, const struct gl_client_array *arrays[], int count);
-extern GLboolean r700SetupVertexProgram(GLcontext * ctx);
+extern GLboolean r700SetupVertexProgram(struct gl_context * ctx);
-extern void * r700GetActiveVpShaderBo(GLcontext * ctx);
+extern void * r700GetActiveVpShaderBo(struct gl_context * ctx);
-extern void * r700GetActiveVpShaderConstBo(GLcontext * ctx);
+extern void * r700GetActiveVpShaderConstBo(struct gl_context * ctx);
extern int getTypeSize(GLenum type);
* @param[in] height region height
* @param[in] flip_y set if y coords of the source image need to be flipped
*/
-unsigned r100_blit(GLcontext *ctx,
+unsigned r100_blit(struct gl_context *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
gl_format src_mesaformat,
unsigned r100_check_blit(gl_format mesa_format);
-unsigned r100_blit(GLcontext *ctx,
+unsigned r100_blit(struct gl_context *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
gl_format src_mesaformat,
}
static struct gl_buffer_object *
-radeonNewBufferObject(GLcontext * ctx,
+radeonNewBufferObject(struct gl_context * ctx,
GLuint name,
GLenum target)
{
* Called via glDeleteBuffersARB().
*/
static void
-radeonDeleteBufferObject(GLcontext * ctx,
+radeonDeleteBufferObject(struct gl_context * ctx,
struct gl_buffer_object *obj)
{
struct radeon_buffer_object *radeon_obj = get_radeon_buffer_object(obj);
* \return GL_TRUE for success, GL_FALSE if out of memory
*/
static GLboolean
-radeonBufferData(GLcontext * ctx,
+radeonBufferData(struct gl_context * ctx,
GLenum target,
GLsizeiptrARB size,
const GLvoid * data,
* Called via glBufferSubDataARB().
*/
static void
-radeonBufferSubData(GLcontext * ctx,
+radeonBufferSubData(struct gl_context * ctx,
GLenum target,
GLintptrARB offset,
GLsizeiptrARB size,
* Called via glGetBufferSubDataARB()
*/
static void
-radeonGetBufferSubData(GLcontext * ctx,
+radeonGetBufferSubData(struct gl_context * ctx,
GLenum target,
GLintptrARB offset,
GLsizeiptrARB size,
* Called via glMapBufferARB()
*/
static void *
-radeonMapBuffer(GLcontext * ctx,
+radeonMapBuffer(struct gl_context * ctx,
GLenum target,
GLenum access,
struct gl_buffer_object *obj)
* Called via glUnmapBufferARB()
*/
static GLboolean
-radeonUnmapBuffer(GLcontext * ctx,
+radeonUnmapBuffer(struct gl_context * ctx,
GLenum target,
struct gl_buffer_object *obj)
{
-void radeonUpdateScissor( GLcontext *ctx )
+void radeonUpdateScissor( struct gl_context *ctx )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
GLint x = ctx->Scissor.X, y = ctx->Scissor.Y;
* Scissoring
*/
-void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+void radeonScissor(struct gl_context* ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
if (ctx->Scissor.Enabled) {
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
radeonContextPtr radeon;
- GLcontext *ctx;
+ struct gl_context *ctx;
radeon = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = radeon->glCtx;
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
radeonContextPtr radeon;
- GLcontext *ctx;
+ struct gl_context *ctx;
radeon = (radeonContextPtr) dPriv->driContextPriv->driverPrivate;
ctx = radeon->glCtx;
* If so, set the intel->front_buffer_dirty field to true.
*/
void
-radeon_check_front_buffer_rendering(GLcontext *ctx)
+radeon_check_front_buffer_rendering(struct gl_context *ctx)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
const struct gl_framebuffer *fb = ctx->DrawBuffer;
}
-void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
+void radeon_draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_renderbuffer *rrbDepth = NULL, *rrbStencil = NULL,
/**
* Called via glDrawBuffer.
*/
-void radeonDrawBuffer( GLcontext *ctx, GLenum mode )
+void radeonDrawBuffer( struct gl_context *ctx, GLenum mode )
{
if (RADEON_DEBUG & RADEON_DRI)
fprintf(stderr, "%s %s\n", __FUNCTION__,
radeon_draw_buffer(ctx, ctx->DrawBuffer);
}
-void radeonReadBuffer( GLcontext *ctx, GLenum mode )
+void radeonReadBuffer( struct gl_context *ctx, GLenum mode )
{
if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) {
struct radeon_context *const rmesa = RADEON_CONTEXT(ctx);
}
}
-void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height)
+void radeon_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
__DRIcontext *driContext = radeon->dri.context;
- void (*old_viewport)(GLcontext *ctx, GLint x, GLint y,
+ void (*old_viewport)(struct gl_context *ctx, GLint x, GLint y,
GLsizei w, GLsizei h);
if (!driContext->driScreenPriv->dri2.enabled)
COMMIT_BATCH();
}
-static GLboolean radeon_revalidate_bos(GLcontext *ctx)
+static GLboolean radeon_revalidate_bos(struct gl_context *ctx)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
int ret;
}
-void radeonFlush(GLcontext *ctx)
+void radeonFlush(struct gl_context *ctx)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
if (RADEON_DEBUG & RADEON_IOCTL)
/* Make sure all commands have been sent to the hardware and have
* completed processing.
*/
-void radeonFinish(GLcontext * ctx)
+void radeonFinish(struct gl_context * ctx)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct gl_framebuffer *fb = ctx->DrawBuffer;
}
-void radeonUserClear(GLcontext *ctx, GLuint mask)
+void radeonUserClear(struct gl_context *ctx, GLuint mask)
{
_mesa_meta_Clear(ctx, mask);
}
#include "radeon_dma.h"
#include "radeon_texture.h"
-void radeonUserClear(GLcontext *ctx, GLuint mask);
+void radeonUserClear(struct gl_context *ctx, GLuint mask);
void radeonRecalcScissorRects(radeonContextPtr radeon);
void radeonSetCliprects(radeonContextPtr radeon);
-void radeonUpdateScissor( GLcontext *ctx );
-void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h);
+void radeonUpdateScissor( struct gl_context *ctx );
+void radeonScissor(struct gl_context* ctx, GLint x, GLint y, GLsizei w, GLsizei h);
void radeonWaitForIdleLocked(radeonContextPtr radeon);
extern uint32_t radeonGetAge(radeonContextPtr radeon);
void radeonUpdatePageFlipping(radeonContextPtr rmesa);
-void radeonFlush(GLcontext *ctx);
-void radeonFinish(GLcontext * ctx);
+void radeonFlush(struct gl_context *ctx);
+void radeonFinish(struct gl_context * ctx);
void radeonEmitState(radeonContextPtr radeon);
GLuint radeonCountStateEmitSize(radeonContextPtr radeon);
-void radeon_clear_tris(GLcontext *ctx, GLbitfield mask);
+void radeon_clear_tris(struct gl_context *ctx, GLbitfield mask);
void radeon_window_moved(radeonContextPtr radeon);
-void radeon_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb);
-void radeonDrawBuffer( GLcontext *ctx, GLenum mode );
-void radeonReadBuffer( GLcontext *ctx, GLenum mode );
-void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height);
+void radeon_draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb);
+void radeonDrawBuffer( struct gl_context *ctx, GLenum mode );
+void radeonReadBuffer( struct gl_context *ctx, GLenum mode );
+void radeon_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height);
void radeon_get_cliprects(radeonContextPtr radeon,
struct drm_clip_rect **cliprects,
unsigned int *num_cliprects,
radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv);
void
-radeonReadPixels(GLcontext * ctx,
+radeonReadPixels(struct gl_context * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack, GLvoid * pixels);
-void radeon_check_front_buffer_rendering(GLcontext *ctx);
+void radeon_check_front_buffer_rendering(struct gl_context *ctx);
static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb)
{
struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb;
/* Return various strings for glGetString().
*/
-static const GLubyte *radeonGetString(GLcontext * ctx, GLenum name)
+static const GLubyte *radeonGetString(struct gl_context * ctx, GLenum name)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
static char buffer[128];
*/
GLboolean radeonInitContext(radeonContextPtr radeon,
struct dd_function_table* functions,
- const __GLcontextModes * glVisual,
+ const struct gl_config * glVisual,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
- GLcontext* ctx;
- GLcontext* shareCtx;
+ struct gl_context* ctx;
+ struct gl_context* shareCtx;
int fthrottle_mode;
/* Fill in additional standard functions. */
__DRIcontext *driContext = radeon->dri.context;
__DRIdrawable *drawable;
__DRIscreen *screen;
+ struct radeon_framebuffer *draw;
screen = driContext->driScreenPriv;
if (!screen->dri2.loader)
if (drawable->lastStamp != drawable->dri2.stamp)
radeon_update_renderbuffers(driContext, drawable, GL_FALSE);
- /* Intel driver does the equivalent of this, no clue if it is needed:
- * radeon_draw_buffer(radeon->glCtx, &(drawable->driverPrivate)->base);
- */
+ /* Intel driver does the equivalent of this, no clue if it is needed:*/
+ draw = drawable->driverPrivate;
+ radeon_draw_buffer(radeon->glCtx, &draw->base);
+
driContext->dri2.draw_stamp = drawable->dri2.stamp;
}
GLuint *cmd; /* one or more cmd's */
GLuint *lastcmd; /* one or more cmd's */
GLboolean dirty; /* dirty-mark in emit_state_list */
- int (*check) (GLcontext *, struct radeon_state_atom *atom); /* is this state active? */
- void (*emit) (GLcontext *, struct radeon_state_atom *atom);
+ int (*check) (struct gl_context *, struct radeon_state_atom *atom); /* is this state active? */
+ void (*emit) (struct gl_context *, struct radeon_state_atom *atom);
};
struct radeon_hw_state {
* flush must be called before non-active vertex allocations can be
* performed.
*/
- void (*flush) (GLcontext *);
+ void (*flush) (struct gl_context *);
};
/* radeon_swtcl.c
};
struct radeon_context {
- GLcontext *glCtx;
+ struct gl_context *glCtx;
radeonScreenPtr radeonScreen; /* Screen private DRI data */
/* Texture object bookkeeping
struct {
void (*get_lock)(radeonContextPtr radeon);
- void (*update_viewport_offset)(GLcontext *ctx);
+ void (*update_viewport_offset)(struct gl_context *ctx);
void (*emit_cs_header)(struct radeon_cs *cs, radeonContextPtr rmesa);
- void (*swtcl_flush)(GLcontext *ctx, uint32_t offset);
+ void (*swtcl_flush)(struct gl_context *ctx, uint32_t offset);
void (*pre_emit_atoms)(radeonContextPtr rmesa);
void (*pre_emit_state)(radeonContextPtr rmesa);
- void (*fallback)(GLcontext *ctx, GLuint bit, GLboolean mode);
- void (*free_context)(GLcontext *ctx);
+ void (*fallback)(struct gl_context *ctx, GLuint bit, GLboolean mode);
+ void (*free_context)(struct gl_context *ctx);
void (*emit_query_finish)(radeonContextPtr radeon);
- void (*update_scissor)(GLcontext *ctx);
+ void (*update_scissor)(struct gl_context *ctx);
unsigned (*check_blit)(gl_format mesa_format);
- unsigned (*blit)(GLcontext *ctx,
+ unsigned (*blit)(struct gl_context *ctx,
struct radeon_bo *src_bo,
intptr_t src_offset,
gl_format src_mesaformat,
GLboolean radeonInitContext(radeonContextPtr radeon,
struct dd_function_table* functions,
- const __GLcontextModes * glVisual,
+ const struct gl_config * glVisual,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
radeon->hw.is_dirty = 1;
}
-static void r100_vtbl_free_context(GLcontext *ctx)
+static void r100_vtbl_free_context(struct gl_context *ctx)
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
_mesa_vector4f_free( &rmesa->tcl.ObjClean );
*/
GLboolean
r100CreateContext( gl_api api,
- const __GLcontextModes *glVisual,
+ const struct gl_config *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{
radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private);
struct dd_function_table functions;
r100ContextPtr rmesa;
- GLcontext *ctx;
+ struct gl_context *ctx;
int i;
int tcl_mode, fthrottle_mode;
#define RADEON_OLD_PACKETS 1
extern GLboolean r100CreateContext( gl_api api,
- const __GLcontextModes *glVisual,
+ const struct gl_config *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate);
}
}
-void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos,
+void rcommon_emit_vector(struct gl_context * ctx, struct radeon_aos *aos,
const GLvoid * data, int size, int stride, int count)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
/* Flush vertices in the current dma region.
*/
-void rcommon_flush_last_swtcl_prim( GLcontext *ctx )
+void rcommon_flush_last_swtcl_prim( struct gl_context *ctx )
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
struct radeon_dma *dma = &rmesa->dma;
return head;
}
-void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs )
+void radeonReleaseArrays( struct gl_context *ctx, GLuint newinputs )
{
radeonContextPtr radeon = RADEON_CONTEXT( ctx );
int i;
void radeonEmitVec12(uint32_t *out, const GLvoid * data, int stride, int count);
void radeonEmitVec16(uint32_t *out, const GLvoid * data, int stride, int count);
-void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos,
+void rcommon_emit_vector(struct gl_context * ctx, struct radeon_aos *aos,
const GLvoid * data, int size, int stride, int count);
void radeonReturnDmaRegion(radeonContextPtr rmesa, int return_bytes);
int bytes, int alignment);
void radeonReleaseDmaRegions(radeonContextPtr rmesa);
-void rcommon_flush_last_swtcl_prim(GLcontext *ctx);
+void rcommon_flush_last_swtcl_prim(struct gl_context *ctx);
void *rcommonAllocDmaLowVerts(radeonContextPtr rmesa, int nverts, int vsize);
void radeonFreeDmaRegions(radeonContextPtr rmesa);
-void radeonReleaseArrays( GLcontext *ctx, GLuint newinputs );
+void radeonReleaseArrays( struct gl_context *ctx, GLuint newinputs );
#endif
} while(0)
static struct gl_framebuffer *
-radeon_new_framebuffer(GLcontext *ctx, GLuint name)
+radeon_new_framebuffer(struct gl_context *ctx, GLuint name)
{
return _mesa_new_framebuffer(ctx, name);
}
}
static void *
-radeon_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb,
+radeon_get_pointer(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint x, GLint y)
{
radeon_print(RADEON_TEXTURE, RADEON_TRACE,
* storage for a user-created renderbuffer.
*/
static GLboolean
-radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
+radeon_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width, GLuint height)
{
* Not used for user-created renderbuffers!
*/
static GLboolean
-radeon_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
+radeon_alloc_window_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
ASSERT(rb->Name == 0);
static void
-radeon_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb,
+radeon_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint width, GLuint height)
{
struct radeon_framebuffer *radeon_fb = (struct radeon_framebuffer*)fb;
/** Dummy function for gl_renderbuffer::AllocStorage() */
static GLboolean
-radeon_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
+radeon_nop_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
_mesa_problem(ctx, "radeon_op_alloc_storage should never be called.");
}
static struct gl_renderbuffer *
-radeon_new_renderbuffer(GLcontext * ctx, GLuint name)
+radeon_new_renderbuffer(struct gl_context * ctx, GLuint name)
{
struct radeon_renderbuffer *rrb;
}
static void
-radeon_bind_framebuffer(GLcontext * ctx, GLenum target,
+radeon_bind_framebuffer(struct gl_context * ctx, GLenum target,
struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
{
radeon_print(RADEON_TEXTURE, RADEON_TRACE,
}
static void
-radeon_framebuffer_renderbuffer(GLcontext * ctx,
+radeon_framebuffer_renderbuffer(struct gl_context * ctx,
struct gl_framebuffer *fb,
GLenum attachment, struct gl_renderbuffer *rb)
{
}
static GLboolean
-radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb,
+radeon_update_wrapper(struct gl_context *ctx, struct radeon_renderbuffer *rrb,
struct gl_texture_image *texImage)
{
radeon_print(RADEON_TEXTURE, RADEON_TRACE,
static struct radeon_renderbuffer *
-radeon_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage)
+radeon_wrap_texture(struct gl_context * ctx, struct gl_texture_image *texImage)
{
const GLuint name = ~0; /* not significant, but distinct for debugging */
struct radeon_renderbuffer *rrb;
}
static void
-radeon_render_texture(GLcontext * ctx,
+radeon_render_texture(struct gl_context * ctx,
struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att)
{
}
static void
-radeon_finish_render_texture(GLcontext * ctx,
+radeon_finish_render_texture(struct gl_context * ctx,
struct gl_renderbuffer_attachment *att)
{
}
static void
-radeon_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
+radeon_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
gl_format mesa_format;
#include "main/glheader.h"
#include "main/imports.h"
#include "main/simple_list.h"
-#include "swrast/swrast.h"
#include "radeon_context.h"
#include "radeon_common.h"
#endif
}
-void radeonFlushElts( GLcontext *ctx )
+void radeonFlushElts( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
BATCH_LOCALS(&rmesa->radeon);
*/
#define RADEON_MAX_CLEARS 256
-static void radeonKernelClear(GLcontext *ctx, GLuint flags)
+static void radeonKernelClear(struct gl_context *ctx, GLuint flags)
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
UNLOCK_HARDWARE( &rmesa->radeon );
}
-static void radeonClear( GLcontext *ctx, GLbitfield mask )
+static void radeonClear( struct gl_context *ctx, GLbitfield mask )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
}
}
-void radeonInitIoctlFuncs( GLcontext *ctx )
+void radeonInitIoctlFuncs( struct gl_context *ctx )
{
ctx->Driver.Clear = radeonClear;
ctx->Driver.Finish = radeonFinish;
GLuint primitive,
GLuint vertex_nr );
-extern void radeonFlushElts( GLcontext *ctx );
+extern void radeonFlushElts( struct gl_context *ctx );
extern GLushort *radeonAllocEltsOpenEnded( r100ContextPtr rmesa,
extern void radeonFlushCmdBuf( r100ContextPtr rmesa, const char * );
-extern void radeonFlush( GLcontext *ctx );
-extern void radeonFinish( GLcontext *ctx );
-extern void radeonInitIoctlFuncs( GLcontext *ctx );
+extern void radeonFlush( struct gl_context *ctx );
+extern void radeonFinish( struct gl_context *ctx );
+extern void radeonInitIoctlFuncs( struct gl_context *ctx );
extern void radeonGetAllParams( r100ContextPtr rmesa );
extern void radeonSetUpAtomList( r100ContextPtr rmesa );
#include "radeon_context.h"
-extern void radeonEmitArrays( GLcontext *ctx, GLuint inputs );
+extern void radeonEmitArrays( struct gl_context *ctx, GLuint inputs );
#endif
#include "radeon_maos.h"
#include "radeon_tcl.h"
-static void emit_vecfog(GLcontext *ctx, struct radeon_aos *aos,
+static void emit_vecfog(struct gl_context *ctx, struct radeon_aos *aos,
GLvoid *data, int stride, int count)
{
int i;
-static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos,
+static void emit_tex_vector(struct gl_context *ctx, struct radeon_aos *aos,
GLvoid *data, int size, int stride, int count)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
/* Emit any changed arrays to new GART memory, re-emit a packet to
* update the arrays.
*/
-void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
+void radeonEmitArrays( struct gl_context *ctx, GLuint inputs )
{
r100ContextPtr rmesa = R100_CONTEXT( ctx );
struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
#define TCL_DEBUG 0
#endif
-static void TAG(emit)( GLcontext *ctx,
+static void TAG(emit)( struct gl_context *ctx,
GLuint start, GLuint end,
void *dest )
{
#include "math/m_translate.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
-#include "math/m_translate.h"
#include "radeon_context.h"
#include "radeon_state.h"
#include "radeon_ioctl.h"
union emit_union { float f; GLuint ui; radeon_color_t rgba; };
static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void * );
+ void (*emit)( struct gl_context *, GLuint, GLuint, void * );
GLuint vertex_size;
GLuint vertex_format;
} setup_tab[RADEON_TCL_MAX_SETUP];
}
-void radeonEmitArrays( GLcontext *ctx, GLuint inputs )
+void radeonEmitArrays( struct gl_context *ctx, GLuint inputs )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
* If individual images are stored in different mipmap trees
* use the mipmap tree that has the most of the correct data.
*/
-int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj)
+int radeon_validate_texture_miptree(struct gl_context * ctx, struct gl_texture_object *texObj)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeonTexObj *t = radeon_tex_obj(texObj);
}
static GLboolean
-do_blit_readpixels(GLcontext * ctx,
+do_blit_readpixels(struct gl_context * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
}
void
-radeonReadPixels(GLcontext * ctx,
+radeonReadPixels(struct gl_context * ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack, GLvoid * pixels)
#include <inttypes.h>
-static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q)
+static void radeonQueryGetResult(struct gl_context *ctx, struct gl_query_object *q)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_query_object *query = (struct radeon_query_object *)q;
radeon_bo_unmap(query->bo);
}
-static struct gl_query_object * radeonNewQueryObject(GLcontext *ctx, GLuint id)
+static struct gl_query_object * radeonNewQueryObject(struct gl_context *ctx, GLuint id)
{
struct radeon_query_object *query;
return &query->Base;
}
-static void radeonDeleteQuery(GLcontext *ctx, struct gl_query_object *q)
+static void radeonDeleteQuery(struct gl_context *ctx, struct gl_query_object *q)
{
struct radeon_query_object *query = (struct radeon_query_object *)q;
free(query);
}
-static void radeonWaitQuery(GLcontext *ctx, struct gl_query_object *q)
+static void radeonWaitQuery(struct gl_context *ctx, struct gl_query_object *q)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_query_object *query = (struct radeon_query_object *)q;
}
-static void radeonBeginQuery(GLcontext *ctx, struct gl_query_object *q)
+static void radeonBeginQuery(struct gl_context *ctx, struct gl_query_object *q)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_query_object *query = (struct radeon_query_object *)q;
radeon->hw.is_dirty = GL_TRUE;
}
-void radeonEmitQueryEnd(GLcontext *ctx)
+void radeonEmitQueryEnd(struct gl_context *ctx)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_query_object *query = radeon->query.current;
radeon->vtbl.emit_query_finish(radeon);
}
-static void radeonEndQuery(GLcontext *ctx, struct gl_query_object *q)
+static void radeonEndQuery(struct gl_context *ctx, struct gl_query_object *q)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
radeon->query.current = NULL;
}
-static void radeonCheckQuery(GLcontext *ctx, struct gl_query_object *q)
+static void radeonCheckQuery(struct gl_context *ctx, struct gl_query_object *q)
{
radeon_print(RADEON_STATE, RADEON_TRACE, "%s: query id %d\n", __FUNCTION__, q->Id);
functions->WaitQuery = radeonWaitQuery;
}
-int radeon_check_query_active(GLcontext *ctx, struct radeon_state_atom *atom)
+int radeon_check_query_active(struct gl_context *ctx, struct radeon_state_atom *atom)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
struct radeon_query_object *query = radeon->query.current;
return atom->cmd_size;
}
-void radeon_emit_queryobj(GLcontext *ctx, struct radeon_state_atom *atom)
+void radeon_emit_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom)
{
radeonContextPtr radeon = RADEON_CONTEXT(ctx);
BATCH_LOCALS(radeon);
#include "main/simple_list.h"
#include "radeon_common_context.h"
-extern void radeonEmitQueryBegin(GLcontext *ctx);
-extern void radeonEmitQueryEnd(GLcontext *ctx);
+extern void radeonEmitQueryBegin(struct gl_context *ctx);
+extern void radeonEmitQueryEnd(struct gl_context *ctx);
extern void radeonInitQueryObjFunctions(struct dd_function_table *functions);
#define RADEON_QUERY_PAGE_SIZE 4096
-int radeon_check_query_active(GLcontext *ctx, struct radeon_state_atom *atom);
-void radeon_emit_queryobj(GLcontext *ctx, struct radeon_state_atom *atom);
+int radeon_check_query_active(struct gl_context *ctx, struct radeon_state_atom *atom);
+void radeon_emit_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom);
static inline void radeon_init_query_stateobj(radeonContextPtr radeon, int SZ)
{
unsigned stencil_bits, GLboolean have_back_buffer )
{
__DRIconfig **configs;
- __GLcontextModes *m;
+ struct gl_config *m;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
int i;
static GLboolean
radeonCreateBuffer( __DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
GLboolean isPixmap )
{
radeonScreenPtr screen = (radeonScreenPtr) driScrnPriv->private;
if (!rfb)
return;
radeon_cleanup_renderbuffers(rfb);
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
+ _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
*
* \todo maybe fold this into intelInitDriver
*
- * \return the __GLcontextModes supported by this driver
+ * \return the struct gl_config supported by this driver
*/
static const __DRIconfig **
radeonInitScreen(__DRIscreen *psp)
* This is the driver specific part of the createNewScreen entry point.
* Called when using DRI2.
*
- * \return the __GLcontextModes supported by this driver
+ * \return the struct gl_config supported by this driver
*/
static const
__DRIconfig **radeonInitScreen2(__DRIscreen *psp)
}
static void
-radeon_map_unmap_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb,
+radeon_map_unmap_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLboolean map)
{
GLuint i, j;
radeon_check_front_buffer_rendering(ctx);
}
-static void radeonSpanRenderStart(GLcontext * ctx)
+static void radeonSpanRenderStart(struct gl_context * ctx)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
int i;
radeon_map_unmap_framebuffer(ctx, ctx->ReadBuffer, GL_TRUE);
}
-static void radeonSpanRenderFinish(GLcontext * ctx)
+static void radeonSpanRenderFinish(struct gl_context * ctx)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
int i;
}
}
-void radeonInitSpanFuncs(GLcontext * ctx)
+void radeonInitSpanFuncs(struct gl_context * ctx)
{
struct swrast_device_driver *swdd =
_swrast_GetDeviceDriverReference(ctx);
#ifndef __RADEON_SPAN_H__
#define __RADEON_SPAN_H__
-extern void radeonInitSpanFuncs(GLcontext * ctx);
+extern void radeonInitSpanFuncs(struct gl_context * ctx);
#endif
#include "radeon_tex.h"
#include "radeon_swtcl.h"
-static void radeonUpdateSpecular( GLcontext *ctx );
+static void radeonUpdateSpecular( struct gl_context *ctx );
/* =============================================================
* Alpha blending
*/
-static void radeonAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
+static void radeonAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
int pp_misc = rmesa->hw.ctx.cmd[CTX_PP_MISC];
rmesa->hw.ctx.cmd[CTX_PP_MISC] = pp_misc;
}
-static void radeonBlendEquationSeparate( GLcontext *ctx,
+static void radeonBlendEquationSeparate( struct gl_context *ctx,
GLenum modeRGB, GLenum modeA )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
}
}
-static void radeonBlendFuncSeparate( GLcontext *ctx,
+static void radeonBlendFuncSeparate( struct gl_context *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
{
* Depth testing
*/
-static void radeonDepthFunc( GLcontext *ctx, GLenum func )
+static void radeonDepthFunc( struct gl_context *ctx, GLenum func )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
}
-static void radeonDepthMask( GLcontext *ctx, GLboolean flag )
+static void radeonDepthMask( struct gl_context *ctx, GLboolean flag )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
RADEON_STATECHANGE( rmesa, ctx );
}
}
-static void radeonClearDepth( GLcontext *ctx, GLclampd d )
+static void radeonClearDepth( struct gl_context *ctx, GLclampd d )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLuint format = (rmesa->hw.ctx.cmd[CTX_RB3D_ZSTENCILCNTL] &
*/
-static void radeonFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
+static void radeonFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
union { int i; float f; } c, d;
* Culling
*/
-static void radeonCullFace( GLcontext *ctx, GLenum unused )
+static void radeonCullFace( struct gl_context *ctx, GLenum unused )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL];
}
}
-static void radeonFrontFace( GLcontext *ctx, GLenum mode )
+static void radeonFrontFace( struct gl_context *ctx, GLenum mode )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
/* =============================================================
* Line state
*/
-static void radeonLineWidth( GLcontext *ctx, GLfloat widthf )
+static void radeonLineWidth( struct gl_context *ctx, GLfloat widthf )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
}
}
-static void radeonLineStipple( GLcontext *ctx, GLint factor, GLushort pattern )
+static void radeonLineStipple( struct gl_context *ctx, GLint factor, GLushort pattern )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
/* =============================================================
* Masks
*/
-static void radeonColorMask( GLcontext *ctx,
+static void radeonColorMask( struct gl_context *ctx,
GLboolean r, GLboolean g,
GLboolean b, GLboolean a )
{
* Polygon state
*/
-static void radeonPolygonOffset( GLcontext *ctx,
+static void radeonPolygonOffset( struct gl_context *ctx,
GLfloat factor, GLfloat units )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = constant.ui32;
}
-static void radeonPolygonStipplePreKMS( GLcontext *ctx, const GLubyte *mask )
+static void radeonPolygonStipplePreKMS( struct gl_context *ctx, const GLubyte *mask )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLuint i;
UNLOCK_HARDWARE( &rmesa->radeon );
}
-static void radeonPolygonMode( GLcontext *ctx, GLenum face, GLenum mode )
+static void radeonPolygonMode( struct gl_context *ctx, GLenum face, GLenum mode )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0;
/* Examine lighting and texture state to determine if separate specular
* should be enabled.
*/
-static void radeonUpdateSpecular( GLcontext *ctx )
+static void radeonUpdateSpecular( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
uint32_t p = rmesa->hw.ctx.cmd[CTX_PP_CNTL];
/* Update on colormaterial, material emmissive/ambient,
* lightmodel.globalambient
*/
-static void update_global_ambient( GLcontext *ctx )
+static void update_global_ambient( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
float *fcmd = (float *)RADEON_DB_STATE( glt );
* - light[p].colors
* - light[p].enabled
*/
-static void update_light_colors( GLcontext *ctx, GLuint p )
+static void update_light_colors( struct gl_context *ctx, GLuint p )
{
struct gl_light *l = &ctx->Light.Light[p];
/* Also fallback for asym colormaterial mode in twoside lighting...
*/
-static void check_twoside_fallback( GLcontext *ctx )
+static void check_twoside_fallback( struct gl_context *ctx )
{
GLboolean fallback = GL_FALSE;
GLint i;
}
-static void radeonColorMaterial( GLcontext *ctx, GLenum face, GLenum mode )
+static void radeonColorMaterial( struct gl_context *ctx, GLenum face, GLenum mode )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLuint light_model_ctl1 = rmesa->hw.tcl.cmd[TCL_LIGHT_MODEL_CTL];
}
}
-void radeonUpdateMaterial( GLcontext *ctx )
+void radeonUpdateMaterial( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
* lighting space (model or eye), hence dependencies on _NEW_MODELVIEW
* and _MESA_NEW_NEED_EYE_COORDS.
*/
-static void update_light( GLcontext *ctx )
+static void update_light( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
}
}
-static void radeonLightfv( GLcontext *ctx, GLenum light,
+static void radeonLightfv( struct gl_context *ctx, GLenum light,
GLenum pname, const GLfloat *params )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
-static void radeonLightModelfv( GLcontext *ctx, GLenum pname,
+static void radeonLightModelfv( struct gl_context *ctx, GLenum pname,
const GLfloat *param )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
}
}
-static void radeonShadeModel( GLcontext *ctx, GLenum mode )
+static void radeonShadeModel( struct gl_context *ctx, GLenum mode )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLuint s = rmesa->hw.set.cmd[SET_SE_CNTL];
* User clip planes
*/
-static void radeonClipPlane( GLcontext *ctx, GLenum plane, const GLfloat *eq )
+static void radeonClipPlane( struct gl_context *ctx, GLenum plane, const GLfloat *eq )
{
GLint p = (GLint) plane - (GLint) GL_CLIP_PLANE0;
r100ContextPtr rmesa = R100_CONTEXT(ctx);
rmesa->hw.ucp[p].cmd[UCP_W] = ip[3];
}
-static void radeonUpdateClipPlanes( GLcontext *ctx )
+static void radeonUpdateClipPlanes( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLuint p;
*/
static void
-radeonStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func,
+radeonStencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func,
GLint ref, GLuint mask )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
}
static void
-radeonStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask )
+radeonStencilMaskSeparate( struct gl_context *ctx, GLenum face, GLuint mask )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
((ctx->Stencil.WriteMask[0] & 0xff) << RADEON_STENCIL_WRITEMASK_SHIFT);
}
-static void radeonStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum fail,
+static void radeonStencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum fail,
GLenum zfail, GLenum zpass )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
}
}
-static void radeonClearStencil( GLcontext *ctx, GLint s )
+static void radeonClearStencil( struct gl_context *ctx, GLint s )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
* Called when window size or position changes or viewport or depth range
* state is changed. We update the hardware viewport state here.
*/
-void radeonUpdateWindow( GLcontext *ctx )
+void radeonUpdateWindow( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
}
-static void radeonViewport( GLcontext *ctx, GLint x, GLint y,
+static void radeonViewport( struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height )
{
/* Don't pipeline viewport changes, conflict with window offset
radeon_viewport(ctx, x, y, width, height);
}
-static void radeonDepthRange( GLcontext *ctx, GLclampd nearval,
+static void radeonDepthRange( struct gl_context *ctx, GLclampd nearval,
GLclampd farval )
{
radeonUpdateWindow( ctx );
}
-void radeonUpdateViewportOffset( GLcontext *ctx )
+void radeonUpdateViewportOffset( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
* Miscellaneous
*/
-static void radeonClearColor( GLcontext *ctx, const GLfloat color[4] )
+static void radeonClearColor( struct gl_context *ctx, const GLfloat color[4] )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLubyte c[4];
}
-static void radeonRenderMode( GLcontext *ctx, GLenum mode )
+static void radeonRenderMode( struct gl_context *ctx, GLenum mode )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
FALLBACK( rmesa, RADEON_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
RADEON_ROP_SET,
};
-static void radeonLogicOpCode( GLcontext *ctx, GLenum opcode )
+static void radeonLogicOpCode( struct gl_context *ctx, GLenum opcode )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLuint rop = (GLuint)opcode - GL_CLEAR;
* State enable/disable
*/
-static void radeonEnable( GLcontext *ctx, GLenum cap, GLboolean state )
+static void radeonEnable( struct gl_context *ctx, GLenum cap, GLboolean state )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLuint p, flag;
}
-static void radeonLightingSpaceChange( GLcontext *ctx )
+static void radeonLightingSpaceChange( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLboolean tmp;
}
-static void update_texturematrix( GLcontext *ctx )
+static void update_texturematrix( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT( ctx );
GLuint tpc = rmesa->hw.tcl.cmd[TCL_TEXTURE_PROC_CTL];
}
}
-static GLboolean r100ValidateBuffers(GLcontext *ctx)
+static GLboolean r100ValidateBuffers(struct gl_context *ctx)
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
struct radeon_renderbuffer *rrb;
return GL_TRUE;
}
-GLboolean radeonValidateState( GLcontext *ctx )
+GLboolean radeonValidateState( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLuint new_state = rmesa->radeon.NewGLState;
}
-static void radeonInvalidateState( GLcontext *ctx, GLuint new_state )
+static void radeonInvalidateState( struct gl_context *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
/* A hack. Need a faster way to find this out.
*/
-static GLboolean check_material( GLcontext *ctx )
+static GLboolean check_material( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLint i;
}
-static void radeonWrapRunPipeline( GLcontext *ctx )
+static void radeonWrapRunPipeline( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLboolean has_material;
}
}
-static void radeonPolygonStipple( GLcontext *ctx, const GLubyte *mask )
+static void radeonPolygonStipple( struct gl_context *ctx, const GLubyte *mask )
{
r100ContextPtr r100 = R100_CONTEXT(ctx);
GLint i;
* Many of the ctx->Driver functions might have been initialized to
* software defaults in the earlier _mesa_init_driver_functions() call.
*/
-void radeonInitStateFuncs( GLcontext *ctx , GLboolean dri2 )
+void radeonInitStateFuncs( struct gl_context *ctx , GLboolean dri2 )
{
ctx->Driver.UpdateState = radeonInvalidateState;
ctx->Driver.LightingSpaceChange = radeonLightingSpaceChange;
#include "radeon_context.h"
extern void radeonInitState( r100ContextPtr rmesa );
-extern void radeonInitStateFuncs( GLcontext *ctx , GLboolean dri2);
+extern void radeonInitStateFuncs( struct gl_context *ctx , GLboolean dri2);
-extern void radeonUpdateMaterial( GLcontext *ctx );
+extern void radeonUpdateMaterial( struct gl_context *ctx );
-extern void radeonUpdateViewportOffset( GLcontext *ctx );
-extern void radeonUpdateWindow( GLcontext *ctx );
-extern void radeonUpdateDrawBuffer( GLcontext *ctx );
+extern void radeonUpdateViewportOffset( struct gl_context *ctx );
+extern void radeonUpdateWindow( struct gl_context *ctx );
+extern void radeonUpdateDrawBuffer( struct gl_context *ctx );
extern void radeonUploadTexMatrix( r100ContextPtr rmesa,
int unit, GLboolean swapcols );
-extern GLboolean radeonValidateState( GLcontext *ctx );
+extern GLboolean radeonValidateState( struct gl_context *ctx );
-extern void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
+extern void radeonFallback( struct gl_context *ctx, GLuint bit, GLboolean mode );
#define FALLBACK( rmesa, bit, mode ) do { \
if ( 0 ) fprintf( stderr, "FALLBACK in %s: #%d=%d\n", \
__FUNCTION__, bit, mode ); \
}
#define CHECK( NM, FLAG, ADD ) \
-static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \
+static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom ) \
{ \
return FLAG ? atom->cmd_size + (ADD) : 0; \
}
#define TCL_CHECK( NM, FLAG, ADD ) \
-static int check_##NM( GLcontext *ctx, struct radeon_state_atom *atom ) \
+static int check_##NM( struct gl_context *ctx, struct radeon_state_atom *atom ) \
{ \
r100ContextPtr rmesa = R100_CONTEXT(ctx); \
return (!rmesa->radeon.TclFallback && (FLAG)) ? atom->cmd_size + (ADD) : 0; \
OUT_BATCH_TABLE((data), h.scalars.count); \
} while(0)
-static void scl_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void scl_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r100ContextPtr r100 = R100_CONTEXT(ctx);
BATCH_LOCALS(&r100->radeon);
}
-static void vec_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void vec_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r100ContextPtr r100 = R100_CONTEXT(ctx);
BATCH_LOCALS(&r100->radeon);
}
-static void lit_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void lit_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r100ContextPtr r100 = R100_CONTEXT(ctx);
BATCH_LOCALS(&r100->radeon);
END_BATCH();
}
-static void ctx_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void ctx_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r100ContextPtr r100 = R100_CONTEXT(ctx);
BATCH_LOCALS(&r100->radeon);
END_BATCH();
}
-static int check_always_ctx( GLcontext *ctx, struct radeon_state_atom *atom)
+static int check_always_ctx( struct gl_context *ctx, struct radeon_state_atom *atom)
{
r100ContextPtr r100 = R100_CONTEXT(ctx);
struct radeon_renderbuffer *rrb, *drb;
return dwords;
}
-static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom)
+static void ctx_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r100ContextPtr r100 = R100_CONTEXT(ctx);
BATCH_LOCALS(&r100->radeon);
END_BATCH();
}
-static void cube_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void cube_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r100ContextPtr r100 = R100_CONTEXT(ctx);
BATCH_LOCALS(&r100->radeon);
END_BATCH();
}
-static void cube_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom)
+static void cube_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r100ContextPtr r100 = R100_CONTEXT(ctx);
BATCH_LOCALS(&r100->radeon);
END_BATCH();
}
-static void tex_emit(GLcontext *ctx, struct radeon_state_atom *atom)
+static void tex_emit(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r100ContextPtr r100 = R100_CONTEXT(ctx);
BATCH_LOCALS(&r100->radeon);
END_BATCH();
}
-static void tex_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom)
+static void tex_emit_cs(struct gl_context *ctx, struct radeon_state_atom *atom)
{
r100ContextPtr r100 = R100_CONTEXT(ctx);
BATCH_LOCALS(&r100->radeon);
*/
void radeonInitState( r100ContextPtr rmesa )
{
- GLcontext *ctx = rmesa->radeon.glCtx;
+ struct gl_context *ctx = rmesa->radeon.glCtx;
GLuint i;
rmesa->radeon.state.color.clear = 0x00000000;
{ RADEON_CP_VC_FRMT_ST2, RADEON_CP_VC_FRMT_ST2 | RADEON_CP_VC_FRMT_Q2 },
};
-static void radeonSetVertexFormat( GLcontext *ctx )
+static void radeonSetVertexFormat( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT( ctx );
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
}
-static void radeonRenderStart( GLcontext *ctx )
+static void radeonRenderStart( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT( ctx );
* determine in advance whether or not the hardware can / should do the
* projection divide or Mesa should do it.
*/
-void radeonChooseVertexState( GLcontext *ctx )
+void radeonChooseVertexState( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT( ctx );
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
}
-void r100_swtcl_flush(GLcontext *ctx, uint32_t current_offset)
+void r100_swtcl_flush(struct gl_context *ctx, uint32_t current_offset)
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
/**********************************************************************/
-static GLboolean radeon_run_render( GLcontext *ctx,
+static GLboolean radeon_run_render( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST
};
-static void radeonRasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void radeonRenderPrimitive( GLcontext *ctx, GLenum prim );
-static void radeonResetLineStipple( GLcontext *ctx );
+static void radeonRasterPrimitive( struct gl_context *ctx, GLuint hwprim );
+static void radeonRenderPrimitive( struct gl_context *ctx, GLenum prim );
+static void radeonResetLineStipple( struct gl_context *ctx );
/***********************************************************************
/* Choose render functions */
/**********************************************************************/
-void radeonChooseRenderState( GLcontext *ctx )
+void radeonChooseRenderState( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
r100ContextPtr rmesa = R100_CONTEXT(ctx);
/**********************************************************************/
-static void radeonRasterPrimitive( GLcontext *ctx, GLuint hwprim )
+static void radeonRasterPrimitive( struct gl_context *ctx, GLuint hwprim )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
}
}
-static void radeonRenderPrimitive( GLcontext *ctx, GLenum prim )
+static void radeonRenderPrimitive( struct gl_context *ctx, GLenum prim )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
rmesa->radeon.swtcl.render_primitive = prim;
radeonRasterPrimitive( ctx, reduced_hw_prim[prim] );
}
-static void radeonRenderFinish( GLcontext *ctx )
+static void radeonRenderFinish( struct gl_context *ctx )
{
}
-static void radeonResetLineStipple( GLcontext *ctx )
+static void radeonResetLineStipple( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
RADEON_STATECHANGE( rmesa, lin );
}
-void radeonFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
+void radeonFallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
/* Initialization. */
/**********************************************************************/
-void radeonInitSwtcl( GLcontext *ctx )
+void radeonInitSwtcl( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
r100ContextPtr rmesa = R100_CONTEXT(ctx);
#include "swrast/swrast.h"
#include "radeon_context.h"
-extern void radeonInitSwtcl( GLcontext *ctx );
+extern void radeonInitSwtcl( struct gl_context *ctx );
-extern void radeonChooseRenderState( GLcontext *ctx );
-extern void radeonChooseVertexState( GLcontext *ctx );
+extern void radeonChooseRenderState( struct gl_context *ctx );
+extern void radeonChooseVertexState( struct gl_context *ctx );
-extern void radeonCheckTexSizes( GLcontext *ctx );
+extern void radeonCheckTexSizes( struct gl_context *ctx );
-extern void radeonBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
+extern void radeonBuildVertices( struct gl_context *ctx, GLuint start, GLuint count,
GLuint newinputs );
extern void radeonPrintSetupFlags(char *msg, GLuint flags );
-extern void radeon_emit_indexed_verts( GLcontext *ctx,
+extern void radeon_emit_indexed_verts( struct gl_context *ctx,
GLuint start,
GLuint count );
-extern void radeon_translate_vertex( GLcontext *ctx,
+extern void radeon_translate_vertex( struct gl_context *ctx,
const radeonVertex *src,
SWvertex *dst );
-extern void radeon_print_vertex( GLcontext *ctx, const radeonVertex *v );
+extern void radeon_print_vertex( struct gl_context *ctx, const radeonVertex *v );
-extern void r100_swtcl_flush(GLcontext *ctx, uint32_t current_offset);
+extern void r100_swtcl_flush(struct gl_context *ctx, uint32_t current_offset);
#endif
* discrete and there are no intervening state changes. (Somewhat
* duplicates changes to DrawArrays code)
*/
-static void radeonEmitPrim( GLcontext *ctx,
+static void radeonEmitPrim( struct gl_context *ctx,
GLenum prim,
GLuint hwprim,
GLuint start,
/* External entrypoints */
/**********************************************************************/
-void radeonEmitPrimitive( GLcontext *ctx,
+void radeonEmitPrimitive( struct gl_context *ctx,
GLuint first,
GLuint last,
GLuint flags )
tcl_render_tab_verts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
}
-void radeonEmitEltPrimitive( GLcontext *ctx,
+void radeonEmitEltPrimitive( struct gl_context *ctx,
GLuint first,
GLuint last,
GLuint flags )
tcl_render_tab_elts[flags&PRIM_MODE_MASK]( ctx, first, last, flags );
}
-void radeonTclPrimitive( GLcontext *ctx,
+void radeonTclPrimitive( struct gl_context *ctx,
GLenum prim,
int hw_prim )
{
* Fog blend factors are in the range [0,1].
*/
float
-radeonComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord )
+radeonComputeFogBlendFactor( struct gl_context *ctx, GLfloat fogcoord )
{
GLfloat end = ctx->Fog.End;
GLfloat d, temp;
* Predict total emit size for next rendering operation so there is no flush in middle of rendering
* Prediction has to aim towards the best possible value that is worse than worst case scenario
*/
-static GLuint radeonEnsureEmitSize( GLcontext * ctx , GLuint inputs )
+static GLuint radeonEnsureEmitSize( struct gl_context * ctx , GLuint inputs )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
/* TCL render.
*/
-static GLboolean radeon_run_tcl_render( GLcontext *ctx,
+static GLboolean radeon_run_tcl_render( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
*/
-static void transition_to_swtnl( GLcontext *ctx )
+static void transition_to_swtnl( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
-static void transition_to_hwtnl( GLcontext *ctx )
+static void transition_to_hwtnl( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
-void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
+void radeonTclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLuint oldfallback = rmesa->radeon.TclFallback;
#include "radeon_context.h"
-extern void radeonTclPrimitive( GLcontext *ctx, GLenum prim, int hw_prim );
-extern void radeonEmitEltPrimitive( GLcontext *ctx, GLuint first, GLuint last,
+extern void radeonTclPrimitive( struct gl_context *ctx, GLenum prim, int hw_prim );
+extern void radeonEmitEltPrimitive( struct gl_context *ctx, GLuint first, GLuint last,
GLuint flags );
-extern void radeonEmitPrimitive( GLcontext *ctx, GLuint first, GLuint last,
+extern void radeonEmitPrimitive( struct gl_context *ctx, GLuint first, GLuint last,
GLuint flags );
-extern void radeonTclFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
+extern void radeonTclFallback( struct gl_context *ctx, GLuint bit, GLboolean mode );
extern void radeonInitStaticFogData( void );
-extern float radeonComputeFogBlendFactor( GLcontext *ctx, GLfloat fogcoord );
+extern float radeonComputeFogBlendFactor( struct gl_context *ctx, GLfloat fogcoord );
#define RADEON_TCL_FALLBACK_RASTER 0x1 /* rasterization */
#define RADEON_TCL_FALLBACK_UNFILLED 0x2 /* unfilled tris */
#define SCALED_FLOAT_TO_BYTE( x, scale ) \
(((GLuint)((255.0F / scale) * (x))) / 2)
-static void radeonTexEnv( GLcontext *ctx, GLenum target,
+static void radeonTexEnv( struct gl_context *ctx, GLenum target,
GLenum pname, const GLfloat *param )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
* next UpdateTextureState
*/
-static void radeonTexParameter( GLcontext *ctx, GLenum target,
+static void radeonTexParameter( struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat *params )
{
}
}
-static void radeonDeleteTexture( GLcontext *ctx,
+static void radeonDeleteTexture( struct gl_context *ctx,
struct gl_texture_object *texObj )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
* Basically impossible to do this on the fly - just collect some
* basic info & do the checks from ValidateState().
*/
-static void radeonTexGen( GLcontext *ctx,
+static void radeonTexGen( struct gl_context *ctx,
GLenum coord,
GLenum pname,
const GLfloat *params )
* texture object from the core mesa gl_texture_object. Not done at this time.
*/
static struct gl_texture_object *
-radeonNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
+radeonNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
radeonTexObj* t = CALLOC_STRUCT(radeon_tex_obj);
extern void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format,
__DRIdrawable *dPriv);
-extern void radeonUpdateTextureState( GLcontext *ctx );
+extern void radeonUpdateTextureState( struct gl_context *ctx );
extern int radeonUploadTexImages( r100ContextPtr rmesa, radeonTexObjPtr t,
GLuint face );
#include "radeon_mipmap_tree.h"
static GLboolean
-do_copy_texsubimage(GLcontext *ctx,
+do_copy_texsubimage(struct gl_context *ctx,
GLenum target, GLint level,
struct radeon_tex_obj *tobj,
radeon_texture_image *timg,
}
void
-radeonCopyTexImage2D(GLcontext *ctx, GLenum target, GLint level,
+radeonCopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y, GLsizei width, GLsizei height,
GLint border)
}
void
-radeonCopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
+radeonCopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y,
GLsizei width, GLsizei height)
* then unmap it.
*/
static void
-radeon_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
+radeon_get_tex_image(struct gl_context * ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid * pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage, int compressed)
}
void
-radeonGetTexImage(GLcontext * ctx, GLenum target, GLint level,
+radeonGetTexImage(struct gl_context * ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid * pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
}
void
-radeonGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
+radeonGetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level,
GLvoid *pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
* Texture unit state management
*/
-static GLboolean radeonUpdateTextureEnv( GLcontext *ctx, int unit )
+static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
/* Returns GL_FALSE if fallback required.
*/
-static GLboolean radeon_validate_texgen( GLcontext *ctx, GLuint unit )
+static GLboolean radeon_validate_texgen( struct gl_context *ctx, GLuint unit )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
return GL_TRUE;
}
-static GLboolean radeon_validate_texture(GLcontext *ctx, struct gl_texture_object *texObj, int unit)
+static GLboolean radeon_validate_texture(struct gl_context *ctx, struct gl_texture_object *texObj, int unit)
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
radeonTexObj *t = radeon_tex_obj(texObj);
return !t->border_fallback;
}
-static GLboolean radeonUpdateTextureUnit( GLcontext *ctx, int unit )
+static GLboolean radeonUpdateTextureUnit( struct gl_context *ctx, int unit )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
return GL_TRUE;
}
-void radeonUpdateTextureState( GLcontext *ctx )
+void radeonUpdateTextureState( struct gl_context *ctx )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLboolean ok;
/**
* Allocate an empty texture image object.
*/
-struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx)
+struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx)
{
return CALLOC(sizeof(radeon_texture_image));
}
/**
* Free memory associated with this texture image.
*/
-void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage)
+void radeonFreeTexImageData(struct gl_context *ctx, struct gl_texture_image *timage)
{
radeon_texture_image* image = get_radeon_texture_image(timage);
}
}
-static void map_override(GLcontext *ctx, radeonTexObj *t)
+static void map_override(struct gl_context *ctx, radeonTexObj *t)
{
radeon_texture_image *img = get_radeon_texture_image(t->base.Image[0][0]);
img->base.Data = t->bo->ptr;
}
-static void unmap_override(GLcontext *ctx, radeonTexObj *t)
+static void unmap_override(struct gl_context *ctx, radeonTexObj *t)
{
radeon_texture_image *img = get_radeon_texture_image(t->base.Image[0][0]);
/**
* Map a validated texture for reading during software rendering.
*/
-void radeonMapTexture(GLcontext *ctx, struct gl_texture_object *texObj)
+void radeonMapTexture(struct gl_context *ctx, struct gl_texture_object *texObj)
{
radeonTexObj* t = radeon_tex_obj(texObj);
int face, level;
}
}
-void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj)
+void radeonUnmapTexture(struct gl_context *ctx, struct gl_texture_object *texObj)
{
radeonTexObj* t = radeon_tex_obj(texObj);
int face, level;
* This relies on internal details of _mesa_generate_mipmap, in particular
* the fact that the memory for recreated texture images is always freed.
*/
-static void radeon_generate_mipmap(GLcontext *ctx, GLenum target,
+static void radeon_generate_mipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj)
{
radeonTexObj* t = radeon_tex_obj(texObj);
}
-void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj)
+void radeonGenerateMipmap(struct gl_context* ctx, GLenum target, struct gl_texture_object *texObj)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
struct radeon_bo *bo;
return _dri_texformat_argb8888;
}
-gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx,
+gl_format radeonChooseTextureFormat_mesa(struct gl_context * ctx,
GLint internalFormat,
GLenum format,
GLenum type)
type, 0);
}
-gl_format radeonChooseTextureFormat(GLcontext * ctx,
+gl_format radeonChooseTextureFormat(struct gl_context * ctx,
GLint internalFormat,
GLenum format,
GLenum type, GLboolean fbo)
"%s Failed to allocate miptree.\n", __func__);
}
-static GLuint * allocate_image_offsets(GLcontext *ctx,
+static GLuint * allocate_image_offsets(struct gl_context *ctx,
unsigned alignedWidth,
unsigned height,
unsigned depth)
/**
* Update a subregion of the given texture image.
*/
-static void radeon_store_teximage(GLcontext* ctx, int dims,
+static void radeon_store_teximage(struct gl_context* ctx, int dims,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLsizei imageSize,
* All glTexImage calls go through this function.
*/
static void radeon_teximage(
- GLcontext *ctx, int dims,
+ struct gl_context *ctx, int dims,
GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth,
_mesa_unmap_teximage_pbo(ctx, packing);
}
-void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level,
+void radeonTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid * pixels,
0, format, type, pixels, packing, texObj, texImage, 0);
}
-void radeonTexImage2D(GLcontext * ctx, GLenum target, GLint level,
+void radeonTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid * pixels,
0, format, type, pixels, packing, texObj, texImage, 0);
}
-void radeonCompressedTexImage2D(GLcontext * ctx, GLenum target,
+void radeonCompressedTexImage2D(struct gl_context * ctx, GLenum target,
GLint level, GLint internalFormat,
GLint width, GLint height, GLint border,
GLsizei imageSize, const GLvoid * data,
imageSize, 0, 0, data, &ctx->Unpack, texObj, texImage, 1);
}
-void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level,
+void radeonTexImage3D(struct gl_context * ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth,
GLint border,
/**
* All glTexSubImage calls go through this function.
*/
-static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int level,
+static void radeon_texsubimage(struct gl_context* ctx, int dims, GLenum target, int level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLsizei imageSize,
_mesa_unmap_teximage_pbo(ctx, packing);
}
-void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
+void radeonTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset,
GLsizei width,
GLenum format, GLenum type,
format, type, pixels, packing, texObj, texImage, 0);
}
-void radeonTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
+void radeonTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
0);
}
-void radeonCompressedTexSubImage2D(GLcontext * ctx, GLenum target,
+void radeonCompressedTexSubImage2D(struct gl_context * ctx, GLenum target,
GLint level, GLint xoffset,
GLint yoffset, GLsizei width,
GLsizei height, GLenum format,
}
-void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level,
+void radeonTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type,
void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride,
GLuint numrows, GLuint rowsize);
-struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx);
-void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage);
+struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx);
+void radeonFreeTexImageData(struct gl_context *ctx, struct gl_texture_image *timage);
void radeon_teximage_map(radeon_texture_image *image, GLboolean write_enable);
void radeon_teximage_unmap(radeon_texture_image *image);
-void radeonMapTexture(GLcontext *ctx, struct gl_texture_object *texObj);
-void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj);
-void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj);
-int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj);
+void radeonMapTexture(struct gl_context *ctx, struct gl_texture_object *texObj);
+void radeonUnmapTexture(struct gl_context *ctx, struct gl_texture_object *texObj);
+void radeonGenerateMipmap(struct gl_context* ctx, GLenum target, struct gl_texture_object *texObj);
+int radeon_validate_texture_miptree(struct gl_context * ctx, struct gl_texture_object *texObj);
-gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx,
+gl_format radeonChooseTextureFormat_mesa(struct gl_context * ctx,
GLint internalFormat,
GLenum format,
GLenum type);
-gl_format radeonChooseTextureFormat(GLcontext * ctx,
+gl_format radeonChooseTextureFormat(struct gl_context * ctx,
GLint internalFormat,
GLenum format,
GLenum type, GLboolean fbo);
-void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level,
+void radeonTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid * pixels,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
-void radeonTexImage2D(GLcontext * ctx, GLenum target, GLint level,
+void radeonTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid * pixels,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
-void radeonCompressedTexImage2D(GLcontext * ctx, GLenum target,
+void radeonCompressedTexImage2D(struct gl_context * ctx, GLenum target,
GLint level, GLint internalFormat,
GLint width, GLint height, GLint border,
GLsizei imageSize, const GLvoid * data,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
-void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level,
+void radeonTexImage3D(struct gl_context * ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth,
GLint border,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
-void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
+void radeonTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset,
GLsizei width,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
-void radeonTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
+void radeonTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *packing,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
-void radeonCompressedTexSubImage2D(GLcontext * ctx, GLenum target,
+void radeonCompressedTexSubImage2D(struct gl_context * ctx, GLenum target,
GLint level, GLint xoffset,
GLint yoffset, GLsizei width,
GLsizei height, GLenum format,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
-void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level,
+void radeonTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
-void radeonGetTexImage(GLcontext * ctx, GLenum target, GLint level,
+void radeonGetTexImage(struct gl_context * ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid * pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
-void radeonGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
+void radeonGetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level,
GLvoid *pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
-void radeonCopyTexImage2D(GLcontext *ctx, GLenum target, GLint level,
+void radeonCopyTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y, GLsizei width, GLsizei height,
GLint border);
-void radeonCopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
+void radeonCopyTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y,
GLsizei width, GLsizei height);
#include <stdio.h>
#include "main/context.h"
-#include "main/context.h"
-#include "main/matrix.h"
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
#include "main/simple_list.h"
static GLboolean
savageCreateContext( gl_api api,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{
- GLcontext *ctx, *shareCtx;
+ struct gl_context *ctx, *shareCtx;
savageContextPtr imesa;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
struct dd_function_table functions;
static GLboolean
savageCreateBuffer( __DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
GLboolean isPixmap)
{
savageScreenPrivate *screen = (savageScreenPrivate *) driScrnPriv->private;
static void
savageDestroyBuffer(__DRIdrawable *driDrawPriv)
{
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
+ _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
#if 0
savageContextPtr imesa
= (savageContextPtr) driContextPriv->driverPrivate;
struct gl_framebuffer *drawBuffer
- = (GLframebuffer *) driDrawPriv->driverPrivate;
+ = (struct gl_framebuffer *) driDrawPriv->driverPrivate;
struct gl_framebuffer *readBuffer
- = (GLframebuffer *) driReadPriv->driverPrivate;
+ = (struct gl_framebuffer *) driReadPriv->driverPrivate;
driRenderbuffer *frontRb = (driRenderbuffer *)
drawBuffer->Attachment[BUFFER_FRONT_LEFT].Renderbuffer;
driRenderbuffer *backRb = (driRenderbuffer *)
unsigned stencil_bits, GLboolean have_back_buffer )
{
__DRIconfig **configs;
- __GLcontextModes * m;
+ struct gl_config * m;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
GLenum fb_format;
*
* \todo maybe fold this into intelInitDriver
*
- * \return the __GLcontextModes supported by this driver
+ * \return the struct gl_config supported by this driver
*/
static const __DRIconfig **
savageInitScreen(__DRIscreen *psp)
struct savage_context_t {
GLint refcount;
- GLcontext *glCtx;
+ struct gl_context *glCtx;
int lastTexHeap;
driTexHeap *textureHeaps[SAVAGE_NR_TEX_HEAPS];
/* DRI stuff */
GLuint bufferSize;
- GLframebuffer *glBuffer;
+ struct gl_framebuffer *glBuffer;
/* Two flags to keep track of fallbacks. */
GLuint Fallback;
***************************************/
-static const GLubyte *savageDDGetString( GLcontext *ctx, GLenum name )
+static const GLubyte *savageDDGetString( struct gl_context *ctx, GLenum name )
{
static char *cardNames[S3_LAST] = {
"Unknown",
}
}
#if 0
-static GLint savageGetParameteri(const GLcontext *ctx, GLint param)
+static GLint savageGetParameteri(const struct gl_context *ctx, GLint param)
{
switch (param) {
case DD_HAVE_HARDWARE_FOG:
#endif
-void savageDDInitDriverFuncs( GLcontext *ctx )
+void savageDDInitDriverFuncs( struct gl_context *ctx )
{
ctx->Driver.GetString = savageDDGetString;
}
#include "main/context.h"
-void savageDDInitDriverFuncs( GLcontext *ctx );
+void savageDDInitDriverFuncs( struct gl_context *ctx );
#endif
#if 0
/* Still keeping this around because it demonstrates page flipping and
* automatic z-clear. */
-static void savage_BCI_clear(GLcontext *ctx, drm_savage_clear_t *pclear)
+static void savage_BCI_clear(struct gl_context *ctx, drm_savage_clear_t *pclear)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
int nbox = imesa->sarea->nbox;
}
-static void savageDDClear( GLcontext *ctx, GLbitfield mask )
+static void savageDDClear( struct gl_context *ctx, GLbitfield mask )
{
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
GLuint colorMask, depthMask, clearColor, clearDepth, flags;
}
-static void savageDDFlush( GLcontext *ctx )
+static void savageDDFlush( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG)
savageFlushCmdBuf(imesa, GL_FALSE);
}
-static void savageDDFinish( GLcontext *ctx )
+static void savageDDFinish( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG)
WAIT_IDLE_EMPTY(imesa);
}
-void savageDDInitIoctlFuncs( GLcontext *ctx )
+void savageDDInitIoctlFuncs( struct gl_context *ctx )
{
ctx->Driver.Clear = savageDDClear;
ctx->Driver.Flush = savageDDFlush;
void savageFlushCmdBufLocked( savageContextPtr imesa, GLboolean discard );
void savageFlushCmdBuf( savageContextPtr imesa, GLboolean discard );
-void savageDDInitIoctlFuncs( GLcontext *ctx );
+void savageDDInitIoctlFuncs( struct gl_context *ctx );
void savageSwapBuffers( __DRIdrawable *dPriv );
/* Render pipeline stage */
/**********************************************************************/
-static GLboolean savage_run_render( GLcontext *ctx,
+static GLboolean savage_run_render( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
#define TEXNORM_STAGE_DATA(stage) ((struct texnorm_stage_data *)stage->privatePtr)
-static GLboolean run_texnorm_stage( GLcontext *ctx,
+static GLboolean run_texnorm_stage( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
struct texnorm_stage_data *store = TEXNORM_STAGE_DATA(stage);
/* Called the first time stage->run() is invoked.
*/
-static GLboolean alloc_texnorm_data( GLcontext *ctx,
+static GLboolean alloc_texnorm_data( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
return GL_TRUE;
}
-static void validate_texnorm( GLcontext *ctx,
+static void validate_texnorm( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
struct texnorm_stage_data *store = TEXNORM_STAGE_DATA(stage);
* the frame buffer.
*/
static void
-savageCopyPixels( GLcontext *ctx,
+savageCopyPixels( struct gl_context *ctx,
GLint srcx, GLint srcy, GLsizei width, GLsizei height,
GLint destx, GLint desty,
GLenum type )
_swrast_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type);
}
static void
-savageDrawPixels( GLcontext *ctx,
+savageDrawPixels( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
_swrast_DrawPixels(ctx, x, y, width, height, format, type, packing, pixels);
}
static void
-savageReadPixels( GLcontext *ctx,
+savageReadPixels( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *packing,
/*
* Make sure the hardware is idle when span-rendering.
*/
-static void savageSpanRenderStart( GLcontext *ctx )
+static void savageSpanRenderStart( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
FLUSH_BATCH(imesa);
}
-void savageDDInitSpanFuncs( GLcontext *ctx )
+void savageDDInitSpanFuncs( struct gl_context *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
swdd->SpanRenderStart = savageSpanRenderStart;
* Plug in the Get/Put routines for the given driRenderbuffer.
*/
void
-savageSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis,
+savageSetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis,
GLboolean float_depth)
{
if (drb->Base.Format == MESA_FORMAT_RGB565) {
#include "drirenderbuffer.h"
-extern void savageDDInitSpanFuncs( GLcontext *ctx );
+extern void savageDDInitSpanFuncs( struct gl_context *ctx );
extern void
-savageSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis,
+savageSetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis,
GLboolean float_depth);
#define S3D_TR 15
-static void savageBlendFunc_s4(GLcontext *);
-static void savageBlendFunc_s3d(GLcontext *);
+static void savageBlendFunc_s4(struct gl_context *);
+static void savageBlendFunc_s3d(struct gl_context *);
static INLINE GLuint savagePackColor(GLuint format,
GLubyte r, GLubyte g,
}
-static void savageDDAlphaFunc_s4(GLcontext *ctx, GLenum func, GLfloat ref)
+static void savageDDAlphaFunc_s4(struct gl_context *ctx, GLenum func, GLfloat ref)
{
savageBlendFunc_s4(ctx);
}
-static void savageDDAlphaFunc_s3d(GLcontext *ctx, GLenum func, GLfloat ref)
+static void savageDDAlphaFunc_s3d(struct gl_context *ctx, GLenum func, GLfloat ref)
{
savageBlendFunc_s3d(ctx);
}
-static void savageDDBlendEquationSeparate(GLcontext *ctx,
+static void savageDDBlendEquationSeparate(struct gl_context *ctx,
GLenum modeRGB, GLenum modeA)
{
assert( modeRGB == modeA );
}
-static void savageBlendFunc_s4(GLcontext *ctx)
+static void savageBlendFunc_s4(struct gl_context *ctx)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
uint32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui;
drawCtrl1 != imesa->regs.s4.drawCtrl1.ui)
imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
}
-static void savageBlendFunc_s3d(GLcontext *ctx)
+static void savageBlendFunc_s3d(struct gl_context *ctx)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
uint32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui;
imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
}
-static void savageDDBlendFuncSeparate_s4( GLcontext *ctx, GLenum sfactorRGB,
+static void savageDDBlendFuncSeparate_s4( struct gl_context *ctx, GLenum sfactorRGB,
GLenum dfactorRGB, GLenum sfactorA,
GLenum dfactorA )
{
assert (dfactorRGB == dfactorA && sfactorRGB == sfactorA);
savageBlendFunc_s4( ctx );
}
-static void savageDDBlendFuncSeparate_s3d( GLcontext *ctx, GLenum sfactorRGB,
+static void savageDDBlendFuncSeparate_s3d( struct gl_context *ctx, GLenum sfactorRGB,
GLenum dfactorRGB, GLenum sfactorA,
GLenum dfactorA )
{
-static void savageDDDepthFunc_s4(GLcontext *ctx, GLenum func)
+static void savageDDDepthFunc_s4(struct gl_context *ctx, GLenum func)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
ZCmpFunc zmode;
zWatermarks != imesa->regs.s4.zWatermarks.ui)
imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
}
-static void savageDDDepthFunc_s3d(GLcontext *ctx, GLenum func)
+static void savageDDDepthFunc_s3d(struct gl_context *ctx, GLenum func)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
ZCmpFunc zmode;
imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
}
-static void savageDDDepthMask_s4(GLcontext *ctx, GLboolean flag)
+static void savageDDDepthMask_s4(struct gl_context *ctx, GLboolean flag)
{
savageDDDepthFunc_s4(ctx,ctx->Depth.Func);
}
-static void savageDDDepthMask_s3d(GLcontext *ctx, GLboolean flag)
+static void savageDDDepthMask_s3d(struct gl_context *ctx, GLboolean flag)
{
savageDDDepthFunc_s3d(ctx,ctx->Depth.Func);
}
*/
-static void savageDDScissor( GLcontext *ctx, GLint x, GLint y,
+static void savageDDScissor( struct gl_context *ctx, GLint x, GLint y,
GLsizei w, GLsizei h )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
-static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode )
+static void savageDDDrawBuffer(struct gl_context *ctx, GLenum mode )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
uint32_t destCtrl = imesa->regs.s4.destCtrl.ui;
imesa->dirty |= SAVAGE_UPLOAD_GLOBAL;
}
-static void savageDDReadBuffer(GLcontext *ctx, GLenum mode )
+static void savageDDReadBuffer(struct gl_context *ctx, GLenum mode )
{
/* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */
}
#if 0
-static void savageDDSetColor(GLcontext *ctx,
+static void savageDDSetColor(struct gl_context *ctx,
GLubyte r, GLubyte g,
GLubyte b, GLubyte a )
{
* Window position and viewport transformation
*/
-void savageCalcViewport( GLcontext *ctx )
+void savageCalcViewport( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
const GLfloat *v = ctx->Viewport._WindowMap.m;
imesa->SetupNewInputs = ~0;
}
-static void savageViewport( GLcontext *ctx,
+static void savageViewport( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height )
{
savageCalcViewport( ctx );
}
-static void savageDepthRange( GLcontext *ctx,
+static void savageDepthRange( struct gl_context *ctx,
GLclampd nearval, GLclampd farval )
{
savageCalcViewport( ctx );
* Miscellaneous
*/
-static void savageDDClearColor(GLcontext *ctx,
+static void savageDDClearColor(struct gl_context *ctx,
const GLfloat color[4] )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
/* Fallback to swrast for select and feedback.
*/
-static void savageRenderMode( GLcontext *ctx, GLenum mode )
+static void savageRenderMode( struct gl_context *ctx, GLenum mode )
{
FALLBACK( ctx, SAVAGE_FALLBACK_RENDERMODE, (mode != GL_RENDER) );
}
* Culling - the savage isn't quite as clean here as the rest of
* its interfaces, but it's not bad.
*/
-static void savageDDCullFaceFrontFace(GLcontext *ctx, GLenum unused)
+static void savageDDCullFaceFrontFace(struct gl_context *ctx, GLenum unused)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
GLuint cullMode=imesa->LcsCullMode;
}
#endif /* end #if HW_CULL */
-static void savageUpdateCull( GLcontext *ctx )
+static void savageUpdateCull( struct gl_context *ctx )
{
#if HW_CULL
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
* to have any effect. If only some channels are masked we need a
* software fallback on all chips.
*/
-static void savageDDColorMask_s4(GLcontext *ctx,
+static void savageDDColorMask_s4(struct gl_context *ctx,
GLboolean r, GLboolean g,
GLboolean b, GLboolean a )
{
imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
}
}
-static void savageDDColorMask_s3d(GLcontext *ctx,
+static void savageDDColorMask_s3d(struct gl_context *ctx,
GLboolean r, GLboolean g,
GLboolean b, GLboolean a )
{
FALLBACK (ctx, SAVAGE_FALLBACK_COLORMASK, !(r && g && b));
}
-static void savageUpdateSpecular_s4(GLcontext *ctx) {
+static void savageUpdateSpecular_s4(struct gl_context *ctx) {
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
uint32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui;
imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
}
-static void savageUpdateSpecular_s3d(GLcontext *ctx) {
+static void savageUpdateSpecular_s3d(struct gl_context *ctx) {
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
uint32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui;
imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
}
-static void savageDDLightModelfv_s4(GLcontext *ctx, GLenum pname,
+static void savageDDLightModelfv_s4(struct gl_context *ctx, GLenum pname,
const GLfloat *param)
{
savageUpdateSpecular_s4 (ctx);
}
-static void savageDDLightModelfv_s3d(GLcontext *ctx, GLenum pname,
+static void savageDDLightModelfv_s3d(struct gl_context *ctx, GLenum pname,
const GLfloat *param)
{
savageUpdateSpecular_s3d (ctx);
}
-static void savageDDShadeModel_s4(GLcontext *ctx, GLuint mod)
+static void savageDDShadeModel_s4(struct gl_context *ctx, GLuint mod)
{
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
uint32_t drawLocalCtrl = imesa->regs.s4.drawLocalCtrl.ui;
if (drawLocalCtrl != imesa->regs.s4.drawLocalCtrl.ui)
imesa->dirty |= SAVAGE_UPLOAD_LOCAL;
}
-static void savageDDShadeModel_s3d(GLcontext *ctx, GLuint mod)
+static void savageDDShadeModel_s3d(struct gl_context *ctx, GLuint mod)
{
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
uint32_t drawCtrl = imesa->regs.s3d.drawCtrl.ui;
* on savage3d and savage4. No need for two separate functions.
*/
-static void savageDDFogfv(GLcontext *ctx, GLenum pname, const GLfloat *param)
+static void savageDDFogfv(struct gl_context *ctx, GLenum pname, const GLfloat *param)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
GLuint fogClr;
static void
-savageDDStencilFuncSeparate(GLcontext *ctx, GLenum face, GLenum func,
+savageDDStencilFuncSeparate(struct gl_context *ctx, GLenum face, GLenum func,
GLint ref, GLuint mask)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
}
static void
-savageDDStencilMaskSeparate(GLcontext *ctx, GLenum face, GLuint mask)
+savageDDStencilMaskSeparate(struct gl_context *ctx, GLenum face, GLuint mask)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
}
static void
-savageDDStencilOpSeparate(GLcontext *ctx, GLenum face, GLenum fail,
+savageDDStencilOpSeparate(struct gl_context *ctx, GLenum face, GLenum fail,
GLenum zfail, GLenum zpass)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
/* =============================================================
*/
-static void savageDDEnable_s4(GLcontext *ctx, GLenum cap, GLboolean state)
+static void savageDDEnable_s4(struct gl_context *ctx, GLenum cap, GLboolean state)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
;
}
}
-static void savageDDEnable_s3d(GLcontext *ctx, GLenum cap, GLboolean state)
+static void savageDDEnable_s3d(struct gl_context *ctx, GLenum cap, GLboolean state)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
}
}
-void savageDDUpdateHwState( GLcontext *ctx )
+void savageDDUpdateHwState( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
NEW_TEXTURE_MATRIX|\
NEW_USER_CLIP|NEW_CLIENT_STATE))
-static void savageDDInvalidateState( GLcontext *ctx, GLuint new_state )
+static void savageDDInvalidateState( struct gl_context *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
}
-void savageDDInitStateFuncs(GLcontext *ctx)
+void savageDDInitStateFuncs(struct gl_context *ctx)
{
ctx->Driver.UpdateState = savageDDInvalidateState;
ctx->Driver.BlendEquationSeparate = savageDDBlendEquationSeparate;
#include "savagecontext.h"
-void savageCalcViewport( GLcontext *ctx );
+void savageCalcViewport( struct gl_context *ctx );
void savageEmitOldState( savageContextPtr imesa );
void savageEmitChangedState( savageContextPtr imesa );
-extern void savageDDUpdateHwState( GLcontext *ctx );
+extern void savageDDUpdateHwState( struct gl_context *ctx );
extern void savageDDInitState( savageContextPtr imesa );
-extern void savageDDInitStateFuncs( GLcontext *ctx );
-extern void savageDDRenderStart(GLcontext *ctx);
-extern void savageDDRenderEnd(GLcontext *ctx);
+extern void savageDDInitStateFuncs( struct gl_context *ctx );
+extern void savageDDRenderStart(struct gl_context *ctx);
+extern void savageDDRenderEnd(struct gl_context *ctx);
#endif
/* Called by the _mesa_store_teximage[123]d() functions. */
static gl_format
-savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
+savageChooseTextureFormat( struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
}
-static void savageUpdateTex0State_s4( GLcontext *ctx )
+static void savageUpdateTex0State_s4( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
struct gl_texture_object *tObj;
return;
}
-static void savageUpdateTex1State_s4( GLcontext *ctx )
+static void savageUpdateTex1State_s4( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
struct gl_texture_object *tObj;
if(t->base.heap->heapId == SAVAGE_AGP_HEAP)
imesa->regs.s4.texAddr[1].ui |= 0x1;
}
-static void savageUpdateTexState_s3d( GLcontext *ctx )
+static void savageUpdateTexState_s3d( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
struct gl_texture_object *tObj;
}
-static void savageUpdateTextureState_s4( GLcontext *ctx )
+static void savageUpdateTextureState_s4( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
imesa->dirty |= (SAVAGE_UPLOAD_TEX0 |
SAVAGE_UPLOAD_TEX1);
}
-static void savageUpdateTextureState_s3d( GLcontext *ctx )
+static void savageUpdateTextureState_s3d( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
savageUpdateTexState_s3d( ctx );
imesa->dirty |= (SAVAGE_UPLOAD_TEX0);
}
-void savageUpdateTextureState( GLcontext *ctx)
+void savageUpdateTextureState( struct gl_context *ctx)
{
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
FALLBACK (ctx, SAVAGE_FALLBACK_TEXTURE, GL_FALSE);
* DRIVER functions
*****************************************/
-static void savageTexEnv( GLcontext *ctx, GLenum target,
+static void savageTexEnv( struct gl_context *ctx, GLenum target,
GLenum pname, const GLfloat *param )
{
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
}
}
-static void savageTexImage1D( GLcontext *ctx, GLenum target, GLint level,
+static void savageTexImage1D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE;
}
-static void savageTexSubImage1D( GLcontext *ctx,
+static void savageTexSubImage1D( struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset,
SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE;
}
-static void savageTexImage2D( GLcontext *ctx, GLenum target, GLint level,
+static void savageTexImage2D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE;
}
-static void savageTexSubImage2D( GLcontext *ctx,
+static void savageTexSubImage2D( struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
}
static void
-savageCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
+savageCompressedTexImage2D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLsizei imageSize, const GLvoid *data,
}
static void
-savageCompressedTexSubImage2D( GLcontext *ctx,
+savageCompressedTexSubImage2D( struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
SAVAGE_CONTEXT(ctx)->new_state |= SAVAGE_NEW_TEXTURE;
}
-static void savageTexParameter( GLcontext *ctx, GLenum target,
+static void savageTexParameter( struct gl_context *ctx, GLenum target,
struct gl_texture_object *tObj,
GLenum pname, const GLfloat *params )
{
imesa->new_state |= SAVAGE_NEW_TEXTURE;
}
-static void savageBindTexture( GLcontext *ctx, GLenum target,
+static void savageBindTexture( struct gl_context *ctx, GLenum target,
struct gl_texture_object *tObj )
{
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
imesa->new_state |= SAVAGE_NEW_TEXTURE;
}
-static void savageDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )
+static void savageDeleteTexture( struct gl_context *ctx, struct gl_texture_object *tObj )
{
driTextureObject *t = (driTextureObject *)tObj->DriverData;
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
static struct gl_texture_object *
-savageNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
+savageNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target )
{
struct gl_texture_object *obj;
obj = _mesa_new_texture_object(ctx, name, target);
#define __HWParseTexEnvCombine(imesa, flag0, TexCtrl, TexBlendCtrl)
-void savageUpdateTextureState( GLcontext *ctx );
+void savageUpdateTextureState( struct gl_context *ctx );
void savageDDInitTextureFuncs( struct dd_function_table *functions );
void savageDestroyTexObj( savageContextPtr imesa, savageTexObjPtr t );
#include "savagetex.h"
#include "savageioctl.h"
-static void savageRasterPrimitive( GLcontext *ctx, GLuint prim );
-static void savageRenderPrimitive( GLcontext *ctx, GLenum prim );
+static void savageRasterPrimitive( struct gl_context *ctx, GLuint prim );
+static void savageRenderPrimitive( struct gl_context *ctx, GLenum prim );
static GLenum reduced_prim[GL_POLYGON+1] = {
savageVertexPtr v1,
savageVertexPtr v2 )
{
- GLcontext *ctx = imesa->glCtx;
+ struct gl_context *ctx = imesa->glCtx;
SWvertex v[3];
FLUSH_BATCH(imesa);
WAIT_IDLE_EMPTY(imesa);
savageVertexPtr v0,
savageVertexPtr v1 )
{
- GLcontext *ctx = imesa->glCtx;
+ struct gl_context *ctx = imesa->glCtx;
SWvertex v[2];
FLUSH_BATCH(imesa);
WAIT_IDLE_EMPTY(imesa);
savage_fallback_point( savageContextPtr imesa,
savageVertexPtr v0 )
{
- GLcontext *ctx = imesa->glCtx;
+ struct gl_context *ctx = imesa->glCtx;
SWvertex v[1];
FLUSH_BATCH(imesa);
WAIT_IDLE_EMPTY(imesa);
/* Render clipped primitives */
/**********************************************************************/
-static void savageRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
+static void savageRenderClippedPoly( struct gl_context *ctx, const GLuint *elts,
GLuint n )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
}
-static void savageRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
+static void savageRenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.Line( ctx, ii, jj );
}
/*
-static void savageFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
+static void savageFastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts,
GLuint n )
{
r128ContextPtr rmesa = R128_CONTEXT( ctx );
#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
-static void savageChooseRenderState(GLcontext *ctx)
+static void savageChooseRenderState(struct gl_context *ctx)
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
GLuint flags = ctx->_TriangleCaps;
/* Validate state at pipeline start */
/**********************************************************************/
-static void savageRunPipeline( GLcontext *ctx )
+static void savageRunPipeline( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
* primitives.
*/
-static void savageRasterPrimitive( GLcontext *ctx, GLuint prim )
+static void savageRasterPrimitive( struct gl_context *ctx, GLuint prim )
{
savageContextPtr imesa = SAVAGE_CONTEXT( ctx );
#endif
}
-static void savageRenderPrimitive( GLcontext *ctx, GLenum prim )
+static void savageRenderPrimitive( struct gl_context *ctx, GLenum prim )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
GLuint rprim = reduced_prim[prim];
* them. Fallback to swrast we can't. Returns GL_TRUE if projective
* texture coordinates must be faked, GL_FALSE otherwise.
*/
-static GLboolean savageCheckPTexHack( GLcontext *ctx )
+static GLboolean savageCheckPTexHack( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
#define SAVAGE_EMIT_ST1 0x0300
-static INLINE GLuint savageChooseVertexFormat_s3d( GLcontext *ctx )
+static INLINE GLuint savageChooseVertexFormat_s3d( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
-static INLINE GLuint savageChooseVertexFormat_s4( GLcontext *ctx )
+static INLINE GLuint savageChooseVertexFormat_s4( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
-static void savageRenderStart( GLcontext *ctx )
+static void savageRenderStart( struct gl_context *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
}
-static void savageRenderFinish( GLcontext *ctx )
+static void savageRenderFinish( struct gl_context *ctx )
{
/* Flush the last primitive now, before any state is changed. */
savageFlushVertices(SAVAGE_CONTEXT(ctx));
"Projective texture",
};
-void savageFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
+void savageFallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
/* Initialization. */
/**********************************************************************/
-void savageInitTriFuncs( GLcontext *ctx )
+void savageInitTriFuncs( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
static int firsttime = 1;
#include "main/mtypes.h"
-extern void savageInitTriFuncs( GLcontext *ctx );
+extern void savageInitTriFuncs( struct gl_context *ctx );
-extern void savageFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
+extern void savageFallback( struct gl_context *ctx, GLuint bit, GLboolean mode );
#define FALLBACK( ctx, bit, mode ) savageFallback( ctx, bit, mode )
#include "swrast/swrast.h"
#include "main/macros.h"
-static void sis_clear_front_buffer(GLcontext *ctx, GLenum mask, GLint x,
+static void sis_clear_front_buffer(struct gl_context *ctx, GLenum mask, GLint x,
GLint y, GLint width, GLint height);
-static void sis_clear_back_buffer(GLcontext *ctx, GLenum mask, GLint x,
+static void sis_clear_back_buffer(struct gl_context *ctx, GLenum mask, GLint x,
GLint y, GLint width, GLint height);
-static void sis_clear_z_buffer(GLcontext * ctx, GLbitfield mask, GLint x,
+static void sis_clear_z_buffer(struct gl_context * ctx, GLbitfield mask, GLint x,
GLint y, GLint width, GLint height );
static void
}
void
-sis6326DDClear(GLcontext *ctx, GLbitfield mask)
+sis6326DDClear(struct gl_context *ctx, GLbitfield mask)
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
GLint x1, y1, width1, height1;
void
-sis6326DDClearColor(GLcontext *ctx, const GLfloat color[4])
+sis6326DDClearColor(struct gl_context *ctx, const GLfloat color[4])
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
GLubyte c[4];
}
void
-sis6326DDClearDepth(GLcontext *ctx, GLclampd d)
+sis6326DDClearDepth(struct gl_context *ctx, GLclampd d)
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
static void
-sis_clear_back_buffer(GLcontext *ctx, GLenum mask, GLint x, GLint y,
+sis_clear_back_buffer(struct gl_context *ctx, GLenum mask, GLint x, GLint y,
GLint width, GLint height)
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
static void
-sis_clear_front_buffer(GLcontext *ctx, GLenum mask, GLint x, GLint y,
+sis_clear_front_buffer(struct gl_context *ctx, GLenum mask, GLint x, GLint y,
GLint width, GLint height)
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
static void
-sis_clear_z_buffer(GLcontext * ctx, GLbitfield mask, GLint x, GLint y,
+sis_clear_z_buffer(struct gl_context * ctx, GLbitfield mask, GLint x, GLint y,
GLint width, GLint height)
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
*/
static void
-sis6326DDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
+sis6326DDAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
GLubyte refbyte;
}
static void
-sis6326DDBlendFuncSeparate( GLcontext *ctx,
+sis6326DDBlendFuncSeparate( struct gl_context *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
{
*/
static void
-sis6326DDDepthFunc( GLcontext *ctx, GLenum func )
+sis6326DDDepthFunc( struct gl_context *ctx, GLenum func )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
__GLSiSHardware *prev = &smesa->prev;
}
static void
-sis6326DDDepthMask( GLcontext *ctx, GLboolean flag )
+sis6326DDDepthMask( struct gl_context *ctx, GLboolean flag )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
__GLSiSHardware *current = &smesa->current;
*/
static void
-sis6326DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
+sis6326DDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *params )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
__GLSiSHardware *current = &smesa->current;
*/
void
-sis6326UpdateClipping(GLcontext *ctx)
+sis6326UpdateClipping(struct gl_context *ctx)
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
static void
-sis6326DDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h )
+sis6326DDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h )
{
if (ctx->Scissor.Enabled)
sis6326UpdateClipping( ctx );
*/
static void
-sis6326UpdateCull( GLcontext *ctx )
+sis6326UpdateCull( struct gl_context *ctx )
{
/* XXX culling */
}
static void
-sis6326DDCullFace( GLcontext *ctx, GLenum mode )
+sis6326DDCullFace( struct gl_context *ctx, GLenum mode )
{
sis6326UpdateCull( ctx );
}
static void
-sis6326DDFrontFace( GLcontext *ctx, GLenum mode )
+sis6326DDFrontFace( struct gl_context *ctx, GLenum mode )
{
sis6326UpdateCull( ctx );
}
* Masks
*/
-static void sis6326DDColorMask( GLcontext *ctx,
+static void sis6326DDColorMask( struct gl_context *ctx,
GLboolean r, GLboolean g,
GLboolean b, GLboolean a )
{
* Rendering attributes
*/
-static void sis6326UpdateSpecular(GLcontext *ctx)
+static void sis6326UpdateSpecular(struct gl_context *ctx)
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
__GLSiSHardware *current = &smesa->current;
current->hwCapEnable &= ~S_ENABLE_Specular;
}
-static void sis6326DDLightModelfv(GLcontext *ctx, GLenum pname,
+static void sis6326DDLightModelfv(struct gl_context *ctx, GLenum pname,
const GLfloat *param)
{
if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
sis6326UpdateSpecular(ctx);
}
}
-static void sis6326DDShadeModel( GLcontext *ctx, GLenum mode )
+static void sis6326DDShadeModel( struct gl_context *ctx, GLenum mode )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
* Viewport
*/
-static void sis6326CalcViewport( GLcontext *ctx )
+static void sis6326CalcViewport( struct gl_context *ctx )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
const GLfloat *v = ctx->Viewport._WindowMap.m;
m[MAT_TZ] = v[MAT_TZ] * smesa->depth_scale;
}
-static void sis6326DDViewport( GLcontext *ctx,
+static void sis6326DDViewport( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height )
{
sis6326CalcViewport( ctx );
}
-static void sis6326DDDepthRange( GLcontext *ctx,
+static void sis6326DDDepthRange( struct gl_context *ctx,
GLclampd nearval, GLclampd farval )
{
sis6326CalcViewport( ctx );
*/
static void
-sis6326DDLogicOpCode( GLcontext *ctx, GLenum opcode )
+sis6326DDLogicOpCode( struct gl_context *ctx, GLenum opcode )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
}
-void sis6326DDDrawBuffer( GLcontext *ctx, GLenum mode )
+void sis6326DDDrawBuffer( struct gl_context *ctx, GLenum mode )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
*/
static void
-sis6326DDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
+sis6326DDEnable( struct gl_context *ctx, GLenum cap, GLboolean state )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
/* Called before beginning of rendering. */
void
-sis6326UpdateHWState( GLcontext *ctx )
+sis6326UpdateHWState( struct gl_context *ctx )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
__GLSiSHardware *prev = &smesa->prev;
}
static void
-sis6326DDInvalidateState( GLcontext *ctx, GLuint new_state )
+sis6326DDInvalidateState( struct gl_context *ctx, GLuint new_state )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
{
__GLSiSHardware *prev = &smesa->prev;
__GLSiSHardware *current = &smesa->current;
- GLcontext *ctx = smesa->glCtx;
+ struct gl_context *ctx = smesa->glCtx;
/* add Texture Perspective Enable */
current->hwCapEnable = S_ENABLE_TextureCache |
/* Initialize the driver's state functions.
*/
-void sis6326DDInitStateFuncs( GLcontext *ctx )
+void sis6326DDInitStateFuncs( struct gl_context *ctx )
{
ctx->Driver.UpdateState = sis6326DDInvalidateState;
#include "swrast/swrast.h"
#include "main/macros.h"
-static GLbitfield sis_3D_Clear( GLcontext * ctx, GLbitfield mask,
+static GLbitfield sis_3D_Clear( struct gl_context * ctx, GLbitfield mask,
GLint x, GLint y, GLint width,
GLint height );
-static void sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x,
+static void sis_clear_color_buffer( struct gl_context *ctx, GLenum mask, GLint x,
GLint y, GLint width, GLint height );
-static void sis_clear_z_stencil_buffer( GLcontext * ctx,
+static void sis_clear_z_stencil_buffer( struct gl_context * ctx,
GLbitfield mask, GLint x,
GLint y, GLint width,
GLint height );
}
void
-sisDDClear( GLcontext * ctx, GLbitfield mask )
+sisDDClear( struct gl_context * ctx, GLbitfield mask )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
void
-sisDDClearColor( GLcontext * ctx, const GLfloat color[4] )
+sisDDClearColor( struct gl_context * ctx, const GLfloat color[4] )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
GLubyte c[4];
}
void
-sisDDClearDepth( GLcontext * ctx, GLclampd d )
+sisDDClearDepth( struct gl_context * ctx, GLclampd d )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
void
-sisDDClearStencil( GLcontext * ctx, GLint s )
+sisDDClearStencil( struct gl_context * ctx, GLint s )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
static GLbitfield
-sis_3D_Clear( GLcontext * ctx, GLbitfield mask,
+sis_3D_Clear( struct gl_context * ctx, GLbitfield mask,
GLint x, GLint y, GLint width, GLint height )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
static void
-sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y,
+sis_clear_color_buffer( struct gl_context *ctx, GLenum mask, GLint x, GLint y,
GLint width, GLint height )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
static void
-sis_clear_z_stencil_buffer( GLcontext * ctx, GLbitfield mask,
+sis_clear_z_stencil_buffer( struct gl_context * ctx, GLbitfield mask,
GLint x, GLint y, GLint width, GLint height )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
}
-void sisReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer,
+void sisReAllocateBuffers(struct gl_context *ctx, struct gl_framebuffer *drawbuffer,
GLuint width, GLuint height)
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
GLboolean
sisCreateContext( gl_api api,
- const __GLcontextModes *glVisual,
+ const struct gl_config *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{
- GLcontext *ctx, *shareCtx;
+ struct gl_context *ctx, *shareCtx;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
sisContextPtr smesa;
sisScreenPtr sisScreen;
newSisCtx->driDrawable = driDrawPriv;
- drawBuffer = (GLframebuffer *)driDrawPriv->driverPrivate;
- readBuffer = (GLframebuffer *)driReadPriv->driverPrivate;
+ drawBuffer = (struct gl_framebuffer *)driDrawPriv->driverPrivate;
+ readBuffer = (struct gl_framebuffer *)driReadPriv->driverPrivate;
_mesa_make_current( newSisCtx->glCtx, drawBuffer, readBuffer );
struct sis_context
{
/* This must be first in this structure */
- GLcontext *glCtx;
+ struct gl_context *glCtx;
/* Vertex state */
GLuint vertex_size;
};
extern GLboolean sisCreateContext( gl_api api,
- const __GLcontextModes *glVisual,
+ const struct gl_config *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate );
extern void sisDestroyContext( __DRIcontext * );
-void sisReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer,
+void sisReAllocateBuffers(struct gl_context *ctx, struct gl_framebuffer *drawbuffer,
GLuint width, GLuint height);
extern GLboolean sisMakeCurrent( __DRIcontext *driContextPriv,
/* Return the width and height of the given buffer.
*/
static void
-sisGetBufferSize( GLframebuffer *buffer,
+sisGetBufferSize( struct gl_framebuffer *buffer,
GLuint *width, GLuint *height )
{
GET_CURRENT_CONTEXT(ctx);
/* Return various strings for glGetString().
*/
static const GLubyte *
-sisGetString( GLcontext *ctx, GLenum name )
+sisGetString( struct gl_context *ctx, GLenum name )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
static char buffer[128];
/* Send all commands to the hardware.
*/
static void
-sisFlush( GLcontext *ctx )
+sisFlush( struct gl_context *ctx )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
* completed processing.
*/
static void
-sisFinish( GLcontext *ctx )
+sisFinish( struct gl_context *ctx )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
static GLboolean
-sisRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb,
+sisRenderbufferStorage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
rb->Width = width;
static GLint doFPtoFixedNoRound( GLfloat dwInValue, int nFraction );
void
-sisDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
+sisDDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *params )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
__GLSiSHardware *prev = &smesa->prev;
static GLboolean
sisCreateBuffer( __DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
GLboolean isPixmap )
{
/*sisScreenPtr screen = (sisScreenPtr) driScrnPriv->private;*/
static void
sisDestroyBuffer(__DRIdrawable *driDrawPriv)
{
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
+ _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
static void sisCopyBuffer( __DRIdrawable *dPriv )
{
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
sisContextPtr smesa = (sisContextPtr) dPriv->driContextPriv->driverPrivate;
- GLcontext *ctx = smesa->glCtx;
+ struct gl_context *ctx = smesa->glCtx;
if (ctx->Visual.doubleBufferMode) {
_mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
*
* \todo maybe fold this into intelInitDriver
*
- * \return the __GLcontextModes supported by this driver
+ * \return the struct gl_config supported by this driver
*/
static const __DRIconfig **
sisInitScreen(__DRIscreen *psp)
-void sisSpanRenderStart( GLcontext *ctx )
+void sisSpanRenderStart( struct gl_context *ctx )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
WaitEngIdle( smesa );
}
-void sisSpanRenderFinish( GLcontext *ctx )
+void sisSpanRenderFinish( struct gl_context *ctx )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
void
-sisDDInitSpanFuncs( GLcontext *ctx )
+sisDDInitSpanFuncs( struct gl_context *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
swdd->SpanRenderStart = sisSpanRenderStart;
* Plug in the Get/Put routines for the given driRenderbuffer.
*/
void
-sisSetSpanFunctions(struct sis_renderbuffer *srb, const GLvisual *vis)
+sisSetSpanFunctions(struct sis_renderbuffer *srb, const struct gl_config *vis)
{
if (srb->Base.Format == MESA_FORMAT_RGB565) {
sisInitPointers_RGB565( &srb->Base );
#include "drirenderbuffer.h"
-extern void sisSpanRenderStart( GLcontext *ctx );
-extern void sisSpanRenderFinish( GLcontext *ctx );
+extern void sisSpanRenderStart( struct gl_context *ctx );
+extern void sisSpanRenderFinish( struct gl_context *ctx );
-extern void sisDDInitSpanFuncs( GLcontext *ctx );
+extern void sisDDInitSpanFuncs( struct gl_context *ctx );
extern void
-sisSetSpanFunctions(struct sis_renderbuffer *srb, const GLvisual *vis);
+sisSetSpanFunctions(struct sis_renderbuffer *srb, const struct gl_config *vis);
#endif
*/
static void
-sisDDAlphaFunc( GLcontext * ctx, GLenum func, GLfloat ref )
+sisDDAlphaFunc( struct gl_context * ctx, GLenum func, GLfloat ref )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
GLubyte refbyte;
}
static void
-sisDDBlendFuncSeparate( GLcontext *ctx,
+sisDDBlendFuncSeparate( struct gl_context *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
{
*/
static void
-sisDDDepthFunc( GLcontext * ctx, GLenum func )
+sisDDDepthFunc( struct gl_context * ctx, GLenum func )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
__GLSiSHardware *prev = &smesa->prev;
}
void
-sisDDDepthMask( GLcontext * ctx, GLboolean flag )
+sisDDDepthMask( struct gl_context * ctx, GLboolean flag )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
__GLSiSHardware *prev = &smesa->prev;
*/
void
-sisUpdateClipping( GLcontext *ctx )
+sisUpdateClipping( struct gl_context *ctx )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
static void
-sisDDScissor( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h )
+sisDDScissor( struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h )
{
if (ctx->Scissor.Enabled)
sisUpdateClipping( ctx );
*/
static void
-sisUpdateCull( GLcontext *ctx )
+sisUpdateCull( struct gl_context *ctx )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
GLint cullflag, frontface;
static void
-sisDDCullFace( GLcontext *ctx, GLenum mode )
+sisDDCullFace( struct gl_context *ctx, GLenum mode )
{
sisUpdateCull( ctx );
}
static void
-sisDDFrontFace( GLcontext *ctx, GLenum mode )
+sisDDFrontFace( struct gl_context *ctx, GLenum mode )
{
sisUpdateCull( ctx );
}
* Masks
*/
-static void sisDDColorMask( GLcontext *ctx,
+static void sisDDColorMask( struct gl_context *ctx,
GLboolean r, GLboolean g,
GLboolean b, GLboolean a )
{
* Rendering attributes
*/
-static void sisUpdateSpecular(GLcontext *ctx)
+static void sisUpdateSpecular(struct gl_context *ctx)
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
__GLSiSHardware *current = &smesa->current;
current->hwCapEnable &= ~MASK_SpecularEnable;
}
-static void sisDDLightModelfv(GLcontext *ctx, GLenum pname,
+static void sisDDLightModelfv(struct gl_context *ctx, GLenum pname,
const GLfloat *param)
{
if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
}
}
-static void sisDDShadeModel( GLcontext *ctx, GLenum mode )
+static void sisDDShadeModel( struct gl_context *ctx, GLenum mode )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
* Viewport
*/
-static void sisCalcViewport( GLcontext *ctx )
+static void sisCalcViewport( struct gl_context *ctx )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
const GLfloat *v = ctx->Viewport._WindowMap.m;
m[MAT_TZ] = v[MAT_TZ] * smesa->depth_scale;
}
-static void sisDDViewport( GLcontext *ctx,
+static void sisDDViewport( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height )
{
sisCalcViewport( ctx );
}
-static void sisDDDepthRange( GLcontext *ctx,
+static void sisDDDepthRange( struct gl_context *ctx,
GLclampd nearval, GLclampd farval )
{
sisCalcViewport( ctx );
*/
static void
-sisDDLogicOpCode( GLcontext *ctx, GLenum opcode )
+sisDDLogicOpCode( struct gl_context *ctx, GLenum opcode )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
}
-void sisDDDrawBuffer( GLcontext *ctx, GLenum mode )
+void sisDDDrawBuffer( struct gl_context *ctx, GLenum mode )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
__GLSiSHardware *prev = &smesa->prev;
*/
static void
-sisDDEnable( GLcontext * ctx, GLenum cap, GLboolean state )
+sisDDEnable( struct gl_context * ctx, GLenum cap, GLboolean state )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
/* Called before beginning of rendering. */
void
-sisUpdateHWState( GLcontext *ctx )
+sisUpdateHWState( struct gl_context *ctx )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
__GLSiSHardware *prev = &smesa->prev;
}
static void
-sisDDInvalidateState( GLcontext *ctx, GLuint new_state )
+sisDDInvalidateState( struct gl_context *ctx, GLuint new_state )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
{
__GLSiSHardware *current = &smesa->current;
__GLSiSHardware *prev = &(smesa->prev);
- GLcontext *ctx = smesa->glCtx;
+ struct gl_context *ctx = smesa->glCtx;
/* add Texture Perspective Enable */
prev->hwCapEnable = MASK_FogPerspectiveEnable | MASK_TextureCacheEnable |
/* Initialize the driver's state functions.
*/
-void sisDDInitStateFuncs( GLcontext *ctx )
+void sisDDInitStateFuncs( struct gl_context *ctx )
{
ctx->Driver.UpdateState = sisDDInvalidateState;
#include "sis_context.h"
/* sis6326_clear.c */
-extern void sis6326DDClear( GLcontext *ctx, GLbitfield mask );
-extern void sis6326DDClearColor( GLcontext * ctx, const GLfloat color[4] );
-extern void sis6326DDClearDepth( GLcontext * ctx, GLclampd d );
+extern void sis6326DDClear( struct gl_context *ctx, GLbitfield mask );
+extern void sis6326DDClearColor( struct gl_context * ctx, const GLfloat color[4] );
+extern void sis6326DDClearDepth( struct gl_context * ctx, GLclampd d );
extern void sis6326UpdateZPattern(sisContextPtr smesa, GLclampd z);
/* sis_clear.c */
-extern void sisDDClear( GLcontext *ctx, GLbitfield mask );
-extern void sisDDClearColor( GLcontext * ctx, const GLfloat color[4] );
-extern void sisDDClearDepth( GLcontext * ctx, GLclampd d );
-extern void sisDDClearStencil( GLcontext * ctx, GLint s );
+extern void sisDDClear( struct gl_context *ctx, GLbitfield mask );
+extern void sisDDClearColor( struct gl_context * ctx, const GLfloat color[4] );
+extern void sisDDClearDepth( struct gl_context * ctx, GLclampd d );
+extern void sisDDClearStencil( struct gl_context * ctx, GLint s );
extern void sisUpdateZStencilPattern( sisContextPtr smesa, GLclampd z,
int stencil );
/* sis_fog.c */
-extern void sisDDFogfv( GLcontext * ctx, GLenum pname, const GLfloat * params );
+extern void sisDDFogfv( struct gl_context * ctx, GLenum pname, const GLfloat * params );
/* sis6326_state.c */
extern void sis6326DDInitState( sisContextPtr smesa );
-extern void sis6326DDInitStateFuncs( GLcontext *ctx );
-extern void sis6326UpdateClipping( GLcontext * gc );
-extern void sis6326DDDrawBuffer( GLcontext *ctx, GLenum mode );
-extern void sis6326UpdateHWState( GLcontext *ctx );
+extern void sis6326DDInitStateFuncs( struct gl_context *ctx );
+extern void sis6326UpdateClipping( struct gl_context * gc );
+extern void sis6326DDDrawBuffer( struct gl_context *ctx, GLenum mode );
+extern void sis6326UpdateHWState( struct gl_context *ctx );
/* sis_state.c */
extern void sisDDInitState( sisContextPtr smesa );
-extern void sisDDInitStateFuncs( GLcontext *ctx );
-extern void sisDDDepthMask( GLcontext * ctx, GLboolean flag );
-extern void sisUpdateClipping( GLcontext * gc );
-extern void sisDDDrawBuffer( GLcontext *ctx, GLenum mode );
-extern void sisUpdateHWState( GLcontext *ctx );
+extern void sisDDInitStateFuncs( struct gl_context *ctx );
+extern void sisDDDepthMask( struct gl_context * ctx, GLboolean flag );
+extern void sisUpdateClipping( struct gl_context * gc );
+extern void sisDDDrawBuffer( struct gl_context *ctx, GLenum mode );
+extern void sisUpdateHWState( struct gl_context *ctx );
#endif
#include "sis_stencil.h"
static void
-sisDDStencilFuncSeparate( GLcontext * ctx, GLenum face,
+sisDDStencilFuncSeparate( struct gl_context * ctx, GLenum face,
GLenum func, GLint ref, GLuint mask )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
static void
-sisDDStencilMaskSeparate( GLcontext * ctx, GLenum face, GLuint mask )
+sisDDStencilMaskSeparate( struct gl_context * ctx, GLenum face, GLuint mask )
{
if (!ctx->Visual.stencilBits)
return;
}
static void
-sisDDStencilOpSeparate( GLcontext * ctx, GLenum face, GLenum fail,
+sisDDStencilOpSeparate( struct gl_context * ctx, GLenum face, GLenum fail,
GLenum zfail, GLenum zpass )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
void
-sisDDInitStencilFuncs( GLcontext *ctx )
+sisDDInitStencilFuncs( struct gl_context *ctx )
{
ctx->Driver.StencilFuncSeparate = sisDDStencilFuncSeparate;
ctx->Driver.StencilMaskSeparate = sisDDStencilMaskSeparate;
#ifndef __SIS_STENCIL_H__
#define __SIS_STENCIL_H__
-extern void sisDDInitStencilFuncs( GLcontext *ctx );
+extern void sisDDInitStencilFuncs( struct gl_context *ctx );
#endif
}
static void
-sisTexEnv( GLcontext *ctx, GLenum target, GLenum pname, const GLfloat *param )
+sisTexEnv( struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
static void
-sisTexParameter( GLcontext *ctx, GLenum target,
+sisTexParameter( struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj, GLenum pname,
const GLfloat *params )
{
}
static void
-sisBindTexture( GLcontext *ctx, GLenum target,
+sisBindTexture( struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
static void
-sisDeleteTexture( GLcontext * ctx, struct gl_texture_object *texObj )
+sisDeleteTexture( struct gl_context * ctx, struct gl_texture_object *texObj )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
sisTexObjPtr t;
_mesa_delete_texture_object(ctx, texObj);
}
-static GLboolean sisIsTextureResident( GLcontext * ctx,
+static GLboolean sisIsTextureResident( struct gl_context * ctx,
struct gl_texture_object *texObj )
{
return (texObj->DriverData != NULL);
}
static gl_format
-sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
+sisChooseTextureFormat( struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
}
-static void sisTexImage1D( GLcontext *ctx, GLenum target, GLint level,
+static void sisTexImage1D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
}
-static void sisTexSubImage1D( GLcontext *ctx,
+static void sisTexSubImage1D( struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset,
smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
}
-static void sisTexImage2D( GLcontext *ctx, GLenum target, GLint level,
+static void sisTexImage2D( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;
}
-static void sisTexSubImage2D( GLcontext *ctx,
+static void sisTexSubImage2D( struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
* texture object from the core mesa gl_texture_object. Not done at this time.
*/
static struct gl_texture_object *
-sisNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
+sisNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target )
{
struct gl_texture_object *obj;
obj = _mesa_new_texture_object(ctx, name, target);
#define __SIS_TEX_H__
extern void sisInitTextureFuncs( struct dd_function_table *table );
-extern void sisUpdateTextureState( GLcontext *ctx );
+extern void sisUpdateTextureState( struct gl_context *ctx );
#endif /* __SIS_TEX_H__ */
/* Handle texenv stuff, called from validate_texture (renderstart) */
static void
-sis_set_texture_env0( GLcontext *ctx, struct gl_texture_object *texObj,
+sis_set_texture_env0( struct gl_context *ctx, struct gl_texture_object *texObj,
int unit )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
/* Handle texenv stuff, called from validate_texture (renderstart) */
static void
-sis_set_texture_env1( GLcontext *ctx, struct gl_texture_object *texObj,
+sis_set_texture_env1( struct gl_context *ctx, struct gl_texture_object *texObj,
int unit)
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
/* Returns 0 if a software fallback is necessary */
static GLboolean
-sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj,
+sis_set_texobj_parm( struct gl_context *ctx, struct gl_texture_object *texObj,
int hw_unit )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
/* Disable a texture unit, called from validate_texture */
static void
-sis_reset_texture_env (GLcontext *ctx, int hw_unit)
+sis_reset_texture_env (struct gl_context *ctx, int hw_unit)
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
}
-static void updateTextureUnit( GLcontext *ctx, int unit )
+static void updateTextureUnit( struct gl_context *ctx, int unit )
{
sisContextPtr smesa = SIS_CONTEXT( ctx );
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
}
-void sisUpdateTextureState( GLcontext *ctx )
+void sisUpdateTextureState( struct gl_context *ctx )
{
sisContextPtr smesa = SIS_CONTEXT( ctx );
int i;
MASK_PsShadingFlatC
};
-static void sisRasterPrimitive( GLcontext *ctx, GLuint hwprim );
-static void sisRenderPrimitive( GLcontext *ctx, GLenum prim );
+static void sisRasterPrimitive( struct gl_context *ctx, GLuint hwprim );
+static void sisRenderPrimitive( struct gl_context *ctx, GLenum prim );
/***********************************************************************
* Emit primitives as inline vertices *
sisVertex *v1,
sisVertex *v2 )
{
- GLcontext *ctx = smesa->glCtx;
+ struct gl_context *ctx = smesa->glCtx;
SWvertex v[3];
_swsetup_Translate( ctx, v0, &v[0] );
_swsetup_Translate( ctx, v1, &v[1] );
sisVertex *v0,
sisVertex *v1 )
{
- GLcontext *ctx = smesa->glCtx;
+ struct gl_context *ctx = smesa->glCtx;
SWvertex v[2];
_swsetup_Translate( ctx, v0, &v[0] );
_swsetup_Translate( ctx, v1, &v[1] );
sis_fallback_point( sisContextPtr smesa,
sisVertex *v0 )
{
- GLcontext *ctx = smesa->glCtx;
+ struct gl_context *ctx = smesa->glCtx;
SWvertex v[1];
_swsetup_Translate( ctx, v0, &v[0] );
sisSpanRenderStart( ctx );
#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED)
#define _SIS_NEW_RENDER_STATE (ANY_RASTER_FLAGS | ANY_FALLBACK_FLAGS)
-static void sisChooseRenderState(GLcontext *ctx)
+static void sisChooseRenderState(struct gl_context *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
sisContextPtr smesa = SIS_CONTEXT( ctx );
/**********************************************************************/
/* Multipass rendering for front buffering */
/**********************************************************************/
-static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass )
+static GLboolean multipass_cliprect( struct gl_context *ctx, GLuint pass )
{
sisContextPtr smesa = SIS_CONTEXT( ctx );
/* Validate state at pipeline start */
/**********************************************************************/
-static void sisRunPipeline( GLcontext *ctx )
+static void sisRunPipeline( struct gl_context *ctx )
{
sisContextPtr smesa = SIS_CONTEXT( ctx );
* and lines, points and bitmaps.
*/
-static void sisRasterPrimitive( GLcontext *ctx, GLuint hwprim )
+static void sisRasterPrimitive( struct gl_context *ctx, GLuint hwprim )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
if (smesa->hw_primitive != hwprim) {
}
}
-static void sisRenderPrimitive( GLcontext *ctx, GLenum prim )
+static void sisRenderPrimitive( struct gl_context *ctx, GLenum prim )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
smesa->vertex_attr_count++; \
} while (0)
-static void sisRenderStart( GLcontext *ctx )
+static void sisRenderStart( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
sisContextPtr smesa = SIS_CONTEXT(ctx);
}
}
-static void sisRenderFinish( GLcontext *ctx )
+static void sisRenderFinish( struct gl_context *ctx )
{
}
return fallbackStrings[i];
}
-void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
+void sisFallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
sisContextPtr smesa = SIS_CONTEXT(ctx);
/* Initialization. */
/**********************************************************************/
-void sisInitTriFuncs( GLcontext *ctx )
+void sisInitTriFuncs( struct gl_context *ctx )
{
sisContextPtr smesa = SIS_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
#include "sis_lock.h"
#include "main/mtypes.h"
-extern void sisInitTriFuncs( GLcontext *ctx );
+extern void sisInitTriFuncs( struct gl_context *ctx );
extern void sisFlushPrims( sisContextPtr smesa );
extern void sisFlushPrimsLocked( sisContextPtr smesa );
-extern void sisFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
+extern void sisFallback( struct gl_context *ctx, GLuint bit, GLboolean mode );
#define FALLBACK( smesa, bit, mode ) sisFallback( smesa->glCtx, bit, mode )
*/
static GLuint
-choose_pixel_format(const GLvisual *v)
+choose_pixel_format(const struct gl_config *v)
{
int depth = v->rgbBits;
}
static GLboolean
-swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
+swrast_alloc_front_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
}
static GLboolean
-swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
+swrast_alloc_back_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb);
}
static struct swrast_renderbuffer *
-swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
+swrast_new_renderbuffer(const struct gl_config *visual, GLboolean front)
{
struct swrast_renderbuffer *xrb = calloc(1, sizeof *xrb);
GLuint pixel_format;
static GLboolean
dri_create_buffer(__DRIscreen * sPriv,
__DRIdrawable * dPriv,
- const __GLcontextModes * visual, GLboolean isPixmap)
+ const struct gl_config * visual, GLboolean isPixmap)
{
struct dri_drawable *drawable = NULL;
- GLframebuffer *fb;
+ struct gl_framebuffer *fb;
struct swrast_renderbuffer *frontrb, *backrb;
TRACE;
if (dPriv) {
struct dri_drawable *drawable = dri_drawable(dPriv);
- GLframebuffer *fb;
+ struct gl_framebuffer *fb;
free(drawable->row);
GET_CURRENT_CONTEXT(ctx);
struct dri_drawable *drawable = dri_drawable(dPriv);
- GLframebuffer *fb;
+ struct gl_framebuffer *fb;
struct swrast_renderbuffer *frontrb, *backrb;
TRACE;
*/
static void
-get_window_size( GLframebuffer *fb, GLsizei *w, GLsizei *h )
+get_window_size( struct gl_framebuffer *fb, GLsizei *w, GLsizei *h )
{
__DRIdrawable *dPriv = swrast_drawable(fb)->dPriv;
__DRIscreen *sPriv = dPriv->driScreenPriv;
}
static void
-swrast_check_and_update_window_size( GLcontext *ctx, GLframebuffer *fb )
+swrast_check_and_update_window_size( struct gl_context *ctx, struct gl_framebuffer *fb )
{
GLsizei width, height;
}
static const GLubyte *
-get_string(GLcontext *ctx, GLenum pname)
+get_string(struct gl_context *ctx, GLenum pname)
{
(void) ctx;
switch (pname) {
}
static void
-update_state( GLcontext *ctx, GLuint new_state )
+update_state( struct gl_context *ctx, GLuint new_state )
{
/* not much to do here - pass it on */
_swrast_InvalidateState( ctx, new_state );
}
static void
-viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
- GLframebuffer *draw = ctx->WinSysDrawBuffer;
- GLframebuffer *read = ctx->WinSysReadBuffer;
+ struct gl_framebuffer *draw = ctx->WinSysDrawBuffer;
+ struct gl_framebuffer *read = ctx->WinSysReadBuffer;
swrast_check_and_update_window_size(ctx, draw);
swrast_check_and_update_window_size(ctx, read);
}
-static gl_format swrastChooseTextureFormat(GLcontext * ctx,
+static gl_format swrastChooseTextureFormat(struct gl_context * ctx,
GLint internalFormat,
GLenum format,
GLenum type)
static GLboolean
dri_create_context(gl_api api,
- const __GLcontextModes * visual,
+ const struct gl_config * visual,
__DRIcontext * cPriv, void *sharedContextPrivate)
{
struct dri_context *ctx = NULL;
struct dri_context *share = (struct dri_context *)sharedContextPrivate;
- GLcontext *mesaCtx = NULL;
- GLcontext *sharedCtx = NULL;
+ struct gl_context *mesaCtx = NULL;
+ struct gl_context *sharedCtx = NULL;
struct dd_function_table functions;
TRACE;
if (cPriv) {
struct dri_context *ctx = dri_context(cPriv);
- GLcontext *mesaCtx;
+ struct gl_context *mesaCtx;
mesaCtx = &ctx->Base;
__DRIdrawable * driDrawPriv,
__DRIdrawable * driReadPriv)
{
- GLcontext *mesaCtx;
- GLframebuffer *mesaDraw;
- GLframebuffer *mesaRead;
+ struct gl_context *mesaCtx;
+ struct gl_framebuffer *mesaDraw;
+ struct gl_framebuffer *mesaRead;
TRACE;
if (cPriv) {
struct dri_context
{
/* mesa, base class, must be first */
- GLcontext Base;
+ struct gl_context Base;
/* dri */
__DRIcontext *cPriv;
}
static INLINE struct dri_context *
-swrast_context(GLcontext *ctx)
+swrast_context(struct gl_context *ctx)
{
return (struct dri_context *) ctx;
}
struct dri_drawable
{
/* mesa, base class, must be first */
- GLframebuffer Base;
+ struct gl_framebuffer Base;
/* dri */
__DRIdrawable *dPriv;
}
static INLINE struct dri_drawable *
-swrast_drawable(GLframebuffer *fb)
+swrast_drawable(struct gl_framebuffer *fb)
{
return (struct dri_drawable *) fb;
}
#define _SWRAST_SPANTEMP_ONCE
static INLINE void
-PUT_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLvoid *p )
+PUT_PIXEL( struct gl_context *glCtx, GLint x, GLint y, GLvoid *p )
{
__DRIcontext *ctx = swrast_context(glCtx)->cPriv;
__DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv;
static INLINE void
-GET_PIXEL( GLcontext *glCtx, GLint x, GLint y, GLubyte *p )
+GET_PIXEL( struct gl_context *glCtx, GLint x, GLint y, GLubyte *p )
{
__DRIcontext *ctx = swrast_context(glCtx)->cPriv;
__DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv;
}
static INLINE void
-PUT_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row )
+PUT_ROW( struct gl_context *glCtx, GLint x, GLint y, GLuint n, char *row )
{
__DRIcontext *ctx = swrast_context(glCtx)->cPriv;
__DRIdrawable *draw = swrast_drawable(glCtx->DrawBuffer)->dPriv;
}
static INLINE void
-GET_ROW( GLcontext *glCtx, GLint x, GLint y, GLuint n, char *row )
+GET_ROW( struct gl_context *glCtx, GLint x, GLint y, GLuint n, char *row )
{
__DRIcontext *ctx = swrast_context(glCtx)->cPriv;
__DRIdrawable *read = swrast_drawable(glCtx->ReadBuffer)->dPriv;
static void
-NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(get_row)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y, void *values )
{
#ifdef SPAN_VARS
static void
-NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(get_values)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[], void *values )
{
#ifdef SPAN_VARS
static void
-NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(put_row)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
const void *values, const GLubyte mask[] )
{
static void
-NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(put_row_rgb)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
const void *values, const GLubyte mask[] )
{
static void
-NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(put_mono_row)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
const void *value, const GLubyte mask[] )
{
static void
-NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(put_values)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
const void *values, const GLubyte mask[] )
{
static void
-NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(put_mono_values)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
const void *value, const GLubyte mask[] )
{
/*
* Enable/Disable the extensions for this context.
*/
-static void tdfxDDInitExtensions( GLcontext *ctx )
+static void tdfxDDInitExtensions( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
};
GLboolean tdfxCreateContext( gl_api api,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{
tdfxContextPtr fxMesa;
- GLcontext *ctx, *shareCtx;
+ struct gl_context *ctx, *shareCtx;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private;
TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) ((char *) sPriv->pSAREA +
if ( driContextPriv ) {
tdfxContextPtr newFx = (tdfxContextPtr) driContextPriv->driverPrivate;
- GLcontext *newCtx = newFx->glCtx;
+ struct gl_context *newCtx = newFx->glCtx;
GET_CURRENT_CONTEXT(curCtx);
if ((newFx->driDrawable != driDrawPriv)
* dispatch is set correctly.
*/
_mesa_make_current( newCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
+ (struct gl_framebuffer *) driDrawPriv->driverPrivate,
+ (struct gl_framebuffer *) driReadPriv->driverPrivate );
return GL_TRUE;
}
/* [dBorca] tunnel2 requires this */
}
_mesa_make_current( newCtx,
- (GLframebuffer *) driDrawPriv->driverPrivate,
- (GLframebuffer *) driReadPriv->driverPrivate );
+ (struct gl_framebuffer *) driDrawPriv->driverPrivate,
+ (struct gl_framebuffer *) driReadPriv->driverPrivate );
} else {
_mesa_make_current( NULL, NULL, NULL );
}
struct tdfx_context {
/* Set once and never changed:
*/
- GLcontext *glCtx; /* The core Mesa context */
+ struct gl_context *glCtx; /* The core Mesa context */
GLuint new_gl_state;
GLuint new_state;
extern GLboolean
tdfxCreateContext( gl_api api,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate );
tdfxInitGlide( tdfxContextPtr tmesa );
extern void
-FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4]);
+FX_grColorMaskv(struct gl_context *ctx, const GLboolean rgba[4]);
extern void
-FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4]);
+FX_grColorMaskv_NoLock(struct gl_context *ctx, const GLboolean rgba[4]);
/* Color packing utilities
* checks for this rather than doing a glGet(GL_MAX_TEXTURE_SIZE).
* Why?
*/
-static const GLubyte *tdfxDDGetString( GLcontext *ctx, GLenum name )
+static const GLubyte *tdfxDDGetString( struct gl_context *ctx, GLenum name )
{
tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
static void
-tdfxBeginQuery(GLcontext *ctx, struct gl_query_object *q)
+tdfxBeginQuery(struct gl_context *ctx, struct gl_query_object *q)
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
static void
-tdfxEndQuery(GLcontext *ctx, struct gl_query_object *q)
+tdfxEndQuery(struct gl_context *ctx, struct gl_query_object *q)
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
FxI32 total_pixels;
(vis->blueBits == b) && \
(vis->alphaBits == a))
-void tdfxDDInitDriverFuncs( const __GLcontextModes *visual,
+void tdfxDDInitDriverFuncs( const struct gl_config *visual,
struct dd_function_table *functions )
{
if ( MESA_VERBOSE & VERBOSE_DRIVER ) {
*/
void
-FX_grColorMaskv(GLcontext *ctx, const GLboolean rgba[4])
+FX_grColorMaskv(struct gl_context *ctx, const GLboolean rgba[4])
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
LOCK_HARDWARE(fxMesa);
}
void
-FX_grColorMaskv_NoLock(GLcontext *ctx, const GLboolean rgba[4])
+FX_grColorMaskv_NoLock(struct gl_context *ctx, const GLboolean rgba[4])
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
if (ctx->Visual.redBits == 8) {
#include "main/context.h"
-extern void tdfxDDInitDriverFuncs( const __GLcontextModes *visual,
+extern void tdfxDDInitDriverFuncs( const struct gl_config *visual,
struct dd_function_table *functions );
#endif
#if 0
GLboolean
-tdfx_bitmap_R5G6B5(GLcontext * ctx, GLint px, GLint py,
+tdfx_bitmap_R5G6B5(struct gl_context * ctx, GLint px, GLint py,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte * bitmap)
#if 0
GLboolean
-tdfx_bitmap_R8G8B8A8(GLcontext * ctx, GLint px, GLint py,
+tdfx_bitmap_R8G8B8A8(struct gl_context * ctx, GLint px, GLint py,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte * bitmap)
#endif
void
-tdfx_readpixels_R5G6B5(GLcontext * ctx, GLint x, GLint y,
+tdfx_readpixels_R5G6B5(struct gl_context * ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *packing,
}
void
-tdfx_readpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
+tdfx_readpixels_R8G8B8A8(struct gl_context * ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *packing,
}
void
-tdfx_drawpixels_R8G8B8A8(GLcontext * ctx, GLint x, GLint y,
+tdfx_drawpixels_R8G8B8A8(struct gl_context * ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
#include "main/context.h"
extern void
-tdfx_bitmap_R5G6B5( GLcontext *ctx, GLint px, GLint py,
+tdfx_bitmap_R5G6B5( struct gl_context *ctx, GLint px, GLint py,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap );
extern void
-tdfx_bitmap_R8G8B8A8( GLcontext *ctx, GLint px, GLint py,
+tdfx_bitmap_R8G8B8A8( struct gl_context *ctx, GLint px, GLint py,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap );
extern void
-tdfx_readpixels_R5G6B5( GLcontext *ctx, GLint x, GLint y,
+tdfx_readpixels_R5G6B5( struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *packing,
GLvoid *dstImage );
extern void
-tdfx_readpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y,
+tdfx_readpixels_R8G8B8A8( struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *packing,
GLvoid *dstImage );
extern void
-tdfx_drawpixels_R8G8B8A8( GLcontext *ctx, GLint x, GLint y,
+tdfx_drawpixels_R8G8B8A8( struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
/* Clear the color and/or depth buffers.
*/
-static void tdfxClear( GLcontext *ctx, GLbitfield mask )
+static void tdfxClear( struct gl_context *ctx, GLbitfield mask )
{
tdfxContextPtr fxMesa = (tdfxContextPtr) ctx->DriverCtx;
GLbitfield softwareMask = mask & (BUFFER_BIT_ACCUM);
-static void tdfxFinish( GLcontext *ctx )
+static void tdfxFinish( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
UNLOCK_HARDWARE( fxMesa );
}
-static void tdfxFlush( GLcontext *ctx )
+static void tdfxFlush( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
static void uploadTextureImages( tdfxContextPtr fxMesa )
{
- GLcontext *ctx = fxMesa->glCtx;
+ struct gl_context *ctx = fxMesa->glCtx;
int unit;
for (unit = 0; unit < TDFX_NUM_TMU; unit++) {
if (ctx->Texture.Unit[unit]._ReallyEnabled & (TEXTURE_1D_BIT|TEXTURE_2D_BIT)) {
static GLboolean
tdfxCreateBuffer( __DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
GLboolean isPixmap )
{
tdfxScreenPrivate *screen = (tdfxScreenPrivate *) driScrnPriv->private;
static void
tdfxDestroyBuffer(__DRIdrawable *driDrawPriv)
{
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
+ _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
{
GET_CURRENT_CONTEXT(ctx);
tdfxContextPtr fxMesa = 0;
- GLframebuffer *mesaBuffer;
+ struct gl_framebuffer *mesaBuffer;
if ( TDFX_DEBUG & DEBUG_VERBOSE_DRI ) {
fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *)driDrawPriv );
}
- mesaBuffer = (GLframebuffer *) driDrawPriv->driverPrivate;
+ mesaBuffer = (struct gl_framebuffer *) driDrawPriv->driverPrivate;
if ( !mesaBuffer->Visual.doubleBufferMode )
return; /* can't swap a single-buffered window */
*
* \todo maybe fold this into intelInitDriver
*
- * \return the __GLcontextModes supported by this driver
+ * \return the struct gl_config supported by this driver
*/
static const __DRIconfig **
tdfxInitScreen(__DRIscreen *psp)
static void
-tdfxDDWriteDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb,
+tdfxDDWriteDepthSpan(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, const void *values,
const GLubyte mask[])
{
}
static void
-tdfxDDWriteMonoDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb,
+tdfxDDWriteMonoDepthSpan(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, const void *value,
const GLubyte mask[])
{
static void
-tdfxDDReadDepthSpan(GLcontext * ctx, struct gl_renderbuffer *rb,
+tdfxDDReadDepthSpan(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, void *values)
{
GLuint *depth = (GLuint *) values;
static void
-tdfxDDWriteDepthPixels(GLcontext * ctx, struct gl_renderbuffer *rb,
+tdfxDDWriteDepthPixels(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
const void *values, const GLubyte mask[])
{
static void
-tdfxDDReadDepthPixels(GLcontext * ctx, struct gl_renderbuffer *rb, GLuint n,
+tdfxDDReadDepthPixels(struct gl_context * ctx, struct gl_renderbuffer *rb, GLuint n,
const GLint x[], const GLint y[], void *values)
{
GLuint *depth = (GLuint *) values;
#define BUILD_ZS(z, s) (((s) << 24) | (z))
static void
-write_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb,
+write_stencil_span(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *values, const GLubyte mask[])
{
static void
-write_mono_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb,
+write_mono_stencil_span(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const void *value, const GLubyte mask[])
{
static void
-read_stencil_span(GLcontext * ctx, struct gl_renderbuffer *rb,
+read_stencil_span(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
void *values)
{
static void
-write_stencil_pixels(GLcontext * ctx, struct gl_renderbuffer *rb,
+write_stencil_pixels(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
const void *values, const GLubyte mask[])
{
static void
-read_stencil_pixels(GLcontext * ctx, struct gl_renderbuffer *rb,
+read_stencil_pixels(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
void *values)
{
/**********************************************************************/
-static void tdfxSpanRenderStart( GLcontext *ctx )
+static void tdfxSpanRenderStart( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
LOCK_HARDWARE(fxMesa);
}
-static void tdfxSpanRenderFinish( GLcontext *ctx )
+static void tdfxSpanRenderFinish( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
_swrast_flush( ctx );
/* Initialize swrast device driver */
/**********************************************************************/
-void tdfxDDInitSpanFuncs( GLcontext *ctx )
+void tdfxDDInitSpanFuncs( struct gl_context *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
swdd->SpanRenderStart = tdfxSpanRenderStart;
* Plug in the Get/Put routines for the given driRenderbuffer.
*/
void
-tdfxSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
+tdfxSetSpanFunctions(driRenderbuffer *drb, const struct gl_config *vis)
{
if (drb->Base.InternalFormat == GL_RGBA) {
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
#include "main/context.h"
#include "drirenderbuffer.h"
-extern void tdfxDDInitSpanFuncs( GLcontext *ctx );
+extern void tdfxDDInitSpanFuncs( struct gl_context *ctx );
extern void
-tdfxSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
+tdfxSetSpanFunctions(driRenderbuffer *rb, const struct gl_config *vis);
#endif
* Alpha blending
*/
-static void tdfxUpdateAlphaMode( GLcontext *ctx )
+static void tdfxUpdateAlphaMode( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
GrCmpFnc_t func;
}
}
-static void tdfxDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref )
+static void tdfxDDAlphaFunc( struct gl_context *ctx, GLenum func, GLfloat ref )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
fxMesa->new_state |= TDFX_NEW_ALPHA;
}
-static void tdfxDDBlendEquationSeparate( GLcontext *ctx,
+static void tdfxDDBlendEquationSeparate( struct gl_context *ctx,
GLenum modeRGB, GLenum modeA )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
fxMesa->new_state |= TDFX_NEW_ALPHA;
}
-static void tdfxDDBlendFuncSeparate( GLcontext *ctx,
+static void tdfxDDBlendFuncSeparate( struct gl_context *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA )
{
* Stipple
*/
-void tdfxUpdateStipple( GLcontext *ctx )
+void tdfxUpdateStipple( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
GrStippleMode_t mode = GR_STIPPLE_DISABLE;
* Depth testing
*/
-static void tdfxUpdateZMode( GLcontext *ctx )
+static void tdfxUpdateZMode( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
GrCmpFnc_t func;
}
}
-static void tdfxDDDepthFunc( GLcontext *ctx, GLenum func )
+static void tdfxDDDepthFunc( struct gl_context *ctx, GLenum func )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
fxMesa->new_state |= TDFX_NEW_DEPTH;
}
-static void tdfxDDDepthMask( GLcontext *ctx, GLboolean flag )
+static void tdfxDDDepthMask( struct gl_context *ctx, GLboolean flag )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
fxMesa->new_state |= TDFX_NEW_DEPTH;
}
-static void tdfxDDClearDepth( GLcontext *ctx, GLclampd d )
+static void tdfxDDClearDepth( struct gl_context *ctx, GLclampd d )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
}
-static void tdfxUpdateStencil( GLcontext *ctx )
+static void tdfxUpdateStencil( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
static void
-tdfxDDStencilFuncSeparate( GLcontext *ctx, GLenum face, GLenum func,
+tdfxDDStencilFuncSeparate( struct gl_context *ctx, GLenum face, GLenum func,
GLint ref, GLuint mask )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
}
static void
-tdfxDDStencilMaskSeparate( GLcontext *ctx, GLenum face, GLuint mask )
+tdfxDDStencilMaskSeparate( struct gl_context *ctx, GLenum face, GLuint mask )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
}
static void
-tdfxDDStencilOpSeparate( GLcontext *ctx, GLenum face, GLenum sfail,
+tdfxDDStencilOpSeparate( struct gl_context *ctx, GLenum face, GLenum sfail,
GLenum zfail, GLenum zpass )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
* Fog - orthographic fog still not working
*/
-static void tdfxUpdateFogAttrib( GLcontext *ctx )
+static void tdfxUpdateFogAttrib( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
GrFogMode_t mode;
}
}
-static void tdfxDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param )
+static void tdfxDDFogfv( struct gl_context *ctx, GLenum pname, const GLfloat *param )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
* Examine XF86 cliprect list and scissor state to recompute our
* cliprect list.
*/
-void tdfxUpdateClipping( GLcontext *ctx )
+void tdfxUpdateClipping( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
__DRIdrawable *dPriv = fxMesa->driDrawable;
* Culling
*/
-void tdfxUpdateCull( GLcontext *ctx )
+void tdfxUpdateCull( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
GrCullMode_t mode = GR_CULL_DISABLE;
}
}
-static void tdfxDDCullFace( GLcontext *ctx, GLenum mode )
+static void tdfxDDCullFace( struct gl_context *ctx, GLenum mode )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
fxMesa->new_state |= TDFX_NEW_CULL;
}
-static void tdfxDDFrontFace( GLcontext *ctx, GLenum mode )
+static void tdfxDDFrontFace( struct gl_context *ctx, GLenum mode )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
* Line drawing.
*/
-static void tdfxUpdateLine( GLcontext *ctx )
+static void tdfxUpdateLine( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
}
-static void tdfxDDLineWidth( GLcontext *ctx, GLfloat width )
+static void tdfxDDLineWidth( struct gl_context *ctx, GLfloat width )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
FLUSH_BATCH( fxMesa );
* Color Attributes
*/
-static void tdfxDDColorMask( GLcontext *ctx,
+static void tdfxDDColorMask( struct gl_context *ctx,
GLboolean r, GLboolean g,
GLboolean b, GLboolean a )
{
}
-static void tdfxDDClearColor( GLcontext *ctx,
+static void tdfxDDClearColor( struct gl_context *ctx,
const GLfloat color[4] )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
* Light Model
*/
-static void tdfxDDLightModelfv( GLcontext *ctx, GLenum pname,
+static void tdfxDDLightModelfv( struct gl_context *ctx, GLenum pname,
const GLfloat *param )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
}
}
-static void tdfxDDShadeModel( GLcontext *ctx, GLenum mode )
+static void tdfxDDShadeModel( struct gl_context *ctx, GLenum mode )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
*/
static void
-tdfxDDScissor(GLcontext * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+tdfxDDScissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
FLUSH_BATCH( fxMesa );
* Render
*/
-static void tdfxUpdateRenderAttrib( GLcontext *ctx )
+static void tdfxUpdateRenderAttrib( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
FLUSH_BATCH( fxMesa );
* Viewport
*/
-void tdfxUpdateViewport( GLcontext *ctx )
+void tdfxUpdateViewport( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
const GLfloat *v = ctx->Viewport._WindowMap.m;
}
-static void tdfxDDViewport( GLcontext *ctx, GLint x, GLint y,
+static void tdfxDDViewport( struct gl_context *ctx, GLint x, GLint y,
GLsizei w, GLsizei h )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
}
-static void tdfxDDDepthRange( GLcontext *ctx, GLclampd nearVal, GLclampd farVal )
+static void tdfxDDDepthRange( struct gl_context *ctx, GLclampd nearVal, GLclampd farVal )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
FLUSH_BATCH( fxMesa );
* State enable/disable
*/
-static void tdfxDDEnable( GLcontext *ctx, GLenum cap, GLboolean state )
+static void tdfxDDEnable( struct gl_context *ctx, GLenum cap, GLboolean state )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
/* Set the buffer used for drawing */
/* XXX support for separate read/draw buffers hasn't been tested */
-static void tdfxDDDrawBuffer( GLcontext *ctx, GLenum mode )
+static void tdfxDDDrawBuffer( struct gl_context *ctx, GLenum mode )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
}
-static void tdfxDDReadBuffer( GLcontext *ctx, GLenum mode )
+static void tdfxDDReadBuffer( struct gl_context *ctx, GLenum mode )
{
/* XXX ??? */
}
* Polygon stipple
*/
-static void tdfxDDPolygonStipple( GLcontext *ctx, const GLubyte *mask )
+static void tdfxDDPolygonStipple( struct gl_context *ctx, const GLubyte *mask )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
const GLubyte *m = mask;
-static void tdfxDDRenderMode( GLcontext *ctx, GLenum mode )
+static void tdfxDDRenderMode( struct gl_context *ctx, GLenum mode )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
FALLBACK( fxMesa, TDFX_FALLBACK_RENDER_MODE, (mode != GL_RENDER) );
-void tdfxDDUpdateHwState( GLcontext *ctx )
+void tdfxDDUpdateHwState( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
int new_state = fxMesa->new_state;
}
-static void tdfxDDInvalidateState( GLcontext *ctx, GLuint new_state )
+static void tdfxDDInvalidateState( struct gl_context *ctx, GLuint new_state )
{
_swrast_InvalidateState( ctx, new_state );
_swsetup_InvalidateState( ctx, new_state );
*/
void tdfxInitState( tdfxContextPtr fxMesa )
{
- GLcontext *ctx = fxMesa->glCtx;
+ struct gl_context *ctx = fxMesa->glCtx;
GLint i;
fxMesa->ColorCombine.Function = GR_COMBINE_FUNCTION_LOCAL;
-void tdfxDDInitStateFuncs( GLcontext *ctx )
+void tdfxDDInitStateFuncs( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
#include "main/context.h"
#include "tdfx_context.h"
-extern void tdfxDDInitStateFuncs( GLcontext *ctx );
+extern void tdfxDDInitStateFuncs( struct gl_context *ctx );
-extern void tdfxDDUpdateHwState( GLcontext *ctx );
+extern void tdfxDDUpdateHwState( struct gl_context *ctx );
extern void tdfxInitState( tdfxContextPtr fxMesa );
-extern void tdfxUpdateClipping( GLcontext *ctx );
+extern void tdfxUpdateClipping( struct gl_context *ctx );
-extern void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode );
+extern void tdfxFallback( struct gl_context *ctx, GLuint bit, GLboolean mode );
#define FALLBACK( rmesa, bit, mode ) tdfxFallback( rmesa->glCtx, bit, mode )
-extern void tdfxUpdateCull( GLcontext *ctx );
-extern void tdfxUpdateStipple( GLcontext *ctx );
-extern void tdfxUpdateViewport( GLcontext *ctx );
+extern void tdfxUpdateCull( struct gl_context *ctx );
+extern void tdfxUpdateStipple( struct gl_context *ctx );
+extern void tdfxUpdateViewport( struct gl_context *ctx );
#endif
/* no borders! can't halve 1x1! (stride > width * comp) not allowed */
static void
-_mesa_halve2x2_teximage2d ( GLcontext *ctx,
+_mesa_halve2x2_teximage2d ( struct gl_context *ctx,
struct gl_texture_image *texImage,
GLuint bytesPerPixel,
GLint srcWidth, GLint srcHeight,
static void
-tdfxGenerateMipmap(GLcontext *ctx, GLenum target,
+tdfxGenerateMipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj)
{
GLint mipWidth, mipHeight;
* 32 32 GR_LOD_LOG2_32 (=5) GR_ASPECT_LOG2_1x1 (=0)
*/
static void
-tdfxTexGetInfo(const GLcontext *ctx, int w, int h,
+tdfxTexGetInfo(const struct gl_context *ctx, int w, int h,
GrLOD_t *lodlevel, GrAspectRatio_t *aspectratio,
float *sscale, float *tscale,
int *wscale, int *hscale)
* We need to call this when a texture object's minification filter
* or texture image sizes change.
*/
-static void RevalidateTexture(GLcontext *ctx, struct gl_texture_object *tObj)
+static void RevalidateTexture(struct gl_context *ctx, struct gl_texture_object *tObj)
{
tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
GLint minl, maxl;
* Called via glBindTexture.
*/
static void
-tdfxBindTexture(GLcontext * ctx, GLenum target,
+tdfxBindTexture(struct gl_context * ctx, GLenum target,
struct gl_texture_object *tObj)
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
* Called via glTexEnv.
*/
static void
-tdfxTexEnv(GLcontext * ctx, GLenum target, GLenum pname,
+tdfxTexEnv(struct gl_context * ctx, GLenum target, GLenum pname,
const GLfloat * param)
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
* Called via glTexParameter.
*/
static void
-tdfxTexParameter(GLcontext * ctx, GLenum target,
+tdfxTexParameter(struct gl_context * ctx, GLenum target,
struct gl_texture_object *tObj,
GLenum pname, const GLfloat * params)
{
* Here, we delete the Glide data associated with the texture.
*/
static void
-tdfxDeleteTexture(GLcontext * ctx, struct gl_texture_object *tObj)
+tdfxDeleteTexture(struct gl_context * ctx, struct gl_texture_object *tObj)
{
if (ctx && ctx->DriverCtx) {
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
* Return true if texture is resident, false otherwise.
*/
static GLboolean
-tdfxIsTextureResident(GLcontext *ctx, struct gl_texture_object *tObj)
+tdfxIsTextureResident(struct gl_context *ctx, struct gl_texture_object *tObj)
{
tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
return (GLboolean) (ti && ti->isInTM);
static void
-tdfxUpdateTexturePalette(GLcontext * ctx, struct gl_texture_object *tObj)
+tdfxUpdateTexturePalette(struct gl_context * ctx, struct gl_texture_object *tObj)
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
static gl_format
-tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
+tdfxChooseTextureFormat( struct gl_context *ctx, GLint internalFormat,
GLenum srcFormat, GLenum srcType )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
static GLboolean
-adjust2DRatio (GLcontext *ctx,
+adjust2DRatio (struct gl_context *ctx,
GLint xoffset, GLint yoffset,
GLint width, GLint height,
GLenum format, GLenum type, const GLvoid *pixels,
static void
-tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,
+tdfxTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat, GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing,
static void
-tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
+tdfxTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
static void
-tdfxTexImage1D(GLcontext *ctx, GLenum target, GLint level,
+tdfxTexImage1D(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat, GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing,
}
static void
-tdfxTexSubImage1D(GLcontext *ctx, GLenum target, GLint level,
+tdfxTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset,
GLsizei width,
GLenum format, GLenum type,
/**********************************************************************/
static void
-tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target,
+tdfxCompressedTexImage2D (struct gl_context *ctx, GLenum target,
GLint level, GLint internalFormat,
GLsizei width, GLsizei height, GLint border,
GLsizei imageSize, const GLvoid *data,
static void
-tdfxCompressedTexSubImage2D( GLcontext *ctx, GLenum target,
+tdfxCompressedTexSubImage2D( struct gl_context *ctx, GLenum target,
GLint level, GLint xoffset,
GLint yoffset, GLsizei width,
GLint height, GLenum format,
GLboolean
-tdfxTestProxyTexImage(GLcontext *ctx, GLenum target,
+tdfxTestProxyTexImage(struct gl_context *ctx, GLenum target,
GLint level, GLint internalFormat,
GLenum format, GLenum type,
GLint width, GLint height,
* texture object from the core mesa gl_texture_object. Not done at this time.
*/
static struct gl_texture_object *
-tdfxNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
+tdfxNewTextureObject( struct gl_context *ctx, GLuint name, GLenum target )
{
struct gl_texture_object *obj;
obj = _mesa_new_texture_object(ctx, name, target);
extern void
-tdfxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj);
+tdfxTexValidate(struct gl_context * ctx, struct gl_texture_object *tObj);
#if 000 /* DEAD? */
extern void
-fxDDTexUseGlobalPalette(GLcontext * ctx, GLboolean state);
+fxDDTexUseGlobalPalette(struct gl_context * ctx, GLboolean state);
#endif
extern GLboolean
-tdfxTestProxyTexImage(GLcontext *ctx, GLenum target,
+tdfxTestProxyTexImage(struct gl_context *ctx, GLenum target,
GLint level, GLint internalFormat,
GLenum format, GLenum type,
GLint width, GLint height,
GLint depth, GLint border);
extern GLvoid *
-tdfxDDGetTexImage(GLcontext * ctx, GLenum target, GLint level,
+tdfxDDGetTexImage(struct gl_context * ctx, GLenum target, GLint level,
const struct gl_texture_object *texObj,
GLenum * formatOut, GLenum * typeOut,
GLboolean * freeImageOut);
extern void
-tdfxDDGetCompressedTexImage( GLcontext *ctx, GLenum target,
+tdfxDDGetCompressedTexImage( struct gl_context *ctx, GLenum target,
GLint lod, void *image,
const struct gl_texture_object *texObj,
struct gl_texture_image *texImage );
extern GLint
-tdfxSpecificCompressedTexFormat(GLcontext *ctx,
+tdfxSpecificCompressedTexFormat(struct gl_context *ctx,
GLint internalFormat,
GLint numDimensions);
extern GLint
-tdfxBaseCompressedTexFormat(GLcontext *ctx,
+tdfxBaseCompressedTexFormat(struct gl_context *ctx,
GLint internalFormat);
extern GLboolean
-tdfxDDIsCompressedFormat(GLcontext *ctx, GLint internalFormat);
+tdfxDDIsCompressedFormat(struct gl_context *ctx, GLint internalFormat);
extern GLsizei
-tdfxDDCompressedImageSize(GLcontext *ctx,
+tdfxDDCompressedImageSize(struct gl_context *ctx,
GLenum intFormat,
GLuint numDimensions,
GLuint width,
void
-tdfxTMReloadMipMapLevel(GLcontext *ctx, struct gl_texture_object *tObj,
+tdfxTMReloadMipMapLevel(struct gl_context *ctx, struct gl_texture_object *tObj,
GLint level)
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
case TDFX_TMU_SPLIT:
case TDFX_TMU_BOTH:
assert(!shared->umaTexMemory);
+ (void) shared;
RemoveRange_NoLock(fxMesa, TDFX_TMU0, ti->tm[TDFX_TMU0]);
RemoveRange_NoLock(fxMesa, TDFX_TMU1, ti->tm[TDFX_TMU1]);
break;
*/
void tdfxTMRestoreTextures_NoLock( tdfxContextPtr fxMesa )
{
- GLcontext *ctx = fxMesa->glCtx;
+ struct gl_context *ctx = fxMesa->glCtx;
struct _mesa_HashTable *textures = fxMesa->glCtx->Shared->TexObjects;
GLuint id;
extern void tdfxTMDownloadTexture(tdfxContextPtr fxMesa,
struct gl_texture_object *tObj);
-extern void tdfxTMReloadMipMapLevel( GLcontext *ctx,
+extern void tdfxTMReloadMipMapLevel( struct gl_context *ctx,
struct gl_texture_object *tObj,
GLint level );
* If we fail, we'll have to use software rendering.
*/
static GLboolean
-SetupTexEnvNapalm(GLcontext *ctx, GLboolean useIteratedRGBA,
+SetupTexEnvNapalm(struct gl_context *ctx, GLboolean useIteratedRGBA,
const struct gl_texture_unit *texUnit, GLenum baseFormat,
struct tdfx_texcombine_ext *env)
{
* If failure, we'll use software rendering.
*/
static GLboolean
-SetupSingleTexEnvVoodoo3(GLcontext *ctx, int unit,
+SetupSingleTexEnvVoodoo3(struct gl_context *ctx, int unit,
GLenum envMode, GLenum baseFormat)
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
* If failure, we'll use software rendering.
*/
static GLboolean
-SetupDoubleTexEnvVoodoo3(GLcontext *ctx, int tmu0,
+SetupDoubleTexEnvVoodoo3(struct gl_context *ctx, int tmu0,
GLenum envMode0, GLenum baseFormat0,
GLenum envMode1, GLenum baseFormat1)
{
{
struct tdfxSharedState *shared = (struct tdfxSharedState *) fxMesa->glCtx->Shared->DriverData;
tdfxTexInfo *ti = TDFX_TEXTURE_DATA(tObj);
- const GLcontext *ctx = fxMesa->glCtx;
+ const struct gl_context *ctx = fxMesa->glCtx;
/* Make sure we're not loaded incorrectly */
if (ti->isInTM && !shared->umaTexMemory) {
#if 0
static void print_state(tdfxContextPtr fxMesa)
{
- GLcontext *ctx = fxMesa->glCtx;
+ struct gl_context *ctx = fxMesa->glCtx;
struct gl_texture_object *tObj0 = ctx->Texture.Unit[0]._Current;
struct gl_texture_object *tObj1 = ctx->Texture.Unit[1]._Current;
GLenum base0 = tObj0->Image[0][tObj0->BaseLevel] ? tObj0->Image[0][tObj0->BaseLevel]->Format : 99;
* Input: ctx - the context
* unit - the OpenGL texture unit to use.
*/
-static void setupTextureSingleTMU(GLcontext * ctx, GLuint unit)
+static void setupTextureSingleTMU(struct gl_context * ctx, GLuint unit)
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
tdfxTexInfo *ti;
const struct gl_shared_state *mesaShared = fxMesa->glCtx->Shared;
const struct tdfxSharedState *shared = (struct tdfxSharedState *) mesaShared->DriverData;
- const GLcontext *ctx = fxMesa->glCtx;
+ const struct gl_context *ctx = fxMesa->glCtx;
tdfxTexInfo *ti0 = TDFX_TEXTURE_DATA(tObj0);
tdfxTexInfo *ti1 = TDFX_TEXTURE_DATA(tObj1);
GLuint tstate = 0;
#undef T1_IN_TMU1
}
-static void setupTextureDoubleTMU(GLcontext * ctx)
+static void setupTextureDoubleTMU(struct gl_context * ctx)
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
struct gl_texture_object *tObj0 = ctx->Texture.Unit[1]._Current;
void
-tdfxUpdateTextureState( GLcontext *ctx )
+tdfxUpdateTextureState( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
* This is very common in Quake3.
*/
void
-tdfxUpdateTextureBinding( GLcontext *ctx )
+tdfxUpdateTextureBinding( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
struct gl_texture_object *tObj0 = ctx->Texture.Unit[0]._Current;
#ifndef __TDFX_TEXSTATE_H__
#define __TDFX_TEXSTATE_H__
-extern void tdfxUpdateTextureState( GLcontext *ctx );
-extern void tdfxUpdateTextureBinding( GLcontext *ctx );
+extern void tdfxUpdateTextureState( struct gl_context *ctx );
+extern void tdfxUpdateTextureBinding( struct gl_context *ctx );
#endif
#include "tdfx_render.h"
-static void tdfxRasterPrimitive( GLcontext *ctx, GLenum prim );
-static void tdfxRenderPrimitive( GLcontext *ctx, GLenum prim );
+static void tdfxRasterPrimitive( struct gl_context *ctx, GLenum prim );
+static void tdfxRenderPrimitive( struct gl_context *ctx, GLenum prim );
static GLenum reduced_prim[GL_POLYGON+1] = {
GL_POINTS,
* primitives.
*/
static void
-tdfx_translate_vertex( GLcontext *ctx, const tdfxVertex *src, SWvertex *dst)
+tdfx_translate_vertex( struct gl_context *ctx, const tdfxVertex *src, SWvertex *dst)
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
tdfxVertex *v1,
tdfxVertex *v2 )
{
- GLcontext *ctx = fxMesa->glCtx;
+ struct gl_context *ctx = fxMesa->glCtx;
SWvertex v[3];
tdfx_translate_vertex( ctx, v0, &v[0] );
tdfx_translate_vertex( ctx, v1, &v[1] );
tdfxVertex *v0,
tdfxVertex *v1 )
{
- GLcontext *ctx = fxMesa->glCtx;
+ struct gl_context *ctx = fxMesa->glCtx;
SWvertex v[2];
tdfx_translate_vertex( ctx, v0, &v[0] );
tdfx_translate_vertex( ctx, v1, &v[1] );
tdfx_fallback_point( tdfxContextPtr fxMesa,
tdfxVertex *v0 )
{
- GLcontext *ctx = fxMesa->glCtx;
+ struct gl_context *ctx = fxMesa->glCtx;
SWvertex v[1];
tdfx_translate_vertex( ctx, v0, &v[0] );
_swrast_Point( ctx, &v[0] );
* Functions to draw basic primitives *
***********************************************************************/
-static void tdfx_print_vertex( GLcontext *ctx, const tdfxVertex *v )
+static void tdfx_print_vertex( struct gl_context *ctx, const tdfxVertex *v )
{
tdfxContextPtr tmesa = TDFX_CONTEXT( ctx );
*/
#define INIT(x) tdfxRenderPrimitive( ctx, x )
-static void tdfx_render_vb_points( GLcontext *ctx,
+static void tdfx_render_vb_points( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void tdfx_render_vb_line_strip( GLcontext *ctx,
+static void tdfx_render_vb_line_strip( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void tdfx_render_vb_line_loop( GLcontext *ctx,
+static void tdfx_render_vb_line_loop( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void tdfx_render_vb_lines( GLcontext *ctx,
+static void tdfx_render_vb_lines( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void tdfx_render_vb_triangles( GLcontext *ctx,
+static void tdfx_render_vb_triangles( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void tdfx_render_vb_tri_strip( GLcontext *ctx,
+static void tdfx_render_vb_tri_strip( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void tdfx_render_vb_tri_fan( GLcontext *ctx,
+static void tdfx_render_vb_tri_fan( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
fxVB + start, sizeof(tdfxVertex) );
}
-static void tdfx_render_vb_quads( GLcontext *ctx,
+static void tdfx_render_vb_quads( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void tdfx_render_vb_quad_strip( GLcontext *ctx,
+static void tdfx_render_vb_quad_strip( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
count-start, fxVB + start, sizeof(tdfxVertex));
}
-static void tdfx_render_vb_poly( GLcontext *ctx,
+static void tdfx_render_vb_poly( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
fxVB + start, sizeof(tdfxVertex));
}
-static void tdfx_render_vb_noop( GLcontext *ctx,
+static void tdfx_render_vb_noop( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
(void) (ctx && start && count && flags);
}
-static void (*tdfx_render_tab_verts[GL_POLYGON+2])(GLcontext *,
+static void (*tdfx_render_tab_verts[GL_POLYGON+2])(struct gl_context *,
GLuint,
GLuint,
GLuint) =
-static void tdfxRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
+static void tdfxRenderClippedPoly( struct gl_context *ctx, const GLuint *elts,
GLuint n )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
tnl->Driver.Render.PrimitiveNotify( ctx, prim );
}
-static void tdfxRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
+static void tdfxRenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.Line( ctx, ii, jj );
}
-static void tdfxFastRenderClippedPoly( GLcontext *ctx, const GLuint *elts,
+static void tdfxFastRenderClippedPoly( struct gl_context *ctx, const GLuint *elts,
GLuint n )
{
int i;
_NEW_POLYGONSTIPPLE)
-static void tdfxChooseRenderState(GLcontext *ctx)
+static void tdfxChooseRenderState(struct gl_context *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
* TODO: Use single back-buffer cliprect where possible.
* NOTE: <pass> starts at 1, not zero!
*/
-static GLboolean multipass_cliprect( GLcontext *ctx, GLuint pass )
+static GLboolean multipass_cliprect( struct gl_context *ctx, GLuint pass )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
if (pass >= fxMesa->numClipRects)
/* Runtime render state and callbacks */
/**********************************************************************/
-static void tdfxRunPipeline( GLcontext *ctx )
+static void tdfxRunPipeline( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
}
-static void tdfxRenderStart( GLcontext *ctx )
+static void tdfxRenderStart( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
/* Always called between RenderStart and RenderFinish --> We already
* hold the lock.
*/
-static void tdfxRasterPrimitive( GLcontext *ctx, GLenum prim )
+static void tdfxRasterPrimitive( struct gl_context *ctx, GLenum prim )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
* which renders strips as strips, the equivalent calculations are
* performed in tdfx_render.c.
*/
-static void tdfxRenderPrimitive( GLcontext *ctx, GLenum prim )
+static void tdfxRenderPrimitive( struct gl_context *ctx, GLenum prim )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
GLuint rprim = reduced_prim[prim];
}
}
-static void tdfxRenderFinish( GLcontext *ctx )
+static void tdfxRenderFinish( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
}
-void tdfxFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
+void tdfxFallback( struct gl_context *ctx, GLuint bit, GLboolean mode )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
}
-void tdfxDDInitTriFuncs( GLcontext *ctx )
+void tdfxDDInitTriFuncs( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
#include "main/mtypes.h"
-extern void tdfxDDInitTriFuncs( GLcontext *ctx );
+extern void tdfxDDInitTriFuncs( struct gl_context *ctx );
#endif
#include "tdfx_vb.h"
#include "tdfx_render.h"
-static void copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc )
+static void copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
tdfxVertex *dst = fxMesa->verts + edst;
}
static struct {
- void (*emit)( GLcontext *, GLuint, GLuint, void * );
+ void (*emit)( struct gl_context *, GLuint, GLuint, void * );
tnl_interp_func interp;
tnl_copy_pv_func copy_pv;
- GLboolean (*check_tex_sizes)( GLcontext *ctx );
+ GLboolean (*check_tex_sizes)( struct gl_context *ctx );
GLuint vertex_format;
} setup_tab[TDFX_MAX_SETUP];
#define GET_COLOR(ptr, idx) ((ptr)->data[idx])
-static void interp_extras( GLcontext *ctx,
+static void interp_extras( struct gl_context *ctx,
GLfloat t,
GLuint dst, GLuint out, GLuint in,
GLboolean force_boundary )
force_boundary);
}
-static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src )
+static void copy_pv_extras( struct gl_context *ctx, GLuint dst, GLuint src )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-void tdfxCheckTexSizes( GLcontext *ctx )
+void tdfxCheckTexSizes( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
}
-void tdfxBuildVertices( GLcontext *ctx, GLuint start, GLuint end,
+void tdfxBuildVertices( struct gl_context *ctx, GLuint start, GLuint end,
GLuint newinputs )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
}
-void tdfxChooseVertexState( GLcontext *ctx )
+void tdfxChooseVertexState( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tdfxContextPtr fxMesa = TDFX_CONTEXT( ctx );
-void tdfxInitVB( GLcontext *ctx )
+void tdfxInitVB( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
GLuint size = TNL_CONTEXT(ctx)->vb.Size;
}
-void tdfxFreeVB( GLcontext *ctx )
+void tdfxFreeVB( struct gl_context *ctx )
{
tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx);
if (fxMesa->verts) {
_NEW_FOG)
-extern void tdfxValidateBuildProjVerts(GLcontext *ctx,
+extern void tdfxValidateBuildProjVerts(struct gl_context *ctx,
GLuint start, GLuint count,
GLuint newinputs );
extern void tdfxPrintSetupFlags(char *msg, GLuint flags );
-extern void tdfxInitVB( GLcontext *ctx );
+extern void tdfxInitVB( struct gl_context *ctx );
-extern void tdfxFreeVB( GLcontext *ctx );
+extern void tdfxFreeVB( struct gl_context *ctx );
-extern void tdfxCheckTexSizes( GLcontext *ctx );
+extern void tdfxCheckTexSizes( struct gl_context *ctx );
-extern void tdfxChooseVertexState( GLcontext *ctx );
+extern void tdfxChooseVertexState( struct gl_context *ctx );
-extern void tdfxBuildVertices( GLcontext *ctx, GLuint start, GLuint end,
+extern void tdfxBuildVertices( struct gl_context *ctx, GLuint start, GLuint end,
GLuint newinputs );
#endif
#define VIEWPORT_Z(dst,z) dst = s[10] * z + s[14]
-static void TAG(emit)( GLcontext *ctx,
+static void TAG(emit)( struct gl_context *ctx,
GLuint start, GLuint end,
void *dest )
{
}
-static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
+static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx )
{
/* fprintf(stderr, "%s\n", __FUNCTION__); */
}
-static void TAG(interp)( GLcontext *ctx,
+static void TAG(interp)( struct gl_context *ctx,
GLfloat t,
GLuint edst, GLuint eout, GLuint ein,
GLboolean force_boundary )
*
* \sa glGetString
*/
-static const GLubyte *viaGetString(GLcontext *ctx, GLenum name)
+static const GLubyte *viaGetString(struct gl_context *ctx, GLenum name)
{
static char buffer[128];
unsigned offset;
}
static GLboolean
-viaRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb,
+viaRenderbufferStorage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
rb->Width = width;
}
-void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer,
+void viaReAllocateBuffers(struct gl_context *ctx, struct gl_framebuffer *drawbuffer,
GLuint width, GLuint height)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
GLboolean
viaCreateContext(gl_api api,
- const __GLcontextModes *visual,
+ const struct gl_config *visual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{
- GLcontext *ctx, *shareCtx;
+ struct gl_context *ctx, *shareCtx;
struct via_context *vmesa;
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private;
if (driContextPriv) {
struct via_context *vmesa =
(struct via_context *)driContextPriv->driverPrivate;
- GLcontext *ctx = vmesa->glCtx;
+ struct gl_context *ctx = vmesa->glCtx;
struct gl_framebuffer *drawBuffer, *readBuffer;
- drawBuffer = (GLframebuffer *)driDrawPriv->driverPrivate;
- readBuffer = (GLframebuffer *)driReadPriv->driverPrivate;
+ drawBuffer = (struct gl_framebuffer *)driDrawPriv->driverPrivate;
+ readBuffer = (struct gl_framebuffer *)driReadPriv->driverPrivate;
if ((vmesa->driDrawable != driDrawPriv)
|| (vmesa->driReadable != driReadPriv)) {
dPriv->driContextPriv->driverPrivate) {
struct via_context *vmesa =
(struct via_context *)dPriv->driContextPriv->driverPrivate;
- GLcontext *ctx = vmesa->glCtx;
+ struct gl_context *ctx = vmesa->glCtx;
_mesa_notifySwapBuffers(ctx);
struct via_context {
GLint refcount;
- GLcontext *glCtx;
- GLcontext *shareCtx;
+ struct gl_context *glCtx;
+ struct gl_context *shareCtx;
/* XXX These don't belong here. They should be per-drawable state. */
struct via_renderbuffer front;
extern void viaEmitScissorValues(struct via_context *vmesa, int box_nr, int emit);
extern void viaXMesaSetBackClipRects(struct via_context *vmesa);
extern void viaXMesaSetFrontClipRects(struct via_context *vmesa);
-extern void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, GLuint width, GLuint height);
+extern void viaReAllocateBuffers(struct gl_context *ctx, struct gl_framebuffer *drawbuffer, GLuint width, GLuint height);
extern void viaXMesaWindowMoved(struct via_context *vmesa);
extern GLboolean viaTexCombineState(struct via_context *vmesa,
-static void viaClear(GLcontext *ctx, GLbitfield mask)
+static void viaClear(struct gl_context *ctx, GLbitfield mask)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
__DRIdrawable *dPriv = vmesa->driDrawable;
}
}
-static void viaFlush(GLcontext *ctx)
+static void viaFlush(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
VIA_FLUSH_DMA(vmesa);
}
-static void viaFinish(GLcontext *ctx)
+static void viaFinish(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
VIA_FLUSH_DMA(vmesa);
viaWaitIdle(vmesa, GL_FALSE);
}
-static void viaClearStencil(GLcontext *ctx, int s)
+static void viaClearStencil(struct gl_context *ctx, int s)
{
return;
}
-void viaInitIoctlFuncs(GLcontext *ctx)
+void viaInitIoctlFuncs(struct gl_context *ctx)
{
ctx->Driver.Flush = viaFlush;
ctx->Driver.Clear = viaClear;
void viaFlushDma(struct via_context *vmesa);
void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags);
-void viaInitIoctlFuncs(GLcontext *ctx);
+void viaInitIoctlFuncs(struct gl_context *ctx);
void viaCopyBuffer(__DRIdrawable *dpriv);
void viaPageFlip(__DRIdrawable *dpriv);
void viaCheckDma(struct via_context *vmesa, GLuint bytes);
/**********************************************************************/
/* Fast Render pipeline stage */
/**********************************************************************/
-static GLboolean via_run_fastrender(GLcontext *ctx,
+static GLboolean via_run_fastrender(struct gl_context *ctx,
struct tnl_pipeline_stage *stage)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
static GLboolean
viaCreateBuffer(__DRIscreen *driScrnPriv,
__DRIdrawable *driDrawPriv,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
GLboolean isPixmap)
{
#if 0
static void
viaDestroyBuffer(__DRIdrawable *driDrawPriv)
{
- _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
+ _mesa_reference_framebuffer((struct gl_framebuffer **)(&(driDrawPriv->driverPrivate)), NULL);
}
static const __DRIconfig **
*
* \todo maybe fold this into intelInitDriver
*
- * \return the __GLcontextModes supported by this driver
+ * \return the struct gl_config supported by this driver
*/
static const __DRIconfig **
viaInitScreen(__DRIscreen *psp)
extern GLboolean
viaCreateContext(gl_api api,
- const __GLcontextModes *mesaVis,
+ const struct gl_config *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate);
/* Move locking out to get reasonable span performance.
*/
-void viaSpanRenderStart( GLcontext *ctx )
+void viaSpanRenderStart( struct gl_context *ctx )
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
viaWaitIdle(vmesa, GL_FALSE);
LOCK_HARDWARE(vmesa);
}
-void viaSpanRenderFinish( GLcontext *ctx )
+void viaSpanRenderFinish( struct gl_context *ctx )
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
_swrast_flush( ctx );
UNLOCK_HARDWARE( vmesa );
}
-void viaInitSpanFuncs(GLcontext *ctx)
+void viaInitSpanFuncs(struct gl_context *ctx)
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
swdd->SpanRenderStart = viaSpanRenderStart;
* Plug in the Get/Put routines for the given driRenderbuffer.
*/
void
-viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis)
+viaSetSpanFunctions(struct via_renderbuffer *vrb, const struct gl_config *vis)
{
if (vrb->Base.Format == MESA_FORMAT_RGB565) {
viaInitPointers_565(&vrb->Base);
#ifndef _VIA_SPAN_H
#define _VIA_SPAN_H
-extern void viaInitSpanFuncs(GLcontext *ctx);
-extern void viaSpanRenderStart( GLcontext *ctx );
-extern void viaSpanRenderFinish( GLcontext *ctx );
+extern void viaInitSpanFuncs(struct gl_context *ctx);
+extern void viaSpanRenderStart( struct gl_context *ctx );
+extern void viaSpanRenderFinish( struct gl_context *ctx );
extern void
-viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis);
+viaSetSpanFunctions(struct via_renderbuffer *vrb, const struct gl_config *vis);
#endif
void viaEmitState(struct via_context *vmesa)
{
- GLcontext *ctx = vmesa->glCtx;
+ struct gl_context *ctx = vmesa->glCtx;
GLuint i = 0;
GLuint j = 0;
RING_VARS;
}
}
-static void viaBlendEquationSeparate(GLcontext *ctx,
+static void viaBlendEquationSeparate(struct gl_context *ctx,
GLenum rgbMode,
GLenum aMode)
{
ctx->Color.LogicOp != GL_COPY));
}
-static void viaBlendFunc(GLcontext *ctx, GLenum sfactor, GLenum dfactor)
+static void viaBlendFunc(struct gl_context *ctx, GLenum sfactor, GLenum dfactor)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
GLboolean fallback = GL_FALSE;
/* Shouldn't be called as the extension is disabled.
*/
-static void viaBlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
+static void viaBlendFuncSeparate(struct gl_context *ctx, GLenum sfactorRGB,
GLenum dfactorRGB, GLenum sfactorA,
GLenum dfactorA)
{
/* =============================================================
* Hardware clipping
*/
-static void viaScissor(GLcontext *ctx, GLint x, GLint y,
+static void viaScissor(struct gl_context *ctx, GLint x, GLint y,
GLsizei w, GLsizei h)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
vmesa->scissorRect.y2 = vmesa->driDrawable->h - y;
}
-static void viaEnable(GLcontext *ctx, GLenum cap, GLboolean state)
+static void viaEnable(struct gl_context *ctx, GLenum cap, GLboolean state)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
/* Fallback to swrast for select and feedback.
*/
-static void viaRenderMode(GLcontext *ctx, GLenum mode)
+static void viaRenderMode(struct gl_context *ctx, GLenum mode)
{
FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_RENDERMODE, (mode != GL_RENDER));
}
-static void viaDrawBuffer(GLcontext *ctx, GLenum mode)
+static void viaDrawBuffer(struct gl_context *ctx, GLenum mode)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
viaXMesaWindowMoved(vmesa);
}
-static void viaClearColor(GLcontext *ctx, const GLfloat color[4])
+static void viaClearColor(struct gl_context *ctx, const GLfloat color[4])
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
GLubyte pcolor[4];
#define WRITEMASK_GREEN_SHIFT 29
#define WRITEMASK_BLUE_SHIFT 28
-static void viaColorMask(GLcontext *ctx,
+static void viaColorMask(struct gl_context *ctx,
GLboolean r, GLboolean g,
GLboolean b, GLboolean a)
{
/* This hardware just isn't capable of private back buffers without
* glitches and/or a hefty locking scheme.
*/
-void viaCalcViewport(GLcontext *ctx)
+void viaCalcViewport(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
__DRIdrawable *dPriv = vmesa->driDrawable;
m[MAT_TZ] = v[MAT_TZ] * (1.0 / vmesa->depth_max);
}
-static void viaViewport(GLcontext *ctx,
+static void viaViewport(struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height)
{
viaCalcViewport(ctx);
}
-static void viaDepthRange(GLcontext *ctx,
+static void viaDepthRange(struct gl_context *ctx,
GLclampd nearval, GLclampd farval)
{
viaCalcViewport(ctx);
}
-void viaInitState(GLcontext *ctx)
+void viaInitState(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
}
-static GLboolean viaChooseTextureState(GLcontext *ctx)
+static GLboolean viaChooseTextureState(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
struct gl_texture_unit *texUnit0 = &ctx->Texture.Unit[0];
return GL_TRUE;
}
-static void viaChooseColorState(GLcontext *ctx)
+static void viaChooseColorState(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
GLenum s = ctx->Color.BlendSrcRGB;
vmesa->regEnable &= ~HC_HenAW_MASK;
}
-static void viaChooseFogState(GLcontext *ctx)
+static void viaChooseFogState(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
}
}
-static void viaChooseDepthState(GLcontext *ctx)
+static void viaChooseDepthState(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
if (ctx->Depth.Test) {
}
}
-static void viaChooseLineState(GLcontext *ctx)
+static void viaChooseLineState(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
}
}
-static void viaChoosePolygonState(GLcontext *ctx)
+static void viaChoosePolygonState(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
}
}
-static void viaChooseStencilState(GLcontext *ctx)
+static void viaChooseStencilState(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
-static void viaChooseTriangle(GLcontext *ctx)
+static void viaChooseTriangle(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
}
}
-void viaValidateState( GLcontext *ctx )
+void viaValidateState( struct gl_context *ctx )
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
vmesa->newState = 0;
}
-static void viaInvalidateState(GLcontext *ctx, GLuint newState)
+static void viaInvalidateState(struct gl_context *ctx, GLuint newState)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
_tnl_InvalidateState(ctx, newState);
}
-void viaInitStateFuncs(GLcontext *ctx)
+void viaInitStateFuncs(struct gl_context *ctx)
{
/* Callbacks for internal Mesa events.
*/
#include "via_context.h"
-extern void viaInitState(GLcontext *ctx);
-extern void viaInitStateFuncs(GLcontext *ctx);
-extern void viaCalcViewport(GLcontext *ctx);
-extern void viaValidateState(GLcontext *ctx);
+extern void viaInitState(struct gl_context *ctx);
+extern void viaInitStateFuncs(struct gl_context *ctx);
+extern void viaCalcViewport(struct gl_context *ctx);
+extern void viaValidateState(struct gl_context *ctx);
extern void viaEmitState(struct via_context *vmesa);
extern void viaFallback(struct via_context *vmesa, GLuint bit, GLboolean mode);
#include "via_3d_reg.h"
static gl_format
-viaChooseTexFormat( GLcontext *ctx, GLint internalFormat,
+viaChooseTexFormat( struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
/* Basically, just collect the image dimensions and addresses for each
* image and update the texture object state accordingly.
*/
-static GLboolean viaSetTexImages(GLcontext *ctx,
+static GLboolean viaSetTexImages(struct gl_context *ctx,
struct gl_texture_object *texObj)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
}
-GLboolean viaUpdateTextureState( GLcontext *ctx )
+GLboolean viaUpdateTextureState( struct gl_context *ctx )
{
struct gl_texture_unit *texUnit = ctx->Texture.Unit;
GLuint i;
-static void viaTexImage(GLcontext *ctx,
+static void viaTexImage(struct gl_context *ctx,
GLint dims,
GLenum target, GLint level,
GLint internalFormat,
_mesa_unmap_teximage_pbo(ctx, packing);
}
-static void viaTexImage2D(GLcontext *ctx,
+static void viaTexImage2D(struct gl_context *ctx,
GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
packing, texObj, texImage );
}
-static void viaTexSubImage2D(GLcontext *ctx,
+static void viaTexSubImage2D(struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
texImage);
}
-static void viaTexImage1D(GLcontext *ctx,
+static void viaTexImage1D(struct gl_context *ctx,
GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
packing, texObj, texImage );
}
-static void viaTexSubImage1D(GLcontext *ctx,
+static void viaTexSubImage1D(struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset,
-static GLboolean viaIsTextureResident(GLcontext *ctx,
+static GLboolean viaIsTextureResident(struct gl_context *ctx,
struct gl_texture_object *texObj)
{
struct via_texture_object *viaObj =
-static struct gl_texture_image *viaNewTextureImage( GLcontext *ctx )
+static struct gl_texture_image *viaNewTextureImage( struct gl_context *ctx )
{
(void) ctx;
return (struct gl_texture_image *)CALLOC_STRUCT(via_texture_image);
}
-static struct gl_texture_object *viaNewTextureObject( GLcontext *ctx,
+static struct gl_texture_object *viaNewTextureObject( struct gl_context *ctx,
GLuint name,
GLenum target )
{
}
-static void viaFreeTextureImageData( GLcontext *ctx,
+static void viaFreeTextureImageData( struct gl_context *ctx,
struct gl_texture_image *texImage )
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
struct via_context;
-GLboolean viaUpdateTextureState(GLcontext *ctx);
+GLboolean viaUpdateTextureState(struct gl_context *ctx);
void viaInitTextureFuncs(struct dd_function_table * functions);
GLboolean viaSwapOutWork( struct via_context *vmesa );
viaVertex *v1,
viaVertex *v2)
{
- GLcontext *ctx = vmesa->glCtx;
+ struct gl_context *ctx = vmesa->glCtx;
SWvertex v[3];
_swsetup_Translate(ctx, v0, &v[0]);
_swsetup_Translate(ctx, v1, &v[1]);
viaVertex *v0,
viaVertex *v1)
{
- GLcontext *ctx = vmesa->glCtx;
+ struct gl_context *ctx = vmesa->glCtx;
SWvertex v[2];
_swsetup_Translate(ctx, v0, &v[0]);
_swsetup_Translate(ctx, v1, &v[1]);
via_fallback_point(struct via_context *vmesa,
viaVertex *v0)
{
- GLcontext *ctx = vmesa->glCtx;
+ struct gl_context *ctx = vmesa->glCtx;
SWvertex v[1];
_swsetup_Translate(ctx, v0, &v[0]);
viaSpanRenderStart( ctx );
viaSpanRenderFinish( ctx );
}
-static void viaResetLineStipple( GLcontext *ctx )
+static void viaResetLineStipple( struct gl_context *ctx )
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
vmesa->regCmdB |= HC_HLPrst_MASK;
-static void viaRenderClippedPoly(GLcontext *ctx, const GLuint *elts,
+static void viaRenderClippedPoly(struct gl_context *ctx, const GLuint *elts,
GLuint n)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.PrimitiveNotify( ctx, prim );
}
-static void viaRenderClippedLine(GLcontext *ctx, GLuint ii, GLuint jj)
+static void viaRenderClippedLine(struct gl_context *ctx, GLuint ii, GLuint jj)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.Line(ctx, ii, jj);
}
-static void viaFastRenderClippedPoly(GLcontext *ctx, const GLuint *elts,
+static void viaFastRenderClippedPoly(struct gl_context *ctx, const GLuint *elts,
GLuint n)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
_NEW_POLYGONSTIPPLE)
-static void viaChooseRenderState(GLcontext *ctx)
+static void viaChooseRenderState(struct gl_context *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct via_context *vmesa = VIA_CONTEXT(ctx);
-static void viaChooseVertexState( GLcontext *ctx )
+static void viaChooseVertexState( struct gl_context *ctx )
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
* them. Fallback to swrast if we can't. Returns GL_TRUE if projective
* texture coordinates must be faked, GL_FALSE otherwise.
*/
-static GLboolean viaCheckPTexHack( GLcontext *ctx )
+static GLboolean viaCheckPTexHack( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
/**********************************************************************/
-static void viaRenderStart(GLcontext *ctx)
+static void viaRenderStart(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr;
}
-static void viaRenderFinish(GLcontext *ctx)
+static void viaRenderFinish(struct gl_context *ctx)
{
VIA_FINISH_PRIM(VIA_CONTEXT(ctx));
}
/* System to flush dma and emit state changes based on the rasterized
* primitive.
*/
-void viaRasterPrimitive(GLcontext *ctx,
+void viaRasterPrimitive(struct gl_context *ctx,
GLenum glprim,
GLenum hwprim)
{
/* Callback for mesa:
*/
-static void viaRenderPrimitive( GLcontext *ctx, GLuint prim )
+static void viaRenderPrimitive( struct gl_context *ctx, GLuint prim )
{
viaRasterPrimitive( ctx, prim, hwPrim[prim] );
}
void viaFallback(struct via_context *vmesa, GLuint bit, GLboolean mode)
{
- GLcontext *ctx = vmesa->glCtx;
+ struct gl_context *ctx = vmesa->glCtx;
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint oldfallback = vmesa->Fallback;
}
}
-static void viaRunPipeline( GLcontext *ctx )
+static void viaRunPipeline( struct gl_context *ctx )
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
/**********************************************************************/
-void viaInitTriFuncs(GLcontext *ctx)
+void viaInitTriFuncs(struct gl_context *ctx)
{
struct via_context *vmesa = VIA_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
#include "main/mtypes.h"
extern void viaPrintRenderState(const char *msg, GLuint state);
-extern void viaInitTriFuncs(GLcontext *ctx);
-extern void viaRasterPrimitive(GLcontext *ctx, GLenum rPrim, GLuint hwPrim);
-extern void viaRasterPrimitiveFinish(GLcontext *ctx);
+extern void viaInitTriFuncs(struct gl_context *ctx);
+extern void viaRasterPrimitive(struct gl_context *ctx, GLenum rPrim, GLuint hwPrim);
+extern void viaRasterPrimitiveFinish(struct gl_context *ctx);
#endif
/**
- * Derived from Mesa's GLvisual class.
+ * Derived from Mesa's struct gl_config class.
*/
struct GLFBDevVisualRec {
- GLvisual glvisual; /* base class */
+ struct gl_config glvisual; /* base class */
struct fb_fix_screeninfo fix;
struct fb_var_screeninfo var;
int pixelFormat;
};
/**
- * Derived from Mesa's GLframebuffer class.
+ * Derived from Mesa's struct gl_framebuffer class.
*/
struct GLFBDevBufferRec {
- GLframebuffer glframebuffer; /* base class */
+ struct gl_framebuffer glframebuffer; /* base class */
GLFBDevVisualPtr visual;
struct fb_fix_screeninfo fix;
struct fb_var_screeninfo var;
};
/**
- * Derived from Mesa's GLcontext class.
+ * Derived from Mesa's struct gl_context class.
*/
struct GLFBDevContextRec {
- GLcontext glcontext; /* base class */
+ struct gl_context glcontext; /* base class */
GLFBDevVisualPtr visual;
GLFBDevBufferPtr drawBuffer;
GLFBDevBufferPtr readBuffer;
static const GLubyte *
-get_string(GLcontext *ctx, GLenum pname)
+get_string(struct gl_context *ctx, GLenum pname)
{
(void) ctx;
switch (pname) {
static void
-update_state( GLcontext *ctx, GLuint new_state )
+update_state( struct gl_context *ctx, GLuint new_state )
{
/* not much to do here - pass it on */
_swrast_InvalidateState( ctx, new_state );
static void
-get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
+get_buffer_size( struct gl_framebuffer *buffer, GLuint *width, GLuint *height )
{
const GLFBDevBufferPtr fbdevbuffer = (GLFBDevBufferPtr) buffer;
*width = fbdevbuffer->var.xres;
* framebuffer size has changed (and update corresponding state).
*/
static void
-viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
GLuint newWidth, newHeight;
- GLframebuffer *buffer;
+ struct gl_framebuffer *buffer;
buffer = ctx->WinSysDrawBuffer;
get_buffer_size( buffer, &newWidth, &newHeight );
static GLboolean
-renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
+renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
/* no-op: the renderbuffer storage is allocated just once when it's
glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share )
{
GLFBDevContextPtr ctx;
- GLcontext *glctx;
+ struct gl_context *glctx;
struct dd_function_table functions;
ASSERT(visual);
ctx->visual = visual;
/* Create module contexts */
- glctx = (GLcontext *) &ctx->glcontext;
+ glctx = (struct gl_context *) &ctx->glcontext;
_swrast_CreateContext( glctx );
_vbo_CreateContext( glctx );
_tnl_CreateContext( glctx );
GLFBDevContextPtr fbdevctx = glFBDevGetCurrentContext();
if (context) {
- GLcontext *mesaCtx = &context->glcontext;
+ struct gl_context *mesaCtx = &context->glcontext;
_swsetup_DestroyContext( mesaCtx );
_swrast_DestroyContext( mesaCtx );
/**
- * OSMesa rendering context, derived from core Mesa GLcontext.
+ * OSMesa rendering context, derived from core Mesa struct gl_context.
*/
struct osmesa_context
{
- GLcontext mesa; /*< Base class - this must be first */
- GLvisual *gl_visual; /*< Describes the buffers */
+ struct gl_context mesa; /*< Base class - this must be first */
+ struct gl_config *gl_visual; /*< Describes the buffers */
struct gl_renderbuffer *rb; /*< The user's colorbuffer */
- GLframebuffer *gl_buffer; /*< The framebuffer, containing user's rb */
+ struct gl_framebuffer *gl_buffer; /*< The framebuffer, containing user's rb */
GLenum format; /*< User-specified context format */
GLint userRowLength; /*< user-specified number of pixels per row */
GLint rInd, gInd, bInd, aInd;/*< index offsets for RGBA formats */
static INLINE OSMesaContext
-OSMESA_CONTEXT(GLcontext *ctx)
+OSMESA_CONTEXT(struct gl_context *ctx)
{
/* Just cast, since we're using structure containment */
return (OSMesaContext) ctx;
static const GLubyte *
-get_string( GLcontext *ctx, GLenum name )
+get_string( struct gl_context *ctx, GLenum name )
{
(void) ctx;
switch (name) {
static void
-osmesa_update_state( GLcontext *ctx, GLuint new_state )
+osmesa_update_state( struct gl_context *ctx, GLuint new_state )
{
/* easy - just propogate */
_swrast_InvalidateState( ctx, new_state );
* function. Otherwise, return NULL.
*/
static swrast_line_func
-osmesa_choose_line_function( GLcontext *ctx )
+osmesa_choose_line_function( struct gl_context *ctx )
{
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
* Return pointer to an optimized triangle function if possible.
*/
static swrast_tri_func
-osmesa_choose_triangle_function( GLcontext *ctx )
+osmesa_choose_triangle_function( struct gl_context *ctx )
{
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
* standard swrast functions.
*/
static void
-osmesa_choose_triangle( GLcontext *ctx )
+osmesa_choose_triangle( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
}
static void
-osmesa_choose_line( GLcontext *ctx )
+osmesa_choose_line( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
* Just set up all the gl_renderbuffer methods.
*/
static GLboolean
-osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
+osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
const OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
* Allocate a new renderbuffer to describe the user-provided color buffer.
*/
static struct gl_renderbuffer *
-new_osmesa_renderbuffer(GLcontext *ctx, GLenum format, GLenum type)
+new_osmesa_renderbuffer(struct gl_context *ctx, GLenum format, GLenum type)
{
const GLuint name = 0;
struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, name);
if (!_mesa_initialize_context(&osmesa->mesa,
osmesa->gl_visual,
sharelist ? &sharelist->mesa
- : (GLcontext *) NULL,
+ : (struct gl_context *) NULL,
&functions, (void *) osmesa)) {
_mesa_destroy_visual( osmesa->gl_visual );
free(osmesa);
/* Initialize the software rasterizer and helper modules. */
{
- GLcontext *ctx = &osmesa->mesa;
+ struct gl_context *ctx = &osmesa->mesa;
SWcontext *swrast;
TNLcontext *tnl;
GLAPI OSMesaContext GLAPIENTRY
OSMesaGetCurrentContext( void )
{
- GLcontext *ctx = _mesa_get_current_context();
+ struct gl_context *ctx = _mesa_get_current_context();
if (ctx)
return (OSMesaContext) ctx;
else
* given HDC (Window handle).
*/
WMesaFramebuffer
-wmesa_new_framebuffer(HDC hdc, GLvisual *visual)
+wmesa_new_framebuffer(HDC hdc, struct gl_config *visual)
{
WMesaFramebuffer pwfb
= (WMesaFramebuffer) malloc(sizeof(struct wmesa_framebuffer));
/**
- * Given a GLframebuffer, return the corresponding WMesaFramebuffer.
+ * Given a struct gl_framebuffer, return the corresponding WMesaFramebuffer.
*/
-static WMesaFramebuffer wmesa_framebuffer(GLframebuffer *fb)
+static WMesaFramebuffer wmesa_framebuffer(struct gl_framebuffer *fb)
{
return (WMesaFramebuffer) fb;
}
/**
- * Given a GLcontext, return the corresponding WMesaContext.
+ * Given a struct gl_context, return the corresponding WMesaContext.
*/
-static WMesaContext wmesa_context(const GLcontext *ctx)
+static WMesaContext wmesa_context(const struct gl_context *ctx)
{
return (WMesaContext) ctx;
}
* Every driver should implement a GetString function in order to
* return a meaningful GL_RENDERER string.
*/
-static const GLubyte *wmesa_get_string(GLcontext *ctx, GLenum name)
+static const GLubyte *wmesa_get_string(struct gl_context *ctx, GLenum name)
{
return (name == GL_RENDERER) ?
(GLubyte *) "Mesa Windows GDI Driver" : NULL;
static void
-wmesa_get_buffer_size(GLframebuffer *buffer, GLuint *width, GLuint *height)
+wmesa_get_buffer_size(struct gl_framebuffer *buffer, GLuint *width, GLuint *height)
{
WMesaFramebuffer pwfb = wmesa_framebuffer(buffer);
get_window_size(pwfb->hDC, width, height);
}
-static void wmesa_flush(GLcontext *ctx)
+static void wmesa_flush(struct gl_context *ctx)
{
WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->WinSysDrawBuffer);
/*
* Set the color used to clear the color buffer.
*/
-static void clear_color(GLcontext *ctx, const GLfloat color[4])
+static void clear_color(struct gl_context *ctx, const GLfloat color[4])
{
WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
* Clearing of the other non-color buffers is left to the swrast.
*/
-static void clear(GLcontext *ctx, GLbitfield mask)
+static void clear(struct gl_context *ctx, GLbitfield mask)
{
#define FLIP(Y) (ctx->DrawBuffer->Height - (Y) - 1)
const GLint x = ctx->DrawBuffer->_Xmin;
**/
/* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span_front(const GLcontext *ctx,
+static void write_rgba_span_front(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLubyte rgba[][4],
}
/* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span_front(const GLcontext *ctx,
+static void write_rgb_span_front(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLubyte rgb[][3],
* Write a horizontal span of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_span_front(const GLcontext *ctx,
+static void write_mono_rgba_span_front(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLchan color[4],
}
/* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels_front(const GLcontext *ctx,
+static void write_rgba_pixels_front(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
* Write an array of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_pixels_front(const GLcontext *ctx,
+static void write_mono_rgba_pixels_front(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
}
/* Read a horizontal span of color pixels. */
-static void read_rgba_span_front(const GLcontext *ctx,
+static void read_rgba_span_front(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
GLubyte rgba[][4] )
/* Read an array of color pixels. */
-static void read_rgba_pixels_front(const GLcontext *ctx,
+static void read_rgba_pixels_front(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4])
/* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span_32(const GLcontext *ctx,
+static void write_rgba_span_32(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLubyte rgba[][4],
/* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span_32(const GLcontext *ctx,
+static void write_rgb_span_32(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLubyte rgb[][3],
* Write a horizontal span of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_span_32(const GLcontext *ctx,
+static void write_mono_rgba_span_32(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLchan color[4],
}
/* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels_32(const GLcontext *ctx,
+static void write_rgba_pixels_32(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
const GLubyte rgba[][4],
* Write an array of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_pixels_32(const GLcontext *ctx,
+static void write_mono_rgba_pixels_32(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
}
/* Read a horizontal span of color pixels. */
-static void read_rgba_span_32(const GLcontext *ctx,
+static void read_rgba_span_32(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
GLubyte rgba[][4] )
/* Read an array of color pixels. */
-static void read_rgba_pixels_32(const GLcontext *ctx,
+static void read_rgba_pixels_32(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4])
lpb[2] = (r); }
/* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span_24(const GLcontext *ctx,
+static void write_rgba_span_24(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLubyte rgba[][4],
/* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span_24(const GLcontext *ctx,
+static void write_rgb_span_24(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLubyte rgb[][3],
* Write a horizontal span of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_span_24(const GLcontext *ctx,
+static void write_mono_rgba_span_24(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLchan color[4],
}
/* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels_24(const GLcontext *ctx,
+static void write_rgba_pixels_24(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
const GLubyte rgba[][4],
* Write an array of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_pixels_24(const GLcontext *ctx,
+static void write_mono_rgba_pixels_24(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
}
/* Read a horizontal span of color pixels. */
-static void read_rgba_span_24(const GLcontext *ctx,
+static void read_rgba_span_24(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
GLubyte rgba[][4] )
/* Read an array of color pixels. */
-static void read_rgba_pixels_24(const GLcontext *ctx,
+static void read_rgba_pixels_24(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4])
/* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span_16(const GLcontext *ctx,
+static void write_rgba_span_16(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLubyte rgba[][4],
/* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span_16(const GLcontext *ctx,
+static void write_rgb_span_16(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLubyte rgb[][3],
* Write a horizontal span of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_span_16(const GLcontext *ctx,
+static void write_mono_rgba_span_16(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLchan color[4],
}
/* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels_16(const GLcontext *ctx,
+static void write_rgba_pixels_16(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
const GLubyte rgba[][4],
* Write an array of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_pixels_16(const GLcontext *ctx,
+static void write_mono_rgba_pixels_16(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
}
/* Read a horizontal span of color pixels. */
-static void read_rgba_span_16(const GLcontext *ctx,
+static void read_rgba_span_16(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
GLubyte rgba[][4] )
/* Read an array of color pixels. */
-static void read_rgba_pixels_16(const GLcontext *ctx,
+static void read_rgba_pixels_16(const struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4])
* has changed. Do whatever's needed to cope with that.
*/
static GLboolean
-wmesa_renderbuffer_storage(GLcontext *ctx,
+wmesa_renderbuffer_storage(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width,
* Resize the front/back colorbuffers to match the latest window size.
*/
static void
-wmesa_resize_buffers(GLcontext *ctx, GLframebuffer *buffer,
+wmesa_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *buffer,
GLuint width, GLuint height)
{
WMesaContext pwc = wmesa_context(ctx);
* we get the viewport set correctly, even if the app does not call
* glViewport and relies on the defaults.
*/
-static void wmesa_viewport(GLcontext *ctx,
+static void wmesa_viewport(struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height)
{
* Called when the driver should update it's state, based on the new_state
* flags.
*/
-static void wmesa_update_state(GLcontext *ctx, GLuint new_state)
+static void wmesa_update_state(struct gl_context *ctx, GLuint new_state)
{
_swrast_InvalidateState(ctx, new_state);
_swsetup_InvalidateState(ctx, new_state);
WMesaContext c;
struct dd_function_table functions;
GLint red_bits, green_bits, blue_bits, alpha_bits;
- GLcontext *ctx;
- GLvisual *visual;
+ struct gl_context *ctx;
+ struct gl_config *visual;
(void) Pal;
void WMesaDestroyContext( WMesaContext pwc )
{
- GLcontext *ctx = &pwc->gl_ctx;
+ struct gl_context *ctx = &pwc->gl_ctx;
WMesaFramebuffer pwfb;
GET_CURRENT_CONTEXT(cur_ctx);
/* Lazy creation of framebuffers */
if (c && !pwfb && hdc) {
struct gl_renderbuffer *rb;
- GLvisual *visual = &c->gl_ctx.Visual;
+ struct gl_config *visual = &c->gl_ctx.Visual;
GLuint width, height;
get_window_size(hdc, &width, &height);
/**
- * The Windows Mesa rendering context, derived from GLcontext.
+ * The Windows Mesa rendering context, derived from struct gl_context.
*/
struct wmesa_context {
- GLcontext gl_ctx; /* The core GL/Mesa context */
+ struct gl_context gl_ctx; /* The core GL/Mesa context */
HDC hDC;
COLORREF clearColorRef;
HPEN clearPen;
#ifdef _USE_GLD3_WGL
#include "gld_driver.h"
-extern void _gld_mesa_warning(GLcontext *, char *);
-extern void _gld_mesa_fatal(GLcontext *, char *);
+extern void _gld_mesa_warning(struct gl_context *, char *);
+extern void _gld_mesa_fatal(struct gl_context *, char *);
#endif // _USE_GLD3_WGL
// TODO: Clean out old DX6-specific code from GLD 2.x CAD driver
void *glPriv;
// Mesa vars:
- GLcontext *glCtx; // The core Mesa context
- GLvisual *glVis; // Describes the color buffer
- GLframebuffer *glBuffer; // Ancillary buffers
+ struct gl_context *glCtx; // The core Mesa context
+ struct gl_config *glVis; // Describes the color buffer
+ struct gl_framebuffer *glBuffer; // Ancillary buffers
GLuint ClearIndex;
GLuint CurrentIndex;
//
// Mesa context vars:
//
- GLcontext *glCtx; // The core Mesa context
- GLvisual *glVis; // Describes the color buffer
- GLframebuffer *glBuffer; // Ancillary buffers
+ struct gl_context *glCtx; // The core Mesa context
+ struct gl_config *glVis; // Describes the color buffer
+ struct gl_framebuffer *glBuffer; // Ancillary buffers
GLuint ClearIndex;
GLuint CurrentIndex;
// Copied from GLD2.x. KeithH
//
static GLboolean _gldShareLists(
- GLcontext *ctx1,
- GLcontext *ctx2)
+ struct gl_context *ctx1,
+ struct gl_context *ctx2)
{
/* Sanity check context pointers */
if (ctx1 == NULL || ctx2 == NULL)
// either MESA glViewport() or GLD wglMakeCurrent().
BOOL dglWglResizeBuffers(
- GLcontext *ctx,
+ struct gl_context *ctx,
BOOL bDefaultDriver)
{
DGL_ctx *dgl = NULL;
BOOL APIENTRY DGL_UseFontOutlinesW(HDC a, DWORD b, DWORD c, DWORD d, FLOAT e, FLOAT f, int g, LPGLYPHMETRICSFLOAT h);
#endif //_USE_GLD3_WGL
-BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver);
+BOOL dglWglResizeBuffers(struct gl_context *ctx, BOOL bDefaultDriver);
#ifdef __cplusplus
}
//---------------------------------------------------------------------------
void _gld_mesa_warning(
- __GLcontext *gc,
+ __struct gl_context *gc,
char *str)
{
// Intercept Mesa's internal warning mechanism
//---------------------------------------------------------------------------
void _gld_mesa_fatal(
- __GLcontext *gc,
+ __struct gl_context *gc,
char *str)
{
// Intercept Mesa's internal fatal-message mechanism
//---------------------------------------------------------------------------
void gld_Noop_DX7(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
#ifdef _DEBUG
gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n");
//---------------------------------------------------------------------------
void gld_Error_DX7(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
#ifdef _DEBUG
// Quite useless.
//---------------------------------------------------------------------------
static GLboolean gld_set_draw_buffer_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum mode)
{
(void) ctx;
//---------------------------------------------------------------------------
static void gld_set_read_buffer_DX7(
- GLcontext *ctx,
- GLframebuffer *buffer,
+ struct gl_context *ctx,
+ struct gl_framebuffer *buffer,
GLenum mode)
{
/* separate read buffer not supported */
//---------------------------------------------------------------------------
void gld_Clear_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLbitfield mask,
GLboolean all,
GLint x,
// Mesa 5: Parameter change
static void gld_buffer_size_DX7(
-// GLcontext *ctx,
- GLframebuffer *fb,
+// struct gl_context *ctx,
+ struct gl_framebuffer *fb,
GLuint *width,
GLuint *height)
{
//---------------------------------------------------------------------------
static void gld_Finish_DX7(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
}
//---------------------------------------------------------------------------
static void gld_Flush_DX7(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gld = GLD_GET_CONTEXT(ctx);
//---------------------------------------------------------------------------
void gld_NEW_STENCIL(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_COLOR(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_DEPTH(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_POLYGON(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_FOG(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_LIGHT(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_MODELVIEW(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_PROJECTION(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_VIEWPORT(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
//---------------------------------------------------------------------------
__inline BOOL _gldAnyEvalEnabled(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
struct gl_eval_attrib *eval = &ctx->Eval;
//---------------------------------------------------------------------------
BOOL _gldChooseInternalPipeline(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLD_driver_dx7 *gld)
{
// return TRUE; // DEBUGGING: ALWAYS USE MESA
//---------------------------------------------------------------------------
void gld_update_state_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint new_state)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
//---------------------------------------------------------------------------
void gld_Viewport_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint x,
GLint y,
GLsizei w,
//---------------------------------------------------------------------------
-extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver);
+extern BOOL dglWglResizeBuffers(struct gl_context *ctx, BOOL bDefaultDriver);
// Mesa 5: Parameter change
void gldResizeBuffers_DX7(
-// GLcontext *ctx)
- GLframebuffer *fb)
+// struct gl_context *ctx)
+ struct gl_framebuffer *fb)
{
GET_CURRENT_CONTEXT(ctx);
dglWglResizeBuffers(ctx, TRUE);
// This is only for debugging.
// To use, plug into ctx->Driver.Enable pointer below.
void gld_Enable(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum e,
GLboolean b)
{
// Driver pointer setup
//---------------------------------------------------------------------------
-extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum);
+extern const GLubyte* _gldGetStringGeneric(struct gl_context*, GLenum);
void gldSetupDriverPointers_DX7(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx7 *gld = GLD_GET_DX7_DRIVER(gldCtx);
//---------------------------------------------------------------------------
PROC gldGetProcAddress_DX7(LPCSTR a);
-void gldEnableExtensions_DX7(GLcontext *ctx);
-void gldInstallPipeline_DX7(GLcontext *ctx);
-void gldSetupDriverPointers_DX7(GLcontext *ctx);
-void gldResizeBuffers_DX7(GLframebuffer *fb);
+void gldEnableExtensions_DX7(struct gl_context *ctx);
+void gldInstallPipeline_DX7(struct gl_context *ctx);
+void gldSetupDriverPointers_DX7(struct gl_context *ctx);
+void gldResizeBuffers_DX7(struct gl_framebuffer *fb);
// Texture functions
-void gldCopyTexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
-void gldCopyTexImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-void gldCopyTexSubImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
-void gldCopyTexSubImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-void gldCopyTexSubImage3D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-
-void gld_NEW_TEXTURE_DX7(GLcontext *ctx);
-void gld_DrawPixels_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels);
-void gld_ReadPixels_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest);
-void gld_CopyPixels_DX7(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type);
-void gld_Bitmap_DX7(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
-const struct gl_texture_format* gld_ChooseTextureFormat_DX7(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType);
-void gld_TexImage2D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage);
-void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage2D_DX7( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage1D_DX7(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage);
-void gld_DeleteTexture_DX7(GLcontext *ctx, struct gl_texture_object *tObj);
-void gld_ResetLineStipple_DX7(GLcontext *ctx);
+void gldCopyTexImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
+void gldCopyTexImage2D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+void gldCopyTexSubImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
+void gldCopyTexSubImage2D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
+void gldCopyTexSubImage3D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
+
+void gld_NEW_TEXTURE_DX7(struct gl_context *ctx);
+void gld_DrawPixels_DX7(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels);
+void gld_ReadPixels_DX7(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest);
+void gld_CopyPixels_DX7(struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type);
+void gld_Bitmap_DX7(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
+const struct gl_texture_format* gld_ChooseTextureFormat_DX7(struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType);
+void gld_TexImage2D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage);
+void gld_TexImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
+void gld_TexSubImage2D_DX7( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
+void gld_TexSubImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage);
+void gld_DeleteTexture_DX7(struct gl_context *ctx, struct gl_texture_object *tObj);
+void gld_ResetLineStipple_DX7(struct gl_context *ctx);
// 2D primitive functions
-void gld_Points2D_DX7(GLcontext *ctx, GLuint first, GLuint last);
+void gld_Points2D_DX7(struct gl_context *ctx, GLuint first, GLuint last);
-void gld_Line2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
+void gld_Line2DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Line2DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1);
-void gld_Triangle2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DFlatExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DFlatExtras_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DSmoothExtras_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad2DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DFlatExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothExtras_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DFlatExtras_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DSmoothExtras_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
// 3D primitive functions
-void gld_Points3D_DX7(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DFlat_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Line3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DSmooth_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Points3D_DX7(struct gl_context *ctx, GLuint first, GLuint last);
+void gld_Line3DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Triangle3DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Quad3DFlat_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Line3DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Triangle3DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Quad3DSmooth_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
// Primitive functions for Two-sided-lighting Vertex Shader
-void gld_Points2DTwoside_DX7(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad2DFlatTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothTwoside_DX7(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Points2DTwoside_DX7(struct gl_context *ctx, GLuint first, GLuint last);
+void gld_Line2DFlatTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Line2DSmoothTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Triangle2DFlatTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DSmoothTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Quad2DFlatTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DSmoothTwoside_DX7(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
#endif
#include "extensions.h"
// For some reason this is not defined in an above header...
-extern void _mesa_enable_imaging_extensions(GLcontext *ctx);
+extern void _mesa_enable_imaging_extensions(struct gl_context *ctx);
//---------------------------------------------------------------------------
// Hack for the SGIS_multitexture extension that was removed from Mesa
//---------------------------------------------------------------------------
void gldEnableExtensions_DX7(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLuint i;
//---------------------------------------------------------------------------
void gldInstallPipeline_DX7(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
// Remove any existing pipeline stages,
// then install GLDirect pipeline stages.
//---------------------------------------------------------------------------
__inline DWORD _gldComputeFog(
- GLcontext *ctx,
+ struct gl_context *ctx,
SWvertex *swv)
{
// Full fog calculation.
//---------------------------------------------------------------------------
void gld_ResetLineStipple_DX7(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
// TODO: Fake stipple with a 32x32 texture.
}
//---------------------------------------------------------------------------
void gld_Points2D_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint first,
GLuint last)
{
//---------------------------------------------------------------------------
void gld_Line2DFlat_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1)
{
//---------------------------------------------------------------------------
void gld_Line2DSmooth_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1)
{
//---------------------------------------------------------------------------
void gld_Triangle2DFlat_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Triangle2DSmooth_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Triangle2DFlatExtras_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Triangle2DSmoothExtras_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Quad2DFlat_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Quad2DSmooth_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Quad2DFlatExtras_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Quad2DSmoothExtras_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Points3D_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint first,
GLuint last)
{
//---------------------------------------------------------------------------
void gld_Line3DFlat_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1)
{
//---------------------------------------------------------------------------
void gld_Line3DSmooth_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1)
{
//---------------------------------------------------------------------------
void gld_Triangle3DFlat_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Triangle3DSmooth_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Quad3DFlat_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Quad3DSmooth_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
/*
-void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last)
+void gld_Points2DTwoside_DX8(struct gl_context *ctx, GLuint first, GLuint last)
{
// NOTE: Two-sided lighting does not apply to Points
}
//---------------------------------------------------------------------------
-void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1)
+void gld_Line2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1)
{
// NOTE: Two-sided lighting does not apply to Lines
}
//---------------------------------------------------------------------------
-void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1)
+void gld_Line2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1)
{
// NOTE: Two-sided lighting does not apply to Lines
}
//---------------------------------------------------------------------------
-void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
+void gld_Triangle2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2)
{
}
//---------------------------------------------------------------------------
-void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
+void gld_Triangle2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
-void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+void gld_Quad2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
-void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+void gld_Quad2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gldCopyTexImage1D_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y,
//---------------------------------------------------------------------------
void gldCopyTexImage2D_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLenum internalFormat,
//---------------------------------------------------------------------------
void gldCopyTexSubImage1D_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target, GLint level,
GLint xoffset, GLint x, GLint y, GLsizei width )
{
//---------------------------------------------------------------------------
void gldCopyTexSubImage2D_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset,
//---------------------------------------------------------------------------
void gldCopyTexSubImage3D_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset,
//---------------------------------------------------------------------------
HRESULT _gldDrawPixels(
- GLcontext *ctx,
+ struct gl_context *ctx,
BOOL bChromakey, // Alpha test for glBitmap() images
GLint x, // GL x position
GLint y, // GL y position (needs flipping)
//---------------------------------------------------------------------------
void gld_DrawPixels_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
//---------------------------------------------------------------------------
void gld_ReadPixels_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack,
//---------------------------------------------------------------------------
void gld_CopyPixels_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint srcx,
GLint srcy,
GLsizei width,
//---------------------------------------------------------------------------
void gld_Bitmap_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint x,
GLint y,
GLsizei width,
//---------------------------------------------------------------------------
void _gldAllocateTexture(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct gl_texture_object *tObj,
struct gl_texture_image *texImage)
{
//---------------------------------------------------------------------------
const struct gl_texture_format* gld_ChooseTextureFormat_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint internalFormat,
GLenum srcFormat,
GLenum srcType)
/*
// Safer(?), slower version.
void gld_TexImage2D_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLint internalFormat,
// Faster, more efficient version.
// Copies subimage straight to dest texture
void gld_TexImage2D_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLint internalFormat,
//---------------------------------------------------------------------------
-void gld_TexImage1D_DX7(GLcontext *ctx, GLenum target, GLint level,
+void gld_TexImage1D_DX7(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
//---------------------------------------------------------------------------
/*
-void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
+void gld_TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
// Faster, more efficient version.
// Copies subimage straight to dest texture
-void gld_TexSubImage2D_DX7( GLcontext *ctx, GLenum target, GLint level,
+void gld_TexSubImage2D_DX7( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
//---------------------------------------------------------------------------
-void gld_TexSubImage1D_DX7( GLcontext *ctx, GLenum target, GLint level,
+void gld_TexSubImage1D_DX7( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLsizei width,
GLenum format, GLenum type,
const GLvoid *pixels,
//---------------------------------------------------------------------------
void gld_DeleteTexture_DX7(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct gl_texture_object *tObj)
{
GLD_context *gld = (GLD_context*)(ctx->DriverCtx);
//---------------------------------------------------------------------------
void gldUpdateTextureUnit(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint unit,
BOOL bPassThrough)
{
//---------------------------------------------------------------------------
void gld_NEW_TEXTURE_DX7(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
// TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units
//---------------------------------------------------------------------------
/*
__inline void _gldSetVertexShaderConstants(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLD_driver_dx8 *gld)
{
D3DXMATRIX mat, matView, matProj;
//---------------------------------------------------------------------------
static GLboolean gld_d3d_render_stage_run(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct tnl_pipeline_stage *stage)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
/* TODO: do this for all primitives, verts and elts:
*/
-static void clip_elt_triangles( GLcontext *ctx,
+static void clip_elt_triangles( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
/* Helper functions for drivers */
/**********************************************************************/
/*
-void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n )
+void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
VB->Elts = tmp;
}
-void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
+void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.Line( ctx, ii, jj );
//---------------------------------------------------------------------------
static GLboolean _gld_mesa_render_stage_run(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct tnl_pipeline_stage *stage)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
#define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL
-extern void _gld_mesa_warning(GLcontext *, char *);
-extern void _gld_mesa_fatal(GLcontext *, char *);
+extern void _gld_mesa_warning(struct gl_context *, char *);
+extern void _gld_mesa_fatal(struct gl_context *, char *);
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
HRESULT _gldCreatePrimitiveBuffer(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLD_driver_dx7 *lpCtx,
GLD_pb_dx7 *gldVB)
{
//---------------------------------------------------------------------------
void _gld_mesa_warning(
- __GLcontext *gc,
+ __struct gl_context *gc,
char *str)
{
// Intercept Mesa's internal warning mechanism
//---------------------------------------------------------------------------
void _gld_mesa_fatal(
- __GLcontext *gc,
+ __struct gl_context *gc,
char *str)
{
// Intercept Mesa's internal fatal-message mechanism
//---------------------------------------------------------------------------
void gld_Noop_DX8(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
#ifdef _DEBUG
gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n");
//---------------------------------------------------------------------------
void gld_Error_DX8(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
#ifdef _DEBUG
// Quite useless.
//---------------------------------------------------------------------------
static GLboolean gld_set_draw_buffer_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum mode)
{
(void) ctx;
//---------------------------------------------------------------------------
static void gld_set_read_buffer_DX8(
- GLcontext *ctx,
- GLframebuffer *buffer,
+ struct gl_context *ctx,
+ struct gl_framebuffer *buffer,
GLenum mode)
{
/* separate read buffer not supported */
//---------------------------------------------------------------------------
void gld_Clear_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLbitfield mask,
GLboolean all,
GLint x,
// Mesa 5: Parameter change
static void gld_buffer_size_DX8(
-// GLcontext *ctx,
- GLframebuffer *fb,
+// struct gl_context *ctx,
+ struct gl_framebuffer *fb,
GLuint *width,
GLuint *height)
{
//---------------------------------------------------------------------------
static void gld_Finish_DX8(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
}
//---------------------------------------------------------------------------
static void gld_Flush_DX8(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gld = GLD_GET_CONTEXT(ctx);
//---------------------------------------------------------------------------
void gld_NEW_STENCIL(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_COLOR(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_DEPTH(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_POLYGON(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_FOG(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_LIGHT(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_MODELVIEW(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_PROJECTION(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_VIEWPORT(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
__inline BOOL _gldAnyEvalEnabled(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
struct gl_eval_attrib *eval = &ctx->Eval;
//---------------------------------------------------------------------------
BOOL _gldChooseInternalPipeline(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLD_driver_dx8 *gld)
{
// return TRUE; // DEBUGGING: ALWAYS USE MESA
//---------------------------------------------------------------------------
void gld_update_state_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint new_state)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
//---------------------------------------------------------------------------
void gld_Viewport_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint x,
GLint y,
GLsizei w,
//---------------------------------------------------------------------------
-extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver);
+extern BOOL dglWglResizeBuffers(struct gl_context *ctx, BOOL bDefaultDriver);
// Mesa 5: Parameter change
void gldResizeBuffers_DX8(
-// GLcontext *ctx)
- GLframebuffer *fb)
+// struct gl_context *ctx)
+ struct gl_framebuffer *fb)
{
GET_CURRENT_CONTEXT(ctx);
dglWglResizeBuffers(ctx, TRUE);
// This is only for debugging.
// To use, plug into ctx->Driver.Enable pointer below.
void gld_Enable(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum e,
GLboolean b)
{
// Driver pointer setup
//---------------------------------------------------------------------------
-extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum);
+extern const GLubyte* _gldGetStringGeneric(struct gl_context*, GLenum);
void gldSetupDriverPointers_DX8(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
PROC gldGetProcAddress_DX8(LPCSTR a);
-void gldEnableExtensions_DX8(GLcontext *ctx);
-void gldInstallPipeline_DX8(GLcontext *ctx);
-void gldSetupDriverPointers_DX8(GLcontext *ctx);
-//void gldResizeBuffers_DX8(GLcontext *ctx);
-void gldResizeBuffers_DX8(GLframebuffer *fb);
+void gldEnableExtensions_DX8(struct gl_context *ctx);
+void gldInstallPipeline_DX8(struct gl_context *ctx);
+void gldSetupDriverPointers_DX8(struct gl_context *ctx);
+//void gldResizeBuffers_DX8(struct gl_context *ctx);
+void gldResizeBuffers_DX8(struct gl_framebuffer *fb);
// Texture functions
-void gldCopyTexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
-void gldCopyTexImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-void gldCopyTexSubImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
-void gldCopyTexSubImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-void gldCopyTexSubImage3D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-
-void gld_NEW_TEXTURE_DX8(GLcontext *ctx);
-void gld_DrawPixels_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels);
-void gld_ReadPixels_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest);
-void gld_CopyPixels_DX8(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type);
-void gld_Bitmap_DX8(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
-const struct gl_texture_format* gld_ChooseTextureFormat_DX8(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType);
-void gld_TexImage2D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage);
-void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage2D_DX8( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage1D_DX8(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage);
-void gld_DeleteTexture_DX8(GLcontext *ctx, struct gl_texture_object *tObj);
-void gld_ResetLineStipple_DX8(GLcontext *ctx);
+void gldCopyTexImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
+void gldCopyTexImage2D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+void gldCopyTexSubImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
+void gldCopyTexSubImage2D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
+void gldCopyTexSubImage3D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
+
+void gld_NEW_TEXTURE_DX8(struct gl_context *ctx);
+void gld_DrawPixels_DX8(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels);
+void gld_ReadPixels_DX8(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest);
+void gld_CopyPixels_DX8(struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type);
+void gld_Bitmap_DX8(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
+const struct gl_texture_format* gld_ChooseTextureFormat_DX8(struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType);
+void gld_TexImage2D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage);
+void gld_TexImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
+void gld_TexSubImage2D_DX8( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
+void gld_TexSubImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage);
+void gld_DeleteTexture_DX8(struct gl_context *ctx, struct gl_texture_object *tObj);
+void gld_ResetLineStipple_DX8(struct gl_context *ctx);
// 2D primitive functions
-void gld_Points2D_DX8(GLcontext *ctx, GLuint first, GLuint last);
+void gld_Points2D_DX8(struct gl_context *ctx, GLuint first, GLuint last);
-void gld_Line2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
+void gld_Line2DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Line2DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1);
-void gld_Triangle2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DFlatExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DFlatExtras_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DSmoothExtras_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad2DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DFlatExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothExtras_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DFlatExtras_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DSmoothExtras_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
// 3D primitive functions
-void gld_Points3D_DX8(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DFlat_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Line3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DSmooth_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Points3D_DX8(struct gl_context *ctx, GLuint first, GLuint last);
+void gld_Line3DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Triangle3DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Quad3DFlat_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Line3DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Triangle3DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Quad3DSmooth_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
// Primitive functions for Two-sided-lighting Vertex Shader
-void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Points2DTwoside_DX8(struct gl_context *ctx, GLuint first, GLuint last);
+void gld_Line2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Line2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Triangle2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Quad2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
#endif
#include "extensions.h"
// For some reason this is not defined in an above header...
-extern void _mesa_enable_imaging_extensions(GLcontext *ctx);
+extern void _mesa_enable_imaging_extensions(struct gl_context *ctx);
//---------------------------------------------------------------------------
// Hack for the SGIS_multitexture extension that was removed from Mesa
//---------------------------------------------------------------------------
void gldEnableExtensions_DX8(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLuint i;
//---------------------------------------------------------------------------
void gldInstallPipeline_DX8(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
// Remove any existing pipeline stages,
// then install GLDirect pipeline stages.
//---------------------------------------------------------------------------
__inline DWORD _gldComputeFog(
- GLcontext *ctx,
+ struct gl_context *ctx,
SWvertex *swv)
{
// Full fog calculation.
//---------------------------------------------------------------------------
void gld_ResetLineStipple_DX8(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
// TODO: Fake stipple with a 32x32 texture.
}
//---------------------------------------------------------------------------
void gld_Points2D_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint first,
GLuint last)
{
//---------------------------------------------------------------------------
void gld_Line2DFlat_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1)
{
//---------------------------------------------------------------------------
void gld_Line2DSmooth_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1)
{
//---------------------------------------------------------------------------
void gld_Triangle2DFlat_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Triangle2DSmooth_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Triangle2DFlatExtras_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Triangle2DSmoothExtras_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Quad2DFlat_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Quad2DSmooth_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Quad2DFlatExtras_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Quad2DSmoothExtras_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Points3D_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint first,
GLuint last)
{
//---------------------------------------------------------------------------
void gld_Line3DFlat_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1)
{
//---------------------------------------------------------------------------
void gld_Line3DSmooth_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1)
{
//---------------------------------------------------------------------------
void gld_Triangle3DFlat_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Triangle3DSmooth_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Quad3DFlat_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Quad3DSmooth_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
/*
-void gld_Points2DTwoside_DX8(GLcontext *ctx, GLuint first, GLuint last)
+void gld_Points2DTwoside_DX8(struct gl_context *ctx, GLuint first, GLuint last)
{
// NOTE: Two-sided lighting does not apply to Points
}
//---------------------------------------------------------------------------
-void gld_Line2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1)
+void gld_Line2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1)
{
// NOTE: Two-sided lighting does not apply to Lines
}
//---------------------------------------------------------------------------
-void gld_Line2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1)
+void gld_Line2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1)
{
// NOTE: Two-sided lighting does not apply to Lines
}
//---------------------------------------------------------------------------
-void gld_Triangle2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
+void gld_Triangle2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2)
{
}
//---------------------------------------------------------------------------
-void gld_Triangle2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
+void gld_Triangle2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
-void gld_Quad2DFlatTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+void gld_Quad2DFlatTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
-void gld_Quad2DSmoothTwoside_DX8(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+void gld_Quad2DSmoothTwoside_DX8(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx8 *gld = GLD_GET_DX8_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gldCopyTexImage1D_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y,
//---------------------------------------------------------------------------
void gldCopyTexImage2D_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLenum internalFormat,
//---------------------------------------------------------------------------
void gldCopyTexSubImage1D_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target, GLint level,
GLint xoffset, GLint x, GLint y, GLsizei width )
{
//---------------------------------------------------------------------------
void gldCopyTexSubImage2D_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset,
//---------------------------------------------------------------------------
void gldCopyTexSubImage3D_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset,
//---------------------------------------------------------------------------
HRESULT _gldDrawPixels(
- GLcontext *ctx,
+ struct gl_context *ctx,
BOOL bChromakey, // Alpha test for glBitmap() images
GLint x, // GL x position
GLint y, // GL y position (needs flipping)
//---------------------------------------------------------------------------
void gld_DrawPixels_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
//---------------------------------------------------------------------------
void gld_ReadPixels_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack,
//---------------------------------------------------------------------------
void gld_CopyPixels_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint srcx,
GLint srcy,
GLsizei width,
//---------------------------------------------------------------------------
void gld_Bitmap_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint x,
GLint y,
GLsizei width,
//---------------------------------------------------------------------------
void _gldAllocateTexture(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct gl_texture_object *tObj,
struct gl_texture_image *texImage)
{
//---------------------------------------------------------------------------
const struct gl_texture_format* gld_ChooseTextureFormat_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint internalFormat,
GLenum srcFormat,
GLenum srcType)
/*
// Safer(?), slower version.
void gld_TexImage2D_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLint internalFormat,
// Faster, more efficient version.
// Copies subimage straight to dest texture
void gld_TexImage2D_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLint internalFormat,
//---------------------------------------------------------------------------
-void gld_TexImage1D_DX8(GLcontext *ctx, GLenum target, GLint level,
+void gld_TexImage1D_DX8(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
//---------------------------------------------------------------------------
/*
-void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
+void gld_TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
// Faster, more efficient version.
// Copies subimage straight to dest texture
-void gld_TexSubImage2D_DX8( GLcontext *ctx, GLenum target, GLint level,
+void gld_TexSubImage2D_DX8( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
//---------------------------------------------------------------------------
-void gld_TexSubImage1D_DX8( GLcontext *ctx, GLenum target, GLint level,
+void gld_TexSubImage1D_DX8( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLsizei width,
GLenum format, GLenum type,
const GLvoid *pixels,
//---------------------------------------------------------------------------
void gld_DeleteTexture_DX8(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct gl_texture_object *tObj)
{
GLD_context *gld = (GLD_context*)(ctx->DriverCtx);
//---------------------------------------------------------------------------
void gldUpdateTextureUnit(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint unit,
BOOL bPassThrough)
{
//---------------------------------------------------------------------------
void gld_NEW_TEXTURE_DX8(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
// TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units
//---------------------------------------------------------------------------
__inline void _gldSetVertexShaderConstants(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLD_driver_dx8 *gld)
{
D3DXMATRIX mat, matView, matProj;
//---------------------------------------------------------------------------
static GLboolean gld_d3d_render_stage_run(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct tnl_pipeline_stage *stage)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
/* TODO: do this for all primitives, verts and elts:
*/
-static void clip_elt_triangles( GLcontext *ctx,
+static void clip_elt_triangles( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
/* Helper functions for drivers */
/**********************************************************************/
/*
-void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n )
+void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
VB->Elts = tmp;
}
-void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
+void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.Line( ctx, ii, jj );
//---------------------------------------------------------------------------
static GLboolean _gld_mesa_render_stage_run(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct tnl_pipeline_stage *stage)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
#define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL
-extern void _gld_mesa_warning(GLcontext *, char *);
-extern void _gld_mesa_fatal(GLcontext *, char *);
+extern void _gld_mesa_warning(struct gl_context *, char *);
+extern void _gld_mesa_fatal(struct gl_context *, char *);
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
HRESULT _gldCreatePrimitiveBuffer(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLD_driver_dx8 *lpCtx,
GLD_pb_dx8 *gldVB)
{
//---------------------------------------------------------------------------
void _gld_mesa_warning(
- __GLcontext *gc,
+ __struct gl_context *gc,
char *str)
{
// Intercept Mesa's internal warning mechanism
//---------------------------------------------------------------------------
void _gld_mesa_fatal(
- __GLcontext *gc,
+ __struct gl_context *gc,
char *str)
{
// Intercept Mesa's internal fatal-message mechanism
//---------------------------------------------------------------------------
void gld_Noop_DX9(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
#ifdef _DEBUG
gldLogMessage(GLDLOG_ERROR, "gld_Noop called!\n");
//---------------------------------------------------------------------------
void gld_Error_DX9(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
#ifdef _DEBUG
// Quite useless.
//---------------------------------------------------------------------------
static GLboolean gld_set_draw_buffer_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum mode)
{
(void) ctx;
//---------------------------------------------------------------------------
static void gld_set_read_buffer_DX9(
- GLcontext *ctx,
- GLframebuffer *buffer,
+ struct gl_context *ctx,
+ struct gl_framebuffer *buffer,
GLenum mode)
{
/* separate read buffer not supported */
//---------------------------------------------------------------------------
void gld_Clear_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLbitfield mask,
GLboolean all,
GLint x,
// Mesa 5: Parameter change
static void gld_buffer_size_DX9(
-// GLcontext *ctx,
- GLframebuffer *fb,
+// struct gl_context *ctx,
+ struct gl_framebuffer *fb,
GLuint *width,
GLuint *height)
{
//---------------------------------------------------------------------------
static void gld_Finish_DX9(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
}
//---------------------------------------------------------------------------
static void gld_Flush_DX9(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gld = GLD_GET_CONTEXT(ctx);
//---------------------------------------------------------------------------
void gld_NEW_STENCIL(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_COLOR(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_DEPTH(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_POLYGON(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_FOG(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_LIGHT(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_MODELVIEW(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_PROJECTION(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_VIEWPORT(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gld_NEW_SCISSOR(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
__inline BOOL _gldAnyEvalEnabled(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
struct gl_eval_attrib *eval = &ctx->Eval;
//---------------------------------------------------------------------------
BOOL _gldChooseInternalPipeline(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLD_driver_dx9 *gld)
{
// return TRUE; // DEBUGGING: ALWAYS USE MESA
//---------------------------------------------------------------------------
void gld_update_state_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint new_state)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
//---------------------------------------------------------------------------
void gld_Viewport_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint x,
GLint y,
GLsizei w,
//---------------------------------------------------------------------------
-extern BOOL dglWglResizeBuffers(GLcontext *ctx, BOOL bDefaultDriver);
+extern BOOL dglWglResizeBuffers(struct gl_context *ctx, BOOL bDefaultDriver);
// Mesa 5: Parameter change
void gldResizeBuffers_DX9(
-// GLcontext *ctx)
- GLframebuffer *fb)
+// struct gl_context *ctx)
+ struct gl_framebuffer *fb)
{
GET_CURRENT_CONTEXT(ctx);
dglWglResizeBuffers(ctx, TRUE);
// This is only for debugging.
// To use, plug into ctx->Driver.Enable pointer below.
void gld_Enable(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum e,
GLboolean b)
{
// Driver pointer setup
//---------------------------------------------------------------------------
-extern const GLubyte* _gldGetStringGeneric(GLcontext*, GLenum);
+extern const GLubyte* _gldGetStringGeneric(struct gl_context*, GLenum);
void gldSetupDriverPointers_DX9(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
PROC gldGetProcAddress_DX9(LPCSTR a);
-void gldEnableExtensions_DX9(GLcontext *ctx);
-void gldInstallPipeline_DX9(GLcontext *ctx);
-void gldSetupDriverPointers_DX9(GLcontext *ctx);
-//void gldResizeBuffers_DX9(GLcontext *ctx);
-void gldResizeBuffers_DX9(GLframebuffer *fb);
+void gldEnableExtensions_DX9(struct gl_context *ctx);
+void gldInstallPipeline_DX9(struct gl_context *ctx);
+void gldSetupDriverPointers_DX9(struct gl_context *ctx);
+//void gldResizeBuffers_DX9(struct gl_context *ctx);
+void gldResizeBuffers_DX9(struct gl_framebuffer *fb);
// Texture functions
-void gldCopyTexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
-void gldCopyTexImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-void gldCopyTexSubImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
-void gldCopyTexSubImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-void gldCopyTexSubImage3D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-
-void gld_NEW_TEXTURE_DX9(GLcontext *ctx);
-void gld_DrawPixels_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels);
-void gld_ReadPixels_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest);
-void gld_CopyPixels_DX9(GLcontext *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type);
-void gld_Bitmap_DX9(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
-const struct gl_texture_format* gld_ChooseTextureFormat_DX9(GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType);
-void gld_TexImage2D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage);
-void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage2D_DX9( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
-void gld_TexSubImage1D_DX9(GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage);
-void gld_DeleteTexture_DX9(GLcontext *ctx, struct gl_texture_object *tObj);
-void gld_ResetLineStipple_DX9(GLcontext *ctx);
+void gldCopyTexImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
+void gldCopyTexImage2D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+void gldCopyTexSubImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
+void gldCopyTexSubImage2D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
+void gldCopyTexSubImage3D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
+
+void gld_NEW_TEXTURE_DX9(struct gl_context *ctx);
+void gld_DrawPixels_DX9(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels);
+void gld_ReadPixels_DX9(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, GLvoid *dest);
+void gld_CopyPixels_DX9(struct gl_context *ctx, GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLint dstx, GLint dsty, GLenum type);
+void gld_Bitmap_DX9(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap);
+const struct gl_texture_format* gld_ChooseTextureFormat_DX9(struct gl_context *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType);
+void gld_TexImage2D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *tObj, struct gl_texture_image *texImage);
+void gld_TexImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint internalFormat, GLint width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
+void gld_TexSubImage2D_DX9( struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage );
+void gld_TexSubImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, struct gl_texture_object *texObj, struct gl_texture_image *texImage);
+void gld_DeleteTexture_DX9(struct gl_context *ctx, struct gl_texture_object *tObj);
+void gld_ResetLineStipple_DX9(struct gl_context *ctx);
// 2D primitive functions
-void gld_Points2D_DX9(GLcontext *ctx, GLuint first, GLuint last);
+void gld_Points2D_DX9(struct gl_context *ctx, GLuint first, GLuint last);
-void gld_Line2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
+void gld_Line2DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Line2DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1);
-void gld_Triangle2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DFlatExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DFlatExtras_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DSmoothExtras_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad2DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DFlatExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothExtras_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DFlatExtras_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DSmoothExtras_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
// 3D primitive functions
-void gld_Points3D_DX9(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DFlat_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Line3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad3DSmooth_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Points3D_DX9(struct gl_context *ctx, GLuint first, GLuint last);
+void gld_Line3DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Triangle3DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Quad3DFlat_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Line3DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Triangle3DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Quad3DSmooth_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
// Primitive functions for Two-sided-lighting Vertex Shader
-void gld_Points2DTwoside_DX9(GLcontext *ctx, GLuint first, GLuint last);
-void gld_Line2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Line2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1);
-void gld_Triangle2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2);
-void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-void gld_Quad2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Points2DTwoside_DX9(struct gl_context *ctx, GLuint first, GLuint last);
+void gld_Line2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Line2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1);
+void gld_Triangle2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Triangle2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2);
+void gld_Quad2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+void gld_Quad2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
#endif
#include "extensions.h"
// For some reason this is not defined in an above header...
-extern void _mesa_enable_imaging_extensions(GLcontext *ctx);
+extern void _mesa_enable_imaging_extensions(struct gl_context *ctx);
//---------------------------------------------------------------------------
// Hack for the SGIS_multitexture extension that was removed from Mesa
//---------------------------------------------------------------------------
void gldEnableExtensions_DX9(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
GLuint i;
//---------------------------------------------------------------------------
void gldInstallPipeline_DX9(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
// Remove any existing pipeline stages,
// then install GLDirect pipeline stages.
//---------------------------------------------------------------------------
__inline DWORD _gldComputeFog(
- GLcontext *ctx,
+ struct gl_context *ctx,
SWvertex *swv)
{
// Full fog calculation.
//---------------------------------------------------------------------------
void gld_ResetLineStipple_DX9(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
// TODO: Fake stipple with a 32x32 texture.
}
//---------------------------------------------------------------------------
void gld_Points2D_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint first,
GLuint last)
{
//---------------------------------------------------------------------------
void gld_Line2DFlat_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1)
{
//---------------------------------------------------------------------------
void gld_Line2DSmooth_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1)
{
//---------------------------------------------------------------------------
void gld_Triangle2DFlat_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Triangle2DSmooth_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Triangle2DFlatExtras_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Triangle2DSmoothExtras_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Quad2DFlat_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Quad2DSmooth_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Quad2DFlatExtras_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Quad2DSmoothExtras_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Points3D_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint first,
GLuint last)
{
//---------------------------------------------------------------------------
void gld_Line3DFlat_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1)
{
//---------------------------------------------------------------------------
void gld_Line3DSmooth_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1)
{
//---------------------------------------------------------------------------
void gld_Triangle3DFlat_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Triangle3DSmooth_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2)
//---------------------------------------------------------------------------
void gld_Quad3DFlat_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
//---------------------------------------------------------------------------
void gld_Quad3DSmooth_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint v0,
GLuint v1,
GLuint v2,
/*
-void gld_Points2DTwoside_DX9(GLcontext *ctx, GLuint first, GLuint last)
+void gld_Points2DTwoside_DX9(struct gl_context *ctx, GLuint first, GLuint last)
{
// NOTE: Two-sided lighting does not apply to Points
}
//---------------------------------------------------------------------------
-void gld_Line2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1)
+void gld_Line2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1)
{
// NOTE: Two-sided lighting does not apply to Lines
}
//---------------------------------------------------------------------------
-void gld_Line2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1)
+void gld_Line2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1)
{
// NOTE: Two-sided lighting does not apply to Lines
}
//---------------------------------------------------------------------------
-void gld_Triangle2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
+void gld_Triangle2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2)
{
}
//---------------------------------------------------------------------------
-void gld_Triangle2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2)
+void gld_Triangle2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
-void gld_Quad2DFlatTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+void gld_Quad2DFlatTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
-void gld_Quad2DSmoothTwoside_DX9(GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+void gld_Quad2DSmoothTwoside_DX9(struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
GLD_driver_dx9 *gld = GLD_GET_DX9_DRIVER(gldCtx);
//---------------------------------------------------------------------------
void gldCopyTexImage1D_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y,
//---------------------------------------------------------------------------
void gldCopyTexImage2D_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLenum internalFormat,
//---------------------------------------------------------------------------
void gldCopyTexSubImage1D_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target, GLint level,
GLint xoffset, GLint x, GLint y, GLsizei width )
{
//---------------------------------------------------------------------------
void gldCopyTexSubImage2D_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset,
//---------------------------------------------------------------------------
void gldCopyTexSubImage3D_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLint xoffset,
//---------------------------------------------------------------------------
HRESULT _gldDrawPixels(
- GLcontext *ctx,
+ struct gl_context *ctx,
BOOL bChromakey, // Alpha test for glBitmap() images
GLint x, // GL x position
GLint y, // GL y position (needs flipping)
//---------------------------------------------------------------------------
void gld_DrawPixels_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
//---------------------------------------------------------------------------
void gld_ReadPixels_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack,
//---------------------------------------------------------------------------
void gld_CopyPixels_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint srcx,
GLint srcy,
GLsizei width,
//---------------------------------------------------------------------------
void gld_Bitmap_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint x,
GLint y,
GLsizei width,
//---------------------------------------------------------------------------
void _gldAllocateTexture(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct gl_texture_object *tObj,
struct gl_texture_image *texImage)
{
//---------------------------------------------------------------------------
const struct gl_texture_format* gld_ChooseTextureFormat_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint internalFormat,
GLenum srcFormat,
GLenum srcType)
/*
// Safer(?), slower version.
void gld_TexImage2D_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLint internalFormat,
// Faster, more efficient version.
// Copies subimage straight to dest texture
void gld_TexImage2D_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum target,
GLint level,
GLint internalFormat,
//---------------------------------------------------------------------------
-void gld_TexImage1D_DX9(GLcontext *ctx, GLenum target, GLint level,
+void gld_TexImage1D_DX9(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
//---------------------------------------------------------------------------
/*
-void gld_TexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
+void gld_TexSubImage2D( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
// Faster, more efficient version.
// Copies subimage straight to dest texture
-void gld_TexSubImage2D_DX9( GLcontext *ctx, GLenum target, GLint level,
+void gld_TexSubImage2D_DX9( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
//---------------------------------------------------------------------------
-void gld_TexSubImage1D_DX9( GLcontext *ctx, GLenum target, GLint level,
+void gld_TexSubImage1D_DX9( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLsizei width,
GLenum format, GLenum type,
const GLvoid *pixels,
//---------------------------------------------------------------------------
void gld_DeleteTexture_DX9(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct gl_texture_object *tObj)
{
GLD_context *gld = (GLD_context*)(ctx->DriverCtx);
//---------------------------------------------------------------------------
void gldUpdateTextureUnit(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint unit,
BOOL bPassThrough)
{
//---------------------------------------------------------------------------
void gld_NEW_TEXTURE_DX9(
- GLcontext *ctx)
+ struct gl_context *ctx)
{
// TODO: Support for three (ATI Radeon) or more (nVidia GeForce3) texture units
//---------------------------------------------------------------------------
__inline void _gldSetVertexShaderConstants(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLD_driver_dx9 *gld)
{
D3DXMATRIX mat, matView, matProj;
//---------------------------------------------------------------------------
static GLboolean gld_d3d_render_stage_run(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct tnl_pipeline_stage *stage)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
//---------------------------------------------------------------------------
static void gld_d3d_render_stage_check(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct tnl_pipeline_stage *stage)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
/* TODO: do this for all primitives, verts and elts:
*/
-static void clip_elt_triangles( GLcontext *ctx,
+static void clip_elt_triangles( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
/* Helper functions for drivers */
/**********************************************************************/
/*
-void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n )
+void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
VB->Elts = tmp;
}
-void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
+void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.Line( ctx, ii, jj );
//---------------------------------------------------------------------------
static GLboolean _gld_mesa_render_stage_run(
- GLcontext *ctx,
+ struct gl_context *ctx,
struct tnl_pipeline_stage *stage)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
#define DDLOG_CRITICAL_OR_WARN DDLOG_CRITICAL
-extern void _gld_mesa_warning(GLcontext *, char *);
-extern void _gld_mesa_fatal(GLcontext *, char *);
+extern void _gld_mesa_warning(struct gl_context *, char *);
+extern void _gld_mesa_fatal(struct gl_context *, char *);
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
HRESULT _gldCreatePrimitiveBuffer(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLD_driver_dx9 *lpCtx,
GLD_pb_dx9 *gldVB)
{
//---------------------------------------------------------------------------
const GLubyte* _gldGetStringGeneric(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLenum name)
{
if (!ctx)
extern GLD_driver _gldDriver;
BOOL gldInitDriverPointers(DWORD dwDriver);
-const GLubyte* _gldGetStringGeneric(GLcontext *ctx, GLenum name);
+const GLubyte* _gldGetStringGeneric(struct gl_context *ctx, GLenum name);
#endif // _USE_GLD3_WGL
// Support Functions
//---------------------------------------------------------------------------
-static void flush(GLcontext* ctx)
+static void flush(struct gl_context* ctx)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
/*
* Set the color used to clear the color buffer.
*/
-//static void clear_color( GLcontext* ctx, const GLchan color[4] )
+//static void clear_color( struct gl_context* ctx, const GLchan color[4] )
// Changed for Mesa 5.x. KeithH
static void clear_color(
- GLcontext* ctx,
+ struct gl_context* ctx,
const GLfloat color[4])
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
* Otherwise, we let swrast do it.
*/
-static clear(GLcontext* ctx, GLbitfield mask,
+static clear(struct gl_context* ctx, GLbitfield mask,
GLboolean all, GLint x, GLint y, GLint width, GLint height)
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
//---------------------------------------------------------------------------
-static void enable( GLcontext* ctx, GLenum pname, GLboolean enable )
+static void enable( struct gl_context* ctx, GLenum pname, GLboolean enable )
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
WMesaContext *Current = GLD_GET_WMESA_DRIVER(gldCtx);
//---------------------------------------------------------------------------
-static GLboolean set_draw_buffer( GLcontext* ctx, GLenum mode )
+static GLboolean set_draw_buffer( struct gl_context* ctx, GLenum mode )
{
/* TODO: this could be better */
if (mode==GL_FRONT_LEFT || mode==GL_BACK_LEFT) {
//---------------------------------------------------------------------------
-static void set_read_buffer(GLcontext *ctx, GLframebuffer *colorBuffer,
+static void set_read_buffer(struct gl_context *ctx, struct gl_framebuffer *colorBuffer,
GLenum buffer )
{
/* XXX todo */
/* Return characteristics of the output buffer. */
-//static void buffer_size( GLcontext* ctx, GLuint *width, GLuint *height )
+//static void buffer_size( struct gl_context* ctx, GLuint *width, GLuint *height )
// Altered for Mesa 5.x. KeithH
static void buffer_size(
- GLframebuffer *buffer,
+ struct gl_framebuffer *buffer,
GLuint *width,
GLuint *height)
{
/* Accelerated routines are not implemented in 4.0. See OSMesa for ideas. */
-static void fast_rgb_points( GLcontext* ctx, GLuint first, GLuint last )
+static void fast_rgb_points( struct gl_context* ctx, GLuint first, GLuint last )
{
}
//---------------------------------------------------------------------------
/* Return pointer to accelerated points function */
-extern tnl_points_func choose_points_function( GLcontext* ctx )
+extern tnl_points_func choose_points_function( struct gl_context* ctx )
{
return NULL;
}
//---------------------------------------------------------------------------
-static void fast_flat_rgb_line( GLcontext* ctx, GLuint v0,
+static void fast_flat_rgb_line( struct gl_context* ctx, GLuint v0,
GLuint v1, GLuint pv )
{
}
//---------------------------------------------------------------------------
-static tnl_line_func choose_line_function( GLcontext* ctx )
+static tnl_line_func choose_line_function( struct gl_context* ctx )
{
}
/* Write a horizontal span of 32-bit color-index pixels with a boolean mask. */
-static void write_ci32_span( const GLcontext* ctx,
+static void write_ci32_span( const struct gl_context* ctx,
GLuint n, GLint x, GLint y,
const GLuint index[],
const GLubyte mask[] )
//---------------------------------------------------------------------------
/* Write a horizontal span of 8-bit color-index pixels with a boolean mask. */
-static void write_ci8_span( const GLcontext* ctx,
+static void write_ci8_span( const struct gl_context* ctx,
GLuint n, GLint x, GLint y,
const GLubyte index[],
const GLubyte mask[] )
* Write a horizontal span of pixels with a boolean mask. The current
* color index is used for all pixels.
*/
-static void write_mono_ci_span(const GLcontext* ctx,
+static void write_mono_ci_span(const struct gl_context* ctx,
GLuint n,GLint x,GLint y,
GLuint colorIndex, const GLubyte mask[])
{
*/
/* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span( const GLcontext* ctx, GLuint n, GLint x, GLint y,
+static void write_rgba_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y,
const GLubyte rgba[][4], const GLubyte mask[] )
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
//---------------------------------------------------------------------------
/* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span( const GLcontext* ctx,
+static void write_rgb_span( const struct gl_context* ctx,
GLuint n, GLint x, GLint y,
const GLubyte rgb[][3], const GLubyte mask[] )
{
* Write a horizontal span of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_span( const GLcontext* ctx,
+static void write_mono_rgba_span( const struct gl_context* ctx,
GLuint n, GLint x, GLint y,
const GLchan color[4], const GLubyte mask[])
{
/* Write an array of 32-bit index pixels with a boolean mask. */
-static void write_ci32_pixels( const GLcontext* ctx,
+static void write_ci32_pixels( const struct gl_context* ctx,
GLuint n, const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[] )
{
* Write an array of pixels with a boolean mask. The current color
* index is used for all pixels.
*/
-static void write_mono_ci_pixels( const GLcontext* ctx,
+static void write_mono_ci_pixels( const struct gl_context* ctx,
GLuint n,
const GLint x[], const GLint y[],
GLuint colorIndex, const GLubyte mask[] )
/* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels( const GLcontext* ctx,
+static void write_rgba_pixels( const struct gl_context* ctx,
GLuint n, const GLint x[], const GLint y[],
const GLubyte rgba[][4], const GLubyte mask[] )
{
* Write an array of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_pixels( const GLcontext* ctx,
+static void write_mono_rgba_pixels( const struct gl_context* ctx,
GLuint n,
const GLint x[], const GLint y[],
const GLchan color[4],
/**********************************************************************/
/* Read a horizontal span of color-index pixels. */
-static void read_ci32_span( const GLcontext* ctx, GLuint n, GLint x, GLint y,
+static void read_ci32_span( const struct gl_context* ctx, GLuint n, GLint x, GLint y,
GLuint index[])
{
GLD_context *gldCtx = GLD_GET_CONTEXT(ctx);
//---------------------------------------------------------------------------
/* Read an array of color index pixels. */
-static void read_ci32_pixels( const GLcontext* ctx,
+static void read_ci32_pixels( const struct gl_context* ctx,
GLuint n, const GLint x[], const GLint y[],
GLuint indx[], const GLubyte mask[] )
{
//---------------------------------------------------------------------------
/* Read a horizontal span of color pixels. */
-static void read_rgba_span( const GLcontext* ctx,
+static void read_rgba_span( const struct gl_context* ctx,
GLuint n, GLint x, GLint y,
GLubyte rgba[][4] )
{
//---------------------------------------------------------------------------
/* Read an array of color pixels. */
-static void read_rgba_pixels( const GLcontext* ctx,
+static void read_rgba_pixels( const struct gl_context* ctx,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4], const GLubyte mask[] )
{
//---------------------------------------------------------------------------
static void wmesa_update_state(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint new_state)
{
_swrast_InvalidateState( ctx, new_state );
//---------------------------------------------------------------------------
static void wmesa_viewport(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLint x,
GLint y,
GLsizei w,
//---------------------------------------------------------------------------
static void wmesa_update_state_first_time(
- GLcontext *ctx,
+ struct gl_context *ctx,
GLuint new_state)
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
BOOL gldInitialiseMesa_MesaSW(
DGL_ctx *gld)
{
- GLcontext *ctx;
+ struct gl_context *ctx;
if (gld == NULL)
return FALSE;
GL_MAJOR = 1
GL_MINOR = 5
-GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
+GL_TINY = 0$(MESA_MAJOR)$(MESA_MINOR)0$(MESA_TINY)
HEADERS = \
/**
* Allocate a new XMesaBuffer object which corresponds to the given drawable.
- * Note that XMesaBuffer is derived from GLframebuffer.
+ * Note that XMesaBuffer is derived from struct gl_framebuffer.
* The new XMesaBuffer will not have any size (Width=Height=0).
*
* \param d the corresponding X drawable (window or pixmap)
XMesaColormap cmap)
{
int client = 0;
- const int xclass = v->mesa_visual.visualType;
+ const int xclass = v->visualType;
#ifdef XFree86Server
client = (window) ? CLIENT_ID(window->id) : 0;
* Convert an RGBA color to a pixel value.
*/
unsigned long
-xmesa_color_to_pixel(GLcontext *ctx,
+xmesa_color_to_pixel(struct gl_context *ctx,
GLubyte r, GLubyte g, GLubyte b, GLubyte a,
GLuint pixelFormat)
{
v->mesa_visual.redMask = visinfo->redMask;
v->mesa_visual.greenMask = visinfo->greenMask;
v->mesa_visual.blueMask = visinfo->blueMask;
- v->mesa_visual.visualID = visinfo->vid;
- v->mesa_visual.screen = 0; /* FIXME: What should be done here? */
+ v->visualID = visinfo->vid;
+ v->screen = 0; /* FIXME: What should be done here? */
#else
v->mesa_visual.redMask = visinfo->red_mask;
v->mesa_visual.greenMask = visinfo->green_mask;
v->mesa_visual.blueMask = visinfo->blue_mask;
- v->mesa_visual.visualID = visinfo->visualid;
- v->mesa_visual.screen = visinfo->screen;
+ v->visualID = visinfo->visualid;
+ v->screen = visinfo->screen;
#endif
#if defined(XFree86Server) || !(defined(__cplusplus) || defined(c_plusplus))
- v->mesa_visual.visualType = xmesa_convert_from_x_visual_type(visinfo->class);
+ v->visualType = xmesa_convert_from_x_visual_type(visinfo->class);
#else
- v->mesa_visual.visualType = xmesa_convert_from_x_visual_type(visinfo->c_class);
+ v->visualType = xmesa_convert_from_x_visual_type(visinfo->c_class);
#endif
v->mesa_visual.visualRating = visualCaveat;
(void) initialize_visual_and_buffer( v, NULL, 0, 0 );
{
- const int xclass = v->mesa_visual.visualType;
+ const int xclass = v->visualType;
if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) {
red_bits = _mesa_bitcount(GET_REDMASK(v));
green_bits = _mesa_bitcount(GET_GREENMASK(v));
{
static GLboolean firstTime = GL_TRUE;
XMesaContext c;
- GLcontext *mesaCtx;
+ struct gl_context *mesaCtx;
struct dd_function_table functions;
TNLcontext *tnl;
firstTime = GL_FALSE;
}
- /* Note: the XMesaContext contains a Mesa GLcontext struct (inheritance) */
+ /* Note: the XMesaContext contains a Mesa struct gl_context struct (inheritance) */
c = (XMesaContext) CALLOC_STRUCT(xmesa_context);
if (!c)
return NULL;
_mesa_init_driver_functions(&functions);
xmesa_init_driver_functions(v, &functions);
if (!_mesa_initialize_context(mesaCtx, &v->mesa_visual,
- share_list ? &(share_list->mesa) : (GLcontext *) NULL,
+ share_list ? &(share_list->mesa) : (struct gl_context *) NULL,
&functions, (void *) c)) {
free(c);
return NULL;
PUBLIC
void XMesaDestroyContext( XMesaContext c )
{
- GLcontext *mesaCtx = &c->mesa;
+ struct gl_context *mesaCtx = &c->mesa;
#ifdef FX
FXdestroyContext( XMESA_BUFFER(mesaCtx->DrawBuffer) );
/**
- * Query the current window size and update the corresponding GLframebuffer
+ * Query the current window size and update the corresponding struct gl_framebuffer
* and all attached renderbuffers.
* Called when:
* 1. the first time a buffer is bound to a context.
xmesa_get_window_size(drawBuffer->display, drawBuffer, &width, &height);
if (drawBuffer->mesa_buffer.Width != width ||
drawBuffer->mesa_buffer.Height != height) {
- GLcontext *ctx = xmctx ? &xmctx->mesa : NULL;
+ struct gl_context *ctx = xmctx ? &xmctx->mesa : NULL;
_mesa_resize_framebuffer(ctx, &(drawBuffer->mesa_buffer), width, height);
}
drawBuffer->mesa_buffer.Initialized = GL_TRUE; /* XXX TEMPORARY? */
GLfloat red, GLfloat green,
GLfloat blue, GLfloat alpha )
{
- GLcontext *ctx = &xmesa->mesa;
+ struct gl_context *ctx = &xmesa->mesa;
GLint r = (GLint) (red * 255.0F);
GLint g = (GLint) (green * 255.0F);
GLint b = (GLint) (blue * 255.0F);
* Called via gl_renderbuffer::AllocStorage()
*/
static GLboolean
-xmesa_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
+xmesa_alloc_front_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb);
* Called via gl_renderbuffer::AllocStorage()
*/
static GLboolean
-xmesa_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
+xmesa_alloc_back_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb);
struct xmesa_renderbuffer *
-xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual,
+xmesa_new_renderbuffer(struct gl_context *ctx, GLuint name, const struct gl_config *visual,
GLboolean backBuffer)
{
struct xmesa_renderbuffer *xrb = CALLOC_STRUCT(xmesa_renderbuffer);
static void
-finish_or_flush( GLcontext *ctx )
+finish_or_flush( struct gl_context *ctx )
{
#ifdef XFree86Server
/* NOT_NEEDED */
static void
-clear_color( GLcontext *ctx, const GLfloat color[4] )
+clear_color( struct gl_context *ctx, const GLfloat color[4] )
{
if (ctx->DrawBuffer->Name == 0) {
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
/* Implements glColorMask() */
static void
-color_mask(GLcontext *ctx,
+color_mask(struct gl_context *ctx,
GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask)
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
XMesaBuffer xmbuf;
- const int xclass = xmesa->xm_visual->mesa_visual.visualType;
+ const int xclass = xmesa->xm_visual->visualType;
(void) amask;
if (ctx->DrawBuffer->Name != 0)
* Clear the front or back color buffer, if it's implemented with a pixmap.
*/
static void
-clear_pixmap(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_pixmap(struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height)
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_8bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_8bit_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height )
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_HPCR_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_HPCR_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height )
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_16bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_16bit_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height)
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
/* Optimized code provided by Nozomi Ytow <noz@xfree86.org> */
static void
-clear_24bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_24bit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height)
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_32bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_32bit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height)
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_nbit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_nbit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height)
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_buffers(GLcontext *ctx, GLbitfield buffers)
+clear_buffers(struct gl_context *ctx, GLbitfield buffers)
{
if (ctx->DrawBuffer->Name == 0) {
/* this is a window system framebuffer */
* Check if we can do an optimized glDrawPixels into an 8R8G8B visual.
*/
static GLboolean
-can_do_DrawPixels_8R8G8B(GLcontext *ctx, GLenum format, GLenum type)
+can_do_DrawPixels_8R8G8B(struct gl_context *ctx, GLenum format, GLenum type)
{
if (format == GL_BGRA &&
type == GL_UNSIGNED_BYTE &&
* The image format must be GL_BGRA to match the PF_8R8G8B pixel format.
*/
static void
-xmesa_DrawPixels_8R8G8B( GLcontext *ctx,
+xmesa_DrawPixels_8R8G8B( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
* Check if we can do an optimized glDrawPixels into an 5R6G5B visual.
*/
static GLboolean
-can_do_DrawPixels_5R6G5B(GLcontext *ctx, GLenum format, GLenum type)
+can_do_DrawPixels_5R6G5B(struct gl_context *ctx, GLenum format, GLenum type)
{
if (format == GL_RGB &&
type == GL_UNSIGNED_SHORT_5_6_5 &&
* match the PF_5R6G5B pixel format.
*/
static void
-xmesa_DrawPixels_5R6G5B( GLcontext *ctx,
+xmesa_DrawPixels_5R6G5B( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
* Determine if we can do an optimized glCopyPixels.
*/
static GLboolean
-can_do_CopyPixels(GLcontext *ctx, GLenum type)
+can_do_CopyPixels(struct gl_context *ctx, GLenum type)
{
if (type == GL_COLOR &&
ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */
* We do support copying from one window to another, ala glXMakeCurrentRead.
*/
static void
-xmesa_CopyPixels( GLcontext *ctx,
+xmesa_CopyPixels( struct gl_context *ctx,
GLint srcx, GLint srcy, GLsizei width, GLsizei height,
GLint destx, GLint desty, GLenum type )
{
* return a meaningful GL_RENDERER string.
*/
static const GLubyte *
-get_string( GLcontext *ctx, GLenum name )
+get_string( struct gl_context *ctx, GLenum name )
{
(void) ctx;
switch (name) {
* dither enable/disable.
*/
static void
-enable( GLcontext *ctx, GLenum pname, GLboolean state )
+enable( struct gl_context *ctx, GLenum pname, GLboolean state )
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_color_HPCR_ximage( GLcontext *ctx, const GLfloat color[4] )
+clear_color_HPCR_ximage( struct gl_context *ctx, const GLfloat color[4] )
{
int i;
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_color_HPCR_pixmap( GLcontext *ctx, const GLfloat color[4] )
+clear_color_HPCR_pixmap( struct gl_context *ctx, const GLfloat color[4] )
{
int i;
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
* flags.
*/
void
-xmesa_update_state( GLcontext *ctx, GLbitfield new_state )
+xmesa_update_state( struct gl_context *ctx, GLbitfield new_state )
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
* texels.
*/
static GLboolean
-test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
+test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat, GLenum format, GLenum type,
GLint width, GLint height, GLint depth, GLint border)
{
* In SW, we don't really compress GL_COMPRESSED_RGB[A] textures!
*/
static gl_format
-choose_tex_format( GLcontext *ctx, GLint internalFormat,
+choose_tex_format( struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
switch (internalFormat) {
* That problem led to the GLX_MESA_resize_buffers extension.
*/
static void
-xmesa_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+xmesa_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
XMesaContext xmctx = XMESA_CONTEXT(ctx);
XMesaBuffer xmdrawbuf = XMESA_BUFFER(ctx->WinSysDrawBuffer);
static struct gl_query_object *
-xmesa_new_query_object(GLcontext *ctx, GLuint id)
+xmesa_new_query_object(struct gl_context *ctx, GLuint id)
{
struct xmesa_query_object *q = CALLOC_STRUCT(xmesa_query_object);
if (q) {
static void
-xmesa_begin_query(GLcontext *ctx, struct gl_query_object *q)
+xmesa_begin_query(struct gl_context *ctx, struct gl_query_object *q)
{
if (q->Target == GL_TIME_ELAPSED_EXT) {
struct xmesa_query_object *xq = (struct xmesa_query_object *) q;
static void
-xmesa_end_query(GLcontext *ctx, struct gl_query_object *q)
+xmesa_end_query(struct gl_context *ctx, struct gl_query_object *q)
{
if (q->Target == GL_TIME_ELAPSED_EXT) {
struct xmesa_query_object *xq = (struct xmesa_query_object *) q;
* functions.
* Called during context creation only.
*/
-void xmesa_register_swrast_functions( GLcontext *ctx )
+void xmesa_register_swrast_functions( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT( ctx );
*/
#if 000
/* XXX don't use this, it doesn't dither correctly */
-static void draw_points_ANY_pixmap( GLcontext *ctx, const SWvertex *vert )
+static void draw_points_ANY_pixmap( struct gl_context *ctx, const SWvertex *vert )
{
XMesaContext xmesa = XMESA_CONTEXT(ctx);
XMesaDisplay *dpy = xmesa->xm_visual->display;
* our internal point functions, otherwise fall back to the standard
* swrast functions.
*/
-void xmesa_choose_point( GLcontext *ctx )
+void xmesa_choose_point( struct gl_context *ctx )
{
#if 0
XMesaContext xmesa = XMESA_CONTEXT(ctx);
* for the XSetLineAttributes() function call.
*/
static void
-xor_line(GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1)
+xor_line(struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1)
{
XMesaContext xmesa = XMESA_CONTEXT(ctx);
XMesaDisplay *dpy = xmesa->xm_visual->display;
* swrast fallback.
*/
static swrast_line_func
-get_line_func(GLcontext *ctx)
+get_line_func(struct gl_context *ctx)
{
#if CHAN_BITS == 8
SWcontext *swrast = SWRAST_CONTEXT(ctx);
* standard swrast functions.
*/
void
-xmesa_choose_line(GLcontext *ctx)
+xmesa_choose_line(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
#define PUT_ROW_ARGS \
- GLcontext *ctx, \
+ struct gl_context *ctx, \
struct gl_renderbuffer *rb, \
GLuint n, GLint x, GLint y, \
const void *values, const GLubyte mask[]
#define RGB_SPAN_ARGS \
- GLcontext *ctx, \
+ struct gl_context *ctx, \
struct gl_renderbuffer *rb, \
GLuint n, GLint x, GLint y, \
const void *values, const GLubyte mask[]
#define PUT_VALUES_ARGS \
- GLcontext *ctx, struct gl_renderbuffer *rb, \
+ struct gl_context *ctx, struct gl_renderbuffer *rb, \
GLuint n, const GLint x[], const GLint y[], \
const void *values, const GLubyte mask[]
/**********************************************************************/
#define PUT_MONO_ROW_ARGS \
- GLcontext *ctx, struct gl_renderbuffer *rb, \
+ struct gl_context *ctx, struct gl_renderbuffer *rb, \
GLuint n, GLint x, GLint y, const void *value, \
const GLubyte mask[]
/**********************************************************************/
#define PUT_MONO_VALUES_ARGS \
- GLcontext *ctx, struct gl_renderbuffer *rb, \
+ struct gl_context *ctx, struct gl_renderbuffer *rb, \
GLuint n, const GLint x[], const GLint y[], \
const void *value, const GLubyte mask[]
* else return number of pixels to skip in the destination array.
*/
static int
-clip_for_xgetimage(GLcontext *ctx, XMesaPixmap pixmap, GLuint *n, GLint *x, GLint *y)
+clip_for_xgetimage(struct gl_context *ctx, XMesaPixmap pixmap, GLuint *n, GLint *x, GLint *y)
{
XMesaContext xmesa = XMESA_CONTEXT(ctx);
XMesaBuffer source = XMESA_BUFFER(ctx->DrawBuffer);
* Read a horizontal span of color-index pixels.
*/
static void
-get_row_ci(GLcontext *ctx, struct gl_renderbuffer *rb,
+get_row_ci(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, void *values)
{
GLuint *index = (GLuint *) values;
* Read a horizontal span of color pixels.
*/
static void
-get_row_rgba(GLcontext *ctx, struct gl_renderbuffer *rb,
+get_row_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, void *values)
{
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
* Read an array of color index pixels.
*/
static void
-get_values_ci(GLcontext *ctx, struct gl_renderbuffer *rb,
+get_values_ci(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[], void *values)
{
GLuint *indx = (GLuint *) values;
static void
-get_values_rgba(GLcontext *ctx, struct gl_renderbuffer *rb,
+get_values_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[], void *values)
{
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
* swrast fallback.
*/
static swrast_tri_func
-get_triangle_func(GLcontext *ctx)
+get_triangle_func(struct gl_context *ctx)
{
#if CHAN_BITS == 8
SWcontext *swrast = SWRAST_CONTEXT(ctx);
* of our internal tri functions, otherwise fall back to the
* standard swrast functions.
*/
-void xmesa_choose_triangle( GLcontext *ctx )
+void xmesa_choose_triangle( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
/* Function pointer for clearing color buffers */
-typedef void (*ClearFunc)( GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+typedef void (*ClearFunc)( struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height );
/**
- * Visual inforation, derived from GLvisual.
+ * Visual inforation, derived from struct gl_config.
* Basically corresponds to an XVisualInfo.
*/
struct xmesa_visual {
- GLvisual mesa_visual; /* Device independent visual parameters */
+ struct gl_config mesa_visual; /* Device independent visual parameters */
XMesaDisplay *display; /* The X11 display */
+ int screen, visualID;
+ int visualType;
#ifdef XFree86Server
GLint ColormapEntries;
GLint nplanes;
/**
- * Context info, derived from GLcontext.
+ * Context info, derived from struct gl_context.
* Basically corresponds to a GLXContext.
*/
struct xmesa_context {
- GLcontext mesa; /* the core library context (containment) */
+ struct gl_context mesa; /* the core library context (containment) */
XMesaVisual xm_visual; /* Describes the buffers */
XMesaBuffer xm_buffer; /* current span/point/line/triangle buffer */
* Basically corresponds to a GLXDrawable.
*/
struct xmesa_buffer {
- GLframebuffer mesa_buffer; /* depth, stencil, accum, etc buffers */
+ struct gl_framebuffer mesa_buffer; /* depth, stencil, accum, etc buffers */
/* This MUST BE FIRST! */
GLboolean wasCurrent; /* was ever the current buffer? */
XMesaVisual xm_visual; /* the X/Mesa visual */
*/
extern struct xmesa_renderbuffer *
-xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual,
+xmesa_new_renderbuffer(struct gl_context *ctx, GLuint name, const struct gl_config *visual,
GLboolean backBuffer);
extern void
xmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis);
extern unsigned long
-xmesa_color_to_pixel( GLcontext *ctx,
+xmesa_color_to_pixel( struct gl_context *ctx,
GLubyte r, GLubyte g, GLubyte b, GLubyte a,
GLuint pixelFormat );
struct dd_function_table *driver );
extern void
-xmesa_update_state( GLcontext *ctx, GLbitfield new_state );
+xmesa_update_state( struct gl_context *ctx, GLbitfield new_state );
extern void
xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb,
/**
- * Return pointer to XMesaContext corresponding to a Mesa GLcontext.
+ * Return pointer to XMesaContext corresponding to a Mesa struct gl_context.
* Since we're using structure containment, it's just a cast!.
*/
static INLINE XMesaContext
-XMESA_CONTEXT(GLcontext *ctx)
+XMESA_CONTEXT(struct gl_context *ctx)
{
return (XMesaContext) ctx;
}
/**
- * Return pointer to XMesaBuffer corresponding to a Mesa GLframebuffer.
+ * Return pointer to XMesaBuffer corresponding to a Mesa struct gl_framebuffer.
* Since we're using structure containment, it's just a cast!.
*/
static INLINE XMesaBuffer
-XMESA_BUFFER(GLframebuffer *b)
+XMESA_BUFFER(struct gl_framebuffer *b)
{
return (XMesaBuffer) b;
}
/* Plugged into the software rasterizer. Try to use internal
* swrast-style point, line and triangle functions.
*/
-extern void xmesa_choose_point( GLcontext *ctx );
-extern void xmesa_choose_line( GLcontext *ctx );
-extern void xmesa_choose_triangle( GLcontext *ctx );
+extern void xmesa_choose_point( struct gl_context *ctx );
+extern void xmesa_choose_line( struct gl_context *ctx );
+extern void xmesa_choose_triangle( struct gl_context *ctx );
-extern void xmesa_register_swrast_functions( GLcontext *ctx );
+extern void xmesa_register_swrast_functions( struct gl_context *ctx );
#define GET_GREENMASK(__v) __v->mesa_visual.greenMask
#define GET_BLUEMASK(__v) __v->mesa_visual.blueMask
#define GET_VISUAL_DEPTH(__v) __v->visinfo->depth
-#define GET_BLACK_PIXEL(__v) BlackPixel(__v->display, __v->mesa_visual.screen)
+#define GET_BLACK_PIXEL(__v) BlackPixel(__v->display, __v->screen)
#define CHECK_BYTE_ORDER(__v) host_byte_order()==ImageByteOrder(__v->display)
#define CHECK_FOR_HPCR(__v) XInternAtom(__v->display, "_HP_RGB_SMOOTH_MAP_LIST", True)
<value name="GL_ALPHA"/>
<value name="GL_RGB"/>
<value name="GL_RGBA"/>
+ <value name="GL_BGRA_EXT"/>
<value name="GL_LUMINANCE"/>
<value name="GL_LUMINANCE_ALPHA"/>
<value name="GL_DEPTH_COMPONENT" category="OES_depth_texture"/>
<desc name="format" category="OES_packed_depth_stencil">
<value name="GL_DEPTH_STENCIL_OES"/>
-
<desc name="type" error="GL_INVALID_OPERATION">
<value name="GL_UNSIGNED_INT_24_8_OES"/>
</desc>
</desc>
+
+ <desc name="format" category="EXT_texture_format_BGRA8888">
+ <value name="GL_BGRA_EXT"/>
+
+ <desc name="type" error="GL_INVALID_OPERATION">
+ <value name="GL_UNSIGNED_BYTE"/>
+ </desc>
+ </desc>
</template>
<template name="TexEnv">
<category name="OES_depth_texture"/>
<category name="OES_packed_depth_stencil"/>
<category name="OES_standard_derivatives"/>
+ <category name="EXT_texture_format_BGRA8888"/>
<category name="EXT_texture_compression_dxt1"/>
<category name="EXT_blend_minmax"/>
void
-_mesa_init_accum( GLcontext *ctx )
+_mesa_init_accum( struct gl_context *ctx )
{
/* Accumulate buffer group */
ASSIGN_4V( ctx->Accum.ClearColor, 0.0, 0.0, 0.0, 0.0 );
#endif /* FEATURE_accum */
extern void
-_mesa_init_accum( GLcontext *ctx );
+_mesa_init_accum( struct gl_context *ctx );
#endif /* ACCUM_H */
/**********************************************************************/
-GLboolean _ae_create_context( GLcontext *ctx )
+GLboolean _ae_create_context( struct gl_context *ctx )
{
if (ctx->aelt_context)
return GL_TRUE;
}
-void _ae_destroy_context( GLcontext *ctx )
+void _ae_destroy_context( struct gl_context *ctx )
{
if ( AE_CONTEXT( ctx ) ) {
FREE( ctx->aelt_context );
* etc).
* Note: this may be called during display list construction.
*/
-static void _ae_update_state( GLcontext *ctx )
+static void _ae_update_state( struct gl_context *ctx )
{
AEcontext *actx = AE_CONTEXT(ctx);
AEarray *aa = actx->arrays;
actx->NewState = 0;
}
-void _ae_map_vbos( GLcontext *ctx )
+void _ae_map_vbos( struct gl_context *ctx )
{
AEcontext *actx = AE_CONTEXT(ctx);
GLuint i;
actx->mapped_vbos = GL_TRUE;
}
-void _ae_unmap_vbos( GLcontext *ctx )
+void _ae_unmap_vbos( struct gl_context *ctx )
{
AEcontext *actx = AE_CONTEXT(ctx);
GLuint i;
}
-void _ae_invalidate_state( GLcontext *ctx, GLuint new_state )
+void _ae_invalidate_state( struct gl_context *ctx, GLuint new_state )
{
AEcontext *actx = AE_CONTEXT(ctx);
(vfmt)->ArrayElement = impl ## ArrayElement; \
} while (0)
-extern GLboolean _ae_create_context( GLcontext *ctx );
-extern void _ae_destroy_context( GLcontext *ctx );
-extern void _ae_invalidate_state( GLcontext *ctx, GLuint new_state );
+extern GLboolean _ae_create_context( struct gl_context *ctx );
+extern void _ae_destroy_context( struct gl_context *ctx );
+extern void _ae_invalidate_state( struct gl_context *ctx, GLuint new_state );
extern void GLAPIENTRY _ae_ArrayElement( GLint elt );
/* May optionally be called before a batch of element calls:
*/
-extern void _ae_map_vbos( GLcontext *ctx );
-extern void _ae_unmap_vbos( GLcontext *ctx );
+extern void _ae_map_vbos( struct gl_context *ctx );
+extern void _ae_unmap_vbos( struct gl_context *ctx );
extern void
_mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp,
#define _MESA_INIT_ARRAYELT_VTXFMT(vfmt, impl) do { } while (0)
static INLINE GLboolean
-_ae_create_context( GLcontext *ctx )
+_ae_create_context( struct gl_context *ctx )
{
return GL_TRUE;
}
static INLINE void
-_ae_destroy_context( GLcontext *ctx )
+_ae_destroy_context( struct gl_context *ctx )
{
}
static INLINE void
-_ae_invalidate_state( GLcontext *ctx, GLuint new_state )
+_ae_invalidate_state( struct gl_context *ctx, GLuint new_state )
{
}
#include "mtypes.h"
#include "varray.h"
#include "viewport.h"
-#if FEATURE_NV_vertex_program
-#include "nvprogram.h"
-#endif
-#if FEATURE_NV_fragment_program
+#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
#include "nvprogram.h"
#endif
#if FEATURE_ARB_shader_objects
* Find the max index in the given element/index buffer
*/
GLuint
-_mesa_max_buffer_index(GLcontext *ctx, GLuint count, GLenum type,
+_mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type,
const void *indices,
struct gl_buffer_object *elementBuf)
{
* Check if OK to draw arrays/elements.
*/
static GLboolean
-check_valid_to_render(GLcontext *ctx, const char *function)
+check_valid_to_render(struct gl_context *ctx, const char *function)
{
if (!_mesa_valid_to_render(ctx, function)) {
return GL_FALSE;
* \return GL_TRUE if OK, GL_FALSE if any indexed vertex goes is out of bounds
*/
static GLboolean
-check_index_bounds(GLcontext *ctx, GLsizei count, GLenum type,
+check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
{
struct _mesa_prim prim;
* \return GL_TRUE if OK to render, GL_FALSE if error found
*/
GLboolean
-_mesa_validate_DrawElements(GLcontext *ctx,
+_mesa_validate_DrawElements(struct gl_context *ctx,
GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
{
* \return GL_TRUE if OK to render, GL_FALSE if error found
*/
GLboolean
-_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
+_mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
GLuint start, GLuint end,
GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex)
* \return GL_TRUE if OK to render, GL_FALSE if error found
*/
GLboolean
-_mesa_validate_DrawArrays(GLcontext *ctx,
+_mesa_validate_DrawArrays(struct gl_context *ctx,
GLenum mode, GLint start, GLsizei count)
{
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
GLboolean
-_mesa_validate_DrawArraysInstanced(GLcontext *ctx, GLenum mode, GLint first,
+_mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint first,
GLsizei count, GLsizei primcount)
{
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
GLboolean
-_mesa_validate_DrawElementsInstanced(GLcontext *ctx,
+_mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLsizei primcount)
{
extern GLuint
-_mesa_max_buffer_index(GLcontext *ctx, GLuint count, GLenum type,
+_mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type,
const void *indices,
struct gl_buffer_object *elementBuf);
extern GLboolean
-_mesa_validate_DrawArrays(GLcontext *ctx,
+_mesa_validate_DrawArrays(struct gl_context *ctx,
GLenum mode, GLint start, GLsizei count);
extern GLboolean
-_mesa_validate_DrawElements(GLcontext *ctx,
+_mesa_validate_DrawElements(struct gl_context *ctx,
GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex);
extern GLboolean
-_mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode,
+_mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
GLuint start, GLuint end,
GLsizei count, GLenum type,
const GLvoid *indices, GLint basevertex);
extern GLboolean
-_mesa_validate_DrawArraysInstanced(GLcontext *ctx, GLenum mode, GLint first,
+_mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint first,
GLsizei count, GLsizei primcount);
extern GLboolean
-_mesa_validate_DrawElementsInstanced(GLcontext *ctx,
+_mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
GLenum mode, GLsizei count, GLenum type,
const GLvoid *indices, GLsizei primcount);
*/
static INLINE struct gl_array_object *
-lookup_arrayobj(GLcontext *ctx, GLuint id)
+lookup_arrayobj(struct gl_context *ctx, GLuint id)
{
if (id == 0)
return NULL;
* This is done just prior to array object destruction.
*/
static void
-unbind_array_object_vbos(GLcontext *ctx, struct gl_array_object *obj)
+unbind_array_object_vbos(struct gl_context *ctx, struct gl_array_object *obj)
{
GLuint i;
* \c dd_function_table::NewArrayObject.
*/
struct gl_array_object *
-_mesa_new_array_object( GLcontext *ctx, GLuint name )
+_mesa_new_array_object( struct gl_context *ctx, GLuint name )
{
struct gl_array_object *obj = CALLOC_STRUCT(gl_array_object);
if (obj)
* \c dd_function_table::DeleteArrayObject.
*/
void
-_mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj )
+_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj )
{
(void) ctx;
unbind_array_object_vbos(ctx, obj);
* Set ptr to arrayObj w/ reference counting.
*/
void
-_mesa_reference_array_object(GLcontext *ctx,
+_mesa_reference_array_object(struct gl_context *ctx,
struct gl_array_object **ptr,
struct gl_array_object *arrayObj)
{
static void
-init_array(GLcontext *ctx,
+init_array(struct gl_context *ctx,
struct gl_client_array *array, GLint size, GLint type)
{
array->Size = size;
* Initialize a gl_array_object's arrays.
*/
void
-_mesa_initialize_array_object( GLcontext *ctx,
+_mesa_initialize_array_object( struct gl_context *ctx,
struct gl_array_object *obj,
GLuint name )
{
* Add the given array object to the array object pool.
*/
static void
-save_array_object( GLcontext *ctx, struct gl_array_object *obj )
+save_array_object( struct gl_context *ctx, struct gl_array_object *obj )
{
if (obj->Name > 0) {
/* insert into hash table */
* Do not deallocate the array object though.
*/
static void
-remove_array_object( GLcontext *ctx, struct gl_array_object *obj )
+remove_array_object( struct gl_context *ctx, struct gl_array_object *obj )
{
if (obj->Name > 0) {
/* remove from hash table */
* Examine vertex arrays to update the gl_array_object::_MaxElement field.
*/
void
-_mesa_update_array_object_max_element(GLcontext *ctx,
+_mesa_update_array_object_max_element(struct gl_context *ctx,
struct gl_array_object *arrayObj)
{
GLuint i, min = ~0;
* glGenVertexArrays().
*/
static void
-bind_vertex_array(GLcontext *ctx, GLuint id, GLboolean genRequired)
+bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
{
struct gl_array_object * const oldObj = ctx->Array.ArrayObj;
struct gl_array_object *newObj = NULL;
* \param vboOnly Will arrays have to reside in VBOs?
*/
static void
-gen_vertex_arrays(GLcontext *ctx, GLsizei n, GLuint *arrays, GLboolean vboOnly)
+gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays, GLboolean vboOnly)
{
GLuint first;
GLint i;
*/
extern struct gl_array_object *
-_mesa_new_array_object( GLcontext *ctx, GLuint name );
+_mesa_new_array_object( struct gl_context *ctx, GLuint name );
extern void
-_mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj );
+_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj );
extern void
-_mesa_reference_array_object(GLcontext *ctx,
+_mesa_reference_array_object(struct gl_context *ctx,
struct gl_array_object **ptr,
struct gl_array_object *arrayObj);
extern void
-_mesa_initialize_array_object( GLcontext *ctx,
+_mesa_initialize_array_object( struct gl_context *ctx,
struct gl_array_object *obj, GLuint name );
extern void
-_mesa_update_array_object_max_element(GLcontext *ctx,
+_mesa_update_array_object_max_element(struct gl_context *ctx,
struct gl_array_object *arrayObj);
* Allocate and initialize a new ATI fragment shader object.
*/
struct ati_fragment_shader *
-_mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id)
+_mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id)
{
struct ati_fragment_shader *s = CALLOC_STRUCT(ati_fragment_shader);
(void) ctx;
* Delete the given ati fragment shader
*/
void
-_mesa_delete_ati_fragment_shader(GLcontext *ctx, struct ati_fragment_shader *s)
+_mesa_delete_ati_fragment_shader(struct gl_context *ctx, struct ati_fragment_shader *s)
{
GLuint i;
for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp);
extern struct ati_fragment_shader *
-_mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id);
+_mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id);
extern void
-_mesa_delete_ati_fragment_shader(GLcontext *ctx,
+_mesa_delete_ati_fragment_shader(struct gl_context *ctx,
struct ati_fragment_shader *s);
}
static INLINE struct ati_fragment_shader *
-_mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id)
+_mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id)
{
return NULL;
}
static INLINE void
-_mesa_delete_ati_fragment_shader(GLcontext *ctx,
+_mesa_delete_ati_fragment_shader(struct gl_context *ctx,
struct ati_fragment_shader *s)
{
}
static void
-pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable)
+pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
{
const GLuint curTexUnitSave = ctx->Texture.CurrentUnit;
GLuint i;
* Pop/restore texture attribute/group state.
*/
static void
-pop_texture_group(GLcontext *ctx, struct texture_state *texstate)
+pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
{
GLuint u;
* object refcounts.
*/
static void
-copy_pixelstore(GLcontext *ctx,
+copy_pixelstore(struct gl_context *ctx,
struct gl_pixelstore_attrib *dst,
const struct gl_pixelstore_attrib *src)
{
* Free any attribute state data that might be attached to the context.
*/
void
-_mesa_free_attrib_data(GLcontext *ctx)
+_mesa_free_attrib_data(struct gl_context *ctx)
{
while (ctx->AttribStackDepth > 0) {
struct gl_attrib_node *attr, *next;
}
-void _mesa_init_attrib( GLcontext *ctx )
+void _mesa_init_attrib( struct gl_context *ctx )
{
/* Renderer and client attribute stacks */
ctx->AttribStackDepth = 0;
#endif /* FEATURE_attrib_stack */
extern void
-_mesa_init_attrib( GLcontext *ctx );
+_mesa_init_attrib( struct gl_context *ctx );
extern void
-_mesa_free_attrib_data( GLcontext *ctx );
+_mesa_free_attrib_data( struct gl_context *ctx );
#endif /* ATTRIB_H */
#if _HAVE_FULL_GL
static GLboolean
-_mesa_validate_blend_equation( GLcontext *ctx,
+_mesa_validate_blend_equation( struct gl_context *ctx,
GLenum mode, GLboolean is_separate )
{
switch (mode) {
* \param ctx GL context.
*
* Initializes the related fields in the context color attribute group,
- * __GLcontextRec::Color.
+ * __struct gl_contextRec::Color.
*/
-void _mesa_init_color( GLcontext * ctx )
+void _mesa_init_color( struct gl_context * ctx )
{
/* Color buffer group */
ctx->Color.IndexMask = ~0u;
extern void
-_mesa_init_color( GLcontext * ctx );
+_mesa_init_color( struct gl_context * ctx );
#endif
* specified context or \c NULL if \c target is invalid.
*/
static INLINE struct gl_buffer_object **
-get_buffer_target(GLcontext *ctx, GLenum target)
+get_buffer_target(struct gl_context *ctx, GLenum target)
{
switch (target) {
case GL_ARRAY_BUFFER_ARB:
* specified context or \c NULL if \c target is invalid.
*/
static INLINE struct gl_buffer_object *
-get_buffer(GLcontext *ctx, GLenum target)
+get_buffer(struct gl_context *ctx, GLenum target)
{
struct gl_buffer_object **bufObj = get_buffer_target(ctx, target);
if (bufObj)
* \sa glBufferSubDataARB, glGetBufferSubDataARB
*/
static struct gl_buffer_object *
-buffer_object_subdata_range_good( GLcontext * ctx, GLenum target,
+buffer_object_subdata_range_good( struct gl_context * ctx, GLenum target,
GLintptrARB offset, GLsizeiptrARB size,
const char *caller )
{
* Default callback for the \c dd_function_table::NewBufferObject() hook.
*/
static struct gl_buffer_object *
-_mesa_new_buffer_object( GLcontext *ctx, GLuint name, GLenum target )
+_mesa_new_buffer_object( struct gl_context *ctx, GLuint name, GLenum target )
{
struct gl_buffer_object *obj;
* Default callback for the \c dd_function_table::DeleteBuffer() hook.
*/
static void
-_mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj )
+_mesa_delete_buffer_object( struct gl_context *ctx, struct gl_buffer_object *bufObj )
{
(void) ctx;
* Set ptr to bufObj w/ reference counting.
*/
void
-_mesa_reference_buffer_object(GLcontext *ctx,
+_mesa_reference_buffer_object(struct gl_context *ctx,
struct gl_buffer_object **ptr,
struct gl_buffer_object *bufObj)
{
* \sa glBufferDataARB, dd_function_table::BufferData.
*/
static GLboolean
-_mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
+_mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size,
const GLvoid * data, GLenum usage,
struct gl_buffer_object * bufObj )
{
* \sa glBufferSubDataARB, dd_function_table::BufferSubData.
*/
static void
-_mesa_buffer_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
+_mesa_buffer_subdata( struct gl_context *ctx, GLenum target, GLintptrARB offset,
GLsizeiptrARB size, const GLvoid * data,
struct gl_buffer_object * bufObj )
{
* \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData.
*/
static void
-_mesa_buffer_get_subdata( GLcontext *ctx, GLenum target, GLintptrARB offset,
+_mesa_buffer_get_subdata( struct gl_context *ctx, GLenum target, GLintptrARB offset,
GLsizeiptrARB size, GLvoid * data,
struct gl_buffer_object * bufObj )
{
* \sa glMapBufferARB, dd_function_table::MapBuffer
*/
static void *
-_mesa_buffer_map( GLcontext *ctx, GLenum target, GLenum access,
+_mesa_buffer_map( struct gl_context *ctx, GLenum target, GLenum access,
struct gl_buffer_object *bufObj )
{
(void) ctx;
* Called via glMapBufferRange().
*/
static void *
-_mesa_buffer_map_range( GLcontext *ctx, GLenum target, GLintptr offset,
+_mesa_buffer_map_range( struct gl_context *ctx, GLenum target, GLintptr offset,
GLsizeiptr length, GLbitfield access,
struct gl_buffer_object *bufObj )
{
* Called via glFlushMappedBufferRange().
*/
static void
-_mesa_buffer_flush_mapped_range( GLcontext *ctx, GLenum target,
+_mesa_buffer_flush_mapped_range( struct gl_context *ctx, GLenum target,
GLintptr offset, GLsizeiptr length,
struct gl_buffer_object *obj )
{
* \sa glUnmapBufferARB, dd_function_table::UnmapBuffer
*/
static GLboolean
-_mesa_buffer_unmap( GLcontext *ctx, GLenum target,
+_mesa_buffer_unmap( struct gl_context *ctx, GLenum target,
struct gl_buffer_object *bufObj )
{
(void) ctx;
* Called via glCopyBuffserSubData().
*/
static void
-_mesa_copy_buffer_subdata(GLcontext *ctx,
+_mesa_copy_buffer_subdata(struct gl_context *ctx,
struct gl_buffer_object *src,
struct gl_buffer_object *dst,
GLintptr readOffset, GLintptr writeOffset,
* Initialize the state associated with buffer objects
*/
void
-_mesa_init_buffer_objects( GLcontext *ctx )
+_mesa_init_buffer_objects( struct gl_context *ctx )
{
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
ctx->Shared->NullBufferObj);
void
-_mesa_free_buffer_objects( GLcontext *ctx )
+_mesa_free_buffer_objects( struct gl_context *ctx )
{
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL);
_mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, NULL);
* Called by glBindBuffer() and other functions.
*/
static void
-bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer)
+bind_buffer_object(struct gl_context *ctx, GLenum target, GLuint buffer)
{
struct gl_buffer_object *oldBufObj;
struct gl_buffer_object *newBufObj = NULL;
* shared state.
*/
void
-_mesa_update_default_objects_buffer_objects(GLcontext *ctx)
+_mesa_update_default_objects_buffer_objects(struct gl_context *ctx)
{
/* Bind the NullBufferObj to remove references to those
* in the shared context hash table.
* \return NULL if error, else pointer to start of data
*/
const GLvoid *
-_mesa_map_pbo_source(GLcontext *ctx,
+_mesa_map_pbo_source(struct gl_context *ctx,
const struct gl_pixelstore_attrib *unpack,
const GLvoid *src)
{
* _mesa_unmap_pbo_source().
*/
const GLvoid *
-_mesa_map_validate_pbo_source(GLcontext *ctx,
+_mesa_map_validate_pbo_source(struct gl_context *ctx,
GLuint dimensions,
const struct gl_pixelstore_attrib *unpack,
GLsizei width, GLsizei height, GLsizei depth,
* Counterpart to _mesa_map_pbo_source()
*/
void
-_mesa_unmap_pbo_source(GLcontext *ctx,
+_mesa_unmap_pbo_source(struct gl_context *ctx,
const struct gl_pixelstore_attrib *unpack)
{
ASSERT(unpack != &ctx->Pack); /* catch pack/unpack mismatch */
* \return NULL if error, else pointer to start of data
*/
void *
-_mesa_map_pbo_dest(GLcontext *ctx,
+_mesa_map_pbo_dest(struct gl_context *ctx,
const struct gl_pixelstore_attrib *pack,
GLvoid *dest)
{
* _mesa_unmap_pbo_dest().
*/
GLvoid *
-_mesa_map_validate_pbo_dest(GLcontext *ctx,
+_mesa_map_validate_pbo_dest(struct gl_context *ctx,
GLuint dimensions,
const struct gl_pixelstore_attrib *unpack,
GLsizei width, GLsizei height, GLsizei depth,
* Counterpart to _mesa_map_pbo_dest()
*/
void
-_mesa_unmap_pbo_dest(GLcontext *ctx,
+_mesa_unmap_pbo_dest(struct gl_context *ctx,
const struct gl_pixelstore_attrib *pack)
{
ASSERT(pack != &ctx->Unpack); /* catch pack/unpack mismatch */
* Always return NULL for ID 0.
*/
struct gl_buffer_object *
-_mesa_lookup_bufferobj(GLcontext *ctx, GLuint buffer)
+_mesa_lookup_bufferobj(struct gl_context *ctx, GLuint buffer)
{
if (buffer == 0)
return NULL;
* unbound from all arrays in the current context.
*/
static void
-unbind(GLcontext *ctx,
+unbind(struct gl_context *ctx,
struct gl_buffer_object **ptr,
struct gl_buffer_object *obj)
{
#if FEATURE_APPLE_object_purgeable
static GLenum
-_mesa_BufferObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option)
+_mesa_BufferObjectPurgeable(struct gl_context *ctx, GLuint name, GLenum option)
{
struct gl_buffer_object *bufObj;
GLenum retval;
static GLenum
-_mesa_RenderObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option)
+_mesa_RenderObjectPurgeable(struct gl_context *ctx, GLuint name, GLenum option)
{
struct gl_renderbuffer *bufObj;
GLenum retval;
static GLenum
-_mesa_TextureObjectPurgeable(GLcontext *ctx, GLuint name, GLenum option)
+_mesa_TextureObjectPurgeable(struct gl_context *ctx, GLuint name, GLenum option)
{
struct gl_texture_object *bufObj;
GLenum retval;
static GLenum
-_mesa_BufferObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option)
+_mesa_BufferObjectUnpurgeable(struct gl_context *ctx, GLuint name, GLenum option)
{
struct gl_buffer_object *bufObj;
GLenum retval;
static GLenum
-_mesa_RenderObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option)
+_mesa_RenderObjectUnpurgeable(struct gl_context *ctx, GLuint name, GLenum option)
{
struct gl_renderbuffer *bufObj;
GLenum retval;
static GLenum
-_mesa_TextureObjectUnpurgeable(GLcontext *ctx, GLuint name, GLenum option)
+_mesa_TextureObjectUnpurgeable(struct gl_context *ctx, GLuint name, GLenum option)
{
struct gl_texture_object *bufObj;
GLenum retval;
static void
-_mesa_GetBufferObjectParameterivAPPLE(GLcontext *ctx, GLuint name,
+_mesa_GetBufferObjectParameterivAPPLE(struct gl_context *ctx, GLuint name,
GLenum pname, GLint* params)
{
struct gl_buffer_object *bufObj;
static void
-_mesa_GetRenderObjectParameterivAPPLE(GLcontext *ctx, GLuint name,
+_mesa_GetRenderObjectParameterivAPPLE(struct gl_context *ctx, GLuint name,
GLenum pname, GLint* params)
{
struct gl_renderbuffer *bufObj;
static void
-_mesa_GetTextureObjectParameterivAPPLE(GLcontext *ctx, GLuint name,
+_mesa_GetTextureObjectParameterivAPPLE(struct gl_context *ctx, GLuint name,
GLenum pname, GLint* params)
{
struct gl_texture_object *bufObj;
extern void
-_mesa_init_buffer_objects( GLcontext *ctx );
+_mesa_init_buffer_objects( struct gl_context *ctx );
extern void
-_mesa_free_buffer_objects( GLcontext *ctx );
+_mesa_free_buffer_objects( struct gl_context *ctx );
extern void
-_mesa_update_default_objects_buffer_objects(GLcontext *ctx);
+_mesa_update_default_objects_buffer_objects(struct gl_context *ctx);
extern struct gl_buffer_object *
-_mesa_lookup_bufferobj(GLcontext *ctx, GLuint buffer);
+_mesa_lookup_bufferobj(struct gl_context *ctx, GLuint buffer);
extern void
_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
GLuint name, GLenum target );
extern void
-_mesa_reference_buffer_object(GLcontext *ctx,
+_mesa_reference_buffer_object(struct gl_context *ctx,
struct gl_buffer_object **ptr,
struct gl_buffer_object *bufObj);
GLenum format, GLenum type, const GLvoid *ptr);
extern const GLvoid *
-_mesa_map_pbo_source(GLcontext *ctx,
+_mesa_map_pbo_source(struct gl_context *ctx,
const struct gl_pixelstore_attrib *unpack,
const GLvoid *src);
extern const GLvoid *
-_mesa_map_validate_pbo_source(GLcontext *ctx,
+_mesa_map_validate_pbo_source(struct gl_context *ctx,
GLuint dimensions,
const struct gl_pixelstore_attrib *unpack,
GLsizei width, GLsizei height, GLsizei depth,
const char *where);
extern void
-_mesa_unmap_pbo_source(GLcontext *ctx,
+_mesa_unmap_pbo_source(struct gl_context *ctx,
const struct gl_pixelstore_attrib *unpack);
extern void *
-_mesa_map_pbo_dest(GLcontext *ctx,
+_mesa_map_pbo_dest(struct gl_context *ctx,
const struct gl_pixelstore_attrib *pack,
GLvoid *dest);
extern GLvoid *
-_mesa_map_validate_pbo_dest(GLcontext *ctx,
+_mesa_map_validate_pbo_dest(struct gl_context *ctx,
GLuint dimensions,
const struct gl_pixelstore_attrib *unpack,
GLsizei width, GLsizei height, GLsizei depth,
const char *where);
extern void
-_mesa_unmap_pbo_dest(GLcontext *ctx,
+_mesa_unmap_pbo_dest(struct gl_context *ctx,
const struct gl_pixelstore_attrib *pack);
* \return bitmask of BUFFER_BIT_* flags
*/
static GLbitfield
-supported_buffer_bitmask(const GLcontext *ctx, const struct gl_framebuffer *fb)
+supported_buffer_bitmask(const struct gl_context *ctx, const struct gl_framebuffer *fb)
{
GLbitfield mask = 0x0;
* BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT).
*/
void
-_mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers,
+_mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
const GLbitfield *destMask)
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
* \param bufferIndex the numerical index corresponding to 'buffer'
*/
void
-_mesa_readbuffer(GLcontext *ctx, GLenum buffer, GLint bufferIndex)
+_mesa_readbuffer(struct gl_context *ctx, GLenum buffer, GLint bufferIndex)
{
struct gl_framebuffer *fb = ctx->ReadBuffer;
_mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers);
extern void
-_mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers,
+_mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
const GLbitfield *destMask);
extern void
-_mesa_readbuffer(GLcontext *ctx, GLenum buffer, GLint bufferIndex);
+_mesa_readbuffer(struct gl_context *ctx, GLenum buffer, GLint bufferIndex);
extern void GLAPIENTRY
_mesa_ReadBuffer( GLenum mode );
*
* \param mask bit-mask indicating the buffers to be cleared.
*
- * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState
+ * Flushes the vertices and verifies the parameter. If __struct gl_contextRec::NewState
* is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin,
* etc. If the rasterization mode is set to GL_RENDER then requests the driver
* to clear the buffers, via the dd_function_table::Clear callback.
* Return INVALID_MASK if the drawbuffer value is invalid.
*/
static GLbitfield
-make_color_buffer_mask(GLcontext *ctx, GLint drawbuffer)
+make_color_buffer_mask(struct gl_context *ctx, GLint drawbuffer)
{
const struct gl_renderbuffer_attachment *att = ctx->DrawBuffer->Attachment;
GLbitfield mask = 0x0;
* \param [rgba]Bias - RGBA bias factors
*/
static void
-store_colortable_entries(GLcontext *ctx, struct gl_color_table *table,
+store_colortable_entries(struct gl_context *ctx, struct gl_color_table *table,
GLsizei start, GLsizei count,
GLenum format, GLenum type, const GLvoid *data,
GLfloat rScale, GLfloat rBias,
* \return GL_TRUE if we should render, GL_FALSE if we should discard
*/
GLboolean
-_mesa_check_conditional_render(GLcontext *ctx)
+_mesa_check_conditional_render(struct gl_context *ctx)
{
struct gl_query_object *q = ctx->Query.CondRenderQuery;
_mesa_EndConditionalRender(void);
extern GLboolean
-_mesa_check_conditional_render(GLcontext *ctx);
+_mesa_check_conditional_render(struct gl_context *ctx);
#endif /* CONDRENDER_H */
#endif
#include "glsl_parser_extras.h"
-
+#include <stdbool.h>
#ifndef MESA_VERBOSE
* We have to finish any pending rendering.
*/
void
-_mesa_notifySwapBuffers(__GLcontext *ctx)
+_mesa_notifySwapBuffers(struct gl_context *ctx)
{
if (MESA_VERBOSE & VERBOSE_SWAPBUFFERS)
_mesa_debug(ctx, "SwapBuffers\n");
/*@{*/
/**
- * Allocates a GLvisual structure and initializes it via
+ * Allocates a struct gl_config structure and initializes it via
* _mesa_initialize_visual().
*
* \param dbFlag double buffering
* \param alphaBits same as above.
* \param numSamples not really used.
*
- * \return pointer to new GLvisual or NULL if requested parameters can't be
+ * \return pointer to new struct gl_config or NULL if requested parameters can't be
* met.
*
* \note Need to add params for level and numAuxBuffers (at least)
*/
-GLvisual *
+struct gl_config *
_mesa_create_visual( GLboolean dbFlag,
GLboolean stereoFlag,
GLint redBits,
GLint accumAlphaBits,
GLint numSamples )
{
- GLvisual *vis = (GLvisual *) calloc(1, sizeof(GLvisual));
+ struct gl_config *vis = (struct gl_config *) calloc(1, sizeof(struct gl_config));
if (vis) {
if (!_mesa_initialize_visual(vis, dbFlag, stereoFlag,
redBits, greenBits, blueBits, alphaBits,
/**
* Makes some sanity checks and fills in the fields of the
- * GLvisual object with the given parameters. If the caller needs
- * to set additional fields, he should just probably init the whole GLvisual
+ * struct gl_config object with the given parameters. If the caller needs
+ * to set additional fields, he should just probably init the whole struct gl_config
* object himself.
* \return GL_TRUE on success, or GL_FALSE on failure.
*
* \sa _mesa_create_visual() above for the parameter description.
*/
GLboolean
-_mesa_initialize_visual( GLvisual *vis,
+_mesa_initialize_visual( struct gl_config *vis,
GLboolean dbFlag,
GLboolean stereoFlag,
GLint redBits,
vis->numAuxBuffers = 0;
vis->level = 0;
- vis->pixmapMode = 0;
vis->sampleBuffers = numSamples > 0 ? 1 : 0;
vis->samples = numSamples;
* Frees the visual structure.
*/
void
-_mesa_destroy_visual( GLvisual *vis )
+_mesa_destroy_visual( struct gl_config *vis )
{
free(vis);
}
* \sa _math_init().
*/
static void
-one_time_init( GLcontext *ctx )
+one_time_init( struct gl_context *ctx )
{
static GLboolean alreadyCalled = GL_FALSE;
(void) ctx;
* Initialize fields of gl_current_attrib (aka ctx->Current.*)
*/
static void
-_mesa_init_current(GLcontext *ctx)
+_mesa_init_current(struct gl_context *ctx)
{
GLuint i;
* some of these values (such as number of texture units).
*/
static void
-_mesa_init_constants(GLcontext *ctx)
+_mesa_init_constants(struct gl_context *ctx)
{
assert(ctx);
* Only called the first time a context is bound.
*/
static void
-check_context_limits(GLcontext *ctx)
+check_context_limits(struct gl_context *ctx)
{
/* check that we don't exceed the size of various bitfields */
assert(VERT_RESULT_MAX <=
* functions for the more complex data structures.
*/
static GLboolean
-init_attrib_groups(GLcontext *ctx)
+init_attrib_groups(struct gl_context *ctx)
{
assert(ctx);
* state.
*/
static GLboolean
-update_default_objects(GLcontext *ctx)
+update_default_objects(struct gl_context *ctx)
{
assert(ctx);
/**
- * Initialize a GLcontext struct (rendering context).
+ * Initialize a struct gl_context struct (rendering context).
*
* This includes allocating all the other structs and arrays which hang off of
* the context by pointers.
* \param driverContext pointer to driver-specific context data
*/
GLboolean
-_mesa_initialize_context_for_api(GLcontext *ctx,
+_mesa_initialize_context_for_api(struct gl_context *ctx,
gl_api api,
- const GLvisual *visual,
- GLcontext *share_list,
+ const struct gl_config *visual,
+ struct gl_context *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext)
{
switch (ctx->API) {
case API_OPENGL:
- /* Neutral tnl module stuff */
- _mesa_init_exec_vtxfmt( ctx );
- ctx->TnlModule.Current = NULL;
- ctx->TnlModule.SwapCount = 0;
-
#if FEATURE_dlist
ctx->Save = _mesa_create_save_table();
if (!ctx->Save) {
}
GLboolean
-_mesa_initialize_context(GLcontext *ctx,
- const GLvisual *visual,
- GLcontext *share_list,
+_mesa_initialize_context(struct gl_context *ctx,
+ const struct gl_config *visual,
+ struct gl_context *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext)
{
}
/**
- * Allocate and initialize a GLcontext structure.
+ * Allocate and initialize a struct gl_context structure.
* Note that the driver needs to pass in its dd_function_table here since
* we need to at least call driverFunctions->NewTextureObject to initialize
* the rendering context.
*
* \param api the GL API type to create the context for
- * \param visual a GLvisual pointer (we copy the struct contents)
+ * \param visual a struct gl_config pointer (we copy the struct contents)
* \param share_list another context to share display lists with or NULL
* \param driverFunctions points to the dd_function_table into which the
* driver has plugged in all its special functions.
* \param driverContext points to the device driver's private context state
*
- * \return pointer to a new __GLcontextRec or NULL if error.
+ * \return pointer to a new __struct gl_contextRec or NULL if error.
*/
-GLcontext *
+struct gl_context *
_mesa_create_context_for_api(gl_api api,
- const GLvisual *visual,
- GLcontext *share_list,
+ const struct gl_config *visual,
+ struct gl_context *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext)
{
- GLcontext *ctx;
+ struct gl_context *ctx;
ASSERT(visual);
/*ASSERT(driverContext);*/
- ctx = (GLcontext *) calloc(1, sizeof(GLcontext));
+ ctx = (struct gl_context *) calloc(1, sizeof(struct gl_context));
if (!ctx)
return NULL;
}
}
-GLcontext *
-_mesa_create_context(const GLvisual *visual,
- GLcontext *share_list,
+struct gl_context *
+_mesa_create_context(const struct gl_config *visual,
+ struct gl_context *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext)
{
/**
* Free the data associated with the given context.
*
- * But doesn't free the GLcontext struct itself.
+ * But doesn't free the struct gl_context struct itself.
*
* \sa _mesa_initialize_context() and init_attrib_groups().
*/
void
-_mesa_free_context_data( GLcontext *ctx )
+_mesa_free_context_data( struct gl_context *ctx )
{
if (!_mesa_get_current_context()){
/* No current context, but we may need one in order to delete
/**
- * Destroy a GLcontext structure.
+ * Destroy a struct gl_context structure.
*
* \param ctx GL context.
*
- * Calls _mesa_free_context_data() and frees the GLcontext structure itself.
+ * Calls _mesa_free_context_data() and frees the struct gl_context structure itself.
*/
void
-_mesa_destroy_context( GLcontext *ctx )
+_mesa_destroy_context( struct gl_context *ctx )
{
if (ctx) {
_mesa_free_context_data(ctx);
* structures.
*/
void
-_mesa_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask )
+_mesa_copy_context( const struct gl_context *src, struct gl_context *dst, GLuint mask )
{
if (mask & GL_ACCUM_BUFFER_BIT) {
/* OK to memcpy */
* \return GL_TRUE if compatible, GL_FALSE otherwise.
*/
static GLboolean
-check_compatible(const GLcontext *ctx, const GLframebuffer *buffer)
+check_compatible(const struct gl_context *ctx, const struct gl_framebuffer *buffer)
{
- const GLvisual *ctxvis = &ctx->Visual;
- const GLvisual *bufvis = &buffer->Visual;
+ const struct gl_config *ctxvis = &ctx->Visual;
+ const struct gl_config *bufvis = &buffer->Visual;
if (ctxvis == bufvis)
return GL_TRUE;
* Really, the device driver should totally take care of this.
*/
static void
-initialize_framebuffer_size(GLcontext *ctx, GLframebuffer *fb)
+initialize_framebuffer_size(struct gl_context *ctx, struct gl_framebuffer *fb)
{
GLuint width, height;
if (ctx->Driver.GetBufferSize) {
* Initialize the size if the given width and height are non-zero.
*/
void
-_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height)
+_mesa_check_init_viewport(struct gl_context *ctx, GLuint width, GLuint height)
{
if (!ctx->ViewportInitialized && width > 0 && height > 0) {
/* Note: set flag here, before calling _mesa_set_viewport(), to prevent
* \param readBuffer the reading framebuffer
*/
GLboolean
-_mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
- GLframebuffer *readBuffer )
+_mesa_make_current( struct gl_context *newCtx, struct gl_framebuffer *drawBuffer,
+ struct gl_framebuffer *readBuffer )
{
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(newCtx, "_mesa_make_current()\n");
* be deleted if nobody else is sharing them.
*/
GLboolean
-_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare)
+_mesa_share_state(struct gl_context *ctx, struct gl_context *ctxToShare)
{
if (ctx && ctxToShare && ctx->Shared && ctxToShare->Shared) {
struct gl_shared_state *oldSharedState = ctx->Shared;
* context. If you need speed, see the #GET_CURRENT_CONTEXT macro in
* context.h.
*/
-GLcontext *
+struct gl_context *
_mesa_get_current_context( void )
{
- return (GLcontext *) _glapi_get_context();
+ return (struct gl_context *) _glapi_get_context();
}
*
* \return pointer to dispatch_table.
*
- * Simply returns __GLcontextRec::CurrentDispatch.
+ * Simply returns __struct gl_contextRec::CurrentDispatch.
*/
struct _glapi_table *
-_mesa_get_dispatch(GLcontext *ctx)
+_mesa_get_dispatch(struct gl_context *ctx)
{
return ctx->CurrentDispatch;
}
* This is called via _mesa_error().
*/
void
-_mesa_record_error(GLcontext *ctx, GLenum error)
+_mesa_record_error(struct gl_context *ctx, GLenum error)
{
if (!ctx)
return;
* Flush commands and wait for completion.
*/
void
-_mesa_finish(GLcontext *ctx)
+_mesa_finish(struct gl_context *ctx)
{
FLUSH_CURRENT( ctx, 0 );
if (ctx->Driver.Finish) {
* Flush commands.
*/
void
-_mesa_flush(GLcontext *ctx)
+_mesa_flush(struct gl_context *ctx)
{
FLUSH_CURRENT( ctx, 0 );
if (ctx->Driver.Flush) {
* Otherwise we default to MUL/MAD.
*/
void
-_mesa_set_mvp_with_dp4( GLcontext *ctx,
+_mesa_set_mvp_with_dp4( struct gl_context *ctx,
GLboolean flag )
{
ctx->mvp_with_dp4 = flag;
* \return GL_TRUE if OK to render, GL_FALSE if not
*/
GLboolean
-_mesa_valid_to_render(GLcontext *ctx, const char *where)
+_mesa_valid_to_render(struct gl_context *ctx, const char *where)
{
+ bool vert_from_glsl_shader = false;
+ bool geom_from_glsl_shader = false;
+ bool frag_from_glsl_shader = false;
+
/* This depends on having up to date derived state (shaders) */
if (ctx->NewState)
_mesa_update_state(ctx);
if (ctx->Shader.CurrentProgram) {
+ struct gl_shader_program *const prog = ctx->Shader.CurrentProgram;
+
/* using shaders */
- if (!ctx->Shader.CurrentProgram->LinkStatus) {
+ if (!prog->LinkStatus) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(shader not linked)", where);
return GL_FALSE;
#if 0 /* not normally enabled */
{
char errMsg[100];
- if (!_mesa_validate_shader_program(ctx, ctx->Shader.CurrentProgram,
- errMsg)) {
+ if (!_mesa_validate_shader_program(ctx, prog, errMsg)) {
_mesa_warning(ctx, "Shader program %u is invalid: %s",
- ctx->Shader.CurrentProgram->Name, errMsg);
+ prog->Name, errMsg);
}
}
#endif
+
+ /* Figure out which shader stages are provided by the GLSL program. For
+ * any stages that are not provided, the corresponding assembly shader
+ * target will be validated below.
+ */
+ vert_from_glsl_shader =
+ prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL;
+ geom_from_glsl_shader =
+ prog->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL;
+ frag_from_glsl_shader =
+ prog->_LinkedShaders[MESA_SHADER_FRAGMENT] != NULL;
}
- else {
- if (ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(vertex program not valid)", where);
- return GL_FALSE;
- }
- if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(fragment program not valid)", where);
- return GL_FALSE;
- }
+
+
+ /* Any shader stages that are not supplied by the GLSL shader and have
+ * assembly shaders enabled must now be validated.
+ */
+ if (!vert_from_glsl_shader
+ && ctx->VertexProgram.Enabled && !ctx->VertexProgram._Enabled) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(vertex program not valid)", where);
+ return GL_FALSE;
+ }
+
+ /* FINISHME: If GL_NV_geometry_program4 is ever supported, the current
+ * FINISHME: geometry program should validated here.
+ */
+ (void) geom_from_glsl_shader;
+
+ if (!frag_from_glsl_shader
+ && ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(fragment program not valid)", where);
+ return GL_FALSE;
}
if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
*
* There are three large Mesa data types/classes which are meant to be
* used by device drivers:
- * - GLcontext: this contains the Mesa rendering state
- * - GLvisual: this describes the color buffer (RGB vs. ci), whether or not
+ * - struct gl_context: this contains the Mesa rendering state
+ * - struct gl_config: this describes the color buffer (RGB vs. ci), whether or not
* there's a depth buffer, stencil buffer, etc.
- * - GLframebuffer: contains pointers to the depth buffer, stencil buffer,
+ * - struct gl_framebuffer: contains pointers to the depth buffer, stencil buffer,
* accum buffer and alpha buffers.
*
* These types should be encapsulated by corresponding device driver
* data types. See xmesa.h and xmesaP.h for an example.
*
- * In OOP terms, GLcontext, GLvisual, and GLframebuffer are base classes
+ * In OOP terms, struct gl_context, struct gl_config, and struct gl_framebuffer are base classes
* which the device driver must derive from.
*
* The following functions create and destroy these data types.
/** \name Visual-related functions */
/*@{*/
-extern GLvisual *
+extern struct gl_config *
_mesa_create_visual( GLboolean dbFlag,
GLboolean stereoFlag,
GLint redBits,
GLint numSamples );
extern GLboolean
-_mesa_initialize_visual( GLvisual *v,
+_mesa_initialize_visual( struct gl_config *v,
GLboolean dbFlag,
GLboolean stereoFlag,
GLint redBits,
GLint numSamples );
extern void
-_mesa_destroy_visual( GLvisual *vis );
+_mesa_destroy_visual( struct gl_config *vis );
/*@}*/
/** \name Context-related functions */
/*@{*/
-extern GLcontext *
-_mesa_create_context( const GLvisual *visual,
- GLcontext *share_list,
+extern struct gl_context *
+_mesa_create_context( const struct gl_config *visual,
+ struct gl_context *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext );
extern GLboolean
-_mesa_initialize_context( GLcontext *ctx,
- const GLvisual *visual,
- GLcontext *share_list,
+_mesa_initialize_context( struct gl_context *ctx,
+ const struct gl_config *visual,
+ struct gl_context *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext );
-extern GLcontext *
+extern struct gl_context *
_mesa_create_context_for_api(gl_api api,
- const GLvisual *visual,
- GLcontext *share_list,
+ const struct gl_config *visual,
+ struct gl_context *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext);
extern GLboolean
-_mesa_initialize_context_for_api(GLcontext *ctx,
+_mesa_initialize_context_for_api(struct gl_context *ctx,
gl_api api,
- const GLvisual *visual,
- GLcontext *share_list,
+ const struct gl_config *visual,
+ struct gl_context *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext);
extern void
-_mesa_free_context_data( GLcontext *ctx );
+_mesa_free_context_data( struct gl_context *ctx );
extern void
-_mesa_destroy_context( GLcontext *ctx );
+_mesa_destroy_context( struct gl_context *ctx );
extern void
-_mesa_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask);
+_mesa_copy_context(const struct gl_context *src, struct gl_context *dst, GLuint mask);
extern void
-_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height);
+_mesa_check_init_viewport(struct gl_context *ctx, GLuint width, GLuint height);
extern GLboolean
-_mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer,
- GLframebuffer *readBuffer );
+_mesa_make_current( struct gl_context *ctx, struct gl_framebuffer *drawBuffer,
+ struct gl_framebuffer *readBuffer );
extern GLboolean
-_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare);
+_mesa_share_state(struct gl_context *ctx, struct gl_context *ctxToShare);
-extern GLcontext *
+extern struct gl_context *
_mesa_get_current_context(void);
/*@}*/
extern void
-_mesa_init_get_hash(GLcontext *ctx);
+_mesa_init_get_hash(struct gl_context *ctx);
extern void
-_mesa_notifySwapBuffers(__GLcontext *gc);
+_mesa_notifySwapBuffers(struct gl_context *gc);
extern struct _glapi_table *
-_mesa_get_dispatch(GLcontext *ctx);
+_mesa_get_dispatch(struct gl_context *ctx);
void
-_mesa_set_mvp_with_dp4( GLcontext *ctx,
+_mesa_set_mvp_with_dp4( struct gl_context *ctx,
GLboolean flag );
extern GLboolean
-_mesa_valid_to_render(GLcontext *ctx, const char *where);
+_mesa_valid_to_render(struct gl_context *ctx, const char *where);
/*@{*/
extern void
-_mesa_record_error( GLcontext *ctx, GLenum error );
+_mesa_record_error( struct gl_context *ctx, GLenum error );
extern void
-_mesa_finish(GLcontext *ctx);
+_mesa_finish(struct gl_context *ctx);
extern void
-_mesa_flush(GLcontext *ctx);
+_mesa_flush(struct gl_context *ctx);
extern void GLAPIENTRY
*
* Checks if dd_function_table::NeedFlush is marked to flush stored vertices,
* and calls dd_function_table::FlushVertices if so. Marks
- * __GLcontextRec::NewState with \p newstate.
+ * __struct gl_contextRec::NewState with \p newstate.
*/
#define FLUSH_VERTICES(ctx, newstate) \
do { \
*
* Checks if dd_function_table::NeedFlush is marked to flush current state,
* and calls dd_function_table::FlushVertices if so. Marks
- * __GLcontextRec::NewState with \p newstate.
+ * __struct gl_contextRec::NewState with \p newstate.
*/
#define FLUSH_CURRENT(ctx, newstate) \
do { \
* Only the GL_RENDERER query must be implemented. Otherwise, NULL can be
* returned.
*/
- const GLubyte * (*GetString)( GLcontext *ctx, GLenum name );
+ const GLubyte * (*GetString)( struct gl_context *ctx, GLenum name );
/**
* Notify the driver after Mesa has made some internal state changes.
* This is in addition to any state change callbacks Mesa may already have
* made.
*/
- void (*UpdateState)( GLcontext *ctx, GLbitfield new_state );
+ void (*UpdateState)( struct gl_context *ctx, GLbitfield new_state );
/**
* Get the width and height of the named buffer/window.
* Mesa uses this to determine when the driver's window size has changed.
* XXX OBSOLETE: this function will be removed in the future.
*/
- void (*GetBufferSize)( GLframebuffer *buffer,
+ void (*GetBufferSize)( struct gl_framebuffer *buffer,
GLuint *width, GLuint *height );
/**
* Resize the given framebuffer to the given size.
* XXX OBSOLETE: this function will be removed in the future.
*/
- void (*ResizeBuffers)( GLcontext *ctx, GLframebuffer *fb,
+ void (*ResizeBuffers)( struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint width, GLuint height);
/**
* Called whenever an error is generated.
- * __GLcontextRec::ErrorValue contains the error value.
+ * __struct gl_contextRec::ErrorValue contains the error value.
*/
- void (*Error)( GLcontext *ctx );
+ void (*Error)( struct gl_context *ctx );
/**
* This is called whenever glFinish() is called.
*/
- void (*Finish)( GLcontext *ctx );
+ void (*Finish)( struct gl_context *ctx );
/**
* This is called whenever glFlush() is called.
*/
- void (*Flush)( GLcontext *ctx );
+ void (*Flush)( struct gl_context *ctx );
/**
* Clear the color/depth/stencil/accum buffer(s).
* \param buffers a bitmask of BUFFER_BIT_* flags indicating which
* renderbuffers need to be cleared.
*/
- void (*Clear)( GLcontext *ctx, GLbitfield buffers );
+ void (*Clear)( struct gl_context *ctx, GLbitfield buffers );
/**
* Execute glAccum command.
*/
- void (*Accum)( GLcontext *ctx, GLenum op, GLfloat value );
+ void (*Accum)( struct gl_context *ctx, GLenum op, GLfloat value );
/**
* Execute glRasterPos, updating the ctx->Current.Raster fields
*/
- void (*RasterPos)( GLcontext *ctx, const GLfloat v[4] );
+ void (*RasterPos)( struct gl_context *ctx, const GLfloat v[4] );
/**
* \name Image-related functions
* Called by glDrawPixels().
* \p unpack describes how to unpack the source image data.
*/
- void (*DrawPixels)( GLcontext *ctx,
+ void (*DrawPixels)( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
/**
* Called by glReadPixels().
*/
- void (*ReadPixels)( GLcontext *ctx,
+ void (*ReadPixels)( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
/**
* Called by glCopyPixels().
*/
- void (*CopyPixels)( GLcontext *ctx, GLint srcx, GLint srcy,
+ void (*CopyPixels)( struct gl_context *ctx, GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
GLint dstx, GLint dsty, GLenum type );
/**
* Called by glBitmap().
*/
- void (*Bitmap)( GLcontext *ctx,
+ void (*Bitmap)( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap );
* functions. The driver should examine \p internalFormat and return a
* gl_format value.
*/
- GLuint (*ChooseTextureFormat)( GLcontext *ctx, GLint internalFormat,
+ GLuint (*ChooseTextureFormat)( struct gl_context *ctx, GLint internalFormat,
GLenum srcFormat, GLenum srcType );
/**
*
* Drivers should call a fallback routine from texstore.c if needed.
*/
- void (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level,
+ void (*TexImage1D)( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
*
* \sa dd_function_table::TexImage1D.
*/
- void (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level,
+ void (*TexImage2D)( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
*
* \sa dd_function_table::TexImage1D.
*/
- void (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level,
+ void (*TexImage3D)( struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
*
* The driver should use a fallback routine from texstore.c if needed.
*/
- void (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
+ void (*TexSubImage1D)( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLsizei width,
GLenum format, GLenum type,
const GLvoid *pixels,
*
* \sa dd_function_table::TexSubImage1D.
*/
- void (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
+ void (*TexSubImage2D)( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
*
* \sa dd_function_table::TexSubImage1D.
*/
- void (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
+ void (*TexSubImage3D)( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLint depth,
GLenum format, GLenum type,
/**
* Called by glGetTexImage().
*/
- void (*GetTexImage)( GLcontext *ctx, GLenum target, GLint level,
+ void (*GetTexImage)( struct gl_context *ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid *pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage );
*
* Drivers should use a fallback routine from texstore.c if needed.
*/
- void (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level,
+ void (*CopyTexImage1D)( struct gl_context *ctx, GLenum target, GLint level,
GLenum internalFormat, GLint x, GLint y,
GLsizei width, GLint border );
*
* Drivers should use a fallback routine from texstore.c if needed.
*/
- void (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level,
+ void (*CopyTexImage2D)( struct gl_context *ctx, GLenum target, GLint level,
GLenum internalFormat, GLint x, GLint y,
GLsizei width, GLsizei height, GLint border );
*
* Drivers should use a fallback routine from texstore.c if needed.
*/
- void (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level,
+ void (*CopyTexSubImage1D)( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset,
GLint x, GLint y, GLsizei width );
/**
*
* Drivers should use a fallback routine from texstore.c if needed.
*/
- void (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level,
+ void (*CopyTexSubImage2D)( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y,
GLsizei width, GLsizei height );
*
* Drivers should use a fallback routine from texstore.c if needed.
*/
- void (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level,
+ void (*CopyTexSubImage3D)( struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y,
GLsizei width, GLsizei height );
/**
* Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled.
*/
- void (*GenerateMipmap)(GLcontext *ctx, GLenum target,
+ void (*GenerateMipmap)(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj);
/**
*
* \return GL_TRUE if the proxy test passes, or GL_FALSE if the test fails.
*/
- GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target,
+ GLboolean (*TestProxyTexImage)(struct gl_context *ctx, GLenum target,
GLint level, GLint internalFormat,
GLenum format, GLenum type,
GLint width, GLint height,
* \a retainInternalCopy is returned by this function and indicates whether
* core Mesa should keep an internal copy of the texture image.
*/
- void (*CompressedTexImage1D)( GLcontext *ctx, GLenum target,
+ void (*CompressedTexImage1D)( struct gl_context *ctx, GLenum target,
GLint level, GLint internalFormat,
GLsizei width, GLint border,
GLsizei imageSize, const GLvoid *data,
*
* \sa dd_function_table::CompressedTexImage1D.
*/
- void (*CompressedTexImage2D)( GLcontext *ctx, GLenum target,
+ void (*CompressedTexImage2D)( struct gl_context *ctx, GLenum target,
GLint level, GLint internalFormat,
GLsizei width, GLsizei height, GLint border,
GLsizei imageSize, const GLvoid *data,
*
* \sa dd_function_table::CompressedTexImage3D.
*/
- void (*CompressedTexImage3D)( GLcontext *ctx, GLenum target,
+ void (*CompressedTexImage3D)( struct gl_context *ctx, GLenum target,
GLint level, GLint internalFormat,
GLsizei width, GLsizei height, GLsizei depth,
GLint border,
* \param texImage is the target texture image. It will have the texture \p
* width, \p height, \p depth, \p border and \p internalFormat information.
*/
- void (*CompressedTexSubImage1D)(GLcontext *ctx, GLenum target, GLint level,
+ void (*CompressedTexSubImage1D)(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLsizei width,
GLenum format,
GLsizei imageSize, const GLvoid *data,
*
* \sa dd_function_table::CompressedTexImage3D.
*/
- void (*CompressedTexSubImage2D)(GLcontext *ctx, GLenum target, GLint level,
+ void (*CompressedTexSubImage2D)(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLint height,
GLenum format,
*
* \sa dd_function_table::CompressedTexImage3D.
*/
- void (*CompressedTexSubImage3D)(GLcontext *ctx, GLenum target, GLint level,
+ void (*CompressedTexSubImage3D)(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLint height, GLint depth,
GLenum format,
/**
* Called by glGetCompressedTexImage.
*/
- void (*GetCompressedTexImage)(GLcontext *ctx, GLenum target, GLint level,
+ void (*GetCompressedTexImage)(struct gl_context *ctx, GLenum target, GLint level,
GLvoid *img,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
/**
* Called by glBindTexture().
*/
- void (*BindTexture)( GLcontext *ctx, GLenum target,
+ void (*BindTexture)( struct gl_context *ctx, GLenum target,
struct gl_texture_object *tObj );
/**
* A new gl_texture_object should be returned. The driver should
* attach to it any device-specific info it needs.
*/
- struct gl_texture_object * (*NewTextureObject)( GLcontext *ctx, GLuint name,
+ struct gl_texture_object * (*NewTextureObject)( struct gl_context *ctx, GLuint name,
GLenum target );
/**
* Called when a texture object is about to be deallocated.
* Driver should delete the gl_texture_object object and anything
* hanging off of it.
*/
- void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
+ void (*DeleteTexture)( struct gl_context *ctx, struct gl_texture_object *tObj );
/**
* Called to allocate a new texture image object.
*/
- struct gl_texture_image * (*NewTextureImage)( GLcontext *ctx );
+ struct gl_texture_image * (*NewTextureImage)( struct gl_context *ctx );
/**
* Called to free tImage->Data.
*/
- void (*FreeTexImageData)( GLcontext *ctx, struct gl_texture_image *tImage );
+ void (*FreeTexImageData)( struct gl_context *ctx, struct gl_texture_image *tImage );
/** Map texture image data into user space */
- void (*MapTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
+ void (*MapTexture)( struct gl_context *ctx, struct gl_texture_object *tObj );
/** Unmap texture images from user space */
- void (*UnmapTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
+ void (*UnmapTexture)( struct gl_context *ctx, struct gl_texture_object *tObj );
/**
* Note: no context argument. This function doesn't initially look
/**
* Called by glAreTextureResident().
*/
- GLboolean (*IsTextureResident)( GLcontext *ctx,
+ GLboolean (*IsTextureResident)( struct gl_context *ctx,
struct gl_texture_object *t );
/**
* If \p tObj is NULL then the shared texture palette
* gl_texture_object::Palette is to be updated.
*/
- void (*UpdateTexturePalette)( GLcontext *ctx,
+ void (*UpdateTexturePalette)( struct gl_context *ctx,
struct gl_texture_object *tObj );
/*@}*/
* \name Imaging functionality
*/
/*@{*/
- void (*CopyColorTable)( GLcontext *ctx,
+ void (*CopyColorTable)( struct gl_context *ctx,
GLenum target, GLenum internalformat,
GLint x, GLint y, GLsizei width );
- void (*CopyColorSubTable)( GLcontext *ctx,
+ void (*CopyColorSubTable)( struct gl_context *ctx,
GLenum target, GLsizei start,
GLint x, GLint y, GLsizei width );
/*@}*/
*/
/*@{*/
/** Bind a vertex/fragment program */
- void (*BindProgram)(GLcontext *ctx, GLenum target, struct gl_program *prog);
+ void (*BindProgram)(struct gl_context *ctx, GLenum target, struct gl_program *prog);
/** Allocate a new program */
- struct gl_program * (*NewProgram)(GLcontext *ctx, GLenum target, GLuint id);
+ struct gl_program * (*NewProgram)(struct gl_context *ctx, GLenum target, GLuint id);
/** Delete a program */
- void (*DeleteProgram)(GLcontext *ctx, struct gl_program *prog);
+ void (*DeleteProgram)(struct gl_context *ctx, struct gl_program *prog);
/**
* Notify driver that a program string (and GPU code) has been specified
* or modified. Return GL_TRUE or GL_FALSE to indicate if the program is
* supported by the driver.
*/
- GLboolean (*ProgramStringNotify)(GLcontext *ctx, GLenum target,
+ GLboolean (*ProgramStringNotify)(struct gl_context *ctx, GLenum target,
struct gl_program *prog);
/** Query if program can be loaded onto hardware */
- GLboolean (*IsProgramNative)(GLcontext *ctx, GLenum target,
+ GLboolean (*IsProgramNative)(struct gl_context *ctx, GLenum target,
struct gl_program *prog);
/*@}*/
* have CompileShader() called, so if lowering passes are done they
* need to also be performed in LinkShader().
*/
- GLboolean (*CompileShader)(GLcontext *ctx, struct gl_shader *shader);
+ GLboolean (*CompileShader)(struct gl_context *ctx, struct gl_shader *shader);
/**
* Called when a shader program is linked.
*
* This gives drivers an opportunity to clone the IR and make their
* own transformations on it for the purposes of code generation.
*/
- GLboolean (*LinkShader)(GLcontext *ctx, struct gl_shader_program *shader);
+ GLboolean (*LinkShader)(struct gl_context *ctx, struct gl_shader_program *shader);
/*@}*/
/**
*/
/*@{*/
/** Specify the alpha test function */
- void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLfloat ref);
+ void (*AlphaFunc)(struct gl_context *ctx, GLenum func, GLfloat ref);
/** Set the blend color */
- void (*BlendColor)(GLcontext *ctx, const GLfloat color[4]);
+ void (*BlendColor)(struct gl_context *ctx, const GLfloat color[4]);
/** Set the blend equation */
- void (*BlendEquationSeparate)(GLcontext *ctx, GLenum modeRGB, GLenum modeA);
+ void (*BlendEquationSeparate)(struct gl_context *ctx, GLenum modeRGB, GLenum modeA);
/** Specify pixel arithmetic */
- void (*BlendFuncSeparate)(GLcontext *ctx,
+ void (*BlendFuncSeparate)(struct gl_context *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA);
/** Specify clear values for the color buffers */
- void (*ClearColor)(GLcontext *ctx, const GLfloat color[4]);
+ void (*ClearColor)(struct gl_context *ctx, const GLfloat color[4]);
/** Specify the clear value for the depth buffer */
- void (*ClearDepth)(GLcontext *ctx, GLclampd d);
+ void (*ClearDepth)(struct gl_context *ctx, GLclampd d);
/** Specify the clear value for the stencil buffer */
- void (*ClearStencil)(GLcontext *ctx, GLint s);
+ void (*ClearStencil)(struct gl_context *ctx, GLint s);
/** Specify a plane against which all geometry is clipped */
- void (*ClipPlane)(GLcontext *ctx, GLenum plane, const GLfloat *equation );
+ void (*ClipPlane)(struct gl_context *ctx, GLenum plane, const GLfloat *equation );
/** Enable and disable writing of frame buffer color components */
- void (*ColorMask)(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
+ void (*ColorMask)(struct gl_context *ctx, GLboolean rmask, GLboolean gmask,
GLboolean bmask, GLboolean amask );
- void (*ColorMaskIndexed)(GLcontext *ctx, GLuint buf, GLboolean rmask,
+ void (*ColorMaskIndexed)(struct gl_context *ctx, GLuint buf, GLboolean rmask,
GLboolean gmask, GLboolean bmask, GLboolean amask);
/** Cause a material color to track the current color */
- void (*ColorMaterial)(GLcontext *ctx, GLenum face, GLenum mode);
+ void (*ColorMaterial)(struct gl_context *ctx, GLenum face, GLenum mode);
/** Specify whether front- or back-facing facets can be culled */
- void (*CullFace)(GLcontext *ctx, GLenum mode);
+ void (*CullFace)(struct gl_context *ctx, GLenum mode);
/** Define front- and back-facing polygons */
- void (*FrontFace)(GLcontext *ctx, GLenum mode);
+ void (*FrontFace)(struct gl_context *ctx, GLenum mode);
/** Specify the value used for depth buffer comparisons */
- void (*DepthFunc)(GLcontext *ctx, GLenum func);
+ void (*DepthFunc)(struct gl_context *ctx, GLenum func);
/** Enable or disable writing into the depth buffer */
- void (*DepthMask)(GLcontext *ctx, GLboolean flag);
+ void (*DepthMask)(struct gl_context *ctx, GLboolean flag);
/** Specify mapping of depth values from NDC to window coordinates */
- void (*DepthRange)(GLcontext *ctx, GLclampd nearval, GLclampd farval);
+ void (*DepthRange)(struct gl_context *ctx, GLclampd nearval, GLclampd farval);
/** Specify the current buffer for writing */
- void (*DrawBuffer)( GLcontext *ctx, GLenum buffer );
+ void (*DrawBuffer)( struct gl_context *ctx, GLenum buffer );
/** Specify the buffers for writing for fragment programs*/
- void (*DrawBuffers)( GLcontext *ctx, GLsizei n, const GLenum *buffers );
+ void (*DrawBuffers)( struct gl_context *ctx, GLsizei n, const GLenum *buffers );
/** Enable or disable server-side gl capabilities */
- void (*Enable)(GLcontext *ctx, GLenum cap, GLboolean state);
+ void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state);
/** Specify fog parameters */
- void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
+ void (*Fogfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params);
/** Specify implementation-specific hints */
- void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
+ void (*Hint)(struct gl_context *ctx, GLenum target, GLenum mode);
/** Set light source parameters.
* Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already
* been transformed to eye-space.
*/
- void (*Lightfv)(GLcontext *ctx, GLenum light,
+ void (*Lightfv)(struct gl_context *ctx, GLenum light,
GLenum pname, const GLfloat *params );
/** Set the lighting model parameters */
- void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
+ void (*LightModelfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params);
/** Specify the line stipple pattern */
- void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern );
+ void (*LineStipple)(struct gl_context *ctx, GLint factor, GLushort pattern );
/** Specify the width of rasterized lines */
- void (*LineWidth)(GLcontext *ctx, GLfloat width);
+ void (*LineWidth)(struct gl_context *ctx, GLfloat width);
/** Specify a logical pixel operation for color index rendering */
- void (*LogicOpcode)(GLcontext *ctx, GLenum opcode);
- void (*PointParameterfv)(GLcontext *ctx, GLenum pname,
+ void (*LogicOpcode)(struct gl_context *ctx, GLenum opcode);
+ void (*PointParameterfv)(struct gl_context *ctx, GLenum pname,
const GLfloat *params);
/** Specify the diameter of rasterized points */
- void (*PointSize)(GLcontext *ctx, GLfloat size);
+ void (*PointSize)(struct gl_context *ctx, GLfloat size);
/** Select a polygon rasterization mode */
- void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
+ void (*PolygonMode)(struct gl_context *ctx, GLenum face, GLenum mode);
/** Set the scale and units used to calculate depth values */
- void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units);
+ void (*PolygonOffset)(struct gl_context *ctx, GLfloat factor, GLfloat units);
/** Set the polygon stippling pattern */
- void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
+ void (*PolygonStipple)(struct gl_context *ctx, const GLubyte *mask );
/* Specifies the current buffer for reading */
- void (*ReadBuffer)( GLcontext *ctx, GLenum buffer );
+ void (*ReadBuffer)( struct gl_context *ctx, GLenum buffer );
/** Set rasterization mode */
- void (*RenderMode)(GLcontext *ctx, GLenum mode );
+ void (*RenderMode)(struct gl_context *ctx, GLenum mode );
/** Define the scissor box */
- void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
+ void (*Scissor)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
/** Select flat or smooth shading */
- void (*ShadeModel)(GLcontext *ctx, GLenum mode);
+ void (*ShadeModel)(struct gl_context *ctx, GLenum mode);
/** OpenGL 2.0 two-sided StencilFunc */
- void (*StencilFuncSeparate)(GLcontext *ctx, GLenum face, GLenum func,
+ void (*StencilFuncSeparate)(struct gl_context *ctx, GLenum face, GLenum func,
GLint ref, GLuint mask);
/** OpenGL 2.0 two-sided StencilMask */
- void (*StencilMaskSeparate)(GLcontext *ctx, GLenum face, GLuint mask);
+ void (*StencilMaskSeparate)(struct gl_context *ctx, GLenum face, GLuint mask);
/** OpenGL 2.0 two-sided StencilOp */
- void (*StencilOpSeparate)(GLcontext *ctx, GLenum face, GLenum fail,
+ void (*StencilOpSeparate)(struct gl_context *ctx, GLenum face, GLenum fail,
GLenum zfail, GLenum zpass);
/** Control the generation of texture coordinates */
- void (*TexGen)(GLcontext *ctx, GLenum coord, GLenum pname,
+ void (*TexGen)(struct gl_context *ctx, GLenum coord, GLenum pname,
const GLfloat *params);
/** Set texture environment parameters */
- void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname,
+ void (*TexEnv)(struct gl_context *ctx, GLenum target, GLenum pname,
const GLfloat *param);
/** Set texture parameters */
- void (*TexParameter)(GLcontext *ctx, GLenum target,
+ void (*TexParameter)(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat *params);
/** Set the viewport */
- void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
+ void (*Viewport)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
/*@}*/
* \name Vertex/pixel buffer object functions
*/
/*@{*/
- void (*BindBuffer)( GLcontext *ctx, GLenum target,
+ void (*BindBuffer)( struct gl_context *ctx, GLenum target,
struct gl_buffer_object *obj );
- struct gl_buffer_object * (*NewBufferObject)( GLcontext *ctx, GLuint buffer,
+ struct gl_buffer_object * (*NewBufferObject)( struct gl_context *ctx, GLuint buffer,
GLenum target );
- void (*DeleteBuffer)( GLcontext *ctx, struct gl_buffer_object *obj );
+ void (*DeleteBuffer)( struct gl_context *ctx, struct gl_buffer_object *obj );
- GLboolean (*BufferData)( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
+ GLboolean (*BufferData)( struct gl_context *ctx, GLenum target, GLsizeiptrARB size,
const GLvoid *data, GLenum usage,
struct gl_buffer_object *obj );
- void (*BufferSubData)( GLcontext *ctx, GLenum target, GLintptrARB offset,
+ void (*BufferSubData)( struct gl_context *ctx, GLenum target, GLintptrARB offset,
GLsizeiptrARB size, const GLvoid *data,
struct gl_buffer_object *obj );
- void (*GetBufferSubData)( GLcontext *ctx, GLenum target,
+ void (*GetBufferSubData)( struct gl_context *ctx, GLenum target,
GLintptrARB offset, GLsizeiptrARB size,
GLvoid *data, struct gl_buffer_object *obj );
- void * (*MapBuffer)( GLcontext *ctx, GLenum target, GLenum access,
+ void * (*MapBuffer)( struct gl_context *ctx, GLenum target, GLenum access,
struct gl_buffer_object *obj );
- void (*CopyBufferSubData)( GLcontext *ctx,
+ void (*CopyBufferSubData)( struct gl_context *ctx,
struct gl_buffer_object *src,
struct gl_buffer_object *dst,
GLintptr readOffset, GLintptr writeOffset,
/* May return NULL if MESA_MAP_NOWAIT_BIT is set in access:
*/
- void * (*MapBufferRange)( GLcontext *ctx, GLenum target, GLintptr offset,
+ void * (*MapBufferRange)( struct gl_context *ctx, GLenum target, GLintptr offset,
GLsizeiptr length, GLbitfield access,
struct gl_buffer_object *obj);
- void (*FlushMappedBufferRange)(GLcontext *ctx, GLenum target,
+ void (*FlushMappedBufferRange)(struct gl_context *ctx, GLenum target,
GLintptr offset, GLsizeiptr length,
struct gl_buffer_object *obj);
- GLboolean (*UnmapBuffer)( GLcontext *ctx, GLenum target,
+ GLboolean (*UnmapBuffer)( struct gl_context *ctx, GLenum target,
struct gl_buffer_object *obj );
/*@}*/
*/
/*@{*/
/* variations on ObjectPurgeable */
- GLenum (*BufferObjectPurgeable)( GLcontext *ctx, struct gl_buffer_object *obj, GLenum option );
- GLenum (*RenderObjectPurgeable)( GLcontext *ctx, struct gl_renderbuffer *obj, GLenum option );
- GLenum (*TextureObjectPurgeable)( GLcontext *ctx, struct gl_texture_object *obj, GLenum option );
+ GLenum (*BufferObjectPurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option );
+ GLenum (*RenderObjectPurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option );
+ GLenum (*TextureObjectPurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option );
/* variations on ObjectUnpurgeable */
- GLenum (*BufferObjectUnpurgeable)( GLcontext *ctx, struct gl_buffer_object *obj, GLenum option );
- GLenum (*RenderObjectUnpurgeable)( GLcontext *ctx, struct gl_renderbuffer *obj, GLenum option );
- GLenum (*TextureObjectUnpurgeable)( GLcontext *ctx, struct gl_texture_object *obj, GLenum option );
+ GLenum (*BufferObjectUnpurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option );
+ GLenum (*RenderObjectUnpurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option );
+ GLenum (*TextureObjectUnpurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option );
/*@}*/
/**
* \name Functions for GL_EXT_framebuffer_{object,blit}.
*/
/*@{*/
- struct gl_framebuffer * (*NewFramebuffer)(GLcontext *ctx, GLuint name);
- struct gl_renderbuffer * (*NewRenderbuffer)(GLcontext *ctx, GLuint name);
- void (*BindFramebuffer)(GLcontext *ctx, GLenum target,
+ struct gl_framebuffer * (*NewFramebuffer)(struct gl_context *ctx, GLuint name);
+ struct gl_renderbuffer * (*NewRenderbuffer)(struct gl_context *ctx, GLuint name);
+ void (*BindFramebuffer)(struct gl_context *ctx, GLenum target,
struct gl_framebuffer *drawFb,
struct gl_framebuffer *readFb);
- void (*FramebufferRenderbuffer)(GLcontext *ctx,
+ void (*FramebufferRenderbuffer)(struct gl_context *ctx,
struct gl_framebuffer *fb,
GLenum attachment,
struct gl_renderbuffer *rb);
- void (*RenderTexture)(GLcontext *ctx,
+ void (*RenderTexture)(struct gl_context *ctx,
struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att);
- void (*FinishRenderTexture)(GLcontext *ctx,
+ void (*FinishRenderTexture)(struct gl_context *ctx,
struct gl_renderbuffer_attachment *att);
- void (*ValidateFramebuffer)(GLcontext *ctx,
+ void (*ValidateFramebuffer)(struct gl_context *ctx,
struct gl_framebuffer *fb);
/*@}*/
- void (*BlitFramebuffer)(GLcontext *ctx,
+ void (*BlitFramebuffer)(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
* \name Query objects
*/
/*@{*/
- struct gl_query_object * (*NewQueryObject)(GLcontext *ctx, GLuint id);
- void (*DeleteQuery)(GLcontext *ctx, struct gl_query_object *q);
- void (*BeginQuery)(GLcontext *ctx, struct gl_query_object *q);
- void (*EndQuery)(GLcontext *ctx, struct gl_query_object *q);
- void (*CheckQuery)(GLcontext *ctx, struct gl_query_object *q);
- void (*WaitQuery)(GLcontext *ctx, struct gl_query_object *q);
+ struct gl_query_object * (*NewQueryObject)(struct gl_context *ctx, GLuint id);
+ void (*DeleteQuery)(struct gl_context *ctx, struct gl_query_object *q);
+ void (*BeginQuery)(struct gl_context *ctx, struct gl_query_object *q);
+ void (*EndQuery)(struct gl_context *ctx, struct gl_query_object *q);
+ void (*CheckQuery)(struct gl_context *ctx, struct gl_query_object *q);
+ void (*WaitQuery)(struct gl_context *ctx, struct gl_query_object *q);
/*@}*/
* \name Vertex Array objects
*/
/*@{*/
- struct gl_array_object * (*NewArrayObject)(GLcontext *ctx, GLuint id);
- void (*DeleteArrayObject)(GLcontext *ctx, struct gl_array_object *obj);
- void (*BindArrayObject)(GLcontext *ctx, struct gl_array_object *obj);
+ struct gl_array_object * (*NewArrayObject)(struct gl_context *ctx, GLuint id);
+ void (*DeleteArrayObject)(struct gl_context *ctx, struct gl_array_object *obj);
+ void (*BindArrayObject)(struct gl_context *ctx, struct gl_array_object *obj);
/*@}*/
/**
* \name GLSL-related functions (ARB extensions and OpenGL 2.x)
*/
/*@{*/
- struct gl_shader *(*NewShader)(GLcontext *ctx, GLuint name, GLenum type);
- void (*DeleteShader)(GLcontext *ctx, struct gl_shader *shader);
- struct gl_shader_program *(*NewShaderProgram)(GLcontext *ctx, GLuint name);
- void (*DeleteShaderProgram)(GLcontext *ctx,
+ struct gl_shader *(*NewShader)(struct gl_context *ctx, GLuint name, GLenum type);
+ void (*DeleteShader)(struct gl_context *ctx, struct gl_shader *shader);
+ struct gl_shader_program *(*NewShaderProgram)(struct gl_context *ctx, GLuint name);
+ void (*DeleteShaderProgram)(struct gl_context *ctx,
struct gl_shader_program *shProg);
- void (*UseProgram)(GLcontext *ctx, struct gl_shader_program *shProg);
+ void (*UseProgram)(struct gl_context *ctx, struct gl_shader_program *shProg);
/*@}*/
* This must be non-NULL if a driver installs a custom T&L module and sets
* the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
*/
- void (*ValidateTnlModule)( GLcontext *ctx, GLuint new_state );
+ void (*ValidateTnlModule)( struct gl_context *ctx, GLuint new_state );
#define PRIM_OUTSIDE_BEGIN_END (GL_POLYGON+1)
#define FLUSH_UPDATE_CURRENT 0x2
/**
* Set by the driver-supplied T&L engine whenever vertices are buffered
- * between glBegin()/glEnd() objects or __GLcontextRec::Current is not
+ * between glBegin()/glEnd() objects or __struct gl_contextRec::Current is not
* updated.
*
* The dd_function_table::FlushVertices call below may be used to resolve
/* Called prior to any of the GLvertexformat functions being
* called. Paired with Driver.FlushVertices().
*/
- void (*BeginVertices)( GLcontext *ctx );
+ void (*BeginVertices)( struct gl_context *ctx );
/**
* If inside glBegin()/glEnd(), it should ASSERT(0). Otherwise, if
* FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
* vertices, if FLUSH_UPDATE_CURRENT bit is set updates
- * __GLcontextRec::Current and gl_light_attrib::Material
+ * __struct gl_contextRec::Current and gl_light_attrib::Material
*
* Note that the default T&L engine never clears the
* FLUSH_UPDATE_CURRENT bit, even after performing the update.
*/
- void (*FlushVertices)( GLcontext *ctx, GLuint flags );
- void (*SaveFlushVertices)( GLcontext *ctx );
+ void (*FlushVertices)( struct gl_context *ctx, GLuint flags );
+ void (*SaveFlushVertices)( struct gl_context *ctx );
/**
* Give the driver the opportunity to hook in its own vtxfmt for
* compiling optimized display lists. This is called on each valid
* glBegin() during list compilation.
*/
- GLboolean (*NotifySaveBegin)( GLcontext *ctx, GLenum mode );
+ GLboolean (*NotifySaveBegin)( struct gl_context *ctx, GLenum mode );
/**
* Notify driver that the special derived value _NeedEyeCoords has
* changed.
*/
- void (*LightingSpaceChange)( GLcontext *ctx );
+ void (*LightingSpaceChange)( struct gl_context *ctx );
/**
* Called by glNewList().
* Let the T&L component know what is going on with display lists
* in time to make changes to dispatch tables, etc.
*/
- void (*NewList)( GLcontext *ctx, GLuint list, GLenum mode );
+ void (*NewList)( struct gl_context *ctx, GLuint list, GLenum mode );
/**
* Called by glEndList().
*
* \sa dd_function_table::NewList.
*/
- void (*EndList)( GLcontext *ctx );
+ void (*EndList)( struct gl_context *ctx );
/**
* Called by glCallList(s).
*
* Notify the T&L component before and after calling a display list.
*/
- void (*BeginCallList)( GLcontext *ctx,
+ void (*BeginCallList)( struct gl_context *ctx,
struct gl_display_list *dlist );
/**
* Called by glEndCallList().
*
* \sa dd_function_table::BeginCallList.
*/
- void (*EndCallList)( GLcontext *ctx );
+ void (*EndCallList)( struct gl_context *ctx );
/**
* \name GL_ARB_sync interfaces
*/
/*@{*/
- struct gl_sync_object * (*NewSyncObject)(GLcontext *, GLenum);
- void (*FenceSync)(GLcontext *, struct gl_sync_object *, GLenum, GLbitfield);
- void (*DeleteSyncObject)(GLcontext *, struct gl_sync_object *);
- void (*CheckSync)(GLcontext *, struct gl_sync_object *);
- void (*ClientWaitSync)(GLcontext *, struct gl_sync_object *,
+ struct gl_sync_object * (*NewSyncObject)(struct gl_context *, GLenum);
+ void (*FenceSync)(struct gl_context *, struct gl_sync_object *, GLenum, GLbitfield);
+ void (*DeleteSyncObject)(struct gl_context *, struct gl_sync_object *);
+ void (*CheckSync)(struct gl_context *, struct gl_sync_object *);
+ void (*ClientWaitSync)(struct gl_context *, struct gl_sync_object *,
GLbitfield, GLuint64);
- void (*ServerWaitSync)(GLcontext *, struct gl_sync_object *,
+ void (*ServerWaitSync)(struct gl_context *, struct gl_sync_object *,
GLbitfield, GLuint64);
/*@}*/
/** GL_NV_conditional_render */
- void (*BeginConditionalRender)(GLcontext *ctx, struct gl_query_object *q,
+ void (*BeginConditionalRender)(struct gl_context *ctx, struct gl_query_object *q,
GLenum mode);
- void (*EndConditionalRender)(GLcontext *ctx, struct gl_query_object *q);
+ void (*EndConditionalRender)(struct gl_context *ctx, struct gl_query_object *q);
/**
* \name GL_OES_draw_texture interface
*/
/*@{*/
- void (*DrawTex)(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
+ void (*DrawTex)(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
GLfloat width, GLfloat height);
/*@}*/
/**
* \name GL_OES_EGL_image interface
*/
- void (*EGLImageTargetTexture2D)(GLcontext *ctx, GLenum target,
+ void (*EGLImageTargetTexture2D)(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage,
GLeglImageOES image_handle);
- void (*EGLImageTargetRenderbufferStorage)(GLcontext *ctx,
+ void (*EGLImageTargetRenderbufferStorage)(struct gl_context *ctx,
struct gl_renderbuffer *rb,
void *image_handle);
* \name GL_EXT_transform_feedback interface
*/
struct gl_transform_feedback_object *
- (*NewTransformFeedback)(GLcontext *ctx, GLuint name);
- void (*DeleteTransformFeedback)(GLcontext *ctx,
+ (*NewTransformFeedback)(struct gl_context *ctx, GLuint name);
+ void (*DeleteTransformFeedback)(struct gl_context *ctx,
struct gl_transform_feedback_object *obj);
- void (*BeginTransformFeedback)(GLcontext *ctx, GLenum mode,
+ void (*BeginTransformFeedback)(struct gl_context *ctx, GLenum mode,
struct gl_transform_feedback_object *obj);
- void (*EndTransformFeedback)(GLcontext *ctx,
+ void (*EndTransformFeedback)(struct gl_context *ctx,
struct gl_transform_feedback_object *obj);
- void (*PauseTransformFeedback)(GLcontext *ctx,
+ void (*PauseTransformFeedback)(struct gl_context *ctx,
struct gl_transform_feedback_object *obj);
- void (*ResumeTransformFeedback)(GLcontext *ctx,
+ void (*ResumeTransformFeedback)(struct gl_context *ctx,
struct gl_transform_feedback_object *obj);
- void (*DrawTransformFeedback)(GLcontext *ctx, GLenum mode,
+ void (*DrawTransformFeedback)(struct gl_context *ctx, GLenum mode,
struct gl_transform_feedback_object *obj);
};
void
-_mesa_init_debug( GLcontext *ctx )
+_mesa_init_debug( struct gl_context *ctx )
{
char *c;
* Quick and dirty function to "print" a texture to stdout.
*/
void
-_mesa_print_texture(GLcontext *ctx, const struct gl_texture_image *img)
+_mesa_print_texture(struct gl_context *ctx, const struct gl_texture_image *img)
{
#if CHAN_TYPE != GL_UNSIGNED_BYTE
_mesa_problem(NULL, "PrintTexture not supported");
extern void _mesa_print_enable_flags( const char *msg, GLuint flags );
extern void _mesa_print_state( const char *msg, GLuint state );
extern void _mesa_print_info( void );
-extern void _mesa_init_debug( GLcontext *ctx );
+extern void _mesa_init_debug( struct gl_context *ctx );
#else
_mesa_dump_stencil_buffer(const char *filename);
extern void
-_mesa_print_texture(GLcontext *ctx, const struct gl_texture_image *img);
+_mesa_print_texture(struct gl_context *ctx, const struct gl_texture_image *img);
#endif
* Initialize the depth buffer attribute group in the given context.
*/
void
-_mesa_init_depth(GLcontext *ctx)
+_mesa_init_depth(struct gl_context *ctx)
{
ctx->Depth.Test = GL_FALSE;
ctx->Depth.Clear = 1.0;
_mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax );
extern void
-_mesa_init_depth( GLcontext * ctx );
+_mesa_init_depth( struct gl_context * ctx );
#else
static void *
-nop_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y)
+nop_get_pointer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y)
{
(void) ctx;
(void) rb;
* Realloc storage for wrapper.
*/
static GLboolean
-alloc_wrapper_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
+alloc_wrapper_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat, GLuint width, GLuint height)
{
/* just pass this on to the wrapped renderbuffer */
*/
static void
-get_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count,
+get_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
GLint x, GLint y, void *values)
{
struct gl_renderbuffer *dsrb = z24rb->Wrapped;
}
static void
-get_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count,
+get_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
const GLint x[], const GLint y[], void *values)
{
struct gl_renderbuffer *dsrb = z24rb->Wrapped;
}
static void
-put_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count,
+put_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
struct gl_renderbuffer *dsrb = z24rb->Wrapped;
}
static void
-put_mono_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count,
+put_mono_row_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
GLint x, GLint y, const void *value, const GLubyte *mask)
{
struct gl_renderbuffer *dsrb = z24rb->Wrapped;
}
static void
-put_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count,
+put_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb, GLuint count,
const GLint x[], const GLint y[],
const void *values, const GLubyte *mask)
{
}
static void
-put_mono_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb,
+put_mono_values_z24(struct gl_context *ctx, struct gl_renderbuffer *z24rb,
GLuint count, const GLint x[], const GLint y[],
const void *value, const GLubyte *mask)
{
* \return new depth renderbuffer
*/
struct gl_renderbuffer *
-_mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx,
+_mesa_new_z24_renderbuffer_wrapper(struct gl_context *ctx,
struct gl_renderbuffer *dsrb)
{
struct gl_renderbuffer *z24rb;
*/
static void
-get_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
+get_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
GLint x, GLint y, void *values)
{
struct gl_renderbuffer *dsrb = s8rb->Wrapped;
}
static void
-get_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
+get_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
const GLint x[], const GLint y[], void *values)
{
struct gl_renderbuffer *dsrb = s8rb->Wrapped;
}
static void
-put_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
+put_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
struct gl_renderbuffer *dsrb = s8rb->Wrapped;
}
static void
-put_mono_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
+put_mono_row_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
GLint x, GLint y, const void *value, const GLubyte *mask)
{
struct gl_renderbuffer *dsrb = s8rb->Wrapped;
}
static void
-put_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
+put_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
const GLint x[], const GLint y[],
const void *values, const GLubyte *mask)
{
}
static void
-put_mono_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count,
+put_mono_values_s8(struct gl_context *ctx, struct gl_renderbuffer *s8rb, GLuint count,
const GLint x[], const GLint y[],
const void *value, const GLubyte *mask)
{
* \return new stencil renderbuffer
*/
struct gl_renderbuffer *
-_mesa_new_s8_renderbuffer_wrapper(GLcontext *ctx, struct gl_renderbuffer *dsrb)
+_mesa_new_s8_renderbuffer_wrapper(struct gl_context *ctx, struct gl_renderbuffer *dsrb)
{
struct gl_renderbuffer *s8rb;
* (either 8-bit or 32-bit)
*/
void
-_mesa_extract_stencil(GLcontext *ctx,
+_mesa_extract_stencil(struct gl_context *ctx,
struct gl_renderbuffer *dsRb,
struct gl_renderbuffer *stencilRb)
{
* \param stencilRb the source stencil buffer (either 8-bit or 32-bit)
*/
void
-_mesa_insert_stencil(GLcontext *ctx,
+_mesa_insert_stencil(struct gl_context *ctx,
struct gl_renderbuffer *dsRb,
struct gl_renderbuffer *stencilRb)
{
* \param stencilRb the stencil renderbuffer to promote
*/
void
-_mesa_promote_stencil(GLcontext *ctx, struct gl_renderbuffer *stencilRb)
+_mesa_promote_stencil(struct gl_context *ctx, struct gl_renderbuffer *stencilRb)
{
const GLsizei width = stencilRb->Width;
const GLsizei height = stencilRb->Height;
#include "mtypes.h"
extern struct gl_renderbuffer *
-_mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx,
+_mesa_new_z24_renderbuffer_wrapper(struct gl_context *ctx,
struct gl_renderbuffer *dsrb);
extern struct gl_renderbuffer *
-_mesa_new_s8_renderbuffer_wrapper(GLcontext *ctx,
+_mesa_new_s8_renderbuffer_wrapper(struct gl_context *ctx,
struct gl_renderbuffer *dsrb);
extern void
-_mesa_extract_stencil(GLcontext *ctx,
+_mesa_extract_stencil(struct gl_context *ctx,
struct gl_renderbuffer *dsRb,
struct gl_renderbuffer *stencilRb);
extern void
-_mesa_insert_stencil(GLcontext *ctx,
+_mesa_insert_stencil(struct gl_context *ctx,
struct gl_renderbuffer *dsRb,
struct gl_renderbuffer *stencilRb);
extern void
-_mesa_promote_stencil(GLcontext *ctx, struct gl_renderbuffer *stencilRb);
+_mesa_promote_stencil(struct gl_context *ctx, struct gl_renderbuffer *stencilRb);
#endif /* DEPTHSTENCIL_H */
#include "hash.h"
#include "image.h"
#include "light.h"
-#include "dlist.h"
#include "macros.h"
#include "queryobj.h"
#include "teximage.h"
struct gl_list_instruction
{
GLuint Size;
- void (*Execute)( GLcontext *ctx, void *data );
- void (*Destroy)( GLcontext *ctx, void *data );
- void (*Print)( GLcontext *ctx, void *data );
+ void (*Execute)( struct gl_context *ctx, void *data );
+ void (*Destroy)( struct gl_context *ctx, void *data );
+ void (*Print)( struct gl_context *ctx, void *data );
};
* Lookup function to just encapsulate casting.
*/
static INLINE struct gl_display_list *
-lookup_list(GLcontext *ctx, GLuint list)
+lookup_list(struct gl_context *ctx, GLuint list)
{
return (struct gl_display_list *)
_mesa_HashLookup(ctx->Shared->DisplayList, list);
/** Destroy an extended opcode instruction */
static GLint
-ext_opcode_destroy(GLcontext *ctx, Node *node)
+ext_opcode_destroy(struct gl_context *ctx, Node *node)
{
const GLint i = node[0].opcode - OPCODE_EXT_0;
GLint step;
/** Execute an extended opcode instruction */
static GLint
-ext_opcode_execute(GLcontext *ctx, Node *node)
+ext_opcode_execute(struct gl_context *ctx, Node *node)
{
const GLint i = node[0].opcode - OPCODE_EXT_0;
GLint step;
/** Print an extended opcode instruction */
static GLint
-ext_opcode_print(GLcontext *ctx, Node *node)
+ext_opcode_print(struct gl_context *ctx, Node *node)
{
const GLint i = node[0].opcode - OPCODE_EXT_0;
GLint step;
* \param dlist - display list pointer
*/
void
-_mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist)
+_mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
{
Node *n, *block;
GLboolean done;
* \param list - display list number
*/
static void
-destroy_list(GLcontext *ctx, GLuint list)
+destroy_list(struct gl_context *ctx, GLuint list)
{
struct gl_display_list *dlist;
* If we run out of memory, GL_OUT_OF_MEMORY will be recorded.
*/
static GLvoid *
-unpack_image(GLcontext *ctx, GLuint dimensions,
+unpack_image(struct gl_context *ctx, GLuint dimensions,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type, const GLvoid * pixels,
const struct gl_pixelstore_attrib *unpack)
* \return pointer to allocated memory (the opcode space)
*/
static Node *
-dlist_alloc(GLcontext *ctx, OpCode opcode, GLuint bytes)
+dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes)
{
const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node);
Node *n;
* opcode).
*/
void *
-_mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint bytes)
+_mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint bytes)
{
Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes);
if (n)
* \return the new opcode number or -1 if error
*/
GLint
-_mesa_dlist_alloc_opcode(GLcontext *ctx,
+_mesa_dlist_alloc_opcode(struct gl_context *ctx,
GLuint size,
- void (*execute) (GLcontext *, void *),
- void (*destroy) (GLcontext *, void *),
- void (*print) (GLcontext *, void *))
+ void (*execute) (struct gl_context *, void *),
+ void (*destroy) (struct gl_context *, void *),
+ void (*print) (struct gl_context *, void *))
{
if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) {
const GLuint i = ctx->ListExt->NumOpcodes++;
* \return pointer to start of instruction space
*/
static INLINE Node *
-alloc_instruction(GLcontext *ctx, OpCode opcode, GLuint nparams)
+alloc_instruction(struct gl_context *ctx, OpCode opcode, GLuint nparams)
{
return dlist_alloc(ctx, opcode, nparams * sizeof(Node));
}
}
}
-static void invalidate_saved_current_state( GLcontext *ctx )
+static void invalidate_saved_current_state( struct gl_context *ctx )
{
GLint i;
* command that provoked the error. I don't see this as a problem.
*/
static void
-save_error(GLcontext *ctx, GLenum error, const char *s)
+save_error(struct gl_context *ctx, GLenum error, const char *s)
{
Node *n;
n = alloc_instruction(ctx, OPCODE_ERROR, 2);
* Compile an error into current display list.
*/
void
-_mesa_compile_error(GLcontext *ctx, GLenum error, const char *s)
+_mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s)
{
if (ctx->CompileFlag)
save_error(ctx, error, s);
* Test if ID names a display list.
*/
static GLboolean
-islist(GLcontext *ctx, GLuint list)
+islist(struct gl_context *ctx, GLuint list)
{
if (list > 0 && lookup_list(ctx, list)) {
return GL_TRUE;
* \param list - display list number
*/
static void
-execute_list(GLcontext *ctx, GLuint list)
+execute_list(struct gl_context *ctx, GLuint list)
{
struct gl_display_list *dlist;
Node *n;
* TODO: many commands aren't handled yet.
*/
static void GLAPIENTRY
-print_list(GLcontext *ctx, GLuint list)
+print_list(struct gl_context *ctx, GLuint list)
{
struct gl_display_list *dlist;
Node *n;
* Initialize display list state for given context.
*/
void
-_mesa_init_display_list(GLcontext *ctx)
+_mesa_init_display_list(struct gl_context *ctx)
{
static GLboolean tableInitialized = GL_FALSE;
void
-_mesa_free_display_list_data(GLcontext *ctx)
+_mesa_free_display_list_data(struct gl_context *ctx)
{
free(ctx->ListExt);
ctx->ListExt = NULL;
extern void GLAPIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists );
-extern void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s );
+extern void _mesa_compile_error( struct gl_context *ctx, GLenum error, const char *s );
-extern void *_mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint sz);
+extern void *_mesa_dlist_alloc(struct gl_context *ctx, GLuint opcode, GLuint sz);
-extern GLint _mesa_dlist_alloc_opcode( GLcontext *ctx, GLuint sz,
- void (*execute)( GLcontext *, void * ),
- void (*destroy)( GLcontext *, void * ),
- void (*print)( GLcontext *, void * ) );
+extern GLint _mesa_dlist_alloc_opcode( struct gl_context *ctx, GLuint sz,
+ void (*execute)( struct gl_context *, void * ),
+ void (*destroy)( struct gl_context *, void * ),
+ void (*print)( struct gl_context *, void * ) );
-extern void _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist);
+extern void _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist);
extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt );
#define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) do { } while (0)
static INLINE void
-_mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist)
+_mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist)
{
/* there should be no list to delete */
ASSERT_NO_FEATURE();
#endif /* FEATURE_dlist */
-extern void _mesa_init_display_list( GLcontext * ctx );
+extern void _mesa_init_display_list( struct gl_context * ctx );
-extern void _mesa_free_display_list_data(GLcontext *ctx);
+extern void _mesa_free_display_list_data(struct gl_context *ctx);
#endif /* DLIST_H */
* \return GL_TRUE if valid, GL_FALSE otherwise
*/
static GLboolean
-valid_fragment_program(GLcontext *ctx)
+valid_fragment_program(struct gl_context *ctx)
{
return !(ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled);
}
static void
-draw_texture(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
+draw_texture(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
GLfloat width, GLfloat height)
{
if (!ctx->Extensions.OES_draw_texture) {
* Helper to enable/disable client-side state.
*/
static void
-client_state(GLcontext *ctx, GLenum cap, GLboolean state)
+client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
{
struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
GLuint flag;
* higher than the number of supported coordinate units. And we'll return NULL.
*/
static struct gl_texture_unit *
-get_texcoord_unit(GLcontext *ctx)
+get_texcoord_unit(struct gl_context *ctx)
{
if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glEnable/Disable(texcoord unit)");
* \return GL_TRUE if state is changing or GL_FALSE if no change
*/
static GLboolean
-enable_texture(GLcontext *ctx, GLboolean state, GLbitfield texBit)
+enable_texture(struct gl_context *ctx, GLboolean state, GLbitfield texBit)
{
struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
const GLbitfield newenabled = state
* dd_function_table::Enable.
*/
void
-_mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
+_mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
{
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "%s %s (newstate is %x)\n",
* Enable/disable an indexed state var.
*/
void
-_mesa_set_enablei(GLcontext *ctx, GLenum cap, GLuint index, GLboolean state)
+_mesa_set_enablei(struct gl_context *ctx, GLenum cap, GLuint index, GLboolean state)
{
ASSERT(state == 0 || state == 1);
switch (cap) {
* Helper function to determine whether a texture target is enabled.
*/
static GLboolean
-is_texture_enabled(GLcontext *ctx, GLbitfield bit)
+is_texture_enabled(struct gl_context *ctx, GLbitfield bit)
{
const struct gl_texture_unit *const texUnit =
&ctx->Texture.Unit[ctx->Texture.CurrentUnit];
extern void
-_mesa_set_enable( GLcontext* ctx, GLenum cap, GLboolean state );
+_mesa_set_enable( struct gl_context* ctx, GLenum cap, GLboolean state );
extern void GLAPIENTRY
_mesa_Disable( GLenum cap );
_mesa_IsEnabled( GLenum cap );
extern void
-_mesa_set_enablei(GLcontext *ctx, GLenum cap, GLuint index, GLboolean state);
+_mesa_set_enablei(struct gl_context *ctx, GLenum cap, GLuint index, GLboolean state);
extern void GLAPIENTRY
_mesa_DisableIndexed( GLenum cap, GLuint index );
* Return pointer to the gl_1d_map struct for the named target.
*/
static struct gl_1d_map *
-get_1d_map( GLcontext *ctx, GLenum target )
+get_1d_map( struct gl_context *ctx, GLenum target )
{
switch (target) {
case GL_MAP1_VERTEX_3:
* Return pointer to the gl_2d_map struct for the named target.
*/
static struct gl_2d_map *
-get_2d_map( GLcontext *ctx, GLenum target )
+get_2d_map( struct gl_context *ctx, GLenum target )
{
switch (target) {
case GL_MAP2_VERTEX_3:
}
-void _mesa_init_eval( GLcontext *ctx )
+void _mesa_init_eval( struct gl_context *ctx )
{
int i;
}
-void _mesa_free_eval_data( GLcontext *ctx )
+void _mesa_free_eval_data( struct gl_context *ctx )
{
int i;
extern GLuint _mesa_evaluator_components( GLenum target );
-extern void gl_free_control_points( GLcontext *ctx,
+extern void gl_free_control_points( struct gl_context *ctx,
GLenum target, GLfloat *data );
#endif /* FEATURE_evaluators */
-extern void _mesa_init_eval( GLcontext *ctx );
-extern void _mesa_free_eval_data( GLcontext *ctx );
+extern void _mesa_init_eval( struct gl_context *ctx );
+extern void _mesa_free_eval_data( struct gl_context *ctx );
#endif /* EVAL_H */
{ ON, "GL_ARB_draw_buffers", F(ARB_draw_buffers) },
{ OFF, "GL_ARB_draw_elements_base_vertex", F(ARB_draw_elements_base_vertex) },
{ OFF, "GL_ARB_draw_instanced", F(ARB_draw_instanced) },
+ { OFF, "GL_ARB_explicit_attrib_location", F(ARB_explicit_attrib_location) },
{ OFF, "GL_ARB_fragment_coord_conventions", F(ARB_fragment_coord_conventions) },
{ OFF, "GL_ARB_fragment_program", F(ARB_fragment_program) },
{ OFF, "GL_ARB_fragment_program_shadow", F(ARB_fragment_program_shadow) },
{ OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) },
{ OFF, "GL_ARB_framebuffer_object", F(ARB_framebuffer_object) },
- { OFF, "GL_ARB_explicit_attrib_location", F(ARB_explicit_attrib_location) },
/* TODO: reenable this when the new GLSL compiler actually supports them */
/* { OFF, "GL_ARB_geometry_shader4", F(ARB_geometry_shader4) }, */
{ OFF, "GL_ARB_half_float_pixel", F(ARB_half_float_pixel) },
{ OFF, "GL_ARB_sampler_objects", F(ARB_sampler_objects) },
{ OFF, "GL_ARB_seamless_cube_map", F(ARB_seamless_cube_map) },
{ OFF, "GL_ARB_shader_objects", F(ARB_shader_objects) },
+ { OFF, "GL_ARB_shader_stencil_export", F(ARB_shader_stencil_export) },
{ OFF, "GL_ARB_shading_language_100", F(ARB_shading_language_100) },
{ OFF, "GL_ARB_shadow", F(ARB_shadow) },
{ OFF, "GL_ARB_shadow_ambient", F(ARB_shadow_ambient) },
{ OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) },
{ OFF, "GL_ARB_texture_buffer_object", F(ARB_texture_buffer_object) },
{ ON, "GL_ARB_texture_compression", F(ARB_texture_compression) },
+ { OFF, "GL_ARB_texture_compression_rgtc", F(ARB_texture_compression_rgtc) },
{ OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) },
{ OFF, "GL_ARB_texture_env_add", F(EXT_texture_env_add) },
{ OFF, "GL_ARB_texture_env_combine", F(ARB_texture_env_combine) },
{ ON, "GL_EXT_texture3D", F(EXT_texture3D) },
{ OFF, "GL_EXT_texture_array", F(EXT_texture_array) },
{ OFF, "GL_EXT_texture_compression_s3tc", F(EXT_texture_compression_s3tc) },
- { OFF, "GL_EXT_texture_compression_rgtc", F(EXT_texture_compression_rgtc) },
+ { OFF, "GL_EXT_texture_compression_rgtc", F(ARB_texture_compression_rgtc) },
{ OFF, "GL_EXT_texture_cube_map", F(ARB_texture_cube_map) },
{ ON, "GL_EXT_texture_edge_clamp", F(SGIS_texture_edge_clamp) },
{ OFF, "GL_EXT_texture_env_add", F(EXT_texture_env_add) },
{ ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) },
{ ON, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) },
{ OFF, "GL_S3_s3tc", F(S3_s3tc) },
+ { OFF, "GL_EXT_texture_format_BGRA8888", F(EXT_texture_format_BGRA8888) },
#if FEATURE_OES_EGL_image
{ OFF, "GL_OES_EGL_image", F(OES_EGL_image) },
#endif
* This is a convenience function used by the XMesa, OSMesa, GGI drivers, etc.
*/
void
-_mesa_enable_sw_extensions(GLcontext *ctx)
+_mesa_enable_sw_extensions(struct gl_context *ctx)
{
/*ctx->Extensions.ARB_copy_buffer = GL_TRUE;*/
ctx->Extensions.ARB_depth_clamp = GL_TRUE;
ctx->Extensions.ARB_depth_texture = GL_TRUE;
/*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/
ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE;
+ ctx->Extensions.ARB_explicit_attrib_location = GL_TRUE;
ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
#if FEATURE_ARB_fragment_program
ctx->Extensions.ARB_fragment_program = GL_TRUE;
/*ctx->Extensions.ARB_texture_float = GL_TRUE;*/
ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE;
ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
+ ctx->Extensions.ARB_texture_rg = GL_TRUE;
ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
#if FEATURE_ARB_vertex_program
ctx->Extensions.ARB_vertex_program = GL_TRUE;
* Enable common EXT extensions in the ARB_imaging subset.
*/
void
-_mesa_enable_imaging_extensions(GLcontext *ctx)
+_mesa_enable_imaging_extensions(struct gl_context *ctx)
{
ctx->Extensions.EXT_blend_color = GL_TRUE;
ctx->Extensions.EXT_blend_logic_op = GL_TRUE;
* A convenience function to be called by drivers.
*/
void
-_mesa_enable_1_3_extensions(GLcontext *ctx)
+_mesa_enable_1_3_extensions(struct gl_context *ctx)
{
/*ctx->Extensions.ARB_multisample = GL_TRUE;*/
ctx->Extensions.ARB_multitexture = GL_TRUE;
* A convenience function to be called by drivers.
*/
void
-_mesa_enable_1_4_extensions(GLcontext *ctx)
+_mesa_enable_1_4_extensions(struct gl_context *ctx)
{
ctx->Extensions.ARB_depth_texture = GL_TRUE;
ctx->Extensions.ARB_shadow = GL_TRUE;
* A convenience function to be called by drivers.
*/
void
-_mesa_enable_1_5_extensions(GLcontext *ctx)
+_mesa_enable_1_5_extensions(struct gl_context *ctx)
{
ctx->Extensions.ARB_occlusion_query = GL_TRUE;
/*ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;*/
* A convenience function to be called by drivers.
*/
void
-_mesa_enable_2_0_extensions(GLcontext *ctx)
+_mesa_enable_2_0_extensions(struct gl_context *ctx)
{
/*ctx->Extensions.ARB_draw_buffers = GL_TRUE;*/
#if FEATURE_ARB_fragment_shader
* A convenience function to be called by drivers.
*/
void
-_mesa_enable_2_1_extensions(GLcontext *ctx)
+_mesa_enable_2_1_extensions(struct gl_context *ctx)
{
#if FEATURE_EXT_pixel_buffer_object
ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE;
* \return GL_TRUE for success, GL_FALSE if invalid extension name
*/
static GLboolean
-set_extension( GLcontext *ctx, const char *name, GLboolean state )
+set_extension( struct gl_context *ctx, const char *name, GLboolean state )
{
GLboolean *base = (GLboolean *) &ctx->Extensions;
GLuint i;
* Typically called by drivers.
*/
void
-_mesa_enable_extension( GLcontext *ctx, const char *name )
+_mesa_enable_extension( struct gl_context *ctx, const char *name )
{
if (!set_extension(ctx, name, GL_TRUE))
_mesa_problem(ctx, "Trying to enable unknown extension: %s", name);
* XXX is this really needed???
*/
void
-_mesa_disable_extension( GLcontext *ctx, const char *name )
+_mesa_disable_extension( struct gl_context *ctx, const char *name )
{
if (!set_extension(ctx, name, GL_FALSE))
_mesa_problem(ctx, "Trying to disable unknown extension: %s", name);
* Check if the i-th extension is enabled.
*/
static GLboolean
-extension_enabled(GLcontext *ctx, GLuint index)
+extension_enabled(struct gl_context *ctx, GLuint index)
{
const GLboolean *base = (const GLboolean *) &ctx->Extensions;
if (!default_extensions[index].flag_offset ||
* Test if the named extension is enabled in this context.
*/
GLboolean
-_mesa_extension_is_enabled( GLcontext *ctx, const char *name )
+_mesa_extension_is_enabled( struct gl_context *ctx, const char *name )
{
GLuint i;
* Return a string of the unknown/leftover names.
*/
static const char *
-get_extension_override( GLcontext *ctx )
+get_extension_override( struct gl_context *ctx )
{
const char *envExt = _mesa_getenv("MESA_EXTENSION_OVERRIDE");
char *extraExt = NULL;
* To be called during context initialization.
*/
void
-_mesa_init_extensions( GLcontext *ctx )
+_mesa_init_extensions( struct gl_context *ctx )
{
GLboolean *base = (GLboolean *) &ctx->Extensions;
GLuint i;
* glGetString(GL_EXTENSIONS) is called.
*/
static GLubyte *
-compute_extensions( GLcontext *ctx )
+compute_extensions( struct gl_context *ctx )
{
const char *extraExt = get_extension_override(ctx);
GLuint extStrLen = 0;
static size_t
-make_extension_string_es1(const GLcontext *ctx, GLubyte *str)
+make_extension_string_es1(const struct gl_context *ctx, GLubyte *str)
{
size_t len = 0;
static GLubyte *
-compute_extensions_es1(const GLcontext *ctx)
+compute_extensions_es1(const struct gl_context *ctx)
{
GLubyte *s;
unsigned int len;
}
static size_t
-make_extension_string_es2(const GLcontext *ctx, GLubyte *str)
+make_extension_string_es2(const struct gl_context *ctx, GLubyte *str)
{
size_t len = 0;
len += append_extension(&str, "GL_OES_EGL_image");
#endif
+ if (ctx->Extensions.EXT_texture_format_BGRA8888)
+ len += append_extension(&str, "GL_EXT_texture_format_BGRA8888");
+
return len;
}
static GLubyte *
-compute_extensions_es2(GLcontext *ctx)
+compute_extensions_es2(struct gl_context *ctx)
{
GLubyte *s;
unsigned int len;
GLubyte *
-_mesa_make_extension_string(GLcontext *ctx)
+_mesa_make_extension_string(struct gl_context *ctx)
{
switch (ctx->API) {
case API_OPENGL:
* Return number of enabled extensions.
*/
GLuint
-_mesa_get_extension_count(GLcontext *ctx)
+_mesa_get_extension_count(struct gl_context *ctx)
{
GLuint i;
* Return name of i-th enabled extension
*/
const GLubyte *
-_mesa_get_enabled_extension(GLcontext *ctx, GLuint index)
+_mesa_get_enabled_extension(struct gl_context *ctx, GLuint index)
{
GLuint i;
#if _HAVE_FULL_GL
-extern void _mesa_enable_sw_extensions(GLcontext *ctx);
+extern void _mesa_enable_sw_extensions(struct gl_context *ctx);
-extern void _mesa_enable_imaging_extensions(GLcontext *ctx);
+extern void _mesa_enable_imaging_extensions(struct gl_context *ctx);
-extern void _mesa_enable_1_3_extensions(GLcontext *ctx);
+extern void _mesa_enable_1_3_extensions(struct gl_context *ctx);
-extern void _mesa_enable_1_4_extensions(GLcontext *ctx);
+extern void _mesa_enable_1_4_extensions(struct gl_context *ctx);
-extern void _mesa_enable_1_5_extensions(GLcontext *ctx);
+extern void _mesa_enable_1_5_extensions(struct gl_context *ctx);
-extern void _mesa_enable_2_0_extensions(GLcontext *ctx);
+extern void _mesa_enable_2_0_extensions(struct gl_context *ctx);
-extern void _mesa_enable_2_1_extensions(GLcontext *ctx);
+extern void _mesa_enable_2_1_extensions(struct gl_context *ctx);
-extern void _mesa_enable_extension(GLcontext *ctx, const char *name);
+extern void _mesa_enable_extension(struct gl_context *ctx, const char *name);
-extern void _mesa_disable_extension(GLcontext *ctx, const char *name);
+extern void _mesa_disable_extension(struct gl_context *ctx, const char *name);
-extern GLboolean _mesa_extension_is_enabled(GLcontext *ctx, const char *name);
+extern GLboolean _mesa_extension_is_enabled(struct gl_context *ctx, const char *name);
-extern void _mesa_init_extensions(GLcontext *ctx);
+extern void _mesa_init_extensions(struct gl_context *ctx);
-extern GLubyte *_mesa_make_extension_string(GLcontext *ctx);
+extern GLubyte *_mesa_make_extension_string(struct gl_context *ctx);
extern GLuint
-_mesa_get_extension_count(GLcontext *ctx);
+_mesa_get_extension_count(struct gl_context *ctx);
extern const GLubyte *
-_mesa_get_enabled_extension(GLcontext *ctx, GLuint index);
+_mesa_get_enabled_extension(struct gl_context *ctx, GLuint index);
#else
void
-_mesa_init_fbobjects(GLcontext *ctx)
+_mesa_init_fbobjects(struct gl_context *ctx)
{
_glthread_INIT_MUTEX(DummyFramebuffer.Mutex);
_glthread_INIT_MUTEX(DummyRenderbuffer.Mutex);
* Helper routine for getting a gl_renderbuffer.
*/
struct gl_renderbuffer *
-_mesa_lookup_renderbuffer(GLcontext *ctx, GLuint id)
+_mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id)
{
struct gl_renderbuffer *rb;
* Helper routine for getting a gl_framebuffer.
*/
struct gl_framebuffer *
-_mesa_lookup_framebuffer(GLcontext *ctx, GLuint id)
+_mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id)
{
struct gl_framebuffer *fb;
* the depth buffer attachment point.
*/
struct gl_renderbuffer_attachment *
-_mesa_get_attachment(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
GLenum attachment)
{
GLuint i;
* window-system framebuffer (not user-created framebuffer objects).
*/
static struct gl_renderbuffer_attachment *
-_mesa_get_fb0_attachment(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_get_fb0_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
GLenum attachment)
{
assert(fb->Name == 0);
* point. Update reference counts, etc.
*/
void
-_mesa_remove_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att)
+_mesa_remove_attachment(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
{
if (att->Type == GL_TEXTURE) {
ASSERT(att->Texture);
* The previous binding, if any, will be removed first.
*/
void
-_mesa_set_texture_attachment(GLcontext *ctx,
+_mesa_set_texture_attachment(struct gl_context *ctx,
struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att,
struct gl_texture_object *texObj,
* The previous binding, if any, will be removed first.
*/
void
-_mesa_set_renderbuffer_attachment(GLcontext *ctx,
+_mesa_set_renderbuffer_attachment(struct gl_context *ctx,
struct gl_renderbuffer_attachment *att,
struct gl_renderbuffer *rb)
{
* Attach a renderbuffer object to a framebuffer object.
*/
void
-_mesa_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLenum attachment, struct gl_renderbuffer *rb)
{
struct gl_renderbuffer_attachment *att;
* if GL_STENCIL, this is a stencil component attachment point.
*/
static void
-test_attachment_completeness(const GLcontext *ctx, GLenum format,
+test_attachment_completeness(const struct gl_context *ctx, GLenum format,
struct gl_renderbuffer_attachment *att)
{
assert(format == GL_COLOR || format == GL_DEPTH || format == GL_STENCIL);
if (baseFormat != GL_RGB &&
baseFormat != GL_RGBA &&
(!ctx->Extensions.ARB_framebuffer_object ||
- baseFormat != GL_ALPHA)) {
+ baseFormat != GL_ALPHA) &&
+ (!ctx->Extensions.ARB_texture_rg ||
+ baseFormat != GL_RED) &&
+ (!ctx->Extensions.ARB_texture_rg ||
+ baseFormat != GL_RG)) {
att_incomplete("bad format");
att->Complete = GL_FALSE;
return;
* framebuffer is complete.
*/
void
-_mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
+_mesa_test_framebuffer_completeness(struct gl_context *ctx, struct gl_framebuffer *fb)
{
GLuint numImages;
GLenum intFormat = GL_NONE; /* color buffers' internal format */
numImages++;
if (f != GL_RGB && f != GL_RGBA && f != GL_DEPTH_COMPONENT
&& f != GL_DEPTH_STENCIL_EXT
- && (!ctx->Extensions.ARB_framebuffer_object || f != GL_ALPHA)) {
+ && (!ctx->Extensions.ARB_framebuffer_object || f != GL_ALPHA)
+ && (!ctx->Extensions.ARB_texture_rg || f != GL_RED)
+ && (!ctx->Extensions.ARB_texture_rg || f != GL_RG)) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
fbo_incomplete("texture attachment incomplete", -1);
return;
* The spec calls for unbinding.
*/
static void
-detach_renderbuffer(GLcontext *ctx,
+detach_renderbuffer(struct gl_context *ctx,
struct gl_framebuffer *fb,
struct gl_renderbuffer *rb)
{
* we'll also return GL_RED and GL_RG.
*/
GLenum
-_mesa_base_fbo_format(GLcontext *ctx, GLenum internalFormat)
+_mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
{
switch (internalFormat) {
case GL_ALPHA:
* attachments.
*/
static void
-check_begin_texture_render(GLcontext *ctx, struct gl_framebuffer *fb)
+check_begin_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
{
GLuint i;
ASSERT(ctx->Driver.RenderTexture);
* notify the device driver that the texture image may have changed.
*/
static void
-check_end_texture_render(GLcontext *ctx, struct gl_framebuffer *fb)
+check_end_texture_render(struct gl_context *ctx, struct gl_framebuffer *fb)
{
if (fb->Name == 0)
return; /* can't render to texture with winsys framebuffers */
* Common code called by glFramebufferTexture1D/2D/3DEXT().
*/
static void
-framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target,
+framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
GLenum attachment, GLenum textarget, GLuint texture,
GLint level, GLint zoffset)
{
#include "mtypes.h"
extern void
-_mesa_init_fbobjects(GLcontext *ctx);
+_mesa_init_fbobjects(struct gl_context *ctx);
extern struct gl_framebuffer *
_mesa_get_incomplete_framebuffer(void);
extern struct gl_renderbuffer *
-_mesa_lookup_renderbuffer(GLcontext *ctx, GLuint id);
+_mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id);
extern struct gl_framebuffer *
-_mesa_lookup_framebuffer(GLcontext *ctx, GLuint id);
+_mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id);
extern struct gl_renderbuffer_attachment *
-_mesa_get_attachment(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
GLenum attachment);
extern void
-_mesa_remove_attachment(GLcontext *ctx,
+_mesa_remove_attachment(struct gl_context *ctx,
struct gl_renderbuffer_attachment *att);
extern void
-_mesa_set_texture_attachment(GLcontext *ctx,
+_mesa_set_texture_attachment(struct gl_context *ctx,
struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att,
struct gl_texture_object *texObj,
GLenum texTarget, GLuint level, GLuint zoffset);
extern void
-_mesa_set_renderbuffer_attachment(GLcontext *ctx,
+_mesa_set_renderbuffer_attachment(struct gl_context *ctx,
struct gl_renderbuffer_attachment *att,
struct gl_renderbuffer *rb);
extern void
-_mesa_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_framebuffer_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLenum attachment, struct gl_renderbuffer *rb);
extern void
-_mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb);
+_mesa_test_framebuffer_completeness(struct gl_context *ctx, struct gl_framebuffer *fb);
extern GLenum
-_mesa_base_fbo_format(GLcontext *ctx, GLenum internalFormat);
+_mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat);
extern GLboolean GLAPIENTRY
_mesa_IsRenderbufferEXT(GLuint renderbuffer);
* Put a vertex into the feedback buffer.
*/
void
-_mesa_feedback_vertex(GLcontext *ctx,
+_mesa_feedback_vertex(struct gl_context *ctx,
const GLfloat win[4],
const GLfloat color[4],
const GLfloat texcoord[4])
* \note this function can't be put in a display list.
*
* Verifies we're not in selection mode, flushes the vertices and initialize
- * the fields in __GLcontextRec::Select with the given buffer.
+ * the fields in __struct gl_contextRec::Select with the given buffer.
*/
static void GLAPIENTRY
_mesa_SelectBuffer( GLsizei size, GLuint *buffer )
* increments the pointer.
*/
static INLINE void
-write_record(GLcontext *ctx, GLuint value)
+write_record(struct gl_context *ctx, GLuint value)
{
if (ctx->Select.BufferCount < ctx->Select.BufferSize) {
ctx->Select.Buffer[ctx->Select.BufferCount] = value;
* gl_selection::HitMaxZ.
*/
void
-_mesa_update_hitflag(GLcontext *ctx, GLfloat z)
+_mesa_update_hitflag(struct gl_context *ctx, GLfloat z)
{
ctx->Select.HitFlag = GL_TRUE;
if (z < ctx->Select.HitMinZ) {
* \sa gl_selection.
*/
static void
-write_hit_record(GLcontext *ctx)
+write_hit_record(struct gl_context *ctx)
{
GLuint i;
GLuint zmin, zmax, zscale = (~0u);
*
* Verifies we are in select mode and resets the name stack depth and resets
* the hit record data in gl_selection. Marks new render mode in
- * __GLcontextRec::NewState.
+ * __struct gl_contextRec::NewState.
*/
static void GLAPIENTRY
_mesa_InitNames( void )
* Flushes vertices. If there is a hit flag writes it (via write_hit_record()),
* and replace the top-most name in the stack.
*
- * sa __GLcontextRec::Select.
+ * sa __struct gl_contextRec::Select.
*/
static void GLAPIENTRY
_mesa_LoadName( GLuint name )
* Flushes vertices. If there is a hit flag writes it (via write_hit_record()),
* and adds the name to the top of the name stack.
*
- * sa __GLcontextRec::Select.
+ * sa __struct gl_contextRec::Select.
*/
static void GLAPIENTRY
_mesa_PushName( GLuint name )
* Flushes vertices. If there is a hit flag writes it (via write_hit_record()),
* and removes top-most name in the name stack.
*
- * sa __GLcontextRec::Select.
+ * sa __struct gl_contextRec::Select.
*/
static void GLAPIENTRY
_mesa_PopName( void )
* Flushes the vertices and do the necessary cleanup according to the previous
* rasterization mode, such as writing the hit record or resent the select
* buffer index when exiting the select mode. Updates
- * __GLcontextRec::RenderMode and notifies the driver via the
+ * __struct gl_contextRec::RenderMode and notifies the driver via the
* dd_function_table::RenderMode callback.
*/
static GLint GLAPIENTRY
/**
* Initialize context feedback data.
*/
-void _mesa_init_feedback( GLcontext * ctx )
+void _mesa_init_feedback( struct gl_context * ctx )
{
/* Feedback */
ctx->Feedback.Type = GL_2D; /* TODO: verify */
#if FEATURE_feedback
extern void
-_mesa_feedback_vertex( GLcontext *ctx,
+_mesa_feedback_vertex( struct gl_context *ctx,
const GLfloat win[4],
const GLfloat color[4],
const GLfloat texcoord[4] );
static INLINE void
-_mesa_feedback_token( GLcontext *ctx, GLfloat token )
+_mesa_feedback_token( struct gl_context *ctx, GLfloat token )
{
if (ctx->Feedback.Count < ctx->Feedback.BufferSize) {
ctx->Feedback.Buffer[ctx->Feedback.Count] = token;
extern void
-_mesa_update_hitflag( GLcontext *ctx, GLfloat z );
+_mesa_update_hitflag( struct gl_context *ctx, GLfloat z );
extern void
#include "main/compiler.h"
static INLINE void
-_mesa_feedback_vertex( GLcontext *ctx,
+_mesa_feedback_vertex( struct gl_context *ctx,
const GLfloat win[4],
const GLfloat color[4],
const GLfloat texcoord[4] )
static INLINE void
-_mesa_feedback_token( GLcontext *ctx, GLfloat token )
+_mesa_feedback_token( struct gl_context *ctx, GLfloat token )
{
/* render mode is always GL_RENDER */
ASSERT_NO_FEATURE();
}
static INLINE void
-_mesa_update_hitflag( GLcontext *ctx, GLfloat z )
+_mesa_update_hitflag( struct gl_context *ctx, GLfloat z )
{
/* render mode is always GL_RENDER */
ASSERT_NO_FEATURE();
#endif /* FEATURE_feedback */
extern void
-_mesa_init_feedback( GLcontext *ctx );
+_mesa_init_feedback( struct gl_context *ctx );
#endif /* FEEDBACK_H */
-static GLboolean check_active_shininess( GLcontext *ctx,
+static GLboolean check_active_shininess( struct gl_context *ctx,
const struct state_key *key,
GLuint side )
{
}
-static void make_state_key( GLcontext *ctx, struct state_key *key )
+static void make_state_key( struct gl_context *ctx, struct state_key *key )
{
const struct gl_fragment_program *fp;
GLuint i;
* XXX move this into core mesa (main/)
*/
struct gl_vertex_program *
-_mesa_get_fixed_func_vertex_program(GLcontext *ctx)
+_mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
{
struct gl_vertex_program *prog;
struct state_key key;
#include "main/mtypes.h"
struct gl_vertex_program *
-_mesa_get_fixed_func_vertex_program(GLcontext *ctx);
+_mesa_get_fixed_func_vertex_program(struct gl_context *ctx);
/***** Initialization *****/
/**********************************************************************/
-void _mesa_init_fog( GLcontext * ctx )
+void _mesa_init_fog( struct gl_context * ctx )
{
/* Fog group */
ctx->Fog.Enabled = GL_FALSE;
extern void GLAPIENTRY
_mesa_Fogiv(GLenum pname, const GLint *params );
-extern void _mesa_init_fog( GLcontext * ctx );
+extern void _mesa_init_fog( struct gl_context * ctx );
#else
0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
1, 1, 2 /* BlockWidth/Height,Bytes */
},
+ {
+ MESA_FORMAT_R8,
+ "MESA_FORMAT_R8",
+ GL_RED,
+ GL_UNSIGNED_NORMALIZED,
+ 8, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 1, 1, 1
+ },
+ {
+ MESA_FORMAT_RG88,
+ "MESA_FORMAT_RG88",
+ GL_RG,
+ GL_UNSIGNED_NORMALIZED,
+ 8, 8, 0, 0,
+ 0, 0, 0, 0, 0,
+ 1, 1, 2
+ },
+ {
+ MESA_FORMAT_RG88_REV,
+ "MESA_FORMAT_RG88_REV",
+ GL_RG,
+ GL_UNSIGNED_NORMALIZED,
+ 8, 8, 0, 0,
+ 0, 0, 0, 0, 0,
+ 1, 1, 2
+ },
+ {
+ MESA_FORMAT_R16,
+ "MESA_FORMAT_R16",
+ GL_RED,
+ GL_UNSIGNED_NORMALIZED,
+ 16, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 1, 1, 2
+ },
+ {
+ MESA_FORMAT_RG1616,
+ "MESA_FORMAT_RG1616",
+ GL_RG,
+ GL_UNSIGNED_NORMALIZED,
+ 16, 16, 0, 0,
+ 0, 0, 0, 0, 0,
+ 1, 1, 4
+ },
+ {
+ MESA_FORMAT_RG1616_REV,
+ "MESA_FORMAT_RG1616_REV",
+ GL_RG,
+ GL_UNSIGNED_NORMALIZED,
+ 16, 16, 0, 0,
+ 0, 0, 0, 0, 0,
+ 1, 1, 4
+ },
{
MESA_FORMAT_Z24_S8, /* Name */
"MESA_FORMAT_Z24_S8", /* StrName */
assert(info->LuminanceBits == 0);
assert(info->IntensityBits == 0);
}
+ else if (info->BaseFormat == GL_RG) {
+ assert(info->RedBits > 0);
+ assert(info->GreenBits > 0);
+ assert(info->BlueBits == 0);
+ assert(info->AlphaBits == 0);
+ assert(info->LuminanceBits == 0);
+ assert(info->IntensityBits == 0);
+ }
+ else if (info->BaseFormat == GL_RED) {
+ assert(info->RedBits > 0);
+ assert(info->GreenBits == 0);
+ assert(info->BlueBits == 0);
+ assert(info->AlphaBits == 0);
+ assert(info->LuminanceBits == 0);
+ assert(info->IntensityBits == 0);
+ }
else if (info->BaseFormat == GL_LUMINANCE) {
assert(info->RedBits == 0);
assert(info->GreenBits == 0);
case MESA_FORMAT_AL88:
case MESA_FORMAT_AL88_REV:
+ case MESA_FORMAT_RG88:
+ case MESA_FORMAT_RG88_REV:
*datatype = GL_UNSIGNED_BYTE;
*comps = 2;
return;
case MESA_FORMAT_AL1616:
case MESA_FORMAT_AL1616_REV:
+ case MESA_FORMAT_RG1616:
+ case MESA_FORMAT_RG1616_REV:
*datatype = GL_UNSIGNED_SHORT;
*comps = 2;
return;
+ case MESA_FORMAT_R16:
+ *datatype = GL_UNSIGNED_SHORT;
+ *comps = 1;
+ return;
+
case MESA_FORMAT_RGB332:
*datatype = GL_UNSIGNED_BYTE_3_3_2;
*comps = 3;
case MESA_FORMAT_L8:
case MESA_FORMAT_I8:
case MESA_FORMAT_CI8:
+ case MESA_FORMAT_R8:
*datatype = GL_UNSIGNED_BYTE;
*comps = 1;
return;
case MESA_FORMAT_SRGBA_DXT1:
case MESA_FORMAT_SRGBA_DXT3:
case MESA_FORMAT_SRGBA_DXT5:
+#endif
#endif
/* XXX generate error instead? */
*datatype = GL_UNSIGNED_BYTE;
*comps = 0;
return;
-#endif
case MESA_FORMAT_RGBA_FLOAT32:
*datatype = GL_FLOAT;
MESA_FORMAT_CI8, /* CCCC CCCC */
MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
+ MESA_FORMAT_R8, /* RRRR RRRR */
+ MESA_FORMAT_RG88, /* RRRR RRRR GGGG GGGG */
+ MESA_FORMAT_RG88_REV, /* GGGG GGGG RRRR RRRR */
+ MESA_FORMAT_R16, /* RRRR RRRR RRRR RRRR */
+ MESA_FORMAT_RG1616, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
+ MESA_FORMAT_RG1616_REV, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */
* \sa _mesa_new_framebuffer
*/
struct gl_framebuffer *
-_mesa_create_framebuffer(const GLvisual *visual)
+_mesa_create_framebuffer(const struct gl_config *visual)
{
struct gl_framebuffer *fb = CALLOC_STRUCT(gl_framebuffer);
assert(visual);
* \sa _mesa_create_framebuffer
*/
struct gl_framebuffer *
-_mesa_new_framebuffer(GLcontext *ctx, GLuint name)
+_mesa_new_framebuffer(struct gl_context *ctx, GLuint name)
{
struct gl_framebuffer *fb;
(void) ctx;
*/
void
_mesa_initialize_window_framebuffer(struct gl_framebuffer *fb,
- const GLvisual *visual)
+ const struct gl_config *visual)
{
assert(fb);
assert(visual);
* without a currently bound rendering context.
*/
void
-_mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint width, GLuint height)
{
GLuint i;
* from device drivers (as was done in the past).
*/
void
-_mesa_resizebuffers( GLcontext *ctx )
+_mesa_resizebuffers( struct gl_context *ctx )
{
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
if (ctx->WinSysDrawBuffer) {
GLuint newWidth, newHeight;
- GLframebuffer *buffer = ctx->WinSysDrawBuffer;
+ struct gl_framebuffer *buffer = ctx->WinSysDrawBuffer;
assert(buffer->Name == 0);
if (ctx->WinSysReadBuffer
&& ctx->WinSysReadBuffer != ctx->WinSysDrawBuffer) {
GLuint newWidth, newHeight;
- GLframebuffer *buffer = ctx->WinSysReadBuffer;
+ struct gl_framebuffer *buffer = ctx->WinSysReadBuffer;
assert(buffer->Name == 0);
* window-system framebuffes.
*/
static void
-update_framebuffer_size(GLcontext *ctx, struct gl_framebuffer *fb)
+update_framebuffer_size(struct gl_context *ctx, struct gl_framebuffer *fb)
{
GLuint minWidth = ~0, minHeight = ~0;
GLuint i;
* \param ctx the GL context.
*/
void
-_mesa_update_draw_buffer_bounds(GLcontext *ctx)
+_mesa_update_draw_buffer_bounds(struct gl_context *ctx)
{
struct gl_framebuffer *buffer = ctx->DrawBuffer;
* \param attIndex indicates the renderbuffer to possibly wrap
*/
void
-_mesa_update_depth_buffer(GLcontext *ctx,
+_mesa_update_depth_buffer(struct gl_context *ctx,
struct gl_framebuffer *fb,
GLuint attIndex)
{
* \param attIndex indicates the renderbuffer to possibly wrap
*/
void
-_mesa_update_stencil_buffer(GLcontext *ctx,
+_mesa_update_stencil_buffer(struct gl_context *ctx,
struct gl_framebuffer *fb,
GLuint attIndex)
{
* writing colors.
*/
static void
-update_color_draw_buffers(GLcontext *ctx, struct gl_framebuffer *fb)
+update_color_draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb)
{
GLuint output;
* Unlike the DrawBuffer, we can only read from one (or zero) color buffers.
*/
static void
-update_color_read_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
+update_color_read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb)
{
(void) ctx;
if (fb->_ColorReadBufferIndex == -1 ||
* glRenderbufferStorageEXT.
*/
static void
-update_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
+update_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
{
if (fb->Name == 0) {
/* This is a window-system framebuffer */
* Update state related to the current draw/read framebuffers.
*/
void
-_mesa_update_framebuffer(GLcontext *ctx)
+_mesa_update_framebuffer(struct gl_context *ctx)
{
struct gl_framebuffer *drawFb;
struct gl_framebuffer *readFb;
* \return GL_TRUE if buffer exists, GL_FALSE otherwise
*/
GLboolean
-_mesa_source_buffer_exists(GLcontext *ctx, GLenum format)
+_mesa_source_buffer_exists(struct gl_context *ctx, GLenum format)
{
const struct gl_renderbuffer_attachment *att = ctx->ReadBuffer->Attachment;
* XXX could do some code merging w/ above function.
*/
GLboolean
-_mesa_dest_buffer_exists(GLcontext *ctx, GLenum format)
+_mesa_dest_buffer_exists(struct gl_context *ctx, GLenum format)
{
const struct gl_renderbuffer_attachment *att = ctx->DrawBuffer->Attachment;
* Used to answer the GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES query.
*/
GLenum
-_mesa_get_color_read_format(GLcontext *ctx)
+_mesa_get_color_read_format(struct gl_context *ctx)
{
switch (ctx->ReadBuffer->_ColorReadBuffer->Format) {
case MESA_FORMAT_ARGB8888:
* Used to answer the GL_IMPLEMENTATION_COLOR_READ_TYPE_OES query.
*/
GLenum
-_mesa_get_color_read_type(GLcontext *ctx)
+_mesa_get_color_read_type(struct gl_context *ctx)
{
switch (ctx->ReadBuffer->_ColorReadBuffer->Format) {
case MESA_FORMAT_ARGB8888:
#include "mtypes.h"
extern struct gl_framebuffer *
-_mesa_create_framebuffer(const GLvisual *visual);
+_mesa_create_framebuffer(const struct gl_config *visual);
extern struct gl_framebuffer *
-_mesa_new_framebuffer(GLcontext *ctx, GLuint name);
+_mesa_new_framebuffer(struct gl_context *ctx, GLuint name);
extern void
_mesa_initialize_window_framebuffer(struct gl_framebuffer *fb,
- const GLvisual *visual);
+ const struct gl_config *visual);
extern void
_mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name);
struct gl_framebuffer *fb);
extern void
-_mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint width, GLuint height);
extern void
-_mesa_resizebuffers( GLcontext *ctx );
+_mesa_resizebuffers( struct gl_context *ctx );
extern void GLAPIENTRY
_mesa_ResizeBuffersMESA( void );
extern void
-_mesa_update_draw_buffer_bounds(GLcontext *ctx);
+_mesa_update_draw_buffer_bounds(struct gl_context *ctx);
extern void
_mesa_update_framebuffer_visual(struct gl_framebuffer *fb);
extern void
-_mesa_update_depth_buffer(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_update_depth_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint attIndex);
extern void
-_mesa_update_stencil_buffer(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_update_stencil_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint attIndex);
extern void
-_mesa_update_framebuffer(GLcontext *ctx);
+_mesa_update_framebuffer(struct gl_context *ctx);
extern GLboolean
-_mesa_source_buffer_exists(GLcontext *ctx, GLenum format);
+_mesa_source_buffer_exists(struct gl_context *ctx, GLenum format);
extern GLboolean
-_mesa_dest_buffer_exists(GLcontext *ctx, GLenum format);
+_mesa_dest_buffer_exists(struct gl_context *ctx, GLenum format);
extern GLenum
-_mesa_get_color_read_type(GLcontext *ctx);
+_mesa_get_color_read_type(struct gl_context *ctx);
extern GLenum
-_mesa_get_color_read_format(GLcontext *ctx);
+_mesa_get_color_read_format(struct gl_context *ctx);
extern void
_mesa_print_framebuffer(const struct gl_framebuffer *fb);
/* This is a table driven implemetation of the glGet*v() functions.
* The basic idea is that most getters just look up an int somewhere
- * in GLcontext and then convert it to a bool or float according to
+ * in struct gl_context and then convert it to a bool or float according to
* which of glGetIntegerv() glGetBooleanv() etc is being called.
* Instead of generating code to do this, we can just record the enum
- * value and the offset into GLcontext in an array of structs. Then
+ * value and the offset into struct gl_context in an array of structs. Then
* in glGet*(), we lookup the struct for the enum in question, and use
* the offset to get the int we need.
*
* Sometimes we need to look up a float, a boolean, a bit in a
* bitfield, a matrix or other types instead, so we need to track the
- * type of the value in GLcontext. And sometimes the value isn't in
- * GLcontext but in the drawbuffer, the array object, current texture
+ * type of the value in struct gl_context. And sometimes the value isn't in
+ * struct gl_context but in the drawbuffer, the array object, current texture
* unit, or maybe it's a computed value. So we need to also track
* where or how to find the value. Finally, we sometimes need to
* check that one of a number of extensions are enabled, the GL
#define BUFFER_FIELD(field, type) \
LOC_BUFFER, type, offsetof(struct gl_framebuffer, field)
#define CONTEXT_FIELD(field, type) \
- LOC_CONTEXT, type, offsetof(GLcontext, field)
+ LOC_CONTEXT, type, offsetof(struct gl_context, field)
#define ARRAY_FIELD(field, type) \
LOC_ARRAY, type, offsetof(struct gl_array_object, field)
#define CONST(value) \
{ GL_MAX_ELEMENTS_VERTICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA },
{ GL_MAX_ELEMENTS_INDICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA },
{ GL_MAX_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, Const.MaxTextureLevels), NO_EXTRA },
+ offsetof(struct gl_context, Const.MaxTextureLevels), NO_EXTRA },
{ GL_MAX_VIEWPORT_DIMS, CONTEXT_INT2(Const.MaxViewportWidth), NO_EXTRA },
{ GL_PACK_ALIGNMENT, CONTEXT_INT(Pack.Alignment), NO_EXTRA },
{ GL_ALIASED_POINT_SIZE_RANGE, CONTEXT_FLOAT2(Const.MinPointSize), NO_EXTRA },
{ GL_TEXTURE_BINDING_CUBE_MAP_ARB, LOC_CUSTOM, TYPE_INT,
TEXTURE_CUBE_INDEX, extra_ARB_texture_cube_map },
{ GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, Const.MaxCubeTextureLevels),
+ offsetof(struct gl_context, Const.MaxCubeTextureLevels),
extra_ARB_texture_cube_map }, /* XXX: OES_texture_cube_map */
/* XXX: OES_blend_subtract */
{ GL_MAX_TEXTURE_STACK_DEPTH, CONST(MAX_TEXTURE_STACK_DEPTH), NO_EXTRA },
{ GL_MODELVIEW_MATRIX, CONTEXT_MATRIX(ModelviewMatrixStack.Top), NO_EXTRA },
{ GL_MODELVIEW_STACK_DEPTH, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, ModelviewMatrixStack.Depth), NO_EXTRA },
+ offsetof(struct gl_context, ModelviewMatrixStack.Depth), NO_EXTRA },
{ GL_NORMALIZE, CONTEXT_BOOL(Transform.Normalize), NO_EXTRA },
{ GL_PACK_SKIP_IMAGES_EXT, CONTEXT_INT(Pack.SkipImages), NO_EXTRA },
{ GL_PERSPECTIVE_CORRECTION_HINT, CONTEXT_ENUM(Hint.PerspectiveCorrection), NO_EXTRA },
{ GL_POINT_FADE_THRESHOLD_SIZE_EXT, CONTEXT_FLOAT(Point.Threshold), NO_EXTRA },
{ GL_PROJECTION_MATRIX, CONTEXT_MATRIX(ProjectionMatrixStack.Top), NO_EXTRA },
{ GL_PROJECTION_STACK_DEPTH, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, ProjectionMatrixStack.Depth), NO_EXTRA },
+ offsetof(struct gl_context, ProjectionMatrixStack.Depth), NO_EXTRA },
{ GL_RESCALE_NORMAL, CONTEXT_BOOL(Transform.RescaleNormals), NO_EXTRA },
{ GL_SHADE_MODEL, CONTEXT_ENUM(Light.ShadeModel), NO_EXTRA },
{ GL_TEXTURE_2D, LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA },
/* OES_texture_3D */
{ GL_TEXTURE_BINDING_3D, LOC_CUSTOM, TYPE_INT, TEXTURE_3D_INDEX, NO_EXTRA },
{ GL_MAX_3D_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, Const.Max3DTextureLevels), NO_EXTRA },
+ offsetof(struct gl_context, Const.Max3DTextureLevels), NO_EXTRA },
/* GL_ARB_fragment_program/OES_standard_derivatives */
{ GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB,
/* Enums unique to OpenGL ES 2.0 */
{ 0, 0, TYPE_API_MASK, API_OPENGLES2_BIT, NO_EXTRA },
{ GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, Const.FragmentProgram.MaxUniformComponents), NO_EXTRA },
+ offsetof(struct gl_context, Const.FragmentProgram.MaxUniformComponents), NO_EXTRA },
{ GL_MAX_VARYING_VECTORS, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, Const.MaxVarying), NO_EXTRA },
+ offsetof(struct gl_context, Const.MaxVarying), NO_EXTRA },
{ GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, Const.VertexProgram.MaxUniformComponents), NO_EXTRA },
+ offsetof(struct gl_context, Const.VertexProgram.MaxUniformComponents), NO_EXTRA },
{ GL_SHADER_COMPILER, CONST(1), NO_EXTRA },
/* OES_get_program_binary */
{ GL_NUM_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA },
*
* \param the current context, for determining the API in question
*/
-void _mesa_init_get_hash(GLcontext *ctx)
+void _mesa_init_get_hash(struct gl_context *ctx)
{
int i, hash, index, mask;
int api_mask = 0, api_bit;
* \param v pointer to the tmp declared in the calling glGet*v() function
*/
static void
-find_custom_value(GLcontext *ctx, const struct value_desc *d, union value *v)
+find_custom_value(struct gl_context *ctx, const struct value_desc *d, union value *v)
{
struct gl_buffer_object *buffer_obj;
struct gl_client_array *array;
* otherwise GL_TRUE.
*/
static GLboolean
-check_extra(GLcontext *ctx, const char *func, const struct value_desc *d)
+check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d)
{
const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor;
int total, enabled;
* Return the string for a glGetString(GL_SHADING_LANGUAGE_VERSION) query.
*/
static const GLubyte *
-shading_language_version(GLcontext *ctx)
+shading_language_version(struct gl_context *ctx)
{
switch (ctx->API) {
case API_OPENGL:
* Returns the current GL error code, or GL_NO_ERROR.
* \return current error code
*
- * Returns __GLcontextRec::ErrorValue.
+ * Returns __struct gl_contextRec::ErrorValue.
*/
GLenum GLAPIENTRY
_mesa_GetError( void )
#define GL_GLEXT_PROTOTYPES
#include "GL/gl.h"
#include "GL/glext.h"
-#include "GL/internal/glcore.h"
/**
*/
#define MESA_GEOMETRY_PROGRAM 0x8c26
-
+/* Several fields of struct gl_config can take these as values. Since
+ * GLX header files may not be available everywhere they need to be used,
+ * redefine them here.
+ */
+#define GLX_NONE 0x8000
+#define GLX_SLOW_CONFIG 0x8001
+#define GLX_TRUE_COLOR 0x8002
+#define GLX_DIRECT_COLOR 0x8003
+#define GLX_PSEUDO_COLOR 0x8004
+#define GLX_STATIC_COLOR 0x8005
+#define GLX_GRAY_SCALE 0x8006
+#define GLX_STATIC_GRAY 0x8007
+#define GLX_TRANSPARENT_RGB 0x8008
+#define GLX_TRANSPARENT_INDEX 0x8009
+#define GLX_NON_CONFORMANT_CONFIG 0x800D
+#define GLX_SWAP_EXCHANGE_OML 0x8061
+#define GLX_SWAP_COPY_OML 0x8062
+#define GLX_SWAP_UNDEFINED_OML 0x8063
+
+#define GLX_DONT_CARE 0xFFFFFFFF
#endif /* GLHEADER_H */
* \param table the hash table to delete
* \param callback the callback function
* \param userData arbitrary pointer to pass along to the callback
- * (this is typically a GLcontext pointer)
+ * (this is typically a struct gl_context pointer)
*/
void
_mesa_HashDeleteAll(struct _mesa_HashTable *table,
* \param table the hash table to walk
* \param callback the callback function
* \param userData arbitrary pointer to pass along to the callback
- * (this is typically a GLcontext pointer)
+ * (this is typically a struct gl_context pointer)
*/
void
_mesa_HashWalk(const struct _mesa_HashTable *table,
/***** Initialization *****/
/**********************************************************************/
-void _mesa_init_hint( GLcontext * ctx )
+void _mesa_init_hint( struct gl_context * ctx )
{
/* Hint group */
ctx->Hint.PerspectiveCorrection = GL_DONT_CARE;
_mesa_Hint( GLenum target, GLenum mode );
extern void
-_mesa_init_hint( GLcontext * ctx );
+_mesa_init_hint( struct gl_context * ctx );
#else
return 1;
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE_ALPHA_INTEGER_EXT:
+ case GL_RG:
return 2;
case GL_RGB:
case GL_RGB_INTEGER_EXT:
* otherwise.
*/
GLboolean
-_mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type )
+_mesa_is_legal_format_and_type( struct gl_context *ctx, GLenum format, GLenum type )
{
switch (format) {
case GL_COLOR_INDEX:
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
case GL_DEPTH_COMPONENT:
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ return GL_TRUE;
+ case GL_HALF_FLOAT_ARB:
+ return ctx->Extensions.ARB_half_float_pixel;
+ default:
+ return GL_FALSE;
+ }
+ case GL_RG:
+ if (!ctx->Extensions.ARB_texture_rg)
+ return GL_FALSE;
+
switch (type) {
case GL_BYTE:
case GL_UNSIGNED_BYTE:
case GL_INTENSITY8:
case GL_INTENSITY12:
case GL_INTENSITY16:
+ case GL_R8:
+ case GL_R16:
+ case GL_RG:
+ case GL_RG8:
+ case GL_RG16:
case 3:
case GL_RGB:
case GL_BGR:
case GL_LUMINANCE_ALPHA32F_ARB:
case GL_INTENSITY16F_ARB:
case GL_INTENSITY32F_ARB:
+ case GL_R16F:
+ case GL_R32F:
+ case GL_RG16F:
+ case GL_RG32F:
case GL_RGB16F_ARB:
case GL_RGB32F_ARB:
case GL_RGBA16F_ARB:
case GL_COMPRESSED_LUMINANCE:
case GL_COMPRESSED_LUMINANCE_ALPHA:
case GL_COMPRESSED_INTENSITY:
+ case GL_COMPRESSED_RED:
+ case GL_COMPRESSED_RG:
case GL_COMPRESSED_RGB:
case GL_COMPRESSED_RGBA:
case GL_RGB_S3TC:
case GL_COMPRESSED_SLUMINANCE_EXT:
case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
#endif /* FEATURE_EXT_texture_sRGB */
+ case GL_COMPRESSED_RED_RGTC1:
+ case GL_COMPRESSED_SIGNED_RED_RGTC1:
+ case GL_COMPRESSED_RG_RGTC2:
+ case GL_COMPRESSED_SIGNED_RG_RGTC2:
return GL_TRUE;
/* signed texture formats */
case GL_RGBA_SNORM:
* \return GL_TRUE if compressed, GL_FALSE if uncompressed
*/
GLboolean
-_mesa_is_compressed_format(GLcontext *ctx, GLenum format)
+_mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
{
switch (format) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGB_FXT1_3DFX:
case GL_COMPRESSED_RGBA_FXT1_3DFX:
return ctx->Extensions.TDFX_texture_compression_FXT1;
+ case GL_COMPRESSED_RED_RGTC1:
+ case GL_COMPRESSED_SIGNED_RED_RGTC1:
+ case GL_COMPRESSED_RG_RGTC2:
+ case GL_COMPRESSED_SIGNED_RG_RGTC2:
+ return ctx->Extensions.ARB_texture_compression_rgtc;
default:
return GL_FALSE;
}
* Apply pixel mapping to an array of floating point RGBA pixels.
*/
void
-_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] )
+_mesa_map_rgba( const struct gl_context *ctx, GLuint n, GLfloat rgba[][4] )
{
const GLfloat rscale = (GLfloat) (ctx->PixelMaps.RtoR.Size - 1);
const GLfloat gscale = (GLfloat) (ctx->PixelMaps.GtoG.Size - 1);
rgba[i][ACOMP] = alpha;;
}
break;
+ case GL_RED:
+ /* replace RGB with RGB */
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND(rgba[i][RCOMP] * scale);
+ jR = CLAMP(jR, 0, max);
+ rgba[i][RCOMP] = lut[jR * 3 + 0];
+ }
+ break;
+ case GL_RG:
+ /* replace RG with RG */
+ for (i = 0; i < n; i++) {
+ GLint jR = IROUND(rgba[i][RCOMP] * scale);
+ GLint jG = IROUND(rgba[i][GCOMP] * scale);
+ jR = CLAMP(jR, 0, max);
+ jG = CLAMP(jG, 0, max);
+ rgba[i][RCOMP] = lut[jR * 3 + 0];
+ rgba[i][GCOMP] = lut[jG * 3 + 1];
+ }
+ break;
case GL_RGB:
/* replace RGB with RGB */
for (i = 0; i < n; i++) {
* Map color indexes to float rgba values.
*/
void
-_mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n,
+_mesa_map_ci_to_rgba( const struct gl_context *ctx, GLuint n,
const GLuint index[], GLfloat rgba[][4] )
{
GLuint rmask = ctx->PixelMaps.ItoR.Size - 1;
* Map ubyte color indexes to ubyte/RGBA values.
*/
void
-_mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[],
+_mesa_map_ci8_to_rgba8(const struct gl_context *ctx, GLuint n, const GLubyte index[],
GLubyte rgba[][4])
{
GLuint rmask = ctx->PixelMaps.ItoR.Size - 1;
void
-_mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n,
+_mesa_scale_and_bias_depth(const struct gl_context *ctx, GLuint n,
GLfloat depthValues[])
{
const GLfloat scale = ctx->Pixel.DepthScale;
void
-_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n,
+_mesa_scale_and_bias_depth_uint(const struct gl_context *ctx, GLuint n,
GLuint depthValues[])
{
const GLdouble max = (double) 0xffffffff;
* as indicated by the transferOps bitmask
*/
void
-_mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
+_mesa_apply_rgba_transfer_ops(struct gl_context *ctx, GLbitfield transferOps,
GLuint n, GLfloat rgba[][4])
{
/* scale & bias */
* Apply color index shift and offset to an array of pixels.
*/
static void
-shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] )
+shift_and_offset_ci( const struct gl_context *ctx, GLuint n, GLuint indexes[] )
{
GLint shift = ctx->Pixel.IndexShift;
GLint offset = ctx->Pixel.IndexOffset;
* of color indexes;
*/
void
-_mesa_apply_ci_transfer_ops(const GLcontext *ctx, GLbitfield transferOps,
+_mesa_apply_ci_transfer_ops(const struct gl_context *ctx, GLbitfield transferOps,
GLuint n, GLuint indexes[])
{
if (transferOps & IMAGE_SHIFT_OFFSET_BIT) {
* of stencil values.
*/
void
-_mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n,
+_mesa_apply_stencil_transfer_ops(const struct gl_context *ctx, GLuint n,
GLstencil stencil[])
{
if (ctx->Pixel.IndexShift != 0 || ctx->Pixel.IndexOffset != 0) {
* transfer ops are enabled.
*/
void
-_mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
+_mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
GLenum dstFormat, GLenum dstType,
GLvoid *dstAddr,
const struct gl_pixelstore_attrib *dstPacking,
srcFormat == GL_LUMINANCE ||
srcFormat == GL_LUMINANCE_ALPHA ||
srcFormat == GL_INTENSITY ||
+ srcFormat == GL_RG ||
srcFormat == GL_RGB ||
srcFormat == GL_BGR ||
srcFormat == GL_RGBA ||
redIndex = greenIndex = blueIndex = alphaIndex = 0;
stride = 1;
break;
+ case GL_RG:
+ case GL_RG_INTEGER:
+ redIndex = 0;
+ greenIndex = 1;
+ blueIndex = -1;
+ alphaIndex = -1;
+ rComp = 0;
+ gComp = 1;
+ bComp = 2;
+ aComp = 3;
+ stride = 2;
+ break;
case GL_RGB:
case GL_RGB_INTEGER:
redIndex = 0;
* XXX perhaps expand this to process whole images someday.
*/
void
-_mesa_unpack_color_span_chan( GLcontext *ctx,
+_mesa_unpack_color_span_chan( struct gl_context *ctx,
GLuint n, GLenum dstFormat, GLchan dest[],
GLenum srcFormat, GLenum srcType,
const GLvoid *source,
dstFormat == GL_LUMINANCE ||
dstFormat == GL_LUMINANCE_ALPHA ||
dstFormat == GL_INTENSITY ||
+ dstFormat == GL_RED ||
+ dstFormat == GL_RG ||
dstFormat == GL_RGB ||
dstFormat == GL_RGBA ||
dstFormat == GL_COLOR_INDEX);
srcFormat == GL_LUMINANCE ||
srcFormat == GL_LUMINANCE_ALPHA ||
srcFormat == GL_INTENSITY ||
+ srcFormat == GL_RG ||
srcFormat == GL_RGB ||
srcFormat == GL_BGR ||
srcFormat == GL_RGBA ||
dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1;
dstLuminanceIndex = -1;
break;
+ case GL_RED:
+ dstRedIndex = 0;
+ dstGreenIndex = dstBlueIndex = -1;
+ dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1;
+ break;
+ case GL_RG:
+ dstRedIndex = 0;
+ dstGreenIndex = 1;
+ dstBlueIndex = -1;
+ dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1;
+ break;
case GL_RGB:
dstRedIndex = 0;
dstGreenIndex = 1;
* instead of GLchan.
*/
void
-_mesa_unpack_color_span_float( GLcontext *ctx,
+_mesa_unpack_color_span_float( struct gl_context *ctx,
GLuint n, GLenum dstFormat, GLfloat dest[],
GLenum srcFormat, GLenum srcType,
const GLvoid *source,
dstFormat == GL_LUMINANCE ||
dstFormat == GL_LUMINANCE_ALPHA ||
dstFormat == GL_INTENSITY ||
+ dstFormat == GL_RED ||
+ dstFormat == GL_RG ||
dstFormat == GL_RGB ||
dstFormat == GL_RGBA ||
dstFormat == GL_COLOR_INDEX);
srcFormat == GL_LUMINANCE ||
srcFormat == GL_LUMINANCE_ALPHA ||
srcFormat == GL_INTENSITY ||
+ srcFormat == GL_RG ||
srcFormat == GL_RGB ||
srcFormat == GL_BGR ||
srcFormat == GL_RGBA ||
dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1;
dstLuminanceIndex = -1;
break;
+ case GL_RED:
+ dstRedIndex = 0;
+ dstGreenIndex = dstBlueIndex = -1;
+ dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1;
+ break;
+ case GL_RG:
+ dstRedIndex = 0;
+ dstGreenIndex = 1;
+ dstBlueIndex = -1;
+ dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1;
+ break;
case GL_RGB:
dstRedIndex = 0;
dstGreenIndex = 1;
* directly return GLbyte data, no transfer ops apply.
*/
void
-_mesa_unpack_dudv_span_byte( GLcontext *ctx,
+_mesa_unpack_dudv_span_byte( struct gl_context *ctx,
GLuint n, GLenum dstFormat, GLbyte dest[],
GLenum srcFormat, GLenum srcType,
const GLvoid *source,
* transferOps - the pixel transfer operations to apply
*/
void
-_mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
+_mesa_unpack_index_span( const struct gl_context *ctx, GLuint n,
GLenum dstType, GLvoid *dest,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *srcPacking,
void
-_mesa_pack_index_span( const GLcontext *ctx, GLuint n,
+_mesa_pack_index_span( const struct gl_context *ctx, GLuint n,
GLenum dstType, GLvoid *dest, const GLuint *source,
const struct gl_pixelstore_attrib *dstPacking,
GLbitfield transferOps )
* transferOps - apply offset/bias/lookup ops?
*/
void
-_mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
+_mesa_unpack_stencil_span( const struct gl_context *ctx, GLuint n,
GLenum dstType, GLvoid *dest,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *srcPacking,
void
-_mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
+_mesa_pack_stencil_span( const struct gl_context *ctx, GLuint n,
GLenum dstType, GLvoid *dest, const GLstencil *source,
const struct gl_pixelstore_attrib *dstPacking )
{
* (ignored for GLfloat).
*/
void
-_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
+_mesa_unpack_depth_span( const struct gl_context *ctx, GLuint n,
GLenum dstType, GLvoid *dest, GLuint depthMax,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *srcPacking )
* Pack an array of depth values. The values are floats in [0,1].
*/
void
-_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest,
+_mesa_pack_depth_span( const struct gl_context *ctx, GLuint n, GLvoid *dest,
GLenum dstType, const GLfloat *depthSpan,
const struct gl_pixelstore_attrib *dstPacking )
{
* Pack depth and stencil values as GL_DEPTH_STENCIL/GL_UNSIGNED_INT_24_8.
*/
void
-_mesa_pack_depth_stencil_span(const GLcontext *ctx, GLuint n, GLuint *dest,
+_mesa_pack_depth_stencil_span(const struct gl_context *ctx, GLuint n, GLuint *dest,
const GLfloat *depthVals,
const GLstencil *stencilVals,
const struct gl_pixelstore_attrib *dstPacking)
* GL_FALSE if image was completely clipped away (draw nothing)
*/
GLboolean
-_mesa_clip_drawpixels(const GLcontext *ctx,
+_mesa_clip_drawpixels(const struct gl_context *ctx,
GLint *destX, GLint *destY,
GLsizei *width, GLsizei *height,
struct gl_pixelstore_attrib *unpack)
{
- const GLframebuffer *buffer = ctx->DrawBuffer;
+ const struct gl_framebuffer *buffer = ctx->DrawBuffer;
if (unpack->RowLength == 0) {
unpack->RowLength = *width;
* GL_FALSE if image was completely clipped away (draw nothing)
*/
GLboolean
-_mesa_clip_readpixels(const GLcontext *ctx,
+_mesa_clip_readpixels(const struct gl_context *ctx,
GLint *srcX, GLint *srcY,
GLsizei *width, GLsizei *height,
struct gl_pixelstore_attrib *pack)
{
- const GLframebuffer *buffer = ctx->ReadBuffer;
+ const struct gl_framebuffer *buffer = ctx->ReadBuffer;
if (pack->RowLength == 0) {
pack->RowLength = *width;
* \return GL_FALSE if region is totally clipped, GL_TRUE otherwise.
*/
GLboolean
-_mesa_clip_copytexsubimage(const GLcontext *ctx,
+_mesa_clip_copytexsubimage(const struct gl_context *ctx,
GLint *destX, GLint *destY,
GLint *srcX, GLint *srcY,
GLsizei *width, GLsizei *height)
* \return GL_TRUE if anything is left to draw, GL_FALSE if totally clipped
*/
GLboolean
-_mesa_clip_blit(GLcontext *ctx,
+_mesa_clip_blit(struct gl_context *ctx,
GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1)
{
_mesa_bytes_per_pixel( GLenum format, GLenum type );
extern GLboolean
-_mesa_is_legal_format_and_type( GLcontext *ctx, GLenum format, GLenum type );
+_mesa_is_legal_format_and_type( struct gl_context *ctx, GLenum format, GLenum type );
extern GLboolean
_mesa_is_color_format(GLenum format);
_mesa_is_integer_format(GLenum format);
extern GLboolean
-_mesa_is_compressed_format(GLcontext *ctx, GLenum format);
+_mesa_is_compressed_format(struct gl_context *ctx, GLenum format);
extern GLvoid *
_mesa_image_address( GLuint dimensions,
GLfloat bBias, GLfloat aBias);
extern void
-_mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
+_mesa_map_rgba(const struct gl_context *ctx, GLuint n, GLfloat rgba[][4]);
extern void
_mesa_lookup_rgba_float(const struct gl_color_table *table,
extern void
-_mesa_map_ci_to_rgba(const GLcontext *ctx,
+_mesa_map_ci_to_rgba(const struct gl_context *ctx,
GLuint n, const GLuint index[], GLfloat rgba[][4]);
extern void
-_mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[],
+_mesa_map_ci8_to_rgba8(const struct gl_context *ctx, GLuint n, const GLubyte index[],
GLubyte rgba[][4]);
extern void
-_mesa_scale_and_bias_depth(const GLcontext *ctx, GLuint n,
+_mesa_scale_and_bias_depth(const struct gl_context *ctx, GLuint n,
GLfloat depthValues[]);
extern void
-_mesa_scale_and_bias_depth_uint(const GLcontext *ctx, GLuint n,
+_mesa_scale_and_bias_depth_uint(const struct gl_context *ctx, GLuint n,
GLuint depthValues[]);
extern void
-_mesa_apply_rgba_transfer_ops(GLcontext *ctx, GLbitfield transferOps,
+_mesa_apply_rgba_transfer_ops(struct gl_context *ctx, GLbitfield transferOps,
GLuint n, GLfloat rgba[][4]);
extern void
-_mesa_apply_ci_transfer_ops(const GLcontext *ctx, GLbitfield transferOps,
+_mesa_apply_ci_transfer_ops(const struct gl_context *ctx, GLbitfield transferOps,
GLuint n, GLuint indexes[]);
extern void
-_mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n,
+_mesa_apply_stencil_transfer_ops(const struct gl_context *ctx, GLuint n,
GLstencil stencil[]);
extern void
-_mesa_pack_rgba_span_float( GLcontext *ctx, GLuint n, GLfloat rgba[][4],
+_mesa_pack_rgba_span_float( struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
GLenum dstFormat, GLenum dstType, GLvoid *dstAddr,
const struct gl_pixelstore_attrib *dstPacking,
GLbitfield transferOps );
extern void
-_mesa_unpack_color_span_chan( GLcontext *ctx,
+_mesa_unpack_color_span_chan( struct gl_context *ctx,
GLuint n, GLenum dstFormat, GLchan dest[],
GLenum srcFormat, GLenum srcType,
const GLvoid *source,
extern void
-_mesa_unpack_color_span_float( GLcontext *ctx,
+_mesa_unpack_color_span_float( struct gl_context *ctx,
GLuint n, GLenum dstFormat, GLfloat dest[],
GLenum srcFormat, GLenum srcType,
const GLvoid *source,
GLbitfield transferOps );
extern void
-_mesa_unpack_dudv_span_byte( GLcontext *ctx,
+_mesa_unpack_dudv_span_byte( struct gl_context *ctx,
GLuint n, GLenum dstFormat, GLbyte dest[],
GLenum srcFormat, GLenum srcType,
const GLvoid *source,
GLbitfield transferOps );
extern void
-_mesa_unpack_index_span( const GLcontext *ctx, GLuint n,
+_mesa_unpack_index_span( const struct gl_context *ctx, GLuint n,
GLenum dstType, GLvoid *dest,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *srcPacking,
extern void
-_mesa_pack_index_span( const GLcontext *ctx, GLuint n,
+_mesa_pack_index_span( const struct gl_context *ctx, GLuint n,
GLenum dstType, GLvoid *dest, const GLuint *source,
const struct gl_pixelstore_attrib *dstPacking,
GLbitfield transferOps );
extern void
-_mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,
+_mesa_unpack_stencil_span( const struct gl_context *ctx, GLuint n,
GLenum dstType, GLvoid *dest,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *srcPacking,
GLbitfield transferOps );
extern void
-_mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
+_mesa_pack_stencil_span( const struct gl_context *ctx, GLuint n,
GLenum dstType, GLvoid *dest, const GLstencil *source,
const struct gl_pixelstore_attrib *dstPacking );
extern void
-_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
+_mesa_unpack_depth_span( const struct gl_context *ctx, GLuint n,
GLenum dstType, GLvoid *dest, GLuint depthMax,
GLenum srcType, const GLvoid *source,
const struct gl_pixelstore_attrib *srcPacking );
extern void
-_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLvoid *dest,
+_mesa_pack_depth_span( const struct gl_context *ctx, GLuint n, GLvoid *dest,
GLenum dstType, const GLfloat *depthSpan,
const struct gl_pixelstore_attrib *dstPacking );
extern void
-_mesa_pack_depth_stencil_span(const GLcontext *ctx, GLuint n, GLuint *dest,
+_mesa_pack_depth_stencil_span(const struct gl_context *ctx, GLuint n, GLuint *dest,
const GLfloat *depthVals,
const GLstencil *stencilVals,
const struct gl_pixelstore_attrib *dstPacking);
extern GLboolean
-_mesa_clip_drawpixels(const GLcontext *ctx,
+_mesa_clip_drawpixels(const struct gl_context *ctx,
GLint *destX, GLint *destY,
GLsizei *width, GLsizei *height,
struct gl_pixelstore_attrib *unpack);
extern GLboolean
-_mesa_clip_readpixels(const GLcontext *ctx,
+_mesa_clip_readpixels(const struct gl_context *ctx,
GLint *srcX, GLint *srcY,
GLsizei *width, GLsizei *height,
struct gl_pixelstore_attrib *pack);
extern GLboolean
-_mesa_clip_copytexsubimage(const GLcontext *ctx,
+_mesa_clip_copytexsubimage(const struct gl_context *ctx,
GLint *destX, GLint *destY,
GLint *srcX, GLint *srcY,
GLsizei *width, GLsizei *height);
GLsizei *width, GLsizei *height );
extern GLboolean
-_mesa_clip_blit(GLcontext *ctx,
+_mesa_clip_blit(struct gl_context *ctx,
GLint *srcX0, GLint *srcY0, GLint *srcX1, GLint *srcY1,
GLint *dstX0, GLint *dstY0, GLint *dstX1, GLint *dstY1);
* previous errors which were accumulated.
*/
static void
-flush_delayed_errors( GLcontext *ctx )
+flush_delayed_errors( struct gl_context *ctx )
{
char s[MAXSTRING];
* \param fmtString printf()-like format string.
*/
void
-_mesa_warning( GLcontext *ctx, const char *fmtString, ... )
+_mesa_warning( struct gl_context *ctx, const char *fmtString, ... )
{
char str[MAXSTRING];
va_list args;
* \param fmtString problem description string.
*/
void
-_mesa_problem( const GLcontext *ctx, const char *fmtString, ... )
+_mesa_problem( const struct gl_context *ctx, const char *fmtString, ... )
{
va_list args;
char str[MAXSTRING];
* \param fmtString printf() style format string, followed by optional args
*/
void
-_mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... )
+_mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... )
{
static GLint debug = -1;
* \param fmtString printf()-style format string, followed by optional args.
*/
void
-_mesa_debug( const GLcontext *ctx, const char *fmtString, ... )
+_mesa_debug( const struct gl_context *ctx, const char *fmtString, ... )
{
#ifdef DEBUG
char s[MAXSTRING];
extern int
_mesa_snprintf( char *str, size_t size, const char *fmt, ... ) PRINTFLIKE(3, 4);
+struct gl_context;
+
extern void
-_mesa_warning( __GLcontext *gc, const char *fmtString, ... ) PRINTFLIKE(2, 3);
+_mesa_warning( struct gl_context *gc, const char *fmtString, ... ) PRINTFLIKE(2, 3);
extern void
-_mesa_problem( const __GLcontext *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3);
+_mesa_problem( const struct gl_context *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3);
extern void
-_mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... ) PRINTFLIKE(3, 4);
+_mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) PRINTFLIKE(3, 4);
extern void
-_mesa_debug( const __GLcontext *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3);
+_mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3);
#if defined(_MSC_VER) && !defined(snprintf)
* Also, all error checking should have already been done.
*/
void
-_mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params)
+_mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *params)
{
struct gl_light *light;
* of the targeted material values.
*/
GLuint
-_mesa_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname,
+_mesa_material_bitmask( struct gl_context *ctx, GLenum face, GLenum pname,
GLuint legal, const char *where )
{
GLuint bitmask = 0;
/* Update derived values following a change in ctx->Light.Material
*/
void
-_mesa_update_material( GLcontext *ctx, GLuint bitmask )
+_mesa_update_material( struct gl_context *ctx, GLuint bitmask )
{
struct gl_light *light, *list = &ctx->Light.EnabledList;
GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
* set by glColorMaterial().
*/
void
-_mesa_update_color_material( GLcontext *ctx, const GLfloat color[4] )
+_mesa_update_color_material( struct gl_context *ctx, const GLfloat color[4] )
{
GLuint bitmask = ctx->Light.ColorMaterialBitmask;
struct gl_material *mat = &ctx->Light.Material;
* by keeping a MRU cache of shine tables for various shine values.
*/
void
-_mesa_invalidate_shine_table( GLcontext *ctx, GLuint side )
+_mesa_invalidate_shine_table( struct gl_context *ctx, GLuint side )
{
ASSERT(side < 2);
if (ctx->_ShineTable[side])
static void
-validate_shine_table( GLcontext *ctx, GLuint side, GLfloat shininess )
+validate_shine_table( struct gl_context *ctx, GLuint side, GLfloat shininess )
{
struct gl_shine_tab *list = ctx->_ShineTabList;
struct gl_shine_tab *s;
void
-_mesa_validate_all_lighting_tables( GLcontext *ctx )
+_mesa_validate_all_lighting_tables( struct gl_context *ctx )
{
GLuint i;
GLfloat shininess;
* source and material ambient, diffuse and specular coefficients.
*/
void
-_mesa_update_lighting( GLcontext *ctx )
+_mesa_update_lighting( struct gl_context *ctx )
{
struct gl_light *light;
ctx->Light._NeedEyeCoords = GL_FALSE;
* Also update on lighting space changes.
*/
static void
-compute_light_positions( GLcontext *ctx )
+compute_light_positions( struct gl_context *ctx )
{
struct gl_light *light;
static const GLfloat eye_z[3] = { 0, 0, 1 };
static void
-update_modelview_scale( GLcontext *ctx )
+update_modelview_scale( struct gl_context *ctx )
{
ctx->_ModelViewInvScale = 1.0F;
if (!_math_matrix_is_length_preserving(ctx->ModelviewMatrixStack.Top)) {
* Bring up to date any state that relies on _NeedEyeCoords.
*/
void
-_mesa_update_tnl_spaces( GLcontext *ctx, GLuint new_state )
+_mesa_update_tnl_spaces( struct gl_context *ctx, GLuint new_state )
{
const GLuint oldneedeyecoords = ctx->_NeedEyeCoords;
* light-in-modelspace optimization. It's also useful for debugging.
*/
void
-_mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag )
+_mesa_allow_light_in_model( struct gl_context *ctx, GLboolean flag )
{
ctx->_ForceEyeCoords = !flag;
ctx->NewState |= _NEW_POINT; /* one of the bits from
* Initialize all lighting state for the given context.
*/
void
-_mesa_init_lighting( GLcontext *ctx )
+_mesa_init_lighting( struct gl_context *ctx )
{
GLuint i;
* Deallocate malloc'd lighting state attached to given context.
*/
void
-_mesa_free_lighting_data( GLcontext *ctx )
+_mesa_free_lighting_data( struct gl_context *ctx )
{
struct gl_shine_tab *s, *tmps;
extern void
-_mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params);
+_mesa_light(struct gl_context *ctx, GLuint lnum, GLenum pname, const GLfloat *params);
/* Lerp between adjacent values in the f(x) lookup table, giving a
} while (0)
-extern GLuint _mesa_material_bitmask( GLcontext *ctx,
+extern GLuint _mesa_material_bitmask( struct gl_context *ctx,
GLenum face, GLenum pname,
GLuint legal,
const char * );
extern void _mesa_invalidate_spot_exp_table( struct gl_light *l );
-extern void _mesa_invalidate_shine_table( GLcontext *ctx, GLuint i );
+extern void _mesa_invalidate_shine_table( struct gl_context *ctx, GLuint i );
-extern void _mesa_validate_all_lighting_tables( GLcontext *ctx );
+extern void _mesa_validate_all_lighting_tables( struct gl_context *ctx );
-extern void _mesa_update_lighting( GLcontext *ctx );
+extern void _mesa_update_lighting( struct gl_context *ctx );
-extern void _mesa_update_tnl_spaces( GLcontext *ctx, GLuint new_state );
+extern void _mesa_update_tnl_spaces( struct gl_context *ctx, GLuint new_state );
-extern void _mesa_update_material( GLcontext *ctx,
+extern void _mesa_update_material( struct gl_context *ctx,
GLuint bitmask );
extern void _mesa_copy_materials( struct gl_material *dst,
const struct gl_material *src,
GLuint bitmask );
-extern void _mesa_update_color_material( GLcontext *ctx,
+extern void _mesa_update_color_material( struct gl_context *ctx,
const GLfloat rgba[4] );
-extern void _mesa_init_lighting( GLcontext *ctx );
+extern void _mesa_init_lighting( struct gl_context *ctx );
-extern void _mesa_free_lighting_data( GLcontext *ctx );
+extern void _mesa_free_lighting_data( struct gl_context *ctx );
-extern void _mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag );
+extern void _mesa_allow_light_in_model( struct gl_context *ctx, GLboolean flag );
#else
#define _mesa_update_color_material( c, r ) ((void)0)
*
* \param ctx GL context.
*
- * Initializes __GLcontextRec::Line and line related constants in
- * __GLcontextRec::Const.
+ * Initializes __struct gl_contextRec::Line and line related constants in
+ * __struct gl_contextRec::Const.
*/
void GLAPIENTRY
-_mesa_init_line( GLcontext * ctx )
+_mesa_init_line( struct gl_context * ctx )
{
ctx->Line.SmoothFlag = GL_FALSE;
ctx->Line.StippleFlag = GL_FALSE;
_mesa_LineStipple( GLint factor, GLushort pattern );
extern void GLAPIENTRY
-_mesa_init_line( GLcontext * ctx );
+_mesa_init_line( struct gl_context * ctx );
#endif
*
* Flushes vertices and validates parameters. Calls _math_matrix_frustum() with
* the top matrix of the current matrix stack and sets
- * __GLcontextRec::NewState.
+ * __struct gl_contextRec::NewState.
*/
void GLAPIENTRY
_mesa_Frustum( GLdouble left, GLdouble right,
*
* Flushes vertices and validates parameters. Calls _math_matrix_ortho() with
* the top matrix of the current matrix stack and sets
- * __GLcontextRec::NewState.
+ * __struct gl_contextRec::NewState.
*/
void GLAPIENTRY
_mesa_Ortho( GLdouble left, GLdouble right,
* \sa glMatrixMode().
*
* Flushes the vertices, validates the parameter and updates
- * __GLcontextRec::CurrentStack and gl_transform_attrib::MatrixMode with the
+ * __struct gl_contextRec::CurrentStack and gl_transform_attrib::MatrixMode with the
* specified matrix stack.
*/
void GLAPIENTRY
* \sa glPushMatrix().
*
* Verifies the current matrix stack is not full, and duplicates the top-most
- * matrix in the stack. Marks __GLcontextRec::NewState with the stack dirty
+ * matrix in the stack. Marks __struct gl_contextRec::NewState with the stack dirty
* flag.
*/
void GLAPIENTRY
* \sa glPopMatrix().
*
* Flushes the vertices, verifies the current matrix stack is not empty, and
- * moves the stack head down. Marks __GLcontextRec::NewState with the dirty
+ * moves the stack head down. Marks __struct gl_contextRec::NewState with the dirty
* stack flag.
*/
void GLAPIENTRY
* \sa glLoadIdentity().
*
* Flushes the vertices and calls _math_matrix_set_identity() with the top-most
- * matrix in the current stack. Marks __GLcontextRec::NewState with the stack
+ * matrix in the current stack. Marks __struct gl_contextRec::NewState with the stack
* dirty flag.
*/
void GLAPIENTRY
* \sa glLoadMatrixf().
*
* Flushes the vertices and calls _math_matrix_loadf() with the top-most matrix
- * in the current stack and the given matrix. Marks __GLcontextRec::NewState
+ * in the current stack and the given matrix. Marks __struct gl_contextRec::NewState
* with the dirty stack flag.
*/
void GLAPIENTRY
*
* Flushes the vertices and calls _math_matrix_mul_floats() with the top-most
* matrix in the current stack and the given matrix. Marks
- * __GLcontextRec::NewState with the dirty stack flag.
+ * __struct gl_contextRec::NewState with the dirty stack flag.
*/
void GLAPIENTRY
_mesa_MultMatrixf( const GLfloat *m )
*
* Flushes the vertices and calls _math_matrix_rotate() with the top-most
* matrix in the current stack and the given parameters. Marks
- * __GLcontextRec::NewState with the dirty stack flag.
+ * __struct gl_contextRec::NewState with the dirty stack flag.
*/
void GLAPIENTRY
_mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
*
* Flushes the vertices and calls _math_matrix_scale() with the top-most
* matrix in the current stack and the given parameters. Marks
- * __GLcontextRec::NewState with the dirty stack flag.
+ * __struct gl_contextRec::NewState with the dirty stack flag.
*/
void GLAPIENTRY
_mesa_Scalef( GLfloat x, GLfloat y, GLfloat z )
*
* Flushes the vertices and calls _math_matrix_translate() with the top-most
* matrix in the current stack and the given parameters. Marks
- * __GLcontextRec::NewState with the dirty stack flag.
+ * __struct gl_contextRec::NewState with the dirty stack flag.
*/
void GLAPIENTRY
_mesa_Translatef( GLfloat x, GLfloat y, GLfloat z )
* Calls _math_matrix_analyse() with the top-matrix of the projection matrix
* stack, and recomputes user clip positions if necessary.
*
- * \note This routine references __GLcontextRec::Tranform attribute values to
+ * \note This routine references __struct gl_contextRec::Tranform attribute values to
* compute userclip positions in clip space, but is only called on
* _NEW_PROJECTION. The _mesa_ClipPlane() function keeps these values up to
- * date across changes to the __GLcontextRec::Transform attributes.
+ * date across changes to the __struct gl_contextRec::Transform attributes.
*/
static void
-update_projection( GLcontext *ctx )
+update_projection( struct gl_context *ctx )
{
_math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
* \param ctx GL context.
*
* Multiplies the top matrices of the projection and model view stacks into
- * __GLcontextRec::_ModelProjectMatrix via _math_matrix_mul_matrix() and
+ * __struct gl_contextRec::_ModelProjectMatrix via _math_matrix_mul_matrix() and
* analyzes the resulting matrix via _math_matrix_analyse().
*/
static void
-calculate_model_project_matrix( GLcontext *ctx )
+calculate_model_project_matrix( struct gl_context *ctx )
{
_math_matrix_mul_matrix( &ctx->_ModelProjectMatrix,
ctx->ProjectionMatrixStack.Top,
* calculate_model_project_matrix() to recalculate the modelview-projection
* matrix.
*/
-void _mesa_update_modelview_project( GLcontext *ctx, GLuint new_state )
+void _mesa_update_modelview_project( struct gl_context *ctx, GLuint new_state )
{
if (new_state & _NEW_MODELVIEW) {
_math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
* Initializes each of the matrix stacks and the combined modelview-projection
* matrix.
*/
-void _mesa_init_matrix( GLcontext * ctx )
+void _mesa_init_matrix( struct gl_context * ctx )
{
GLint i;
* Frees each of the matrix stacks and the combined modelview-projection
* matrix.
*/
-void _mesa_free_matrix_data( GLcontext *ctx )
+void _mesa_free_matrix_data( struct gl_context *ctx )
{
GLint i;
*
* \todo Move this to a new file with other 'transform' routines.
*/
-void _mesa_init_transform( GLcontext *ctx )
+void _mesa_init_transform( struct gl_context *ctx )
{
GLint i;
extern void
-_mesa_init_matrix( GLcontext * ctx );
+_mesa_init_matrix( struct gl_context * ctx );
extern void
-_mesa_init_transform( GLcontext *ctx );
+_mesa_init_transform( struct gl_context *ctx );
extern void
-_mesa_free_matrix_data( GLcontext *ctx );
+_mesa_free_matrix_data( struct gl_context *ctx );
extern void
-_mesa_update_modelview_project( GLcontext *ctx, GLuint newstate );
+_mesa_update_modelview_project( struct gl_context *ctx, GLuint newstate );
#endif
FILTER_3D(0);
}
}
- if ((datatype == GL_BYTE) && (comps == 4)) {
+ else if ((datatype == GL_BYTE) && (comps == 4)) {
DECLARE_ROW_POINTERS(GLbyte, 4);
for (i = j = 0, k = k0; i < (GLuint) dstWidth;
* GL_TEXTURE_CUBE_MAP_POSITIVE/NEGATIVE_X/Y/Z; never GL_TEXTURE_CUBE_MAP.
*/
void
-_mesa_generate_mipmap(GLcontext *ctx, GLenum target,
+_mesa_generate_mipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj)
{
const struct gl_texture_image *srcImage;
extern void
-_mesa_generate_mipmap(GLcontext *ctx, GLenum target,
+_mesa_generate_mipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj);
struct gl_texture_format;
struct gl_texture_image;
struct gl_texture_object;
+struct gl_context;
struct st_context;
-typedef struct __GLcontextRec GLcontext;
-typedef struct __GLcontextModesRec GLvisual;
-typedef struct gl_framebuffer GLframebuffer;
/*@}*/
typedef enum
{
FRAG_RESULT_DEPTH = 0,
- FRAG_RESULT_COLOR = 1,
- FRAG_RESULT_DATA0 = 2,
+ FRAG_RESULT_STENCIL = 1,
+ FRAG_RESULT_COLOR = 2,
+ FRAG_RESULT_DATA0 = 3,
FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS)
} gl_frag_result;
GLuint refcount;
};
+struct gl_config {
+ GLboolean rgbMode;
+ GLboolean floatMode;
+ GLboolean colorIndexMode;
+ GLuint doubleBufferMode;
+ GLuint stereoMode;
+
+ GLboolean haveAccumBuffer;
+ GLboolean haveDepthBuffer;
+ GLboolean haveStencilBuffer;
+
+ GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */
+ GLuint redMask, greenMask, blueMask, alphaMask;
+ GLint rgbBits; /* total bits for rgb */
+ GLint indexBits; /* total bits for colorindex */
+
+ GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
+ GLint depthBits;
+ GLint stencilBits;
+
+ GLint numAuxBuffers;
+
+ GLint level;
+
+ /* EXT_visual_rating / GLX 1.2 */
+ GLint visualRating;
+
+ /* EXT_visual_info / GLX 1.2 */
+ GLint transparentPixel;
+ /* colors are floats scaled to ints */
+ GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
+ GLint transparentIndex;
+
+ /* ARB_multisample / SGIS_multisample */
+ GLint sampleBuffers;
+ GLint samples;
+
+ /* SGIX_pbuffer / GLX 1.3 */
+ GLint maxPbufferWidth;
+ GLint maxPbufferHeight;
+ GLint maxPbufferPixels;
+ GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */
+ GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */
+
+ /* OML_swap_method */
+ GLint swapMethod;
+
+ /* EXT_texture_from_pixmap */
+ GLint bindToTextureRgb;
+ GLint bindToTextureRgba;
+ GLint bindToMipmapTexture;
+ GLint bindToTextureTargets;
+ GLint yInverted;
+};
/**
* Light source state.
/**
* Per-stage shaders resulting from the first stage of linking.
+ *
+ * Set of linked shaders for this program. The array is accessed using the
+ * \c MESA_SHADER_* defines. Entries for non-existent stages will be
+ * \c NULL.
*/
- /*@{*/
- GLuint _NumLinkedShaders;
- struct gl_shader *_LinkedShaders[2];
- /*@}*/
+ struct gl_shader *_LinkedShaders[MESA_SHADER_TYPES];
};
void (*Delete)(struct gl_renderbuffer *rb);
/* Allocate new storage for this renderbuffer */
- GLboolean (*AllocStorage)(GLcontext *ctx, struct gl_renderbuffer *rb,
+ GLboolean (*AllocStorage)(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width, GLuint height);
/* Lock/Unlock are called before/after calling the Get/Put functions.
* Not sure this is the right place for these yet.
- void (*Lock)(GLcontext *ctx, struct gl_renderbuffer *rb);
- void (*Unlock)(GLcontext *ctx, struct gl_renderbuffer *rb);
+ void (*Lock)(struct gl_context *ctx, struct gl_renderbuffer *rb);
+ void (*Unlock)(struct gl_context *ctx, struct gl_renderbuffer *rb);
*/
/* Return a pointer to the element/pixel at (x,y).
* Should return NULL if the buffer memory can't be directly addressed.
*/
- void *(*GetPointer)(GLcontext *ctx, struct gl_renderbuffer *rb,
+ void *(*GetPointer)(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint x, GLint y);
/* Get/Read a row of values.
* The values will be of format _BaseFormat and type DataType.
*/
- void (*GetRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ void (*GetRow)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, void *values);
/* Get/Read values at arbitrary locations.
* The values will be of format _BaseFormat and type DataType.
*/
- void (*GetValues)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ void (*GetValues)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], void *values);
/* Put/Write a row of values.
* The values will be of format _BaseFormat and type DataType.
*/
- void (*PutRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ void (*PutRow)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask);
/* Put/Write a row of RGB values. This is a special-case routine that's
* a common case for glDrawPixels and some triangle routines.
* The values will be of format GL_RGB and type DataType.
*/
- void (*PutRowRGB)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ void (*PutRowRGB)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask);
/* Put/Write a row of identical values.
* The values will be of format _BaseFormat and type DataType.
*/
- void (*PutMonoRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ void (*PutMonoRow)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *value, const GLubyte *mask);
/* Put/Write values at arbitrary locations.
* The values will be of format _BaseFormat and type DataType.
*/
- void (*PutValues)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+ void (*PutValues)(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], const void *values,
const GLubyte *mask);
/* Put/Write identical values at arbitrary locations.
* The values will be of format _BaseFormat and type DataType.
*/
- void (*PutMonoValues)(GLcontext *ctx, struct gl_renderbuffer *rb,
+ void (*PutMonoValues)(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
const void *value, const GLubyte *mask);
};
* The framebuffer's visual. Immutable if this is a window system buffer.
* Computed from attachments if user-made FBO.
*/
- GLvisual Visual;
+ struct gl_config Visual;
GLboolean Initialized;
GLboolean ARB_sampler_objects;
GLboolean ARB_seamless_cube_map;
GLboolean ARB_shader_objects;
+ GLboolean ARB_shader_stencil_export;
GLboolean ARB_shading_language_100;
GLboolean ARB_shadow;
GLboolean ARB_shadow_ambient;
GLboolean ARB_texture_border_clamp;
GLboolean ARB_texture_buffer_object;
GLboolean ARB_texture_compression;
+ GLboolean ARB_texture_compression_rgtc;
GLboolean ARB_texture_cube_map;
GLboolean ARB_texture_env_combine;
GLboolean ARB_texture_env_crossbar;
GLboolean EXT_texture3D;
GLboolean EXT_texture_array;
GLboolean EXT_texture_compression_s3tc;
- GLboolean EXT_texture_compression_rgtc;
GLboolean EXT_texture_env_add;
GLboolean EXT_texture_env_combine;
GLboolean EXT_texture_env_dot3;
GLboolean S3_s3tc;
GLboolean OES_EGL_image;
GLboolean OES_draw_texture;
+ GLboolean EXT_texture_format_BGRA8888;
/** The extension string */
const GLubyte *String;
/** Number of supported extensions */
/**
* \name Bits for image transfer operations
- * \sa __GLcontextRec::ImageTransferState.
+ * \sa __struct gl_contextRec::ImageTransferState.
*/
/*@{*/
#define IMAGE_SCALE_BIAS_BIT 0x1
* 4 unused flags.
*/
/*@{*/
-#define _NEW_MODELVIEW 0x1 /**< __GLcontextRec::ModelView */
-#define _NEW_PROJECTION 0x2 /**< __GLcontextRec::Projection */
-#define _NEW_TEXTURE_MATRIX 0x4 /**< __GLcontextRec::TextureMatrix */
-#define _NEW_ACCUM 0x10 /**< __GLcontextRec::Accum */
-#define _NEW_COLOR 0x20 /**< __GLcontextRec::Color */
-#define _NEW_DEPTH 0x40 /**< __GLcontextRec::Depth */
-#define _NEW_EVAL 0x80 /**< __GLcontextRec::Eval, __GLcontextRec::EvalMap */
-#define _NEW_FOG 0x100 /**< __GLcontextRec::Fog */
-#define _NEW_HINT 0x200 /**< __GLcontextRec::Hint */
-#define _NEW_LIGHT 0x400 /**< __GLcontextRec::Light */
-#define _NEW_LINE 0x800 /**< __GLcontextRec::Line */
-#define _NEW_PIXEL 0x1000 /**< __GLcontextRec::Pixel */
-#define _NEW_POINT 0x2000 /**< __GLcontextRec::Point */
-#define _NEW_POLYGON 0x4000 /**< __GLcontextRec::Polygon */
-#define _NEW_POLYGONSTIPPLE 0x8000 /**< __GLcontextRec::PolygonStipple */
-#define _NEW_SCISSOR 0x10000 /**< __GLcontextRec::Scissor */
-#define _NEW_STENCIL 0x20000 /**< __GLcontextRec::Stencil */
-#define _NEW_TEXTURE 0x40000 /**< __GLcontextRec::Texture */
-#define _NEW_TRANSFORM 0x80000 /**< __GLcontextRec::Transform */
-#define _NEW_VIEWPORT 0x100000 /**< __GLcontextRec::Viewport */
-#define _NEW_PACKUNPACK 0x200000 /**< __GLcontextRec::Pack, __GLcontextRec::Unpack */
-#define _NEW_ARRAY 0x400000 /**< __GLcontextRec::Array */
-#define _NEW_RENDERMODE 0x800000 /**< __GLcontextRec::RenderMode, __GLcontextRec::Feedback, __GLcontextRec::Select */
-#define _NEW_BUFFERS 0x1000000 /**< __GLcontextRec::Visual, __GLcontextRec::DrawBuffer, */
-#define _NEW_MULTISAMPLE 0x2000000 /**< __GLcontextRec::Multisample */
-#define _NEW_TRACK_MATRIX 0x4000000 /**< __GLcontextRec::VertexProgram */
-#define _NEW_PROGRAM 0x8000000 /**< __GLcontextRec::VertexProgram */
-#define _NEW_CURRENT_ATTRIB 0x10000000 /**< __GLcontextRec::Current */
+#define _NEW_MODELVIEW 0x1 /**< __struct gl_contextRec::ModelView */
+#define _NEW_PROJECTION 0x2 /**< __struct gl_contextRec::Projection */
+#define _NEW_TEXTURE_MATRIX 0x4 /**< __struct gl_contextRec::TextureMatrix */
+#define _NEW_ACCUM 0x10 /**< __struct gl_contextRec::Accum */
+#define _NEW_COLOR 0x20 /**< __struct gl_contextRec::Color */
+#define _NEW_DEPTH 0x40 /**< __struct gl_contextRec::Depth */
+#define _NEW_EVAL 0x80 /**< __struct gl_contextRec::Eval, __struct gl_contextRec::EvalMap */
+#define _NEW_FOG 0x100 /**< __struct gl_contextRec::Fog */
+#define _NEW_HINT 0x200 /**< __struct gl_contextRec::Hint */
+#define _NEW_LIGHT 0x400 /**< __struct gl_contextRec::Light */
+#define _NEW_LINE 0x800 /**< __struct gl_contextRec::Line */
+#define _NEW_PIXEL 0x1000 /**< __struct gl_contextRec::Pixel */
+#define _NEW_POINT 0x2000 /**< __struct gl_contextRec::Point */
+#define _NEW_POLYGON 0x4000 /**< __struct gl_contextRec::Polygon */
+#define _NEW_POLYGONSTIPPLE 0x8000 /**< __struct gl_contextRec::PolygonStipple */
+#define _NEW_SCISSOR 0x10000 /**< __struct gl_contextRec::Scissor */
+#define _NEW_STENCIL 0x20000 /**< __struct gl_contextRec::Stencil */
+#define _NEW_TEXTURE 0x40000 /**< __struct gl_contextRec::Texture */
+#define _NEW_TRANSFORM 0x80000 /**< __struct gl_contextRec::Transform */
+#define _NEW_VIEWPORT 0x100000 /**< __struct gl_contextRec::Viewport */
+#define _NEW_PACKUNPACK 0x200000 /**< __struct gl_contextRec::Pack, __struct gl_contextRec::Unpack */
+#define _NEW_ARRAY 0x400000 /**< __struct gl_contextRec::Array */
+#define _NEW_RENDERMODE 0x800000 /**< __struct gl_contextRec::RenderMode, __struct gl_contextRec::Feedback, __struct gl_contextRec::Select */
+#define _NEW_BUFFERS 0x1000000 /**< __struct gl_contextRec::Visual, __struct gl_contextRec::DrawBuffer, */
+#define _NEW_MULTISAMPLE 0x2000000 /**< __struct gl_contextRec::Multisample */
+#define _NEW_TRACK_MATRIX 0x4000000 /**< __struct gl_contextRec::VertexProgram */
+#define _NEW_PROGRAM 0x8000000 /**< __struct gl_contextRec::VertexProgram */
+#define _NEW_CURRENT_ATTRIB 0x10000000 /**< __struct gl_contextRec::Current */
#define _NEW_PROGRAM_CONSTANTS 0x20000000
#define _NEW_BUFFER_OBJECT 0x40000000
#define _NEW_ALL ~0
/**
* \name A bunch of flags that we think might be useful to drivers.
*
- * Set in the __GLcontextRec::_TriangleCaps bitfield.
+ * Set in the __struct gl_contextRec::_TriangleCaps bitfield.
*/
/*@{*/
#define DD_FLATSHADE 0x1
#include "dd.h"
-#define NUM_VERTEX_FORMAT_ENTRIES (sizeof(GLvertexformat) / sizeof(void *))
-
-/**
- * Core Mesa's support for tnl modules:
- */
-struct gl_tnl_module
-{
- /**
- * Vertex format to be lazily swapped into current dispatch.
- */
- const GLvertexformat *Current;
-
- /**
- * \name Record of functions swapped out.
- * On restore, only need to swap these functions back in.
- */
- /*@{*/
- struct {
- _glapi_proc * location;
- _glapi_proc function;
- } Swapped[NUM_VERTEX_FORMAT_ENTRIES];
- GLuint SwapCount;
- /*@}*/
-};
-
-
/**
* Display list flags.
* Strictly this is a tnl-private concept, but it doesn't seem
* Think of this as a base class from which device drivers will derive
* sub classes.
*
- * The GLcontext typedef names this structure.
+ * The struct gl_context typedef names this structure.
*/
-struct __GLcontextRec
+struct gl_context
{
/** State possibly shared with other contexts in the address space */
struct gl_shared_state *Shared;
struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */
/*@}*/
- GLvisual Visual;
- GLframebuffer *DrawBuffer; /**< buffer for writing */
- GLframebuffer *ReadBuffer; /**< buffer for reading */
- GLframebuffer *WinSysDrawBuffer; /**< set with MakeCurrent */
- GLframebuffer *WinSysReadBuffer; /**< set with MakeCurrent */
+ struct gl_config Visual;
+ struct gl_framebuffer *DrawBuffer; /**< buffer for writing */
+ struct gl_framebuffer *ReadBuffer; /**< buffer for reading */
+ struct gl_framebuffer *WinSysDrawBuffer; /**< set with MakeCurrent */
+ struct gl_framebuffer *WinSysReadBuffer; /**< set with MakeCurrent */
/**
* Device driver function pointer table
*/
GLboolean mvp_with_dp4;
- /** Core tnl module support */
- struct gl_tnl_module TnlModule;
-
/**
* \name Hooks for module contexts.
*
* \param ctx the GL context.
*/
void
-_mesa_init_multisample(GLcontext *ctx)
+_mesa_init_multisample(struct gl_context *ctx)
{
ctx->Multisample.Enabled = GL_TRUE;
ctx->Multisample.SampleAlphaToCoverage = GL_FALSE;
extern void
-_mesa_init_multisample(GLcontext *ctx);
+_mesa_init_multisample(struct gl_context *ctx);
#endif
}
void
-_mesa_emit_nv_temp_initialization(GLcontext *ctx,
+_mesa_emit_nv_temp_initialization(struct gl_context *ctx,
struct gl_program *program)
{
struct prog_instruction *inst;
}
void
-_mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program)
+_mesa_setup_nv_temporary_count(struct gl_context *ctx, struct gl_program *program)
{
GLuint i;
GLdouble *params);
extern void
-_mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program);
+_mesa_setup_nv_temporary_count(struct gl_context *ctx, struct gl_program *program);
extern void
-_mesa_emit_nv_temp_initialization(GLcontext *ctx,
+_mesa_emit_nv_temp_initialization(struct gl_context *ctx,
struct gl_program *program);
#endif
* Return pointer to a pixelmap by name.
*/
static struct gl_pixelmap *
-get_pixelmap(GLcontext *ctx, GLenum map)
+get_pixelmap(struct gl_context *ctx, GLenum map)
{
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
* Helper routine used by the other _mesa_PixelMap() functions.
*/
static void
-store_pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize,
+store_pixelmap(struct gl_context *ctx, GLenum map, GLsizei mapsize,
const GLfloat *values)
{
GLint i;
* Convenience wrapper for _mesa_validate_pbo_access() for gl[Get]PixelMap().
*/
static GLboolean
-validate_pbo_access(GLcontext *ctx, struct gl_pixelstore_attrib *pack,
+validate_pbo_access(struct gl_context *ctx, struct gl_pixelstore_attrib *pack,
GLsizei mapsize, GLenum format, GLenum type,
const GLvoid *ptr)
{
* pixel transfer operations are enabled.
*/
static void
-update_image_transfer_state(GLcontext *ctx)
+update_image_transfer_state(struct gl_context *ctx)
{
GLuint mask = 0;
/**
* Update mesa pixel transfer derived state.
*/
-void _mesa_update_pixel( GLcontext *ctx, GLuint new_state )
+void _mesa_update_pixel( struct gl_context *ctx, GLuint new_state )
{
if (new_state & _MESA_NEW_TRANSFER_STATE)
update_image_transfer_state(ctx);
* Initialize the context's PIXEL attribute group.
*/
void
-_mesa_init_pixel( GLcontext *ctx )
+_mesa_init_pixel( struct gl_context *ctx )
{
/* Pixel group */
ctx->Pixel.RedBias = 0.0;
#if FEATURE_pixel_transfer
extern void
-_mesa_update_pixel( GLcontext *ctx, GLuint newstate );
+_mesa_update_pixel( struct gl_context *ctx, GLuint newstate );
extern void
_mesa_init_pixel_dispatch( struct _glapi_table * disp );
#else /* FEATURE_pixel_transfer */
static INLINE void
-_mesa_update_pixel(GLcontext *ctx, GLuint newstate)
+_mesa_update_pixel(struct gl_context *ctx, GLuint newstate)
{
}
extern void
-_mesa_init_pixel( GLcontext * ctx );
+_mesa_init_pixel( struct gl_context * ctx );
/*@}*/
* Initialize the context's pixel store state.
*/
void
-_mesa_init_pixelstore( GLcontext *ctx )
+_mesa_init_pixelstore( struct gl_context *ctx )
{
/* Pixel transfer */
ctx->Pack.Alignment = 4;
extern void
-_mesa_init_pixelstore( GLcontext *ctx );
+_mesa_init_pixelstore( struct gl_context *ctx );
#endif
*
* \param ctx GL context.
*
- * Initializes __GLcontextRec::Point and point related constants in
- * __GLcontextRec::Const.
+ * Initializes __struct gl_contextRec::Point and point related constants in
+ * __struct gl_contextRec::Const.
*/
void
-_mesa_init_point(GLcontext *ctx)
+_mesa_init_point(struct gl_context *ctx)
{
GLuint i;
_mesa_PointParameterfv( GLenum pname, const GLfloat *params );
extern void
-_mesa_init_point( GLcontext * ctx );
+_mesa_init_point( struct gl_context * ctx );
#endif
* too.
*/
void
-_mesa_polygon_stipple(GLcontext *ctx, const GLubyte *pattern)
+_mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern)
{
pattern = _mesa_map_validate_pbo_source(ctx, 2,
&ctx->Unpack, 32, 32, 1,
*
* \param ctx GL context.
*
- * Initializes __GLcontextRec::Polygon and __GLcontextRec::PolygonStipple
+ * Initializes __struct gl_contextRec::Polygon and __struct gl_contextRec::PolygonStipple
* attribute groups.
*/
-void _mesa_init_polygon( GLcontext * ctx )
+void _mesa_init_polygon( struct gl_context * ctx )
{
/* Polygon group */
ctx->Polygon.CullFlag = GL_FALSE;
extern void
-_mesa_polygon_stipple(GLcontext *ctx, const GLubyte *pattern);
+_mesa_polygon_stipple(struct gl_context *ctx, const GLubyte *pattern);
extern void GLAPIENTRY
_mesa_GetPolygonStipple( GLubyte *mask );
extern void
-_mesa_init_polygon( GLcontext * ctx );
+_mesa_init_polygon( struct gl_context * ctx );
#endif
* \return pointer to new query_object object or NULL if out of memory.
*/
static struct gl_query_object *
-_mesa_new_query_object(GLcontext *ctx, GLuint id)
+_mesa_new_query_object(struct gl_context *ctx, GLuint id)
{
struct gl_query_object *q = MALLOC_STRUCT(gl_query_object);
(void) ctx;
* Called via ctx->Driver.BeginQuery().
*/
static void
-_mesa_begin_query(GLcontext *ctx, struct gl_query_object *q)
+_mesa_begin_query(struct gl_context *ctx, struct gl_query_object *q)
{
/* no-op */
}
* Called via ctx->Driver.EndQuery().
*/
static void
-_mesa_end_query(GLcontext *ctx, struct gl_query_object *q)
+_mesa_end_query(struct gl_context *ctx, struct gl_query_object *q)
{
q->Ready = GL_TRUE;
}
* Called via ctx->Driver.WaitQuery().
*/
static void
-_mesa_wait_query(GLcontext *ctx, struct gl_query_object *q)
+_mesa_wait_query(struct gl_context *ctx, struct gl_query_object *q)
{
/* For software drivers, _mesa_end_query() should have completed the query.
* For real hardware, implement a proper WaitQuery() driver function,
* Called via ctx->Driver.CheckQuery().
*/
static void
-_mesa_check_query(GLcontext *ctx, struct gl_query_object *q)
+_mesa_check_query(struct gl_context *ctx, struct gl_query_object *q)
{
/* No-op for sw rendering.
* HW drivers may need to flush at this time.
* Not removed from hash table here.
*/
static void
-_mesa_delete_query(GLcontext *ctx, struct gl_query_object *q)
+_mesa_delete_query(struct gl_context *ctx, struct gl_query_object *q)
{
free(q);
}
* \return NULL if invalid target, else the address of binding point
*/
static struct gl_query_object **
-get_query_binding_point(GLcontext *ctx, GLenum target)
+get_query_binding_point(struct gl_context *ctx, GLenum target)
{
switch (target) {
case GL_SAMPLES_PASSED_ARB:
* Allocate/init the context state related to query objects.
*/
void
-_mesa_init_queryobj(GLcontext *ctx)
+_mesa_init_queryobj(struct gl_context *ctx)
{
ctx->Query.QueryObjects = _mesa_NewHashTable();
ctx->Query.CurrentOcclusionObject = NULL;
delete_queryobj_cb(GLuint id, void *data, void *userData)
{
struct gl_query_object *q= (struct gl_query_object *) data;
- GLcontext *ctx = (GLcontext *)userData;
+ struct gl_context *ctx = (struct gl_context *)userData;
ctx->Driver.DeleteQuery(ctx, q);
}
* Free the context state related to query objects.
*/
void
-_mesa_free_queryobj_data(GLcontext *ctx)
+_mesa_free_queryobj_data(struct gl_context *ctx)
{
_mesa_HashDeleteAll(ctx->Query.QueryObjects, delete_queryobj_cb, ctx);
_mesa_DeleteHashTable(ctx->Query.QueryObjects);
#if FEATURE_queryobj
static INLINE struct gl_query_object *
-_mesa_lookup_query_object(GLcontext *ctx, GLuint id)
+_mesa_lookup_query_object(struct gl_context *ctx, GLuint id)
{
return (struct gl_query_object *)
_mesa_HashLookup(ctx->Query.QueryObjects, id);
#else /* FEATURE_queryobj */
static INLINE struct gl_query_object *
-_mesa_lookup_query_object(GLcontext *ctx, GLuint id)
+_mesa_lookup_query_object(struct gl_context *ctx, GLuint id)
{
return NULL;
}
#endif /* FEATURE_queryobj */
extern void
-_mesa_init_queryobj(GLcontext *ctx);
+_mesa_init_queryobj(struct gl_context *ctx);
extern void
-_mesa_free_queryobj_data(GLcontext *ctx);
+_mesa_free_queryobj_data(struct gl_context *ctx);
#endif /* QUERYOBJ_H */
* \param ctx GL context.
*
* Initialize the current raster position information in
- * __GLcontextRec::Current, and adds the extension entry points to the
+ * __struct gl_contextRec::Current, and adds the extension entry points to the
* dispatcher.
*/
-void _mesa_init_rastpos( GLcontext * ctx )
+void _mesa_init_rastpos( struct gl_context * ctx )
{
int i;
#endif /* FEATURE_rastpos */
extern void
-_mesa_init_rastpos(GLcontext *ctx);
+_mesa_init_rastpos(struct gl_context *ctx);
/*@}*/
* \return GL_TRUE if error detected, GL_FALSE if no errors
*/
GLboolean
-_mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type,
+_mesa_error_check_format_type(struct gl_context *ctx, GLenum format, GLenum type,
GLboolean drawing)
{
const char *readDraw = drawing ? "Draw" : "Read";
/* additional checks */
switch (format) {
+ case GL_RG:
case GL_RED:
case GL_GREEN:
case GL_BLUE:
extern GLboolean
-_mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type,
+_mesa_error_check_format_type(struct gl_context *ctx, GLenum format, GLenum type,
GLboolean drawing);
extern void GLAPIENTRY
#include "fbobject.h"
#include "formats.h"
#include "mtypes.h"
-#include "fbobject.h"
#include "renderbuffer.h"
*/
static void *
-get_pointer_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb,
+get_pointer_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint x, GLint y)
{
if (!rb->Data)
static void
-get_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+get_row_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, void *values)
{
const GLubyte *src = (const GLubyte *) rb->Data + y * rb->Width + x;
static void
-get_values_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+get_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], void *values)
{
GLubyte *dst = (GLubyte *) values;
static void
-put_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_row_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
const GLubyte *src = (const GLubyte *) values;
static void
-put_mono_row_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_mono_row_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *value, const GLubyte *mask)
{
const GLubyte val = *((const GLubyte *) value);
static void
-put_values_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[],
const void *values, const GLubyte *mask)
{
static void
-put_mono_values_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_mono_values_ubyte(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[],
const void *value, const GLubyte *mask)
{
*/
static void *
-get_pointer_ushort(GLcontext *ctx, struct gl_renderbuffer *rb,
+get_pointer_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint x, GLint y)
{
if (!rb->Data)
static void
-get_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+get_row_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, void *values)
{
const void *src = rb->GetPointer(ctx, rb, x, y);
static void
-get_values_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+get_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], void *values)
{
GLushort *dst = (GLushort *) values;
static void
-put_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_row_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
const GLushort *src = (const GLushort *) values;
static void
-put_mono_row_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_mono_row_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *value, const GLubyte *mask)
{
const GLushort val = *((const GLushort *) value);
static void
-put_values_ushort(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], const void *values,
const GLubyte *mask)
{
static void
-put_mono_values_ushort(GLcontext *ctx, struct gl_renderbuffer *rb,
+put_mono_values_ushort(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
const void *value, const GLubyte *mask)
{
*/
static void *
-get_pointer_uint(GLcontext *ctx, struct gl_renderbuffer *rb,
+get_pointer_uint(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint x, GLint y)
{
if (!rb->Data)
static void
-get_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+get_row_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, void *values)
{
const void *src = rb->GetPointer(ctx, rb, x, y);
static void
-get_values_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+get_values_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], void *values)
{
GLuint *dst = (GLuint *) values;
static void
-put_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_row_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
const GLuint *src = (const GLuint *) values;
static void
-put_mono_row_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_mono_row_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *value, const GLubyte *mask)
{
const GLuint val = *((const GLuint *) value);
static void
-put_values_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_values_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], const void *values,
const GLubyte *mask)
{
static void
-put_mono_values_uint(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_mono_values_uint(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], const void *value,
const GLubyte *mask)
{
*/
static void *
-get_pointer_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb,
+get_pointer_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint x, GLint y)
{
ASSERT(rb->Format == MESA_FORMAT_RGB888);
static void
-get_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+get_row_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, void *values)
{
const GLubyte *src = (const GLubyte *) rb->Data + 3 * (y * rb->Width + x);
static void
-get_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+get_values_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], void *values)
{
GLubyte *dst = (GLubyte *) values;
static void
-put_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_row_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
/* note: incoming values are RGB+A! */
static void
-put_row_rgb_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_row_rgb_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
/* note: incoming values are RGB+A! */
static void
-put_mono_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_mono_row_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *value, const GLubyte *mask)
{
/* note: incoming value is RGB+A! */
static void
-put_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_values_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], const void *values,
const GLubyte *mask)
{
static void
-put_mono_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb,
+put_mono_values_ubyte3(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
const void *value, const GLubyte *mask)
{
*/
static void *
-get_pointer_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb,
+get_pointer_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint x, GLint y)
{
if (!rb->Data)
static void
-get_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+get_row_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, void *values)
{
const GLubyte *src = (const GLubyte *) rb->Data + 4 * (y * rb->Width + x);
static void
-get_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+get_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], void *values)
{
/* treat 4*GLubyte as 1*GLuint */
static void
-put_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_row_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
/* treat 4*GLubyte as 1*GLuint */
static void
-put_row_rgb_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_row_rgb_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
/* Store RGB values in RGBA buffer */
static void
-put_mono_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_mono_row_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *value, const GLubyte *mask)
{
/* treat 4*GLubyte as 1*GLuint */
static void
-put_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], const void *values,
const GLubyte *mask)
{
static void
-put_mono_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb,
+put_mono_values_ubyte4(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
const void *value, const GLubyte *mask)
{
*/
static void *
-get_pointer_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb,
+get_pointer_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint x, GLint y)
{
if (!rb->Data)
static void
-get_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+get_row_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, void *values)
{
const GLshort *src = (const GLshort *) rb->Data + 4 * (y * rb->Width + x);
static void
-get_values_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+get_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], void *values)
{
GLushort *dst = (GLushort *) values;
static void
-put_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_row_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
const GLushort *src = (const GLushort *) values;
static void
-put_row_rgb_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_row_rgb_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
/* Put RGB values in RGBA buffer */
static void
-put_mono_row_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_mono_row_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *value, const GLubyte *mask)
{
const GLushort val0 = ((const GLushort *) value)[0];
static void
-put_values_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+put_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], const void *values,
const GLubyte *mask)
{
static void
-put_mono_values_ushort4(GLcontext *ctx, struct gl_renderbuffer *rb,
+put_mono_values_ushort4(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
const void *value, const GLubyte *mask)
{
* Get/PutValues functions.
*/
GLboolean
-_mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
+_mesa_soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width, GLuint height)
{
static GLboolean
-alloc_storage_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb,
+alloc_storage_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb,
GLenum internalFormat, GLuint width, GLuint height)
{
ASSERT(arb != arb->Wrapped);
static void *
-get_pointer_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb,
+get_pointer_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb,
GLint x, GLint y)
{
return NULL; /* don't allow direct access! */
static void
-get_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count,
+get_row_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count,
GLint x, GLint y, void *values)
{
/* NOTE: 'values' is RGBA format! */
static void
-get_values_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count,
+get_values_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count,
const GLint x[], const GLint y[], void *values)
{
GLubyte *dst = (GLubyte *) values;
static void
-put_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count,
+put_row_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
const GLubyte *src = (const GLubyte *) values;
static void
-put_row_rgb_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count,
+put_row_rgb_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
const GLubyte *src = (const GLubyte *) values;
static void
-put_mono_row_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count,
+put_mono_row_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count,
GLint x, GLint y, const void *value, const GLubyte *mask)
{
const GLubyte val = ((const GLubyte *) value)[3];
static void
-put_values_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLuint count,
+put_values_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb, GLuint count,
const GLint x[], const GLint y[],
const void *values, const GLubyte *mask)
{
static void
-put_mono_values_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb,
+put_mono_values_alpha8(struct gl_context *ctx, struct gl_renderbuffer *arb,
GLuint count, const GLint x[], const GLint y[],
const void *value, const GLubyte *mask)
{
* direct buffer access is not supported.
*/
static void *
-nop_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y)
+nop_get_pointer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLint x, GLint y)
{
return NULL;
}
* renderbuffers or window-system renderbuffers.
*/
struct gl_renderbuffer *
-_mesa_new_renderbuffer(GLcontext *ctx, GLuint name)
+_mesa_new_renderbuffer(struct gl_context *ctx, GLuint name)
{
struct gl_renderbuffer *rb = CALLOC_STRUCT(gl_renderbuffer);
if (rb) {
* This would not be used for hardware-based renderbuffers.
*/
struct gl_renderbuffer *
-_mesa_new_soft_renderbuffer(GLcontext *ctx, GLuint name)
+_mesa_new_soft_renderbuffer(struct gl_context *ctx, GLuint name)
{
struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, name);
if (rb) {
* rendering!
*/
GLboolean
-_mesa_add_color_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint rgbBits, GLuint alphaBits,
GLboolean frontLeft, GLboolean backLeft,
GLboolean frontRight, GLboolean backRight)
* rendering!
*/
GLboolean
-_mesa_add_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_add_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint alphaBits,
GLboolean frontLeft, GLboolean backLeft,
GLboolean frontRight, GLboolean backRight)
* copy the back buffer alpha channel into the front buffer alpha channel.
*/
void
-_mesa_copy_soft_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb)
+_mesa_copy_soft_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb)
{
if (fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer &&
fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer)
* rendering!
*/
GLboolean
-_mesa_add_depth_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_add_depth_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint depthBits)
{
struct gl_renderbuffer *rb;
* rendering!
*/
GLboolean
-_mesa_add_stencil_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_add_stencil_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint stencilBits)
{
struct gl_renderbuffer *rb;
* rendering!
*/
GLboolean
-_mesa_add_accum_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_add_accum_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint redBits, GLuint greenBits,
GLuint blueBits, GLuint alphaBits)
{
* NOTE: color-index aux buffers not supported.
*/
GLboolean
-_mesa_add_aux_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_add_aux_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint colorBits, GLuint numBuffers)
{
GLuint i;
* \return new depth/stencil renderbuffer
*/
struct gl_renderbuffer *
-_mesa_new_depthstencil_renderbuffer(GLcontext *ctx, GLuint name)
+_mesa_new_depthstencil_renderbuffer(struct gl_context *ctx, GLuint name)
{
struct gl_renderbuffer *dsrb;
_mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name);
extern struct gl_renderbuffer *
-_mesa_new_renderbuffer(GLcontext *ctx, GLuint name);
+_mesa_new_renderbuffer(struct gl_context *ctx, GLuint name);
extern void
_mesa_delete_renderbuffer(struct gl_renderbuffer *rb);
extern struct gl_renderbuffer *
-_mesa_new_soft_renderbuffer(GLcontext *ctx, GLuint name);
+_mesa_new_soft_renderbuffer(struct gl_context *ctx, GLuint name);
extern GLboolean
-_mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
+_mesa_soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width, GLuint height);
extern GLboolean
-_mesa_add_color_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint rgbBits, GLuint alphaBits,
GLboolean frontLeft, GLboolean backLeft,
GLboolean frontRight, GLboolean backRight);
extern GLboolean
-_mesa_add_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_add_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint alphaBits,
GLboolean frontLeft, GLboolean backLeft,
GLboolean frontRight, GLboolean backRight);
extern void
-_mesa_copy_soft_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb);
+_mesa_copy_soft_alpha_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb);
extern GLboolean
-_mesa_add_depth_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_add_depth_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint depthBits);
extern GLboolean
-_mesa_add_stencil_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_add_stencil_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint stencilBits);
extern GLboolean
-_mesa_add_accum_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_add_accum_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint redBits, GLuint greenBits,
GLuint blueBits, GLuint alphaBits);
extern GLboolean
-_mesa_add_aux_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb,
+_mesa_add_aux_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
GLuint bits, GLuint numBuffers);
extern void
struct gl_renderbuffer *rb);
extern struct gl_renderbuffer *
-_mesa_new_depthstencil_renderbuffer(GLcontext *ctx, GLuint name);
+_mesa_new_depthstencil_renderbuffer(struct gl_context *ctx, GLuint name);
#endif /* RENDERBUFFER_H */
*
* \sa glScissor().
*
- * Verifies the parameters and updates __GLcontextRec::Scissor. On a
+ * Verifies the parameters and updates __struct gl_contextRec::Scissor. On a
* change flushes the vertices and notifies the driver via
* the dd_function_table::Scissor callback.
*/
void
-_mesa_set_scissor(GLcontext *ctx,
+_mesa_set_scissor(struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height)
{
if (x == ctx->Scissor.X &&
* \param ctx the GL context.
*/
void
-_mesa_init_scissor(GLcontext *ctx)
+_mesa_init_scissor(struct gl_context *ctx)
{
/* Scissor group */
ctx->Scissor.Enabled = GL_FALSE;
extern void
-_mesa_set_scissor(GLcontext *ctx,
+_mesa_set_scissor(struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height);
extern void
-_mesa_init_scissor(GLcontext *ctx);
+_mesa_init_scissor(struct gl_context *ctx);
#endif
#include "program/prog_parameter.h"
#include "program/prog_uniform.h"
#include "talloc.h"
-
+#include <stdbool.h>
/** Define this to enable shader substitution (see below) */
#define SHADER_SUBST 0
* Initialize context's shader state.
*/
void
-_mesa_init_shader_state(GLcontext *ctx)
+_mesa_init_shader_state(struct gl_context *ctx)
{
/* Device drivers may override these to control what kind of instructions
* are generated by the GLSL compiler.
* Free the per-context shader-related state.
*/
void
-_mesa_free_shader_state(GLcontext *ctx)
+_mesa_free_shader_state(struct gl_context *ctx)
{
_mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram, NULL);
}
+/**
+ * Confirm that the a shader type is valid and supported by the implementation
+ *
+ * \param ctx Current GL context
+ * \param type Shader target
+ *
+ */
+static bool
+validate_shader_target(const struct gl_context *ctx, GLenum type)
+{
+ switch (type) {
+#if FEATURE_ARB_fragment_shader
+ case GL_FRAGMENT_SHADER:
+ return ctx->Extensions.ARB_fragment_shader;
+#endif
+#if FEATURE_ARB_vertex_shader
+ case GL_VERTEX_SHADER:
+ return ctx->Extensions.ARB_vertex_shader;
+#endif
+#if FEATURE_ARB_geometry_shader4
+ case GL_GEOMETRY_SHADER_ARB:
+ return ctx->Extensions.ARB_geometry_shader4;
+#endif
+ default:
+ return false;
+ }
+}
+
+
/**
* Find the length of the longest transform feedback varying name
* which was specified with glTransformFeedbackVaryings().
static GLboolean
-is_program(GLcontext *ctx, GLuint name)
+is_program(struct gl_context *ctx, GLuint name)
{
struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, name);
return shProg ? GL_TRUE : GL_FALSE;
static GLboolean
-is_shader(GLcontext *ctx, GLuint name)
+is_shader(struct gl_context *ctx, GLuint name)
{
struct gl_shader *shader = _mesa_lookup_shader(ctx, name);
return shader ? GL_TRUE : GL_FALSE;
* Attach shader to a shader program.
*/
static void
-attach_shader(GLcontext *ctx, GLuint program, GLuint shader)
+attach_shader(struct gl_context *ctx, GLuint program, GLuint shader)
{
struct gl_shader_program *shProg;
struct gl_shader *sh;
static GLint
-get_attrib_location(GLcontext *ctx, GLuint program, const GLchar *name)
+get_attrib_location(struct gl_context *ctx, GLuint program, const GLchar *name)
{
struct gl_shader_program *shProg
= _mesa_lookup_shader_program_err(ctx, program, "glGetAttribLocation");
static void
-bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
+bind_attrib_location(struct gl_context *ctx, GLuint program, GLuint index,
const GLchar *name)
{
struct gl_shader_program *shProg;
static GLuint
-create_shader(GLcontext *ctx, GLenum type)
+create_shader(struct gl_context *ctx, GLenum type)
{
struct gl_shader *sh;
GLuint name;
- name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
-
- switch (type) {
- case GL_FRAGMENT_SHADER:
- case GL_VERTEX_SHADER:
- case GL_GEOMETRY_SHADER_ARB:
- sh = ctx->Driver.NewShader(ctx, name, type);
- break;
- default:
+ if (!validate_shader_target(ctx, type)) {
_mesa_error(ctx, GL_INVALID_ENUM, "CreateShader(type)");
return 0;
}
+ name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
+ sh = ctx->Driver.NewShader(ctx, name, type);
_mesa_HashInsert(ctx->Shared->ShaderObjects, name, sh);
return name;
static GLuint
-create_shader_program(GLcontext *ctx)
+create_shader_program(struct gl_context *ctx)
{
GLuint name;
struct gl_shader_program *shProg;
* DeleteProgramARB.
*/
static void
-delete_shader_program(GLcontext *ctx, GLuint name)
+delete_shader_program(struct gl_context *ctx, GLuint name)
{
/*
* NOTE: deleting shaders/programs works a bit differently than
static void
-delete_shader(GLcontext *ctx, GLuint shader)
+delete_shader(struct gl_context *ctx, GLuint shader)
{
struct gl_shader *sh;
static void
-detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
+detach_shader(struct gl_context *ctx, GLuint program, GLuint shader)
{
struct gl_shader_program *shProg;
GLuint n;
static void
-get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
+get_active_attrib(struct gl_context *ctx, GLuint program, GLuint index,
GLsizei maxLength, GLsizei *length, GLint *size,
GLenum *type, GLchar *nameOut)
{
* Return list of shaders attached to shader program.
*/
static void
-get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount,
+get_attached_shaders(struct gl_context *ctx, GLuint program, GLsizei maxCount,
GLsizei *count, GLuint *obj)
{
struct gl_shader_program *shProg =
* glGetHandleARB() - return ID/name of currently bound shader program.
*/
static GLuint
-get_handle(GLcontext *ctx, GLenum pname)
+get_handle(struct gl_context *ctx, GLenum pname)
{
if (pname == GL_PROGRAM_OBJECT_ARB) {
if (ctx->Shader.CurrentProgram)
* programs (see glGetProgramivARB).
*/
static void
-get_programiv(GLcontext *ctx, GLuint program, GLenum pname, GLint *params)
+get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *params)
{
const struct gl_program_parameter_list *attribs;
struct gl_shader_program *shProg
* glGetShaderiv() - get GLSL shader state
*/
static void
-get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params)
+get_shaderiv(struct gl_context *ctx, GLuint name, GLenum pname, GLint *params)
{
struct gl_shader *shader =
_mesa_lookup_shader_err(ctx, name, "glGetShaderiv");
static void
-get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize,
+get_program_info_log(struct gl_context *ctx, GLuint program, GLsizei bufSize,
GLsizei *length, GLchar *infoLog)
{
struct gl_shader_program *shProg
static void
-get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize,
+get_shader_info_log(struct gl_context *ctx, GLuint shader, GLsizei bufSize,
GLsizei *length, GLchar *infoLog)
{
struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
* Return shader source code.
*/
static void
-get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength,
+get_shader_source(struct gl_context *ctx, GLuint shader, GLsizei maxLength,
GLsizei *length, GLchar *sourceOut)
{
struct gl_shader *sh;
* Set/replace shader source code.
*/
static void
-shader_source(GLcontext *ctx, GLuint shader, const GLchar *source)
+shader_source(struct gl_context *ctx, GLuint shader, const GLchar *source)
{
struct gl_shader *sh;
* Compile a shader.
*/
static void
-compile_shader(GLcontext *ctx, GLuint shaderObj)
+compile_shader(struct gl_context *ctx, GLuint shaderObj)
{
struct gl_shader *sh;
struct gl_shader_compiler_options *options;
* Link a program's shaders.
*/
static void
-link_program(GLcontext *ctx, GLuint program)
+link_program(struct gl_context *ctx, GLuint program)
{
struct gl_shader_program *shProg;
struct gl_transform_feedback_object *obj =
* Use the named shader program for subsequent rendering.
*/
void
-_mesa_use_program(GLcontext *ctx, GLuint program)
+_mesa_use_program(struct gl_context *ctx, GLuint program)
{
struct gl_shader_program *shProg;
struct gl_transform_feedback_object *obj =
* \return GL_TRUE if valid, GL_FALSE if invalid
*/
static GLboolean
-validate_samplers(GLcontext *ctx, const struct gl_program *prog, char *errMsg)
+validate_samplers(const struct gl_program *prog, char *errMsg)
{
static const char *targetName[] = {
"TEXTURE_2D_ARRAY",
assert(sampler < MAX_TEXTURE_IMAGE_UNITS);
unit = prog->SamplerUnits[sampler];
target = prog->SamplerTargets[sampler];
- if (targetUsed[unit] != -1 && targetUsed[unit] != target) {
+ if (targetUsed[unit] != -1 && targetUsed[unit] != (int) target) {
_mesa_snprintf(errMsg, 100,
"Texture unit %d is accessed both as %s and %s",
unit, targetName[targetUsed[unit]], targetName[target]);
* \return GL_TRUE if valid, GL_FALSE if invalid (and set errMsg)
*/
static GLboolean
-validate_shader_program(GLcontext *ctx,
- const struct gl_shader_program *shProg,
+validate_shader_program(const struct gl_shader_program *shProg,
char *errMsg)
{
const struct gl_vertex_program *vp = shProg->VertexProgram;
* Check: any two active samplers in the current program object are of
* different types, but refer to the same texture image unit,
*/
- if (vp && !validate_samplers(ctx, &vp->Base, errMsg)) {
+ if (vp && !validate_samplers(&vp->Base, errMsg)) {
return GL_FALSE;
}
- if (fp && !validate_samplers(ctx, &fp->Base, errMsg)) {
+ if (fp && !validate_samplers(&fp->Base, errMsg)) {
return GL_FALSE;
}
* Called via glValidateProgram()
*/
static void
-validate_program(GLcontext *ctx, GLuint program)
+validate_program(struct gl_context *ctx, GLuint program)
{
struct gl_shader_program *shProg;
char errMsg[100];
return;
}
- shProg->Validated = validate_shader_program(ctx, shProg, errMsg);
+ shProg->Validated = validate_shader_program(shProg, errMsg);
if (!shProg->Validated) {
/* update info log */
if (shProg->InfoLog) {
GLint* range, GLint* precision)
{
GET_CURRENT_CONTEXT(ctx);
+ (void) shadertype;
+ (void) precisiontype;
+ (void) range;
+ (void) precision;
_mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
}
const void* binary, GLint length)
{
GET_CURRENT_CONTEXT(ctx);
+ (void) n;
+ (void) shaders;
+ (void) binaryformat;
+ (void) binary;
+ (void) length;
_mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
}
switch (pname) {
case GL_GEOMETRY_VERTICES_OUT_ARB:
if (value < 1 ||
- value > ctx->Const.GeometryProgram.MaxGeometryOutputVertices) {
+ (unsigned) value > ctx->Const.GeometryProgram.MaxGeometryOutputVertices) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glProgramParameteri(GL_GEOMETRY_VERTICES_OUT_ARB=%d",
value);
GLsizei *length, const GLchar *src);
extern void
-_mesa_use_program(GLcontext *ctx, GLuint program);
+_mesa_use_program(struct gl_context *ctx, GLuint program);
extern void
* Then set ptr to point to sh, incrementing its refcount.
*/
void
-_mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr,
+_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
struct gl_shader *sh)
{
assert(ptr);
}
void
-_mesa_init_shader(GLcontext *ctx, struct gl_shader *shader)
+_mesa_init_shader(struct gl_context *ctx, struct gl_shader *shader)
{
shader->RefCount = 1;
}
* Called via ctx->Driver.NewShader()
*/
struct gl_shader *
-_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type)
+_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
{
struct gl_shader *shader;
assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER ||
* Called via ctx->Driver.DeleteShader().
*/
static void
-_mesa_delete_shader(GLcontext *ctx, struct gl_shader *sh)
+_mesa_delete_shader(struct gl_context *ctx, struct gl_shader *sh)
{
if (sh->Source)
free((void *) sh->Source);
* Lookup a GLSL shader object.
*/
struct gl_shader *
-_mesa_lookup_shader(GLcontext *ctx, GLuint name)
+_mesa_lookup_shader(struct gl_context *ctx, GLuint name)
{
if (name) {
struct gl_shader *sh = (struct gl_shader *)
* As above, but record an error if shader is not found.
*/
struct gl_shader *
-_mesa_lookup_shader_err(GLcontext *ctx, GLuint name, const char *caller)
+_mesa_lookup_shader_err(struct gl_context *ctx, GLuint name, const char *caller)
{
if (!name) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s", caller);
* Then set ptr to point to shProg, incrementing its refcount.
*/
void
-_mesa_reference_shader_program(GLcontext *ctx,
+_mesa_reference_shader_program(struct gl_context *ctx,
struct gl_shader_program **ptr,
struct gl_shader_program *shProg)
{
}
void
-_mesa_init_shader_program(GLcontext *ctx, struct gl_shader_program *prog)
+_mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog)
{
prog->Type = GL_SHADER_PROGRAM_MESA;
prog->RefCount = 1;
* Called via ctx->Driver.NewShaderProgram()
*/
static struct gl_shader_program *
-_mesa_new_shader_program(GLcontext *ctx, GLuint name)
+_mesa_new_shader_program(struct gl_context *ctx, GLuint name)
{
struct gl_shader_program *shProg;
shProg = talloc_zero(NULL, struct gl_shader_program);
* Clear (free) the shader program state that gets produced by linking.
*/
void
-_mesa_clear_shader_program_data(GLcontext *ctx,
+_mesa_clear_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg)
{
_mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL);
* object itself.
*/
void
-_mesa_free_shader_program_data(GLcontext *ctx,
+_mesa_free_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg)
{
GLuint i;
shProg->TransformFeedback.NumVarying = 0;
- for (i = 0; i < shProg->_NumLinkedShaders; i++) {
- ctx->Driver.DeleteShader(ctx, shProg->_LinkedShaders[i]);
+ for (i = 0; i < MESA_SHADER_TYPES; i++) {
+ if (shProg->_LinkedShaders[i] != NULL) {
+ ctx->Driver.DeleteShader(ctx, shProg->_LinkedShaders[i]);
+ shProg->_LinkedShaders[i] = NULL;
+ }
}
- shProg->_NumLinkedShaders = 0;
}
* Called via ctx->Driver.DeleteShaderProgram().
*/
static void
-_mesa_delete_shader_program(GLcontext *ctx, struct gl_shader_program *shProg)
+_mesa_delete_shader_program(struct gl_context *ctx, struct gl_shader_program *shProg)
{
_mesa_free_shader_program_data(ctx, shProg);
* Lookup a GLSL program object.
*/
struct gl_shader_program *
-_mesa_lookup_shader_program(GLcontext *ctx, GLuint name)
+_mesa_lookup_shader_program(struct gl_context *ctx, GLuint name)
{
struct gl_shader_program *shProg;
if (name) {
* As above, but record an error if program is not found.
*/
struct gl_shader_program *
-_mesa_lookup_shader_program_err(GLcontext *ctx, GLuint name,
+_mesa_lookup_shader_program_err(struct gl_context *ctx, GLuint name,
const char *caller)
{
if (!name) {
#define SHADEROBJ_H
+#include "main/compiler.h"
#include "main/glheader.h"
#include "main/mtypes.h"
#include "program/ir_to_mesa.h"
*/
extern void
-_mesa_init_shader_state(GLcontext * ctx);
+_mesa_init_shader_state(struct gl_context * ctx);
extern void
-_mesa_free_shader_state(GLcontext *ctx);
+_mesa_free_shader_state(struct gl_context *ctx);
extern void
-_mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr,
+_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
struct gl_shader *sh);
extern struct gl_shader *
-_mesa_lookup_shader(GLcontext *ctx, GLuint name);
+_mesa_lookup_shader(struct gl_context *ctx, GLuint name);
extern struct gl_shader *
-_mesa_lookup_shader_err(GLcontext *ctx, GLuint name, const char *caller);
+_mesa_lookup_shader_err(struct gl_context *ctx, GLuint name, const char *caller);
extern void
-_mesa_reference_shader_program(GLcontext *ctx,
+_mesa_reference_shader_program(struct gl_context *ctx,
struct gl_shader_program **ptr,
struct gl_shader_program *shProg);
extern void
-_mesa_init_shader(GLcontext *ctx, struct gl_shader *shader);
+_mesa_init_shader(struct gl_context *ctx, struct gl_shader *shader);
extern struct gl_shader *
-_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
+_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
extern void
-_mesa_init_shader_program(GLcontext *ctx, struct gl_shader_program *prog);
+_mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog);
extern struct gl_shader_program *
-_mesa_lookup_shader_program(GLcontext *ctx, GLuint name);
+_mesa_lookup_shader_program(struct gl_context *ctx, GLuint name);
extern struct gl_shader_program *
-_mesa_lookup_shader_program_err(GLcontext *ctx, GLuint name,
+_mesa_lookup_shader_program_err(struct gl_context *ctx, GLuint name,
const char *caller);
extern void
-_mesa_clear_shader_program_data(GLcontext *ctx,
+_mesa_clear_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg);
extern void
-_mesa_free_shader_program_data(GLcontext *ctx,
+_mesa_free_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg);
_mesa_init_shader_object_functions(struct dd_function_table *driver);
extern void
-_mesa_init_shader_state(GLcontext *ctx);
+_mesa_init_shader_state(struct gl_context *ctx);
extern void
-_mesa_free_shader_state(GLcontext *ctx);
+_mesa_free_shader_state(struct gl_context *ctx);
static INLINE GLuint
_mesa_shader_type_to_index(GLenum v)
* failure.
*/
struct gl_shared_state *
-_mesa_alloc_shared_state(GLcontext *ctx)
+_mesa_alloc_shared_state(struct gl_context *ctx)
{
struct gl_shared_state *shared;
GLuint i;
delete_displaylist_cb(GLuint id, void *data, void *userData)
{
struct gl_display_list *list = (struct gl_display_list *) data;
- GLcontext *ctx = (GLcontext *) userData;
+ struct gl_context *ctx = (struct gl_context *) userData;
_mesa_delete_list(ctx, list);
}
delete_texture_cb(GLuint id, void *data, void *userData)
{
struct gl_texture_object *texObj = (struct gl_texture_object *) data;
- GLcontext *ctx = (GLcontext *) userData;
+ struct gl_context *ctx = (struct gl_context *) userData;
ctx->Driver.DeleteTexture(ctx, texObj);
}
delete_program_cb(GLuint id, void *data, void *userData)
{
struct gl_program *prog = (struct gl_program *) data;
- GLcontext *ctx = (GLcontext *) userData;
+ struct gl_context *ctx = (struct gl_context *) userData;
if(prog != &_mesa_DummyProgram) {
ASSERT(prog->RefCount == 1); /* should only be referenced by hash table */
prog->RefCount = 0; /* now going away */
delete_fragshader_cb(GLuint id, void *data, void *userData)
{
struct ati_fragment_shader *shader = (struct ati_fragment_shader *) data;
- GLcontext *ctx = (GLcontext *) userData;
+ struct gl_context *ctx = (struct gl_context *) userData;
_mesa_delete_ati_fragment_shader(ctx, shader);
}
#endif
delete_bufferobj_cb(GLuint id, void *data, void *userData)
{
struct gl_buffer_object *bufObj = (struct gl_buffer_object *) data;
- GLcontext *ctx = (GLcontext *) userData;
+ struct gl_context *ctx = (struct gl_context *) userData;
if (_mesa_bufferobj_mapped(bufObj)) {
ctx->Driver.UnmapBuffer(ctx, 0, bufObj);
bufObj->Pointer = NULL;
static void
free_shader_program_data_cb(GLuint id, void *data, void *userData)
{
- GLcontext *ctx = (GLcontext *) userData;
+ struct gl_context *ctx = (struct gl_context *) userData;
struct gl_shader_program *shProg = (struct gl_shader_program *) data;
if (shProg->Type == GL_SHADER_PROGRAM_MESA) {
static void
delete_shader_cb(GLuint id, void *data, void *userData)
{
- GLcontext *ctx = (GLcontext *) userData;
+ struct gl_context *ctx = (struct gl_context *) userData;
struct gl_shader *sh = (struct gl_shader *) data;
if (sh->Type == GL_FRAGMENT_SHADER || sh->Type == GL_VERTEX_SHADER) {
ctx->Driver.DeleteShader(ctx, sh);
* \sa alloc_shared_state().
*/
static void
-free_shared_state(GLcontext *ctx, struct gl_shared_state *shared)
+free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
{
GLuint i;
* \sa free_shared_state().
*/
void
-_mesa_release_shared_state(GLcontext *ctx, struct gl_shared_state *shared)
+_mesa_release_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
{
GLint RefCount;
#include "mtypes.h"
struct gl_shared_state *
-_mesa_alloc_shared_state(GLcontext *ctx);
+_mesa_alloc_shared_state(struct gl_context *ctx);
void
-_mesa_release_shared_state(GLcontext *ctx, struct gl_shared_state *shared);
+_mesa_release_shared_state(struct gl_context *ctx, struct gl_shared_state *shared);
#endif
* \file state.c
* State management.
*
- * This file manages recalculation of derived values in GLcontext.
+ * This file manages recalculation of derived values in struct gl_context.
*/
static void
-update_separate_specular(GLcontext *ctx)
+update_separate_specular(struct gl_context *ctx)
{
if (NEED_SECONDARY_COLOR(ctx))
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
* Need to do this upon new array state or new buffer object state.
*/
static void
-update_arrays( GLcontext *ctx )
+update_arrays( struct gl_context *ctx )
{
struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
GLuint i, min = ~0;
* This needs to be done before texture state validation.
*/
static void
-update_program_enables(GLcontext *ctx)
+update_program_enables(struct gl_context *ctx)
{
/* These _Enabled flags indicate if the program is enabled AND valid. */
ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
* or fragment program is being used.
*/
static GLbitfield
-update_program(GLcontext *ctx)
+update_program(struct gl_context *ctx)
{
const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current;
* Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0.
*/
static GLbitfield
-update_program_constants(GLcontext *ctx)
+update_program_constants(struct gl_context *ctx)
{
GLbitfield new_state = 0x0;
static void
-update_viewport_matrix(GLcontext *ctx)
+update_viewport_matrix(struct gl_context *ctx)
{
const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF;
* Update derived multisample state.
*/
static void
-update_multisample(GLcontext *ctx)
+update_multisample(struct gl_context *ctx)
{
ctx->Multisample._Enabled = GL_FALSE;
if (ctx->Multisample.Enabled &&
* Update derived color/blend/logicop state.
*/
static void
-update_color(GLcontext *ctx)
+update_color(struct gl_context *ctx)
{
/* This is needed to support 1.1's RGB logic ops AND
* 1.0's blending logicops.
* in ctx->_TriangleCaps if needed.
*/
static void
-update_polygon(GLcontext *ctx)
+update_polygon(struct gl_context *ctx)
{
ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET);
*/
#if 0
static void
-update_tricaps(GLcontext *ctx, GLbitfield new_state)
+update_tricaps(struct gl_context *ctx, GLbitfield new_state)
{
ctx->_TriangleCaps = 0;
/**
* Compute derived GL state.
- * If __GLcontextRec::NewState is non-zero then this function \b must
+ * If __struct gl_contextRec::NewState is non-zero then this function \b must
* be called before rendering anything.
*
* Calls dd_function_table::UpdateState to perform any internal state
* _mesa_update_lighting() and _mesa_update_tnl_spaces().
*/
void
-_mesa_update_state_locked( GLcontext *ctx )
+_mesa_update_state_locked( struct gl_context *ctx )
{
GLbitfield new_state = ctx->NewState;
GLbitfield prog_flags = _NEW_PROGRAM;
/* This is the usual entrypoint for state updates:
*/
void
-_mesa_update_state( GLcontext *ctx )
+_mesa_update_state( struct gl_context *ctx )
{
_mesa_lock_context_textures(ctx);
_mesa_update_state_locked(ctx);
* Otherwise, the fp should track them as state values instead.
*/
void
-_mesa_set_varying_vp_inputs( GLcontext *ctx,
+_mesa_set_varying_vp_inputs( struct gl_context *ctx,
GLbitfield varying_inputs )
{
if (ctx->varying_vp_inputs != varying_inputs) {
* of ordinary varyings/inputs.
*/
void
-_mesa_set_vp_override(GLcontext *ctx, GLboolean flag)
+_mesa_set_vp_override(struct gl_context *ctx, GLboolean flag)
{
if (ctx->VertexProgram._Overriden != flag) {
ctx->VertexProgram._Overriden = flag;
#include "mtypes.h"
extern void
-_mesa_update_state(GLcontext *ctx);
+_mesa_update_state(struct gl_context *ctx);
/* As above but can only be called between _mesa_lock_context_textures() and
* _mesa_unlock_context_textures().
*/
extern void
-_mesa_update_state_locked(GLcontext *ctx);
+_mesa_update_state_locked(struct gl_context *ctx);
extern void
-_mesa_set_varying_vp_inputs(GLcontext *ctx, GLbitfield varying_inputs);
+_mesa_set_varying_vp_inputs(struct gl_context *ctx, GLbitfield varying_inputs);
extern void
-_mesa_set_vp_override(GLcontext *ctx, GLboolean flag);
+_mesa_set_vp_override(struct gl_context *ctx, GLboolean flag);
#endif
static GLboolean
-validate_stencil_op(GLcontext *ctx, GLenum op)
+validate_stencil_op(struct gl_context *ctx, GLenum op)
{
switch (op) {
case GL_KEEP:
static GLboolean
-validate_stencil_func(GLcontext *ctx, GLenum func)
+validate_stencil_func(struct gl_context *ctx, GLenum func)
{
switch (func) {
case GL_NEVER:
* \sa glStencilFunc().
*
* Verifies the parameters and updates the respective values in
- * __GLcontextRec::Stencil. On change flushes the vertices and notifies the
+ * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the
* driver via the dd_function_table::StencilFunc callback.
*/
void GLAPIENTRY
* \sa glStencilFunc().
*
* Verifies the parameters and updates the respective values in
- * __GLcontextRec::Stencil. On change flushes the vertices and notifies the
+ * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the
* driver via the dd_function_table::StencilFunc callback.
*/
void GLAPIENTRY
* \sa glStencilOp().
*
* Verifies the parameters and updates the respective fields in
- * __GLcontextRec::Stencil. On change flushes the vertices and notifies the
+ * __struct gl_contextRec::Stencil. On change flushes the vertices and notifies the
* driver via the dd_function_table::StencilOp callback.
*/
void GLAPIENTRY
* Update derived stencil state.
*/
void
-_mesa_update_stencil(GLcontext *ctx)
+_mesa_update_stencil(struct gl_context *ctx)
{
const GLint face = ctx->Stencil._BackFace;
*
* \param ctx GL context.
*
- * Initializes __GLcontextRec::Stencil attribute group.
+ * Initializes __struct gl_contextRec::Stencil attribute group.
*/
void
-_mesa_init_stencil(GLcontext *ctx)
+_mesa_init_stencil(struct gl_context *ctx)
{
ctx->Stencil.Enabled = GL_FALSE;
ctx->Stencil.TestTwoSide = GL_FALSE;
extern void
-_mesa_update_stencil(GLcontext *ctx);
+_mesa_update_stencil(struct gl_context *ctx);
extern void
-_mesa_init_stencil( GLcontext * ctx );
+_mesa_init_stencil( struct gl_context * ctx );
#endif
#include "syncobj.h"
static struct gl_sync_object *
-_mesa_new_sync_object(GLcontext *ctx, GLenum type)
+_mesa_new_sync_object(struct gl_context *ctx, GLenum type)
{
struct gl_sync_object *s = MALLOC_STRUCT(gl_sync_object);
(void) ctx;
static void
-_mesa_delete_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj)
+_mesa_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
{
(void) ctx;
free(syncObj);
static void
-_mesa_fence_sync(GLcontext *ctx, struct gl_sync_object *syncObj,
+_mesa_fence_sync(struct gl_context *ctx, struct gl_sync_object *syncObj,
GLenum condition, GLbitfield flags)
{
(void) ctx;
static void
-_mesa_check_sync(GLcontext *ctx, struct gl_sync_object *syncObj)
+_mesa_check_sync(struct gl_context *ctx, struct gl_sync_object *syncObj)
{
(void) ctx;
(void) syncObj;
static void
-_mesa_wait_sync(GLcontext *ctx, struct gl_sync_object *syncObj,
+_mesa_wait_sync(struct gl_context *ctx, struct gl_sync_object *syncObj,
GLbitfield flags, GLuint64 timeout)
{
(void) ctx;
* Allocate/init the context state related to sync objects.
*/
void
-_mesa_init_sync(GLcontext *ctx)
+_mesa_init_sync(struct gl_context *ctx)
{
(void) ctx;
}
* Free the context state related to sync objects.
*/
void
-_mesa_free_sync_data(GLcontext *ctx)
+_mesa_free_sync_data(struct gl_context *ctx)
{
(void) ctx;
}
void
-_mesa_ref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj)
+_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
{
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
syncObj->RefCount++;
void
-_mesa_unref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj)
+_mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
{
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
syncObj->RefCount--;
_mesa_init_sync_dispatch(struct _glapi_table *disp);
extern void
-_mesa_init_sync(GLcontext *);
+_mesa_init_sync(struct gl_context *);
extern void
-_mesa_free_sync_data(GLcontext *);
+_mesa_free_sync_data(struct gl_context *);
extern void
-_mesa_ref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj);
+_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj);
extern void
-_mesa_unref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj);
+_mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj);
extern GLboolean GLAPIENTRY
_mesa_IsSync(GLsync sync);
}
static INLINE void
-_mesa_init_sync(GLcontext *ctx)
+_mesa_init_sync(struct gl_context *ctx)
{
}
static INLINE void
-_mesa_free_sync_data(GLcontext *ctx)
+_mesa_free_sync_data(struct gl_context *ctx)
{
}
static INLINE void
-_mesa_ref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj)
+_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
{
ASSERT_NO_FEATURE();
}
static INLINE void
-_mesa_unref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj)
+_mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
{
ASSERT_NO_FEATURE();
}
* \return number of formats.
*/
GLuint
-_mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all)
+_mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats, GLboolean all)
{
GLuint n = 0;
if (ctx->Extensions.TDFX_texture_compression_FXT1) {
* internal format unchanged.
*/
GLenum
-_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat)
+_mesa_compressed_format_to_glenum(struct gl_context *ctx, GLuint mesaFormat)
{
switch (mesaFormat) {
#if FEATURE_texture_fxt1
#if _HAVE_FULL_GL
extern GLuint
-_mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all);
+_mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats, GLboolean all);
extern gl_format
_mesa_glenum_to_compressed_format(GLenum format);
extern GLenum
-_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat);
+_mesa_compressed_format_to_glenum(struct gl_context *ctx, GLuint mesaFormat);
extern GLubyte *
_mesa_compressed_image_address(GLint col, GLint row, GLint img,
/**
* \file texcompress_fxt1.c
- * GL_EXT_texture_compression_fxt1 support.
+ * GL_3DFX_texture_compression_FXT1 support.
*/
void
-_mesa_init_texture_s3tc( GLcontext *ctx )
+_mesa_init_texture_s3tc( struct gl_context *ctx )
{
/* called during context initialization */
ctx->Mesa_DXTn = GL_FALSE;
GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_init_texture_s3tc(GLcontext *ctx);
+_mesa_init_texture_s3tc(struct gl_context *ctx);
#else /* FEATURE_texture_s3tc */
#define _mesa_fetch_texel_2d_f_srgba_dxt5 NULL
static INLINE void
-_mesa_init_texture_s3tc(GLcontext *ctx)
+_mesa_init_texture_s3tc(struct gl_context *ctx)
{
}
/** Set texture env mode */
static void
-set_env_mode(GLcontext *ctx,
+set_env_mode(struct gl_context *ctx,
struct gl_texture_unit *texUnit,
GLenum mode)
{
static void
-set_env_color(GLcontext *ctx,
+set_env_color(struct gl_context *ctx,
struct gl_texture_unit *texUnit,
const GLfloat *color)
{
/** Set an RGB or A combiner mode/function */
static void
-set_combiner_mode(GLcontext *ctx,
+set_combiner_mode(struct gl_context *ctx,
struct gl_texture_unit *texUnit,
GLenum pname, GLenum mode)
{
/** Set an RGB or A combiner source term */
static void
-set_combiner_source(GLcontext *ctx,
+set_combiner_source(struct gl_context *ctx,
struct gl_texture_unit *texUnit,
GLenum pname, GLenum param)
{
/** Set an RGB or A combiner operand term */
static void
-set_combiner_operand(GLcontext *ctx,
+set_combiner_operand(struct gl_context *ctx,
struct gl_texture_unit *texUnit,
GLenum pname, GLenum param)
{
static void
-set_combiner_scale(GLcontext *ctx,
+set_combiner_scale(struct gl_context *ctx,
struct gl_texture_unit *texUnit,
GLenum pname, GLfloat scale)
{
* \return value of queried pname or -1 if error.
*/
static GLint
-get_texenvi(GLcontext *ctx, const struct gl_texture_unit *texUnit,
+get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
GLenum pname)
{
switch (pname) {
};
static GLboolean
-texenv_doing_secondary_color(GLcontext *ctx)
+texenv_doing_secondary_color(struct gl_context *ctx)
{
if (ctx->Light.Enabled &&
(ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR))
* has access to. The bitmask is later reduced to just those which
* are actually referenced.
*/
-static GLbitfield get_fp_input_mask( GLcontext *ctx )
+static GLbitfield get_fp_input_mask( struct gl_context *ctx )
{
/* _NEW_PROGRAM */
const GLboolean vertexShader = (ctx->Shader.CurrentProgram &&
* Examine current texture environment state and generate a unique
* key to identify it.
*/
-static GLuint make_state_key( GLcontext *ctx, struct state_key *key )
+static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
{
GLuint i, j;
GLbitfield inputs_referenced = FRAG_BIT_COL0;
}
-static void release_temps(GLcontext *ctx, struct texenv_fragment_program *p )
+static void release_temps(struct gl_context *ctx, struct texenv_fragment_program *p )
{
GLuint max_temp = ctx->Const.FragmentProgram.MaxTemps;
* current texture env/combine mode.
*/
static void
-create_new_program(GLcontext *ctx, struct state_key *key,
+create_new_program(struct gl_context *ctx, struct state_key *key,
struct gl_fragment_program *program)
{
struct prog_instruction instBuffer[MAX_INSTRUCTIONS];
emit_arith( &p, OPCODE_END, undef, WRITEMASK_XYZW, 0, undef, undef, undef);
if (key->fog_enabled) {
- /* Pull fog mode from GLcontext, the value in the state key is
+ /* Pull fog mode from struct gl_context, the value in the state key is
* a reduced value and not what is expected in FogOption
*/
p.program->FogOption = ctx->Fog.Mode;
* fixed-function texture, fog and color-sum operations.
*/
struct gl_fragment_program *
-_mesa_get_fixed_func_fragment_program(GLcontext *ctx)
+_mesa_get_fixed_func_fragment_program(struct gl_context *ctx)
{
struct gl_fragment_program *prog;
struct state_key key;
#include "mtypes.h"
extern struct gl_fragment_program *
-_mesa_get_fixed_func_fragment_program(GLcontext *ctx);
+_mesa_get_fixed_func_fragment_program(struct gl_context *ctx);
#endif
fetch_texel_3d_f_ycbcr_rev,
store_texel_ycbcr_rev
},
+ {
+ MESA_FORMAT_R8,
+ fetch_texel_1d_f_r8,
+ fetch_texel_2d_f_r8,
+ fetch_texel_3d_f_r8,
+ store_texel_r8,
+ },
+ {
+ MESA_FORMAT_RG88,
+ fetch_texel_1d_f_rg88,
+ fetch_texel_2d_f_rg88,
+ fetch_texel_3d_f_rg88,
+ store_texel_rg88,
+ },
+ {
+ MESA_FORMAT_RG88_REV,
+ fetch_texel_1d_f_rg88_rev,
+ fetch_texel_2d_f_rg88_rev,
+ fetch_texel_3d_f_rg88_rev,
+ store_texel_rg88_rev,
+ },
+ {
+ MESA_FORMAT_R16,
+ fetch_texel_1d_f_r16,
+ fetch_texel_2d_f_r16,
+ fetch_texel_3d_f_r16,
+ store_texel_r16,
+ },
+ {
+ MESA_FORMAT_RG1616,
+ fetch_texel_1d_f_rg1616,
+ fetch_texel_2d_f_rg1616,
+ fetch_texel_3d_f_rg1616,
+ store_texel_rg1616,
+ },
+ {
+ MESA_FORMAT_RG1616_REV,
+ fetch_texel_1d_f_rg1616_rev,
+ fetch_texel_2d_f_rg1616_rev,
+ fetch_texel_3d_f_rg1616_rev,
+ store_texel_rg1616_rev,
+ },
{
MESA_FORMAT_Z24_S8,
fetch_texel_1d_f_z24_s8,
#endif
+/* MESA_FORMAT_RG88 **********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */
+static void FETCH(f_rg88)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ texel[RCOMP] = UBYTE_TO_FLOAT( s & 0xff );
+ texel[GCOMP] = UBYTE_TO_FLOAT( s >> 8 );
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = 1.0;
+}
+
+#if DIM == 3
+static void store_texel_rg88(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLubyte *rgba = (const GLubyte *) texel;
+ GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ *dst = PACK_COLOR_88(rgba[RCOMP], rgba[GCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_RG88_REV ******************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rg88_rev texture, return 4 GLchans */
+static void FETCH(f_rg88_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ texel[RCOMP] = UBYTE_TO_FLOAT( s & 0xff );
+ texel[GCOMP] = UBYTE_TO_FLOAT( s >> 8 );
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = 1.0;
+}
+
+#if DIM == 3
+static void store_texel_rg88_rev(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLubyte *rgba = (const GLubyte *) texel;
+ GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ *dst = PACK_COLOR_88(rgba[GCOMP], rgba[RCOMP]);
+}
+#endif
+
+
/* MESA_FORMAT_AL88 **********************************************************/
/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */
#endif
+/* MESA_FORMAT_R8 ************************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */
+static void FETCH(f_r8)(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+ texel[RCOMP] = UBYTE_TO_FLOAT(s);
+ texel[GCOMP] = 0.0;
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = 1.0;
+}
+
+#if DIM == 3
+static void store_texel_r8(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLubyte *rgba = (const GLubyte *) texel;
+ GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
+ *dst = rgba[RCOMP];
+}
+#endif
+
+
+/* MESA_FORMAT_R16 ***********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D r16 texture, return 4 GLchans */
+static void FETCH(f_r16)(const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ texel[RCOMP] = USHORT_TO_FLOAT(s);
+ texel[GCOMP] = 0.0;
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = 1.0;
+}
+
+#if DIM == 3
+static void store_texel_r16(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLushort *rgba = (const GLushort *) texel;
+ GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ *dst = rgba[RCOMP];
+}
+#endif
+
+
/* MESA_FORMAT_AL88_REV ******************************************************/
/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */
#endif
+/* MESA_FORMAT_RG1616 ********************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rg1616 texture, return 4 GLchans */
+static void FETCH(f_rg1616)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ texel[RCOMP] = USHORT_TO_FLOAT( s & 0xffff );
+ texel[GCOMP] = USHORT_TO_FLOAT( s >> 16 );
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = 1.0;
+}
+
+#if DIM == 3
+static void store_texel_rg1616(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLubyte *rgba = (const GLubyte *) texel;
+ GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ *dst = PACK_COLOR_1616(rgba[RCOMP], rgba[GCOMP]);
+}
+#endif
+
+
+/* MESA_FORMAT_RG1616_REV ****************************************************/
+
+/* Fetch texel from 1D, 2D or 3D rg1616_rev texture, return 4 GLchans */
+static void FETCH(f_rg1616_rev)( const struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel )
+{
+ const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ texel[RCOMP] = USHORT_TO_FLOAT( s >> 16 );
+ texel[GCOMP] = USHORT_TO_FLOAT( s & 0xffff );
+ texel[BCOMP] = 0.0;
+ texel[ACOMP] = 1.0;
+}
+
+#if DIM == 3
+static void store_texel_rg1616_rev(struct gl_texture_image *texImage,
+ GLint i, GLint j, GLint k, const void *texel)
+{
+ const GLubyte *rgba = (const GLubyte *) texel;
+ GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
+ *dst = PACK_COLOR_1616(rgba[GCOMP], rgba[RCOMP]);
+}
+#endif
+
+
/* MESA_FORMAT_AL1616 ********************************************************/
/* Fetch texel from 1D, 2D or 3D al1616 texture, return 4 GLchans */
* will typically override this function with a specialized version.
*/
gl_format
-_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
+_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
(void) format;
}
}
+ if (ctx->Extensions.ARB_texture_rg) {
+ switch (internalFormat) {
+ case GL_R8:
+ case GL_RED:
+ case GL_COMPRESSED_RED:
+ return MESA_FORMAT_R8;
+
+ case GL_R16:
+ return MESA_FORMAT_R16;
+
+ case GL_RG:
+ case GL_RG8:
+ case GL_COMPRESSED_RG:
+ return MESA_FORMAT_RG88;
+
+ case GL_RG16:
+ return MESA_FORMAT_RG1616;
+
+ default:
+ ; /* fallthrough */
+ }
+ }
+
_mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
return MESA_FORMAT_NONE;
}
extern gl_format
-_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
+_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type );
* glGetTexImage for color index pixels.
*/
static void
-get_tex_color_index(GLcontext *ctx, GLuint dimensions,
+get_tex_color_index(struct gl_context *ctx, GLuint dimensions,
GLenum format, GLenum type, GLvoid *pixels,
const struct gl_texture_image *texImage)
{
* glGetTexImage for depth/Z pixels.
*/
static void
-get_tex_depth(GLcontext *ctx, GLuint dimensions,
+get_tex_depth(struct gl_context *ctx, GLuint dimensions,
GLenum format, GLenum type, GLvoid *pixels,
const struct gl_texture_image *texImage)
{
* glGetTexImage for depth/stencil pixels.
*/
static void
-get_tex_depth_stencil(GLcontext *ctx, GLuint dimensions,
+get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions,
GLenum format, GLenum type, GLvoid *pixels,
const struct gl_texture_image *texImage)
{
* glGetTexImage for YCbCr pixels.
*/
static void
-get_tex_ycbcr(GLcontext *ctx, GLuint dimensions,
+get_tex_ycbcr(struct gl_context *ctx, GLuint dimensions,
GLenum format, GLenum type, GLvoid *pixels,
const struct gl_texture_image *texImage)
{
* glGetTexImagefor sRGB pixels;
*/
static void
-get_tex_srgb(GLcontext *ctx, GLuint dimensions,
+get_tex_srgb(struct gl_context *ctx, GLuint dimensions,
GLenum format, GLenum type, GLvoid *pixels,
const struct gl_texture_image *texImage)
{
static INLINE void
-get_tex_srgb(GLcontext *ctx, GLuint dimensions,
+get_tex_srgb(struct gl_context *ctx, GLuint dimensions,
GLenum format, GLenum type, GLvoid *pixels,
const struct gl_texture_image *texImage)
{
* This is the slow way since we use texture sampling.
*/
static void
-get_tex_rgba(GLcontext *ctx, GLuint dimensions,
+get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
GLenum format, GLenum type, GLvoid *pixels,
const struct gl_texture_image *texImage)
{
* \return GL_TRUE if done, GL_FALSE otherwise
*/
static GLboolean
-get_tex_memcpy(GLcontext *ctx, GLenum format, GLenum type, GLvoid *pixels,
+get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type, GLvoid *pixels,
const struct gl_texture_object *texObj,
const struct gl_texture_image *texImage)
{
* The texture image must be mapped.
*/
void
-_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
+_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid *pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
* All error checking will have been done before this routine is called.
*/
void
-_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
+_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint level,
GLvoid *img,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
* \return GL_TRUE if any error, GL_FALSE if no errors.
*/
static GLboolean
-getteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
+getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid *pixels )
{
struct gl_texture_object *texObj;
* \return GL_TRUE if any error, GL_FALSE if no errors.
*/
static GLboolean
-getcompressedteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
+getcompressedteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
GLvoid *img)
{
struct gl_texture_object *texObj;
#include "mtypes.h"
extern void
-_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
+_mesa_get_teximage(struct gl_context *ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid *pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
extern void
-_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
+_mesa_get_compressed_teximage(struct gl_context *ctx, GLenum target, GLint level,
GLvoid *img,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage);
* XXX this could be static
*/
GLint
-_mesa_base_tex_format( GLcontext *ctx, GLint internalFormat )
+_mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
{
switch (internalFormat) {
case GL_ALPHA:
if (ctx->Extensions.ARB_texture_rg) {
switch (internalFormat) {
- case GL_R8:
- case GL_R16:
case GL_R16F:
+ /* R16F depends on both ARB_half_float_pixel and ARB_texture_float.
+ */
+ if (!ctx->Extensions.ARB_half_float_pixel)
+ break;
+ /* FALLTHROUGH */
case GL_R32F:
+ if (!ctx->Extensions.ARB_texture_float)
+ break;
+ return GL_RED;
case GL_R8I:
case GL_R8UI:
case GL_R16I:
case GL_R16UI:
case GL_R32I:
case GL_R32UI:
- return GL_R;
- case GL_RG:
- case GL_RG_INTEGER:
- case GL_RG8:
- case GL_RG16:
+ if (!ctx->Extensions.EXT_texture_integer)
+ break;
+ /* FALLTHROUGH */
+ case GL_R8:
+ case GL_R16:
+ case GL_RED:
+ case GL_COMPRESSED_RED:
+ return GL_RED;
+
case GL_RG16F:
+ /* RG16F depends on both ARB_half_float_pixel and ARB_texture_float.
+ */
+ if (!ctx->Extensions.ARB_half_float_pixel)
+ break;
+ /* FALLTHROUGH */
case GL_RG32F:
+ if (!ctx->Extensions.ARB_texture_float)
+ break;
+ return GL_RG;
case GL_RG8I:
case GL_RG8UI:
case GL_RG16I:
case GL_RG16UI:
case GL_RG32I:
case GL_RG32UI:
+ if (!ctx->Extensions.EXT_texture_integer)
+ break;
+ /* FALLTHROUGH */
+ case GL_RG:
+ case GL_RG8:
+ case GL_RG16:
+ case GL_COMPRESSED_RG:
return GL_RG;
default:
; /* fallthrough */
}
}
- if (ctx->Extensions.EXT_texture_compression_rgtc) {
+ if (ctx->Extensions.ARB_texture_compression_rgtc) {
switch (internalFormat) {
- case GL_COMPRESSED_RED:
- case GL_COMPRESSED_RED_RGTC1_EXT:
- case GL_COMPRESSED_SIGNED_RED_RGTC1_EXT:
+ case GL_COMPRESSED_RED_RGTC1:
+ case GL_COMPRESSED_SIGNED_RED_RGTC1:
return GL_RED;
- case GL_COMPRESSED_RG:
- case GL_COMPRESSED_RED_GREEN_RGTC2_EXT:
- case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:
+ case GL_COMPRESSED_RG_RGTC2:
+ case GL_COMPRESSED_SIGNED_RG_RGTC2:
return GL_RG;
default:
; /* fallthrough */
* zero.
*/
struct gl_texture_image *
-_mesa_new_texture_image( GLcontext *ctx )
+_mesa_new_texture_image( struct gl_context *ctx )
{
(void) ctx;
return CALLOC_STRUCT(gl_texture_image);
* Free the texture image data if it's not marked as client data.
*/
void
-_mesa_free_texture_image_data(GLcontext *ctx,
+_mesa_free_texture_image_data(struct gl_context *ctx,
struct gl_texture_image *texImage)
{
(void) ctx;
* Free the texture image structure and the associated image data.
*/
void
-_mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *texImage )
+_mesa_delete_texture_image( struct gl_context *ctx, struct gl_texture_image *texImage )
{
/* Free texImage->Data and/or any other driver-specific texture
* image storage.
* \sa gl_texture_unit.
*/
struct gl_texture_object *
-_mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
+_mesa_select_tex_object(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
GLenum target)
{
switch (target) {
* Return pointer to texture object for given target on current texture unit.
*/
struct gl_texture_object *
-_mesa_get_current_tex_object(GLcontext *ctx, GLenum target)
+_mesa_get_current_tex_object(struct gl_context *ctx, GLenum target)
{
struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
return _mesa_select_tex_object(ctx, texUnit, target);
* \return pointer to the texture image structure, or NULL on failure.
*/
struct gl_texture_image *
-_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj,
+_mesa_select_tex_image(struct gl_context *ctx, const struct gl_texture_object *texObj,
GLenum target, GLint level)
{
const GLuint face = _mesa_tex_target_to_face(target);
* out of memory.
*/
struct gl_texture_image *
-_mesa_get_tex_image(GLcontext *ctx, struct gl_texture_object *texObj,
+_mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
GLenum target, GLint level)
{
struct gl_texture_image *texImage;
* level, or out of memory.
*/
struct gl_texture_image *
-_mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level)
+_mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level)
{
struct gl_texture_image *texImage;
GLuint texIndex;
* \sa gl_constants.
*/
GLint
-_mesa_max_texture_levels(GLcontext *ctx, GLenum target)
+_mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
{
switch (target) {
case GL_TEXTURE_1D:
* Note: width, height and depth include the border.
*/
void
-_mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
+_mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
struct gl_texture_image *img,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum internalFormat)
* fields are cleared so that its parent object will test incomplete.
*/
void
-_mesa_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage)
+_mesa_clear_texture_image(struct gl_context *ctx, struct gl_texture_image *texImage)
{
ctx->Driver.FreeTexImageData(ctx, texImage);
clear_teximage_fields(texImage);
* \return GL_TRUE if the image is acceptable, GL_FALSE if not acceptable.
*/
GLboolean
-_mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
+_mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat, GLenum format, GLenum type,
GLint width, GLint height, GLint depth, GLint border)
{
* Helper function to determine whether a target supports compressed textures
*/
static GLboolean
-target_can_be_compressed(GLcontext *ctx, GLenum target)
+target_can_be_compressed(struct gl_context *ctx, GLenum target)
{
return (((target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D))
|| ((ctx->Extensions.ARB_texture_cube_map &&
* \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
*
* Verifies each of the parameters against the constants specified in
- * __GLcontextRec::Const and the supported extensions, and according to the
+ * __struct gl_contextRec::Const and the supported extensions, and according to the
* OpenGL specification.
*/
static GLboolean
-texture_error_check( GLcontext *ctx, GLenum target,
+texture_error_check( struct gl_context *ctx, GLenum target,
GLint level, GLint internalFormat,
GLenum format, GLenum type,
GLuint dimensions,
* \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
*
* Verifies each of the parameters against the constants specified in
- * __GLcontextRec::Const and the supported extensions, and according to the
+ * __struct gl_contextRec::Const and the supported extensions, and according to the
* OpenGL specification.
*/
static GLboolean
-subtexture_error_check( GLcontext *ctx, GLuint dimensions,
+subtexture_error_check( struct gl_context *ctx, GLuint dimensions,
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
* \return GL_TRUE if error recorded, GL_FALSE otherwise
*/
static GLboolean
-subtexture_error_check2( GLcontext *ctx, GLuint dimensions,
+subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
* \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
*
* Verifies each of the parameters against the constants specified in
- * __GLcontextRec::Const and the supported extensions, and according to the
+ * __struct gl_contextRec::Const and the supported extensions, and according to the
* OpenGL specification.
*/
static GLboolean
-copytexture_error_check( GLcontext *ctx, GLuint dimensions,
+copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
GLenum target, GLint level, GLint internalFormat,
GLint width, GLint height, GLint border )
{
* \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
*/
static GLboolean
-copytexsubimage_error_check1( GLcontext *ctx, GLuint dimensions,
+copytexsubimage_error_check1( struct gl_context *ctx, GLuint dimensions,
GLenum target, GLint level)
{
/* Check that the source buffer is complete */
* \param height image height given by the user.
*/
static GLboolean
-copytexsubimage_error_check2( GLcontext *ctx, GLuint dimensions,
+copytexsubimage_error_check2( struct gl_context *ctx, GLuint dimensions,
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height,
/** Callback info for walking over FBO hash table */
struct cb_info
{
- GLcontext *ctx;
+ struct gl_context *ctx;
struct gl_texture_object *texObj;
GLuint level, face;
};
{
struct gl_framebuffer *fb = (struct gl_framebuffer *) data;
const struct cb_info *info = (struct cb_info *) userData;
- GLcontext *ctx = info->ctx;
+ struct gl_context *ctx = info->ctx;
const struct gl_texture_object *texObj = info->texObj;
const GLuint level = info->level, face = info->face;
* Any FBOs rendering into the texture must be re-validated.
*/
static void
-update_fbo_texture(GLcontext *ctx, struct gl_texture_object *texObj,
+update_fbo_texture(struct gl_context *ctx, struct gl_texture_object *texObj,
GLuint face, GLuint level)
{
/* Only check this texture if it's been marked as RenderToTexture */
* mipmap levels now.
*/
static INLINE void
-check_gen_mipmap(GLcontext *ctx, GLenum target,
+check_gen_mipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj, GLint level)
{
ASSERT(target != GL_TEXTURE_CUBE_MAP);
* comes up during automatic mipmap generation.
*/
void
-_mesa_choose_texture_format(GLcontext *ctx,
+_mesa_choose_texture_format(struct gl_context *ctx,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage,
GLenum target, GLint level,
GLsizei width, GLint border, GLenum format,
GLenum type, const GLvoid *pixels )
{
- GLsizei postConvWidth = width;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
const GLuint face = _mesa_tex_target_to_face(target);
if (texture_error_check(ctx, target, level, internalFormat,
- format, type, 1, postConvWidth, 1, 1, border)) {
+ format, type, 1, width, 1, 1, border)) {
return; /* error was recorded */
}
clear_teximage_fields(texImage); /* not really needed, but helpful */
_mesa_init_teximage_fields(ctx, target, texImage,
- postConvWidth, 1, 1,
+ width, 1, 1,
border, internalFormat);
_mesa_choose_texture_format(ctx, texObj, texImage, target, level,
struct gl_texture_image *texImage;
texImage = _mesa_get_proxy_tex_image(ctx, target, level);
if (texture_error_check(ctx, target, level, internalFormat,
- format, type, 1, postConvWidth, 1, 1, border)) {
+ format, type, 1, width, 1, 1, border)) {
/* when error, clear all proxy texture image parameters */
if (texImage)
clear_teximage_fields(texImage);
_mesa_get_current_tex_object(ctx, target);
ASSERT(texImage);
_mesa_init_teximage_fields(ctx, target, texImage,
- postConvWidth, 1, 1,
+ width, 1, 1,
border, internalFormat);
_mesa_choose_texture_format(ctx, texObj, texImage, target, level,
internalFormat, format, type);
GLenum format, GLenum type,
const GLvoid *pixels )
{
- GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
const GLuint face = _mesa_tex_target_to_face(target);
if (texture_error_check(ctx, target, level, internalFormat,
- format, type, 2, postConvWidth, postConvHeight,
- 1, border)) {
+ format, type, 2, width, height, 1, border)) {
return; /* error was recorded */
}
ASSERT(texImage->Data == NULL);
clear_teximage_fields(texImage); /* not really needed, but helpful */
_mesa_init_teximage_fields(ctx, target, texImage,
- postConvWidth, postConvHeight, 1,
+ width, height, 1,
border, internalFormat);
_mesa_choose_texture_format(ctx, texObj, texImage, target, level,
struct gl_texture_image *texImage;
texImage = _mesa_get_proxy_tex_image(ctx, target, level);
if (texture_error_check(ctx, target, level, internalFormat,
- format, type, 2, postConvWidth, postConvHeight,
- 1, border)) {
+ format, type, 2, width, height, 1, border)) {
/* when error, clear all proxy texture image parameters */
if (texImage)
clear_teximage_fields(texImage);
struct gl_texture_object *texObj =
_mesa_get_current_tex_object(ctx, target);
_mesa_init_teximage_fields(ctx, target, texImage,
- postConvWidth, postConvHeight, 1,
+ width, height, 1,
border, internalFormat);
_mesa_choose_texture_format(ctx, texObj, texImage, target, level,
internalFormat, format, type);
GLenum format, GLenum type,
const GLvoid *pixels )
{
- GLsizei postConvWidth = width;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GET_CURRENT_CONTEXT(ctx);
_mesa_update_state(ctx);
if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0,
- postConvWidth, 1, 1, format, type)) {
+ width, 1, 1, format, type)) {
return; /* error was detected */
}
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
if (subtexture_error_check2(ctx, 1, target, level, xoffset, 0, 0,
- postConvWidth, 1, 1,
- format, type, texImage)) {
+ width, 1, 1, format, type, texImage)) {
/* error was recorded */
}
else if (width > 0) {
GLenum format, GLenum type,
const GLvoid *pixels )
{
- GLsizei postConvWidth = width, postConvHeight = height;
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
GET_CURRENT_CONTEXT(ctx);
_mesa_update_state(ctx);
if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0,
- postConvWidth, postConvHeight, 1, format, type)) {
+ width, height, 1, format, type)) {
return; /* error was detected */
}
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
if (subtexture_error_check2(ctx, 2, target, level, xoffset, yoffset, 0,
- postConvWidth, postConvHeight, 1,
- format, type, texImage)) {
+ width, height, 1, format, type, texImage)) {
/* error was recorded */
}
else if (width > 0 && height >= 0) {
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- GLsizei postConvWidth = width;
const GLuint face = _mesa_tex_target_to_face(target);
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
_mesa_update_state(ctx);
if (copytexture_error_check(ctx, 1, target, level, internalFormat,
- postConvWidth, 1, border))
+ width, 1, border))
return;
texObj = _mesa_get_current_tex_object(ctx, target);
ASSERT(texImage->Data == NULL);
clear_teximage_fields(texImage); /* not really needed, but helpful */
- _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1,
+ _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1,
border, internalFormat);
_mesa_choose_texture_format(ctx, texObj, texImage, target, level,
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- GLsizei postConvWidth = width, postConvHeight = height;
const GLuint face = _mesa_tex_target_to_face(target);
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
_mesa_update_state(ctx);
if (copytexture_error_check(ctx, 2, target, level, internalFormat,
- postConvWidth, postConvHeight, border))
+ width, height, border))
return;
texObj = _mesa_get_current_tex_object(ctx, target);
clear_teximage_fields(texImage); /* not really needed, but helpful */
_mesa_init_teximage_fields(ctx, target, texImage,
- postConvWidth, postConvHeight, 1,
+ width, height, 1,
border, internalFormat);
_mesa_choose_texture_format(ctx, texObj, texImage, target, level,
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- GLsizei postConvWidth = width;
GLint yoffset = 0;
GLsizei height = 1;
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
if (copytexsubimage_error_check2(ctx, 1, target, level,
- xoffset, 0, 0, postConvWidth, 1,
- texImage)) {
+ xoffset, 0, 0, width, 1, texImage)) {
/* error was recorded */
}
else {
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
if (copytexsubimage_error_check2(ctx, 2, target, level,
xoffset, yoffset, 0,
- postConvWidth, postConvHeight,
- texImage)) {
+ width, height, texImage)) {
/* error was recorded */
}
else {
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- GLsizei postConvWidth = width, postConvHeight = height;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
texImage = _mesa_select_tex_image(ctx, texObj, target, level);
if (copytexsubimage_error_check2(ctx, 3, target, level, xoffset, yoffset,
- zoffset, postConvWidth, postConvHeight,
- texImage)) {
+ zoffset, width, height, texImage)) {
/* error was recored */
}
else {
* \return error code or GL_NO_ERROR.
*/
static GLenum
-compressed_texture_error_check(GLcontext *ctx, GLint dimensions,
+compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
GLenum target, GLint level,
GLenum internalFormat, GLsizei width,
GLsizei height, GLsizei depth, GLint border,
* \return error code or GL_NO_ERROR.
*/
static GLenum
-compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions,
+compressed_subtexture_error_check(struct gl_context *ctx, GLint dimensions,
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
* \return GL_TRUE if error found, GL_FALSE otherwise.
*/
static GLboolean
-compressed_subtexture_error_check2(GLcontext *ctx, GLuint dims,
+compressed_subtexture_error_check2(struct gl_context *ctx, GLuint dims,
GLsizei width, GLsizei height,
GLsizei depth, GLenum format,
struct gl_texture_image *texImage)
/*@{*/
extern GLint
-_mesa_base_tex_format( GLcontext *ctx, GLint internalFormat );
+_mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat );
extern GLboolean
extern struct gl_texture_image *
-_mesa_new_texture_image( GLcontext *ctx );
+_mesa_new_texture_image( struct gl_context *ctx );
extern void
-_mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *teximage );
+_mesa_delete_texture_image( struct gl_context *ctx, struct gl_texture_image *teximage );
extern void
-_mesa_free_texture_image_data( GLcontext *ctx,
+_mesa_free_texture_image_data( struct gl_context *ctx,
struct gl_texture_image *texImage );
extern void
-_mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
+_mesa_init_teximage_fields(struct gl_context *ctx, GLenum target,
struct gl_texture_image *img,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum internalFormat);
extern void
-_mesa_choose_texture_format(GLcontext *ctx,
+_mesa_choose_texture_format(struct gl_context *ctx,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage,
GLenum target, GLint level,
extern void
-_mesa_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage);
+_mesa_clear_texture_image(struct gl_context *ctx, struct gl_texture_image *texImage);
extern void
extern struct gl_texture_object *
-_mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit,
+_mesa_select_tex_object(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
GLenum target);
extern struct gl_texture_object *
-_mesa_get_current_tex_object(GLcontext *ctx, GLenum target);
+_mesa_get_current_tex_object(struct gl_context *ctx, GLenum target);
extern struct gl_texture_image *
-_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj,
+_mesa_select_tex_image(struct gl_context *ctx, const struct gl_texture_object *texObj,
GLenum target, GLint level);
extern struct gl_texture_image *
-_mesa_get_tex_image(GLcontext *ctx, struct gl_texture_object *texObj,
+_mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
GLenum target, GLint level);
extern struct gl_texture_image *
-_mesa_get_proxy_tex_image(GLcontext *ctx, GLenum target, GLint level);
+_mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level);
extern GLint
-_mesa_max_texture_levels(GLcontext *ctx, GLenum target);
+_mesa_max_texture_levels(struct gl_context *ctx, GLenum target);
extern GLboolean
-_mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
+_mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat, GLenum format, GLenum type,
GLint width, GLint height, GLint depth, GLint border);
* Lock a texture for updating. See also _mesa_lock_context_textures().
*/
static INLINE void
-_mesa_lock_texture(GLcontext *ctx, struct gl_texture_object *texObj)
+_mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
{
_glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
ctx->Shared->TextureStateStamp++;
}
static INLINE void
-_mesa_unlock_texture(GLcontext *ctx, struct gl_texture_object *texObj)
+_mesa_unlock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
{
_glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
}
* Return the gl_texture_object for a given ID.
*/
struct gl_texture_object *
-_mesa_lookup_texture(GLcontext *ctx, GLuint id)
+_mesa_lookup_texture(struct gl_context *ctx, GLuint id)
{
return (struct gl_texture_object *)
_mesa_HashLookup(ctx->Shared->TexObjects, id);
* \return pointer to new texture object.
*/
struct gl_texture_object *
-_mesa_new_texture_object( GLcontext *ctx, GLuint name, GLenum target )
+_mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target )
{
struct gl_texture_object *obj;
(void) ctx;
* target it's getting bound to (GL_TEXTURE_1D/2D/etc).
*/
static void
-finish_texture_init(GLcontext *ctx, GLenum target,
+finish_texture_init(struct gl_context *ctx, GLenum target,
struct gl_texture_object *obj)
{
assert(obj->Target == 0);
* \param texObj the texture object to delete.
*/
void
-_mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj )
+_mesa_delete_texture_object( struct gl_context *ctx, struct gl_texture_object *texObj )
{
GLuint i, face;
* \sa _mesa_clear_texture_image().
*/
void
-_mesa_clear_texture_object(GLcontext *ctx, struct gl_texture_object *texObj)
+_mesa_clear_texture_object(struct gl_context *ctx, struct gl_texture_object *texObj)
{
GLuint i, j;
* present and has the expected size.
*/
void
-_mesa_test_texobj_completeness( const GLcontext *ctx,
+_mesa_test_texobj_completeness( const struct gl_context *ctx,
struct gl_texture_object *t )
{
const GLint baseLevel = t->BaseLevel;
* \param invalidate_state also invalidate context state.
*/
void
-_mesa_dirty_texobj(GLcontext *ctx, struct gl_texture_object *texObj,
+_mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj,
GLboolean invalidate_state)
{
texObj->_Complete = GL_FALSE;
* incomplete texture.
*/
struct gl_texture_object *
-_mesa_get_fallback_texture(GLcontext *ctx)
+_mesa_get_fallback_texture(struct gl_context *ctx)
{
if (!ctx->Shared->FallbackTex) {
/* create fallback texture now */
* read framebuffer. If so, Unbind it.
*/
static void
-unbind_texobj_from_fbo(GLcontext *ctx, struct gl_texture_object *texObj)
+unbind_texobj_from_fbo(struct gl_context *ctx, struct gl_texture_object *texObj)
{
const GLuint n = (ctx->DrawBuffer == ctx->ReadBuffer) ? 1 : 2;
GLuint i;
* unbind it if so (revert to default textures).
*/
static void
-unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj)
+unbind_texobj_from_texunits(struct gl_context *ctx, struct gl_texture_object *texObj)
{
GLuint u, tex;
* See also _mesa_lock/unlock_texture() in teximage.h
*/
void
-_mesa_lock_context_textures( GLcontext *ctx )
+_mesa_lock_context_textures( struct gl_context *ctx )
{
_glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
void
-_mesa_unlock_context_textures( GLcontext *ctx )
+_mesa_unlock_context_textures( struct gl_context *ctx )
{
assert(ctx->Shared->TextureStateStamp == ctx->TextureStateTimestamp);
_glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
/*@{*/
extern struct gl_texture_object *
-_mesa_lookup_texture(GLcontext *ctx, GLuint id);
+_mesa_lookup_texture(struct gl_context *ctx, GLuint id);
extern struct gl_texture_object *
-_mesa_new_texture_object( GLcontext *ctx, GLuint name, GLenum target );
+_mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target );
extern void
_mesa_initialize_texture_object( struct gl_texture_object *obj,
GLuint name, GLenum target );
extern void
-_mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *obj );
+_mesa_delete_texture_object( struct gl_context *ctx, struct gl_texture_object *obj );
extern void
_mesa_copy_texture_object( struct gl_texture_object *dest,
const struct gl_texture_object *src );
extern void
-_mesa_clear_texture_object(GLcontext *ctx, struct gl_texture_object *obj);
+_mesa_clear_texture_object(struct gl_context *ctx, struct gl_texture_object *obj);
extern void
_mesa_reference_texobj(struct gl_texture_object **ptr,
struct gl_texture_object *tex);
extern void
-_mesa_test_texobj_completeness( const GLcontext *ctx,
+_mesa_test_texobj_completeness( const struct gl_context *ctx,
struct gl_texture_object *obj );
extern void
-_mesa_dirty_texobj(GLcontext *ctx, struct gl_texture_object *texObj,
+_mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj,
GLboolean invalidate_state);
extern struct gl_texture_object *
-_mesa_get_fallback_texture(GLcontext *ctx);
+_mesa_get_fallback_texture(struct gl_context *ctx);
extern void
-_mesa_unlock_context_textures( GLcontext *ctx );
+_mesa_unlock_context_textures( struct gl_context *ctx );
extern void
-_mesa_lock_context_textures( GLcontext *ctx );
+_mesa_lock_context_textures( struct gl_context *ctx );
/*@}*/
* \return GL_TRUE if legal, GL_FALSE otherwise
*/
static GLboolean
-validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap)
+validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap)
{
const struct gl_extensions * const e = & ctx->Extensions;
* Only the glGetTexLevelParameter() functions accept proxy targets.
*/
static struct gl_texture_object *
-get_texobj(GLcontext *ctx, GLenum target, GLboolean get)
+get_texobj(struct gl_context *ctx, GLenum target, GLboolean get)
{
struct gl_texture_unit *texUnit;
* per-texture derived state gets recomputed.
*/
static INLINE void
-flush(GLcontext *ctx, struct gl_texture_object *texObj)
+flush(struct gl_context *ctx, struct gl_texture_object *texObj)
{
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->_Complete = GL_FALSE;
* \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
*/
static GLboolean
-set_tex_parameteri(GLcontext *ctx,
+set_tex_parameteri(struct gl_context *ctx,
struct gl_texture_object *texObj,
GLenum pname, const GLint *params)
{
if (ctx->Extensions.ARB_depth_texture &&
(params[0] == GL_LUMINANCE ||
params[0] == GL_INTENSITY ||
- params[0] == GL_ALPHA)) {
+ params[0] == GL_ALPHA ||
+ (ctx->Extensions.ARB_texture_rg && params[0] == GL_RED))) {
if (texObj->DepthMode != params[0]) {
flush(ctx, texObj);
texObj->DepthMode = params[0];
* \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
*/
static GLboolean
-set_tex_parameterf(GLcontext *ctx,
+set_tex_parameterf(struct gl_context *ctx,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat *params)
{
*params = img->Border;
break;
case GL_TEXTURE_RED_SIZE:
+ if (img->_BaseFormat == GL_RED) {
+ *params = _mesa_get_format_bits(texFormat, pname);
+ break;
+ }
+ /* FALLTHROUGH */
case GL_TEXTURE_GREEN_SIZE:
+ if (img->_BaseFormat == GL_RG) {
+ *params = _mesa_get_format_bits(texFormat, pname);
+ break;
+ }
+ /* FALLTHROUGH */
case GL_TEXTURE_BLUE_SIZE:
if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
*params = _mesa_get_format_bits(texFormat, pname);
* Get row of values from the renderbuffer that wraps a texture image.
*/
static void
-texture_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+texture_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, void *values)
{
const struct texture_renderbuffer *trb
static void
-texture_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+texture_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], void *values)
{
const struct texture_renderbuffer *trb
* Put row of values into a renderbuffer that wraps a texture image.
*/
static void
-texture_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+texture_put_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
const struct texture_renderbuffer *trb
* Put row of RGB values into a renderbuffer that wraps a texture image.
*/
static void
-texture_put_row_rgb(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+texture_put_row_rgb(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *values, const GLubyte *mask)
{
const struct texture_renderbuffer *trb
static void
-texture_put_mono_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+texture_put_mono_row(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
GLint x, GLint y, const void *value, const GLubyte *mask)
{
const struct texture_renderbuffer *trb
static void
-texture_put_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
+texture_put_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint count,
const GLint x[], const GLint y[], const void *values,
const GLubyte *mask)
{
static void
-texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb,
+texture_put_mono_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
const void *value, const GLubyte *mask)
{
* This allows rendering into the texture as if it were a renderbuffer.
*/
static void
-wrap_texture(GLcontext *ctx, struct gl_renderbuffer_attachment *att)
+wrap_texture(struct gl_context *ctx, struct gl_renderbuffer_attachment *att)
{
struct texture_renderbuffer *trb;
const GLuint name = 0;
* update the internal format info, etc.
*/
static void
-update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att)
+update_wrapper(struct gl_context *ctx, const struct gl_renderbuffer_attachment *att)
{
struct texture_renderbuffer *trb
= (struct texture_renderbuffer *) att->Renderbuffer;
* \sa _mesa_framebuffer_renderbuffer
*/
void
-_mesa_render_texture(GLcontext *ctx,
+_mesa_render_texture(struct gl_context *ctx,
struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att)
{
void
-_mesa_finish_render_texture(GLcontext *ctx,
+_mesa_finish_render_texture(struct gl_context *ctx,
struct gl_renderbuffer_attachment *att)
{
/* do nothing */
#include "mtypes.h"
extern void
-_mesa_render_texture(GLcontext *ctx,
+_mesa_render_texture(struct gl_context *ctx,
struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att);
extern void
-_mesa_finish_render_texture(GLcontext *ctx,
+_mesa_finish_render_texture(struct gl_context *ctx,
struct gl_renderbuffer_attachment *att);
* Used by glXCopyContext to copy texture state from one context to another.
*/
void
-_mesa_copy_texture_state( const GLcontext *src, GLcontext *dst )
+_mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst )
{
GLuint u, tex;
* For debugging
*/
void
-_mesa_print_texunit_state( GLcontext *ctx, GLuint unit )
+_mesa_print_texunit_state( struct gl_context *ctx, GLuint unit )
{
const struct gl_texture_unit *texUnit = ctx->Texture.Unit + unit;
printf("Texture Unit %d\n", unit);
break;
case GL_LUMINANCE:
+ case GL_RED:
+ case GL_RG:
case GL_RGB:
case GL_YCBCR_MESA:
case GL_DUDV_ATI:
case GL_INTENSITY:
state->SourceRGB[0] = GL_PREVIOUS;
break;
+ case GL_RED:
+ case GL_RG:
case GL_RGB:
case GL_YCBCR_MESA:
case GL_DUDV_ATI:
state->OperandA[2] = GL_SRC_ALPHA;
/* FALLTHROUGH */
case GL_LUMINANCE:
+ case GL_RED:
+ case GL_RG:
case GL_RGB:
case GL_LUMINANCE_ALPHA:
case GL_RGBA:
* \param ctx GL context.
*/
static void
-update_texture_matrices( GLcontext *ctx )
+update_texture_matrices( struct gl_context *ctx )
{
GLuint u;
* Examine texture unit's combine/env state to update derived state.
*/
static void
-update_tex_combine(GLcontext *ctx, struct gl_texture_unit *texUnit)
+update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
{
struct gl_tex_env_combine_state *combine;
* \param ctx GL context.
*/
static void
-update_texture_state( GLcontext *ctx )
+update_texture_state( struct gl_context *ctx )
{
GLuint unit;
struct gl_fragment_program *fprog = NULL;
* Update texture-related derived state.
*/
void
-_mesa_update_texture( GLcontext *ctx, GLuint new_state )
+_mesa_update_texture( struct gl_context *ctx, GLuint new_state )
{
if (new_state & _NEW_TEXTURE_MATRIX)
update_texture_matrices( ctx );
* GL_FALSE.
*/
static GLboolean
-alloc_proxy_textures( GLcontext *ctx )
+alloc_proxy_textures( struct gl_context *ctx )
{
static const GLenum targets[] = {
GL_TEXTURE_1D,
* \param unit texture unit number to be initialized.
*/
static void
-init_texture_unit( GLcontext *ctx, GLuint unit )
+init_texture_unit( struct gl_context *ctx, GLuint unit )
{
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
GLuint tex;
* Initialize texture state for the given context.
*/
GLboolean
-_mesa_init_texture(GLcontext *ctx)
+_mesa_init_texture(struct gl_context *ctx)
{
GLuint u;
* Free dynamically-allocted texture data attached to the given context.
*/
void
-_mesa_free_texture_data(GLcontext *ctx)
+_mesa_free_texture_data(struct gl_context *ctx)
{
GLuint u, tgt;
* shared state.
*/
void
-_mesa_update_default_objects_texture(GLcontext *ctx)
+_mesa_update_default_objects_texture(struct gl_context *ctx)
{
GLuint u, tex;
* This the texture unit set by glActiveTexture(), not glClientActiveTexture().
*/
static INLINE struct gl_texture_unit *
-_mesa_get_current_tex_unit(GLcontext *ctx)
+_mesa_get_current_tex_unit(struct gl_context *ctx)
{
ASSERT(ctx->Texture.CurrentUnit < Elements(ctx->Texture.Unit));
return &(ctx->Texture.Unit[ctx->Texture.CurrentUnit]);
extern void
-_mesa_copy_texture_state( const GLcontext *src, GLcontext *dst );
+_mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst );
extern void
-_mesa_print_texunit_state( GLcontext *ctx, GLuint unit );
+_mesa_print_texunit_state( struct gl_context *ctx, GLuint unit );
/*@{*/
extern void
-_mesa_update_texture( GLcontext *ctx, GLuint new_state );
+_mesa_update_texture( struct gl_context *ctx, GLuint new_state );
extern GLboolean
-_mesa_init_texture( GLcontext *ctx );
+_mesa_init_texture( struct gl_context *ctx );
extern void
-_mesa_free_texture_data( GLcontext *ctx );
+_mesa_free_texture_data( struct gl_context *ctx );
extern void
-_mesa_update_default_objects_texture(GLcontext *ctx);
+_mesa_update_default_objects_texture(struct gl_context *ctx);
/*@}*/
case GL_BGR:
case GL_BGRA:
case GL_ABGR_EXT:
+ case GL_RG:
return GL_TRUE;
default:
return GL_FALSE;
IDX_BGR,
IDX_BGRA,
IDX_ABGR,
+ IDX_RG,
MAX_IDX
};
MAP4(0,1,2,3),
},
-
{
IDX_RED,
MAP4(0, ZERO, ZERO, ONE),
MAP4(3,2,1,0),
MAP4(3,2,1,0)
},
+
+ {
+ IDX_RG,
+ MAP4(0, 1, ZERO, ONE),
+ MAP2(0, 1)
+ },
};
case GL_BGR: return IDX_BGR;
case GL_BGRA: return IDX_BGRA;
case GL_ABGR_EXT: return IDX_ABGR;
+ case GL_RG: return IDX_RG;
default:
_mesa_problem(NULL, "Unexpected inFormat");
return 0;
* Apply all needed pixel unpacking and pixel transfer operations.
* Note that there are both logicalBaseFormat and textureBaseFormat parameters.
* Suppose the user specifies GL_LUMINANCE as the internal texture format
- * but the graphics hardware doesn't support luminance textures. So, might
+ * but the graphics hardware doesn't support luminance textures. So, we might
* use an RGB hardware format instead.
* If logicalBaseFormat != textureBaseFormat we have some extra work to do.
*
* \return resulting image with format = textureBaseFormat and type = GLfloat.
*/
static GLfloat *
-make_temp_float_image(GLcontext *ctx, GLuint dims,
+make_temp_float_image(struct gl_context *ctx, GLuint dims,
GLenum logicalBaseFormat,
GLenum textureBaseFormat,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
ASSERT(logicalBaseFormat == GL_RGBA ||
logicalBaseFormat == GL_RGB ||
+ logicalBaseFormat == GL_RG ||
+ logicalBaseFormat == GL_RED ||
logicalBaseFormat == GL_LUMINANCE_ALPHA ||
logicalBaseFormat == GL_LUMINANCE ||
logicalBaseFormat == GL_ALPHA ||
ASSERT(textureBaseFormat == GL_RGBA ||
textureBaseFormat == GL_RGB ||
+ textureBaseFormat == GL_RG ||
+ textureBaseFormat == GL_RED ||
textureBaseFormat == GL_LUMINANCE_ALPHA ||
textureBaseFormat == GL_LUMINANCE ||
textureBaseFormat == GL_ALPHA ||
* Apply all needed pixel unpacking and pixel transfer operations.
* Note that there are both logicalBaseFormat and textureBaseFormat parameters.
* Suppose the user specifies GL_LUMINANCE as the internal texture format
- * but the graphics hardware doesn't support luminance textures. So, might
+ * but the graphics hardware doesn't support luminance textures. So, we might
* use an RGB hardware format instead.
* If logicalBaseFormat != textureBaseFormat we have some extra work to do.
*
* \return resulting image with format = textureBaseFormat and type = GLchan.
*/
GLchan *
-_mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
+_mesa_make_temp_chan_image(struct gl_context *ctx, GLuint dims,
GLenum logicalBaseFormat,
GLenum textureBaseFormat,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
ASSERT(logicalBaseFormat == GL_RGBA ||
logicalBaseFormat == GL_RGB ||
+ logicalBaseFormat == GL_RG ||
+ logicalBaseFormat == GL_RED ||
logicalBaseFormat == GL_LUMINANCE_ALPHA ||
logicalBaseFormat == GL_LUMINANCE ||
logicalBaseFormat == GL_ALPHA ||
ASSERT(textureBaseFormat == GL_RGBA ||
textureBaseFormat == GL_RGB ||
+ textureBaseFormat == GL_RG ||
+ textureBaseFormat == GL_RED ||
textureBaseFormat == GL_LUMINANCE_ALPHA ||
textureBaseFormat == GL_LUMINANCE ||
textureBaseFormat == GL_ALPHA ||
static const GLubyte map_identity[6] = { 0, 1, 2, 3, ZERO, ONE };
static const GLubyte map_3210[6] = { 3, 2, 1, 0, ZERO, ONE };
-/* Deal with the _REV input types:
+
+/**
+ * For 1-byte/pixel formats (or 8_8_8_8 packed formats), return a
+ * mapping array depending on endianness.
*/
static const GLubyte *
type_mapping( GLenum srcType )
}
}
-/* Mapping required if input type is
+
+/**
+ * For 1-byte/pixel formats (or 8_8_8_8 packed formats), return a
+ * mapping array depending on pixelstore byte swapping state.
*/
static const GLubyte *
byteswap_mapping( GLboolean swapBytes,
* Transfer a GLubyte texture image with component swizzling.
*/
static void
-_mesa_swizzle_ubyte_image(GLcontext *ctx,
+_mesa_swizzle_ubyte_image(struct gl_context *ctx,
GLuint dimensions,
GLenum srcFormat,
GLenum srcType,
* 1D, 2D and 3D images supported.
*/
static void
-memcpy_texture(GLcontext *ctx,
+memcpy_texture(struct gl_context *ctx,
GLuint dimensions,
gl_format dstFormat,
GLvoid *dstAddr,
_mesa_swizzle_ubyte_image(ctx, dims,
srcFormat,
srcType,
-
baseInternalFormat,
dstmap, 4,
dstAddr, dstXoffset, dstYoffset, dstZoffset,
}
+/**
+ * Do texstore for 2-channel, 8-bit/channel, unsigned normalized formats.
+ */
static GLboolean
-_mesa_texstore_al88(TEXSTORE_PARAMS)
+_mesa_texstore_unorm88(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
ASSERT(dstFormat == MESA_FORMAT_AL88 ||
- dstFormat == MESA_FORMAT_AL88_REV);
+ dstFormat == MESA_FORMAT_AL88_REV ||
+ dstFormat == MESA_FORMAT_RG88 ||
+ dstFormat == MESA_FORMAT_RG88_REV);
ASSERT(texelBytes == 2);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_AL88 &&
- baseInternalFormat == GL_LUMINANCE_ALPHA &&
- srcFormat == GL_LUMINANCE_ALPHA &&
+ (dstFormat == MESA_FORMAT_AL88 || dstFormat == MESA_FORMAT_RG88) &&
+ baseInternalFormat == srcFormat &&
srcType == GL_UNSIGNED_BYTE &&
littleEndian) {
/* simple memcpy path */
srcType == GL_UNSIGNED_BYTE &&
can_swizzle(baseInternalFormat) &&
can_swizzle(srcFormat)) {
-
GLubyte dstmap[4];
/* dstmap - how to swizzle from RGBA to dst format:
*/
- if ((littleEndian && dstFormat == MESA_FORMAT_AL88) ||
- (!littleEndian && dstFormat == MESA_FORMAT_AL88_REV)) {
- dstmap[0] = 0;
- dstmap[1] = 3;
+ if (dstFormat == MESA_FORMAT_AL88 || dstFormat == MESA_FORMAT_AL88_REV) {
+ if ((littleEndian && dstFormat == MESA_FORMAT_AL88) ||
+ (!littleEndian && dstFormat == MESA_FORMAT_AL88_REV)) {
+ dstmap[0] = 0;
+ dstmap[1] = 3;
+ }
+ else {
+ dstmap[0] = 3;
+ dstmap[1] = 0;
+ }
}
else {
- dstmap[0] = 3;
- dstmap[1] = 0;
+ if ((littleEndian && dstFormat == MESA_FORMAT_RG88) ||
+ (!littleEndian && dstFormat == MESA_FORMAT_RG88_REV)) {
+ dstmap[0] = 0;
+ dstmap[1] = 1;
+ }
+ else {
+ dstmap[0] = 1;
+ dstmap[1] = 0;
+ }
}
dstmap[2] = ZERO; /* ? */
dstmap[3] = ONE; /* ? */
+ dstXoffset * texelBytes;
for (row = 0; row < srcHeight; row++) {
GLushort *dstUS = (GLushort *) dstRow;
- if (dstFormat == MESA_FORMAT_AL88) {
+ if (dstFormat == MESA_FORMAT_AL88 ||
+ dstFormat == MESA_FORMAT_RG88) {
for (col = 0; col < srcWidth; col++) {
/* src[0] is luminance, src[1] is alpha */
dstUS[col] = PACK_COLOR_88( CHAN_TO_UBYTE(src[1]),
}
+/**
+ * Do texstore for 2-channel, 16-bit/channel, unsigned normalized formats.
+ */
static GLboolean
-_mesa_texstore_al1616(TEXSTORE_PARAMS)
+_mesa_texstore_unorm1616(TEXSTORE_PARAMS)
{
const GLboolean littleEndian = _mesa_little_endian();
const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
ASSERT(dstFormat == MESA_FORMAT_AL1616 ||
- dstFormat == MESA_FORMAT_AL1616_REV);
+ dstFormat == MESA_FORMAT_AL1616_REV ||
+ dstFormat == MESA_FORMAT_RG1616 ||
+ dstFormat == MESA_FORMAT_RG1616_REV);
ASSERT(texelBytes == 4);
if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
- dstFormat == MESA_FORMAT_AL1616 &&
- baseInternalFormat == GL_LUMINANCE_ALPHA &&
- srcFormat == GL_LUMINANCE_ALPHA &&
+ (dstFormat == MESA_FORMAT_AL1616 || dstFormat == MESA_FORMAT_RG1616) &&
+ baseInternalFormat == srcFormat &&
srcType == GL_UNSIGNED_SHORT &&
littleEndian) {
/* simple memcpy path */
+ dstXoffset * texelBytes;
for (row = 0; row < srcHeight; row++) {
GLuint *dstUI = (GLuint *) dstRow;
- if (dstFormat == MESA_FORMAT_AL1616) {
+ if (dstFormat == MESA_FORMAT_AL1616 ||
+ dstFormat == MESA_FORMAT_RG1616) {
for (col = 0; col < srcWidth; col++) {
GLushort l, a;
}
+static GLboolean
+_mesa_texstore_r16(TEXSTORE_PARAMS)
+{
+ const GLboolean littleEndian = _mesa_little_endian();
+ const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
+ const GLenum baseFormat = _mesa_get_format_base_format(dstFormat);
+
+ ASSERT(dstFormat == MESA_FORMAT_R16);
+ ASSERT(texelBytes == 2);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ dstFormat == MESA_FORMAT_R16 &&
+ baseInternalFormat == GL_RED &&
+ srcFormat == GL_RED &&
+ srcType == GL_UNSIGNED_SHORT &&
+ littleEndian) {
+ /* simple memcpy path */
+ memcpy_texture(ctx, dims,
+ dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride,
+ dstImageOffsets,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
+ }
+ else {
+ /* general path */
+ const GLfloat *tempImage = make_temp_float_image(ctx, dims,
+ baseInternalFormat,
+ baseFormat,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType, srcAddr,
+ srcPacking);
+ const GLfloat *src = tempImage;
+ GLint img, row, col;
+ if (!tempImage)
+ return GL_FALSE;
+ for (img = 0; img < srcDepth; img++) {
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ + dstImageOffsets[dstZoffset + img] * texelBytes
+ + dstYoffset * dstRowStride
+ + dstXoffset * texelBytes;
+ for (row = 0; row < srcHeight; row++) {
+ GLushort *dstUS = (GLushort *) dstRow;
+ for (col = 0; col < srcWidth; col++) {
+ GLushort r;
+
+ UNCLAMPED_FLOAT_TO_USHORT(r, src[0]);
+ dstUS[col] = r;
+ src += 1;
+ }
+ dstRow += dstRowStride;
+ }
+ }
+ free((void *) tempImage);
+ }
+ return GL_TRUE;
+}
+
+
static GLboolean
_mesa_texstore_rgba_16(TEXSTORE_PARAMS)
{
ASSERT(dstFormat == MESA_FORMAT_A8 ||
dstFormat == MESA_FORMAT_L8 ||
- dstFormat == MESA_FORMAT_I8);
+ dstFormat == MESA_FORMAT_I8 ||
+ dstFormat == MESA_FORMAT_R8);
ASSERT(texelBytes == 1);
if (!ctx->_ImageTransferState &&
srcType == GL_UNSIGNED_BYTE &&
can_swizzle(baseInternalFormat) &&
can_swizzle(srcFormat)) {
-
GLubyte dstmap[4];
/* dstmap - how to swizzle from RGBA to dst format:
srcAddr, srcPacking);
}
else if (srcType == GL_BYTE) {
-
GLubyte dstmap[4];
/* dstmap - how to swizzle from RGBA to dst format:
/**
- * Store a texture in MESA_FORMAT_SIGNED_RGBA8888 or MESA_FORMAT_SIGNED_RGBA8888_REV
+ * Store a texture in MESA_FORMAT_SIGNED_RGBA8888 or
+ * MESA_FORMAT_SIGNED_RGBA8888_REV
*/
static GLboolean
_mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT);
ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT);
- /* In case we only upload depth we need to preserve the stencil */
- if (srcFormat == GL_DEPTH_COMPONENT) {
- for (img = 0; img < srcDepth; img++) {
- GLuint *dstRow = (GLuint *) dstAddr
- + dstImageOffsets[dstZoffset + img]
- + dstYoffset * dstRowStride / sizeof(GLuint)
- + dstXoffset;
- const GLuint *src
- = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
- srcWidth, srcHeight,
- srcFormat, srcType,
- img, 0, 0);
- for (row = 0; row < srcHeight; row++) {
- GLuint depth[MAX_WIDTH];
- GLint i;
- _mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_INT, /* dst type */
- depth, /* dst addr */
- depthScale,
- srcType, src, srcPacking);
-
- for (i = 0; i < srcWidth; i++)
- dstRow[i] = depth[i] << 8 | (dstRow[i] & 0x000000FF);
-
- src += srcRowStride;
- dstRow += dstRowStride / sizeof(GLuint);
- }
- }
- }
- else if (ctx->Pixel.DepthScale == 1.0f &&
+ if (srcFormat != GL_DEPTH_COMPONENT && ctx->Pixel.DepthScale == 1.0f &&
ctx->Pixel.DepthBias == 0.0f &&
!srcPacking->SwapBytes) {
/* simple path */
srcWidth, srcHeight, srcDepth, srcFormat, srcType,
srcAddr, srcPacking);
}
- else {
- /* general path */
- const GLint srcRowStride
- = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
- / sizeof(GLuint);
- GLint img, row;
-
+ else if (srcFormat == GL_DEPTH_COMPONENT) {
+ /* In case we only upload depth we need to preserve the stencil */
for (img = 0; img < srcDepth; img++) {
- GLuint *dstRow = (GLuint *) dstAddr
+ GLuint *dstRow = (GLuint *) dstAddr
+ dstImageOffsets[dstZoffset + img]
+ dstYoffset * dstRowStride / sizeof(GLuint)
+ dstXoffset;
const GLuint *src
= (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
- srcWidth, srcHeight,
- srcFormat, srcType,
- img, 0, 0);
+ srcWidth, srcHeight,
+ srcFormat, srcType,
+ img, 0, 0);
for (row = 0; row < srcHeight; row++) {
- GLubyte stencil[MAX_WIDTH];
+ GLuint depth[MAX_WIDTH];
+ GLubyte stencil[MAX_WIDTH];
GLint i;
- /* the 24 depth bits will be in the high position: */
- _mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_INT_24_8_EXT, /* dst type */
- dstRow, /* dst addr */
- depthScale,
- srcType, src, srcPacking);
- /* get the 8-bit stencil values */
- _mesa_unpack_stencil_span(ctx, srcWidth,
- GL_UNSIGNED_BYTE, /* dst type */
- stencil, /* dst addr */
- srcType, src, srcPacking,
- ctx->_ImageTransferState);
- /* merge stencil values into depth values */
- for (i = 0; i < srcWidth; i++)
- dstRow[i] |= stencil[i];
+ GLboolean keepdepth = GL_FALSE, keepstencil = GL_FALSE;
+
+ if (srcFormat == GL_DEPTH_COMPONENT) { /* preserve stencil */
+ keepstencil = GL_TRUE;
+ }
+ else if (srcFormat == GL_STENCIL_INDEX) { /* preserve depth */
+ keepdepth = GL_TRUE;
+ }
+
+ if (keepdepth == GL_FALSE)
+ /* the 24 depth bits will be in the low position: */
+ _mesa_unpack_depth_span(ctx, srcWidth,
+ GL_UNSIGNED_INT, /* dst type */
+ keepstencil ? depth : dstRow, /* dst addr */
+ depthScale,
+ srcType, src, srcPacking);
+
+ if (keepstencil == GL_FALSE)
+ /* get the 8-bit stencil values */
+ _mesa_unpack_stencil_span(ctx, srcWidth,
+ GL_UNSIGNED_BYTE, /* dst type */
+ stencil, /* dst addr */
+ srcType, src, srcPacking,
+ ctx->_ImageTransferState);
+
+ for (i = 0; i < srcWidth; i++) {
+ if (keepstencil)
+ dstRow[i] = depth[i] << 8 | (dstRow[i] & 0x000000FF);
+ else
+ dstRow[i] = (dstRow[i] & 0xFFFFFF00) | (stencil[i] & 0xFF);
+ }
src += srcRowStride;
dstRow += dstRowStride / sizeof(GLuint);
GLint img, row;
ASSERT(dstFormat == MESA_FORMAT_S8_Z24);
- ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT);
- ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT);
+ ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT ||
+ srcFormat == GL_DEPTH_COMPONENT ||
+ srcFormat == GL_STENCIL_INDEX);
+ ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT ||
+ srcType == GL_UNSIGNED_INT_24_8_EXT);
- /* In case we only upload depth we need to preserve the stencil */
- if (srcFormat == GL_DEPTH_COMPONENT) {
- for (img = 0; img < srcDepth; img++) {
- GLuint *dstRow = (GLuint *) dstAddr
- + dstImageOffsets[dstZoffset + img]
- + dstYoffset * dstRowStride / sizeof(GLuint)
- + dstXoffset;
- const GLuint *src
- = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
- srcWidth, srcHeight,
- srcFormat, srcType,
- img, 0, 0);
- for (row = 0; row < srcHeight; row++) {
- GLuint depth[MAX_WIDTH];
- GLint i;
- _mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_INT, /* dst type */
- depth, /* dst addr */
- depthScale,
- srcType, src, srcPacking);
+ for (img = 0; img < srcDepth; img++) {
+ GLuint *dstRow = (GLuint *) dstAddr
+ + dstImageOffsets[dstZoffset + img]
+ + dstYoffset * dstRowStride / sizeof(GLuint)
+ + dstXoffset;
+ const GLuint *src
+ = (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
+ srcWidth, srcHeight,
+ srcFormat, srcType,
+ img, 0, 0);
+ for (row = 0; row < srcHeight; row++) {
+ GLuint depth[MAX_WIDTH];
+ GLubyte stencil[MAX_WIDTH];
+ GLint i;
+ GLboolean keepdepth = GL_FALSE, keepstencil = GL_FALSE;
+
+ if (srcFormat == GL_DEPTH_COMPONENT) { /* preserve stencil */
+ keepstencil = GL_TRUE;
+ }
+ else if (srcFormat == GL_STENCIL_INDEX) { /* preserve depth */
+ keepdepth = GL_TRUE;
+ }
+
+ if (keepdepth == GL_FALSE)
+ /* the 24 depth bits will be in the low position: */
+ _mesa_unpack_depth_span(ctx, srcWidth,
+ GL_UNSIGNED_INT, /* dst type */
+ keepstencil ? depth : dstRow, /* dst addr */
+ depthScale,
+ srcType, src, srcPacking);
+
+ if (keepstencil == GL_FALSE)
+ /* get the 8-bit stencil values */
+ _mesa_unpack_stencil_span(ctx, srcWidth,
+ GL_UNSIGNED_BYTE, /* dst type */
+ stencil, /* dst addr */
+ srcType, src, srcPacking,
+ ctx->_ImageTransferState);
+
+ /* merge stencil values into depth values */
+ for (i = 0; i < srcWidth; i++) {
+ if (keepstencil)
+ dstRow[i] = depth[i] | (dstRow[i] & 0xFF000000);
+ else
+ dstRow[i] = (dstRow[i] & 0xFFFFFF) | (stencil[i] << 24);
+
+ }
+ src += srcRowStride;
+ dstRow += dstRowStride / sizeof(GLuint);
+ }
+ }
+ return GL_TRUE;
+}
- for (i = 0; i < srcWidth; i++)
- dstRow[i] = depth[i] | (dstRow[i] & 0xFF000000);
- src += srcRowStride;
- dstRow += dstRowStride / sizeof(GLuint);
- }
- }
+/**
+ * Store simple 8-bit/value stencil texture data.
+ */
+static GLboolean
+_mesa_texstore_s8(TEXSTORE_PARAMS)
+{
+ ASSERT(dstFormat == MESA_FORMAT_S8);
+ ASSERT(srcFormat == GL_STENCIL_INDEX);
+
+ if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
+ baseInternalFormat == srcFormat &&
+ srcType == GL_UNSIGNED_BYTE) {
+ /* simple memcpy path */
+ memcpy_texture(ctx, dims,
+ dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride,
+ dstImageOffsets,
+ srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+ srcAddr, srcPacking);
}
else {
+ const GLint srcRowStride
+ = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType)
+ / sizeof(GLuint);
+ GLint img, row;
+
for (img = 0; img < srcDepth; img++) {
- GLuint *dstRow = (GLuint *) dstAddr
+ GLubyte *dstRow = (GLubyte *) dstAddr
+ dstImageOffsets[dstZoffset + img]
+ dstYoffset * dstRowStride / sizeof(GLuint)
+ dstXoffset;
const GLuint *src
= (const GLuint *) _mesa_image_address(dims, srcPacking, srcAddr,
- srcWidth, srcHeight,
- srcFormat, srcType,
- img, 0, 0);
+ srcWidth, srcHeight,
+ srcFormat, srcType,
+ img, 0, 0);
for (row = 0; row < srcHeight; row++) {
GLubyte stencil[MAX_WIDTH];
GLint i;
- /* the 24 depth bits will be in the low position: */
- _mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_INT, /* dst type */
- dstRow, /* dst addr */
- depthScale,
- srcType, src, srcPacking);
+
/* get the 8-bit stencil values */
_mesa_unpack_stencil_span(ctx, srcWidth,
GL_UNSIGNED_BYTE, /* dst type */
ctx->_ImageTransferState);
/* merge stencil values into depth values */
for (i = 0; i < srcWidth; i++)
- dstRow[i] |= stencil[i] << 24;
+ dstRow[i] = stencil[i];
src += srcRowStride;
- dstRow += dstRowStride / sizeof(GLuint);
+ dstRow += dstRowStride / sizeof(GLubyte);
}
}
+
}
+
return GL_TRUE;
}
+
/**
* Store an image in any of the formats:
* _mesa_texformat_rgba_float32
}
+
/**
* As above, but store 16-bit floats.
*/
newDstFormat = MESA_FORMAT_RGB888;
k = _mesa_texstore_rgb888(ctx, dims, baseInternalFormat,
- newDstFormat, dstAddr,
- dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType,
- srcAddr, srcPacking);
+ newDstFormat, dstAddr,
+ dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageOffsets,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType,
+ srcAddr, srcPacking);
return k;
}
/* reuse normal luminance/alpha texstore code */
newDstFormat = MESA_FORMAT_AL88;
- k = _mesa_texstore_al88(ctx, dims, baseInternalFormat,
- newDstFormat, dstAddr,
- dstXoffset, dstYoffset, dstZoffset,
- dstRowStride, dstImageOffsets,
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType,
- srcAddr, srcPacking);
+ k = _mesa_texstore_unorm88(ctx, dims, baseInternalFormat,
+ newDstFormat, dstAddr,
+ dstXoffset, dstYoffset, dstZoffset,
+ dstRowStride, dstImageOffsets,
+ srcWidth, srcHeight, srcDepth,
+ srcFormat, srcType,
+ srcAddr, srcPacking);
return k;
}
/**
- * Table mapping MESA_FORMAT_8 to _mesa_texstore_*()
+ * Table mapping MESA_FORMAT_* to _mesa_texstore_*()
* XXX this is somewhat temporary.
*/
static const struct {
{ MESA_FORMAT_RGBA5551, _mesa_texstore_rgba5551 },
{ MESA_FORMAT_ARGB1555, _mesa_texstore_argb1555 },
{ MESA_FORMAT_ARGB1555_REV, _mesa_texstore_argb1555 },
- { MESA_FORMAT_AL88, _mesa_texstore_al88 },
- { MESA_FORMAT_AL88_REV, _mesa_texstore_al88 },
- { MESA_FORMAT_AL1616, _mesa_texstore_al1616 },
- { MESA_FORMAT_AL1616_REV, _mesa_texstore_al1616 },
+ { MESA_FORMAT_AL88, _mesa_texstore_unorm88 },
+ { MESA_FORMAT_AL88_REV, _mesa_texstore_unorm88 },
+ { MESA_FORMAT_AL1616, _mesa_texstore_unorm1616 },
+ { MESA_FORMAT_AL1616_REV, _mesa_texstore_unorm1616 },
{ MESA_FORMAT_RGB332, _mesa_texstore_rgb332 },
{ MESA_FORMAT_A8, _mesa_texstore_a8 },
{ MESA_FORMAT_L8, _mesa_texstore_a8 },
{ MESA_FORMAT_CI8, _mesa_texstore_ci8 },
{ MESA_FORMAT_YCBCR, _mesa_texstore_ycbcr },
{ MESA_FORMAT_YCBCR_REV, _mesa_texstore_ycbcr },
+ { MESA_FORMAT_R8, _mesa_texstore_a8 },
+ { MESA_FORMAT_RG88, _mesa_texstore_unorm88 },
+ { MESA_FORMAT_RG88_REV, _mesa_texstore_unorm88 },
+ { MESA_FORMAT_R16, _mesa_texstore_r16 },
+ { MESA_FORMAT_RG1616, _mesa_texstore_unorm1616 },
+ { MESA_FORMAT_RG1616_REV, _mesa_texstore_unorm1616 },
{ MESA_FORMAT_Z24_S8, _mesa_texstore_z24_s8 },
{ MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 },
{ MESA_FORMAT_Z16, _mesa_texstore_z16 },
{ MESA_FORMAT_X8_Z24, _mesa_texstore_x8_z24 },
{ MESA_FORMAT_Z24_X8, _mesa_texstore_z24_x8 },
{ MESA_FORMAT_Z32, _mesa_texstore_z32 },
- { MESA_FORMAT_S8, NULL/*_mesa_texstore_s8*/ },
+ { MESA_FORMAT_S8, _mesa_texstore_s8 },
{ MESA_FORMAT_SRGB8, _mesa_texstore_srgb8 },
{ MESA_FORMAT_SRGBA8, _mesa_texstore_srgba8 },
{ MESA_FORMAT_SARGB8, _mesa_texstore_sargb8 },
* The caller _must_ call _mesa_unmap_teximage_pbo() too!
*/
const GLvoid *
-_mesa_validate_pbo_teximage(GLcontext *ctx, GLuint dimensions,
+_mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *unpack,
* The caller _must_ call _mesa_unmap_teximage_pbo() too!
*/
const GLvoid *
-_mesa_validate_pbo_compressed_teximage(GLcontext *ctx,
+_mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
GLsizei imageSize, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing,
const char *funcName)
* functions. It unmaps the PBO buffer if it was mapped earlier.
*/
void
-_mesa_unmap_teximage_pbo(GLcontext *ctx,
+_mesa_unmap_teximage_pbo(struct gl_context *ctx,
const struct gl_pixelstore_attrib *unpack)
{
if (_mesa_is_bufferobj(unpack->BufferObj)) {
* \sa _mesa_store_teximage2d()
*/
void
-_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
* than VRAM. Device driver's can easily plug in their own replacement.
*/
void
-_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const void *pixels,
* \sa _mesa_store_teximage2d()
*/
void
-_mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const void *pixels,
* and Driver.CopyTexSubImage1D().
*/
void
-_mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_texsubimage1d(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint width,
GLenum format, GLenum type, const void *pixels,
const struct gl_pixelstore_attrib *packing,
* and Driver.CopyTexSubImage2D().
*/
void
-_mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_texsubimage2d(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint width, GLint height,
GLenum format, GLenum type, const void *pixels,
* and Driver.CopyTexSubImage3D().
*/
void
-_mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
GLenum format, GLenum type, const void *pixels,
* Fallback for Driver.CompressedTexImage1D()
*/
void
-_mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_compressed_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLsizei imageSize, const GLvoid *data,
* Fallback for Driver.CompressedTexImage2D()
*/
void
-_mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_compressed_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLsizei imageSize, const GLvoid *data,
* Fallback for Driver.CompressedTexImage3D()
*/
void
-_mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_compressed_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth,
GLint border,
* Fallback for Driver.CompressedTexSubImage1D()
*/
void
-_mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target,
+_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, GLenum target,
GLint level,
GLint xoffset, GLsizei width,
GLenum format,
* Fallback for Driver.CompressedTexSubImage2D()
*/
void
-_mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
+_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
* Fallback for Driver.CompressedTexSubImage3D()
*/
void
-_mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target,
+_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, GLenum target,
GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
* \param srcPacking source image packing parameters
*/
#define TEXSTORE_PARAMS \
- GLcontext *ctx, GLuint dims, \
+ struct gl_context *ctx, GLuint dims, \
GLenum baseInternalFormat, \
gl_format dstFormat, \
GLvoid *dstAddr, \
extern GLchan *
-_mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
+_mesa_make_temp_chan_image(struct gl_context *ctx, GLuint dims,
GLenum logicalBaseFormat,
GLenum textureBaseFormat,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
extern void
-_mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
extern void
-_mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
extern void
-_mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
extern void
-_mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_texsubimage1d(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint width,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing,
extern void
-_mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_texsubimage2d(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint width, GLint height,
GLenum format, GLenum type, const GLvoid *pixels,
extern void
-_mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_texsubimage3d(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
GLenum format, GLenum type, const GLvoid *pixels,
extern void
-_mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_compressed_teximage1d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
GLsizei imageSize, const GLvoid *data,
struct gl_texture_image *texImage);
extern void
-_mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_compressed_teximage2d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLsizei imageSize, const GLvoid *data,
struct gl_texture_image *texImage);
extern void
-_mesa_store_compressed_teximage3d(GLcontext *ctx, GLenum target, GLint level,
+_mesa_store_compressed_teximage3d(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth,
GLint border,
extern void
-_mesa_store_compressed_texsubimage1d(GLcontext *ctx, GLenum target,
+_mesa_store_compressed_texsubimage1d(struct gl_context *ctx, GLenum target,
GLint level,
GLint xoffset, GLsizei width,
GLenum format,
struct gl_texture_image *texImage);
extern void
-_mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
+_mesa_store_compressed_texsubimage2d(struct gl_context *ctx, GLenum target,
GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
struct gl_texture_image *texImage);
extern void
-_mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target,
+_mesa_store_compressed_texsubimage3d(struct gl_context *ctx, GLenum target,
GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
extern const GLvoid *
-_mesa_validate_pbo_teximage(GLcontext *ctx, GLuint dimensions,
+_mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *unpack,
const char *funcName);
extern const GLvoid *
-_mesa_validate_pbo_compressed_teximage(GLcontext *ctx,
+_mesa_validate_pbo_compressed_teximage(struct gl_context *ctx,
GLsizei imageSize, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing,
const char *funcName);
extern void
-_mesa_unmap_teximage_pbo(GLcontext *ctx,
+_mesa_unmap_teximage_pbo(struct gl_context *ctx,
const struct gl_pixelstore_attrib *unpack);
* \return GL_TRUE if the mode is OK, GL_FALSE otherwise.
*/
GLboolean
-_mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode)
+_mesa_validate_primitive_mode(struct gl_context *ctx, GLenum mode)
{
if (ctx->TransformFeedback.CurrentObject->Active) {
switch (mode) {
* \return GL_TRUE for success, GL_FALSE if error
*/
GLboolean
-_mesa_validate_transform_feedback_buffers(GLcontext *ctx)
+_mesa_validate_transform_feedback_buffers(struct gl_context *ctx)
{
/* XXX to do */
return GL_TRUE;
* Per-context init for transform feedback.
*/
void
-_mesa_init_transform_feedback(GLcontext *ctx)
+_mesa_init_transform_feedback(struct gl_context *ctx)
{
/* core mesa expects this, even a dummy one, to be available */
ASSERT(ctx->Driver.NewTransformFeedback);
static void
delete_cb(GLuint key, void *data, void *userData)
{
- GLcontext *ctx = (GLcontext *) userData;
+ struct gl_context *ctx = (struct gl_context *) userData;
struct gl_transform_feedback_object *obj =
(struct gl_transform_feedback_object *) data;
* Per-context free/clean-up for transform feedback.
*/
void
-_mesa_free_transform_feedback(GLcontext *ctx)
+_mesa_free_transform_feedback(struct gl_context *ctx)
{
/* core mesa expects this, even a dummy one, to be available */
ASSERT(ctx->Driver.NewTransformFeedback);
/* forward declarations */
static struct gl_transform_feedback_object *
-new_transform_feedback(GLcontext *ctx, GLuint name);
+new_transform_feedback(struct gl_context *ctx, GLuint name);
static void
-delete_transform_feedback(GLcontext *ctx,
+delete_transform_feedback(struct gl_context *ctx,
struct gl_transform_feedback_object *obj);
/* dummy per-context init/clean-up for transform feedback */
void
-_mesa_init_transform_feedback(GLcontext *ctx)
+_mesa_init_transform_feedback(struct gl_context *ctx)
{
ctx->TransformFeedback.DefaultObject = new_transform_feedback(ctx, 0);
ctx->TransformFeedback.CurrentObject = ctx->TransformFeedback.DefaultObject;
}
void
-_mesa_free_transform_feedback(GLcontext *ctx)
+_mesa_free_transform_feedback(struct gl_context *ctx)
{
_mesa_reference_buffer_object(ctx,
&ctx->TransformFeedback.CurrentBuffer,
/** Default fallback for ctx->Driver.NewTransformFeedback() */
static struct gl_transform_feedback_object *
-new_transform_feedback(GLcontext *ctx, GLuint name)
+new_transform_feedback(struct gl_context *ctx, GLuint name)
{
struct gl_transform_feedback_object *obj;
obj = CALLOC_STRUCT(gl_transform_feedback_object);
/** Default fallback for ctx->Driver.DeleteTransformFeedback() */
static void
-delete_transform_feedback(GLcontext *ctx,
+delete_transform_feedback(struct gl_context *ctx,
struct gl_transform_feedback_object *obj)
{
GLuint i;
/** Default fallback for ctx->Driver.BeginTransformFeedback() */
static void
-begin_transform_feedback(GLcontext *ctx, GLenum mode,
+begin_transform_feedback(struct gl_context *ctx, GLenum mode,
struct gl_transform_feedback_object *obj)
{
/* nop */
/** Default fallback for ctx->Driver.EndTransformFeedback() */
static void
-end_transform_feedback(GLcontext *ctx,
+end_transform_feedback(struct gl_context *ctx,
struct gl_transform_feedback_object *obj)
{
/* nop */
/** Default fallback for ctx->Driver.PauseTransformFeedback() */
static void
-pause_transform_feedback(GLcontext *ctx,
+pause_transform_feedback(struct gl_context *ctx,
struct gl_transform_feedback_object *obj)
{
/* nop */
/** Default fallback for ctx->Driver.ResumeTransformFeedback() */
static void
-resume_transform_feedback(GLcontext *ctx,
+resume_transform_feedback(struct gl_context *ctx,
struct gl_transform_feedback_object *obj)
{
/* nop */
/** Default fallback for ctx->Driver.DrawTransformFeedback() */
static void
-draw_transform_feedback(GLcontext *ctx, GLenum mode,
+draw_transform_feedback(struct gl_context *ctx, GLenum mode,
struct gl_transform_feedback_object *obj)
{
/* XXX to do */
* Helper used by BindBufferRange() and BindBufferBase().
*/
static void
-bind_buffer_range(GLcontext *ctx, GLuint index,
+bind_buffer_range(struct gl_context *ctx, GLuint index,
struct gl_buffer_object *bufObj,
GLintptr offset, GLsizeiptr size)
{
static struct gl_transform_feedback_object *
-lookup_transform_feedback_object(GLcontext *ctx, GLuint name)
+lookup_transform_feedback_object(struct gl_context *ctx, GLuint name)
{
if (name == 0) {
return ctx->TransformFeedback.DefaultObject;
extern void
-_mesa_init_transform_feedback(GLcontext *ctx);
+_mesa_init_transform_feedback(struct gl_context *ctx);
extern void
-_mesa_free_transform_feedback(GLcontext *ctx);
+_mesa_free_transform_feedback(struct gl_context *ctx);
#if FEATURE_EXT_transform_feedback
extern GLboolean
-_mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode);
+_mesa_validate_primitive_mode(struct gl_context *ctx, GLenum mode);
extern GLboolean
-_mesa_validate_transform_feedback_buffers(GLcontext *ctx);
+_mesa_validate_transform_feedback_buffers(struct gl_context *ctx);
extern void
#else /* FEATURE_EXT_transform_feedback */
static INLINE GLboolean
-_mesa_validate_primitive_mode(GLcontext *ctx, GLenum mode)
+_mesa_validate_primitive_mode(struct gl_context *ctx, GLenum mode)
{
return GL_TRUE;
}
static INLINE GLboolean
-_mesa_validate_transform_feedback_buffers(GLcontext *ctx)
+_mesa_validate_transform_feedback_buffers(struct gl_context *ctx)
{
return GL_TRUE;
}
*
* Copyright (C) 2004-2008 Brian Paul All Rights Reserved.
* Copyright (C) 2009-2010 VMware, Inc. All Rights Reserved.
+ * Copyright © 2010 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#include "program/prog_parameter.h"
#include "program/prog_statevars.h"
#include "program/prog_uniform.h"
-
+#include "program/prog_instruction.h"
static GLenum
}
}
+static struct gl_builtin_uniform_element gl_DepthRange_elements[] = {
+ {"near", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_XXXX},
+ {"far", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_YYYY},
+ {"diff", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_ZZZZ},
+};
+
+static struct gl_builtin_uniform_element gl_ClipPlane_elements[] = {
+ {NULL, {STATE_CLIPPLANE, 0, 0}, SWIZZLE_XYZW}
+};
+
+static struct gl_builtin_uniform_element gl_Point_elements[] = {
+ {"size", {STATE_POINT_SIZE}, SWIZZLE_XXXX},
+ {"sizeMin", {STATE_POINT_SIZE}, SWIZZLE_YYYY},
+ {"sizeMax", {STATE_POINT_SIZE}, SWIZZLE_ZZZZ},
+ {"fadeThresholdSize", {STATE_POINT_SIZE}, SWIZZLE_WWWW},
+ {"distanceConstantAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_XXXX},
+ {"distanceLinearAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_YYYY},
+ {"distanceQuadraticAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_ZZZZ},
+};
+
+static struct gl_builtin_uniform_element gl_FrontMaterial_elements[] = {
+ {"emission", {STATE_MATERIAL, 0, STATE_EMISSION}, SWIZZLE_XYZW},
+ {"ambient", {STATE_MATERIAL, 0, STATE_AMBIENT}, SWIZZLE_XYZW},
+ {"diffuse", {STATE_MATERIAL, 0, STATE_DIFFUSE}, SWIZZLE_XYZW},
+ {"specular", {STATE_MATERIAL, 0, STATE_SPECULAR}, SWIZZLE_XYZW},
+ {"shininess", {STATE_MATERIAL, 0, STATE_SHININESS}, SWIZZLE_XXXX},
+};
+
+static struct gl_builtin_uniform_element gl_BackMaterial_elements[] = {
+ {"emission", {STATE_MATERIAL, 1, STATE_EMISSION}, SWIZZLE_XYZW},
+ {"ambient", {STATE_MATERIAL, 1, STATE_AMBIENT}, SWIZZLE_XYZW},
+ {"diffuse", {STATE_MATERIAL, 1, STATE_DIFFUSE}, SWIZZLE_XYZW},
+ {"specular", {STATE_MATERIAL, 1, STATE_SPECULAR}, SWIZZLE_XYZW},
+ {"shininess", {STATE_MATERIAL, 1, STATE_SHININESS}, SWIZZLE_XXXX},
+};
+
+static struct gl_builtin_uniform_element gl_LightSource_elements[] = {
+ {"ambient", {STATE_LIGHT, 0, STATE_AMBIENT}, SWIZZLE_XYZW},
+ {"diffuse", {STATE_LIGHT, 0, STATE_DIFFUSE}, SWIZZLE_XYZW},
+ {"specular", {STATE_LIGHT, 0, STATE_SPECULAR}, SWIZZLE_XYZW},
+ {"position", {STATE_LIGHT, 0, STATE_POSITION}, SWIZZLE_XYZW},
+ {"halfVector", {STATE_LIGHT, 0, STATE_HALF_VECTOR}, SWIZZLE_XYZW},
+ {"spotDirection", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION},
+ MAKE_SWIZZLE4(SWIZZLE_X,
+ SWIZZLE_Y,
+ SWIZZLE_Z,
+ SWIZZLE_Z)},
+ {"spotCosCutoff", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_WWWW},
+ {"spotCutoff", {STATE_LIGHT, 0, STATE_SPOT_CUTOFF}, SWIZZLE_XXXX},
+ {"spotExponent", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_WWWW},
+ {"constantAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_XXXX},
+ {"linearAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_YYYY},
+ {"quadraticAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_ZZZZ},
+};
+
+static struct gl_builtin_uniform_element gl_LightModel_elements[] = {
+ {"ambient", {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_FrontLightModelProduct_elements[] = {
+ {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 0}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_BackLightModelProduct_elements[] = {
+ {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 1}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_FrontLightProduct_elements[] = {
+ {"ambient", {STATE_LIGHTPROD, 0, 0, STATE_AMBIENT}, SWIZZLE_XYZW},
+ {"diffuse", {STATE_LIGHTPROD, 0, 0, STATE_DIFFUSE}, SWIZZLE_XYZW},
+ {"specular", {STATE_LIGHTPROD, 0, 0, STATE_SPECULAR}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_BackLightProduct_elements[] = {
+ {"ambient", {STATE_LIGHTPROD, 0, 1, STATE_AMBIENT}, SWIZZLE_XYZW},
+ {"diffuse", {STATE_LIGHTPROD, 0, 1, STATE_DIFFUSE}, SWIZZLE_XYZW},
+ {"specular", {STATE_LIGHTPROD, 0, 1, STATE_SPECULAR}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_TextureEnvColor_elements[] = {
+ {NULL, {STATE_TEXENV_COLOR, 0}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_EyePlaneS_elements[] = {
+ {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_S}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_EyePlaneT_elements[] = {
+ {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_T}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_EyePlaneR_elements[] = {
+ {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_R}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_EyePlaneQ_elements[] = {
+ {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_Q}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_ObjectPlaneS_elements[] = {
+ {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_S}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_ObjectPlaneT_elements[] = {
+ {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_T}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_ObjectPlaneR_elements[] = {
+ {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_R}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_ObjectPlaneQ_elements[] = {
+ {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_Q}, SWIZZLE_XYZW},
+};
+
+static struct gl_builtin_uniform_element gl_Fog_elements[] = {
+ {"color", {STATE_FOG_COLOR}, SWIZZLE_XYZW},
+ {"density", {STATE_FOG_PARAMS}, SWIZZLE_XXXX},
+ {"start", {STATE_FOG_PARAMS}, SWIZZLE_YYYY},
+ {"end", {STATE_FOG_PARAMS}, SWIZZLE_ZZZZ},
+ {"scale", {STATE_FOG_PARAMS}, SWIZZLE_WWWW},
+};
+
+static struct gl_builtin_uniform_element gl_NormalScale_elements[] = {
+ {NULL, {STATE_NORMAL_SCALE}, SWIZZLE_XXXX},
+};
+
+#define MATRIX(name, statevar, modifier) \
+ static struct gl_builtin_uniform_element name ## _elements[] = { \
+ { NULL, { statevar, 0, 0, 0, modifier}, SWIZZLE_XYZW }, \
+ { NULL, { statevar, 0, 1, 1, modifier}, SWIZZLE_XYZW }, \
+ { NULL, { statevar, 0, 2, 2, modifier}, SWIZZLE_XYZW }, \
+ { NULL, { statevar, 0, 3, 3, modifier}, SWIZZLE_XYZW }, \
+ }
+
+MATRIX(gl_ModelViewMatrix,
+ STATE_MODELVIEW_MATRIX, STATE_MATRIX_TRANSPOSE);
+MATRIX(gl_ModelViewMatrixInverse,
+ STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVTRANS);
+MATRIX(gl_ModelViewMatrixTranspose,
+ STATE_MODELVIEW_MATRIX, 0);
+MATRIX(gl_ModelViewMatrixInverseTranspose,
+ STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE);
+
+MATRIX(gl_ProjectionMatrix,
+ STATE_PROJECTION_MATRIX, STATE_MATRIX_TRANSPOSE);
+MATRIX(gl_ProjectionMatrixInverse,
+ STATE_PROJECTION_MATRIX, STATE_MATRIX_INVTRANS);
+MATRIX(gl_ProjectionMatrixTranspose,
+ STATE_PROJECTION_MATRIX, 0);
+MATRIX(gl_ProjectionMatrixInverseTranspose,
+ STATE_PROJECTION_MATRIX, STATE_MATRIX_INVERSE);
+
+MATRIX(gl_ModelViewProjectionMatrix,
+ STATE_MVP_MATRIX, STATE_MATRIX_TRANSPOSE);
+MATRIX(gl_ModelViewProjectionMatrixInverse,
+ STATE_MVP_MATRIX, STATE_MATRIX_INVTRANS);
+MATRIX(gl_ModelViewProjectionMatrixTranspose,
+ STATE_MVP_MATRIX, 0);
+MATRIX(gl_ModelViewProjectionMatrixInverseTranspose,
+ STATE_MVP_MATRIX, STATE_MATRIX_INVERSE);
+
+MATRIX(gl_TextureMatrix,
+ STATE_TEXTURE_MATRIX, STATE_MATRIX_TRANSPOSE);
+MATRIX(gl_TextureMatrixInverse,
+ STATE_TEXTURE_MATRIX, STATE_MATRIX_INVTRANS);
+MATRIX(gl_TextureMatrixTranspose,
+ STATE_TEXTURE_MATRIX, 0);
+MATRIX(gl_TextureMatrixInverseTranspose,
+ STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE);
+
+static struct gl_builtin_uniform_element gl_NormalMatrix_elements[] = {
+ { NULL, { STATE_MODELVIEW_MATRIX, 0, 0, 0, STATE_MATRIX_INVERSE},
+ SWIZZLE_XYZW },
+ { NULL, { STATE_MODELVIEW_MATRIX, 0, 1, 1, STATE_MATRIX_INVERSE},
+ SWIZZLE_XYZW },
+ { NULL, { STATE_MODELVIEW_MATRIX, 0, 2, 2, STATE_MATRIX_INVERSE},
+ SWIZZLE_XYZW },
+};
+
+#undef MATRIX
+
+#define STATEVAR(name) {#name, name ## _elements, Elements(name ## _elements)}
+
+const struct gl_builtin_uniform_desc _mesa_builtin_uniform_desc[] = {
+ STATEVAR(gl_DepthRange),
+ STATEVAR(gl_ClipPlane),
+ STATEVAR(gl_Point),
+ STATEVAR(gl_FrontMaterial),
+ STATEVAR(gl_BackMaterial),
+ STATEVAR(gl_LightSource),
+ STATEVAR(gl_LightModel),
+ STATEVAR(gl_FrontLightModelProduct),
+ STATEVAR(gl_BackLightModelProduct),
+ STATEVAR(gl_FrontLightProduct),
+ STATEVAR(gl_BackLightProduct),
+ STATEVAR(gl_TextureEnvColor),
+ STATEVAR(gl_EyePlaneS),
+ STATEVAR(gl_EyePlaneT),
+ STATEVAR(gl_EyePlaneR),
+ STATEVAR(gl_EyePlaneQ),
+ STATEVAR(gl_ObjectPlaneS),
+ STATEVAR(gl_ObjectPlaneT),
+ STATEVAR(gl_ObjectPlaneR),
+ STATEVAR(gl_ObjectPlaneQ),
+ STATEVAR(gl_Fog),
+
+ STATEVAR(gl_ModelViewMatrix),
+ STATEVAR(gl_ModelViewMatrixInverse),
+ STATEVAR(gl_ModelViewMatrixTranspose),
+ STATEVAR(gl_ModelViewMatrixInverseTranspose),
+
+ STATEVAR(gl_ProjectionMatrix),
+ STATEVAR(gl_ProjectionMatrixInverse),
+ STATEVAR(gl_ProjectionMatrixTranspose),
+ STATEVAR(gl_ProjectionMatrixInverseTranspose),
+
+ STATEVAR(gl_ModelViewProjectionMatrix),
+ STATEVAR(gl_ModelViewProjectionMatrixInverse),
+ STATEVAR(gl_ModelViewProjectionMatrixTranspose),
+ STATEVAR(gl_ModelViewProjectionMatrixInverseTranspose),
+
+ STATEVAR(gl_TextureMatrix),
+ STATEVAR(gl_TextureMatrixInverse),
+ STATEVAR(gl_TextureMatrixTranspose),
+ STATEVAR(gl_TextureMatrixInverseTranspose),
+
+ STATEVAR(gl_NormalMatrix),
+ STATEVAR(gl_NormalScale),
+
+ {NULL, NULL, 0}
+};
static GLboolean
is_boolean_type(GLenum type)
* Called by glGetActiveUniform().
*/
static void
-_mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index,
+_mesa_get_active_uniform(struct gl_context *ctx, GLuint program, GLuint index,
GLsizei maxLength, GLsizei *length, GLint *size,
GLenum *type, GLchar *nameOut)
{
* to the shader program and return the program parameter position.
*/
static void
-lookup_uniform_parameter(GLcontext *ctx, GLuint program, GLint location,
+lookup_uniform_parameter(struct gl_context *ctx, GLuint program, GLint location,
struct gl_program **progOut, GLint *paramPosOut)
{
struct gl_shader_program *shProg
* Called via glGetUniformfv().
*/
static void
-_mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
+_mesa_get_uniformfv(struct gl_context *ctx, GLuint program, GLint location,
GLfloat *params)
{
struct gl_program *prog;
* \sa _mesa_get_uniformfv, only difference is a cast.
*/
static void
-_mesa_get_uniformiv(GLcontext *ctx, GLuint program, GLint location,
+_mesa_get_uniformiv(struct gl_context *ctx, GLuint program, GLint location,
GLint *params)
{
struct gl_program *prog;
* offset (used for arrays, structs).
*/
GLint
-_mesa_get_uniform_location(GLcontext *ctx, struct gl_shader_program *shProg,
+_mesa_get_uniform_location(struct gl_context *ctx, struct gl_shader_program *shProg,
const GLchar *name)
{
GLint offset = 0, location = -1;
* \param values the new values, of datatype 'type'
*/
static void
-set_program_uniform(GLcontext *ctx, struct gl_program *program,
+set_program_uniform(struct gl_context *ctx, struct gl_program *program,
GLint index, GLint offset,
GLenum type, GLsizei count, GLint elems,
const void *values)
* Called via glUniform*() functions.
*/
void
-_mesa_uniform(GLcontext *ctx, struct gl_shader_program *shProg,
+_mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
GLint location, GLsizei count,
const GLvoid *values, GLenum type)
{
* Set a matrix-valued program parameter.
*/
static void
-set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program,
+set_program_uniform_matrix(struct gl_context *ctx, struct gl_program *program,
GLuint index, GLuint offset,
GLuint count, GLuint rows, GLuint cols,
GLboolean transpose, const GLfloat *values)
* Note: cols=2, rows=4 ==> array[2] of vec4
*/
void
-_mesa_uniform_matrix(GLcontext *ctx, struct gl_shader_program *shProg,
+_mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
GLint cols, GLint rows,
GLint location, GLsizei count,
GLboolean transpose, const GLfloat *values)
#define UNIFORMS_H
#include "glheader.h"
+#include "program/prog_parameter.h"
struct gl_program;
struct _glapi_table;
_mesa_GetUniformLocationARB(GLhandleARB, const GLcharARB *);
GLint
-_mesa_get_uniform_location(GLcontext *ctx, struct gl_shader_program *shProg,
+_mesa_get_uniform_location(struct gl_context *ctx, struct gl_shader_program *shProg,
const GLchar *name);
void
-_mesa_uniform(GLcontext *ctx, struct gl_shader_program *shader_program,
+_mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shader_program,
GLint location, GLsizei count,
const GLvoid *values, GLenum type);
void
-_mesa_uniform_matrix(GLcontext *ctx, struct gl_shader_program *shProg,
+_mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
GLint cols, GLint rows,
GLint location, GLsizei count,
GLboolean transpose, const GLfloat *values);
extern void
_mesa_init_shader_uniform_dispatch(struct _glapi_table *exec);
+struct gl_builtin_uniform_element {
+ const char *field;
+ int tokens[STATE_LENGTH];
+ int swizzle;
+};
+
+struct gl_builtin_uniform_desc {
+ const char *name;
+ struct gl_builtin_uniform_element *elements;
+ unsigned int num_elements;
+};
+
+extern const struct gl_builtin_uniform_desc _mesa_builtin_uniform_desc[];
+
#endif /* UNIFORMS_H */
* \param ptr the address (or offset inside VBO) of the array data
*/
static void
-update_array(GLcontext *ctx, struct gl_client_array *array,
+update_array(struct gl_context *ctx, struct gl_client_array *array,
GLbitfield dirtyBit, GLsizei elementSize,
GLint size, GLenum type, GLenum format,
GLsizei stride, GLboolean normalized, const GLvoid *ptr)
* not handle the 4-element GL_CURRENT_VERTEX_ATTRIB_ARB query.
*/
static GLuint
-get_vertex_array_attrib(GLcontext *ctx, GLuint index, GLenum pname,
+get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname,
const char *caller)
{
const struct gl_client_array *array;
* Copy one client vertex array to another.
*/
void
-_mesa_copy_client_array(GLcontext *ctx,
+_mesa_copy_client_array(struct gl_context *ctx,
struct gl_client_array *dst,
struct gl_client_array *src)
{
* Print current vertex object/array info. For debug.
*/
void
-_mesa_print_arrays(GLcontext *ctx)
+_mesa_print_arrays(struct gl_context *ctx)
{
struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
GLuint i;
* Initialize vertex array state for given context.
*/
void
-_mesa_init_varray(GLcontext *ctx)
+_mesa_init_varray(struct gl_context *ctx)
{
ctx->Array.DefaultArrayObj = _mesa_new_array_object(ctx, 0);
_mesa_reference_array_object(ctx, &ctx->Array.ArrayObj,
delete_arrayobj_cb(GLuint id, void *data, void *userData)
{
struct gl_array_object *arrayObj = (struct gl_array_object *) data;
- GLcontext *ctx = (GLcontext *) userData;
+ struct gl_context *ctx = (struct gl_context *) userData;
_mesa_delete_array_object(ctx, arrayObj);
}
* Free vertex array state for given context.
*/
void
-_mesa_free_varray_data(GLcontext *ctx)
+_mesa_free_varray_data(struct gl_context *ctx)
{
_mesa_HashDeleteAll(ctx->Array.Objects, delete_arrayobj_cb, ctx);
_mesa_DeleteHashTable(ctx->Array.Objects);
extern void
-_mesa_copy_client_array(GLcontext *ctx,
+_mesa_copy_client_array(struct gl_context *ctx,
struct gl_client_array *dst,
struct gl_client_array *src);
extern void
-_mesa_print_arrays(GLcontext *ctx);
+_mesa_print_arrays(struct gl_context *ctx);
extern void
-_mesa_init_varray( GLcontext * ctx );
+_mesa_init_varray( struct gl_context * ctx );
extern void
-_mesa_free_varray_data(GLcontext *ctx);
+_mesa_free_varray_data(struct gl_context *ctx);
#else
* Return major and minor version numbers.
*/
static void
-compute_version(GLcontext *ctx)
+compute_version(struct gl_context *ctx)
{
GLuint major, minor;
static const int max = 100;
ctx->Extensions.ARB_map_buffer_range &&
ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_texture_rg &&
+ ctx->Extensions.ARB_texture_compression_rgtc &&
ctx->Extensions.APPLE_vertex_array_object &&
ctx->Extensions.EXT_draw_buffers2 &&
ctx->Extensions.EXT_framebuffer_blit &&
ctx->Extensions.EXT_packed_depth_stencil &&
ctx->Extensions.EXT_packed_float &&
ctx->Extensions.EXT_texture_array &&
- ctx->Extensions.EXT_texture_compression_rgtc &&
ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.EXT_texture_shared_exponent &&
ctx->Extensions.EXT_transform_feedback &&
}
static void
-compute_version_es1(GLcontext *ctx)
+compute_version_es1(struct gl_context *ctx)
{
static const int max = 100;
}
static void
-compute_version_es2(GLcontext *ctx)
+compute_version_es2(struct gl_context *ctx)
{
static const int max = 100;
* or to perform version check for GLX_ARB_create_context_profile.
*/
void
-_mesa_compute_version(GLcontext *ctx)
+_mesa_compute_version(struct gl_context *ctx)
{
if (ctx->VersionMajor)
return;
extern void
-_mesa_compute_version(GLcontext *ctx);
+_mesa_compute_version(struct gl_context *ctx);
#endif /* VERSION_H */
* \param height height of the viewport rectangle.
*/
void
-_mesa_set_viewport(GLcontext *ctx, GLint x, GLint y,
+_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height)
{
if (MESA_VERBOSE & VERBOSE_API)
* Initialize the context viewport attribute group.
* \param ctx the GL context.
*/
-void _mesa_init_viewport(GLcontext *ctx)
+void _mesa_init_viewport(struct gl_context *ctx)
{
GLfloat depthMax = 65535.0F; /* sorf of arbitrary */
* Free the context viewport attribute group data.
* \param ctx the GL context.
*/
-void _mesa_free_viewport_data(GLcontext *ctx)
+void _mesa_free_viewport_data(struct gl_context *ctx)
{
_math_matrix_dtr(&ctx->Viewport._WindowMap);
}
extern void
-_mesa_set_viewport(GLcontext *ctx, GLint x, GLint y,
+_mesa_set_viewport(struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height);
extern void
-_mesa_init_viewport(GLcontext *ctx);
+_mesa_init_viewport(struct gl_context *ctx);
extern void
-_mesa_free_viewport_data(GLcontext *ctx);
+_mesa_free_viewport_data(struct gl_context *ctx);
#endif
#include "vtxfmt.h"
#include "eval.h"
#include "dlist.h"
+#include "main/dispatch.h"
#if FEATURE_beginend
-
-/* The neutral vertex format. This wraps all tnl module functions,
- * verifying that the currently-installed module is valid and then
- * installing the function pointers in a lazy fashion. It records the
- * function pointers that have been swapped out, which allows a fast
- * restoration of the neutral module in almost all cases -- a typical
- * app might only require 4-6 functions to be modified from the neutral
- * baseline, and only restoring these is certainly preferable to doing
- * the entire module's 60 or so function pointers.
- */
-
-#define PRE_LOOPBACK( FUNC ) \
-{ \
- GET_CURRENT_CONTEXT(ctx); \
- struct gl_tnl_module * const tnl = &(ctx->TnlModule); \
- const int tmp_offset = _gloffset_ ## FUNC ; \
- \
- ASSERT( tnl->Current ); \
- ASSERT( tnl->SwapCount < NUM_VERTEX_FORMAT_ENTRIES ); \
- ASSERT( tmp_offset >= 0 ); \
- \
- if (tnl->SwapCount == 0) \
- ctx->Driver.BeginVertices( ctx ); \
- \
- /* Save the swapped function's dispatch entry so it can be */ \
- /* restored later. */ \
- tnl->Swapped[tnl->SwapCount].location = & (((_glapi_proc *)ctx->Exec)[tmp_offset]); \
- tnl->Swapped[tnl->SwapCount].function = (_glapi_proc)TAG(FUNC); \
- tnl->SwapCount++; \
- \
- if ( 0 ) \
- _mesa_debug(ctx, " swapping gl" #FUNC"...\n" ); \
- \
- /* Install the tnl function pointer. */ \
- SET_ ## FUNC(ctx->Exec, tnl->Current->FUNC); \
-}
-
-#define TAG(x) neutral_##x
-#include "vtxfmt_tmp.h"
-
-
/**
* Use the per-vertex functions found in <vfmt> to initialze the given
* API dispatch table.
}
-void _mesa_init_exec_vtxfmt( GLcontext *ctx )
+void _mesa_install_exec_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt )
{
- install_vtxfmt( ctx->Exec, &neutral_vtxfmt );
- ctx->TnlModule.SwapCount = 0;
+ if (ctx->API == API_OPENGL)
+ install_vtxfmt( ctx->Exec, vfmt );
}
-void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
+void _mesa_install_save_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt )
{
- ctx->TnlModule.Current = vfmt;
- _mesa_restore_exec_vtxfmt( ctx );
-}
-
-
-void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
-{
- install_vtxfmt( ctx->Save, vfmt );
-}
-
-
-void _mesa_restore_exec_vtxfmt( GLcontext *ctx )
-{
- struct gl_tnl_module *tnl = &(ctx->TnlModule);
- GLuint i;
-
- /* Restore the neutral tnl module wrapper.
- */
- for ( i = 0 ; i < tnl->SwapCount ; i++ ) {
- *(tnl->Swapped[i].location) = tnl->Swapped[i].function;
- }
-
- tnl->SwapCount = 0;
+ if (ctx->API == API_OPENGL)
+ install_vtxfmt( ctx->Save, vfmt );
}
#if FEATURE_beginend
-extern void _mesa_init_exec_vtxfmt( GLcontext *ctx );
-
-extern void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt );
-extern void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt );
-
-extern void _mesa_restore_exec_vtxfmt( GLcontext *ctx );
+extern void _mesa_install_exec_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt );
+extern void _mesa_install_save_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt );
#else /* FEATURE_beginend */
static INLINE void
-_mesa_init_exec_vtxfmt( GLcontext *ctx )
-{
-}
-
-static INLINE void
-_mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
-{
-}
-
-static INLINE void
-_mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
+_mesa_install_exec_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt )
{
}
static INLINE void
-_mesa_restore_exec_vtxfmt( GLcontext *ctx )
+_mesa_install_save_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt )
{
}
char buf[100];
sprintf( buf, "%s[%d] failed test (%s)",
cnames[np], psize, description );
- _mesa_problem( NULL, buf );
+ _mesa_problem( NULL, "%s", buf );
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile )
char buf[100];
sprintf( buf, "_mesa_normal_tab[0][%s] failed test (%s)",
norm_strings[mtype], description );
- _mesa_problem( NULL, buf );
+ _mesa_problem( NULL, "%s", buf );
}
#ifdef RUN_DEBUG_BENCHMARK
char buf[100];
sprintf(buf, "_mesa_transform_tab[0][%d][%s] failed test (%s)",
psize, mstrings[mtype], description );
- _mesa_problem( NULL, buf );
+ _mesa_problem( NULL, "%s", buf );
}
#ifdef RUN_DEBUG_BENCHMARK
if ( mesa_profile )
#include "main/glheader.h"
#include "main/imports.h"
#include "main/macros.h"
-#include "main/imports.h"
#include "m_matrix.h"
#include "main/glheader.h"
#include "main/imports.h"
#include "main/macros.h"
-#include "main/imports.h"
#include "m_vector.h"
void
-_mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
+_mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
const GLvoid *str, GLsizei len,
struct gl_fragment_program *program)
{
* object unchanged.
*/
void
-_mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target,
+_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
const GLvoid *str, GLsizei len,
struct gl_vertex_program *program)
{
#include "main/mtypes.h"
extern void
-_mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target,
+_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
const GLvoid *str, GLsizei len,
struct gl_vertex_program *program);
extern void
-_mesa_parse_arb_fragment_program(GLcontext *ctx, GLenum target,
+_mesa_parse_arb_fragment_program(struct gl_context *ctx, GLenum target,
const GLvoid *str, GLsizei len,
struct gl_fragment_program *program);
/**
* \file ir_to_mesa.cpp
*
- * Translates the IR to ARB_fragment_program text if possible,
- * printing the result
+ * Translate GLSL IR to Mesa's gl_program representation.
*/
#include <stdio.h>
#include "program/program.h"
#include "program/prog_uniform.h"
#include "program/prog_parameter.h"
+#include "program/sampler.h"
}
static int swizzle_for_size(int size);
function_entry *current_function;
- GLcontext *ctx;
+ struct gl_context *ctx;
struct gl_program *prog;
struct gl_shader_program *shader_program;
struct gl_shader_compiler_options *options;
GLboolean try_emit_mad(ir_expression *ir,
int mul_operand);
- int get_sampler_uniform_value(ir_dereference *deref);
-
void *mem_ctx;
};
PROGRAM_ADDRESS, 0, WRITEMASK_X, COND_TR, NULL
};
-static void fail_link(struct gl_shader_program *prog, const char *fmt, ...) PRINTFLIKE(2, 3);
+static void
+fail_link(struct gl_shader_program *prog, const char *fmt, ...) PRINTFLIKE(2, 3);
-static void fail_link(struct gl_shader_program *prog, const char *fmt, ...)
- {
- va_list args;
- va_start(args, fmt);
- prog->InfoLog = talloc_vasprintf_append(prog->InfoLog, fmt, args);
- va_end(args);
+static void
+fail_link(struct gl_shader_program *prog, const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ prog->InfoLog = talloc_vasprintf_append(prog->InfoLog, fmt, args);
+ va_end(args);
- prog->LinkStatus = GL_FALSE;
- }
+ prog->LinkStatus = GL_FALSE;
+}
-static int swizzle_for_size(int size)
+static int
+swizzle_for_size(int size)
{
int size_swizzles[4] = {
MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X),
MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W),
};
+ assert((size >= 1) && (size <= 4));
return size_swizzles[size - 1];
}
return NULL;
}
-struct statevar_element {
- const char *field;
- int tokens[STATE_LENGTH];
- int swizzle;
-};
-
-static struct statevar_element gl_DepthRange_elements[] = {
- {"near", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_XXXX},
- {"far", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_YYYY},
- {"diff", {STATE_DEPTH_RANGE, 0, 0}, SWIZZLE_ZZZZ},
-};
-
-static struct statevar_element gl_ClipPlane_elements[] = {
- {NULL, {STATE_CLIPPLANE, 0, 0}, SWIZZLE_XYZW}
-};
-
-static struct statevar_element gl_Point_elements[] = {
- {"size", {STATE_POINT_SIZE}, SWIZZLE_XXXX},
- {"sizeMin", {STATE_POINT_SIZE}, SWIZZLE_YYYY},
- {"sizeMax", {STATE_POINT_SIZE}, SWIZZLE_ZZZZ},
- {"fadeThresholdSize", {STATE_POINT_SIZE}, SWIZZLE_WWWW},
- {"distanceConstantAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_XXXX},
- {"distanceLinearAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_YYYY},
- {"distanceQuadraticAttenuation", {STATE_POINT_ATTENUATION}, SWIZZLE_ZZZZ},
-};
-
-static struct statevar_element gl_FrontMaterial_elements[] = {
- {"emission", {STATE_MATERIAL, 0, STATE_EMISSION}, SWIZZLE_XYZW},
- {"ambient", {STATE_MATERIAL, 0, STATE_AMBIENT}, SWIZZLE_XYZW},
- {"diffuse", {STATE_MATERIAL, 0, STATE_DIFFUSE}, SWIZZLE_XYZW},
- {"specular", {STATE_MATERIAL, 0, STATE_SPECULAR}, SWIZZLE_XYZW},
- {"shininess", {STATE_MATERIAL, 0, STATE_SHININESS}, SWIZZLE_XXXX},
-};
-
-static struct statevar_element gl_BackMaterial_elements[] = {
- {"emission", {STATE_MATERIAL, 1, STATE_EMISSION}, SWIZZLE_XYZW},
- {"ambient", {STATE_MATERIAL, 1, STATE_AMBIENT}, SWIZZLE_XYZW},
- {"diffuse", {STATE_MATERIAL, 1, STATE_DIFFUSE}, SWIZZLE_XYZW},
- {"specular", {STATE_MATERIAL, 1, STATE_SPECULAR}, SWIZZLE_XYZW},
- {"shininess", {STATE_MATERIAL, 1, STATE_SHININESS}, SWIZZLE_XXXX},
-};
-
-static struct statevar_element gl_LightSource_elements[] = {
- {"ambient", {STATE_LIGHT, 0, STATE_AMBIENT}, SWIZZLE_XYZW},
- {"diffuse", {STATE_LIGHT, 0, STATE_DIFFUSE}, SWIZZLE_XYZW},
- {"specular", {STATE_LIGHT, 0, STATE_SPECULAR}, SWIZZLE_XYZW},
- {"position", {STATE_LIGHT, 0, STATE_POSITION}, SWIZZLE_XYZW},
- {"halfVector", {STATE_LIGHT, 0, STATE_HALF_VECTOR}, SWIZZLE_XYZW},
- {"spotDirection", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_XYZW},
- {"spotCosCutoff", {STATE_LIGHT, 0, STATE_SPOT_DIRECTION}, SWIZZLE_WWWW},
- {"spotCutoff", {STATE_LIGHT, 0, STATE_SPOT_CUTOFF}, SWIZZLE_XXXX},
- {"spotExponent", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_WWWW},
- {"constantAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_XXXX},
- {"linearAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_YYYY},
- {"quadraticAttenuation", {STATE_LIGHT, 0, STATE_ATTENUATION}, SWIZZLE_ZZZZ},
-};
-
-static struct statevar_element gl_LightModel_elements[] = {
- {"ambient", {STATE_LIGHTMODEL_AMBIENT, 0}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_FrontLightModelProduct_elements[] = {
- {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 0}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_BackLightModelProduct_elements[] = {
- {"sceneColor", {STATE_LIGHTMODEL_SCENECOLOR, 1}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_FrontLightProduct_elements[] = {
- {"ambient", {STATE_LIGHTPROD, 0, 0, STATE_AMBIENT}, SWIZZLE_XYZW},
- {"diffuse", {STATE_LIGHTPROD, 0, 0, STATE_DIFFUSE}, SWIZZLE_XYZW},
- {"specular", {STATE_LIGHTPROD, 0, 0, STATE_SPECULAR}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_BackLightProduct_elements[] = {
- {"ambient", {STATE_LIGHTPROD, 0, 1, STATE_AMBIENT}, SWIZZLE_XYZW},
- {"diffuse", {STATE_LIGHTPROD, 0, 1, STATE_DIFFUSE}, SWIZZLE_XYZW},
- {"specular", {STATE_LIGHTPROD, 0, 1, STATE_SPECULAR}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_TextureEnvColor_elements[] = {
- {NULL, {STATE_TEXENV_COLOR, 0}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_EyePlaneS_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_S}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_EyePlaneT_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_T}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_EyePlaneR_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_R}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_EyePlaneQ_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_EYE_Q}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_ObjectPlaneS_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_S}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_ObjectPlaneT_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_T}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_ObjectPlaneR_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_R}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_ObjectPlaneQ_elements[] = {
- {NULL, {STATE_TEXGEN, 0, STATE_TEXGEN_OBJECT_Q}, SWIZZLE_XYZW},
-};
-
-static struct statevar_element gl_Fog_elements[] = {
- {"color", {STATE_FOG_COLOR}, SWIZZLE_XYZW},
- {"density", {STATE_FOG_PARAMS}, SWIZZLE_XXXX},
- {"start", {STATE_FOG_PARAMS}, SWIZZLE_YYYY},
- {"end", {STATE_FOG_PARAMS}, SWIZZLE_ZZZZ},
- {"scale", {STATE_FOG_PARAMS}, SWIZZLE_WWWW},
-};
-
-static struct statevar_element gl_NormalScale_elements[] = {
- {NULL, {STATE_NORMAL_SCALE}, SWIZZLE_XXXX},
-};
-
-#define MATRIX(name, statevar, modifier) \
- static struct statevar_element name ## _elements[] = { \
- { NULL, { statevar, 0, 0, 0, modifier}, SWIZZLE_XYZW }, \
- { NULL, { statevar, 0, 1, 1, modifier}, SWIZZLE_XYZW }, \
- { NULL, { statevar, 0, 2, 2, modifier}, SWIZZLE_XYZW }, \
- { NULL, { statevar, 0, 3, 3, modifier}, SWIZZLE_XYZW }, \
- }
-
-MATRIX(gl_ModelViewMatrix,
- STATE_MODELVIEW_MATRIX, STATE_MATRIX_TRANSPOSE);
-MATRIX(gl_ModelViewMatrixInverse,
- STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVTRANS);
-MATRIX(gl_ModelViewMatrixTranspose,
- STATE_MODELVIEW_MATRIX, 0);
-MATRIX(gl_ModelViewMatrixInverseTranspose,
- STATE_MODELVIEW_MATRIX, STATE_MATRIX_INVERSE);
-
-MATRIX(gl_ProjectionMatrix,
- STATE_PROJECTION_MATRIX, STATE_MATRIX_TRANSPOSE);
-MATRIX(gl_ProjectionMatrixInverse,
- STATE_PROJECTION_MATRIX, STATE_MATRIX_INVTRANS);
-MATRIX(gl_ProjectionMatrixTranspose,
- STATE_PROJECTION_MATRIX, 0);
-MATRIX(gl_ProjectionMatrixInverseTranspose,
- STATE_PROJECTION_MATRIX, STATE_MATRIX_INVERSE);
-
-MATRIX(gl_ModelViewProjectionMatrix,
- STATE_MVP_MATRIX, STATE_MATRIX_TRANSPOSE);
-MATRIX(gl_ModelViewProjectionMatrixInverse,
- STATE_MVP_MATRIX, STATE_MATRIX_INVTRANS);
-MATRIX(gl_ModelViewProjectionMatrixTranspose,
- STATE_MVP_MATRIX, 0);
-MATRIX(gl_ModelViewProjectionMatrixInverseTranspose,
- STATE_MVP_MATRIX, STATE_MATRIX_INVERSE);
-
-MATRIX(gl_TextureMatrix,
- STATE_TEXTURE_MATRIX, STATE_MATRIX_TRANSPOSE);
-MATRIX(gl_TextureMatrixInverse,
- STATE_TEXTURE_MATRIX, STATE_MATRIX_INVTRANS);
-MATRIX(gl_TextureMatrixTranspose,
- STATE_TEXTURE_MATRIX, 0);
-MATRIX(gl_TextureMatrixInverseTranspose,
- STATE_TEXTURE_MATRIX, STATE_MATRIX_INVERSE);
-
-static struct statevar_element gl_NormalMatrix_elements[] = {
- { NULL, { STATE_MODELVIEW_MATRIX, 0, 0, 0, STATE_MATRIX_INVERSE},
- SWIZZLE_XYZW },
- { NULL, { STATE_MODELVIEW_MATRIX, 0, 1, 1, STATE_MATRIX_INVERSE},
- SWIZZLE_XYZW },
- { NULL, { STATE_MODELVIEW_MATRIX, 0, 2, 2, STATE_MATRIX_INVERSE},
- SWIZZLE_XYZW },
-};
-
-#undef MATRIX
-
-#define STATEVAR(name) {#name, name ## _elements, Elements(name ## _elements)}
-
-static const struct statevar {
- const char *name;
- struct statevar_element *elements;
- unsigned int num_elements;
-} statevars[] = {
- STATEVAR(gl_DepthRange),
- STATEVAR(gl_ClipPlane),
- STATEVAR(gl_Point),
- STATEVAR(gl_FrontMaterial),
- STATEVAR(gl_BackMaterial),
- STATEVAR(gl_LightSource),
- STATEVAR(gl_LightModel),
- STATEVAR(gl_FrontLightModelProduct),
- STATEVAR(gl_BackLightModelProduct),
- STATEVAR(gl_FrontLightProduct),
- STATEVAR(gl_BackLightProduct),
- STATEVAR(gl_TextureEnvColor),
- STATEVAR(gl_EyePlaneS),
- STATEVAR(gl_EyePlaneT),
- STATEVAR(gl_EyePlaneR),
- STATEVAR(gl_EyePlaneQ),
- STATEVAR(gl_ObjectPlaneS),
- STATEVAR(gl_ObjectPlaneT),
- STATEVAR(gl_ObjectPlaneR),
- STATEVAR(gl_ObjectPlaneQ),
- STATEVAR(gl_Fog),
-
- STATEVAR(gl_ModelViewMatrix),
- STATEVAR(gl_ModelViewMatrixInverse),
- STATEVAR(gl_ModelViewMatrixTranspose),
- STATEVAR(gl_ModelViewMatrixInverseTranspose),
-
- STATEVAR(gl_ProjectionMatrix),
- STATEVAR(gl_ProjectionMatrixInverse),
- STATEVAR(gl_ProjectionMatrixTranspose),
- STATEVAR(gl_ProjectionMatrixInverseTranspose),
-
- STATEVAR(gl_ModelViewProjectionMatrix),
- STATEVAR(gl_ModelViewProjectionMatrixInverse),
- STATEVAR(gl_ModelViewProjectionMatrixTranspose),
- STATEVAR(gl_ModelViewProjectionMatrixInverseTranspose),
-
- STATEVAR(gl_TextureMatrix),
- STATEVAR(gl_TextureMatrixInverse),
- STATEVAR(gl_TextureMatrixTranspose),
- STATEVAR(gl_TextureMatrixInverseTranspose),
-
- STATEVAR(gl_NormalMatrix),
- STATEVAR(gl_NormalScale),
-};
-
void
ir_to_mesa_visitor::visit(ir_variable *ir)
{
if (ir->mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) {
unsigned int i;
+ const struct gl_builtin_uniform_desc *statevar;
- for (i = 0; i < Elements(statevars); i++) {
- if (strcmp(ir->name, statevars[i].name) == 0)
+ for (i = 0; _mesa_builtin_uniform_desc[i].name; i++) {
+ if (strcmp(ir->name, _mesa_builtin_uniform_desc[i].name) == 0)
break;
}
- if (i == Elements(statevars)) {
+ if (!_mesa_builtin_uniform_desc[i].name) {
fail_link(this->shader_program,
"Failed to find builtin uniform `%s'\n", ir->name);
return;
}
- const struct statevar *statevar = &statevars[i];
+ statevar = &_mesa_builtin_uniform_desc[i];
int array_count;
if (ir->type->is_array()) {
for (int a = 0; a < array_count; a++) {
for (unsigned int i = 0; i < statevar->num_elements; i++) {
- struct statevar_element *element = &statevar->elements[i];
+ struct gl_builtin_uniform_element *element = &statevar->elements[i];
int tokens[STATE_LENGTH];
memcpy(tokens, element->tokens, sizeof(element->tokens));
case ir_binop_bit_and:
case ir_binop_bit_xor:
case ir_binop_bit_or:
+ case ir_unop_round_even:
assert(!"GLSL 1.30 features unsupported");
break;
}
this->result = entry->return_reg;
}
-class get_sampler_name : public ir_hierarchical_visitor
-{
-public:
- get_sampler_name(ir_to_mesa_visitor *mesa, ir_dereference *last)
- {
- this->mem_ctx = mesa->mem_ctx;
- this->mesa = mesa;
- this->name = NULL;
- this->offset = 0;
- this->last = last;
- }
-
- virtual ir_visitor_status visit(ir_dereference_variable *ir)
- {
- this->name = ir->var->name;
- return visit_continue;
- }
-
- virtual ir_visitor_status visit_leave(ir_dereference_record *ir)
- {
- this->name = talloc_asprintf(mem_ctx, "%s.%s", name, ir->field);
- return visit_continue;
- }
-
- virtual ir_visitor_status visit_leave(ir_dereference_array *ir)
- {
- ir_constant *index = ir->array_index->as_constant();
- int i;
-
- if (index) {
- i = index->value.i[0];
- } else {
- /* GLSL 1.10 and 1.20 allowed variable sampler array indices,
- * while GLSL 1.30 requires that the array indices be
- * constant integer expressions. We don't expect any driver
- * to actually work with a really variable array index, so
- * all that would work would be an unrolled loop counter that ends
- * up being constant above.
- */
- mesa->shader_program->InfoLog =
- talloc_asprintf_append(mesa->shader_program->InfoLog,
- "warning: Variable sampler array index "
- "unsupported.\nThis feature of the language "
- "was removed in GLSL 1.20 and is unlikely "
- "to be supported for 1.10 in Mesa.\n");
- i = 0;
- }
- if (ir != last) {
- this->name = talloc_asprintf(mem_ctx, "%s[%d]", name, i);
- } else {
- offset = i;
- }
- return visit_continue;
- }
-
- ir_to_mesa_visitor *mesa;
- const char *name;
- void *mem_ctx;
- int offset;
- ir_dereference *last;
-};
-
-int
-ir_to_mesa_visitor::get_sampler_uniform_value(ir_dereference *sampler)
-{
- get_sampler_name getname(this, sampler);
-
- sampler->accept(&getname);
-
- GLint index = _mesa_lookup_parameter_index(prog->Parameters, -1,
- getname.name);
-
- if (index < 0) {
- fail_link(this->shader_program,
- "failed to find sampler named %s.\n", getname.name);
- return 0;
- }
-
- index += getname.offset;
-
- return this->prog->Parameters->ParameterValues[index][0];
-}
-
void
ir_to_mesa_visitor::visit(ir_texture *ir)
{
if (ir->shadow_comparitor)
inst->tex_shadow = GL_TRUE;
- inst->sampler = get_sampler_uniform_value(ir->sampler);
+ inst->sampler = _mesa_get_sampler_uniform_value(ir->sampler,
+ this->shader_program,
+ this->prog);
const glsl_type *sampler_type = ir->sampler->type;
}
static void
-set_uniform_initializer(GLcontext *ctx, void *mem_ctx,
+set_uniform_initializer(struct gl_context *ctx, void *mem_ctx,
struct gl_shader_program *shader_program,
const char *name, const glsl_type *type,
ir_constant *val)
}
static void
-set_uniform_initializers(GLcontext *ctx,
+set_uniform_initializers(struct gl_context *ctx,
struct gl_shader_program *shader_program)
{
void *mem_ctx = NULL;
- for (unsigned int i = 0; i < shader_program->_NumLinkedShaders; i++) {
+ for (unsigned int i = 0; i < MESA_SHADER_TYPES; i++) {
struct gl_shader *shader = shader_program->_LinkedShaders[i];
+
+ if (shader == NULL)
+ continue;
+
foreach_iter(exec_list_iterator, iter, *shader->ir) {
ir_instruction *ir = (ir_instruction *)iter.get();
ir_variable *var = ir->as_variable();
talloc_free(mem_ctx);
}
+
+/**
+ * Convert a shader's GLSL IR into a Mesa gl_program.
+ */
struct gl_program *
-get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program,
+get_mesa_program(struct gl_context *ctx, struct gl_shader_program *shader_program,
struct gl_shader *shader)
{
ir_to_mesa_visitor v;
mesa_instruction_annotation = talloc_array(v.mem_ctx, ir_instruction *,
num_instructions);
+ /* Convert ir_mesa_instructions into prog_instructions.
+ */
mesa_inst = mesa_instructions;
i = 0;
foreach_iter(exec_list_iterator, iter, v.instructions) {
- ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get();
+ const ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get();
mesa_inst->Opcode = inst->op;
mesa_inst->CondUpdate = inst->cond_update;
if (mesa_inst->DstReg.RelAddr)
prog->IndirectRegisterFiles |= 1 << mesa_inst->DstReg.File;
+ /* Update program's bitmask of indirectly accessed register files */
for (unsigned src = 0; src < 3; src++)
if (mesa_inst->SrcReg[src].RelAddr)
prog->IndirectRegisterFiles |= 1 << mesa_inst->SrcReg[src].File;
}
extern "C" {
+
+/**
+ * Called via ctx->Driver.CompilerShader().
+ * This is a no-op.
+ * XXX can we remove the ctx->Driver.CompileShader() hook?
+ */
GLboolean
-_mesa_ir_compile_shader(GLcontext *ctx, struct gl_shader *shader)
+_mesa_ir_compile_shader(struct gl_context *ctx, struct gl_shader *shader)
{
assert(shader->CompileStatus);
(void) ctx;
return GL_TRUE;
}
+
+/**
+ * Link a shader.
+ * Called via ctx->Driver.LinkShader()
+ * This actually involves converting GLSL IR into Mesa gl_programs with
+ * code lowering and other optimizations.
+ */
GLboolean
-_mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog)
+_mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
{
assert(prog->LinkStatus);
- for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
+ for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
+ if (prog->_LinkedShaders[i] == NULL)
+ continue;
+
bool progress;
exec_list *ir = prog->_LinkedShaders[i]->ir;
- struct gl_shader_compiler_options *options =
+ const struct gl_shader_compiler_options *options =
&ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(prog->_LinkedShaders[i]->Type)];
do {
validate_ir_tree(ir);
}
- for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
+ for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
struct gl_program *linked_prog;
bool ok = true;
+ if (prog->_LinkedShaders[i] == NULL)
+ continue;
+
linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]);
switch (prog->_LinkedShaders[i]->Type) {
return GL_TRUE;
}
+
+/**
+ * Compile a GLSL shader. Called via glCompileShader().
+ */
void
-_mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader)
+_mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader)
{
struct _mesa_glsl_parse_state *state =
new(shader) _mesa_glsl_parse_state(ctx, shader->Type, shader);
}
}
+
+/**
+ * Link a GLSL shader program. Called via glLinkProgram().
+ */
void
-_mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog)
+_mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
{
unsigned int i;
#include "main/config.h"
#include "main/mtypes.h"
-void _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *sh);
-void _mesa_glsl_link_shader(GLcontext *ctx, struct gl_shader_program *prog);
-GLboolean _mesa_ir_compile_shader(GLcontext *ctx, struct gl_shader *shader);
-GLboolean _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog);
+void _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *sh);
+void _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
+GLboolean _mesa_ir_compile_shader(struct gl_context *ctx, struct gl_shader *shader);
+GLboolean _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
#ifdef __cplusplus
}
* _successfully_ parsed the program text.
*/
struct parse_state {
- GLcontext *ctx;
+ struct gl_context *ctx;
const GLubyte *start; /* start of program string */
const GLubyte *pos; /* current position */
const GLubyte *curLine;
* indicates the position of the error in 'str'.
*/
void
-_mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget,
+_mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum dstTarget,
const GLubyte *str, GLsizei len,
struct gl_fragment_program *program)
{
#include "main/mtypes.h"
extern void
-_mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum target,
+_mesa_parse_nv_fragment_program(struct gl_context *ctx, GLenum target,
const GLubyte *str, GLsizei len,
struct gl_fragment_program *program);
* program attributes.
*/
struct parse_state {
- GLcontext *ctx;
+ struct gl_context *ctx;
const GLubyte *start;
const GLubyte *pos;
const GLubyte *curLine;
* indicates the position of the error in 'str'.
*/
void
-_mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget,
+_mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum dstTarget,
const GLubyte *str, GLsizei len,
struct gl_vertex_program *program)
{
#include "main/mtypes.h"
extern void
-_mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum target,
+_mesa_parse_nv_vertex_program(struct gl_context *ctx, GLenum target,
const GLubyte *str, GLsizei len,
struct gl_vertex_program *program);
static void
-clear_cache(GLcontext *ctx, struct gl_program_cache *cache)
+clear_cache(struct gl_context *ctx, struct gl_program_cache *cache)
{
struct cache_item *c, *next;
GLuint i;
void
-_mesa_delete_program_cache(GLcontext *ctx, struct gl_program_cache *cache)
+_mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *cache)
{
clear_cache(ctx, cache);
free(cache->items);
void
-_mesa_program_cache_insert(GLcontext *ctx,
+_mesa_program_cache_insert(struct gl_context *ctx,
struct gl_program_cache *cache,
const void *key, GLuint keysize,
struct gl_program *program)
_mesa_new_program_cache(void);
extern void
-_mesa_delete_program_cache(GLcontext *ctx, struct gl_program_cache *pc);
+_mesa_delete_program_cache(struct gl_context *ctx, struct gl_program_cache *pc);
extern struct gl_program *
const void *key, GLuint keysize);
extern void
-_mesa_program_cache_insert(GLcontext *ctx,
+_mesa_program_cache_insert(struct gl_context *ctx,
struct gl_program_cache *cache,
const void *key, GLuint keysize,
struct gl_program *program);
* XXX this currently only works for fragment program input attribs.
*/
static void
-fetch_vector4_deriv(GLcontext * ctx,
+fetch_vector4_deriv(struct gl_context * ctx,
const struct prog_src_register *source,
const struct gl_program_machine *machine,
char xOrY, GLfloat result[4])
* Fetch texel from texture. Use partial derivatives when possible.
*/
static INLINE void
-fetch_texel(GLcontext *ctx,
+fetch_texel(struct gl_context *ctx,
const struct gl_program_machine *machine,
const struct prog_instruction *inst,
const GLfloat texcoord[4], GLfloat lodBias,
* \return GL_TRUE if program completed or GL_FALSE if program executed KIL.
*/
GLboolean
-_mesa_execute_program(GLcontext * ctx,
+_mesa_execute_program(struct gl_context * ctx,
const struct gl_program *program,
struct gl_program_machine *machine)
{
#include "main/mtypes.h"
-typedef void (*FetchTexelLodFunc)(GLcontext *ctx, const GLfloat texcoord[4],
+typedef void (*FetchTexelLodFunc)(struct gl_context *ctx, const GLfloat texcoord[4],
GLfloat lambda, GLuint unit, GLfloat color[4]);
-typedef void (*FetchTexelDerivFunc)(GLcontext *ctx, const GLfloat texcoord[4],
+typedef void (*FetchTexelDerivFunc)(struct gl_context *ctx, const GLfloat texcoord[4],
const GLfloat texdx[4],
const GLfloat texdy[4],
GLfloat lodBias,
extern void
-_mesa_get_program_register(GLcontext *ctx, gl_register_file file,
+_mesa_get_program_register(struct gl_context *ctx, gl_register_file file,
GLuint index, GLfloat val[4]);
extern GLboolean
-_mesa_execute_program(GLcontext *ctx,
+_mesa_execute_program(struct gl_context *ctx,
const struct gl_program *program,
struct gl_program_machine *machine);
#if 0
static void
-print_it(GLcontext *ctx, struct gl_program *program, const char *txt) {
+print_it(struct gl_context *ctx, struct gl_program *program, const char *txt) {
fprintf(stderr, "%s (%u inst):\n", txt, program->NumInstructions);
_mesa_print_program(program);
_mesa_print_program_parameters(ctx, program);
* instructions, temp regs, etc.
*/
void
-_mesa_optimize_program(GLcontext *ctx, struct gl_program *program)
+_mesa_optimize_program(struct gl_context *ctx, struct gl_program *program)
{
GLboolean any_change;
GLint intEnd[MAX_PROGRAM_TEMPS]);
extern void
-_mesa_optimize_program(GLcontext *ctx, struct gl_program *program);
+_mesa_optimize_program(struct gl_context *ctx, struct gl_program *program);
#endif
/* Check if the state reference is already in the list */
for (index = 0; index < (GLint) paramList->NumParameters; index++) {
- GLuint i, match = 0;
- for (i = 0; i < STATE_LENGTH; i++) {
- if (paramList->Parameters[index].StateIndexes[i] == stateTokens[i]) {
- match++;
- }
- else {
- break;
- }
- }
- if (match == STATE_LENGTH) {
- /* this state reference is already in the parameter list */
- return index;
+ if (!memcmp(paramList->Parameters[index].StateIndexes,
+ stateTokens, STATE_LENGTH * sizeof(gl_state_index))) {
+ return index;
}
}
*/
static void
_mesa_fprint_program_parameters(FILE *f,
- GLcontext *ctx,
+ struct gl_context *ctx,
const struct gl_program *prog)
{
GLuint i;
* Print all of a program's parameters/fields to stderr.
*/
void
-_mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog)
+_mesa_print_program_parameters(struct gl_context *ctx, const struct gl_program *prog)
{
_mesa_fprint_program_parameters(stderr, ctx, prog);
}
GLboolean lineNumbers);
extern void
-_mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog);
+_mesa_print_program_parameters(struct gl_context *ctx, const struct gl_program *prog);
extern void
_mesa_print_parameter_list(const struct gl_program_parameter_list *list);
* The program parser will produce the state[] values.
*/
static void
-_mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
+_mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
GLfloat *value)
{
switch (state[0]) {
* This would be called at glBegin time when using a fragment program.
*/
void
-_mesa_load_state_parameters(GLcontext *ctx,
+_mesa_load_state_parameters(struct gl_context *ctx,
struct gl_program_parameter_list *paramList)
{
GLuint i;
* glBegin/glEnd, not per-vertex.
*/
void
-_mesa_load_tracked_matrices(GLcontext *ctx)
+_mesa_load_tracked_matrices(struct gl_context *ctx)
{
GLuint i;
extern void
-_mesa_load_state_parameters(GLcontext *ctx,
+_mesa_load_state_parameters(struct gl_context *ctx,
struct gl_program_parameter_list *paramList);
extern void
-_mesa_load_tracked_matrices(GLcontext *ctx);
+_mesa_load_tracked_matrices(struct gl_context *ctx);
#endif /* PROG_STATEVARS_H */
* Init context's vertex/fragment program state
*/
void
-_mesa_init_program(GLcontext *ctx)
+_mesa_init_program(struct gl_context *ctx)
{
GLuint i;
* Free a context's vertex/fragment program state
*/
void
-_mesa_free_program_data(GLcontext *ctx)
+_mesa_free_program_data(struct gl_context *ctx)
{
#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL);
* shared state.
*/
void
-_mesa_update_default_objects_program(GLcontext *ctx)
+_mesa_update_default_objects_program(struct gl_context *ctx)
{
#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
* This is generally called from within the parsers.
*/
void
-_mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string)
+_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string)
{
ctx->Program.ErrorPos = pos;
free((void *) ctx->Program.ErrorString);
* Initialize a new vertex/fragment program object.
*/
static struct gl_program *
-_mesa_init_program_struct( GLcontext *ctx, struct gl_program *prog,
+_mesa_init_program_struct( struct gl_context *ctx, struct gl_program *prog,
GLenum target, GLuint id)
{
(void) ctx;
* Initialize a new fragment program object.
*/
struct gl_program *
-_mesa_init_fragment_program( GLcontext *ctx, struct gl_fragment_program *prog,
+_mesa_init_fragment_program( struct gl_context *ctx, struct gl_fragment_program *prog,
GLenum target, GLuint id)
{
if (prog)
* Initialize a new vertex program object.
*/
struct gl_program *
-_mesa_init_vertex_program( GLcontext *ctx, struct gl_vertex_program *prog,
+_mesa_init_vertex_program( struct gl_context *ctx, struct gl_vertex_program *prog,
GLenum target, GLuint id)
{
if (prog)
* Initialize a new geometry program object.
*/
struct gl_program *
-_mesa_init_geometry_program( GLcontext *ctx, struct gl_geometry_program *prog,
+_mesa_init_geometry_program( struct gl_context *ctx, struct gl_geometry_program *prog,
GLenum target, GLuint id)
{
if (prog)
* \return pointer to new program object
*/
struct gl_program *
-_mesa_new_program(GLcontext *ctx, GLenum target, GLuint id)
+_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
{
struct gl_program *prog;
switch (target) {
* by a device driver function.
*/
void
-_mesa_delete_program(GLcontext *ctx, struct gl_program *prog)
+_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog)
{
(void) ctx;
ASSERT(prog);
* casts elsewhere.
*/
struct gl_program *
-_mesa_lookup_program(GLcontext *ctx, GLuint id)
+_mesa_lookup_program(struct gl_context *ctx, GLuint id)
{
if (id)
return (struct gl_program *) _mesa_HashLookup(ctx->Shared->Programs, id);
* Reference counting for vertex/fragment programs
*/
void
-_mesa_reference_program(GLcontext *ctx,
+_mesa_reference_program(struct gl_context *ctx,
struct gl_program **ptr,
struct gl_program *prog)
{
* made by a device driver.
*/
struct gl_program *
-_mesa_clone_program(GLcontext *ctx, const struct gl_program *prog)
+_mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog)
{
struct gl_program *clone;
* the first program go to the inputs of the second program.
*/
struct gl_program *
-_mesa_combine_programs(GLcontext *ctx,
+_mesa_combine_programs(struct gl_context *ctx,
const struct gl_program *progA,
const struct gl_program *progB)
{
* behaviour.
*/
void
-_mesa_postprocess_program(GLcontext *ctx, struct gl_program *prog)
+_mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog)
{
static const GLfloat white[4] = { 0.5, 0.5, 0.5, 0.5 };
GLuint i;
extern void
-_mesa_init_program(GLcontext *ctx);
+_mesa_init_program(struct gl_context *ctx);
extern void
-_mesa_free_program_data(GLcontext *ctx);
+_mesa_free_program_data(struct gl_context *ctx);
extern void
-_mesa_update_default_objects_program(GLcontext *ctx);
+_mesa_update_default_objects_program(struct gl_context *ctx);
extern void
-_mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string);
+_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string);
extern const GLubyte *
_mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
extern struct gl_program *
-_mesa_init_vertex_program(GLcontext *ctx,
+_mesa_init_vertex_program(struct gl_context *ctx,
struct gl_vertex_program *prog,
GLenum target, GLuint id);
extern struct gl_program *
-_mesa_init_fragment_program(GLcontext *ctx,
+_mesa_init_fragment_program(struct gl_context *ctx,
struct gl_fragment_program *prog,
GLenum target, GLuint id);
extern struct gl_program *
-_mesa_init_geometry_program(GLcontext *ctx,
+_mesa_init_geometry_program(struct gl_context *ctx,
struct gl_geometry_program *prog,
GLenum target, GLuint id);
extern struct gl_program *
-_mesa_new_program(GLcontext *ctx, GLenum target, GLuint id);
+_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id);
extern void
-_mesa_delete_program(GLcontext *ctx, struct gl_program *prog);
+_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog);
extern struct gl_program *
-_mesa_lookup_program(GLcontext *ctx, GLuint id);
+_mesa_lookup_program(struct gl_context *ctx, GLuint id);
extern void
-_mesa_reference_program(GLcontext *ctx,
+_mesa_reference_program(struct gl_context *ctx,
struct gl_program **ptr,
struct gl_program *prog);
static INLINE void
-_mesa_reference_vertprog(GLcontext *ctx,
+_mesa_reference_vertprog(struct gl_context *ctx,
struct gl_vertex_program **ptr,
struct gl_vertex_program *prog)
{
}
static INLINE void
-_mesa_reference_fragprog(GLcontext *ctx,
+_mesa_reference_fragprog(struct gl_context *ctx,
struct gl_fragment_program **ptr,
struct gl_fragment_program *prog)
{
}
static INLINE void
-_mesa_reference_geomprog(GLcontext *ctx,
+_mesa_reference_geomprog(struct gl_context *ctx,
struct gl_geometry_program **ptr,
struct gl_geometry_program *prog)
{
}
extern struct gl_program *
-_mesa_clone_program(GLcontext *ctx, const struct gl_program *prog);
+_mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog);
static INLINE struct gl_vertex_program *
-_mesa_clone_vertex_program(GLcontext *ctx,
+_mesa_clone_vertex_program(struct gl_context *ctx,
const struct gl_vertex_program *prog)
{
return (struct gl_vertex_program *) _mesa_clone_program(ctx, &prog->Base);
}
static INLINE struct gl_geometry_program *
-_mesa_clone_geometry_program(GLcontext *ctx,
+_mesa_clone_geometry_program(struct gl_context *ctx,
const struct gl_geometry_program *prog)
{
return (struct gl_geometry_program *) _mesa_clone_program(ctx, &prog->Base);
}
static INLINE struct gl_fragment_program *
-_mesa_clone_fragment_program(GLcontext *ctx,
+_mesa_clone_fragment_program(struct gl_context *ctx,
const struct gl_fragment_program *prog)
{
return (struct gl_fragment_program *) _mesa_clone_program(ctx, &prog->Base);
_mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count);
extern struct gl_program *
-_mesa_combine_programs(GLcontext *ctx,
+_mesa_combine_programs(struct gl_context *ctx,
const struct gl_program *progA,
const struct gl_program *progB);
GLuint maxRegs, GLuint firstReg);
extern void
-_mesa_postprocess_program(GLcontext *ctx, struct gl_program *prog);
+_mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog);
/* keep these in the same order as TGSI_PROCESSOR_* */
GLboolean
-_mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
+_mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *str,
GLsizei len, struct asm_parser_state *state)
{
struct asm_instruction *inst;
GLboolean
-_mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
+_mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *str,
GLsizei len, struct asm_parser_state *state)
{
struct asm_instruction *inst;
#include "main/config.h"
-#ifndef MTYPES_H
-struct __GLcontextRec;
-typedef struct __GLcontextRec GLcontext;
-#endif
+struct gl_context;
enum asm_type {
at_none,
struct asm_parser_state {
- GLcontext *ctx;
+ struct gl_context *ctx;
struct gl_program *prog;
/**
#define YYLTYPE_IS_TRIVIAL 1
-extern GLboolean _mesa_parse_arb_program(GLcontext *ctx, GLenum target,
+extern GLboolean _mesa_parse_arb_program(struct gl_context *ctx, GLenum target,
const GLubyte *str, GLsizei len, struct asm_parser_state *state);
* May be used to implement the position_invariant option.
*/
static void
-_mesa_insert_mvp_dp4_code(GLcontext *ctx, struct gl_vertex_program *vprog)
+_mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
{
struct prog_instruction *newInst;
const GLuint origLen = vprog->Base.NumInstructions;
static void
-_mesa_insert_mvp_mad_code(GLcontext *ctx, struct gl_vertex_program *vprog)
+_mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
{
struct prog_instruction *newInst;
const GLuint origLen = vprog->Base.NumInstructions;
void
-_mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog)
+_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
{
if (ctx->mvp_with_dp4)
_mesa_insert_mvp_dp4_code( ctx, vprog );
* to vertex programs too.
*/
void
-_mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
+_mesa_append_fog_code(struct gl_context *ctx, struct gl_fragment_program *fprog)
{
static const gl_state_index fogPStateOpt[STATE_LENGTH]
= { STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED, 0, 0, 0 };
* This is for debug/test purposes.
*/
void
-_mesa_nop_fragment_program(GLcontext *ctx, struct gl_fragment_program *prog)
+_mesa_nop_fragment_program(struct gl_context *ctx, struct gl_fragment_program *prog)
{
struct prog_instruction *inst;
GLuint inputAttr;
* transforms vertex position and emits color.
*/
void
-_mesa_nop_vertex_program(GLcontext *ctx, struct gl_vertex_program *prog)
+_mesa_nop_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog)
{
struct prog_instruction *inst;
GLuint inputAttr;
#include "main/mtypes.h"
extern void
-_mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog);
+_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog);
extern void
-_mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog);
+_mesa_append_fog_code(struct gl_context *ctx, struct gl_fragment_program *fprog);
extern void
_mesa_count_texture_indirections(struct gl_program *prog);
_mesa_remove_output_reads(struct gl_program *prog, gl_register_file type);
extern void
-_mesa_nop_fragment_program(GLcontext *ctx, struct gl_fragment_program *prog);
+_mesa_nop_fragment_program(struct gl_context *ctx, struct gl_fragment_program *prog);
extern void
-_mesa_nop_vertex_program(GLcontext *ctx, struct gl_vertex_program *prog);
+_mesa_nop_vertex_program(struct gl_context *ctx, struct gl_vertex_program *prog);
#endif /* PROGRAMOPT_H */
--- /dev/null
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+/** @file register_allocate.c
+ *
+ * Graph-coloring register allocator.
+ */
+
+#include <talloc.h>
+
+#include "main/imports.h"
+#include "main/macros.h"
+#include "main/mtypes.h"
+#include "register_allocate.h"
+
+struct ra_reg {
+ char *name;
+ GLboolean *conflicts;
+};
+
+struct ra_regs {
+ struct ra_reg *regs;
+ unsigned int count;
+
+ struct ra_class **classes;
+ unsigned int class_count;
+};
+
+struct ra_class {
+ GLboolean *regs;
+
+ /**
+ * p_B in Runeson/Nyström paper.
+ *
+ * This is "how many regs are in the set."
+ */
+ unsigned int p;
+
+ /**
+ * q_B,C in Runeson/Nyström paper.
+ */
+ unsigned int *q;
+};
+
+struct ra_node {
+ GLboolean *adjacency;
+ unsigned int class;
+ unsigned int adjacency_count;
+ unsigned int reg;
+ GLboolean in_stack;
+};
+
+struct ra_graph {
+ struct ra_regs *regs;
+ /**
+ * the variables that need register allocation.
+ */
+ struct ra_node *nodes;
+ unsigned int count; /**< count of nodes. */
+
+ unsigned int *stack;
+ unsigned int stack_count;
+};
+
+struct ra_regs *
+ra_alloc_reg_set(unsigned int count)
+{
+ unsigned int i;
+ struct ra_regs *regs;
+
+ regs = talloc_zero(NULL, struct ra_regs);
+ regs->count = count;
+ regs->regs = talloc_zero_array(regs, struct ra_reg, count);
+
+ for (i = 0; i < count; i++) {
+ regs->regs[i].conflicts = talloc_zero_array(regs->regs, GLboolean, count);
+ regs->regs[i].conflicts[i] = GL_TRUE;
+ }
+
+ return regs;
+}
+
+void
+ra_add_reg_conflict(struct ra_regs *regs, unsigned int r1, unsigned int r2)
+{
+ regs->regs[r1].conflicts[r2] = GL_TRUE;
+ regs->regs[r2].conflicts[r1] = GL_TRUE;
+}
+
+unsigned int
+ra_alloc_reg_class(struct ra_regs *regs)
+{
+ struct ra_class *class;
+
+ regs->classes = talloc_realloc(regs, regs->classes,
+ struct ra_class *,
+ regs->class_count + 1);
+
+ class = talloc_zero(regs, struct ra_class);
+ regs->classes[regs->class_count] = class;
+
+ class->regs = talloc_zero_array(class, GLboolean, regs->count);
+
+ return regs->class_count++;
+}
+
+void
+ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int r)
+{
+ struct ra_class *class = regs->classes[c];
+
+ class->regs[r] = GL_TRUE;
+ class->p++;
+}
+
+/**
+ * Must be called after all conflicts and register classes have been
+ * set up and before the register set is used for allocation.
+ */
+void
+ra_set_finalize(struct ra_regs *regs)
+{
+ unsigned int b, c;
+
+ for (b = 0; b < regs->class_count; b++) {
+ regs->classes[b]->q = talloc_array(regs, unsigned int, regs->class_count);
+ }
+
+ /* Compute, for each class B and C, how many regs of B an
+ * allocation to C could conflict with.
+ */
+ for (b = 0; b < regs->class_count; b++) {
+ for (c = 0; c < regs->class_count; c++) {
+ unsigned int rc;
+ int max_conflicts = 0;
+
+ for (rc = 0; rc < regs->count; rc++) {
+ unsigned int rb;
+ int conflicts = 0;
+
+ if (!regs->classes[c]->regs[rc])
+ continue;
+
+ for (rb = 0; rb < regs->count; rb++) {
+ if (regs->classes[b]->regs[rb] &&
+ regs->regs[rb].conflicts[rc])
+ conflicts++;
+ }
+ max_conflicts = MAX2(max_conflicts, conflicts);
+ }
+ regs->classes[b]->q[c] = max_conflicts;
+ }
+ }
+}
+
+struct ra_graph *
+ra_alloc_interference_graph(struct ra_regs *regs, unsigned int count)
+{
+ struct ra_graph *g;
+ unsigned int i;
+
+ g = talloc_zero(regs, struct ra_graph);
+ g->regs = regs;
+ g->nodes = talloc_zero_array(g, struct ra_node, count);
+ g->count = count;
+
+ g->stack = talloc_zero_array(g, unsigned int, count);
+
+ for (i = 0; i < count; i++) {
+ g->nodes[i].adjacency = talloc_zero_array(g, GLboolean, count);
+ g->nodes[i].adjacency[i] = GL_TRUE;
+ g->nodes[i].reg = ~0;
+ }
+
+ return g;
+}
+
+void
+ra_set_node_class(struct ra_graph *g,
+ unsigned int n, unsigned int class)
+{
+ g->nodes[n].class = class;
+}
+
+void
+ra_add_node_interference(struct ra_graph *g,
+ unsigned int n1, unsigned int n2)
+{
+ if (g->nodes[n1].adjacency[n2])
+ return;
+
+ g->nodes[n1].adjacency[n2] = GL_TRUE;
+ g->nodes[n2].adjacency_count++;
+ g->nodes[n2].adjacency[n1] = GL_TRUE;
+ g->nodes[n2].adjacency_count++;
+}
+
+static GLboolean pq_test(struct ra_graph *g, unsigned int n)
+{
+ unsigned int j;
+ unsigned int q = 0;
+ int n_class = g->nodes[n].class;
+
+ for (j = 0; j < g->count; j++) {
+ if (j == n || g->nodes[j].in_stack)
+ continue;
+
+ if (g->nodes[n].adjacency[j]) {
+ unsigned int j_class = g->nodes[j].class;
+ q += g->regs->classes[n_class]->q[j_class];
+ }
+ }
+
+ return q < g->regs->classes[n_class]->p;
+}
+
+/**
+ * Simplifies the interference graph by pushing all
+ * trivially-colorable nodes into a stack of nodes to be colored,
+ * removing them from the graph, and rinsing and repeating.
+ *
+ * Returns GL_TRUE if all nodes were removed from the graph. GL_FALSE
+ * means that either spilling will be required, or optimistic coloring
+ * should be applied.
+ */
+GLboolean
+ra_simplify(struct ra_graph *g)
+{
+ GLboolean progress = GL_TRUE;
+ int i;
+
+ while (progress) {
+ progress = GL_FALSE;
+
+ for (i = g->count - 1; i >= 0; i--) {
+ if (g->nodes[i].in_stack)
+ continue;
+
+ if (pq_test(g, i)) {
+ g->stack[g->stack_count] = i;
+ g->stack_count++;
+ g->nodes[i].in_stack = GL_TRUE;
+ progress = GL_TRUE;
+ }
+ }
+ }
+
+ for (i = 0; i < g->count; i++) {
+ if (!g->nodes[i].in_stack)
+ return GL_FALSE;
+ }
+
+ return GL_TRUE;
+}
+
+/**
+ * Pops nodes from the stack back into the graph, coloring them with
+ * registers as they go.
+ *
+ * If all nodes were trivially colorable, then this must succeed. If
+ * not (optimistic coloring), then it may return GL_FALSE;
+ */
+GLboolean
+ra_select(struct ra_graph *g)
+{
+ int i;
+
+ while (g->stack_count != 0) {
+ unsigned int r;
+ int n = g->stack[g->stack_count - 1];
+ struct ra_class *c = g->regs->classes[g->nodes[n].class];
+
+ /* Find the lowest-numbered reg which is not used by a member
+ * of the graph adjacent to us.
+ */
+ for (r = 0; r < g->regs->count; r++) {
+ if (!c->regs[r])
+ continue;
+
+ /* Check if any of our neighbors conflict with this register choice. */
+ for (i = 0; i < g->count; i++) {
+ if (g->nodes[n].adjacency[i] &&
+ !g->nodes[i].in_stack &&
+ g->regs->regs[r].conflicts[g->nodes[i].reg]) {
+ break;
+ }
+ }
+ if (i == g->count)
+ break;
+ }
+ if (r == g->regs->count)
+ return GL_FALSE;
+
+ g->nodes[n].reg = r;
+ g->nodes[n].in_stack = GL_FALSE;
+ g->stack_count--;
+ }
+
+ return GL_TRUE;
+}
+
+/**
+ * Optimistic register coloring: Just push the remaining nodes
+ * on the stack. They'll be colored first in ra_select(), and
+ * if they succeed then the locally-colorable nodes are still
+ * locally-colorable and the rest of the register allocation
+ * will succeed.
+ */
+void
+ra_optimistic_color(struct ra_graph *g)
+{
+ unsigned int i;
+
+ for (i = 0; i < g->count; i++) {
+ if (g->nodes[i].in_stack)
+ continue;
+
+ g->stack[g->stack_count] = i;
+ g->stack_count++;
+ g->nodes[i].in_stack = GL_TRUE;
+ }
+}
+
+GLboolean
+ra_allocate_no_spills(struct ra_graph *g)
+{
+ if (!ra_simplify(g)) {
+ ra_optimistic_color(g);
+ }
+ return ra_select(g);
+}
+
+unsigned int
+ra_get_node_reg(struct ra_graph *g, unsigned int n)
+{
+ return g->nodes[n].reg;
+}
--- /dev/null
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Eric Anholt <eric@anholt.net>
+ *
+ */
+
+struct ra_class;
+struct ra_regs;
+
+/* @{
+ * Register set setup.
+ *
+ * This should be done once at backend initializaion, as
+ * ra_set_finalize is O(r^2*c^2). The registers may be virtual
+ * registers, such as aligned register pairs that conflict with the
+ * two real registers from which they are composed.
+ */
+struct ra_regs *ra_alloc_reg_set(unsigned int count);
+unsigned int ra_alloc_reg_class(struct ra_regs *regs);
+void ra_add_reg_conflict(struct ra_regs *regs,
+ unsigned int r1, unsigned int r2);
+void ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int reg);
+void ra_set_finalize(struct ra_regs *regs);
+/** @} */
+
+/** @{ Interference graph setup.
+ *
+ * Each interference graph node is a virtual variable in the IL. It
+ * is up to the user to ra_set_node_class() for the virtual variable,
+ * and compute live ranges and ra_node_interfere() between conflicting
+ * live ranges.
+ */
+struct ra_graph *ra_alloc_interference_graph(struct ra_regs *regs,
+ unsigned int count);
+void ra_set_node_class(struct ra_graph *g, unsigned int n, unsigned int c);
+void ra_add_node_interference(struct ra_graph *g,
+ unsigned int n1, unsigned int n2);
+/** @} */
+
+/** @{ Graph-coloring register allocation */
+GLboolean ra_simplify(struct ra_graph *g);
+void ra_optimistic_color(struct ra_graph *g);
+GLboolean ra_select(struct ra_graph *g);
+GLboolean ra_allocate_no_spills(struct ra_graph *g);
+
+unsigned int ra_get_node_reg(struct ra_graph *g, unsigned int n);
+/** @} */
+
--- /dev/null
+/*
+ * Copyright (C) 2005-2007 Brian Paul All Rights Reserved.
+ * Copyright (C) 2008 VMware, Inc. All Rights Reserved.
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <stdio.h>
+
+extern "C" {
+#include "main/compiler.h"
+#include "main/mtypes.h"
+#include "program/prog_parameter.h"
+#include "ir.h"
+#include "ir_visitor.h"
+#include "glsl_types.h"
+}
+
+static void fail_link(struct gl_shader_program *prog, const char *fmt, ...) PRINTFLIKE(2, 3);
+
+static void fail_link(struct gl_shader_program *prog, const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ prog->InfoLog = talloc_vasprintf_append(prog->InfoLog, fmt, args);
+ va_end(args);
+
+ prog->LinkStatus = GL_FALSE;
+}
+
+class get_sampler_name : public ir_hierarchical_visitor
+{
+public:
+ get_sampler_name(ir_dereference *last,
+ struct gl_shader_program *shader_program)
+ {
+ this->mem_ctx = talloc_new(NULL);
+ this->shader_program = shader_program;
+ this->name = NULL;
+ this->offset = 0;
+ this->last = last;
+ }
+
+ ~get_sampler_name()
+ {
+ talloc_free(this->mem_ctx);
+ }
+
+ virtual ir_visitor_status visit(ir_dereference_variable *ir)
+ {
+ this->name = ir->var->name;
+ return visit_continue;
+ }
+
+ virtual ir_visitor_status visit_leave(ir_dereference_record *ir)
+ {
+ this->name = talloc_asprintf(mem_ctx, "%s.%s", name, ir->field);
+ return visit_continue;
+ }
+
+ virtual ir_visitor_status visit_leave(ir_dereference_array *ir)
+ {
+ ir_constant *index = ir->array_index->as_constant();
+ int i;
+
+ if (index) {
+ i = index->value.i[0];
+ } else {
+ /* GLSL 1.10 and 1.20 allowed variable sampler array indices,
+ * while GLSL 1.30 requires that the array indices be
+ * constant integer expressions. We don't expect any driver
+ * to actually work with a really variable array index, so
+ * all that would work would be an unrolled loop counter that ends
+ * up being constant above.
+ */
+ shader_program->InfoLog =
+ talloc_asprintf_append(shader_program->InfoLog,
+ "warning: Variable sampler array index "
+ "unsupported.\nThis feature of the language "
+ "was removed in GLSL 1.20 and is unlikely "
+ "to be supported for 1.10 in Mesa.\n");
+ i = 0;
+ }
+ if (ir != last) {
+ this->name = talloc_asprintf(mem_ctx, "%s[%d]", name, i);
+ } else {
+ offset = i;
+ }
+ return visit_continue;
+ }
+
+ struct gl_shader_program *shader_program;
+ const char *name;
+ void *mem_ctx;
+ int offset;
+ ir_dereference *last;
+};
+
+extern "C" {
+int
+_mesa_get_sampler_uniform_value(class ir_dereference *sampler,
+ struct gl_shader_program *shader_program,
+ const struct gl_program *prog)
+{
+ get_sampler_name getname(sampler, shader_program);
+
+ sampler->accept(&getname);
+
+ GLint index = _mesa_lookup_parameter_index(prog->Parameters, -1,
+ getname.name);
+
+ if (index < 0) {
+ fail_link(shader_program,
+ "failed to find sampler named %s.\n", getname.name);
+ return 0;
+ }
+
+ index += getname.offset;
+
+ return prog->Parameters->ParameterValues[index][0];
+}
+}
--- /dev/null
+/*
+ * Copyright (C) 2005-2007 Brian Paul All Rights Reserved.
+ * Copyright (C) 2008 VMware, Inc. All Rights Reserved.
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+int
+_mesa_get_sampler_uniform_value(class ir_dereference *sampler,
+ struct gl_shader_program *shader_program,
+ const struct gl_program *prog);
program/prog_statevars.c \
program/prog_uniform.c \
program/programopt.c \
+ program/register_allocate.c \
program/symbol_table.c
SHADER_CXX_SOURCES = \
- program/ir_to_mesa.cpp
+ program/ir_to_mesa.cpp \
+ program/sampler.cpp
ASM_C_SOURCES = \
x86/common_x86.c \
*/
static void check_program_state( struct st_context *st )
{
- GLcontext *ctx = st->ctx;
+ struct gl_context *ctx = st->ctx;
if (ctx->VertexProgram._Current != &st->vp->Base)
st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
extern const struct st_tracked_state st_update_pixel_transfer;
-uint st_compare_func_to_pipe(GLenum func);
+GLuint st_compare_func_to_pipe(GLenum func);
#endif
* Figure out if colormasks are different per rt.
*/
static GLboolean
-colormask_per_rt(GLcontext *ctx)
+colormask_per_rt(struct gl_context *ctx)
{
/* a bit suboptimal have to compare lots of values */
unsigned i;
* Figure out if blend enables are different per rt.
*/
static GLboolean
-blend_per_rt(GLcontext *ctx)
+blend_per_rt(struct gl_context *ctx)
{
if (ctx->Color.BlendEnabled &&
(ctx->Color.BlendEnabled != ((1 << ctx->Const.MaxDrawBuffers) - 1))) {
{
struct pipe_depth_stencil_alpha_state *dsa = &st->state.depth_stencil;
struct pipe_stencil_ref sr;
- GLcontext *ctx = st->ctx;
+ struct gl_context *ctx = st->ctx;
memset(dsa, 0, sizeof(*dsa));
memset(&sr, 0, sizeof(sr));
};
static void
-make_state_key(GLcontext *ctx, struct state_key *key)
+make_state_key(struct gl_context *ctx, struct state_key *key)
{
memset(key, 0, sizeof(*key));
static struct pipe_resource *
-create_color_map_texture(GLcontext *ctx)
+create_color_map_texture(struct gl_context *ctx)
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
* Update the pixelmap texture with the contents of the R/G/B/A pixel maps.
*/
static void
-load_color_map_texture(GLcontext *ctx, struct pipe_resource *pt)
+load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt)
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
* Returns a fragment program which implements the current pixel transfer ops.
*/
static struct gl_fragment_program *
-get_pixel_transfer_program(GLcontext *ctx, const struct state_key *key)
+get_pixel_transfer_program(struct gl_context *ctx, const struct state_key *key)
{
struct st_context *st = st_context(ctx);
struct prog_instruction inst[MAX_INST];
static void
update_pixel_transfer(struct st_context *st)
{
- GLcontext *ctx = st->ctx;
+ struct gl_context *ctx = st->ctx;
struct state_key key;
struct gl_fragment_program *fp;
static void update_raster_state( struct st_context *st )
{
- GLcontext *ctx = st->ctx;
+ struct gl_context *ctx = st->ctx;
struct pipe_rasterizer_state *raster = &st->state.rasterizer;
const struct gl_vertex_program *vertProg = ctx->VertexProgram._Current;
const struct gl_fragment_program *fragProg = ctx->FragmentProgram._Current;
*
* \param format PIPE_FORMAT_*.
* \param swizzle Texture swizzle, a bitmask computed using MAKE_SWIZZLE4.
- * \param depthmode One of GL_LUMINANCE, GL_INTENSITY, GL_ALPHA.
+ * \param depthmode One of GL_LUMINANCE, GL_INTENSITY, GL_ALPHA, GL_RED.
*/
static GLuint apply_depthmode(enum pipe_format format,
GLuint swizzle, GLenum depthmode)
else if (swiz[i] < SWIZZLE_W)
swiz[i] = SWIZZLE_ZERO;
break;
+ case GL_RED:
+ /* Rewrite reads W to 1, XYZ to X00 */
+ for (i = 0; i < 4; i++)
+ if (swiz[i] == SWIZZLE_W)
+ swiz[i] = SWIZZLE_ONE;
+ else if (swiz[i] == SWIZZLE_Y || swiz[i] == SWIZZLE_Z)
+ swiz[i] = SWIZZLE_ZERO;
+ break;
}
return MAKE_SWIZZLE4(swiz[0], swiz[1], swiz[2], swiz[3]);
static void
update_viewport( struct st_context *st )
{
- GLcontext *ctx = st->ctx;
+ struct gl_context *ctx = st->ctx;
GLfloat yScale, yBias;
/* _NEW_BUFFERS
void
-st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
+st_clear_accum_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
struct st_renderbuffer *acc_strb = st_renderbuffer(rb);
const GLint xpos = ctx->DrawBuffer->_Xmin;
/** For ADD/MULT */
static void
-accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias,
+accum_mad(struct gl_context *ctx, GLfloat scale, GLfloat bias,
GLint xpos, GLint ypos, GLint width, GLint height,
struct st_renderbuffer *acc_strb)
{
static void
-accum_return(GLcontext *ctx, GLfloat value,
+accum_return(struct gl_context *ctx, GLfloat value,
GLint xpos, GLint ypos, GLint width, GLint height,
struct st_renderbuffer *acc_strb,
struct st_renderbuffer *color_strb)
static void
-st_Accum(GLcontext *ctx, GLenum op, GLfloat value)
+st_Accum(struct gl_context *ctx, GLenum op, GLfloat value)
{
struct st_context *st = st_context(ctx);
struct st_renderbuffer *acc_strb
#if FEATURE_accum
extern void
-st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb);
+st_clear_accum_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb);
extern void st_init_accum_functions(struct dd_function_table *functions);
#include "main/compiler.h"
static INLINE void
-st_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
+st_clear_accum_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
ASSERT_NO_FEATURE();
}
* This program will be combined with the user's fragment program.
*/
static struct st_fragment_program *
-make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex)
+make_bitmap_fragment_program(struct gl_context *ctx, GLuint samplerIndex)
{
struct st_context *st = st_context(ctx);
struct st_fragment_program *stfp;
* Combine basic bitmap fragment program with the user-defined program.
*/
static struct st_fragment_program *
-combined_bitmap_fragment_program(GLcontext *ctx)
+combined_bitmap_fragment_program(struct gl_context *ctx)
{
struct st_context *st = st_context(ctx);
struct st_fragment_program *stfp = st->fp;
* Create a texture which represents a bitmap image.
*/
static struct pipe_resource *
-make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
+make_bitmap_texture(struct gl_context *ctx, GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap)
{
* Render a glBitmap by drawing a textured quad
*/
static void
-draw_bitmap_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
+draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
GLsizei width, GLsizei height,
struct pipe_sampler_view *sv,
const GLfloat *color)
* Called via ctx->Driver.Bitmap()
*/
static void
-st_Bitmap(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
+st_Bitmap(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap )
{
struct st_context *st = st_context(ctx);
#if FEATURE_EXT_framebuffer_blit
static void
-st_BlitFramebuffer(GLcontext *ctx,
+st_BlitFramebuffer(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter)
* internal structure where somehow shared.
*/
static struct gl_buffer_object *
-st_bufferobj_alloc(GLcontext *ctx, GLuint name, GLenum target)
+st_bufferobj_alloc(struct gl_context *ctx, GLuint name, GLenum target)
{
struct st_buffer_object *st_obj = ST_CALLOC_STRUCT(st_buffer_object);
* Called via glDeleteBuffersARB().
*/
static void
-st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj)
+st_bufferobj_free(struct gl_context *ctx, struct gl_buffer_object *obj)
{
struct st_buffer_object *st_obj = st_buffer_object(obj);
* Called via glBufferSubDataARB().
*/
static void
-st_bufferobj_subdata(GLcontext *ctx,
+st_bufferobj_subdata(struct gl_context *ctx,
GLenum target,
GLintptrARB offset,
GLsizeiptrARB size,
* Called via glGetBufferSubDataARB().
*/
static void
-st_bufferobj_get_subdata(GLcontext *ctx,
+st_bufferobj_get_subdata(struct gl_context *ctx,
GLenum target,
GLintptrARB offset,
GLsizeiptrARB size,
* \return GL_TRUE for success, GL_FALSE if out of memory
*/
static GLboolean
-st_bufferobj_data(GLcontext *ctx,
+st_bufferobj_data(struct gl_context *ctx,
GLenum target,
GLsizeiptrARB size,
const GLvoid * data,
* Called via glMapBufferARB().
*/
static void *
-st_bufferobj_map(GLcontext *ctx, GLenum target, GLenum access,
+st_bufferobj_map(struct gl_context *ctx, GLenum target, GLenum access,
struct gl_buffer_object *obj)
{
struct st_buffer_object *st_obj = st_buffer_object(obj);
* Called via glMapBufferRange().
*/
static void *
-st_bufferobj_map_range(GLcontext *ctx, GLenum target,
+st_bufferobj_map_range(struct gl_context *ctx, GLenum target,
GLintptr offset, GLsizeiptr length, GLbitfield access,
struct gl_buffer_object *obj)
{
static void
-st_bufferobj_flush_mapped_range(GLcontext *ctx, GLenum target,
+st_bufferobj_flush_mapped_range(struct gl_context *ctx, GLenum target,
GLintptr offset, GLsizeiptr length,
struct gl_buffer_object *obj)
{
* Called via glUnmapBufferARB().
*/
static GLboolean
-st_bufferobj_unmap(GLcontext *ctx, GLenum target, struct gl_buffer_object *obj)
+st_bufferobj_unmap(struct gl_context *ctx, GLenum target, struct gl_buffer_object *obj)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_buffer_object *st_obj = st_buffer_object(obj);
* Called via glCopyBufferSubData().
*/
static void
-st_copy_buffer_subdata(GLcontext *ctx,
+st_copy_buffer_subdata(struct gl_context *ctx,
struct gl_buffer_object *src,
struct gl_buffer_object *dst,
GLintptr readOffset, GLintptr writeOffset,
* ctx->DrawBuffer->_X/Ymin/max fields.
*/
static void
-clear_with_quad(GLcontext *ctx,
+clear_with_quad(struct gl_context *ctx,
GLboolean color, GLboolean depth, GLboolean stencil)
{
struct st_context *st = st_context(ctx);
* Determine if we need to clear the depth buffer by drawing a quad.
*/
static INLINE GLboolean
-check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
+check_clear_color_with_quad(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
if (ctx->Scissor.Enabled &&
(ctx->Scissor.X != 0 ||
* drawing a quad.
*/
static INLINE GLboolean
-check_clear_depth_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
+check_clear_depth_stencil_with_quad(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
const GLuint stencilMax = 0xff;
GLboolean maskStencil
* Determine if we need to clear the depth buffer by drawing a quad.
*/
static INLINE GLboolean
-check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb,
+check_clear_depth_with_quad(struct gl_context *ctx, struct gl_renderbuffer *rb,
boolean ds_separate)
{
const struct st_renderbuffer *strb = st_renderbuffer(rb);
* Determine if we need to clear the stencil buffer by drawing a quad.
*/
static INLINE GLboolean
-check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb,
+check_clear_stencil_with_quad(struct gl_context *ctx, struct gl_renderbuffer *rb,
boolean ds_separate)
{
const struct st_renderbuffer *strb = st_renderbuffer(rb);
* Called via ctx->Driver.Clear()
*/
static void
-st_Clear(GLcontext *ctx, GLbitfield mask)
+st_Clear(struct gl_context *ctx, GLbitfield mask)
{
static const GLbitfield BUFFER_BITS_DS
= (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL);
* Called via ctx->Driver.BeginConditionalRender()
*/
static void
-st_BeginConditionalRender(GLcontext *ctx, struct gl_query_object *q,
+st_BeginConditionalRender(struct gl_context *ctx, struct gl_query_object *q,
GLenum mode)
{
struct st_query_object *stq = st_query_object(q);
* Called via ctx->Driver.BeginConditionalRender()
*/
static void
-st_EndConditionalRender(GLcontext *ctx, struct gl_query_object *q)
+st_EndConditionalRender(struct gl_context *ctx, struct gl_query_object *q)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
(void) q;
#include "main/texstore.h"
#include "program/program.h"
#include "program/prog_print.h"
+#include "program/prog_instruction.h"
-#include "st_debug.h"
-#include "st_context.h"
#include "st_atom.h"
#include "st_atom_constbuf.h"
-#include "st_program.h"
#include "st_cb_drawpixels.h"
#include "st_cb_readpixels.h"
#include "st_cb_fbo.h"
+#include "st_context.h"
+#include "st_debug.h"
#include "st_format.h"
+#include "st_program.h"
#include "st_texture.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
#include "tgsi/tgsi_ureg.h"
-#include "util/u_tile.h"
#include "util/u_draw_quad.h"
#include "util/u_format.h"
+#include "util/u_inlines.h"
#include "util/u_math.h"
-#include "program/prog_instruction.h"
+#include "util/u_tile.h"
#include "cso_cache/cso_context.h"
* \return pointer to Gallium driver fragment shader
*/
static void *
-combined_drawpix_fragment_program(GLcontext *ctx)
+combined_drawpix_fragment_program(struct gl_context *ctx)
{
struct st_context *st = st_context(ctx);
struct st_fragment_program *stfp;
/**
- * Create fragment shader that does a TEX() instruction to get a Z
- * value, then writes to FRAG_RESULT_DEPTH.
+ * Create fragment shader that does a TEX() instruction to get a Z and/or
+ * stencil value value, then writes to FRAG_RESULT_DEPTH/FRAG_RESULT_STENCIL.
+ * Used for glDrawPixels(GL_DEPTH_COMPONENT / GL_STENCIL_INDEX).
* Pass fragment color through as-is.
* \return pointer to the Gallium driver fragment shader
*/
static void *
-make_fragment_shader_z(struct st_context *st)
+make_fragment_shader_z_stencil(struct st_context *st, GLboolean write_depth,
+ GLboolean write_stencil)
{
- GLcontext *ctx = st->ctx;
+ struct gl_context *ctx = st->ctx;
struct gl_program *p;
+ struct st_fragment_program *stp;
GLuint ic = 0;
+ const GLuint shaderIndex = write_depth * 2 + write_stencil;
- if (st->drawpix.z_shader) {
- return st->drawpix.z_shader->driver_shader;
+ assert(shaderIndex < Elements(st->drawpix.shaders));
+
+ if (st->drawpix.shaders[shaderIndex]) {
+ /* already have the proper shader */
+ return st->drawpix.shaders[shaderIndex]->driver_shader;
}
/*
if (!p)
return NULL;
- p->NumInstructions = 3;
+ p->NumInstructions = write_depth ? 2 : 1;
+ p->NumInstructions += write_stencil ? 1 : 0;
p->Instructions = _mesa_alloc_instructions(p->NumInstructions);
if (!p->Instructions) {
}
_mesa_init_instructions(p->Instructions, p->NumInstructions);
- /* TEX result.depth, fragment.texcoord[0], texture[0], 2D; */
- p->Instructions[ic].Opcode = OPCODE_TEX;
- p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
- p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPTH;
- p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Z;
- p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
- p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0;
- p->Instructions[ic].TexSrcUnit = 0;
- p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX;
- ic++;
-
- /* MOV result.color, fragment.color */
- p->Instructions[ic].Opcode = OPCODE_MOV;
- p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
- p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR;
- p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
- p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0;
- ic++;
+ if (write_depth) {
+ /* TEX result.depth, fragment.texcoord[0], texture[0], 2D; */
+ p->Instructions[ic].Opcode = OPCODE_TEX;
+ p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
+ p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPTH;
+ p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Z;
+ p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
+ p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0;
+ p->Instructions[ic].TexSrcUnit = 0;
+ p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX;
+ ic++;
+ }
+
+ if (write_stencil) {
+ /* TEX result.stencil, fragment.texcoord[0], texture[0], 2D; */
+ p->Instructions[ic].Opcode = OPCODE_TEX;
+ p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
+ p->Instructions[ic].DstReg.Index = FRAG_RESULT_STENCIL;
+ p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Y;
+ p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
+ p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0;
+ p->Instructions[ic].TexSrcUnit = 1;
+ p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX;
+ ic++;
+ }
/* END; */
p->Instructions[ic++].Opcode = OPCODE_END;
assert(ic == p->NumInstructions);
p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0;
- p->OutputsWritten = (1 << FRAG_RESULT_COLOR) | (1 << FRAG_RESULT_DEPTH);
- p->SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */
+ p->OutputsWritten = 0;
+ if (write_depth)
+ p->OutputsWritten |= (1 << FRAG_RESULT_DEPTH);
+ if (write_stencil)
+ p->OutputsWritten |= (1 << FRAG_RESULT_STENCIL);
+
+ p->SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */
+ if (write_stencil)
+ p->SamplersUsed |= 1 << 1;
+
+ stp = st_fragment_program((struct gl_fragment_program *) p);
- st->drawpix.z_shader = (struct st_fragment_program *) p;
- st_translate_fragment_program(st, st->drawpix.z_shader);
+ /* save the new shader */
+ st->drawpix.shaders[shaderIndex] = stp;
- return st->drawpix.z_shader->driver_shader;
+ st_translate_fragment_program(st, stp);
+
+ return stp->driver_shader;
}
GLboolean passColor)
{
if (!st->drawpix.vert_shaders[passColor]) {
- struct ureg_program *ureg =
- ureg_create( TGSI_PROCESSOR_VERTEX );
+ struct ureg_program *ureg = ureg_create( TGSI_PROCESSOR_VERTEX );
if (ureg == NULL)
return NULL;
const struct gl_pixelstore_attrib *unpack,
const GLvoid *pixels)
{
- GLcontext *ctx = st->ctx;
+ struct gl_context *ctx = st->ctx;
struct pipe_context *pipe = st->pipe;
gl_format mformat;
struct pipe_resource *pt;
baseFormat = base_format(format);
- mformat = st_ChooseTextureFormat(ctx, baseFormat, format, type);
+ mformat = st_ChooseTextureFormat_renderable(ctx, baseFormat,
+ format, type, GL_FALSE);
assert(mformat);
pipeFormat = st_mesa_format_to_pipe_format(mformat);
* \param invertTex if true, flip texcoords vertically
*/
static void
-draw_quad(GLcontext *ctx, GLfloat x0, GLfloat y0, GLfloat z,
+draw_quad(struct gl_context *ctx, GLfloat x0, GLfloat y0, GLfloat z,
GLfloat x1, GLfloat y1, const GLfloat *color,
GLboolean invertTex, GLfloat maxXcoord, GLfloat maxYcoord)
{
static void
-draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
+draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
GLsizei width, GLsizei height,
GLfloat zoomX, GLfloat zoomY,
- struct pipe_sampler_view *sv,
+ struct pipe_sampler_view **sv,
+ int num_sampler_view,
void *driver_vp,
void *driver_fp,
const GLfloat *color,
- GLboolean invertTex)
+ GLboolean invertTex,
+ GLboolean write_depth, GLboolean write_stencil)
{
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct cso_context *cso = st->cso_context;
GLfloat x0, y0, x1, y1;
GLsizei maxSize;
- boolean normalized = sv->texture->target != PIPE_TEXTURE_RECT;
+ boolean normalized = sv[0]->texture->target != PIPE_TEXTURE_RECT;
/* limit checks */
/* XXX if DrawPixels image is larger than max texture size, break
* it up into chunks.
*/
- maxSize = 1 << (pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1);
+ maxSize = 1 << (pipe->screen->get_param(pipe->screen,
+ PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1);
assert(width <= maxSize);
assert(height <= maxSize);
+ cso_save_depth_stencil_alpha(cso);
cso_save_rasterizer(cso);
cso_save_viewport(cso);
cso_save_samplers(cso);
cso_set_rasterizer(cso, &rasterizer);
}
+ if (write_depth || write_stencil)
+ {
+ struct pipe_depth_stencil_alpha_state dsa;
+ memset(&dsa, 0, sizeof(dsa));
+ if (write_depth) {
+ dsa.depth.enabled = 1;
+ dsa.depth.func = PIPE_FUNC_ALWAYS;
+ dsa.depth.writemask = 1;
+ }
+ if (write_stencil) {
+ dsa.stencil[0].enabled = 1;
+ dsa.stencil[0].func = PIPE_FUNC_ALWAYS;
+ dsa.stencil[0].writemask = 0xff;
+ dsa.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE;
+ }
+ cso_set_depth_stencil_alpha(cso, &dsa);
+ }
+
/* fragment shader state: TEX lookup program */
cso_set_fragment_shader_handle(cso, driver_fp);
sampler.normalized_coords = normalized;
cso_single_sampler(cso, 0, &sampler);
- if (st->pixel_xfer.pixelmap_enabled) {
+ if (num_sampler_view > 1) {
cso_single_sampler(cso, 1, &sampler);
}
cso_single_sampler_done(cso);
cso_set_vertex_elements(cso, 3, st->velems_util_draw);
/* texture state: */
- if (st->pixel_xfer.pixelmap_enabled) {
- struct pipe_sampler_view *sampler_views[2];
- sampler_views[0] = sv;
- sampler_views[1] = st->pixel_xfer.pixelmap_sampler_view;
- cso_set_fragment_sampler_views(cso, 2, sampler_views);
- }
- else {
- cso_set_fragment_sampler_views(cso, 1, &sv);
- }
+ cso_set_fragment_sampler_views(cso, num_sampler_view, sv);
/* Compute Gallium window coords (y=0=top) with pixel zoom.
* Recall that these coords are transformed by the current
z = z * 2.0 - 1.0;
draw_quad(ctx, x0, y0, z, x1, y1, color, invertTex,
- normalized ? ((GLfloat) width / sv->texture->width0) : (GLfloat)width,
- normalized ? ((GLfloat) height / sv->texture->height0) : (GLfloat)height);
+ normalized ? ((GLfloat) width / sv[0]->texture->width0) : (GLfloat)width,
+ normalized ? ((GLfloat) height / sv[0]->texture->height0) : (GLfloat)height);
/* restore state */
+ cso_restore_depth_stencil_alpha(cso);
cso_restore_rasterizer(cso);
cso_restore_viewport(cso);
cso_restore_samplers(cso);
}
+/**
+ * Software fallback to do glDrawPixels(GL_STENCIL_INDEX) when we
+ * can't use a fragment shader to write stencil values.
+ */
static void
-draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
+draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height, GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
const GLvoid *pixels)
}
if(format != GL_DEPTH_STENCIL &&
- util_format_get_component_bits(strb->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0)
+ util_format_get_component_bits(strb->format,
+ UTIL_FORMAT_COLORSPACE_ZS, 0) != 0)
usage = PIPE_TRANSFER_READ_WRITE;
else
usage = PIPE_TRANSFER_WRITE;
* Called via ctx->Driver.DrawPixels()
*/
static void
-st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
+st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
+ GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels)
{
void *driver_vp, *driver_fp;
struct st_context *st = st_context(ctx);
const GLfloat *color;
-
- if (format == GL_STENCIL_INDEX ||
- format == GL_DEPTH_STENCIL) {
- draw_stencil_pixels(ctx, x, y, width, height, format, type,
- unpack, pixels);
- return;
+ struct pipe_context *pipe = st->pipe;
+ GLboolean write_stencil = GL_FALSE, write_depth = GL_FALSE;
+ struct pipe_sampler_view *sv[2];
+ int num_sampler_view = 1;
+ enum pipe_format stencil_format = PIPE_FORMAT_NONE;
+
+ if (format == GL_DEPTH_STENCIL)
+ write_stencil = write_depth = GL_TRUE;
+ else if (format == GL_STENCIL_INDEX)
+ write_stencil = GL_TRUE;
+ else if (format == GL_DEPTH_COMPONENT)
+ write_depth = GL_TRUE;
+
+ if (write_stencil) {
+ enum pipe_format tex_format;
+ /* can we write to stencil if not fallback */
+ if (!pipe->screen->get_param(pipe->screen, PIPE_CAP_SHADER_STENCIL_EXPORT))
+ goto stencil_fallback;
+
+ tex_format = st_choose_format(st->pipe->screen, base_format(format),
+ PIPE_TEXTURE_2D,
+ 0, PIPE_BIND_SAMPLER_VIEW);
+ if (tex_format == PIPE_FORMAT_Z24_UNORM_S8_USCALED)
+ stencil_format = PIPE_FORMAT_X24S8_USCALED;
+ else if (tex_format == PIPE_FORMAT_S8_USCALED_Z24_UNORM)
+ stencil_format = PIPE_FORMAT_S8X24_USCALED;
+ else
+ stencil_format = PIPE_FORMAT_S8_USCALED;
+ if (stencil_format == PIPE_FORMAT_NONE)
+ goto stencil_fallback;
}
/* Mesa state should be up to date by now */
st_validate_state(st);
- if (format == GL_DEPTH_COMPONENT) {
- driver_fp = make_fragment_shader_z(st);
+ if (write_depth || write_stencil) {
+ driver_fp = make_fragment_shader_z_stencil(st, write_depth, write_stencil);
driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
color = ctx->Current.RasterColor;
}
driver_fp = combined_drawpix_fragment_program(ctx);
driver_vp = make_passthrough_vertex_shader(st, GL_FALSE);
color = NULL;
+ if (st->pixel_xfer.pixelmap_enabled) {
+ sv[1] = st->pixel_xfer.pixelmap_sampler_view;
+ num_sampler_view++;
+ }
}
/* draw with textured quad */
struct pipe_resource *pt
= make_texture(st, width, height, format, type, unpack, pixels);
if (pt) {
- struct pipe_sampler_view *sv = st_create_texture_sampler_view(st->pipe, pt);
+ sv[0] = st_create_texture_sampler_view(st->pipe, pt);
+
+ if (sv[0]) {
+ if (write_stencil) {
+ sv[1] = st_create_texture_sampler_view_format(st->pipe, pt,
+ stencil_format);
+ num_sampler_view++;
+ }
- if (sv) {
draw_textured_quad(ctx, x, y, ctx->Current.RasterPos[2],
- width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY,
+ width, height,
+ ctx->Pixel.ZoomX, ctx->Pixel.ZoomY,
sv,
- driver_vp,
+ num_sampler_view,
+ driver_vp,
driver_fp,
- color, GL_FALSE);
- pipe_sampler_view_reference(&sv, NULL);
+ color, GL_FALSE, write_depth, write_stencil);
+ pipe_sampler_view_reference(&sv[0], NULL);
+ if (num_sampler_view > 1)
+ pipe_sampler_view_reference(&sv[1], NULL);
}
pipe_resource_reference(&pt, NULL);
}
}
+ return;
+
+stencil_fallback:
+ draw_stencil_pixels(ctx, x, y, width, height, format, type,
+ unpack, pixels);
}
+/**
+ * Software fallback for glCopyPixels(GL_STENCIL).
+ */
static void
-copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
+copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
GLint dstx, GLint dsty)
{
GL_STENCIL_INDEX, GL_UNSIGNED_BYTE,
&ctx->DefaultPacking, buffer);
- if(util_format_get_component_bits(rbDraw->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0)
+ if (util_format_get_component_bits(rbDraw->format,
+ UTIL_FORMAT_COLORSPACE_ZS, 0) != 0)
usage = PIPE_TRANSFER_READ_WRITE;
else
usage = PIPE_TRANSFER_WRITE;
static void
-st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
+st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
GLsizei width, GLsizei height,
GLint dstx, GLint dsty, GLenum type)
{
struct st_renderbuffer *rbRead;
void *driver_vp, *driver_fp;
struct pipe_resource *pt;
- struct pipe_sampler_view *sv;
+ struct pipe_sampler_view *sv[2];
+ int num_sampler_view = 1;
GLfloat *color;
enum pipe_format srcFormat, texFormat;
GLboolean invertTex = GL_FALSE;
color = NULL;
driver_fp = combined_drawpix_fragment_program(ctx);
driver_vp = make_passthrough_vertex_shader(st, GL_FALSE);
+ if (st->pixel_xfer.pixelmap_enabled) {
+ sv[1] = st->pixel_xfer.pixelmap_sampler_view;
+ num_sampler_view++;
+ }
}
else {
assert(type == GL_DEPTH);
rbRead = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer);
color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
- driver_fp = make_fragment_shader_z(st);
+ driver_fp = make_fragment_shader_z_stencil(st, GL_TRUE, GL_FALSE);
driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
}
srcFormat = rbRead->texture->format;
- if (screen->is_format_supported(screen, srcFormat, st->internal_target, sample_count,
+ if (screen->is_format_supported(screen, srcFormat, st->internal_target,
+ sample_count,
PIPE_BIND_SAMPLER_VIEW, 0)) {
texFormat = srcFormat;
}
if (!pt)
return;
- sv = st_create_texture_sampler_view(st->pipe, pt);
- if (!sv) {
+ sv[0] = st_create_texture_sampler_view(st->pipe, pt);
+ if (!sv[0]) {
pipe_resource_reference(&pt, NULL);
return;
}
*/
draw_textured_quad(ctx, dstx, dsty, ctx->Current.RasterPos[2],
width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY,
- sv,
+ sv,
+ num_sampler_view,
driver_vp,
driver_fp,
- color, invertTex);
+ color, invertTex, GL_FALSE, GL_FALSE);
pipe_resource_reference(&pt, NULL);
- pipe_sampler_view_reference(&sv, NULL);
+ pipe_sampler_view_reference(&sv[0], NULL);
}
void
st_destroy_drawpix(struct st_context *st)
{
- st_reference_fragprog(st, &st->drawpix.z_shader, NULL);
+ GLuint i;
+
+ for (i = 0; i < Elements(st->drawpix.shaders); i++) {
+ if (st->drawpix.shaders[i])
+ st_reference_fragprog(st, &st->drawpix.shaders[i], NULL);
+ }
+
st_reference_fragprog(st, &st->pixel_xfer.combined_prog, NULL);
if (st->drawpix.vert_shaders[0])
ureg_free_tokens(st->drawpix.vert_shaders[0]);
}
static void
-st_DrawTex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
+st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
GLfloat width, GLfloat height)
{
struct st_context *st = ctx->st;
}
static void
-st_egl_image_target_renderbuffer_storage(GLcontext *ctx,
+st_egl_image_target_renderbuffer_storage(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLeglImageOES image_handle)
{
}
static void
-st_bind_surface(GLcontext *ctx, GLenum target,
+st_bind_surface(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage,
struct pipe_surface *ps)
}
static void
-st_egl_image_target_texture_2d(GLcontext *ctx, GLenum target,
+st_egl_image_target_texture_2d(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage,
GLeglImageOES image_handle)
* during window resize.
*/
static GLboolean
-st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
+st_renderbuffer_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width, GLuint height)
{
* gl_renderbuffer::GetPointer()
*/
static void *
-null_get_pointer(GLcontext * ctx, struct gl_renderbuffer *rb,
+null_get_pointer(struct gl_context * ctx, struct gl_renderbuffer *rb,
GLint x, GLint y)
{
/* By returning NULL we force all software rendering to go through
* Called via ctx->Driver.NewFramebuffer()
*/
static struct gl_framebuffer *
-st_new_framebuffer(GLcontext *ctx, GLuint name)
+st_new_framebuffer(struct gl_context *ctx, GLuint name)
{
/* XXX not sure we need to subclass gl_framebuffer for pipe */
return _mesa_new_framebuffer(ctx, name);
* Called via ctx->Driver.NewRenderbuffer()
*/
static struct gl_renderbuffer *
-st_new_renderbuffer(GLcontext *ctx, GLuint name)
+st_new_renderbuffer(struct gl_context *ctx, GLuint name)
{
struct st_renderbuffer *strb = ST_CALLOC_STRUCT(st_renderbuffer);
if (strb) {
case PIPE_FORMAT_R16G16B16A16_SNORM:
strb->Base.InternalFormat = GL_RGBA16;
break;
+ case PIPE_FORMAT_R8_UNORM:
+ strb->Base.InternalFormat = GL_R8;
+ break;
+ case PIPE_FORMAT_R8G8_UNORM:
+ strb->Base.InternalFormat = GL_RG8;
+ break;
+ case PIPE_FORMAT_R16_UNORM:
+ strb->Base.InternalFormat = GL_R16;
+ break;
+ case PIPE_FORMAT_R16G16_UNORM:
+ strb->Base.InternalFormat = GL_RG16;
+ break;
default:
_mesa_problem(NULL,
"Unexpected format in st_new_renderbuffer_fb");
* Called via ctx->Driver.BindFramebufferEXT().
*/
static void
-st_bind_framebuffer(GLcontext *ctx, GLenum target,
+st_bind_framebuffer(struct gl_context *ctx, GLenum target,
struct gl_framebuffer *fb, struct gl_framebuffer *fbread)
{
* Called by ctx->Driver.FramebufferRenderbuffer
*/
static void
-st_framebuffer_renderbuffer(GLcontext *ctx,
+st_framebuffer_renderbuffer(struct gl_context *ctx,
struct gl_framebuffer *fb,
GLenum attachment,
struct gl_renderbuffer *rb)
* Called by ctx->Driver.RenderTexture
*/
static void
-st_render_texture(GLcontext *ctx,
+st_render_texture(struct gl_context *ctx,
struct gl_framebuffer *fb,
struct gl_renderbuffer_attachment *att)
{
* Called via ctx->Driver.FinishRenderTexture.
*/
static void
-st_finish_render_texture(GLcontext *ctx,
+st_finish_render_texture(struct gl_context *ctx,
struct gl_renderbuffer_attachment *att)
{
struct st_context *st = st_context(ctx);
* For Gallium we only supports combined Z+stencil, not separate buffers.
*/
static void
-st_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
+st_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
{
struct st_context *st = st_context(ctx);
struct pipe_screen *screen = st->pipe->screen;
* Called via glDrawBuffer.
*/
static void
-st_DrawBuffers(GLcontext *ctx, GLsizei count, const GLenum *buffers)
+st_DrawBuffers(struct gl_context *ctx, GLsizei count, const GLenum *buffers)
{
struct st_context *st = st_context(ctx);
- GLframebuffer *fb = ctx->DrawBuffer;
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
GLuint i;
(void) count;
* Called via glReadBuffer.
*/
static void
-st_ReadBuffer(GLcontext *ctx, GLenum buffer)
+st_ReadBuffer(struct gl_context *ctx, GLenum buffer)
{
struct st_context *st = st_context(ctx);
- GLframebuffer *fb = ctx->ReadBuffer;
+ struct gl_framebuffer *fb = ctx->ReadBuffer;
(void) buffer;
struct feedback_stage
{
struct draw_stage stage; /**< Base class */
- GLcontext *ctx; /**< Rendering context */
+ struct gl_context *ctx; /**< Rendering context */
GLboolean reset_stipple_counter;
};
static void
-feedback_vertex(GLcontext *ctx, const struct draw_context *draw,
+feedback_vertex(struct gl_context *ctx, const struct draw_context *draw,
const struct vertex_header *v)
{
const struct st_context *st = st_context(ctx);
* Create GL feedback drawing stage.
*/
static struct draw_stage *
-draw_glfeedback_stage(GLcontext *ctx, struct draw_context *draw)
+draw_glfeedback_stage(struct gl_context *ctx, struct draw_context *draw)
{
struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage);
* Create GL selection mode drawing stage.
*/
static struct draw_stage *
-draw_glselect_stage(GLcontext *ctx, struct draw_context *draw)
+draw_glselect_stage(struct gl_context *ctx, struct draw_context *draw)
{
struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage);
static void
-st_RenderMode(GLcontext *ctx, GLenum newMode )
+st_RenderMode(struct gl_context *ctx, GLenum newMode )
{
struct st_context *st = st_context(ctx);
struct draw_context *draw = st->draw;
static INLINE GLboolean
is_front_buffer_dirty(struct st_context *st)
{
- GLframebuffer *fb = st->ctx->DrawBuffer;
+ struct gl_framebuffer *fb = st->ctx->DrawBuffer;
struct st_renderbuffer *strb
= st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
return strb && strb->defined;
static void
display_front_buffer(struct st_context *st)
{
- GLframebuffer *fb = st->ctx->DrawBuffer;
+ struct gl_framebuffer *fb = st->ctx->DrawBuffer;
struct st_renderbuffer *strb
= st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
/**
* Called via ctx->Driver.Flush()
*/
-static void st_glFlush(GLcontext *ctx)
+static void st_glFlush(struct gl_context *ctx)
{
struct st_context *st = st_context(ctx);
/**
* Called via ctx->Driver.Finish()
*/
-static void st_glFinish(GLcontext *ctx)
+static void st_glFinish(struct gl_context *ctx)
{
struct st_context *st = st_context(ctx);
* Called via ctx->Driver.BindProgram() to bind an ARB vertex or
* fragment program.
*/
-static void st_bind_program( GLcontext *ctx,
+static void st_bind_program( struct gl_context *ctx,
GLenum target,
struct gl_program *prog )
{
* Called via ctx->Driver.UseProgram() to bind a linked GLSL program
* (vertex shader + fragment shader).
*/
-static void st_use_program( GLcontext *ctx, struct gl_shader_program *shProg)
+static void st_use_program( struct gl_context *ctx, struct gl_shader_program *shProg)
{
struct st_context *st = st_context(ctx);
* Called via ctx->Driver.NewProgram() to allocate a new vertex or
* fragment program.
*/
-static struct gl_program *st_new_program( GLcontext *ctx,
+static struct gl_program *st_new_program( struct gl_context *ctx,
GLenum target,
GLuint id )
{
void
-st_delete_program(GLcontext *ctx, struct gl_program *prog)
+st_delete_program(struct gl_context *ctx, struct gl_program *prog)
{
struct st_context *st = st_context(ctx);
}
-static GLboolean st_is_program_native( GLcontext *ctx,
+static GLboolean st_is_program_native( struct gl_context *ctx,
GLenum target,
struct gl_program *prog )
{
}
-static GLboolean st_program_string_notify( GLcontext *ctx,
+static GLboolean st_program_string_notify( struct gl_context *ctx,
GLenum target,
struct gl_program *prog )
{
st_init_program_functions(struct dd_function_table *functions);
extern void
-st_delete_program(GLcontext *ctx, struct gl_program *prog);
+st_delete_program(struct gl_context *ctx, struct gl_program *prog);
#endif
#if FEATURE_queryobj
static struct gl_query_object *
-st_NewQueryObject(GLcontext *ctx, GLuint id)
+st_NewQueryObject(struct gl_context *ctx, GLuint id)
{
struct st_query_object *stq = ST_CALLOC_STRUCT(st_query_object);
if (stq) {
static void
-st_DeleteQuery(GLcontext *ctx, struct gl_query_object *q)
+st_DeleteQuery(struct gl_context *ctx, struct gl_query_object *q)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_query_object *stq = st_query_object(q);
static void
-st_BeginQuery(GLcontext *ctx, struct gl_query_object *q)
+st_BeginQuery(struct gl_context *ctx, struct gl_query_object *q)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_query_object *stq = st_query_object(q);
static void
-st_EndQuery(GLcontext *ctx, struct gl_query_object *q)
+st_EndQuery(struct gl_context *ctx, struct gl_query_object *q)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_query_object *stq = st_query_object(q);
static void
-st_WaitQuery(GLcontext *ctx, struct gl_query_object *q)
+st_WaitQuery(struct gl_context *ctx, struct gl_query_object *q)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_query_object *stq = st_query_object(q);
static void
-st_CheckQuery(GLcontext *ctx, struct gl_query_object *q)
+st_CheckQuery(struct gl_context *ctx, struct gl_query_object *q)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
struct st_query_object *stq = st_query_object(q);
#include "st_atom.h"
#include "st_draw.h"
#include "st_cb_rasterpos.h"
-#include "st_draw.h"
#include "draw/draw_context.h"
#include "draw/draw_pipe.h"
#include "vbo/vbo.h"
struct rastpos_stage
{
struct draw_stage stage; /**< Base class */
- GLcontext *ctx; /**< Rendering context */
+ struct gl_context *ctx; /**< Rendering context */
/* vertex attrib info we can setup once and re-use */
struct gl_client_array array[VERT_ATTRIB_MAX];
* else copy the current attrib.
*/
static void
-update_attrib(GLcontext *ctx, const GLuint *outputMapping,
+update_attrib(struct gl_context *ctx, const GLuint *outputMapping,
const struct vertex_header *vert,
GLfloat *dest,
GLuint result, GLuint defaultAttrib)
rastpos_point(struct draw_stage *stage, struct prim_header *prim)
{
struct rastpos_stage *rs = rastpos_stage(stage);
- GLcontext *ctx = rs->ctx;
+ struct gl_context *ctx = rs->ctx;
struct st_context *st = st_context(ctx);
const GLfloat height = (GLfloat) ctx->DrawBuffer->Height;
const GLuint *outputMapping = st->vertex_result_to_slot;
* Create rasterpos "drawing" stage.
*/
static struct rastpos_stage *
-new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw)
+new_draw_rastpos_stage(struct gl_context *ctx, struct draw_context *draw)
{
struct rastpos_stage *rs = ST_CALLOC_STRUCT(rastpos_stage);
GLuint i;
static void
-st_RasterPos(GLcontext *ctx, const GLfloat v[4])
+st_RasterPos(struct gl_context *ctx, const GLfloat v[4])
{
struct st_context *st = st_context(ctx);
struct draw_context *draw = st->draw;
* For color/depth we use get_tile(). For stencil, map the stencil buffer.
*/
void
-st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
+st_read_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *packing,
* commands.
*/
struct st_renderbuffer *
-st_get_color_read_renderbuffer(GLcontext *ctx)
+st_get_color_read_renderbuffer(struct gl_context *ctx)
{
struct gl_framebuffer *fb = ctx->ReadBuffer;
struct st_renderbuffer *strb =
* \return GL_TRUE for success, GL_FALSE for failure
*/
static GLboolean
-st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
+st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack,
* Image transfer ops are done in software too.
*/
static void
-st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
+st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *pack,
GLvoid *dest)
struct dd_function_table;
extern struct st_renderbuffer *
-st_get_color_read_renderbuffer(GLcontext *ctx);
+st_get_color_read_renderbuffer(struct gl_context *ctx);
extern void
-st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
+st_read_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *packing,
#define ST_VERSION_STRING "0.4"
static const GLubyte *
-st_get_string(GLcontext * ctx, GLenum name)
+st_get_string(struct gl_context * ctx, GLenum name)
{
struct st_context *st = st_context(ctx);
struct pipe_screen *screen = st->pipe->screen;
/** called via ctx->Driver.NewTextureImage() */
static struct gl_texture_image *
-st_NewTextureImage(GLcontext * ctx)
+st_NewTextureImage(struct gl_context * ctx)
{
DBG("%s\n", __FUNCTION__);
(void) ctx;
/** called via ctx->Driver.NewTextureObject() */
static struct gl_texture_object *
-st_NewTextureObject(GLcontext * ctx, GLuint name, GLenum target)
+st_NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target)
{
struct st_texture_object *obj = ST_CALLOC_STRUCT(st_texture_object);
/** called via ctx->Driver.DeleteTextureObject() */
static void
-st_DeleteTextureObject(GLcontext *ctx,
+st_DeleteTextureObject(struct gl_context *ctx,
struct gl_texture_object *texObj)
{
struct st_context *st = st_context(ctx);
/** called via ctx->Driver.FreeTexImageData() */
static void
-st_FreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage)
+st_FreeTextureImageData(struct gl_context * ctx, struct gl_texture_image *texImage)
{
struct st_texture_image *stImage = st_texture_image(texImage);
* \return GL_TRUE for success, GL_FALSE for failure
*/
static GLboolean
-compress_with_blit(GLcontext * ctx,
+compress_with_blit(struct gl_context * ctx,
GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
* Do glTexImage1/2/3D().
*/
static void
-st_TexImage(GLcontext * ctx,
+st_TexImage(struct gl_context * ctx,
GLint dims,
GLenum target, GLint level,
GLint internalFormat,
static void
-st_TexImage3D(GLcontext * ctx,
+st_TexImage3D(struct gl_context * ctx,
GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint depth,
static void
-st_TexImage2D(GLcontext * ctx,
+st_TexImage2D(struct gl_context * ctx,
GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
static void
-st_TexImage1D(GLcontext * ctx,
+st_TexImage1D(struct gl_context * ctx,
GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint border,
static void
-st_CompressedTexImage2D(GLcontext *ctx, GLenum target, GLint level,
+st_CompressedTexImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLint internalFormat,
GLint width, GLint height, GLint border,
GLsizei imageSize, const GLvoid *data,
* a textured quad. Store the results in the user's buffer.
*/
static void
-decompress_with_blit(GLcontext * ctx, GLenum target, GLint level,
+decompress_with_blit(struct gl_context * ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid *pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
* then unmap it.
*/
static void
-st_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
+st_get_tex_image(struct gl_context * ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid * pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage, GLboolean compressed_dst)
static void
-st_GetTexImage(GLcontext * ctx, GLenum target, GLint level,
+st_GetTexImage(struct gl_context * ctx, GLenum target, GLint level,
GLenum format, GLenum type, GLvoid * pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
static void
-st_GetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
+st_GetCompressedTexImage(struct gl_context *ctx, GLenum target, GLint level,
GLvoid *pixels,
struct gl_texture_object *texObj,
struct gl_texture_image *texImage)
static void
-st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level,
+st_TexSubimage(struct gl_context *ctx, GLint dims, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
GLenum format, GLenum type, const void *pixels,
static void
-st_TexSubImage3D(GLcontext *ctx, GLenum target, GLint level,
+st_TexSubImage3D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type, const GLvoid *pixels,
static void
-st_TexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
+st_TexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid * pixels,
static void
-st_TexSubImage1D(GLcontext *ctx, GLenum target, GLint level,
+st_TexSubImage1D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLsizei width, GLenum format, GLenum type,
const GLvoid * pixels,
const struct gl_pixelstore_attrib *packing,
static void
-st_CompressedTexSubImage1D(GLcontext *ctx, GLenum target, GLint level,
+st_CompressedTexSubImage1D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLsizei width,
GLenum format,
GLsizei imageSize, const GLvoid *data,
static void
-st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
+st_CompressedTexSubImage2D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLint height,
GLenum format,
static void
-st_CompressedTexSubImage3D(GLcontext *ctx, GLenum target, GLint level,
+st_CompressedTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLsizei width, GLint height, GLint depth,
GLenum format,
* Note: srcY=0=TOP of renderbuffer
*/
static void
-fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level,
+fallback_copy_texsubimage(struct gl_context *ctx, GLenum target, GLint level,
struct st_renderbuffer *strb,
struct st_texture_image *stImage,
GLenum baseFormat,
* If the src/dest are incompatible, return 0.
*/
static unsigned
-compatible_src_dst_formats(GLcontext *ctx,
+compatible_src_dst_formats(struct gl_context *ctx,
const struct gl_renderbuffer *src,
const struct gl_texture_image *dst)
{
* Note: srcY=0=Bottom of renderbuffer (GL convention)
*/
static void
-st_copy_texsubimage(GLcontext *ctx,
+st_copy_texsubimage(struct gl_context *ctx,
GLenum target, GLint level,
GLint destX, GLint destY, GLint destZ,
GLint srcX, GLint srcY,
static void
-st_CopyTexImage1D(GLcontext * ctx, GLenum target, GLint level,
+st_CopyTexImage1D(struct gl_context * ctx, GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y, GLsizei width, GLint border)
{
static void
-st_CopyTexImage2D(GLcontext * ctx, GLenum target, GLint level,
+st_CopyTexImage2D(struct gl_context * ctx, GLenum target, GLint level,
GLenum internalFormat,
GLint x, GLint y, GLsizei width, GLsizei height,
GLint border)
static void
-st_CopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
+st_CopyTexSubImage1D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset, GLint x, GLint y, GLsizei width)
{
const GLint yoffset = 0, zoffset = 0;
static void
-st_CopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
+st_CopyTexSubImage2D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLint x, GLint y, GLsizei width, GLsizei height)
{
static void
-st_CopyTexSubImage3D(GLcontext * ctx, GLenum target, GLint level,
+st_CopyTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint x, GLint y, GLsizei width, GLsizei height)
{
* \return GL_TRUE for success, GL_FALSE for failure (out of mem)
*/
GLboolean
-st_finalize_texture(GLcontext *ctx,
+st_finalize_texture(struct gl_context *ctx,
struct pipe_context *pipe,
struct gl_texture_object *tObj)
{
struct st_context;
extern GLboolean
-st_finalize_texture(GLcontext *ctx,
+st_finalize_texture(struct gl_context *ctx,
struct pipe_context *pipe,
struct gl_texture_object *tObj);
#include "util/u_atomic.h"
/**
- * Cast wrapper to convert a GLframebuffer to an st_framebuffer.
- * Return NULL if the GLframebuffer is a user-created framebuffer.
+ * Cast wrapper to convert a struct gl_framebuffer to an st_framebuffer.
+ * Return NULL if the struct gl_framebuffer is a user-created framebuffer.
* We'll only return non-null for window system framebuffers.
* Note that this function may fail.
*/
static INLINE struct st_framebuffer *
-st_ws_framebuffer(GLframebuffer *fb)
+st_ws_framebuffer(struct gl_framebuffer *fb)
{
/* FBO cannot be casted. See st_new_framebuffer */
return (struct st_framebuffer *) ((fb && !fb->Name) ? fb : NULL);
}
-static void st_viewport(GLcontext * ctx, GLint x, GLint y,
+static void st_viewport(struct gl_context * ctx, GLint x, GLint y,
GLsizei width, GLsizei height)
{
struct st_context *st = ctx->st;
#if 0
static struct gl_transform_feedback_object *
-st_new_transform_feedback(GLcontext *ctx, GLuint name)
+st_new_transform_feedback(struct gl_context *ctx, GLuint name)
{
struct gl_transform_feedback_object *obj;
obj = CALLOC_STRUCT(gl_transform_feedback_object);
#if 0
static void
-st_delete_transform_feedback(GLcontext *ctx,
+st_delete_transform_feedback(struct gl_context *ctx,
struct gl_transform_feedback_object *obj)
{
GLuint i;
static void
-st_begin_transform_feedback(GLcontext *ctx, GLenum mode,
+st_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
struct gl_transform_feedback_object *obj)
{
/* to-do */
static void
-st_end_transform_feedback(GLcontext *ctx,
+st_end_transform_feedback(struct gl_context *ctx,
struct gl_transform_feedback_object *obj)
{
/* to-do */
static void
-st_pause_transform_feedback(GLcontext *ctx,
+st_pause_transform_feedback(struct gl_context *ctx,
struct gl_transform_feedback_object *obj)
{
/* to-do */
static void
-st_resume_transform_feedback(GLcontext *ctx,
+st_resume_transform_feedback(struct gl_context *ctx,
struct gl_transform_feedback_object *obj)
{
/* to-do */
static void
-st_draw_transform_feedback(GLcontext *ctx, GLenum mode,
+st_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
struct gl_transform_feedback_object *obj)
{
/* XXX to do */
/**
* Called via ctx->Driver.UpdateState()
*/
-void st_invalidate_state(GLcontext * ctx, GLuint new_state)
+void st_invalidate_state(struct gl_context * ctx, GLuint new_state)
{
struct st_context *st = st_context(ctx);
static struct st_context *
-st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
+st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe )
{
uint i;
struct st_context *st = ST_CALLOC_STRUCT( st_context );
struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
- const __GLcontextModes *visual,
+ const struct gl_config *visual,
struct st_context *share)
{
- GLcontext *ctx;
- GLcontext *shareCtx = share ? share->ctx : NULL;
+ struct gl_context *ctx;
+ struct gl_context *shareCtx = share ? share->ctx : NULL;
struct dd_function_table funcs;
memset(&funcs, 0, sizeof(funcs));
{
struct pipe_context *pipe = st->pipe;
struct cso_context *cso = st->cso_context;
- GLcontext *ctx = st->ctx;
+ struct gl_context *ctx = st->ctx;
GLuint i;
/* need to unbind and destroy CSO objects before anything else */
{
struct st_context_iface iface;
- GLcontext *ctx;
+ struct gl_context *ctx;
struct pipe_context *pipe;
/** for glDraw/CopyPixels */
struct {
- struct st_fragment_program *z_shader;
+ struct st_fragment_program *shaders[4];
void *vert_shaders[2]; /**< ureg shaders */
} drawpix;
/* Need this so that we can implement Mesa callbacks in this module.
*/
-static INLINE struct st_context *st_context(GLcontext *ctx)
+static INLINE struct st_context *st_context(struct gl_context *ctx)
{
return ctx->st;
}
/**
- * Wrapper for GLframebuffer.
+ * Wrapper for struct gl_framebuffer.
* This is an opaque type to the outside world.
*/
struct st_framebuffer
{
- GLframebuffer Base;
+ struct gl_framebuffer Base;
void *Private;
struct st_framebuffer_iface *iface;
extern void st_init_driver_functions(struct dd_function_table *functions);
-void st_invalidate_state(GLcontext * ctx, GLuint new_state);
+void st_invalidate_state(struct gl_context * ctx, GLuint new_state);
extern struct st_context *
st_create_context(gl_api api, struct pipe_context *pipe,
- const __GLcontextModes *visual,
+ const struct gl_config *visual,
struct st_context *share);
extern void
* \param velements returns vertex element info
*/
static void
-setup_interleaved_attribs(GLcontext *ctx,
+setup_interleaved_attribs(struct gl_context *ctx,
const struct st_vertex_program *vp,
const struct st_vp_varient *vpv,
const struct gl_client_array **arrays,
* \param velements returns vertex element info
*/
static void
-setup_non_interleaved_attribs(GLcontext *ctx,
+setup_non_interleaved_attribs(struct gl_context *ctx,
const struct st_vertex_program *vp,
const struct st_vp_varient *vpv,
const struct gl_client_array **arrays,
static void
-setup_index_buffer(GLcontext *ctx,
+setup_index_buffer(struct gl_context *ctx,
const struct _mesa_index_buffer *ib,
struct pipe_index_buffer *ibuffer)
{
* issue a warning.
*/
static void
-check_uniforms(GLcontext *ctx)
+check_uniforms(struct gl_context *ctx)
{
const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
if (shProg && shProg->LinkStatus) {
* the corresponding Gallium type.
*/
static unsigned
-translate_prim(const GLcontext *ctx, unsigned prim)
+translate_prim(const struct gl_context *ctx, unsigned prim)
{
/* GL prims should match Gallium prims, spot-check a few */
assert(GL_POINTS == PIPE_PRIM_POINTS);
* Basically, translate the information into the format expected by gallium.
*/
void
-st_draw_vbo(GLcontext *ctx,
+st_draw_vbo(struct gl_context *ctx,
const struct gl_client_array **arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
void st_init_draw( struct st_context *st )
{
- GLcontext *ctx = st->ctx;
+ struct gl_context *ctx = st->ctx;
vbo_set_draw_func(ctx, st_draw_vbo);
void st_destroy_draw( struct st_context *st );
extern void
-st_draw_vbo(GLcontext *ctx,
+st_draw_vbo(struct gl_context *ctx,
const struct gl_client_array **arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
GLuint max_index);
extern void
-st_feedback_draw_vbo(GLcontext *ctx,
+st_feedback_draw_vbo(struct gl_context *ctx,
const struct gl_client_array **arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
* GL_SELECT or GL_FEEDBACK mode or for glRasterPos.
*/
static void
-set_feedback_vertex_format(GLcontext *ctx)
+set_feedback_vertex_format(struct gl_context *ctx)
{
#if 0
struct st_context *st = st_context(ctx);
* Might move this into the failover module some day.
*/
void
-st_feedback_draw_vbo(GLcontext *ctx,
+st_feedback_draw_vbo(struct gl_context *ctx,
const struct gl_client_array **arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
void st_init_extensions(struct st_context *st)
{
struct pipe_screen *screen = st->pipe->screen;
- GLcontext *ctx = st->ctx;
+ struct gl_context *ctx = st->ctx;
/*
* Extensions that are supported by all Gallium drivers:
ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
}
+ if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW, 0)) {
+ ctx->Extensions.ARB_texture_rg = GL_TRUE;
+ }
+
/* s3tc support */
if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
PIPE_TEXTURE_2D, 0,
if (screen->get_param(screen, PIPE_CAP_DEPTH_CLAMP)) {
ctx->Extensions.ARB_depth_clamp = GL_TRUE;
}
+
+ if (screen->get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT)) {
+ ctx->Extensions.ARB_shader_stencil_export = GL_TRUE;
+ }
}
case MESA_FORMAT_SARGB8:
return PIPE_FORMAT_B8G8R8A8_SRGB;
#endif
+ case MESA_FORMAT_R8:
+ return PIPE_FORMAT_R8_UNORM;
+ case MESA_FORMAT_R16:
+ return PIPE_FORMAT_R16_UNORM;
+ case MESA_FORMAT_RG88:
+ return PIPE_FORMAT_R8G8_UNORM;
+ case MESA_FORMAT_RG1616:
+ return PIPE_FORMAT_R16G16_UNORM;
default:
assert(0);
return PIPE_FORMAT_NONE;
case PIPE_FORMAT_B8G8R8A8_SRGB:
return MESA_FORMAT_SARGB8;
#endif
+
+ case PIPE_FORMAT_R8_UNORM:
+ return MESA_FORMAT_R8;
+ case PIPE_FORMAT_R16_UNORM:
+ return MESA_FORMAT_R16;
+ case PIPE_FORMAT_R8G8_UNORM:
+ return MESA_FORMAT_RG88;
+ case PIPE_FORMAT_R16G16_UNORM:
+ return MESA_FORMAT_RG1616;
default:
assert(0);
return MESA_FORMAT_NONE;
return default_srgba_format( screen, target, sample_count, bindings,
geom_flags );
+ case GL_RED:
+ case GL_R8:
+ if (screen->is_format_supported(screen, PIPE_FORMAT_R8_UNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_R8_UNORM;
+ return PIPE_FORMAT_NONE;
+ case GL_RG:
+ case GL_RG8:
+ if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_R8G8_UNORM;
+ return PIPE_FORMAT_NONE;
+
+ case GL_R16:
+ if (screen->is_format_supported(screen, PIPE_FORMAT_R16_UNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_R16_UNORM;
+ return PIPE_FORMAT_NONE;
+
+ case GL_RG16:
+ if (screen->is_format_supported(screen, PIPE_FORMAT_R16G16_UNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_R16G16_UNORM;
+ return PIPE_FORMAT_NONE;
+
+ case GL_COMPRESSED_RED_RGTC1:
+ if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC1_UNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_RGTC1_UNORM;
+ return PIPE_FORMAT_NONE;
+
+ case GL_COMPRESSED_SIGNED_RED_RGTC1:
+ if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC1_SNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_RGTC1_SNORM;
+ return PIPE_FORMAT_NONE;
+
+ case GL_COMPRESSED_RG_RGTC2:
+ if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC2_UNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_RGTC2_UNORM;
+ return PIPE_FORMAT_NONE;
+
+ case GL_COMPRESSED_SIGNED_RG_RGTC2:
+ if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC2_SNORM, target,
+ sample_count, bindings, geom_flags))
+ return PIPE_FORMAT_RGTC2_SNORM;
+ return PIPE_FORMAT_NONE;
+
default:
return PIPE_FORMAT_NONE;
}
* Called via ctx->Driver.chooseTextureFormat().
*/
gl_format
-st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat,
- GLenum format, GLenum type)
+st_ChooseTextureFormat_renderable(struct gl_context *ctx, GLint internalFormat,
+ GLenum format, GLenum type, GLboolean renderable)
{
struct pipe_screen *screen = st_context(ctx)->pipe->screen;
enum pipe_format pFormat;
/* GL textures may wind up being render targets, but we don't know
* that in advance. Specify potential render target flags now.
*/
- if (_mesa_is_depth_format(internalFormat) ||
- _mesa_is_depthstencil_format(internalFormat))
- bindings = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_DEPTH_STENCIL;
- else
- bindings = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
+ bindings = PIPE_BIND_SAMPLER_VIEW;
+ if (renderable == GL_TRUE) {
+ if (_mesa_is_depth_format(internalFormat) ||
+ _mesa_is_depth_or_stencil_format(internalFormat))
+ bindings |= PIPE_BIND_DEPTH_STENCIL;
+ else
+ bindings |= PIPE_BIND_RENDER_TARGET;
+ }
pFormat = st_choose_format(screen, internalFormat,
PIPE_TEXTURE_2D, 0, bindings);
return st_pipe_format_to_mesa_format(pFormat);
}
+gl_format
+st_ChooseTextureFormat(struct gl_context *ctx, GLint internalFormat,
+ GLenum format, GLenum type)
+{
+ return st_ChooseTextureFormat_renderable(ctx, internalFormat,
+ format, type, GL_TRUE);
+}
/**
* Test if a gallium format is equivalent to a GL format/type.
GLenum internalFormat, unsigned sample_count);
+gl_format
+st_ChooseTextureFormat_renderable(struct gl_context *ctx, GLint internalFormat,
+ GLenum format, GLenum type, GLboolean renderable);
+
extern gl_format
-st_ChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
+st_ChooseTextureFormat(struct gl_context * ctx, GLint internalFormat,
GLenum format, GLenum type);
* Software fallback for generate mipmap levels.
*/
static void
-fallback_generate_mipmap(GLcontext *ctx, GLenum target,
+fallback_generate_mipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj)
{
struct pipe_context *pipe = st_context(ctx)->pipe;
* levels should be generated.
*/
static GLuint
-compute_num_levels(GLcontext *ctx,
+compute_num_levels(struct gl_context *ctx,
struct gl_texture_object *texObj,
GLenum target)
{
* Called via ctx->Driver.GenerateMipmap().
*/
void
-st_generate_mipmap(GLcontext *ctx, GLenum target,
+st_generate_mipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj)
{
struct st_context *st = st_context(ctx);
extern void
-st_generate_mipmap(GLcontext *ctx, GLenum target,
+st_generate_mipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj);
#include "st_manager.h"
/**
- * Cast wrapper to convert a GLframebuffer to an st_framebuffer.
- * Return NULL if the GLframebuffer is a user-created framebuffer.
+ * Cast wrapper to convert a struct gl_framebuffer to an st_framebuffer.
+ * Return NULL if the struct gl_framebuffer is a user-created framebuffer.
* We'll only return non-null for window system framebuffers.
* Note that this function may fail.
*/
static INLINE struct st_framebuffer *
-st_ws_framebuffer(GLframebuffer *fb)
+st_ws_framebuffer(struct gl_framebuffer *fb)
{
/* FBO cannot be casted. See st_new_framebuffer */
return (struct st_framebuffer *) ((fb && !fb->Name) ? fb : NULL);
}
/**
- * Intialize a __GLcontextModes from a visual.
+ * Intialize a struct gl_config from a visual.
*/
static void
st_visual_to_context_mode(const struct st_visual *visual,
- __GLcontextModes *mode)
+ struct gl_config *mode)
{
memset(mode, 0, sizeof(*mode));
st_framebuffer_create(struct st_framebuffer_iface *stfbi)
{
struct st_framebuffer *stfb;
- __GLcontextModes mode;
+ struct gl_config mode;
gl_buffer_index idx;
stfb = CALLOC_STRUCT(st_framebuffer);
/* for FBO-only context */
if (!stfbi) {
- GLframebuffer *base = _mesa_get_incomplete_framebuffer();
+ struct gl_framebuffer *base = _mesa_get_incomplete_framebuffer();
stfb->Base = *base;
st_framebuffer_reference(struct st_framebuffer **ptr,
struct st_framebuffer *stfb)
{
- GLframebuffer *fb = &stfb->Base;
- _mesa_reference_framebuffer((GLframebuffer **) ptr, fb);
+ struct gl_framebuffer *fb = &stfb->Base;
+ _mesa_reference_framebuffer((struct gl_framebuffer **) ptr, fb);
}
static void
stfb = st_ws_framebuffer(st->ctx->WinSysDrawBuffer);
if (!stfb || stfb->iface != stfbi)
stfb = st_ws_framebuffer(st->ctx->WinSysReadBuffer);
- assert(stfb && stfb->iface == stfbi);
- p_atomic_set(&stfb->revalidate, TRUE);
+ if (stfb && stfb->iface == stfbi) {
+ p_atomic_set(&stfb->revalidate, TRUE);
+ }
+ else {
+ /* This function is probably getting called when we've detected a
+ * change in a window's size but the currently bound context is
+ * not bound to that window.
+ * If the st_framebuffer_iface structure had a pointer to the
+ * corresponding st_framebuffer we'd be able to handle this.
+ */
+ }
}
static void
struct pipe_resource *tex, boolean mipmap)
{
struct st_context *st = (struct st_context *) stctxi;
- GLcontext *ctx = st->ctx;
+ struct gl_context *ctx = st->ctx;
struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
struct st_context *shared_ctx = (struct st_context *) shared_stctxi;
struct st_context *st;
struct pipe_context *pipe;
- __GLcontextModes mode;
+ struct gl_config mode;
gl_api api;
if (!(stapi->profile_mask & (1 << attribs->profile)))
* Add a color renderbuffer on demand.
*/
boolean
-st_manager_add_color_renderbuffer(struct st_context *st, GLframebuffer *fb,
+st_manager_add_color_renderbuffer(struct st_context *st, struct gl_framebuffer *fb,
gl_buffer_index idx)
{
struct st_framebuffer *stfb = st_ws_framebuffer(fb);
st_manager_validate_framebuffers(struct st_context *st);
boolean
-st_manager_add_color_renderbuffer(struct st_context *st, GLframebuffer *fb,
+st_manager_add_color_renderbuffer(struct st_context *st, struct gl_framebuffer *fb,
gl_buffer_index idx);
#endif /* ST_MANAGER_H */
*/
enum pipe_error
st_translate_mesa_program(
- GLcontext *ctx,
+ struct gl_context *ctx,
uint procType,
struct ureg_program *ureg,
const struct gl_program *program,
t->outputs[i] = ureg_writemask( t->outputs[i],
TGSI_WRITEMASK_Z );
break;
+ case TGSI_SEMANTIC_STENCIL:
+ t->outputs[i] = ureg_DECL_output( ureg,
+ TGSI_SEMANTIC_STENCIL, /* Stencil */
+ outputSemanticIndex[i] );
+ t->outputs[i] = ureg_writemask( t->outputs[i],
+ TGSI_WRITEMASK_Y );
+ break;
case TGSI_SEMANTIC_COLOR:
t->outputs[i] = ureg_DECL_output( ureg,
TGSI_SEMANTIC_COLOR,
enum pipe_error
st_translate_mesa_program(
- GLcontext *ctx,
+ struct gl_context *ctx,
uint procType,
struct ureg_program *ureg,
const struct gl_program *program,
outputsWritten &= ~(1 << FRAG_RESULT_DEPTH);
}
+ if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_STENCIL)) {
+ fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_STENCIL;
+ fs_output_semantic_index[fs_num_outputs] = 0;
+ outputMapping[FRAG_RESULT_STENCIL] = fs_num_outputs;
+ fs_num_outputs++;
+ outputsWritten &= ~(1 << FRAG_RESULT_STENCIL);
+ }
+
/* handle remaning outputs (color) */
for (attr = 0; attr < FRAG_RESULT_MAX; attr++) {
if (outputsWritten & BITFIELD64_BIT(attr)) {
switch (attr) {
case FRAG_RESULT_DEPTH:
+ case FRAG_RESULT_STENCIL:
/* handled above */
assert(0);
break;
* Debug- print current shader text
*/
void
-st_print_shaders(GLcontext *ctx)
+st_print_shaders(struct gl_context *ctx)
{
struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
if (shProg) {
struct st_vertex_program *stvp );
extern void
-st_print_shaders(GLcontext *ctx);
+st_print_shaders(struct gl_context *ctx);
#endif
}
+static INLINE struct pipe_sampler_view *
+st_create_texture_sampler_view_format(struct pipe_context *pipe,
+ struct pipe_resource *texture,
+ enum pipe_format format)
+{
+ struct pipe_sampler_view templ;
+
+ u_sampler_view_default_template(&templ,
+ texture,
+ format);
+
+ return pipe->create_sampler_view(pipe, texture, &templ);
+}
+
static INLINE struct pipe_sampler_view *
st_get_texture_sampler_view(struct st_texture_object *stObj,
struct pipe_context *pipe)
To create and destroy the module:
- GLboolean _swrast_CreateContext( GLcontext *ctx );
- void _swrast_DestroyContext( GLcontext *ctx );
+ GLboolean _swrast_CreateContext( struct gl_context *ctx );
+ void _swrast_DestroyContext( struct gl_context *ctx );
This module tracks state changes internally and maintains derived
values based on the current state. For this to work, the driver
ensure the following funciton is called whenever the state changes and
the swsetup module is 'awake':
- void _swrast_InvalidateState( GLcontext *ctx, GLuint new_state );
+ void _swrast_InvalidateState( struct gl_context *ctx, GLuint new_state );
There is no explicit call to put the swrast module to sleep.
CUSTOMIZATION
- void (*choose_point)( GLcontext * );
- void (*choose_line)( GLcontext * );
- void (*choose_triangle)( GLcontext * );
+ void (*choose_point)( struct gl_context * );
+ void (*choose_line)( struct gl_context * );
+ void (*choose_triangle)( struct gl_context * );
Drivers may add additional triangle/line/point functions to swrast by
overriding these functions. It is necessary for the driver to be very
}
-typedef void (*plot_func)(GLcontext *ctx, struct LineInfo *line,
+typedef void (*plot_func)(struct gl_context *ctx, struct LineInfo *line,
int ix, int iy);
* Draw an AA line segment (called many times per line when stippling)
*/
static void
-segment(GLcontext *ctx,
+segment(struct gl_context *ctx,
struct LineInfo *line,
plot_func plot,
GLfloat t0, GLfloat t1)
void
-_swrast_choose_aa_line_function(GLcontext *ctx)
+_swrast_choose_aa_line_function(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
extern void
-_swrast_choose_aa_line_function(GLcontext *ctx);
+_swrast_choose_aa_line_function(struct gl_context *ctx);
#endif
* \param iy - integer fragment window Y coordiante
*/
static void
-NAME(plot)(GLcontext *ctx, struct LineInfo *line, int ix, int iy)
+NAME(plot)(struct gl_context *ctx, struct LineInfo *line, int ix, int iy)
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLfloat fx = (GLfloat) ix;
* Line setup
*/
static void
-NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
+NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLfloat tStart, tEnd; /* segment start, end along line length */
#include "main/glheader.h"
#include "main/context.h"
#include "main/colormac.h"
-#include "main/context.h"
#include "main/macros.h"
#include "main/imports.h"
#include "s_aatriangle.h"
static void
-rgba_aa_tri(GLcontext *ctx,
+rgba_aa_tri(struct gl_context *ctx,
const SWvertex *v0,
const SWvertex *v1,
const SWvertex *v2)
static void
-general_aa_tri(GLcontext *ctx,
+general_aa_tri(struct gl_context *ctx,
const SWvertex *v0,
const SWvertex *v1,
const SWvertex *v2)
* appropriate antialiased triangle rasterizer function.
*/
void
-_swrast_set_aa_triangle_function(GLcontext *ctx)
+_swrast_set_aa_triangle_function(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
extern void
-_swrast_set_aa_triangle_function(GLcontext *ctx);
+_swrast_set_aa_triangle_function(struct gl_context *ctx);
#endif
* DO_ATTRIBS - if defined, compute texcoords, varying, etc.
*/
-/*void triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv )*/
+/*void triangle( struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv )*/
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLfloat *p0 = v0->attrib[FRAG_ATTRIB_WPOS];
* representing the range[-1, 1].
*/
static void
-rescale_accum( GLcontext *ctx )
+rescale_accum( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
struct gl_renderbuffer *rb
* Clear the accumulation Buffer.
*/
void
-_swrast_clear_accum_buffer( GLcontext *ctx, struct gl_renderbuffer *rb )
+_swrast_clear_accum_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint x, y, width, height;
static void
-accum_add(GLcontext *ctx, GLfloat value,
+accum_add(struct gl_context *ctx, GLfloat value,
GLint xpos, GLint ypos, GLint width, GLint height )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
static void
-accum_mult(GLcontext *ctx, GLfloat mult,
+accum_mult(struct gl_context *ctx, GLfloat mult,
GLint xpos, GLint ypos, GLint width, GLint height )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
static void
-accum_accum(GLcontext *ctx, GLfloat value,
+accum_accum(struct gl_context *ctx, GLfloat value,
GLint xpos, GLint ypos, GLint width, GLint height )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
static void
-accum_load(GLcontext *ctx, GLfloat value,
+accum_load(struct gl_context *ctx, GLfloat value,
GLint xpos, GLint ypos, GLint width, GLint height )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
static void
-accum_return(GLcontext *ctx, GLfloat value,
+accum_return(struct gl_context *ctx, GLfloat value,
GLint xpos, GLint ypos, GLint width, GLint height )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
* Software fallback for glAccum.
*/
void
-_swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value)
+_swrast_Accum(struct gl_context *ctx, GLenum op, GLfloat value)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLint xpos, ypos, width, height;
extern void
-_swrast_clear_accum_buffer(GLcontext *ctx, struct gl_renderbuffer *rb);
+_swrast_clear_accum_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb);
#endif
* 1 if one or more pixels passed the alpha test.
*/
GLint
-_swrast_alpha_test(const GLcontext *ctx, SWspan *span)
+_swrast_alpha_test(const struct gl_context *ctx, SWspan *span)
{
const GLuint n = span->end;
GLubyte *mask = span->array->mask;
extern GLint
-_swrast_alpha_test( const GLcontext *ctx, SWspan *span );
+_swrast_alpha_test( const struct gl_context *ctx, SWspan *span );
#endif
* Fetch a texel.
*/
static void
-fetch_texel(GLcontext * ctx, const GLfloat texcoord[4], GLfloat lambda,
+fetch_texel(struct gl_context * ctx, const GLfloat texcoord[4], GLfloat lambda,
GLuint unit, GLfloat color[4])
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
}
static void
-handle_sample_op(GLcontext * ctx, struct atifs_machine *machine,
+handle_sample_op(struct gl_context * ctx, struct atifs_machine *machine,
struct atifs_setupinst *texinst, const SWspan *span,
GLuint column, GLuint idx)
{
* \param column - which pixel [i] we're operating on in the span
*/
static void
-execute_shader(GLcontext *ctx, const struct ati_fragment_shader *shader,
+execute_shader(struct gl_context *ctx, const struct ati_fragment_shader *shader,
struct atifs_machine *machine, const SWspan *span,
GLuint column)
{
* Init fragment shader virtual machine state.
*/
static void
-init_machine(GLcontext * ctx, struct atifs_machine *machine,
+init_machine(struct gl_context * ctx, struct atifs_machine *machine,
const struct ati_fragment_shader *shader,
const SWspan *span, GLuint col)
{
* Execute the current ATI shader program, operating on the given span.
*/
void
-_swrast_exec_fragment_shader(GLcontext * ctx, SWspan *span)
+_swrast_exec_fragment_shader(struct gl_context * ctx, SWspan *span)
{
const struct ati_fragment_shader *shader = ctx->ATIFragmentShader.Current;
struct atifs_machine machine;
extern void
-_swrast_exec_fragment_shader( GLcontext *ctx, SWspan *span );
+_swrast_exec_fragment_shader( struct gl_context *ctx, SWspan *span );
#endif
* All parameter error checking will have been done before this is called.
*/
void
-_swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
+_swrast_Bitmap( struct gl_context *ctx, GLint px, GLint py,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap )
* draw or skip.
*/
void
-_swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
+_swrast_Bitmap( struct gl_context *ctx, GLint px, GLint py,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap )
* Any chanType ok.
*/
static void _BLENDAPI
-blend_noop(GLcontext *ctx, GLuint n, const GLubyte mask[],
+blend_noop(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *src, const GLvoid *dst, GLenum chanType)
{
GLint bytes;
* Any chanType ok.
*/
static void _BLENDAPI
-blend_replace(GLcontext *ctx, GLuint n, const GLubyte mask[],
+blend_replace(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *src, const GLvoid *dst, GLenum chanType)
{
ASSERT(ctx->Color.BlendEquationRGB == GL_FUNC_ADD);
* glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).
*/
static void _BLENDAPI
-blend_transparency_ubyte(GLcontext *ctx, GLuint n, const GLubyte mask[],
+blend_transparency_ubyte(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *src, const GLvoid *dst, GLenum chanType)
{
GLubyte (*rgba)[4] = (GLubyte (*)[4]) src;
static void _BLENDAPI
-blend_transparency_ushort(GLcontext *ctx, GLuint n, const GLubyte mask[],
+blend_transparency_ushort(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *src, const GLvoid *dst, GLenum chanType)
{
GLushort (*rgba)[4] = (GLushort (*)[4]) src;
static void _BLENDAPI
-blend_transparency_float(GLcontext *ctx, GLuint n, const GLubyte mask[],
+blend_transparency_float(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *src, const GLvoid *dst, GLenum chanType)
{
GLfloat (*rgba)[4] = (GLfloat (*)[4]) src;
* Any chanType ok.
*/
static void _BLENDAPI
-blend_add(GLcontext *ctx, GLuint n, const GLubyte mask[],
+blend_add(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *src, const GLvoid *dst, GLenum chanType)
{
GLuint i;
* Any chanType ok.
*/
static void _BLENDAPI
-blend_min(GLcontext *ctx, GLuint n, const GLubyte mask[],
+blend_min(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *src, const GLvoid *dst, GLenum chanType)
{
GLuint i;
* Any chanType ok.
*/
static void _BLENDAPI
-blend_max(GLcontext *ctx, GLuint n, const GLubyte mask[],
+blend_max(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *src, const GLvoid *dst, GLenum chanType)
{
GLuint i;
* Any chanType ok.
*/
static void _BLENDAPI
-blend_modulate(GLcontext *ctx, GLuint n, const GLubyte mask[],
+blend_modulate(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *src, const GLvoid *dst, GLenum chanType)
{
GLuint i;
* \param dest array of pixels from the dest color buffer
*/
static void
-blend_general_float(GLcontext *ctx, GLuint n, const GLubyte mask[],
+blend_general_float(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLfloat rgba[][4], GLfloat dest[][4],
GLenum chanType)
{
* Do any blending operation, any chanType.
*/
static void
-blend_general(GLcontext *ctx, GLuint n, const GLubyte mask[],
+blend_general(struct gl_context *ctx, GLuint n, const GLubyte mask[],
void *src, const void *dst, GLenum chanType)
{
GLfloat rgbaF[MAX_WIDTH][4], destF[MAX_WIDTH][4];
* Result: the ctx->Color.BlendFunc pointer is updated.
*/
void
-_swrast_choose_blend_func(GLcontext *ctx, GLenum chanType)
+_swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLenum eq = ctx->Color.BlendEquationRGB;
* pixel coordinates.
*/
void
-_swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb, SWspan *span)
+_swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
void *rbPixels;
extern void
-_swrast_blend_span(GLcontext *ctx, struct gl_renderbuffer *rb, SWspan *span);
+_swrast_blend_span(struct gl_context *ctx, struct gl_renderbuffer *rb, SWspan *span);
extern void
-_swrast_choose_blend_func(GLcontext *ctx, GLenum chanType);
+_swrast_choose_blend_func(struct gl_context *ctx, GLenum chanType);
#endif
* Blit color, depth or stencil with GL_NEAREST filtering.
*/
static void
-blit_nearest(GLcontext *ctx,
+blit_nearest(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield buffer)
* Bilinear filtered blit (color only).
*/
static void
-blit_linear(GLcontext *ctx,
+blit_linear(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1)
{
* XXX we could easily support vertical flipping here.
*/
static void
-simple_blit(GLcontext *ctx,
+simple_blit(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield buffer)
* Software fallback for glBlitFramebufferEXT().
*/
void
-_swrast_BlitFramebuffer(GLcontext *ctx,
+_swrast_BlitFramebuffer(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter)
* Clear the color buffer when glColorMask is in effect.
*/
static void
-clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb,
+clear_rgba_buffer_with_masking(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint buf)
{
const GLint x = ctx->DrawBuffer->_Xmin;
* Clear an rgba color buffer without channel masking.
*/
static void
-clear_rgba_buffer(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint buf)
+clear_rgba_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb, GLuint buf)
{
const GLint x = ctx->DrawBuffer->_Xmin;
const GLint y = ctx->DrawBuffer->_Ymin;
* clear its own color buffers for some reason (such as with masking).
*/
static void
-clear_color_buffers(GLcontext *ctx)
+clear_color_buffers(struct gl_context *ctx)
{
GLuint buf;
* \param all if GL_TRUE, clear whole buffer, else clear specified region.
*/
void
-_swrast_Clear(GLcontext *ctx, GLbitfield buffers)
+_swrast_Clear(struct gl_context *ctx, GLbitfield buffers)
{
#ifdef DEBUG_FOO
{
* stenciling, logic-op, fog, etc?).
*/
static void
-_swrast_update_rasterflags( GLcontext *ctx )
+_swrast_update_rasterflags( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLbitfield rasterMask = 0;
* factors in.
*/
static void
-_swrast_update_polygon( GLcontext *ctx )
+_swrast_update_polygon( struct gl_context *ctx )
{
GLfloat backface_sign;
* fog blend factors (from the fog coords) per-fragment.
*/
static void
-_swrast_update_fog_hint( GLcontext *ctx )
+_swrast_update_fog_hint( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
swrast->_PreferPixelFog = (!swrast->AllowVertexFog ||
* Update the swrast->_TextureCombinePrimary flag.
*/
static void
-_swrast_update_texture_env( GLcontext *ctx )
+_swrast_update_texture_env( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint i;
* lots of fragments.
*/
static void
-_swrast_update_deferred_texture(GLcontext *ctx)
+_swrast_update_deferred_texture(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (ctx->Color.AlphaEnabled) {
* Update swrast->_FogColor and swrast->_FogEnable values.
*/
static void
-_swrast_update_fog_state( GLcontext *ctx )
+_swrast_update_fog_state( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
* program parameters with current state values.
*/
static void
-_swrast_update_fragment_program(GLcontext *ctx, GLbitfield newState)
+_swrast_update_fragment_program(struct gl_context *ctx, GLbitfield newState)
{
const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
if (fp) {
* add per vertex instead of per-fragment.
*/
static void
-_swrast_update_specular_vertex_add(GLcontext *ctx)
+_swrast_update_specular_vertex_add(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLboolean separateSpecular = ctx->Fog.ColorSumEnabled ||
* after a state change.
*/
static void
-_swrast_validate_triangle( GLcontext *ctx,
+_swrast_validate_triangle( struct gl_context *ctx,
const SWvertex *v0,
const SWvertex *v1,
const SWvertex *v2 )
* line routine. Then call it.
*/
static void
-_swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
+_swrast_validate_line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
* point routine. Then call it.
*/
static void
-_swrast_validate_point( GLcontext *ctx, const SWvertex *v0 )
+_swrast_validate_point( struct gl_context *ctx, const SWvertex *v0 )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
* function, then call it.
*/
static void _ASMAPI
-_swrast_validate_blend_func(GLcontext *ctx, GLuint n, const GLubyte mask[],
+_swrast_validate_blend_func(struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *src, const GLvoid *dst,
GLenum chanType )
{
* for subsequent rendering.
*/
static void
-_swrast_validate_texture_images(GLcontext *ctx)
+_swrast_validate_texture_images(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint u;
* from software to hardware rendering.
*/
void
-_swrast_eject_texture_images(GLcontext *ctx)
+_swrast_eject_texture_images(struct gl_context *ctx)
{
GLuint u;
static void
-_swrast_sleep( GLcontext *ctx, GLbitfield new_state )
+_swrast_sleep( struct gl_context *ctx, GLbitfield new_state )
{
(void) ctx; (void) new_state;
}
static void
-_swrast_invalidate_state( GLcontext *ctx, GLbitfield new_state )
+_swrast_invalidate_state( struct gl_context *ctx, GLbitfield new_state )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint i;
void
-_swrast_update_texture_samplers(GLcontext *ctx)
+_swrast_update_texture_samplers(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint u;
* swrast->_ActiveAtttribMask.
*/
static void
-_swrast_update_active_attribs(GLcontext *ctx)
+_swrast_update_active_attribs(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint attribsMask;
void
-_swrast_validate_derived( GLcontext *ctx )
+_swrast_validate_derived( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
/* Public entrypoints: See also s_accum.c, s_bitmap.c, etc.
*/
void
-_swrast_Quad( GLcontext *ctx,
+_swrast_Quad( struct gl_context *ctx,
const SWvertex *v0, const SWvertex *v1,
const SWvertex *v2, const SWvertex *v3 )
{
}
void
-_swrast_Triangle( GLcontext *ctx, const SWvertex *v0,
+_swrast_Triangle( struct gl_context *ctx, const SWvertex *v0,
const SWvertex *v1, const SWvertex *v2 )
{
if (SWRAST_DEBUG) {
}
void
-_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
+_swrast_Line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 )
{
if (SWRAST_DEBUG) {
_mesa_debug(ctx, "_swrast_Line\n");
}
void
-_swrast_Point( GLcontext *ctx, const SWvertex *v0 )
+_swrast_Point( struct gl_context *ctx, const SWvertex *v0 )
{
if (SWRAST_DEBUG) {
_mesa_debug(ctx, "_swrast_Point\n");
}
void
-_swrast_InvalidateState( GLcontext *ctx, GLbitfield new_state )
+_swrast_InvalidateState( struct gl_context *ctx, GLbitfield new_state )
{
if (SWRAST_DEBUG) {
_mesa_debug(ctx, "_swrast_InvalidateState\n");
}
void
-_swrast_ResetLineStipple( GLcontext *ctx )
+_swrast_ResetLineStipple( struct gl_context *ctx )
{
if (SWRAST_DEBUG) {
_mesa_debug(ctx, "_swrast_ResetLineStipple\n");
}
void
-_swrast_SetFacing(GLcontext *ctx, GLuint facing)
+_swrast_SetFacing(struct gl_context *ctx, GLuint facing)
{
SWRAST_CONTEXT(ctx)->PointLineFacing = facing;
}
void
-_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value )
+_swrast_allow_vertex_fog( struct gl_context *ctx, GLboolean value )
{
if (SWRAST_DEBUG) {
_mesa_debug(ctx, "_swrast_allow_vertex_fog %d\n", value);
}
void
-_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value )
+_swrast_allow_pixel_fog( struct gl_context *ctx, GLboolean value )
{
if (SWRAST_DEBUG) {
_mesa_debug(ctx, "_swrast_allow_pixel_fog %d\n", value);
GLboolean
-_swrast_CreateContext( GLcontext *ctx )
+_swrast_CreateContext( struct gl_context *ctx )
{
GLuint i;
SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext));
}
void
-_swrast_DestroyContext( GLcontext *ctx )
+_swrast_DestroyContext( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
struct swrast_device_driver *
-_swrast_GetDeviceDriverReference( GLcontext *ctx )
+_swrast_GetDeviceDriverReference( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
return &swrast->Driver;
}
void
-_swrast_flush( GLcontext *ctx )
+_swrast_flush( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
/* flush any pending fragments from rendering points */
}
void
-_swrast_render_primitive( GLcontext *ctx, GLenum prim )
+_swrast_render_primitive( struct gl_context *ctx, GLenum prim )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (swrast->Primitive == GL_POINTS && prim != GL_POINTS) {
void
-_swrast_render_start( GLcontext *ctx )
+_swrast_render_start( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (swrast->Driver.SpanRenderStart)
}
void
-_swrast_render_finish( GLcontext *ctx )
+_swrast_render_finish( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (swrast->Driver.SpanRenderFinish)
#define SWRAST_DEBUG_VERTICES 0
void
-_swrast_print_vertex( GLcontext *ctx, const SWvertex *v )
+_swrast_print_vertex( struct gl_context *ctx, const SWvertex *v )
{
GLuint i;
#include "s_span.h"
-typedef void (*texture_sample_func)(GLcontext *ctx,
+typedef void (*texture_sample_func)(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoords[][4],
const GLfloat lambda[], GLfloat rgba[][4]);
-typedef void (_ASMAPIP blend_func)( GLcontext *ctx, GLuint n,
+typedef void (_ASMAPIP blend_func)( struct gl_context *ctx, GLuint n,
const GLubyte mask[],
GLvoid *src, const GLvoid *dst,
GLenum chanType);
-typedef void (*swrast_point_func)( GLcontext *ctx, const SWvertex *);
+typedef void (*swrast_point_func)( struct gl_context *ctx, const SWvertex *);
-typedef void (*swrast_line_func)( GLcontext *ctx,
+typedef void (*swrast_line_func)( struct gl_context *ctx,
const SWvertex *, const SWvertex *);
-typedef void (*swrast_tri_func)( GLcontext *ctx, const SWvertex *,
+typedef void (*swrast_tri_func)( struct gl_context *ctx, const SWvertex *,
const SWvertex *, const SWvertex *);
-typedef void (*validate_texture_image_func)(GLcontext *ctx,
+typedef void (*validate_texture_image_func)(struct gl_context *ctx,
struct gl_texture_object *texObj,
GLuint face, GLuint level);
GLenum Primitive; /* current primitive being drawn (ala glBegin) */
GLboolean SpecularVertexAdd; /**< Add specular/secondary color per vertex */
- void (*InvalidateState)( GLcontext *ctx, GLbitfield new_state );
+ void (*InvalidateState)( struct gl_context *ctx, GLbitfield new_state );
/**
* When the NewState mask intersects these masks, we invalidate the
* Will be called when the GL state change mask intersects the above masks.
*/
/*@{*/
- void (*choose_point)( GLcontext * );
- void (*choose_line)( GLcontext * );
- void (*choose_triangle)( GLcontext * );
+ void (*choose_point)( struct gl_context * );
+ void (*choose_line)( struct gl_context * );
+ void (*choose_triangle)( struct gl_context * );
/*@}*/
/**
extern void
-_swrast_validate_derived( GLcontext *ctx );
+_swrast_validate_derived( struct gl_context *ctx );
extern void
-_swrast_update_texture_samplers(GLcontext *ctx);
+_swrast_update_texture_samplers(struct gl_context *ctx);
-/** Return SWcontext for the given GLcontext */
+/** Return SWcontext for the given struct gl_context */
static INLINE SWcontext *
-SWRAST_CONTEXT(GLcontext *ctx)
+SWRAST_CONTEXT(struct gl_context *ctx)
{
return (SWcontext *) ctx->swrast_context;
}
/** const version of above */
static INLINE const SWcontext *
-CONST_SWRAST_CONTEXT(const GLcontext *ctx)
+CONST_SWRAST_CONTEXT(const struct gl_context *ctx)
{
return (const SWcontext *) ctx->swrast_context;
}
* driver's opportunity to map renderbuffers and textures.
*/
static INLINE void
-swrast_render_start(GLcontext *ctx)
+swrast_render_start(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (swrast->Driver.SpanRenderStart)
/** Called after framebuffer reading/writing */
static INLINE void
-swrast_render_finish(GLcontext *ctx)
+swrast_render_finish(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (swrast->Driver.SpanRenderFinish)
* RGBA copypixels
*/
static void
-copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
+copy_rgba_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
GLint width, GLint height, GLint destx, GLint desty)
{
GLfloat *tmpImage, *p;
* Z scale and bias.
*/
static void
-scale_and_bias_z(GLcontext *ctx, GLuint width,
+scale_and_bias_z(struct gl_context *ctx, GLuint width,
const GLfloat depth[], GLuint z[])
{
const GLuint depthMax = ctx->DrawBuffer->_DepthMax;
* TODO: Optimize!!!!
*/
static void
-copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
+copy_depth_pixels( struct gl_context *ctx, GLint srcx, GLint srcy,
GLint width, GLint height,
GLint destx, GLint desty )
{
static void
-copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
+copy_stencil_pixels( struct gl_context *ctx, GLint srcx, GLint srcy,
GLint width, GLint height,
GLint destx, GLint desty )
{
* CopyPixels function.
*/
static void
-copy_depth_stencil_pixels(GLcontext *ctx,
+copy_depth_stencil_pixels(struct gl_context *ctx,
const GLint srcX, const GLint srcY,
const GLint width, const GLint height,
const GLint destX, const GLint destY)
* Try to do a fast copy pixels.
*/
static GLboolean
-fast_copy_pixels(GLcontext *ctx,
+fast_copy_pixels(struct gl_context *ctx,
GLint srcX, GLint srcY, GLsizei width, GLsizei height,
GLint dstX, GLint dstY, GLenum type)
{
* By time we get here, all parameters will have been error-checked.
*/
void
-_swrast_CopyPixels( GLcontext *ctx,
+_swrast_CopyPixels( struct gl_context *ctx,
GLint srcx, GLint srcy, GLsizei width, GLsizei height,
GLint destx, GLint desty, GLenum type )
{
* Return: number of fragments which pass the test.
*/
static GLuint
-depth_test_span16( GLcontext *ctx, GLuint n,
+depth_test_span16( struct gl_context *ctx, GLuint n,
GLushort zbuffer[], const GLuint z[], GLubyte mask[] )
{
GLuint passed = 0;
static GLuint
-depth_test_span32( GLcontext *ctx, GLuint n,
+depth_test_span32( struct gl_context *ctx, GLuint n,
GLuint zbuffer[], const GLuint z[], GLubyte mask[] )
{
GLuint passed = 0;
* [0,1] range.
*/
void
-_swrast_depth_clamp_span( GLcontext *ctx, SWspan *span )
+_swrast_depth_clamp_span( struct gl_context *ctx, SWspan *span )
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
const GLuint count = span->end;
* Apply depth test to span of fragments.
*/
static GLuint
-depth_test_span( GLcontext *ctx, SWspan *span)
+depth_test_span( struct gl_context *ctx, SWspan *span)
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct gl_renderbuffer *rb = fb->_DepthBuffer;
* Do depth testing for an array of fragments at assorted locations.
*/
static void
-direct_depth_test_pixels16(GLcontext *ctx, GLushort *zStart, GLuint stride,
+direct_depth_test_pixels16(struct gl_context *ctx, GLushort *zStart, GLuint stride,
GLuint n, const GLint x[], const GLint y[],
const GLuint z[], GLubyte mask[] )
{
* Do depth testing for an array of fragments with direct access to zbuffer.
*/
static void
-direct_depth_test_pixels32(GLcontext *ctx, GLuint *zStart, GLuint stride,
+direct_depth_test_pixels32(struct gl_context *ctx, GLuint *zStart, GLuint stride,
GLuint n, const GLint x[], const GLint y[],
const GLuint z[], GLubyte mask[] )
{
static GLuint
-depth_test_pixels( GLcontext *ctx, SWspan *span )
+depth_test_pixels( struct gl_context *ctx, SWspan *span )
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct gl_renderbuffer *rb = fb->_DepthBuffer;
* \return approx number of pixels that passed (only zero is reliable)
*/
GLuint
-_swrast_depth_test_span( GLcontext *ctx, SWspan *span)
+_swrast_depth_test_span( struct gl_context *ctx, SWspan *span)
{
if (span->arrayMask & SPAN_XY)
return depth_test_pixels(ctx, span);
* \return GL_TRUE if any fragments pass, GL_FALSE if no fragments pass
*/
GLboolean
-_swrast_depth_bounds_test( GLcontext *ctx, SWspan *span )
+_swrast_depth_bounds_test( struct gl_context *ctx, SWspan *span )
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct gl_renderbuffer *rb = fb->_DepthBuffer;
* _swrast_ReadPixels.
*/
void
-_swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_read_depth_span_float( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint n, GLint x, GLint y, GLfloat depth[] )
{
const GLfloat scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
* As above, but return 32-bit GLuint values.
*/
void
-_swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_read_depth_span_uint( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint n, GLint x, GLint y, GLuint depth[] )
{
GLuint depthBits;
* Clear the given z/depth renderbuffer.
*/
void
-_swrast_clear_depth_buffer( GLcontext *ctx, struct gl_renderbuffer *rb )
+_swrast_clear_depth_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb )
{
GLuint clearValue;
GLint x, y, width, height;
extern GLuint
-_swrast_depth_test_span( GLcontext *ctx, SWspan *span);
+_swrast_depth_test_span( struct gl_context *ctx, SWspan *span);
extern void
-_swrast_depth_clamp_span( GLcontext *ctx, SWspan *span );
+_swrast_depth_clamp_span( struct gl_context *ctx, SWspan *span );
extern GLboolean
-_swrast_depth_bounds_test( GLcontext *ctx, SWspan *span );
+_swrast_depth_bounds_test( struct gl_context *ctx, SWspan *span );
extern void
-_swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_read_depth_span_float( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint n, GLint x, GLint y, GLfloat depth[] );
extern void
-_swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_read_depth_span_uint( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint n, GLint x, GLint y, GLuint depth[] );
extern void
-_swrast_clear_depth_buffer( GLcontext *ctx, struct gl_renderbuffer *rb );
+_swrast_clear_depth_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb );
#endif
* Return: GL_TRUE if success, GL_FALSE if slow path must be used instead
*/
static GLboolean
-fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y,
+fast_draw_rgba_pixels(struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *userUnpack,
* Draw stencil image.
*/
static void
-draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y,
+draw_stencil_pixels( struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum type,
const struct gl_pixelstore_attrib *unpack,
* Draw depth image.
*/
static void
-draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
+draw_depth_pixels( struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum type,
const struct gl_pixelstore_attrib *unpack,
* Draw RGBA image.
*/
static void
-draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
+draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
* color buffer(s).
*/
static void
-draw_depth_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
+draw_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
GLsizei width, GLsizei height, GLenum type,
const struct gl_pixelstore_attrib *unpack,
const GLvoid *pixels)
* By time we get here, all error checking will have been done.
*/
void
-_swrast_DrawPixels( GLcontext *ctx,
+_swrast_DrawPixels( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
static void
-feedback_vertex(GLcontext * ctx, const SWvertex * v, const SWvertex * pv)
+feedback_vertex(struct gl_context * ctx, const SWvertex * v, const SWvertex * pv)
{
GLfloat win[4];
const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX0];
* Put triangle in feedback buffer.
*/
void
-_swrast_feedback_triangle(GLcontext *ctx, const SWvertex *v0,
+_swrast_feedback_triangle(struct gl_context *ctx, const SWvertex *v0,
const SWvertex *v1, const SWvertex *v2)
{
if (!_swrast_culltriangle(ctx, v0, v1, v2)) {
void
-_swrast_feedback_line(GLcontext *ctx, const SWvertex *v0,
+_swrast_feedback_line(struct gl_context *ctx, const SWvertex *v0,
const SWvertex *v1)
{
GLenum token = GL_LINE_TOKEN;
void
-_swrast_feedback_point(GLcontext *ctx, const SWvertex *v)
+_swrast_feedback_point(struct gl_context *ctx, const SWvertex *v)
{
_mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POINT_TOKEN);
feedback_vertex(ctx, v, v);
void
-_swrast_select_triangle(GLcontext *ctx, const SWvertex *v0,
+_swrast_select_triangle(struct gl_context *ctx, const SWvertex *v0,
const SWvertex *v1, const SWvertex *v2)
{
if (!_swrast_culltriangle(ctx, v0, v1, v2)) {
void
-_swrast_select_line(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
+_swrast_select_line(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1)
{
const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
_mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs );
void
-_swrast_select_point(GLcontext *ctx, const SWvertex *v)
+_swrast_select_point(struct gl_context *ctx, const SWvertex *v)
{
const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF;
_mesa_update_hitflag( ctx, v->attrib[FRAG_ATTRIB_WPOS][2] * zs );
#include "swrast.h"
-extern void _swrast_feedback_point( GLcontext *ctx, const SWvertex *v );
+extern void _swrast_feedback_point( struct gl_context *ctx, const SWvertex *v );
-extern void _swrast_feedback_line( GLcontext *ctx,
+extern void _swrast_feedback_line( struct gl_context *ctx,
const SWvertex *v1, const SWvertex *v2 );
-extern void _swrast_feedback_triangle( GLcontext *ctx, const SWvertex *v0,
+extern void _swrast_feedback_triangle( struct gl_context *ctx, const SWvertex *v0,
const SWvertex *v1, const SWvertex *v2 );
-extern void _swrast_select_point( GLcontext *ctx, const SWvertex *v );
+extern void _swrast_select_point( struct gl_context *ctx, const SWvertex *v );
-extern void _swrast_select_line( GLcontext *ctx,
+extern void _swrast_select_line( struct gl_context *ctx,
const SWvertex *v1, const SWvertex *v2 );
-extern void _swrast_select_triangle( GLcontext *ctx, const SWvertex *v0,
+extern void _swrast_select_triangle( struct gl_context *ctx, const SWvertex *v0,
const SWvertex *v1, const SWvertex *v2 );
#endif
* Used to convert current raster distance to a fog factor in [0,1].
*/
GLfloat
-_swrast_z_to_fogfactor(GLcontext *ctx, GLfloat z)
+_swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z)
{
GLfloat d, f;
* _PreferPixelFog should be in sync with that state!
*/
void
-_swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span )
+_swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span )
{
const SWcontext *swrast = CONST_SWRAST_CONTEXT(ctx);
GLfloat rFog, gFog, bFog;
extern GLfloat
-_swrast_z_to_fogfactor(GLcontext *ctx, GLfloat z);
+_swrast_z_to_fogfactor(struct gl_context *ctx, GLfloat z);
extern void
-_swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span );
+_swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span );
#endif
* Called via machine->FetchTexelLod()
*/
static void
-fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
+fetch_texel_lod( struct gl_context *ctx, const GLfloat texcoord[4], GLfloat lambda,
GLuint unit, GLfloat color[4] )
{
const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current;
* otherwise zero.
*/
static void
-fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
+fetch_texel_deriv( struct gl_context *ctx, const GLfloat texcoord[4],
const GLfloat texdx[4], const GLfloat texdy[4],
GLfloat lodBias, GLuint unit, GLfloat color[4] )
{
* \param col which element (column) of the span we'll operate on
*/
static void
-init_machine(GLcontext *ctx, struct gl_program_machine *machine,
+init_machine(struct gl_context *ctx, struct gl_program_machine *machine,
const struct gl_fragment_program *program,
const SWspan *span, GLuint col)
{
* Run fragment program on the pixels in span from 'start' to 'end' - 1.
*/
static void
-run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end)
+run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_fragment_program *program = ctx->FragmentProgram._Current;
* in the given span.
*/
void
-_swrast_exec_fragment_program( GLcontext *ctx, SWspan *span )
+_swrast_exec_fragment_program( struct gl_context *ctx, SWspan *span )
{
const struct gl_fragment_program *program = ctx->FragmentProgram._Current;
extern void
-_swrast_exec_fragment_program(GLcontext *ctx, SWspan *span);
+_swrast_exec_fragment_program(struct gl_context *ctx, SWspan *span);
#endif /* S_FRAGPROG_H */
* Init the mask[] array to implement a line stipple.
*/
static void
-compute_stipple_mask( GLcontext *ctx, GLuint len, GLubyte mask[] )
+compute_stipple_mask( struct gl_context *ctx, GLuint len, GLubyte mask[] )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLuint i;
* To draw a wide line we can simply redraw the span N times, side by side.
*/
static void
-draw_wide_line( GLcontext *ctx, SWspan *span, GLboolean xMajor )
+draw_wide_line( struct gl_context *ctx, SWspan *span, GLboolean xMajor )
{
const GLint width = (GLint) CLAMP(ctx->Line.Width,
ctx->Const.MinLineWidth,
void
-_swrast_add_spec_terms_line(GLcontext *ctx,
+_swrast_add_spec_terms_line(struct gl_context *ctx,
const SWvertex *v0, const SWvertex *v1)
{
SWvertex *ncv0 = (SWvertex *)v0;
* tests to this code.
*/
void
-_swrast_choose_line( GLcontext *ctx )
+_swrast_choose_line( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLboolean specular = (ctx->Fog.ColorSumEnabled ||
#include "swrast.h"
void
-_swrast_choose_line( GLcontext *ctx );
+_swrast_choose_line( struct gl_context *ctx );
void
-_swrast_add_spec_terms_line( GLcontext *ctx,
+_swrast_add_spec_terms_line( struct gl_context *ctx,
const SWvertex *v0,
const SWvertex *v1 );
static void
-NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
+NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 )
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
SWspan span;
static INLINE void
-logicop_uint1(GLcontext *ctx, GLuint n, GLuint src[], const GLuint dest[],
+logicop_uint1(struct gl_context *ctx, GLuint n, GLuint src[], const GLuint dest[],
const GLubyte mask[])
{
LOGIC_OP_LOOP(ctx->Color.LogicOp, 1);
static INLINE void
-logicop_uint2(GLcontext *ctx, GLuint n, GLuint src[], const GLuint dest[],
+logicop_uint2(struct gl_context *ctx, GLuint n, GLuint src[], const GLuint dest[],
const GLubyte mask[])
{
LOGIC_OP_LOOP(ctx->Color.LogicOp, 2);
static INLINE void
-logicop_uint4(GLcontext *ctx, GLuint n, GLuint src[], const GLuint dest[],
+logicop_uint4(struct gl_context *ctx, GLuint n, GLuint src[], const GLuint dest[],
const GLubyte mask[])
{
LOGIC_OP_LOOP(ctx->Color.LogicOp, 4);
* pixel coordinates.
*/
void
-_swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
SWspan *span)
{
void *rbPixels;
#include "s_span.h"
extern void
-_swrast_logicop_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
SWspan *span);
* Apply the color mask to a span of rgba values.
*/
void
-_swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
SWspan *span, GLuint buf)
{
const GLuint n = span->end;
extern void
-_swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
SWspan *span, GLuint buf);
#endif
* Must also clamp to user-defined range and implmentation limits.
*/
static INLINE GLfloat
-get_size(const GLcontext *ctx, const SWvertex *vert, GLboolean smoothed)
+get_size(const struct gl_context *ctx, const SWvertex *vert, GLboolean smoothed)
{
GLfloat size;
* Draw a point sprite
*/
static void
-sprite_point(GLcontext *ctx, const SWvertex *vert)
+sprite_point(struct gl_context *ctx, const SWvertex *vert)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
SWspan span;
* Draw smooth/antialiased point. RGB or CI mode.
*/
static void
-smooth_point(GLcontext *ctx, const SWvertex *vert)
+smooth_point(struct gl_context *ctx, const SWvertex *vert)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
SWspan span;
* Draw large (size >= 1) non-AA point. RGB or CI mode.
*/
static void
-large_point(GLcontext *ctx, const SWvertex *vert)
+large_point(struct gl_context *ctx, const SWvertex *vert)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
SWspan span;
* Draw size=1, single-pixel point
*/
static void
-pixel_point(GLcontext *ctx, const SWvertex *vert)
+pixel_point(struct gl_context *ctx, const SWvertex *vert)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
/*
* primary color.
*/
void
-_swrast_add_spec_terms_point(GLcontext *ctx, const SWvertex *v0)
+_swrast_add_spec_terms_point(struct gl_context *ctx, const SWvertex *v0)
{
SWvertex *ncv0 = (SWvertex *) v0; /* cast away const */
GLfloat rSum, gSum, bSum;
* Examine current state to determine which point drawing function to use.
*/
void
-_swrast_choose_point(GLcontext *ctx)
+_swrast_choose_point(struct gl_context *ctx)
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLfloat size = CLAMP(ctx->Point.Size,
#include "swrast.h"
extern void
-_swrast_choose_point( GLcontext *ctx );
+_swrast_choose_point( struct gl_context *ctx );
extern void
-_swrast_add_spec_terms_point( GLcontext *ctx,
+_swrast_add_spec_terms_point( struct gl_context *ctx,
const SWvertex *v0 );
#endif
* Read pixels for format=GL_DEPTH_COMPONENT.
*/
static void
-read_depth_pixels( GLcontext *ctx,
+read_depth_pixels( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum type, GLvoid *pixels,
* Read pixels for format=GL_STENCIL_INDEX.
*/
static void
-read_stencil_pixels( GLcontext *ctx,
+read_stencil_pixels( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum type, GLvoid *pixels,
* \return GL_TRUE if success, GL_FALSE if unable to do the readpixels
*/
static GLboolean
-fast_read_rgba_pixels( GLcontext *ctx,
+fast_read_rgba_pixels( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
* Read R, G, B, A, RGB, L, or LA pixels.
*/
static void
-read_rgba_pixels( GLcontext *ctx,
+read_rgba_pixels( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type, GLvoid *pixels,
* depth and stencil buffers really exist.
*/
static void
-read_depth_stencil_pixels(GLcontext *ctx,
+read_depth_stencil_pixels(struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum type, GLvoid *pixels,
* By time we get here, all error checking will have been done.
*/
void
-_swrast_ReadPixels( GLcontext *ctx,
+_swrast_ReadPixels( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *packing,
* and glBitmap.
*/
void
-_swrast_span_default_attribs(GLcontext *ctx, SWspan *span)
+_swrast_span_default_attribs(struct gl_context *ctx, SWspan *span)
{
GLchan r, g, b, a;
/* Z*/
* should have computed attrStart/Step values for FRAG_ATTRIB_WPOS[3]!
*/
static INLINE void
-interpolate_active_attribs(GLcontext *ctx, SWspan *span, GLbitfield attrMask)
+interpolate_active_attribs(struct gl_context *ctx, SWspan *span, GLbitfield attrMask)
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
* color array.
*/
static INLINE void
-interpolate_int_colors(GLcontext *ctx, SWspan *span)
+interpolate_int_colors(struct gl_context *ctx, SWspan *span)
{
const GLuint n = span->end;
GLuint i;
* Fill in the span.zArray array from the span->z, zStep values.
*/
void
-_swrast_span_interpolate_z( const GLcontext *ctx, SWspan *span )
+_swrast_span_interpolate_z( const struct gl_context *ctx, SWspan *span )
{
const GLuint n = span->end;
GLuint i;
* texels with (s/q, t/q, r/q).
*/
static void
-interpolate_texcoords(GLcontext *ctx, SWspan *span)
+interpolate_texcoords(struct gl_context *ctx, SWspan *span)
{
const GLuint maxUnit
= (ctx->Texture._EnabledCoordUnits > 1) ? ctx->Const.MaxTextureUnits : 1;
* Fill in the arrays->attribs[FRAG_ATTRIB_WPOS] array.
*/
static INLINE void
-interpolate_wpos(GLcontext *ctx, SWspan *span)
+interpolate_wpos(struct gl_context *ctx, SWspan *span)
{
GLfloat (*wpos)[4] = span->array->attribs[FRAG_ATTRIB_WPOS];
GLuint i;
* Apply the current polygon stipple pattern to a span of pixels.
*/
static INLINE void
-stipple_polygon_span(GLcontext *ctx, SWspan *span)
+stipple_polygon_span(struct gl_context *ctx, SWspan *span)
{
GLubyte *mask = span->array->mask;
* GL_FALSE nothing visible
*/
static INLINE GLuint
-clip_span( GLcontext *ctx, SWspan *span )
+clip_span( struct gl_context *ctx, SWspan *span )
{
const GLint xmin = ctx->DrawBuffer->_Xmin;
const GLint xmax = ctx->DrawBuffer->_Xmax;
* Result is float color array (FRAG_ATTRIB_COL0).
*/
static INLINE void
-add_specular(GLcontext *ctx, SWspan *span)
+add_specular(struct gl_context *ctx, SWspan *span)
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLubyte *mask = span->array->mask;
* Apply fragment shader, fragment program or normal texturing to span.
*/
static INLINE void
-shade_texture_span(GLcontext *ctx, SWspan *span)
+shade_texture_span(struct gl_context *ctx, SWspan *span)
{
GLbitfield inputsRead;
* to their original values before returning.
*/
void
-_swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
+_swrast_write_rgba_span( struct gl_context *ctx, SWspan *span)
{
const SWcontext *swrast = SWRAST_CONTEXT(ctx);
const GLuint *colorMask = (GLuint *) ctx->Color.ColorMask;
* \param rgba the returned colors
*/
void
-_swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_read_rgba_span( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, GLenum dstType,
GLvoid *rgba)
{
* values array.
*/
void
-_swrast_get_values(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
void *values, GLuint valueSize)
{
* \param valueSize size of each value (pixel) in bytes
*/
void
-_swrast_put_row(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_put_row(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
const GLvoid *values, GLuint valueSize)
{
* \param valueSize size of each value (pixel) in bytes
*/
void
-_swrast_get_row(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
GLvoid *values, GLuint valueSize)
{
* \return pointer to the colors we read.
*/
void *
-_swrast_get_dest_rgba(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_get_dest_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb,
SWspan *span)
{
const GLuint pixelSize = RGBA_PIXEL_SIZE(span->array->ChanType);
extern void
-_swrast_span_default_attribs(GLcontext *ctx, SWspan *span);
+_swrast_span_default_attribs(struct gl_context *ctx, SWspan *span);
extern void
-_swrast_span_interpolate_z( const GLcontext *ctx, SWspan *span );
+_swrast_span_interpolate_z( const struct gl_context *ctx, SWspan *span );
extern GLfloat
_swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy,
extern void
-_swrast_write_rgba_span( GLcontext *ctx, SWspan *span);
+_swrast_write_rgba_span( struct gl_context *ctx, SWspan *span);
extern void
-_swrast_read_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_read_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, GLenum type, GLvoid *rgba);
extern void
-_swrast_get_values(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_get_values(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
void *values, GLuint valueSize);
extern void
-_swrast_put_row(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_put_row(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
const GLvoid *values, GLuint valueSize);
extern void
-_swrast_get_row(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_get_row(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
GLvoid *values, GLuint valueSize);
extern void *
-_swrast_get_dest_rgba(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_get_dest_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb,
SWspan *span);
#endif
static void
-NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(get_row)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y, void *values )
{
#ifdef SPAN_VARS
static void
-NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(get_values)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[], void *values )
{
#ifdef SPAN_VARS
static void
-NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(put_row)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
const void *values, const GLubyte mask[] )
{
static void
-NAME(put_row_rgb)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(put_row_rgb)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
const void *values, const GLubyte mask[] )
{
static void
-NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(put_mono_row)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, GLint x, GLint y,
const void *value, const GLubyte mask[] )
{
static void
-NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(put_values)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
const void *values, const GLubyte mask[] )
{
static void
-NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb,
+NAME(put_mono_values)( struct gl_context *ctx, struct gl_renderbuffer *rb,
GLuint count, const GLint x[], const GLint y[],
const void *value, const GLubyte mask[] )
{
* Output: stencil - modified values
*/
static void
-apply_stencil_op( const GLcontext *ctx, GLenum oper, GLuint face,
+apply_stencil_op( const struct gl_context *ctx, GLenum oper, GLuint face,
GLuint n, GLstencil stencil[], const GLubyte mask[] )
{
const GLstencil ref = ctx->Stencil.Ref[face];
* Return: GL_FALSE = all pixels failed, GL_TRUE = zero or more pixels passed.
*/
static GLboolean
-do_stencil_test( GLcontext *ctx, GLuint face, GLuint n, GLstencil stencil[],
+do_stencil_test( struct gl_context *ctx, GLuint face, GLuint n, GLstencil stencil[],
GLubyte mask[] )
{
GLubyte fail[MAX_WIDTH];
*
*/
static GLboolean
-stencil_and_ztest_span(GLcontext *ctx, SWspan *span, GLuint face)
+stencil_and_ztest_span(struct gl_context *ctx, SWspan *span, GLuint face)
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
struct gl_renderbuffer *rb = fb->_StencilBuffer;
* mask - array [n] of flag: 1=apply operator, 0=don't apply operator
*/
static void
-apply_stencil_op_to_pixels( GLcontext *ctx,
+apply_stencil_op_to_pixels( struct gl_context *ctx,
GLuint n, const GLint x[], const GLint y[],
GLenum oper, GLuint face, const GLubyte mask[] )
{
* \return GL_FALSE = all pixels failed, GL_TRUE = zero or more pixels passed.
*/
static GLboolean
-stencil_test_pixels( GLcontext *ctx, GLuint face, GLuint n,
+stencil_test_pixels( struct gl_context *ctx, GLuint face, GLuint n,
const GLint x[], const GLint y[], GLubyte mask[] )
{
const struct gl_framebuffer *fb = ctx->DrawBuffer;
* GL_TRUE - one or more fragments passed the testing
*/
static GLboolean
-stencil_and_ztest_pixels( GLcontext *ctx, SWspan *span, GLuint face )
+stencil_and_ztest_pixels( struct gl_context *ctx, SWspan *span, GLuint face )
{
GLubyte passMask[MAX_WIDTH], failMask[MAX_WIDTH], origMask[MAX_WIDTH];
struct gl_framebuffer *fb = ctx->DrawBuffer;
* GL_FALSE = all fragments failed.
*/
GLboolean
-_swrast_stencil_and_ztest_span(GLcontext *ctx, SWspan *span)
+_swrast_stencil_and_ztest_span(struct gl_context *ctx, SWspan *span)
{
const GLuint face = (span->facing == 0) ? 0 : ctx->Stencil._BackFace;
* Output: stencil - the array of stencil values
*/
void
-_swrast_read_stencil_span(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_read_stencil_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint n, GLint x, GLint y, GLstencil stencil[])
{
if (y < 0 || y >= (GLint) rb->Height ||
* stencil - the array of stencil values
*/
void
-_swrast_write_stencil_span(GLcontext *ctx, GLint n, GLint x, GLint y,
+_swrast_write_stencil_span(struct gl_context *ctx, GLint n, GLint x, GLint y,
const GLstencil stencil[] )
{
struct gl_framebuffer *fb = ctx->DrawBuffer;
* Clear the stencil buffer.
*/
void
-_swrast_clear_stencil_buffer( GLcontext *ctx, struct gl_renderbuffer *rb )
+_swrast_clear_stencil_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb )
{
const GLubyte stencilBits = ctx->DrawBuffer->Visual.stencilBits;
const GLuint mask = ctx->Stencil.WriteMask[0];
extern GLboolean
-_swrast_stencil_and_ztest_span(GLcontext *ctx, SWspan *span);
+_swrast_stencil_and_ztest_span(struct gl_context *ctx, SWspan *span);
extern void
-_swrast_read_stencil_span(GLcontext *ctx, struct gl_renderbuffer *rb,
+_swrast_read_stencil_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint n, GLint x, GLint y, GLstencil stencil[]);
extern void
-_swrast_write_stencil_span( GLcontext *ctx, GLint n, GLint x, GLint y,
+_swrast_write_stencil_span( struct gl_context *ctx, GLint n, GLint x, GLint y,
const GLstencil stencil[] );
extern void
-_swrast_clear_stencil_buffer( GLcontext *ctx, struct gl_renderbuffer *rb );
+_swrast_clear_stencil_buffer( struct gl_context *ctx, struct gl_renderbuffer *rb );
#endif
* \param rgba incoming/result fragment colors
*/
static void
-texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
+texture_combine( struct gl_context *ctx, GLuint unit, GLuint n,
const float4_array primary_rgba,
const GLfloat *texelBuffer,
GLchan (*rgbaChan)[4] )
* Apply texture mapping to a span of fragments.
*/
void
-_swrast_texture_span( GLcontext *ctx, SWspan *span )
+_swrast_texture_span( struct gl_context *ctx, SWspan *span )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
GLfloat primary_rgba[MAX_WIDTH][4];
#include "s_span.h"
extern void
-_swrast_texture_span( GLcontext *ctx, SWspan *span );
+_swrast_texture_span( struct gl_context *ctx, SWspan *span );
#endif
* Return the texture sample for coordinate (s) using GL_NEAREST filter.
*/
static INLINE void
-sample_1d_nearest(GLcontext *ctx,
+sample_1d_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
const GLfloat texcoord[4], GLfloat rgba[4])
* Return the texture sample for coordinate (s) using GL_LINEAR filter.
*/
static INLINE void
-sample_1d_linear(GLcontext *ctx,
+sample_1d_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
const GLfloat texcoord[4], GLfloat rgba[4])
static void
-sample_1d_nearest_mipmap_nearest(GLcontext *ctx,
+sample_1d_nearest_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_1d_linear_mipmap_nearest(GLcontext *ctx,
+sample_1d_linear_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_1d_nearest_mipmap_linear(GLcontext *ctx,
+sample_1d_nearest_mipmap_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_1d_linear_mipmap_linear(GLcontext *ctx,
+sample_1d_linear_mipmap_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
/** Sample 1D texture, nearest filtering for both min/magnification */
static void
-sample_nearest_1d( GLcontext *ctx,
+sample_nearest_1d( struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4] )
/** Sample 1D texture, linear filtering for both min/magnification */
static void
-sample_linear_1d( GLcontext *ctx,
+sample_linear_1d( struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4] )
/** Sample 1D texture, using lambda to choose between min/magnification */
static void
-sample_lambda_1d( GLcontext *ctx,
+sample_lambda_1d( struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLfloat rgba[][4] )
* Return the texture sample for coordinate (s,t) using GL_NEAREST filter.
*/
static INLINE void
-sample_2d_nearest(GLcontext *ctx,
+sample_2d_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
const GLfloat texcoord[4],
* New sampling code contributed by Lynn Quam <quam@ai.sri.com>.
*/
static INLINE void
-sample_2d_linear(GLcontext *ctx,
+sample_2d_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
const GLfloat texcoord[4],
* We don't have to worry about the texture border.
*/
static INLINE void
-sample_2d_linear_repeat(GLcontext *ctx,
+sample_2d_linear_repeat(struct gl_context *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
const GLfloat texcoord[4],
static void
-sample_2d_nearest_mipmap_nearest(GLcontext *ctx,
+sample_2d_nearest_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_2d_linear_mipmap_nearest(GLcontext *ctx,
+sample_2d_linear_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_2d_nearest_mipmap_linear(GLcontext *ctx,
+sample_2d_nearest_mipmap_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_2d_linear_mipmap_linear( GLcontext *ctx,
+sample_2d_linear_mipmap_linear( struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4] )
static void
-sample_2d_linear_mipmap_linear_repeat(GLcontext *ctx,
+sample_2d_linear_mipmap_linear_repeat(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
/** Sample 2D texture, nearest filtering for both min/magnification */
static void
-sample_nearest_2d(GLcontext *ctx,
+sample_nearest_2d(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLfloat rgba[][4])
/** Sample 2D texture, linear filtering for both min/magnification */
static void
-sample_linear_2d(GLcontext *ctx,
+sample_linear_2d(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLfloat rgba[][4])
* Format = GL_RGB
*/
static void
-opt_sample_rgb_2d(GLcontext *ctx,
+opt_sample_rgb_2d(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoords[][4],
const GLfloat lambda[], GLfloat rgba[][4])
* Format = GL_RGBA
*/
static void
-opt_sample_rgba_2d(GLcontext *ctx,
+opt_sample_rgba_2d(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoords[][4],
const GLfloat lambda[], GLfloat rgba[][4])
/** Sample 2D texture, using lambda to choose between min/magnification */
static void
-sample_lambda_2d(GLcontext *ctx,
+sample_lambda_2d(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoords[][4],
const GLfloat lambda[], GLfloat rgba[][4])
* Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter.
*/
static INLINE void
-sample_3d_nearest(GLcontext *ctx,
+sample_3d_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
const GLfloat texcoord[4],
* Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter.
*/
static void
-sample_3d_linear(GLcontext *ctx,
+sample_3d_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
const GLfloat texcoord[4],
static void
-sample_3d_nearest_mipmap_nearest(GLcontext *ctx,
+sample_3d_nearest_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4] )
static void
-sample_3d_linear_mipmap_nearest(GLcontext *ctx,
+sample_3d_linear_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_3d_nearest_mipmap_linear(GLcontext *ctx,
+sample_3d_nearest_mipmap_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_3d_linear_mipmap_linear(GLcontext *ctx,
+sample_3d_linear_mipmap_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
/** Sample 3D texture, nearest filtering for both min/magnification */
static void
-sample_nearest_3d(GLcontext *ctx,
+sample_nearest_3d(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4])
/** Sample 3D texture, linear filtering for both min/magnification */
static void
-sample_linear_3d(GLcontext *ctx,
+sample_linear_3d(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLfloat rgba[][4])
/** Sample 3D texture, using lambda to choose between min/magnification */
static void
-sample_lambda_3d(GLcontext *ctx,
+sample_lambda_3d(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4])
static void
-sample_nearest_cube(GLcontext *ctx,
+sample_nearest_cube(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4])
static void
-sample_linear_cube(GLcontext *ctx,
+sample_linear_cube(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_cube_nearest_mipmap_nearest(GLcontext *ctx,
+sample_cube_nearest_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_cube_linear_mipmap_nearest(GLcontext *ctx,
+sample_cube_linear_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_cube_nearest_mipmap_linear(GLcontext *ctx,
+sample_cube_nearest_mipmap_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_cube_linear_mipmap_linear(GLcontext *ctx,
+sample_cube_linear_mipmap_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
/** Sample cube texture, using lambda to choose between min/magnification */
static void
-sample_lambda_cube(GLcontext *ctx,
+sample_lambda_cube(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4])
static void
-sample_nearest_rect(GLcontext *ctx,
+sample_nearest_rect(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4])
static void
-sample_linear_rect(GLcontext *ctx,
+sample_linear_rect(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLfloat rgba[][4])
/** Sample Rect texture, using lambda to choose between min/magnification */
static void
-sample_lambda_rect(GLcontext *ctx,
+sample_lambda_rect(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4])
* Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter.
*/
static void
-sample_2d_array_nearest(GLcontext *ctx,
+sample_2d_array_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
const GLfloat texcoord[4],
* Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter.
*/
static void
-sample_2d_array_linear(GLcontext *ctx,
+sample_2d_array_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
const GLfloat texcoord[4],
static void
-sample_2d_array_nearest_mipmap_nearest(GLcontext *ctx,
+sample_2d_array_nearest_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_2d_array_linear_mipmap_nearest(GLcontext *ctx,
+sample_2d_array_linear_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_2d_array_nearest_mipmap_linear(GLcontext *ctx,
+sample_2d_array_nearest_mipmap_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_2d_array_linear_mipmap_linear(GLcontext *ctx,
+sample_2d_array_linear_mipmap_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
/** Sample 2D Array texture, nearest filtering for both min/magnification */
static void
-sample_nearest_2d_array(GLcontext *ctx,
+sample_nearest_2d_array(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4])
/** Sample 2D Array texture, linear filtering for both min/magnification */
static void
-sample_linear_2d_array(GLcontext *ctx,
+sample_linear_2d_array(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLfloat rgba[][4])
/** Sample 2D Array texture, using lambda to choose between min/magnification */
static void
-sample_lambda_2d_array(GLcontext *ctx,
+sample_lambda_2d_array(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4])
* Return the texture sample for coordinate (s,t,r) using GL_NEAREST filter.
*/
static void
-sample_1d_array_nearest(GLcontext *ctx,
+sample_1d_array_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
const GLfloat texcoord[4],
* Return the texture sample for coordinate (s,t,r) using GL_LINEAR filter.
*/
static void
-sample_1d_array_linear(GLcontext *ctx,
+sample_1d_array_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
const struct gl_texture_image *img,
const GLfloat texcoord[4],
static void
-sample_1d_array_nearest_mipmap_nearest(GLcontext *ctx,
+sample_1d_array_nearest_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_1d_array_linear_mipmap_nearest(GLcontext *ctx,
+sample_1d_array_linear_mipmap_nearest(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_1d_array_nearest_mipmap_linear(GLcontext *ctx,
+sample_1d_array_nearest_mipmap_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
static void
-sample_1d_array_linear_mipmap_linear(GLcontext *ctx,
+sample_1d_array_linear_mipmap_linear(struct gl_context *ctx,
const struct gl_texture_object *tObj,
GLuint n, const GLfloat texcoord[][4],
const GLfloat lambda[], GLfloat rgba[][4])
/** Sample 1D Array texture, nearest filtering for both min/magnification */
static void
-sample_nearest_1d_array(GLcontext *ctx,
+sample_nearest_1d_array(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4])
/** Sample 1D Array texture, linear filtering for both min/magnification */
static void
-sample_linear_1d_array(GLcontext *ctx,
+sample_linear_1d_array(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4],
const GLfloat lambda[], GLfloat rgba[][4])
/** Sample 1D Array texture, using lambda to choose between min/magnification */
static void
-sample_lambda_1d_array(GLcontext *ctx,
+sample_lambda_1d_array(struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4])
{
GLint level;
- lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod);
-
- level = (GLint) lambda;
-
- level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel);
+ if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) {
+ /* no mipmapping - use base level */
+ level = tObj->BaseLevel;
+ }
+ else {
+ /* choose mipmap level */
+ lambda = CLAMP(lambda, tObj->MinLod, tObj->MaxLod);
+ level = (GLint) lambda;
+ level = CLAMP(level, tObj->BaseLevel, tObj->_MaxLevel);
+ }
return level;
}
* check for minification vs. magnification, etc.
*/
static void
-sample_depth_texture( GLcontext *ctx,
+sample_depth_texture( struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat texel[][4] )
case GL_ALPHA:
ASSIGN_4V(texel[i], 0.0F, 0.0F, 0.0F, result);
break;
+ case GL_RED:
+ ASSIGN_4V(texel[i], result, 0.0F, 0.0F, 1.0F);
+ break;
default:
_mesa_problem(ctx, "Bad depth texture mode");
}
* Note: fragment programs don't observe the texture enable/disable flags.
*/
static void
-null_sample_func( GLcontext *ctx,
+null_sample_func( struct gl_context *ctx,
const struct gl_texture_object *tObj, GLuint n,
const GLfloat texcoords[][4], const GLfloat lambda[],
GLfloat rgba[][4])
* Choose the texture sampling function for the given texture object.
*/
texture_sample_func
-_swrast_choose_texture_sample_func( GLcontext *ctx,
+_swrast_choose_texture_sample_func( struct gl_context *ctx,
const struct gl_texture_object *t )
{
if (!t || !t->_Complete) {
extern texture_sample_func
-_swrast_choose_texture_sample_func( GLcontext *ctx,
+_swrast_choose_texture_sample_func( struct gl_context *ctx,
const struct gl_texture_object *tObj );
* \return GL_TRUE if the triangle is to be culled, GL_FALSE otherwise.
*/
GLboolean
-_swrast_culltriangle( GLcontext *ctx,
+_swrast_culltriangle( struct gl_context *ctx,
const SWvertex *v0,
const SWvertex *v1,
const SWvertex *v2 )
* texture env modes.
*/
static INLINE void
-affine_span(GLcontext *ctx, SWspan *span,
+affine_span(struct gl_context *ctx, SWspan *span,
struct affine_info *info)
{
GLchan sample[4]; /* the filtered texture sample */
static INLINE void
-fast_persp_span(GLcontext *ctx, SWspan *span,
+fast_persp_span(struct gl_context *ctx, SWspan *span,
struct persp_info *info)
{
GLchan sample[4]; /* the filtered texture sample */
static void
-nodraw_triangle( GLcontext *ctx,
+nodraw_triangle( struct gl_context *ctx,
const SWvertex *v0,
const SWvertex *v1,
const SWvertex *v2 )
* Inefficient, but seldom needed.
*/
void
-_swrast_add_spec_terms_triangle(GLcontext *ctx, const SWvertex *v0,
+_swrast_add_spec_terms_triangle(struct gl_context *ctx, const SWvertex *v0,
const SWvertex *v1, const SWvertex *v2)
{
SWvertex *ncv0 = (SWvertex *)v0; /* drop const qualifier */
* remove tests to this code.
*/
void
-_swrast_choose_triangle( GLcontext *ctx )
+_swrast_choose_triangle( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
extern GLboolean
-_swrast_culltriangle( GLcontext *ctx,
+_swrast_culltriangle( struct gl_context *ctx,
const SWvertex *v0,
const SWvertex *v1,
const SWvertex *v2);
extern void
-_swrast_choose_triangle( GLcontext *ctx );
+_swrast_choose_triangle( struct gl_context *ctx );
extern void
-_swrast_add_spec_terms_triangle( GLcontext *ctx,
+_swrast_add_spec_terms_triangle( struct gl_context *ctx,
const SWvertex *v0,
const SWvertex *v1,
const SWvertex *v2 );
#endif
-static void NAME(GLcontext *ctx, const SWvertex *v0,
+static void NAME(struct gl_context *ctx, const SWvertex *v0,
const SWvertex *v1,
const SWvertex *v2 )
{
* \return GL_TRUE if any zoomed pixels visible, GL_FALSE if totally clipped
*/
static GLboolean
-compute_zoomed_bounds(GLcontext *ctx, GLint imageX, GLint imageY,
+compute_zoomed_bounds(struct gl_context *ctx, GLint imageX, GLint imageY,
GLint spanX, GLint spanY, GLint width,
GLint *x0, GLint *x1, GLint *y0, GLint *y1)
{
* index/depth_span().
*/
static void
-zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span,
+zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
const GLvoid *src, GLenum format )
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
void
-_swrast_write_zoomed_rgba_span(GLcontext *ctx, GLint imgX, GLint imgY,
+_swrast_write_zoomed_rgba_span(struct gl_context *ctx, GLint imgX, GLint imgY,
const SWspan *span, const GLvoid *rgba)
{
zoom_span(ctx, imgX, imgY, span, rgba, GL_RGBA);
void
-_swrast_write_zoomed_rgb_span(GLcontext *ctx, GLint imgX, GLint imgY,
+_swrast_write_zoomed_rgb_span(struct gl_context *ctx, GLint imgX, GLint imgY,
const SWspan *span, const GLvoid *rgb)
{
zoom_span(ctx, imgX, imgY, span, rgb, GL_RGB);
void
-_swrast_write_zoomed_depth_span(GLcontext *ctx, GLint imgX, GLint imgY,
+_swrast_write_zoomed_depth_span(struct gl_context *ctx, GLint imgX, GLint imgY,
const SWspan *span)
{
zoom_span(ctx, imgX, imgY, span,
* No per-fragment operations are applied.
*/
void
-_swrast_write_zoomed_stencil_span(GLcontext *ctx, GLint imgX, GLint imgY,
+_swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY,
GLint width, GLint spanX, GLint spanY,
const GLstencil stencil[])
{
* No per-fragment operations are applied.
*/
void
-_swrast_write_zoomed_z_span(GLcontext *ctx, GLint imgX, GLint imgY,
+_swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY,
GLint width, GLint spanX, GLint spanY,
const GLvoid *z)
{
extern void
-_swrast_write_zoomed_rgba_span(GLcontext *ctx, GLint imgX, GLint imgY,
+_swrast_write_zoomed_rgba_span(struct gl_context *ctx, GLint imgX, GLint imgY,
const SWspan *span, const GLvoid *rgba);
extern void
-_swrast_write_zoomed_rgb_span(GLcontext *ctx, GLint imgX, GLint imgY,
+_swrast_write_zoomed_rgb_span(struct gl_context *ctx, GLint imgX, GLint imgY,
const SWspan *span, const GLvoid *rgb);
extern void
-_swrast_write_zoomed_depth_span(GLcontext *ctx, GLint imgX, GLint imgY,
+_swrast_write_zoomed_depth_span(struct gl_context *ctx, GLint imgX, GLint imgY,
const SWspan *span);
extern void
-_swrast_write_zoomed_stencil_span(GLcontext *ctx, GLint imgX, GLint imgY,
+_swrast_write_zoomed_stencil_span(struct gl_context *ctx, GLint imgX, GLint imgY,
GLint width, GLint spanX, GLint spanY,
const GLstencil stencil[]);
extern void
-_swrast_write_zoomed_z_span(GLcontext *ctx, GLint imgX, GLint imgY,
+_swrast_write_zoomed_z_span(struct gl_context *ctx, GLint imgX, GLint imgY,
GLint width, GLint spanX, GLint spanY,
const GLvoid *z);
*/
extern GLboolean
-_swrast_CreateContext( GLcontext *ctx );
+_swrast_CreateContext( struct gl_context *ctx );
extern void
-_swrast_DestroyContext( GLcontext *ctx );
+_swrast_DestroyContext( struct gl_context *ctx );
/* Get a (non-const) reference to the device driver struct for swrast.
*/
extern struct swrast_device_driver *
-_swrast_GetDeviceDriverReference( GLcontext *ctx );
+_swrast_GetDeviceDriverReference( struct gl_context *ctx );
extern void
-_swrast_Bitmap( GLcontext *ctx,
+_swrast_Bitmap( struct gl_context *ctx,
GLint px, GLint py,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap );
extern void
-_swrast_CopyPixels( GLcontext *ctx,
+_swrast_CopyPixels( struct gl_context *ctx,
GLint srcx, GLint srcy,
GLint destx, GLint desty,
GLsizei width, GLsizei height,
GLenum type );
extern void
-_swrast_DrawPixels( GLcontext *ctx,
+_swrast_DrawPixels( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const GLvoid *pixels );
extern void
-_swrast_ReadPixels( GLcontext *ctx,
+_swrast_ReadPixels( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
GLvoid *pixels );
extern void
-_swrast_BlitFramebuffer(GLcontext *ctx,
+_swrast_BlitFramebuffer(struct gl_context *ctx,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
extern void
-_swrast_Clear(GLcontext *ctx, GLbitfield buffers);
+_swrast_Clear(struct gl_context *ctx, GLbitfield buffers);
extern void
-_swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value);
+_swrast_Accum(struct gl_context *ctx, GLenum op, GLfloat value);
/* Reset the stipple counter
*/
extern void
-_swrast_ResetLineStipple( GLcontext *ctx );
+_swrast_ResetLineStipple( struct gl_context *ctx );
/**
* Indicates front/back facing for subsequent points/lines when drawing
* unfilled polygons. Needed for two-side stencil.
*/
extern void
-_swrast_SetFacing(GLcontext *ctx, GLuint facing);
+_swrast_SetFacing(struct gl_context *ctx, GLuint facing);
/* These will always render the correct point/line/triangle for the
* current state.
* For flatshaded primitives, the provoking vertex is the final one.
*/
extern void
-_swrast_Point( GLcontext *ctx, const SWvertex *v );
+_swrast_Point( struct gl_context *ctx, const SWvertex *v );
extern void
-_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 );
+_swrast_Line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 );
extern void
-_swrast_Triangle( GLcontext *ctx, const SWvertex *v0,
+_swrast_Triangle( struct gl_context *ctx, const SWvertex *v0,
const SWvertex *v1, const SWvertex *v2 );
extern void
-_swrast_Quad( GLcontext *ctx,
+_swrast_Quad( struct gl_context *ctx,
const SWvertex *v0, const SWvertex *v1,
const SWvertex *v2, const SWvertex *v3);
extern void
-_swrast_flush( GLcontext *ctx );
+_swrast_flush( struct gl_context *ctx );
extern void
-_swrast_render_primitive( GLcontext *ctx, GLenum mode );
+_swrast_render_primitive( struct gl_context *ctx, GLenum mode );
extern void
-_swrast_render_start( GLcontext *ctx );
+_swrast_render_start( struct gl_context *ctx );
extern void
-_swrast_render_finish( GLcontext *ctx );
+_swrast_render_finish( struct gl_context *ctx );
/* Tell the software rasterizer about core state changes.
*/
extern void
-_swrast_InvalidateState( GLcontext *ctx, GLbitfield new_state );
+_swrast_InvalidateState( struct gl_context *ctx, GLbitfield new_state );
/* Configure software rasterizer to match hardware rasterizer characteristics:
*/
extern void
-_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value );
+_swrast_allow_vertex_fog( struct gl_context *ctx, GLboolean value );
extern void
-_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value );
+_swrast_allow_pixel_fog( struct gl_context *ctx, GLboolean value );
/* Debug:
*/
extern void
-_swrast_print_vertex( GLcontext *ctx, const SWvertex *v );
+_swrast_print_vertex( struct gl_context *ctx, const SWvertex *v );
extern void
-_swrast_eject_texture_images(GLcontext *ctx);
+_swrast_eject_texture_images(struct gl_context *ctx);
* these functions. Locking in that case must be organized by the
* driver by other mechanisms.
*/
- void (*SpanRenderStart)(GLcontext *ctx);
- void (*SpanRenderFinish)(GLcontext *ctx);
+ void (*SpanRenderStart)(struct gl_context *ctx);
+ void (*SpanRenderFinish)(struct gl_context *ctx);
};
To create and destroy the module:
- GLboolean _swsetup_CreateContext( GLcontext *ctx );
- void _swsetup_DestroyContext( GLcontext *ctx );
+ GLboolean _swsetup_CreateContext( struct gl_context *ctx );
+ void _swsetup_DestroyContext( struct gl_context *ctx );
The module is not active by default, and must be installed by calling
_swrast_Wakeup(). This function installs internal swrast_setup
functions into all the tnl->Driver.Render driver hooks, thus taking
over the task of rasterization entirely:
- void _swrast_Wakeup( GLcontext *ctx );
+ void _swrast_Wakeup( struct gl_context *ctx );
This module tracks state changes internally and maintains derived
ensure the following funciton is called whenever the state changes and
the swsetup module is 'awake':
- void _swsetup_InvalidateState( GLcontext *ctx, GLuint new_state );
+ void _swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state );
There is no explicit call to put the swsetup module to sleep. Simply
install other function pointers into all the tnl->Driver.Render.*
The module offers a minimal driver interface:
- void (*Start)( GLcontext *ctx );
- void (*Finish)( GLcontext *ctx );
+ void (*Start)( struct gl_context *ctx );
+ void (*Finish)( struct gl_context *ctx );
These are called before and after the completion of all swrast drawing
activity. As swrast doesn't call callbacks during triangle, line or
GLboolean
-_swsetup_CreateContext( GLcontext *ctx )
+_swsetup_CreateContext( struct gl_context *ctx )
{
SScontext *swsetup = (SScontext *)CALLOC(sizeof(SScontext));
}
void
-_swsetup_DestroyContext( GLcontext *ctx )
+_swsetup_DestroyContext( struct gl_context *ctx )
{
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
}
static void
-_swsetup_RenderPrimitive( GLcontext *ctx, GLenum mode )
+_swsetup_RenderPrimitive( struct gl_context *ctx, GLenum mode )
{
SWSETUP_CONTEXT(ctx)->render_prim = mode;
_swrast_render_primitive( ctx, mode );
* _tnl_install_attrs().
*/
static void
-setup_vertex_format(GLcontext *ctx)
+setup_vertex_format(struct gl_context *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
* Called via tnl->Driver.Render.Start.
*/
static void
-_swsetup_RenderStart( GLcontext *ctx )
+_swsetup_RenderStart( struct gl_context *ctx )
{
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
* It's called when we finish rendering a vertex buffer.
*/
static void
-_swsetup_RenderFinish( GLcontext *ctx )
+_swsetup_RenderFinish( struct gl_context *ctx )
{
_swrast_render_finish( ctx );
}
void
-_swsetup_InvalidateState( GLcontext *ctx, GLuint new_state )
+_swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state )
{
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
swsetup->NewState |= new_state;
void
-_swsetup_Wakeup( GLcontext *ctx )
+_swsetup_Wakeup( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
* Populate a swrast SWvertex from an attrib-style vertex.
*/
void
-_swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest )
+_swsetup_Translate( struct gl_context *ctx, const void *vertex, SWvertex *dest )
{
const GLfloat *m = ctx->Viewport._WindowMap.m;
GLfloat tmp[4];
/*
* Render a triangle respecting edge flags.
*/
-typedef void (* swsetup_edge_render_prim_tri)(GLcontext *ctx,
+typedef void (* swsetup_edge_render_prim_tri)(struct gl_context *ctx,
const GLubyte *ef,
GLuint e0,
GLuint e1,
* Render a triangle using lines and respecting edge flags.
*/
static void
-_swsetup_edge_render_line_tri(GLcontext *ctx,
+_swsetup_edge_render_line_tri(struct gl_context *ctx,
const GLubyte *ef,
GLuint e0,
GLuint e1,
* Render a triangle using points and respecting edge flags.
*/
static void
-_swsetup_edge_render_point_tri(GLcontext *ctx,
+_swsetup_edge_render_point_tri(struct gl_context *ctx,
const GLubyte *ef,
GLuint e0,
GLuint e1,
/*
* Render a triangle respecting cull and shade model.
*/
-static void _swsetup_render_tri(GLcontext *ctx,
+static void _swsetup_render_tri(struct gl_context *ctx,
GLuint e0,
GLuint e1,
GLuint e2,
#include "ss_tritmp.h"
-void _swsetup_trifuncs_init( GLcontext *ctx )
+void _swsetup_trifuncs_init( struct gl_context *ctx )
{
(void) ctx;
}
-static void swsetup_points( GLcontext *ctx, GLuint first, GLuint last )
+static void swsetup_points( struct gl_context *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts;
}
}
-static void swsetup_line( GLcontext *ctx, GLuint v0, GLuint v1 )
+static void swsetup_line( struct gl_context *ctx, GLuint v0, GLuint v1 )
{
SWvertex *verts = SWSETUP_CONTEXT(ctx)->verts;
_swrast_Line( ctx, &verts[v0], &verts[v1] );
-void _swsetup_choose_trifuncs( GLcontext *ctx )
+void _swsetup_choose_trifuncs( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint ind = 0;
#include "main/mtypes.h"
-void _swsetup_trifuncs_init( GLcontext *ctx );
-void _swsetup_choose_trifuncs( GLcontext *ctx );
+void _swsetup_trifuncs_init( struct gl_context *ctx );
+void _swsetup_choose_trifuncs( struct gl_context *ctx );
#endif
* This is where we handle assigning vertex colors based on front/back
* facing, compute polygon offset and handle glPolygonMode().
*/
-static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
+static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e2 )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
SScontext *swsetup = SWSETUP_CONTEXT(ctx);
/* Need to fixup edgeflags when decomposing to triangles:
*/
-static void TAG(quadfunc)( GLcontext *ctx, GLuint v0,
+static void TAG(quadfunc)( struct gl_context *ctx, GLuint v0,
GLuint v1, GLuint v2, GLuint v3 )
{
if (IND & SS_UNFILLED_BIT) {
#include "main/mtypes.h"
-void _swsetup_vb_init( GLcontext *ctx );
-void _swsetup_choose_rastersetup_func( GLcontext *ctx );
+void _swsetup_vb_init( struct gl_context *ctx );
+void _swsetup_choose_rastersetup_func( struct gl_context *ctx );
#endif
#include "swrast/swrast.h"
extern GLboolean
-_swsetup_CreateContext( GLcontext *ctx );
+_swsetup_CreateContext( struct gl_context *ctx );
extern void
-_swsetup_DestroyContext( GLcontext *ctx );
+_swsetup_DestroyContext( struct gl_context *ctx );
extern void
-_swsetup_InvalidateState( GLcontext *ctx, GLuint new_state );
+_swsetup_InvalidateState( struct gl_context *ctx, GLuint new_state );
extern void
-_swsetup_Wakeup( GLcontext *ctx );
+_swsetup_Wakeup( struct gl_context *ctx );
/* Helper function to translate a hardware vertex (as understood by
* the tnl/t_vertex.c code) to a swrast vertex.
*/
extern void
-_swsetup_Translate( GLcontext *ctx, const void *vertex, SWvertex *dest );
+_swsetup_Translate( struct gl_context *ctx, const void *vertex, SWvertex *dest );
#endif
To create and destroy the module:
- GLboolean _tnl_CreateContext( GLcontext *ctx );
- void _tnl_DestroyContext( GLcontext *ctx );
+ GLboolean _tnl_CreateContext( struct gl_context *ctx );
+ void _tnl_DestroyContext( struct gl_context *ctx );
The module is not active by default, and must be installed by calling
_tnl_Wakeup(). This function installs internal tnl functions into all
the vtxfmt dispatch hooks, thus taking over the task of transformation
and lighting entirely:
- void _tnl_wakeup_exec( GLcontext *ctx );
- void _tnl_wakeup_save_exec( GLcontext *ctx );
+ void _tnl_wakeup_exec( struct gl_context *ctx );
+ void _tnl_wakeup_save_exec( struct gl_context *ctx );
This module tracks state changes internally and maintains derived
ensure the following funciton is called whenever the state changes and
the swsetup module is 'awake':
- void _tnl_InvalidateState( GLcontext *ctx, GLuint new_state );
+ void _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state );
There is no explicit call to put the tnl module to sleep. Simply
install other function pointers into all the vtxfmt dispatch slots,
In addition, the following functions provide further tweaks:
extern void
-_tnl_need_projected_coords( GLcontext *ctx, GLboolean flag );
+_tnl_need_projected_coords( struct gl_context *ctx, GLboolean flag );
- Direct the default vertex transformation stage to
produce/not produce projected clip coordinates.
extern void
-_tnl_need_dlist_loopback( GLcontext *ctx, GLboolean flag );
+_tnl_need_dlist_loopback( struct gl_context *ctx, GLboolean flag );
- Direct the display list component of the tnl module to
replay display lists as 'glVertex' type calls, rather than
extern void
-_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean flag );
+_tnl_need_dlist_norm_lengths( struct gl_context *ctx, GLboolean flag );
- Direct the display list component to enable/disable caching
1/length values for display list normals. Doing so is
The module itself offers a minimal driver interface:
- void (*RunPipeline)( GLcontext *ctx );
+ void (*RunPipeline)( struct gl_context *ctx );
Normally this is set to _tnl_RunPipeline(), however the driver can use
this hook to wrap checks or other code around this call.
#include "vbo/vbo.h"
GLboolean
-_tnl_CreateContext( GLcontext *ctx )
+_tnl_CreateContext( struct gl_context *ctx )
{
TNLcontext *tnl;
void
-_tnl_DestroyContext( GLcontext *ctx )
+_tnl_DestroyContext( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
void
-_tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
+_tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
const struct gl_vertex_program *vp = ctx->VertexProgram._Current;
void
-_tnl_wakeup( GLcontext *ctx )
+_tnl_wakeup( struct gl_context *ctx )
{
/* Assume we haven't been getting state updates either:
*/
* we should "Divide-by-W". Software renders will want that.
*/
void
-_tnl_need_projected_coords( GLcontext *ctx, GLboolean mode )
+_tnl_need_projected_coords( struct gl_context *ctx, GLboolean mode )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->NeedNdcCoords = mode;
}
void
-_tnl_allow_vertex_fog( GLcontext *ctx, GLboolean value )
+_tnl_allow_vertex_fog( struct gl_context *ctx, GLboolean value )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->AllowVertexFog = value;
}
void
-_tnl_allow_pixel_fog( GLcontext *ctx, GLboolean value )
+_tnl_allow_pixel_fog( struct gl_context *ctx, GLboolean value )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->AllowPixelFog = value;
/* Allocate private data
*/
- GLboolean (*create)( GLcontext *ctx, struct tnl_pipeline_stage * );
+ GLboolean (*create)( struct gl_context *ctx, struct tnl_pipeline_stage * );
/* Free private data.
*/
/* Called on any statechange or input array size change or
* input array change to/from zero stride.
*/
- void (*validate)( GLcontext *ctx, struct tnl_pipeline_stage * );
+ void (*validate)( struct gl_context *ctx, struct tnl_pipeline_stage * );
/* Called from _tnl_run_pipeline(). The stage.changed_inputs value
* encodes all inputs to thee struct which have changed. If
* Return value: GL_TRUE - keep going
* GL_FALSE - finished pipeline
*/
- GLboolean (*run)( GLcontext *ctx, struct tnl_pipeline_stage * );
+ GLboolean (*run)( struct gl_context *ctx, struct tnl_pipeline_stage * );
};
GLubyte *v,
const GLfloat *in );
-typedef void (*tnl_emit_func)( GLcontext *ctx,
+typedef void (*tnl_emit_func)( struct gl_context *ctx,
GLuint count,
GLubyte *dest );
-typedef void (*tnl_points_func)( GLcontext *ctx, GLuint first, GLuint last );
-typedef void (*tnl_line_func)( GLcontext *ctx, GLuint v1, GLuint v2 );
-typedef void (*tnl_triangle_func)( GLcontext *ctx,
+typedef void (*tnl_points_func)( struct gl_context *ctx, GLuint first, GLuint last );
+typedef void (*tnl_line_func)( struct gl_context *ctx, GLuint v1, GLuint v2 );
+typedef void (*tnl_triangle_func)( struct gl_context *ctx,
GLuint v1, GLuint v2, GLuint v3 );
-typedef void (*tnl_quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,
+typedef void (*tnl_quad_func)( struct gl_context *ctx, GLuint v1, GLuint v2,
GLuint v3, GLuint v4 );
-typedef void (*tnl_render_func)( GLcontext *ctx, GLuint start, GLuint count,
+typedef void (*tnl_render_func)( struct gl_context *ctx, GLuint start, GLuint count,
GLuint flags );
-typedef void (*tnl_interp_func)( GLcontext *ctx,
+typedef void (*tnl_interp_func)( struct gl_context *ctx,
GLfloat t, GLuint dst, GLuint out, GLuint in,
GLboolean force_boundary );
-typedef void (*tnl_copy_pv_func)( GLcontext *ctx, GLuint dst, GLuint src );
-typedef void (*tnl_setup_func)( GLcontext *ctx,
+typedef void (*tnl_copy_pv_func)( struct gl_context *ctx, GLuint dst, GLuint src );
+typedef void (*tnl_setup_func)( struct gl_context *ctx,
GLuint start, GLuint end,
GLuint new_inputs);
struct tnl_clipspace_fastpath *fastpath;
- void (*codegen_emit)( GLcontext *ctx );
+ void (*codegen_emit)( struct gl_context *ctx );
};
*** TNL Pipeline
***/
- void (*RunPipeline)(GLcontext *ctx);
+ void (*RunPipeline)(struct gl_context *ctx);
/* Replaces PipelineStart/PipelineFinish -- intended to allow
* drivers to wrap _tnl_run_pipeline() with code to validate state
* and grab/release hardware locks.
*/
- void (*NotifyMaterialChange)(GLcontext *ctx);
+ void (*NotifyMaterialChange)(struct gl_context *ctx);
/* Alert tnl-aware drivers of changes to material.
*/
***/
struct
{
- void (*Start)(GLcontext *ctx);
- void (*Finish)(GLcontext *ctx);
+ void (*Start)(struct gl_context *ctx);
+ void (*Finish)(struct gl_context *ctx);
/* Called before and after all rendering operations, including DrawPixels,
* ReadPixels, Bitmap, span functions, and CopyTexImage, etc commands.
* These are a suitable place for grabbing/releasing hardware locks.
*/
- void (*PrimitiveNotify)(GLcontext *ctx, GLenum mode);
+ void (*PrimitiveNotify)(struct gl_context *ctx, GLenum mode);
/* Called between RenderStart() and RenderFinish() to indicate the
* type of primitive we're about to draw. Mode will be one of the
* modes accepted by glBegin().
* vertex attributes should be copied.
*/
- void (*ClippedPolygon)( GLcontext *ctx, const GLuint *elts, GLuint n );
+ void (*ClippedPolygon)( struct gl_context *ctx, const GLuint *elts, GLuint n );
/* Render a polygon with <n> vertices whose indexes are in the <elts>
* array.
*/
- void (*ClippedLine)( GLcontext *ctx, GLuint v0, GLuint v1 );
+ void (*ClippedLine)( struct gl_context *ctx, GLuint v0, GLuint v1 );
/* Render a line between the two vertices given by indexes v0 and v1. */
tnl_points_func Points; /* must now respect vb->elts */
* vertices.
*/
- void (*ResetLineStipple)( GLcontext *ctx );
+ void (*ResetLineStipple)( struct gl_context *ctx );
/* Reset the hardware's line stipple counter.
*/
*/
- GLboolean (*Multipass)( GLcontext *ctx, GLuint passno );
+ GLboolean (*Multipass)( struct gl_context *ctx, GLuint passno );
/* Driver may request additional render passes by returning GL_TRUE
* when this function is called. This function will be called
* after the first pass, and passes will be made until the function
extern void
-tnl_clip_prepare(GLcontext *ctx);
+tnl_clip_prepare(struct gl_context *ctx);
#endif
-static GLubyte *get_space(GLcontext *ctx, GLuint bytes)
+static GLubyte *get_space(struct gl_context *ctx, GLuint bytes)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLubyte *space = malloc(bytes);
}
-static void free_space(GLcontext *ctx)
+static void free_space(struct gl_context *ctx)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint i;
/* Adjust pointer to point at first requested element, convert to
* floating point, populate VB->AttribPtr[].
*/
-static void _tnl_import_array( GLcontext *ctx,
+static void _tnl_import_array( struct gl_context *ctx,
GLuint attrib,
GLuint count,
const struct gl_client_array *input,
#define CLIPVERTS ((6 + MAX_CLIP_PLANES) * 2)
-static GLboolean *_tnl_import_edgeflag( GLcontext *ctx,
+static GLboolean *_tnl_import_edgeflag( struct gl_context *ctx,
const GLvector4f *input,
GLuint count)
{
}
-static void bind_inputs( GLcontext *ctx,
+static void bind_inputs( struct gl_context *ctx,
const struct gl_client_array *inputs[],
GLint count,
struct gl_buffer_object **bo,
/* Translate indices to GLuints and store in VB->Elts.
*/
-static void bind_indices( GLcontext *ctx,
+static void bind_indices( struct gl_context *ctx,
const struct _mesa_index_buffer *ib,
struct gl_buffer_object **bo,
GLuint *nr_bo)
}
}
-static void bind_prims( GLcontext *ctx,
+static void bind_prims( struct gl_context *ctx,
const struct _mesa_prim *prim,
GLuint nr_prims )
{
VB->PrimitiveCount = nr_prims;
}
-static void unmap_vbos( GLcontext *ctx,
+static void unmap_vbos( struct gl_context *ctx,
struct gl_buffer_object **bo,
GLuint nr_bo )
{
}
-void _tnl_vbo_draw_prims(GLcontext *ctx,
+void _tnl_vbo_draw_prims(struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
* module. In a regular swtnl driver, this can be plugged straight
* into the vbo->Driver.DrawPrims() callback.
*/
-void _tnl_draw_prims( GLcontext *ctx,
+void _tnl_draw_prims( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
#include "t_vp_build.h"
#include "t_vertex.h"
-void _tnl_install_pipeline( GLcontext *ctx,
+void _tnl_install_pipeline( struct gl_context *ctx,
const struct tnl_pipeline_stage **stages )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->pipeline.nr_stages = i;
}
-void _tnl_destroy_pipeline( GLcontext *ctx )
+void _tnl_destroy_pipeline( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint i;
-static GLuint check_input_changes( GLcontext *ctx )
+static GLuint check_input_changes( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint i;
}
-static GLuint check_output_changes( GLcontext *ctx )
+static GLuint check_output_changes( struct gl_context *ctx )
{
#if 0
TNLcontext *tnl = TNL_CONTEXT(ctx);
}
-void _tnl_run_pipeline( GLcontext *ctx )
+void _tnl_run_pipeline( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
unsigned short __tmp;
#include "main/mtypes.h"
#include "t_context.h"
-extern void _tnl_run_pipeline( GLcontext *ctx );
+extern void _tnl_run_pipeline( struct gl_context *ctx );
-extern void _tnl_destroy_pipeline( GLcontext *ctx );
+extern void _tnl_destroy_pipeline( struct gl_context *ctx );
-extern void _tnl_install_pipeline( GLcontext *ctx,
+extern void _tnl_install_pipeline( struct gl_context *ctx,
const struct tnl_pipeline_stage **stages );
extern tnl_render_func _tnl_render_tab_elts[];
extern tnl_render_func _tnl_render_tab_verts[];
-extern void _tnl_RenderClippedPolygon( GLcontext *ctx,
+extern void _tnl_RenderClippedPolygon( struct gl_context *ctx,
const GLuint *elts, GLuint n );
-extern void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj );
+extern void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj );
#endif
* \return zero if the point was clipped, or one otherwise.
*/
static GLuint
-userclip_point( GLcontext *ctx, const GLfloat v[] )
+userclip_point( struct gl_context *ctx, const GLfloat v[] )
{
GLuint p;
* \param Rindex returned color index
*/
static void
-shade_rastpos(GLcontext *ctx,
+shade_rastpos(struct gl_context *ctx,
const GLfloat vertex[4],
const GLfloat normal[3],
GLfloat Rcolor[4],
* \param texcoord incoming texcoord and resulting texcoord
*/
static void
-compute_texgen(GLcontext *ctx, const GLfloat vObj[4], const GLfloat vEye[4],
+compute_texgen(struct gl_context *ctx, const GLfloat vObj[4], const GLfloat vEye[4],
const GLfloat normal[3], GLuint unit, GLfloat texcoord[4])
{
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
* \param vObj vertex position in object space
*/
void
-_tnl_RasterPos(GLcontext *ctx, const GLfloat vObj[4])
+_tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4])
{
if (ctx->VertexProgram._Enabled) {
/* XXX implement this */
/* Clip a line against the viewport and user clip planes.
*/
static INLINE void
-TAG(clip_line)( GLcontext *ctx, GLuint v0, GLuint v1, GLubyte mask )
+TAG(clip_line)( struct gl_context *ctx, GLuint v0, GLuint v1, GLubyte mask )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
/* Clip a triangle against the viewport and user clip planes.
*/
static INLINE void
-TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask )
+TAG(clip_tri)( struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
/* Clip a quad against the viewport and user clip planes.
*/
static INLINE void
-TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3,
+TAG(clip_quad)( struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3,
GLubyte mask )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
* Fog blend factors are in the range [0,1].
*/
static void
-compute_fog_blend_factors(GLcontext *ctx, GLvector4f *out, const GLvector4f *in)
+compute_fog_blend_factors(struct gl_context *ctx, GLvector4f *out, const GLvector4f *in)
{
GLfloat end = ctx->Fog.End;
GLfloat *v = in->start;
static GLboolean
-run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
+run_fog_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
/* Called the first time stage->run() is invoked.
*/
static GLboolean
-alloc_fog_data(GLcontext *ctx, struct tnl_pipeline_stage *stage)
+alloc_fog_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct fog_stage_data *store;
#define LIGHT_MATERIAL 0x2
#define MAX_LIGHT_FUNC 0x4
-typedef void (*light_func)( GLcontext *ctx,
+typedef void (*light_func)( struct gl_context *ctx,
struct vertex_buffer *VB,
struct tnl_pipeline_stage *stage,
GLvector4f *input );
* It's called per-vertex in the lighting loop.
*/
static void
-update_materials(GLcontext *ctx, struct light_stage_data *store)
+update_materials(struct gl_context *ctx, struct light_stage_data *store)
{
GLuint i;
* Return number of material attributes which will track vertex color.
*/
static GLuint
-prepare_materials(GLcontext *ctx,
+prepare_materials(struct gl_context *ctx,
struct vertex_buffer *VB, struct light_stage_data *store)
{
GLuint i;
}
-static GLboolean run_lighting( GLcontext *ctx,
+static GLboolean run_lighting( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
struct light_stage_data *store = LIGHT_STAGE_DATA(stage);
/* Called in place of do_lighting when the light table may have changed.
*/
-static void validate_lighting( GLcontext *ctx,
+static void validate_lighting( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
light_func *tab;
/* Called the first time stage->run is called. In effect, don't
* allocate data until the first time the stage is run.
*/
-static GLboolean init_lighting( GLcontext *ctx,
+static GLboolean init_lighting( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
* stage is the lighting stage-private data
* input is the vector of eye or object-space vertex coordinates
*/
-static void TAG(light_rgba_spec)( GLcontext *ctx,
+static void TAG(light_rgba_spec)( struct gl_context *ctx,
struct vertex_buffer *VB,
struct tnl_pipeline_stage *stage,
GLvector4f *input )
}
-static void TAG(light_rgba)( GLcontext *ctx,
+static void TAG(light_rgba)( struct gl_context *ctx,
struct vertex_buffer *VB,
struct tnl_pipeline_stage *stage,
GLvector4f *input )
/* As below, but with just a single light.
*/
-static void TAG(light_fast_rgba_single)( GLcontext *ctx,
+static void TAG(light_fast_rgba_single)( struct gl_context *ctx,
struct vertex_buffer *VB,
struct tnl_pipeline_stage *stage,
GLvector4f *input )
/* Light infinite lights
*/
-static void TAG(light_fast_rgba)( GLcontext *ctx,
+static void TAG(light_fast_rgba)( struct gl_context *ctx,
struct vertex_buffer *VB,
struct tnl_pipeline_stage *stage,
GLvector4f *input )
static GLboolean
-run_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
+run_normal_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
{
struct normal_stage_data *store = NORMAL_STAGE_DATA(stage);
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
* to point to the appropriate normal transformation routine.
*/
static void
-validate_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
+validate_normal_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
{
struct normal_stage_data *store = NORMAL_STAGE_DATA(stage);
* Allocate stage's private data (storage for transformed normals).
*/
static GLboolean
-alloc_normal_data(GLcontext *ctx, struct tnl_pipeline_stage *stage)
+alloc_normal_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct normal_stage_data *store;
* disabled.
*/
static GLboolean
-run_point_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
+run_point_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
{
if (ctx->Point._Attenuated && !ctx->VertexProgram._Current) {
struct point_stage_data *store = POINT_STAGE_DATA(stage);
static GLboolean
-alloc_point_data(GLcontext *ctx, struct tnl_pipeline_stage *stage)
+alloc_point_data(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
struct point_stage_data *store;
static void
-userclip( GLcontext *ctx,
+userclip( struct gl_context *ctx,
GLvector4f *clip,
GLubyte *clipmask,
GLubyte *clipormask,
static GLboolean
-do_ndc_cliptest(GLcontext *ctx, struct vp_stage_data *store)
+do_ndc_cliptest(struct gl_context *ctx, struct vp_stage_data *store)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
* moved into main/ someday.
*/
static void
-vp_fetch_texel(GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
+vp_fetch_texel(struct gl_context *ctx, const GLfloat texcoord[4], GLfloat lambda,
GLuint unit, GLfloat color[4])
{
SWcontext *swrast = SWRAST_CONTEXT(ctx);
* string has been parsed.
*/
GLboolean
-_tnl_program_string(GLcontext *ctx, GLenum target, struct gl_program *program)
+_tnl_program_string(struct gl_context *ctx, GLenum target, struct gl_program *program)
{
/* No-op.
* If we had derived anything from the program that was private to this
* Initialize virtual machine state prior to executing vertex program.
*/
static void
-init_machine(GLcontext *ctx, struct gl_program_machine *machine)
+init_machine(struct gl_context *ctx, struct gl_program_machine *machine)
{
/* Input registers get initialized from the current vertex attribs */
memcpy(machine->VertAttribs, ctx->Current.Attrib,
* Map the texture images which the vertex program will access (if any).
*/
static void
-map_textures(GLcontext *ctx, const struct gl_vertex_program *vp)
+map_textures(struct gl_context *ctx, const struct gl_vertex_program *vp)
{
GLuint u;
* Unmap the texture images which were used by the vertex program (if any).
*/
static void
-unmap_textures(GLcontext *ctx, const struct gl_vertex_program *vp)
+unmap_textures(struct gl_context *ctx, const struct gl_vertex_program *vp)
{
GLuint u;
* This function executes vertex programs
*/
static GLboolean
-run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
+run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vp_stage_data *store = VP_STAGE_DATA(stage);
* allocate data until the first time the stage is run.
*/
static GLboolean
-init_vp(GLcontext *ctx, struct tnl_pipeline_stage *stage)
+init_vp(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &(tnl->vb);
static void
-validate_vp_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage)
+validate_vp_stage(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
{
if (ctx->VertexProgram._Current) {
_swrast_update_texture_samplers(ctx);
/* TODO: do this for all primitives, verts and elts:
*/
-static void clip_elt_triangles( GLcontext *ctx,
+static void clip_elt_triangles( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
/* Helper functions for drivers */
/**********************************************************************/
-void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n )
+void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct vertex_buffer *VB = &tnl->vb;
VB->Elts = tmp;
}
-void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj )
+void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
tnl->Driver.Render.Line( ctx, ii, jj );
/**********************************************************************/
-static GLboolean run_render( GLcontext *ctx,
+static GLboolean run_render( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
#define RENDER_TAB_QUALIFIER static
#endif
-static void TAG(render_points)( GLcontext *ctx,
+static void TAG(render_points)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
POSTFIX;
}
-static void TAG(render_lines)( GLcontext *ctx,
+static void TAG(render_lines)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_line_strip)( GLcontext *ctx,
+static void TAG(render_line_strip)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_line_loop)( GLcontext *ctx,
+static void TAG(render_line_loop)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_triangles)( GLcontext *ctx,
+static void TAG(render_triangles)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
-static void TAG(render_tri_strip)( GLcontext *ctx,
+static void TAG(render_tri_strip)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_tri_fan)( GLcontext *ctx,
+static void TAG(render_tri_fan)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_poly)( GLcontext *ctx,
+static void TAG(render_poly)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
POSTFIX;
}
-static void TAG(render_quads)( GLcontext *ctx,
+static void TAG(render_quads)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
POSTFIX;
}
-static void TAG(render_quad_strip)( GLcontext *ctx,
+static void TAG(render_quad_strip)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
POSTFIX;
}
-static void TAG(render_noop)( GLcontext *ctx,
+static void TAG(render_noop)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
(void)(ctx && start && count && flags);
}
-RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(GLcontext *,
+RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(struct gl_context *,
GLuint,
GLuint,
GLuint) =
struct texgen_stage_data;
-typedef void (*texgen_func)( GLcontext *ctx,
+typedef void (*texgen_func)( struct gl_context *ctx,
struct texgen_stage_data *store,
GLuint unit);
/* Special case texgen functions.
*/
-static void texgen_reflection_map_nv( GLcontext *ctx,
+static void texgen_reflection_map_nv( struct gl_context *ctx,
struct texgen_stage_data *store,
GLuint unit )
{
-static void texgen_normal_map_nv( GLcontext *ctx,
+static void texgen_normal_map_nv( struct gl_context *ctx,
struct texgen_stage_data *store,
GLuint unit )
{
}
-static void texgen_sphere_map( GLcontext *ctx,
+static void texgen_sphere_map( struct gl_context *ctx,
struct texgen_stage_data *store,
GLuint unit )
{
-static void texgen( GLcontext *ctx,
+static void texgen( struct gl_context *ctx,
struct texgen_stage_data *store,
GLuint unit )
{
-static GLboolean run_texgen_stage( GLcontext *ctx,
+static GLboolean run_texgen_stage( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
}
-static void validate_texgen_stage( GLcontext *ctx,
+static void validate_texgen_stage( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
struct texgen_stage_data *store = TEXGEN_STAGE_DATA(stage);
/* Called the first time stage->run() is invoked.
*/
-static GLboolean alloc_texgen_data( GLcontext *ctx,
+static GLboolean alloc_texgen_data( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
-static GLboolean run_texmat_stage( GLcontext *ctx,
+static GLboolean run_texmat_stage( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
struct texmat_stage_data *store = TEXMAT_STAGE_DATA(stage);
/* Called the first time stage->run() is invoked.
*/
-static GLboolean alloc_texmat_data( GLcontext *ctx,
+static GLboolean alloc_texmat_data( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
* t_render_clip.h.
*/
#define USER_CLIPTEST(NAME, SZ) \
-static void NAME( GLcontext *ctx, \
+static void NAME( struct gl_context *ctx, \
GLvector4f *clip, \
GLubyte *clipmask, \
GLubyte *clipormask, \
USER_CLIPTEST(userclip3, 3)
USER_CLIPTEST(userclip4, 4)
-static void (*(usercliptab[5]))( GLcontext *,
+static void (*(usercliptab[5]))( struct gl_context *,
GLvector4f *, GLubyte *,
GLubyte *, GLubyte * ) =
{
void
-tnl_clip_prepare(GLcontext *ctx)
+tnl_clip_prepare(struct gl_context *ctx)
{
/* Neither the x86 nor sparc asm cliptest functions have been updated
* for ARB_depth_clamp, so force the C paths.
-static GLboolean run_vertex_stage( GLcontext *ctx,
+static GLboolean run_vertex_stage( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
struct vertex_stage_data *store = (struct vertex_stage_data *)stage->privatePtr;
}
-static GLboolean init_vertex_stage( GLcontext *ctx,
+static GLboolean init_vertex_stage( struct gl_context *ctx,
struct tnl_pipeline_stage *stage )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
/***********************************************************************
* Build codegen functions or return generic ones:
*/
-static void choose_emit_func( GLcontext *ctx, GLuint count, GLubyte *dest)
+static void choose_emit_func( struct gl_context *ctx, GLuint count, GLubyte *dest)
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
-static void choose_interp_func( GLcontext *ctx,
+static void choose_interp_func( struct gl_context *ctx,
GLfloat t,
GLuint edst, GLuint eout, GLuint ein,
GLboolean force_boundary )
}
-static void choose_copy_pv_func( GLcontext *ctx, GLuint edst, GLuint esrc )
+static void choose_copy_pv_func( struct gl_context *ctx, GLuint edst, GLuint esrc )
{
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
/* Interpolate between two vertices to produce a third:
*/
-void _tnl_interp( GLcontext *ctx,
+void _tnl_interp( struct gl_context *ctx,
GLfloat t,
GLuint edst, GLuint eout, GLuint ein,
GLboolean force_boundary )
/* Copy colors from one vertex to another:
*/
-void _tnl_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc )
+void _tnl_copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc )
{
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
vtx->copy_pv( ctx, edst, esrc );
* reverse any viewport transformation, swizzling or other conversions
* which may have been applied:
*/
-void _tnl_get_attr( GLcontext *ctx, const void *vin,
+void _tnl_get_attr( struct gl_context *ctx, const void *vin,
GLenum attr, GLfloat *dest )
{
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
*/
if (attr == _TNL_ATTRIB_POINTSIZE) {
/* If the hardware vertex doesn't have point size then use size from
- * GLcontext. XXX this will be wrong if drawing attenuated points!
+ * struct gl_context. XXX this will be wrong if drawing attenuated points!
*/
dest[0] = ctx->Point.Size;
}
/* Complementary operation to the above.
*/
-void _tnl_set_attr( GLcontext *ctx, void *vout,
+void _tnl_set_attr( struct gl_context *ctx, void *vout,
GLenum attr, const GLfloat *src )
{
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
}
-void *_tnl_get_vertex( GLcontext *ctx, GLuint nr )
+void *_tnl_get_vertex( struct gl_context *ctx, GLuint nr )
{
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
return vtx->vertex_buf + nr * vtx->vertex_size;
}
-void _tnl_invalidate_vertex_state( GLcontext *ctx, GLuint new_state )
+void _tnl_invalidate_vertex_state( struct gl_context *ctx, GLuint new_state )
{
if (new_state & (_DD_NEW_TRI_LIGHT_TWOSIDE|_DD_NEW_TRI_UNFILLED) ) {
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
vtx->new_inputs = ~0;
}
-GLuint _tnl_install_attrs( GLcontext *ctx, const struct tnl_attr_map *map,
+GLuint _tnl_install_attrs( struct gl_context *ctx, const struct tnl_attr_map *map,
GLuint nr, const GLfloat *vp,
GLuint unpacked_size )
{
-void _tnl_invalidate_vertices( GLcontext *ctx, GLuint newinputs )
+void _tnl_invalidate_vertices( struct gl_context *ctx, GLuint newinputs )
{
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
vtx->new_inputs |= newinputs;
/* This event has broader use beyond this file - will move elsewhere
* and probably invoke a driver callback.
*/
-void _tnl_notify_pipeline_output_change( GLcontext *ctx )
+void _tnl_notify_pipeline_output_change( struct gl_context *ctx )
{
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
invalidate_funcs(vtx);
}
-static void adjust_input_ptrs( GLcontext *ctx, GLint diff)
+static void adjust_input_ptrs( struct gl_context *ctx, GLint diff)
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
}
}
-static void update_input_ptrs( GLcontext *ctx, GLuint start )
+static void update_input_ptrs( struct gl_context *ctx, GLuint start )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
}
-void _tnl_build_vertices( GLcontext *ctx,
+void _tnl_build_vertices( struct gl_context *ctx,
GLuint start,
GLuint end,
GLuint newinputs )
/* Emit VB vertices start..end to dest. Note that VB vertex at
* postion start will be emitted to dest at position zero.
*/
-void *_tnl_emit_vertices_to_buffer( GLcontext *ctx,
+void *_tnl_emit_vertices_to_buffer( struct gl_context *ctx,
GLuint start,
GLuint end,
void *dest )
* postion start will be emitted to dest at position zero.
*/
-void *_tnl_emit_indexed_vertices_to_buffer( GLcontext *ctx,
+void *_tnl_emit_indexed_vertices_to_buffer( struct gl_context *ctx,
const GLuint *elts,
GLuint start,
GLuint end,
}
-void _tnl_init_vertices( GLcontext *ctx,
+void _tnl_init_vertices( struct gl_context *ctx,
GLuint vb_size,
GLuint max_vertex_size )
{
}
-void _tnl_free_vertices( GLcontext *ctx )
+void _tnl_free_vertices( struct gl_context *ctx )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
if (tnl) {
/* Interpolate between two vertices to produce a third:
*/
-extern void _tnl_interp( GLcontext *ctx,
+extern void _tnl_interp( struct gl_context *ctx,
GLfloat t,
GLuint edst, GLuint eout, GLuint ein,
GLboolean force_boundary );
/* Copy colors from one vertex to another:
*/
-extern void _tnl_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc );
+extern void _tnl_copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc );
/* Extract a named attribute from a hardware vertex. Will have to
* reverse any viewport transformation, swizzling or other conversions
* which may have been applied:
*/
-extern void _tnl_get_attr( GLcontext *ctx, const void *vertex, GLenum attrib,
+extern void _tnl_get_attr( struct gl_context *ctx, const void *vertex, GLenum attrib,
GLfloat *dest );
/* Complementary to the above.
*/
-extern void _tnl_set_attr( GLcontext *ctx, void *vout, GLenum attrib,
+extern void _tnl_set_attr( struct gl_context *ctx, void *vout, GLenum attrib,
const GLfloat *src );
-extern void *_tnl_get_vertex( GLcontext *ctx, GLuint nr );
+extern void *_tnl_get_vertex( struct gl_context *ctx, GLuint nr );
-extern GLuint _tnl_install_attrs( GLcontext *ctx,
+extern GLuint _tnl_install_attrs( struct gl_context *ctx,
const struct tnl_attr_map *map,
GLuint nr, const GLfloat *vp,
GLuint unpacked_size );
-extern void _tnl_free_vertices( GLcontext *ctx );
+extern void _tnl_free_vertices( struct gl_context *ctx );
-extern void _tnl_init_vertices( GLcontext *ctx,
+extern void _tnl_init_vertices( struct gl_context *ctx,
GLuint vb_size,
GLuint max_vertex_size );
-extern void *_tnl_emit_vertices_to_buffer( GLcontext *ctx,
+extern void *_tnl_emit_vertices_to_buffer( struct gl_context *ctx,
GLuint start,
GLuint end,
void *dest );
* the same functionality.
*/
-extern void *_tnl_emit_indexed_vertices_to_buffer( GLcontext *ctx,
+extern void *_tnl_emit_indexed_vertices_to_buffer( struct gl_context *ctx,
const GLuint *elts,
GLuint start,
GLuint end,
void *dest );
-extern void _tnl_build_vertices( GLcontext *ctx,
+extern void _tnl_build_vertices( struct gl_context *ctx,
GLuint start,
GLuint end,
GLuint newinputs );
-extern void _tnl_invalidate_vertices( GLcontext *ctx, GLuint newinputs );
+extern void _tnl_invalidate_vertices( struct gl_context *ctx, GLuint newinputs );
-extern void _tnl_invalidate_vertex_state( GLcontext *ctx, GLuint new_state );
+extern void _tnl_invalidate_vertex_state( struct gl_context *ctx, GLuint new_state );
-extern void _tnl_notify_pipeline_output_change( GLcontext *ctx );
+extern void _tnl_notify_pipeline_output_change( struct gl_context *ctx );
#define GET_VERTEX_STATE(ctx) &(TNL_CONTEXT(ctx)->clipspace)
/* t_vertex_generic.c -- Internal functions for t_vertex.c
*/
-void _tnl_generic_copy_pv_extras( GLcontext *ctx,
+void _tnl_generic_copy_pv_extras( struct gl_context *ctx,
GLuint dst, GLuint src );
-void _tnl_generic_interp_extras( GLcontext *ctx,
+void _tnl_generic_interp_extras( struct gl_context *ctx,
GLfloat t,
GLuint dst, GLuint out, GLuint in,
GLboolean force_boundary );
-void _tnl_generic_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc );
+void _tnl_generic_copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc );
-void _tnl_generic_interp( GLcontext *ctx,
+void _tnl_generic_interp( struct gl_context *ctx,
GLfloat t,
GLuint edst, GLuint eout, GLuint ein,
GLboolean force_boundary );
-void _tnl_generic_emit( GLcontext *ctx,
+void _tnl_generic_emit( struct gl_context *ctx,
GLuint count,
GLubyte *v );
-void _tnl_generate_hardwired_emit( GLcontext *ctx );
+void _tnl_generate_hardwired_emit( struct gl_context *ctx );
/* t_vertex_sse.c -- Internal functions for t_vertex.c
*/
-void _tnl_generate_sse_emit( GLcontext *ctx );
+void _tnl_generate_sse_emit( struct gl_context *ctx );
#endif
* vertices
*/
#define EMIT5(NR, F0, F1, F2, F3, F4, NAME) \
-static void NAME( GLcontext *ctx, \
+static void NAME( struct gl_context *ctx, \
GLuint count, \
GLubyte *v ) \
{ \
/* Use the codegen paths to select one of a number of hardwired
* fastpaths.
*/
-void _tnl_generate_hardwired_emit( GLcontext *ctx )
+void _tnl_generate_hardwired_emit( struct gl_context *ctx )
{
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
tnl_emit_func func = NULL;
* vertices
*/
-void _tnl_generic_emit( GLcontext *ctx,
+void _tnl_generic_emit( struct gl_context *ctx,
GLuint count,
GLubyte *v )
{
}
-void _tnl_generic_interp( GLcontext *ctx,
+void _tnl_generic_interp( struct gl_context *ctx,
GLfloat t,
GLuint edst, GLuint eout, GLuint ein,
GLboolean force_boundary )
/* Extract color attributes from one vertex and insert them into
* another. (Shortcircuit extract/insert with memcpy).
*/
-void _tnl_generic_copy_pv( GLcontext *ctx, GLuint edst, GLuint esrc )
+void _tnl_generic_copy_pv( struct gl_context *ctx, GLuint edst, GLuint esrc )
{
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
GLubyte *vsrc = vtx->vertex_buf + esrc * vtx->vertex_size;
/* Helper functions for hardware which doesn't put back colors and/or
* edgeflags into vertices.
*/
-void _tnl_generic_interp_extras( GLcontext *ctx,
+void _tnl_generic_interp_extras( struct gl_context *ctx,
GLfloat t,
GLuint dst, GLuint out, GLuint in,
GLboolean force_boundary )
_tnl_generic_interp(ctx, t, dst, out, in, force_boundary);
}
-void _tnl_generic_copy_pv_extras( GLcontext *ctx,
+void _tnl_generic_copy_pv_extras( struct gl_context *ctx,
GLuint dst, GLuint src )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
struct x86_program {
struct x86_function func;
- GLcontext *ctx;
+ struct gl_context *ctx;
GLboolean inputs_safe;
GLboolean outputs_safe;
GLboolean have_sse2;
*/
static GLboolean build_vertex_emit( struct x86_program *p )
{
- GLcontext *ctx = p->ctx;
+ struct gl_context *ctx = p->ctx;
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
GLuint j = 0;
-void _tnl_generate_sse_emit( GLcontext *ctx )
+void _tnl_generate_sse_emit( struct gl_context *ctx )
{
struct tnl_clipspace *vtx = GET_VERTEX_STATE(ctx);
struct x86_program p;
#else
-void _tnl_generate_sse_emit( GLcontext *ctx )
+void _tnl_generate_sse_emit( struct gl_context *ctx )
{
/* Dummy version for when USE_SSE_ASM not defined */
}
/**
* XXX This should go away someday, but still referenced by some drivers...
*/
-void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx )
+void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx )
{
const struct gl_vertex_program *prev = ctx->VertexProgram._Current;
_NEW_FOG | \
_NEW_POINT)
-extern void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx );
+extern void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx );
#endif
* itself.)
*/
extern GLboolean
-_tnl_CreateContext( GLcontext *ctx );
+_tnl_CreateContext( struct gl_context *ctx );
extern void
-_tnl_DestroyContext( GLcontext *ctx );
+_tnl_DestroyContext( struct gl_context *ctx );
extern void
-_tnl_InvalidateState( GLcontext *ctx, GLuint new_state );
+_tnl_InvalidateState( struct gl_context *ctx, GLuint new_state );
/* Functions to revive the tnl module after being unhooked from
* dispatch and/or driver callbacks.
*/
extern void
-_tnl_wakeup( GLcontext *ctx );
+_tnl_wakeup( struct gl_context *ctx );
/* Driver configuration options:
*/
extern void
-_tnl_need_projected_coords( GLcontext *ctx, GLboolean flag );
+_tnl_need_projected_coords( struct gl_context *ctx, GLboolean flag );
/* Control whether T&L does per-vertex fog
*/
extern void
-_tnl_allow_vertex_fog( GLcontext *ctx, GLboolean value );
+_tnl_allow_vertex_fog( struct gl_context *ctx, GLboolean value );
extern void
-_tnl_allow_pixel_fog( GLcontext *ctx, GLboolean value );
+_tnl_allow_pixel_fog( struct gl_context *ctx, GLboolean value );
extern GLboolean
-_tnl_program_string(GLcontext *ctx, GLenum target, struct gl_program *program);
+_tnl_program_string(struct gl_context *ctx, GLenum target, struct gl_program *program);
struct _mesa_prim;
struct _mesa_index_buffer;
void
-_tnl_draw_prims( GLcontext *ctx,
+_tnl_draw_prims( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
GLuint max_index);
void
-_tnl_vbo_draw_prims( GLcontext *ctx,
+_tnl_vbo_draw_prims( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
GLuint max_index);
extern void
-_mesa_load_tracked_matrices(GLcontext *ctx);
+_mesa_load_tracked_matrices(struct gl_context *ctx);
extern void
-_tnl_RasterPos(GLcontext *ctx, const GLfloat vObj[4]);
+_tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]);
#endif
* GL_POINTS
*/
-static void TAG(flush_point_0)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_point_0)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
if ( !v0->mask ) {
LOCAL_VARS;
* GL_LINES
*/
-static void TAG(flush_line_1)( GLcontext *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_line_1)( struct gl_context *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_line_0)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_line_0)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
FLUSH_VERTEX = TAG(flush_line_1);
ACTIVE_VERTEX = IMM_VERTICES( 1 );
}
-static void TAG(flush_line_1)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_line_1)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
TNL_VERTEX *v1 = v0 - 1;
* GL_LINE_LOOP
*/
-static void TAG(flush_line_loop_2)( GLcontext *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_line_loop_1)( GLcontext *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_line_loop_2)( struct gl_context *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_line_loop_1)( struct gl_context *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_line_loop_0)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_line_loop_0)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
EMIT_VERTEX( b ); \
}
-static void TAG(flush_line_loop_1)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_line_loop_1)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
TNL_VERTEX *v1 = v0 - 1;
DRAW_LINELOOP_LINE( v1, v0 );
}
-static void TAG(flush_line_loop_2)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_line_loop_2)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
TNL_VERTEX *v1 = v0 + 1;
DRAW_LINELOOP_LINE( v1, v0 );
}
-static void TAG(end_line_loop)( GLcontext *ctx )
+static void TAG(end_line_loop)( struct gl_context *ctx )
{
LOCAL_VARS;
* GL_LINE_STRIP
*/
-static void TAG(flush_line_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_line_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_line_strip_2)( struct gl_context *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_line_strip_1)( struct gl_context *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_line_strip_0)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_line_strip_0)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
}
-static void TAG(flush_line_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_line_strip_1)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
TNL_VERTEX *v1 = v0 - 1;
}
}
-static void TAG(flush_line_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_line_strip_2)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
TNL_VERTEX *v1 = v0 + 1;
* GL_TRIANGLES
*/
-static void TAG(flush_triangle_2)( GLcontext *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_triangle_1)( GLcontext *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_triangle_2)( struct gl_context *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_triangle_1)( struct gl_context *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_triangle_0)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_triangle_0)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
BEGIN_PRIM( GL_TRIANGLES, 0 );
}
-static void TAG(flush_triangle_1)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_triangle_1)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
FLUSH_VERTEX = TAG(flush_triangle_2);
}
-static void TAG(flush_triangle_2)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_triangle_2)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
TNL_VERTEX *v2 = v0 - 2;
* GL_TRIANGLE_STRIP
*/
-static void TAG(flush_tri_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_tri_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_tri_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_tri_strip_3)( struct gl_context *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_tri_strip_2)( struct gl_context *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_tri_strip_1)( struct gl_context *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_tri_strip_0)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_tri_strip_0)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
ACTIVE_VERTEX = IMM_VERTICES( 1 );
FLUSH_VERTEX = TAG(flush_tri_strip_1);
}
-static void TAG(flush_tri_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_tri_strip_1)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
ACTIVE_VERTEX = IMM_VERTICES( 2 );
EMIT_VERTEX( v0 ); \
}
-static void TAG(flush_tri_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_tri_strip_2)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
FLUSH_VERTEX = TAG(flush_tri_strip_3);
DO_TRISTRIP_TRI( 0, 1 );
}
-static void TAG(flush_tri_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_tri_strip_3)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
FLUSH_VERTEX = TAG(flush_tri_strip_4);
DO_TRISTRIP_TRI( 1, 2 );
}
-static void TAG(flush_tri_strip_4)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_tri_strip_4)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
FLUSH_VERTEX = TAG(flush_tri_strip_5);
DO_TRISTRIP_TRI( 2, 3 );
}
-static void TAG(flush_tri_strip_5)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_tri_strip_5)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
FLUSH_VERTEX = TAG(flush_tri_strip_2);
* GL_TRIANGLE_FAN
*/
-static void TAG(flush_tri_fan_2)( GLcontext *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_tri_fan_1)( GLcontext *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_tri_fan_2)( struct gl_context *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_tri_fan_1)( struct gl_context *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_tri_fan_0)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_tri_fan_0)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
FLUSH_VERTEX = TAG(flush_tri_fan_1);
}
-static void TAG(flush_tri_fan_1)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_tri_fan_1)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
EMIT_VERTEX( v0 ); \
}
-static void TAG(flush_tri_fan_2)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_tri_fan_2)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
ACTIVE_VERTEX = IMM_VERTICES( 1 );
DO_TRIFAN_TRI( 0, 1 );
}
-static void TAG(flush_tri_fan_3)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_tri_fan_3)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
ACTIVE_VERTEX = IMM_VERTICES( 2 );
* GL_QUADS
*/
-static void TAG(flush_quad_3)( GLcontext *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_quad_2)( GLcontext *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_quad_1)( GLcontext *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_quad_3)( struct gl_context *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_quad_2)( struct gl_context *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_quad_1)( struct gl_context *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_quad_0)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_quad_0)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
IMM_VERTEX( v0 ) = v0 + 1;
FLUSH_VERTEX = TAG(flush_quad_1);
}
-static void TAG(flush_quad_1)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_quad_1)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
IMM_VERTEX( v0 ) = v0 + 1;
FLUSH_VERTEX = TAG(flush_quad_2);
}
-static void TAG(flush_quad_2)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_quad_2)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
IMM_VERTEX( v0 ) = v0 + 1;
FLUSH_VERTEX = TAG(flush_quad_3);
}
-static void TAG(flush_quad_3)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_quad_3)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
TNL_VERTEX *v3 = v0 - 3;
* GL_QUAD_STRIP
*/
-static void TAG(flush_quad_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_quad_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_quad_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_quad_strip_3)( struct gl_context *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_quad_strip_2)( struct gl_context *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_quad_strip_1)( struct gl_context *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_quad_strip_0)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_quad_strip_0)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
FLUSH_VERTEX = TAG(flush_quad_strip_1);
}
-static void TAG(flush_quad_strip_1)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_quad_strip_1)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
FLUSH_VERTEX = TAG(flush_quad_strip_2);
}
-static void TAG(flush_quad_strip_2)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_quad_strip_2)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
FLUSH_VERTEX = TAG(flush_quad_strip_3);
}
-static void TAG(flush_quad_strip_3)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_quad_strip_3)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
TNL_VERTEX *v3 = IMM_VERTEX( v3 );
* GL_POLYGON
*/
-static void TAG(flush_poly_2)( GLcontext *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_poly_1)( GLcontext *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_poly_2)( struct gl_context *ctx, TNL_VERTEX *v0 );
+static void TAG(flush_poly_1)( struct gl_context *ctx, TNL_VERTEX *v0 );
-static void TAG(flush_poly_0)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_poly_0)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
ACTIVE_VERTEX = IMM_VERTICES( 1 );
FLUSH_VERTEX = TAG(flush_poly_1);
}
-static void TAG(flush_poly_1)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_poly_1)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
ACTIVE_VERTEX = IMM_VERTICES( 2 );
EMIT_VERTEX( v0 ); \
}
-static void TAG(flush_poly_2)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_poly_2)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
ACTIVE_VERTEX = IMM_VERTICES( 1 );
DO_POLY_TRI( 0, 1 );
}
-static void TAG(flush_poly_3)( GLcontext *ctx, TNL_VERTEX *v0 )
+static void TAG(flush_poly_3)( struct gl_context *ctx, TNL_VERTEX *v0 )
{
LOCAL_VARS;
ACTIVE_VERTEX = IMM_VERTICES( 2 );
}
-void (*TAG(flush_tab)[GL_POLYGON+1])( GLcontext *, TNL_VERTEX * ) =
+void (*TAG(flush_tab)[GL_POLYGON+1])( struct gl_context *, TNL_VERTEX * ) =
{
TAG(flush_point),
TAG(flush_line_0),
/* Clip a line against the viewport and user clip planes.
*/
-static void TAG(clip_draw_line)( GLcontext *ctx,
+static void TAG(clip_draw_line)( struct gl_context *ctx,
TNL_VERTEX *I,
TNL_VERTEX *J,
GLuint mask )
/* Clip a triangle against the viewport and user clip planes.
*/
-static void TAG(clip_draw_triangle)( GLcontext *ctx,
+static void TAG(clip_draw_triangle)( struct gl_context *ctx,
TNL_VERTEX *v0,
TNL_VERTEX *v1,
TNL_VERTEX *v2,
}
-static __inline void TAG(draw_triangle)( GLcontext *ctx,
+static __inline void TAG(draw_triangle)( struct gl_context *ctx,
TNL_VERTEX *v0,
TNL_VERTEX *v1,
TNL_VERTEX *v2 )
}
}
-static __inline void TAG(draw_line)( GLcontext *ctx,
+static __inline void TAG(draw_line)( struct gl_context *ctx,
TNL_VERTEX *v0,
TNL_VERTEX *v1 )
{
/* COPY_VERTEX_FROM_CURRENT in t_dd_imm_vapi.c
*/
-static void TAG(emit_vfmt)( GLcontext *ctx, VERTEX *v )
+static void TAG(emit_vfmt)( struct gl_context *ctx, VERTEX *v )
{
LOCALVARS
;
-static void TAG(interp)( GLcontext *ctx,
+static void TAG(interp)( struct gl_context *ctx,
GLfloat t,
TNL_VERTEX *dst,
TNL_VERTEX *in,
}
-static __inline void TAG(copy_pv)( GLcontext *ctx,
+static __inline void TAG(copy_pv)( struct gl_context *ctx,
TNL_VERTEX *dst,
TNL_VERTEX *src )
{
* Keith Whitwell <keith@tungstengraphics.com>
*/
-static void copy_pv_rgba4_spec5( GLcontext *ctx, GLuint edst, GLuint esrc )
+static void copy_pv_rgba4_spec5( struct gl_context *ctx, GLuint edst, GLuint esrc )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
GLubyte *i810verts = (GLubyte *)imesa->verts;
dst->ui[5] = src->ui[5];
}
-static void copy_pv_rgba4( GLcontext *ctx, GLuint edst, GLuint esrc )
+static void copy_pv_rgba4( struct gl_context *ctx, GLuint edst, GLuint esrc )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
GLubyte *i810verts = (GLubyte *)imesa->verts;
dst->ui[4] = src->ui[4];
}
-static void copy_pv_rgba3( GLcontext *ctx, GLuint edst, GLuint esrc )
+static void copy_pv_rgba3( struct gl_context *ctx, GLuint edst, GLuint esrc )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
GLubyte *i810verts = (GLubyte *)imesa->verts;
#if (HAVE_ELTS)
-static void *TAG(emit_elts)( GLcontext *ctx, GLuint *elts, GLuint nr,
+static void *TAG(emit_elts)( struct gl_context *ctx, GLuint *elts, GLuint nr,
void *buf)
{
GLint i;
}
#endif
-static __inline void *TAG(emit_verts)( GLcontext *ctx, GLuint start,
+static __inline void *TAG(emit_verts)( struct gl_context *ctx, GLuint start,
GLuint count, void *buf )
{
return EMIT_VERTS(ctx, start, count, buf);
* Render non-indexed primitives.
***********************************************************************/
-static void TAG(render_points_verts)( GLcontext *ctx,
+static void TAG(render_points_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void TAG(render_lines_verts)( GLcontext *ctx,
+static void TAG(render_lines_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_line_strip_verts)( GLcontext *ctx,
+static void TAG(render_line_strip_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_line_loop_verts)( GLcontext *ctx,
+static void TAG(render_line_loop_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_triangles_verts)( GLcontext *ctx,
+static void TAG(render_triangles_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
-static void TAG(render_tri_strip_verts)( GLcontext *ctx,
+static void TAG(render_tri_strip_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void TAG(render_tri_fan_verts)( GLcontext *ctx,
+static void TAG(render_tri_fan_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_poly_verts)( GLcontext *ctx,
+static void TAG(render_poly_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void TAG(render_quad_strip_verts)( GLcontext *ctx,
+static void TAG(render_quad_strip_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_quads_verts)( GLcontext *ctx,
+static void TAG(render_quads_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void TAG(render_noop)( GLcontext *ctx,
+static void TAG(render_noop)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
****************************************************************************/
#if (HAVE_ELTS)
-static void TAG(render_points_elts)( GLcontext *ctx,
+static void TAG(render_points_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
-static void TAG(render_lines_elts)( GLcontext *ctx,
+static void TAG(render_lines_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_line_strip_elts)( GLcontext *ctx,
+static void TAG(render_line_strip_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_line_loop_elts)( GLcontext *ctx,
+static void TAG(render_line_loop_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
* buffers. For elts, this is probably no better (worse?) than the
* standard path.
*/
-static void TAG(render_triangles_elts)( GLcontext *ctx,
+static void TAG(render_triangles_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
-static void TAG(render_tri_strip_elts)( GLcontext *ctx,
+static void TAG(render_tri_strip_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void TAG(render_tri_fan_elts)( GLcontext *ctx,
+static void TAG(render_tri_fan_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_poly_elts)( GLcontext *ctx,
+static void TAG(render_poly_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void TAG(render_quad_strip_elts)( GLcontext *ctx,
+static void TAG(render_quad_strip_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_quads_elts)( GLcontext *ctx,
+static void TAG(render_quads_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
/* Pre-check the primitives in the VB to prevent the need for
* fallbacks later on.
*/
-static GLboolean TAG(validate_render)( GLcontext *ctx,
+static GLboolean TAG(validate_render)( struct gl_context *ctx,
struct vertex_buffer *VB )
{
GLint i;
/**********************************************************************/
-static ELT_TYPE *TAG(emit_elts)( GLcontext *ctx,
+static ELT_TYPE *TAG(emit_elts)( struct gl_context *ctx,
ELT_TYPE *dest,
GLuint *elts, GLuint nr )
{
return dest;
}
-static ELT_TYPE *TAG(emit_consecutive_elts)( GLcontext *ctx,
+static ELT_TYPE *TAG(emit_consecutive_elts)( struct gl_context *ctx,
ELT_TYPE *dest,
GLuint start, GLuint nr )
{
-static void TAG(render_points_verts)( GLcontext *ctx,
+static void TAG(render_points_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void TAG(render_lines_verts)( GLcontext *ctx,
+static void TAG(render_lines_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_line_strip_verts)( GLcontext *ctx,
+static void TAG(render_line_strip_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_line_loop_verts)( GLcontext *ctx,
+static void TAG(render_line_loop_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_triangles_verts)( GLcontext *ctx,
+static void TAG(render_triangles_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
-static void TAG(render_tri_strip_verts)( GLcontext *ctx,
+static void TAG(render_tri_strip_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
EMIT_PRIM( ctx, GL_TRIANGLE_STRIP, HW_TRIANGLE_STRIP_0, start, count );
}
-static void TAG(render_tri_fan_verts)( GLcontext *ctx,
+static void TAG(render_tri_fan_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_poly_verts)( GLcontext *ctx,
+static void TAG(render_poly_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
EMIT_PRIM( ctx, GL_POLYGON, HW_POLYGON, start, count );
}
-static void TAG(render_quad_strip_verts)( GLcontext *ctx,
+static void TAG(render_quad_strip_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_quads_verts)( GLcontext *ctx,
+static void TAG(render_quads_verts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void TAG(render_noop)( GLcontext *ctx,
+static void TAG(render_noop)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
* Render elts using hardware indexed verts *
****************************************************************************/
-static void TAG(render_points_elts)( GLcontext *ctx,
+static void TAG(render_points_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
-static void TAG(render_lines_elts)( GLcontext *ctx,
+static void TAG(render_lines_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_line_strip_elts)( GLcontext *ctx,
+static void TAG(render_line_strip_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_line_loop_elts)( GLcontext *ctx,
+static void TAG(render_line_loop_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_triangles_elts)( GLcontext *ctx,
+static void TAG(render_triangles_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
-static void TAG(render_tri_strip_elts)( GLcontext *ctx,
+static void TAG(render_tri_strip_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void TAG(render_tri_fan_elts)( GLcontext *ctx,
+static void TAG(render_tri_fan_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_poly_elts)( GLcontext *ctx,
+static void TAG(render_poly_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
}
-static void TAG(render_quad_strip_elts)( GLcontext *ctx,
+static void TAG(render_quad_strip_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_quads_elts)( GLcontext *ctx,
+static void TAG(render_quads_elts)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
#define RENDER_TAB_QUALIFIER static
#endif
-static void TAG(render_points)( GLcontext *ctx,
+static void TAG(render_points)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
POSTFIX;
}
-static void TAG(render_lines)( GLcontext *ctx,
+static void TAG(render_lines)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_line_strip)( GLcontext *ctx,
+static void TAG(render_line_strip)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_line_loop)( GLcontext *ctx,
+static void TAG(render_line_loop)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_triangles)( GLcontext *ctx,
+static void TAG(render_triangles)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
-static void TAG(render_tri_strip)( GLcontext *ctx,
+static void TAG(render_tri_strip)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_tri_fan)( GLcontext *ctx,
+static void TAG(render_tri_fan)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
}
-static void TAG(render_poly)( GLcontext *ctx,
+static void TAG(render_poly)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
POSTFIX;
}
-static void TAG(render_quads)( GLcontext *ctx,
+static void TAG(render_quads)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
POSTFIX;
}
-static void TAG(render_quad_strip)( GLcontext *ctx,
+static void TAG(render_quad_strip)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
POSTFIX;
}
-static void TAG(render_noop)( GLcontext *ctx,
+static void TAG(render_noop)( struct gl_context *ctx,
GLuint start,
GLuint count,
GLuint flags )
(void)(ctx && start && count && flags);
}
-RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(GLcontext *,
+RENDER_TAB_QUALIFIER void (*TAG(render_tab)[GL_POLYGON+2])(struct gl_context *,
GLuint,
GLuint,
GLuint) =
#endif
-static void TAG(fast_clipped_poly)( GLcontext *ctx, const GLuint *elts,
+static void TAG(fast_clipped_poly)( struct gl_context *ctx, const GLuint *elts,
GLuint n )
{
LOCAL_VARS
#endif
#if DO_TRI
-static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
+static void TAG(triangle)( struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e2 )
{
struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
VERTEX *v[3];
#if DO_QUAD
#if DO_FULL_QUAD
-static void TAG(quadr)( GLcontext *ctx,
+static void TAG(quadr)( struct gl_context *ctx,
GLuint e0, GLuint e1, GLuint e2, GLuint e3 )
{
struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
}
}
#else
-static void TAG(quadr)( GLcontext *ctx, GLuint e0,
+static void TAG(quadr)( struct gl_context *ctx, GLuint e0,
GLuint e1, GLuint e2, GLuint e3 )
{
if (DO_UNFILLED) {
#endif
#if DO_LINE
-static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 )
+static void TAG(line)( struct gl_context *ctx, GLuint e0, GLuint e1 )
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
VERTEX *v[2];
#endif
#if DO_POINTS
-static void TAG(points)( GLcontext *ctx, GLuint first, GLuint last )
+static void TAG(points)( struct gl_context *ctx, GLuint first, GLuint last )
{
struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
GLuint i;
#define VERT_RESTORE_SPEC( idx )
#endif
-static void TAG(unfilled_tri)( GLcontext *ctx,
+static void TAG(unfilled_tri)( struct gl_context *ctx,
GLenum mode,
GLuint e0, GLuint e1, GLuint e2 )
{
}
-static void TAG(unfilled_quad)( GLcontext *ctx,
+static void TAG(unfilled_quad)( struct gl_context *ctx,
GLenum mode,
GLuint e0, GLuint e1,
GLuint e2, GLuint e3 )
* really convenient to put them. Need to build some actual .o files in
* this directory?
*/
-static void copy_pv_rgba4_spec5( GLcontext *ctx, GLuint edst, GLuint esrc )
+static void copy_pv_rgba4_spec5( struct gl_context *ctx, GLuint edst, GLuint esrc )
{
LOCALVARS
GLubyte *verts = GET_VERTEX_STORE();
dst[5] = src[5];
}
-static void copy_pv_rgba4( GLcontext *ctx, GLuint edst, GLuint esrc )
+static void copy_pv_rgba4( struct gl_context *ctx, GLuint edst, GLuint esrc )
{
LOCALVARS
GLubyte *verts = GET_VERTEX_STORE();
dst[4] = src[4];
}
-static void copy_pv_rgba3( GLcontext *ctx, GLuint edst, GLuint esrc )
+static void copy_pv_rgba3( struct gl_context *ctx, GLuint edst, GLuint esrc )
{
LOCALVARS
GLubyte *verts = GET_VERTEX_STORE();
}
-void TAG(translate_vertex)(GLcontext *ctx,
+void TAG(translate_vertex)(struct gl_context *ctx,
const VERTEX *src,
SWvertex *dst)
{
/* prototype to silence warning */
-void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v );
+void TAG(print_vertex)( struct gl_context *ctx, const VERTEX *v );
-void TAG(print_vertex)( GLcontext *ctx, const VERTEX *v )
+void TAG(print_vertex)( struct gl_context *ctx, const VERTEX *v )
{
LOCALVARS
GLuint format = GET_VERTEX_FORMAT();
#define GET_COLOR(ptr, idx) ((ptr)->data[idx])
-INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx,
+INTERP_QUALIFIER void TAG(interp_extras)( struct gl_context *ctx,
GLfloat t,
GLuint dst, GLuint out, GLuint in,
GLboolean force_boundary )
INTERP_VERTEX(ctx, t, dst, out, in, force_boundary);
}
-INTERP_QUALIFIER void TAG(copy_pv_extras)( GLcontext *ctx,
+INTERP_QUALIFIER void TAG(copy_pv_extras)( struct gl_context *ctx,
GLuint dst, GLuint src )
{
LOCALVARS
#if (HAVE_HW_DIVIDE || DO_SPEC || DO_TEX0 || DO_FOG || !HAVE_TINY_VERTICES)
-static void TAG(emit)( GLcontext *ctx,
+static void TAG(emit)( struct gl_context *ctx,
GLuint start, GLuint end,
void *dest,
GLuint stride )
#error "cannot use tiny vertices with hw perspective divide"
#endif
-static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end,
+static void TAG(emit)( struct gl_context *ctx, GLuint start, GLuint end,
void *dest, GLuint stride )
{
LOCALVARS
#if (HAVE_PTEX_VERTICES)
-static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
+static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx )
{
LOCALVARS
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
return GL_TRUE;
}
#else
-static GLboolean TAG(check_tex_sizes)( GLcontext *ctx )
+static GLboolean TAG(check_tex_sizes)( struct gl_context *ctx )
{
LOCALVARS
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
#endif /* ptex */
-static void TAG(interp)( GLcontext *ctx,
+static void TAG(interp)( struct gl_context *ctx,
GLfloat t,
GLuint edst, GLuint eout, GLuint ein,
GLboolean force_boundary )
-GLboolean _vbo_CreateContext( GLcontext *ctx );
-void _vbo_DestroyContext( GLcontext *ctx );
-void _vbo_InvalidateState( GLcontext *ctx, GLuint new_state );
+GLboolean _vbo_CreateContext( struct gl_context *ctx );
+void _vbo_DestroyContext( struct gl_context *ctx );
+void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state );
-typedef void (*vbo_draw_func)( GLcontext *ctx,
+typedef void (*vbo_draw_func)( struct gl_context *ctx,
const struct gl_client_array **arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
};
-void vbo_split_prims( GLcontext *ctx,
+void vbo_split_prims( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
/* Helpers for dealing translating away non-zero min_index.
*/
GLboolean vbo_all_varyings_in_vbos( const struct gl_client_array *arrays[] );
+GLboolean vbo_any_varyings_in_vbos( const struct gl_client_array *arrays[] );
-void vbo_rebase_prims( GLcontext *ctx,
+void vbo_rebase_prims( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
GLuint max_index,
vbo_draw_func draw );
void
-vbo_get_minmax_index(GLcontext *ctx, const struct _mesa_prim *prim,
+vbo_get_minmax_index(struct gl_context *ctx, const struct _mesa_prim *prim,
const struct _mesa_index_buffer *ib,
GLuint *min_index, GLuint *max_index);
-void vbo_use_buffer_objects(GLcontext *ctx);
+void vbo_use_buffer_objects(struct gl_context *ctx);
-void vbo_set_draw_func(GLcontext *ctx, vbo_draw_func func);
+void vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func);
void GLAPIENTRY
}
-static void init_legacy_currval(GLcontext *ctx)
+static void init_legacy_currval(struct gl_context *ctx)
{
struct vbo_context *vbo = vbo_context(ctx);
struct gl_client_array *arrays = vbo->legacy_currval;
}
-static void init_generic_currval(GLcontext *ctx)
+static void init_generic_currval(struct gl_context *ctx)
{
struct vbo_context *vbo = vbo_context(ctx);
struct gl_client_array *arrays = vbo->generic_currval;
}
-static void init_mat_currval(GLcontext *ctx)
+static void init_mat_currval(struct gl_context *ctx)
{
struct vbo_context *vbo = vbo_context(ctx);
struct gl_client_array *arrays = vbo->mat_currval;
}
-GLboolean _vbo_CreateContext( GLcontext *ctx )
+GLboolean _vbo_CreateContext( struct gl_context *ctx )
{
struct vbo_context *vbo = CALLOC_STRUCT(vbo_context);
}
-void _vbo_InvalidateState( GLcontext *ctx, GLuint new_state )
+void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state )
{
_ae_invalidate_state(ctx, new_state);
vbo_exec_invalidate_state(ctx, new_state);
}
-void _vbo_DestroyContext( GLcontext *ctx )
+void _vbo_DestroyContext( struct gl_context *ctx )
{
struct vbo_context *vbo = vbo_context(ctx);
}
-void vbo_set_draw_func(GLcontext *ctx, vbo_draw_func func)
+void vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func)
{
struct vbo_context *vbo = vbo_context(ctx);
vbo->draw_prims = func;
};
-static INLINE struct vbo_context *vbo_context(GLcontext *ctx)
+static INLINE struct vbo_context *vbo_context(struct gl_context *ctx)
{
return (struct vbo_context *)(ctx->swtnl_im);
}
* vertex transformation, an NV vertex program or ARB vertex program/shader.
*/
static INLINE enum vp_mode
-get_program_mode( GLcontext *ctx )
+get_program_mode( struct gl_context *ctx )
{
if (!ctx->VertexProgram._Current)
return VP_NONE;
-void vbo_exec_init( GLcontext *ctx )
+void vbo_exec_init( struct gl_context *ctx )
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
}
-void vbo_exec_destroy( GLcontext *ctx )
+void vbo_exec_destroy( struct gl_context *ctx )
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
* invoked according to the state flags. That will have to wait for a
* mesa rework:
*/
-void vbo_exec_invalidate_state( GLcontext *ctx, GLuint new_state )
+void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state )
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
struct vbo_exec_context
{
- GLcontext *ctx;
+ struct gl_context *ctx;
GLvertexformat vtxfmt;
struct {
/* External API:
*/
-void vbo_exec_init( GLcontext *ctx );
-void vbo_exec_destroy( GLcontext *ctx );
-void vbo_exec_invalidate_state( GLcontext *ctx, GLuint new_state );
-void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap );
+void vbo_exec_init( struct gl_context *ctx );
+void vbo_exec_destroy( struct gl_context *ctx );
+void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state );
+void vbo_exec_FlushVertices_internal( struct gl_context *ctx, GLboolean unmap );
-void vbo_exec_BeginVertices( GLcontext *ctx );
-void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags );
+void vbo_exec_BeginVertices( struct gl_context *ctx );
+void vbo_exec_FlushVertices( struct gl_context *ctx, GLuint flags );
/* Internal functions:
*/
static void vbo_exec_copy_to_current( struct vbo_exec_context *exec )
{
- GLcontext *ctx = exec->ctx;
+ struct gl_context *ctx = exec->ctx;
struct vbo_context *vbo = vbo_context(ctx);
GLuint i;
static void vbo_exec_copy_from_current( struct vbo_exec_context *exec )
{
- GLcontext *ctx = exec->ctx;
+ struct gl_context *ctx = exec->ctx;
struct vbo_context *vbo = vbo_context(ctx);
GLint i;
GLuint attr,
GLuint newsz )
{
- GLcontext *ctx = exec->ctx;
+ struct gl_context *ctx = exec->ctx;
struct vbo_context *vbo = vbo_context(ctx);
GLint lastcount = exec->vtx.vert_count;
GLfloat *tmp;
}
-static void vbo_exec_fixup_vertex( GLcontext *ctx,
+static void vbo_exec_fixup_vertex( struct gl_context *ctx,
GLuint attr, GLuint sz )
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
#define ATTR( A, N, V0, V1, V2, V3 ) \
do { \
struct vbo_exec_context *exec = &vbo_context(ctx)->exec; \
- \
- if (exec->vtx.active_sz[A] != N) \
- vbo_exec_fixup_vertex(ctx, A, N); \
- \
+ \
+ if (unlikely(!(exec->ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT))) \
+ ctx->Driver.BeginVertices( ctx ); \
+ if (unlikely(exec->vtx.active_sz[A] != N)) \
+ vbo_exec_fixup_vertex(ctx, A, N); \
+ \
{ \
GLfloat *dest = exec->vtx.attrptr[A]; \
if (N>0) dest[0] = V0; \
* This replaces the malloced buffer which was created in
* vb_exec_vtx_init() below.
*/
-void vbo_use_buffer_objects(GLcontext *ctx)
+void vbo_use_buffer_objects(struct gl_context *ctx)
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
/* Any buffer name but 0 can be used here since this bufferobj won't
void vbo_exec_vtx_init( struct vbo_exec_context *exec )
{
- GLcontext *ctx = exec->ctx;
+ struct gl_context *ctx = exec->ctx;
struct vbo_context *vbo = vbo_context(ctx);
GLuint i;
void vbo_exec_vtx_destroy( struct vbo_exec_context *exec )
{
/* using a real VBO for vertex data */
- GLcontext *ctx = exec->ctx;
+ struct gl_context *ctx = exec->ctx;
unsigned i;
/* True VBOs should already be unmapped
_mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL);
}
-void vbo_exec_BeginVertices( GLcontext *ctx )
+void vbo_exec_BeginVertices( struct gl_context *ctx )
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
if (0) printf("%s\n", __FUNCTION__);
exec->ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT;
}
-void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap )
+void vbo_exec_FlushVertices_internal( struct gl_context *ctx, GLboolean unmap )
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
/**
* \param flags bitmask of FLUSH_STORED_VERTICES, FLUSH_UPDATE_CURRENT
*/
-void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags )
+void vbo_exec_FlushVertices( struct gl_context *ctx, GLuint flags )
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
/* Need to do this to ensure BeginVertices gets called again:
*/
- if (exec->ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) {
- _mesa_restore_exec_vtxfmt( ctx );
+ if (exec->ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT)
exec->ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT;
- }
exec->ctx->Driver.NeedFlush &= ~flags;
* glDraw[Range]Elements() calls.
*/
void
-vbo_get_minmax_index(GLcontext *ctx,
+vbo_get_minmax_index(struct gl_context *ctx,
const struct _mesa_prim *prim,
const struct _mesa_index_buffer *ib,
GLuint *min_index, GLuint *max_index)
* For debugging purposes; not normally used.
*/
static void
-check_array_data(GLcontext *ctx, struct gl_client_array *array,
+check_array_data(struct gl_context *ctx, struct gl_client_array *array,
GLuint attrib, GLuint j)
{
if (array->Enabled) {
* Unmap the buffer object referenced by given array, if mapped.
*/
static void
-unmap_array_buffer(GLcontext *ctx, struct gl_client_array *array)
+unmap_array_buffer(struct gl_context *ctx, struct gl_client_array *array)
{
if (array->Enabled &&
_mesa_is_bufferobj(array->BufferObj) &&
* For debug purposes; not normally used.
*/
static void
-check_draw_elements_data(GLcontext *ctx, GLsizei count, GLenum elemType,
+check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
const void *elements, GLint basevertex)
{
struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
* Check array data, looking for NaNs, etc.
*/
static void
-check_draw_arrays_data(GLcontext *ctx, GLint start, GLsizei count)
+check_draw_arrays_data(struct gl_context *ctx, GLint start, GLsizei count)
{
/* TO DO */
}
* Print info/data for glDrawArrays(), for debugging.
*/
static void
-print_draw_arrays(GLcontext *ctx, struct vbo_exec_context *exec,
+print_draw_arrays(struct gl_context *ctx, struct vbo_exec_context *exec,
GLenum mode, GLint start, GLsizei count)
{
int i;
* Just translate the arrayobj into a sane layout.
*/
static void
-bind_array_obj(GLcontext *ctx)
+bind_array_obj(struct gl_context *ctx)
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
* to point at a zero-stride current value "array".
*/
static void
-recalculate_input_bindings(GLcontext *ctx)
+recalculate_input_bindings(struct gl_context *ctx)
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
* must be done after this call.
*/
static void
-bind_arrays(GLcontext *ctx)
+bind_arrays(struct gl_context *ctx)
{
bind_array_obj(ctx);
recalculate_input_bindings(ctx);
* For debugging.
*/
static void
-dump_element_buffer(GLcontext *ctx, GLenum type)
+dump_element_buffer(struct gl_context *ctx, GLenum type)
{
const GLvoid *map = ctx->Driver.MapBuffer(ctx,
GL_ELEMENT_ARRAY_BUFFER_ARB,
* we've validated buffer bounds, etc.
*/
static void
-vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode,
+vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
GLboolean index_bounds_valid,
GLuint start, GLuint end,
GLsizei count, GLenum type,
* This does the actual rendering after we've checked array indexes, etc.
*/
static void
-vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode,
+vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
const GLsizei *count, GLenum type,
const GLvoid **indices, GLsizei primcount,
const GLint *basevertex)
/* TODO: populate these as the vertex is defined:
*/
static void
-vbo_exec_bind_arrays( GLcontext *ctx )
+vbo_exec_bind_arrays( struct gl_context *ctx )
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_exec_context *exec = &vbo->exec;
GLenum target = GL_ARRAY_BUFFER_ARB;
if (_mesa_is_bufferobj(exec->vtx.bufferobj)) {
- GLcontext *ctx = exec->ctx;
+ struct gl_context *ctx = exec->ctx;
if (ctx->Driver.FlushMappedBufferRange) {
GLintptr offset = exec->vtx.buffer_used - exec->vtx.bufferobj->Offset;
void
vbo_exec_vtx_map( struct vbo_exec_context *exec )
{
- GLcontext *ctx = exec->ctx;
+ struct gl_context *ctx = exec->ctx;
const GLenum target = GL_ARRAY_BUFFER_ARB;
const GLenum access = GL_READ_WRITE_ARB; /* for MapBuffer */
const GLenum accessRange = GL_MAP_WRITE_BIT | /* for MapBufferRange */
exec->vtx.copied.nr = vbo_copy_vertices( exec );
if (exec->vtx.copied.nr != exec->vtx.vert_count) {
- GLcontext *ctx = exec->ctx;
+ struct gl_context *ctx = exec->ctx;
/* Before the update_state() as this may raise _NEW_ARRAY
* from _mesa_set_varying_vp_inputs().
void vbo_exec_eval_update( struct vbo_exec_context *exec )
{
- GLcontext *ctx = exec->ctx;
+ struct gl_context *ctx = exec->ctx;
GLuint attr;
/* Vertex program maps have priority over conventional attribs */
return GL_TRUE;
}
+GLboolean vbo_any_varyings_in_vbos( const struct gl_client_array *arrays[] )
+{
+ GLuint i;
+
+ for (i = 0; i < VERT_ATTRIB_MAX; i++)
+ if (arrays[i]->StrideB &&
+ arrays[i]->BufferObj->Name != 0)
+ return GL_TRUE;
+
+ return GL_FALSE;
+}
+
/* Adjust primitives, indices and vertex definitions so that min_index
* becomes zero. There are lots of reasons for wanting to do this, eg:
*
* - can't save time by trying to upload half a vbo - typically it is
* all or nothing.
*/
-void vbo_rebase_prims( GLcontext *ctx,
+void vbo_rebase_prims( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
#if FEATURE_dlist
-static void vbo_save_callback_init( GLcontext *ctx )
+static void vbo_save_callback_init( struct gl_context *ctx )
{
ctx->Driver.NewList = vbo_save_NewList;
ctx->Driver.EndList = vbo_save_EndList;
-void vbo_save_init( GLcontext *ctx )
+void vbo_save_init( struct gl_context *ctx )
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_save_context *save = &vbo->save;
}
-void vbo_save_destroy( GLcontext *ctx )
+void vbo_save_destroy( struct gl_context *ctx )
{
struct vbo_context *vbo = vbo_context(ctx);
struct vbo_save_context *save = &vbo->save;
/* Note that this can occur during the playback of a display list:
*/
-void vbo_save_fallback( GLcontext *ctx, GLboolean fallback )
+void vbo_save_fallback( struct gl_context *ctx, GLboolean fallback )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
struct vbo_save_context {
- GLcontext *ctx;
+ struct gl_context *ctx;
GLvertexformat vtxfmt;
struct gl_client_array arrays[VBO_ATTRIB_MAX];
const struct gl_client_array *inputs[VBO_ATTRIB_MAX];
#if FEATURE_dlist
-void vbo_save_init( GLcontext *ctx );
-void vbo_save_destroy( GLcontext *ctx );
-void vbo_save_fallback( GLcontext *ctx, GLboolean fallback );
+void vbo_save_init( struct gl_context *ctx );
+void vbo_save_destroy( struct gl_context *ctx );
+void vbo_save_fallback( struct gl_context *ctx, GLboolean fallback );
/* save_loopback.c:
*/
-void vbo_loopback_vertex_list( GLcontext *ctx,
+void vbo_loopback_vertex_list( struct gl_context *ctx,
const GLfloat *buffer,
const GLubyte *attrsz,
const struct _mesa_prim *prim,
/* Callbacks:
*/
-void vbo_save_EndList( GLcontext *ctx );
-void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode );
-void vbo_save_EndCallList( GLcontext *ctx );
-void vbo_save_BeginCallList( GLcontext *ctx, struct gl_display_list *list );
-void vbo_save_SaveFlushVertices( GLcontext *ctx );
-GLboolean vbo_save_NotifyBegin( GLcontext *ctx, GLenum mode );
+void vbo_save_EndList( struct gl_context *ctx );
+void vbo_save_NewList( struct gl_context *ctx, GLuint list, GLenum mode );
+void vbo_save_EndCallList( struct gl_context *ctx );
+void vbo_save_BeginCallList( struct gl_context *ctx, struct gl_display_list *list );
+void vbo_save_SaveFlushVertices( struct gl_context *ctx );
+GLboolean vbo_save_NotifyBegin( struct gl_context *ctx, GLenum mode );
-void vbo_save_playback_vertex_list( GLcontext *ctx, void *data );
+void vbo_save_playback_vertex_list( struct gl_context *ctx, void *data );
void vbo_save_api_init( struct vbo_save_context *save );
#else /* FEATURE_dlist */
static INLINE void
-vbo_save_init( GLcontext *ctx )
+vbo_save_init( struct gl_context *ctx )
{
}
static INLINE void
-vbo_save_destroy( GLcontext *ctx )
+vbo_save_destroy( struct gl_context *ctx )
{
}
* NOTE: Old 'parity' issue is gone, but copying can still be
* wrong-footed on replay.
*/
-static GLuint _save_copy_vertices( GLcontext *ctx,
+static GLuint _save_copy_vertices( struct gl_context *ctx,
const struct vbo_save_vertex_list *node,
const GLfloat *src_buffer)
{
}
-static struct vbo_save_vertex_store *alloc_vertex_store( GLcontext *ctx )
+static struct vbo_save_vertex_store *alloc_vertex_store( struct gl_context *ctx )
{
struct vbo_save_vertex_store *vertex_store = CALLOC_STRUCT(vbo_save_vertex_store);
return vertex_store;
}
-static void free_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *vertex_store )
+static void free_vertex_store( struct gl_context *ctx, struct vbo_save_vertex_store *vertex_store )
{
assert(!vertex_store->buffer);
FREE( vertex_store );
}
-static GLfloat *map_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *vertex_store )
+static GLfloat *map_vertex_store( struct gl_context *ctx, struct vbo_save_vertex_store *vertex_store )
{
assert(vertex_store->bufferobj);
assert(!vertex_store->buffer);
return vertex_store->buffer + vertex_store->used;
}
-static void unmap_vertex_store( GLcontext *ctx, struct vbo_save_vertex_store *vertex_store )
+static void unmap_vertex_store( struct gl_context *ctx, struct vbo_save_vertex_store *vertex_store )
{
ctx->Driver.UnmapBuffer( ctx, GL_ARRAY_BUFFER_ARB, vertex_store->bufferobj );
vertex_store->buffer = NULL;
}
-static struct vbo_save_primitive_store *alloc_prim_store( GLcontext *ctx )
+static struct vbo_save_primitive_store *alloc_prim_store( struct gl_context *ctx )
{
struct vbo_save_primitive_store *store = CALLOC_STRUCT(vbo_save_primitive_store);
(void) ctx;
return store;
}
-static void _save_reset_counters( GLcontext *ctx )
+static void _save_reset_counters( struct gl_context *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
/* Insert the active immediate struct onto the display list currently
* being built.
*/
-static void _save_compile_vertex_list( GLcontext *ctx )
+static void _save_compile_vertex_list( struct gl_context *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
struct vbo_save_vertex_list *node;
/* TODO -- If no new vertices have been stored, don't bother saving
* it.
*/
-static void _save_wrap_buffers( GLcontext *ctx )
+static void _save_wrap_buffers( struct gl_context *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLint i = save->prim_count - 1;
/* Called only when buffers are wrapped as the result of filling the
* vertex_store struct.
*/
-static void _save_wrap_filled_vertex( GLcontext *ctx )
+static void _save_wrap_filled_vertex( struct gl_context *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLfloat *data = save->copied.buffer;
}
-static void _save_copy_to_current( GLcontext *ctx )
+static void _save_copy_to_current( struct gl_context *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLuint i;
}
-static void _save_copy_from_current( GLcontext *ctx )
+static void _save_copy_from_current( struct gl_context *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLint i;
/* Flush existing data, set new attrib size, replay copied vertices.
*/
-static void _save_upgrade_vertex( GLcontext *ctx,
+static void _save_upgrade_vertex( struct gl_context *ctx,
GLuint attr,
GLuint newsz )
{
}
}
-static void save_fixup_vertex( GLcontext *ctx, GLuint attr, GLuint sz )
+static void save_fixup_vertex( struct gl_context *ctx, GLuint attr, GLuint sz )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
save->active_sz[attr] = sz;
}
-static void _save_reset_vertex( GLcontext *ctx )
+static void _save_reset_vertex( struct gl_context *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLuint i;
* -- Flush current buffer
* -- Fallback to opcodes for the rest of the begin/end object.
*/
-static void DO_FALLBACK( GLcontext *ctx )
+static void DO_FALLBACK( struct gl_context *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
/* This begin is hooked into ... Updating of
* ctx->Driver.CurrentSavePrimitive is already taken care of.
*/
-GLboolean vbo_save_NotifyBegin( GLcontext *ctx, GLenum mode )
+GLboolean vbo_save_NotifyBegin( struct gl_context *ctx, GLenum mode )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
-static void _save_vtxfmt_init( GLcontext *ctx )
+static void _save_vtxfmt_init( struct gl_context *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLvertexformat *vfmt = &save->vtxfmt;
}
-void vbo_save_SaveFlushVertices( GLcontext *ctx )
+void vbo_save_SaveFlushVertices( struct gl_context *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
ctx->Driver.SaveNeedFlush = 0;
}
-void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode )
+void vbo_save_NewList( struct gl_context *ctx, GLuint list, GLenum mode )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
ctx->Driver.SaveNeedFlush = 0;
}
-void vbo_save_EndList( GLcontext *ctx )
+void vbo_save_EndList( struct gl_context *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
assert(save->vertex_size == 0);
}
-void vbo_save_BeginCallList( GLcontext *ctx, struct gl_display_list *dlist )
+void vbo_save_BeginCallList( struct gl_context *ctx, struct gl_display_list *dlist )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
save->replay_flags |= dlist->Flags;
}
-void vbo_save_EndCallList( GLcontext *ctx )
+void vbo_save_EndCallList( struct gl_context *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
}
-static void vbo_destroy_vertex_list( GLcontext *ctx, void *data )
+static void vbo_destroy_vertex_list( struct gl_context *ctx, void *data )
{
struct vbo_save_vertex_list *node = (struct vbo_save_vertex_list *)data;
(void) ctx;
}
-static void vbo_print_vertex_list( GLcontext *ctx, void *data )
+static void vbo_print_vertex_list( struct gl_context *ctx, void *data )
{
struct vbo_save_vertex_list *node = (struct vbo_save_vertex_list *)data;
GLuint i;
}
-static void _save_current_init( GLcontext *ctx )
+static void _save_current_init( struct gl_context *ctx )
{
struct vbo_save_context *save = &vbo_context(ctx)->save;
GLint i;
*/
void vbo_save_api_init( struct vbo_save_context *save )
{
- GLcontext *ctx = save->ctx;
+ struct gl_context *ctx = save->ctx;
GLuint i;
save->opcode_vertex_list =
* last vertex to the saved state
*/
static void
-_playback_copy_to_current(GLcontext *ctx,
+_playback_copy_to_current(struct gl_context *ctx,
const struct vbo_save_vertex_list *node)
{
struct vbo_context *vbo = vbo_context(ctx);
* Treat the vertex storage as a VBO, define vertex arrays pointing
* into it:
*/
-static void vbo_bind_vertex_list(GLcontext *ctx,
+static void vbo_bind_vertex_list(struct gl_context *ctx,
const struct vbo_save_vertex_list *node)
{
struct vbo_context *vbo = vbo_context(ctx);
static void
-vbo_save_loopback_vertex_list(GLcontext *ctx,
+vbo_save_loopback_vertex_list(struct gl_context *ctx,
const struct vbo_save_vertex_list *list)
{
const char *buffer = ctx->Driver.MapBuffer(ctx,
* a drawing command.
*/
void
-vbo_save_playback_vertex_list(GLcontext *ctx, void *data)
+vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
{
const struct vbo_save_vertex_list *node =
(const struct vbo_save_vertex_list *) data;
#if FEATURE_dlist
-typedef void (*attr_func)( GLcontext *ctx, GLint target, const GLfloat * );
+typedef void (*attr_func)( struct gl_context *ctx, GLint target, const GLfloat * );
/* This file makes heavy use of the aliasing of NV vertex attributes
* with the legacy attributes, and also with ARB and Material
* attributes as currently implemented.
*/
-static void VertexAttrib1fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
+static void VertexAttrib1fvNV(struct gl_context *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib1fvNV(ctx->Exec, (target, v));
}
-static void VertexAttrib2fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
+static void VertexAttrib2fvNV(struct gl_context *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib2fvNV(ctx->Exec, (target, v));
}
-static void VertexAttrib3fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
+static void VertexAttrib3fvNV(struct gl_context *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib3fvNV(ctx->Exec, (target, v));
}
-static void VertexAttrib4fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
+static void VertexAttrib4fvNV(struct gl_context *ctx, GLint target, const GLfloat *v)
{
CALL_VertexAttrib4fvNV(ctx->Exec, (target, v));
}
* wrapped vertices. If we get here, it's probably because the
* precalculated wrapping is wrong.
*/
-static void loopback_prim( GLcontext *ctx,
+static void loopback_prim( struct gl_context *ctx,
const GLfloat *buffer,
const struct _mesa_prim *prim,
GLuint wrap_count,
* normally, otherwise need to track and discard the generated
* primitives.
*/
-static void loopback_weak_prim( GLcontext *ctx,
+static void loopback_weak_prim( struct gl_context *ctx,
const struct _mesa_prim *prim )
{
/* Use the prim_weak flag to ensure that if this primitive
}
-void vbo_loopback_vertex_list( GLcontext *ctx,
+void vbo_loopback_vertex_list( struct gl_context *ctx,
const GLfloat *buffer,
const GLubyte *attrsz,
const struct _mesa_prim *prim,
-void vbo_split_prims( GLcontext *ctx,
+void vbo_split_prims( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
*/
GLboolean split_prim_inplace(GLenum mode, GLuint *first, GLuint *incr);
-void vbo_split_inplace( GLcontext *ctx,
+void vbo_split_inplace( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
/* Requires ib != NULL:
*/
-void vbo_split_copy( GLcontext *ctx,
+void vbo_split_copy( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
*/
struct copy_context {
- GLcontext *ctx;
+ struct gl_context *ctx;
const struct gl_client_array **array;
const struct _mesa_prim *prim;
GLuint nr_prims;
* Dump the parameters/info for a vbo->draw() call.
*/
static void
-dump_draw_info(GLcontext *ctx,
+dump_draw_info(struct gl_context *ctx,
const struct gl_client_array **arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
static void
replay_init( struct copy_context *copy )
{
- GLcontext *ctx = copy->ctx;
+ struct gl_context *ctx = copy->ctx;
GLuint i;
GLuint offset;
const GLvoid *srcptr;
static void
replay_finish( struct copy_context *copy )
{
- GLcontext *ctx = copy->ctx;
+ struct gl_context *ctx = copy->ctx;
GLuint i;
/* Free our vertex and index buffers:
/**
* Split VBO into smaller pieces, draw the pieces.
*/
-void vbo_split_copy( GLcontext *ctx,
+void vbo_split_copy( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
* that.
*/
struct split_context {
- GLcontext *ctx;
+ struct gl_context *ctx;
const struct gl_client_array **array;
const struct _mesa_prim *prim;
GLuint nr_prims;
}
-void vbo_split_inplace( GLcontext *ctx,
+void vbo_split_inplace( struct gl_context *ctx,
const struct gl_client_array *arrays[],
const struct _mesa_prim *prim,
GLuint nr_prims,
printf( "\n" );
- /* GLcontext offsets:
+ /* struct gl_context offsets:
*/
- OFFSET_HEADER( "GLcontext" );
+ OFFSET_HEADER( "struct gl_context" );
- OFFSET( "CTX_DRIVER_CTX ", GLcontext, DriverCtx );
+ OFFSET( "CTX_DRIVER_CTX ", struct gl_context, DriverCtx );
printf( "\n" );
- OFFSET( "CTX_LIGHT_ENABLED ", GLcontext, Light.Enabled );
- OFFSET( "CTX_LIGHT_SHADE_MODEL ", GLcontext, Light.ShadeModel );
- OFFSET( "CTX_LIGHT_COLOR_MAT_FACE ", GLcontext, Light.ColorMaterialFace );
- OFFSET( "CTX_LIGHT_COLOR_MAT_MODE ", GLcontext, Light.ColorMaterialMode );
- OFFSET( "CTX_LIGHT_COLOR_MAT_MASK ", GLcontext, Light.ColorMaterialBitmask );
- OFFSET( "CTX_LIGHT_COLOR_MAT_ENABLED ", GLcontext, Light.ColorMaterialEnabled );
- OFFSET( "CTX_LIGHT_ENABLED_LIST ", GLcontext, Light.EnabledList );
- OFFSET( "CTX_LIGHT_NEED_VERTS ", GLcontext, Light._NeedVertices );
- OFFSET( "CTX_LIGHT_FLAGS ", GLcontext, Light._Flags );
- OFFSET( "CTX_LIGHT_BASE_COLOR ", GLcontext, Light._BaseColor );
+ OFFSET( "CTX_LIGHT_ENABLED ", struct gl_context, Light.Enabled );
+ OFFSET( "CTX_LIGHT_SHADE_MODEL ", struct gl_context, Light.ShadeModel );
+ OFFSET( "CTX_LIGHT_COLOR_MAT_FACE ", struct gl_context, Light.ColorMaterialFace );
+ OFFSET( "CTX_LIGHT_COLOR_MAT_MODE ", struct gl_context, Light.ColorMaterialMode );
+ OFFSET( "CTX_LIGHT_COLOR_MAT_MASK ", struct gl_context, Light.ColorMaterialBitmask );
+ OFFSET( "CTX_LIGHT_COLOR_MAT_ENABLED ", struct gl_context, Light.ColorMaterialEnabled );
+ OFFSET( "CTX_LIGHT_ENABLED_LIST ", struct gl_context, Light.EnabledList );
+ OFFSET( "CTX_LIGHT_NEED_VERTS ", struct gl_context, Light._NeedVertices );
+ OFFSET( "CTX_LIGHT_FLAGS ", struct gl_context, Light._Flags );
+ OFFSET( "CTX_LIGHT_BASE_COLOR ", struct gl_context, Light._BaseColor );
/* struct vertex_buffer offsets:
#include "main/mtypes.h"
extern void _ASMAPI
-_mesa_mmx_blend_transparency( GLcontext *ctx, GLuint n, const GLubyte mask[],
+_mesa_mmx_blend_transparency( struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *rgba, const GLvoid *dest,
GLenum chanType );
extern void _ASMAPI
-_mesa_mmx_blend_add( GLcontext *ctx, GLuint n, const GLubyte mask[],
+_mesa_mmx_blend_add( struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *rgba, const GLvoid *dest,
GLenum chanType );
extern void _ASMAPI
-_mesa_mmx_blend_min( GLcontext *ctx, GLuint n, const GLubyte mask[],
+_mesa_mmx_blend_min( struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *rgba, const GLvoid *dest,
GLenum chanType );
extern void _ASMAPI
-_mesa_mmx_blend_max( GLcontext *ctx, GLuint n, const GLubyte mask[],
+_mesa_mmx_blend_max( struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *rgba, const GLvoid *dest,
GLenum chanType );
extern void _ASMAPI
-_mesa_mmx_blend_modulate( GLcontext *ctx, GLuint n, const GLubyte mask[],
+_mesa_mmx_blend_modulate( struct gl_context *ctx, GLuint n, const GLubyte mask[],
GLvoid *rgba, const GLvoid *dest,
GLenum chanType );
/*
- * void _mesa_mmx_blend( GLcontext *ctx,
+ * void _mesa_mmx_blend( struct gl_context *ctx,
* GLuint n,
* const GLubyte mask[],
* GLchan rgba[][4],