Re: [Mesa-dev] [PATCH 13/18] i965: Pass slice details as parameters for surface setup
On Wednesday, April 29, 2015 08:58:18 AM Pohjolainen, Topi wrote: > On Tue, Apr 28, 2015 at 02:45:27PM -0700, Kenneth Graunke wrote: > > On Wednesday, April 22, 2015 11:47:33 PM Topi Pohjolainen wrote: > > > Also changed a couple of direct shifts into SET_FIELD(). > > > > > > Signed-off-by: Topi Pohjolainen > > > --- > > > src/mesa/drivers/dri/i965/brw_context.h | 3 ++- > > > src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 30 > > > +-- > > > src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 14 +-- > > > src/mesa/drivers/dri/i965/gen8_surface_state.c| 10 +++- > > > 4 files changed, 29 insertions(+), 28 deletions(-) > > > > > > diff --git a/src/mesa/drivers/dri/i965/brw_context.h > > > b/src/mesa/drivers/dri/i965/brw_context.h > > > index b90d329..ae28955 100644 > > > --- a/src/mesa/drivers/dri/i965/brw_context.h > > > +++ b/src/mesa/drivers/dri/i965/brw_context.h > > > @@ -964,10 +964,11 @@ struct brw_context > > > { > > >void (*update_texture_surface)(struct brw_context *brw, > > > const struct intel_mipmap_tree *mt, > > > - struct gl_texture_object *tObj, > > > uint32_t tex_format, > > > bool is_integer_format, > > > GLenum target, uint32_t > > > effective_depth, > > > + uint32_t min_layer, > > > + uint32_t min_lod, uint32_t > > > mip_count, > > > int swizzle, uint32_t *surf_offset, > > > bool for_gather); > > >uint32_t (*update_renderbuffer_surface)(struct brw_context *brw, > > > diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c > > > b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c > > > index f7acad4..ad5ddb5 100644 > > > --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c > > > +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c > > > @@ -310,16 +310,16 @@ update_buffer_texture_surface(struct gl_context > > > *ctx, > > > static void > > > brw_update_texture_surface(struct brw_context *brw, > > > const struct intel_mipmap_tree *mt, > > > - struct gl_texture_object *tObj, > > > uint32_t tex_format, > > > bool is_integer_format /* unused */, > > > GLenum target, > > > uint32_t effective_depth /* unused */, > > > + uint32_t min_layer /* unused */, > > > + uint32_t min_lod, uint32_t mip_count, > > > int swizzle /* unused */, > > > uint32_t *surf_offset, > > > bool for_gather) > > > { > > > - struct intel_texture_object *intelObj = intel_texture_object(tObj); > > > uint32_t *surf; > > > > > > surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, > > > @@ -361,16 +361,16 @@ brw_update_texture_surface(struct brw_context *brw, > > > > > > surf[1] = mt->bo->offset64 + mt->offset; /* reloc */ > > > > > > - surf[2] = ((intelObj->_MaxLevel - tObj->BaseLevel) << > > > BRW_SURFACE_LOD_SHIFT | > > > - (mt->logical_width0 - 1) << BRW_SURFACE_WIDTH_SHIFT | > > > - (mt->logical_height0 - 1) << BRW_SURFACE_HEIGHT_SHIFT); > > > + surf[2] = SET_FIELD(mip_count, BRW_SURFACE_LOD) | > > > + SET_FIELD(mt->logical_width0 - 1, BRW_SURFACE_WIDTH) | > > > + SET_FIELD(mt->logical_height0 - 1, BRW_SURFACE_HEIGHT); > > > > > > - surf[3] = (brw_get_surface_tiling_bits(mt->tiling) | > > > - (mt->logical_depth0 - 1) << BRW_SURFACE_DEPTH_SHIFT | > > > - (mt->pitch - 1) << BRW_SURFACE_PITCH_SHIFT); > > > + surf[3] = brw_get_surface_tiling_bits(mt->tiling) | > > > + SET_FIELD(mt->logical_depth0 - 1, BRW_SURFACE_DEPTH) | > > > + SET_FIELD(mt->pitch - 1, BRW_SURFACE_PITCH); > > > > > > - surf[4] = (brw_get_surface_num_multisamples(mt->num_samples) | > > > - SET_FIELD(tObj->BaseLevel - mt->first_level, > > > BRW_SURFACE_MIN_LOD)); > > > + surf[4] = brw_get_surface_num_multisamples(mt->num_samples) | > > > + SET_FIELD(min_lod, BRW_SURFACE_MIN_LOD); > > > > This is not equivalent...Min Lod used to be: > > > >tObj->BaseLevel - mt->first_level > > > > and now it is: > > > >tObj->MinLevel + tObj->BaseLevel - mt->first_level > > > > I would really appreciate it if you could make this a separate patch > > from the refactoring, for easier bisectability. (First add tObj->MinLevel > > to the Gen4-6 code, then do this refactor.) > > > > It seems like a fine change, but is certainly worth noting in the commit > > message. Perhaps this is what fixed some tests? > > Mark helped me to bi
[Mesa-dev] [PATCH 5/9] mesa: add helper convenience functions for computing box intersected against scissors of gl_framebuffer
From: Kevin Rogovin Add helper convenience function that intersects the scissor values against a passed bounding box. In addition, to avoid replicated code, make the function _mesa_scissor_bounding_box() use this new function. --- src/mesa/main/framebuffer.c | 63 +++-- src/mesa/main/framebuffer.h | 4 +++ 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 4e4d896..56c1225 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -357,42 +357,38 @@ update_framebuffer_size(struct gl_context *ctx, struct gl_framebuffer *fb) } + /** - * Calculate the inclusive bounding box for the scissor of a specific viewport + * Given a bounding box, intersect the bounding box with the scissor of + * a specified vieport. * * \param ctx GL context. - * \param buffer Framebuffer to be checked against * \param idx Index of the desired viewport * \param bboxBounding box for the scissored viewport. Stored as xmin, *xmax, ymin, ymax. - * - * \warning This function assumes that the framebuffer dimensions are up to - * date (e.g., update_framebuffer_size has been recently called on \c buffer). - * - * \sa _mesa_clip_to_region */ -void -_mesa_scissor_bounding_box(const struct gl_context *ctx, - const struct gl_framebuffer *buffer, - unsigned idx, int *bbox) +extern void +_mesa_intersect_scissor_bounding_box(const struct gl_context *ctx, + unsigned idx, int *bbox) { - bbox[0] = 0; - bbox[2] = 0; - bbox[1] = buffer->Width; - bbox[3] = buffer->Height; - if (ctx->Scissor.EnableFlags & (1u << idx)) { + int xmax, ymax; + + xmax = ctx->Scissor.ScissorArray[idx].X ++ ctx->Scissor.ScissorArray[idx].Width; + ymax = ctx->Scissor.ScissorArray[idx].Y ++ ctx->Scissor.ScissorArray[idx].Height; if (ctx->Scissor.ScissorArray[idx].X > bbox[0]) { bbox[0] = ctx->Scissor.ScissorArray[idx].X; } if (ctx->Scissor.ScissorArray[idx].Y > bbox[2]) { bbox[2] = ctx->Scissor.ScissorArray[idx].Y; } - if (ctx->Scissor.ScissorArray[idx].X + ctx->Scissor.ScissorArray[idx].Width < bbox[1]) { - bbox[1] = ctx->Scissor.ScissorArray[idx].X + ctx->Scissor.ScissorArray[idx].Width; + if (xmax < bbox[1]) { + bbox[1] = xmax; } - if (ctx->Scissor.ScissorArray[idx].Y + ctx->Scissor.ScissorArray[idx].Height < bbox[3]) { - bbox[3] = ctx->Scissor.ScissorArray[idx].Y + ctx->Scissor.ScissorArray[idx].Height; + if (ymax < bbox[3]) { +bbox[3] = ymax; } /* finally, check for empty region */ if (bbox[0] > bbox[1]) { @@ -402,6 +398,33 @@ _mesa_scissor_bounding_box(const struct gl_context *ctx, bbox[2] = bbox[3]; } } +} + +/** + * Calculate the inclusive bounding box for the scissor of a specific viewport + * + * \param ctx GL context. + * \param buffer Framebuffer to be checked against + * \param idx Index of the desired viewport + * \param bboxBounding box for the scissored viewport. Stored as xmin, + *xmax, ymin, ymax. + * + * \warning This function assumes that the framebuffer dimensions are up to + * date (e.g., update_framebuffer_size has been recently called on \c buffer). + * + * \sa _mesa_clip_to_region + */ +void +_mesa_scissor_bounding_box(const struct gl_context *ctx, + const struct gl_framebuffer *buffer, + unsigned idx, int *bbox) +{ + bbox[0] = 0; + bbox[2] = 0; + bbox[1] = buffer->Width; + bbox[3] = buffer->Height; + + _mesa_intersect_scissor_bounding_box(ctx, idx, bbox); assert(bbox[0] <= bbox[1]); assert(bbox[2] <= bbox[3]); diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h index 4a2e0d9..8c824dc 100644 --- a/src/mesa/main/framebuffer.h +++ b/src/mesa/main/framebuffer.h @@ -76,6 +76,10 @@ _mesa_scissor_bounding_box(const struct gl_context *ctx, const struct gl_framebuffer *buffer, unsigned idx, int *bbox); +extern void +_mesa_intersect_scissor_bounding_box(const struct gl_context *ctx, + unsigned idx, int *bbox); + static inline GLuint _mesa_geometric_width(const struct gl_framebuffer *buffer) { -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 9/9] mark GL_ARB_framebuffer_no_attachments as done for i965
From: Kevin Rogovin Mark GL_ARB_framebuffer_no_attachments as done for i965. --- docs/GL3.txt | 2 +- docs/relnotes/10.6.0.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/GL3.txt b/docs/GL3.txt index 172fd3c..cf3b5a2 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -157,7 +157,7 @@ GL 4.3, GLSL 4.30: GL_KHR_debug DONE (all drivers) GL_ARB_explicit_uniform_location DONE (all drivers that support GLSL) GL_ARB_fragment_layer_viewport DONE (nv50, nvc0, r600, llvmpipe) - GL_ARB_framebuffer_no_attachmentsnot started + GL_ARB_framebuffer_no_attachmentsDONE (i965) GL_ARB_internalformat_query2 not started GL_ARB_invalidate_subdataDONE (all drivers) GL_ARB_multi_draw_indirect DONE (i965, nvc0, r600, radeonsi, llvmpipe, softpipe) diff --git a/docs/relnotes/10.6.0.html b/docs/relnotes/10.6.0.html index 48f76f9..3919d19 100644 --- a/docs/relnotes/10.6.0.html +++ b/docs/relnotes/10.6.0.html @@ -55,6 +55,7 @@ Note: some of the new features are only available with certain drivers. GL_ARB_clip_control on i965 GL_ARB_program_interface_query (all drivers) GL_ARB_texture_stencil8 on nv50, nvc0, r600, radeonsi, softpipe +GL_ARB_framebuffer_no_attachments on i965 Bug fixes -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/9] mesa:Define extension GL_ARB_framebuffer_no_attachments
From: Kevin Rogovin Define the infrastructure for the extension GL_ARB_framebuffer_no_attachments: - extension table - additions to gl_framebuffer --- src/mesa/main/extensions.c | 1 + src/mesa/main/fbobject.c| 1 + src/mesa/main/framebuffer.c | 1 + src/mesa/main/mtypes.h | 52 - 4 files changed, 50 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 3d4965c..99c1b06 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -117,6 +117,7 @@ static const struct extension extension_table[] = { { "GL_ARB_fragment_program",o(ARB_fragment_program), GLL,2002 }, { "GL_ARB_fragment_program_shadow", o(ARB_fragment_program_shadow), GLL,2003 }, { "GL_ARB_fragment_shader", o(ARB_fragment_shader), GL, 2002 }, + { "GL_ARB_framebuffer_no_attachments", o(ARB_framebuffer_no_attachments), GL, 2012 }, { "GL_ARB_framebuffer_object", o(ARB_framebuffer_object), GL, 2005 }, { "GL_ARB_framebuffer_sRGB",o(EXT_framebuffer_sRGB), GL, 1998 }, { "GL_ARB_get_program_binary", o(dummy_true), GL, 2010 }, diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 27cf97f..eabbb96 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -914,6 +914,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, fb->Height = 0; fb->_AllColorBuffersFixedPoint = GL_TRUE; fb->_HasSNormOrFloatColorBuffer = GL_FALSE; + fb->_HasAttachments = GL_TRUE; /* Start at -2 to more easily loop over all attachment points. * -2: depth buffer diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 4f7736a..4e4d896 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -157,6 +157,7 @@ _mesa_initialize_window_framebuffer(struct gl_framebuffer *fb, fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT; fb->_AllColorBuffersFixedPoint = !visual->floatMode; fb->_HasSNormOrFloatColorBuffer = visual->floatMode; + fb->_HasAttachments = GL_TRUE; compute_depth_max(fb); } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index fb41430..ef97538 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3133,12 +3133,29 @@ struct gl_framebuffer */ struct gl_config Visual; - GLuint Width, Height; /**< size of frame buffer in pixels */ + /** +* size of frame buffer in pixels, +* no attachments has these values as 0 +*/ + GLuint Width, Height; + + /** +* In the case that the framebuffer has no attachment (i.e. +* GL_ARB_framebuffer_no_attachments) then the geometry of +* the framebuffer is specified by the default values. +*/ + struct { + GLuint Width, Height, Layers, NumSamples; + GLboolean FixedSampleLocations; + } DefaultGeometry; - /** \name Drawing bounds (Intersection of buffer size and scissor box) */ + /** \name Drawing bounds (Intersection of buffer size and scissor box) +* The drawing region is given by [_Xmin, _Xmax) x [_Ymin, _Ymax), +* (inclusive for _Xmin and _Ymin while exclusive for _Xmax and _Ymax) +*/ /*@{*/ - GLint _Xmin, _Xmax; /**< inclusive */ - GLint _Ymin, _Ymax; /**< exclusive */ + GLint _Xmin, _Xmax; + GLint _Ymin, _Ymax; /*@}*/ /** \name Derived Z buffer stuff */ @@ -3151,6 +3168,20 @@ struct gl_framebuffer /** One of the GL_FRAMEBUFFER_(IN)COMPLETE_* tokens */ GLenum _Status; + /** True if both of the conditions: +* 1. one of Attachment has Type != GL_NONE +* 2 _Status is GL_FRAMEBUFFER_COMPLETE_EXT +* NOTE: the values for Width and Height are set to 0 in +* case of no attachments, a backend driver supporting +* GL_ARB_framebuffer_no_attachments must check for the +* flag _HasAttachments and if GL_FALSE, must then use +* the values in DefaultGeometry to initialize its +* viewport, scissor and so on (in particular _Xmin, +* _Xmax, _Ymin and _Ymax do NOT take into account +* _HasAttachments being false) +*/ + GLboolean _HasAttachments; + /** Integer color values */ GLboolean _IntegerColor; @@ -3161,7 +3192,9 @@ struct gl_framebuffer /** * The maximum number of layers in the framebuffer, or 0 if the framebuffer * is not layered. For cube maps and cube map arrays, each cube face -* counts as a layer. +* counts as a layer. As the case for Width, Height a backend driver +* supporting GL_ARB_framebuffer_no_attachments must use DefaultGeometry +* in the case that _HasAttachments is false */ GLuint MaxNumLayers; @@ -3340,6 +3373
[Mesa-dev] [PATCH 6/9] i965: Use _mesa_geometry_ functions appropriately
From: Kevin Rogovin Change references to gl_framebuffer::Width, Height, MaxNumLayers and Visual::samples to use the _mesa_geometry_ convenience functions for those places where the geometry of the gl_framebuffer is needed (in contrast to the geometry of the intersection of the attachments of the gl_framebuffer). This patch is to pave the way to enable GL_ARB_framebuffer_no_attachments on Gen7 and higher in i965. --- src/mesa/drivers/dri/i965/brw_clip_state.c | 9 ++--- src/mesa/drivers/dri/i965/brw_misc_state.c | 10 +++--- src/mesa/drivers/dri/i965/brw_sf_state.c | 8 src/mesa/drivers/dri/i965/brw_state_upload.c | 6 -- src/mesa/drivers/dri/i965/brw_wm.c | 7 --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 11 +++ src/mesa/drivers/dri/i965/gen6_clip_state.c| 10 +++--- src/mesa/drivers/dri/i965/gen6_multisample_state.c | 3 ++- src/mesa/drivers/dri/i965/gen6_scissor_state.c | 13 ++--- src/mesa/drivers/dri/i965/gen6_sf_state.c | 3 ++- src/mesa/drivers/dri/i965/gen6_viewport_state.c| 5 +++-- src/mesa/drivers/dri/i965/gen6_wm_state.c | 3 ++- src/mesa/drivers/dri/i965/gen7_sf_state.c | 3 ++- src/mesa/drivers/dri/i965/gen7_viewport_state.c| 5 +++-- src/mesa/drivers/dri/i965/gen7_wm_state.c | 3 ++- src/mesa/drivers/dri/i965/gen8_viewport_state.c| 8 +--- 16 files changed, 74 insertions(+), 33 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c index 3223834..dee74db 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_state.c +++ b/src/mesa/drivers/dri/i965/brw_clip_state.c @@ -32,6 +32,7 @@ #include "brw_context.h" #include "brw_state.h" #include "brw_defines.h" +#include "main/framebuffer.h" static void upload_clip_vp(struct brw_context *brw) @@ -59,7 +60,9 @@ brw_upload_clip_unit(struct brw_context *brw) struct brw_clip_unit_state *clip; /* _NEW_BUFFERS */ - struct gl_framebuffer *fb = ctx->DrawBuffer; + const struct gl_framebuffer *fb = ctx->DrawBuffer; + const float fb_width = (float)_mesa_geometric_width(fb); + const float fb_height = (float)_mesa_geometric_height(fb); upload_clip_vp(brw); @@ -127,8 +130,8 @@ brw_upload_clip_unit(struct brw_context *brw) /* enable guardband clipping if we can */ if (ctx->ViewportArray[0].X == 0 && ctx->ViewportArray[0].Y == 0 && - ctx->ViewportArray[0].Width == (float) fb->Width && - ctx->ViewportArray[0].Height == (float) fb->Height) + ctx->ViewportArray[0].Width == fb_width && + ctx->ViewportArray[0].Height == fb_height) { clip->clip5.guard_band_enable = 1; clip->clip6.clipper_viewport_state_ptr = diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 78a46cb..e9b1773 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -39,6 +39,7 @@ #include "brw_state.h" #include "brw_defines.h" +#include "main/framebuffer.h" #include "main/fbobject.h" #include "main/glformats.h" @@ -46,12 +47,15 @@ static void upload_drawing_rect(struct brw_context *brw) { struct gl_context *ctx = &brw->ctx; + const struct gl_framebuffer *fb = ctx->DrawBuffer; + const unsigned int fb_width = _mesa_geometric_width(fb); + const unsigned int fb_height = _mesa_geometric_height(fb); BEGIN_BATCH(4); OUT_BATCH(_3DSTATE_DRAWING_RECTANGLE << 16 | (4 - 2)); OUT_BATCH(0); /* xmin, ymin */ - OUT_BATCH(((ctx->DrawBuffer->Width - 1) & 0x) | - ((ctx->DrawBuffer->Height - 1) << 16)); + OUT_BATCH(((fb_width - 1) & 0x) | + ((fb_height - 1) << 16)); OUT_BATCH(0); ADVANCE_BATCH(); } @@ -767,7 +771,7 @@ static void upload_polygon_stipple_offset(struct brw_context *brw) * works just fine, and there's no window system to worry about. */ if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) - OUT_BATCH((32 - (ctx->DrawBuffer->Height & 31)) & 31); + OUT_BATCH((32 - (_mesa_geometric_height(ctx->DrawBuffer) & 31)) & 31); else OUT_BATCH(0); ADVANCE_BATCH(); diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index 014b434..6f9397f 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -52,6 +52,14 @@ static void upload_sf_vp(struct brw_context *brw) sizeof(*sfv), 32, &brw->sf.vp_offset); memset(sfv, 0, sizeof(*sfv)); + /* Accessing the fields Width and Height of +* gl_framebuffer to produce the values to +* program the viewport and scissor is fine +* as long as the gl_framebuffer has atleast +* one attachment. +*/ + assert(ctx->DrawBuffer->_HasAttachments); + if (render_to_fbo) { y_scale = 1.0; y_bias = 0; diff --git a/s
[Mesa-dev] [PATCH 4/9] mesa: add helper convenience functions for fetching geometry of gl_framebuffer
From: Kevin Rogovin Add convenience helper functions for fetching geometry of gl_framebuffer that return the geometry of the gl_framebuffer instead of the geometry of the buffers of the gl_framebuffer when then the gl_framebuffer has no attachments. --- src/mesa/main/framebuffer.h | 29 + src/mesa/main/mtypes.h | 8 +++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h index a427421..4a2e0d9 100644 --- a/src/mesa/main/framebuffer.h +++ b/src/mesa/main/framebuffer.h @@ -76,6 +76,35 @@ _mesa_scissor_bounding_box(const struct gl_context *ctx, const struct gl_framebuffer *buffer, unsigned idx, int *bbox); +static inline GLuint +_mesa_geometric_width(const struct gl_framebuffer *buffer) +{ + return buffer->_HasAttachments ? + buffer->Width : buffer->DefaultGeometry.Width; +} + + +static inline GLuint +_mesa_geometric_height(const struct gl_framebuffer *buffer) +{ + return buffer->_HasAttachments ? + buffer->Height : buffer->DefaultGeometry.Height; +} + +static inline GLuint +_mesa_geometric_samples(const struct gl_framebuffer *buffer) +{ + return buffer->_HasAttachments ? + buffer->Visual.samples : buffer->DefaultGeometry.NumSamples; +} + +static inline GLuint +_mesa_geometric_layers(const struct gl_framebuffer *buffer) +{ + return buffer->_HasAttachments ? + buffer->MaxNumLayers : buffer->DefaultGeometry.Layers; +} + extern void _mesa_update_draw_buffer_bounds(struct gl_context *ctx); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index ef97538..f0e8fbc 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3178,7 +3178,13 @@ struct gl_framebuffer * the values in DefaultGeometry to initialize its * viewport, scissor and so on (in particular _Xmin, * _Xmax, _Ymin and _Ymax do NOT take into account -* _HasAttachments being false) +* _HasAttachments being false). To get the geometry +* of the framebuffer, the helper functions +* _mesa_geometric_width(), +* _mesa_geometric_height(), +* _mesa_geometric_samples(), +* _mesa_geometric_layers() +* are available that check _HasAttachments. */ GLboolean _HasAttachments; -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/9] mesa: Complete implementation for GL_ARB_framebuffer_no_attachments in Mesa core
From: Kevin Rogovin Implement GL_ARB_framebuffer_no_attachments in Mesa core - changes to conditions for framebuffer completenss - implement set/get functions for framebuffers for new functions in GL_ARB_framebuffer_no_attachments --- src/mesa/main/fbobject.c | 154 --- 1 file changed, 145 insertions(+), 9 deletions(-) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 5c78c40..402537b 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1113,14 +1113,49 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, } else if (att_layer_count > max_layer_count) { max_layer_count = att_layer_count; } + + /** + * The extension GL_ARB_framebuffer_no_attachments places the additional + * requirement on each attachment that + * + * "The width and height of image are greater than zero and less than or + * equal to the values of the implementation-dependent limits + * MAX_FRAMEBUFFER_WIDTH and MAX_FRAMEBUFFER_HEIGHT, respectively. " + * + * "If is a three-dimensional texture or a one- or two-dimensional + * array texture and the attachment is layered, the depth or layer count + * of the texture is less than or equal to the implementation-dependent + * limit MAX_FRAMEBUFFER_LAYERS." + * + * "If image has multiple samples, its sample count is less than or equal + * to the value of the implementation-dependent limit MAX_FRAMEBUFFER_- + * SAMPLES ." + * + * The same requirements are also in place for GL 4.5, + * Section 9.4.1 "Framebuffer Attachment Completeness", pg 310-311 + * + * However, this is a tighter restriction than previous version of GL. + * In interest of better compatibility, we will not enforce these + * restrictions. + */ } fb->MaxNumLayers = max_layer_count; if (numImages == 0) { - fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT; - fbo_incomplete(ctx, "no attachments", -1); - return; + fb->_HasAttachments = GL_FALSE; + + if (!ctx->Extensions.ARB_framebuffer_no_attachments) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT; + fbo_incomplete(ctx, "no attachments", -1); + return; + } + + if (fb->DefaultGeometry.Width == 0 || fb->DefaultGeometry.Height == 0) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT; + fbo_incomplete(ctx, "no attachments and default width or height is 0", -1); + return; + } } if (_mesa_is_desktop_gl(ctx) && !ctx->Extensions.ARB_ES2_compatibility) { @@ -1185,8 +1220,10 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, * renderbuffers/textures are different sizes, the framebuffer * width/height will be set to the smallest width/height. */ - fb->Width = minWidth; - fb->Height = minHeight; + if (numImages != 0) { + fb->Width = minWidth; + fb->Height = minHeight; + } /* finally, update the visual info for the framebuffer */ _mesa_update_framebuffer_visual(ctx, fb); @@ -1292,16 +1329,115 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer) bind_renderbuffer(target, renderbuffer, true); } -extern void GLAPIENTRY +static void +framebuffer_parameteri(struct gl_context *ctx, struct gl_framebuffer *fb, + GLenum pname, GLint param, const char *func) +{ + switch (pname) { + case GL_FRAMEBUFFER_DEFAULT_WIDTH: + if (param < 0 || param > ctx->Const.MaxFramebufferWidth) +_mesa_error(ctx, GL_INVALID_VALUE, "%s", func); + else + fb->DefaultGeometry.Width = param; + break; + case GL_FRAMEBUFFER_DEFAULT_HEIGHT: + if (param < 0 || param > ctx->Const.MaxFramebufferHeight) +_mesa_error(ctx, GL_INVALID_VALUE, "%s", func); + else + fb->DefaultGeometry.Height = param; + break; + case GL_FRAMEBUFFER_DEFAULT_LAYERS: + if (param < 0 || param > ctx->Const.MaxFramebufferLayers) +_mesa_error(ctx, GL_INVALID_VALUE, "%s", func); + else + fb->DefaultGeometry.Layers = param; + break; + case GL_FRAMEBUFFER_DEFAULT_SAMPLES: + if (param < 0 || param > ctx->Const.MaxFramebufferSamples) +_mesa_error(ctx, GL_INVALID_VALUE, "%s", func); + else +fb->DefaultGeometry.NumSamples = param; + break; + case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS: + fb->DefaultGeometry.FixedSampleLocations = param; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, + "%s(pname=0x%x)", func, pname); + } +} + +void GLAPIENTRY _mesa_FramebufferParameteri(GLenum target, GLenum pname, GLint param) { - /* to be implemented */ + GET_CURRENT_CONTEXT(ctx); + struct gl_framebuffer *fb; + + fb = get_framebuffer_t
[Mesa-dev] [PATCH 8/9] i965: enable ARB_framebuffer_no_attachments extension for Gen7 and later
From: Kevin Rogovin Enable GL_ARB_framebuffer_no_attachments in i965 for Gen7 and higher. --- src/mesa/drivers/dri/i965/brw_context.c | 6 ++ src/mesa/drivers/dri/i965/intel_extensions.c | 1 + 2 files changed, 7 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 9d90360..5c9577f 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -608,6 +608,12 @@ brw_initialize_context_constants(struct brw_context *brw) /* ARB_gpu_shader5 */ if (brw->gen >= 7) ctx->Const.MaxVertexStreams = MIN2(4, MAX_VERTEX_STREAMS); + + /* ARB_framebuffer_no_attachments */ + ctx->Const.MaxFramebufferWidth = ctx->Const.MaxViewportWidth; + ctx->Const.MaxFramebufferHeight = ctx->Const.MaxViewportHeight; + ctx->Const.MaxFramebufferLayers = ctx->Const.MaxArrayTextureLayers; + ctx->Const.MaxFramebufferSamples = max_samples; } /** diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c index 48064e1..65cf2bb 100644 --- a/src/mesa/drivers/dri/i965/intel_extensions.c +++ b/src/mesa/drivers/dri/i965/intel_extensions.c @@ -304,6 +304,7 @@ intelInitExtensions(struct gl_context *ctx) if (brw->gen >= 7) { ctx->Extensions.ARB_conservative_depth = true; ctx->Extensions.ARB_texture_view = true; + ctx->Extensions.ARB_framebuffer_no_attachments = true; if (can_do_pipelined_register_writes(brw)) { ctx->Extensions.ARB_transform_feedback2 = true; ctx->Extensions.ARB_transform_feedback3 = true; -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/9] mesa:Define constants and functions for GL_ARB_framebuffer_no_attachment extension
From: Kevin Rogovin Define the enumeration constants, function entry points and glGet for the GL_ARB_framebuffer_no_attachments --- .../glapi/gen/ARB_framebuffer_no_attachments.xml | 33 +++ src/mapi/glapi/gen/Makefile.am | 1 + src/mapi/glapi/gen/gl_API.xml | 4 ++- src/mesa/main/fbobject.c | 12 +++ src/mesa/main/fbobject.h | 7 src/mesa/main/get.c| 3 ++ src/mesa/main/get_hash_params.py | 38 ++ 7 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 src/mapi/glapi/gen/ARB_framebuffer_no_attachments.xml diff --git a/src/mapi/glapi/gen/ARB_framebuffer_no_attachments.xml b/src/mapi/glapi/gen/ARB_framebuffer_no_attachments.xml new file mode 100644 index 000..5bde14d --- /dev/null +++ b/src/mapi/glapi/gen/ARB_framebuffer_no_attachments.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am index 1c4b86a..dc61739 100644 --- a/src/mapi/glapi/gen/Makefile.am +++ b/src/mapi/glapi/gen/Makefile.am @@ -129,6 +129,7 @@ API_XML = \ ARB_draw_instanced.xml \ ARB_ES2_compatibility.xml \ ARB_ES3_compatibility.xml \ + ARB_framebuffer_no_attachments.xml \ ARB_framebuffer_object.xml \ ARB_geometry_shader4.xml \ ARB_get_program_binary.xml \ diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index a8a6db6..91882ef 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -8324,7 +8324,9 @@ - +http://www.w3.org/2001/XInclude"/> + + diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index eabbb96..5c78c40 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1292,6 +1292,18 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer) bind_renderbuffer(target, renderbuffer, true); } +extern void GLAPIENTRY +_mesa_FramebufferParameteri(GLenum target, GLenum pname, GLint param) +{ + /* to be implemented */ +} + +extern void GLAPIENTRY +_mesa_GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params) +{ + /* to be implemented */ +} + /** * Remove the specified renderbuffer or texture from any attachment point in diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h index 61aa1f5..76adb92 100644 --- a/src/mesa/main/fbobject.h +++ b/src/mesa/main/fbobject.h @@ -211,4 +211,11 @@ extern void GLAPIENTRY _mesa_DiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments); + +extern void GLAPIENTRY +_mesa_FramebufferParameteri(GLenum target, GLenum pname, GLint param); + +extern void GLAPIENTRY +_mesa_GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params); + #endif /* FBOBJECT_H */ diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index a881bc5..ca9d13c 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -393,6 +393,7 @@ EXTRA_EXT(INTEL_performance_query); EXTRA_EXT(ARB_explicit_uniform_location); EXTRA_EXT(ARB_clip_control); EXTRA_EXT(EXT_polygon_offset_clamp); +EXTRA_EXT(ARB_framebuffer_no_attachments); static const int extra_ARB_color_buffer_float_or_glcore[] = { @@ -466,6 +467,8 @@ static const int extra_core_ARB_color_buffer_float_and_new_buffers[] = { * remaining combinations. To look up the enums valid in a given API * we will use a hash table specific to that API. These tables are in * turn generated at build time and included through get_hash.h. + * To add an entry (i.e. a new enumeration for glGet that is taken + * from the table) add an entry to get_hash_params.py. */ #include "get_hash.h" diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index 41cb2c1..37d9545 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -1,3 +1,34 @@ +# glGet pnames possible, organized first by GL version +# and then organized by GL extension. +# There is a list for different combinations of GL_ version +# that combination is specified by the field "apis". +# The field "params" is a list of entries describing +# how glGet* operates when passed a pname. +# To add a pname for glGet* to handle, the entry is of the form +# a) [ "PnameX", "LOC_CUSTOM, TypeX, ExtraRequirementX" ] +# OR +# b) [ "PnameX", "OffsetX, ExtraRequirement" ] +# +# - PnameX is the name of the pname passed to glGet without the GL_ prefix +# - ExtraRequirement is extra requirment declared in get.c listing +# GL requirements (such as extension requirements). If no extra +# requirement is needed, then it is NO_EXTRA +# +# Form a) is for those pnames whose glGet implementation is +# not a direct take of the value from a value stored in a field +# but requires some "work
[Mesa-dev] [PATCH 7/9] i965: ensure execution of fragment shader when fragment shader has atomic buffer access
From: Kevin Rogovin If the fragment shader has atomic buffer access, the shader must execute even if the current draw buffer has no attachments. --- src/mesa/drivers/dri/i965/gen7_wm_state.c | 7 +++ src/mesa/drivers/dri/i965/gen8_ps_state.c | 4 2 files changed, 11 insertions(+) diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c b/src/mesa/drivers/dri/i965/gen7_wm_state.c index 4d67b86..939d6e4 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c @@ -77,6 +77,13 @@ upload_wm_state(struct brw_context *brw) dw1 |= GEN7_WM_KILL_ENABLE; } + if (brw->ctx.Shader._CurrentFragmentProgram != NULL && + brw->ctx.Shader._CurrentFragmentProgram->NumAtomicBuffers > 0) { + dw1 |= GEN7_WM_DISPATCH_ENABLE; + } + /* _NEW_BUFFERS | _NEW_COLOR */ if (brw_color_buffer_write_enabled(brw) || writes_depth || dw1 & GEN7_WM_KILL_ENABLE) { diff --git a/src/mesa/drivers/dri/i965/gen8_ps_state.c b/src/mesa/drivers/dri/i965/gen8_ps_state.c index 5f39e12..614bc9b 100644 --- a/src/mesa/drivers/dri/i965/gen8_ps_state.c +++ b/src/mesa/drivers/dri/i965/gen8_ps_state.c @@ -62,6 +62,10 @@ upload_ps_extra(struct brw_context *brw) if (prog_data->uses_omask) dw1 |= GEN8_PSX_OMASK_TO_RENDER_TARGET; + if (brw->ctx.Shader._CurrentFragmentProgram != NULL && + brw->ctx.Shader._CurrentFragmentProgram->NumAtomicBuffers > 0) + dw1 |= GEN8_PSX_SHADER_HAS_UAV; + BEGIN_BATCH(2); OUT_BATCH(_3DSTATE_PS_EXTRA << 16 | (2 - 2)); OUT_BATCH(dw1); -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] st/mesa: adjust blending modes if we don't have destination alpha
On 28/04/15 23:16, Brian Paul wrote: If the user requested a GL_RGB texture but the driver actually allocated an RGBA texture, the alpha values in the texture may not be defined. If we later bind the texture as a color target and try to blend into it with GL_DST_ALPHA or GL_ONE_MINUS_DST_ALPHA we may blend with undefined alpha values when, in fact, the dest alpha value should be one. So replace GL_DST_ALPHA/GL_ONE_MINUS_DST_ALPHA with GL_ONE/GL_ZERO. Fixes the piglit fbo-blending-formats test for some GL_RGB formats with the VMware driver. Also tested with llvmpipe. --- src/mesa/state_tracker/st_atom_blend.c | 38 +- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c index 6bb4077..30bff7a 100644 --- a/src/mesa/state_tracker/st_atom_blend.c +++ b/src/mesa/state_tracker/st_atom_blend.c @@ -44,10 +44,21 @@ /** * Convert GLenum blend tokens to pipe tokens. * Both blend factors and blend funcs are accepted. + * \param destBaseFormat the base format of the render target, such as + *GL_RGBA, GL_RGB, GL_RED, GL_ALPHA, etc. */ static GLuint -translate_blend(GLenum blend) +translate_blend(GLenum blend, GLenum destBaseFormat) { + /* If we don't have destination alpha and the blend factor is either +* GL_DST_ALPHA or GL_ONE_MINUS_DST_ALPHA then we use +* PIPE_BLENDFACTOR_ONE or _ZERO instead. +*/ + const bool haveDstA = (destBaseFormat == GL_RGBA || + destBaseFormat == GL_ALPHA || + destBaseFormat == GL_INTENSITY || + destBaseFormat == GL_LUMINANCE_ALPHA); + switch (blend) { /* blend functions */ case GL_FUNC_ADD: @@ -69,7 +80,7 @@ translate_blend(GLenum blend) case GL_SRC_ALPHA: return PIPE_BLENDFACTOR_SRC_ALPHA; case GL_DST_ALPHA: - return PIPE_BLENDFACTOR_DST_ALPHA; + return haveDstA ? PIPE_BLENDFACTOR_DST_ALPHA : PIPE_BLENDFACTOR_ONE; case GL_DST_COLOR: return PIPE_BLENDFACTOR_DST_COLOR; case GL_SRC_ALPHA_SATURATE: @@ -91,7 +102,7 @@ translate_blend(GLenum blend) case GL_ONE_MINUS_DST_COLOR: return PIPE_BLENDFACTOR_INV_DST_COLOR; case GL_ONE_MINUS_DST_ALPHA: - return PIPE_BLENDFACTOR_INV_DST_ALPHA; + return haveDstA ? PIPE_BLENDFACTOR_INV_DST_ALPHA : PIPE_BLENDFACTOR_ZERO; case GL_ONE_MINUS_CONSTANT_COLOR: return PIPE_BLENDFACTOR_INV_CONST_COLOR; case GL_ONE_MINUS_CONSTANT_ALPHA: @@ -208,14 +219,21 @@ update_blend( struct st_context *st ) else if (ctx->Color.BlendEnabled) { /* blending enabled */ for (i = 0, j = 0; i < num_state; i++) { + const struct gl_renderbuffer *rb; + GLenum baseFormat; blend->rt[i].blend_enable = (ctx->Color.BlendEnabled >> i) & 0x1; if (ctx->Extensions.ARB_draw_buffers_blend) j = i; + /* _NEW_BUFFERS */ + /* Get the base format of the render target */ + rb = ctx->DrawBuffer->_ColorDrawBuffers[j]; + baseFormat = rb ? rb->_BaseFormat : GL_RGBA; + blend->rt[i].rgb_func = -translate_blend(ctx->Color.Blend[j].EquationRGB); +translate_blend(ctx->Color.Blend[j].EquationRGB, baseFormat); if (ctx->Color.Blend[i].EquationRGB == GL_MIN || ctx->Color.Blend[i].EquationRGB == GL_MAX) { @@ -225,13 +243,13 @@ update_blend( struct st_context *st ) } else { blend->rt[i].rgb_src_factor = - translate_blend(ctx->Color.Blend[j].SrcRGB); + translate_blend(ctx->Color.Blend[j].SrcRGB, baseFormat); blend->rt[i].rgb_dst_factor = - translate_blend(ctx->Color.Blend[j].DstRGB); + translate_blend(ctx->Color.Blend[j].DstRGB, baseFormat); } blend->rt[i].alpha_func = -translate_blend(ctx->Color.Blend[j].EquationA); +translate_blend(ctx->Color.Blend[j].EquationA, baseFormat); if (ctx->Color.Blend[i].EquationA == GL_MIN || ctx->Color.Blend[i].EquationA == GL_MAX) { @@ -241,9 +259,9 @@ update_blend( struct st_context *st ) } else { blend->rt[i].alpha_src_factor = - translate_blend(ctx->Color.Blend[j].SrcA); + translate_blend(ctx->Color.Blend[j].SrcA, baseFormat); blend->rt[i].alpha_dst_factor = - translate_blend(ctx->Color.Blend[j].DstA); + translate_blend(ctx->Color.Blend[j].DstA, baseFormat); } } } @@ -285,7 +303,7 @@ update_blend( struct st_context *st ) const struct st_tracked_state st_update_blend = { "st_update_blend", /* name */ { /* dirty */ - (_NEW_COLOR | _NEW_MULTISAMPLE), /*
Re: [Mesa-dev] [PATCH 1/2] st/mesa: adjust blending modes if we don't have destination alpha
I can't say I like this. Ever since Radeon - Northern Islands, our hardware can do this DST_ALPHA->ONE adjustment automatically, so the new state dependency on _NEW_BUFFERS is unnecessary for us here. Marek On Wed, Apr 29, 2015 at 2:19 AM, Brian Paul wrote: > If the user requested a GL_RGB texture but the driver actually allocated > an RGBA texture, the alpha values in the texture may not be defined. > > If we later bind the texture as a color target and try to blend into > it with GL_DST_ALPHA or GL_ONE_MINUS_DST_ALPHA we may blend with > undefined alpha values when, in fact, the dest alpha value should be one. > So replace GL_DST_ALPHA/GL_ONE_MINUS_DST_ALPHA with GL_ONE/GL_ZERO. > > Fixes the piglit fbo-blending-formats test for some GL_RGB formats > with the VMware driver. Also tested with llvmpipe. > > v2: use the i-th (not j-th) render buffer's base format > --- > src/mesa/state_tracker/st_atom_blend.c | 38 > +- > 1 file changed, 28 insertions(+), 10 deletions(-) > > diff --git a/src/mesa/state_tracker/st_atom_blend.c > b/src/mesa/state_tracker/st_atom_blend.c > index 6bb4077..6337e1c 100644 > --- a/src/mesa/state_tracker/st_atom_blend.c > +++ b/src/mesa/state_tracker/st_atom_blend.c > @@ -44,10 +44,21 @@ > /** > * Convert GLenum blend tokens to pipe tokens. > * Both blend factors and blend funcs are accepted. > + * \param destBaseFormat the base format of the render target, such as > + *GL_RGBA, GL_RGB, GL_RED, GL_ALPHA, etc. > */ > static GLuint > -translate_blend(GLenum blend) > +translate_blend(GLenum blend, GLenum destBaseFormat) > { > + /* If we don't have destination alpha and the blend factor is either > +* GL_DST_ALPHA or GL_ONE_MINUS_DST_ALPHA then we use > +* PIPE_BLENDFACTOR_ONE or _ZERO instead. > +*/ > + const bool haveDstA = (destBaseFormat == GL_RGBA || > + destBaseFormat == GL_ALPHA || > + destBaseFormat == GL_INTENSITY || > + destBaseFormat == GL_LUMINANCE_ALPHA); > + > switch (blend) { > /* blend functions */ > case GL_FUNC_ADD: > @@ -69,7 +80,7 @@ translate_blend(GLenum blend) > case GL_SRC_ALPHA: >return PIPE_BLENDFACTOR_SRC_ALPHA; > case GL_DST_ALPHA: > - return PIPE_BLENDFACTOR_DST_ALPHA; > + return haveDstA ? PIPE_BLENDFACTOR_DST_ALPHA : PIPE_BLENDFACTOR_ONE; > case GL_DST_COLOR: >return PIPE_BLENDFACTOR_DST_COLOR; > case GL_SRC_ALPHA_SATURATE: > @@ -91,7 +102,7 @@ translate_blend(GLenum blend) > case GL_ONE_MINUS_DST_COLOR: >return PIPE_BLENDFACTOR_INV_DST_COLOR; > case GL_ONE_MINUS_DST_ALPHA: > - return PIPE_BLENDFACTOR_INV_DST_ALPHA; > + return haveDstA ? PIPE_BLENDFACTOR_INV_DST_ALPHA : > PIPE_BLENDFACTOR_ZERO; > case GL_ONE_MINUS_CONSTANT_COLOR: >return PIPE_BLENDFACTOR_INV_CONST_COLOR; > case GL_ONE_MINUS_CONSTANT_ALPHA: > @@ -208,14 +219,21 @@ update_blend( struct st_context *st ) > else if (ctx->Color.BlendEnabled) { >/* blending enabled */ >for (i = 0, j = 0; i < num_state; i++) { > + const struct gl_renderbuffer *rb; > + GLenum baseFormat; > > blend->rt[i].blend_enable = (ctx->Color.BlendEnabled >> i) & 0x1; > > if (ctx->Extensions.ARB_draw_buffers_blend) > j = i; > > + /* _NEW_BUFFERS */ > + /* Get the base format of the i-th render target */ > + rb = ctx->DrawBuffer->_ColorDrawBuffers[i]; > + baseFormat = rb ? rb->_BaseFormat : GL_RGBA; > + > blend->rt[i].rgb_func = > -translate_blend(ctx->Color.Blend[j].EquationRGB); > +translate_blend(ctx->Color.Blend[j].EquationRGB, baseFormat); > > if (ctx->Color.Blend[i].EquationRGB == GL_MIN || > ctx->Color.Blend[i].EquationRGB == GL_MAX) { > @@ -225,13 +243,13 @@ update_blend( struct st_context *st ) > } > else { > blend->rt[i].rgb_src_factor = > - translate_blend(ctx->Color.Blend[j].SrcRGB); > + translate_blend(ctx->Color.Blend[j].SrcRGB, baseFormat); > blend->rt[i].rgb_dst_factor = > - translate_blend(ctx->Color.Blend[j].DstRGB); > + translate_blend(ctx->Color.Blend[j].DstRGB, baseFormat); > } > > blend->rt[i].alpha_func = > -translate_blend(ctx->Color.Blend[j].EquationA); > +translate_blend(ctx->Color.Blend[j].EquationA, baseFormat); > > if (ctx->Color.Blend[i].EquationA == GL_MIN || > ctx->Color.Blend[i].EquationA == GL_MAX) { > @@ -241,9 +259,9 @@ update_blend( struct st_context *st ) > } > else { > blend->rt[i].alpha_src_factor = > - translate_blend(ctx->Color.Blend[j].SrcA); > + translate_blend(ctx->Color.Blend[j].SrcA, baseFormat); > blend->rt[i].alpha_dst_factor =
Re: [Mesa-dev] [PATCH 9/9] mark GL_ARB_framebuffer_no_attachments as done for i965
On 04/29/2015 11:56 AM, kevin.rogo...@intel.com wrote: From: Kevin Rogovin Mark GL_ARB_framebuffer_no_attachments as done for i965. --- docs/GL3.txt | 2 +- docs/relnotes/10.6.0.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/GL3.txt b/docs/GL3.txt index 172fd3c..cf3b5a2 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -157,7 +157,7 @@ GL 4.3, GLSL 4.30: GL_KHR_debug DONE (all drivers) GL_ARB_explicit_uniform_location DONE (all drivers that support GLSL) GL_ARB_fragment_layer_viewport DONE (nv50, nvc0, r600, llvmpipe) - GL_ARB_framebuffer_no_attachmentsnot started + GL_ARB_framebuffer_no_attachmentsDONE (i965) GL_ARB_internalformat_query2 not started GL_ARB_invalidate_subdataDONE (all drivers) GL_ARB_multi_draw_indirect DONE (i965, nvc0, r600, radeonsi, llvmpipe, softpipe) At the bottom is another block with GLES 3.1 requirements, which also contains GL_ARB_f_n_a. -- Petri Latvala ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] st/mesa: adjust blending modes if we don't have destination alpha
I think there are two different things here: one is the driver internally fakes BGRX with BGRA, and obviously it's the pipe driver that needs to fix up alpha channel blending to simulate it's one. The other is the state tracker is faking BGRX with BGRA, and in that case, it's the state tracker that needs to do the fix up (as the pipe has no way to know if that's intentional or not). Or are you saying that state trackers should never attempt to fulfill BGRX formats with BGRA, and that every driver needs to workaround this internally? I don't fill too strongly about this, but it wouldn't sound consistent. Nowadays have a pipe cap for every single little thing out there. I don't see a reason to treat render target formats differently. Otherwise something that can be easily done once in the state tracker now needs to be replicated in every driver. But you have a point about _NEW_BUFFERS. It could be avoided. We could introduce a new flag _NEW_BUFFERS_EMULATED, set when fbo's with emulated formats (e.g., backing BGRX with BGRA), so that drivers that support (or workaround) these things internally don't . On the other hand, _NEW_BUFFERS probably doesn't change that frequently, blend state probably changes much more often. Jose On 29/04/15 11:00, Marek Olšák wrote: I can't say I like this. Ever since Radeon - Northern Islands, our hardware can do this DST_ALPHA->ONE adjustment automatically, so the new state dependency on _NEW_BUFFERS is unnecessary for us here. Marek On Wed, Apr 29, 2015 at 2:19 AM, Brian Paul wrote: If the user requested a GL_RGB texture but the driver actually allocated an RGBA texture, the alpha values in the texture may not be defined. If we later bind the texture as a color target and try to blend into it with GL_DST_ALPHA or GL_ONE_MINUS_DST_ALPHA we may blend with undefined alpha values when, in fact, the dest alpha value should be one. So replace GL_DST_ALPHA/GL_ONE_MINUS_DST_ALPHA with GL_ONE/GL_ZERO. Fixes the piglit fbo-blending-formats test for some GL_RGB formats with the VMware driver. Also tested with llvmpipe. v2: use the i-th (not j-th) render buffer's base format --- src/mesa/state_tracker/st_atom_blend.c | 38 +- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c index 6bb4077..6337e1c 100644 --- a/src/mesa/state_tracker/st_atom_blend.c +++ b/src/mesa/state_tracker/st_atom_blend.c @@ -44,10 +44,21 @@ /** * Convert GLenum blend tokens to pipe tokens. * Both blend factors and blend funcs are accepted. + * \param destBaseFormat the base format of the render target, such as + *GL_RGBA, GL_RGB, GL_RED, GL_ALPHA, etc. */ static GLuint -translate_blend(GLenum blend) +translate_blend(GLenum blend, GLenum destBaseFormat) { + /* If we don't have destination alpha and the blend factor is either +* GL_DST_ALPHA or GL_ONE_MINUS_DST_ALPHA then we use +* PIPE_BLENDFACTOR_ONE or _ZERO instead. +*/ + const bool haveDstA = (destBaseFormat == GL_RGBA || + destBaseFormat == GL_ALPHA || + destBaseFormat == GL_INTENSITY || + destBaseFormat == GL_LUMINANCE_ALPHA); + switch (blend) { /* blend functions */ case GL_FUNC_ADD: @@ -69,7 +80,7 @@ translate_blend(GLenum blend) case GL_SRC_ALPHA: return PIPE_BLENDFACTOR_SRC_ALPHA; case GL_DST_ALPHA: - return PIPE_BLENDFACTOR_DST_ALPHA; + return haveDstA ? PIPE_BLENDFACTOR_DST_ALPHA : PIPE_BLENDFACTOR_ONE; case GL_DST_COLOR: return PIPE_BLENDFACTOR_DST_COLOR; case GL_SRC_ALPHA_SATURATE: @@ -91,7 +102,7 @@ translate_blend(GLenum blend) case GL_ONE_MINUS_DST_COLOR: return PIPE_BLENDFACTOR_INV_DST_COLOR; case GL_ONE_MINUS_DST_ALPHA: - return PIPE_BLENDFACTOR_INV_DST_ALPHA; + return haveDstA ? PIPE_BLENDFACTOR_INV_DST_ALPHA : PIPE_BLENDFACTOR_ZERO; case GL_ONE_MINUS_CONSTANT_COLOR: return PIPE_BLENDFACTOR_INV_CONST_COLOR; case GL_ONE_MINUS_CONSTANT_ALPHA: @@ -208,14 +219,21 @@ update_blend( struct st_context *st ) else if (ctx->Color.BlendEnabled) { /* blending enabled */ for (i = 0, j = 0; i < num_state; i++) { + const struct gl_renderbuffer *rb; + GLenum baseFormat; blend->rt[i].blend_enable = (ctx->Color.BlendEnabled >> i) & 0x1; if (ctx->Extensions.ARB_draw_buffers_blend) j = i; + /* _NEW_BUFFERS */ + /* Get the base format of the i-th render target */ + rb = ctx->DrawBuffer->_ColorDrawBuffers[i]; + baseFormat = rb ? rb->_BaseFormat : GL_RGBA; + blend->rt[i].rgb_func = -translate_blend(ctx->Color.Blend[j].EquationRGB); +translate_blend(ctx->Color.Blend[j].EquationRGB, baseFormat); if (ctx->Color.Blend[i].
Re: [Mesa-dev] [PATCH 1/2] st/mesa: adjust blending modes if we don't have destination alpha
On Wed, Apr 29, 2015 at 12:44 PM, Jose Fonseca wrote: > I think there are two different things here: one is the driver internally > fakes BGRX with BGRA, and obviously it's the pipe driver that needs to fix > up alpha channel blending to simulate it's one. > > The other is the state tracker is faking BGRX with BGRA, and in that case, > it's the state tracker that needs to do the fix up (as the pipe has no way > to know if that's intentional or not). That's a fair point. On the other hand, I don't see why drivers can't support BGRX even if they can force A=1 for texturing only. > > Or are you saying that state trackers should never attempt to fulfill BGRX > formats with BGRA, and that every driver needs to workaround this > internally? Not necessarily. > > I don't fill too strongly about this, but it wouldn't sound consistent. > Nowadays have a pipe cap for every single little thing out there. I don't > see a reason to treat render target formats differently. Otherwise something > that can be easily done once in the state tracker now needs to be replicated > in every driver. > > > But you have a point about _NEW_BUFFERS. It could be avoided. We could > introduce a new flag _NEW_BUFFERS_EMULATED, set when fbo's with emulated > formats (e.g., backing BGRX with BGRA), so that drivers that support (or > workaround) these things internally don't . On the other hand, _NEW_BUFFERS > probably doesn't change that frequently, blend state probably changes much > more often. A new CAP would work. There is an easier way to do it though, see the attached patch (assuming blend_force_dst_alpha_to_one is set correctly). Marek diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c index 6bb4077..0d1542f 100644 --- a/src/mesa/state_tracker/st_atom_blend.c +++ b/src/mesa/state_tracker/st_atom_blend.c @@ -286,7 +286,7 @@ const struct st_tracked_state st_update_blend = { "st_update_blend", /* name */ { /* dirty */ (_NEW_COLOR | _NEW_MULTISAMPLE), /* XXX _NEW_BLEND someday? */ /* mesa */ - 0, /* st */ + ST_NEW_BLEND,/* st */ }, update_blend, /* update */ }; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 5fe132a..d7ebe22 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -95,6 +95,10 @@ void st_invalidate_state(struct gl_context * ctx, GLuint new_state) st->dirty.st |= ST_NEW_VERTEX_PROGRAM; } + if (st->blend_force_dst_alpha_to_one && (new_state & _NEW_BUFFERS)) { + st->dirty.st |= ST_NEW_BLEND; + } + st->dirty.mesa |= new_state; st->dirty.st |= ST_NEW_MESA; diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 8a9504b..a9c861d 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -53,7 +53,7 @@ struct u_upload_mgr; #define ST_NEW_FRAGMENT_PROGRAM(1 << 1) #define ST_NEW_VERTEX_PROGRAM (1 << 2) #define ST_NEW_FRAMEBUFFER (1 << 3) -/* gap, re-use it */ +#define ST_NEW_BLEND (1 << 4) #define ST_NEW_GEOMETRY_PROGRAM(1 << 5) #define ST_NEW_VERTEX_ARRAYS (1 << 6) #define ST_NEW_RASTERIZER (1 << 7) @@ -89,6 +89,7 @@ struct st_context struct draw_stage *rastpos_stage; /**< For glRasterPos */ GLboolean clamp_frag_color_in_shader; GLboolean clamp_vert_color_in_shader; + GLboolean blend_force_dst_alpha_to_one; boolean has_stencil_export; /**< can do shader stencil export? */ boolean has_time_elapsed; boolean has_shader_model3; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 9/9] mark GL_ARB_framebuffer_no_attachments as done for i965
> At the bottom is another block with GLES 3.1 requirements, which also > contains GL_ARB_f_n_a. At first, I said "Oh futz, I did not mark that one". Then I did some thinking. Before expressing my thoughts I want to emphasize that I really do not know what is the best answer, or potentially even a good one. With the caveat in mind, maybe it is best that it is not marked as ready for GL ES. Maybe. The potentially flawed reasoning is as follows: The patch series enables the extension for OpenGL and the extension stuff, I think, only applies to GL, and not GL ES, contexts. In particular, the "wiring" for the new functions is not implemented for GL ES. Secondly, the code in Mesa core from patch 3 of this series just checks for the driver reporting it supports the extension; it does not do the check "if driver supports extension AND it is GL". However, the default geometry values are zero, so the correct error code gets emitted anyways, but the text-error is not correct. This part makes me twitch, though it follows the letter of the specs jut tine. Lastly, and this is just paranoia and quite likely not an issue. I had not checked, much less quote, the relevant sections of the GL ES 3.1 spec. I think they are the same, but I did not check it at all. As one can see from the above, when implementing this, GLES did not even cross my mind. My tendency is to mark the "enabling" of this feature for ES3.1 a separate patch, but on the other hand it is not code, it is just saying the feature is ready for eventual use by ES3.1. Now in mid e-mail, I am thinking it should be marked. Beats me what is best. In truth what is making me twitch is Patch 3 under GL ES 3.1. I think that the function might need to be revisited a little when GL ES 3.1 support goes live. Thoughts on this are welcome, particular in reference to Patch 3 of the series. -Kevin ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2] clover: compile all sources with c++11
I've pushed this patch, thanks! -Tom On Tue, Apr 21, 2015 at 03:49:09PM +0200, EdB wrote: > Later we can remove the compat code > > According to Francisco Jerez, it happen that some time llvm requiring exotic > compilation flags and it would be preferable not to to contaminate the rest of > the clover build and keep the 3 statics libs > --- > src/gallium/state_trackers/clover/Makefile.am | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/gallium/state_trackers/clover/Makefile.am > b/src/gallium/state_trackers/clover/Makefile.am > index 62c13fa..f46d9ef 100644 > --- a/src/gallium/state_trackers/clover/Makefile.am > +++ b/src/gallium/state_trackers/clover/Makefile.am > @@ -35,12 +35,13 @@ endif > noinst_LTLIBRARIES = libclover.la libcltgsi.la libclllvm.la > > libcltgsi_la_CXXFLAGS = \ > - -std=c++0x \ > + -std=c++11 \ > $(VISIBILITY_CXXFLAGS) > > libcltgsi_la_SOURCES = $(TGSI_SOURCES) > > libclllvm_la_CXXFLAGS = \ > + -std=c++11 \ > $(VISIBILITY_CXXFLAGS) \ > $(LLVM_CXXFLAGS) \ > $(DEFINES) \ > -- > 2.4.0.rc2 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/4] clover: this serie remove util/compat.*
I've pushed patches 1-3, thanks! -Tom On Fri, Apr 24, 2015 at 12:59:53PM +0200, EdB wrote: > Since clover should compile use -std=c++11, > compat classes are no longer neccessary > > EdB (4): > clover: remove compat class that matche std one > clover: remove compat::string > clover: make module::symbol::name a string > clover: remove util/compat > > src/gallium/state_trackers/clover/Makefile.sources | 2 - > src/gallium/state_trackers/clover/api/program.cpp | 19 +- > .../state_trackers/clover/core/compiler.hpp| 14 +- > src/gallium/state_trackers/clover/core/error.hpp | 10 +- > src/gallium/state_trackers/clover/core/kernel.cpp | 2 +- > src/gallium/state_trackers/clover/core/module.cpp | 56 ++- > src/gallium/state_trackers/clover/core/module.hpp | 23 +- > src/gallium/state_trackers/clover/core/program.cpp | 4 +- > src/gallium/state_trackers/clover/core/program.hpp | 2 +- > .../state_trackers/clover/llvm/invocation.cpp | 42 +- > .../state_trackers/clover/tgsi/compiler.cpp| 12 +- > src/gallium/state_trackers/clover/util/compat.cpp | 38 -- > src/gallium/state_trackers/clover/util/compat.hpp | 444 > - > 13 files changed, 105 insertions(+), 563 deletions(-) > delete mode 100644 src/gallium/state_trackers/clover/util/compat.cpp > delete mode 100644 src/gallium/state_trackers/clover/util/compat.hpp > > -- > 2.3.6 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 90130] gl_PrimitiveId seems to reset at 340
https://bugs.freedesktop.org/show_bug.cgi?id=90130 --- Comment #19 from Ken Martin --- Tested and it looks good, gl_PrimitiveId is incrementing properly. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] st/mesa: adjust blending modes if we don't have destination alpha
On 04/29/2015 05:52 AM, Marek Olšák wrote: On Wed, Apr 29, 2015 at 12:44 PM, Jose Fonseca wrote: I think there are two different things here: one is the driver internally fakes BGRX with BGRA, and obviously it's the pipe driver that needs to fix up alpha channel blending to simulate it's one. The other is the state tracker is faking BGRX with BGRA, and in that case, it's the state tracker that needs to do the fix up (as the pipe has no way to know if that's intentional or not). That's a fair point. On the other hand, I don't see why drivers can't support BGRX even if they can force A=1 for texturing only. Yeah, the key thing is whether the driver advertises support for alpha "X" formats. We've only been doing that for one case (PIPE_FORMAT_B8G8R8X8_UNORM) which directly corresponds to an SVGA3D_ format (SVGA3D_X8R8G8B8). If the state tracker can always find a PIPE_FORMAT_RGBX format for a GL_RGB format then the driver can detect this particular blend / format combination and work things out itself. But if the state tracker can't find a PIPE_FORMAT_RGBX format for GL_RGB and uses a PIPE_FORMAT_RGBA format, it's really up to the state tracker to fix-up the blend mode in this case. The gallium interface has never specified a required set of surface formats. Maybe we need to establish a policy for that first. Or are you saying that state trackers should never attempt to fulfill BGRX formats with BGRA, and that every driver needs to workaround this internally? Not necessarily. I don't fill too strongly about this, but it wouldn't sound consistent. Nowadays have a pipe cap for every single little thing out there. I don't see a reason to treat render target formats differently. Otherwise something that can be easily done once in the state tracker now needs to be replicated in every driver. But you have a point about _NEW_BUFFERS. It could be avoided. We could introduce a new flag _NEW_BUFFERS_EMULATED, set when fbo's with emulated formats (e.g., backing BGRX with BGRA), so that drivers that support (or workaround) these things internally don't . On the other hand, _NEW_BUFFERS probably doesn't change that frequently, blend state probably changes much more often. A new CAP would work. There is an easier way to do it though, see the attached patch (assuming blend_force_dst_alpha_to_one is set correctly). I guess we could do yet another new cap. I'm probably not going to pursue this any further right now. I'm going off-line for a few days and have other things to finish up. In any case, this is an odd state combination that a real app would never hit. Why would one use GL_DST_ALPHA if the dest surface doesn't have an alpha channel?? I am tempted to change the piglit fbo-blend-formats test to skip the GL_DST_ALPHA blend test if the surface doesn't have alpha. As it is, we get failures for some formats when, in fact, all the other blend modes work fine. It's just this odd case that's spoiling the party and given a false impression of brokenness. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] i965: Batch emission refactoring
On Tue, Apr 28, 2015 at 03:07:35PM -0700, Kenneth Graunke wrote: > On Wednesday, April 22, 2015 11:47:20 PM Topi Pohjolainen wrote: > > Currently batch emission logic is bolted into using the current > > gl-state and currently bound user shader programs as input. This > > series refactors the api to allow caller to give individual bits of > > information needed explicitly instead of the emission logic > > deducing them from the current state. > > > > This is needed to support blorp style gl-state-agnostic launching > > of internal utility shaders - shaders used for 2D blitting and > > buffer clearing/resolving. > > > > I have a follow-up series ready that is actually leveraging this, > > this series is simple set of refactors. I didn't mean it to, but > > it actually fixes one pigit test on ILK due to the way formats > > are set for texture surfaces: arb_copy_image.arb_copy_image-formats. > > > > Patches 6-13 all address texture surface setup. They move all the > > decision making of values into the hardware agnostic dispatcher > > leaving the hw-specific part just to deal with formatting. > > > > Topi Pohjolainen (18): > > i965: Refactor rb surface setup to allow caller to store offsets > > i965: Expose and refactor brw_update_renderbuffer_surfaces() > > i965: Refactor and expose brw_upload_binding_table() > > i965: Remove dependency to tex object in default color setup > > i965: Refactor sampler state setup > > i965: Move texture buffer dispatch into single location > > i965/gen8: Use miptree format in the surface setup > > i965: Move tex miptree and format resolving into dispatcher > > i965: Move texture swizzle resolving into dispatcher > > i965: Pass integer format flag as parameter to surface setup > > i965: Refactor effective depth calculation > > i965: Pass texture target as parameter for surface setup > > i965: Pass slice details as parameters for surface setup > > I requested a small change on this patch. > > > i965/wm/gen6: Refactor program offset setup > > I NAK'd this one. > > The rest of this 18 patch series looks great to me and is: > Reviewed-by: Kenneth Graunke > > It looks like Curro landed different texture surface state refactoring > patches in the meantime, though...so the two of you will need to decide > how to sort that out :( It looks like I need to do more rebasing than this. There are now these two in master: e17dc00 i965/gen8: Factor out texture surface state set-up from gen8_update_text 6f26ffa i965/gen7: Factor out texture surface state set-up from gen7_update_text Curro, neither has any review tags, why is this? ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 9/9] mark GL_ARB_framebuffer_no_attachments as done for i965
On Wed, Apr 29, 2015 at 4:56 AM, wrote: > From: Kevin Rogovin > > Mark GL_ARB_framebuffer_no_attachments as done for i965. > > --- > docs/GL3.txt | 2 +- > docs/relnotes/10.6.0.html | 1 + > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/docs/GL3.txt b/docs/GL3.txt > index 172fd3c..cf3b5a2 100644 > --- a/docs/GL3.txt > +++ b/docs/GL3.txt > @@ -157,7 +157,7 @@ GL 4.3, GLSL 4.30: >GL_KHR_debug DONE (all drivers) >GL_ARB_explicit_uniform_location DONE (all drivers > that support GLSL) >GL_ARB_fragment_layer_viewport DONE (nv50, nvc0, > r600, llvmpipe) > - GL_ARB_framebuffer_no_attachmentsnot started > + GL_ARB_framebuffer_no_attachmentsDONE (i965) >GL_ARB_internalformat_query2 not started >GL_ARB_invalidate_subdataDONE (all drivers) >GL_ARB_multi_draw_indirect DONE (i965, nvc0, > r600, radeonsi, llvmpipe, softpipe) > diff --git a/docs/relnotes/10.6.0.html b/docs/relnotes/10.6.0.html > index 48f76f9..3919d19 100644 > --- a/docs/relnotes/10.6.0.html > +++ b/docs/relnotes/10.6.0.html > @@ -55,6 +55,7 @@ Note: some of the new features are only available with > certain drivers. > GL_ARB_clip_control on i965 > GL_ARB_program_interface_query (all drivers) > GL_ARB_texture_stencil8 on nv50, nvc0, r600, radeonsi, softpipe > +GL_ARB_framebuffer_no_attachments on i965 When you rebase this, I'd appreciate it if you could insert it into the list in alphabetical order. (You based this on a commit where a bunch of the later additions were already not inserted alphabetically, but I've recently fixed that up.) Thanks, -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4] clover: remove util/compat
I've pushed this patch, thanks! -Tom On Wed, Apr 29, 2015 at 08:22:02AM +0200, EdB wrote: > > --- > src/gallium/state_trackers/clover/Makefile.sources | 1 - > src/gallium/state_trackers/clover/api/program.cpp | 14 +- > .../state_trackers/clover/core/compiler.hpp| 4 +- > src/gallium/state_trackers/clover/core/error.hpp | 2 - > src/gallium/state_trackers/clover/core/kernel.cpp | 2 +- > src/gallium/state_trackers/clover/core/module.cpp | 39 +-- > src/gallium/state_trackers/clover/core/module.hpp | 19 +- > src/gallium/state_trackers/clover/core/program.cpp | 2 +- > src/gallium/state_trackers/clover/core/program.hpp | 2 +- > .../state_trackers/clover/llvm/invocation.cpp | 20 +- > .../state_trackers/clover/tgsi/compiler.cpp| 5 +- > src/gallium/state_trackers/clover/util/compat.hpp | 313 > - > 12 files changed, 56 insertions(+), 367 deletions(-) > delete mode 100644 src/gallium/state_trackers/clover/util/compat.hpp > > diff --git a/src/gallium/state_trackers/clover/Makefile.sources > b/src/gallium/state_trackers/clover/Makefile.sources > index 03eb754..fa96774 100644 > --- a/src/gallium/state_trackers/clover/Makefile.sources > +++ b/src/gallium/state_trackers/clover/Makefile.sources > @@ -45,7 +45,6 @@ CPP_SOURCES := \ > util/adaptor.hpp \ > util/algebra.hpp \ > util/algorithm.hpp \ > - util/compat.hpp \ > util/factor.hpp \ > util/functional.hpp \ > util/lazy.hpp \ > diff --git a/src/gallium/state_trackers/clover/api/program.cpp > b/src/gallium/state_trackers/clover/api/program.cpp > index 913d195..e9b1f38 100644 > --- a/src/gallium/state_trackers/clover/api/program.cpp > +++ b/src/gallium/state_trackers/clover/api/program.cpp > @@ -23,6 +23,8 @@ > #include "api/util.hpp" > #include "core/program.hpp" > > +#include > + > using namespace clover; > > namespace { > @@ -94,12 +96,12 @@ clCreateProgramWithBinary(cl_context d_ctx, > cl_uint n, > return { CL_INVALID_VALUE, {} }; > > try { > -compat::istream::buffer_t bin(p, l); > -compat::istream s(bin); > +std::stringbuf bin( { (char*)p, l } ); > +std::istream s(&bin); > > return { CL_SUCCESS, module::deserialize(s) }; > > - } catch (compat::istream::error &e) { > + } catch (std::istream::failure &e) { > return { CL_INVALID_BINARY, {} }; > } >}, > @@ -279,10 +281,10 @@ clGetProgramInfo(cl_program d_prog, > cl_program_info param, > > case CL_PROGRAM_BINARIES: >buf.as_matrix() = map([&](const device &dev) { > -compat::ostream::buffer_t bin; > -compat::ostream s(bin); > +std::stringbuf bin; > +std::ostream s(&bin); > prog.binary(dev).serialize(s); > -return bin; > +return bin.str(); > }, > prog.devices()); >break; > diff --git a/src/gallium/state_trackers/clover/core/compiler.hpp > b/src/gallium/state_trackers/clover/core/compiler.hpp > index 62c0f47..c68aa39 100644 > --- a/src/gallium/state_trackers/clover/core/compiler.hpp > +++ b/src/gallium/state_trackers/clover/core/compiler.hpp > @@ -23,14 +23,12 @@ > #ifndef CLOVER_CORE_COMPILER_HPP > #define CLOVER_CORE_COMPILER_HPP > > -#include "util/compat.hpp" > #include "core/error.hpp" > #include "core/module.hpp" > #include "pipe/p_defines.h" > > namespace clover { > - typedef compat::vector - std::string> > header_map; > + typedef std::vector > > header_map; > > module compile_program_llvm(const std::string &source, > const header_map &headers, > diff --git a/src/gallium/state_trackers/clover/core/error.hpp > b/src/gallium/state_trackers/clover/core/error.hpp > index 805a0ec..eb65d62 100644 > --- a/src/gallium/state_trackers/clover/core/error.hpp > +++ b/src/gallium/state_trackers/clover/core/error.hpp > @@ -27,8 +27,6 @@ > > #include > > -#include "util/compat.hpp" > - > namespace clover { > class command_queue; > class context; > diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp > b/src/gallium/state_trackers/clover/core/kernel.cpp > index 442762c..0756f06 100644 > --- a/src/gallium/state_trackers/clover/core/kernel.cpp > +++ b/src/gallium/state_trackers/clover/core/kernel.cpp > @@ -192,7 +192,7 @@ > kernel::exec_context::bind(intrusive_ptr _q, >if (st) > _q->pipe->delete_compute_state(_q->pipe, st); > > - cs.prog = msec.data.begin(); > + cs.prog = &(msec.data[0]); >cs.req_local_mem = mem_local; >cs.req_input_mem = input.size(); >st = q->pipe->create_compute_state(q->pipe, &cs); > diff --git a/src/gallium/state_trackers/clover/core/module.cpp > b/src/gallium/state_trackers/clover/core/module.cpp > index f098b05..a6c5b98 100644 > --- a/src/gallium/state_trackers/clover/core/m
Re: [Mesa-dev] [PATCH 1/2] st/mesa: adjust blending modes if we don't have destination alpha
On 29/04/15 15:56, Brian Paul wrote: On 04/29/2015 05:52 AM, Marek Olšák wrote: On Wed, Apr 29, 2015 at 12:44 PM, Jose Fonseca wrote: I think there are two different things here: one is the driver internally fakes BGRX with BGRA, and obviously it's the pipe driver that needs to fix up alpha channel blending to simulate it's one. The other is the state tracker is faking BGRX with BGRA, and in that case, it's the state tracker that needs to do the fix up (as the pipe has no way to know if that's intentional or not). That's a fair point. On the other hand, I don't see why drivers can't support BGRX even if they can force A=1 for texturing only. Yeah, the key thing is whether the driver advertises support for alpha "X" formats. We've only been doing that for one case (PIPE_FORMAT_B8G8R8X8_UNORM) which directly corresponds to an SVGA3D_ format (SVGA3D_X8R8G8B8). If the state tracker can always find a PIPE_FORMAT_RGBX format for a GL_RGB format then the driver can detect this particular blend / format combination and work things out itself. But if the state tracker can't find a PIPE_FORMAT_RGBX format for GL_RGB and uses a PIPE_FORMAT_RGBA format, it's really up to the state tracker to fix-up the blend mode in this case. The gallium interface has never specified a required set of surface formats. Maybe we need to establish a policy for that first. Or are you saying that state trackers should never attempt to fulfill BGRX formats with BGRA, and that every driver needs to workaround this internally? Not necessarily. I don't fill too strongly about this, but it wouldn't sound consistent. Nowadays have a pipe cap for every single little thing out there. I don't see a reason to treat render target formats differently. Otherwise something that can be easily done once in the state tracker now needs to be replicated in every driver. But you have a point about _NEW_BUFFERS. It could be avoided. We could introduce a new flag _NEW_BUFFERS_EMULATED, set when fbo's with emulated formats (e.g., backing BGRX with BGRA), so that drivers that support (or workaround) these things internally don't . On the other hand, _NEW_BUFFERS probably doesn't change that frequently, blend state probably changes much more often. A new CAP would work. There is an easier way to do it though, see the attached patch (assuming blend_force_dst_alpha_to_one is set correctly). I guess we could do yet another new cap. I think that the is_format_support suffices. Like you said, if the driver doesn't support the RGBX format, the state tracker will emulate it with the RGBA. So no new cap necessary, unless some driver actually doesn't want this automatic conversion. Jose ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] i965: Batch emission refactoring
"Pohjolainen, Topi" writes: > On Tue, Apr 28, 2015 at 03:07:35PM -0700, Kenneth Graunke wrote: >> On Wednesday, April 22, 2015 11:47:20 PM Topi Pohjolainen wrote: >> > Currently batch emission logic is bolted into using the current >> > gl-state and currently bound user shader programs as input. This >> > series refactors the api to allow caller to give individual bits of >> > information needed explicitly instead of the emission logic >> > deducing them from the current state. >> > >> > This is needed to support blorp style gl-state-agnostic launching >> > of internal utility shaders - shaders used for 2D blitting and >> > buffer clearing/resolving. >> > >> > I have a follow-up series ready that is actually leveraging this, >> > this series is simple set of refactors. I didn't mean it to, but >> > it actually fixes one pigit test on ILK due to the way formats >> > are set for texture surfaces: arb_copy_image.arb_copy_image-formats. >> > >> > Patches 6-13 all address texture surface setup. They move all the >> > decision making of values into the hardware agnostic dispatcher >> > leaving the hw-specific part just to deal with formatting. >> > >> > Topi Pohjolainen (18): >> > i965: Refactor rb surface setup to allow caller to store offsets >> > i965: Expose and refactor brw_update_renderbuffer_surfaces() >> > i965: Refactor and expose brw_upload_binding_table() >> > i965: Remove dependency to tex object in default color setup >> > i965: Refactor sampler state setup >> > i965: Move texture buffer dispatch into single location >> > i965/gen8: Use miptree format in the surface setup >> > i965: Move tex miptree and format resolving into dispatcher >> > i965: Move texture swizzle resolving into dispatcher >> > i965: Pass integer format flag as parameter to surface setup >> > i965: Refactor effective depth calculation >> > i965: Pass texture target as parameter for surface setup >> > i965: Pass slice details as parameters for surface setup >> >> I requested a small change on this patch. >> >> > i965/wm/gen6: Refactor program offset setup >> >> I NAK'd this one. >> >> The rest of this 18 patch series looks great to me and is: >> Reviewed-by: Kenneth Graunke >> >> It looks like Curro landed different texture surface state refactoring >> patches in the meantime, though...so the two of you will need to decide >> how to sort that out :( > > It looks like I need to do more rebasing than this. There are now these > two in master: > > e17dc00 i965/gen8: Factor out texture surface state set-up from > gen8_update_text > 6f26ffa i965/gen7: Factor out texture surface state set-up from > gen7_update_text > > Curro, neither has any review tags, why is this? Ahh, sorry for the collision. I also landed "i965: Add helper functions to calculate the slice pitch of an array or 3D miptree." without apparent review at the same time. I proposed both the texture and miptree refactor so long ago (in December 2013 IIRC) that I had kind of lost hope of it getting reviewed anytime soon, and they were a real mess to rebase (I actually introduced regressions accidentally during my regular rebases due to the constant changes in those code paths). I warned several days before I pushed them and nobody seemed to care. In fact I got some R-b tags from Paul Berry at some point, but by the time I decided to push the patches things had changed so much that it didn't seem fair anymore to include his tags... Which of your patches do they conflict with? If they happened to change the API in a different direction that you were meaning to, maybe we can have a chat about it tomorrow? signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] i965: Batch emission refactoring
On Wed, Apr 29, 2015 at 06:54:34PM +0300, Francisco Jerez wrote: > "Pohjolainen, Topi" writes: > > > On Tue, Apr 28, 2015 at 03:07:35PM -0700, Kenneth Graunke wrote: > >> On Wednesday, April 22, 2015 11:47:20 PM Topi Pohjolainen wrote: > >> > Currently batch emission logic is bolted into using the current > >> > gl-state and currently bound user shader programs as input. This > >> > series refactors the api to allow caller to give individual bits of > >> > information needed explicitly instead of the emission logic > >> > deducing them from the current state. > >> > > >> > This is needed to support blorp style gl-state-agnostic launching > >> > of internal utility shaders - shaders used for 2D blitting and > >> > buffer clearing/resolving. > >> > > >> > I have a follow-up series ready that is actually leveraging this, > >> > this series is simple set of refactors. I didn't mean it to, but > >> > it actually fixes one pigit test on ILK due to the way formats > >> > are set for texture surfaces: arb_copy_image.arb_copy_image-formats. > >> > > >> > Patches 6-13 all address texture surface setup. They move all the > >> > decision making of values into the hardware agnostic dispatcher > >> > leaving the hw-specific part just to deal with formatting. > >> > > >> > Topi Pohjolainen (18): > >> > i965: Refactor rb surface setup to allow caller to store offsets > >> > i965: Expose and refactor brw_update_renderbuffer_surfaces() > >> > i965: Refactor and expose brw_upload_binding_table() > >> > i965: Remove dependency to tex object in default color setup > >> > i965: Refactor sampler state setup > >> > i965: Move texture buffer dispatch into single location > >> > i965/gen8: Use miptree format in the surface setup > >> > i965: Move tex miptree and format resolving into dispatcher > >> > i965: Move texture swizzle resolving into dispatcher > >> > i965: Pass integer format flag as parameter to surface setup > >> > i965: Refactor effective depth calculation > >> > i965: Pass texture target as parameter for surface setup > >> > i965: Pass slice details as parameters for surface setup > >> > >> I requested a small change on this patch. > >> > >> > i965/wm/gen6: Refactor program offset setup > >> > >> I NAK'd this one. > >> > >> The rest of this 18 patch series looks great to me and is: > >> Reviewed-by: Kenneth Graunke > >> > >> It looks like Curro landed different texture surface state refactoring > >> patches in the meantime, though...so the two of you will need to decide > >> how to sort that out :( > > > > It looks like I need to do more rebasing than this. There are now these > > two in master: > > > > e17dc00 i965/gen8: Factor out texture surface state set-up from > > gen8_update_text > > 6f26ffa i965/gen7: Factor out texture surface state set-up from > > gen7_update_text > > > > Curro, neither has any review tags, why is this? > > Ahh, sorry for the collision. I also landed "i965: Add helper functions > to calculate the slice pitch of an array or 3D miptree." without > apparent review at the same time. I proposed both the texture and > miptree refactor so long ago (in December 2013 IIRC) that I had kind of > lost hope of it getting reviewed anytime soon, and they were a real mess > to rebase (I actually introduced regressions accidentally during my > regular rebases due to the constant changes in those code paths). I > warned several days before I pushed them and nobody seemed to care. > > In fact I got some R-b tags from Paul Berry at some point, but by the > time I decided to push the patches things had changed so much that it > didn't seem fair anymore to include his tags... > > Which of your patches do they conflict with? If they happened to change > the API in a different direction that you were meaning to, maybe we can > have a chat about it tomorrow? Well, your changes would have been easy to put on top of mine. But I have seven patch incremental refactoring of which none apply anymore. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] i965: Batch emission refactoring
"Pohjolainen, Topi" writes: > On Wed, Apr 29, 2015 at 06:54:34PM +0300, Francisco Jerez wrote: >> "Pohjolainen, Topi" writes: >> >> > On Tue, Apr 28, 2015 at 03:07:35PM -0700, Kenneth Graunke wrote: >> >> On Wednesday, April 22, 2015 11:47:20 PM Topi Pohjolainen wrote: >> >> > Currently batch emission logic is bolted into using the current >> >> > gl-state and currently bound user shader programs as input. This >> >> > series refactors the api to allow caller to give individual bits of >> >> > information needed explicitly instead of the emission logic >> >> > deducing them from the current state. >> >> > >> >> > This is needed to support blorp style gl-state-agnostic launching >> >> > of internal utility shaders - shaders used for 2D blitting and >> >> > buffer clearing/resolving. >> >> > >> >> > I have a follow-up series ready that is actually leveraging this, >> >> > this series is simple set of refactors. I didn't mean it to, but >> >> > it actually fixes one pigit test on ILK due to the way formats >> >> > are set for texture surfaces: arb_copy_image.arb_copy_image-formats. >> >> > >> >> > Patches 6-13 all address texture surface setup. They move all the >> >> > decision making of values into the hardware agnostic dispatcher >> >> > leaving the hw-specific part just to deal with formatting. >> >> > >> >> > Topi Pohjolainen (18): >> >> > i965: Refactor rb surface setup to allow caller to store offsets >> >> > i965: Expose and refactor brw_update_renderbuffer_surfaces() >> >> > i965: Refactor and expose brw_upload_binding_table() >> >> > i965: Remove dependency to tex object in default color setup >> >> > i965: Refactor sampler state setup >> >> > i965: Move texture buffer dispatch into single location >> >> > i965/gen8: Use miptree format in the surface setup >> >> > i965: Move tex miptree and format resolving into dispatcher >> >> > i965: Move texture swizzle resolving into dispatcher >> >> > i965: Pass integer format flag as parameter to surface setup >> >> > i965: Refactor effective depth calculation >> >> > i965: Pass texture target as parameter for surface setup >> >> > i965: Pass slice details as parameters for surface setup >> >> >> >> I requested a small change on this patch. >> >> >> >> > i965/wm/gen6: Refactor program offset setup >> >> >> >> I NAK'd this one. >> >> >> >> The rest of this 18 patch series looks great to me and is: >> >> Reviewed-by: Kenneth Graunke >> >> >> >> It looks like Curro landed different texture surface state refactoring >> >> patches in the meantime, though...so the two of you will need to decide >> >> how to sort that out :( >> > >> > It looks like I need to do more rebasing than this. There are now these >> > two in master: >> > >> > e17dc00 i965/gen8: Factor out texture surface state set-up from >> > gen8_update_text >> > 6f26ffa i965/gen7: Factor out texture surface state set-up from >> > gen7_update_text >> > >> > Curro, neither has any review tags, why is this? >> >> Ahh, sorry for the collision. I also landed "i965: Add helper functions >> to calculate the slice pitch of an array or 3D miptree." without >> apparent review at the same time. I proposed both the texture and >> miptree refactor so long ago (in December 2013 IIRC) that I had kind of >> lost hope of it getting reviewed anytime soon, and they were a real mess >> to rebase (I actually introduced regressions accidentally during my >> regular rebases due to the constant changes in those code paths). I >> warned several days before I pushed them and nobody seemed to care. >> >> In fact I got some R-b tags from Paul Berry at some point, but by the >> time I decided to push the patches things had changed so much that it >> didn't seem fair anymore to include his tags... >> >> Which of your patches do they conflict with? If they happened to change >> the API in a different direction that you were meaning to, maybe we can >> have a chat about it tomorrow? > > Well, your changes would have been easy to put on top of mine. But I have > seven patch incremental refactoring of which none apply anymore. Sorry, if you need to make non-trivial changes requiring additional review don't hesitate to ping me. signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 03/18] winsys/amdgpu: add a new winsys for the new kernel driver
On 28/04/15 14:28, Marek Olšák wrote: > Hi Emil, > > I think I have fixed everything that you suggested. You can review the > branch here: > > http://cgit.freedesktop.org/~mareko/mesa/log/?h=amdgpu > Looks great. You've even added the new symbol (which I forgot to mention) so that vdpau-gl interop works. Thanks again for going with my suggestions :-) Cheers, Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 90213] glDrawPixels with GL_COLOR_INDEX never returns.
https://bugs.freedesktop.org/show_bug.cgi?id=90213 --- Comment #1 from Mark Janes --- This test asserted from the time it was written. The test failure does not necessarily indicate a regression. The test was introduced in piglit 2e7be059b1dc71eef0c09964ea393678618d898b, and references the "format overhaul". Also, Message-ID: <5525834f.4020...@vmware.com> on the piglit list seems to point at waffle, at least for nv. JP's application seems to rule that out, though. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 17/18] i965/ps/gen8: Refactor state uploading
On Thu, Apr 23, 2015 at 09:58:22PM +0300, Pohjolainen, Topi wrote: > On Thu, Apr 23, 2015 at 11:53:49AM -0700, Matt Turner wrote: > > On Wed, Apr 22, 2015 at 1:47 PM, Topi Pohjolainen > > wrote: > > > Signed-off-by: Topi Pohjolainen > > > --- > > > src/mesa/drivers/dri/i965/brw_state.h | 12 + > > > src/mesa/drivers/dri/i965/gen8_ps_state.c | 74 > > > --- > > > 2 files changed, 59 insertions(+), 27 deletions(-) > > > > > > diff --git a/src/mesa/drivers/dri/i965/brw_state.h > > > b/src/mesa/drivers/dri/i965/brw_state.h > > > index 178f039..0c4f65e 100644 > > > --- a/src/mesa/drivers/dri/i965/brw_state.h > > > +++ b/src/mesa/drivers/dri/i965/brw_state.h > > > @@ -265,6 +265,18 @@ void gen7_set_surface_mcs_info(struct brw_context > > > *brw, > > > void gen7_check_surface_setup(uint32_t *surf, bool is_render_target); > > > void gen7_init_vtable_surface_functions(struct brw_context *brw); > > > > > > +/* gen8_ps_state.c */ > > > +void gen8_upload_ps_state(struct brw_context *brw, > > > + const struct gl_fragment_program *fp, > > > + const struct brw_stage_state *stage_state, > > > + const struct brw_wm_prog_data *prog_data, > > > + uint32_t fast_clear_op); > > > + > > > +void gen8_upload_ps_extra(struct brw_context *brw, > > > + const struct gl_fragment_program *fp, > > > + const struct brw_wm_prog_data *prog_data, > > > + bool multisampled_fbo); > > > + > > > /* gen7_sol_state.c */ > > > void gen7_upload_3dstate_so_decl_list(struct brw_context *brw, > > >const struct brw_vue_map *vue_map); > > > diff --git a/src/mesa/drivers/dri/i965/gen8_ps_state.c > > > b/src/mesa/drivers/dri/i965/gen8_ps_state.c > > > index 5f39e12..da6136b 100644 > > > --- a/src/mesa/drivers/dri/i965/gen8_ps_state.c > > > +++ b/src/mesa/drivers/dri/i965/gen8_ps_state.c > > > @@ -27,15 +27,13 @@ > > > #include "brw_defines.h" > > > #include "intel_batchbuffer.h" > > > > > > -static void > > > -upload_ps_extra(struct brw_context *brw) > > > +void > > > +gen8_upload_ps_extra(struct brw_context *brw, > > > + const struct gl_fragment_program *fp, > > > + const struct brw_wm_prog_data *prog_data, > > > + bool multisampled_fbo) > > > { > > > struct gl_context *ctx = &brw->ctx; > > > - /* BRW_NEW_FRAGMENT_PROGRAM */ > > > - const struct brw_fragment_program *fp = > > > - brw_fragment_program_const(brw->fragment_program); > > > - /* BRW_NEW_FS_PROG_DATA */ > > > - const struct brw_wm_prog_data *prog_data = brw->wm.prog_data; > > > uint32_t dw1 = 0; > > > > > > dw1 |= GEN8_PSX_PIXEL_SHADER_VALID; > > > @@ -47,16 +45,14 @@ upload_ps_extra(struct brw_context *brw) > > > if (prog_data->num_varying_inputs != 0) > > >dw1 |= GEN8_PSX_ATTRIBUTE_ENABLE; > > > > > > - if (fp->program.Base.InputsRead & VARYING_BIT_POS) > > > + if (fp->Base.InputsRead & VARYING_BIT_POS) > > >dw1 |= GEN8_PSX_USES_SOURCE_DEPTH | GEN8_PSX_USES_SOURCE_W; > > > > > > - /* BRW_NEW_NUM_SAMPLES | _NEW_MULTISAMPLE */ > > > - bool multisampled_fbo = brw->num_samples > 1; > > > if (multisampled_fbo && > > > - _mesa_get_min_invocations_per_fragment(ctx, &fp->program, false) > > > > 1) > > > + _mesa_get_min_invocations_per_fragment(ctx, fp, false) > 1) > > >dw1 |= GEN8_PSX_SHADER_IS_PER_SAMPLE; > > > > > > - if (fp->program.Base.SystemValuesRead & SYSTEM_BIT_SAMPLE_MASK_IN) > > > + if (fp->Base.SystemValuesRead & SYSTEM_BIT_SAMPLE_MASK_IN) > > >dw1 |= GEN8_PSX_SHADER_USES_INPUT_COVERAGE_MASK; > > > > > > if (prog_data->uses_omask) > > > @@ -68,6 +64,20 @@ upload_ps_extra(struct brw_context *brw) > > > ADVANCE_BATCH(); > > > } > > > > > > +static void > > > +upload_ps_extra(struct brw_context *brw) > > > +{ > > > + /* BRW_NEW_FRAGMENT_PROGRAM */ > > > + const struct brw_fragment_program *fp = > > > + brw_fragment_program_const(brw->fragment_program); > > > + /* BRW_NEW_FS_PROG_DATA */ > > > + const struct brw_wm_prog_data *prog_data = brw->wm.prog_data; > > > + /* BRW_NEW_NUM_SAMPLES | _NEW_MULTISAMPLE */ > > > + const bool multisampled_fbo = brw->num_samples > 1; > > > + > > > + gen8_upload_ps_extra(brw, &fp->program, prog_data, multisampled_fbo); > > > +} > > > + > > > const struct brw_tracked_state gen8_ps_extra = { > > > .dirty = { > > >.mesa = _NEW_MULTISAMPLE, > > > @@ -118,23 +128,24 @@ const struct brw_tracked_state gen8_wm_state = { > > > .emit = upload_wm_state, > > > }; > > > > > > -static void > > > -upload_ps_state(struct brw_context *brw) > > > +void > > > +gen8_upload_ps_state(struct brw_context *brw, > > > + const struct gl_fragment_program *fp, > > > + const struct brw_stage_state
[Mesa-dev] [Bug 90207] [r600g, bisected] regression: NI/Turks crash on WebGL Water (most WebGL stuff)
https://bugs.freedesktop.org/show_bug.cgi?id=90207 --- Comment #18 from Mark Janes --- The fix for this bug triggered a piglit failure: spec.!opengl 3_2.get-active-attrib-returns-all-inputs /tmp/build_root/m32/lib/piglit/bin/gl-get-active-attrib-returns-all-inputs -auto -fbo piglit_vertex was not counted as active. Should I write up a separate bug for this? -- You are receiving this mail because: You are the QA Contact for the bug. You are on the CC list for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 90207] [r600g, bisected] regression: NI/Turks crash on WebGL Water (most WebGL stuff)
https://bugs.freedesktop.org/show_bug.cgi?id=90207 --- Comment #19 from Tapani Pälli --- (In reply to Mark Janes from comment #18) > The fix for this bug triggered a piglit failure: > > spec.!opengl 3_2.get-active-attrib-returns-all-inputs > > /tmp/build_root/m32/lib/piglit/bin/gl-get-active-attrib-returns-all-inputs > -auto -fbo > piglit_vertex was not counted as active. > > Should I write up a separate bug for this? Yes please, assign to me. I think I know what's up here, it's probably the builtin attribs that are not referenced by the vertex stage. -- You are receiving this mail because: You are the QA Contact for the bug. You are on the CC list for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 17/18] i965/ps/gen8: Refactor state uploading
On Wednesday, April 29, 2015 07:47:26 PM Pohjolainen, Topi wrote: > On Thu, Apr 23, 2015 at 09:58:22PM +0300, Pohjolainen, Topi wrote: > > On Thu, Apr 23, 2015 at 11:53:49AM -0700, Matt Turner wrote: > > > On Wed, Apr 22, 2015 at 1:47 PM, Topi Pohjolainen > > > wrote: > > > > Signed-off-by: Topi Pohjolainen > > > > --- > > > > src/mesa/drivers/dri/i965/brw_state.h | 12 + > > > > src/mesa/drivers/dri/i965/gen8_ps_state.c | 74 > > > > --- > > > > 2 files changed, 59 insertions(+), 27 deletions(-) > > > > > > > > diff --git a/src/mesa/drivers/dri/i965/brw_state.h > > > > b/src/mesa/drivers/dri/i965/brw_state.h > > > > index 178f039..0c4f65e 100644 > > > > --- a/src/mesa/drivers/dri/i965/brw_state.h > > > > +++ b/src/mesa/drivers/dri/i965/brw_state.h > > > > @@ -265,6 +265,18 @@ void gen7_set_surface_mcs_info(struct brw_context > > > > *brw, > > > > void gen7_check_surface_setup(uint32_t *surf, bool is_render_target); > > > > void gen7_init_vtable_surface_functions(struct brw_context *brw); > > > > > > > > +/* gen8_ps_state.c */ > > > > +void gen8_upload_ps_state(struct brw_context *brw, > > > > + const struct gl_fragment_program *fp, > > > > + const struct brw_stage_state *stage_state, > > > > + const struct brw_wm_prog_data *prog_data, > > > > + uint32_t fast_clear_op); > > > > + > > > > +void gen8_upload_ps_extra(struct brw_context *brw, > > > > + const struct gl_fragment_program *fp, > > > > + const struct brw_wm_prog_data *prog_data, > > > > + bool multisampled_fbo); > > > > + > > > > /* gen7_sol_state.c */ > > > > void gen7_upload_3dstate_so_decl_list(struct brw_context *brw, > > > >const struct brw_vue_map > > > > *vue_map); > > > > diff --git a/src/mesa/drivers/dri/i965/gen8_ps_state.c > > > > b/src/mesa/drivers/dri/i965/gen8_ps_state.c > > > > index 5f39e12..da6136b 100644 > > > > --- a/src/mesa/drivers/dri/i965/gen8_ps_state.c > > > > +++ b/src/mesa/drivers/dri/i965/gen8_ps_state.c > > > > @@ -27,15 +27,13 @@ > > > > #include "brw_defines.h" > > > > #include "intel_batchbuffer.h" > > > > > > > > -static void > > > > -upload_ps_extra(struct brw_context *brw) > > > > +void > > > > +gen8_upload_ps_extra(struct brw_context *brw, > > > > + const struct gl_fragment_program *fp, > > > > + const struct brw_wm_prog_data *prog_data, > > > > + bool multisampled_fbo) > > > > { > > > > struct gl_context *ctx = &brw->ctx; > > > > - /* BRW_NEW_FRAGMENT_PROGRAM */ > > > > - const struct brw_fragment_program *fp = > > > > - brw_fragment_program_const(brw->fragment_program); > > > > - /* BRW_NEW_FS_PROG_DATA */ > > > > - const struct brw_wm_prog_data *prog_data = brw->wm.prog_data; > > > > uint32_t dw1 = 0; > > > > > > > > dw1 |= GEN8_PSX_PIXEL_SHADER_VALID; > > > > @@ -47,16 +45,14 @@ upload_ps_extra(struct brw_context *brw) > > > > if (prog_data->num_varying_inputs != 0) > > > >dw1 |= GEN8_PSX_ATTRIBUTE_ENABLE; > > > > > > > > - if (fp->program.Base.InputsRead & VARYING_BIT_POS) > > > > + if (fp->Base.InputsRead & VARYING_BIT_POS) > > > >dw1 |= GEN8_PSX_USES_SOURCE_DEPTH | GEN8_PSX_USES_SOURCE_W; > > > > > > > > - /* BRW_NEW_NUM_SAMPLES | _NEW_MULTISAMPLE */ > > > > - bool multisampled_fbo = brw->num_samples > 1; > > > > if (multisampled_fbo && > > > > - _mesa_get_min_invocations_per_fragment(ctx, &fp->program, > > > > false) > 1) > > > > + _mesa_get_min_invocations_per_fragment(ctx, fp, false) > 1) > > > >dw1 |= GEN8_PSX_SHADER_IS_PER_SAMPLE; > > > > > > > > - if (fp->program.Base.SystemValuesRead & SYSTEM_BIT_SAMPLE_MASK_IN) > > > > + if (fp->Base.SystemValuesRead & SYSTEM_BIT_SAMPLE_MASK_IN) > > > >dw1 |= GEN8_PSX_SHADER_USES_INPUT_COVERAGE_MASK; > > > > > > > > if (prog_data->uses_omask) > > > > @@ -68,6 +64,20 @@ upload_ps_extra(struct brw_context *brw) > > > > ADVANCE_BATCH(); > > > > } > > > > > > > > +static void > > > > +upload_ps_extra(struct brw_context *brw) > > > > +{ > > > > + /* BRW_NEW_FRAGMENT_PROGRAM */ > > > > + const struct brw_fragment_program *fp = > > > > + brw_fragment_program_const(brw->fragment_program); > > > > + /* BRW_NEW_FS_PROG_DATA */ > > > > + const struct brw_wm_prog_data *prog_data = brw->wm.prog_data; > > > > + /* BRW_NEW_NUM_SAMPLES | _NEW_MULTISAMPLE */ > > > > + const bool multisampled_fbo = brw->num_samples > 1; > > > > + > > > > + gen8_upload_ps_extra(brw, &fp->program, prog_data, > > > > multisampled_fbo); > > > > +} > > > > + > > > > const struct brw_tracked_state gen8_ps_extra = { > > > > .dirty = { > > > >.mesa = _NEW_MULTISAMPLE, > > > > @@ -118,23 +128,24 @@ const struct brw_tracked_state gen8_wm_state = { > > > >
[Mesa-dev] [Bug 90207] [r600g, bisected] regression: NI/Turks crash on WebGL Water (most WebGL stuff)
https://bugs.freedesktop.org/show_bug.cgi?id=90207 Mark Janes changed: What|Removed |Added CC||lem...@gmail.com -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/6] Gallium support for create_context_robustness extensions
Hi, These patches add Gallium support for: - GLX_ARB_create_context_robustness - EGL_EXT_create_context_robustness - glGetGraphicsResetStatusARB() Only r600 and radeonsi support is done, which depends on the kernel patch I sent just a moment ago. Please review. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/6] gallium: add PIPE_CAP_DEVICE_RESET_STATUS_QUERY
From: Marek Olšák --- src/gallium/docs/source/screen.rst | 2 ++ src/gallium/drivers/freedreno/freedreno_screen.c | 1 + src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/ilo/ilo_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 | 1 + src/gallium/drivers/r300/r300_screen.c | 1 + src/gallium/drivers/softpipe/sp_screen.c | 1 + src/gallium/drivers/svga/svga_screen.c | 1 + src/gallium/drivers/vc4/vc4_screen.c | 1 + src/gallium/include/pipe/p_defines.h | 1 + 13 files changed, 14 insertions(+) diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 4386bcf..4c5fa48 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -252,6 +252,8 @@ The integer capabilities: existing user memory into the device address space for direct device access. The create function is pipe_screen::resource_from_user_memory. The address and size must be page-aligned. +* ``PIPE_CAP_DEVICE_RESET_STATUS_QUERY``: + Whether pipe_context::get_device_reset_status is implemented. .. _pipe_capf: diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 556c8ab..f81ec80 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -220,6 +220,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_POLYGON_OFFSET_CLAMP: case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: + case PIPE_CAP_DEVICE_RESET_STATUS_QUERY: return 0; case PIPE_CAP_MAX_VIEWPORTS: diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 7216160..03fecd1 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -241,6 +241,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_POLYGON_OFFSET_CLAMP: case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: + case PIPE_CAP_DEVICE_RESET_STATUS_QUERY: return 0; case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index 80ea4c7..93bddd5 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -473,6 +473,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_SAMPLER_VIEW_TARGET: case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: + case PIPE_CAP_DEVICE_RESET_STATUS_QUERY: return 0; case PIPE_CAP_VENDOR_ID: diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index f4ba596..509b9bc 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -290,6 +290,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) return 1; case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: + case PIPE_CAP_DEVICE_RESET_STATUS_QUERY: return 0; } /* should only get here on unhandled cases */ diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index eeb7148..025cad2 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -161,6 +161,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_POLYGON_OFFSET_CLAMP: case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: + case PIPE_CAP_DEVICE_RESET_STATUS_QUERY: return 0; case PIPE_CAP_VENDOR_ID: diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index 829dfbc..f455a7f 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -209,6 +209,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_VERTEXID_NOBASE: case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: /* potentially supported on some hw */ case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: + case PIPE_CAP_DEVICE_RESET_STATUS_QUERY: return 0; case PIPE_CAP_VENDOR_ID: diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index 7a9f649..df1bde6 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -193,6 +193,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum
[Mesa-dev] [PATCH 5/6] st/mesa: translate st_api robustness flags to gl_context flags
From: Marek Olšák --- src/mesa/state_tracker/st_manager.c | 4 1 file changed, 4 insertions(+) diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 840f76a..0376954 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -680,6 +680,10 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, if (attribs->flags & ST_CONTEXT_FLAG_FORWARD_COMPATIBLE) st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT; + if (attribs->flags & ST_CONTEXT_FLAG_ROBUST_ACCESS) + st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB; + if (attribs->flags & ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED) + st->ctx->Const.ResetStrategy = GL_LOSE_CONTEXT_ON_RESET_ARB; /* need to perform version check */ if (attribs->major > 1 || attribs->minor > 0) { -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/6] st/mesa: implement GetGraphicsResetStatus
From: Marek Olšák --- src/mesa/state_tracker/st_cb_flush.c | 35 ++- src/mesa/state_tracker/st_cb_flush.h | 3 ++- src/mesa/state_tracker/st_context.c | 7 --- src/mesa/state_tracker/st_context.h | 3 ++- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index ca51eee..82affd2 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -141,11 +141,44 @@ static void st_glFinish(struct gl_context *ctx) } -void st_init_flush_functions(struct dd_function_table *functions) +/** + * Query information about GPU resets observed by this context + * + * Called via \c dd_function_table::GetGraphicsResetStatus. + */ +static GLenum +st_get_graphics_reset_status(struct gl_context *ctx) +{ + struct st_context *st = st_context(ctx); + enum pipe_reset_status status; + + status = st->pipe->get_device_reset_status(st->pipe); + + switch (status) { + case PIPE_NO_RESET: + return GL_NO_ERROR; + case PIPE_GUILTY_CONTEXT_RESET: + return GL_GUILTY_CONTEXT_RESET_ARB; + case PIPE_INNOCENT_CONTEXT_RESET: + return GL_INNOCENT_CONTEXT_RESET_ARB; + case PIPE_UNKNOWN_CONTEXT_RESET: + return GL_UNKNOWN_CONTEXT_RESET_ARB; + default: + assert(0); + return GL_NO_ERROR; + } +} + + +void st_init_flush_functions(struct pipe_screen *screen, + struct dd_function_table *functions) { functions->Flush = st_glFlush; functions->Finish = st_glFinish; + if (screen->get_param(screen, PIPE_CAP_DEVICE_RESET_STATUS_QUERY)) + functions->GetGraphicsResetStatus = st_get_graphics_reset_status; + /* Windows opengl32.dll calls glFinish prior to every swapbuffers. * This is unnecessary and degrades performance. Luckily we have some * scope to work around this, as the externally-visible behaviour of diff --git a/src/mesa/state_tracker/st_cb_flush.h b/src/mesa/state_tracker/st_cb_flush.h index 84ffc63..f92dcd5 100644 --- a/src/mesa/state_tracker/st_cb_flush.h +++ b/src/mesa/state_tracker/st_cb_flush.h @@ -37,7 +37,8 @@ struct pipe_fence_handle; struct st_context; extern void -st_init_flush_functions(struct dd_function_table *functions); +st_init_flush_functions(struct pipe_screen *screen, +struct dd_function_table *functions); extern void st_flush(struct st_context *st, diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 5fe132a..d272104 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -313,7 +313,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, struct st_context *st; memset(&funcs, 0, sizeof(funcs)); - st_init_driver_functions(&funcs); + st_init_driver_functions(pipe->screen, &funcs); ctx = _mesa_create_context(api, visual, shareCtx, &funcs); if (!ctx) { @@ -393,7 +393,8 @@ void st_destroy_context( struct st_context *st ) } -void st_init_driver_functions(struct dd_function_table *functions) +void st_init_driver_functions(struct pipe_screen *screen, + struct dd_function_table *functions) { _mesa_init_shader_object_functions(functions); _mesa_init_sampler_object_functions(functions); @@ -420,7 +421,7 @@ void st_init_driver_functions(struct dd_function_table *functions) st_init_readpixels_functions(functions); st_init_texture_functions(functions); st_init_texture_barrier_functions(functions); - st_init_flush_functions(functions); + st_init_flush_functions(screen, functions); st_init_string_functions(functions); st_init_viewport_functions(functions); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 8a9504b..dac5a4b 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -237,7 +237,8 @@ struct st_framebuffer }; -extern void st_init_driver_functions(struct dd_function_table *functions); +extern void st_init_driver_functions(struct pipe_screen *screen, + struct dd_function_table *functions); void st_invalidate_state(struct gl_context * ctx, GLuint new_state); -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 6/6] r600g, radeonsi: implement get_device_reset_status
From: Marek Olšák --- src/gallium/drivers/r600/r600_pipe.c | 3 +++ src/gallium/drivers/radeon/r600_pipe_common.c | 20 src/gallium/drivers/radeon/r600_pipe_common.h | 1 + src/gallium/drivers/radeonsi/si_pipe.c| 3 +++ src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 8 src/gallium/winsys/radeon/drm/radeon_winsys.h | 5 +++-- 6 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 21e5d42..4b19c7f 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -270,6 +270,9 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_POLYGON_OFFSET_CLAMP: return 1; + case PIPE_CAP_DEVICE_RESET_STATUS_QUERY: + return rscreen->b.info.drm_major == 2 && rscreen->b.info.drm_minor >= 43; + case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: return !R600_BIG_ENDIAN && rscreen->b.info.has_userptr; diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index eddb37d..7765c00 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -197,6 +197,19 @@ static void r600_flush_dma_ring(void *ctx, unsigned flags, rctx->rings.dma.flushing = false; } +static enum pipe_reset_status r600_get_reset_status(struct pipe_context *ctx) +{ + struct r600_common_context *rctx = (struct r600_common_context *)ctx; + unsigned latest = rctx->ws->query_value(rctx->ws, + RADEON_GPU_RESET_COUNTER); + + if (rctx->gpu_reset_counter == latest) + return PIPE_NO_RESET; + + rctx->gpu_reset_counter = latest; + return PIPE_UNKNOWN_CONTEXT_RESET; +} + bool r600_common_context_init(struct r600_common_context *rctx, struct r600_common_screen *rscreen) { @@ -223,6 +236,13 @@ bool r600_common_context_init(struct r600_common_context *rctx, rctx->b.memory_barrier = r600_memory_barrier; rctx->b.flush = r600_flush_from_st; + if (rscreen->info.drm_major == 2 && rscreen->info.drm_minor >= 43) { + rctx->b.get_device_reset_status = r600_get_reset_status; + rctx->gpu_reset_counter = + rctx->ws->query_value(rctx->ws, + RADEON_GPU_RESET_COUNTER); + } + LIST_INITHEAD(&rctx->texture_buffers); r600_init_context_texture_functions(rctx); diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index faa6e0d..009cd72 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -356,6 +356,7 @@ struct r600_common_context { enum chip_class chip_class; struct r600_rings rings; unsignedinitial_gfx_cs_size; + unsignedgpu_reset_counter; struct u_upload_mgr *uploader; struct u_suballocator *allocator_so_filled_size; diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index e68c30e..ac382e7 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -256,6 +256,9 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: return !SI_BIG_ENDIAN && sscreen->b.info.has_userptr; + case PIPE_CAP_DEVICE_RESET_STATUS_QUERY: + return sscreen->b.info.drm_major == 2 && sscreen->b.info.drm_minor >= 43; + case PIPE_CAP_TEXTURE_MULTISAMPLE: /* 2D tiling on CIK is supported since DRM 2.35.0 */ return sscreen->b.chip_class < CIK || diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index a6f847f..5222ff9 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -56,6 +56,10 @@ #define RADEON_INFO_READ_REG 0x24 #endif +#ifndef RADEON_INFO_GPU_RESET_COUNTER +#define RADEON_INFO_GPU_RESET_COUNTER 0x25 +#endif + static struct util_hash_table *fd_tab = NULL; pipe_static_mutex(fd_tab_mutex); @@ -578,6 +582,10 @@ static uint64_t radeon_query_value(struct radeon_winsys *rws, radeon_get_drm_value(ws->fd, RADEON_INFO_CURRENT_GPU_MCLK, "current-gpu-mclk", (uint32_t*)&retval); return retval; +case RADEON_GPU_RESET_COUNTER: +radeon_get_drm_value(ws->fd, RADEON_INFO_GPU_RESET_COUNTER, + "gpu-reset-counter", (uint32_t*)&retval); +
[Mesa-dev] [PATCH 4/6] st/dri: add support for create_context_robustness GLX and EGL extensions
From: Marek Olšák --- src/gallium/include/state_tracker/st_api.h | 1 + src/gallium/state_trackers/dri/dri2.c| 22 +- src/gallium/state_trackers/dri/dri_context.c | 27 +++ src/gallium/state_trackers/dri/dri_screen.h | 1 + 4 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h index 86fdc69..ecf1c07 100644 --- a/src/gallium/include/state_tracker/st_api.h +++ b/src/gallium/include/state_tracker/st_api.h @@ -89,6 +89,7 @@ enum st_api_feature #define ST_CONTEXT_FLAG_DEBUG (1 << 0) #define ST_CONTEXT_FLAG_FORWARD_COMPATIBLE (1 << 1) #define ST_CONTEXT_FLAG_ROBUST_ACCESS (1 << 2) +#define ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED (1 << 3) /** * Reasons that context creation might fail. diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index f8f4ecf..fba0df1 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -1251,6 +1251,10 @@ static __DRIimageExtension dri2ImageExtension = { .getCapabilities = dri2_get_capabilities, }; +static const __DRIrobustnessExtension dri2Robustness = { + .base = { __DRI2_ROBUSTNESS, 1 } +}; + /* * Backend function init_screen. */ @@ -1265,6 +1269,17 @@ static const __DRIextension *dri_screen_extensions[] = { NULL }; +static const __DRIextension *dri_robust_screen_extensions[] = { + &driTexBufferExtension.base, + &dri2FlushExtension.base, + &dri2ImageExtension.base, + &dri2RendererQueryExtension.base, + &dri2ConfigQueryExtension.base, + &dri2ThrottleExtension.base, + &dri2Robustness.base, + NULL +}; + /** * This is the driver specific part of the createNewScreen entry point. * @@ -1317,7 +1332,12 @@ dri2_init_screen(__DRIscreen * sPriv) } } - sPriv->extensions = dri_screen_extensions; + if (pscreen->get_param(pscreen, PIPE_CAP_DEVICE_RESET_STATUS_QUERY)) { + sPriv->extensions = dri_robust_screen_extensions; + screen->has_reset_status_query = true; + } + else + sPriv->extensions = dri_screen_extensions; /* dri_init_screen_helper checks pscreen for us */ diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c index 8ac81b7..9f11b15 100644 --- a/src/gallium/state_trackers/dri/dri_context.c +++ b/src/gallium/state_trackers/dri/dri_context.c @@ -56,6 +56,21 @@ dri_create_context(gl_api api, const struct gl_config * visual, struct st_context_iface *st_share = NULL; struct st_context_attribs attribs; enum st_context_error ctx_err = 0; + unsigned allowed_flags = __DRI_CTX_FLAG_DEBUG | +__DRI_CTX_FLAG_FORWARD_COMPATIBLE; + + if (screen->has_reset_status_query) + allowed_flags |= __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS; + + if (flags & ~allowed_flags) { + *error = __DRI_CTX_ERROR_UNKNOWN_FLAG; + goto fail; + } + + if (!screen->has_reset_status_query && notify_reset) { + *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE; + goto fail; + } memset(&attribs, 0, sizeof(attribs)); switch (api) { @@ -83,15 +98,11 @@ dri_create_context(gl_api api, const struct gl_config * visual, if ((flags & __DRI_CTX_FLAG_DEBUG) != 0) attribs.flags |= ST_CONTEXT_FLAG_DEBUG; - if (flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)) { - *error = __DRI_CTX_ERROR_UNKNOWN_FLAG; - goto fail; - } + if (flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS) + attribs.flags |= ST_CONTEXT_FLAG_ROBUST_ACCESS; - if (notify_reset) { - *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE; - goto fail; - } + if (notify_reset) + attribs.flags |= ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED; if (sharedContextPrivate) { st_share = ((struct dri_context *)sharedContextPrivate)->st; diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h index e4a1a39..f708649 100644 --- a/src/gallium/state_trackers/dri/dri_screen.h +++ b/src/gallium/state_trackers/dri/dri_screen.h @@ -80,6 +80,7 @@ struct dri_screen boolean d_depth_bits_last; boolean sd_depth_bits_last; boolean auto_fake_front; + boolean has_reset_status_query; enum pipe_texture_target target; /* hooks filled in by dri2 & drisw */ -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/6] gallium: add an interface for querying a device reset status
From: Marek Olšák --- src/gallium/include/pipe/p_context.h | 4 src/gallium/include/pipe/p_defines.h | 13 + 2 files changed, 17 insertions(+) diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index a4cae8e..314561f 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -562,6 +562,10 @@ struct pipe_context { void (*invalidate_resource)(struct pipe_context *ctx, struct pipe_resource *resource); + /** +* Return information about unexpected device resets. +*/ + enum pipe_reset_status (*get_device_reset_status)(struct pipe_context *ctx); }; diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 67f48e4..629475e 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -476,6 +476,19 @@ enum pipe_flush_flags #define PIPE_TIMEOUT_INFINITE 0xull + +/** + * Device reset status. + */ +enum pipe_reset_status +{ + PIPE_NO_RESET = 0, + PIPE_GUILTY_CONTEXT_RESET = 1, + PIPE_INNOCENT_CONTEXT_RESET = 2, + PIPE_UNKNOWN_CONTEXT_RESET = 3 +}; + + /** * Implementation capabilities/limits which are queried through * pipe_screen::get_param() -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/6] Gallium support for create_context_robustness extensions
On Wednesday, April 29, 2015 07:43:21 PM Marek Olšák wrote: > Hi, > > These patches add Gallium support for: > - GLX_ARB_create_context_robustness > - EGL_EXT_create_context_robustness > - glGetGraphicsResetStatusARB() > > Only r600 and radeonsi support is done, which depends on the kernel patch I > sent just a moment ago. > > Please review. > > Marek For what it's worth, the series is: Reviewed-by: Kenneth Graunke The kernel patch looks reasonable too. signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/18] i965: Refactor rb surface setup to allow caller to store offsets
On Wed, Apr 22, 2015 at 1:47 PM, Topi Pohjolainen wrote: > Notice that in gen7_wm_surface_state.c there is also indentation > change in the surrounding code removing tabs. > > Signed-off-by: Topi Pohjolainen > --- > src/mesa/drivers/dri/i965/brw_context.h | 8 +++ > src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 28 > --- > src/mesa/drivers/dri/i965/gen6_surface_state.c| 17 +++--- > src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 20 > src/mesa/drivers/dri/i965/gen8_surface_state.c| 18 +++ > 5 files changed, 46 insertions(+), 45 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_context.h > b/src/mesa/drivers/dri/i965/brw_context.h > index a6d6787..9f4eddd 100644 > --- a/src/mesa/drivers/dri/i965/brw_context.h > +++ b/src/mesa/drivers/dri/i965/brw_context.h > @@ -966,10 +966,10 @@ struct brw_context > unsigned unit, > uint32_t *surf_offset, > bool for_gather); > - void (*update_renderbuffer_surface)(struct brw_context *brw, > - struct gl_renderbuffer *rb, > - bool layered, > - unsigned unit); > + uint32_t (*update_renderbuffer_surface)(struct brw_context *brw, > + struct gl_renderbuffer *rb, > + bool layered, unsigned unit, > + uint32_t surf_index); > >void (*emit_buffer_surface_state)(struct brw_context *brw, > uint32_t *out_offset, > diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c > b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c > index 161d140..959d6c2 100644 > --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c > +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c > @@ -626,11 +626,11 @@ brw_emit_null_surface_state(struct brw_context *brw, > * While it is only used for the front/back buffer currently, it should be > * usable for further buffers when doing ARB_draw_buffer support. > */ > -static void > +static uint32_t > brw_update_renderbuffer_surface(struct brw_context *brw, > struct gl_renderbuffer *rb, > - bool layered, > - unsigned int unit) > + bool layered, unsigned unit, > +uint32_t surf_index) > { > struct gl_context *ctx = &brw->ctx; > struct intel_renderbuffer *irb = intel_renderbuffer(rb); > @@ -638,11 +638,10 @@ brw_update_renderbuffer_surface(struct brw_context *brw, > uint32_t *surf; > uint32_t tile_x, tile_y; > uint32_t format = 0; > + uint32_t offset; > /* _NEW_BUFFERS */ > mesa_format rb_format = _mesa_get_render_format(ctx, > intel_rb_format(irb)); > /* BRW_NEW_FS_PROG_DATA */ > - uint32_t surf_index = > - brw->wm.prog_data->binding_table.render_target_start + unit; > > assert(!layered); > > @@ -663,8 +662,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, > > intel_miptree_used_for_rendering(irb->mt); > > - surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, 6 * 4, 32, > - &brw->wm.base.surf_offset[surf_index]); > + surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, 6 * 4, 32, &offset); > > format = brw->render_target_format[rb_format]; > if (unlikely(!brw->format_supported_as_render_target[rb_format])) { > @@ -721,11 +719,13 @@ brw_update_renderbuffer_surface(struct brw_context *brw, > } > > drm_intel_bo_emit_reloc(brw->batch.bo, > - brw->wm.base.surf_offset[surf_index] + 4, > + offset + 4, >mt->bo, >surf[1] - mt->bo->offset64, >I915_GEM_DOMAIN_RENDER, >I915_GEM_DOMAIN_RENDER); > + > + return offset; > } > > /** > @@ -743,13 +743,15 @@ brw_update_renderbuffer_surfaces(struct brw_context > *brw) > /* Update surfaces for drawing buffers */ > if (ctx->DrawBuffer->_NumColorDrawBuffers >= 1) { >for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { > + const uint32_t surf_index = > +brw->wm.prog_data->binding_table.render_target_start + i; > + > if (intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[i])) { > - brw->vtbl.update_renderbuffer_surface(brw, > ctx->DrawBuffer->_ColorDrawBuffers[i], > - > ctx->DrawBuffer->MaxNumLayers > 0, i); > +brw->wm.base.surf_offset[surf_index] = > + brw->vtbl.update_renderbuffer_surface( > + brw, ctx->DrawBuffer->_ColorDra
Re: [Mesa-dev] [PATCH 9/9] mark GL_ARB_framebuffer_no_attachments as done for i965
> When you rebase this, I'd appreciate it if you could insert it into > the list in alphabetical order. (You based this on a commit where a > bunch of the later additions were already not inserted alphabetically, > but I've recently fixed that up.) Sure, no worries. Given that I am just changing the word "not started" to "DONE (i965)", it is a no-op really. However, I'd really appreciate any advice on the GL ES situation, basically if more say mark as done in ES I will, if less say I won't. I also would really like to hear opinions on GL ES interaction on Patch 3. -Kevin ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 9/9] mark GL_ARB_framebuffer_no_attachments as done for i965
On Wed, Apr 29, 2015 at 2:35 PM, Rogovin, Kevin wrote: >> When you rebase this, I'd appreciate it if you could insert it into >> the list in alphabetical order. (You based this on a commit where a >> bunch of the later additions were already not inserted alphabetically, >> but I've recently fixed that up.) > > Sure, no worries. Given that I am just changing the word “not started” to > “DONE (i965)”, it is a no-op really. That bit's fine -- I was responding to the relnotes addition. > However, I’d really appreciate any advice on the GL ES situation, basically > if more say mark as done in ES I will, if less say I won’t. > > I also would really like to hear opinions on GL ES interaction on Patch 3. Sorry, not my area... I just handle sorting of relnotes items ;) -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: Restore functionality to dispatch sanity test
From: Ian Romanick Along with a couple secondary goals, the dispatch sanity test had two major, primary goals. 1. Ensure that all functions part of an API version are set in the dispatch table. 2. Ensure that functions that cannot be part of an API version are not set in the dispatch table. Commit 4bdbb58 removed the tests ability to fulfill either of its primary goals by removing anything that used _mesa_generic_nop(). It seems like the problem on Windows could have been resolved by adding the NULL context pointer check from nop_handler to _mesa_generic_nop(). There is, however, some debugging benefit to actually getting the (supposed) function name logged in the "unsupported function called" message. The preceding commit added a function, _glapi_new_nop_table, that allocates a table of per-entry point no-op functions. Restore the ability to actually validate the sanity of the dispatch table by using _glapi_new_nop_table. Previous to this commit removing a function from one of the *_functions_possible lists would not cause the test to fail. With this commit removing such a function will result in failure, as is expected. Signed-off-by: Ian Romanick Cc: Brian Paul --- src/mesa/main/tests/dispatch_sanity.cpp | 49 + 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 946eabb..2a5afcd 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -82,6 +82,7 @@ public: struct dd_function_table driver_functions; struct gl_context share_list; struct gl_context ctx; + _glapi_proc *nop_table; }; void @@ -93,6 +94,9 @@ DispatchSanity_test::SetUp() memset(&ctx, 0, sizeof(ctx)); _mesa_init_driver_functions(&driver_functions); + + const unsigned size = _glapi_get_dispatch_table_size(); + nop_table = (_glapi_proc *) _glapi_new_nop_table(size); } void @@ -122,11 +126,18 @@ offset_to_proc_name_safe(unsigned offset) * _glapi_proc *table exist. */ static void -validate_functions(struct gl_context *ctx, const struct function *function_table) +validate_functions(struct gl_context *ctx, const struct function *function_table, + const _glapi_proc *nop_table) { _glapi_proc *table = (_glapi_proc *) ctx->Exec; for (unsigned i = 0; function_table[i].name != NULL; i++) { + /* The context version is >= the GL version where the function was + * introduced. Therefore, the function cannot be set to the nop + * function. + */ + const bool cant_be_nop = ctx->Version >= function_table[i].Version; + const int offset = (function_table[i].offset != -1) ? function_table[i].offset : _glapi_get_proc_offset(function_table[i].name); @@ -136,32 +147,58 @@ validate_functions(struct gl_context *ctx, const struct function *function_table ASSERT_EQ(offset, _glapi_get_proc_offset(function_table[i].name)) << "Function: " << function_table[i].name; + if (cant_be_nop) { + EXPECT_NE(nop_table[offset], table[offset]) +<< "Function: " << function_table[i].name +<< " at offset " << offset; + } + + table[offset] = nop_table[offset]; + } +} + +/* Scan through the table and ensure that there is nothing except + * nop functions (as set by validate_functions(). + */ +static void +validate_nops(struct gl_context *ctx, const _glapi_proc *nop_table) +{ + _glapi_proc *table = (_glapi_proc *) ctx->Exec; + + const unsigned size = _glapi_get_dispatch_table_size(); + for (unsigned i = 0; i < size; i++) { + EXPECT_EQ(nop_table[i], table[i]) + << "i = " << i << " (" << offset_to_proc_name_safe(i) << ")"; } } TEST_F(DispatchSanity_test, GL31_CORE) { SetUpCtx(API_OPENGL_CORE, 31); - validate_functions(&ctx, gl_core_functions_possible); + validate_functions(&ctx, gl_core_functions_possible, nop_table); + validate_nops(&ctx, nop_table); } TEST_F(DispatchSanity_test, GLES11) { SetUpCtx(API_OPENGLES, 11); - validate_functions(&ctx, gles11_functions_possible); + validate_functions(&ctx, gles11_functions_possible, nop_table); + validate_nops(&ctx, nop_table); } TEST_F(DispatchSanity_test, GLES2) { SetUpCtx(API_OPENGLES2, 20); - validate_functions(&ctx, gles2_functions_possible); + validate_functions(&ctx, gles2_functions_possible, nop_table); + validate_nops(&ctx, nop_table); } TEST_F(DispatchSanity_test, GLES3) { SetUpCtx(API_OPENGLES2, 30); - validate_functions(&ctx, gles2_functions_possible); - validate_functions(&ctx, gles3_functions_possible); + validate_functions(&ctx, gles2_functions_possible, nop_table); + validate_functions(&ctx, gles3_functions_possible, nop_table); + validate_nops(&ctx, nop_table); } const struct function gl_core_functions_possible[] = { -- 2.1.0 _
Re: [Mesa-dev] [PATCH 9/9] mark GL_ARB_framebuffer_no_attachments as done for i965
On Wed, Apr 29, 2015 at 6:36 AM, Rogovin, Kevin wrote: >> At the bottom is another block with GLES 3.1 requirements, which also >> contains GL_ARB_f_n_a. > > > > At first, I said “Oh futz, I did not mark that one”. Then I did some > thinking. Before expressing > > my thoughts I want to emphasize that I really do not know what is the best > answer, or > > potentially even a good one. With the caveat in mind, maybe it is best that > it is not marked > > as ready for GL ES. Maybe. The potentially flawed reasoning is as follows: > > > > The patch series enables the extension for OpenGL and the extension stuff, I > think, only > > applies to GL, and not GL ES, contexts. In particular, the “wiring” for the > new functions is > > not implemented for GL ES. > > > > Secondly, the code in Mesa core from patch 3 of this series just checks for > the driver > > reporting it supports the extension; it does not do the check “if driver > supports extension > > AND it is GL”. However, the default geometry values are zero, so the > correct error > > code gets emitted anyways, but the text-error is not correct. This part > makes me twitch, > > though it follows the letter of the specs jut tine. > > > > Lastly, and this is just paranoia and quite likely not an issue. I had not > checked, much less > > quote, the relevant sections of the GL ES 3.1 spec. I think they are the > same, but I did > > not check it at all. > > > > As one can see from the above, when implementing this, GLES did not even > cross my mind. > > > > My tendency is to mark the “enabling” of this feature for ES3.1 a separate > patch, but on > > the other hand it is not code, it is just saying the feature is ready for > eventual use by ES3.1. > > Now in mid e-mail, I am thinking it should be marked. Beats me what is best. > > > > In truth what is making me twitch is Patch 3 under GL ES 3.1. I think that > the function > > might need to be revisited a little when GL ES 3.1 support goes live. > > > > Thoughts on this are welcome, particular in reference to Patch 3 of the > series. I'd just go read the ES 3.1 spec and see if there are any differences in this area. Also, please fix your mail client to stop its weird line wrapping (and the other half of the time sending HTML mail). ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/18] i965: Refactor rb surface setup to allow caller to store offsets
On Wed, Apr 29, 2015 at 11:05 AM, Anuj Phogat wrote: > With Matt's comments fixed: > Reviewed-by: Anuj Phogat So you know, Ken and I have both reviewed this series now. Unless you just want to review it, I don't think you need to. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/18] i965: Refactor rb surface setup to allow caller to store offsets
On Wed, Apr 29, 2015 at 12:17 PM, Matt Turner wrote: > On Wed, Apr 29, 2015 at 11:05 AM, Anuj Phogat wrote: >> With Matt's comments fixed: >> Reviewed-by: Anuj Phogat > > So you know, Ken and I have both reviewed this series now. Unless you > just want to review it, I don't think you need to. Topi mentioned I might need to rebase my Yf/Ys surface state patches on top of his surface state refactoring patches. So, I thought of taking a glance at the series. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 17/18] i965/ps/gen8: Refactor state uploading
It might be better to just prefetch no samplers in this case? -- a shader that has this many active samplers "probably" doesn't actually use them all in a single invocation. On Thu, Apr 30, 2015 at 5:23 AM, Kenneth Graunke wrote: > On Wednesday, April 29, 2015 07:47:26 PM Pohjolainen, Topi wrote: >> On Thu, Apr 23, 2015 at 09:58:22PM +0300, Pohjolainen, Topi wrote: >> > On Thu, Apr 23, 2015 at 11:53:49AM -0700, Matt Turner wrote: >> > > On Wed, Apr 22, 2015 at 1:47 PM, Topi Pohjolainen >> > > wrote: >> > > > Signed-off-by: Topi Pohjolainen >> > > > --- >> > > > src/mesa/drivers/dri/i965/brw_state.h | 12 + >> > > > src/mesa/drivers/dri/i965/gen8_ps_state.c | 74 >> > > > --- >> > > > 2 files changed, 59 insertions(+), 27 deletions(-) >> > > > >> > > > diff --git a/src/mesa/drivers/dri/i965/brw_state.h >> > > > b/src/mesa/drivers/dri/i965/brw_state.h >> > > > index 178f039..0c4f65e 100644 >> > > > --- a/src/mesa/drivers/dri/i965/brw_state.h >> > > > +++ b/src/mesa/drivers/dri/i965/brw_state.h >> > > > @@ -265,6 +265,18 @@ void gen7_set_surface_mcs_info(struct brw_context >> > > > *brw, >> > > > void gen7_check_surface_setup(uint32_t *surf, bool is_render_target); >> > > > void gen7_init_vtable_surface_functions(struct brw_context *brw); >> > > > >> > > > +/* gen8_ps_state.c */ >> > > > +void gen8_upload_ps_state(struct brw_context *brw, >> > > > + const struct gl_fragment_program *fp, >> > > > + const struct brw_stage_state *stage_state, >> > > > + const struct brw_wm_prog_data *prog_data, >> > > > + uint32_t fast_clear_op); >> > > > + >> > > > +void gen8_upload_ps_extra(struct brw_context *brw, >> > > > + const struct gl_fragment_program *fp, >> > > > + const struct brw_wm_prog_data *prog_data, >> > > > + bool multisampled_fbo); >> > > > + >> > > > /* gen7_sol_state.c */ >> > > > void gen7_upload_3dstate_so_decl_list(struct brw_context *brw, >> > > >const struct brw_vue_map >> > > > *vue_map); >> > > > diff --git a/src/mesa/drivers/dri/i965/gen8_ps_state.c >> > > > b/src/mesa/drivers/dri/i965/gen8_ps_state.c >> > > > index 5f39e12..da6136b 100644 >> > > > --- a/src/mesa/drivers/dri/i965/gen8_ps_state.c >> > > > +++ b/src/mesa/drivers/dri/i965/gen8_ps_state.c >> > > > @@ -27,15 +27,13 @@ >> > > > #include "brw_defines.h" >> > > > #include "intel_batchbuffer.h" >> > > > >> > > > -static void >> > > > -upload_ps_extra(struct brw_context *brw) >> > > > +void >> > > > +gen8_upload_ps_extra(struct brw_context *brw, >> > > > + const struct gl_fragment_program *fp, >> > > > + const struct brw_wm_prog_data *prog_data, >> > > > + bool multisampled_fbo) >> > > > { >> > > > struct gl_context *ctx = &brw->ctx; >> > > > - /* BRW_NEW_FRAGMENT_PROGRAM */ >> > > > - const struct brw_fragment_program *fp = >> > > > - brw_fragment_program_const(brw->fragment_program); >> > > > - /* BRW_NEW_FS_PROG_DATA */ >> > > > - const struct brw_wm_prog_data *prog_data = brw->wm.prog_data; >> > > > uint32_t dw1 = 0; >> > > > >> > > > dw1 |= GEN8_PSX_PIXEL_SHADER_VALID; >> > > > @@ -47,16 +45,14 @@ upload_ps_extra(struct brw_context *brw) >> > > > if (prog_data->num_varying_inputs != 0) >> > > >dw1 |= GEN8_PSX_ATTRIBUTE_ENABLE; >> > > > >> > > > - if (fp->program.Base.InputsRead & VARYING_BIT_POS) >> > > > + if (fp->Base.InputsRead & VARYING_BIT_POS) >> > > >dw1 |= GEN8_PSX_USES_SOURCE_DEPTH | GEN8_PSX_USES_SOURCE_W; >> > > > >> > > > - /* BRW_NEW_NUM_SAMPLES | _NEW_MULTISAMPLE */ >> > > > - bool multisampled_fbo = brw->num_samples > 1; >> > > > if (multisampled_fbo && >> > > > - _mesa_get_min_invocations_per_fragment(ctx, &fp->program, >> > > > false) > 1) >> > > > + _mesa_get_min_invocations_per_fragment(ctx, fp, false) > 1) >> > > >dw1 |= GEN8_PSX_SHADER_IS_PER_SAMPLE; >> > > > >> > > > - if (fp->program.Base.SystemValuesRead & SYSTEM_BIT_SAMPLE_MASK_IN) >> > > > + if (fp->Base.SystemValuesRead & SYSTEM_BIT_SAMPLE_MASK_IN) >> > > >dw1 |= GEN8_PSX_SHADER_USES_INPUT_COVERAGE_MASK; >> > > > >> > > > if (prog_data->uses_omask) >> > > > @@ -68,6 +64,20 @@ upload_ps_extra(struct brw_context *brw) >> > > > ADVANCE_BATCH(); >> > > > } >> > > > >> > > > +static void >> > > > +upload_ps_extra(struct brw_context *brw) >> > > > +{ >> > > > + /* BRW_NEW_FRAGMENT_PROGRAM */ >> > > > + const struct brw_fragment_program *fp = >> > > > + brw_fragment_program_const(brw->fragment_program); >> > > > + /* BRW_NEW_FS_PROG_DATA */ >> > > > + const struct brw_wm_prog_data *prog_data = brw->wm.prog_data; >> > > > + /* BRW_NEW_NUM_SAMPLES | _NEW_MULTISAMPLE */ >> > > > + const bool multisampled_fbo = brw->num_samples > 1; >>
Re: [Mesa-dev] [PATCH] mesa: Restore functionality to dispatch sanity test
On 04/29/2015 12:07 PM, Ian Romanick wrote: > From: Ian Romanick > > Along with a couple secondary goals, the dispatch sanity test had two > major, primary goals. > > 1. Ensure that all functions part of an API version are set in the >dispatch table. > > 2. Ensure that functions that cannot be part of an API version are not >set in the dispatch table. > > Commit 4bdbb58 removed the tests ability to fulfill either of its This commit also breaks binary compatibility between old libGL and new DRI driver. $ EGL_LOG_LEVEL=debug es2_info libEGL debug: Native platform type: x11 (autodetected) libEGL debug: EGL search path is /opt/xorg-master-x86_64/lib64/egl libEGL debug: added egl_dri2 to module array libEGL debug: failed to open /home/idr/devel/graphics/Mesa/BUILD/10.4-64/lib64/i965_dri.so: /home/idr/devel/graphics/Mesa/BUILD/10.4-64/lib64/i965_dri.so: undefined symbol: _glapi_set_nop_handler That's not ok. :( Brian: Can you propose an alternate solution to your original problem that doesn't break compatibility? Otherwise, I'm going to have to just revert 4bdbb58. > primary goals by removing anything that used _mesa_generic_nop(). It > seems like the problem on Windows could have been resolved by adding the > NULL context pointer check from nop_handler to _mesa_generic_nop(). > There is, however, some debugging benefit to actually getting the > (supposed) function name logged in the "unsupported function called" > message. > > The preceding commit added a function, _glapi_new_nop_table, that > allocates a table of per-entry point no-op functions. Restore the > ability to actually validate the sanity of the dispatch table by using > _glapi_new_nop_table. > > Previous to this commit removing a function from one of the > *_functions_possible lists would not cause the test to fail. With this > commit removing such a function will result in failure, as is expected. > > Signed-off-by: Ian Romanick > Cc: Brian Paul > --- > src/mesa/main/tests/dispatch_sanity.cpp | 49 > + > 1 file changed, 43 insertions(+), 6 deletions(-) > > diff --git a/src/mesa/main/tests/dispatch_sanity.cpp > b/src/mesa/main/tests/dispatch_sanity.cpp > index 946eabb..2a5afcd 100644 > --- a/src/mesa/main/tests/dispatch_sanity.cpp > +++ b/src/mesa/main/tests/dispatch_sanity.cpp > @@ -82,6 +82,7 @@ public: > struct dd_function_table driver_functions; > struct gl_context share_list; > struct gl_context ctx; > + _glapi_proc *nop_table; > }; > > void > @@ -93,6 +94,9 @@ DispatchSanity_test::SetUp() > memset(&ctx, 0, sizeof(ctx)); > > _mesa_init_driver_functions(&driver_functions); > + > + const unsigned size = _glapi_get_dispatch_table_size(); > + nop_table = (_glapi_proc *) _glapi_new_nop_table(size); > } > > void > @@ -122,11 +126,18 @@ offset_to_proc_name_safe(unsigned offset) > * _glapi_proc *table exist. > */ > static void > -validate_functions(struct gl_context *ctx, const struct function > *function_table) > +validate_functions(struct gl_context *ctx, const struct function > *function_table, > + const _glapi_proc *nop_table) > { > _glapi_proc *table = (_glapi_proc *) ctx->Exec; > > for (unsigned i = 0; function_table[i].name != NULL; i++) { > + /* The context version is >= the GL version where the function was > + * introduced. Therefore, the function cannot be set to the nop > + * function. > + */ > + const bool cant_be_nop = ctx->Version >= function_table[i].Version; > + >const int offset = (function_table[i].offset != -1) > ? function_table[i].offset > : _glapi_get_proc_offset(function_table[i].name); > @@ -136,32 +147,58 @@ validate_functions(struct gl_context *ctx, const struct > function *function_table >ASSERT_EQ(offset, > _glapi_get_proc_offset(function_table[i].name)) > << "Function: " << function_table[i].name; > + if (cant_be_nop) { > + EXPECT_NE(nop_table[offset], table[offset]) > +<< "Function: " << function_table[i].name > +<< " at offset " << offset; > + } > + > + table[offset] = nop_table[offset]; > + } > +} > + > +/* Scan through the table and ensure that there is nothing except > + * nop functions (as set by validate_functions(). > + */ > +static void > +validate_nops(struct gl_context *ctx, const _glapi_proc *nop_table) > +{ > + _glapi_proc *table = (_glapi_proc *) ctx->Exec; > + > + const unsigned size = _glapi_get_dispatch_table_size(); > + for (unsigned i = 0; i < size; i++) { > + EXPECT_EQ(nop_table[i], table[i]) > + << "i = " << i << " (" << offset_to_proc_name_safe(i) << ")"; > } > } > > TEST_F(DispatchSanity_test, GL31_CORE) > { > SetUpCtx(API_OPENGL_CORE, 31); > - validate_functions(&ctx, gl_core_functions_possible); > + validate_functions(&ctx, gl_core_functions_possible, nop_table); > + validate_nops(&ctx,
Re: [Mesa-dev] [PATCH 9/9] mark GL_ARB_framebuffer_no_attachments as done for i965
Hi, > I'd just go read the ES 3.1 spec and see if there are any differences in this > area. I checked the spec, and it appears to me to have the same behavior as GL_ARB_framebuffer_no_attachments. > Also, please fix your mail client to stop its weird line wrapping (and the > other half of the time sending HTML mail). Fingers crossed that the settings are correct. -Kevin ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/9] mesa: Complete implementation for GL_ARB_framebuffer_no_attachments in Mesa core
I just want to make a begging on the review for this patch: I am a touch paranoid about how the thing will act under the GL ES situation; I believe it should follow the spec, but if whoever reviews does the extra leg work of checking that I got this right, I'd really appreciate it. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 6/9] i965: Use _mesa_geometry_ functions appropriately
Hi, One comment on the code, or rather a request to the reviewer of the code. The icky part of checking this patch is correct is checking that the remaining instances of gl_framebuffer::Width, Height, MaxNumLayers and Visaul.samples are "correct". I believe I "got 'em all", of those that should be changed and those changed should be changed, but the part of checking if the remaining unchanged bits is not seen from the raw diff. Also, the exchange I had with Topi previously, what I was really after was just this, to make sure this gets checked and I got terribly, embarrassingly sidetracked by to split and include or not include work for a particular Gen4/5 atom only atom. My sincere apologies for all the traffic and me making, by my actions, the community and development process worse. -Kevin ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965/ps: Use SET_FIELD() for sampler count
The value is actually clamped to 0-16 as sample state pointer can be used to support more than 16 samplers. Signed-off-by: Topi Pohjolainen --- src/mesa/drivers/dri/i965/brw_defines.h | 1 + src/mesa/drivers/dri/i965/gen7_wm_state.c | 5 +++-- src/mesa/drivers/dri/i965/gen8_ps_state.c | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index bd3218a..7d55d85 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -2259,6 +2259,7 @@ enum brw_wm_barycentric_interp_mode { # define GEN7_PS_SPF_MODE (1 << 31) # define GEN7_PS_VECTOR_MASK_ENABLE(1 << 30) # define GEN7_PS_SAMPLER_COUNT_SHIFT 27 +# define GEN7_PS_SAMPLER_COUNT_MASK INTEL_MASK(29, 27) # define GEN7_PS_BINDING_TABLE_ENTRY_COUNT_SHIFT 18 # define GEN7_PS_FLOATING_POINT_MODE_IEEE_754 (0 << 16) # define GEN7_PS_FLOATING_POINT_MODE_ALT (1 << 16) diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c b/src/mesa/drivers/dri/i965/gen7_wm_state.c index 923414e..55a1acd 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c @@ -135,8 +135,9 @@ upload_ps_state(struct brw_context *brw) dw2 = dw4 = dw5 = ksp2 = 0; - dw2 |= - (ALIGN(brw->wm.base.sampler_count, 4) / 4) << GEN7_PS_SAMPLER_COUNT_SHIFT; + const unsigned sampler_count = + DIV_ROUND_UP(CLAMP(brw->wm.base.sampler_count, 0, 16), 4); + dw2 |= SET_FIELD(sampler_count, GEN7_PS_SAMPLER_COUNT); dw2 |= ((prog_data->base.binding_table.size_bytes / 4) << GEN7_PS_BINDING_TABLE_ENTRY_COUNT_SHIFT); diff --git a/src/mesa/drivers/dri/i965/gen8_ps_state.c b/src/mesa/drivers/dri/i965/gen8_ps_state.c index 5f39e12..8481153 100644 --- a/src/mesa/drivers/dri/i965/gen8_ps_state.c +++ b/src/mesa/drivers/dri/i965/gen8_ps_state.c @@ -133,8 +133,9 @@ upload_ps_state(struct brw_context *brw) */ dw3 |= GEN7_PS_VECTOR_MASK_ENABLE; - dw3 |= - (ALIGN(brw->wm.base.sampler_count, 4) / 4) << GEN7_PS_SAMPLER_COUNT_SHIFT; + const unsigned sampler_count = + DIV_ROUND_UP(CLAMP(brw->wm.base.sampler_count, 0, 16), 4); + dw3 |= SET_FIELD(sampler_count, GEN7_PS_SAMPLER_COUNT); /* BRW_NEW_FS_PROG_DATA */ dw3 |= -- 1.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 17/18] i965/ps/gen8: Refactor state uploading
On Thursday, April 30, 2015 08:09:46 AM Chris Forbes wrote: > It might be better to just prefetch no samplers in this case? -- a > shader that has this many active samplers "probably" doesn't actually > use them all in a single invocation. I'm fine with that too - I think the gains from prefetching were pretty small, and it's questionable whether it's even worth doing in a lot of cases. signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965/ps: Use SET_FIELD() for sampler count
On Thursday, April 30, 2015 12:14:34 AM Topi Pohjolainen wrote: > The value is actually clamped to 0-16 as sample state pointer > can be used to support more than 16 samplers. > > Signed-off-by: Topi Pohjolainen > --- > src/mesa/drivers/dri/i965/brw_defines.h | 1 + > src/mesa/drivers/dri/i965/gen7_wm_state.c | 5 +++-- > src/mesa/drivers/dri/i965/gen8_ps_state.c | 5 +++-- > 3 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_defines.h > b/src/mesa/drivers/dri/i965/brw_defines.h > index bd3218a..7d55d85 100644 > --- a/src/mesa/drivers/dri/i965/brw_defines.h > +++ b/src/mesa/drivers/dri/i965/brw_defines.h > @@ -2259,6 +2259,7 @@ enum brw_wm_barycentric_interp_mode { > # define GEN7_PS_SPF_MODE(1 << 31) > # define GEN7_PS_VECTOR_MASK_ENABLE (1 << 30) > # define GEN7_PS_SAMPLER_COUNT_SHIFT 27 > +# define GEN7_PS_SAMPLER_COUNT_MASK INTEL_MASK(29, 27) > # define GEN7_PS_BINDING_TABLE_ENTRY_COUNT_SHIFT 18 > # define GEN7_PS_FLOATING_POINT_MODE_IEEE_754(0 << 16) > # define GEN7_PS_FLOATING_POINT_MODE_ALT (1 << 16) > diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c > b/src/mesa/drivers/dri/i965/gen7_wm_state.c > index 923414e..55a1acd 100644 > --- a/src/mesa/drivers/dri/i965/gen7_wm_state.c > +++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c > @@ -135,8 +135,9 @@ upload_ps_state(struct brw_context *brw) > > dw2 = dw4 = dw5 = ksp2 = 0; > > - dw2 |= > - (ALIGN(brw->wm.base.sampler_count, 4) / 4) << > GEN7_PS_SAMPLER_COUNT_SHIFT; > + const unsigned sampler_count = > + DIV_ROUND_UP(CLAMP(brw->wm.base.sampler_count, 0, 16), 4); > + dw2 |= SET_FIELD(sampler_count, GEN7_PS_SAMPLER_COUNT); > > dw2 |= ((prog_data->base.binding_table.size_bytes / 4) << > GEN7_PS_BINDING_TABLE_ENTRY_COUNT_SHIFT); > diff --git a/src/mesa/drivers/dri/i965/gen8_ps_state.c > b/src/mesa/drivers/dri/i965/gen8_ps_state.c > index 5f39e12..8481153 100644 > --- a/src/mesa/drivers/dri/i965/gen8_ps_state.c > +++ b/src/mesa/drivers/dri/i965/gen8_ps_state.c > @@ -133,8 +133,9 @@ upload_ps_state(struct brw_context *brw) > */ > dw3 |= GEN7_PS_VECTOR_MASK_ENABLE; > > - dw3 |= > - (ALIGN(brw->wm.base.sampler_count, 4) / 4) << > GEN7_PS_SAMPLER_COUNT_SHIFT; > + const unsigned sampler_count = > + DIV_ROUND_UP(CLAMP(brw->wm.base.sampler_count, 0, 16), 4); > + dw3 |= SET_FIELD(sampler_count, GEN7_PS_SAMPLER_COUNT); > > /* BRW_NEW_FS_PROG_DATA */ > dw3 |= > Reviewed-by: Kenneth Graunke signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Restore functionality to dispatch sanity test
On 04/29/2015 02:53 PM, Ian Romanick wrote: On 04/29/2015 12:07 PM, Ian Romanick wrote: From: Ian Romanick Along with a couple secondary goals, the dispatch sanity test had two major, primary goals. 1. Ensure that all functions part of an API version are set in the dispatch table. 2. Ensure that functions that cannot be part of an API version are not set in the dispatch table. Commit 4bdbb58 removed the tests ability to fulfill either of its This commit also breaks binary compatibility between old libGL and new DRI driver. $ EGL_LOG_LEVEL=debug es2_info libEGL debug: Native platform type: x11 (autodetected) libEGL debug: EGL search path is /opt/xorg-master-x86_64/lib64/egl libEGL debug: added egl_dri2 to module array libEGL debug: failed to open /home/idr/devel/graphics/Mesa/BUILD/10.4-64/lib64/i965_dri.so: /home/idr/devel/graphics/Mesa/BUILD/10.4-64/lib64/i965_dri.so: undefined symbol: _glapi_set_nop_handler That's not ok. :( Brian: Can you propose an alternate solution to your original problem that doesn't break compatibility? Otherwise, I'm going to have to just revert 4bdbb58. Please hold off on that. I'm going to be off-line until next week and won't have time to work on this until then at the earliest. primary goals by removing anything that used _mesa_generic_nop(). It seems like the problem on Windows could have been resolved by adding the NULL context pointer check from nop_handler to _mesa_generic_nop(). Unfortunately, no. The problem is the the OpenGL API uses __stdcall convention on Windows (the callee has to restore the stack). That means plugging a single, generic no-op handler into all dispatch slots will not work. The no-op function will not properly clean up the stack and we'll crash. We found this with a professional CAD app on Windows so the fix is critical to those users. A temporary work-around may be to only call _glapi_set_nop_handler() for Windows. Then, maybe remove the #ifdef _WIN32 at some point down the road. How often do you test mixing old libGL with newer drivers? I've always suspected this is a bit fragile. Nobody else seems to have noticed. -Brian PS: the patch looks OK to me. Reviewed-by: Brian Paul There is, however, some debugging benefit to actually getting the (supposed) function name logged in the "unsupported function called" message. The preceding commit added a function, _glapi_new_nop_table, that allocates a table of per-entry point no-op functions. Restore the ability to actually validate the sanity of the dispatch table by using _glapi_new_nop_table. Previous to this commit removing a function from one of the *_functions_possible lists would not cause the test to fail. With this commit removing such a function will result in failure, as is expected. Signed-off-by: Ian Romanick Cc: Brian Paul --- src/mesa/main/tests/dispatch_sanity.cpp | 49 + 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 946eabb..2a5afcd 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -82,6 +82,7 @@ public: struct dd_function_table driver_functions; struct gl_context share_list; struct gl_context ctx; + _glapi_proc *nop_table; }; void @@ -93,6 +94,9 @@ DispatchSanity_test::SetUp() memset(&ctx, 0, sizeof(ctx)); _mesa_init_driver_functions(&driver_functions); + + const unsigned size = _glapi_get_dispatch_table_size(); + nop_table = (_glapi_proc *) _glapi_new_nop_table(size); } void @@ -122,11 +126,18 @@ offset_to_proc_name_safe(unsigned offset) * _glapi_proc *table exist. */ static void -validate_functions(struct gl_context *ctx, const struct function *function_table) +validate_functions(struct gl_context *ctx, const struct function *function_table, + const _glapi_proc *nop_table) { _glapi_proc *table = (_glapi_proc *) ctx->Exec; for (unsigned i = 0; function_table[i].name != NULL; i++) { + /* The context version is >= the GL version where the function was + * introduced. Therefore, the function cannot be set to the nop + * function. + */ + const bool cant_be_nop = ctx->Version >= function_table[i].Version; + const int offset = (function_table[i].offset != -1) ? function_table[i].offset : _glapi_get_proc_offset(function_table[i].name); @@ -136,32 +147,58 @@ validate_functions(struct gl_context *ctx, const struct function *function_table ASSERT_EQ(offset, _glapi_get_proc_offset(function_table[i].name)) << "Function: " << function_table[i].name; + if (cant_be_nop) { + EXPECT_NE(nop_table[offset], table[offset]) +<< "Function: " << function_table[i].name +<< " at offset " << offset; + } + + table[offset] = nop_table[o
Re: [Mesa-dev] [PATCH] i965/ps: Use SET_FIELD() for sampler count
On Wed, Apr 29, 2015 at 2:14 PM, Topi Pohjolainen wrote: > The value is actually clamped to 0-16 as sample state pointer > can be used to support more than 16 samplers. > > Signed-off-by: Topi Pohjolainen > --- > src/mesa/drivers/dri/i965/brw_defines.h | 1 + > src/mesa/drivers/dri/i965/gen7_wm_state.c | 5 +++-- > src/mesa/drivers/dri/i965/gen8_ps_state.c | 5 +++-- > 3 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_defines.h > b/src/mesa/drivers/dri/i965/brw_defines.h > index bd3218a..7d55d85 100644 > --- a/src/mesa/drivers/dri/i965/brw_defines.h > +++ b/src/mesa/drivers/dri/i965/brw_defines.h > @@ -2259,6 +2259,7 @@ enum brw_wm_barycentric_interp_mode { > # define GEN7_PS_SPF_MODE (1 << 31) > # define GEN7_PS_VECTOR_MASK_ENABLE(1 << 30) > # define GEN7_PS_SAMPLER_COUNT_SHIFT 27 > +# define GEN7_PS_SAMPLER_COUNT_MASK INTEL_MASK(29, 27) > # define GEN7_PS_BINDING_TABLE_ENTRY_COUNT_SHIFT 18 > # define GEN7_PS_FLOATING_POINT_MODE_IEEE_754 (0 << 16) > # define GEN7_PS_FLOATING_POINT_MODE_ALT (1 << 16) > diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c > b/src/mesa/drivers/dri/i965/gen7_wm_state.c > index 923414e..55a1acd 100644 > --- a/src/mesa/drivers/dri/i965/gen7_wm_state.c > +++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c > @@ -135,8 +135,9 @@ upload_ps_state(struct brw_context *brw) > > dw2 = dw4 = dw5 = ksp2 = 0; > > - dw2 |= > - (ALIGN(brw->wm.base.sampler_count, 4) / 4) << > GEN7_PS_SAMPLER_COUNT_SHIFT; > + const unsigned sampler_count = > + DIV_ROUND_UP(CLAMP(brw->wm.base.sampler_count, 0, 16), 4); > + dw2 |= SET_FIELD(sampler_count, GEN7_PS_SAMPLER_COUNT); > > dw2 |= ((prog_data->base.binding_table.size_bytes / 4) << > GEN7_PS_BINDING_TABLE_ENTRY_COUNT_SHIFT); > diff --git a/src/mesa/drivers/dri/i965/gen8_ps_state.c > b/src/mesa/drivers/dri/i965/gen8_ps_state.c > index 5f39e12..8481153 100644 > --- a/src/mesa/drivers/dri/i965/gen8_ps_state.c > +++ b/src/mesa/drivers/dri/i965/gen8_ps_state.c > @@ -133,8 +133,9 @@ upload_ps_state(struct brw_context *brw) > */ > dw3 |= GEN7_PS_VECTOR_MASK_ENABLE; > > - dw3 |= > - (ALIGN(brw->wm.base.sampler_count, 4) / 4) << > GEN7_PS_SAMPLER_COUNT_SHIFT; > + const unsigned sampler_count = > + DIV_ROUND_UP(CLAMP(brw->wm.base.sampler_count, 0, 16), 4); > + dw3 |= SET_FIELD(sampler_count, GEN7_PS_SAMPLER_COUNT); > > /* BRW_NEW_FS_PROG_DATA */ > dw3 |= > -- > 1.9.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev Reviewed-by: Anuj Phogat ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 12/20] glsl/es3.1: Allow interger mix built-ins in GLSL ES 3.10
From: Ian Romanick Signed-off-by: Ian Romanick --- src/glsl/builtin_functions.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp index 5ce8112..435d926 100644 --- a/src/glsl/builtin_functions.cpp +++ b/src/glsl/builtin_functions.cpp @@ -194,7 +194,8 @@ shader_bit_encoding(const _mesa_glsl_parse_state *state) static bool shader_integer_mix(const _mesa_glsl_parse_state *state) { - return v130(state) && state->EXT_shader_integer_mix_enable; + return state->is_version(450, 310) || + v130(state) && state->EXT_shader_integer_mix_enable; } static bool -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 20/20] mesa: Allow MESA_GL_VERSION_OVERRIDE with ES contexts
From: Ian Romanick The bulk of the change is to prevent overriding the context to API_OPENGL_CORE based on the requested version. If the context is API_OPENGL_ES2, don't change it. Signed-off-by: Ian Romanick --- src/mesa/drivers/dri/common/dri_util.c | 4 src/mesa/main/context.c| 4 +--- src/mesa/main/version.c| 16 +--- src/mesa/state_tracker/st_manager.c| 3 +-- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index d6e875f..680a907 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -163,6 +163,10 @@ driCreateNewScreen2(int scrn, int fd, } int gl_version_override = _mesa_get_gl_version_override(); +if (gl_version_override >= 20) { + psp->max_gl_es2_version = MAX2(psp->max_gl_es2_version, + gl_version_override); +} if (gl_version_override >= 31) { psp->max_gl_core_version = MAX2(psp->max_gl_core_version, gl_version_override); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 4aaf8b1..cd1a02b 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1109,9 +1109,7 @@ _mesa_initialize_context(struct gl_context *ctx, ctx->HasConfig = GL_FALSE; } - if (_mesa_is_desktop_gl(ctx)) { - _mesa_override_gl_version(ctx); - } + _mesa_override_gl_version(ctx); /* misc one-time initializations */ one_time_init(ctx); diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 1c19277..f426342 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -134,13 +134,15 @@ _mesa_override_gl_version_contextless(struct gl_constants *consts, if (version > 0) { *versionOut = version; - if (version >= 30 && fwd_context) { - *apiOut = API_OPENGL_CORE; - consts->ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT; - } else if (version >= 31 && !compat_context) { - *apiOut = API_OPENGL_CORE; - } else { - *apiOut = API_OPENGL_COMPAT; + if (*apiOut == API_OPENGL_CORE || *apiOut == API_OPENGL_COMPAT) { + if (version >= 30 && fwd_context) { +*apiOut = API_OPENGL_CORE; +consts->ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT; + } else if (version >= 31 && !compat_context) { +*apiOut = API_OPENGL_CORE; + } else { +*apiOut = API_OPENGL_COMPAT; + } } return true; } diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 840f76a..1b3b4cb 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -920,8 +920,7 @@ static unsigned get_version(struct pipe_screen *screen, struct gl_extensions extensions = {0}; GLuint version; - if ((api == API_OPENGL_COMPAT || api == API_OPENGL_CORE) && - _mesa_override_gl_version_contextless(&consts, &api, &version)) { + if (_mesa_override_gl_version_contextless(&consts, &api, &version)) { return version; } -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/20] mesa: Use bool instead of GLboolean
From: Ian Romanick Signed-off-by: Ian Romanick --- src/mesa/main/version.c | 56 - 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 5b8ac0a..7bf3f49 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -32,7 +32,7 @@ /** * Scans 'string' to see if it ends with 'ending'. */ -static GLboolean +static bool check_for_ending(const char *string, const char *ending) { int len1, len2; @@ -41,13 +41,13 @@ check_for_ending(const char *string, const char *ending) len2 = strlen(ending); if (len2 > len1) { - return GL_FALSE; + return false; } if (strcmp(string + (len1 - len2), ending) == 0) { - return GL_TRUE; + return true; } else { - return GL_FALSE; + return false; } } @@ -58,15 +58,15 @@ check_for_ending(const char *string, const char *ending) * fwd_context is only valid if version > 0 */ static void -get_gl_override(int *version, GLboolean *fwd_context, -GLboolean *compat_context) +get_gl_override(int *version, bool *fwd_context, +bool *compat_context) { const char *env_var = "MESA_GL_VERSION_OVERRIDE"; const char *version_str; int major, minor, n; static int override_version = -1; - static GLboolean fc_suffix = GL_FALSE; - static GLboolean compat_suffix = GL_FALSE; + static bool fc_suffix = false; + static bool compat_suffix = false; if (override_version < 0) { override_version = 0; @@ -134,7 +134,7 @@ _mesa_override_gl_version_contextless(struct gl_constants *consts, gl_api *apiOut, GLuint *versionOut) { int version; - GLboolean fwd_context, compat_context; + bool fwd_context, compat_context; get_gl_override(&version, &fwd_context, &compat_context); @@ -148,9 +148,9 @@ _mesa_override_gl_version_contextless(struct gl_constants *consts, } else { *apiOut = API_OPENGL_COMPAT; } - return GL_TRUE; + return true; } - return GL_FALSE; + return false; } void @@ -171,7 +171,7 @@ int _mesa_get_gl_version_override(void) { int version; - GLboolean fwd_context, compat_context; + bool fwd_context, compat_context; get_gl_override(&version, &fwd_context, &compat_context); @@ -211,11 +211,11 @@ compute_version(const struct gl_extensions *extensions, { GLuint major, minor, version; - const GLboolean ver_1_3 = (extensions->ARB_texture_border_clamp && + const bool ver_1_3 = (extensions->ARB_texture_border_clamp && extensions->ARB_texture_cube_map && extensions->ARB_texture_env_combine && extensions->ARB_texture_env_dot3); - const GLboolean ver_1_4 = (ver_1_3 && + const bool ver_1_4 = (ver_1_3 && extensions->ARB_depth_texture && extensions->ARB_shadow && extensions->ARB_texture_env_crossbar && @@ -223,9 +223,9 @@ compute_version(const struct gl_extensions *extensions, extensions->EXT_blend_func_separate && extensions->EXT_blend_minmax && extensions->EXT_point_parameters); - const GLboolean ver_1_5 = (ver_1_4 && + const bool ver_1_5 = (ver_1_4 && extensions->ARB_occlusion_query); - const GLboolean ver_2_0 = (ver_1_5 && + const bool ver_2_0 = (ver_1_5 && extensions->ARB_point_sprite && extensions->ARB_vertex_shader && extensions->ARB_fragment_shader && @@ -240,10 +240,10 @@ compute_version(const struct gl_extensions *extensions, */ (extensions->EXT_stencil_two_side || extensions->ATI_separate_stencil)); - const GLboolean ver_2_1 = (ver_2_0 && + const bool ver_2_1 = (ver_2_0 && extensions->EXT_pixel_buffer_object && extensions->EXT_texture_sRGB); - const GLboolean ver_3_0 = (ver_2_1 && + const bool ver_3_0 = (ver_2_1 && consts->GLSLVersion >= 130 && (consts->MaxSamples >= 4 || consts->FakeSWMSAA) && (api == API_OPENGL_CORE || @@ -263,7 +263,7 @@ compute_version(const struct gl_extensions *extensions, extensions->EXT_texture_shared_exponent && extensions->EXT_transform_feedback && extensions->NV_conditional_render); - const GLboolean ver_3_1 = (ver_3_0 && + const bool ver_3_1 = (ver_3_0 && consts->GLSLVersion >= 140 &&
[Mesa-dev] [PATCH 07/20] docs/GL3: Update GLES 3.1 dependencies
From: Ian Romanick Signed-off-by: Ian Romanick --- docs/GL3.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/docs/GL3.txt b/docs/GL3.txt index 617ff34..d188ffa 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -225,11 +225,17 @@ GLES3.1, GLSL ES 3.1 GL_ARB_shading_language_packing DONE (all drivers) GL_ARB_separate_shader_objects DONE (all drivers) GL_ARB_stencil_texturing DONE (i965/gen8+, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe) + Multisample textures (GL_ARB_texture_multisample)DONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe) + GL_ARB_texture_storage_multisample DONE (all drivers that support GL_ARB_texture_multisample) GL_ARB_vertex_attrib_binding DONE (all drivers) GS5 Enhanced textureGather DONE (i965, nvc0, r600, radeonsi) GS5 Packing/bitfield/conversion functionsDONE (i965, nvc0, r600, radeonsi) GL_EXT_shader_integer_mixDONE (all drivers that support GLSL) + Additional functions not covered above: + glMemoryBarrierByRegion + glGetTexLevelParameter[fi]v - needs updates to restrict to GLES enums + glGetBooleani_v - needs updates to restrict to GLES enums More info about these features and the work involved can be found at http://dri.freedesktop.org/wiki/MissingFunctionality -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/20] glsl: Silence unused parameter warnings
From: Ian Romanick I opted to comment out "last_field" because it was not obvious what the meaning of the dangling bool would be. For the other parameters, the meaning was more intuitive without the name. link_uniform_blocks.cpp:70:65: warning: unused parameter 'name' [-Wunused-parameter] virtual void enter_record(const glsl_type *type, const char *name, ^ link_uniform_blocks.cpp:77:65: warning: unused parameter 'name' [-Wunused-parameter] virtual void leave_record(const glsl_type *type, const char *name, ^ link_uniform_blocks.cpp:93:62: warning: unused parameter 'record_type' [-Wunused-parameter] bool row_major, const glsl_type *record_type, ^ link_uniform_blocks.cpp:94:34: warning: unused parameter 'last_field' [-Wunused-parameter] bool last_field) ^ link_uniforms.cpp:547:65: warning: unused parameter 'name' [-Wunused-parameter] virtual void enter_record(const glsl_type *type, const char *name, ^ link_uniforms.cpp:556:65: warning: unused parameter 'name' [-Wunused-parameter] virtual void leave_record(const glsl_type *type, const char *name, ^ link_uniforms.cpp:567:34: warning: unused parameter 'last_field' [-Wunused-parameter] bool last_field) ^ Signed-off-by: Ian Romanick --- src/glsl/link_uniform_blocks.cpp | 8 src/glsl/link_uniforms.cpp | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/glsl/link_uniform_blocks.cpp b/src/glsl/link_uniform_blocks.cpp index 6ca4110..898544b 100644 --- a/src/glsl/link_uniform_blocks.cpp +++ b/src/glsl/link_uniform_blocks.cpp @@ -67,14 +67,14 @@ private: assert(!"Should not get here."); } - virtual void enter_record(const glsl_type *type, const char *name, + virtual void enter_record(const glsl_type *type, const char *, bool row_major) { assert(type->is_record()); this->offset = glsl_align( this->offset, type->std140_base_alignment(row_major)); } - virtual void leave_record(const glsl_type *type, const char *name, + virtual void leave_record(const glsl_type *type, const char *, bool row_major) { assert(type->is_record()); @@ -90,8 +90,8 @@ private: } virtual void visit_field(const glsl_type *type, const char *name, -bool row_major, const glsl_type *record_type, -bool last_field) +bool row_major, const glsl_type *, +bool /* last_field */) { assert(this->index < this->num_variables); diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index d5ca23a..2c928e1 100644 --- a/src/glsl/link_uniforms.cpp +++ b/src/glsl/link_uniforms.cpp @@ -544,7 +544,7 @@ private: assert(!"Should not get here."); } - virtual void enter_record(const glsl_type *type, const char *name, + virtual void enter_record(const glsl_type *type, const char *, bool row_major) { assert(type->is_record()); if (this->ubo_block_index == -1) @@ -553,7 +553,7 @@ private: this->ubo_byte_offset, type->std140_base_alignment(row_major)); } - virtual void leave_record(const glsl_type *type, const char *name, + virtual void leave_record(const glsl_type *type, const char *, bool row_major) { assert(type->is_record()); if (this->ubo_block_index == -1) @@ -564,7 +564,7 @@ private: virtual void visit_field(const glsl_type *type, const char *name, bool row_major, const glsl_type *record_type, -bool last_field) +bool /* last_field */) { assert(!type->without_array()->is_record()); assert(!type->without_array()->is_interface()); -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/20] glsl/es3.1: Allow 3.10 ES shaders in a GLES 3.1 context
From: Ian Romanick Currently no 3.10 ES features (beyond 3.00 ES) are enabled. That will come later. Signed-off-by: Ian Romanick --- src/glsl/glsl_parser_extras.cpp | 9 +++-- src/glsl/glsl_parser_extras.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 0aa3c54..91f225e 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -143,9 +143,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->num_user_structures = 0; /* supported_versions should be large enough to support the known desktop -* GLSL versions plus 2 GLES versions (ES2 & ES3) +* GLSL versions plus 3 GLES versions (ES 1.00, ES 3.00, and ES 3.10)) */ - STATIC_ASSERT((ARRAY_SIZE(known_desktop_glsl_versions) + 2) == + STATIC_ASSERT((ARRAY_SIZE(known_desktop_glsl_versions) + 3) == ARRAY_SIZE(this->supported_versions)); /* Populate the list of supported GLSL versions */ @@ -175,6 +175,11 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->supported_versions[this->num_supported_versions].es = true; this->num_supported_versions++; } + if (_mesa_is_gles31(ctx)) { + this->supported_versions[this->num_supported_versions].ver = 310; + this->supported_versions[this->num_supported_versions].es = true; + this->num_supported_versions++; + } /* Create a string for use in error messages to tell the user which GLSL * versions are supported. diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 382c200..960f957 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -229,7 +229,7 @@ struct _mesa_glsl_parse_state { struct { unsigned ver; bool es; - } supported_versions[14]; + } supported_versions[15]; bool es_shader; unsigned language_version; -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/20] glsl/es3.1: Allow explicit uniform locations in GLSL ES 3.10
From: Ian Romanick Signed-off-by: Ian Romanick --- src/glsl/glsl_parser_extras.h | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 960f957..552d589 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -175,11 +175,15 @@ struct _mesa_glsl_parse_state { const ir_variable *) { if (!this->has_explicit_attrib_location() || - !this->ARB_explicit_uniform_location_enable) { + !this->has_explicit_uniform_location()) { + const char *const requirement = this->es_shader +? "GLSL ES 310" +: "GL_ARB_explicit_uniform_location and either " + "GL_ARB_explicit_attrib_location or GLSL 330."; + _mesa_glsl_error(locp, this, - "uniform explicit location requires " - "GL_ARB_explicit_uniform_location and either " - "GL_ARB_explicit_attrib_location or GLSL 330."); + "uniform explicit location requires %s", + requirement); return false; } @@ -201,6 +205,11 @@ struct _mesa_glsl_parse_state { return ARB_explicit_attrib_location_enable || is_version(330, 300); } + bool has_explicit_uniform_location() const + { + return ARB_explicit_uniform_location_enable || is_version(430, 310); + } + bool has_uniform_buffer_objects() const { return ARB_uniform_buffer_object_enable || is_version(140, 300); -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/20] mesa: Use bool in _mesa_is_ helpers instead of GLboolean
From: Ian Romanick Signed-off-by: Ian Romanick --- src/mesa/main/context.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 1cd89a8..d11027d 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -285,7 +285,7 @@ do { \ /** * Checks if the context is for Desktop GL (Compatibility or Core) */ -static inline GLboolean +static inline bool _mesa_is_desktop_gl(const struct gl_context *ctx) { return ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGL_CORE; @@ -295,7 +295,7 @@ _mesa_is_desktop_gl(const struct gl_context *ctx) /** * Checks if the context is for any GLES version */ -static inline GLboolean +static inline bool _mesa_is_gles(const struct gl_context *ctx) { return ctx->API == API_OPENGLES || ctx->API == API_OPENGLES2; @@ -305,7 +305,7 @@ _mesa_is_gles(const struct gl_context *ctx) /** * Checks if the context is for GLES 3.x */ -static inline GLboolean +static inline bool _mesa_is_gles3(const struct gl_context *ctx) { return ctx->API == API_OPENGLES2 && ctx->Version >= 30; @@ -315,7 +315,7 @@ _mesa_is_gles3(const struct gl_context *ctx) /** * Checks if the context supports geometry shaders. */ -static inline GLboolean +static inline bool _mesa_has_geometry_shaders(const struct gl_context *ctx) { return _mesa_is_desktop_gl(ctx) && -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 18/20] gles/es3.1: Enable dispatch of almost all new GLES 3.1 functions
From: Ian Romanick A couple functions are missing because there are no implementations of them yet. These are: glFramebufferParameteri (from GL_ARB_framebuffer_no_attachments) glGetFramebufferParameteriv (from GL_ARB_framebuffer_no_attachments) glMemoryBarrierByRegion v2: Rebase on updated dispatch_sanity.cpp test. v3: Add support for glDraw{Arrays,Elements}Indirect in vbo_exec_array.c. The updated dispatch_sanity.cpp test discovered this omission. Signed-off-by: Ian Romanick --- src/mapi/glapi/gen/ARB_compute_shader.xml | 4 +- src/mapi/glapi/gen/ARB_draw_indirect.xml | 4 +- src/mapi/glapi/gen/ARB_program_interface_query.xml | 10 +-- src/mapi/glapi/gen/ARB_separate_shader_objects.xml | 86 ++-- src/mapi/glapi/gen/ARB_shader_image_load_store.xml | 4 +- src/mapi/glapi/gen/ARB_texture_multisample.xml | 4 +- .../glapi/gen/ARB_texture_storage_multisample.xml | 2 +- src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml | 10 +-- src/mapi/glapi/gen/GL3x.xml| 2 +- src/mapi/glapi/gen/gl_API.xml | 4 +- src/mesa/main/tests/dispatch_sanity.cpp| 95 ++ src/mesa/vbo/vbo_exec_array.c | 5 +- 12 files changed, 164 insertions(+), 66 deletions(-) diff --git a/src/mapi/glapi/gen/ARB_compute_shader.xml b/src/mapi/glapi/gen/ARB_compute_shader.xml index 1db373e..0ccbcc0 100644 --- a/src/mapi/glapi/gen/ARB_compute_shader.xml +++ b/src/mapi/glapi/gen/ARB_compute_shader.xml @@ -26,13 +26,13 @@ - + - + diff --git a/src/mapi/glapi/gen/ARB_draw_indirect.xml b/src/mapi/glapi/gen/ARB_draw_indirect.xml index 7de03cd..e02568c 100644 --- a/src/mapi/glapi/gen/ARB_draw_indirect.xml +++ b/src/mapi/glapi/gen/ARB_draw_indirect.xml @@ -8,12 +8,12 @@ - + - + diff --git a/src/mapi/glapi/gen/ARB_program_interface_query.xml b/src/mapi/glapi/gen/ARB_program_interface_query.xml index 59eb59c..5c26498 100644 --- a/src/mapi/glapi/gen/ARB_program_interface_query.xml +++ b/src/mapi/glapi/gen/ARB_program_interface_query.xml @@ -56,21 +56,21 @@ - + - + - + @@ -79,7 +79,7 @@ - + @@ -90,7 +90,7 @@ - + diff --git a/src/mapi/glapi/gen/ARB_separate_shader_objects.xml b/src/mapi/glapi/gen/ARB_separate_shader_objects.xml index 96ae2b9..d05b96c 100644 --- a/src/mapi/glapi/gen/ARB_separate_shader_objects.xml +++ b/src/mapi/glapi/gen/ARB_separate_shader_objects.xml @@ -15,33 +15,33 @@ - + - + - + - + - + - + - + @@ -54,30 +54,30 @@ --> - + - + - + - + - + @@ -85,25 +85,25 @@ - + - + - + - + @@ -111,25 +111,25 @@ - + - + - + - + @@ -137,145 +137,145 @@ - + - + - + - + - + - + - + - + - + - + - + -
[Mesa-dev] [PATCH 17/20] glapi/es3.1: Add support for GLES versions > 3.0
From: Ian Romanick Make the checks in the Python script and the generated code more generic to support arbitrary GLES versions >= 2.0. The updated dispatch_sanity.cpp test discovered this problem. Without this, the next patch would erroneously enable GLES 3.1 functions in GLES 2.0 and GLES 3.0. Signed-off-by: Ian Romanick --- src/mapi/glapi/gen/gl_genexec.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py index 7151f0d..e58cdfc 100644 --- a/src/mapi/glapi/gen/gl_genexec.py +++ b/src/mapi/glapi/gen/gl_genexec.py @@ -183,8 +183,8 @@ class PrintCode(gl_XML.gl_print_base): if 'es1' in f.api_map: condition_parts.append('ctx->API == API_OPENGLES') if 'es2' in f.api_map: -if f.api_map['es2'] == 3: -condition_parts.append('_mesa_is_gles3(ctx)') +if f.api_map['es2'] > 2.0: +condition_parts.append('(ctx->API == API_OPENGLES2 && ctx->Version >= {})'.format(int(f.api_map['es2'] * 10))) else: condition_parts.append('ctx->API == API_OPENGLES2') if not condition_parts: -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/20] mesa: Trivial coding standards cleanups
From: Ian Romanick Signed-off-by: Ian Romanick --- src/mesa/main/version.c | 25 ++--- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 85d5ab1..88dba24 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -35,20 +35,13 @@ static bool check_for_ending(const char *string, const char *ending) { - int len1, len2; + const size_t len1 = strlen(string); + const size_t len2 = strlen(ending); - len1 = strlen(string); - len2 = strlen(ending); - - if (len2 > len1) { + if (len2 > len1) return false; - } - if (strcmp(string + (len1 - len2), ending) == 0) { - return true; - } else { - return false; - } + return strcmp(string + (len1 - len2), ending) == 0; } /** @@ -77,12 +70,14 @@ get_gl_override(int *version, bool *fwd_context, bool *compat_context) n = sscanf(version_str, "%u.%u", &major, &minor); if (n != 2) { -fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version_str); +fprintf(stderr, "error: invalid value for %s: %s\n", +env_var, version_str); override_version = 0; } else { override_version = major * 10 + minor; if (override_version < 30 && fc_suffix) { - fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version_str); + fprintf(stderr, "error: invalid value for %s: %s\n", + env_var, version_str); } } } @@ -301,7 +296,7 @@ compute_version(const struct gl_extensions *extensions, extensions->ARB_gpu_shader5 && extensions->ARB_gpu_shader_fp64 && extensions->ARB_sample_shading && - 0/*extensions->ARB_shader_subroutine*/ && + false /*extensions->ARB_shader_subroutine*/ && extensions->ARB_tessellation_shader && extensions->ARB_texture_buffer_object_rgb32 && extensions->ARB_texture_cube_map_array && @@ -312,7 +307,7 @@ compute_version(const struct gl_extensions *extensions, consts->GLSLVersion >= 410 && extensions->ARB_ES2_compatibility && extensions->ARB_shader_precision && - 0/*extensions->ARB_vertex_attrib_64bit*/ && + false /*extensions->ARB_vertex_attrib_64bit*/ && extensions->ARB_viewport_array); const bool ver_4_2 = (ver_4_1 && consts->GLSLVersion >= 420 && -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/20] glsl/es3.1: Allow atomic counters in GLSL ES 3.10
From: Ian Romanick Signed-off-by: Ian Romanick --- src/glsl/builtin_variables.cpp | 35 +++ src/glsl/glsl_parser_extras.cpp | 10 ++ src/glsl/glsl_parser_extras.h | 12 +++- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp index 9d0b272..6806aa1 100644 --- a/src/glsl/builtin_variables.cpp +++ b/src/glsl/builtin_variables.cpp @@ -656,16 +656,43 @@ builtin_variable_generator::generate_constants() if (state->has_atomic_counters()) { add_const("gl_MaxVertexAtomicCounters", state->Const.MaxVertexAtomicCounters); - add_const("gl_MaxGeometryAtomicCounters", -state->Const.MaxGeometryAtomicCounters); add_const("gl_MaxFragmentAtomicCounters", state->Const.MaxFragmentAtomicCounters); add_const("gl_MaxCombinedAtomicCounters", state->Const.MaxCombinedAtomicCounters); add_const("gl_MaxAtomicCounterBindings", state->Const.MaxAtomicBufferBindings); - add_const("gl_MaxTessControlAtomicCounters", 0); - add_const("gl_MaxTessEvaluationAtomicCounters", 0); + + /* When Mesa adds support for GL_OES_geometry_shader and + * GL_OES_tessellation_shader, this will need to change. + */ + if (!state->es_shader) { + add_const("gl_MaxGeometryAtomicCounters", + state->Const.MaxGeometryAtomicCounters); + add_const("gl_MaxTessControlAtomicCounters", 0); + add_const("gl_MaxTessEvaluationAtomicCounters", 0); + } + } + + if (state->is_version(420, 310)) { + add_const("gl_MaxVertexAtomicCounterBuffers", +state->Const.MaxVertexAtomicCounterBuffers); + add_const("gl_MaxFragmentAtomicCounterBuffers", +state->Const.MaxFragmentAtomicCounterBuffers); + add_const("gl_MaxCombinedAtomicCounterBuffers", +state->Const.MaxCombinedAtomicCounterBuffers); + add_const("gl_MaxAtomicCounterBufferSize", +state->Const.MaxAtomicCounterBufferSize); + + /* When Mesa adds support for GL_OES_geometry_shader and + * GL_OES_tessellation_shader, this will need to change. + */ + if (!state->es_shader) { + add_const("gl_MaxGeometryAtomicCounterBuffers", + state->Const.MaxGeometryAtomicCounterBuffers); + add_const("gl_MaxTessControlAtomicCounterBuffers", 0); + add_const("gl_MaxTessEvaluationAtomicCounterBuffers", 0); + } } if (state->is_version(430, 0) || state->ARB_compute_shader_enable) { diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 91f225e..59e1d6e 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -117,6 +117,16 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->Const.MaxFragmentAtomicCounters = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicCounters; this->Const.MaxCombinedAtomicCounters = ctx->Const.MaxCombinedAtomicCounters; this->Const.MaxAtomicBufferBindings = ctx->Const.MaxAtomicBufferBindings; + this->Const.MaxVertexAtomicCounterBuffers = + ctx->Const.Program[MESA_SHADER_VERTEX].MaxAtomicBuffers; + this->Const.MaxGeometryAtomicCounterBuffers = + ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicBuffers; + this->Const.MaxFragmentAtomicCounterBuffers = + ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicBuffers; + this->Const.MaxCombinedAtomicCounterBuffers = + ctx->Const.MaxCombinedAtomicBuffers; + this->Const.MaxAtomicCounterBufferSize = + ctx->Const.MaxAtomicBufferSize; /* Compute shader constants */ for (unsigned i = 0; i < ARRAY_SIZE(this->Const.MaxComputeWorkGroupCount); i++) diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 61d4c93..42b7442 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -192,7 +192,7 @@ struct _mesa_glsl_parse_state { bool has_atomic_counters() const { - return ARB_shader_atomic_counters_enable || is_version(400, 0); + return ARB_shader_atomic_counters_enable || is_version(400, 310); } bool has_explicit_attrib_stream() const @@ -353,6 +353,16 @@ struct _mesa_glsl_parse_state { unsigned MaxCombinedAtomicCounters; unsigned MaxAtomicBufferBindings; + /* These are also atomic counter related, but they weren't added to + * until atomic counters were added to core in GLSL 4.20 and GLSL ES + * 3.10. + */ + unsigned MaxVertexAtomicCounterBuffers; + unsigned MaxGeometryAtomicCounterBuffers; + unsigned MaxFragmentAtomicCounterBuffers; + unsigned MaxCombinedAtomicCounterBuffers; + unsigned MaxAtomicCounterBufferSize; + /* ARB_compute_shader */ unsigned MaxComputeWorkGroupCount[3]; unsigned MaxComputeWorkGroupSize[3]; -
[Mesa-dev] [PATCH 00/20] Begin enabling OpenGL ES 3.1
There's still a fair amount functionality left to be implemented before GLES 3.1 can actually be enabled. Compute shaders and SSBOs are the biggest things left to finish. This series just allows people to start testing the things that are implemented. To get a GLES 3.1 context, set the environment variable MESA_GL_VERSION_OVERRIDE=3.1 The GLES3 experience taught me that there is a huge pile of little differences between GLES and desktop GL... and it takes a really, really long time to get those ironed out enough to pass Khronos conformance tests. Getting the initial boiler plate stuff out now lets people start testing and fixing sooner. This is also available in the gles3.1-enabling branch of my fd.o tree at git://people.freedesktop.org/~idr/mesa. I have tested this with the glsl-es-3.10 patches that I just sent to the piglit list. I get the expected set of passes and failures from the minimum-maximums.txt test. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 08/20] mesa/es3.1: Add _mesa_is_gles31 helper
From: Ian Romanick Signed-off-by: Ian Romanick --- src/mesa/main/context.h | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index d11027d..6f3c941 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -303,7 +303,7 @@ _mesa_is_gles(const struct gl_context *ctx) /** - * Checks if the context is for GLES 3.x + * Checks if the context is for GLES 3.0 or later */ static inline bool _mesa_is_gles3(const struct gl_context *ctx) @@ -313,6 +313,16 @@ _mesa_is_gles3(const struct gl_context *ctx) /** + * Checks if the context is for GLES 3.1 or later + */ +static inline bool +_mesa_is_gles31(const struct gl_context *ctx) +{ + return ctx->API == API_OPENGLES2 && ctx->Version >= 31; +} + + +/** * Checks if the context supports geometry shaders. */ static inline bool -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 14/20] glsl/es3.1: Allow enhnaced packing functions in GLSL ES 3.10
From: Ian Romanick Signed-off-by: Ian Romanick --- src/glsl/builtin_functions.cpp | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp index 435d926..72fb5e0 100644 --- a/src/glsl/builtin_functions.cpp +++ b/src/glsl/builtin_functions.cpp @@ -220,10 +220,11 @@ gpu_shader5(const _mesa_glsl_parse_state *state) } static bool -shader_packing_or_gpu_shader5(const _mesa_glsl_parse_state *state) +shader_packing_or_es31_or_gpu_shader5(const _mesa_glsl_parse_state *state) { return state->ARB_shading_language_packing_enable || - gpu_shader5(state); + state->ARB_gpu_shader5_enable || + state->is_version(400, 310); } static bool @@ -1162,12 +1163,12 @@ builtin_builder::create_builtins() add_function("packUnorm2x16", _packUnorm2x16(shader_packing_or_es3_or_gpu_shader5), NULL); add_function("packSnorm2x16", _packSnorm2x16(shader_packing_or_es3), NULL); - add_function("packUnorm4x8", _packUnorm4x8(shader_packing_or_gpu_shader5), NULL); - add_function("packSnorm4x8", _packSnorm4x8(shader_packing_or_gpu_shader5), NULL); + add_function("packUnorm4x8", _packUnorm4x8(shader_packing_or_es31_or_gpu_shader5), NULL); + add_function("packSnorm4x8", _packSnorm4x8(shader_packing_or_es31_or_gpu_shader5), NULL); add_function("unpackUnorm2x16", _unpackUnorm2x16(shader_packing_or_es3_or_gpu_shader5), NULL); add_function("unpackSnorm2x16", _unpackSnorm2x16(shader_packing_or_es3), NULL); - add_function("unpackUnorm4x8", _unpackUnorm4x8(shader_packing_or_gpu_shader5), NULL); - add_function("unpackSnorm4x8", _unpackSnorm4x8(shader_packing_or_gpu_shader5), NULL); + add_function("unpackUnorm4x8", _unpackUnorm4x8(shader_packing_or_es31_or_gpu_shader5), NULL); + add_function("unpackSnorm4x8", _unpackSnorm4x8(shader_packing_or_es31_or_gpu_shader5), NULL); add_function("packHalf2x16",_packHalf2x16(shader_packing_or_es3), NULL); add_function("unpackHalf2x16", _unpackHalf2x16(shader_packing_or_es3), NULL); add_function("packDouble2x32",_packDouble2x32(fp64), NULL); -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 15/20] glsl/es3.1: Allow textureGather and textureGatherOffset in GLSL ES 3.10
From: Ian Romanick Signed-off-by: Ian Romanick --- src/glsl/builtin_functions.cpp | 90 -- 1 file changed, 61 insertions(+), 29 deletions(-) diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp index 72fb5e0..b202b39 100644 --- a/src/glsl/builtin_functions.cpp +++ b/src/glsl/builtin_functions.cpp @@ -136,6 +136,12 @@ v140(const _mesa_glsl_parse_state *state) } static bool +es31(const _mesa_glsl_parse_state *state) +{ + return state->is_version(0, 310); +} + +static bool texture_rectangle(const _mesa_glsl_parse_state *state) { return state->ARB_texture_rectangle_enable; @@ -220,6 +226,12 @@ gpu_shader5(const _mesa_glsl_parse_state *state) } static bool +gpu_shader5_or_es31(const _mesa_glsl_parse_state *state) +{ + return state->is_version(400, 310) || state->ARB_gpu_shader5_enable; +} + +static bool shader_packing_or_es31_or_gpu_shader5(const _mesa_glsl_parse_state *state) { return state->ARB_shading_language_packing_enable || @@ -299,15 +311,24 @@ texture_gather(const _mesa_glsl_parse_state *state) state->ARB_gpu_shader5_enable; } +static bool +texture_gather_or_es31(const _mesa_glsl_parse_state *state) +{ + return state->is_version(400, 310) || + state->ARB_texture_gather_enable || + state->ARB_gpu_shader5_enable; +} + /* Only ARB_texture_gather but not GLSL 4.0 or ARB_gpu_shader5. * used for relaxation of const offset requirements. */ static bool -texture_gather_only(const _mesa_glsl_parse_state *state) +texture_gather_only_or_es31(const _mesa_glsl_parse_state *state) { return !state->is_version(400, 0) && !state->ARB_gpu_shader5_enable && - state->ARB_texture_gather_enable; + (state->ARB_texture_gather_enable || + state->is_version(0, 310)); } /* Desktop GL or OES_standard_derivatives + fragment shader only */ @@ -2204,61 +2225,69 @@ builtin_builder::create_builtins() NULL); add_function("textureGather", -_texture(ir_tg4, texture_gather, glsl_type::vec4_type, glsl_type::sampler2D_type, glsl_type::vec2_type), -_texture(ir_tg4, texture_gather, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type), -_texture(ir_tg4, texture_gather, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type), +_texture(ir_tg4, texture_gather_or_es31, glsl_type::vec4_type, glsl_type::sampler2D_type, glsl_type::vec2_type), +_texture(ir_tg4, texture_gather_or_es31, glsl_type::ivec4_type, glsl_type::isampler2D_type, glsl_type::vec2_type), +_texture(ir_tg4, texture_gather_or_es31, glsl_type::uvec4_type, glsl_type::usampler2D_type, glsl_type::vec2_type), _texture(ir_tg4, gpu_shader5, glsl_type::vec4_type, glsl_type::sampler2DRect_type, glsl_type::vec2_type), _texture(ir_tg4, gpu_shader5, glsl_type::ivec4_type, glsl_type::isampler2DRect_type, glsl_type::vec2_type), _texture(ir_tg4, gpu_shader5, glsl_type::uvec4_type, glsl_type::usampler2DRect_type, glsl_type::vec2_type), -_texture(ir_tg4, texture_gather, glsl_type::vec4_type, glsl_type::sampler2DArray_type, glsl_type::vec3_type), -_texture(ir_tg4, texture_gather, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type), -_texture(ir_tg4, texture_gather, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type), +_texture(ir_tg4, texture_gather_or_es31, glsl_type::vec4_type, glsl_type::sampler2DArray_type, glsl_type::vec3_type), +_texture(ir_tg4, texture_gather_or_es31, glsl_type::ivec4_type, glsl_type::isampler2DArray_type, glsl_type::vec3_type), +_texture(ir_tg4, texture_gather_or_es31, glsl_type::uvec4_type, glsl_type::usampler2DArray_type, glsl_type::vec3_type), -_texture(ir_tg4, texture_gather, glsl_type::vec4_type, glsl_type::samplerCube_type, glsl_type::vec3_type), -_texture(ir_tg4, texture_gather, glsl_type::ivec4_type, glsl_type::isamplerCube_type, glsl_type::vec3_type), -_texture(ir_tg4, texture_gather, glsl_type::uvec4_type, glsl_type::usamplerCube_type, glsl_type::vec3_type), +_texture(ir_tg4, texture_gather_or_es31, glsl_type::vec4_type, glsl_type::samplerCube_type, glsl_type::vec3_type), +_texture(ir_tg4, texture_gather_or_es31, glsl_type::ivec4_type, glsl_type::isamplerCube_type, glsl_type::vec3_type), +_texture(ir_tg4, texture_gather_or_es31, glsl_type::uvec4_type, glsl_type::usamplerCube_type, glsl_type::vec3_type), _texture(ir_tg4, texture_gather, glsl_type::vec4_type, glsl_type::samplerCubeArray_type, glsl_type::vec4_type), _texture(ir_tg4, texture_gather, glsl_type::ivec4_type, glsl_type::isamp
[Mesa-dev] [PATCH 11/20] glsl/es3.1: Allow separate shader objects in GLSL ES 3.10
From: Ian Romanick Signed-off-by: Ian Romanick --- src/glsl/glsl_parser_extras.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 552d589..61d4c93 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -160,7 +160,7 @@ struct _mesa_glsl_parse_state { { if (!this->has_separate_shader_objects()) { const char *const requirement = this->es_shader -? "GL_EXT_separate_shader_objects extension" +? "GL_EXT_separate_shader_objects extension or GLSL ES 310" : "GL_ARB_separate_shader_objects extension or GLSL 420"; _mesa_glsl_error(locp, this, "%s explicit location requires %s", @@ -217,7 +217,7 @@ struct _mesa_glsl_parse_state { bool has_separate_shader_objects() const { - return ARB_separate_shader_objects_enable || is_version(410, 0) + return ARB_separate_shader_objects_enable || is_version(410, 310) || EXT_separate_shader_objects_enable; } -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/20] glsl: Add glsl_parser_state::has_atomic_counters helper
From: Ian Romanick Signed-off-by: Ian Romanick --- src/glsl/builtin_functions.cpp | 2 +- src/glsl/builtin_types.cpp | 2 +- src/glsl/builtin_variables.cpp | 2 +- src/glsl/glsl_parser.yy| 4 ++-- src/glsl/glsl_parser_extras.h | 5 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp index 524b8d6..5ce8112 100644 --- a/src/glsl/builtin_functions.cpp +++ b/src/glsl/builtin_functions.cpp @@ -359,7 +359,7 @@ tex3d_lod(const _mesa_glsl_parse_state *state) static bool shader_atomic_counters(const _mesa_glsl_parse_state *state) { - return state->ARB_shader_atomic_counters_enable; + return state->has_atomic_counters(); } static bool diff --git a/src/glsl/builtin_types.cpp b/src/glsl/builtin_types.cpp index fef86df..d92e2eb 100644 --- a/src/glsl/builtin_types.cpp +++ b/src/glsl/builtin_types.cpp @@ -372,7 +372,7 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state) add_type(symbols, glsl_type::uimage2DMSArray_type); } - if (state->ARB_shader_atomic_counters_enable) { + if (state->has_atomic_counters()) { add_type(symbols, glsl_type::atomic_uint_type); } diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp index 21e7331..9d0b272 100644 --- a/src/glsl/builtin_variables.cpp +++ b/src/glsl/builtin_variables.cpp @@ -653,7 +653,7 @@ builtin_variable_generator::generate_constants() add_const("gl_MaxTextureCoords", state->Const.MaxTextureCoords); } - if (state->ARB_shader_atomic_counters_enable) { + if (state->has_atomic_counters()) { add_const("gl_MaxVertexAtomicCounters", state->Const.MaxVertexAtomicCounters); add_const("gl_MaxGeometryAtomicCounters", diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index aceb3b9..b34d7ef 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -1404,13 +1404,13 @@ layout_qualifier_id: } if ((state->ARB_shading_language_420pack_enable || - state->ARB_shader_atomic_counters_enable) && + state->has_atomic_counters()) && match_layout_qualifier("binding", $1, state) == 0) { $$.flags.q.explicit_binding = 1; $$.binding = $3; } - if (state->ARB_shader_atomic_counters_enable && + if (state->has_atomic_counters() && match_layout_qualifier("offset", $1, state) == 0) { $$.flags.q.explicit_offset = 1; $$.offset = $3; diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index dae7864..382c200 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -186,6 +186,11 @@ struct _mesa_glsl_parse_state { return true; } + bool has_atomic_counters() const + { + return ARB_shader_atomic_counters_enable || is_version(400, 0); + } + bool has_explicit_attrib_stream() const { return ARB_gpu_shader5_enable || is_version(400, 0); -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/20] SQUASH! whitespace fixes after previous commit
From: Ian Romanick Signed-off-by: Ian Romanick --- src/mesa/main/version.c | 261 1 file changed, 130 insertions(+), 131 deletions(-) diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 7bf3f49..85d5ab1 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -58,8 +58,7 @@ check_for_ending(const char *string, const char *ending) * fwd_context is only valid if version > 0 */ static void -get_gl_override(int *version, bool *fwd_context, -bool *compat_context) +get_gl_override(int *version, bool *fwd_context, bool *compat_context) { const char *env_var = "MESA_GL_VERSION_OVERRIDE"; const char *version_str; @@ -212,120 +211,120 @@ compute_version(const struct gl_extensions *extensions, GLuint major, minor, version; const bool ver_1_3 = (extensions->ARB_texture_border_clamp && - extensions->ARB_texture_cube_map && - extensions->ARB_texture_env_combine && - extensions->ARB_texture_env_dot3); + extensions->ARB_texture_cube_map && + extensions->ARB_texture_env_combine && + extensions->ARB_texture_env_dot3); const bool ver_1_4 = (ver_1_3 && - extensions->ARB_depth_texture && - extensions->ARB_shadow && - extensions->ARB_texture_env_crossbar && - extensions->EXT_blend_color && - extensions->EXT_blend_func_separate && - extensions->EXT_blend_minmax && - extensions->EXT_point_parameters); + extensions->ARB_depth_texture && + extensions->ARB_shadow && + extensions->ARB_texture_env_crossbar && + extensions->EXT_blend_color && + extensions->EXT_blend_func_separate && + extensions->EXT_blend_minmax && + extensions->EXT_point_parameters); const bool ver_1_5 = (ver_1_4 && - extensions->ARB_occlusion_query); + extensions->ARB_occlusion_query); const bool ver_2_0 = (ver_1_5 && - extensions->ARB_point_sprite && - extensions->ARB_vertex_shader && - extensions->ARB_fragment_shader && - extensions->ARB_texture_non_power_of_two && - extensions->EXT_blend_equation_separate && - - /* Technically, 2.0 requires the functionality - * of the EXT version. Enable 2.0 if either - * extension is available, and assume that a - * driver that only exposes the ATI extension - * will fallback to software when necessary. - */ - (extensions->EXT_stencil_two_side - || extensions->ATI_separate_stencil)); + extensions->ARB_point_sprite && + extensions->ARB_vertex_shader && + extensions->ARB_fragment_shader && + extensions->ARB_texture_non_power_of_two && + extensions->EXT_blend_equation_separate && + + /* Technically, 2.0 requires the functionality of the + * EXT version. Enable 2.0 if either extension is + * available, and assume that a driver that only + * exposes the ATI extension will fallback to + * software when necessary. + */ + (extensions->EXT_stencil_two_side + || extensions->ATI_separate_stencil)); const bool ver_2_1 = (ver_2_0 && - extensions->EXT_pixel_buffer_object && - extensions->EXT_texture_sRGB); + extensions->EXT_pixel_buffer_object && + extensions->EXT_texture_sRGB); const bool ver_3_0 = (ver_2_1 && - consts->GLSLVersion >= 130 && - (consts->MaxSamples >= 4 || consts->FakeSWMSAA) && - (api == API_OPENGL_CORE || - extensions->ARB_color_buffer_float) && - extensions->ARB_depth_buffer_float && - extensions->ARB_half_float_vertex && - extensions->ARB_map_buffer_range && - extensions->ARB_shader_texture_lod
[Mesa-dev] [PATCH 16/20] glsl/es3.1: Allow misc ARB_gpu_shader5 built-ins in GLSL ES 3.10
From: Ian Romanick Signed-off-by: Ian Romanick --- src/glsl/builtin_functions.cpp | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp index b202b39..1df6956 100644 --- a/src/glsl/builtin_functions.cpp +++ b/src/glsl/builtin_functions.cpp @@ -4479,7 +4479,7 @@ builtin_builder::_bitfieldExtract(const glsl_type *type) ir_variable *value = in_var(type, "value"); ir_variable *offset = in_var(glsl_type::int_type, "offset"); ir_variable *bits = in_var(glsl_type::int_type, "bits"); - MAKE_SIG(type, gpu_shader5, 3, value, offset, bits); + MAKE_SIG(type, gpu_shader5_or_es31, 3, value, offset, bits); body.emit(ret(expr(ir_triop_bitfield_extract, value, offset, bits))); @@ -4493,33 +4493,33 @@ builtin_builder::_bitfieldInsert(const glsl_type *type) ir_variable *insert = in_var(type, "insert"); ir_variable *offset = in_var(glsl_type::int_type, "offset"); ir_variable *bits = in_var(glsl_type::int_type, "bits"); - MAKE_SIG(type, gpu_shader5, 4, base, insert, offset, bits); + MAKE_SIG(type, gpu_shader5_or_es31, 4, base, insert, offset, bits); body.emit(ret(bitfield_insert(base, insert, offset, bits))); return sig; } -UNOP(bitfieldReverse, ir_unop_bitfield_reverse, gpu_shader5) +UNOP(bitfieldReverse, ir_unop_bitfield_reverse, gpu_shader5_or_es31) ir_function_signature * builtin_builder::_bitCount(const glsl_type *type) { - return unop(gpu_shader5, ir_unop_bit_count, + return unop(gpu_shader5_or_es31, ir_unop_bit_count, glsl_type::ivec(type->vector_elements), type); } ir_function_signature * builtin_builder::_findLSB(const glsl_type *type) { - return unop(gpu_shader5, ir_unop_find_lsb, + return unop(gpu_shader5_or_es31, ir_unop_find_lsb, glsl_type::ivec(type->vector_elements), type); } ir_function_signature * builtin_builder::_findMSB(const glsl_type *type) { - return unop(gpu_shader5, ir_unop_find_msb, + return unop(gpu_shader5_or_es31, ir_unop_find_msb, glsl_type::ivec(type->vector_elements), type); } @@ -4539,7 +4539,7 @@ builtin_builder::_fma(builtin_available_predicate avail, const glsl_type *type) ir_function_signature * builtin_builder::_ldexp(const glsl_type *x_type, const glsl_type *exp_type) { - return binop(ir_binop_ldexp, x_type->base_type == GLSL_TYPE_DOUBLE ? fp64 : gpu_shader5, x_type, x_type, exp_type); + return binop(ir_binop_ldexp, x_type->base_type == GLSL_TYPE_DOUBLE ? fp64 : gpu_shader5_or_es31, x_type, x_type, exp_type); } ir_function_signature * @@ -4560,7 +4560,7 @@ builtin_builder::_frexp(const glsl_type *x_type, const glsl_type *exp_type) { ir_variable *x = in_var(x_type, "x"); ir_variable *exponent = out_var(exp_type, "exp"); - MAKE_SIG(x_type, gpu_shader5, 2, x, exponent); + MAKE_SIG(x_type, gpu_shader5_or_es31, 2, x, exponent); const unsigned vec_elem = x_type->vector_elements; const glsl_type *bvec = glsl_type::get_instance(GLSL_TYPE_BOOL, vec_elem, 1); @@ -4609,7 +4609,7 @@ builtin_builder::_uaddCarry(const glsl_type *type) ir_variable *x = in_var(type, "x"); ir_variable *y = in_var(type, "y"); ir_variable *carry = out_var(type, "carry"); - MAKE_SIG(type, gpu_shader5, 3, x, y, carry); + MAKE_SIG(type, gpu_shader5_or_es31, 3, x, y, carry); body.emit(assign(carry, ir_builder::carry(x, y))); body.emit(ret(add(x, y))); @@ -4623,7 +4623,7 @@ builtin_builder::_usubBorrow(const glsl_type *type) ir_variable *x = in_var(type, "x"); ir_variable *y = in_var(type, "y"); ir_variable *borrow = out_var(type, "borrow"); - MAKE_SIG(type, gpu_shader5, 3, x, y, borrow); + MAKE_SIG(type, gpu_shader5_or_es31, 3, x, y, borrow); body.emit(assign(borrow, ir_builder::borrow(x, y))); body.emit(ret(sub(x, y))); @@ -4641,7 +4641,7 @@ builtin_builder::_mulExtended(const glsl_type *type) ir_variable *y = in_var(type, "y"); ir_variable *msb = out_var(type, "msb"); ir_variable *lsb = out_var(type, "lsb"); - MAKE_SIG(glsl_type::void_type, gpu_shader5, 4, x, y, msb, lsb); + MAKE_SIG(glsl_type::void_type, gpu_shader5_or_es31, 4, x, y, msb, lsb); body.emit(assign(msb, imul_high(x, y))); body.emit(assign(lsb, mul(x, y))); -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 19/20] mesa/es3.1: Enable ES 3.1 API and shading language version
From: Ian Romanick This is a bit of a hack for now. Several of the extensions required for OpenGL ES 3.1 have no support, at all, in Mesa. However, with this patch and a patch to allow MESA_GL_VERSION_OVERRIDE to work with ES contexts, people can begin testing the ES "version" of the functionality that is supported. Signed-off-by: Ian Romanick --- src/mesa/main/getstring.c | 16 src/mesa/main/version.c | 18 +- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index 1b2c7f0..72d99ca 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -72,10 +72,18 @@ shading_language_version(struct gl_context *ctx) break; case API_OPENGLES2: - return (ctx->Version < 30) - ? (const GLubyte *) "OpenGL ES GLSL ES 1.0.16" - : (const GLubyte *) "OpenGL ES GLSL ES 3.00"; - + switch (ctx->Version) { + case 20: + return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16"; + case 30: + return (const GLubyte *) "OpenGL ES GLSL ES 3.00"; + case 31: + return (const GLubyte *) "OpenGL ES GLSL ES 3.10"; + default: + _mesa_problem(ctx, + "Invalid OpenGL ES version in shading_language_version()"); + return (const GLubyte *) 0; + } case API_OPENGLES: /* fall-through */ diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 88dba24..1c19277 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -433,7 +433,23 @@ compute_version_es2(const struct gl_extensions *extensions) extensions->EXT_texture_snorm && extensions->NV_primitive_restart && extensions->OES_depth_texture_cube_map); - if (ver_3_0) { + const bool ver_3_1 = (ver_3_0 && + extensions->ARB_arrays_of_arrays && + extensions->ARB_compute_shader && + extensions->ARB_draw_indirect && + false /*extensions->ARB_framebuffer_no_attachments*/ && + extensions->ARB_shader_atomic_counters && + extensions->ARB_shader_image_load_store && + false /*extensions->ARB_shader_image_size*/ && + false /*extensions->ARB_shader_storage_buffer_object*/ && + extensions->ARB_shading_language_packing && + extensions->ARB_stencil_texturing && + extensions->ARB_gpu_shader5 && + extensions->EXT_shader_integer_mix); + + if (ver_3_1) { + return 31; + } else if (ver_3_0) { return 30; } else if (ver_2_0) { return 20; -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 20/20] mesa: Allow MESA_GL_VERSION_OVERRIDE with ES contexts
On Wed, Apr 29, 2015 at 7:26 PM, Ian Romanick wrote: > From: Ian Romanick > > The bulk of the change is to prevent overriding the context to > API_OPENGL_CORE based on the requested version. If the context is > API_OPENGL_ES2, don't change it. > > Signed-off-by: Ian Romanick \o/-by: Rob Clark > --- > src/mesa/drivers/dri/common/dri_util.c | 4 > src/mesa/main/context.c| 4 +--- > src/mesa/main/version.c| 16 +--- > src/mesa/state_tracker/st_manager.c| 3 +-- > 4 files changed, 15 insertions(+), 12 deletions(-) > > diff --git a/src/mesa/drivers/dri/common/dri_util.c > b/src/mesa/drivers/dri/common/dri_util.c > index d6e875f..680a907 100644 > --- a/src/mesa/drivers/dri/common/dri_util.c > +++ b/src/mesa/drivers/dri/common/dri_util.c > @@ -163,6 +163,10 @@ driCreateNewScreen2(int scrn, int fd, > } > > int gl_version_override = _mesa_get_gl_version_override(); > +if (gl_version_override >= 20) { > + psp->max_gl_es2_version = MAX2(psp->max_gl_es2_version, > + gl_version_override); > +} > if (gl_version_override >= 31) { > psp->max_gl_core_version = MAX2(psp->max_gl_core_version, > gl_version_override); > diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c > index 4aaf8b1..cd1a02b 100644 > --- a/src/mesa/main/context.c > +++ b/src/mesa/main/context.c > @@ -1109,9 +1109,7 @@ _mesa_initialize_context(struct gl_context *ctx, >ctx->HasConfig = GL_FALSE; > } > > - if (_mesa_is_desktop_gl(ctx)) { > - _mesa_override_gl_version(ctx); > - } > + _mesa_override_gl_version(ctx); > > /* misc one-time initializations */ > one_time_init(ctx); > diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c > index 1c19277..f426342 100644 > --- a/src/mesa/main/version.c > +++ b/src/mesa/main/version.c > @@ -134,13 +134,15 @@ _mesa_override_gl_version_contextless(struct > gl_constants *consts, > > if (version > 0) { >*versionOut = version; > - if (version >= 30 && fwd_context) { > - *apiOut = API_OPENGL_CORE; > - consts->ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT; > - } else if (version >= 31 && !compat_context) { > - *apiOut = API_OPENGL_CORE; > - } else { > - *apiOut = API_OPENGL_COMPAT; > + if (*apiOut == API_OPENGL_CORE || *apiOut == API_OPENGL_COMPAT) { > + if (version >= 30 && fwd_context) { > +*apiOut = API_OPENGL_CORE; > +consts->ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT; > + } else if (version >= 31 && !compat_context) { > +*apiOut = API_OPENGL_CORE; > + } else { > +*apiOut = API_OPENGL_COMPAT; > + } >} >return true; > } > diff --git a/src/mesa/state_tracker/st_manager.c > b/src/mesa/state_tracker/st_manager.c > index 840f76a..1b3b4cb 100644 > --- a/src/mesa/state_tracker/st_manager.c > +++ b/src/mesa/state_tracker/st_manager.c > @@ -920,8 +920,7 @@ static unsigned get_version(struct pipe_screen *screen, > struct gl_extensions extensions = {0}; > GLuint version; > > - if ((api == API_OPENGL_COMPAT || api == API_OPENGL_CORE) && > - _mesa_override_gl_version_contextless(&consts, &api, &version)) { > + if (_mesa_override_gl_version_contextless(&consts, &api, &version)) { >return version; > } > > -- > 2.1.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/20] glsl: Silence unused parameter warnings
On Wed, Apr 29, 2015 at 4:25 PM, Ian Romanick wrote: > From: Ian Romanick > > I opted to comment out "last_field" because it was not obvious what the > meaning of the dangling bool would be. For the other parameters, the > meaning was more intuitive without the name. > > link_uniform_blocks.cpp:70:65: warning: unused parameter 'name' > [-Wunused-parameter] > virtual void enter_record(const glsl_type *type, const char *name, > ^ > link_uniform_blocks.cpp:77:65: warning: unused parameter 'name' > [-Wunused-parameter] > virtual void leave_record(const glsl_type *type, const char *name, > ^ > link_uniform_blocks.cpp:93:62: warning: unused parameter 'record_type' > [-Wunused-parameter] > bool row_major, const glsl_type *record_type, > ^ > link_uniform_blocks.cpp:94:34: warning: unused parameter 'last_field' > [-Wunused-parameter] > bool last_field) > ^ > link_uniforms.cpp:547:65: warning: unused parameter 'name' > [-Wunused-parameter] > virtual void enter_record(const glsl_type *type, const char *name, > ^ > link_uniforms.cpp:556:65: warning: unused parameter 'name' > [-Wunused-parameter] > virtual void leave_record(const glsl_type *type, const char *name, > ^ > link_uniforms.cpp:567:34: warning: unused parameter 'last_field' > [-Wunused-parameter] > bool last_field) > ^ > > Signed-off-by: Ian Romanick > --- > src/glsl/link_uniform_blocks.cpp | 8 > src/glsl/link_uniforms.cpp | 6 +++--- > 2 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/src/glsl/link_uniform_blocks.cpp > b/src/glsl/link_uniform_blocks.cpp > index 6ca4110..898544b 100644 > --- a/src/glsl/link_uniform_blocks.cpp > +++ b/src/glsl/link_uniform_blocks.cpp > @@ -67,14 +67,14 @@ private: >assert(!"Should not get here."); > } > > - virtual void enter_record(const glsl_type *type, const char *name, > + virtual void enter_record(const glsl_type *type, const char *, > bool row_major) { >assert(type->is_record()); >this->offset = glsl_align( > this->offset, type->std140_base_alignment(row_major)); > } > > - virtual void leave_record(const glsl_type *type, const char *name, > + virtual void leave_record(const glsl_type *type, const char *, > bool row_major) { >assert(type->is_record()); > > @@ -90,8 +90,8 @@ private: > } > > virtual void visit_field(const glsl_type *type, const char *name, > -bool row_major, const glsl_type *record_type, > -bool last_field) > +bool row_major, const glsl_type *, > +bool /* last_field */) > { >assert(this->index < this->num_variables); > > diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp > index d5ca23a..2c928e1 100644 > --- a/src/glsl/link_uniforms.cpp > +++ b/src/glsl/link_uniforms.cpp > @@ -544,7 +544,7 @@ private: >assert(!"Should not get here."); > } > > - virtual void enter_record(const glsl_type *type, const char *name, > + virtual void enter_record(const glsl_type *type, const char *, > bool row_major) { >assert(type->is_record()); >if (this->ubo_block_index == -1) > @@ -553,7 +553,7 @@ private: > this->ubo_byte_offset, type->std140_base_alignment(row_major)); > } > > - virtual void leave_record(const glsl_type *type, const char *name, > + virtual void leave_record(const glsl_type *type, const char *, > bool row_major) { >assert(type->is_record()); >if (this->ubo_block_index == -1) > @@ -564,7 +564,7 @@ private: > > virtual void visit_field(const glsl_type *type, const char *name, > bool row_major, const glsl_type *record_type, > -bool last_field) > +bool /* last_field */) > { >assert(!type->without_array()->is_record()); >assert(!type->without_array()->is_interface()); > -- > 2.1.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev Reviewed-by: Anuj Phogat ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 6/7] i965/cs: Implement brw_emit_gpgpu_walker
On 2015-04-27 19:02:38, Kenneth Graunke wrote: > On Friday, April 24, 2015 04:33:43 PM Jordan Justen wrote: > > Tested on Ivybridge, Haswell and Broadwell. > > > > Signed-off-by: Jordan Justen > > --- > > src/mesa/drivers/dri/i965/brw_compute.c | 39 > > - > > src/mesa/drivers/dri/i965/brw_defines.h | 1 + > > 2 files changed, 39 insertions(+), 1 deletion(-) > > > > diff --git a/src/mesa/drivers/dri/i965/brw_compute.c > > b/src/mesa/drivers/dri/i965/brw_compute.c > > index baed701..06ef448 100644 > > --- a/src/mesa/drivers/dri/i965/brw_compute.c > > +++ b/src/mesa/drivers/dri/i965/brw_compute.c > > @@ -31,12 +31,49 @@ > > #include "brw_draw.h" > > #include "brw_state.h" > > #include "intel_batchbuffer.h" > > +#include "brw_defines.h" > > > > > > static void > > brw_emit_gpgpu_walker(struct brw_context *brw, const GLuint *num_groups) > > { > > - _mesa_problem(&brw->ctx, "TODO: implement brw_emit_gpgpu_walker"); > > + const struct brw_cs_prog_data *prog_data = brw->cs.prog_data; > > + > > + const unsigned simd_size = prog_data->simd_size; > > + unsigned group_size = prog_data->local_size[0] * > > + prog_data->local_size[1] * prog_data->local_size[2]; > > + unsigned thread_width_max = > > + (group_size + simd_size - 1) / simd_size; > > + > > + uint32_t right_mask = (1u << simd_size) - 1; > > + const unsigned right_non_aligned = group_size & (simd_size - 1); > > + if (right_non_aligned != 0) > > + right_mask >>= (simd_size - right_non_aligned); > > I think this is equvalent to: > > uint32_t right_mask = (1u << (simd_size - (group_size % simd_size))) - 1; > > which might be a bit simpler... > > > + BEGIN_BATCH(dwords); > > + OUT_BATCH(GPGPU_WALKER << 16 | (dwords - 2)); > > I was going to suggest splitting this into separate Gen8+ and Gen7 > blocks, but now that I look at the code...these two are slightly > different indirect handling, and the later one is just a DWord of MBZ, > so...it's not really that different. I think what you have is fine :) > > > + uint32_t dwords = brw->gen < 8 ? 11 : 15; > > + OUT_BATCH(0); > > + if (brw->gen >= 8) { > > + OUT_BATCH(0); > > + OUT_BATCH(0); > > + } > > + assert(thread_width_max <= brw->max_cs_threads); > > + OUT_BATCH(((simd_size == 8) ? 0 : 1) << 30 | > > You might want to write this as ((simd_size / 8) - 1). That will work > for SIMD8/16/32. Good idea, but I think simd_size / 16 will be needed, since we need 2 for SIMD32. > Topi would probably suggest using SET_FIELD, i.e. > > #define BRW_GPGPU_SIMD_SIZE_SHIFT 30 > #define BRW_GPGPU_SIMD_SIZE_MASK INTEL_MASK(31, 30) > > SET_FIELD((simd_size / 8) - 1, BRW_GPGPU_SIMD_SIZE) > > It's probably a good idea here too. Will do. > > + (thread_width_max - 1)); > > Don't you need to set the thread height/depth maximums as well? > I'm not really sure how this works. We flatten the 3-dims out above in group_size, and then thread_width_max. So, this basically focuses getting it to execute the correct number of times. When height is not used, we can set bottom_mask to all 1's, and only use the right_mask. In terms of GLSL's gl_LocalInvocationID, that is a whole separate matter. (And a whole separate patch series! :) > > + OUT_BATCH(0); > > It'd be nice to label the 0's, i.e. Will do. Thanks for the review! -Jordan >OUT_BATCH(0); /* Thread Group ID Starting X */ >OUT_BATCH(num_groups[0]); /* Thread Group ID X Dimension */ > > With those changes, the whole series is: > Reviewed-by: Kenneth Graunke > > I haven't verified that these execution masks are really what you want. > You know more about this than I do. :) > > > + if (brw->gen >= 8) > > + OUT_BATCH(0); > > + OUT_BATCH(num_groups[0]); > > + OUT_BATCH(0); > > + if (brw->gen >= 8) > > + OUT_BATCH(0); > > + OUT_BATCH(num_groups[1]); > > + OUT_BATCH(0); > > + OUT_BATCH(num_groups[2]); > > + OUT_BATCH(right_mask); > > + OUT_BATCH(0x); > > + ADVANCE_BATCH(); > > } > > > > > > diff --git a/src/mesa/drivers/dri/i965/brw_defines.h > > b/src/mesa/drivers/dri/i965/brw_defines.h > > index 36f46af..cd25511 100644 > > --- a/src/mesa/drivers/dri/i965/brw_defines.h > > +++ b/src/mesa/drivers/dri/i965/brw_defines.h > > @@ -2451,5 +2451,6 @@ enum brw_wm_barycentric_interp_mode { > > > > #define MEDIA_VFE_STATE 0x7000 > > #define MEDIA_INTERFACE_DESCRIPTOR_LOAD 0x7002 > > +#define GPGPU_WALKER0x7105 > > > > #endif > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 12/20] glsl/es3.1: Allow interger mix built-ins in GLSL ES 3.10
In patch heading: s/interger/integer On Wed, Apr 29, 2015 at 4:26 PM, Ian Romanick wrote: > From: Ian Romanick > > Signed-off-by: Ian Romanick > --- > src/glsl/builtin_functions.cpp | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp > index 5ce8112..435d926 100644 > --- a/src/glsl/builtin_functions.cpp > +++ b/src/glsl/builtin_functions.cpp > @@ -194,7 +194,8 @@ shader_bit_encoding(const _mesa_glsl_parse_state *state) > static bool > shader_integer_mix(const _mesa_glsl_parse_state *state) > { > - return v130(state) && state->EXT_shader_integer_mix_enable; > + return state->is_version(450, 310) || > + v130(state) && state->EXT_shader_integer_mix_enable; > } > > static bool > -- > 2.1.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 12/20] glsl/es3.1: Allow interger mix built-ins in GLSL ES 3.10
On Wed, Apr 29, 2015 at 5:38 PM, Anuj Phogat wrote: > In patch heading: s/interger/integer > > On Wed, Apr 29, 2015 at 4:26 PM, Ian Romanick wrote: >> From: Ian Romanick >> >> Signed-off-by: Ian Romanick >> --- >> src/glsl/builtin_functions.cpp | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp >> index 5ce8112..435d926 100644 >> --- a/src/glsl/builtin_functions.cpp >> +++ b/src/glsl/builtin_functions.cpp >> @@ -194,7 +194,8 @@ shader_bit_encoding(const _mesa_glsl_parse_state *state) >> static bool >> shader_integer_mix(const _mesa_glsl_parse_state *state) >> { >> - return v130(state) && state->EXT_shader_integer_mix_enable; >> + return state->is_version(450, 310) || >> + v130(state) && state->EXT_shader_integer_mix_enable; >> } >> >> static bool >> -- >> 2.1.0 >> >> ___ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/mesa-dev Patches 1-12 are: Reviewed-by: Anuj Phogat ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 05/20] mesa: Use bool in _mesa_is_ helpers instead of GLboolean
For what it's worth, patches 1-5 are: Reviewed-by: Dylan Baker On Wed, Apr 29, 2015 at 04:25:56PM -0700, Ian Romanick wrote: > From: Ian Romanick > > Signed-off-by: Ian Romanick > --- > src/mesa/main/context.h | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h > index 1cd89a8..d11027d 100644 > --- a/src/mesa/main/context.h > +++ b/src/mesa/main/context.h > @@ -285,7 +285,7 @@ do { > \ > /** > * Checks if the context is for Desktop GL (Compatibility or Core) > */ > -static inline GLboolean > +static inline bool > _mesa_is_desktop_gl(const struct gl_context *ctx) > { > return ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGL_CORE; > @@ -295,7 +295,7 @@ _mesa_is_desktop_gl(const struct gl_context *ctx) > /** > * Checks if the context is for any GLES version > */ > -static inline GLboolean > +static inline bool > _mesa_is_gles(const struct gl_context *ctx) > { > return ctx->API == API_OPENGLES || ctx->API == API_OPENGLES2; > @@ -305,7 +305,7 @@ _mesa_is_gles(const struct gl_context *ctx) > /** > * Checks if the context is for GLES 3.x > */ > -static inline GLboolean > +static inline bool > _mesa_is_gles3(const struct gl_context *ctx) > { > return ctx->API == API_OPENGLES2 && ctx->Version >= 30; > @@ -315,7 +315,7 @@ _mesa_is_gles3(const struct gl_context *ctx) > /** > * Checks if the context supports geometry shaders. > */ > -static inline GLboolean > +static inline bool > _mesa_has_geometry_shaders(const struct gl_context *ctx) > { > return _mesa_is_desktop_gl(ctx) && > -- > 2.1.0 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: Digital signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 88275] [865G] Intel OpenGL rendering isn't starting
https://bugs.freedesktop.org/show_bug.cgi?id=88275 Sgt. Garcia changed: What|Removed |Added CC||darwinsker...@gmail.com -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 88275] [865G] Intel OpenGL rendering isn't starting
https://bugs.freedesktop.org/show_bug.cgi?id=88275 --- Comment #30 from Sgt. Garcia --- same here, it seems. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 88275] [865G] Intel OpenGL rendering isn't starting
https://bugs.freedesktop.org/show_bug.cgi?id=88275 --- Comment #31 from Sgt. Garcia --- Created attachment 115461 --> https://bugs.freedesktop.org/attachment.cgi?id=115461&action=edit dmesg |ag drm -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 88275] [865G] Intel OpenGL rendering isn't starting
https://bugs.freedesktop.org/show_bug.cgi?id=88275 --- Comment #32 from Sgt. Garcia --- Created attachment 115462 --> https://bugs.freedesktop.org/attachment.cgi?id=115462&action=edit /sys/class/drm/card0/error -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 88275] [865G] Intel OpenGL rendering isn't starting
https://bugs.freedesktop.org/show_bug.cgi?id=88275 --- Comment #33 from Sgt. Garcia --- Created attachment 115463 --> https://bugs.freedesktop.org/attachment.cgi?id=115463&action=edit glxinfo -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 88275] [865G] Intel OpenGL rendering isn't starting
https://bugs.freedesktop.org/show_bug.cgi?id=88275 --- Comment #34 from Sgt. Garcia --- glxgrear: Running synchronized to the vertical refresh. The framerate should be approximately the same as the monitor refresh rate. intel_do_flush_locked failed: Input/output error compton: intel_do_flush_locked failed: Input/output error mpv: [vo/opengl/x11] X11 error: GLXBadFBConfig [vo/opengl] Could not create GL3 context. Retrying with legacy context. AO: [pulse] 44100Hz stereo 2ch float VO: [opengl] 1280x720 yuv420p intel_do_flush_locked failed: Input/output error -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 14/20] glsl/es3.1: Allow enhnaced packing functions in GLSL ES 3.10
On Wed, Apr 29, 2015 at 4:26 PM, Ian Romanick wrote: > From: Ian Romanick > > Signed-off-by: Ian Romanick Reviewed-by: Matt Turner (I'm just reviewing this because I've familiar with the crazy availability matrix of these functions. Not planning to review the rest of the series) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 16/20] glsl/es3.1: Allow misc ARB_gpu_shader5 built-ins in GLSL ES 3.10
Reviewed-by: Matt Turner ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 88275] [865G] Intel OpenGL rendering isn't starting
https://bugs.freedesktop.org/show_bug.cgi?id=88275 --- Comment #35 from Sgt. Garcia --- Created attachment 115464 --> https://bugs.freedesktop.org/attachment.cgi?id=115464&action=edit intel_reg_dumper -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/8] glsl: track which program inputs are doubles
From: Dave Airlie instead of doing the attempts at dual slot handling here, let the backend do it. Signed-off-by: Dave Airlie --- src/glsl/ir_set_program_inouts.cpp | 14 ++ src/mesa/main/mtypes.h | 1 + 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/glsl/ir_set_program_inouts.cpp b/src/glsl/ir_set_program_inouts.cpp index e877a20..0a410ab 100644 --- a/src/glsl/ir_set_program_inouts.cpp +++ b/src/glsl/ir_set_program_inouts.cpp @@ -105,13 +105,10 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len, int idx = var->data.location + var->data.index + offset + i; GLbitfield64 bitfield = BITFIELD64_BIT(idx); - /* dvec3 and dvec4 take up 2 slots */ - if (dual_slot) { - idx += i; - bitfield |= bitfield << 1; - } if (var->data.mode == ir_var_shader_in) { prog->InputsRead |= bitfield; +if (dual_slot) + prog->DoubleInputsRead |= bitfield; if (is_fragment_shader) { gl_fragment_program *fprog = (gl_fragment_program *) prog; fprog->InterpQualifier[idx] = @@ -120,13 +117,6 @@ mark(struct gl_program *prog, ir_variable *var, int offset, int len, fprog->IsCentroid |= bitfield; if (var->data.sample) fprog->IsSample |= bitfield; - -/* Set the InterpQualifier of the next slot to the same as the - * current one, since dvec3 and dvec4 spans 2 slots. - */ -if (dual_slot) - fprog->InterpQualifier[idx + 1] = - (glsl_interp_qualifier) var->data.interpolation; } } else if (var->data.mode == ir_var_system_value) { prog->SystemValuesRead |= bitfield; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index efc723a..3860ab9 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2090,6 +2090,7 @@ struct gl_program struct nir_shader *nir; GLbitfield64 InputsRead; /**< Bitmask of which input regs are read */ + GLbitfield64 DoubleInputsRead; /**< Bitmask of which input regs are read and are doubles */ GLbitfield64 OutputsWritten; /**< Bitmask of which output regs are written */ GLbitfield SystemValuesRead; /**< Bitmask of SYSTEM_VALUE_x inputs used */ GLbitfield InputFlags[MAX_PROGRAM_INPUTS]; /**< PROG_PARAM_BIT_x flags */ -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/8] mapi: add GL_ARB_vertex_attrib_64bit support
From: Dave Airlie This just adds the glapi bits. Signed-off-by: Dave Airlie --- src/mapi/glapi/gen/ARB_vertex_attrib_64bit.xml | 70 ++ src/mapi/glapi/gen/Makefile.am | 1 + src/mapi/glapi/gen/gl_API.xml | 4 +- src/mesa/main/api_loopback.c | 37 ++ src/mesa/main/api_loopback.h | 16 ++ src/mesa/main/tests/dispatch_sanity.cpp| 20 src/mesa/main/varray.c | 10 +++- src/mesa/main/varray.h | 6 ++- 8 files changed, 151 insertions(+), 13 deletions(-) create mode 100644 src/mapi/glapi/gen/ARB_vertex_attrib_64bit.xml diff --git a/src/mapi/glapi/gen/ARB_vertex_attrib_64bit.xml b/src/mapi/glapi/gen/ARB_vertex_attrib_64bit.xml new file mode 100644 index 000..fc49f84 --- /dev/null +++ b/src/mapi/glapi/gen/ARB_vertex_attrib_64bit.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am index 1c4b86a..c8d4174 100644 --- a/src/mapi/glapi/gen/Makefile.am +++ b/src/mapi/glapi/gen/Makefile.am @@ -163,6 +163,7 @@ API_XML = \ ARB_texture_view.xml \ ARB_uniform_buffer_object.xml \ ARB_vertex_array_object.xml \ + ARB_vertex_attrib_64bit.xml \ ARB_vertex_attrib_binding.xml \ ARB_viewport_array.xml \ AMD_draw_buffers_blend.xml \ diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index a8a6db6..d156598 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -8253,7 +8253,9 @@ - +http://www.w3.org/2001/XInclude"/> + + http://www.w3.org/2001/XInclude"/> diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c index d10ae15..9a59779 100644 --- a/src/mesa/main/api_loopback.c +++ b/src/mesa/main/api_loopback.c @@ -1490,8 +1490,45 @@ _mesa_VertexAttribI4usv(GLuint index, const GLushort *v) ATTRIBI_4UI(index, v[0], v[1], v[2], v[3]); } +void GLAPIENTRY +_mesa_VertexAttribL1d(GLuint index, GLdouble x) +{ +} +void GLAPIENTRY +_mesa_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y) +{ +} +void GLAPIENTRY +_mesa_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ +} + +void GLAPIENTRY +_mesa_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ +} + +void GLAPIENTRY +_mesa_VertexAttribL1dv(GLuint index, const GLdouble *v) +{ +} + +void GLAPIENTRY +_mesa_VertexAttribL2dv(GLuint index, const GLdouble *v) +{ +} + +void GLAPIENTRY +_mesa_VertexAttribL3dv(GLuint index, const GLdouble *v) +{ +} + +void GLAPIENTRY +_mesa_VertexAttribL4dv(GLuint index, const GLdouble *v) +{ +} /* * This code never registers handlers for any of the entry points diff --git a/src/mesa/main/api_loopback.h b/src/mesa/main/api_loopback.h index 4451440..026bfd6 100644 --- a/src/mesa/main/api_loopback.h +++ b/src/mesa/main/api_loopback.h @@ -464,5 +464,21 @@ _mesa_VertexAttribI4ubv(GLuint index, const GLubyte *v); void GLAPIENTRY _mesa_VertexAttribI4usv(GLuint index, const GLushort *v); +void GLAPIENTRY +_mesa_VertexAttribL1d(GLuint index, GLdouble x); +void GLAPIENTRY +_mesa_VertexAttribL2d(GLuint index, GLdouble x, GLdouble y); +void GLAPIENTRY +_mesa_VertexAttribL3d(GLuint index, GLdouble x, GLdouble y, GLdouble z); +void GLAPIENTRY +_mesa_VertexAttribL4d(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +void GLAPIENTRY +_mesa_VertexAttribL1dv(GLuint index, const GLdouble *v); +void GLAPIENTRY +_mesa_VertexAttribL2dv(GLuint index, const GLdouble *v); +void GLAPIENTRY +_mesa_VertexAttribL3dv(GLuint index, const GLdouble *v); +void GLAPIENTRY +_mesa_VertexAttribL4dv(GLuint index, const GLdouble *v); #endif /* API_LOOPBACK_H */ diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 946eabb..4db6e4f 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -743,16 +743,16 @@ const struct function gl_core_functions_possible[] = { { "glProgramUniformMatrix4x3dv", 40, -1 }, { "glValidateProgramPipeline", 43, -1 }, { "glGetProgramPipelineInfoLog", 43, -1 }, -// { "glVertexAttribL1d", 43, -1 }, // XXX: Add to xml -// { "glVertexAttribL2d", 43, -1 }, // XXX: Add to xml -// { "glVertexAttribL3d", 43, -1 }, // XXX: Add to xml -// { "glVertexAttribL4d", 43, -1 }, // XXX: Add to xml -// { "glVertexAttribL1d
[Mesa-dev] [PATCH 3/8] mesa: add ARB_vertex_attrib_64bit to extensions. (v2)
From: Dave Airlie Just add the boilerplate bits. v2: add to version.c Signed-off-by: Dave Airlie --- src/mesa/main/extensions.c | 1 + src/mesa/main/mtypes.h | 1 + src/mesa/main/version.c| 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 3d4965c..92bc19f 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -203,6 +203,7 @@ static const struct extension extension_table[] = { { "GL_ARB_vertex_buffer_object",o(dummy_true), GLL,2003 }, { "GL_ARB_vertex_program", o(ARB_vertex_program), GLL,2002 }, { "GL_ARB_vertex_shader", o(ARB_vertex_shader), GL, 2002 }, + { "GL_ARB_vertex_attrib_64bit", o(ARB_vertex_attrib_64bit), GLC,2010 }, { "GL_ARB_vertex_type_10f_11f_11f_rev", o(ARB_vertex_type_10f_11f_11f_rev), GL, 2013 }, { "GL_ARB_vertex_type_2_10_10_10_rev", o(ARB_vertex_type_2_10_10_10_rev), GL, 2009 }, { "GL_ARB_viewport_array", o(ARB_viewport_array), GLC,2010 }, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index fb41430..efc723a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3672,6 +3672,7 @@ struct gl_extensions GLboolean ARB_transform_feedback3; GLboolean ARB_transform_feedback_instanced; GLboolean ARB_uniform_buffer_object; + GLboolean ARB_vertex_attrib_64bit; GLboolean ARB_vertex_program; GLboolean ARB_vertex_shader; GLboolean ARB_vertex_type_10f_11f_11f_rev; diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 5b8ac0a..e38a20c 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -313,7 +313,7 @@ compute_version(const struct gl_extensions *extensions, consts->GLSLVersion >= 410 && extensions->ARB_ES2_compatibility && extensions->ARB_shader_precision && - 0/*extensions->ARB_vertex_attrib_64bit*/ && + extensions->ARB_vertex_attrib_64bit && extensions->ARB_viewport_array); const GLboolean ver_4_2 = (ver_4_1 && consts->GLSLVersion >= 420 && -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/8] st/glsl_to_tgsi: fix ir_assignment hack doing bad things for doubles
From: Dave Airlie This hack for fixing gl_FragDepth apparantly caused a GLSL shader outputting a single double to try and output a dvec4, but we hadn't assigned outputs for the secondary bit. This avoids going into the hack code for scalar doubles. Signed-off-by: Dave Airlie --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 93671ba..08957dc 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2611,6 +2611,7 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir) assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector()); l.writemask = WRITEMASK_XYZW; } else if (ir->lhs->type->is_scalar() && + !ir->lhs->type->is_double() && ir->lhs->variable_referenced()->data.mode == ir_var_shader_out) { /* FINISHME: This hack makes writing to gl_FragDepth, which lives in the * FINISHME: W component of fragment shader output zero, work correctly. -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] ARB_vertex_attrib_64bit support (2nd posting I think)
The biggest change in this series is the attribute slot counting code in patch 6, and some cleanups in patch 8. I think this isn't going to improve itself much more out of tree, Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev