[Mesa-dev] [Bug 49326] softpipe regressed back to OpenGL 2.1
https://bugs.freedesktop.org/show_bug.cgi?id=49326 Alex Deucher changed: What|Removed |Added Status|NEW |RESOLVED Resolution||NOTABUG --- Comment #1 from Alex Deucher 2012-05-01 06:12:29 PDT --- GL3 requires MSAA support which isn't implemented yet. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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 3/3] svga: check for and skip null vertex buffer pointers
Series looks good to me. Jose - Original Message - > Fixes regressions with google earth and other things. > --- > src/gallium/drivers/svga/svga_swtnl_draw.c | 20 > > 1 files changed, 12 insertions(+), 8 deletions(-) > > diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c > b/src/gallium/drivers/svga/svga_swtnl_draw.c > index 3770264..bb6870f 100644 > --- a/src/gallium/drivers/svga/svga_swtnl_draw.c > +++ b/src/gallium/drivers/svga/svga_swtnl_draw.c > @@ -66,12 +66,14 @@ svga_swtnl_draw_vbo(struct svga_context *svga, > * Map vertex buffers > */ > for (i = 0; i < svga->curr.num_vertex_buffers; i++) { > - map = pipe_buffer_map(&svga->pipe, > -svga->curr.vb[i].buffer, > -PIPE_TRANSFER_READ, > - &vb_transfer[i]); > - > - draw_set_mapped_vertex_buffer(draw, i, map); > + if (svga->curr.vb[i].buffer) { > + map = pipe_buffer_map(&svga->pipe, > + svga->curr.vb[i].buffer, > + PIPE_TRANSFER_READ, > + &vb_transfer[i]); > + > + draw_set_mapped_vertex_buffer(draw, i, map); > + } > } > > /* TODO move this to update_swtnl_draw */ > @@ -109,8 +111,10 @@ svga_swtnl_draw_vbo(struct svga_context *svga, > * unmap vertex/index buffers > */ > for (i = 0; i < svga->curr.num_vertex_buffers; i++) { > - pipe_buffer_unmap(&svga->pipe, vb_transfer[i]); > - draw_set_mapped_vertex_buffer(draw, i, NULL); > + if (svga->curr.vb[i].buffer) { > + pipe_buffer_unmap(&svga->pipe, vb_transfer[i]); > + draw_set_mapped_vertex_buffer(draw, i, NULL); > + } > } > > if (ib_transfer) { > -- > 1.7.7.3 > > ___ > 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] scons: Do not build EGL on Solaris.
On 04/30/2012 11:38 PM, Vinson Lee wrote: The current EGL headers do not support Solaris. How hard would it be to update the EGL headers for Solaris? For the long-term, it would be nice if Khronos applied a fix/patch to the EGL headers instead. But this is OK. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] softpipe: implement coord clamping for texel fetches (TXF)
From: Brian Paul The GL spec says out of bounds fetches produce undefined results. Use clamping to avoid failed assertions or crashes. Fixes failed assertion in https://bugs.freedesktop.org/show_bug.cgi?id=49125 but the test still fails. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 45 ++ 1 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index d54e02e..83d9be8 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -799,7 +799,8 @@ get_texel_2d_array(const struct sp_sampler_variant *samp, const struct pipe_resource *texture = samp->view->texture; unsigned level = addr.bits.level; - assert(layer < texture->array_size); + assert(layer < (int) texture->array_size); + assert(layer >= 0); if (x < 0 || x >= (int) u_minify(texture->width0, level) || y < 0 || y >= (int) u_minify(texture->height0, level)) { @@ -2630,8 +2631,12 @@ sample_get_dims(struct tgsi_sampler *tgsi_sampler, int level, } } -/* this function is only used for unfiltered texel gets - via the TGSI TXF opcode. */ +/** + * This function is only used for getting unfiltered texels via the + * TXF opcode. The GL spec says that out-of-bounds texel fetches + * produce undefined results. Instead of crashing, lets just clamp + * coords to the texture image size. + */ static void sample_get_texels(struct tgsi_sampler *tgsi_sampler, const int v_i[TGSI_QUAD_SIZE], @@ -2650,15 +2655,22 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler, samp->key.bits.swizzle_g != PIPE_SWIZZLE_GREEN || samp->key.bits.swizzle_b != PIPE_SWIZZLE_BLUE || samp->key.bits.swizzle_a != PIPE_SWIZZLE_ALPHA); + int width, height, depth, layers; addr.value = 0; /* TODO write a better test for LOD */ addr.bits.level = lod[0]; + width = u_minify(texture->width0, addr.bits.level); + height = u_minify(texture->height0, addr.bits.level); + depth = u_minify(texture->depth0, addr.bits.level); + layers = texture->array_size; + switch(texture->target) { case PIPE_TEXTURE_1D: for (j = 0; j < TGSI_QUAD_SIZE; j++) { -tx = get_texel_2d(samp, addr, v_i[j] + offset[0], 0); + int x = CLAMP(v_i[j] + offset[0], 0, width - 1); +tx = get_texel_2d(samp, addr, x, 0); for (c = 0; c < 4; c++) { rgba[c][j] = tx[c]; } @@ -2666,8 +2678,9 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler, break; case PIPE_TEXTURE_1D_ARRAY: for (j = 0; j < TGSI_QUAD_SIZE; j++) { -tx = get_texel_1d_array(samp, addr, v_i[j] + offset[0], -v_j[j] + offset[1]); + int x = CLAMP(v_i[j] + offset[0], 0, width - 1); + int y = CLAMP(v_j[j] + offset[1], 0, layers - 1); +tx = get_texel_1d_array(samp, addr, x, y); for (c = 0; c < 4; c++) { rgba[c][j] = tx[c]; } @@ -2676,8 +2689,9 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler, case PIPE_TEXTURE_2D: case PIPE_TEXTURE_RECT: for (j = 0; j < TGSI_QUAD_SIZE; j++) { -tx = get_texel_2d(samp, addr, v_i[j] + offset[0], - v_j[j] + offset[1]); + int x = CLAMP(v_i[j] + offset[0], 0, width - 1); + int y = CLAMP(v_j[j] + offset[1], 0, height - 1); +tx = get_texel_2d(samp, addr, x, y); for (c = 0; c < 4; c++) { rgba[c][j] = tx[c]; } @@ -2685,9 +2699,10 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler, break; case PIPE_TEXTURE_2D_ARRAY: for (j = 0; j < TGSI_QUAD_SIZE; j++) { -tx = get_texel_2d_array(samp, addr, v_i[j] + offset[0], -v_j[j] + offset[1], -v_k[j] + offset[2]); + int x = CLAMP(v_i[j] + offset[0], 0, width - 1); + int y = CLAMP(v_j[j] + offset[1], 0, height - 1); + int layer = CLAMP(v_k[j] + offset[2], 0, layers - 1); +tx = get_texel_2d_array(samp, addr, x, y, layer); for (c = 0; c < 4; c++) { rgba[c][j] = tx[c]; } @@ -2695,9 +2710,11 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler, break; case PIPE_TEXTURE_3D: for (j = 0; j < TGSI_QUAD_SIZE; j++) { -tx = get_texel_3d(samp, addr, v_i[j] + offset[0], - v_j[j] + offset[1], - v_k[j] + offset[2]); + int x = CLAMP(v_i[j] + offset[0], 0, width - 1); + int y = CLAMP(v_j[j] + offset[1], 0, height - 1); + int z = CLAMP(v_k[j] + offset[2], 0, depth - 1); + +tx = get_texel_3d(samp, addr, x, y, z); for (c = 0; c < 4; c++) { rgba[c][j] = tx[c]; } -- 1.7.4.1 ___ mesa-dev mailing
[Mesa-dev] [PATCH 2/3] softpipe: whitespace, comment clean-ups in sp_tex_sample.c
From: Brian Paul --- src/gallium/drivers/softpipe/sp_tex_sample.c | 58 ++--- 1 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 83d9be8..6f4294f 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1788,9 +1788,9 @@ img_filter_2d_ewa(struct tgsi_sampler *tgsi_sampler, float weight_buffer[TGSI_QUAD_SIZE]; unsigned buffer_next; int j; - float den;// = 0.0F; + float den; /* = 0.0F; */ float ddq; - float U;// = u0 - tex_u; + float U; /* = u0 - tex_u; */ int v; /* Scale ellipse formula to directly index the Filter Lookup Table. @@ -1806,8 +1806,8 @@ img_filter_2d_ewa(struct tgsi_sampler *tgsi_sampler, * also the same. Note that texel/image access can only be performed using * a quad, i.e. it is not possible to get the pixel value for a single * tex coord. In order to have a better performance, the access is buffered -* using the s_buffer/t_buffer and weight_buffer. Only when the buffer is full, -* then the pixel values are read from the image. +* using the s_buffer/t_buffer and weight_buffer. Only when the buffer is +* full, then the pixel values are read from the image. */ ddq = 2 * A; @@ -1835,7 +1835,9 @@ img_filter_2d_ewa(struct tgsi_sampler *tgsi_sampler, int u; for (u = u0; u <= u1; ++u) { -/* Note that the ellipse has been pre-scaled so F = WEIGHT_LUT_SIZE - 1 */ +/* Note that the ellipse has been pre-scaled so F = + * WEIGHT_LUT_SIZE - 1 + */ if (q < WEIGHT_LUT_SIZE) { /* as a LUT is used, q must never be negative; * should not happen, though @@ -1874,10 +1876,11 @@ img_filter_2d_ewa(struct tgsi_sampler *tgsi_sampler, } } - /* if the tex coord buffer contains unread values, we will read them now. - * Note that in most cases we have to read more pixel values than required, - * however, as the img_filter_2d_nearest function(s) does not have a count - * parameter, we need to read the whole quad and ignore the unused values + /* if the tex coord buffer contains unread values, we will read + * them now. Note that in most cases we have to read more pixel + * values than required, however, as the img_filter_2d_nearest + * function(s) does not have a count parameter, we need to read + * the whole quad and ignore the unused values */ if (buffer_next > 0) { unsigned jj; @@ -1896,11 +1899,9 @@ img_filter_2d_ewa(struct tgsi_sampler *tgsi_sampler, } if (den <= 0.0F) { - /* Reaching this place would mean - * that no pixels intersected the ellipse. - * This should never happen because - * the filter we use always - * intersects at least one pixel. + /* Reaching this place would mean that no pixels intersected + * the ellipse. This should never happen because the filter + * we use always intersects at least one pixel. */ /*rgba[0]=0; @@ -1908,7 +1909,8 @@ img_filter_2d_ewa(struct tgsi_sampler *tgsi_sampler, rgba[2]=0; rgba[3]=0;*/ /* not enough pixels in resampling, resort to direct interpolation */ - samp->min_img_filter(tgsi_sampler, s, t, p, NULL, tgsi_sampler_lod_bias, rgba_temp); + samp->min_img_filter(tgsi_sampler, s, t, p, NULL, + tgsi_sampler_lod_bias, rgba_temp); den = 1; num[0] = rgba_temp[0][j]; num[1] = rgba_temp[1][j]; @@ -2021,7 +2023,6 @@ mip_filter_linear_aniso(struct tgsi_sampler *tgsi_sampler, } - /** * Specialized version of mip_filter_linear with hard-wired calls to * 2d lambda calculation and 2d_linear_repeat_POT img filters. @@ -2091,7 +2092,6 @@ mip_filter_linear_2d_linear_repeat_POT( } - /** * Do shadow/depth comparisons. */ @@ -2288,9 +2288,11 @@ sample_cube(struct tgsi_sampler *tgsi_sampler, samp->compare(tgsi_sampler, , , NULL, c0, control, rgba); } -static void do_swizzling(const struct sp_sampler_variant *samp, - float in[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE], - float out[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]) + +static void +do_swizzling(const struct sp_sampler_variant *samp, + float in[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE], + float out[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]) { int j; const unsigned swizzle_r = samp->key.bits.swizzle_r; @@ -2359,6 +2361,7 @@ static void do_swizzling(const struct sp_sampler_variant *samp, } } + static void sample_swizzle(struct tgsi_sampler *tgsi_sampler, const float s[TGSI_QUAD_SIZE], @@ -2591,6 +2594,7 @@ sp_sampler_variant_destroy
[Mesa-dev] [PATCH 3/3] softpipe: use any_swizzle() helper in sp_tex_sample.c
From: Brian Paul --- src/gallium/drivers/softpipe/sp_tex_sample.c | 23 +++ 1 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 6f4294f..d4c0175 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -2468,6 +2468,19 @@ get_linear_wrap(unsigned mode) } +/** + * Is swizzling needed for the given state key? + */ +static INLINE bool +any_swizzle(union sp_sampler_key key) +{ + return (key.bits.swizzle_r != PIPE_SWIZZLE_RED || + key.bits.swizzle_g != PIPE_SWIZZLE_GREEN || + key.bits.swizzle_b != PIPE_SWIZZLE_BLUE || + key.bits.swizzle_a != PIPE_SWIZZLE_ALPHA); +} + + static compute_lambda_func get_lambda_func(const union sp_sampler_key key) { @@ -2655,10 +2668,7 @@ sample_get_texels(struct tgsi_sampler *tgsi_sampler, const struct pipe_resource *texture = samp->view->texture; int j, c; const float *tx; - bool need_swizzle = (samp->key.bits.swizzle_r != PIPE_SWIZZLE_RED || -samp->key.bits.swizzle_g != PIPE_SWIZZLE_GREEN || -samp->key.bits.swizzle_b != PIPE_SWIZZLE_BLUE || -samp->key.bits.swizzle_a != PIPE_SWIZZLE_ALPHA); + const bool need_swizzle = any_swizzle(samp->key); int width, height, depth, layers; addr.value = 0; @@ -2853,10 +2863,7 @@ sp_create_sampler_variant( const struct pipe_sampler_state *sampler, samp->sample_target = samp->compare; } - if (key.bits.swizzle_r != PIPE_SWIZZLE_RED || - key.bits.swizzle_g != PIPE_SWIZZLE_GREEN || - key.bits.swizzle_b != PIPE_SWIZZLE_BLUE || - key.bits.swizzle_a != PIPE_SWIZZLE_ALPHA) { + if (any_swizzle(key)) { samp->base.get_samples = sample_swizzle; } else { -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4] radeon: use _mesa_is_winsys/user_fbo() helpers
From: Brian Paul --- src/mesa/drivers/dri/r200/r200_state.c |5 +++-- src/mesa/drivers/dri/radeon/radeon_common.c | 11 ++- src/mesa/drivers/dri/radeon/radeon_pixel_read.c |3 ++- src/mesa/drivers/dri/radeon/radeon_state.c |5 +++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 3131007..0f7b564 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -40,6 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/colormac.h" #include "main/light.h" #include "main/framebuffer.h" +#include "main/fbobject.h" #include "swrast/swrast.h" #include "vbo/vbo.h" @@ -536,7 +537,7 @@ static void r200FrontFace( struct gl_context *ctx, GLenum mode ) rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_CULL_FRONT_IS_CCW; /* Winding is inverted when rendering to FBO */ - if (ctx->DrawBuffer && ctx->DrawBuffer->Name) + if (ctx->DrawBuffer && _mesa_is_user_fbo(ctx->DrawBuffer)) mode = (mode == GL_CW) ? GL_CCW : GL_CW; switch ( mode ) { @@ -1547,7 +1548,7 @@ void r200UpdateWindow( struct gl_context *ctx ) GLfloat xoffset = 0; GLfloat yoffset = dPriv ? (GLfloat) dPriv->h : 0; const GLfloat *v = ctx->Viewport._WindowMap.m; - const GLboolean render_to_fbo = (ctx->DrawBuffer ? (ctx->DrawBuffer->Name != 0) : 0); + const GLboolean render_to_fbo = (ctx->DrawBuffer ? _mesa_is_user_fbo(ctx->DrawBuffer) : 0); const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; GLfloat y_scale, y_bias; diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index b64ff81..a8dfae0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -46,6 +46,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/imports.h" #include "main/context.h" #include "main/enums.h" +#include "main/fbobject.h" #include "main/framebuffer.h" #include "main/renderbuffer.h" #include "drivers/common/meta.h" @@ -168,7 +169,7 @@ void radeonUpdateScissor( struct gl_context *ctx ) max_x = ctx->DrawBuffer->Width - 1; max_y = ctx->DrawBuffer->Height - 1; - if ( !ctx->DrawBuffer->Name ) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { x1 = x; y1 = ctx->DrawBuffer->Height - (y + h); x2 = x + w - 1; @@ -407,7 +408,7 @@ void radeonDrawBuffer( struct gl_context *ctx, GLenum mode ) fprintf(stderr, "%s %s\n", __FUNCTION__, _mesa_lookup_enum_by_nr( mode )); - if (ctx->DrawBuffer->Name == 0) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); const GLboolean was_front_buffer_rendering = @@ -430,7 +431,7 @@ void radeonDrawBuffer( struct gl_context *ctx, GLenum mode ) void radeonReadBuffer( struct gl_context *ctx, GLenum mode ) { - if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) { + if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) { struct radeon_context *const rmesa = RADEON_CONTEXT(ctx); const GLboolean was_front_buffer_reading = rmesa->is_front_buffer_reading; rmesa->is_front_buffer_reading = (mode == GL_FRONT_LEFT) @@ -465,7 +466,7 @@ void radeon_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GL void (*old_viewport)(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h); - if (ctx->DrawBuffer->Name == 0) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { if (radeon->is_front_buffer_rendering) { ctx->Driver.Flush(ctx); } @@ -656,7 +657,7 @@ void radeonFlush(struct gl_context *ctx) rcommonFlushCmdBuf(radeon, __FUNCTION__); flush_front: - if ((ctx->DrawBuffer->Name == 0) && radeon->front_buffer_dirty) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer) && radeon->front_buffer_dirty) { __DRIscreen *const screen = radeon->radeonScreen->driScreen; if (screen->dri2.loader && (screen->dri2.loader->base.version >= 2) diff --git a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c index 3a14cc6..db5e01d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c +++ b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c @@ -28,6 +28,7 @@ #include "stdint.h" #include "main/bufferobj.h" #include "main/enums.h" +#include "main/fbobject.h" #include "main/image.h" #include "main/readpix.h" #include "main/state.h" @@ -148,7 +149,7 @@ do_blit_readpixels(struct gl_context * ctx, } /* Disable source Y flipping for FBOs */ -flip_y = (ctx->Re
[Mesa-dev] [PATCH 2/4] nouveau: use _mesa_is_winsys/user_fbo() helpers
From: Brian Paul --- src/mesa/drivers/dri/nouveau/nouveau_context.c |5 +++-- src/mesa/drivers/dri/nouveau/nouveau_driver.c |4 +++- src/mesa/drivers/dri/nouveau/nouveau_screen.c |1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 4845767..2625b76 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -33,6 +33,7 @@ #include "main/dd.h" #include "main/framebuffer.h" +#include "main/fbobject.h" #include "main/light.h" #include "main/state.h" #include "main/version.h" @@ -396,11 +397,11 @@ nouveau_validate_framebuffer(struct gl_context *ctx) __DRIdrawable *dri_draw = dri_ctx->driDrawablePriv; __DRIdrawable *dri_read = dri_ctx->driReadablePriv; - if (ctx->DrawBuffer->Name == 0) + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) validate_framebuffer(dri_ctx, dri_draw, &dri_ctx->dri2.draw_stamp); - if (ctx->ReadBuffer->Name == 0) + if (_mesa_is_winsys_fbo(ctx->ReadBuffer)) validate_framebuffer(dri_ctx, dri_read, &dri_ctx->dri2.read_stamp); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index 7222f68..69e5cac 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c @@ -25,6 +25,8 @@ */ #include "main/mfeatures.h" +#include "main/mtypes.h" +#include "main/fbobject.h" #include "nouveau_driver.h" #include "nouveau_context.h" @@ -61,7 +63,7 @@ nouveau_flush(struct gl_context *ctx) PUSH_KICK(push); - if (ctx->DrawBuffer->Name == 0 && + if (_mesa_is_winsys_fbo(ctx->DrawBuffer) && ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) { __DRIscreen *screen = nctx->screen->dri_screen; __DRIdri2LoaderExtension *dri2 = screen->dri2.loader; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index 7e51b94..2a15c08 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -33,6 +33,7 @@ #include "nv20_driver.h" #include "main/framebuffer.h" +#include "main/fbobject.h" #include "main/renderbuffer.h" #include "swrast/s_renderbuffer.h" -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/4] intel: use _mesa_is_winsys/user_fbo() helpers
From: Brian Paul --- src/mesa/drivers/dri/i915/i830_state.c |3 ++- src/mesa/drivers/dri/i915/i915_state.c |7 --- src/mesa/drivers/dri/i965/brw_fs.cpp|3 ++- src/mesa/drivers/dri/i965/brw_misc_state.c | 18 +- src/mesa/drivers/dri/i965/brw_sf.c |4 +++- src/mesa/drivers/dri/i965/brw_sf_state.c|8 +--- src/mesa/drivers/dri/i965/brw_wm.c |3 ++- src/mesa/drivers/dri/i965/gen6_scissor_state.c |3 ++- src/mesa/drivers/dri/i965/gen6_sf_state.c |3 ++- src/mesa/drivers/dri/i965/gen6_viewport_state.c |3 ++- src/mesa/drivers/dri/i965/gen7_clip_state.c |3 ++- src/mesa/drivers/dri/i965/gen7_sf_state.c |5 +++-- src/mesa/drivers/dri/i965/gen7_viewport_state.c |3 ++- src/mesa/drivers/dri/intel/intel_buffers.c |5 +++-- src/mesa/drivers/dri/intel/intel_context.c |4 ++-- src/mesa/drivers/dri/intel/intel_pixel_read.c |5 +++-- 16 files changed, 48 insertions(+), 32 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c index ea6e0be..6f8bd69 100644 --- a/src/mesa/drivers/dri/i915/i830_state.c +++ b/src/mesa/drivers/dri/i915/i830_state.c @@ -30,6 +30,7 @@ #include "main/context.h" #include "main/macros.h" #include "main/enums.h" +#include "main/fbobject.h" #include "main/dd.h" #include "main/state.h" @@ -545,7 +546,7 @@ i830Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h) DBG("%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h); - if (ctx->DrawBuffer->Name == 0) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { x1 = x; y1 = ctx->DrawBuffer->Height - (y + h); x2 = x + w - 1; diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 94c7327..3ab75a9 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -30,6 +30,7 @@ #include "main/context.h" #include "main/macros.h" #include "main/enums.h" +#include "main/fbobject.h" #include "main/dd.h" #include "main/state.h" #include "tnl/tnl.h" @@ -400,7 +401,7 @@ intelCalcViewport(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); - if (ctx->DrawBuffer->Name == 0) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { _math_matrix_viewport(&intel->ViewportMatrix, ctx->Viewport.X, ctx->DrawBuffer->Height - ctx->Viewport.Y, @@ -518,7 +519,7 @@ i915Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h) DBG("%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h); - if (ctx->DrawBuffer->Name == 0) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { x1 = x; y1 = ctx->DrawBuffer->Height - (y + h); x2 = x + w - 1; @@ -577,7 +578,7 @@ i915CullFaceFrontFace(struct gl_context * ctx, GLenum unused) else if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) { mode = S4_CULLMODE_CW; - if (ctx->DrawBuffer && ctx->DrawBuffer->Name != 0) + if (ctx->DrawBuffer && _mesa_is_user_fbo(ctx->DrawBuffer)) mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW); if (ctx->Polygon.CullFaceMode == GL_FRONT) mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW); diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 8af4300..fd67318 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -35,6 +35,7 @@ extern "C" { #include "main/macros.h" #include "main/shaderobj.h" #include "main/uniforms.h" +#include "main/fbobject.h" #include "program/prog_parameter.h" #include "program/prog_print.h" #include "program/register_allocate.h" @@ -1828,7 +1829,7 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) if (fp->Base.InputsRead & FRAG_BIT_WPOS) { key.drawable_height = ctx->DrawBuffer->Height; - key.render_to_fbo = ctx->DrawBuffer->Name != 0; + key.render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); } key.nr_color_regions = 1; diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 62bcc93..51ea03b 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -40,6 +40,8 @@ #include "brw_state.h" #include "brw_defines.h" +#include "main/fbobject.h" + /* Constant single cliprect for framebuffer object or DRI2 drawing */ static void upload_drawing_rect(struct brw_context *brw) { @@ -507,7 +509,7 @@ static void upload_polygon_stipple(struct brw_context *brw) * to a FBO (i.e. any named frame buffer object), we *don't* * need to invert - we already match the layout. */ - if (ctx->DrawBuffer->Name == 0) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { for (i = 0; i < 32; i++) OUT_BATCH(ctx->PolygonStipple[31
[Mesa-dev] [PATCH 4/4] xlib: use _mesa_is_winsys/user_fbo() helpers
From: Brian Paul --- src/mesa/drivers/x11/xm_dd.c | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 7748298..12004ba 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -32,6 +32,7 @@ #include "main/bufferobj.h" #include "main/context.h" #include "main/colormac.h" +#include "main/fbobject.h" #include "main/macros.h" #include "main/image.h" #include "main/imports.h" @@ -69,7 +70,7 @@ color_mask(struct gl_context *ctx, const int xclass = xmesa->xm_visual->visualType; (void) amask; - if (ctx->DrawBuffer->Name != 0) + if (_mesa_is_user_fbo(ctx->DrawBuffer)) return; xmbuf = XMESA_BUFFER(ctx->DrawBuffer); @@ -240,7 +241,7 @@ clear_nbit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb, static void clear_buffers(struct gl_context *ctx, GLbitfield buffers) { - if (ctx->DrawBuffer->Name == 0) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { /* this is a window system framebuffer */ const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask[0]; const XMesaContext xmesa = XMESA_CONTEXT(ctx); @@ -304,7 +305,7 @@ can_do_DrawPixels_8R8G8B(struct gl_context *ctx, GLenum format, GLenum type) if (format == GL_BGRA && type == GL_UNSIGNED_BYTE && ctx->DrawBuffer && - ctx->DrawBuffer->Name == 0 && + _mesa_is_winsys_fbo(ctx->DrawBuffer) && ctx->Pixel.ZoomX == 1.0 &&/* no zooming */ ctx->Pixel.ZoomY == 1.0 && ctx->_ImageTransferState == 0 /* no color tables, scale/bias, etc */) { @@ -437,7 +438,7 @@ can_do_DrawPixels_5R6G5B(struct gl_context *ctx, GLenum format, GLenum type) type == GL_UNSIGNED_SHORT_5_6_5 && !ctx->Color.DitherFlag && /* no dithering */ ctx->DrawBuffer && - ctx->DrawBuffer->Name == 0 && + _mesa_is_winsys_fbo(ctx->DrawBuffer) && ctx->Pixel.ZoomX == 1.0 &&/* no zooming */ ctx->Pixel.ZoomY == 1.0 && ctx->_ImageTransferState == 0 /* no color tables, scale/bias, etc */) { @@ -693,7 +694,7 @@ xmesa_update_state( struct gl_context *ctx, GLbitfield new_state ) _vbo_InvalidateState( ctx, new_state ); _swsetup_InvalidateState( ctx, new_state ); - if (ctx->DrawBuffer->Name != 0) + if (_mesa_is_user_fbo(ctx->DrawBuffer)) return; /* -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/4] radeon: use _mesa_is_winsys/user_fbo() helpers
On Tue, May 1, 2012 at 10:48 AM, Brian Paul wrote: > From: Brian Paul > > --- > src/mesa/drivers/dri/r200/r200_state.c | 5 +++-- > src/mesa/drivers/dri/radeon/radeon_common.c | 11 ++- > src/mesa/drivers/dri/radeon/radeon_pixel_read.c | 3 ++- > src/mesa/drivers/dri/radeon/radeon_state.c | 5 +++-- > 4 files changed, 14 insertions(+), 10 deletions(-) Reviewed-by: Alex Deucher > > diff --git a/src/mesa/drivers/dri/r200/r200_state.c > b/src/mesa/drivers/dri/r200/r200_state.c > index 3131007..0f7b564 100644 > --- a/src/mesa/drivers/dri/r200/r200_state.c > +++ b/src/mesa/drivers/dri/r200/r200_state.c > @@ -40,6 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE > SOFTWARE. > #include "main/colormac.h" > #include "main/light.h" > #include "main/framebuffer.h" > +#include "main/fbobject.h" > > #include "swrast/swrast.h" > #include "vbo/vbo.h" > @@ -536,7 +537,7 @@ static void r200FrontFace( struct gl_context *ctx, GLenum > mode ) > rmesa->hw.tcl.cmd[TCL_UCP_VERT_BLEND_CTL] &= ~R200_CULL_FRONT_IS_CCW; > > /* Winding is inverted when rendering to FBO */ > - if (ctx->DrawBuffer && ctx->DrawBuffer->Name) > + if (ctx->DrawBuffer && _mesa_is_user_fbo(ctx->DrawBuffer)) > mode = (mode == GL_CW) ? GL_CCW : GL_CW; > > switch ( mode ) { > @@ -1547,7 +1548,7 @@ void r200UpdateWindow( struct gl_context *ctx ) > GLfloat xoffset = 0; > GLfloat yoffset = dPriv ? (GLfloat) dPriv->h : 0; > const GLfloat *v = ctx->Viewport._WindowMap.m; > - const GLboolean render_to_fbo = (ctx->DrawBuffer ? (ctx->DrawBuffer->Name > != 0) : 0); > + const GLboolean render_to_fbo = (ctx->DrawBuffer ? > _mesa_is_user_fbo(ctx->DrawBuffer) : 0); > const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; > GLfloat y_scale, y_bias; > > diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c > b/src/mesa/drivers/dri/radeon/radeon_common.c > index b64ff81..a8dfae0 100644 > --- a/src/mesa/drivers/dri/radeon/radeon_common.c > +++ b/src/mesa/drivers/dri/radeon/radeon_common.c > @@ -46,6 +46,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE > SOFTWARE. > #include "main/imports.h" > #include "main/context.h" > #include "main/enums.h" > +#include "main/fbobject.h" > #include "main/framebuffer.h" > #include "main/renderbuffer.h" > #include "drivers/common/meta.h" > @@ -168,7 +169,7 @@ void radeonUpdateScissor( struct gl_context *ctx ) > max_x = ctx->DrawBuffer->Width - 1; > max_y = ctx->DrawBuffer->Height - 1; > > - if ( !ctx->DrawBuffer->Name ) { > + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { > x1 = x; > y1 = ctx->DrawBuffer->Height - (y + h); > x2 = x + w - 1; > @@ -407,7 +408,7 @@ void radeonDrawBuffer( struct gl_context *ctx, GLenum > mode ) > fprintf(stderr, "%s %s\n", __FUNCTION__, > _mesa_lookup_enum_by_nr( mode )); > > - if (ctx->DrawBuffer->Name == 0) { > + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { > radeonContextPtr radeon = RADEON_CONTEXT(ctx); > > const GLboolean was_front_buffer_rendering = > @@ -430,7 +431,7 @@ void radeonDrawBuffer( struct gl_context *ctx, GLenum > mode ) > > void radeonReadBuffer( struct gl_context *ctx, GLenum mode ) > { > - if ((ctx->DrawBuffer != NULL) && (ctx->DrawBuffer->Name == 0)) { > + if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) { > struct radeon_context *const rmesa = RADEON_CONTEXT(ctx); > const GLboolean was_front_buffer_reading = > rmesa->is_front_buffer_reading; > rmesa->is_front_buffer_reading = (mode == GL_FRONT_LEFT) > @@ -465,7 +466,7 @@ void radeon_viewport(struct gl_context *ctx, GLint x, > GLint y, GLsizei width, GL > void (*old_viewport)(struct gl_context *ctx, GLint x, GLint y, > GLsizei w, GLsizei h); > > - if (ctx->DrawBuffer->Name == 0) { > + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { > if (radeon->is_front_buffer_rendering) { > ctx->Driver.Flush(ctx); > } > @@ -656,7 +657,7 @@ void radeonFlush(struct gl_context *ctx) > rcommonFlushCmdBuf(radeon, __FUNCTION__); > > flush_front: > - if ((ctx->DrawBuffer->Name == 0) && radeon->front_buffer_dirty) { > + if (_mesa_is_winsys_fbo(ctx->DrawBuffer) && > radeon->front_buffer_dirty) { > __DRIscreen *const screen = radeon->radeonScreen->driScreen; > > if (screen->dri2.loader && (screen->dri2.loader->base.version > >= 2) > diff --git a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c > b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c > index 3a14cc6..db5e01d 100644 > --- a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c > +++ b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c > @@ -28,6 +28,7 @@ > #include "stdint.h" > #include "main/bufferobj.h" > #inc
[Mesa-dev] [Bug 49124] swrast/s_texfetch.c:1156: set_fetch_functions: Assertion `texImage->FetchTexel' failed.
https://bugs.freedesktop.org/show_bug.cgi?id=49124 --- Comment #1 from Brian Paul 2012-05-01 08:13:38 PDT --- It looks like the piglit test has a few bugs. I'll post a patch to fix them. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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 v3 03/13] gallium: Add context hooks for binding shader resources.
--- v3: Split sampler views from shader resources. src/gallium/docs/source/context.rst | 20 +++- src/gallium/docs/source/screen.rst |4 src/gallium/include/pipe/p_context.h | 32 src/gallium/include/pipe/p_defines.h |2 ++ src/gallium/include/pipe/p_state.h |1 + 5 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index cb9b8de..eae400d 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -120,6 +120,22 @@ to the array index which is used for sampling. * ``sampler_view_destroy`` destroys a sampler view and releases its reference to associated texture. +Shader Resources + + +Shader resources are textures or buffers that may be read or written +from a shader without an associated sampler. This means that they +have no support for floating point coordinates, address wrap modes or +filtering. + +Shader resources are specified for all the shader stages at once using +the ``set_shader_resources`` method. When binding texture resources, +the ``level``, ``first_layer`` and ``last_layer`` pipe_surface fields +specify the mipmap level and the range of layers the texture will be +constrained to. In the case of buffers, ``first_element`` and +``last_element`` specify the range within the buffer that will be used +by the shader resource. + Surfaces @@ -575,7 +591,9 @@ The compute program has access to four special resources: These resources use a byte-based addressing scheme, and they can be accessed from the compute program by means of the LOAD/STORE TGSI -opcodes. +opcodes. Additional resources to be accessed using the same opcodes +may be specified by the user with the ``set_compute_resources`` +method. In addition, normal texture sampling is allowed from the compute program: ``bind_compute_sampler_states`` may be used to set up texture diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 5d8280a..8e45840 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -249,6 +249,10 @@ resources might be created and handled quite differently. process. * ``PIPE_BIND_GLOBAL``: A buffer that can be mapped into the global address space of a compute program. +* ``PIPE_BIND_SHADER_RESOURCE``: A buffer or texture that can be + bound to the graphics pipeline as a shader resource. +* ``PIPE_BIND_COMPUTE_RESOURCE``: A buffer or texture that can be + bound to the compute program as a shader resource. .. _pipe_usage: diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 3c0b89e..0951e70 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -229,6 +229,22 @@ struct pipe_context { unsigned start_slot, unsigned num_views, struct pipe_sampler_view **); + /** +* Bind an array of shader resources that will be used by the +* graphics pipeline. Any resources that were previously bound to +* the specified range will be unbound after this call. +* +* \param first first resource to bind. +* \param count number of consecutive resources to bind. +* \param resources array of pointers to the resources to bind, it +* should contain at least \a count elements +* unless it's NULL, in which case no new +* resources will be bound. +*/ + void (*set_shader_resources)(struct pipe_context *, +unsigned start, unsigned count, +struct pipe_surface **resources); + void (*set_vertex_buffers)( struct pipe_context *, unsigned num_buffers, const struct pipe_vertex_buffer * ); @@ -442,6 +458,22 @@ struct pipe_context { void (*delete_compute_state)(struct pipe_context *, void *); /** +* Bind an array of shader resources that will be used by the +* compute program. Any resources that were previously bound to +* the specified range will be unbound after this call. +* +* \param first first resource to bind. +* \param count number of consecutive resources to bind. +* \param resources array of pointers to the resources to bind, it +* should contain at least \a count elements +* unless it's NULL, in which case no new +* resources will be bound. +*/ + void (*set_compute_resources)(struct pipe_context *, + unsigned start, unsigned count, + struct pipe_surface **resources); + + /** * Bind an array of buffers to be mapped into the address space of *
[Mesa-dev] [PATCH v3 01/13] gallium: Basic compute interface.
Define an interface that exposes the minimal functionality required to implement some of the popular compute APIs. This commit adds entry points to set the grid layout and other state required to keep track of the usual address spaces employed in compute APIs, to bind a compute program, and execute it on the device. Reviewed-by: Marek Olšák --- v2: Add "start slot" argument to the resource binding driver hooks. v3: Split sampler views from shader resources. src/gallium/docs/source/context.rst| 39 +++ src/gallium/docs/source/screen.rst | 28 ++- src/gallium/include/pipe/p_context.h | 73 src/gallium/include/pipe/p_defines.h | 19 +++- src/gallium/include/pipe/p_screen.h| 12 + src/gallium/include/pipe/p_shader_tokens.h |9 src/gallium/include/pipe/p_state.h |7 +++ 7 files changed, 185 insertions(+), 2 deletions(-) diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index b2872cd..cb9b8de 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -542,3 +542,42 @@ These flags control the behavior of a transfer object. ``PIPE_TRANSFER_FLUSH_EXPLICIT`` Written ranges will be notified later with :ref:`transfer_flush_region`. Cannot be used with ``PIPE_TRANSFER_READ``. + + +Compute kernel execution + + +A compute program can be defined, bound or destroyed using +``create_compute_state``, ``bind_compute_state`` or +``destroy_compute_state`` respectively. + +Any of the subroutines contained within the compute program can be +executed on the device using the ``launch_grid`` method. This method +will execute as many instances of the program as elements in the +specified N-dimensional grid, hopefully in parallel. + +The compute program has access to four special resources: + +* ``GLOBAL`` represents a memory space shared among all the threads + running on the device. An arbitrary buffer created with the + ``PIPE_BIND_GLOBAL`` flag can be mapped into it using the + ``set_global_binding`` method. + +* ``LOCAL`` represents a memory space shared among all the threads + running in the same working group. The initial contents of this + resource are undefined. + +* ``PRIVATE`` represents a memory space local to a single thread. + The initial contents of this resource are undefined. + +* ``INPUT`` represents a read-only memory space that can be + initialized at ``launch_grid`` time. + +These resources use a byte-based addressing scheme, and they can be +accessed from the compute program by means of the LOAD/STORE TGSI +opcodes. + +In addition, normal texture sampling is allowed from the compute +program: ``bind_compute_sampler_states`` may be used to set up texture +samplers for the compute stage and ``set_compute_sampler_views`` may +be used to bind a number of sampler views to it. diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 05f7e8f..5d8280a 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -110,7 +110,8 @@ The integer capabilities: * ``PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY``: This CAP describes a hw limitation. If true, pipe_vertex_element::src_offset must always be aligned to 4. If false, there are no restrictions on src_offset. - +* ``PIPE_CAP_COMPUTE``: Whether the implementation supports the + compute entry points defined in pipe_context and pipe_screen. .. _pipe_capf: @@ -186,6 +187,29 @@ to be 0. samplers. +.. _pipe_compute_cap: + +PIPE_COMPUTE_CAP_* +^^ + +Compute-specific capabilities. They can be queried using +pipe_screen::get_compute_param. + +* ``PIPE_COMPUTE_CAP_GRID_DIMENSION``: Number of supported dimensions + for grid and block coordinates. Value type: ``uint64_t``. +* ``PIPE_COMPUTE_CAP_MAX_GRID_SIZE``: Maximum grid size in block + units. Value type: ``uint64_t []``. +* ``PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE``: Maximum block size in thread + units. Value type: ``uint64_t []``. +* ``PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE``: Maximum size of the GLOBAL + resource. Value type: ``uint64_t``. +* ``PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE``: Maximum size of the LOCAL + resource. Value type: ``uint64_t``. +* ``PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE``: Maximum size of the PRIVATE + resource. Value type: ``uint64_t``. +* ``PIPE_COMPUTE_CAP_MAX_INPUT_SIZE``: Maximum size of the INPUT + resource. Value type: ``uint64_t``. + .. _pipe_bind: PIPE_BIND_* @@ -223,6 +247,8 @@ resources might be created and handled quite differently. * ``PIPE_BIND_SCANOUT``: A front color buffer or scanout buffer. * ``PIPE_BIND_SHARED``: A sharable buffer that can be given to another process. +* ``PIPE_BIND_GLOBAL``: A buffer that can be mapped into the global + address space of a compute program. .. _pipe_usage: diff --git a/src/gallium/include/pipe/p_cont
[Mesa-dev] [PATCH v3 05/13] gallium/tgsi: Introduce the compute processor.
--- v3: Split sampler views from shader resources. src/gallium/auxiliary/tgsi/tgsi_scan.c |3 ++- src/gallium/auxiliary/tgsi/tgsi_strings.c |5 +++-- src/gallium/auxiliary/tgsi/tgsi_strings.h |2 +- src/gallium/auxiliary/tgsi/tgsi_text.c |2 ++ src/gallium/include/pipe/p_shader_tokens.h |1 + 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index 036ff31..df299ba 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -68,7 +68,8 @@ tgsi_scan_shader(const struct tgsi_token *tokens, procType = parse.FullHeader.Processor.Processor; assert(procType == TGSI_PROCESSOR_FRAGMENT || procType == TGSI_PROCESSOR_VERTEX || - procType == TGSI_PROCESSOR_GEOMETRY); + procType == TGSI_PROCESSOR_GEOMETRY || + procType == TGSI_PROCESSOR_COMPUTE); /** diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c index 626ff6f..3c7ab3b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c @@ -32,11 +32,12 @@ #include "tgsi_strings.h" -const char *tgsi_processor_type_names[3] = +const char *tgsi_processor_type_names[4] = { "FRAG", "VERT", - "GEOM" + "GEOM", + "COMP" }; const char *tgsi_file_names[TGSI_FILE_COUNT] = diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.h b/src/gallium/auxiliary/tgsi/tgsi_strings.h index 0946a58..5c57e22 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.h +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.h @@ -38,7 +38,7 @@ extern "C" { #endif -extern const char *tgsi_processor_type_names[3]; +extern const char *tgsi_processor_type_names[4]; extern const char *tgsi_file_names[TGSI_FILE_COUNT]; diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 7269f53..0486275 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -238,6 +238,8 @@ static boolean parse_header( struct translate_ctx *ctx ) processor = TGSI_PROCESSOR_VERTEX; else if (str_match_no_case( &ctx->cur, "GEOM" )) processor = TGSI_PROCESSOR_GEOMETRY; + else if (str_match_no_case( &ctx->cur, "COMP" )) + processor = TGSI_PROCESSOR_COMPUTE; else { report_error( ctx, "Unknown header" ); return FALSE; diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 3542e54..3c97072 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -43,6 +43,7 @@ struct tgsi_header #define TGSI_PROCESSOR_FRAGMENT 0 #define TGSI_PROCESSOR_VERTEX1 #define TGSI_PROCESSOR_GEOMETRY 2 +#define TGSI_PROCESSOR_COMPUTE 3 struct tgsi_processor { -- 1.7.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 02/13] gallium/tgsi: Split sampler views from shader resources.
This commit splits the current concept of resource into "sampler views" and "shader resources": "Sampler views" are textures or buffers that are bound to a given shader stage and can be read from in conjunction with a sampler object. They are analogous to OpenGL texture objects or Direct3D SRVs. "Shader resources" are textures or buffers that can be read and written from a shader. There's no support for floating point coordinates, address wrap modes or filtering, and, unlike sampler views, shader resources are global for the whole graphics pipeline. They are analogous to OpenGL image objects (as in ARB_shader_image_load_store) or Direct3D UAVs. Most hardware is likely to implement shader resources and sampler views as separate objects, so, having the distinction at the API level simplifies things slightly for the driver. This patch introduces the SVIEW register file with a declaration token and syntax analogous to the already existing RES register file. After this change, the SAMPLE_* opcodes no longer accept a resource as input, but rather a SVIEW object. To preserve the functionality of reading from a sampler view with integer coordinates, the SAMPLE_I(_MS) opcodes are introduced which are similar to LOAD(_MS) but take a SVIEW register instead of a RES register as argument. --- v3: Split sampler views from shader resources. src/gallium/auxiliary/tgsi/tgsi_build.c| 88 ++ src/gallium/auxiliary/tgsi/tgsi_dump.c | 22 ++-- src/gallium/auxiliary/tgsi/tgsi_exec.c | 14 +-- src/gallium/auxiliary/tgsi/tgsi_exec.h |3 +- src/gallium/auxiliary/tgsi/tgsi_info.c |7 +- src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h |6 +- src/gallium/auxiliary/tgsi/tgsi_parse.c|4 + src/gallium/auxiliary/tgsi/tgsi_parse.h|1 + src/gallium/auxiliary/tgsi/tgsi_strings.c |3 +- src/gallium/auxiliary/tgsi/tgsi_text.c | 32 -- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 88 +++--- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 14 +-- src/gallium/docs/source/tgsi.rst | 121 +--- .../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp | 34 +++--- src/gallium/drivers/r600/r600_shader.c | 18 +-- src/gallium/include/pipe/p_shader_tokens.h | 18 ++- .../state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp| 13 ++- 17 files changed, 303 insertions(+), 183 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 6ec2b0d..6c3f775 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -227,42 +227,66 @@ tgsi_build_declaration_semantic( return ds; } - static struct tgsi_declaration_resource tgsi_default_declaration_resource(void) { - struct tgsi_declaration_resource declaration_resource; + struct tgsi_declaration_resource dr; - declaration_resource.Resource = TGSI_TEXTURE_UNKNOWN; - declaration_resource.ReturnTypeX = PIPE_TYPE_UNORM; - declaration_resource.ReturnTypeY = PIPE_TYPE_UNORM; - declaration_resource.ReturnTypeZ = PIPE_TYPE_UNORM; - declaration_resource.ReturnTypeW = PIPE_TYPE_UNORM; + dr.Resource = TGSI_BUFFER; - return declaration_resource; + return dr; } static struct tgsi_declaration_resource tgsi_build_declaration_resource(unsigned texture, -unsigned return_type_x, -unsigned return_type_y, -unsigned return_type_z, -unsigned return_type_w, struct tgsi_declaration *declaration, struct tgsi_header *header) { - struct tgsi_declaration_resource declaration_resource; + struct tgsi_declaration_resource dr; + + dr = tgsi_default_declaration_resource(); + dr.Resource = texture; + + declaration_grow(declaration, header); + + return dr; +} + +static struct tgsi_declaration_sampler_view +tgsi_default_declaration_sampler_view(void) +{ + struct tgsi_declaration_sampler_view dsv; + + dsv.Resource = TGSI_BUFFER; + dsv.ReturnTypeX = PIPE_TYPE_UNORM; + dsv.ReturnTypeY = PIPE_TYPE_UNORM; + dsv.ReturnTypeZ = PIPE_TYPE_UNORM; + dsv.ReturnTypeW = PIPE_TYPE_UNORM; + + return dsv; +} + +static struct tgsi_declaration_sampler_view +tgsi_build_declaration_sampler_view(unsigned texture, +unsigned return_type_x, +unsigned return_type_y, +unsigned return_type_z, +unsigned return_type_w, +struct tgsi_declaration *declaration, +struct tgsi_header *header) +{ + struct tgsi_declaration_sampler_view dsv; - declaration_resource = tgsi_default_dec
[Mesa-dev] [PATCH v3 04/13] gallium/tgsi: Move interpolation info from tgsi_declaration to a separate token.
Move Interpolate, Centroid and CylindricalWrap from tgsi_declaration to a separate token -- they only make sense for FS inputs and we need room for other flags in the top-level declaration token. --- v3: Split sampler views from shader resources. src/gallium/auxiliary/draw/draw_pipe_aaline.c |3 +- src/gallium/auxiliary/draw/draw_pipe_aapoint.c |3 +- src/gallium/auxiliary/draw/draw_pipe_pstipple.c|3 +- src/gallium/auxiliary/tgsi/tgsi_build.c| 57 src/gallium/auxiliary/tgsi/tgsi_dump.c | 49 + src/gallium/auxiliary/tgsi/tgsi_exec.c |2 +- src/gallium/auxiliary/tgsi/tgsi_parse.c|4 ++ src/gallium/auxiliary/tgsi/tgsi_parse.h|1 + src/gallium/auxiliary/tgsi/tgsi_ppc.c |2 +- src/gallium/auxiliary/tgsi/tgsi_scan.c |6 +-- src/gallium/auxiliary/tgsi/tgsi_text.c |3 +- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 21 src/gallium/auxiliary/util/u_pstipple.c|3 +- src/gallium/docs/source/tgsi.rst | 24 + .../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp |4 +- src/gallium/drivers/r300/r300_vs_draw.c|3 +- src/gallium/drivers/r600/r600_shader.c |6 +-- src/gallium/drivers/radeonsi/radeonsi_shader.c |8 +-- src/gallium/include/pipe/p_shader_tokens.h | 13 +++-- 19 files changed, 141 insertions(+), 74 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index ea0a4fb..d6b9811 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -237,12 +237,13 @@ aa_transform_inst(struct tgsi_transform_context *ctx, decl = tgsi_default_full_declaration(); decl.Declaration.File = TGSI_FILE_INPUT; /* XXX this could be linear... */ - decl.Declaration.Interpolate = TGSI_INTERPOLATE_PERSPECTIVE; + decl.Declaration.Interpolate = 1; decl.Declaration.Semantic = 1; decl.Semantic.Name = TGSI_SEMANTIC_GENERIC; decl.Semantic.Index = aactx->maxGeneric + 1; decl.Range.First = decl.Range.Last = aactx->maxInput + 1; + decl.Interp.Interpolate = TGSI_INTERPOLATE_PERSPECTIVE; ctx->emit_declaration(ctx, &decl); /* declare new sampler */ diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index a900dd3..ec703d0 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -201,12 +201,13 @@ aa_transform_inst(struct tgsi_transform_context *ctx, decl = tgsi_default_full_declaration(); decl.Declaration.File = TGSI_FILE_INPUT; /* XXX this could be linear... */ - decl.Declaration.Interpolate = TGSI_INTERPOLATE_PERSPECTIVE; + decl.Declaration.Interpolate = 1; decl.Declaration.Semantic = 1; decl.Semantic.Name = TGSI_SEMANTIC_GENERIC; decl.Semantic.Index = aactx->maxGeneric + 1; decl.Range.First = decl.Range.Last = texInput; + decl.Interp.Interpolate = TGSI_INTERPOLATE_PERSPECTIVE; ctx->emit_declaration(ctx, &decl); /* declare new temp regs */ diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index cfb6ef4..842f6ee 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -234,12 +234,13 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, /* declare new position input reg */ decl = tgsi_default_full_declaration(); decl.Declaration.File = TGSI_FILE_INPUT; - decl.Declaration.Interpolate = TGSI_INTERPOLATE_LINEAR; /* XXX? */ + decl.Declaration.Interpolate = 1; decl.Declaration.Semantic = 1; decl.Semantic.Name = TGSI_SEMANTIC_POSITION; decl.Semantic.Index = 0; decl.Range.First = decl.Range.Last = wincoordInput; + decl.Interp.Interpolate = TGSI_INTERPOLATE_LINEAR; /* XXX? */ ctx->emit_declaration(ctx, &decl); } diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 6c3f775..b4f5003 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -104,12 +104,10 @@ tgsi_default_declaration( void ) declaration.NrTokens = 1; declaration.File = TGSI_FILE_NULL; declaration.UsageMask = TGSI_WRITEMASK_XYZW; - declaration.Interpolate = TGSI_INTERPOLATE_CONSTANT; + declaration.Interpolate = 0; declaration.Dimension = 0; declaration.Semantic = 0; - declaration.Centroid = 0; declaration.Invariant = 0; - declaration.CylindricalWrap = 0; return declaration; } @@ -121,9 +119,7 @@ tgsi_build_decla
[Mesa-dev] [PATCH v3 09/13] gallium/tgsi: Define system values used to query the compute grid parameters.
--- v3: Split sampler views from shader resources. src/gallium/auxiliary/tgsi/tgsi_strings.c |6 +- src/gallium/include/pipe/p_shader_tokens.h |6 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c index 1d959b6..d7b74ba 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c @@ -74,7 +74,11 @@ const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] = "VERTEXID", "STENCIL", "CLIPDIST", - "CLIPVERTEX" + "CLIPVERTEX", + "GRID_SIZE", + "BLOCK_ID", + "BLOCK_SIZE", + "THREAD_ID" }; const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] = diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index d45a914..70a3221 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -158,7 +158,11 @@ struct tgsi_declaration_interp #define TGSI_SEMANTIC_STENCIL12 #define TGSI_SEMANTIC_CLIPDIST 13 #define TGSI_SEMANTIC_CLIPVERTEX 14 -#define TGSI_SEMANTIC_COUNT 15 /**< number of semantic values */ +#define TGSI_SEMANTIC_GRID_SIZE 15 /**< grid size in blocks */ +#define TGSI_SEMANTIC_BLOCK_ID 16 /**< id of the current block */ +#define TGSI_SEMANTIC_BLOCK_SIZE 17 /**< block size in threads */ +#define TGSI_SEMANTIC_THREAD_ID 18 /**< block-relative id of the current thread */ +#define TGSI_SEMANTIC_COUNT 19 /**< number of semantic values */ struct tgsi_declaration_semantic { -- 1.7.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 06/13] gallium/tgsi: Define the TGSI_BUFFER texture target.
This texture type was already referred to by the documentation but it was never defined. Define it as 0 to match the pipe_texture_target enumeration values. --- v3: Split sampler views from shader resources. src/gallium/auxiliary/tgsi/tgsi_build.c|2 +- src/gallium/auxiliary/tgsi/tgsi_strings.c |2 +- src/gallium/auxiliary/util/u_blitter.c |2 +- src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp |4 ++-- src/gallium/include/pipe/p_shader_tokens.h |2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index b4f5003..1bcdef2 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -709,7 +709,7 @@ tgsi_default_instruction_texture( void ) { struct tgsi_instruction_texture instruction_texture; - instruction_texture.Texture = TGSI_TEXTURE_UNKNOWN; + instruction_texture.Texture = TGSI_BUFFER; instruction_texture.NumOffsets = 0; instruction_texture.Padding = 0; diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c index 3c7ab3b..1d959b6 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c @@ -79,7 +79,7 @@ const char *tgsi_semantic_names[TGSI_SEMANTIC_COUNT] = const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] = { - "UNKNOWN", + "BUFFER", "1D", "2D", "3D", diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index d0b9187..28e7383 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -674,7 +674,7 @@ pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target) return TGSI_TEXTURE_2D_ARRAY; default: assert(0 && "unexpected texture target"); - return TGSI_TEXTURE_UNKNOWN; + return 0; } } diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp index 6d0147b..955eb92 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp @@ -347,8 +347,8 @@ static nv50_ir::TexTarget translateTexture(uint tex) NV50_IR_TEX_TARG_CASE(SHADOW2D_ARRAY, 2D_ARRAY_SHADOW); NV50_IR_TEX_TARG_CASE(SHADOWCUBE, CUBE_SHADOW); NV50_IR_TEX_TARG_CASE(SHADOWRECT, RECT_SHADOW); - - case TGSI_TEXTURE_UNKNOWN: + case TGSI_BUFFER: + return nv50_ir::TEX_TARGET_BUFFER; default: assert(!"invalid texture target"); return nv50_ir::TEX_TARGET_2D; diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 3c97072..a62d7a2 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -466,7 +466,7 @@ struct tgsi_instruction_label unsigned Padding : 8; }; -#define TGSI_TEXTURE_UNKNOWN0 +#define TGSI_BUFFER 0 #define TGSI_TEXTURE_1D 1 #define TGSI_TEXTURE_2D 2 #define TGSI_TEXTURE_3D 3 -- 1.7.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 08/13] gallium/tgsi: Add resource write-back support.
Define a new STORE opcode with a role dual to the LOAD opcode, and add flags to specify that a shader resource is intended for writing. --- v3: Split sampler views from shader resources. src/gallium/auxiliary/tgsi/tgsi_build.c|4 src/gallium/auxiliary/tgsi/tgsi_dump.c |2 ++ src/gallium/auxiliary/tgsi/tgsi_info.c |1 + src/gallium/auxiliary/tgsi/tgsi_text.c |4 src/gallium/docs/source/context.rst|3 ++- src/gallium/docs/source/tgsi.rst | 28 +++- src/gallium/include/pipe/p_shader_tokens.h |6 -- src/gallium/include/pipe/p_state.h |1 + 8 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 2945a0d..8378075 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -258,6 +258,7 @@ tgsi_default_declaration_resource(void) dr.Resource = TGSI_BUFFER; dr.Raw = 0; + dr.Writable = 0; return dr; } @@ -265,6 +266,7 @@ tgsi_default_declaration_resource(void) static struct tgsi_declaration_resource tgsi_build_declaration_resource(unsigned texture, unsigned raw, +unsigned writable, struct tgsi_declaration *declaration, struct tgsi_header *header) { @@ -273,6 +275,7 @@ tgsi_build_declaration_resource(unsigned texture, dr = tgsi_default_declaration_resource(); dr.Resource = texture; dr.Raw = raw; + dr.Writable = writable; declaration_grow(declaration, header); @@ -443,6 +446,7 @@ tgsi_build_full_declaration( *dr = tgsi_build_declaration_resource(full_decl->Resource.Resource, full_decl->Resource.Raw, +full_decl->Resource.Writable, declaration, header); } diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index f48e390..3685946 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -285,6 +285,8 @@ iter_declaration( if (decl->Declaration.File == TGSI_FILE_RESOURCE) { TXT(", "); ENM(decl->Resource.Resource, tgsi_texture_names); + if (decl->Resource.Writable) + TXT(", WR"); if (decl->Resource.Raw) TXT(", RAW"); } diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index c41288f..46a9df1 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -200,6 +200,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 1, 0, 0, 0, 0, COMP, "IABS", TGSI_OPCODE_IABS }, { 1, 1, 0, 0, 0, 0, COMP, "ISSG", TGSI_OPCODE_ISSG }, { 1, 2, 0, 0, 0, 0, OTHR, "LOAD", TGSI_OPCODE_LOAD }, + { 1, 2, 0, 0, 0, 0, OTHR, "STORE", TGSI_OPCODE_STORE }, }; const struct tgsi_opcode_info * diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index ad9b304..52e30b4 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -1078,6 +1078,10 @@ static boolean parse_declaration( struct translate_ctx *ctx ) !is_digit_alpha_underscore(cur2)) { decl.Resource.Raw = 1; +} else if (str_match_no_case(&cur2, "WR") && +!is_digit_alpha_underscore(cur2)) { + decl.Resource.Writable = 1; + } else { break; } diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index eae400d..d17ea42 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -134,7 +134,8 @@ the ``level``, ``first_layer`` and ``last_layer`` pipe_surface fields specify the mipmap level and the range of layers the texture will be constrained to. In the case of buffers, ``first_element`` and ``last_element`` specify the range within the buffer that will be used -by the shader resource. +by the shader resource. Writes to a shader resource are only allowed +when the ``writable`` flag is set. Surfaces diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index eb8be46..f32aff1 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1490,6 +1490,29 @@ Resource Access Opcodes texture arrays and 2D textures. address.w is always ignored. +.. opcode:: STORE - Write data to a shader resource + + Syntax: ``STORE resource, address, src`` + + Example: ``STORE RES[0], TEMP[0], TEMP[1]`` + + Using the provided integer address, STORE write
[Mesa-dev] [PATCH v3 11/13] gallium/tgsi: Add support for atomic opcodes.
--- v3: Split sampler views from shader resources. src/gallium/auxiliary/tgsi/tgsi_info.c | 13 ++- src/gallium/docs/source/tgsi.rst | 164 src/gallium/include/pipe/p_shader_tokens.h | 13 ++- 3 files changed, 188 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index b06b9be..8bf9aeb 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -204,7 +204,18 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 0, 0, 0, 0, 0, OTHR, "MFENCE", TGSI_OPCODE_MFENCE }, { 1, 0, 0, 0, 0, 0, OTHR, "LFENCE", TGSI_OPCODE_LFENCE }, { 1, 0, 0, 0, 0, 0, OTHR, "SFENCE", TGSI_OPCODE_SFENCE }, - { 0, 0, 0, 0, 0, 0, OTHR, "BARRIER", TGSI_OPCODE_BARRIER } + { 0, 0, 0, 0, 0, 0, OTHR, "BARRIER", TGSI_OPCODE_BARRIER }, + + { 1, 3, 0, 0, 0, 0, OTHR, "ATOMUADD", TGSI_OPCODE_ATOMUADD }, + { 1, 3, 0, 0, 0, 0, OTHR, "ATOMXCHG", TGSI_OPCODE_ATOMXCHG }, + { 1, 4, 0, 0, 0, 0, OTHR, "ATOMCAS", TGSI_OPCODE_ATOMCAS }, + { 1, 3, 0, 0, 0, 0, OTHR, "ATOMAND", TGSI_OPCODE_ATOMAND }, + { 1, 3, 0, 0, 0, 0, OTHR, "ATOMOR", TGSI_OPCODE_ATOMOR }, + { 1, 3, 0, 0, 0, 0, OTHR, "ATOMXOR", TGSI_OPCODE_ATOMXOR }, + { 1, 3, 0, 0, 0, 0, OTHR, "ATOMUMIN", TGSI_OPCODE_ATOMUMIN }, + { 1, 3, 0, 0, 0, 0, OTHR, "ATOMUMAX", TGSI_OPCODE_ATOMUMAX }, + { 1, 3, 0, 0, 0, 0, OTHR, "ATOMIMIN", TGSI_OPCODE_ATOMIMIN }, + { 1, 3, 0, 0, 0, 0, OTHR, "ATOMIMAX", TGSI_OPCODE_ATOMIMAX } }; const struct tgsi_opcode_info * diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index 20611cb..1155ff3 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1563,6 +1563,170 @@ programs. threads terminates or never reaches an executed BARRIER instruction. +.. _atomopcodes: + +Atomic opcodes +^^ + +These opcodes provide atomic variants of some common arithmetic and +logical operations. In this context atomicity means that another +concurrent memory access operation that affects the same memory +location is guaranteed to be performed strictly before or after the +entire execution of the atomic operation. + +For the moment they're only valid in compute programs. + +.. opcode:: ATOMUADD - Atomic integer addition + + Syntax: ``ATOMUADD dst, resource, offset, src`` + + Example: ``ATOMUADD TEMP[0], RES[0], TEMP[1], TEMP[2]`` + + The following operation is performed atomically on each component: + +.. math:: + + dst_i = resource[offset]_i + + resource[offset]_i = dst_i + src_i + + +.. opcode:: ATOMXCHG - Atomic exchange + + Syntax: ``ATOMXCHG dst, resource, offset, src`` + + Example: ``ATOMXCHG TEMP[0], RES[0], TEMP[1], TEMP[2]`` + + The following operation is performed atomically on each component: + +.. math:: + + dst_i = resource[offset]_i + + resource[offset]_i = src_i + + +.. opcode:: ATOMCAS - Atomic compare-and-exchange + + Syntax: ``ATOMCAS dst, resource, offset, cmp, src`` + + Example: ``ATOMCAS TEMP[0], RES[0], TEMP[1], TEMP[2], TEMP[3]`` + + The following operation is performed atomically on each component: + +.. math:: + + dst_i = resource[offset]_i + + resource[offset]_i = (dst_i == cmp_i ? src_i : dst_i) + + +.. opcode:: ATOMAND - Atomic bitwise And + + Syntax: ``ATOMAND dst, resource, offset, src`` + + Example: ``ATOMAND TEMP[0], RES[0], TEMP[1], TEMP[2]`` + + The following operation is performed atomically on each component: + +.. math:: + + dst_i = resource[offset]_i + + resource[offset]_i = dst_i \& src_i + + +.. opcode:: ATOMOR - Atomic bitwise Or + + Syntax: ``ATOMOR dst, resource, offset, src`` + + Example: ``ATOMOR TEMP[0], RES[0], TEMP[1], TEMP[2]`` + + The following operation is performed atomically on each component: + +.. math:: + + dst_i = resource[offset]_i + + resource[offset]_i = dst_i | src_i + + +.. opcode:: ATOMXOR - Atomic bitwise Xor + + Syntax: ``ATOMXOR dst, resource, offset, src`` + + Example: ``ATOMXOR TEMP[0], RES[0], TEMP[1], TEMP[2]`` + + The following operation is performed atomically on each component: + +.. math:: + + dst_i = resource[offset]_i + + resource[offset]_i = dst_i \oplus src_i + + +.. opcode:: ATOMUMIN - Atomic unsigned minimum + + Syntax: ``ATOMUMIN dst, resource, offset, src`` + + Example: ``ATOMUMIN TEMP[0], RES[0], TEMP[1], TEMP[2]`` + + The following operation is performed atomically on each component: + +.. math:: + + dst_i = resource[offset]_i + + resource[offset]_i = (dst_i < src_i ? dst_i : src_i) + + +.. opcode:: ATOMUMAX - Atomic unsigned maximum + + Syntax: ``ATOMUMAX dst, resource, offset, src`` + + Example: ``ATOMUMAX TEMP[0], RES[0], TEMP[1], TEMP[2]`` + + The following operation is performed atomically on each component: + +.. math:: + + dst_i = resource[offset]_i + + resource[offset]_i = (dst_i > src_i ? dst_i : src_i) + + +.. opcode:: ATOMIMIN - Atomic signed minimum + + Syn
[Mesa-dev] [PATCH v3 07/13] gallium/tgsi: Add support for raw resources.
Normal resource access (e.g. the LOAD TGSI opcode) is supposed to perform a series of conversions to turn the texture data as it's found in memory into the target data type. In compute programs it's often the case that we only want to access the raw bits as they're stored in some buffer object, and any kind of channel conversion and scaling is harmful or inefficient, especially in implementations that lack proper hardware support to take care of it -- in those cases the conversion has to be implemented in software and it's likely to result in a performance hit even if the pipe_buffer and declaration data types are set up in a way that would just pass the data through. Add a declaration flag that marks a resource as typeless. No channel conversion will be performed in that case, and the X coordinate of the address vector will be interpreted in byte units instead of elements for obvious reasons. This is similar to D3D11's ByteAddressBuffer, and will be used to implement OpenCL's constant arguments. The remaining four compute memory spaces can also be understood as raw resources. --- v3: Split sampler views from shader resources. src/gallium/auxiliary/tgsi/tgsi_build.c|4 src/gallium/auxiliary/tgsi/tgsi_dump.c |2 ++ src/gallium/auxiliary/tgsi/tgsi_text.c | 20 ++-- src/gallium/docs/source/tgsi.rst | 15 ++- src/gallium/include/pipe/p_shader_tokens.h |3 ++- 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 1bcdef2..2945a0d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -257,12 +257,14 @@ tgsi_default_declaration_resource(void) struct tgsi_declaration_resource dr; dr.Resource = TGSI_BUFFER; + dr.Raw = 0; return dr; } static struct tgsi_declaration_resource tgsi_build_declaration_resource(unsigned texture, +unsigned raw, struct tgsi_declaration *declaration, struct tgsi_header *header) { @@ -270,6 +272,7 @@ tgsi_build_declaration_resource(unsigned texture, dr = tgsi_default_declaration_resource(); dr.Resource = texture; + dr.Raw = raw; declaration_grow(declaration, header); @@ -439,6 +442,7 @@ tgsi_build_full_declaration( size++; *dr = tgsi_build_declaration_resource(full_decl->Resource.Resource, +full_decl->Resource.Raw, declaration, header); } diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 328dfb1..f48e390 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -285,6 +285,8 @@ iter_declaration( if (decl->Declaration.File == TGSI_FILE_RESOURCE) { TXT(", "); ENM(decl->Resource.Resource, tgsi_texture_names); + if (decl->Resource.Raw) + TXT(", RAW"); } if (decl->Declaration.File == TGSI_FILE_SAMPLER_VIEW) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 0486275..ad9b304 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -1015,7 +1015,7 @@ static boolean parse_declaration( struct translate_ctx *ctx ) struct parsed_dcl_bracket brackets[2]; int num_brackets; uint writemask; - const char *cur; + const char *cur, *cur2; uint advance; boolean is_vs_input; boolean is_imm_array; @@ -1069,6 +1069,22 @@ static boolean parse_declaration( struct translate_ctx *ctx ) return FALSE; } + cur2 = cur; + eat_opt_white(&cur2); + while (*cur2 == ',') { +cur2++; +eat_opt_white(&cur2); +if (str_match_no_case(&cur2, "RAW") && +!is_digit_alpha_underscore(cur2)) { + decl.Resource.Raw = 1; + +} else { + break; +} +cur = cur2; +eat_opt_white(&cur2); + } + ctx->cur = cur; } else if (file == TGSI_FILE_SAMPLER_VIEW) { @@ -1122,7 +1138,7 @@ static boolean parse_declaration( struct translate_ctx *ctx ) } break; } else { - const char *cur2 = cur; + cur2 = cur; eat_opt_white( &cur2 ); if (*cur2 == ',') { cur2++; diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index 6a1cb7e..eb8be46 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1745,7 +1745,7 @@ Declaration Resource Follows Declaration token if file is TGSI_FILE_RESOURCE. - DCL RES[#], resource + DCL
[Mesa-dev] [PATCH v3 12/13] gallium/tgsi: Introduce the "LOCAL" register declaration modifier.
This change will be useful to implement function parameter passing on top of TGSI. As we don't have a proper stack, a register-based calling convention will be used instead, which isn't necessarily a bad thing given that GPUs often have plenty of registers to spare. Using the same register space for local temporaries and inter-procedural communication caused some inefficiencies, because in some cases the register allocator would lose the freedom to merge temporary values together into the same physical register, leading to suboptimal register (and sometimes, as a side effect, instruction) usage. The LOCAL declaration modifier specifies that the value isn't intended for parameter passing and as a result the compiler doesn't have to give any guarantees of it being preserved across function boundaries. Ignoring the LOCAL flag doesn't change the semantics of a valid program in any way, because local variables are just supposed to get a more relaxed treatment. IOW, this should be a backwards-compatible change. --- v3: Split sampler views from shader resources. src/gallium/auxiliary/tgsi/tgsi_build.c|4 ++ src/gallium/auxiliary/tgsi/tgsi_dump.c |3 ++ src/gallium/auxiliary/tgsi/tgsi_text.c | 65 +--- src/gallium/docs/source/tgsi.rst |6 +++ src/gallium/include/pipe/p_shader_tokens.h |3 +- 5 files changed, 54 insertions(+), 27 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 8378075..ed725c5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -108,6 +108,7 @@ tgsi_default_declaration( void ) declaration.Dimension = 0; declaration.Semantic = 0; declaration.Invariant = 0; + declaration.Local = 0; return declaration; } @@ -120,6 +121,7 @@ tgsi_build_declaration( unsigned dimension, unsigned semantic, unsigned invariant, + unsigned local, struct tgsi_header *header ) { struct tgsi_declaration declaration; @@ -134,6 +136,7 @@ tgsi_build_declaration( declaration.Dimension = dimension; declaration.Semantic = semantic; declaration.Invariant = invariant; + declaration.Local = local; header_bodysize_grow( header ); @@ -359,6 +362,7 @@ tgsi_build_full_declaration( full_decl->Declaration.Dimension, full_decl->Declaration.Semantic, full_decl->Declaration.Invariant, + full_decl->Declaration.Local, header ); if (maxsize <= size) diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 3685946..383c545 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -271,6 +271,9 @@ iter_declaration( ctx, decl->Declaration.UsageMask ); + if (decl->Declaration.Local) + TXT( ", LOCAL" ); + if (decl->Declaration.Semantic) { TXT( ", " ); ENM( decl->Semantic.Name, tgsi_semantic_names ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 52e30b4..c87313a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -1161,38 +1161,51 @@ static boolean parse_declaration( struct translate_ctx *ctx ) } ctx->cur = cur; } else { - for (i = 0; i < TGSI_SEMANTIC_COUNT; i++) { -if (str_match_no_case( &cur, tgsi_semantic_names[i] )) { - const char *cur2 = cur; - uint index; + if (str_match_no_case(&cur, "LOCAL") && + !is_digit_alpha_underscore(cur)) { +decl.Declaration.Local = 1; +ctx->cur = cur; + } - if (is_digit_alpha_underscore( cur )) - continue; - eat_opt_white( &cur2 ); - if (*cur2 == '[') { - cur2++; - eat_opt_white( &cur2 ); - if (!parse_uint( &cur2, &index )) { - report_error( ctx, "Expected literal integer" ); - return FALSE; - } + cur = ctx->cur; + eat_opt_white( &cur ); + if (*cur == ',') { +cur++; +eat_opt_white( &cur ); + +for (i = 0; i < TGSI_SEMANTIC_COUNT; i++) { + if (str_match_no_case( &cur, tgsi_semantic_names[i] )) { + uint index; + + if (is_digit_alpha_underscore( cur )) + continue; + cur2 = cur; eat_opt_white( &cur2 ); - if (*cur2 != ']') { - report_error( ctx, "Expected `]'" ); - return FALSE; - } - cur2++; + if (*cur2 == '[') { + cur2++; + eat_opt_white( &cur2 ); + if (!parse_uint( &cur2, &index )) { +
[Mesa-dev] [PATCH v3 10/13] gallium/tgsi: Add support for barriers.
--- v3: Split sampler views from shader resources. src/gallium/auxiliary/tgsi/tgsi_info.c |4 +++ src/gallium/docs/source/tgsi.rst | 49 src/gallium/include/pipe/p_shader_tokens.h |7 +++- 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index 46a9df1..b06b9be 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -201,6 +201,10 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 1, 0, 0, 0, 0, COMP, "ISSG", TGSI_OPCODE_ISSG }, { 1, 2, 0, 0, 0, 0, OTHR, "LOAD", TGSI_OPCODE_LOAD }, { 1, 2, 0, 0, 0, 0, OTHR, "STORE", TGSI_OPCODE_STORE }, + { 1, 0, 0, 0, 0, 0, OTHR, "MFENCE", TGSI_OPCODE_MFENCE }, + { 1, 0, 0, 0, 0, 0, OTHR, "LFENCE", TGSI_OPCODE_LFENCE }, + { 1, 0, 0, 0, 0, 0, OTHR, "SFENCE", TGSI_OPCODE_SFENCE }, + { 0, 0, 0, 0, 0, 0, OTHR, "BARRIER", TGSI_OPCODE_BARRIER } }; const struct tgsi_opcode_info * diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index f32aff1..20611cb 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1514,6 +1514,55 @@ Resource Access Opcodes ignored. +.. _threadsyncopcodes: + +Inter-thread synchronization opcodes + + +These opcodes are intended for communication between threads running +within the same compute grid. For now they're only valid in compute +programs. + +.. opcode:: MFENCE - Memory fence + + Syntax: ``MFENCE resource`` + + Example: ``MFENCE RES[0]`` + + This opcode forces strong ordering between any memory access + operations that affect the specified resource. This means that + previous loads and stores (and only those) will be performed and + visible to other threads before the program execution continues. + + +.. opcode:: LFENCE - Load memory fence + + Syntax: ``LFENCE resource`` + + Example: ``LFENCE RES[0]`` + + Similar to MFENCE, but it only affects the ordering of memory loads. + + +.. opcode:: SFENCE - Store memory fence + + Syntax: ``SFENCE resource`` + + Example: ``SFENCE RES[0]`` + + Similar to MFENCE, but it only affects the ordering of memory stores. + + +.. opcode:: BARRIER - Thread group barrier + + ``BARRIER`` + + This opcode suspends the execution of the current thread until all + the remaining threads in the working group reach the same point of + the program. Results are unspecified if any of the remaining + threads terminates or never reaches an executed BARRIER instruction. + + Explanation of symbols used -- diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 70a3221..41347ad 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -413,7 +413,12 @@ struct tgsi_property_data { #define TGSI_OPCODE_LOAD161 #define TGSI_OPCODE_STORE 162 -#define TGSI_OPCODE_LAST163 +#define TGSI_OPCODE_MFENCE 163 +#define TGSI_OPCODE_LFENCE 164 +#define TGSI_OPCODE_SFENCE 165 +#define TGSI_OPCODE_BARRIER 166 + +#define TGSI_OPCODE_LAST167 #define TGSI_SAT_NONE0 /* do not saturate */ #define TGSI_SAT_ZERO_ONE1 /* clamp to [0,1] */ -- 1.7.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 13/13] gallium/compute: Drop TGSI dependency.
Add a shader cap for specifying the preferred shader representation. Right now the only supported value is TGSI, other enum values will be added as they are needed. This is mainly to accommodate AMD's LLVM compiler back-end by letting it bypass the TGSI representation for compute programs. Other drivers will keep using the common TGSI instruction set. Reviewed-by: Tom Stellard --- v2: Use an enumeration instead of a string, and make it a shader cap instead of a compute-specific cap. v3: Split sampler views from shader resources. src/gallium/docs/source/screen.rst |2 ++ src/gallium/include/pipe/p_defines.h | 11 ++- src/gallium/include/pipe/p_state.h |2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 8e45840..d912dc6 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -185,6 +185,8 @@ to be 0. If unsupported, only float opcodes are supported. * ``PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS``: THe maximum number of texture samplers. +* ``PIPE_SHADER_CAP_PREFERRED_IR``: Preferred representation of the + program. It should be one of the ``pipe_shader_ir`` enum values. .. _pipe_compute_cap: diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 9a0bce1..edcca23 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -524,7 +524,16 @@ enum pipe_shader_cap PIPE_SHADER_CAP_INDIRECT_CONST_ADDR = 15, PIPE_SHADER_CAP_SUBROUTINES = 16, /* BGNSUB, ENDSUB, CAL, RET */ PIPE_SHADER_CAP_INTEGERS = 17, - PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS = 18 + PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS = 18, + PIPE_SHADER_CAP_PREFERRED_IR = 19 +}; + +/** + * Shader intermediate representation. + */ +enum pipe_shader_ir +{ + PIPE_SHADER_IR_TGSI }; /** diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 7e741cf..02cd1fd 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -584,7 +584,7 @@ struct pipe_resolve_info struct pipe_compute_state { - const struct tgsi_token *tokens; /**< Compute program to be executed. */ + const void *prog; /**< Compute program to be executed. */ unsigned req_local_mem; /**< Required size of the LOCAL resource. */ unsigned req_private_mem; /**< Required size of the PRIVATE resource. */ unsigned req_input_mem; /**< Required size of the INPUT resource. */ -- 1.7.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa/main: Add primitive restart support to glArrayElement
When primitive restart is enabled, and glArrayElement is called with the restart index value, then call glPrimitiveRestartNV. Signed-off-by: Jordan Justen --- src/mesa/main/api_arrayelt.c | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index 7bf55f3..6de6de2 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -1643,12 +1643,20 @@ void GLAPIENTRY _ae_ArrayElement( GLint elt ) const struct _glapi_table * const disp = GET_DISPATCH(); GLboolean do_map; + /* If PrimitiveRestart is enabled and the index is the RestartIndex +* then we call PrimitiveRestartNV and return. +*/ + if (ctx->Array.PrimitiveRestart && (elt == ctx->Array.RestartIndex)) { + CALL_PrimitiveRestartNV((struct _glapi_table *)disp, ()); + return; + } + if (actx->NewState) { assert(!actx->mapped_vbos); _ae_update_state( ctx ); } - /* Determine if w need to map/unmap VBOs */ + /* Determine if we need to map/unmap VBOs */ do_map = actx->nr_vbos && !actx->mapped_vbos; if (do_map) -- 1.7.5.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] softpipe: implement coord clamping for texel fetches (TXF)
The whole series looks good to me. Jose - Original Message - > From: Brian Paul > > The GL spec says out of bounds fetches produce undefined results. > Use clamping to avoid failed assertions or crashes. > > Fixes failed assertion in > https://bugs.freedesktop.org/show_bug.cgi?id=49125 > but the test still fails. > --- > src/gallium/drivers/softpipe/sp_tex_sample.c | 45 > ++ > 1 files changed, 31 insertions(+), 14 deletions(-) > > diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c > b/src/gallium/drivers/softpipe/sp_tex_sample.c > index d54e02e..83d9be8 100644 > --- a/src/gallium/drivers/softpipe/sp_tex_sample.c > +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c > @@ -799,7 +799,8 @@ get_texel_2d_array(const struct > sp_sampler_variant *samp, > const struct pipe_resource *texture = samp->view->texture; > unsigned level = addr.bits.level; > > - assert(layer < texture->array_size); > + assert(layer < (int) texture->array_size); > + assert(layer >= 0); > > if (x < 0 || x >= (int) u_minify(texture->width0, level) || > y < 0 || y >= (int) u_minify(texture->height0, level)) { > @@ -2630,8 +2631,12 @@ sample_get_dims(struct tgsi_sampler > *tgsi_sampler, int level, > } > } > > -/* this function is only used for unfiltered texel gets > - via the TGSI TXF opcode. */ > +/** > + * This function is only used for getting unfiltered texels via the > + * TXF opcode. The GL spec says that out-of-bounds texel fetches > + * produce undefined results. Instead of crashing, lets just clamp > + * coords to the texture image size. > + */ > static void > sample_get_texels(struct tgsi_sampler *tgsi_sampler, > const int v_i[TGSI_QUAD_SIZE], > @@ -2650,15 +2655,22 @@ sample_get_texels(struct tgsi_sampler > *tgsi_sampler, > samp->key.bits.swizzle_g != > PIPE_SWIZZLE_GREEN || > samp->key.bits.swizzle_b != > PIPE_SWIZZLE_BLUE || > samp->key.bits.swizzle_a != > PIPE_SWIZZLE_ALPHA); > + int width, height, depth, layers; > > addr.value = 0; > /* TODO write a better test for LOD */ > addr.bits.level = lod[0]; > > + width = u_minify(texture->width0, addr.bits.level); > + height = u_minify(texture->height0, addr.bits.level); > + depth = u_minify(texture->depth0, addr.bits.level); > + layers = texture->array_size; > + > switch(texture->target) { > case PIPE_TEXTURE_1D: >for (j = 0; j < TGSI_QUAD_SIZE; j++) { > - tx = get_texel_2d(samp, addr, v_i[j] + offset[0], 0); > + int x = CLAMP(v_i[j] + offset[0], 0, width - 1); > + tx = get_texel_2d(samp, addr, x, 0); >for (c = 0; c < 4; c++) { > rgba[c][j] = tx[c]; >} > @@ -2666,8 +2678,9 @@ sample_get_texels(struct tgsi_sampler > *tgsi_sampler, >break; > case PIPE_TEXTURE_1D_ARRAY: >for (j = 0; j < TGSI_QUAD_SIZE; j++) { > - tx = get_texel_1d_array(samp, addr, v_i[j] + offset[0], > - v_j[j] + offset[1]); > + int x = CLAMP(v_i[j] + offset[0], 0, width - 1); > + int y = CLAMP(v_j[j] + offset[1], 0, layers - 1); > + tx = get_texel_1d_array(samp, addr, x, y); >for (c = 0; c < 4; c++) { > rgba[c][j] = tx[c]; >} > @@ -2676,8 +2689,9 @@ sample_get_texels(struct tgsi_sampler > *tgsi_sampler, > case PIPE_TEXTURE_2D: > case PIPE_TEXTURE_RECT: >for (j = 0; j < TGSI_QUAD_SIZE; j++) { > - tx = get_texel_2d(samp, addr, v_i[j] + offset[0], > -v_j[j] + offset[1]); > + int x = CLAMP(v_i[j] + offset[0], 0, width - 1); > + int y = CLAMP(v_j[j] + offset[1], 0, height - 1); > + tx = get_texel_2d(samp, addr, x, y); >for (c = 0; c < 4; c++) { > rgba[c][j] = tx[c]; >} > @@ -2685,9 +2699,10 @@ sample_get_texels(struct tgsi_sampler > *tgsi_sampler, >break; > case PIPE_TEXTURE_2D_ARRAY: >for (j = 0; j < TGSI_QUAD_SIZE; j++) { > - tx = get_texel_2d_array(samp, addr, v_i[j] + offset[0], > - v_j[j] + offset[1], > - v_k[j] + offset[2]); > + int x = CLAMP(v_i[j] + offset[0], 0, width - 1); > + int y = CLAMP(v_j[j] + offset[1], 0, height - 1); > + int layer = CLAMP(v_k[j] + offset[2], 0, layers - 1); > + tx = get_texel_2d_array(samp, addr, x, y, layer); >for (c = 0; c < 4; c++) { > rgba[c][j] = tx[c]; >} > @@ -2695,9 +2710,11 @@ sample_get_texels(struct tgsi_sampler > *tgsi_sampler, >break; > case PIPE_TEXTURE_3D: >for (j = 0; j < TGSI_QUAD_SIZE; j++) { > - tx = get_texel_3d(samp, addr, v_i[j] + offset[0], > -v_j[j] + offset[1], > -v_k[j] + offset[2]); > + int x = CLAMP(v_i[j] + offset[0], 0, wid
Re: [Mesa-dev] [PATCH 2/6] New unary opcodes for ARB_shader_bit_encoding support.
On Tue, 1 May 2012 08:52:51 +0200, Olivier Galibert wrote: > On Mon, Apr 30, 2012 at 02:21:51PM -0700, Eric Anholt wrote: > > GLSL 1.30 is already on for gen6+. You can force 1.30 for your purposes > > if needed on older hardware with the environment variable: > > > > MESA_GLSL_VERSION_OVERRIDE=130 > > > > (Also, there's MESA_EXTENSION_OVERRIDE="+GL_ARB_texture_buffer_object > > +GL_ARB_uniform_buffer_object" or MESA_GL_VERSION_OVERRIDE for poking at > > new extension support before the driver's ready) > > Thanks. The only intel hardware I have is a GM45 (8086:2a43) which is > seems qualifies at gen4. I rememeber from my casual reading of the > hardware docs that it seemed 3.3-capable. Did I miss something? Issues with GL 3.0 pre-gen6: - No MSAA. You'd have to fake it with supersampling. - Doesn't support filtering on 32-bit float textures. - transform feedback is different and needs backporting. - GLSL noperspective/smooth/flat keywords are handled very differently in the SF. pgpCf15AYmxcy.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/4] radeon: use _mesa_is_winsys/user_fbo() helpers
On Tue, 1 May 2012 08:48:39 -0600, Brian Paul wrote: > From: Brian Paul Series is: Reviewed-by: Eric Anholt pgpU6m9maDXLZ.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/6] New unary opcodes for ARB_shader_bit_encoding support.
On 05/01/2012 10:24 AM, Eric Anholt wrote: On Tue, 1 May 2012 08:52:51 +0200, Olivier Galibert wrote: On Mon, Apr 30, 2012 at 02:21:51PM -0700, Eric Anholt wrote: GLSL 1.30 is already on for gen6+. You can force 1.30 for your purposes if needed on older hardware with the environment variable: MESA_GLSL_VERSION_OVERRIDE=130 (Also, there's MESA_EXTENSION_OVERRIDE="+GL_ARB_texture_buffer_object +GL_ARB_uniform_buffer_object" or MESA_GL_VERSION_OVERRIDE for poking at new extension support before the driver's ready) Thanks. The only intel hardware I have is a GM45 (8086:2a43) which is seems qualifies at gen4. I rememeber from my casual reading of the hardware docs that it seemed 3.3-capable. Did I miss something? Issues with GL 3.0 pre-gen6: - No MSAA. You'd have to fake it with supersampling. - Doesn't support filtering on 32-bit float textures. - transform feedback is different and needs backporting. - GLSL noperspective/smooth/flat keywords are handled very differently in the SF. Also, support for gl_ClipDistance pre-Gen6 would be a lot of work, as Gen4-5 used a programmable clipping stage (?!?), and we'd basically have to rewrite all the clipping programs. That's one of the major reasons why 1.30 is off pre-Gen6. I'll go ahead and write the patch, since exposing it without 1.30 doesn't make a lot of sense. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 49124] swrast/s_texfetch.c:1156: set_fetch_functions: Assertion `texImage->FetchTexel' failed.
https://bugs.freedesktop.org/show_bug.cgi?id=49124 Brian Paul changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Comment #2 from Brian Paul 2012-05-01 13:15:31 PDT --- Fixed w/ piglit commit a50bc91c44f21214569d2c567f803d3a92af6ab5 -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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 49124] swrast/s_texfetch.c:1156: set_fetch_functions: Assertion `texImage->FetchTexel' failed.
https://bugs.freedesktop.org/show_bug.cgi?id=49124 --- Comment #3 from nobled 2012-05-01 13:29:35 UTC --- Test failure aside, shouldn't the assert still be fixed? A buggy client shouldn't be able to cause that. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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] mesa: do more teximage error checking for generic compressed formats
When glTexImage or glCopyTexImage is called with internalFormat being a generic compressed format (like GL_COMPRESSED_RGB) we need to do the same error checks as for specific compressed formats. In particular, check if the texture target is compatible with the format. None of the texture compression formats we support so far work with GL_TEXTURE_1D, for example. See also https://bugs.freedesktop.org/show_bug.cgi?id=49124 NOTE: This is a candidate for the 8.0 branch. --- src/mesa/main/teximage.c | 32 ++-- 1 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 50095d2..694f6fa 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -531,6 +531,32 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ) /** + * Is the given texture format a generic compressed format? + */ +static GLboolean +is_generic_compressed_format(GLenum format) +{ + switch (format) { + case GL_COMPRESSED_RED: + case GL_COMPRESSED_RG: + case GL_COMPRESSED_RGB: + case GL_COMPRESSED_RGBA: + case GL_COMPRESSED_ALPHA: + case GL_COMPRESSED_LUMINANCE: + case GL_COMPRESSED_LUMINANCE_ALPHA: + case GL_COMPRESSED_INTENSITY: + case GL_COMPRESSED_SRGB: + case GL_COMPRESSED_SRGB_ALPHA: + case GL_COMPRESSED_SLUMINANCE: + case GL_COMPRESSED_SLUMINANCE_ALPHA: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + +/** * For cube map faces, return a face index in [0,5]. * For other targets return 0; */ @@ -1705,7 +1731,8 @@ texture_error_check( struct gl_context *ctx, } /* additional checks for compressed textures */ - if (_mesa_is_compressed_format(ctx, internalFormat)) { + if (_mesa_is_compressed_format(ctx, internalFormat) || + is_generic_compressed_format(internalFormat)) { if (!target_can_be_compressed(ctx, target, internalFormat)) { if (!isProxy) _mesa_error(ctx, GL_INVALID_ENUM, @@ -2036,7 +2063,8 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, return GL_TRUE; } - if (_mesa_is_compressed_format(ctx, internalFormat)) { + if (_mesa_is_compressed_format(ctx, internalFormat) || + is_generic_compressed_format(internalFormat)) { if (!target_can_be_compressed(ctx, target, internalFormat)) { _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexImage%dD(target)", dimensions); -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 49124] swrast/s_texfetch.c:1156: set_fetch_functions: Assertion `texImage->FetchTexel' failed.
https://bugs.freedesktop.org/show_bug.cgi?id=49124 --- Comment #4 from Brian Paul 2012-05-01 14:16:28 PDT --- Yes, I already posted a Mesa patch to fix that side of it. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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] mesa/main: Add primitive restart support to glArrayElement
On 05/01/2012 10:09 AM, Jordan Justen wrote: When primitive restart is enabled, and glArrayElement is called with the restart index value, then call glPrimitiveRestartNV. Signed-off-by: Jordan Justen --- src/mesa/main/api_arrayelt.c | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index 7bf55f3..6de6de2 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -1643,12 +1643,20 @@ void GLAPIENTRY _ae_ArrayElement( GLint elt ) const struct _glapi_table * const disp = GET_DISPATCH(); GLboolean do_map; + /* If PrimitiveRestart is enabled and the index is the RestartIndex +* then we call PrimitiveRestartNV and return. +*/ + if (ctx->Array.PrimitiveRestart&& (elt == ctx->Array.RestartIndex)) { + CALL_PrimitiveRestartNV((struct _glapi_table *)disp, ()); + return; + } + if (actx->NewState) { assert(!actx->mapped_vbos); _ae_update_state( ctx ); } - /* Determine if w need to map/unmap VBOs */ + /* Determine if we need to map/unmap VBOs */ do_map = actx->nr_vbos&& !actx->mapped_vbos; if (do_map) You might add a note to the commit message that this is a candidate for the 8.0 / stable branch. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] intel: Remove pointless software fallback for glBitmap on Gen6.
We already have a meta path below that works just fine; no apparent regressions in oglconform. NOTE: This is a candidate for the 8.0 branch. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46834 --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c |4 1 file changed, 4 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index bdfb9ab..6821b69 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -337,9 +337,5 @@ intelBitmap(struct gl_context * ctx, unpack, pixels)) return; - /* FIXME */ - if (intel->gen == 6) - return _swrast_Bitmap(ctx, x, y, width, height, unpack, pixels); - _mesa_meta_Bitmap(ctx, x, y, width, height, unpack, pixels); } -- 1.7.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4 v2] glsl: consolidate code
And lay the groundwork for GL_ARB_debug_output. --- src/glsl/glsl_parser_extras.cpp | 33 +++-- 1 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index ae7a365..6a4ab4a 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -134,24 +134,34 @@ _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target) return "unknown"; } +static void +_mesa_glsl_msg(const YYLTYPE *locp, _mesa_glsl_parse_state *state, + GLenum type, GLuint id, const char *fmt, va_list ap) +{ + bool error = (type == GL_DEBUG_TYPE_ERROR_ARB); + + assert(state->info_log != NULL); + ralloc_asprintf_append(&state->info_log, "%u:%u(%u): %s: ", + locp->source, + locp->first_line, + locp->first_column, + error ? "error" : "warning"); + ralloc_vasprintf_append(&state->info_log, fmt, ap); + ralloc_strcat(&state->info_log, "\n"); +} void _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state, const char *fmt, ...) { va_list ap; + GLenum type = GL_DEBUG_TYPE_ERROR_ARB; state->error = true; - assert(state->info_log != NULL); - ralloc_asprintf_append(&state->info_log, "%u:%u(%u): error: ", - locp->source, - locp->first_line, - locp->first_column); va_start(ap, fmt); - ralloc_vasprintf_append(&state->info_log, fmt, ap); + _mesa_glsl_msg(locp, state, type, SHADER_ERROR_UNKNOWN, fmt, ap); va_end(ap); - ralloc_strcat(&state->info_log, "\n"); } @@ -160,16 +170,11 @@ _mesa_glsl_warning(const YYLTYPE *locp, _mesa_glsl_parse_state *state, const char *fmt, ...) { va_list ap; + GLenum type = GL_DEBUG_TYPE_OTHER_ARB; - assert(state->info_log != NULL); - ralloc_asprintf_append(&state->info_log, "%u:%u(%u): warning: ", - locp->source, - locp->first_line, - locp->first_column); va_start(ap, fmt); - ralloc_vasprintf_append(&state->info_log, fmt, ap); + _mesa_glsl_msg(locp, state, type, 0, fmt, ap); va_end(ap); - ralloc_strcat(&state->info_log, "\n"); } -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4 v2] mesa: add _mesa_shader_debug()
This should be the one entrypoint libglsl needs for GL_ARB_debug_output. --- src/mesa/main/errors.c | 34 ++ src/mesa/main/errors.h |4 2 files changed, 38 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index fcf873f..be271eb 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -1062,4 +1062,38 @@ _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) (void) fmtString; } + +void +_mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint err, +const char *msg, int len ) +{ + GLenum source = GL_DEBUG_SOURCE_SHADER_COMPILER_ARB, + severity; + + switch (type) { + case GL_DEBUG_TYPE_ERROR_ARB: + assert(err < SHADER_ERROR_COUNT); + severity = GL_DEBUG_SEVERITY_HIGH_ARB; + break; + case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: + case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB: + case GL_DEBUG_TYPE_PORTABILITY_ARB: + case GL_DEBUG_TYPE_PERFORMANCE_ARB: + case GL_DEBUG_TYPE_OTHER_ARB: + assert(0 && "other categories not implemented yet"); + default: + _mesa_problem(ctx, "bad enum in _mesa_shader_debug()"); + return; + } + + if (len < 0) + len = strlen(msg); + + /* Truncate the message if necessary. */ + if (len >= MAX_DEBUG_MESSAGE_LENGTH) + len = MAX_DEBUG_MESSAGE_LENGTH - 1; + + _mesa_log_msg(ctx, source, type, err, severity, len, msg); +} + /*@}*/ diff --git a/src/mesa/main/errors.h b/src/mesa/main/errors.h index ed1c6fc..2b4f5ff 100644 --- a/src/mesa/main/errors.h +++ b/src/mesa/main/errors.h @@ -38,6 +38,7 @@ #include "compiler.h" #include "glheader.h" +#include "mtypes.h" #ifdef __cplusplus @@ -68,6 +69,9 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... ) extern void _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3); +extern void +_mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint err, const char *msg, int len ); + #ifdef __cplusplus } #endif -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/4 resend] glsl: add gl_context member
--- src/glsl/glsl_parser_extras.cpp |3 ++- src/glsl/glsl_parser_extras.h |3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 6a4ab4a..3d99cc5 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -36,8 +36,9 @@ extern "C" { #include "ir_optimization.h" #include "loop_analysis.h" -_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx, +_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, GLenum target, void *mem_ctx) + : ctx(_ctx) { switch (target) { case GL_VERTEX_SHADER: this->target = vertex_shader; break; diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 55676f5..1a909c6 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -57,7 +57,7 @@ struct glsl_switch_state { }; struct _mesa_glsl_parse_state { - _mesa_glsl_parse_state(struct gl_context *ctx, GLenum target, + _mesa_glsl_parse_state(struct gl_context *_ctx, GLenum target, void *mem_ctx); /* Callers of this ralloc-based new need not call delete. It's @@ -77,6 +77,7 @@ struct _mesa_glsl_parse_state { ralloc_free(mem); } + struct gl_context *const ctx; void *scanner; exec_list translation_unit; glsl_symbol_table *symbols; -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4 v2] glsl: report errors via GL_ARB_debug_output
--- src/glsl/glsl_parser_extras.cpp | 11 +++ src/glsl/standalone_scaffolding.cpp |6 ++ src/glsl/standalone_scaffolding.h |4 3 files changed, 21 insertions(+), 0 deletions(-) diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 3d99cc5..d2469f5 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -142,12 +142,23 @@ _mesa_glsl_msg(const YYLTYPE *locp, _mesa_glsl_parse_state *state, bool error = (type == GL_DEBUG_TYPE_ERROR_ARB); assert(state->info_log != NULL); + + /* Get the offset that the new message will be written to. */ + int msg_offset = strlen(state->info_log); + ralloc_asprintf_append(&state->info_log, "%u:%u(%u): %s: ", locp->source, locp->first_line, locp->first_column, error ? "error" : "warning"); ralloc_vasprintf_append(&state->info_log, fmt, ap); + + const char *const msg = &state->info_log[msg_offset]; + struct gl_context *ctx = state->ctx; + /* Report the error via GL_ARB_debug_output. */ + if (error) + _mesa_shader_debug(ctx, type, id, msg, strlen(msg)); + ralloc_strcat(&state->info_log, "\n"); } diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp index 24cc64a..f15f2d8 100644 --- a/src/glsl/standalone_scaffolding.cpp +++ b/src/glsl/standalone_scaffolding.cpp @@ -41,6 +41,12 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr, *ptr = sh; } +void +_mesa_shader_debug(struct gl_context *, GLenum, GLuint, + const char *, int) +{ +} + struct gl_shader * _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type) { diff --git a/src/glsl/standalone_scaffolding.h b/src/glsl/standalone_scaffolding.h index 8773320..41ce35b 100644 --- a/src/glsl/standalone_scaffolding.h +++ b/src/glsl/standalone_scaffolding.h @@ -40,6 +40,10 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr, extern "C" struct gl_shader * _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type); +extern "C" void +_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint id, + const char *msg, int len); + /** * Initialize the given gl_context structure to a reasonable set of * defaults representing the minimum capabilities required by the -- 1.7.4.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] intel: Remove pointless software fallback for glBitmap on Gen6.
On 05/01/2012 03:53 PM, Kenneth Graunke wrote: > We already have a meta path below that works just fine; no apparent > regressions in oglconform. > > NOTE: This is a candidate for the 8.0 branch. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46834 > --- > src/mesa/drivers/dri/intel/intel_pixel_bitmap.c |4 > 1 file changed, 4 deletions(-) > > diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c > b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c > index bdfb9ab..6821b69 100644 > --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c > +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c > @@ -337,9 +337,5 @@ intelBitmap(struct gl_context * ctx, >unpack, pixels)) >return; > > - /* FIXME */ > - if (intel->gen == 6) > - return _swrast_Bitmap(ctx, x, y, width, height, unpack, pixels); > - > _mesa_meta_Bitmap(ctx, x, y, width, height, unpack, pixels); > } Approximately three months ago, disabling the fallback here caused a gpu hang in mesa-demos:src/samples/bitmap2.c, which uses *gasp* stencil bitmaps. I'm hoping your recent STC patch fixed the hang. As long as the hang no longer occurs with an up-to-date kernel, Reviewed-by: Chad Versace ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] intel: Remove pointless software fallback for glBitmap on Gen6.
On 05/01/2012 04:41 PM, Chad Versace wrote: On 05/01/2012 03:53 PM, Kenneth Graunke wrote: We already have a meta path below that works just fine; no apparent regressions in oglconform. NOTE: This is a candidate for the 8.0 branch. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46834 --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c |4 1 file changed, 4 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index bdfb9ab..6821b69 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -337,9 +337,5 @@ intelBitmap(struct gl_context * ctx, unpack, pixels)) return; - /* FIXME */ - if (intel->gen == 6) - return _swrast_Bitmap(ctx, x, y, width, height, unpack, pixels); - _mesa_meta_Bitmap(ctx, x, y, width, height, unpack, pixels); } Approximately three months ago, disabling the fallback here caused a gpu hang in mesa-demos:src/samples/bitmap2.c, which uses *gasp* stencil bitmaps. I'm hoping your recent STC patch fixed the hang. As long as the hang no longer occurs with an up-to-date kernel, Reviewed-by: Chad Versace Yeah, I'm not sure what fixed it, but with modern components it works. Thanks! ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 49360] New: Build: gen_matypes does not use $HOST_LDFLAGS
https://bugs.freedesktop.org/show_bug.cgi?id=49360 Bug #: 49360 Summary: Build: gen_matypes does not use $HOST_LDFLAGS Classification: Unclassified Product: Mesa Version: git Platform: Other OS/Version: All Status: NEW Severity: minor Priority: medium Component: Other AssignedTo: mesa-dev@lists.freedesktop.org ReportedBy: bugs-fdo.8eaf7cd8e5128d819...@spamgourmet.com In mesa-7.11.2, but still present in the current HEAD of 83a02427e576a5126a618c13bc3e12ff2b4a3e0a, src/mesa/x86/Makefile has a rule to build a helper program gen_matypes, which is then run on the build host: gen_matypes: gen_matypes.c $(HOST_CC) $(ARCH_FLAGS) $(INCLUDE_DIRS) $(HOST_CFLAGS) gen_matypes.c -o gen_matypes However, this rule does not include a reference to $(HOST_LDFLAGS). In some setups, such as the one where I noticed this, a successful link requires the flags that are specified in $(HOST_LDFLAGS). Omitting that reference causes the link to fail. Please consider changing the recipe to read: $(HOST_CC) $(ARCH_FLAGS) $(INCLUDE_DIRS) $(HOST_CFLAGS) $(HOST_LDFLAGS) gen_matypes.c -o gen_matypes -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- 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] UBO progress
I've pushed a "ubo" branch to my personal tree on fdo containing the start of work on UBOs. I pulled the glapi changes from vlj, but didn't take much else -- his grammar was oddly divergent from the spec, I didn't like the parallel type structure, and the interaction with the GL API for uniforms had all changed anyway. Right now, it's passing the piglit tests I sent out except for the error check in the getuniformlocation. I'm going to wait until I get some UBO loads working in i965, and possibly fix up the qualifier handling, before I send patches out for review. I think the alignment/size interfaces I have will be reasonable for drivers to use, but I'm not sure. pgplrkGxedV4n.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PULL demos] eglut: Add wayland support
The following changes since commit ebe0ddf657903bef32a161dc66254fbf8725f986: util: add gl_wrap.h and glu_wrap.h to libutil_la_SOURCES (2012-04-23 08:21:43 -0600) Alex Wu (2): eglut: Add wayland support opengles2: Add es2gears_wayland target configure.ac | 14 src/egl/eglut/Makefile.am | 15 - src/egl/eglut/eglut_wayland.c | 135 + src/egl/opengles2/Makefile.am |6 ++ 4 files changed, 169 insertions(+), 1 deletions(-) create mode 100644 src/egl/eglut/eglut_wayland.c ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH demos 1/2] eglut: Add wayland support
From: Alex Wu This patch adds wayland support for eglut, so that the demos based on eglut can run on wayland platform. --- configure.ac | 14 src/egl/eglut/Makefile.am | 15 - src/egl/eglut/eglut_wayland.c | 135 + 3 files changed, 163 insertions(+), 1 deletions(-) create mode 100644 src/egl/eglut/eglut_wayland.c diff --git a/configure.ac b/configure.ac index 4f6f16f..be9caa1 100644 --- a/configure.ac +++ b/configure.ac @@ -206,6 +206,16 @@ if test "x$x11_enabled" != "xno"; then PKG_CHECK_MODULES(X11, [x11 xext], [x11_enabled=yes], [x11_enabled=no]) fi +AC_ARG_ENABLE([wayland], +[AS_HELP_STRING([--enable-wayland], +[enable support for wayland @<:@default=no@:>@])], +[wayland_enabled="$enableval"], +[wayland_enabled=no]) + +if test "x$wayland_enabled" != "xno"; then +PKG_CHECK_MODULES(WAYLAND, [wayland-client wayland-egl], [wayland_enabled=yes], [wayland_enabled=no]) +fi + dnl GBM is needed for EGL on KMS AC_ARG_ENABLE([gbm], [AS_HELP_STRING([--enable-gbm], @@ -283,6 +293,9 @@ AC_SUBST([OSMESA_LIBS]) AC_SUBST([OSMESA16_LIBS]) AC_SUBST([OSMESA32_LIBS]) AC_SUBST([MESA_GLAPI]) +AC_SUBST([WAYLAND_CFLAGS]) +AC_SUBST([WAYLAND_LIBS]) + AM_CONDITIONAL(HAVE_EGL, test "x$egl_enabled" = "xyes") AM_CONDITIONAL(HAVE_GLESV1, test "x$glesv1_enabled" = "xyes") @@ -296,6 +309,7 @@ AM_CONDITIONAL(HAVE_OSMESA, test "x$osmesa_enabled" = "xyes") AM_CONDITIONAL(HAVE_DRM, test "x$drm_enabled" = "xyes") AM_CONDITIONAL(BUILD_GLTRACE, false) AM_CONDITIONAL(HAVE_MESA_SOURCE, test "x$mesa_source_enabled" = "xyes") +AM_CONDITIONAL(HAVE_WAYLAND, test "x$wayland_enabled" = "xyes") AC_OUTPUT([ Makefile diff --git a/src/egl/eglut/Makefile.am b/src/egl/eglut/Makefile.am index f0ab283..2d2f2af 100644 --- a/src/egl/eglut/Makefile.am +++ b/src/egl/eglut/Makefile.am @@ -29,7 +29,11 @@ if HAVE_EGL if HAVE_X11 eglut_x11 = libeglut_x11.la endif -noinst_LTLIBRARIES = libeglut_screen.la $(eglut_x11) +if HAVE_WAYLAND +eglut_wayland = libeglut_wayland.la +endif + +noinst_LTLIBRARIES = libeglut_screen.la $(eglut_x11) $(eglut_wayland) endif libeglut_screen_la_SOURCES = \ @@ -44,3 +48,12 @@ libeglut_x11_la_SOURCES = \ eglut_x11.c libeglut_x11_la_CFLAGS = $(X11_CFLAGS) $(EGL_CFLAGS) libeglut_x11_la_LIBADD = $(X11_LIBS) $(EGL_LIBS) + + +libeglut_wayland_la_SOURCES = \ + eglut.c \ + eglutint.h \ + eglut_wayland.c + +libeglut_wayland_la_CFLAGS = $(WAYLAND_CFLAGS) $(EGL_CFLAGS) +libeglut_wayland_la_LIBADD = $(WAYLAND_LIBS) $(EGL_LIBS) diff --git a/src/egl/eglut/eglut_wayland.c b/src/egl/eglut/eglut_wayland.c new file mode 100644 index 000..61207d2 --- /dev/null +++ b/src/egl/eglut/eglut_wayland.c @@ -0,0 +1,135 @@ +#include +#include + +#include "eglutint.h" + +struct display { + struct wl_display *display; + struct wl_compositor *compositor; + struct wl_shell *shell; + uint32_t mask; +}; + +struct window { + struct wl_surface *surface; + struct wl_shell_surface *shell_surface; + struct wl_callback *callback; +}; + +static struct display display = {0, }; +static struct window window = {0, }; + +static void +display_handle_global(struct wl_display *display, uint32_t id, + const char *interface, uint32_t version, void *data) +{ + struct display *d = data; + + if (strcmp(interface, "wl_compositor") == 0) { + d->compositor = + wl_display_bind(display, id, &wl_compositor_interface); + } else if (strcmp(interface, "wl_shell") == 0) { + d->shell = wl_display_bind(display, id, &wl_shell_interface); + } +} + +static int +event_mask_update(uint32_t mask, void *data) +{ + struct display *d = data; + + d->mask = mask; + + return 0; +} + +void +_eglutNativeInitDisplay(void) +{ + _eglut->native_dpy = display.display = wl_display_connect(NULL); + + if (!_eglut->native_dpy) + _eglutFatal("failed to initialize native display"); + + wl_display_add_global_listener(_eglut->native_dpy, + display_handle_global, &display); + + wl_display_get_fd(_eglut->native_dpy, event_mask_update, &display); + wl_display_iterate(_eglut->native_dpy, WL_DISPLAY_READABLE); + + _eglut->surface_type = EGL_WINDOW_BIT; +} + +void +_eglutNativeFiniDisplay(void) +{ + wl_display_flush(_eglut->native_dpy); + wl_display_disconnect(_eglut->native_dpy); +} + +void +_eglutNativeInitWindow(struct eglut_window *win, const char *title, + int x, int y, int w, int h) +{ + struct wl_egl_window *native; + + window.surface = wl_compositor_create_surface(display.compositor); + window.shell_surface = wl_shell_get_shell_surface(display.shell, + window.surface); + native = wl_egl_window_create(window.surface, w, h); + + wl_shell_surface_set_toplevel(window.shell_surface); + + win->native.u.window = native; + win->native.width = w; + win->native.height = h; +} + +void +_eglutNativeFiniWindow(struct eglut_
[Mesa-dev] [PATCH demos 2/2] opengles2: Add es2gears_wayland target
From: Alex Wu Since we already have wayland support in eglut, add a target for es2geares_wayland. --- src/egl/opengles2/Makefile.am |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/src/egl/opengles2/Makefile.am b/src/egl/opengles2/Makefile.am index c84d91d..41c1b80 100644 --- a/src/egl/opengles2/Makefile.am +++ b/src/egl/opengles2/Makefile.am @@ -40,6 +40,9 @@ bin_PROGRAMS = \ es2gears_screen \ es2gears_x11 \ es2tri +if HAVE_WAYLAND +bin_PROGRAMS += es2gears_wayland +endif endif endif @@ -53,3 +56,6 @@ es2gears_x11_SOURCES = es2gears.c es2gears_screen_LDADD = ../eglut/libeglut_screen.la es2gears_x11_LDADD = ../eglut/libeglut_x11.la + +es2gears_wayland_SOURCES = es2gears.c +es2gears_wayland_LDADD = ../eglut/libeglut_wayland.la -- 1.7.5.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev