Re: [Mesa-dev] [PATCH 1/2] mesa: Don't report types for 0-sized components of textures.
On 11/18/2011 07:10 PM, Eric Anholt wrote: The GL_TEXTURE_WHATEVER_SIZE entrypoints were checking if the specified base type of the texture allowed that channel to be present before reporting the size of the channel, so that GL_RGB didn't end up with an alpha size if the hardware driver had to store it that way. The GL_TEXTURE_WHATEVER_TYPE entrypoints weren't checking it, so you would end up with strange responses from the GL involving 0-bit floating-point alpha components in GL_RGB32F, even though it says GL_NONE as expected for other 0-sized channels. Make _TYPE check _BaseFormat the same as _SIZE, which results in fixing most of the GL_RGB* testcases of gl-3.0-required-sized-formats pass on i965. --- src/mesa/main/texparam.c | 115 ++ 1 files changed, 65 insertions(+), 50 deletions(-) diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 17eac5f..89a8fbb 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -884,6 +884,66 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params) } +static GLboolean +base_format_has_channel(GLenum base_format, GLenum pname) +{ + switch (pname) { + case GL_TEXTURE_RED_SIZE: + case GL_TEXTURE_RED_TYPE: + if (base_format == GL_RED || + base_format == GL_RG || + base_format == GL_RGB || + base_format == GL_RGBA) { +return GL_TRUE; + } + return GL_FALSE; + case GL_TEXTURE_GREEN_SIZE: + case GL_TEXTURE_GREEN_TYPE: + if (base_format == GL_RG || + base_format == GL_RGB || + base_format == GL_RGBA) { +return GL_TRUE; + } + return GL_FALSE; + case GL_TEXTURE_BLUE_SIZE: + case GL_TEXTURE_BLUE_TYPE: + if (base_format == GL_RGB || + base_format == GL_RGBA) { +return GL_TRUE; + } + return GL_FALSE; + case GL_TEXTURE_ALPHA_SIZE: + case GL_TEXTURE_ALPHA_TYPE: + if (base_format == GL_RGBA || + base_format == GL_ALPHA || + base_format == GL_LUMINANCE_ALPHA) { +return GL_TRUE; + } + return GL_FALSE; + case GL_TEXTURE_LUMINANCE_SIZE: + case GL_TEXTURE_LUMINANCE_TYPE: + if (base_format == GL_LUMINANCE || + base_format == GL_LUMINANCE_ALPHA) { +return GL_TRUE; + } + return GL_FALSE; + case GL_TEXTURE_INTENSITY_SIZE: + case GL_TEXTURE_INTENSITY_TYPE: + if (base_format == GL_INTENSITY) { +return GL_TRUE; + } + return GL_FALSE; + case GL_TEXTURE_DEPTH_SIZE: + case GL_TEXTURE_DEPTH_TYPE: + if (base_format == GL_DEPTH_STENCIL || + base_format == GL_DEPTH_COMPONENT) { +return GL_TRUE; + } + return GL_FALSE; Maybe add a default case with _mesa_warning() to catch unexpected cases in the future? + } + + return GL_FALSE; +} void GLAPIENTRY @@ -981,27 +1041,10 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *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); - else -*params = 0; - break; case GL_TEXTURE_ALPHA_SIZE: - if (img->_BaseFormat == GL_ALPHA || - img->_BaseFormat == GL_LUMINANCE_ALPHA || - img->_BaseFormat == GL_RGBA) + if (base_format_has_channel(img->_BaseFormat, pname)) *params = _mesa_get_format_bits(texFormat, pname); else *params = 0; @@ -1067,46 +1110,18 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, /* GL_ARB_texture_float */ case GL_TEXTURE_RED_TYPE_ARB: - if (!ctx->Extensions.ARB_texture_float) -goto invalid_pname; - *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE) ? -_mesa_get_format_datatype(texFormat) : GL_NONE; - break; case GL_TEXTURE_GREEN_TYPE_ARB: - if (!ctx->Extensions.ARB_texture_float) -goto invalid_pname; - *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE) ? -_mesa_get_format_datatype(texFormat) : GL_NONE; - break; case GL_TEXTURE_BLUE_TYPE_ARB: - if (!ctx->Extensions.ARB_texture_float) -goto invalid_pname; - *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE) ? -_mesa_get_format_datatype(texFormat) : GL_NONE; - break; case GL_TEXTURE_ALPHA_TYPE_ARB: -
Re: [Mesa-dev] [PATCH 2/2] mesa: Make formats.c "datatype" values match glGetTexLevelParameter return.
On 11/18/2011 07:10 PM, Eric Anholt wrote: The formats.c code's "datatype" value is "what does this value mean", i.e. unorm or snorm or float, and is the return value from the GL_TEXTURE_RED_TYPE class of queries. The depth formats were marked as GL_UNSIGNED_INT, which is what we use for integer, and not what we should be returning from the glGetTexLevelParameter. In texstore, we were inappropriately using it as an argument to _mesa_unpack_depth_span() that was expecting a value like GL_UNSIGNED_INT or GL_UNSIGNED_SHORT. Just hardcode _mesa_unpack_depth_span()'s arguments for now, though it looks like the consumers of that interface would be happier with using MESA_FORMAT. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/2] Patches to try to fix draw-pixel-with-textures in swrast
On Sat, Nov 19, 2011 at 1:02 AM, Brian Paul wrote: > On 11/18/2011 12:38 AM, Yuanhan Liu wrote: >> >> The two patches tries to fix an issue that happened while calling >> glDrawPixels >> with texture enabled. >> >> Here I attached a piglit testcase for this issue. > > Can you resend? I can't detach the attachment and when I save the msg to a > text file it's all on one line. > Ah, sorry, my fault. Actually, I didn't attach it but put the patch inline this email. -- regards Yuanhan Liu ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/2] Patches to try to fix draw-pixel-with-textures in swrast
On Sat, Nov 19, 2011 at 3:25 AM, Eric Anholt wrote: > On Fri, 18 Nov 2011 15:38:46 +0800, Yuanhan Liu > wrote: >> >> + glDrawPixels(20, 20, GL_RGBA, GL_FLOAT, pixels); >> + >> + /* Here just sample a small set of pixels */ >> + pass &= piglit_probe_pixel_rgba(5, 5, expected); >> + pass &= piglit_probe_pixel_rgba(7, 12, expected); >> + pass &= piglit_probe_pixel_rgba(10, 10, expected); >> + pass &= piglit_probe_pixel_rgba(18, 18, expected); > > there's piglit_probe_rect_rgba() available instead of picking some > arbitrary subset of pixels. Oh, I didn't noticed that helper function. Thanks for the hint. Will fix it next week. -- regards Yuanhan Liu ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] swrast: fix unmatched span->array->ChanType
On Sat, Nov 19, 2011 at 12:49 AM, Brian Paul wrote: > On 11/18/2011 12:38 AM, Yuanhan Liu wrote: >> >> texture_combine converts the result rgba to CHAN_TYPE from FLOAT. At the >> same time, make sure the span->array->ChanType is changed, too. >> >> Signed-off-by: Yuanhan Liu >> --- >> src/mesa/swrast/s_texcombine.c | 5 + >> 1 files changed, 5 insertions(+), 0 deletions(-) >> >> diff --git a/src/mesa/swrast/s_texcombine.c >> b/src/mesa/swrast/s_texcombine.c >> index 0686acd..9f9b7fb 100644 >> --- a/src/mesa/swrast/s_texcombine.c >> +++ b/src/mesa/swrast/s_texcombine.c >> @@ -545,6 +545,11 @@ texture_combine( struct gl_context *ctx, GLuint unit, >> UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][BCOMP], rgba[i][BCOMP]); >> UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][ACOMP], rgba[i][ACOMP]); >> } >> + /* >> + * span->array->rgba is coverted to CHAN type by force, so it's a >> + * need to make sure the span->array->ChanType is converted, too. >> + */ > > Maybe rewrite that comment as: > > /* The span->array->rgba values are of CHAN type so set > * span->array->ChanType field accordingly. > */ Yeah, a nicer one. Will change it next week. Thanks. -- regards Yuanhan Liu ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/6] glsl: finish up ARB_conservative_depth
On Fri, Nov 18, 2011 at 9:44 PM, Ian Romanick wrote: > On 11/18/2011 11:27 AM, Marek Olšák wrote: > > This patch also needs to change the _mesa_glsl_supported_extensions table in > glsl_parser_extras.cpp. AMD_conservative_depth is used for both versions of > the extension in the table. But that refers to the single extension flag in mtypes.h and there's only one: the AMD one. Not sure what else I should change in that table. > > I'm not super convinced that we even need separate enable flags. Both > extensions add the exact same functionality using the exact same layout > qualifiers. It's not a big deal to me either way, though. I guess this would end up being incorrect with unified flags: #extension GL_AMD_conservative_depth : enable #extension GL_ARB_conservative_depth : disable // would disable AMD too Just a thought. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] mesa-demos: Fixing build errors, add information to glx{gears, info}, CMake improvements
The patches can be used independent. Patch 6 applies only clean with applied patch 5 because of changes in same section of CMakeLists.txt. Patches 1 and 2: Fix build errors on CMake and Autoconf build. Patches 3 and 4 (by Matthias Hopf on openSUSE): Add some information about direct rendering, hardware acceleration and validity to glxgears and glxinfo. Patch 5: Install shared libraries on CMake build (if -DBUILD_SHARED_LIBS). Patch 6: Add possibility to use linux filesystem hierarchy on CMake build. It introduces following variables (as prefixes): (-D)BINDIR - default: none, ${BINDIR}/${subdir} (-D)DATADIR - default: none, ${DATADIR}/${subdir} (-D)DOCDIR - default: doc Following CMake build was successfully tested by me: cmake .. '-DCMAKE_C_FLAGS=-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g' '-DCMAKE_CXX_FLAGS=-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g' -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=ON -DBINDIR=/usr/lib/mesa-demos -DDATADIR=/usr/share/mesa-demos -DDOCDIR=/usr/share/doc/packages/mesa-demos -DLIBDIR=/usr/lib64 PS: Please CC me on discussion. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/6] eglut_x11: Add ${X11_X11_LIB} to target_link_libraries.
--- src/egl/eglut/CMakeLists.txt |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/egl/eglut/CMakeLists.txt b/src/egl/eglut/CMakeLists.txt index b97caa6..45208d6 100644 --- a/src/egl/eglut/CMakeLists.txt +++ b/src/egl/eglut/CMakeLists.txt @@ -1,6 +1,6 @@ if(X11_FOUND) add_library(eglut_x11 eglut.h eglut.c eglutint.h eglut_x11.c) - target_link_libraries(eglut_x11 ${EGL_egl_LIBRARY}) + target_link_libraries(eglut_x11 ${EGL_egl_LIBRARY} ${X11_X11_LIB}) endif(X11_FOUND) add_library(eglut_screen eglut.h eglut.c eglutint.h eglut_screen.c) -- 1.7.7 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/6] eglkms: Add GBM_{CFLAGS,LIBS}.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=40612 --- src/egl/opengl/Makefile.am |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/egl/opengl/Makefile.am b/src/egl/opengl/Makefile.am index 6df114d..0c7228f 100644 --- a/src/egl/opengl/Makefile.am +++ b/src/egl/opengl/Makefile.am @@ -80,5 +80,5 @@ eglgears_x11_LDADD = ../eglut/libeglut_x11.la egltri_x11_LDADD = ../eglut/libeglut_x11.la eglkms_SOURCES = eglkms.c -eglkms_CFLAGS = $(AM_CFLAGS) $(DRM_CFLAGS) -eglkms_LDADD = $(AM_LDFLAGS) $(DRM_LIBS) +eglkms_CFLAGS = $(AM_CFLAGS) $(DRM_CFLAGS) $(GBM_CFLAGS) +eglkms_LDADD = $(AM_LDFLAGS) $(DRM_LIBS) $(GBM_LIBS) -- 1.7.7 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/6] glxinfo: Notify user if direct rendering or hardware acceleration is not available.
From: Matthias Hopf --- src/xdemos/glxinfo.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/xdemos/glxinfo.c b/src/xdemos/glxinfo.c index fe2f68b..df0c516 100644 --- a/src/xdemos/glxinfo.c +++ b/src/xdemos/glxinfo.c @@ -646,6 +646,11 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, Bool limits, Bool fprintf(stderr, "Error: glXMakeCurrent failed\n"); } + if (! glXIsDirect(dpy, ctx)) + printf ("\n***\n*** WARNING: Direct Rendering is NOT enabled\n***\n\n"); + else if (strcasestr ((char *) glGetString(GL_RENDERER), "software")) + printf ("\n***\n*** WARNING: Hardware acceleration is NOT active\n***\n\n"); + glXDestroyContext(dpy, ctx); XFree(visinfo); XDestroyWindow(dpy, win); -- 1.7.7 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/6] glxgears: Notify user if direct rendering or hardware acceleration is not available and that this not a benchmark.
From: Matthias Hopf --- src/xdemos/glxgears.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/xdemos/glxgears.c b/src/xdemos/glxgears.c index cff92b0..c64c2c9 100644 --- a/src/xdemos/glxgears.c +++ b/src/xdemos/glxgears.c @@ -766,6 +766,14 @@ main(int argc, char *argv[]) printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); } + if (! glXIsDirect(dpy, ctx)) + printf ("\n***\n*** WARNING: Direct Rendering is NOT enabled\n***\n"); + else if (strcasestr ((char *) glGetString(GL_RENDERER), "software")) + printf ("\n***\n*** WARNING: Hardware acceleration is NOT active\n***\n"); + printf ("\n*** NOTE: Don't use glxgears as a benchmark.\n" + "OpenGL implementations are not optimized for frame rates >> 60fps,\n" + "thus these numbers are meaningless when compared between vendors.\n\n"); + init(); /* Set initial projection/viewing transformation. -- 1.7.7 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/6] Install shared libraries (if -DBUILD_SHARED_LIBS).
--- CMakeLists.txt |4 src/egl/eglut/CMakeLists.txt |6 ++ src/util/CMakeLists.txt |4 src/xdemos/CMakeLists.txt|4 4 files changed, 18 insertions(+), 0 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbb3359..d07215f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,6 +103,10 @@ endif (MSVC) add_definitions(-DDEMOS_DATA_DIR=\"../data/\") +if (BUILD_SHARED_LIBS AND NOT DEFINED LIBDIR) + set(LIBDIR lib) +endif (BUILD_SHARED_LIBS AND NOT DEFINED LIBDIR) + add_subdirectory (src) diff --git a/src/egl/eglut/CMakeLists.txt b/src/egl/eglut/CMakeLists.txt index 45208d6..d86b59a 100644 --- a/src/egl/eglut/CMakeLists.txt +++ b/src/egl/eglut/CMakeLists.txt @@ -1,7 +1,13 @@ if(X11_FOUND) add_library(eglut_x11 eglut.h eglut.c eglutint.h eglut_x11.c) target_link_libraries(eglut_x11 ${EGL_egl_LIBRARY} ${X11_X11_LIB}) + if (BUILD_SHARED_LIBS) +install (TARGETS eglut_x11 DESTINATION ${LIBDIR}) + endif (BUILD_SHARED_LIBS) endif(X11_FOUND) add_library(eglut_screen eglut.h eglut.c eglutint.h eglut_screen.c) target_link_libraries(eglut_screen ${EGL_egl_LIBRARY}) +if (BUILD_SHARED_LIBS) + install (TARGETS eglut_screen DESTINATION ${LIBDIR}) +endif (BUILD_SHARED_LIBS) diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index a3ea7b4..0829034 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -11,3 +11,7 @@ add_library (util showbuffer.c trackball.c ) + +if (BUILD_SHARED_LIBS) + install (TARGETS util DESTINATION ${LIBDIR}) +endif (BUILD_SHARED_LIBS) diff --git a/src/xdemos/CMakeLists.txt b/src/xdemos/CMakeLists.txt index f60f682..ee8b12d 100644 --- a/src/xdemos/CMakeLists.txt +++ b/src/xdemos/CMakeLists.txt @@ -19,6 +19,10 @@ link_libraries ( add_library (pbutil pbutil.c) +if (BUILD_SHARED_LIBS) + install (TARGETS pbutil DESTINATION ${LIBDIR}) +endif (BUILD_SHARED_LIBS) + set (subdir xdemos) set (targets -- 1.7.7 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 6/6] Add possibility to use linux filesystem hierarchy on CMake build.
It introduces following variables (as prefixes): (-D)BINDIR - default: none, ${BINDIR}/${subdir} (-D)DATADIR - default: none, ${DATADIR}/${subdir} (-D)DOCDIR - default: doc --- CMakeLists.txt| 23 +++ configure.ac | 17 +++-- src/data/CMakeLists.txt |2 +- src/data/Makefile.am |3 +-- src/demos/CMakeLists.txt |4 ++-- src/demos/copypix.c |2 +- src/demos/dissolve.c |4 ++-- src/demos/drawpix.c |2 +- src/demos/engine.c|2 +- src/demos/fbo_firecube.c |6 +++--- src/demos/fire.c |6 +++--- src/demos/geartrain.c |2 +- src/demos/gloss.c |4 ++-- src/demos/ipers.c |2 +- src/demos/isosurf.c |4 ++-- src/demos/lodbias.c |2 +- src/demos/multiarb.c |4 ++-- src/demos/projtex.c |8 src/demos/rain.cxx|2 +- src/demos/readpix.c |2 +- src/demos/reflect.c |2 +- src/demos/teapot.c|4 ++-- src/demos/terrain.c |2 +- src/demos/texcyl.c|2 +- src/demos/textures.c |8 src/demos/tunnel.c|4 ++-- src/demos/tunnel2.c |4 ++-- src/demos/winpos.c|2 +- src/egl/opengl/CMakeLists.txt |6 +++--- src/fp/CMakeLists.txt | 10 +++--- src/fp/fp-tri.c |2 +- src/fp/tri-tex.c |2 +- src/fpglsl/CMakeLists.txt |4 ++-- src/fpglsl/fp-tri.c |2 +- src/glsl/CMakeLists.txt |4 ++-- src/glsl/brick.c |4 ++-- src/glsl/bump.c |8 src/glsl/convolutions.c |2 +- src/glsl/mandelbrot.c |4 ++-- src/glsl/multitex.c |8 src/glsl/simplex-noise.c |2 +- src/glsl/skinning.c |4 ++-- src/glsl/texdemo1.c | 12 ++-- src/glsl/toyball.c|4 ++-- src/gs/CMakeLists.txt |4 ++-- src/objviewer/CMakeLists.txt |4 ++-- src/objviewer/objview.c | 14 +++--- src/perf/CMakeLists.txt |2 +- src/perf/glslstateschange.c |8 src/redbook/CMakeLists.txt|2 +- src/samples/CMakeLists.txt|4 ++-- src/samples/sphere.c |2 +- src/slang/CMakeLists.txt |4 ++-- src/slang/cltest.c|2 +- src/slang/vstest.c|2 +- src/tests/CMakeLists.txt |4 ++-- src/tests/afsmultiarb.c |4 ++-- src/tests/arbfptexture.c |2 +- src/tests/arbfptrig.c |2 +- src/tests/arbnpot.c |2 +- src/tests/arbvparray.c|2 +- src/tests/arraytexture.c | 16 src/tests/blendxor.c |2 +- src/tests/bug_3195.c |2 +- src/tests/bumpmap.c |2 +- src/tests/ext422square.c |2 +- src/tests/fillrate.c |4 ++-- src/tests/floattex.c |2 +- src/tests/fptexture.c |2 +- src/tests/invert.c|2 +- src/tests/mipmap_limits.c |2 +- src/tests/mipmap_view.c |2 +- src/tests/multipal.c |4 ++-- src/tests/pbo.c |2 +- src/tests/rubberband.c|2 +- src/tests/texcmp.c|2 +- src/tests/texcompress2.c |2 +- src/tests/texline.c |2 +- src/tests/texrect.c |4 ++-- src/tests/vparray.c |2 +- src/tests/yuvrect.c |2 +- src/tests/yuvsquare.c |2 +- src/trivial/CMakeLists.txt|2 +- src/vp/CMakeLists.txt | 10 +++--- src/vpglsl/CMakeLists.txt |4 ++-- src/wgl/CMakeLists.txt|2 +- src/xdemos/CMakeLists.txt |4 ++-- src/xdemos/yuvrect_client.c |2 +- 88 files changed, 196 insertions(+), 161 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d07215f..4e74a39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,16 +101,31 @@ if (MSVC) add_definitions (-wd4244) # conversion' conversion from 'type1' to 'type2', possible loss of data endif (MSVC) -add_definitions(-DDEMOS_DATA_DIR=\"../data/\") - if (BUILD_SHARED_LIBS AND NOT DEFINED LIBDIR) set(LIBDIR lib) endif (BUILD_SHARED_LIBS AND NOT DEFINED LIBDIR) -add_subdirectory (src) +if (DEFINED BINDIR) + set(BINDIR ${BINDIR}/) +endif (DEFINED BINDIR) + +if (DEFINED DATADIR) + set(DATADIR ${DATADIR}/) +endif (DEFINED DATADIR) +if (DEFINED BINDIR OR DEFINED DATADIR) + add_definitions(-DDEMOS_DATA_DIR=\"${DATADIR}\") +else (DEFINED BINDIR OR DEFINED DATADIR) + add_definitions(-DDEMOS_DATA_DIR=\"..\") +endif (DEFINED BINDIR OR DEFINED DATADIR) + +add_subdirectory (src) -install (FILES index.html DESTINATION doc) +if (DEFINED DOCDIR) + install
[Mesa-dev] [Bug 43094] New: ir_swizzle @ 0xe134ae0 specifies a channel not present in the value
https://bugs.freedesktop.org/show_bug.cgi?id=43094 Bug #: 43094 Summary: ir_swizzle @ 0xe134ae0 specifies a channel not present in the value Classification: Unclassified Product: Mesa Version: git Platform: x86-64 (AMD64) OS/Version: Linux (All) Status: NEW Severity: normal Priority: medium Component: Mesa core AssignedTo: mesa-dev@lists.freedesktop.org ReportedBy: ingo.the...@i-matrixx.de While trying to play the game Ryzom with latest mesa compiled from git the program terminates with error "ir_swizzle @ 0xe134ae0 specifies a channel not present in the value". Switching back to the stable branch mesa-7.11 (haven´t tried mesa-7.11.1) the error is gone. My glxinfo: OpenGL renderer string: Gallium 0.4 on AMD BARTS OpenGL version string: 2.1 Mesa 7.12-devel (git-ec174a4) OpenGL shading language version string: 1.20 Here is the backtrace: Core was generated by `/usr/games/ryzom_client'. Program terminated with signal 6, Aborted. #0 0x7f1c03120405 in *__GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64 ../nptl/sysdeps/unix/sysv/linux/raise.c: Datei oder Verzeichnis nicht gefunden. in ../nptl/sysdeps/unix/sysv/linux/raise.c (gdb) bt #0 0x7f1c03120405 in *__GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #1 0x7f1c03123680 in *__GI_abort () at abort.c:92 #2 0x7f1bfb0423ad in visit_leave (ir=0xdbaf870, this=) at ir_validate.cpp:465 #3 ir_validate::visit_leave (this=, ir=0xdbaf870) at ir_validate.cpp:456 #4 0x7f1bfb03c0f0 in ir_expression::accept (this=0xdbaf8e0, v=0x7fff048099a0) at ir_hv_accept.cpp:155 #5 0x7f1bfb03c0f0 in ir_expression::accept (this=0xdbafbd0, v=0x7fff048099a0) at ir_hv_accept.cpp:155 #6 0x7f1bfb03c0f0 in ir_expression::accept (this=0xdbafcf0, v=0x7fff048099a0) at ir_hv_accept.cpp:155 #7 0x7f1bfb03c2e6 in ir_swizzle::accept (this=0xdbafd80, v=0x7fff048099a0) at ir_hv_accept.cpp:244 #8 0x7f1bfb03c2e6 in ir_swizzle::accept (this=0xdbafdf0, v=0x7fff048099a0) at ir_hv_accept.cpp:244 #9 0x7f1bfb03c0f0 in ir_expression::accept (this=0xdbaff20, v=0x7fff048099a0) at ir_hv_accept.cpp:155 #10 0x7f1bfb03c0f0 in ir_expression::accept (this=0xdbb0070, v=0x7fff048099a0) at ir_hv_accept.cpp:155 #11 0x7f1bfb03c4ed in ir_assignment::accept (this=0xdbb0170, v=0x7fff048099a0) at ir_hv_accept.cpp:304 #12 0x7f1bfb03bf88 in visit_list_elements (statement_list=true, l=0xdbbc1c0, v=0x7fff048099a0) at ir_hv_accept.cpp:56 #13 ir_function_signature::accept (this=0xdbbc170, v=0x7fff048099a0) at ir_hv_accept.cpp:129 #14 0x7f1bfb03c044 in visit_list_elements (statement_list=false, l=0xdbbbff0, v=0x7fff048099a0) at ir_hv_accept.cpp:56 #15 ir_function::accept (this=0xdbbbfc0, v=0x7fff048099a0) at ir_hv_accept.cpp:141 #16 0x7f1bfb03bd58 in visit_list_elements (v=0x7fff048099a0, l=, statement_list=) at ir_hv_accept.cpp:56 #17 0x7f1bfb042942 in validate_ir_tree (instructions=0xdbbf090) at ir_validate.cpp:621 #18 0x7f1bfafe6533 in create_new_program (key=0x7fff04809b70, ctx=) at main/ff_fragment_shader.cpp:1472 #19 _mesa_get_fixed_func_fragment_program (ctx=) at main/ff_fragment_shader.cpp:1540 #20 0x7f1bfaf62890 in update_program (ctx=0x24dd700) at main/state.c:263 #21 _mesa_update_state_locked (ctx=0x24dd700) at main/state.c:676 #22 0x7f1bfaf6393f in _mesa_update_state (ctx=0x24dd700) at main/state.c:709 #23 0x7f1bfaec47b9 in _mesa_valid_to_render (ctx=0x24dd700, where=) at main/context.c:1723 #24 0x7f1bfb060517 in check_valid_to_render (ctx=0x24dd700, function=) at main/api_validate.c:105 #25 0x7f1bfb0613b2 in _mesa_validate_DrawElements (ctx=0x24dd700, mode=, count=1494, type=5123, indices=0x898ff60, basevertex=) at main/api_validate.c:253 #26 0x7f1bfafb8f42 in vbo_exec_DrawElements (mode=4, count=1494, type=5123, indices=0x898ff60) at vbo/vbo_exec_array.c:1010 #27 0x7f1bfc984381 in NL3D::CDriverGL::renderTriangles(NL3D::CMaterial&, unsigned int, unsigned int) () from /usr/lib/nel/libnel_drv_opengl.so ---Type to continue, or q to quit--- #28 0x7f1c05a98b27 in NL3D::CMeshMRMSkinnedGeom::renderSkinGroupSpecularRdrPass(NL3D::CMeshMRMSkinnedInstance*, unsigned int) () from /usr/lib/libnel3d.so.0 #29 0x7f1c05c7b5cf in NL3D::CSkeletonModel::renderSkinList(NLMISC::CObjectVector&, float) () from /usr/lib/libnel3d.so.0 #30 0x7f1c05c7ba66 in NL3D::CSkeletonModel::renderSkins() () from /usr/lib/libnel3d.so.0 #31 0x7f1c05c7bc25 in NL3D::CSkeletonModel::traverseRender() () from /usr/lib/libnel3d.so.0 #32 0x7f1c058f3ae1 in NL3D::CRenderTrav::traverse(NL3D::UScene::TRenderPart, bool) () from /usr/lib/libnel3d.so.0 #33 0x7f1c05a64bc2 in NL3D::CScene::renderPart(NL3D::UScene::TRenderPart, bool) () from /usr/lib/libnel3d.so.0 #34 0x7f1c05a667a9 in NL3D::CScene::render(bool) () from /usr/lib/libnel3d.so.0 #35 0x7f1c05bd43ce in NL3D::CScen
[Mesa-dev] [PATCHv2 6/6] Add possibility to use linux filesystem hierarchy on CMake build.
It introduces following variables (as prefixes): (-D)BINDIR - default: none, ${BINDIR}/${subdir} (-D)DATADIR - default: none, ${DATADIR}/${subdir} (-D)DOCDIR - default: doc --- CMakeLists.txt| 23 +++ configure.ac | 17 +++-- src/data/CMakeLists.txt |2 +- src/data/Makefile.am |3 +-- src/demos/CMakeLists.txt |4 ++-- src/demos/copypix.c |2 +- src/demos/dissolve.c |4 ++-- src/demos/drawpix.c |2 +- src/demos/engine.c|2 +- src/demos/fbo_firecube.c |6 +++--- src/demos/fire.c |6 +++--- src/demos/geartrain.c |2 +- src/demos/gloss.c |4 ++-- src/demos/ipers.c |2 +- src/demos/isosurf.c |4 ++-- src/demos/lodbias.c |2 +- src/demos/multiarb.c |4 ++-- src/demos/projtex.c |8 src/demos/rain.cxx|2 +- src/demos/readpix.c |2 +- src/demos/reflect.c |2 +- src/demos/teapot.c|4 ++-- src/demos/terrain.c |2 +- src/demos/texcyl.c|2 +- src/demos/textures.c |8 src/demos/tunnel.c|4 ++-- src/demos/tunnel2.c |4 ++-- src/demos/winpos.c|2 +- src/egl/opengl/CMakeLists.txt |6 +++--- src/fp/CMakeLists.txt | 10 +++--- src/fp/fp-tri.c |2 +- src/fp/tri-tex.c |2 +- src/fpglsl/CMakeLists.txt |4 ++-- src/fpglsl/fp-tri.c |2 +- src/glsl/CMakeLists.txt |4 ++-- src/glsl/brick.c |4 ++-- src/glsl/bump.c |8 src/glsl/convolutions.c |2 +- src/glsl/mandelbrot.c |4 ++-- src/glsl/multitex.c |8 src/glsl/simplex-noise.c |2 +- src/glsl/skinning.c |4 ++-- src/glsl/texdemo1.c | 12 ++-- src/glsl/toyball.c|4 ++-- src/gs/CMakeLists.txt |4 ++-- src/objviewer/CMakeLists.txt |4 ++-- src/objviewer/objview.c | 14 +++--- src/perf/CMakeLists.txt |2 +- src/perf/glslstateschange.c |8 src/redbook/CMakeLists.txt|2 +- src/samples/CMakeLists.txt|4 ++-- src/samples/sphere.c |2 +- src/slang/CMakeLists.txt |4 ++-- src/slang/cltest.c|2 +- src/slang/vstest.c|2 +- src/tests/CMakeLists.txt |4 ++-- src/tests/afsmultiarb.c |4 ++-- src/tests/arbfptexture.c |2 +- src/tests/arbfptrig.c |2 +- src/tests/arbnpot.c |2 +- src/tests/arbvparray.c|2 +- src/tests/arraytexture.c | 16 src/tests/blendxor.c |2 +- src/tests/bug_3195.c |2 +- src/tests/bumpmap.c |2 +- src/tests/ext422square.c |2 +- src/tests/fillrate.c |4 ++-- src/tests/floattex.c |2 +- src/tests/fptexture.c |2 +- src/tests/invert.c|2 +- src/tests/mipmap_limits.c |2 +- src/tests/mipmap_view.c |2 +- src/tests/multipal.c |4 ++-- src/tests/pbo.c |2 +- src/tests/rubberband.c|2 +- src/tests/texcmp.c|2 +- src/tests/texcompress2.c |2 +- src/tests/texline.c |2 +- src/tests/texrect.c |4 ++-- src/tests/vparray.c |2 +- src/tests/yuvrect.c |2 +- src/tests/yuvsquare.c |2 +- src/trivial/CMakeLists.txt|2 +- src/vp/CMakeLists.txt | 10 +++--- src/vpglsl/CMakeLists.txt |4 ++-- src/wgl/CMakeLists.txt|2 +- src/xdemos/CMakeLists.txt |4 ++-- src/xdemos/yuvrect_client.c |2 +- 88 files changed, 196 insertions(+), 161 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d07215f..4e74a39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,16 +101,31 @@ if (MSVC) add_definitions (-wd4244) # conversion' conversion from 'type1' to 'type2', possible loss of data endif (MSVC) -add_definitions(-DDEMOS_DATA_DIR=\"../data/\") - if (BUILD_SHARED_LIBS AND NOT DEFINED LIBDIR) set(LIBDIR lib) endif (BUILD_SHARED_LIBS AND NOT DEFINED LIBDIR) -add_subdirectory (src) +if (DEFINED BINDIR) + set(BINDIR ${BINDIR}/) +endif (DEFINED BINDIR) + +if (DEFINED DATADIR) + set(DATADIR ${DATADIR}/) +endif (DEFINED DATADIR) +if (DEFINED BINDIR OR DEFINED DATADIR) + add_definitions(-DDEMOS_DATA_DIR=\"${DATADIR}\") +else (DEFINED BINDIR OR DEFINED DATADIR) + add_definitions(-DDEMOS_DATA_DIR=\"..\") +endif (DEFINED BINDIR OR DEFINED DATADIR) + +add_subdirectory (src) -install (FILES index.html DESTINATION doc) +if (DEFINED DOCDIR) + install
Re: [Mesa-dev] [PATCH 4/6] gallium: remove PIPE_CAP_GLSL and enable GLSL unconditionally
Well, there are three drivers which are pretty much dead: - cell - failover (co-driver) - i965 A lot of work has gone into the cell driver. I wonder if anybody still has any plans for it. Marek On Fri, Nov 18, 2011 at 11:57 PM, Keith Whitwell wrote: > > > - Original Message - >> On 11/18/2011 11:27 AM, Marek Olšák wrote: >> > Only i965g does not enable GLSL, but that driver has been >> > unmaintained and >> > bitrotting for quite a while anyway. >> >> It doesn't even do GLSL? I'm pretty shocked, I figured it at least >> did >> that. Is it even worth keeping around in the tree? Seems like it's >> just creating extra work for you guys, having to update it for >> Gallium >> changes...when ultimately, nobody's using it. >> > > I agree -- this was never finished & isn't likely to be either. > > Keith > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] mesa: rename the AMD_conservative_depth extension flag to ARB
--- src/glsl/glcpp/glcpp-parse.y|2 +- src/glsl/glsl_parser_extras.cpp |4 ++-- src/mesa/main/extensions.c |4 ++-- src/mesa/main/mtypes.h |2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index c0457b0..2b7e65c 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -1135,7 +1135,7 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) if (extensions->ARB_draw_instanced) add_builtin_define(parser, "GL_ARB_draw_instanced", 1); - if (extensions->AMD_conservative_depth) { + if (extensions->ARB_conservative_depth) { add_builtin_define(parser, "GL_AMD_conservative_depth", 1); add_builtin_define(parser, "GL_ARB_conservative_depth", 1); } diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 23aadb1..53ce881 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -256,7 +256,7 @@ struct _mesa_glsl_extension { static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { /* target availability API availability */ /* name VS GS FS GL ES supported flag */ - EXT(ARB_conservative_depth, true, false, true, true, false, AMD_conservative_depth), + EXT(ARB_conservative_depth, true, false, true, true, false, ARB_conservative_depth), EXT(ARB_draw_buffers, false, false, true, true, false, dummy_true), EXT(ARB_draw_instanced, true, false, false, true, false, ARB_draw_instanced), EXT(ARB_explicit_attrib_location, true, false, true, true, false, ARB_explicit_attrib_location), @@ -265,7 +265,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { EXT(EXT_texture_array, true, false, true, true, false, EXT_texture_array), EXT(ARB_shader_texture_lod, true, false, true, true, false, ARB_shader_texture_lod), EXT(ARB_shader_stencil_export, false, false, true, true, false, ARB_shader_stencil_export), - EXT(AMD_conservative_depth, true, false, true, true, false, AMD_conservative_depth), + EXT(AMD_conservative_depth, true, false, true, true, false, ARB_conservative_depth), EXT(AMD_shader_stencil_export, false, false, true, true, false, ARB_shader_stencil_export), EXT(OES_texture_3D, true, false, true, false, true, EXT_texture3D), EXT(OES_EGL_image_external, true, false, true, false, true, OES_EGL_image_external), diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index d5a8914..8ebc051 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -81,7 +81,7 @@ static const struct extension extension_table[] = { { "GL_ARB_blend_func_extended", o(ARB_blend_func_extended), GL, 2009 }, { "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), GL, 2004 }, { "GL_ARB_copy_buffer", o(ARB_copy_buffer), GL, 2008 }, - { "GL_ARB_conservative_depth", o(AMD_conservative_depth), GL, 2011 }, + { "GL_ARB_conservative_depth", o(ARB_conservative_depth), GL, 2011 }, { "GL_ARB_depth_buffer_float", o(ARB_depth_buffer_float), GL, 2008 }, { "GL_ARB_depth_clamp", o(ARB_depth_clamp), GL, 2003 }, { "GL_ARB_depth_texture", o(ARB_depth_texture), GL, 2001 }, @@ -257,7 +257,7 @@ static const struct extension extension_table[] = { /* Vendor extensions */ { "GL_3DFX_texture_compression_FXT1", o(TDFX_texture_compression_FXT1), GL, 1999 }, - { "GL_AMD_conservative_depth", o(AMD_conservative_depth), GL, 2009 }, + { "GL_AMD_conservative_depth", o(ARB_conservative_depth), GL, 2009 }, { "GL_AMD_draw_buffers_blend", o(ARB_draw_buffers_blend), GL, 2009 }, { "GL_AMD_seamless_cubemap_per_texture", o(AMD_seamless_cubemap_per_texture),GL, 2009 }, { "GL_AMD_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 }, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b3427da..96a4426 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2844,
[Mesa-dev] [PATCH 2/3] glsl: finish up ARB_conservative_depth (v2)
v2: updated an error message --- src/glsl/ast_to_hir.cpp | 10 +++--- src/glsl/glsl_lexer.ll |1 + src/glsl/glsl_parser.yy |9 - 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index ac090c3..d5b04e9 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2090,6 +2090,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, * The following extension do not allow the deprecated keywords: * *GL_AMD_conservative_depth +*GL_ARB_conservative_depth *GL_ARB_gpu_shader5 *GL_ARB_separate_shader_objects *GL_ARB_tesselation_shader @@ -2122,9 +2123,11 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual, + qual->flags.q.depth_less + qual->flags.q.depth_unchanged; if (depth_layout_count > 0 - && !state->AMD_conservative_depth_enable) { + && !state->AMD_conservative_depth_enable + && !state->ARB_conservative_depth_enable) { _mesa_glsl_error(loc, state, -"extension GL_AMD_conservative_depth must be enabled " +"extension GL_AMD_conservative_depth or " +"GL_ARB_conservative_depth must be enabled " "to use depth layout qualifiers"); } else if (depth_layout_count > 0 && strcmp(var->name, "gl_FragDepth") != 0) { @@ -2237,7 +2240,8 @@ get_variable_being_redeclared(ir_variable *var, ast_declaration *decl, earlier->interpolation = var->interpolation; /* Layout qualifiers for gl_FragDepth. */ - } else if (state->AMD_conservative_depth_enable + } else if ((state->AMD_conservative_depth_enable || + state->ARB_conservative_depth_enable) && strcmp(var->name, "gl_FragDepth") == 0 && earlier->type == var->type && earlier->mode == var->mode) { diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll index 49f3bc8..c7cfedd 100644 --- a/src/glsl/glsl_lexer.ll +++ b/src/glsl/glsl_lexer.ll @@ -310,6 +310,7 @@ voidreturn VOID_TOK; layout { if ((yyextra->language_version >= 140) || yyextra->AMD_conservative_depth_enable + || yyextra->ARB_conservative_depth_enable || yyextra->ARB_explicit_attrib_location_enable || yyextra->ARB_fragment_coord_conventions_enable) { return LAYOUT_TOK; diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 8363904..71ab039 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -1124,7 +1124,9 @@ layout_qualifier_id: } /* Layout qualifiers for AMD/ARB_conservative_depth. */ - if (!got_one && state->AMD_conservative_depth_enable) { + if (!got_one && + (state->AMD_conservative_depth_enable || + state->ARB_conservative_depth_enable)) { if (strcmp($1, "depth_any") == 0) { got_one = true; $$.flags.q.depth_any = 1; @@ -1141,6 +1143,11 @@ layout_qualifier_id: if (got_one && state->AMD_conservative_depth_warn) { _mesa_glsl_warning(& @1, state, + "GL_AMD_conservative_depth " + "layout qualifier `%s' is used\n", $1); + } + if (got_one && state->ARB_conservative_depth_warn) { +_mesa_glsl_warning(& @1, state, "GL_ARB_conservative_depth " "layout qualifier `%s' is used\n", $1); } -- 1.7.5.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] glsl: convervative_depth is not allowed in the vertex shader
--- src/glsl/glsl_parser_extras.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 53ce881..0b4ccac 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -256,7 +256,7 @@ struct _mesa_glsl_extension { static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { /* target availability API availability */ /* name VS GS FS GL ES supported flag */ - EXT(ARB_conservative_depth, true, false, true, true, false, ARB_conservative_depth), + EXT(ARB_conservative_depth, false, false, true, true, false, ARB_conservative_depth), EXT(ARB_draw_buffers, false, false, true, true, false, dummy_true), EXT(ARB_draw_instanced, true, false, false, true, false, ARB_draw_instanced), EXT(ARB_explicit_attrib_location, true, false, true, true, false, ARB_explicit_attrib_location), @@ -265,7 +265,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { EXT(EXT_texture_array, true, false, true, true, false, EXT_texture_array), EXT(ARB_shader_texture_lod, true, false, true, true, false, ARB_shader_texture_lod), EXT(ARB_shader_stencil_export, false, false, true, true, false, ARB_shader_stencil_export), - EXT(AMD_conservative_depth, true, false, true, true, false, ARB_conservative_depth), + EXT(AMD_conservative_depth, false, false, true, true, false, ARB_conservative_depth), EXT(AMD_shader_stencil_export, false, false, true, true, false, ARB_shader_stencil_export), EXT(OES_texture_3D, true, false, true, false, true, EXT_texture3D), EXT(OES_EGL_image_external, true, false, true, false, true, OES_EGL_image_external), -- 1.7.5.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/8] EXT_transform_feedback & ARB_transform_feedback2 core support
Hi everyone, this patch series implements all the core Mesa and Gallium support for EXT_transform_feedback and ARB_transform_feedback2. It's been tested by me on Radeons and by Christoph Bumiller on Nouveau. I have verified that all transform feedback piglit tests (except the one that requires GLSL 1.3) pass with this code. Since we were discussing this last time, the Gallium interface has been slightly modified to make it easier to implement by drivers. The Gallium docs have been updated too. Some streamout-related softpipe and llvmpipe code for the old interface has been disabled. I didn't look at what needs to be done to support the new one. Please review. Marek Olšák (8): mesa: implement DrawTransformFeedback from ARB_transform_feedback2 gallium: disable stream output in drivers that support it gallium: interface changes necessary to implement transform feedback (v4) gallium: utility helper functions for stream output noop: implement stream output u_blitter: restore stream output targets u_blitter: implement copy_buffer using stream output st/mesa: implement EXT_transform_feedback and ARB_transform_feedback2 src/gallium/auxiliary/cso_cache/cso_context.c | 101 + src/gallium/auxiliary/cso_cache/cso_context.h |8 ++ src/gallium/auxiliary/draw/draw_context.c |4 +- src/gallium/auxiliary/draw/draw_context.h |2 +- src/gallium/auxiliary/draw/draw_private.h |2 +- src/gallium/auxiliary/draw/draw_pt_so_emit.c |2 +- src/gallium/auxiliary/tgsi/tgsi_ureg.c|7 +- src/gallium/auxiliary/tgsi/tgsi_ureg.h| 18 +++- src/gallium/auxiliary/util/u_blit.c |6 + src/gallium/auxiliary/util/u_blitter.c| 105 +- src/gallium/auxiliary/util/u_blitter.h| 29 + src/gallium/auxiliary/util/u_debug_describe.c | 10 ++ src/gallium/auxiliary/util/u_debug_describe.h |2 + src/gallium/auxiliary/util/u_gen_mipmap.c |3 + src/gallium/auxiliary/util/u_inlines.h| 12 ++ src/gallium/auxiliary/util/u_simple_shaders.c | 14 ++- src/gallium/auxiliary/util/u_simple_shaders.h |8 ++ src/gallium/docs/source/context.rst | 61 +++ src/gallium/docs/source/screen.rst|3 + src/gallium/drivers/llvmpipe/lp_state.h |2 +- src/gallium/drivers/llvmpipe/lp_state_so.c|9 ++- src/gallium/drivers/noop/noop_state.c | 35 ++ src/gallium/drivers/nv50/nv50_screen.c|2 +- src/gallium/drivers/nvc0/nvc0_screen.c|2 +- src/gallium/drivers/nvc0/nvc0_state.c |9 ++- src/gallium/drivers/r300/r300_screen.c|2 +- src/gallium/drivers/r600/r600_pipe.c |2 +- src/gallium/drivers/softpipe/sp_context.c |2 +- src/gallium/drivers/softpipe/sp_screen.c |4 +- src/gallium/drivers/softpipe/sp_state.h |2 +- src/gallium/drivers/softpipe/sp_state_so.c|9 ++- src/gallium/include/pipe/p_context.h | 38 --- src/gallium/include/pipe/p_defines.h |8 +- src/gallium/include/pipe/p_state.h| 83 +++--- src/mesa/drivers/dri/i965/brw_draw.c |3 +- src/mesa/drivers/dri/i965/brw_draw.h |3 +- src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c | 15 ++- src/mesa/main/api_validate.c | 34 ++ src/mesa/main/api_validate.h | 10 ++ src/mesa/main/dd.h|3 +- src/mesa/main/mtypes.h|2 + src/mesa/main/transformfeedback.c | 65 ++-- src/mesa/main/transformfeedback.h |6 +- src/mesa/main/varray.h|7 + src/mesa/main/vtxfmt.c|1 + src/mesa/state_tracker/st_atom_rasterizer.c |7 +- src/mesa/state_tracker/st_cb_bitmap.c |3 + src/mesa/state_tracker/st_cb_clear.c |3 + src/mesa/state_tracker/st_cb_drawpixels.c |3 + src/mesa/state_tracker/st_cb_drawtex.c|3 + src/mesa/state_tracker/st_cb_rasterpos.c |3 +- src/mesa/state_tracker/st_cb_xformfb.c| 149 ++--- src/mesa/state_tracker/st_cb_xformfb.h| 12 ++ src/mesa/state_tracker/st_draw.c | 14 ++- src/mesa/state_tracker/st_draw.h |6 +- src/mesa/state_tracker/st_draw_feedback.c |3 +- src/mesa/state_tracker/st_extensions.c| 16 +++ src/mesa/state_tracker/st_glsl_to_tgsi.cpp| 25 src/mesa/state_tracker/st_glsl_to_tgsi.h |6 + src/mesa/state_tracker/st_program.c | 12 ++ src/mesa/tnl/t_draw.c |3 +- src/mesa/tnl/tnl.h|3 +- src/mesa/vbo/vbo.h|4 +- src/mesa/vbo/vbo_exec_array.c | 93 +++- src/mesa/vbo/vbo_exec_draw.c |3 +- src/mesa/vbo/vbo_reb
[Mesa-dev] [PATCH 1/8] mesa: implement DrawTransformFeedback from ARB_transform_feedback2
It's like DrawArrays, but the count is taken from a transform feedback object. This removes DrawTransformFeedback from dd_function_table and adds the same function to GLvertexformat (with the function parameters matching GL). The vbo_draw_func callback has a new parameter "struct gl_transform_feedback_object *tfb_vertcount". The rest of the code just validates states and forwards the transform feedback object into vbo_draw_func. --- src/mesa/drivers/dri/i965/brw_draw.c |3 +- src/mesa/drivers/dri/i965/brw_draw.h |3 +- src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c | 15 +++-- src/mesa/main/api_validate.c | 34 + src/mesa/main/api_validate.h | 10 +++ src/mesa/main/dd.h |3 +- src/mesa/main/mtypes.h |2 + src/mesa/main/transformfeedback.c| 65 ++ src/mesa/main/transformfeedback.h|6 +- src/mesa/main/varray.h |7 ++ src/mesa/main/vtxfmt.c |1 + src/mesa/state_tracker/st_cb_rasterpos.c |3 +- src/mesa/state_tracker/st_cb_xformfb.c | 13 src/mesa/state_tracker/st_draw.c |4 +- src/mesa/state_tracker/st_draw.h |6 +- src/mesa/state_tracker/st_draw_feedback.c|3 +- src/mesa/tnl/t_draw.c|3 +- src/mesa/tnl/tnl.h |3 +- src/mesa/vbo/vbo.h |4 +- src/mesa/vbo/vbo_exec_array.c| 93 -- src/mesa/vbo/vbo_exec_draw.c |3 +- src/mesa/vbo/vbo_rebase.c|3 +- src/mesa/vbo/vbo_save_api.c | 11 +++ src/mesa/vbo/vbo_save_draw.c |3 +- src/mesa/vbo/vbo_split_copy.c|3 +- src/mesa/vbo/vbo_split_inplace.c |3 +- 26 files changed, 207 insertions(+), 100 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 1571fb7..4c53cf5 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -414,7 +414,8 @@ void brw_draw_prims( struct gl_context *ctx, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, GLuint min_index, -GLuint max_index ) +GLuint max_index, +struct gl_transform_feedback_object *tfb_vertcount ) { bool retval; diff --git a/src/mesa/drivers/dri/i965/brw_draw.h b/src/mesa/drivers/dri/i965/brw_draw.h index 1fe4172..b910419 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.h +++ b/src/mesa/drivers/dri/i965/brw_draw.h @@ -41,7 +41,8 @@ void brw_draw_prims( struct gl_context *ctx, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, GLuint min_index, -GLuint max_index ); +GLuint max_index, +struct gl_transform_feedback_object *tfb_vertcount ); void brw_draw_init( struct brw_context *brw ); void brw_draw_destroy( struct brw_context *brw ); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c index d8b331c..de04d18 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c @@ -219,7 +219,8 @@ TAG(vbo_render_prims)(struct gl_context *ctx, const struct gl_client_array **arr const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, - GLuint min_index, GLuint max_index); + GLuint min_index, GLuint max_index, + struct gl_transform_feedback_object *tfb_vertcount); static GLboolean vbo_maybe_split(struct gl_context *ctx, const struct gl_client_array **arrays, @@ -430,7 +431,8 @@ TAG(vbo_render_prims)(struct gl_context *ctx, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, - GLuint min_index, GLuint max_index) + GLuint min_index, GLuint max_index, + struct gl_transform_feedback_object *tfb_vertcount) { struct nouveau_render_state *render = to_render_state(ctx); @@ -464,7 +466,8 @@ TAG(vbo_check_render_prims)(struct gl_context *ctx, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, - GLuint min_index, GLuint max_index) + GLuint min_index, GLuint max_index, +
[Mesa-dev] [PATCH 2/8] gallium: disable stream output in drivers that support it
I am going to make interface changes and I don't want to break compilation. --- src/gallium/drivers/llvmpipe/lp_state_so.c |7 +++ src/gallium/drivers/nvc0/nvc0_state.c |7 +++ src/gallium/drivers/softpipe/sp_context.c |2 +- src/gallium/drivers/softpipe/sp_screen.c |2 +- src/gallium/drivers/softpipe/sp_state_so.c |7 +++ 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_state_so.c b/src/gallium/drivers/llvmpipe/lp_state_so.c index 30b17c9..35de52c 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_so.c +++ b/src/gallium/drivers/llvmpipe/lp_state_so.c @@ -125,6 +125,7 @@ llvmpipe_set_stream_output_buffers(struct pipe_context *pipe, void llvmpipe_init_so_funcs(struct llvmpipe_context *llvmpipe) { +#if 0 llvmpipe->pipe.create_stream_output_state = llvmpipe_create_stream_output_state; llvmpipe->pipe.bind_stream_output_state = @@ -134,4 +135,10 @@ llvmpipe_init_so_funcs(struct llvmpipe_context *llvmpipe) llvmpipe->pipe.set_stream_output_buffers = llvmpipe_set_stream_output_buffers; +#else + (void) llvmpipe_create_stream_output_state; + (void) llvmpipe_bind_stream_output_state; + (void) llvmpipe_delete_stream_output_state; + (void) llvmpipe_set_stream_output_buffers; +#endif } diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c index 1a37d04..0d6952d 100644 --- a/src/gallium/drivers/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nvc0/nvc0_state.c @@ -871,10 +871,17 @@ nvc0_init_state_functions(struct nvc0_context *nvc0) pipe->set_vertex_buffers = nvc0_set_vertex_buffers; pipe->set_index_buffer = nvc0_set_index_buffer; +#if 0 pipe->create_stream_output_state = nvc0_tfb_state_create; pipe->delete_stream_output_state = nvc0_tfb_state_delete; pipe->bind_stream_output_state = nvc0_tfb_state_bind; pipe->set_stream_output_buffers = nvc0_set_transform_feedback_buffers; +#else + (void)nvc0_tfb_state_create; + (void)nvc0_tfb_state_delete; + (void)nvc0_tfb_state_bind; + (void)nvc0_set_transform_feedback_buffers; +#endif pipe->redefine_user_buffer = u_default_redefine_user_buffer; } diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 3a83e58..a720600 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -257,7 +257,7 @@ softpipe_create_context( struct pipe_screen *screen, softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state; softpipe->pipe.draw_vbo = softpipe_draw_vbo; - softpipe->pipe.draw_stream_output = softpipe_draw_stream_output; + /* XXX softpipe->pipe.draw_stream_output = softpipe_draw_stream_output; */ softpipe->pipe.clear = softpipe_clear; softpipe->pipe.flush = softpipe_flush_wrapped; diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 4851049..49d3de7 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -108,7 +108,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: return 1; case PIPE_CAP_STREAM_OUTPUT: - return 1; + return 0; case PIPE_CAP_PRIMITIVE_RESTART: return 1; case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE: diff --git a/src/gallium/drivers/softpipe/sp_state_so.c b/src/gallium/drivers/softpipe/sp_state_so.c index ddfa3ef..40e5634 100644 --- a/src/gallium/drivers/softpipe/sp_state_so.c +++ b/src/gallium/drivers/softpipe/sp_state_so.c @@ -131,10 +131,17 @@ softpipe_set_stream_output_buffers(struct pipe_context *pipe, void softpipe_init_streamout_funcs(struct pipe_context *pipe) { +#if 0 pipe->create_stream_output_state = softpipe_create_stream_output_state; pipe->bind_stream_output_state = softpipe_bind_stream_output_state; pipe->delete_stream_output_state = softpipe_delete_stream_output_state; pipe->set_stream_output_buffers = softpipe_set_stream_output_buffers; +#else + (void) softpipe_create_stream_output_state; + (void) softpipe_bind_stream_output_state; + (void) softpipe_delete_stream_output_state; + (void) softpipe_set_stream_output_buffers; +#endif } -- 1.7.5.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/8] gallium: interface changes necessary to implement transform feedback (v4)
Namely: - EXT_transform_feedback - ARB_transform_feedback2 - ARB_transform_feedback_instanced The old interface was not useful for OpenGL and had to be reworked. This interface was originally designed for OpenGL, but additional changes have been made in order to make st/d3d1x support easier. The most notable change is the stream-out info must be linked with a vertex or geometry shader and cannot be set independently. This is due to limitations of existing hardware (special shader instructions must be used to write into stream-out buffers), and it's also how OpenGL works (stream outputs must be specified prior to linking shaders). Other than that, each stream output buffer has a "view" into it that internally maintains the number of bytes which have been written into it. (one buffer can be bound in several different transform feedback objects in OpenGL, so we must be able to have several views around) The set_stream_output_targets function contains a parameter saying whether new data should be appended or not. Also, the view can optionally be used to provide the vertex count for draw_vbo. Note that the count is supposed to be stored in device memory and the CPU never gets to know its value. OpenGL way | Gallium way BeginTF= set_so_targets(append_bitmask = 0) PauseTF= set_so_targets(num_targets = 0) ResumeTF = set_so_targets(append_bitmask = ~0) EndTF = set_so_targets(num_targets = 0) DrawTF = use pipe_draw_info::count_from_stream_output v2: * removed the reset_stream_output_targets function * added a parameter append_bitmask to set_stream_output_targets, each bit specifies whether new data should be appended to each buffer or not. v3: * added PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME for ARB_tfb2, note that the draw-auto subset is always required (for d3d10), only the pause/resume functionality is limited if the CAP is not advertised v4: * update gallium/docs --- src/gallium/auxiliary/draw/draw_context.c|4 +- src/gallium/auxiliary/draw/draw_context.h|2 +- src/gallium/auxiliary/draw/draw_private.h|2 +- src/gallium/auxiliary/draw/draw_pt_so_emit.c |2 +- src/gallium/docs/source/context.rst | 61 +-- src/gallium/docs/source/screen.rst |3 + src/gallium/drivers/llvmpipe/lp_state.h |2 +- src/gallium/drivers/llvmpipe/lp_state_so.c |2 +- src/gallium/drivers/nv50/nv50_screen.c |2 +- src/gallium/drivers/nvc0/nvc0_screen.c |2 +- src/gallium/drivers/nvc0/nvc0_state.c|2 +- src/gallium/drivers/r300/r300_screen.c |2 +- src/gallium/drivers/r600/r600_pipe.c |2 +- src/gallium/drivers/softpipe/sp_screen.c |2 +- src/gallium/drivers/softpipe/sp_state.h |2 +- src/gallium/drivers/softpipe/sp_state_so.c |2 +- src/gallium/include/pipe/p_context.h | 38 +++- src/gallium/include/pipe/p_defines.h |8 ++- src/gallium/include/pipe/p_state.h | 83 -- 19 files changed, 151 insertions(+), 72 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index a444793..9c00687 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -722,11 +722,11 @@ draw_set_mapped_so_buffers(struct draw_context *draw, void draw_set_so_state(struct draw_context *draw, - struct pipe_stream_output_state *state) + struct pipe_stream_output_info *state) { memcpy(&draw->so.state, state, - sizeof(struct pipe_stream_output_state)); + sizeof(struct pipe_stream_output_info)); } void diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 799eb94..93577d0 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -202,7 +202,7 @@ draw_set_mapped_so_buffers(struct draw_context *draw, unsigned num_buffers); void draw_set_so_state(struct draw_context *draw, - struct pipe_stream_output_state *state); + struct pipe_stream_output_info *state); /*** diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 3521a03..89653e1 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -270,7 +270,7 @@ struct draw_context /** Stream output (vertex feedback) state */ struct { - struct pipe_stream_output_state state; + struct pipe_stream_output_info state; void *buffers[PIPE_MAX_SO_BUFFERS]; uint num_buffers; } so; diff --git a/src/gallium/auxiliary/draw/draw_pt_so_emit.c b/src/gallium/auxiliary/draw/draw_pt_so_emit.c
[Mesa-dev] [PATCH 4/8] gallium: utility helper functions for stream output
--- src/gallium/auxiliary/tgsi/tgsi_ureg.c|7 ++- src/gallium/auxiliary/tgsi/tgsi_ureg.h| 18 ++ src/gallium/auxiliary/util/u_debug_describe.c | 10 ++ src/gallium/auxiliary/util/u_debug_describe.h |2 ++ src/gallium/auxiliary/util/u_inlines.h| 12 src/gallium/auxiliary/util/u_simple_shaders.c | 14 +- src/gallium/auxiliary/util/u_simple_shaders.h |8 7 files changed, 65 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index cada435..0ee1947 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -1575,14 +1575,19 @@ const struct tgsi_token *ureg_finalize( struct ureg_program *ureg ) void *ureg_create_shader( struct ureg_program *ureg, - struct pipe_context *pipe ) + struct pipe_context *pipe, + const struct pipe_stream_output_info *so ) { struct pipe_shader_state state; + memset(&state, 0, sizeof(state)); state.tokens = ureg_finalize(ureg); if(!state.tokens) return NULL; + if (so) + state.stream_output = *so; + if (ureg->processor == TGSI_PROCESSOR_VERTEX) return pipe->create_vs_state( pipe, &state ); else diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 8f5f22e..72b837a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -37,6 +37,7 @@ extern "C" { #endif struct ureg_program; +struct pipe_stream_output_info; /* Almost a tgsi_src_register, but we need to pull in the Absolute * flag from the _ext token. Indirect flag always implies ADDR[0]. @@ -97,7 +98,8 @@ ureg_finalize( struct ureg_program * ); */ void * ureg_create_shader( struct ureg_program *, -struct pipe_context *pipe ); +struct pipe_context *pipe, + const struct pipe_stream_output_info *so ); /* Alternately, return the built token stream and hand ownership of @@ -120,14 +122,22 @@ ureg_destroy( struct ureg_program * ); * Convenience routine: */ static INLINE void * -ureg_create_shader_and_destroy( struct ureg_program *p, -struct pipe_context *pipe ) +ureg_create_shader_with_so_and_destroy( struct ureg_program *p, + struct pipe_context *pipe, + const struct pipe_stream_output_info *so ) { - void *result = ureg_create_shader( p, pipe ); + void *result = ureg_create_shader( p, pipe, so ); ureg_destroy( p ); return result; } +static INLINE void * +ureg_create_shader_and_destroy( struct ureg_program *p, +struct pipe_context *pipe ) +{ + return ureg_create_shader_with_so_and_destroy(p, pipe, NULL); +} + /*** * Build shader properties: diff --git a/src/gallium/auxiliary/util/u_debug_describe.c b/src/gallium/auxiliary/util/u_debug_describe.c index 3574acc..df73ed8 100644 --- a/src/gallium/auxiliary/util/u_debug_describe.c +++ b/src/gallium/auxiliary/util/u_debug_describe.c @@ -79,3 +79,13 @@ debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr) debug_describe_resource(res, ptr->texture); util_sprintf(buf, "pipe_sampler_view<%s,%s>", res, util_format_short_name(ptr->format)); } + +void +debug_describe_so_target(char* buf, + const struct pipe_stream_output_target *ptr) +{ + char res[128]; + debug_describe_resource(res, ptr->buffer); + util_sprintf(buf, "pipe_stream_output_target<%s,%u,%u>", res, +ptr->buffer_offset, ptr->buffer_size); +} diff --git a/src/gallium/auxiliary/util/u_debug_describe.h b/src/gallium/auxiliary/util/u_debug_describe.h index 26d1f80..4f7882b 100644 --- a/src/gallium/auxiliary/util/u_debug_describe.h +++ b/src/gallium/auxiliary/util/u_debug_describe.h @@ -41,6 +41,8 @@ void debug_describe_reference(char* buf, const struct pipe_reference*ptr); void debug_describe_resource(char* buf, const struct pipe_resource *ptr); void debug_describe_surface(char* buf, const struct pipe_surface *ptr); void debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr); +void debug_describe_so_target(char* buf, + const struct pipe_stream_output_target *ptr); #ifdef __cplusplus } diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index ddb81b5..4428390 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -136,6 +136,18 @@ pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_ } static INLINE void +pipe_so_target_reference(struct pipe_stream_output_target **ptr, +
[Mesa-dev] [PATCH 5/8] noop: implement stream output
--- src/gallium/drivers/noop/noop_state.c | 35 + 1 files changed, 35 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/noop/noop_state.c b/src/gallium/drivers/noop/noop_state.c index 58ea8be..9d8dbfc 100644 --- a/src/gallium/drivers/noop/noop_state.c +++ b/src/gallium/drivers/noop/noop_state.c @@ -124,6 +124,7 @@ static struct pipe_surface *noop_create_surface(struct pipe_context *ctx, return surface; } + static void noop_set_vs_sampler_view(struct pipe_context *ctx, unsigned count, struct pipe_sampler_view **views) { @@ -244,6 +245,37 @@ static void *noop_create_shader_state(struct pipe_context *ctx, return nstate; } +static struct pipe_stream_output_target *noop_create_stream_output_target( + struct pipe_context *ctx, + struct pipe_resource *res, + unsigned buffer_offset, + unsigned buffer_size) +{ + struct pipe_stream_output_target *t = CALLOC_STRUCT(pipe_stream_output_target); + if (!t) + return NULL; + + pipe_reference_init(&t->reference, 1); + pipe_resource_reference(&t->buffer, res); + t->buffer_offset = buffer_offset; + t->buffer_size = buffer_size; + return t; +} + +static void noop_stream_output_target_destroy(struct pipe_context *ctx, + struct pipe_stream_output_target *t) +{ + pipe_resource_reference(&t->buffer, NULL); + FREE(t); +} + +static void noop_set_stream_output_targets(struct pipe_context *ctx, + unsigned num_targets, + struct pipe_stream_output_target **targets, + unsigned append_bitmask) +{ +} + void noop_init_state_functions(struct pipe_context *ctx); void noop_init_state_functions(struct pipe_context *ctx) @@ -289,4 +321,7 @@ void noop_init_state_functions(struct pipe_context *ctx) ctx->surface_destroy = noop_surface_destroy; ctx->draw_vbo = noop_draw_vbo; ctx->redefine_user_buffer = u_default_redefine_user_buffer; + ctx->create_stream_output_target = noop_create_stream_output_target; + ctx->stream_output_target_destroy = noop_stream_output_target_destroy; + ctx->set_stream_output_targets = noop_set_stream_output_targets; } -- 1.7.5.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 6/8] u_blitter: restore stream output targets
--- src/gallium/auxiliary/util/u_blitter.c | 18 ++ src/gallium/auxiliary/util/u_blitter.h | 18 ++ 2 files changed, 36 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index f5cc5cb..c0c477b 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -109,6 +109,7 @@ struct blitter_context_priv boolean has_geometry_shader; boolean vertex_has_integers; + boolean has_stream_out; }; static void blitter_draw_rectangle(struct blitter_context *blitter, @@ -148,6 +149,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) ctx->base.saved_num_sampler_views = ~0; ctx->base.saved_num_sampler_states = ~0; ctx->base.saved_num_vertex_buffers = ~0; + ctx->base.saved_num_so_targets = ~0; ctx->has_geometry_shader = pipe->screen->get_shader_param(pipe->screen, PIPE_SHADER_GEOMETRY, @@ -155,6 +157,9 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) ctx->vertex_has_integers = pipe->screen->get_shader_param(pipe->screen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_INTEGERS); + ctx->has_stream_out = + pipe->screen->get_param(pipe->screen, + PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS) != 0; /* blend state objects */ memset(&blend, 0, sizeof(blend)); @@ -319,6 +324,7 @@ static void blitter_check_saved_vertex_states(struct blitter_context_priv *ctx) ctx->base.saved_velem_state != INVALID_PTR && ctx->base.saved_vs != INVALID_PTR && (!ctx->has_geometry_shader || ctx->base.saved_gs != INVALID_PTR) && + (!ctx->has_stream_out || ctx->base.saved_num_so_targets != ~0) && ctx->base.saved_rs_state != INVALID_PTR); } @@ -354,6 +360,18 @@ static void blitter_restore_vertex_states(struct blitter_context_priv *ctx) ctx->base.saved_gs = INVALID_PTR; } + /* Stream outputs. */ + if (ctx->has_stream_out) { + pipe->set_stream_output_targets(pipe, + ctx->base.saved_num_so_targets, + ctx->base.saved_so_targets, ~0); + + for (i = 0; i < ctx->base.saved_num_so_targets; i++) + pipe_so_target_reference(&ctx->base.saved_so_targets[i], NULL); + + ctx->base.saved_num_so_targets = ~0; + } + /* Rasterizer. */ pipe->bind_rasterizer_state(pipe, ctx->base.saved_rs_state); ctx->base.saved_rs_state = INVALID_PTR; diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index 3e1457a..d02cfaf 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -104,6 +104,9 @@ struct blitter_context int saved_num_vertex_buffers; struct pipe_vertex_buffer saved_vertex_buffers[PIPE_MAX_ATTRIBS]; + + int saved_num_so_targets; + struct pipe_stream_output_target *saved_so_targets[PIPE_MAX_SO_BUFFERS]; }; /** @@ -131,6 +134,7 @@ struct pipe_context *util_blitter_get_pipe(struct blitter_context *blitter) * - vertex elements * - vertex shader * - geometry shader (if supported) + * - stream output targets (if supported) * - rasterizer state */ @@ -379,6 +383,20 @@ util_blitter_save_vertex_buffers(struct blitter_context *blitter, num_vertex_buffers); } +static INLINE void +util_blitter_save_so_targets(struct blitter_context *blitter, + int num_targets, + struct pipe_stream_output_target **targets) +{ + unsigned i; + assert(num_targets <= Elements(blitter->saved_so_targets)); + + blitter->saved_num_so_targets = num_targets; + for (i = 0; i < num_targets; i++) + pipe_so_target_reference(&blitter->saved_so_targets[i], + targets[i]); +} + #ifdef __cplusplus } #endif -- 1.7.5.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 7/8] u_blitter: implement copy_buffer using stream output
--- src/gallium/auxiliary/util/u_blitter.c | 87 +++- src/gallium/auxiliary/util/u_blitter.h | 11 2 files changed, 96 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index c0c477b..f1b9dad 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -63,6 +63,7 @@ struct blitter_context_priv /* Constant state objects. */ /* Vertex shaders. */ void *vs; /**< Vertex shader which passes {pos, generic} to the output.*/ + void *vs_pos_only; /**< Vertex shader which passes pos to the output.*/ /* Fragment shaders. */ /* The shader at index i outputs color to color buffers 0,1,...,i-1. */ @@ -87,15 +88,18 @@ struct blitter_context_priv void *dsa_keep_depth_stencil; void *dsa_keep_depth_write_stencil; + /* Vertex elements states. */ void *velem_state; void *velem_uint_state; void *velem_sint_state; + void *velem_state_readbuf; /* Sampler state. */ void *sampler_state; /* Rasterizer state. */ void *rs_state; + void *rs_discard_state; /* Viewport state. */ struct pipe_viewport_state viewport; @@ -210,7 +214,12 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) rs_state.flatshade = 1; ctx->rs_state = pipe->create_rasterizer_state(pipe, &rs_state); - /* vertex elements state */ + if (ctx->has_stream_out) { + rs_state.rasterizer_discard = 1; + ctx->rs_discard_state = pipe->create_rasterizer_state(pipe, &rs_state); + } + + /* vertex elements states */ memset(&velem[0], 0, sizeof(velem[0]) * 2); for (i = 0; i < 2; i++) { velem[i].src_offset = i * 4 * sizeof(float); @@ -234,9 +243,14 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) ctx->velem_uint_state = pipe->create_vertex_elements_state(pipe, 2, &velem[0]); } + if (ctx->has_stream_out) { + velem[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + ctx->velem_state_readbuf = pipe->create_vertex_elements_state(pipe, 1, &velem[0]); + } + /* fragment shaders are created on-demand */ - /* vertex shader */ + /* vertex shaders */ { const uint semantic_names[] = { TGSI_SEMANTIC_POSITION, TGSI_SEMANTIC_GENERIC }; @@ -245,6 +259,20 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) util_make_vertex_passthrough_shader(pipe, 2, semantic_names, semantic_indices); } + if (ctx->has_stream_out) { + struct pipe_stream_output_info so; + const uint semantic_names[] = { TGSI_SEMANTIC_POSITION }; + const uint semantic_indices[] = { 0 }; + + memset(&so, 0, sizeof(so)); + so.num_outputs = 1; + so.register_mask[0] = TGSI_WRITEMASK_XYZW; + so.stride = 4; + + ctx->vs_pos_only = + util_make_vertex_passthrough_shader_with_so(pipe, 1, semantic_names, + semantic_indices, &so); + } /* set invariant vertex coordinates */ for (i = 0; i < 4; i++) @@ -274,12 +302,18 @@ void util_blitter_destroy(struct blitter_context *blitter) pipe->delete_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_write_stencil); pipe->delete_rasterizer_state(pipe, ctx->rs_state); + if (ctx->rs_discard_state) + pipe->delete_rasterizer_state(pipe, ctx->rs_discard_state); pipe->delete_vs_state(pipe, ctx->vs); + if (ctx->vs_pos_only) + pipe->delete_vs_state(pipe, ctx->vs_pos_only); pipe->delete_vertex_elements_state(pipe, ctx->velem_state); if (ctx->vertex_has_integers) { pipe->delete_vertex_elements_state(pipe, ctx->velem_sint_state); pipe->delete_vertex_elements_state(pipe, ctx->velem_uint_state); } + if (ctx->velem_state_readbuf) + pipe->delete_vertex_elements_state(pipe, ctx->velem_state_readbuf); for (i = 0; i < PIPE_MAX_TEXTURE_TYPES; i++) { if (ctx->fs_texfetch_col[i]) @@ -1178,3 +1212,52 @@ void util_blitter_custom_depth_stencil(struct blitter_context *blitter, blitter_restore_fb_state(ctx); blitter_unset_running_flag(ctx); } + +void util_blitter_copy_buffer(struct blitter_context *blitter, + struct pipe_resource *dst, + unsigned dstx, + struct pipe_resource *src, + unsigned srcx, + unsigned size) +{ + struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; + struct pipe_context *pipe = ctx->base.pipe; + struct pipe_vertex_buffer vb; + struct pipe_stream_output_target *so_target; + + /* Drivers not capable of Stream Out should not call this function +* in the first place. */ + assert(ctx->has_stream_out); + + /* Some alignment is required. */ + if (srcx % 4
[Mesa-dev] [PATCH 8/8] st/mesa: implement EXT_transform_feedback and ARB_transform_feedback2
--- src/gallium/auxiliary/cso_cache/cso_context.c | 101 ++ src/gallium/auxiliary/cso_cache/cso_context.h |8 ++ src/gallium/auxiliary/util/u_blit.c |6 + src/gallium/auxiliary/util/u_gen_mipmap.c |3 + src/mesa/state_tracker/st_atom_rasterizer.c |7 +- src/mesa/state_tracker/st_cb_bitmap.c |3 + src/mesa/state_tracker/st_cb_clear.c |3 + src/mesa/state_tracker/st_cb_drawpixels.c |3 + src/mesa/state_tracker/st_cb_drawtex.c|3 + src/mesa/state_tracker/st_cb_xformfb.c| 142 +++-- src/mesa/state_tracker/st_cb_xformfb.h| 12 ++ src/mesa/state_tracker/st_draw.c | 12 ++- src/mesa/state_tracker/st_extensions.c| 16 +++ src/mesa/state_tracker/st_glsl_to_tgsi.cpp| 25 + src/mesa/state_tracker/st_glsl_to_tgsi.h |6 + src/mesa/state_tracker/st_program.c | 12 ++ 16 files changed, 325 insertions(+), 37 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index b2a2b79..49318e7 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -79,6 +79,7 @@ struct cso_context { struct cso_cache *cache; boolean has_geometry_shader; + boolean has_streamout; struct sampler_info fragment_samplers; struct sampler_info vertex_samplers; @@ -89,6 +90,12 @@ struct cso_context { uint nr_vertex_buffers_saved; struct pipe_vertex_buffer vertex_buffers_saved[PIPE_MAX_ATTRIBS]; + unsigned nr_so_targets; + struct pipe_stream_output_target *so_targets[PIPE_MAX_SO_BUFFERS]; + + unsigned nr_so_targets_saved; + struct pipe_stream_output_target *so_targets_saved[PIPE_MAX_SO_BUFFERS]; + /** Current and saved state. * The saved state is used as a 1-deep stack. */ @@ -276,6 +283,10 @@ struct cso_context *cso_create_context( struct pipe_context *pipe ) PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) { ctx->has_geometry_shader = TRUE; } + if (pipe->screen->get_param(pipe->screen, + PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS) != 0) { + ctx->has_streamout = TRUE; + } return ctx; @@ -306,6 +317,7 @@ void cso_release_all( struct cso_context *ctx ) ctx->pipe->set_fragment_sampler_views(ctx->pipe, 0, NULL); if (ctx->pipe->set_vertex_sampler_views) ctx->pipe->set_vertex_sampler_views(ctx->pipe, 0, NULL); + ctx->pipe->set_stream_output_targets(ctx->pipe, 0, NULL, 0); } /* free fragment samplers, views */ @@ -332,6 +344,11 @@ void cso_release_all( struct cso_context *ctx ) &ctx->nr_vertex_buffers_saved, NULL, 0); + for (i = 0; i < PIPE_MAX_SO_BUFFERS; i++) { + pipe_so_target_reference(&ctx->so_targets[i], NULL); + pipe_so_target_reference(&ctx->so_targets_saved[i], NULL); + } + if (ctx->cache) { cso_cache_delete( ctx->cache ); ctx->cache = NULL; @@ -1311,3 +1328,87 @@ cso_restore_vertex_sampler_views(struct cso_context *ctx) restore_sampler_views(ctx, &ctx->vertex_samplers, ctx->pipe->set_vertex_sampler_views); } + + +void +cso_set_stream_outputs(struct cso_context *ctx, + unsigned num_targets, + struct pipe_stream_output_target **targets, + unsigned append_bitmask) +{ + struct pipe_context *pipe = ctx->pipe; + uint i; + + if (!ctx->has_streamout) { + assert(num_targets == 0); + return; + } + + if (ctx->nr_so_targets == 0 && num_targets == 0) { + /* Nothing to do. */ + return; + } + + /* reference new targets */ + for (i = 0; i < num_targets; i++) { + pipe_so_target_reference(&ctx->so_targets[i], targets[i]); + } + /* unref extra old targets, if any */ + for (; i < ctx->nr_so_targets; i++) { + pipe_so_target_reference(&ctx->so_targets[i], NULL); + } + + pipe->set_stream_output_targets(pipe, num_targets, targets, + append_bitmask); + ctx->nr_so_targets = num_targets; +} + +void +cso_save_stream_outputs(struct cso_context *ctx) +{ + uint i; + + if (!ctx->has_streamout) { + return; + } + + ctx->nr_so_targets_saved = ctx->nr_so_targets; + + for (i = 0; i < ctx->nr_so_targets; i++) { + assert(!ctx->so_targets_saved[i]); + pipe_so_target_reference(&ctx->so_targets_saved[i], ctx->so_targets[i]); + } +} + +void +cso_restore_stream_outputs(struct cso_context *ctx) +{ + struct pipe_context *pipe = ctx->pipe; + uint i; + + if (!ctx->has_streamout) { + return; + } + + if (ctx->nr_so_targets == 0 && ctx->nr_so_targets_saved == 0) { + /* Nothing to do. */ + return; + } + + for (i = 0; i < ctx->nr_so_targets_saved; i++) { + pipe_so_target_reference(&ctx->so_targets
Re: [Mesa-dev] [PATCH 1/3] mesa: rename the AMD_conservative_depth extension flag to ARB
On 11/19/2011 09:54 AM, Marek Olšák wrote: > --- > src/glsl/glcpp/glcpp-parse.y|2 +- > src/glsl/glsl_parser_extras.cpp |4 ++-- > src/mesa/main/extensions.c |4 ++-- > src/mesa/main/mtypes.h |2 +- > 4 files changed, 6 insertions(+), 6 deletions(-) For the series: Reviewed-by: Kenneth Graunke Thanks for fixing this, Marek! ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa : move bindbuffer{base, range} from transformfeedback.c
Le vendredi 18 novembre 2011 à 13:40 -0700, Brian Paul a écrit : > On 11/18/2011 01:11 PM, vlj wrote: > > BindBuffer* functions are part of tfb extension. They are however > > used by others extensions such as uniform buffer object. > > This patch moves the BindBuffer* definition to to bufferobj.c > > where it acts as a dispatcher calling original tfb function ; > > BindBuffer* functions can be used by others extensions, even if > > FEATURE_EXT_transform_feedback is not defined. > > --- > > src/mesa/main/api_exec.c |2 + > > src/mesa/main/bufferobj.c | 144 > > + > > src/mesa/main/bufferobj.h | 12 +++ > > src/mesa/main/transformfeedback.c | 109 +--- > > src/mesa/main/transformfeedback.h |7 -- > > 5 files changed, 159 insertions(+), 115 deletions(-) > > > > diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c > > index 93214dd..0bbfa8b 100644 > > --- a/src/mesa/main/api_exec.c > > +++ b/src/mesa/main/api_exec.c > > @@ -590,6 +590,8 @@ _mesa_create_exec_table(void) > > SET_IsBufferARB(exec, _mesa_IsBufferARB); > > SET_MapBufferARB(exec, _mesa_MapBufferARB); > > SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB); > > + SET_BindBufferRangeEXT(exec, _mesa_BindBufferRange); > > + SET_BindBufferBaseEXT(exec, _mesa_BindBufferBase); > > #endif > > > > /* ARB 29. GL_ARB_occlusion_query */ > > diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c > > index 431eafd..0908ce6 100644 > > --- a/src/mesa/main/bufferobj.c > > +++ b/src/mesa/main/bufferobj.c > > @@ -703,6 +703,150 @@ _mesa_BindBufferARB(GLenum target, GLuint buffer) > > bind_buffer_object(ctx, target, buffer); > > } > > > > +/** > > + * Helper used by BindBufferRange() and BindBufferBase(). > > + */ > > +void > > +bind_buffer_range(struct gl_context *ctx, GLuint index, > > + struct gl_buffer_object *bufObj, > > + GLintptr offset, GLsizeiptr size); > > > bind_buffer_range() should be moved into bufferobj.c and it should be > static. There's no reason to keep it in transformfeedback.c > I wanted to avoid moving BindBufferOffset, as I'm not sure it is shared by another extension ; it calls bind_buffer_range. > > > + > > +/** > > + * Several extensions declare a BindBufferBase API function, > > + * this one dispatchs call according to target > > + */ > > +void GLAPIENTRY > > +_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer) > > +{ > > + > > +/** > > + * Declare everything here to avoid declaring inside switch statement > > + */ > > +#if FEATURE_EXT_transform_feedback > > + struct gl_transform_feedback_object *obj; > > + struct gl_buffer_object *bufObj; > > + GLsizeiptr size; > > +#endif > > Move these xfb-related variables down into the switch case - the only > place they're used. > > > > + > > + GET_CURRENT_CONTEXT(ctx); > > + switch (target) { > > +#if FEATURE_EXT_transform_feedback > > + case GL_TRANSFORM_FEEDBACK_BUFFER: > > + /** > > + * Specify a buffer object to receive vertex shader results. > > + * As in BindBufferRange, but start at offset = 0. > > + */ > > + obj = ctx->TransformFeedback.CurrentObject; > > + > > + if (obj->Active) { > > +_mesa_error(ctx, GL_INVALID_OPERATION, > > +"glBindBufferBase(transform feedback active)"); > > +return; > > + } > > + > > + if (index>= ctx->Const.MaxTransformFeedbackSeparateAttribs) { > > +_mesa_error(ctx, GL_INVALID_VALUE, > > "glBindBufferBase(index=%d)", index); > > +return; > > + } > > + > > + bufObj = _mesa_lookup_bufferobj(ctx, buffer); > > + if (!bufObj) { > > +_mesa_error(ctx, GL_INVALID_OPERATION, > > +"glBindBufferBase(invalid buffer=%u)", buffer); > > +return; > > + } > > The buffer lookup and error check should be after the switch(target) > because it'll be needed for UBO as well. > > > > + /* default size is the buffer size rounded down to nearest > > + * multiple of four. > > + */ > > + size = bufObj->Size& ~0x3; > > + > > + bind_buffer_range(ctx, index, bufObj, 0, size); > > This call should also be placed after the switch. bind_buffer_range is using tfb structure, I put it in another switch. > > > > + break; > > +#endif > > + default: > > + _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferBase(target)"); > > + break; > > + } > > + return; > > +} > > + > > +extern void > > +BindBufferRange_TFB(GLenum target, GLuint index, > > + GLuint buffer, GLintptr offset, GLsizeiptr size); > > + > > +/** > > + * Several extensions declare a BindBufferRange API function, > > + * this one dispatchs call according to target > > + */ > > +voi
[Mesa-dev] [PATCH] mesa : move bindbuffer{base, range} from transformfeedback.c
BindBuffer* functions are part of tfb extension. They are however used by others extensions such as uniform buffer object. This patch moves the BindBuffer* definition to to bufferobj.c where it acts as a dispatcher calling original tfb function ; BindBuffer* functions can be used by others extensions, even if FEATURE_EXT_transform_feedback is not defined. --- src/mapi/glapi/gen/EXT_transform_feedback.xml | 21 --- src/mapi/glapi/gen/gl_API.xml | 21 +++ src/mesa/main/api_exec.c |3 + src/mesa/main/bufferobj.c | 215 + src/mesa/main/bufferobj.h | 12 ++ src/mesa/main/transformfeedback.c | 188 - src/mesa/main/transformfeedback.h | 11 -- 7 files changed, 251 insertions(+), 220 deletions(-) diff --git a/src/mapi/glapi/gen/EXT_transform_feedback.xml b/src/mapi/glapi/gen/EXT_transform_feedback.xml index 051f1e0..ea902f3 100644 --- a/src/mapi/glapi/gen/EXT_transform_feedback.xml +++ b/src/mapi/glapi/gen/EXT_transform_feedback.xml @@ -24,27 +24,6 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index a9be003..d6c926d 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -4933,6 +4933,27 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 93214dd..023d83f 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -590,6 +590,9 @@ _mesa_create_exec_table(void) SET_IsBufferARB(exec, _mesa_IsBufferARB); SET_MapBufferARB(exec, _mesa_MapBufferARB); SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB); + SET_BindBufferRangeEXT(exec, _mesa_BindBufferRange); + SET_BindBufferBaseEXT(exec, _mesa_BindBufferBase); + SET_BindBufferOffsetEXT(exec, _mesa_BindBufferOffsetEXT); #endif /* ARB 29. GL_ARB_occlusion_query */ diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 431eafd..d584bac 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -703,6 +703,221 @@ _mesa_BindBufferARB(GLenum target, GLuint buffer) bind_buffer_object(ctx, target, buffer); } +/** + * Helper used by BindBufferRange() and BindBufferBase() for + * TFB operations. + */ +static void +bind_buffer_range_tfb(struct gl_context *ctx, GLuint index, + struct gl_buffer_object *bufObj, + GLintptr offset, GLsizeiptr size) +{ + struct gl_transform_feedback_object *obj = + ctx->TransformFeedback.CurrentObject; + + /* The general binding point */ + _mesa_reference_buffer_object(ctx, + &ctx->TransformFeedback.CurrentBuffer, + bufObj); + + /* The per-attribute binding point */ + _mesa_reference_buffer_object(ctx, + &obj->Buffers[index], + bufObj); + + obj->BufferNames[index] = bufObj->Name; + + obj->Offset[index] = offset; + obj->Size[index] = size; +} + +/** + * Several extensions declare a BindBufferBase API function, + * this one dispatchs call according to target. + * TRANSFORM_FEEDBACK: + *Specify a buffer object to receive vertex shader results. + *As in BindBufferRange, but start at offset = 0. + */ +void GLAPIENTRY +_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer) +{ + struct gl_buffer_object *bufObj; + GLsizeiptr size; + + GET_CURRENT_CONTEXT(ctx); + switch (target) { +#if FEATURE_EXT_transform_feedback + case GL_TRANSFORM_FEEDBACK_BUFFER: + { /* GCC does not like declaration after a label, add a dummy block */} + struct gl_transform_feedback_object *obj; + obj = ctx->TransformFeedback.CurrentObject; + + if (obj->Active) { +_mesa_error(ctx, GL_INVALID_OPERATION, +"glBindBufferBase(transform feedback active)"); +return; + } + + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { +_mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferBase(index=%d)", index); +return; + } + + break; +#endif + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferBase(target)"); + break; + } + + bufObj = _mesa_lookup_bufferobj(ctx, buffer); + if (!bufObj) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBindBufferBase(invalid buffer=%u)", buffer); + return; + } + + switch (target) { +#if FEATURE_EXT_transform_feedback + case GL_TRANSFORM_FEEDBACK_BUFFER: + /* default size is the buffer size rounded
Re: [Mesa-dev] [PATCH] mesa : move bindbuffer{base, range} from transformfeedback.c
On Fri, Nov 18, 2011 at 3:11 PM, vlj wrote: You should configure git with your name and email address. See http://help.github.com/set-your-user-name-email-and-github-token/ Some projects (like the Linux kernel) won't even accept changes from people unless they've configured their names. Matt ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gallium: separate out floating-point CAPs into its own enum
The motivation behind this is to add some self-documentation in the code about how each CAP can be used. The idea is: - enum pipe_cap is only valid in get_param - enum pipe_cap_float is only valid in get_paramf Which CAPs are floating-point have been determined based on how everybody except svga implemented the functions. svga have been modified to match all the other drivers. Besides that, the floating-point CAPs are now prefixed with PIPE_CAP_FLOAT_. --- src/gallium/auxiliary/util/u_caps.c| 10 src/gallium/docs/source/screen.rst | 28 + src/gallium/drivers/cell/ppu/cell_screen.c | 14 +- src/gallium/drivers/galahad/glhd_screen.c |2 +- src/gallium/drivers/i915/i915_screen.c | 14 +- src/gallium/drivers/i965/brw_screen.c | 14 +- src/gallium/drivers/identity/id_screen.c |2 +- src/gallium/drivers/llvmpipe/lp_screen.c | 22 src/gallium/drivers/noop/noop_pipe.c |3 +- src/gallium/drivers/nv50/nv50_screen.c | 14 +- src/gallium/drivers/nvc0/nvc0_screen.c | 14 +- src/gallium/drivers/nvfx/nvfx_screen.c | 14 +- src/gallium/drivers/r300/r300_screen.c | 23 + src/gallium/drivers/r300/r300_state.c |2 +- src/gallium/drivers/r600/r600_pipe.c | 15 ++- src/gallium/drivers/rbug/rbug_screen.c |2 +- src/gallium/drivers/softpipe/sp_screen.c | 14 +- src/gallium/drivers/svga/svga_screen.c | 37 src/gallium/drivers/trace/tr_screen.c |2 +- src/gallium/include/pipe/p_defines.h | 30 ++ src/gallium/include/pipe/p_screen.h|2 +- src/mesa/state_tracker/st_extensions.c | 17 22 files changed, 161 insertions(+), 134 deletions(-) diff --git a/src/gallium/auxiliary/util/u_caps.c b/src/gallium/auxiliary/util/u_caps.c index 75677b2..064fe3d 100644 --- a/src/gallium/auxiliary/util/u_caps.c +++ b/src/gallium/auxiliary/util/u_caps.c @@ -122,7 +122,7 @@ static unsigned caps_dx_9_1[] = { UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 12),/* 2048 */ UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 9), /* 256 */ UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10), /* 512 */ - UTIL_CHECK_FLOAT(MAX_TEXTURE_ANISOTROPY, 2), + UTIL_CHECK_FLOAT(FLOAT_MAX_TEXTURE_ANISOTROPY, 2), UTIL_CHECK_TERMINATE }; @@ -134,7 +134,7 @@ static unsigned caps_dx_9_2[] = { UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 12),/* 2048 */ UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 9), /* 256 */ UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10), /* 512 */ - UTIL_CHECK_FLOAT(MAX_TEXTURE_ANISOTROPY, 16), + UTIL_CHECK_FLOAT(FLOAT_MAX_TEXTURE_ANISOTROPY, 16), UTIL_CHECK_TERMINATE }; @@ -147,7 +147,7 @@ static unsigned caps_dx_9_3[] = { UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 13),/* 4096 */ UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 9), /* 256 */ UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10), /* 512 */ - UTIL_CHECK_FLOAT(MAX_TEXTURE_ANISOTROPY, 16), + UTIL_CHECK_FLOAT(FLOAT_MAX_TEXTURE_ANISOTROPY, 16), UTIL_CHECK_TERMINATE }; @@ -160,7 +160,7 @@ static unsigned caps_dx_10[] = { UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 14),/* 8192 */ UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 12),/* 2048 */ UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 14), /* 8192 */ - UTIL_CHECK_FLOAT(MAX_TEXTURE_ANISOTROPY, 16), + UTIL_CHECK_FLOAT(FLOAT_MAX_TEXTURE_ANISOTROPY, 16), UTIL_CHECK_UNIMPLEMENTED, /* XXX Unimplemented features in Gallium */ UTIL_CHECK_TERMINATE }; @@ -174,7 +174,7 @@ static unsigned caps_dx_11[] = { UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 14),/* 16384 */ UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 12),/* 2048 */ UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 14), /* 16384 */ - UTIL_CHECK_FLOAT(MAX_TEXTURE_ANISOTROPY, 16), + UTIL_CHECK_FLOAT(FLOAT_MAX_TEXTURE_ANISOTROPY, 16), UTIL_CHECK_FORMAT(B8G8R8A8_UNORM), UTIL_CHECK_UNIMPLEMENTED, /* XXX Unimplemented features in Gallium */ UTIL_CHECK_TERMINATE diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 1272171..d5a2bbe 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -74,20 +74,26 @@ The integer capabilities: * ``PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER``: Whether the TGSI property FS_COORD_PIXEL_CENTER with value INTEGER is supported. -The floating-point capabilities: -* ``PIPE_CAP_MAX_LINE_WIDTH``: The maximum width of a regular line. -* ``PIPE_CAP_MAX_LINE_WIDTH_AA``: The maximum width of a smoothed line. -* ``PIPE_CAP_MAX_POINT_WIDTH``: The maximum width and height of a point. -* ``PIPE_CAP_MAX_POINT_WIDTH_AA``: The maximum width and height of a smoothed point. -* ``PIPE_CAP_MAX_TEXTURE_ANISOTROPY``: The maximum level of anisotropy that can be +.. _pipe_cap_float: + +PIPE_CAP_FLOAT_* + + +The f