Re: [Mesa-dev] Fix the build on Windows
On 08/17/2018 09:16 AM, Mathieu Bridon wrote: This is follow up to my recent patches which made the Python build scripts compatible with both Python 2 and 3, then moved the Meson build system to using Python 3 for them. Unfortunately, one thing I hadn't tested was running them on Windows, where the changes broke the build. See the exchange with Jose for the details: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Farchives%2Fmesa-dev%2F2018-August%2F202847.html&data=02%7C01%7Cbrianp%40vmware.com%7C01cd239cdd5b4b9c156608d604547cd7%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C636701158254371166&sdata=nLN%2FkP37AyHSV3z4XwjdhUN3suDGUlfZDxWRWn39WhI%3D&reserved=0 These 2 patches have already been tested by Jose, who confirms they fix the issue he countered. Do you need one of us to push the patches for you? -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gl.h: define GLeglImageOES depending on GL_EXT_EGL_image_storage
To avoid duplicate typedef with the definition in glext.h V2: test for both GL_OES_EGL_image and GL_EXT_EGL_image_storage in case both the GL and GLES headers are included. Per Emil. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107488 Tested-by: Vinson Lee --- include/GL/gl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/GL/gl.h b/include/GL/gl.h index f5bac36..d4475db 100644 --- a/include/GL/gl.h +++ b/include/GL/gl.h @@ -2086,7 +2086,7 @@ typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLen /* GL_OES_EGL_image */ -#ifndef GL_OES_EGL_image +#if !defined(GL_OES_EGL_image) && !defined(GL_EXT_EGL_image_storage) typedef void* GLeglImageOES; #endif -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] svga: add TGSI_SEMANTIC_FACE switch case in svga_swtnl_update_vdecl()
Fixes failed assertion running Piglit polygon-mode-face test. Though, the test still does not pass. Reviewed-by: Neha Bhende Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_swtnl_state.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/svga/svga_swtnl_state.c b/src/gallium/drivers/svga/svga_swtnl_state.c index 06a9be8..816fef1 100644 --- a/src/gallium/drivers/svga/svga_swtnl_state.c +++ b/src/gallium/drivers/svga/svga_swtnl_state.c @@ -288,6 +288,7 @@ svga_swtnl_update_vdecl(struct svga_context *svga) nr_decls++; break; case TGSI_SEMANTIC_POSITION: + case TGSI_SEMANTIC_FACE: /* generated internally, not a vertex shader output */ break; default: -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] xlib: remove unused Fake_glXGetAGPOffsetMESA() function
To silence compiler warning. --- src/mesa/drivers/x11/fakeglx.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 233b6e2..b946521 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -2716,16 +2716,6 @@ Fake_glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ) -/*** GLX_MESA_agp_offset ***/ - -static GLuint -Fake_glXGetAGPOffsetMESA( const GLvoid *pointer ) -{ - (void) pointer; - return ~0; -} - - /*** GLX_EXT_texture_from_pixmap ***/ static void -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gl.h: define GLeglImageOES depending on GL_EXT_EGL_image_storage
To avoid duplicate typedef with the definition in glext.h Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107488 Tested-by: Vinson Lee --- include/GL/gl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/GL/gl.h b/include/GL/gl.h index f5bac36..0f7ae70 100644 --- a/include/GL/gl.h +++ b/include/GL/gl.h @@ -2086,7 +2086,7 @@ typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLen /* GL_OES_EGL_image */ -#ifndef GL_OES_EGL_image +#ifndef GL_EXT_EGL_image_storage typedef void* GLeglImageOES; #endif -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] util: return 0 for NaNs in float_to_ubyte
On 08/02/2018 09:36 PM, srol...@vmware.com wrote: From: Roland Scheidegger d3d10 requires NaNs to get converted to 0 for float->unorm conversions (and float->int etc.). GL spec probably doesn't care in general, but it would make sense to have reasonable behavior in any case imho - the old code was converting negative NaNs to 0, and positive NaNs to 255. (Note that using float comparison isn't actually all that much more effort in any case, at least with sse2 it's just float comparison (ucommiss) instead of int one - I converted the second comparison to float too simply because it saves the probably somewhat expensive transfer of the float from simd to int domain (with sse2 via stack), so the generated code actually has 2 less instructions, although float comparisons are more expensive than int ones.) --- src/gallium/auxiliary/util/u_math.h | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 79869a1..712305c 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -360,7 +360,6 @@ uif(uint32_t ui) /** * Convert ubyte to float in [0, 1]. - * XXX a 256-entry lookup table would be slightly faster. */ static inline float ubyte_to_float(ubyte ub) @@ -375,16 +374,16 @@ ubyte_to_float(ubyte ub) static inline ubyte float_to_ubyte(float f) { - union fi tmp; - - tmp.f = f; - if (tmp.i < 0) { + /* return 0 for NaN too */ + if (!(f > 0.0f)) { return (ubyte) 0; } - else if (tmp.i >= 0x3f80 /* 1.0f */) { + else if (f >= 1.0f) { return (ubyte) 255; } else { + union fi tmp; + tmp.f = f; tmp.f = tmp.f * (255.0f/256.0f) + 32768.0f; return (ubyte) tmp.i; } Looks good. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: add switch case for GL 2.0 in _mesa_compute_version()
Previously, I added a switch case for GL 2.1 (ed7a0770b881791dd697f3). I don't know of any driver which only supports GL 2.0, but adding this switch case avoids a failure if the app queries GL_SHADING_LANGUAGE_VERSION. --- src/mesa/main/version.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 2c5bd77..9df8c11 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -617,6 +617,8 @@ _mesa_compute_version(struct gl_context *ctx) */ if (_mesa_is_desktop_gl(ctx)) { switch (ctx->Version) { + case 20: + /* fall-through, GLSL 1.20 is the minimum we support */ case 21: ctx->Const.GLSLVersion = 120; break; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/8] GL_AMD_framebuffer_multisample_advanced for RadeonSI
On 08/01/2018 05:25 PM, Marek Olšák wrote: Hi, This implements GL_AMD_framebuffer_multisample_advanced, which is AMD EQAA. I have also sent out a piglit test that tests the new API. Please review. I did a quick read-through and it looks OK to me. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/6] glsl: use util_snprintf()
Series looks good. Thanks for doing this. Reviewed-by: Brian Paul On 08/01/2018 12:53 PM, Andres Gomez wrote: Instead of plain snprintf(). To fix the MSVC 2013 build. Fixes: 6ff0c6f4ebc ("gallium: move ddebug, noop, rbug, trace to auxiliary to improve build times") Cc: Marek Olšák Cc: Brian Paul Cc: Roland Scheidegger Signed-off-by: Andres Gomez --- .../glsl/ir_builder_print_visitor.cpp | 7 --- src/compiler/glsl/ir_print_visitor.cpp| 20 ++- src/compiler/glsl/link_interface_blocks.cpp | 5 +++-- src/compiler/glsl/linker.cpp | 5 +++-- .../glsl/opt_dead_builtin_varyings.cpp| 11 +- src/compiler/glsl_types.cpp | 13 ++-- 6 files changed, 34 insertions(+), 27 deletions(-) diff --git a/src/compiler/glsl/ir_builder_print_visitor.cpp b/src/compiler/glsl/ir_builder_print_visitor.cpp index dfe4bb27ac9..da04868652a 100644 --- a/src/compiler/glsl/ir_builder_print_visitor.cpp +++ b/src/compiler/glsl/ir_builder_print_visitor.cpp @@ -29,6 +29,7 @@ #include "glsl_parser_extras.h" #include "main/macros.h" #include "util/hash_table.h" +#include "util/u_string.h" class ir_builder_print_visitor : public ir_hierarchical_visitor { public: @@ -705,9 +706,9 @@ ir_builder_print_visitor::visit_leave(ir_call *ir) const struct hash_entry *const he = _mesa_hash_table_search(index_map, ir->return_deref); - snprintf(return_deref_string, sizeof(return_deref_string), - "operand(r%04X).val", - (unsigned)(uintptr_t) he->data); + util_snprintf(return_deref_string, sizeof(return_deref_string), +"operand(r%04X).val", +(unsigned)(uintptr_t) he->data); } else { strcpy(return_deref_string, "NULL"); } diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp index ea14cdeb6c7..1626657081e 100644 --- a/src/compiler/glsl/ir_print_visitor.cpp +++ b/src/compiler/glsl/ir_print_visitor.cpp @@ -27,6 +27,7 @@ #include "glsl_parser_extras.h" #include "main/macros.h" #include "util/hash_table.h" +#include "util/u_string.h" static void print_type(FILE *f, const glsl_type *t); @@ -167,31 +168,32 @@ void ir_print_visitor::visit(ir_variable *ir) char binding[32] = {0}; if (ir->data.binding) - snprintf(binding, sizeof(binding), "binding=%i ", ir->data.binding); + util_snprintf(binding, sizeof(binding), "binding=%i ", ir->data.binding); char loc[32] = {0}; if (ir->data.location != -1) - snprintf(loc, sizeof(loc), "location=%i ", ir->data.location); + util_snprintf(loc, sizeof(loc), "location=%i ", ir->data.location); char component[32] = {0}; if (ir->data.explicit_component || ir->data.location_frac != 0) - snprintf(component, sizeof(component), "component=%i ", ir->data.location_frac); + util_snprintf(component, sizeof(component), "component=%i ", +ir->data.location_frac); char stream[32] = {0}; if (ir->data.stream & (1u << 31)) { if (ir->data.stream & ~(1u << 31)) { - snprintf(stream, sizeof(stream), "stream(%u,%u,%u,%u) ", - ir->data.stream & 3, (ir->data.stream >> 2) & 3, - (ir->data.stream >> 4) & 3, (ir->data.stream >> 6) & 3); + util_snprintf(stream, sizeof(stream), "stream(%u,%u,%u,%u) ", + ir->data.stream & 3, (ir->data.stream >> 2) & 3, + (ir->data.stream >> 4) & 3, (ir->data.stream >> 6) & 3); } } else if (ir->data.stream) { - snprintf(stream, sizeof(stream), "stream%u ", ir->data.stream); + util_snprintf(stream, sizeof(stream), "stream%u ", ir->data.stream); } char image_format[32] = {0}; if (ir->data.image_format) { - snprintf(image_format, sizeof(image_format), "format=%x ", - ir->data.image_format); + util_snprintf(image_format, sizeof(image_format), "format=%x ", +ir->data.image_format); } const char *const cent = (ir->data.centroid) ? "centroid " : ""; diff --git a/src/compiler/glsl/link_interface_blocks.cpp b/src/compiler/glsl/link_interface_blocks.cpp index 7c3037e8975..e5eca9460e3 100644 --- a/src/compiler/glsl/link_interface_blocks.cpp +++ b/src/compiler/glsl/link_interface_blocks.cpp @@ -32,6 +32,7 @@ #include "main/macros.h" #include "main/mtypes.h" #include "util/hash_ta
[Mesa-dev] [PATCH] xlib: fix build break from _swrast_map_soft_renderbuffer() call
We need to pass the new flip_y argument. --- src/mesa/drivers/x11/xm_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index 97c7814..9c5383b 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -506,7 +506,7 @@ xmesa_MapRenderbuffer(struct gl_context *ctx, /* otherwise, this is an ordinary malloc-based renderbuffer */ _swrast_map_soft_renderbuffer(ctx, rb, x, y, w, h, mode, - mapOut, rowStrideOut); + mapOut, rowStrideOut, false); } -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium/auxiliary: Extern "c" fixes.
Reviewed-by: Brian Paul On 07/27/2018 02:20 PM, Alexander von Gluck IV wrote: Used by C++ code such as Haiku's renderer. --- src/gallium/auxiliary/driver_ddebug/dd_public.h | 8 src/gallium/auxiliary/driver_noop/noop_public.h | 8 .../auxiliary/target-helpers/inline_debug_helper.h | 9 - 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/driver_ddebug/dd_public.h b/src/gallium/auxiliary/driver_ddebug/dd_public.h index e660765575..31c139d6a1 100644 --- a/src/gallium/auxiliary/driver_ddebug/dd_public.h +++ b/src/gallium/auxiliary/driver_ddebug/dd_public.h @@ -30,7 +30,15 @@ struct pipe_screen; +#ifdef __cplusplus +extern "C" { +#endif + struct pipe_screen * ddebug_screen_create(struct pipe_screen *screen); +#ifdef __cplusplus +} +#endif + #endif /* DD_PUBLIC_H_ */ diff --git a/src/gallium/auxiliary/driver_noop/noop_public.h b/src/gallium/auxiliary/driver_noop/noop_public.h index 180ea597fa..46a7f4084f 100644 --- a/src/gallium/auxiliary/driver_noop/noop_public.h +++ b/src/gallium/auxiliary/driver_noop/noop_public.h @@ -23,7 +23,15 @@ #ifndef NOOP_PUBLIC_H #define NOOP_PUBLIC_H +#ifdef __cplusplus +extern "C" { +#endif + struct pipe_screen; struct pipe_screen *noop_screen_create(struct pipe_screen *screen); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/gallium/auxiliary/target-helpers/inline_debug_helper.h b/src/gallium/auxiliary/target-helpers/inline_debug_helper.h index 66d46de888..15659896b6 100644 --- a/src/gallium/auxiliary/target-helpers/inline_debug_helper.h +++ b/src/gallium/auxiliary/target-helpers/inline_debug_helper.h @@ -6,7 +6,6 @@ #include "util/u_debug.h" #include "util/u_tests.h" - /* Helper function to wrap a screen with * one or more debug drivers. */ @@ -16,6 +15,10 @@ #include "driver_rbug/rbug_public.h" #include "driver_noop/noop_public.h" +#ifdef __cplusplus +extern "C" { +#endif + /* * TODO: Audit the following *screen_create() - all of * them should return the original screen on failuire. @@ -35,3 +38,7 @@ debug_screen_wrap(struct pipe_screen *screen) } #endif + +#ifdef __cplusplus +} +#endif ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] mesa: add switch case for GL 2.1 in _mesa_compute_version()
The xlib/swrast driver only supports GL 2.1. This patch fixes a crash if the app calls glGetString(GL_SHADING_LANGUAGE_VERSION). --- src/mesa/main/version.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 58e68b4..2c5bd77 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -617,6 +617,9 @@ _mesa_compute_version(struct gl_context *ctx) */ if (_mesa_is_desktop_gl(ctx)) { switch (ctx->Version) { + case 21: + ctx->Const.GLSLVersion = 120; + break; case 30: ctx->Const.GLSLVersion = 130; break; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] swrast: fix crash in AA line code when there's no texture
Fixes a crash running the Piglit polygon-mode-facing test (and probably others). --- src/mesa/swrast/s_aalinetemp.h | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index bebb131..64767a3 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -179,10 +179,12 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) if (attr >= VARYING_SLOT_TEX0 && attr < VARYING_SLOT_VAR0) { const GLuint u = attr - VARYING_SLOT_TEX0; const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; -const struct gl_texture_image *texImage = - _mesa_base_tex_image(obj); -line.texWidth[attr] = (GLfloat) texImage->Width; -line.texHeight[attr] = (GLfloat) texImage->Height; +if (obj) { + const struct gl_texture_image *texImage = + _mesa_base_tex_image(obj); + line.texWidth[attr] = (GLfloat) texImage->Width; + line.texHeight[attr] = (GLfloat) texImage->Height; +} } ATTRIB_LOOP_END } -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] mesa: remove unneeded free() call in texstore_rgba()
The pointer will always be NULL since that's what we just tested for. --- src/mesa/main/texstore.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 31163f6..c7a459e 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -764,7 +764,6 @@ texstore_rgba(TEXSTORE_PARAMS) tempRGBA = malloc(4 * elementCount * sizeof(float)); if (!tempRGBA) { free(tempImage); - free(tempRGBA); return GL_FALSE; } -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] mesa: move var decls in texstore_rgba()
Move them closer to where they're first used. --- src/mesa/main/texstore.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index c7a459e..55f66c5 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -673,12 +673,10 @@ texstore_compressed(TEXSTORE_PARAMS) static GLboolean texstore_rgba(TEXSTORE_PARAMS) { - void *tempImage = NULL, *tempRGBA = NULL; - int srcRowStride, img; + void *tempImage = NULL; + int img; GLubyte *src, *dst; - uint32_t srcMesaFormat; uint8_t rebaseSwizzle[4]; - bool needRebase; bool transferOpsDone = false; /* We have to handle MESA_FORMAT_YCBCR manually because it is a special case @@ -748,15 +746,18 @@ texstore_rgba(TEXSTORE_PARAMS) } } - srcRowStride = + int srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); - srcMesaFormat = _mesa_format_from_format_and_type(srcFormat, srcType); + uint32_t srcMesaFormat = + _mesa_format_from_format_and_type(srcFormat, srcType); + dstFormat = _mesa_get_srgb_format_linear(dstFormat); /* If we have transferOps then we need to convert to RGBA float first, then apply transferOps, then do the conversion to dst */ + void *tempRGBA = NULL; if (!transferOpsDone && _mesa_texstore_needs_transfer_ops(ctx, baseInternalFormat, dstFormat)) { /* Allocate RGBA float image */ @@ -797,6 +798,7 @@ texstore_rgba(TEXSTORE_PARAMS) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0); + bool needRebase; if (_mesa_get_format_base_format(dstFormat) != baseInternalFormat) { needRebase = _mesa_compute_rgba2base2rgba_component_mapping(baseInternalFormat, -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] libGLw: Use newly introduced GLAPIVAR for variables
On 07/17/2018 06:47 PM, Stefan Dirsch wrote: On Tue, Jul 17, 2018 at 04:57:26PM -0600, Brian Paul wrote: Reviewed-by: Brian Paul Do you need me to push this for you? I'm afraid the answer is yes. Tried it but push hangs forever after this # git push --verbose Pushing to ssh://git.freedesktop.org/git/mesa/glw.git Counting objects: 4, done. Delta compression using up to 8 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 700 bytes | 350.00 KiB/s, done. Total 4 (delta 3), reused 0 (delta 0) Worked for me. My first guess was glw was migrated to gitlab.freedesktop.org, but it looks like it has not. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] libGLw: Use newly introduced GLAPIVAR for variables
On 07/17/2018 12:40 PM, Stefan Dirsch wrote: GLAPI doesn't have an 'extern' in some circumstances. This way, variable declarations become definitions (fdo #100916). Signed-off-by: Stefan Dirsch --- GLwDrawA.h | 10 -- GLwDrawAP.h | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/GLwDrawA.h b/GLwDrawA.h index b9711c2..316a70d 100644 --- a/GLwDrawA.h +++ b/GLwDrawA.h @@ -131,12 +131,18 @@ #define GLwNaccumAlphaSize"accumAlphaSize" #define GLwCAccumAlphaSize"AccumAlphaSize" +#if (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# define GLAPIVAR extern __attribute__((visibility("default"))) +#else +# define GLAPIVAR extern +#endif + #ifdef __GLX_MOTIF typedef struct _GLwMDrawingAreaClassRec *GLwMDrawingAreaWidgetClass; typedef struct _GLwMDrawingAreaRec*GLwMDrawingAreaWidget; -GLAPI WidgetClass glwMDrawingAreaWidgetClass; +GLAPIVAR WidgetClass glwMDrawingAreaWidgetClass; #else @@ -144,7 +150,7 @@ GLAPI WidgetClass glwMDrawingAreaWidgetClass; typedef struct _GLwDrawingAreaClassRec*GLwDrawingAreaWidgetClass; typedef struct _GLwDrawingAreaRec *GLwDrawingAreaWidget; -GLAPI WidgetClass glwDrawingAreaWidgetClass; +GLAPIVAR WidgetClass glwDrawingAreaWidgetClass; #endif diff --git a/GLwDrawAP.h b/GLwDrawAP.h index 4ff21b4..6d29849 100644 --- a/GLwDrawAP.h +++ b/GLwDrawAP.h @@ -59,7 +59,7 @@ typedef struct _GLwMDrawingAreaClassRec { } GLwMDrawingAreaClassRec; -GLAPI GLwMDrawingAreaClassRec glwMDrawingAreaClassRec; +GLAPIVAR GLwMDrawingAreaClassRec glwMDrawingAreaClassRec; /* XT */ @@ -70,7 +70,7 @@ typedef struct _GLwDrawingAreaClassRec { GLwDrawingAreaClassPart glwDrawingArea_class; } GLwDrawingAreaClassRec; -GLAPI GLwDrawingAreaClassRec glwDrawingAreaClassRec; +GLAPIVAR GLwDrawingAreaClassRec glwDrawingAreaClassRec; #endif Reviewed-by: Brian Paul Do you need me to push this for you? -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] libGLw: Use newly introduced GLAPIVAR for variables
On 07/17/2018 07:31 AM, Stefan Dirsch wrote: GLAPI doesn't have an 'extern' in some circumstances. This way, variable declarations become definitions (fdo #100916). Signed-off-by: Stefan Dirsch --- GLwDrawA.h | 12 ++-- GLwDrawAP.h | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/GLwDrawA.h b/GLwDrawA.h index b9711c2..21f70e7 100644 --- a/GLwDrawA.h +++ b/GLwDrawA.h @@ -131,12 +131,20 @@ #define GLwNaccumAlphaSize"accumAlphaSize" #define GLwCAccumAlphaSize"AccumAlphaSize" +#if (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# define GLAPIVAR extern __attribute__((visibility("default"))) +#endif + +#ifndef GLAPIVAR +#define GLAPIVAR extern +#endif Couldn't you just use #else instead of #endif / #ifndef GLAPIVAR ? -Brian + #ifdef __GLX_MOTIF typedef struct _GLwMDrawingAreaClassRec *GLwMDrawingAreaWidgetClass; typedef struct _GLwMDrawingAreaRec*GLwMDrawingAreaWidget; -GLAPI WidgetClass glwMDrawingAreaWidgetClass; +GLAPIVAR WidgetClass glwMDrawingAreaWidgetClass; #else @@ -144,7 +152,7 @@ GLAPI WidgetClass glwMDrawingAreaWidgetClass; typedef struct _GLwDrawingAreaClassRec*GLwDrawingAreaWidgetClass; typedef struct _GLwDrawingAreaRec *GLwDrawingAreaWidget; -GLAPI WidgetClass glwDrawingAreaWidgetClass; +GLAPIVAR WidgetClass glwDrawingAreaWidgetClass; #endif diff --git a/GLwDrawAP.h b/GLwDrawAP.h index 4ff21b4..6d29849 100644 --- a/GLwDrawAP.h +++ b/GLwDrawAP.h @@ -59,7 +59,7 @@ typedef struct _GLwMDrawingAreaClassRec { } GLwMDrawingAreaClassRec; -GLAPI GLwMDrawingAreaClassRec glwMDrawingAreaClassRec; +GLAPIVAR GLwMDrawingAreaClassRec glwMDrawingAreaClassRec; /* XT */ @@ -70,7 +70,7 @@ typedef struct _GLwDrawingAreaClassRec { GLwDrawingAreaClassPart glwDrawingArea_class; } GLwDrawingAreaClassRec; -GLAPI GLwDrawingAreaClassRec glwDrawingAreaClassRec; +GLAPIVAR GLwDrawingAreaClassRec glwDrawingAreaClassRec; #endif ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 1/4] softpipe: Add assert verifying successful pipe_transfer_map
On 07/17/2018 04:32 AM, Robert Foss wrote: This failure mode is a bit tricky to debug and manifests itself later as a null pointer dereference, for which finding the origin is needlessly tricky. Signed-off-by: Robert Foss --- Changes since v1: - Patch added src/gallium/drivers/softpipe/sp_tile_cache.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 351736ee421..211cc5ef4b0 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -209,6 +209,7 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc, PIPE_TRANSFER_UNSYNCHRONIZED, 0, 0, ps->width, ps->height, &tc->transfer[i]); +assert(tc->transfer_map[i]); } } else { Looks OK to me. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/wgl: check for NULL piAttribList in wglCreatePbufferARB()
Thanks for investigating that one! Reviewed-by: Brian Paul On Fri, Jul 6, 2018 at 5:09 PM, Charmaine Lee wrote: > Java2d opengl pipeline passes NULL piAttribList to > wglCreatePbufferARB(). So skip parsing the attribute list > if it is NULL. > --- > src/gallium/state_trackers/wgl/stw_ext_pbuffer.c | 80 > > 1 file changed, 41 insertions(+), 39 deletions(-) > > diff --git a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c > b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c > index d709faa..02ccb76 100644 > --- a/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c > +++ b/src/gallium/state_trackers/wgl/stw_ext_pbuffer.c > @@ -101,45 +101,47 @@ wglCreatePbufferARB(HDC hCurrentDC, >return 0; > } > > - for (piAttrib = piAttribList; *piAttrib; piAttrib++) { > - switch (*piAttrib) { > - case WGL_PBUFFER_LARGEST_ARB: > - piAttrib++; > - useLargest = *piAttrib; > - break; > - case WGL_TEXTURE_FORMAT_ARB: > - /* WGL_ARB_render_texture */ > - piAttrib++; > - textureFormat = *piAttrib; > - if (textureFormat != WGL_TEXTURE_RGB_ARB && > - textureFormat != WGL_TEXTURE_RGBA_ARB && > - textureFormat != WGL_NO_TEXTURE_ARB) { > - SetLastError(ERROR_INVALID_DATA); > - return 0; > - } > - break; > - case WGL_TEXTURE_TARGET_ARB: > - /* WGL_ARB_render_texture */ > - piAttrib++; > - textureTarget = *piAttrib; > - if (textureTarget != WGL_TEXTURE_CUBE_MAP_ARB && > - textureTarget != WGL_TEXTURE_1D_ARB && > - textureTarget != WGL_TEXTURE_2D_ARB && > - textureTarget != WGL_NO_TEXTURE_ARB) { > - SetLastError(ERROR_INVALID_DATA); > - return 0; > - } > - break; > - case WGL_MIPMAP_TEXTURE_ARB: > - /* WGL_ARB_render_texture */ > - piAttrib++; > - textureMipmap = !!*piAttrib; > - break; > - default: > - SetLastError(ERROR_INVALID_DATA); > - debug_printf("wgl: Unsupported attribute 0x%x in %s\n", > - *piAttrib, __func__); > - return 0; > + if (piAttribList) { > + for (piAttrib = piAttribList; *piAttrib; piAttrib++) { > + switch (*piAttrib) { > + case WGL_PBUFFER_LARGEST_ARB: > +piAttrib++; > +useLargest = *piAttrib; > +break; > + case WGL_TEXTURE_FORMAT_ARB: > + /* WGL_ARB_render_texture */ > + piAttrib++; > + textureFormat = *piAttrib; > + if (textureFormat != WGL_TEXTURE_RGB_ARB && > +textureFormat != WGL_TEXTURE_RGBA_ARB && > +textureFormat != WGL_NO_TEXTURE_ARB) { > +SetLastError(ERROR_INVALID_DATA); > +return 0; > + } > + break; > + case WGL_TEXTURE_TARGET_ARB: > + /* WGL_ARB_render_texture */ > + piAttrib++; > + textureTarget = *piAttrib; > + if (textureTarget != WGL_TEXTURE_CUBE_MAP_ARB && > + textureTarget != WGL_TEXTURE_1D_ARB && > + textureTarget != WGL_TEXTURE_2D_ARB && > + textureTarget != WGL_NO_TEXTURE_ARB) { > +SetLastError(ERROR_INVALID_DATA); > +return 0; > + } > + break; > + case WGL_MIPMAP_TEXTURE_ARB: > +/* WGL_ARB_render_texture */ > +piAttrib++; > +textureMipmap = !!*piAttrib; > +break; > + default: > +SetLastError(ERROR_INVALID_DATA); > +debug_printf("wgl: Unsupported attribute 0x%x in %s\n", > + *piAttrib, __func__); > +return 0; > + } >} > } > > -- > 1.9.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 1/9] util/macros: Import ALIGN_POT from ralloc.c
On 07/02/2018 10:50 AM, Jason Ekstrand wrote: On Mon, Jul 2, 2018 at 9:23 AM, Brian Paul <mailto:bri...@vmware.com>> wrote: On 07/02/2018 09:00 AM, Jason Ekstrand wrote: On Mon, Jul 2, 2018 at 6:33 AM, Brian Paul mailto:bri...@vmware.com> <mailto:bri...@vmware.com <mailto:bri...@vmware.com>>> wrote: On 06/29/2018 06:13 PM, Jason Ekstrand wrote: --- src/util/macros.h | 3 +++ src/util/ralloc.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/macros.h b/src/util/macros.h index 6d3df904082..95b86c7a31a 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -285,6 +285,9 @@ do { \ #define MIN3( A, B, C ) ((A) < (B) ? MIN2(A, C) : MIN2(B, C)) #define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C)) +/** Align a value to a power of two */ +#define ALIGN_POT(x, y) (((x) + (y) - 1) & ~((y) - 1)) Maybe improve the comment to say that y must be a power of two value? Maybe rename 'y' to 'pot'? Do you want one or both? I've sent a v2 which just renames "y" to "align_pot" and leaves the comment alone. That's fine. The same macro is in src/util/slab.c and build_id.c too (at least). Good catch. Fixed in v2. Do you mean v3? I haven't seen a newer patch in my inbox yet. I guess so? I think I accidentally called the new one v2 as well. It's here: https://patchwork.freedesktop.org/patch/235957/ Looks good. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 1/9] util/macros: Import ALIGN_POT from ralloc.c
On 07/02/2018 09:00 AM, Jason Ekstrand wrote: On Mon, Jul 2, 2018 at 6:33 AM, Brian Paul <mailto:bri...@vmware.com>> wrote: On 06/29/2018 06:13 PM, Jason Ekstrand wrote: --- src/util/macros.h | 3 +++ src/util/ralloc.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/macros.h b/src/util/macros.h index 6d3df904082..95b86c7a31a 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -285,6 +285,9 @@ do { \ #define MIN3( A, B, C ) ((A) < (B) ? MIN2(A, C) : MIN2(B, C)) #define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C)) +/** Align a value to a power of two */ +#define ALIGN_POT(x, y) (((x) + (y) - 1) & ~((y) - 1)) Maybe improve the comment to say that y must be a power of two value? Maybe rename 'y' to 'pot'? Do you want one or both? I've sent a v2 which just renames "y" to "align_pot" and leaves the comment alone. That's fine. The same macro is in src/util/slab.c and build_id.c too (at least). Good catch. Fixed in v2. Do you mean v3? I haven't seen a newer patch in my inbox yet. -Brian -Brian + /** * Macro for declaring an explicit conversion operator. Defaults to an * implicit conversion if C++11 is not supported. diff --git a/src/util/ralloc.c b/src/util/ralloc.c index 42cfa2e391d..5d77f75ee85 100644 --- a/src/util/ralloc.c +++ b/src/util/ralloc.c @@ -553,8 +553,6 @@ ralloc_vasprintf_rewrite_tail(char **str, size_t *start, const char *fmt, * other buffers. */ -#define ALIGN_POT(x, y) (((x) + (y) - 1) & ~((y) - 1)) - #define MIN_LINEAR_BUFSIZE 2048 #define SUBALLOC_ALIGNMENT sizeof(uintptr_t) #define LMAGIC 0x87b9c7d3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] mesa: fix error msg typo
On 07/02/2018 09:13 AM, Rob Clark wrote: Signed-off-by: Rob Clark --- src/mesa/main/performance_monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/performance_monitor.c b/src/mesa/main/performance_monitor.c index 65ea8437fd8..35972ff 100644 --- a/src/mesa/main/performance_monitor.c +++ b/src/mesa/main/performance_monitor.c @@ -542,7 +542,7 @@ _mesa_EndPerfMonitorAMD(GLuint monitor) * when a performance monitor is not currently started." */ if (!m->Active) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginPerfMonitor(not active)"); + _mesa_error(ctx, GL_INVALID_OPERATION, "glEndPerfMonitor(not active)"); return; } Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] mesa: don't double incr/decr ActiveCounters
On 07/02/2018 09:13 AM, Rob Clark wrote: Frameretrace ends up w/ excess calls to SelectPerfMonitorCountersAMD() which ends up re-enabling already enabled counters. Which causes ActiveCounters[group] to be double incremented for the same counter. This causes BeginPerfMonitorAMD() to fail. The AMD_performance_monitor spec doesn't say that an error should be generated in this case. So I think the safe thing to do is just safe- guard against excess increments/decrements. Signed-off-by: Rob Clark --- src/mesa/main/performance_monitor.c | 4 1 file changed, 4 insertions(+) diff --git a/src/mesa/main/performance_monitor.c b/src/mesa/main/performance_monitor.c index 35972ff..37762e056b0 100644 --- a/src/mesa/main/performance_monitor.c +++ b/src/mesa/main/performance_monitor.c @@ -480,12 +480,16 @@ _mesa_SelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, if (enable) { /* Enable the counters */ for (i = 0; i < numCounters; i++) { + if (BITSET_TEST(m->ActiveCounters[group], counterList[i])) +continue; ++m->ActiveGroups[group]; BITSET_SET(m->ActiveCounters[group], counterList[i]); If it were me, I'd simply use a conditional w/out continue: if (!BITSET_TEST(m->ActiveCounters[group], counterList[i])) { ++m->ActiveGroups[group]; BITSET_SET(m->ActiveCounters[group], counterList[i]); } } } else { /* Disable the counters */ for (i = 0; i < numCounters; i++) { + if (!BITSET_TEST(m->ActiveCounters[group], counterList[i])) +continue; --m->ActiveGroups[group]; BITSET_CLEAR(m->ActiveCounters[group], counterList[i]); } -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 1/9] util/macros: Import ALIGN_POT from ralloc.c
On 06/29/2018 06:13 PM, Jason Ekstrand wrote: --- src/util/macros.h | 3 +++ src/util/ralloc.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/macros.h b/src/util/macros.h index 6d3df904082..95b86c7a31a 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -285,6 +285,9 @@ do { \ #define MIN3( A, B, C ) ((A) < (B) ? MIN2(A, C) : MIN2(B, C)) #define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C)) +/** Align a value to a power of two */ +#define ALIGN_POT(x, y) (((x) + (y) - 1) & ~((y) - 1)) Maybe improve the comment to say that y must be a power of two value? Maybe rename 'y' to 'pot'? The same macro is in src/util/slab.c and build_id.c too (at least). -Brian + /** * Macro for declaring an explicit conversion operator. Defaults to an * implicit conversion if C++11 is not supported. diff --git a/src/util/ralloc.c b/src/util/ralloc.c index 42cfa2e391d..5d77f75ee85 100644 --- a/src/util/ralloc.c +++ b/src/util/ralloc.c @@ -553,8 +553,6 @@ ralloc_vasprintf_rewrite_tail(char **str, size_t *start, const char *fmt, * other buffers. */ -#define ALIGN_POT(x, y) (((x) + (y) - 1) & ~((y) - 1)) - #define MIN_LINEAR_BUFSIZE 2048 #define SUBALLOC_ALIGNMENT sizeof(uintptr_t) #define LMAGIC 0x87b9c7d3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/1] mesa/st: draw_vbo: initialize restart_index too
On 07/01/2018 02:05 AM, Gert Wollny wrote: From: Gert Wollny restart_index is later always used in a comparison, so it should be initialized properly. Fixes valgrind warning: Conditional jump or move depends on uninitialised value(s) at 0xB8D682F: r600_draw_vbo (r600_state_common.c:2153) by 0xB71F743: u_vbuf_draw_vbo (u_vbuf.c:1156) by 0xB3B92DB: st_draw_vbo (st_draw.c:235) by 0xB36B1AE: vbo_draw_arrays (vbo_exec_array.c:391) by 0xB36BB0D: vbo_exec_DrawArrays (vbo_exec_array.c:550) by 0x10A989: piglit_display (textureSize.c:157) by 0x4F8F174: run_test (piglit_fbo_framework.c:52) by 0x4F7BA12: piglit_gl_test_run (piglit-framework-gl.c:229) by 0x10A60A: main (textureSize.c:71) Uninitialised value was created by a stack allocation at 0xB3B90B0: st_draw_vbo (st_draw.c:143) Signed-off-by: Gert Wollny --- src/mesa/state_tracker/st_draw.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 208ea735a7..dee69783ad 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -156,6 +156,7 @@ st_draw_vbo(struct gl_context *ctx, info.vertices_per_patch = ctx->TessCtrlProgram.patch_vertices; info.indirect = NULL; info.count_from_stream_output = NULL; + info.restart_index = 0; if (ib) { struct gl_buffer_object *bufobj = ib->obj; It might be better to simply call util_draw_init_info() first, then drop the =0 assignments. That'd help future-proof the code too. Otherwise, this is OK. Reviewed-by: Brian Paul -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/mesa: add missing switch cases in glsl_to_tgsi_visitor::visit()
To silence compiler warning about unhandled switch cases. --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index b321112..673c0f6 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3990,6 +3990,8 @@ glsl_to_tgsi_visitor::visit(ir_call *ir) case ir_intrinsic_generic_atomic_max: case ir_intrinsic_generic_atomic_exchange: case ir_intrinsic_generic_atomic_comp_swap: + case ir_intrinsic_begin_invocation_interlock: + case ir_intrinsic_end_invocation_interlock: unreachable("Invalid intrinsic"); } } -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] llvmpipe: improve rasterization discard logic
On 05/21/2018 07:34 PM, srol...@vmware.com wrote: From: Roland Scheidegger This unifies the explicit rasterization dicard as well as the implicit "discard" Looks OK to me. Minor nits below. Reviewed-by: Brian Paul rasterization disabled logic (which we need for another state tracker), which really should do the exact same thing. We'll now toss out the prims early on in setup with (implicit or explicit) discard, rather than do setup and binning with them, which was entirely pointless. (We should eventually get rid of implicit discard, which should also enable us to discard stuff already in draw, hence draw would be able to skip the pointless clip and fallback stages in this case.) We still need separate logic for only null ps - this is not the same as rasterization discard. But simplify the logic there and don't count primitives simply when there's an empty fs, regardless of depth/stencil tests, which seems perfectly acceptable by d3d10. While here, also fix statistics for primitives if face culling is enabled. No piglit changes. --- src/gallium/drivers/llvmpipe/lp_context.h | 1 - src/gallium/drivers/llvmpipe/lp_jit.c | 1 + src/gallium/drivers/llvmpipe/lp_jit.h | 5 +++ src/gallium/drivers/llvmpipe/lp_rast.c | 12 +++- src/gallium/drivers/llvmpipe/lp_rast_priv.h | 6 src/gallium/drivers/llvmpipe/lp_scene.c | 5 ++- src/gallium/drivers/llvmpipe/lp_scene.h | 10 +++--- src/gallium/drivers/llvmpipe/lp_setup.c | 18 ++- src/gallium/drivers/llvmpipe/lp_setup_line.c| 27 ++-- src/gallium/drivers/llvmpipe/lp_setup_point.c | 21 + src/gallium/drivers/llvmpipe/lp_setup_tri.c | 29 - src/gallium/drivers/llvmpipe/lp_setup_vbuf.c| 2 +- src/gallium/drivers/llvmpipe/lp_state_derived.c | 22 ++--- src/gallium/drivers/llvmpipe/lp_state_fs.c | 41 - src/gallium/drivers/llvmpipe/lp_state_fs.h | 5 --- 15 files changed, 118 insertions(+), 87 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index 54d98fd..7a2f253 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -136,7 +136,6 @@ struct llvmpipe_context { struct blitter_context *blitter; unsigned tex_timestamp; - boolean no_rast; /** List of all fragment shader variants */ struct lp_fs_variant_list_item fs_variants_list; diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index a2762f3..e2309f4 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -212,6 +212,7 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp) elem_types[LP_JIT_THREAD_DATA_CACHE] = LLVMPointerType(lp_build_format_cache_type(gallivm), 0); elem_types[LP_JIT_THREAD_DATA_COUNTER] = LLVMInt64TypeInContext(lc); + elem_types[LP_JIT_THREAD_DATA_INVOCATIONS] = LLVMInt64TypeInContext(lc); elem_types[LP_JIT_THREAD_DATA_RASTER_STATE_VIEWPORT_INDEX] = LLVMInt32TypeInContext(lc); diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h index 9db26f2..312d1a1 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.h +++ b/src/gallium/drivers/llvmpipe/lp_jit.h @@ -192,6 +192,7 @@ struct lp_jit_thread_data { struct lp_build_format_cache *cache; uint64_t vis_counter; + uint64_t ps_invocations; /* * Non-interpolated rasterizer state passed through to the fragment shader. @@ -205,6 +206,7 @@ struct lp_jit_thread_data enum { LP_JIT_THREAD_DATA_CACHE = 0, LP_JIT_THREAD_DATA_COUNTER, + LP_JIT_THREAD_DATA_INVOCATIONS, LP_JIT_THREAD_DATA_RASTER_STATE_VIEWPORT_INDEX, LP_JIT_THREAD_DATA_COUNT }; @@ -216,6 +218,9 @@ enum { #define lp_jit_thread_data_counter(_gallivm, _ptr) \ lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_THREAD_DATA_COUNTER, "counter") +#define lp_jit_thread_data_invocations(_gallivm, _ptr) \ + lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_THREAD_DATA_INVOCATIONS, "invocs") + #define lp_jit_thread_data_raster_state_viewport_index(_gallivm, _ptr) \ lp_build_struct_get(_gallivm, _ptr, \ LP_JIT_THREAD_DATA_RASTER_STATE_VIEWPORT_INDEX, \ diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 939944a..9d4f9f8 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -107,7 +107,7 @@ lp_rast_tile_begin(struct lp_rasterizer_task *task, task->scene->fb.height - y * TILE_SIZE : TILE_SIZE; task->thread_data.vis_counter = 0; - task->ps_invocations = 0; + task->thread_data.ps_invocations = 0; for (i
Re: [Mesa-dev] [PATCH] draw: get rid of special logic to not emit null tris
On 05/17/2018 10:30 AM, srol...@vmware.com wrote: From: Roland Scheidegger I've confirmed after 77554d220d6d74b4d913dc37ea3a874e9dc550e4 we no longer need this to pass some tests from another api (as we no longer generate the bogus extra null tris in the first place). --- src/gallium/auxiliary/draw/draw_pipe_clip.c | 38 - 1 file changed, 38 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c index 46118b6..2a9c944 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c @@ -210,30 +210,6 @@ static void interp(const struct clip_stage *clip, } /** - * Checks whether the specified triangle is empty and if it is returns - * true, otherwise returns false. - * Triangle is considered null/empty if its area is equal to zero. - */ -static inline boolean -is_tri_null(const struct clip_stage *clip, const struct prim_header *header) -{ - const unsigned pos_attr = clip->pos_attr; - float x1 = header->v[1]->data[pos_attr][0] - header->v[0]->data[pos_attr][0]; - float y1 = header->v[1]->data[pos_attr][1] - header->v[0]->data[pos_attr][1]; - float z1 = header->v[1]->data[pos_attr][2] - header->v[0]->data[pos_attr][2]; - - float x2 = header->v[2]->data[pos_attr][0] - header->v[0]->data[pos_attr][0]; - float y2 = header->v[2]->data[pos_attr][1] - header->v[0]->data[pos_attr][1]; - float z2 = header->v[2]->data[pos_attr][2] - header->v[0]->data[pos_attr][2]; - - float vx = y1 * z2 - z1 * y2; - float vy = x1 * z2 - z1 * x2; - float vz = x1 * y2 - y1 * x2; - - return (vx*vx + vy*vy + vz*vz) == 0.f; -} - -/** * Emit a post-clip polygon to the next pipeline stage. The polygon * will be convex and the provoking vertex will always be vertex[0]. */ @@ -247,7 +223,6 @@ static void emit_poly(struct draw_stage *stage, struct prim_header header; unsigned i; ushort edge_first, edge_middle, edge_last; - boolean tri_emitted = FALSE; if (stage->draw->rasterizer->flatshade_first) { edge_first = DRAW_PIPE_EDGE_FLAG_0; @@ -269,7 +244,6 @@ static void emit_poly(struct draw_stage *stage, header.pad = 0; for (i = 2; i < n; i++, header.flags = edge_middle) { - boolean tri_null; /* order the triangle verts to respect the provoking vertex mode */ if (stage->draw->rasterizer->flatshade_first) { header.v[0] = inlist[0]; /* the provoking vertex */ @@ -282,18 +256,6 @@ static void emit_poly(struct draw_stage *stage, header.v[2] = inlist[0]; /* the provoking vertex */ } - tri_null = is_tri_null(clipper, &header); - /* - * If we ever generated a tri (regardless if it had area or not), - * skip all subsequent null tris. - * FIXME: I think this logic was hiding bugs elsewhere. It should - * be possible now to always emit all tris. - */ - if (tri_null && tri_emitted) { - continue; - } - tri_emitted = TRUE; - if (!edgeflags[i-1]) { header.flags &= ~edge_middle; } Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] tgsi: fix incorrect tgsi_shader_info::num_tokens computation
We were incrementing num_tokens in each loop iteration while parsing the shader. But each call to tgsi_parse_token() can consume more than one token (and often does). Instead, just call the tgsi_num_tokens() function. Luckily, this issue doesn't seem to effect any current users of this field (llvmpipe just checks for <= 1, for example). --- src/gallium/auxiliary/tgsi/tgsi_scan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index 18488d7..685a413 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -836,13 +836,12 @@ tgsi_scan_shader(const struct tgsi_token *tokens, procType == PIPE_SHADER_TESS_EVAL || procType == PIPE_SHADER_COMPUTE); info->processor = procType; + info->num_tokens = tgsi_num_tokens(parse.Tokens); /** ** Loop over incoming program tokens/instructions */ while (!tgsi_parse_end_of_tokens(&parse)) { - info->num_tokens++; - tgsi_parse_token( &parse ); switch( parse.FullToken.Token.Type ) { -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/4] mesa: Remove flush_vertrices argument from VAO methods.
In the subject line "flush_vertices" For this series, Reviewed-by: Brian Paul More nice clean-ups! -Brian On 05/17/2018 12:37 AM, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich The flush_vertices argument is now unused, remove it. Signed-off-by: Mathias Fröhlich --- src/mesa/drivers/common/meta.c | 32 ++- src/mesa/main/bufferobj.c| 2 +- src/mesa/main/enable.c | 4 +-- src/mesa/main/varray.c | 44 +++- src/mesa/main/varray.h | 8 +++--- src/mesa/state_tracker/st_cb_rasterpos.c | 4 +-- src/mesa/vbo/vbo_context.c | 2 +- src/mesa/vbo/vbo_exec_draw.c | 6 ++--- src/mesa/vbo/vbo_save_api.c | 6 ++--- 9 files changed, 51 insertions(+), 57 deletions(-) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 1/2] cast the "GLenum16" to "GLint" to avoid compile warning on android
On 05/16/2018 01:02 AM, jenny.q.cao wrote: force cast the I to GLint to avoid the compile warning when type is GLenum16, in vendor/intel/external/mesa3d-intel/src/mesa/main/get.c:3005:19: warning: comparison of constant -32768 with expression of type 'GLenum16' (aka 'unsigned short') is always false -Wtautologicalia-constant-out-of-range-compare Tests: compilation without this warning Signed-off-by: jenny.q.cao --- src/mesa/main/get.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 90ab7ca60f8b..5f9a60b0801c 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -3002,7 +3002,7 @@ _mesa_GetFixedv(GLenum pname, GLfixed *params) break; case TYPE_ENUM16: - params[0] = INT_TO_FIXED(((GLenum16 *) p)[0]); + params[0] = INT_TO_FIXED((GLint)(((GLenum16 *) p)[0])); break; case TYPE_INT_N: Reviewed-by: Brian Paul I'll clean up the commit message a bit and commit this soon. Thanks. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH] mesa: fix glGetInteger/Float/etc queries for vertex arrays attribs
On 05/11/2018 03:51 AM, Juan A. Suarez Romero wrote: On Wed, 2018-05-09 at 19:51 -0600, Brian Paul wrote: The vertex array Size and Stride attributes are now ubyte and short, respectively. The glGet code needed to be updated to handle those types, but wasn't. Fixes the new piglit test gl-1.5-get-array-attribs test. Bugzilla: https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D106450&d=DwICaQ&c=uilaK90D4TOVoH58JNXRgQ&r=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA&m=UiMSw582Jyda8hb5bMjFvA5YnjycFZvNEg-XV3XkgR8&s=xrYXXcUiUfyIya8IE0wGTxl0FQoLbLKk-BKwePoIDRg&e= Fixes: d5f42f96e16 ("mesa: shrink size of gl_array_attributes (v2)") Cc: mesa-sta...@lists.freedesktop.org This commit was nominated for inclusion to stable, but at the same time it has the "Fixes" tag. My understanding is that this patch does not make sense if the branch doesn't include the commit it fixes. In the case of 18.0 stable branch, commit d5f42f96e16 is not there, so I understand this nominated patch shouldn't be included neither. Thus, I'll reject it for 18.0. If you think it should be included anyway, just sent a new patch that can be applied in 18.0. Thank you. OK, no problem. I was assuming the 18.0 branch was created after Jan 19, but evidently it was made before. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 0/5] Implement ARB_sample_locations for nvc0
For 1-3,5: Reviewed-by: Brian Paul On 05/10/2018 10:28 AM, Rhys Perry wrote: This patch set adds support for GL_ARB_sample_locations in mesa core, gallium, the mesa OpenGL state tracker and the nvc0 driver. Changes in v2: - various minor changes/cleanups (mostly formatting and style changes) - improve error handling - don't expose the ARB_* variant on ES - expose NV_sample_locations so the feature is available on ES - decouple framebuffer and sample location state in the state tracker and nvc0 - rebase to upstream master Rhys Perry (5): mesa: add support for ARB_sample_locations gallium: add support for programmable sample locations st/mesa: add support for ARB_sample_locations nvc0: add support for programmable sample locations docs/features: mark GL_ARB_sample_locations as DONE for nvc0 docs/features.txt | 2 +- src/gallium/auxiliary/util/u_framebuffer.c | 30 +++ src/gallium/auxiliary/util/u_framebuffer.h | 5 + src/gallium/docs/source/context.rst| 3 + src/gallium/docs/source/screen.rst | 3 + src/gallium/drivers/etnaviv/etnaviv_screen.c | 1 + src/gallium/drivers/freedreno/freedreno_screen.c | 1 + src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/llvmpipe/lp_screen.c | 1 + .../drivers/nouveau/codegen/nv50_ir_driver.h | 2 + .../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 7 + .../nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 91 +++- .../nouveau/codegen/nv50_ir_lowering_nvc0.h| 2 + src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 + src/gallium/drivers/nouveau/nv50/nv50_miptree.c| 1 + src/gallium/drivers/nouveau/nv50/nv50_resource.h | 1 + src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_context.h| 15 +- src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c| 1 + src/gallium/drivers/nouveau/nvc0/nvc0_program.c| 3 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 32 +++ src/gallium/drivers/nouveau/nvc0/nvc0_state.c | 17 +- .../drivers/nouveau/nvc0/nvc0_state_validate.c | 174 +++--- src/gallium/drivers/r300/r300_screen.c | 1 + src/gallium/drivers/r600/r600_pipe.c | 1 + src/gallium/drivers/radeonsi/si_get.c | 1 + src/gallium/drivers/softpipe/sp_screen.c | 1 + src/gallium/drivers/svga/svga_screen.c | 1 + src/gallium/drivers/swr/swr_screen.cpp | 1 + src/gallium/drivers/vc4/vc4_screen.c | 1 + src/gallium/drivers/vc5/vc5_screen.c | 1 + src/gallium/drivers/virgl/virgl_screen.c | 1 + src/gallium/include/pipe/p_context.h | 31 ++- src/gallium/include/pipe/p_defines.h | 1 + src/gallium/include/pipe/p_screen.h| 11 + src/gallium/include/pipe/p_state.h | 1 + src/mapi/glapi/gen/gl_API.xml | 104 + src/mesa/main/config.h | 9 + src/mesa/main/dd.h | 9 + src/mesa/main/extensions_table.h | 2 + src/mesa/main/fbobject.c | 256 ++--- src/mesa/main/fbobject.h | 20 ++ src/mesa/main/framebuffer.c| 10 + src/mesa/main/get.c| 31 +++ src/mesa/main/get_hash_params.py | 6 + src/mesa/main/mtypes.h | 9 + src/mesa/main/multisample.c| 18 ++ src/mesa/main/tests/dispatch_sanity.cpp| 10 + src/mesa/state_tracker/st_atom.h | 2 +- src/mesa/state_tracker/st_atom_list.h | 2 +- src/mesa/state_tracker/st_atom_msaa.c | 77 ++- src/mesa/state_tracker/st_cb_msaa.c| 27 +++ src/mesa/state_tracker/st_context.c| 7 +- src/mesa/state_tracker/st_context.h| 6 + src/mesa/state_tracker/st_extensions.c | 1 + 55 files changed, 971 insertions(+), 83 deletions(-) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallium: remove aux_vertex_buffer_slot code
On 05/10/2018 10:21 AM, Marek Olšák wrote: From: Marek Olšák The slot index is always 0, and is pretty unlikely to change in the future. --- src/gallium/auxiliary/cso_cache/cso_context.c | 52 ++- src/gallium/auxiliary/cso_cache/cso_context.h | 5 --- src/gallium/auxiliary/hud/hud_context.c | 14 +++- src/gallium/auxiliary/util/u_blit.c | 5 ++- src/gallium/auxiliary/util/u_vbuf.c | 22 +--- src/gallium/auxiliary/util/u_vbuf.h | 7 ++-- src/mesa/state_tracker/st_cb_bitmap.c | 5 +-- src/mesa/state_tracker/st_cb_drawtex.c| 3 +- src/mesa/state_tracker/st_context.c | 15 ++-- src/mesa/state_tracker/st_draw.c | 10 +- src/mesa/state_tracker/st_pbo.c | 2 +- 11 files changed, 45 insertions(+), 95 deletions(-) Looks OK to me. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: revert GL_[SECONDARY_]COLOR_ARRAY_SIZE glGet type to TYPE_INT
Since size can be 3, 4 or GL_BGRA we need to keep these glGet types as TYPE_INT, not TYPE_UBYTE. Fixes: d07466fe18522 ("mesa: fix glGetInteger/Float/etc queries for vertex arrays attribs") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106462 cc: mesa-sta...@lists.freedesktop.org --- src/mesa/main/get_hash_params.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index bb7d23a..a97b948 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -219,7 +219,7 @@ descriptor=[ [ "NORMAL_ARRAY_TYPE", "ARRAY_ENUM16(VertexAttrib[VERT_ATTRIB_NORMAL].Type), NO_EXTRA" ], [ "NORMAL_ARRAY_STRIDE", "ARRAY_SHORT(VertexAttrib[VERT_ATTRIB_NORMAL].Stride), NO_EXTRA" ], [ "COLOR_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR0].Enabled), NO_EXTRA" ], - [ "COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_UBYTE, 0, NO_EXTRA" ], + [ "COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], [ "COLOR_ARRAY_TYPE", "ARRAY_ENUM16(VertexAttrib[VERT_ATTRIB_COLOR0].Type), NO_EXTRA" ], [ "COLOR_ARRAY_STRIDE", "ARRAY_SHORT(VertexAttrib[VERT_ATTRIB_COLOR0].Stride), NO_EXTRA" ], [ "TEXTURE_COORD_ARRAY", "LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_array_attributes, Enabled), NO_EXTRA" ], @@ -825,7 +825,7 @@ descriptor=[ [ "SECONDARY_COLOR_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR1].Enabled), NO_EXTRA" ], [ "SECONDARY_COLOR_ARRAY_TYPE", "ARRAY_ENUM16(VertexAttrib[VERT_ATTRIB_COLOR1].Type), NO_EXTRA" ], [ "SECONDARY_COLOR_ARRAY_STRIDE", "ARRAY_SHORT(VertexAttrib[VERT_ATTRIB_COLOR1].Stride), NO_EXTRA" ], - [ "SECONDARY_COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_UBYTE, 0, NO_EXTRA" ], + [ "SECONDARY_COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], # GL_EXT_fog_coord [ "CURRENT_FOG_COORDINATE", "CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_FOG][0]), extra_flush_current" ], -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: fix glGetInteger/Float/etc queries for vertex arrays attribs
The vertex array Size and Stride attributes are now ubyte and short, respectively. The glGet code needed to be updated to handle those types, but wasn't. Fixes the new piglit test gl-1.5-get-array-attribs test. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106450 Fixes: d5f42f96e16 ("mesa: shrink size of gl_array_attributes (v2)") Cc: mesa-sta...@lists.freedesktop.org --- src/mesa/main/get.c | 77 ++-- src/mesa/main/get_hash_params.py | 24 ++--- 2 files changed, 86 insertions(+), 15 deletions(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 44b7b83..441eac4 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -105,6 +105,8 @@ enum value_type { TYPE_ENUM, TYPE_ENUM_2, TYPE_BOOLEAN, + TYPE_UBYTE, + TYPE_SHORT, TYPE_BIT_0, TYPE_BIT_1, TYPE_BIT_2, @@ -188,6 +190,8 @@ union value { GLint value_int_4[4]; GLint64 value_int64; GLenum value_enum; + GLubyte value_ubyte; + GLshort value_short; /* Sigh, see GL_COMPRESSED_TEXTURE_FORMATS_ARB handling */ struct { @@ -235,10 +239,13 @@ union value { #define CONTEXT_MATRIX(field) CONTEXT_FIELD(field, TYPE_MATRIX) #define CONTEXT_MATRIX_T(field) CONTEXT_FIELD(field, TYPE_MATRIX_T) +/* Vertex array fields */ #define ARRAY_INT(field) ARRAY_FIELD(field, TYPE_INT) #define ARRAY_ENUM(field) ARRAY_FIELD(field, TYPE_ENUM) #define ARRAY_ENUM16(field) ARRAY_FIELD(field, TYPE_ENUM16) #define ARRAY_BOOL(field) ARRAY_FIELD(field, TYPE_BOOLEAN) +#define ARRAY_UBYTE(field) ARRAY_FIELD(field, TYPE_UBYTE) +#define ARRAY_SHORT(field) ARRAY_FIELD(field, TYPE_SHORT) #define EXT(f) \ offsetof(struct gl_extensions, f) @@ -1520,6 +1527,10 @@ get_value_size(enum value_type type, const union value *v) return sizeof(GLenum) * 2; case TYPE_BOOLEAN: return sizeof(GLboolean); + case TYPE_UBYTE: + return sizeof(GLubyte); + case TYPE_SHORT: + return sizeof(GLshort); case TYPE_BIT_0: case TYPE_BIT_1: case TYPE_BIT_2: @@ -1628,7 +1639,15 @@ _mesa_GetBooleanv(GLenum pname, GLboolean *params) break; case TYPE_BOOLEAN: - params[0] = ((GLboolean*) p)[0]; + params[0] = ((GLboolean *) p)[0]; + break; + + case TYPE_UBYTE: + params[0] = ((GLubyte *) p)[0] != 0; + break; + + case TYPE_SHORT: + params[0] = ((GLshort *) p)[0] != 0; break; case TYPE_MATRIX: @@ -1735,7 +1754,15 @@ _mesa_GetFloatv(GLenum pname, GLfloat *params) break; case TYPE_BOOLEAN: - params[0] = BOOLEAN_TO_FLOAT(*(GLboolean*) p); + params[0] = BOOLEAN_TO_FLOAT(*(GLboolean *) p); + break; + + case TYPE_UBYTE: + params[0] = (GLfloat) ((GLubyte *) p)[0]; + break; + + case TYPE_SHORT: + params[0] = (GLfloat) ((GLshort *) p)[0]; break; case TYPE_MATRIX: @@ -1845,6 +1872,14 @@ _mesa_GetIntegerv(GLenum pname, GLint *params) params[0] = BOOLEAN_TO_INT(*(GLboolean*) p); break; + case TYPE_UBYTE: + params[0] = ((GLubyte *) p)[0]; + break; + + case TYPE_SHORT: + params[0] = ((GLshort *) p)[0]; + break; + case TYPE_MATRIX: m = *(GLmatrix **) p; for (i = 0; i < 16; i++) @@ -2065,6 +2100,14 @@ _mesa_GetDoublev(GLenum pname, GLdouble *params) params[0] = *(GLboolean*) p; break; + case TYPE_UBYTE: + params[0] = ((GLubyte *) p)[0]; + break; + + case TYPE_SHORT: + params[0] = ((GLshort *) p)[0]; + break; + case TYPE_MATRIX: m = *(GLmatrix **) p; for (i = 0; i < 16; i++) @@ -2144,6 +2187,8 @@ _mesa_GetUnsignedBytevEXT(GLenum pname, GLubyte *data) case TYPE_ENUM: case TYPE_ENUM_2: case TYPE_BOOLEAN: + case TYPE_UBYTE: + case TYPE_SHORT: case TYPE_FLOAT: case TYPE_FLOATN: case TYPE_FLOAT_2: @@ -2793,6 +2838,14 @@ _mesa_GetFloati_v(GLenum pname, GLuint index, GLfloat *params) params[0] = BOOLEAN_TO_FLOAT(v.value_bool); break; + case TYPE_UBYTE: + params[0] = (GLfloat) v.value_ubyte; + break; + + case TYPE_SHORT: + params[0] = (GLfloat) v.value_short; + break; + case TYPE_MATRIX: m = *(GLmatrix **) &v; for (i = 0; i < 16; i++) @@ -2876,6 +2929,14 @@ _mesa_GetDoublei_v(GLenum pname, GLuint index, GLdouble *params) params[0] = (GLdouble) BOOLEAN_TO_FLOAT(v.value_bool); break; + case TYPE_UBYTE: + params[0] = (GLdouble) v.value_bool; + break; + + case TYPE_SHORT: + params[0] = (GLdouble) v.value_bool; + break; + case TYPE_MATRIX: m = *(GLmatrix **) &v; for (i = 0; i < 16; i++) @@ -2928,6 +2989,8 @@ _mesa_GetUnsignedBytei_vEXT(GLenum target, GLuint index, GLubyte *data) case TYPE_ENUM: case TYPE_ENUM_2: case TYPE_BOOLEAN: + case TYPE_UBYTE: + case TYPE_SHORT: case TYPE_FLOAT: case TYPE_FLOATN: case TYPE_FLOAT_2: @@ -3018,7 +3081,15
Re: [Mesa-dev] [PATCH 11/11] mesa/vbo/tnl: Move gl_vertex_array related stuff to tnl.
One comment needs updating below. On 05/07/2018 12:15 AM, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich The only remaining users of gl_vertex_array are tnl based drivers. So move everything related to that into tnl and rename it accordingly. Signed-off-by: Mathias Fröhlich --- src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c | 38 +-- src/mesa/main/mtypes.h | 14 src/mesa/main/varray.h | 12 src/mesa/state_tracker/st_draw.h | 1 - src/mesa/tnl/t_context.c | 4 +- src/mesa/tnl/t_context.h | 41 +++- src/mesa/tnl/t_draw.c| 95 ++-- src/mesa/tnl/t_rebase.c | 4 +- src/mesa/tnl/t_rebase.h | 2 +- src/mesa/tnl/t_split.c | 2 +- src/mesa/tnl/t_split.h | 4 +- src/mesa/tnl/t_split_copy.c | 34 ++ src/mesa/tnl/t_split_inplace.c | 4 +- src/mesa/tnl/tnl.h | 24 +-- src/mesa/vbo/vbo.h | 37 --- src/mesa/vbo/vbo_exec.c | 86 - 16 files changed, 199 insertions(+), 203 deletions(-) [...] diff --git a/src/mesa/tnl/t_split_copy.c b/src/mesa/tnl/t_split_copy.c index f76a470b5f..cbb7eb409f 100644 --- a/src/mesa/tnl/t_split_copy.c +++ b/src/mesa/tnl/t_split_copy.c @@ -53,7 +53,7 @@ */ struct copy_context { struct gl_context *ctx; - const struct gl_vertex_array *array; + const struct tnl_vertex_array *array; const struct _mesa_prim *prim; GLuint nr_prims; const struct _mesa_index_buffer *ib; @@ -64,7 +64,7 @@ struct copy_context { struct { GLuint attr; GLuint size; - const struct gl_vertex_array *array; + const struct tnl_vertex_array *array; const GLubyte *src_ptr; struct gl_vertex_buffer_binding dstbinding; @@ -73,7 +73,7 @@ struct copy_context { } varying[VERT_ATTRIB_MAX]; GLuint nr_varying; - struct gl_vertex_array dstarray[VERT_ATTRIB_MAX]; + struct tnl_vertex_array dstarray[VERT_ATTRIB_MAX]; struct _mesa_index_buffer dstib; GLuint *translated_elt_buf; @@ -112,6 +112,18 @@ attr_size(const struct gl_array_attributes *attrib) } +/** + * Shallow copy one vertex array to another. + */ +static inline void +copy_vertex_array(struct tnl_vertex_array *dst, + const struct tnl_vertex_array *src) +{ + dst->VertexAttrib = src->VertexAttrib; + dst->BufferBinding = src->BufferBinding; +} + + /** * Starts returning true slightly before the buffer fills, to ensure * that there is sufficient room for any remaining vertices to finish @@ -142,7 +154,7 @@ check_flush(struct copy_context *copy) */ static void dump_draw_info(struct gl_context *ctx, - const struct gl_vertex_array *arrays, + const struct tnl_vertex_array *arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, @@ -157,7 +169,7 @@ dump_draw_info(struct gl_context *ctx, printf(" Prim mode 0x%x\n", prims[i].mode); printf(" IB: %p\n", (void*) ib); for (j = 0; j < VERT_ATTRIB_MAX; j++) { - const struct gl_vertex_array *array = &arrays[j]; + const struct tnl_vertex_array *array = &arrays[j]; const struct gl_vertex_buffer_binding *binding = array->BufferBinding; const struct gl_array_attributes *attrib = array->VertexAttrib; @@ -254,7 +266,7 @@ elt(struct copy_context *copy, GLuint elt_idx) GLuint i; for (i = 0; i < copy->nr_varying; i++) { - const struct gl_vertex_array *srcarray = copy->varying[i].array; + const struct tnl_vertex_array *srcarray = copy->varying[i].array; const struct gl_vertex_buffer_binding* srcbinding = srcarray->BufferBinding; const GLubyte *srcptr @@ -432,11 +444,11 @@ replay_init(struct copy_context *copy) */ copy->vertex_size = 0; for (i = 0; i < VERT_ATTRIB_MAX; i++) { - const struct gl_vertex_array *array = ©->array[i]; + const struct tnl_vertex_array *array = ©->array[i]; const struct gl_vertex_buffer_binding *binding = array->BufferBinding; if (binding->Stride == 0) { - _mesa_copy_vertex_array(©->dstarray[i], array); + copy_vertex_array(©->dstarray[i], array); } else { const struct gl_array_attributes *attrib = array->VertexAttrib; @@ -517,9 +529,9 @@ replay_init(struct copy_context *copy) /* Setup new vertex arrays to point into the output buffer: */ for (offset = 0, i = 0; i < copy->nr_varying; i++) { - const struct gl_vertex_array *src = copy->varying[i].array; + const struct tnl_verte
Re: [Mesa-dev] [PATCH 04/11] st/mesa: Use Array._DrawVAO in st_atom_array.c.
Two minor nits below. -Brian On 05/07/2018 12:14 AM, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich Finally make use of the binding information in the VAO when setting up arrays for draw. v2: Emit less relocations also for interleaved userspace arrays. Signed-off-by: Mathias Fröhlich --- src/mesa/state_tracker/st_atom_array.c | 432 - 1 file changed, 107 insertions(+), 325 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c index 2fd67e8d84..6b39b4186d 100644 --- a/src/mesa/state_tracker/st_atom_array.c +++ b/src/mesa/state_tracker/st_atom_array.c @@ -48,6 +48,7 @@ #include "main/bufferobj.h" #include "main/glformats.h" #include "main/varray.h" +#include "main/arrayobj.h" /* vertex_formats[gltype - GL_BYTE][integer*2 + normalized][size - 1] */ static const uint16_t vertex_formats[][4][4] = { @@ -306,79 +307,6 @@ st_pipe_vertex_format(const struct gl_array_attributes *attrib) return vertex_formats[type - GL_BYTE][index][size-1]; } -static const struct gl_vertex_array * -get_client_array(const struct gl_vertex_array *arrays, - unsigned mesaAttr) -{ - /* st_program uses 0x to denote a double placeholder attribute */ - if (mesaAttr == ST_DOUBLE_ATTRIB_PLACEHOLDER) - return NULL; - return &arrays[mesaAttr]; -} - -/** - * Examine the active arrays to determine if we have interleaved - * vertex arrays all living in one VBO, or all living in user space. - */ -static GLboolean -is_interleaved_arrays(const struct st_vertex_program *vp, - const struct gl_vertex_array *arrays, - unsigned num_inputs) -{ - GLuint attr; - const struct gl_buffer_object *firstBufObj = NULL; - GLint firstStride = -1; - const GLubyte *firstPtr = NULL; - GLboolean userSpaceBuffer = GL_FALSE; - - for (attr = 0; attr < num_inputs; attr++) { - const struct gl_vertex_array *array; - const struct gl_vertex_buffer_binding *binding; - const struct gl_array_attributes *attrib; - const GLubyte *ptr; - const struct gl_buffer_object *bufObj; - GLsizei stride; - - array = get_client_array(arrays, vp->index_to_input[attr]); - if (!array) -continue; - - binding = array->BufferBinding; - attrib = array->VertexAttrib; - stride = binding->Stride; /* in bytes */ - ptr = _mesa_vertex_attrib_address(attrib, binding); - - /* To keep things simple, don't allow interleaved zero-stride attribs. */ - if (stride == 0) - return false; - - bufObj = binding->BufferObj; - if (attr == 0) { - /* save info about the first array */ - firstStride = stride; - firstPtr = ptr; - firstBufObj = bufObj; - userSpaceBuffer = !_mesa_is_bufferobj(bufObj); - } - else { - /* check if other arrays interleave with the first, in same buffer */ - if (stride != firstStride) -return GL_FALSE; /* strides don't match */ - - if (bufObj != firstBufObj) -return GL_FALSE; /* arrays in different VBOs */ - - if (llabs(ptr - firstPtr) > firstStride) -return GL_FALSE; /* arrays start too far apart */ - - if ((!_mesa_is_bufferobj(bufObj)) != userSpaceBuffer) -return GL_FALSE; /* mix of VBO and user-space arrays */ - } - } - - return GL_TRUE; -} - static void init_velement(struct pipe_vertex_element *velement, int src_offset, int format, int instance_divisor, int vbo_index) @@ -392,13 +320,14 @@ static void init_velement(struct pipe_vertex_element *velement, static void init_velement_lowered(const struct st_vertex_program *vp, struct pipe_vertex_element *velements, - int src_offset, int format, - int instance_divisor, int vbo_index, - int nr_components, GLboolean doubles, - GLuint *attr_idx) + const struct gl_array_attributes *attrib, + int src_offset, int instance_divisor, + int vbo_index, int idx) { - int idx = *attr_idx; - if (doubles) { + const unsigned format = st_pipe_vertex_format(attrib); + const GLubyte nr_components = attrib->Size; + + if (attrib->Doubles) { int lower_format; if (nr_components < 2) @@ -427,15 +356,11 @@ static void init_velement_lowered(const struct st_vertex_program *vp, init_velement(&velements[idx], src_offset, PIPE_FORMAT_R32G32_UINT, instance_divisor, vbo_index); } - - idx++; } } else { init_velement(&velements[idx], src_offset, format, instance_divisor, v
Re: [Mesa-dev] [PATCH 01/11] mesa: Compute effective buffer bindings in the vao.
Minor nit-picks below and on patches 4 and 11. I skimmed the i965 changes, but otherwise everything looks OK AFAICT. Nice work! Reviewed-by: Brian Paul On 05/07/2018 12:14 AM, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich Compute VAO buffer binding information past the position/generic0 mapping. Scan for duplicate buffer bindings and collapse them into derived effective buffer binding index and effective attribute mask variables. Provide a set of helper functions to access the distilled information in the VAO. All of them prefixed with _mesa_draw_... to indicate that they are meant to query draw information. v2: Also group user space arrays containing interleaved arrays. Add _Eff*Offset to be copied on attribute and binding copy. Update comments. Signed-off-by: Mathias Fröhlich --- src/mesa/main/arrayobj.c | 390 - src/mesa/main/arrayobj.h | 186 + src/mesa/main/attrib.c | 1 + src/mesa/main/mtypes.h | 64 src/mesa/main/varray.c | 9 ++ src/mesa/vbo/vbo.h | 8 + src/mesa/vbo/vbo_context.c | 17 ++ src/mesa/vbo/vbo_private.h | 7 +- 8 files changed, 675 insertions(+), 7 deletions(-) [...] diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2d3eb457f9..dee917f2e4 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1426,6 +1426,32 @@ struct gl_array_attributes unsigned _ElementSize:8; /**< Size of each element in bytes */ /** Index into gl_vertex_array_object::BufferBinding[] array */ unsigned BufferBindingIndex:6; + + /** +* Derived effective buffer binding index +* +* Index into the gl_vertex_buffer_binding array of the vao. +* Similar to BufferBindingIndex, but with the mapping of the +* position/generic0 attributes applied and with identical +* gl_vertex_buffer_binding entries collapsed to a single +* entry within the vao. +* +* The value is valid past calling _mesa_update_vao_derived_arrays. +* Note that _mesa_update_vao_derived_arrays is called when binding +* the VAO to Array._DrawVAO. +*/ + unsigned _EffBufferBindingIndex:6; + /** +* Derived effective relative offset. +* +* Relative offset to the effective buffers offset in +* gl_vertex_buffer_binding::_EffOffset. +* +* The value is valid past calling _mesa_update_vao_derived_arrays. +* Note that _mesa_update_vao_derived_arrays is called when binding +* the VAO to Array._DrawVAO. +*/ + GLushort _EffRelativeOffset; }; @@ -1441,6 +1467,35 @@ struct gl_vertex_buffer_binding GLuint InstanceDivisor; /**< GL_ARB_instanced_arrays */ struct gl_buffer_object *BufferObj; /**< GL_ARB_vertex_buffer_object */ GLbitfield _BoundArrays;/**< Arrays bound to this binding point */ + + /** +* Derived effective bound arrays. +* +* The effective binding handles enabled arrays past the +* position/generic0 attribute mapping and reduces the refered +* gl_vertex_buffer_binding entries to a unique subset. +* +* The value is valid past calling _mesa_update_vao_derived_arrays. +* Note that _mesa_update_vao_derived_arrays is called when binding +* the VAO to Array._DrawVAO. +*/ + GLbitfield _EffBoundArrays; + /** +* Derived offset. +* +* The absolute offset to that we can collapse some attributes +* to this unique effective binding. +* For user space array bindings this contains the smalles pointer value "smallest" +* in the bound and interleaved arrays. +* For VBO bindings this contains an offset that lets the attributes +* _EffRelativeOffset stay positive and in bounds with +* Const.MaxVertexAttribRelativeOffset +* +* The value is valid past calling _mesa_update_vao_derived_arrays. +* Note that _mesa_update_vao_derived_arrays is called when binding +* the VAO to Array._DrawVAO. +*/ + GLintptr _EffOffset; }; @@ -1495,6 +1550,15 @@ struct gl_vertex_array_object /** Mask of VERT_BIT_* values indicating which arrays are enabled */ GLbitfield _Enabled; + /** +* Mask of VERT_BIT_* enabled arrays past position/generic0 mapping +* +* The value is valid past calling _mesa_update_vao_derived_arrays. +* Note that _mesa_update_vao_derived_arrays is called when binding +* the VAO to Array._DrawVAO. +*/ + GLbitfield _EffEnabledVBO; + /** Denotes the way the position/generic0 attribute is mapped */ gl_attribute_map_mode _AttributeMapMode; diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 5df38a14f0..d16807b406 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -604,6 +604,11 @@ update_array(struct gl_context *ctx, /* The Stride and Ptr fields are not set by update_array_format() */ struct gl_array_attributes *arra
[Mesa-dev] [PATCH] glsl: change ast_type_qualifier bitset size to work around GCC 5.4 bug
Change the size of the bitset from 128 bits to 96. This works around an apparent GCC 5.4 bug in which bad SSE code is generated, leading to a crash in ast_type_qualifier::validate_in_qualifier() (ast_type.cpp:654). This can be repro'd with the Piglit test tests/spec/glsl-1.50/execution/ varying-struct-basic-gs-fs.shader_test Bugzilla:https://bugs.freedesktop.org/show_bug.cgi?id=105497 Cc: mesa-sta...@lists.freedesktop.org --- src/compiler/glsl/ast.h | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h index a1ec0d5..9b88ff5 100644 --- a/src/compiler/glsl/ast.h +++ b/src/compiler/glsl/ast.h @@ -474,7 +474,13 @@ enum { struct ast_type_qualifier { DECLARE_RALLOC_CXX_OPERATORS(ast_type_qualifier); - DECLARE_BITSET_T(bitset_t, 128); + /* Note: this bitset needs to have at least as many bits as the 'q' +* struct has flags, below. Previously, the size was 128 instead of 96. +* But an apparent bug in GCC 5.4.0 causes bad SSE code generation +* elsewhere, leading to a crash. 96 bits works around the issue. +* See https://bugs.freedesktop.org/show_bug.cgi?id=105497 +*/ + DECLARE_BITSET_T(bitset_t, 96); union flags { struct { -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] gcc bug / crash in ast_type_qualifier::validate_in_qualifier()?
On 05/07/2018 09:45 PM, Matt Turner wrote: On Mon, May 7, 2018 at 8:02 PM, Brian Paul wrote: I don't know when this started happening (I'll try bisecting tomorrow) but we're seeing a crash in ast_type_qualifier::validate_in_qualifier() in -O3 builds with gcc 5.4.0 on Ubuntu 16.04. Specifically, at ast_type.cpp:654: if ((this->flags.i & ~valid_in_mask.flags.i) != 0) { It seems to be the ~ operator/function which is implemented with an SSE pxor instruction. I found that this patch avoids the issue: diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h index a1ec0d5..2e518ce 100644 --- a/src/compiler/glsl/ast.h +++ b/src/compiler/glsl/ast.h @@ -474,7 +474,7 @@ enum { struct ast_type_qualifier { DECLARE_RALLOC_CXX_OPERATORS(ast_type_qualifier); - DECLARE_BITSET_T(bitset_t, 128); + DECLARE_BITSET_T(bitset_t, 96); union flags { struct { This probably prevents use of xmm instructions, but I haven't inspected the code. Is anyone else seeing this? Yes, it's https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D105497&d=DwIBaQ&c=uilaK90D4TOVoH58JNXRgQ&r=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA&m=XjpUGeYdJc6dOmww18kR-siiyCXP1ik8Kmbf8WCZBTw&s=-k8yjJcyWTLYwu0GYXEVsgySdL1AgIW_SvYTKCbPNF8&e= I was surprised that we decided it's not worth working around. Yeah. Thanks for pointing me at that, Matt. I think this is something we should deal with. I can't imagine not using SSE in this one corner of the compiler would make a measurable difference overall. AFAICT, the code is only hit once per shader input. I'll post a patch soon. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] gcc bug / crash in ast_type_qualifier::validate_in_qualifier()?
I don't know when this started happening (I'll try bisecting tomorrow) but we're seeing a crash in ast_type_qualifier::validate_in_qualifier() in -O3 builds with gcc 5.4.0 on Ubuntu 16.04. Specifically, at ast_type.cpp:654: if ((this->flags.i & ~valid_in_mask.flags.i) != 0) { It seems to be the ~ operator/function which is implemented with an SSE pxor instruction. I found that this patch avoids the issue: diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h index a1ec0d5..2e518ce 100644 --- a/src/compiler/glsl/ast.h +++ b/src/compiler/glsl/ast.h @@ -474,7 +474,7 @@ enum { struct ast_type_qualifier { DECLARE_RALLOC_CXX_OPERATORS(ast_type_qualifier); - DECLARE_BITSET_T(bitset_t, 128); + DECLARE_BITSET_T(bitset_t, 96); union flags { struct { This probably prevents use of xmm instructions, but I haven't inspected the code. Is anyone else seeing this? -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/5] st/mesa: add support for ARB_sample_locations
More nit-picks below. On 05/04/2018 06:09 AM, Rhys Perry wrote: Signed-off-by: Rhys Perry --- src/mesa/state_tracker/st_atom_framebuffer.c | 64 src/mesa/state_tracker/st_cb_msaa.c | 22 ++ src/mesa/state_tracker/st_extensions.c | 1 + 3 files changed, 87 insertions(+) diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index 3ef3ff34a9..bb5f02125f 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -102,6 +102,68 @@ framebuffer_quantize_num_samples(struct st_context *st, unsigned num_samples) return quantized_samples; } +/** + * Update the pipe_context's sample location state + */ +static void +update_sample_locations(struct st_context *st, +const struct pipe_framebuffer_state *fb_state) +{ + struct pipe_sample_locations_state locations; + struct gl_framebuffer *fb = st->ctx->DrawBuffer; + + if (!st->ctx->Extensions.ARB_sample_locations) + return; + + locations.enabled = fb->ProgrammableSampleLocations; + if (locations.enabled) { + unsigned grid_width, grid_height; + int samples = _mesa_geometric_samples(fb); + int pixel, sample_index; + bool sample_location_pixel_grid = fb->SampleLocationPixelGrid; + + st->pipe->get_sample_pixel_grid(st->pipe, samples, &grid_width, &grid_height); + + /** + * when a dimension is greater than MAX_SAMPLE_LOCATION_GRID_SIZE, + * st->ctx->Driver.GetSamplePixelGrid() returns 1 for both dimensions. + */ + if (grid_width>MAX_SAMPLE_LOCATION_GRID_SIZE || + grid_height>MAX_SAMPLE_LOCATION_GRID_SIZE) Space before/after > + sample_location_pixel_grid = false; + + for (pixel = 0; pixel < grid_width * grid_height; pixel++) { + for (sample_index = 0; sample_index < samples; sample_index++) { +int table_index = sample_index; +float x = 0.5f, y = 0.5f; +uint8_t loc; +if (sample_location_pixel_grid) + table_index = pixel * samples + sample_index; +if (fb->SampleLocationTable) { + x = fb->SampleLocationTable[table_index*2]; + y = fb->SampleLocationTable[table_index*2+1]; +} +if (st->state.fb_orientation == Y_0_BOTTOM) + y = 1.0 - y; + +loc = roundf(CLAMP(x*16.0f, 0.0f, 15.0f)); +loc |= (int)roundf(CLAMP(y*16.0f, 0.0f, 15.0f)) << 4; spaces before/after * +locations.locations[pixel*samples+sample_index] = loc; Spaces before/after *, + + } + } + + util_sample_locations_flip_y(st->pipe, &locations, fb_state); + } else { + /** + * util_sample_locations_flip_y() initializes unused data to 0x88, so + * this memset is not useful when locations.enabled is true. + */ + memset(locations.locations, 0x88, sizeof(locations.locations)); OK, what's the significance of 0x88 here and in the previous patch? + } + + cso_set_sample_locations(st->cso_context, &locations); +} + /** * Update framebuffer state (color, depth, stencil, etc. buffers) */ @@ -209,4 +271,6 @@ st_update_framebuffer_state( struct st_context *st ) st->state.fb_num_samples = util_framebuffer_get_num_samples(&framebuffer); st->state.fb_num_layers = util_framebuffer_get_num_layers(&framebuffer); st->state.fb_num_cb = framebuffer.nr_cbufs; + + update_sample_locations(st, &framebuffer); } diff --git a/src/mesa/state_tracker/st_cb_msaa.c b/src/mesa/state_tracker/st_cb_msaa.c index 7f1b4fde91..092e74d28e 100644 --- a/src/mesa/state_tracker/st_cb_msaa.c +++ b/src/mesa/state_tracker/st_cb_msaa.c @@ -56,8 +56,30 @@ st_GetSamplePosition(struct gl_context *ctx, } +static void +st_GetProgrammableSampleCaps(struct gl_context *ctx, struct gl_framebuffer *fb, + GLuint *outBits, GLuint *outWidth, GLuint *outHeight) +{ + struct st_context *st = st_context(ctx); + + st_validate_state(st, ST_PIPELINE_UPDATE_FRAMEBUFFER); + + if (st->pipe->get_sample_pixel_grid) + st->pipe->get_sample_pixel_grid(st->pipe, _mesa_geometric_samples(fb), + outWidth, outHeight); + *outBits = 4; + + /* We could handle this better in some circumstances, +* but it's not really an issue */ + if (*outWidth>MAX_SAMPLE_LOCATION_GRID_SIZE || *outHeight>MAX_SAMPLE_LOCATION_GRID_SIZE) { spaces before/after > It that line longer than 78 columns? + *outWidth = 1; + *outHeight = 1; + } +} + void st_init_msaa_functions(struct dd_function_table *functions) { functions->GetSamplePosition = st_GetSamplePosition; + functions->GetProgrammableSampleCaps = st_GetProgrammableSampleCaps; } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 0dc8adb262.
Re: [Mesa-dev] [PATCH 1/5] mesa: add support for ARB_sample_locations
A bunch of nit-picks below. On 05/04/2018 06:09 AM, Rhys Perry wrote: Signed-off-by: Rhys Perry --- src/mapi/glapi/gen/gl_API.xml | 52 +++ src/mesa/main/config.h | 7 + src/mesa/main/dd.h | 7 + src/mesa/main/extensions_table.h| 1 + src/mesa/main/fbobject.c| 247 src/mesa/main/fbobject.h| 20 +++ src/mesa/main/framebuffer.c | 10 ++ src/mesa/main/get.c | 32 + src/mesa/main/get_hash_params.py| 6 + src/mesa/main/mtypes.h | 6 + src/mesa/main/multisample.c | 18 +++ src/mesa/main/tests/dispatch_sanity.cpp | 10 ++ 12 files changed, 386 insertions(+), 30 deletions(-) diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 38c1921047..a23094a548 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -10891,6 +10891,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 81573bfbf2..444e4dedad 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -315,4 +315,11 @@ #define MAX_CLIPPED_VERTICES ((2 * (6 + MAX_CLIP_PLANES))+1) +/** For GL_ARB_sample_locations - maximum of SAMPLE_LOCATION_PIXEL_GRID_*_ARB */ +#define MAX_SAMPLE_LOCATION_GRID_SIZE 4 +/* It is theoretically possible for Consts.MaxSamples to be >32 but + * other code seems to assume that is not the case */ +#define MAX_SAMPLE_LOCATION_TABLE_SIZE \ + (MAX_SAMPLE_LOCATION_GRID_SIZE*MAX_SAMPLE_LOCATION_GRID_SIZE*32) + #endif /* MESA_CONFIG_H_INCLUDED */ diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index d85d89ef50..8929a2e267 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -785,6 +785,13 @@ struct dd_function_table { GLenum target, GLsizei numAttachments, const GLenum *attachments); + /** +* \name Functions for GL_ARB_sample_locations +*/ + void (*GetProgrammableSampleCaps)(struct gl_context *ctx, struct gl_framebuffer *fb, + GLuint *bits, GLuint *width, GLuint *height); + void (*EvaluateDepthValues)(struct gl_context *ctx, struct gl_framebuffer *fb); Can the fb param be const qualified for these? + /** * \name Query objects */ diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h index 492f7c3d20..3497cbea0e 100644 --- a/src/mesa/main/extensions_table.h +++ b/src/mesa/main/extensions_table.h @@ -103,6 +103,7 @@ EXT(ARB_provoking_vertex, EXT_provoking_vertex EXT(ARB_query_buffer_object , ARB_query_buffer_object , GLL, GLC, x , x , 2013) EXT(ARB_robust_buffer_access_behavior , ARB_robust_buffer_access_behavior , GLL, GLC, x , x , 2012) EXT(ARB_robustness , dummy_true , GLL, GLC, x , x , 2010) +EXT(ARB_sample_locations, ARB_sample_locations , GLL, GLC, x , ES2, 2015) EXT(ARB_sample_shading , ARB_sample_shading , GLL, GLC, x , x , 2009) EXT(ARB_sampler_objects , dummy_true , GLL, GLC, x , x , 2009) EXT(ARB_seamless_cube_map , ARB_seamless_cube_map , GLL, GLC, x , x , 2009) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index c72204e11a..33d7f0307d 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -35,6 +35,7 @@ #include "buffers.h" #include "context.h" +#include "debug_output.h" #include "enums.h" #include "fbobject.h" #include "formats.h" @@ -1403,15 +1404,57 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer) bind_renderbuffer(target, renderbuffer, true); } +static bool +_pname_writable_for_default_framebuffer(struct gl_context *ctx, +GLenum pname) +{ + switch (pname) { + case GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_ARB: + case GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_ARB: + return true; + default: + return false; + } +} The _ prefix on the function is not needed for static functions. ctx is not used. + /** - * ARB_framebuffer_no_attachment - Application passes requested param's - * here. NOTE: NumSamples requested need not be _NumSamples which is - * what the hw supports. + * ARB_framebuffer_no_attachment and ARB_sample_locations - Appli
Re: [Mesa-dev] [PATCH 2/5] gallium: add support for programmable sample locations
On 05/04/2018 06:09 AM, Rhys Perry wrote: Signed-off-by: Rhys Perry --- src/gallium/auxiliary/cso_cache/cso_context.c| 31 +++ src/gallium/auxiliary/cso_cache/cso_context.h| 5 src/gallium/auxiliary/util/u_framebuffer.c | 32 src/gallium/auxiliary/util/u_framebuffer.h | 6 + src/gallium/docs/source/context.rst | 2 ++ src/gallium/docs/source/screen.rst | 3 +++ src/gallium/drivers/etnaviv/etnaviv_screen.c | 1 + src/gallium/drivers/freedreno/freedreno_screen.c | 1 + src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/llvmpipe/lp_screen.c | 1 + src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 + src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 2 +- src/gallium/drivers/r300/r300_screen.c | 1 + src/gallium/drivers/r600/r600_pipe.c | 1 + src/gallium/drivers/radeonsi/si_get.c| 1 + src/gallium/drivers/softpipe/sp_screen.c | 1 + src/gallium/drivers/svga/svga_screen.c | 1 + src/gallium/drivers/swr/swr_screen.cpp | 1 + src/gallium/drivers/vc4/vc4_screen.c | 1 + src/gallium/drivers/vc5/vc5_screen.c | 1 + src/gallium/drivers/virgl/virgl_screen.c | 1 + src/gallium/include/pipe/p_context.h | 17 - src/gallium/include/pipe/p_defines.h | 1 + src/gallium/include/pipe/p_state.h | 26 +++ 25 files changed, 138 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 3a3a63a332..b3e09ada6e 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -121,6 +121,7 @@ struct cso_context { boolean render_condition_cond, render_condition_cond_saved; struct pipe_framebuffer_state fb, fb_saved; + struct pipe_sample_locations_state sample_locations, sample_locations_saved; struct pipe_viewport_state vp, vp_saved; struct pipe_blend_color blend_color; unsigned sample_mask, sample_mask_saved; @@ -745,6 +746,32 @@ cso_restore_framebuffer(struct cso_context *ctx) } +void cso_set_sample_locations(struct cso_context *ctx, + const struct pipe_sample_locations_state *locs) +{ + size_t size = sizeof(ctx->sample_locations); + if (memcmp(&ctx->sample_locations, locs, size)) { + memcpy(&ctx->sample_locations, locs, size); + ctx->pipe->set_sample_locations_state(ctx->pipe, locs); + } +} + +static void +cso_save_sample_locations(struct cso_context *ctx) +{ + size_t size = sizeof(ctx->sample_locations); + memcpy(&ctx->sample_locations_saved, &ctx->sample_locations, size); +} + +static void +cso_restore_sample_locations(struct cso_context *ctx) +{ + size_t size = sizeof(ctx->sample_locations); + if (memcmp(&ctx->sample_locations, &ctx->sample_locations_saved, size)) + cso_set_sample_locations(ctx, &ctx->sample_locations_saved); +} + + void cso_set_viewport(struct cso_context *ctx, const struct pipe_viewport_state *vp) { @@ -1636,6 +1663,8 @@ cso_save_state(struct cso_context *cso, unsigned state_mask) cso->pipe->set_active_query_state(cso->pipe, false); if (state_mask & CSO_BIT_FRAGMENT_IMAGE0) cso_save_fragment_image0(cso); + if (state_mask & CSO_BIT_SAMPLE_LOCATIONS) + cso_save_sample_locations(cso); } @@ -1691,6 +1720,8 @@ cso_restore_state(struct cso_context *cso) cso->pipe->set_active_query_state(cso->pipe, true); if (state_mask & CSO_BIT_FRAGMENT_IMAGE0) cso_restore_fragment_image0(cso); + if (state_mask & CSO_BIT_SAMPLE_LOCATIONS) + cso_restore_sample_locations(cso); cso->saved_state = 0; } diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 3a4e808f0c..3f3b0ae3d4 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -133,6 +133,10 @@ void cso_set_framebuffer(struct cso_context *cso, const struct pipe_framebuffer_state *fb); +void cso_set_sample_locations(struct cso_context *ctx, + const struct pipe_sample_locations_state *locs); + + void cso_set_viewport(struct cso_context *cso, const struct pipe_viewport_state *vp); void cso_set_viewport_dims(struct cso_context *ctx, @@ -176,6 +180,7 @@ void cso_set_render_condition(struct cso_context *cso, #define CSO_BIT_VIEWPORT 0x4 #define CSO_BIT_PAUSE_QUERIES 0x8 #define CSO_BIT_FRAGMENT_IMAGE0 0x10 +#define CSO_BIT_SAMPLE_LOCATIONS 0x20 #define CSO_BITS_ALL_SHADERS (CSO_BIT_VERTEX_S
[Mesa-dev] [PATCH] glsl/tests: add GLSL_TYPE_UINT8, GLSL_TYPE_INT8 cases to switch statements
To silence warnings about unhandled switch values. Untested otherwise. --- src/compiler/glsl/tests/uniform_initializer_utils.cpp | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/glsl/tests/uniform_initializer_utils.cpp b/src/compiler/glsl/tests/uniform_initializer_utils.cpp index 0d7fa26..1575b0a 100644 --- a/src/compiler/glsl/tests/uniform_initializer_utils.cpp +++ b/src/compiler/glsl/tests/uniform_initializer_utils.cpp @@ -83,6 +83,8 @@ generate_data_element(void *mem_ctx, const glsl_type *type, switch (type->base_type) { case GLSL_TYPE_UINT: case GLSL_TYPE_INT: + case GLSL_TYPE_UINT8: + case GLSL_TYPE_INT8: case GLSL_TYPE_SAMPLER: case GLSL_TYPE_IMAGE: data.i[i] = values[idx]; @@ -126,6 +128,8 @@ generate_data_element(void *mem_ctx, const glsl_type *type, switch (type->base_type) { case GLSL_TYPE_UINT: case GLSL_TYPE_INT: + case GLSL_TYPE_UINT8: + case GLSL_TYPE_INT8: case GLSL_TYPE_SAMPLER: case GLSL_TYPE_IMAGE: ASSERT_EQ(data.i[i], val->value.i[i]); @@ -257,6 +261,8 @@ verify_data(gl_constant_value *storage, unsigned storage_array_size, switch (val->type->base_type) { case GLSL_TYPE_UINT: case GLSL_TYPE_INT: +case GLSL_TYPE_UINT8: +case GLSL_TYPE_INT8: case GLSL_TYPE_SAMPLER: case GLSL_TYPE_IMAGE: EXPECT_EQ(val->value.i[i], storage[i].i); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] tgsi: use enums instead of unsigned in ureg code
--- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 14 +++--- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 10 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 393e015..7d2b9af 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -170,7 +170,7 @@ struct ureg_program struct { unsigned index; enum tgsi_texture_type target; - unsigned format; + enum pipe_format format; boolean wr; boolean raw; } image[PIPE_MAX_SHADER_IMAGES]; @@ -773,7 +773,7 @@ struct ureg_src ureg_DECL_image(struct ureg_program *ureg, unsigned index, enum tgsi_texture_type target, -unsigned format, +enum pipe_format format, boolean wr, boolean raw) { @@ -1363,8 +1363,8 @@ void ureg_emit_memory(struct ureg_program *ureg, unsigned extended_token, unsigned qualifier, - unsigned texture, - unsigned format) + enum tgsi_texture_type texture, + enum pipe_format format) { union tgsi_any_token *out, *insn; @@ -1478,8 +1478,8 @@ ureg_memory_insn(struct ureg_program *ureg, const struct ureg_src *src, unsigned nr_src, unsigned qualifier, - unsigned texture, - unsigned format) + enum tgsi_texture_type texture, + enum pipe_format format) { struct ureg_emit_insn_result insn; unsigned i; @@ -1719,7 +1719,7 @@ static void emit_decl_image(struct ureg_program *ureg, unsigned index, enum tgsi_texture_type target, -unsigned format, +enum pipe_format format, boolean wr, boolean raw) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 7eef94a..ac46da5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -372,7 +372,7 @@ struct ureg_src ureg_DECL_image(struct ureg_program *ureg, unsigned index, enum tgsi_texture_type target, -unsigned format, +enum pipe_format format, boolean wr, boolean raw); @@ -579,8 +579,8 @@ ureg_memory_insn(struct ureg_program *ureg, const struct ureg_src *src, unsigned nr_src, unsigned qualifier, - unsigned texture, - unsigned format); + enum tgsi_texture_type texture, + enum pipe_format format); /*** * Internal instruction helpers, don't call these directly: @@ -619,8 +619,8 @@ void ureg_emit_memory(struct ureg_program *ureg, unsigned insn_token, unsigned qualifier, - unsigned texture, - unsigned format); + enum tgsi_texture_type texture, + enum pipe_format format); void ureg_emit_dst( struct ureg_program *ureg, -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v7 0/4] Implement Various Conservative Rasterization Extensions
On 04/27/2018 11:34 AM, Rhys Perry wrote: This patch-set adds support for GL_NV_conservative_raster and GL_NV_conservative_raster_dilate on GM2xx and newer. It also adds support for GL_NV_conservative_raster_pre_snap_triangles on GP1xx. In doing so, it implements various functions in mesa core, extends the Gallium API, connects the new mesa core functions and the Gallium API through st/mesa and implements support for the Gallium API in the Nouveau driver. Changes in v7: - fix compilation warnings regarding _mesa_error() - improve errors generated in conservative_raster_parameter() Changes in v6: - some small stylistic changes - use no_error in conservative_raster_parameter() - fix compilation in patch 3 Changes in v5: - use CLAMP() when setting GL_CONSERVATIVE_RASTER_DILATE_NV - use ALWAYS_INLINE for conservative_raster_parameter() Changes in v4: - many small stylistic changes - small updates to reduce the size of the PGRAPH macro Changes in v3: - rename SubpixelPrecisionBias to NvSubpixelPrecisionBias - move the subpixel precision bias into pipe_rasterizer_state - set the conservative rasterization state using a PGRAPH macro Changes in v2: - fix indentation error in gl_API.xml - fix code to handle earlier hardware Rhys Perry (4): mesa: add support for nvidia conservative rasterization extensions gallium: add initial support for conservative rasterization st/mesa: add support for nvidia conservative rasterization extensions nvc0: add conservative rasterization support The patches look OK to me. Thanks for your persistence. I'll add my R-b and push the series today (AFAIK, you don't have git permission). -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v6 0/4] Implement Various Conservative Rasterization Extensions
On 04/27/2018 08:43 AM, Rhys Perry wrote: This patch-set adds support for GL_NV_conservative_raster and GL_NV_conservative_raster_dilate on GM2xx and newer. It also adds support for GL_NV_conservative_raster_pre_snap_triangles on GP1xx. In doing so, it implements various functions in mesa core, extends the Gallium API, connects the new mesa core functions and the Gallium API through st/mesa and implements support for the Gallium API in the Nouveau driver. I'm seeing some gcc warnings: ../../../src/mesa/main/conservativeraster.c: In function ‘conservative_raster_parameter’: ../../../src/mesa/main/conservativeraster.c:43:7: warning: format not a string literal and no format arguments [-Wformat-security] _mesa_error(ctx, GL_INVALID_OPERATION, func); ^ ../../../src/mesa/main/conservativeraster.c:56:10: warning: format not a string literal and no format arguments [-Wformat-security] _mesa_error(ctx, GL_INVALID_OPERATION, func); ^ ../../../src/mesa/main/conservativeraster.c:71:10: warning: format not a string literal and no format arguments [-Wformat-security] _mesa_error(ctx, GL_INVALID_OPERATION, func); ^ -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v5 1/4] mesa: add support for nvidia conservative rasterization extensions
On 04/26/2018 04:33 PM, Rhys Perry wrote: For Brian Paul: Since you seemed to have looked over v3 of this patch, you were Cc'd. Compared to v3, it fixes the style problems (including the CLAMP() thing) and adds ALWAYS_INLINE to conservative_raster_parameter(). A few more nit-picks below. -Brian [Mesa-dev] [PATCH v5 1/4] mesa: add support for nvidia conservative rasterization extensions Rhys Perry pendingchaos02 at gmail.com Sat Apr 7 22:15:02 UTC 2018 Previous message (by thread): [Mesa-dev] [PATCH v5 0/4] Implement Various Conservative Rasterization Extensions Next message (by thread): [Mesa-dev] [PATCH v5 2/4] gallium: add initial support for conservative rasterization Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Although the specs are written against compatibility GL 4.3 and allows core profile and GLES2+, it is exposed for GL 1.0+ and GLES1 and GLES2+. Signed-off-by: Rhys Perry --- src/mapi/glapi/gen/gl_API.xml | 47 src/mapi/glapi/gen/gl_genexec.py| 1 + src/mesa/Makefile.sources | 2 + src/mesa/main/attrib.c | 60 --- src/mesa/main/conservativeraster.c | 127 src/mesa/main/conservativeraster.h | 48 src/mesa/main/context.c | 10 +++ src/mesa/main/dlist.c | 86 + src/mesa/main/enable.c | 14 src/mesa/main/extensions_table.h| 4 + src/mesa/main/get.c | 3 + src/mesa/main/get_hash_params.py| 13 src/mesa/main/mtypes.h | 28 ++- src/mesa/main/tests/dispatch_sanity.cpp | 27 +++ src/mesa/main/viewport.c| 57 ++ src/mesa/main/viewport.h| 6 ++ src/mesa/meson.build| 2 + 17 files changed, 524 insertions(+), 11 deletions(-) create mode 100644 src/mesa/main/conservativeraster.c create mode 100644 src/mesa/main/conservativeraster.h diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 38c1921047..db312370b1 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -12871,6 +12871,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://www.w3.org/2001/XInclude"/> diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py index aaff9f230b..be8013b62b 100644 --- a/src/mapi/glapi/gen/gl_genexec.py +++ b/src/mapi/glapi/gen/gl_genexec.py @@ -62,6 +62,7 @@ header = """/** #include "main/colortab.h" #include "main/compute.h" #include "main/condrender.h" +#include "main/conservativeraster.h" #include "main/context.h" #include "main/convolve.h" #include "main/copyimage.h" diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index 92565ef8f5..952949c737 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -49,6 +49,8 @@ MAIN_FILES = \ main/condrender.c \ main/condrender.h \ main/config.h \ + main/conservativeraster.c \ + main/conservativeraster.h \ main/context.c \ main/context.h \ main/convolve.c \ diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 9c632ffb51..50be1fee7e 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -138,6 +138,9 @@ struct gl_enable_attrib /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */ GLboolean sRGBEnabled; + + /* GL_NV_conservative_raster */ + GLboolean ConservativeRasterization; }; @@ -178,6 +181,13 @@ struct texture_state }; +struct viewport_state +{ + struct gl_viewport_attrib ViewportArray[MAX_VIEWPORTS]; + GLuint SubpixelPrecisionBias[2]; +}; + + /** An unused GL_*_BIT value */ #define DUMMY_BIT 0x1000 @@ -394,6 +404,9 @@ _mesa_PushAttrib(GLbitfield mask) /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */ attr->sRGBEnabled = ctx->Color.sRGBEnabled; + + /* GL_NV_conservative_raster */ + attr->ConservativeRasterization = ctx->ConservativeRasterization; } if (mask & GL_EVAL_BIT) { @@ -545,11 +558,23 @@ _mesa_PushAttrib(GLbitfield mask) } if (mask & GL_VIEWPORT_BIT) { - if (!push_attrib(ctx, &head, GL_VIEWPORT_BIT, - sizeof(struct gl_viewport_attrib) - * ctx->Const.MaxViewports, - (void*)&ctx->ViewportArray)) + struct viewport_state *viewstate = CALLOC_STRUCT(viewport_state); + if (!viewstate) { +
Re: [Mesa-dev] [PATCH] st/mesa: fix missing setting of _ElementSize in new_draw_rasterpos_stage
Reviewed-by: Brian Paul On 04/26/2018 10:29 AM, Charmaine Lee wrote: With this patch, _ElementSize is initialized along with the rest of the vertex array attributes in new_draw_rasterpos_stage(). This fixes a crash in st_pipe_vertex_format() when running topogun-1.06-orc-84k-resize trace file with VMware svga driver. --- src/mesa/state_tracker/st_cb_rasterpos.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 4e5417b..b73d543 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -40,6 +40,7 @@ #include "main/macros.h" #include "main/feedback.h" #include "main/rastpos.h" +#include "glformats.h" #include "st_context.h" #include "st_atom.h" @@ -182,6 +183,7 @@ new_draw_rastpos_stage(struct gl_context *ctx, struct draw_context *draw) { struct rastpos_stage *rs = ST_CALLOC_STRUCT(rastpos_stage); GLuint i; + GLuint elementSize; rs->stage.draw = draw; rs->stage.next = NULL; @@ -196,12 +198,15 @@ new_draw_rastpos_stage(struct gl_context *ctx, struct draw_context *draw) rs->binding.Stride = 0; rs->binding.BufferObj = NULL; + + elementSize = _mesa_bytes_per_vertex_attrib(4, GL_FLOAT); for (i = 0; i < ARRAY_SIZE(rs->array); i++) { rs->attrib[i].Size = 4; rs->attrib[i].Type = GL_FLOAT; rs->attrib[i].Format = GL_RGBA; rs->attrib[i].Ptr = (GLubyte *) ctx->Current.Attrib[i]; rs->attrib[i].Normalized = GL_TRUE; + rs->attrib[i]._ElementSize = elementSize; rs->array[i].BufferBinding = &rs->binding; rs->array[i].VertexAttrib = &rs->attrib[i]; } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] mesa: merge the driver functions DrawBuffers and DrawBuffer
The series looks OK to me. Reviewed-by: Brian Paul On 04/13/2018 10:45 PM, Timothy Arceri wrote: The extra params we unused by the drivers that used DrawBuffers. --- src/mesa/drivers/common/driverfuncs.c| 1 - src/mesa/drivers/dri/nouveau/nouveau_state.c | 4 ++-- src/mesa/main/buffers.c | 8 ++-- src/mesa/main/dd.h | 2 -- src/mesa/state_tracker/st_cb_fbo.c | 9 - 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 11134b69e94..b7ac2b5b434 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -134,7 +134,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->ColorMaterial = NULL; driver->CullFace = NULL; driver->DrawBuffer = NULL; - driver->DrawBuffers = NULL; driver->FrontFace = NULL; driver->DepthFunc = NULL; driver->DepthMask = NULL; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c index e2b01043675..91ca95b5907 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_state.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c @@ -115,7 +115,7 @@ nouveau_read_buffer(struct gl_context *ctx, GLenum buffer) } static void -nouveau_draw_buffers(struct gl_context *ctx, GLsizei n, const GLenum *buffers) +nouveau_draw_buffer(struct gl_context *ctx, GLenum buffers) { nouveau_validate_framebuffer(ctx); context_dirty(ctx, FRAMEBUFFER); @@ -519,7 +519,7 @@ nouveau_state_init(struct gl_context *ctx) ctx->Driver.DepthFunc = nouveau_depth_func; ctx->Driver.DepthMask = nouveau_depth_mask; ctx->Driver.ReadBuffer = nouveau_read_buffer; - ctx->Driver.DrawBuffers = nouveau_draw_buffers; + ctx->Driver.DrawBuffer = nouveau_draw_buffer; ctx->Driver.Enable = nouveau_enable; ctx->Driver.Fogfv = nouveau_fog; ctx->Driver.Lightfv = nouveau_light; diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 5492227de08..7bb5725d085 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -304,9 +304,7 @@ draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb, /* Call device driver function only if fb is the bound draw buffer */ if (fb == ctx->DrawBuffer) { - if (ctx->Driver.DrawBuffers) - ctx->Driver.DrawBuffers(ctx, 1, &buffer); - else if (ctx->Driver.DrawBuffer) + if (ctx->Driver.DrawBuffer) ctx->Driver.DrawBuffer(ctx, buffer); } } @@ -587,9 +585,7 @@ draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLsizei n, * may not be valid. */ if (fb == ctx->DrawBuffer) { - if (ctx->Driver.DrawBuffers) - ctx->Driver.DrawBuffers(ctx, n, buffers); - else if (ctx->Driver.DrawBuffer) + if (ctx->Driver.DrawBuffer) ctx->Driver.DrawBuffer(ctx, n > 0 ? buffers[0] : GL_NONE); } } diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 64ddd818835..d85d89ef50c 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -612,8 +612,6 @@ struct dd_function_table { void (*DepthRange)(struct gl_context *ctx); /** Specify the current buffer for writing */ void (*DrawBuffer)( struct gl_context *ctx, GLenum buffer ); - /** Specify the buffers for writing for fragment programs*/ - void (*DrawBuffers)(struct gl_context *ctx, GLsizei n, const GLenum *buffers); /** Enable or disable server-side gl capabilities */ void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state); /** Specify fog parameters */ diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index f859133e399..696a08fd65b 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -714,13 +714,12 @@ st_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) * created FBOs. */ static void -st_DrawBuffers(struct gl_context *ctx, GLsizei count, const GLenum *buffers) +st_DrawBuffer(struct gl_context *ctx, GLenum buffer) { struct st_context *st = st_context(ctx); struct gl_framebuffer *fb = ctx->DrawBuffer; - (void) count; - (void) buffers; + (void) buffer; if (_mesa_is_winsys_fbo(fb)) { GLuint i; @@ -737,7 +736,7 @@ st_DrawBuffers(struct gl_context *ctx, GLsizei count, const GLenum *buffers) /** - * Called via glReadBuffer. As with st_DrawBuffers, we use this function + * Called via glReadBuffer. As with st_DrawBuffer, we use this function * to check if we need to allocate a renderbuffer on demand. */ static void @@ -869,7 +868,7 @@ st_init_fbo_functions(struct dd_function_table *functions) functions->FinishRenderTexture = st_finish_r
[Mesa-dev] [PATCH 4/5] gallium/util: put (void) in a few function signatures
To match the header file. --- src/gallium/auxiliary/util/u_network.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/util/u_network.c b/src/gallium/auxiliary/util/u_network.c index e74293b..89395f5 100644 --- a/src/gallium/auxiliary/util/u_network.c +++ b/src/gallium/auxiliary/util/u_network.c @@ -20,7 +20,7 @@ #endif boolean -u_socket_init() +u_socket_init(void) { #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) WORD wVersionRequested; @@ -44,7 +44,7 @@ u_socket_init() } void -u_socket_stop() +u_socket_stop(void) { #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) WSACleanup(); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/5] gallium/osmesa: link with winsock2 library on Windows
To fix the MSVC build. The build broke because we started to compile the ddebug code on Windows after the mtypes.h changes. Building ddebug caused us to also use the u_network.c code for the first time. --- src/gallium/targets/osmesa/SConscript | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/targets/osmesa/SConscript b/src/gallium/targets/osmesa/SConscript index f49f1fe..3df5c50 100644 --- a/src/gallium/targets/osmesa/SConscript +++ b/src/gallium/targets/osmesa/SConscript @@ -39,6 +39,9 @@ if env['platform'] == 'windows': sources += ['osmesa.mingw.def'] else: sources += ['osmesa.def'] +# Link with winsock2 library +env.Append(LIBS = ['ws2_32']) + gallium_osmesa = env.SharedLibrary( target ='osmesa', -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/5] mesa: remove unused 'i' in dimensions_error_check()
--- src/mesa/main/texgetimage.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 69521c5..0ab9ed4 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -913,7 +913,6 @@ dimensions_error_check(struct gl_context *ctx, const char *caller) { const struct gl_texture_image *texImage; - int i; if (xoffset < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "%s(xoffset = %d)", caller, xoffset); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/5] mesa: protect #include of unistd.h with _MSV_VER check
unistd.h is unix only. --- src/mesa/program/program_lexer.l | 4 1 file changed, 4 insertions(+) diff --git a/src/mesa/program/program_lexer.l b/src/mesa/program/program_lexer.l index 13eb902..c4973fd 100644 --- a/src/mesa/program/program_lexer.l +++ b/src/mesa/program/program_lexer.l @@ -21,7 +21,11 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ + +#ifndef _MSC_VER #include +#endif + #include "main/glheader.h" #include "main/imports.h" #include "program/prog_instruction.h" -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/5] ddebug: add PIPE_OS_UNIX/LINUX checks to fix MSVC build
Don't include Unix headers or use Unix functions when building with MSVC. --- src/gallium/auxiliary/driver_ddebug/dd_draw.c | 5 + src/gallium/auxiliary/driver_ddebug/dd_util.h | 9 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/driver_ddebug/dd_draw.c b/src/gallium/auxiliary/driver_ddebug/dd_draw.c index c404ea0..cb5db8a 100644 --- a/src/gallium/auxiliary/driver_ddebug/dd_draw.c +++ b/src/gallium/auxiliary/driver_ddebug/dd_draw.c @@ -37,6 +37,7 @@ #include "tgsi/tgsi_scan.h" #include "util/os_time.h" #include +#include "pipe/p_config.h" static void @@ -69,6 +70,7 @@ dd_get_file_stream(struct dd_screen *dscreen, unsigned apitrace_call_number) static void dd_dump_dmesg(FILE *f) { +#ifdef PIPE_OS_LINUX char line[2000]; FILE *p = popen("dmesg | tail -n60", "r"); @@ -80,6 +82,7 @@ dd_dump_dmesg(FILE *f) fputs(line, f); pclose(p); +#endif } static unsigned @@ -611,7 +614,9 @@ dd_dump_call(FILE *f, struct dd_draw_state *state, struct dd_call *call) static void dd_kill_process(void) { +#ifdef PIPE_OS_UNIX sync(); +#endif fprintf(stderr, "dd: Aborting the process...\n"); fflush(stdout); fflush(stderr); diff --git a/src/gallium/auxiliary/driver_ddebug/dd_util.h b/src/gallium/auxiliary/driver_ddebug/dd_util.h index bdfb7cc..8953e34 100644 --- a/src/gallium/auxiliary/driver_ddebug/dd_util.h +++ b/src/gallium/auxiliary/driver_ddebug/dd_util.h @@ -30,14 +30,19 @@ #include #include -#include -#include #include "c99_alloca.h" #include "os/os_process.h" #include "util/u_atomic.h" #include "util/u_debug.h" +#include "pipe/p_config.h" +#ifdef PIPE_OS_UNIX +#include +#include +#endif + + /* name of the directory in home */ #define DD_DIR "ddebug_dumps" -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] mesa: remove snprintf macro in imports.h to fix MSVC build
snprintf is a macro in the MSVC stdio.h header and we needed to include that header before imports.h where we also defined an snprintf macro. Otherwise, the MSVC build would fail. The recent mtypes.h removal patches seems to have exposed this issue. This patch simply removes our snprintf macro and replaces one use of it in teximage.c with _mesa_snprintf(). There are other calls to snprintf() in DRI drivers, but none of them are built on Windows. --- src/mesa/main/imports.h | 4 src/mesa/main/teximage.c | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 72ce878..a761f01 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -339,10 +339,6 @@ extern int _mesa_vsnprintf(char *str, size_t size, const char *fmt, va_list arg); -#if defined(_MSC_VER) && !defined(snprintf) -#define snprintf _snprintf -#endif - #if defined(_WIN32) && !defined(strtok_r) #define strtok_r strtok_s #endif diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 8d5f8aa..5284e60 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1911,7 +1911,7 @@ texture_error_check( struct gl_context *ctx, * requires GL_OES_texture_float) are filtered elsewhere. */ char bufCallerName[20]; - snprintf(bufCallerName, 20, "glTexImage%dD", dimensions); + _mesa_snprintf(bufCallerName, 20, "glTexImage%dD", dimensions); if (_mesa_is_gles(ctx) && texture_format_error_check_gles(ctx, format, type, internalFormat, bufCallerName)) { -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] glsl: rename 'interface' var to 'iface' to fix MSVC build
The recent mtypes.h removal patches seems to have exposed a MSVC issue where 'interface' is defined as a macro in an MSVC header file. --- src/compiler/glsl/linker.cpp | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index ecd267b..f060c53 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -4201,7 +4201,7 @@ get_array_size(struct gl_uniform_storage *uni, const glsl_struct_field *field, static int get_array_stride(struct gl_context *ctx, struct gl_uniform_storage *uni, - const glsl_type *interface, const glsl_struct_field *field, + const glsl_type *iface, const glsl_struct_field *field, char *interface_name, char *var_name) { /* The ARB_program_interface_query spec says: @@ -4227,7 +4227,7 @@ get_array_stride(struct gl_context *ctx, struct gl_uniform_storage *uni, return 0; if (GLSL_INTERFACE_PACKING_STD140 == - interface-> + iface-> get_internal_ifc_packing(ctx->Const.UseSTD430AsDefaultPacking)) { if (array_type->is_record() || array_type->is_array()) return glsl_align(array_type->std140_size(row_major), 16); @@ -4281,17 +4281,17 @@ calculate_array_size_and_stride(struct gl_context *ctx, var->data.mode != ir_var_shader_storage) continue; - const glsl_type *interface = var->get_interface_type(); + const glsl_type *iface = var->get_interface_type(); - if (strcmp(interface_name, interface->name) != 0) + if (strcmp(interface_name, iface->name) != 0) continue; - for (unsigned i = 0; i < interface->length; i++) { -const glsl_struct_field *field = &interface->fields.structure[i]; + for (unsigned i = 0; i < iface->length; i++) { +const glsl_struct_field *field = &iface->fields.structure[i]; if (strcmp(field->name, var_name) != 0) continue; -array_stride = get_array_stride(ctx, uni, interface, field, +array_stride = get_array_stride(ctx, uni, iface, field, interface_name, var_name); array_size = get_array_size(uni, field, interface_name, var_name); goto write_top_level_array_size_and_stride; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] glsl: #undef THIS macro to fix MSVC build
THIS is a macro in one of the MSVC header files. It's also a token in the GLSL lexer. This causes a compilation failure with MSVC. This issue seems to be newly exposed after the recent mtypes.h removal patches. --- src/compiler/glsl/glsl_parser_extras.h | 5 + 1 file changed, 5 insertions(+) diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index 66bd1a3..5b9b6cc 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -33,6 +33,11 @@ #include #include "glsl_symbol_table.h" +/* THIS is a macro defined somewhere deep in the Windows MSVC header files. + * Undefine it here to avoid collision with the lexer's THIS token. + */ +#undef THIS + struct gl_context; struct glsl_switch_state { -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH] mesa: call DrawBuffer(s) driver hook in update_framebuffer for windows-system FB
On 04/13/2018 05:43 AM, Timothy Arceri wrote: On 02/02/17 10:58, Brian Paul wrote: On 01/20/2017 07:18 AM, Manolova, Plamena wrote: This looks good to me :) Reviewed-by: Plamena Manolova mailto:plamena.manol...@intel.com>> On Fri, Jan 20, 2017 at 9:38 AM, Boyan Ding mailto:boyan.j.d...@gmail.com>> wrote: When draw buffers are changed on a bound framebuffer, DrawBuffer(s) hook should be called. However, it is missing in update_framebuffer with window-system framebuffer, in which FB's draw buffer state should match context state, potentially resulting in a change. Bugzilla: https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D99116&d=DwIDaQ&c=uilaK90D4TOVoH58JNXRgQ&r=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA&m=RuLO-5nWOnGpux5W2eCSq_dg2uX8l5i15Ukj83SUjuo&s=561CkiJD4E9v5MalkqxqM7tUtPNTXyKaGSfxK5L42DA&e= <https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D99116&d=DwMFaQ&c=uilaK90D4TOVoH58JNXRgQ&r=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA&m=2GGgfjdsGMbJ2pASP3bJmF1nMiMrJOccqZRrDIWqBOs&s=gFMFh5kphG6qUCsOIbyrliSjbX9cw3WsydU46OcuE14&e=> Signed-off-by: Boyan Ding mailto:boyan.j.d...@gmail.com>> --- src/mesa/main/framebuffer.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index c06130dc8d..55a6d5c004 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -670,6 +670,16 @@ update_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) if (fb->ColorDrawBuffer[0] != ctx->Color.DrawBuffer[0]) { _mesa_drawbuffers(ctx, fb, ctx->Const.MaxDrawBuffers, ctx->Color.DrawBuffer, NULL); + + /* Call device driver function if fb is the bound draw buffer. */ + if (fb == ctx->DrawBuffer) { + if (ctx->Driver.DrawBuffers) { + ctx->Driver.DrawBuffers(ctx, ctx->Const.MaxDrawBuffers, + ctx->Color.DrawBuffer); + } else if (ctx->Driver.DrawBuffer) { + ctx->Driver.DrawBuffer(ctx, ctx->Color.DrawBuffer[0]); + } + } } } else { This makes three places in the code where we call ctx->Driver.DrawBuffers() or ctx->Driver.DrawBuffer() like this. I think some refactoring would be good. Perhaps these calls can go into _mesa_drawbuffers(). I'll try to look into that in a few days. Hi Brain, are you happy if we push this in the meantime? It seems to impact a number of apps running on Wine? I don't have time to look at it myself right now. So if it looks good to you and you can check it in, go for it. Thanks. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] mesa: include mtypes.h less
On 04/11/2018 02:09 PM, Marek Olšák wrote: From: Marek Olšák - remove mtypes.h from most header files - add main/menums.h for often used definitions FWIW, mtypes.h was originally types.h. A long time ago, there was some obscure platform that had a /usr/include/types.h header and the compiler would errantly include it instead of Mesa's types.h. So I renamed types.h to mtypes.h to work around that. If you wanted to name the new file enums.h instead of menums.h that'd be OK. No big deal though. Otherwise, the series looks OK to me, though I see that Dylan found an issue. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 04/11] gallium: Use Array._DrawVAO in st_atom_array.c.
Hmm, in my experience, interleaved arrays are fairly common. I still haven't had much time to look at Mathias's latest patches. And I haven't looked this code in the state tracker recently, but I seem to recall there was some difference between interleaved arrays (in one VBO) vs. separate arrays in separate VBOs that needed special handling. As for determining whether arrays are interleaved, if that's something we still need to do, I think it could be lifted into core Mesa. We could add a new gl_vertex_array_object::_IsInterleaved field which is only updated when the VAO state is modified. -Brian On 04/10/2018 12:09 PM, Marek Olšák wrote: Generally, if you have to loop over all arrays to find common vertex buffers, it's better not to do it. The default separate path is going to perform best, because it's straightforward and interleaved arrays are super rare. Marek On Mon, Apr 9, 2018 at 7:15 PM, Mathias Fröhlich mailto:mathias.froehl...@gmx.net>> wrote: Hi Marek, On Saturday, 7 April 2018 01:53:58 CEST Marek Olšák wrote: > So interleaved attribs are unsupported, right? > > is_interleaved_arrays was probably slowing things down, so I'm OK with that. I am currently away from all the source code and be back at about the 22.4. But out of my head: The main purpose of the is_interleaved_arrays that I could spot is to minimize the vbo's that are send down the pipeline. In the non vbo case the is_interleaved_arrays check did nothing I could finally spot? The buffer itself is marked as user buffer and we need a new vbuffer because of the pointer value anyway? Correct? So, the VAO now contains all the redundancy information. And thanks to this bitmask sieves we can easily collect the arrays belonging to a specific precollapsed binding point. So, the is_interleaved is fully there in the vbo case. Even better as before. It sees even 4 attributes distributed across two pairwise interleaved vbo arrays. So even if you are fine, if you tell me that the user buffer code can make use of the same sharing finally, I can take a look at that and establish the same sort of sharing here. best Mathias > > Marek > > On Sun, Apr 1, 2018 at 2:13 PM, mailto:mathias.froehl...@gmx.net>> wrote: > > From: Mathias Fröhlich mailto:mathias.froehl...@web.de>> > > > > Finally make use of the binding information in the VAO when > > setting up arrays for draw. > > > > Signed-off-by: Mathias Fröhlich mailto:mathias.froehl...@web.de>> > > --- > > > > src/mesa/state_tracker/st_atom_array.c | 448 > > > > + > > > > 1 file changed, 124 insertions(+), 324 deletions(-) > > > > diff --git a/src/mesa/state_tracker/st_atom_array.c > > b/src/mesa/state_tracker/st_atom_array.c > > index 2fd67e8d84..46934a718a 100644 > > --- a/src/mesa/state_tracker/st_atom_array.c > > +++ b/src/mesa/state_tracker/st_atom_array.c > > @@ -48,6 +48,7 @@ > > > > #include "main/bufferobj.h" > > #include "main/glformats.h" > > #include "main/varray.h" > > > > +#include "main/arrayobj.h" > > > > /* vertex_formats[gltype - GL_BYTE][integer*2 + normalized][size - 1] */ > > static const uint16_t vertex_formats[][4][4] = { > > > > @@ -306,79 +307,6 @@ st_pipe_vertex_format(const struct > > gl_array_attributes *attrib) > > > > return vertex_formats[type - GL_BYTE][index][size-1]; > > > > } > > > > -static const struct gl_vertex_array * > > -get_client_array(const struct gl_vertex_array *arrays, > > - unsigned mesaAttr) > > -{ > > - /* st_program uses 0x to denote a double placeholder attribute > > */ > > - if (mesaAttr == ST_DOUBLE_ATTRIB_PLACEHOLDER) > > - return NULL; > > - return &arrays[mesaAttr]; > > -} > > - > > -/** > > - * Examine the active arrays to determine if we have interleaved > > - * vertex arrays all living in one VBO, or all living in user space. > > - */ > > -static GLboolean > > -is_interleaved_arrays(const struct st_vertex_program *vp, > > - const struct gl_vertex_array *arrays, > > - unsigned num_inputs) > > -{ > > - GLuint attr; > > - const struct gl_buffer_object *firstBufObj = NULL; > > - GLint firstStride = -1; > > - const GLubyte *firstPtr = NULL; > > - GLboolean userSpaceBuffer = GL_FALSE; > > - > > - for (attr = 0; attr < num_inputs; attr++) { > > - const struct gl_vertex_array *array; > > - const struct gl_vertex_buffer_binding *binding; > > - const struct gl_array_attributes *attrib; > > -
Re: [Mesa-dev] [PATCH] mesa: Assert base format before truncating to unsigned short
On 04/06/2018 08:26 AM, Topi Pohjolainen wrote: CID: 1433709 Fixes: ca721b3d8: mesa: use GLenum16 in a few more places CC: Marek Olšák CC: Brian Paul Signed-off-by: Topi Pohjolainen --- src/mesa/main/teximage.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 8f53510..f560512 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -845,6 +845,7 @@ _mesa_init_teximage_fields_ms(struct gl_context *ctx, mesa_format format, GLuint numSamples, GLboolean fixedSampleLocations) { + const GLint base_format =_mesa_base_tex_format(ctx, internalFormat); space after = GLenum target; assert(img); assert(width >= 0); @@ -852,8 +853,8 @@ _mesa_init_teximage_fields_ms(struct gl_context *ctx, assert(depth >= 0); target = img->TexObject->Target; - img->_BaseFormat = _mesa_base_tex_format( ctx, internalFormat ); - assert(img->_BaseFormat != -1); + assert(base_format != -1); + img->_BaseFormat = (GLenum16)base_format; img->InternalFormat = internalFormat; img->Border = border; img->Width = width; Reviewed-by: Brian Paul It would probably be nicer if _mesa_base_tex_format() returned GL_NONE for error, instead of -1. But this is OK for now. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] Fix a typo in src/compiler/Makefile.nir.am
On 04/06/2018 10:28 AM, Bastien Orivel wrote: Since 31d91f019b58ca362c05db1fd0c75fedd169cd7b, the makefile tries to find the file SConstript.spirv instead of SConscript.spirv which breaks the make dist command. --- src/compiler/Makefile.nir.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/Makefile.nir.am b/src/compiler/Makefile.nir.am index 27dc129e57..4ccd7f36be 100644 --- a/src/compiler/Makefile.nir.am +++ b/src/compiler/Makefile.nir.am @@ -101,4 +101,4 @@ EXTRA_DIST += \ nir/tests \ nir/README \ SConscript.nir \ - SConstript.spirv + SConscript.spirv Reviewed-by: Brian Paul I'll check this in for you. Thanks! ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: Also use PIPE_FORMAT_R8G8B8A8_SRGB for framebuffer_sRGB.
On 04/03/2018 10:06 AM, Jakob Bornecrantz wrote: When running virgl on a GLES host the only sRGB formats that support rendering is RGBA and RGBX. That pipe format is in the sRGB default lists that the state tracker uses when mapping mesa formats. Cheers, Jakob. Signed-off-by: Jakob Bornecrantz --- src/mesa/state_tracker/st_extensions.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index bea61f21cb..0dc8adb262 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -711,7 +711,8 @@ void st_init_extensions(struct pipe_screen *screen, { { o(EXT_framebuffer_sRGB) }, { PIPE_FORMAT_A8B8G8R8_SRGB, - PIPE_FORMAT_B8G8R8A8_SRGB }, + PIPE_FORMAT_B8G8R8A8_SRGB, + PIPE_FORMAT_R8G8B8A8_SRGB }, GL_TRUE }, /* at least one format must be supported */ { { o(EXT_packed_float) }, LGTM. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glapi: define GL_API to be KEYWORD1 in glapi_dispatch.c (v2)
This fixes a Windows build warning where the prototypes for the ES function in the header file don't match the prototypes in this file because the GL_API and GLAPI macros are defined differently. v2: defined GL_API to KEYWORD1 instead of GLAPI, per Mathias. --- src/mapi/glapi/glapi_dispatch.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index 3239523..ca15449 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -97,6 +97,13 @@ */ #include + +/* Redefine GL_API to avoid MSVC/MinGW warnings about different dllimport + * attributes for these prototypes vs those in the GLES/gl.h header. + */ +#undef GL_API +#define GL_API KEYWORD1 + GL_API void GL_APIENTRY glClearDepthf (GLclampf depth); GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation); GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glapi: define GL_API to be GLAPI in glapi_dispatch.c
On 03/30/2018 09:39 AM, Mathias Fröhlich wrote: On Friday, 30 March 2018 16:42:43 CEST Brian Paul wrote: This fixes a Windows build warning where the prototypes for the ES function in the header file don't match the prototypes in this file because the GL_API and GLAPI macros are defined differently. --- src/mapi/glapi/glapi_dispatch.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/ glapi_dispatch.c index 3239523..f0a8c36 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -97,6 +97,11 @@ */ #include + +/* Use the GLAPI annotation from GL/gl.h, not GL_API from GLES/gl.h */ +#undef GL_API +#define GL_API GLAPI + Hi Brian, I wonder if this proposed change introduces some similar warning on some non windows builds. It looks like down in the generated glapitemp.h included down the file, the functions get implemented like KEYWORD1 KEYWORD2 glSomething(...); So, may be you want to define: #define GL_API KEYWORD1 to match the prototypes with the implementation? That works too. I'll post a v2. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] spirv: Fix building with SCons
OK, I just posted a series of patches which seems to fix everything on Windows/MSVC. Neil, I added fixes for the osmesa and libgl-gdi targets to your patch. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/6] nir/spirv: fix MSVC syntax error in vtn_handle_texture()
--- src/compiler/spirv/spirv_to_nir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 2550ef0..72ab426 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -2086,8 +2086,9 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode, (*p++) = vtn_tex_src(b, w[idx++], nir_tex_src_offset); if (operands & SpvImageOperandsConstOffsetsMask) { + nir_tex_src none = {0}; gather_offsets = vtn_ssa_value(b, w[idx++]); - (*p++) = (nir_tex_src){}; + (*p++) = none; } if (operands & SpvImageOperandsSampleMask) { -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/6] nir/spirv: s/uint32_t/SpvOp/ in various functions
The MSVC compiler warns when the function parameter types don't exactly match with respect to enum vs. uint32_t. Use SpvOp everywhere. Alternately, uint32_t could be used everywhere. There doesn't seem to be an advantage to one over the other. --- src/compiler/spirv/vtn_amd.c | 4 ++-- src/compiler/spirv/vtn_glsl450.c | 2 +- src/compiler/spirv/vtn_private.h | 8 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/spirv/vtn_amd.c b/src/compiler/spirv/vtn_amd.c index 320e3b0..0d5b429 100644 --- a/src/compiler/spirv/vtn_amd.c +++ b/src/compiler/spirv/vtn_amd.c @@ -27,7 +27,7 @@ #include "GLSL.ext.AMD.h" bool -vtn_handle_amd_gcn_shader_instruction(struct vtn_builder *b, uint32_t ext_opcode, +vtn_handle_amd_gcn_shader_instruction(struct vtn_builder *b, SpvOp ext_opcode, const uint32_t *w, unsigned count) { const struct glsl_type *dest_type = @@ -57,7 +57,7 @@ vtn_handle_amd_gcn_shader_instruction(struct vtn_builder *b, uint32_t ext_opcode } bool -vtn_handle_amd_shader_trinary_minmax_instruction(struct vtn_builder *b, uint32_t ext_opcode, +vtn_handle_amd_shader_trinary_minmax_instruction(struct vtn_builder *b, SpvOp ext_opcode, const uint32_t *w, unsigned count) { struct nir_builder *nb = &b->nb; diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c index eb0b90f..d208215 100644 --- a/src/compiler/spirv/vtn_glsl450.c +++ b/src/compiler/spirv/vtn_glsl450.c @@ -810,7 +810,7 @@ handle_glsl450_interpolation(struct vtn_builder *b, enum GLSLstd450 opcode, } bool -vtn_handle_glsl450_instruction(struct vtn_builder *b, uint32_t ext_opcode, +vtn_handle_glsl450_instruction(struct vtn_builder *b, SpvOp ext_opcode, const uint32_t *w, unsigned count) { switch ((enum GLSLstd450)ext_opcode) { diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h index 982b426..b501bbf 100644 --- a/src/compiler/spirv/vtn_private.h +++ b/src/compiler/spirv/vtn_private.h @@ -230,7 +230,7 @@ struct vtn_function { SpvFunctionControlMask control; }; -typedef bool (*vtn_instruction_handler)(struct vtn_builder *, uint32_t, +typedef bool (*vtn_instruction_handler)(struct vtn_builder *, SpvOp, const uint32_t *, unsigned); void vtn_build_cfg(struct vtn_builder *b, const uint32_t *words, @@ -718,7 +718,7 @@ void vtn_handle_alu(struct vtn_builder *b, SpvOp opcode, void vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode, const uint32_t *w, unsigned count); -bool vtn_handle_glsl450_instruction(struct vtn_builder *b, uint32_t ext_opcode, +bool vtn_handle_glsl450_instruction(struct vtn_builder *b, SpvOp ext_opcode, const uint32_t *words, unsigned count); struct vtn_builder* vtn_create_builder(const uint32_t *words, size_t word_count, @@ -744,9 +744,9 @@ vtn_u64_literal(const uint32_t *w) return (uint64_t)w[1] << 32 | w[0]; } -bool vtn_handle_amd_gcn_shader_instruction(struct vtn_builder *b, uint32_t ext_opcode, +bool vtn_handle_amd_gcn_shader_instruction(struct vtn_builder *b, SpvOp ext_opcode, const uint32_t *words, unsigned count); -bool vtn_handle_amd_shader_trinary_minmax_instruction(struct vtn_builder *b, uint32_t ext_opcode, +bool vtn_handle_amd_shader_trinary_minmax_instruction(struct vtn_builder *b, SpvOp ext_opcode, const uint32_t *words, unsigned count); #endif /* _VTN_PRIVATE_H_ */ -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/6] spirv: Fix building with SCons
From: Neil Roberts The SCons build broke with commit ba975140d3c9 because a SPIR-V function is called from Mesa main. This adds a convenience library for SPIR-V and adds it to everything that was including nir. It also adds both nir and spirv to drivers/x11/SConscript. Also add nir/spirv modules to osmesa and libgl-gdi targets. (Brian Paul) --- src/compiler/Makefile.nir.am | 3 +- src/compiler/SConscript | 1 + src/compiler/SConscript.spirv | 54 +++ src/gallium/targets/dri/SConscript| 1 + src/gallium/targets/haiku-softpipe/SConscript | 1 + src/gallium/targets/libgl-gdi/SConscript | 6 ++- src/gallium/targets/libgl-xlib/SConscript | 1 + src/gallium/targets/osmesa/SConscript | 1 + src/mesa/drivers/osmesa/SConscript| 2 + src/mesa/drivers/x11/SConscript | 2 + 10 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 src/compiler/SConscript.spirv diff --git a/src/compiler/Makefile.nir.am b/src/compiler/Makefile.nir.am index 32e4145..27dc129 100644 --- a/src/compiler/Makefile.nir.am +++ b/src/compiler/Makefile.nir.am @@ -100,4 +100,5 @@ EXTRA_DIST += \ nir/nir_opt_algebraic.py\ nir/tests \ nir/README \ - SConscript.nir + SConscript.nir \ + SConstript.spirv diff --git a/src/compiler/SConscript b/src/compiler/SConscript index 44509a9..0a0c073 100644 --- a/src/compiler/SConscript +++ b/src/compiler/SConscript @@ -27,3 +27,4 @@ Export('compiler') SConscript('SConscript.glsl') SConscript('SConscript.nir') +SConscript('SConscript.spirv') diff --git a/src/compiler/SConscript.spirv b/src/compiler/SConscript.spirv new file mode 100644 index 000..4941088 --- /dev/null +++ b/src/compiler/SConscript.spirv @@ -0,0 +1,54 @@ +import common + +Import('*') + +from sys import executable as python_cmd + +env = env.Clone() + +env.MSVC2013Compat() + +env.Prepend(CPPPATH = [ +'#include', +'#src', +'#src/mapi', +'#src/mesa', +'#src/gallium/include', +'#src/gallium/auxiliary', +'#src/compiler/nir', +'#src/compiler/spirv', +]) + +# Make generated headers reachable from the include path. +env.Prepend(CPPPATH = [Dir('.').abspath, Dir('nir').abspath]) +env.Prepend(CPPPATH = [Dir('.').abspath, Dir('spirv').abspath]) + +# spirv generated sources + +env.CodeGenerate( +target = 'spirv/spirv_info.c', +script = 'spirv/spirv_info_c.py', +source = ['spirv/spirv.core.grammar.json'], +command = python_cmd + ' $SCRIPT $SOURCE $TARGET' +) + +env.CodeGenerate( +target = 'spirv/vtn_gather_types.c', +script = 'spirv/vtn_gather_types_c.py', +source = ['spirv/spirv.core.grammar.json'], +command = python_cmd + ' $SCRIPT $SOURCE $TARGET' +) + +# parse Makefile.sources +source_lists = env.ParseSourceList('Makefile.sources') + +spirv_sources = source_lists['SPIRV_FILES'] +spirv_sources += source_lists['SPIRV_GENERATED_FILES'] + +spirv = env.ConvenienceLibrary( +target = 'spirv', +source = spirv_sources, +) + +env.Alias('spirv', spirv) +Export('spirv') diff --git a/src/gallium/targets/dri/SConscript b/src/gallium/targets/dri/SConscript index f5c2818..ff6ce3b 100644 --- a/src/gallium/targets/dri/SConscript +++ b/src/gallium/targets/dri/SConscript @@ -45,6 +45,7 @@ env.Prepend(LIBS = [ mesa, glsl, nir, +spirv, gallium, megadrivers_stub, dri_common, diff --git a/src/gallium/targets/haiku-softpipe/SConscript b/src/gallium/targets/haiku-softpipe/SConscript index f80c167..89792fb 100644 --- a/src/gallium/targets/haiku-softpipe/SConscript +++ b/src/gallium/targets/haiku-softpipe/SConscript @@ -10,6 +10,7 @@ env.Prepend(LIBS = [ mesa, glsl, nir, +spirv, gallium ]) diff --git a/src/gallium/targets/libgl-gdi/SConscript b/src/gallium/targets/libgl-gdi/SConscript index d3251ca..b5ba0fa 100644 --- a/src/gallium/targets/libgl-gdi/SConscript +++ b/src/gallium/targets/libgl-gdi/SConscript @@ -18,7 +18,11 @@ env.Append(LIBS = [ 'ws2_32', ]) -env.Prepend(LIBS = [mesautil]) +env.Prepend(LIBS = [ +mesautil, +nir, +spirv +]) sources = ['libgl_gdi.c'] drivers = [] diff --git a/src/gallium/targets/libgl-xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript index a81ac79..b94ef35 100644 --- a/src/gallium/targets/libgl-xlib/SConscript +++ b/src/gallium/targets/libgl-xlib/SConscript @@ -33,6 +33,7 @@ env.Prepend(LIBS = [ mesa, glsl, nir, +spirv, gallium, ]) diff --git a/src/gallium/targets/osmesa/SConscript b/src/gallium/targe
[Mesa-dev] [PATCH 6/6] spirv: s/uint/unsigned/ to fix MSVC build
--- src/compiler/spirv/vtn_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c index 3d5de37..e7d2f9e 100644 --- a/src/compiler/spirv/vtn_cfg.c +++ b/src/compiler/spirv/vtn_cfg.c @@ -513,7 +513,7 @@ vtn_cfg_walk_blocks(struct vtn_builder *b, struct list_head *cf_list, "Selector of OpSelect must have a type of OpTypeInt"); bool is_default = true; - const uint bitsize = nir_alu_type_get_type_size(cond_type); + const unsigned bitsize = nir_alu_type_get_type_size(cond_type); for (const uint32_t *w = block->branch + 2; w < branch_end;) { uint64_t literal = 0; if (!is_default) { -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/6] nir/spirv: fix MSVC warning in vtn_align_u32()
Fixes warning that "negation of an unsigned value results in an unsigned value". --- src/compiler/spirv/vtn_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h index d8a00f9..269de92 100644 --- a/src/compiler/spirv/vtn_private.h +++ b/src/compiler/spirv/vtn_private.h @@ -732,7 +732,7 @@ void vtn_handle_decoration(struct vtn_builder *b, SpvOp opcode, static inline uint32_t vtn_align_u32(uint32_t v, uint32_t a) { - assert(a != 0 && a == (a & -a)); + assert(a != 0 && a == (a & -((int32_t) a))); return (v + a - 1) & ~(a - 1); } -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/6] nir/spirv: move NORETURN annotation on _vtn_fail() prototype
This needs to before the function, not after, to compile with MSVC. This works with gcc too. --- src/compiler/spirv/vtn_private.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h index 269de92..982b426 100644 --- a/src/compiler/spirv/vtn_private.h +++ b/src/compiler/spirv/vtn_private.h @@ -71,8 +71,10 @@ void _vtn_warn(struct vtn_builder *b, const char *file, unsigned line, * So long as these two things continue to hold, we can easily longjmp back to * spirv_to_nir(), clean up the builder, and return NULL. */ -void _vtn_fail(struct vtn_builder *b, const char *file, unsigned line, - const char *fmt, ...) NORETURN PRINTFLIKE(4, 5); +NORETURN void +_vtn_fail(struct vtn_builder *b, const char *file, unsigned line, + const char *fmt, ...) PRINTFLIKE(4, 5); + #define vtn_fail(...) _vtn_fail(b, __FILE__, __LINE__, __VA_ARGS__) /** Fail if the given expression evaluates to true */ -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] spirv: Fix building with SCons
On 03/30/2018 10:40 AM, Brian Paul wrote: OK, I'll have some patches soon but I'm stuck on one issue. Around spriv_to_nir.c:2090 we have if (operands & SpvImageOperandsConstOffsetsMask) { gather_offsets = vtn_ssa_value(b, w[idx++]); (*p++) = (nir_tex_src){}; } The (nir_tex_src){} expression is not valid for MSVC (syntax error). I haven't figured out exactly what that's supposed to do. Replacing it with (*p++) = (nir_tex_src)0; works but I'm not sure that's correct. I take that back. Replacing the code with: nir_tex_src none = {0}; gather_offsets = vtn_ssa_value(b, w[idx++]); (*p++) = none; is what works. -Brian Ilia wrote the line in question. Ilia? -Brian On 03/30/2018 09:25 AM, Brian Paul wrote: Thanks, Neil. This fixes the SCons build on Linux, but on Windows there's a whole bunch of other issues: c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(232): error C2085: 'vtn_instruction_handler': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(235): error C2085: 'vtn_build_cfg': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2146: syntax error: missing ')' before identifier 'instruction_handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2081: 'vtn_instruction_handler': name in formal parameter list illegal c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2085: 'vtn_function_emit': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2146: syntax error: missing ',' before identifier 'instruction_handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2059: syntax error: ')' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2146: syntax error: missing ')' before identifier 'handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2081: 'vtn_instruction_handler': name in formal parameter list illegal c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2085: 'vtn_foreach_instruction': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2146: syntax error: missing ',' before identifier 'handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2059: syntax error: ')' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(369): error C2085: 'vtn_types_compatible': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(504): error C2061: syntax error: identifier 'vtn_instruction_handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(505): error C2059: syntax error: '}' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(506): error C2059: syntax error: '}' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(597): error C2036: 'vtn_value *': unknown size c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(607): error C2037: left of 'value_type' specifies undefined struct/union 'vtn_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(607): error C2065: 'vtn_value_type_invalid': undeclared identifier c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(609): error C2037: left of 'value_type' specifies undefined struct/union 'vtn_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(611): error C2036: 'vtn_value *': unknown size c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(618): error C2037: left of 'base_type' specifies undefined struct/union 'vtn_type' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(618): error C2065: 'vtn_base_type_pointer': undeclared identifier c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(619): error C2065: 'vtn_value_type_pointer': undeclared identifier c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(620): error C2037: left of 'pointer' specifies undefined struct/union 'vtn_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(620): error C2037: left of 'def' specifies undefined struct/union 'vtn_ssa_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(620): warning C413 3: 'function': incompatible types - from 'vtn_type *' to 'nir_ssa_def *' c:\users\brian\projects\mesa\sr
Re: [Mesa-dev] [PATCH] spirv: Fix building with SCons
OK, I'll have some patches soon but I'm stuck on one issue. Around spriv_to_nir.c:2090 we have if (operands & SpvImageOperandsConstOffsetsMask) { gather_offsets = vtn_ssa_value(b, w[idx++]); (*p++) = (nir_tex_src){}; } The (nir_tex_src){} expression is not valid for MSVC (syntax error). I haven't figured out exactly what that's supposed to do. Replacing it with (*p++) = (nir_tex_src)0; works but I'm not sure that's correct. Ilia wrote the line in question. Ilia? -Brian On 03/30/2018 09:25 AM, Brian Paul wrote: Thanks, Neil. This fixes the SCons build on Linux, but on Windows there's a whole bunch of other issues: c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(232): error C2085: 'vtn_instruction_handler': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(235): error C2085: 'vtn_build_cfg': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2146: syntax error: missing ')' before identifier 'instruction_handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2081: 'vtn_instruction_handler': name in formal parameter list illegal c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2085: 'vtn_function_emit': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2146: syntax error: missing ',' before identifier 'instruction_handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2059: syntax error: ')' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2146: syntax error: missing ')' before identifier 'handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2081: 'vtn_instruction_handler': name in formal parameter list illegal c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2085: 'vtn_foreach_instruction': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2146: syntax error: missing ',' before identifier 'handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2059: syntax error: ')' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(369): error C2085: 'vtn_types_compatible': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(504): error C2061: syntax error: identifier 'vtn_instruction_handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(505): error C2059: syntax error: '}' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(506): error C2059: syntax error: '}' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(597): error C2036: 'vtn_value *': unknown size c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(607): error C2037: left of 'value_type' specifies undefined struct/union 'vtn_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(607): error C2065: 'vtn_value_type_invalid': undeclared identifier c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(609): error C2037: left of 'value_type' specifies undefined struct/union 'vtn_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(611): error C2036: 'vtn_value *': unknown size c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(618): error C2037: left of 'base_type' specifies undefined struct/union 'vtn_type' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(618): error C2065: 'vtn_base_type_pointer': undeclared identifier c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(619): error C2065: 'vtn_value_type_pointer': undeclared identifier c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(620): error C2037: left of 'pointer' specifies undefined struct/union 'vtn_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(620): error C2037: left of 'def' specifies undefined struct/union 'vtn_ssa_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(620): warning C413 3: 'function': incompatible types - from 'vtn_type *' to 'nir_ssa_def *' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(620): error C2198: 'vtn_pointer_from_ssa': too few arguments for call c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(622): error C2065: 'vtn_value_type_ssa':
Re: [Mesa-dev] [PATCH] spirv: Fix building with SCons
Thanks, Neil. This fixes the SCons build on Linux, but on Windows there's a whole bunch of other issues: c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(232): error C2085: 'vtn_instruction_handler': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(235): error C2085: 'vtn_build_cfg': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2146: syntax error: missing ')' before identifier 'instruction_handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2081: 'vtn_instruction_handler': name in formal parameter list illegal c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2085: 'vtn_function_emit': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2146: syntax error: missing ',' before identifier 'instruction_handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(237): error C2059: syntax error: ')' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2146: syntax error: missing ')' before identifier 'handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2081: 'vtn_instruction_handler': name in formal parameter list illegal c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2085: 'vtn_foreach_instruction': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2146: syntax error: missing ',' before identifier 'handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(241): error C2059: syntax error: ')' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(369): error C2085: 'vtn_types_compatible': not in formal parameter list c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(504): error C2061: syntax error: identifier 'vtn_instruction_handler' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(505): error C2059: syntax error: '}' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(506): error C2059: syntax error: '}' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(597): error C2036: 'vtn_value *': unknown size c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(607): error C2037: left of 'value_type' specifies undefined struct/union 'vtn_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(607): error C2065: 'vtn_value_type_invalid': undeclared identifier c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(609): error C2037: left of 'value_type' specifies undefined struct/union 'vtn_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(611): error C2036: 'vtn_value *': unknown size c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(618): error C2037: left of 'base_type' specifies undefined struct/union 'vtn_type' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(618): error C2065: 'vtn_base_type_pointer': undeclared identifier c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(619): error C2065: 'vtn_value_type_pointer': undeclared identifier c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(620): error C2037: left of 'pointer' specifies undefined struct/union 'vtn_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(620): error C2037: left of 'def' specifies undefined struct/union 'vtn_ssa_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(620): warning C413 3: 'function': incompatible types - from 'vtn_type *' to 'nir_ssa_def *' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(620): error C2198: 'vtn_pointer_from_ssa': too few arguments for call c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(622): error C2065: 'vtn_value_type_ssa': undeclared identifier c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(623): error C2037: left of 'ssa' specifies undefined struct/union 'vtn_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(634): error C2037: left of 'value_type' specifies undefined struct/union 'vtn_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(645): error C2065: 'vtn_value_type_constant': undeclared identifier c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(645): error C2037: left of 'constant' specifies undefined struct/union 'vtn_value' c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(645): warning C403 3: 'vtn_constant_value' must return a value c:\users\brian\projects\mesa\src\compiler\spirv\vtn_private.h(735): warning C414 6: unary minus operator applied to unsigned type, result still unsigned src\compiler\spirv\gl_spirv.c(89): error C2065: 'vtn_value_type_constant': undec lared identifier src\compiler\spirv\gl_spirv.c(250): warning C4013: 'vt
[Mesa-dev] [PATCH] mesa: fix MSVC bitshift overflow warnings
In the BITFIELD_MASK() macro, if b==32 the expression evaluates to ~0u, but the compiler still sees the expression (1 << 32) in the unused part and issues a warning about integer bitshift overflow. Fix that by using (b) % 32 to ensure the max shift is 31 bits. This issue has been present for a while, but shows up much more often because of the recent VBO changes. --- src/mesa/main/mtypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 801bd17..b7a7b34 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -59,7 +59,7 @@ extern "C" { #define BITFIELD_BIT(b) ((GLbitfield)1 << (b)) /** Set all bits up to excluding bit b */ #define BITFIELD_MASK(b) \ - ((b) == 32 ? (~(GLbitfield)0) : BITFIELD_BIT(b) - 1) + ((b) == 32 ? (~(GLbitfield)0) : BITFIELD_BIT((b) % 32) - 1) /** Set count bits starting from bit b */ #define BITFIELD_RANGE(b, count) \ (BITFIELD_MASK((b) + (count)) & ~BITFIELD_MASK(b)) -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glapi: define GL_API to be GLAPI in glapi_dispatch.c
This fixes a Windows build warning where the prototypes for the ES function in the header file don't match the prototypes in this file because the GL_API and GLAPI macros are defined differently. --- src/mapi/glapi/glapi_dispatch.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index 3239523..f0a8c36 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -97,6 +97,11 @@ */ #include + +/* Use the GLAPI annotation from GL/gl.h, not GL_API from GLES/gl.h */ +#undef GL_API +#define GL_API GLAPI + GL_API void GL_APIENTRY glClearDepthf (GLclampf depth); GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation); GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/mesa: add missing GLSL_TYPE_[U]INT8 cases in st_glsl_type_dword_size()
Silences a compiler warning about unhandled enum switch cases. --- src/mesa/state_tracker/st_glsl_types.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/state_tracker/st_glsl_types.cpp b/src/mesa/state_tracker/st_glsl_types.cpp index baba2d4..42d4e9c 100644 --- a/src/mesa/state_tracker/st_glsl_types.cpp +++ b/src/mesa/state_tracker/st_glsl_types.cpp @@ -124,6 +124,9 @@ st_glsl_type_dword_size(const struct glsl_type *type) case GLSL_TYPE_INT16: case GLSL_TYPE_FLOAT16: return DIV_ROUND_UP(type->components(), 2); + case GLSL_TYPE_UINT8: + case GLSL_TYPE_INT8: + return DIV_ROUND_UP(type->components(), 4); case GLSL_TYPE_DOUBLE: case GLSL_TYPE_UINT64: case GLSL_TYPE_INT64: -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] nir: s/uint/unsigned/ to fix MSVC/MinGW build
--- src/compiler/glsl/glsl_to_nir.cpp | 2 +- src/compiler/nir/nir_gather_info.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index c4a6d52..dbb58d8 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -369,7 +369,7 @@ nir_visitor::visit(ir_variable *ir) /* Mark all the locations that require two slots */ if (shader->info.stage == MESA_SHADER_VERTEX && glsl_type_is_dual_slot(glsl_without_array(var->type))) { - for (uint i = 0; i < glsl_count_attribute_slots(var->type, true); i++) { + for (unsigned i = 0; i < glsl_count_attribute_slots(var->type, true); i++) { uint64_t bitfield = BITFIELD64_BIT(var->data.location + i); shader->info.vs.double_inputs |= bitfield; } diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index 743f968..5530009 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/nir/nir_gather_info.c @@ -250,7 +250,7 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader) if (shader->info.stage == MESA_SHADER_VERTEX && var->data.mode == nir_var_shader_in && glsl_type_is_dual_slot(glsl_without_array(var->type))) { -for (uint i = 0; i < glsl_count_attribute_slots(var->type, false); i++) { +for (unsigned i = 0; i < glsl_count_attribute_slots(var->type, false); i++) { int idx = var->data.location + i; shader->info.vs.double_inputs |= BITFIELD64_BIT(idx); } -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] intel/compiler: Explicitly cast register type in switch
On 03/29/2018 12:32 PM, Ian Romanick wrote: From: Ian Romanick brw_reg::type is "enum brw_reg_type type:4". For whatever reason, GCC is treating this as an int instead of an enum. As a result, it doesn't detect missing switch cases and it doesn't detect that flow can get out of the switch. This silences the warning: src/intel/compiler/brw_reg.h: In function ‘bool brw_regs_negative_equal(const brw_reg*, const brw_reg*)’: src/intel/compiler/brw_reg.h:305:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ Signed-off-by: Ian Romanick --- src/intel/compiler/brw_reg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_reg.h b/src/intel/compiler/brw_reg.h index 68158cc0cc8..62f76ac0fe0 100644 --- a/src/intel/compiler/brw_reg.h +++ b/src/intel/compiler/brw_reg.h @@ -262,7 +262,7 @@ brw_regs_negative_equal(const struct brw_reg *a, const struct brw_reg *b) if (a->bits != b->bits) return false; - switch (a->type) { + switch ((enum brw_reg_type) a->type) { case BRW_REGISTER_TYPE_UQ: case BRW_REGISTER_TYPE_Q: return a->d64 == -b->d64; Reviewed-by: Brian Paul Thanks. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] vbo: Use alloca for _vbo_draw_indirect.
On 03/28/2018 04:35 AM, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich Marek, you mean with the below patch as the 9-th change in the series? I would like to keep that change seprarate from #3 since patch #3 just moves the already existing impelentation to the driver_functions level using the exactly identical implementation except calling into struct driver_functions instead of the vbo module draw function. Also I do not want to call just blindly into alloca with possibly large counts. So, the implementation uses an upper bound when to use malloc instead of alloca. Ok, with that? best Mathias Avoid using malloc in the draw path of mesa. Since the draw_count is a user api input, fall back to malloc if the amount of consumed stack space may get too high. Signed-off-by: Mathias Fröhlich --- src/mesa/vbo/vbo_context.c | 70 +++--- 1 file changed, 47 insertions(+), 23 deletions(-) diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index b8c28ceffb..06b8f820ee 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -233,25 +233,17 @@ _vbo_DestroyContext(struct gl_context *ctx) } -void -_vbo_draw_indirect(struct gl_context *ctx, GLuint mode, -struct gl_buffer_object *indirect_data, -GLsizeiptr indirect_offset, unsigned draw_count, -unsigned stride, -struct gl_buffer_object *indirect_draw_count_buffer, -GLsizeiptr indirect_draw_count_offset, -const struct _mesa_index_buffer *ib) +static void +draw_indirect(struct gl_context *ctx, GLuint mode, + struct gl_buffer_object *indirect_data, + GLsizeiptr indirect_offset, unsigned draw_count, + unsigned stride, + struct gl_buffer_object *indirect_draw_count_buffer, + GLsizeiptr indirect_draw_count_offset, + const struct _mesa_index_buffer *ib, + struct _mesa_prim *space) Can you just rename 'space' to 'prim' and rm the prim = space assignment below? Also, could you put a comment on this function to explain the draw_count and space/prim parameters, at least? Other than that, the series looks good. Reviewed-by: Brian Paul Sorry for the slow review, busy with other things. -Brian { - struct _mesa_prim *prim; - - prim = calloc(draw_count, sizeof(*prim)); - if (prim == NULL) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "gl%sDraw%sIndirect%s", - (draw_count > 1) ? "Multi" : "", - ib ? "Elements" : "Arrays", - indirect_data ? "CountARB" : ""); - return; - } + struct _mesa_prim *prim = space; prim[0].begin = 1; prim[draw_count - 1].end = 1; @@ -266,10 +258,42 @@ _vbo_draw_indirect(struct gl_context *ctx, GLuint mode, /* This should always be true at this time */ assert(indirect_data == ctx->DrawIndirectBuffer); - ctx->Driver.Draw(ctx, prim, draw_count, - ib, false, 0, ~0, - NULL, 0, - indirect_data); + ctx->Driver.Draw(ctx, prim, draw_count, ib, false, 0u, ~0u, +NULL, 0, indirect_data); +} + - free(prim); +void +_vbo_draw_indirect(struct gl_context *ctx, GLuint mode, + struct gl_buffer_object *indirect_data, + GLsizeiptr indirect_offset, unsigned draw_count, + unsigned stride, + struct gl_buffer_object *indirect_draw_count_buffer, + GLsizeiptr indirect_draw_count_offset, + const struct _mesa_index_buffer *ib) +{ + /* Use alloca for the prim space if we are somehow in bounds. */ + if (draw_count*sizeof(struct _mesa_prim) < 1024) { + struct _mesa_prim *space = alloca(draw_count*sizeof(struct _mesa_prim)); + memset(space, 0, draw_count*sizeof(struct _mesa_prim)); + + draw_indirect(ctx, mode, indirect_data, indirect_offset, draw_count, +stride, indirect_draw_count_buffer, +indirect_draw_count_offset, ib, space); + } else { + struct _mesa_prim *space = calloc(draw_count, sizeof(struct _mesa_prim)); + if (space == NULL) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "gl%sDraw%sIndirect%s", + (draw_count > 1) ? "Multi" : "", + ib ? "Elements" : "Arrays", + indirect_data ? "CountARB" : ""); + return; + } + + draw_indirect(ctx, mode, indirect_data, indirect_offset, draw_count, +stride, indirect_draw_count_buffer, +indirect_draw_count_offset, ib, space); + + free(space); + } } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 6/8] vbo: Readd the arrays argument to the legacy draw methods.
On 03/25/2018 12:42 PM, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich The legacy draw paths from back before 2012 contained a gl_vertex_array array for the inputs to be used for draw. So all draw methods from legacy drivers and evereything that goes through tnl are originally written "everything" -Brian for this calling convention. The same goes for tools like t_rebase or vbo_split*, that even partly still have the original calling convention with a currently unused such pointer. Back in 2012 patch 50f7e75 mesa: move gl_client_array*[] from vbo_draw_func into gl_context introduced Array._DrawArrays, which was something that was IMO aiming for a similar direction than Array._DrawVAO introduced recently. Now several tools like t_rebase and vbo_split*, which are mostly used by tnl based drivers, would need to be converted to use the internal Array._DrawVAO instead of Array._DrawArrays. The same goes for the driver backends that use any of these tools. Alternatively we can reintroduce the gl_vertex_array array in its call argument list and put these tools finally into the tnl directory. So this change reintroduces this gl_vertex_array array for the legacy draw paths that are still required for the tools t_rebase and vbo_split*. A followup will move vbo_split also into tnl. Note that none of the affected drivers use the DriverFlags.NewArray driver bit. So it should be safe to remove this also for the legacy draw path. Signed-off-by: Mathias Fröhlich --- src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c | 11 +++ src/mesa/tnl/t_draw.c| 7 --- src/mesa/tnl/t_rebase.c | 10 ++ src/mesa/tnl/tnl.h | 1 + src/mesa/vbo/vbo.h | 2 ++ src/mesa/vbo/vbo_split_copy.c| 8 +--- src/mesa/vbo/vbo_split_inplace.c | 8 +--- 7 files changed, 18 insertions(+), 29 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c index 10b5c15e41..4533069692 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c @@ -239,6 +239,7 @@ get_max_client_stride(struct gl_context *ctx, const struct gl_vertex_array *arra static void TAG(vbo_render_prims)(struct gl_context *ctx, + const struct gl_vertex_array *arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, @@ -476,6 +477,7 @@ vbo_draw_imm(struct gl_context *ctx, const struct gl_vertex_array *arrays, static void TAG(vbo_render_prims)(struct gl_context *ctx, + const struct gl_vertex_array *arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, @@ -485,7 +487,6 @@ TAG(vbo_render_prims)(struct gl_context *ctx, struct gl_buffer_object *indirect) { struct nouveau_render_state *render = to_render_state(ctx); - const struct gl_vertex_array *arrays = ctx->Array._DrawArrays; if (!index_bounds_valid) vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index, @@ -514,6 +515,7 @@ TAG(vbo_render_prims)(struct gl_context *ctx, static void TAG(vbo_check_render_prims)(struct gl_context *ctx, + const struct gl_vertex_array *arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, @@ -527,12 +529,12 @@ TAG(vbo_check_render_prims)(struct gl_context *ctx, nouveau_validate_framebuffer(ctx); if (nctx->fallback == HWTNL) - TAG(vbo_render_prims)(ctx, prims, nr_prims, ib, + TAG(vbo_render_prims)(ctx, arrays, prims, nr_prims, ib, index_bounds_valid, min_index, max_index, tfb_vertcount, stream, indirect); if (nctx->fallback == SWTNL) - _tnl_draw_prims(ctx, prims, nr_prims, ib, + _tnl_draw_prims(ctx, arrays, prims, nr_prims, ib, index_bounds_valid, min_index, max_index, tfb_vertcount, stream, indirect); } @@ -550,7 +552,8 @@ TAG(vbo_draw)(struct gl_context *ctx, /* Borrow and update the inputs list from the tnl context */ _tnl_bind_inputs(ctx); - TAG(vbo_check_render_prims)(ctx, prims, nr_prims, ib, + TAG(vbo_check_render_prims)(ctx, ctx->Array._DrawArrays, + prims, nr_prims, ib, index_bounds_valid, min_index, max_index,
Re: [Mesa-dev] [PATCH] intel/compiler: fix return statement warning in brw_regs_negative_equal()
On 03/29/2018 03:49 AM, Emil Velikov wrote: Hi Brian, On 29 March 2018 at 02:48, Brian Paul wrote: Silence a gcc warning about missing return value in non-void function. For some reason, gcc 5.4.0 (at least) can't deduce that all else/if cases return a value. A small brain dump: Guessing that's because of the unreachable() cases at the end of the if (a->file == IMM) branch. Yeah, that's what I thought too. But if I comment out the unreachable() statement and put 'return false' in its place, I still get the warning. Ideally we'll update the macro to make things more obvious for the compiler. Otherwise we'll have to update dozens of similar instances through the code base. I don't think this particular issue is caused by unreachable(). -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glapi: define GL_API to be GLAPI in glapi_dispatch.c
This fixes a Windows build warning where the prototypes for the ES function in the header file don't match the prototypes in this file because the GL_API and GLAPI macros are defined differently. --- src/mapi/glapi/glapi_dispatch.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index 3239523..f0a8c36 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -97,6 +97,11 @@ */ #include + +/* Use the GLAPI annotation from GL/gl.h, not GL_API from GLES/gl.h */ +#undef GL_API +#define GL_API GLAPI + GL_API void GL_APIENTRY glClearDepthf (GLclampf depth); GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation); GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gl.h: remove stale comment, trailing whitespace
--- include/GL/gl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/GL/gl.h b/include/GL/gl.h index 5b28480..f5bac36 100644 --- a/include/GL/gl.h +++ b/include/GL/gl.h @@ -47,9 +47,9 @@ #define GLAPI __declspec(dllimport) # else /* for use with static link lib build of Win32 edition only */ #define GLAPI extern -# endif /* _STATIC_MESA support */ +# endif # if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */ -#define GLAPIENTRY +#define GLAPIENTRY # else #define GLAPIENTRY __stdcall # endif -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] intel/compiler: fix return statement warning in brw_regs_negative_equal()
Silence a gcc warning about missing return value in non-void function. For some reason, gcc 5.4.0 (at least) can't deduce that all else/if cases return a value. --- src/intel/compiler/brw_reg.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/intel/compiler/brw_reg.h b/src/intel/compiler/brw_reg.h index 68158cc..0d2900a 100644 --- a/src/intel/compiler/brw_reg.h +++ b/src/intel/compiler/brw_reg.h @@ -302,6 +302,8 @@ brw_regs_negative_equal(const struct brw_reg *a, const struct brw_reg *b) return brw_regs_equal(&tmp, b); } + + return false; /* silence compiler warning */ } struct brw_indirect { -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/mesa: add missing GLSL_TYPE_[U]INT8 cases in st_glsl_type_dword_size()
Silences a compiler warning about unhandled enum switch cases. --- src/mesa/state_tracker/st_glsl_types.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/state_tracker/st_glsl_types.cpp b/src/mesa/state_tracker/st_glsl_types.cpp index ef7b7fa..9ad76c9 100644 --- a/src/mesa/state_tracker/st_glsl_types.cpp +++ b/src/mesa/state_tracker/st_glsl_types.cpp @@ -124,6 +124,9 @@ st_glsl_type_dword_size(const struct glsl_type *type) case GLSL_TYPE_INT16: case GLSL_TYPE_FLOAT16: return DIV_ROUND_UP(type->components(), 2); + case GLSL_TYPE_UINT8: + case GLSL_TYPE_INT8: + return DIV_ROUND_UP(type->components(), 4); case GLSL_TYPE_DOUBLE: case GLSL_TYPE_UINT64: case GLSL_TYPE_INT64: -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st: Don't try to finalize the texture in st_render_texture().
On 03/27/2018 10:14 PM, Eric Anholt wrote: We can't necessarily finalize the texture at this point if we're rendering to a texture image whose format is different from the baselevel's format. This is just a test suite scenario, right? It's not the sort of thing a real app would do, I hope. This was introduced as a fix for fbo-incomplete-texture-03 in de414f491526610bb260c73805c81ba413388e20, but the later fix for vmware on that testcase in 95d5c48f68b598cfa6db25f44aac52b3e11403cc made it unnecessary. Fixes assertion failures in util_resource_copy_region() in KHR-GLES3.copy_tex_image_conversions.forbidden.* when trying to finalize an R8 texture image to the RG8 texture object's pt. Looks OK to me. Go ahead and check it in. The next time I do a piglit run with our driver, I'll be on the lookout for any unexpected regressions. Reviewed-by: Brian Paul --- src/mesa/state_tracker/st_cb_fbo.c | 4 1 file changed, 4 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 02ae8e1380e3..f859133e399e 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -509,14 +509,10 @@ st_render_texture(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) { struct st_context *st = st_context(ctx); - struct pipe_context *pipe = st->pipe; struct gl_renderbuffer *rb = att->Renderbuffer; struct st_renderbuffer *strb = st_renderbuffer(rb); struct pipe_resource *pt; - if (!st_finalize_texture(ctx, pipe, att->Texture, att->CubeMapFace)) - return; - pt = get_teximage_resource(att->Texture, att->CubeMapFace, att->TextureLevel); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 3/4] st/mesa: add support for nvidia conservative rasterization extensions
On 03/28/2018 04:35 AM, Rhys Perry wrote: --- src/mesa/state_tracker/st_atom_rasterizer.c | 15 + src/mesa/state_tracker/st_context.c | 2 ++ src/mesa/state_tracker/st_extensions.c | 34 + 3 files changed, 51 insertions(+) diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 1be072e6e3..5b747a924e 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -298,5 +298,20 @@ st_update_rasterizer(struct st_context *st) raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled; raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE); +/* ST_NEW_RASTERIZER */ + if (ctx->ConservativeRasterization) { + if (ctx->ConservativeRasterMode == GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV) + raster->conservative_raster_mode = PIPE_CONSERVATIVE_RASTER_POST_SNAP; + else + raster->conservative_raster_mode = PIPE_CONSERVATIVE_RASTER_PRE_SNAP; + } else { + raster->conservative_raster_mode = PIPE_CONSERVATIVE_RASTER_OFF; + } + + raster->conservative_raster_dilate = ctx->ConservativeRasterDilate; + + raster->subpixel_precision_x = ctx->NvSubpixelPrecisionBias[0]; + raster->subpixel_precision_y = ctx->NvSubpixelPrecisionBias[1]; + cso_set_rasterizer(st->cso_context, raster); } diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 90b7f9359a..0709681e16 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -344,6 +344,8 @@ st_init_driver_flags(struct st_context *st) f->NewPolygonState = ST_NEW_RASTERIZER; f->NewPolygonStipple = ST_NEW_POLY_STIPPLE; f->NewViewport = ST_NEW_VIEWPORT; + f->NewNvConservativeRasterization = ST_NEW_RASTERIZER; + f->NewNvConservativeRasterizationParams = ST_NEW_RASTERIZER; } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index bea61f21cb..02832f3951 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -494,6 +494,16 @@ void st_init_limits(struct pipe_screen *screen, c->UseSTD430AsDefaultPacking = screen->get_param(screen, PIPE_CAP_LOAD_CONSTBUF); + c->MaxSubpixelPrecisionBiasBits = + screen->get_param(screen, PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS); + + c->ConservativeRasterDilateRange[0] = + screen->get_paramf(screen, PIPE_CAPF_MIN_CONSERVATIVE_RASTER_DILATE); + c->ConservativeRasterDilateRange[1] = + screen->get_paramf(screen, PIPE_CAPF_MAX_CONSERVATIVE_RASTER_DILATE); + c->ConservativeRasterDilateGranularity = + screen->get_paramf(screen, PIPE_CAPF_CONSERVATIVE_RASTER_DILATE_GRANULARITY); + /* limit the max combined shader output resources to a driver limit */ temp = screen->get_param(screen, PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES); if (temp > 0 && c->MaxCombinedShaderOutputResources > temp) @@ -1363,4 +1373,28 @@ void st_init_extensions(struct pipe_screen *screen, extensions->ARB_texture_cube_map_array && extensions->ARB_texture_stencil8 && extensions->ARB_texture_multisample; + + if (screen->get_param(screen, PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_TRIANGLES) && + screen->get_param(screen, PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_POINTS_LINES) && + screen->get_param(screen, PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE)) { + float max_dilate; + bool pre_snap_triangles, pre_snap_points_lines; + + max_dilate = screen->get_paramf(screen, PIPE_CAPF_MAX_CONSERVATIVE_RASTER_DILATE); + + pre_snap_triangles = + screen->get_param(screen, PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES); + pre_snap_points_lines = + screen->get_param(screen, PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_POINTS_LINES); + + extensions->NV_conservative_raster = + screen->get_param(screen, PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS) > 1; + + if (extensions->NV_conservative_raster) { + extensions->NV_conservative_raster_dilate = max_dilate>=0.75; Spaces before/after >= + extensions->NV_conservative_raster_pre_snap_triangles = pre_snap_triangles; + extensions->NV_conservative_raster_pre_snap = +pre_snap_triangles && pre_snap_points_lines; + } + } } Other than that, patches 2&3 look OK to me. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3 1/4] mesa: add support for nvidia conservative rasterization extensions
Looks good overall. Just some style nit-picks below. -Brian On 03/28/2018 04:35 AM, Rhys Perry wrote: Although the specs are written against compatibility GL 4.3 and allows core profile and GLES2+, it is exposed for GL 1.0+ and GLES1 and GLES2+. --- src/mapi/glapi/gen/gl_API.xml | 47 +++ src/mapi/glapi/gen/gl_genexec.py| 1 + src/mesa/Makefile.sources | 2 + src/mesa/main/attrib.c | 60 +++--- src/mesa/main/conservativeraster.c | 138 src/mesa/main/conservativeraster.h | 48 +++ src/mesa/main/context.c | 10 +++ src/mesa/main/dlist.c | 86 src/mesa/main/enable.c | 14 src/mesa/main/extensions_table.h| 4 + src/mesa/main/get.c | 3 + src/mesa/main/get_hash_params.py| 13 +++ src/mesa/main/mtypes.h | 28 ++- src/mesa/main/tests/dispatch_sanity.cpp | 27 +++ src/mesa/main/viewport.c| 57 + src/mesa/main/viewport.h| 6 ++ src/mesa/meson.build| 2 + 17 files changed, 535 insertions(+), 11 deletions(-) create mode 100644 src/mesa/main/conservativeraster.c create mode 100644 src/mesa/main/conservativeraster.h diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 38c1921047..db312370b1 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -12871,6 +12871,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://www.w3.org/2001/XInclude"/> diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py index aaff9f230b..be8013b62b 100644 --- a/src/mapi/glapi/gen/gl_genexec.py +++ b/src/mapi/glapi/gen/gl_genexec.py @@ -62,6 +62,7 @@ header = """/** #include "main/colortab.h" #include "main/compute.h" #include "main/condrender.h" +#include "main/conservativeraster.h" #include "main/context.h" #include "main/convolve.h" #include "main/copyimage.h" diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index 0446078136..43ec55f580 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -49,6 +49,8 @@ MAIN_FILES = \ main/condrender.c \ main/condrender.h \ main/config.h \ + main/conservativeraster.c \ + main/conservativeraster.h \ main/context.c \ main/context.h \ main/convolve.c \ diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 9d3aa728a1..a8873f2988 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -138,6 +138,9 @@ struct gl_enable_attrib /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */ GLboolean sRGBEnabled; + + /* GL_NV_conservative_raster */ + GLboolean ConservativeRasterization; }; @@ -178,6 +181,13 @@ struct texture_state }; +struct viewport_state +{ + struct gl_viewport_attrib ViewportArray[MAX_VIEWPORTS]; + GLuint SubpixelPrecisionBias[2]; +}; + + /** An unused GL_*_BIT value */ #define DUMMY_BIT 0x1000 @@ -394,6 +404,9 @@ _mesa_PushAttrib(GLbitfield mask) /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */ attr->sRGBEnabled = ctx->Color.sRGBEnabled; + + /* GL_NV_conservative_raster */ + attr->ConservativeRasterization = ctx->ConservativeRasterization; } if (mask & GL_EVAL_BIT) { @@ -545,11 +558,23 @@ _mesa_PushAttrib(GLbitfield mask) } if (mask & GL_VIEWPORT_BIT) { - if (!push_attrib(ctx, &head, GL_VIEWPORT_BIT, - sizeof(struct gl_viewport_attrib) - * ctx->Const.MaxViewports, - (void*)&ctx->ViewportArray)) + struct viewport_state *viewstate = CALLOC_STRUCT(viewport_state); + if (!viewstate) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_VIEWPORT_BIT)"); + goto end; + } + + if (!save_attrib_data(&head, GL_VIEWPORT_BIT, viewstate)) { + free(viewstate); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_VIEWPORT_BIT)"); goto end; + } + + memcpy(&viewstate->ViewportArray, &ctx->ViewportArray, + sizeof(struct gl_viewport_attrib)*ctx->Const.MaxViewports); + + viewstate->SubpixelPrecisionBias[0] = ctx->NvSubpixelPrecisionBias[0]; + viewstate->SubpixelPrecisionBias[1] = ctx->NvSubpixelPrecisionBias[1]; } /* GL_ARB_multisample */ @@ -714,6 +739,13 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable) TEST_AND_UPDATE(ctx->Color.sRGBEnable
Re: [Mesa-dev] [PATCH] mesa: Inherit texture view multi-sample information from the original texture images.
LGTM. I guess we probably don't have much piglit coverage for texture_view + MSAA. Reviewed-by: Brian Paul On 03/27/2018 07:52 AM, Henri Verbeet wrote: Found running "The Witness" in Wine. Without this patch, texture views created on multi-sample textures would have a GL_TEXTURE_SAMPLES of 0. All things considered such views actually work surprisingly well, but when combined with (plain) multi-sample textures in a framebuffer object, the resulting FBO is incomplete because the sample counts don't match. Signed-off-by: Henri Verbeet --- src/mesa/main/teximage.c| 20 ++-- src/mesa/main/teximage.h| 8 src/mesa/main/textureview.c | 12 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 9e139d746f..8f5351085c 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -837,8 +837,8 @@ clear_teximage_fields(struct gl_texture_image *img) * Fills in the fields of \p img with the given information. * Note: width, height and depth include the border. */ -static void -init_teximage_fields_ms(struct gl_context *ctx, +void +_mesa_init_teximage_fields_ms(struct gl_context *ctx, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat, @@ -950,8 +950,8 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLint border, GLenum internalFormat, mesa_format format) { - init_teximage_fields_ms(ctx, img, width, height, depth, border, - internalFormat, format, 0, GL_TRUE); + _mesa_init_teximage_fields_ms(ctx, img, width, height, depth, border, + internalFormat, format, 0, GL_TRUE); } @@ -5891,9 +5891,9 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims, if (_mesa_is_proxy_texture(target)) { if (samplesOK && dimensionsOK && sizeOK) { - init_teximage_fields_ms(ctx, texImage, width, height, depth, 0, - internalformat, texFormat, - samples, fixedsamplelocations); + _mesa_init_teximage_fields_ms(ctx, texImage, width, height, depth, 0, + internalformat, texFormat, + samples, fixedsamplelocations); } else { /* clear all image fields */ @@ -5920,9 +5920,9 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims, ctx->Driver.FreeTextureImageBuffer(ctx, texImage); - init_teximage_fields_ms(ctx, texImage, width, height, depth, 0, - internalformat, texFormat, - samples, fixedsamplelocations); + _mesa_init_teximage_fields_ms(ctx, texImage, width, height, depth, 0, +internalformat, texFormat, +samples, fixedsamplelocations); if (width > 0 && height > 0 && depth > 0) { if (memObj) { diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 2e950bf42b..bf790af276 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -130,6 +130,14 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat, mesa_format format); +extern void +_mesa_init_teximage_fields_ms(struct gl_context *ctx, + struct gl_texture_image *img, + GLsizei width, GLsizei height, GLsizei depth, + GLint border, GLenum internalFormat, + mesa_format format, + GLuint numSamples, + GLboolean fixedSampleLocations); extern mesa_format diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c index 89af068fae..9a064ffd71 100644 --- a/src/mesa/main/textureview.c +++ b/src/mesa/main/textureview.c @@ -304,7 +304,8 @@ initialize_texture_fields(struct gl_context *ctx, struct gl_texture_object *texObj, GLint levels, GLsizei width, GLsizei height, GLsizei depth, - GLenum internalFormat, mesa_format texFormat) + GLenum internalFormat, mesa_format texFormat, + GLuint numSamples, GLboolean fixedSampleLocations) { const GLuint numFaces = _mesa_num_tex_faces(target); GLint level, levelWidth = width, levelHeight = height, levelDepth = depth; @@ -326,9 +327,10 @@ initialize_text
[Mesa-dev] [PATCH] glapi: add glBlendBarrier(), glPrimitiveBoundingBox() prototypes
in glapi_dispatch.c, as we have for many other GLES functions. Fixes a cross-compile issue (missing prototype) when GLES support is disabled. --- src/mapi/glapi/glapi_dispatch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mapi/glapi/glapi_dispatch.c b/src/mapi/glapi/glapi_dispatch.c index 269adc7..3239523 100644 --- a/src/mapi/glapi/glapi_dispatch.c +++ b/src/mapi/glapi/glapi_dispatch.c @@ -143,6 +143,8 @@ GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed pa GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params); GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z); GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glBlendBarrier (void); +GL_API void GL_APIENTRY glPrimitiveBoundingBox (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); /* Enable frame pointer elimination on Windows, otherwise forgetting to add * APIENTRY to _mesa_* entrypoints will not cause crashes on debug builds, as -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa/st/tests: Use tgsi opcode enum also in the test classes
Reviewed-by: Brian Paul Sorry for the breakage. -Brian On 03/26/2018 02:17 AM, Gert Wollny wrote: Fixes: ec478cf9c31c3775a21cd7b5b4b5cdd9263bde9e st/mesa,tgsi: use enum tgsi_opcode Bugzilla: https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D105737&d=DwIBAg&c=uilaK90D4TOVoH58JNXRgQ&r=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA&m=lq2W5BZEbroPgPpeg6LQhQDMza_vdl8IYWN8cSDPsBw&s=RbSoaOlqbBS4Vq039rA2vIel6dkwOkK7V2OhXuLlPdI&e= Signed-off-by: Gert Wollny --- src/mesa/state_tracker/tests/st_tests_common.cpp | 6 +++--- src/mesa/state_tracker/tests/st_tests_common.h | 10 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/state_tracker/tests/st_tests_common.cpp b/src/mesa/state_tracker/tests/st_tests_common.cpp index ea01ca..63e3d6b2c4 100644 --- a/src/mesa/state_tracker/tests/st_tests_common.cpp +++ b/src/mesa/state_tracker/tests/st_tests_common.cpp @@ -43,7 +43,7 @@ using std::tuple; /* Implementation of helper and test classes */ void *FakeCodeline::mem_ctx = nullptr; -FakeCodeline::FakeCodeline(unsigned _op, const vector& _dst, +FakeCodeline::FakeCodeline(tgsi_opcode _op, const vector& _dst, const vector& _src, const vector&_to): op(_op), max_temp_id(0) @@ -59,7 +59,7 @@ FakeCodeline::FakeCodeline(unsigned _op, const vector& _dst, } -FakeCodeline::FakeCodeline(unsigned _op, const vector>& _dst, +FakeCodeline::FakeCodeline(tgsi_opcode _op, const vector>& _dst, const vector>& _src, const vector>&_to, SWZ with_swizzle): @@ -84,7 +84,7 @@ FakeCodeline::FakeCodeline(unsigned _op, const vector>& _dst, }); } -FakeCodeline::FakeCodeline(unsigned _op, const vector>& _dst, +FakeCodeline::FakeCodeline(tgsi_opcode _op, const vector>& _dst, const vector>& _src, const vector>&_to, RA with_reladdr): op(_op), diff --git a/src/mesa/state_tracker/tests/st_tests_common.h b/src/mesa/state_tracker/tests/st_tests_common.h index 2e18832923..6d855fe581 100644 --- a/src/mesa/state_tracker/tests/st_tests_common.h +++ b/src/mesa/state_tracker/tests/st_tests_common.h @@ -40,15 +40,15 @@ struct RA {}; /* A line to describe a TGSI instruction for building mock shaders. */ struct FakeCodeline { - FakeCodeline(unsigned _op): op(_op), max_temp_id(0) {} - FakeCodeline(unsigned _op, const std::vector& _dst, const std::vector& _src, + FakeCodeline(tgsi_opcode _op): op(_op), max_temp_id(0) {} + FakeCodeline(tgsi_opcode _op, const std::vector& _dst, const std::vector& _src, const std::vector&_to); - FakeCodeline(unsigned _op, const std::vector>& _dst, + FakeCodeline(tgsi_opcode _op, const std::vector>& _dst, const std::vector>& _src, const std::vector>&_to, SWZ with_swizzle); - FakeCodeline(unsigned _op, const std::vector>& _dst, + FakeCodeline(tgsi_opcode _op, const std::vector>& _dst, const std::vector>& _src, const std::vector>&_to, RA with_reladdr); @@ -78,7 +78,7 @@ private: template void read_reg(const st_reg& s); - unsigned op; + tgsi_opcode op; std::vector dst; std::vector src; std::vector tex_offsets; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/3] A fix and some asserts around the VAO changes.
On 03/23/2018 12:39 PM, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich Hi, Following one fix and a set of asserts in the VAO area. The changes already passed intels CI system. Please review Thanks and best Mathias Mathias Fröhlich (3): mesa: When copying a VAO also copy the vertex attribute mode. mesa: Flag early if we modify a SharedAndImmutable VAO. vbo: Make sure the internal VAO's stay within limits. src/mesa/main/attrib.c | 1 + src/mesa/main/varray.c | 6 ++ src/mesa/vbo/vbo_exec_draw.c | 5 - src/mesa/vbo/vbo_save_api.c | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) Series looks good to me. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] gallium/u_vbuf: Protect against overflow with large instance divisors.
Reviewed-by: Brian Paul On 03/22/2018 04:18 PM, Eric Anholt wrote: GTF-GLES3.gtf.GL3Tests.instanced_arrays.instanced_arrays_divisor uses -1 as a divisor, so we would overflow to count=0 and upload no data, triggering the assert below. We want to upload 1 element in this case, fixing the test on VC5. v2: Use some more obvious logic, and explain why we don't use the normal round_up(). --- src/gallium/auxiliary/util/u_vbuf.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c index 95d7990c6ca4..8a680d60a687 100644 --- a/src/gallium/auxiliary/util/u_vbuf.c +++ b/src/gallium/auxiliary/util/u_vbuf.c @@ -936,7 +936,16 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr, size = mgr->ve->src_format_size[i]; } else if (instance_div) { /* Per-instance attrib. */ - unsigned count = (num_instances + instance_div - 1) / instance_div; + + /* Figure out how many instances we'll render given instance_div. We + * can't use the typical div_round_up() pattern because the CTS uses + * instance_div = ~0 for a test, which overflows div_round_up()'s + * addition. + */ + unsigned count = num_instances / instance_div; + if (count * instance_div != num_instances) +count++; + first += vb->stride * start_instance; size = vb->stride * (count - 1) + mgr->ve->src_format_size[i]; } else { ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] st: Allow accelerated CopyTexImage from RGBA to RGB.
On 03/22/2018 04:18 PM, Eric Anholt wrote: There's nothing to worry about here -- the A channel just gets dropped by the blit. This avoids a segfault in the fallback path when copying from a RGBA16_SINT renderbuffer to a RGB16_SINT destination represented by an RGBA16_SINT texture (the fallback path tries to get/fetch to float buffers, but the float pack/unpack functions are NULL for SINT/UINT). Fixes KHR-GLES3.packed_pixels.pbo_rectangle.rgba16i on VC5. v2: Extract the logic to a helper function and explain what's going on better. --- src/mesa/state_tracker/st_cb_texture.c | 32 ++-- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 6345ead6396b..5a23c7e8b6cd 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -2281,6 +2281,31 @@ fallback_copy_texsubimage(struct gl_context *ctx, pipe->transfer_unmap(pipe, src_trans); } +static bool +st_can_copyteximage_using_blit(struct gl_texture_image *texImage, + struct gl_renderbuffer *rb) I think those params could be const-qualified. Looks great otherwise. Thanks. Reviewed-by: Brian Paul +{ + GLenum tex_baseformat = _mesa_get_format_base_format(texImage->TexFormat); + + /* We don't blit to a teximage where the GL base format doesn't match the +* texture's chosen format, except in the case of a GL_RGB texture +* represented with GL_RGBA (where the alpha channel is just being +* dropped). +*/ + if (texImage->_BaseFormat != tex_baseformat && + ((texImage->_BaseFormat != GL_RGB || tex_baseformat != GL_RGBA))) { + return false; + } + + /* We can't blit from a RB where the GL base format doesn't match the RB's +* chosen format (for example, GL RGB or ALPHA with rb->Format of an RGBA +* type, because the other channels will be undefined). +*/ + if (rb->_BaseFormat != _mesa_get_format_base_format(rb->Format)) + return false; + + return true; +} /** * Do a CopyTex[Sub]Image1/2/3D() using a hardware (blit) path if possible. @@ -2324,12 +2349,7 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims, goto fallback; } - /* The base internal format must match the mesa format, so make sure -* e.g. an RGB internal format is really allocated as RGB and not as RGBA. -*/ - if (texImage->_BaseFormat != - _mesa_get_format_base_format(texImage->TexFormat) || - rb->_BaseFormat != _mesa_get_format_base_format(rb->Format)) { + if (!st_can_copyteximage_using_blit(texImage, rb)) { goto fallback; } ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev