[Mesa-dev] [PATCH] nv50: adjust min/max lod by base level on G80
Make the assumption that there's a 1:1 TIC <-> TSC connection, and increase min/max lod by the relevant texture's base level. Also if there's no mipfilter, we have to enable it while forcing min/max lod to the base level. This fixes many, but not all, tex-miplevel-selection tests on G80. Signed-off-by: Ilia Mirkin --- All the textureLod tests fail. If I also adjust the lod_bias by the first_level, then the regular tests start failing. Not sure what the right move is here... need to trace the blob to see what it does here. src/gallium/drivers/nouveau/nv50/nv50_state.c | 1 + .../drivers/nouveau/nv50/nv50_stateobj_tex.h | 1 + src/gallium/drivers/nouveau/nv50/nv50_tex.c| 39 ++ 3 files changed, 41 insertions(+) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c index d4d41af..98c4c3a 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_state.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c @@ -464,6 +464,7 @@ nv50_sampler_state_create(struct pipe_context *pipe, struct nv50_tsc_entry *so = MALLOC_STRUCT(nv50_tsc_entry); float f[2]; + so->pipe = *cso; so->id = -1; so->tsc[0] = (0x00026000 | diff --git a/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h b/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h index 99548cb..9a19166 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h +++ b/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h @@ -5,6 +5,7 @@ #include "pipe/p_state.h" struct nv50_tsc_entry { + struct pipe_sampler_state pipe; int id; uint32_t tsc[8]; }; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_tex.c b/src/gallium/drivers/nouveau/nv50/nv50_tex.c index 17ae27f..d79c813 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_tex.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_tex.c @@ -344,6 +344,45 @@ nv50_validate_tsc(struct nv50_context *nv50, int s) PUSH_DATA (push, (i << 4) | 0); continue; } + if (nv50->base.screen->class_3d == NV50_3D_CLASS) { + struct nv50_tic_entry *tic = nv50_tic_entry(nv50->textures[s][i]); + + /* We must make sure that the MIN_LOD is at least set to the first + * level for the G80 + */ + bool need_update = false; + float min_lod = CLAMP( + tic->pipe.u.tex.first_level + tsc->pipe.min_lod, 0.0f, 15.0f); + float max_lod = CLAMP( + tic->pipe.u.tex.first_level + tsc->pipe.max_lod, 0.0f, 15.0f); + + if (tsc->pipe.min_mip_filter == PIPE_TEX_MIPFILTER_NONE) { +uint32_t old_tsc1 = tsc->tsc[1]; +tsc->tsc[1] &= ~NV50_TSC_1_MIPF__MASK; +if (tic->pipe.u.tex.first_level) { + tsc->tsc[1] |= NV50_TSC_1_MIPF_NEAREST; + max_lod = min_lod = tic->pipe.u.tex.first_level; +} +if (tsc->tsc[1] != old_tsc1) + need_update = true; + } + + uint32_t new_tsc2 = +(((int)(max_lod * 256.0f) & 0xfff) << 12) | +((int)(min_lod * 256.0f) & 0xfff); + if ((tsc->tsc[2] & 0xff) != new_tsc2) { +tsc->tsc[2] &= ~0xffu; +tsc->tsc[2] |= new_tsc2; +need_update = true; + } + + if (need_update && tsc->id >= 0) { +nv50_sifc_linear_u8(&nv50->base, nv50->screen->txc, +65536 + tsc->id * 32, +NOUVEAU_BO_VRAM, 32, tsc->tsc); +need_flush = TRUE; + } + } if (tsc->id < 0) { tsc->id = nv50_screen_tsc_alloc(nv50->screen, tsc); -- 2.3.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 02/14] meta: Fix transfer operations check in meta pbo path for readpixels
On Fri, 2015-07-17 at 10:36 -0700, Anuj Phogat wrote: > Iago, Jason: Patches 2 and 5 in this series depend on patches 1 and 4 > respectively, Since you guys reviewed 2 and 5, would you also like to > review 1, 4 and/or other patches in this series? > > Thanks > -Anuj Sure, I'll have a look at the patches. Iag > On Sun, Jun 28, 2015 at 11:29 PM, Iago Toral wrote: > > Reviewed-by: Iago Toral Quiroga > > > > On Fri, 2015-06-26 at 13:15 -0700, Anuj Phogat wrote: > >> Currently used ctx->_ImageTransferState check is not sufficient > >> because it doesn't include the read color clamping enabled with > >> GL_CLAMP_READ_COLOR. So, use the helper function > >> _mesa_get_readpixels_transfer_ops(). > >> > >> Also, transfer operations don't affect glGetTexImage(). So, do > >> the check only for glReadPixles. > >> > >> Without this patch, arb_color_buffer_float-readpixels test fails, when > >> forced to use meta pbo path. > >> > >> V2: Add a comment and bump up the commit message. > >> > >> Signed-off-by: Anuj Phogat > >> Cc: > >> Cc: Iago Toral > >> Cc: Jason Ekstrand > >> --- > >> src/mesa/drivers/common/meta_tex_subimage.c | 13 + > >> 1 file changed, 9 insertions(+), 4 deletions(-) > >> > >> diff --git a/src/mesa/drivers/common/meta_tex_subimage.c > >> b/src/mesa/drivers/common/meta_tex_subimage.c > >> index d2474f5..90d78e5 100644 > >> --- a/src/mesa/drivers/common/meta_tex_subimage.c > >> +++ b/src/mesa/drivers/common/meta_tex_subimage.c > >> @@ -273,12 +273,17 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context > >> *ctx, GLuint dims, > >> format == GL_COLOR_INDEX) > >>return false; > >> > >> - if (ctx->_ImageTransferState) > >> - return false; > >> - > >> - > >> + /* Don't use meta path for readpixels in below conditions. */ > >> if (!tex_image) { > >>rb = ctx->ReadBuffer->_ColorReadBuffer; > >> + > >> + /* _mesa_get_readpixels_transfer_ops() includes the cases of read > >> + * color clamping along with the ctx->_ImageTransferState. > >> + */ > >> + if (_mesa_get_readpixels_transfer_ops(ctx, rb->Format, format, > >> +type, GL_FALSE)) > >> + return false; > >> + > >>if (_mesa_need_rgb_to_luminance_conversion(rb->Format, format)) > >> return false; > >> } > > > > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/14] mesa: Turn get_readpixels_transfer_ops() in to a global function
On Tue, 2015-06-16 at 11:15 -0700, Anuj Phogat wrote: > This utility function is utilized in a later patch. > > Signed-off-by: Anuj Phogat > Cc: > --- > Jenkins showed no piglit regressions with this series. > > src/mesa/main/readpix.c | 14 -- > src/mesa/main/readpix.h | 6 ++ > 2 files changed, 14 insertions(+), 6 deletions(-) > > diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c > index a3357cd..caa2648 100644 > --- a/src/mesa/main/readpix.c > +++ b/src/mesa/main/readpix.c > @@ -64,9 +64,11 @@ _mesa_need_rgb_to_luminance_conversion(mesa_format > texFormat, GLenum format) > /** > * Return transfer op flags for this ReadPixels operation. > */ > -static GLbitfield > -get_readpixels_transfer_ops(const struct gl_context *ctx, mesa_format > texFormat, > -GLenum format, GLenum type, GLboolean uses_blit) > +GLbitfield > +_mesa_get_readpixels_transfer_ops(const struct gl_context *ctx, > + mesa_format texFormat, > + GLenum format, GLenum type, > + GLboolean uses_blit) > { > GLbitfield transferOps = ctx->_ImageTransferState; > > @@ -169,7 +171,7 @@ _mesa_readpixels_needs_slow_path(const struct gl_context > *ctx, GLenum format, >} > >/* And finally, see if there are any transfer ops. */ > - return get_readpixels_transfer_ops(ctx, rb->Format, format, type, > + return _mesa_get_readpixels_transfer_ops(ctx, rb->Format, format, type, > uses_blit) != 0; With the change, indentation for the second line needs to be fixed too. Other than that, Reviewed-by: Iago Toral Quiroga > } > return GL_FALSE; > @@ -436,8 +438,8 @@ read_rgba_pixels( struct gl_context *ctx, > if (!rb) >return; > > - transferOps = get_readpixels_transfer_ops(ctx, rb->Format, format, type, > - GL_FALSE); > + transferOps = _mesa_get_readpixels_transfer_ops(ctx, rb->Format, format, > + type, GL_FALSE); > /* Describe the dst format */ > dst_is_integer = _mesa_is_enum_format_integer(format); > dst_stride = _mesa_image_row_stride(packing, width, format, type); > diff --git a/src/mesa/main/readpix.h b/src/mesa/main/readpix.h > index 1636dd9..f894036 100644 > --- a/src/mesa/main/readpix.h > +++ b/src/mesa/main/readpix.h > @@ -40,6 +40,12 @@ _mesa_readpixels_needs_slow_path(const struct gl_context > *ctx, GLenum format, > extern GLboolean > _mesa_need_rgb_to_luminance_conversion(mesa_format texFormat, GLenum format); > > +extern GLbitfield > +_mesa_get_readpixels_transfer_ops(const struct gl_context *ctx, > + mesa_format texFormat, > + GLenum format, GLenum type, > + GLboolean uses_blit); > + > extern void > _mesa_readpixels(struct gl_context *ctx, > GLint x, GLint y, GLsizei width, GLsizei height, ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 04/14] mesa: Add a mesa utility function _mesa_need_signed_unsigned_int_conversion()
On Tue, 2015-06-16 at 11:15 -0700, Anuj Phogat wrote: > This utility function is used in a later patch. > > Signed-off-by: Anuj Phogat > Cc: > --- > src/mesa/main/readpix.c | 32 ++-- > src/mesa/main/readpix.h | 4 > 2 files changed, 22 insertions(+), 14 deletions(-) > > diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c > index a9416ef..1038983 100644 > --- a/src/mesa/main/readpix.c > +++ b/src/mesa/main/readpix.c > @@ -114,6 +114,22 @@ _mesa_get_readpixels_transfer_ops(const struct > gl_context *ctx, > return transferOps; > } > > +bool > +_mesa_need_signed_unsigned_int_conversion(mesa_format rbFormat, > + GLenum format, GLenum type) > +{ > + const GLenum srcType = _mesa_get_format_datatype(rbFormat); > + return (srcType == GL_INT && > + _mesa_is_enum_format_integer(format) && > + (type == GL_UNSIGNED_INT || > + type == GL_UNSIGNED_SHORT || > + type == GL_UNSIGNED_BYTE)) || > + (srcType == GL_UNSIGNED_INT && > + _mesa_is_enum_format_integer(format) && > + (type == GL_INT || > + type == GL_SHORT || > + type == GL_BYTE)); > +} I think it is better if you assign the result of _mesa_is_enum_format_integer(format) to a temporary instead of calling it twice in the condition, just like you do with srcType. > /** > * Return true if memcpy cannot be used for ReadPixels. > @@ -130,7 +146,6 @@ _mesa_readpixels_needs_slow_path(const struct gl_context > *ctx, GLenum format, > { > struct gl_renderbuffer *rb = > _mesa_get_read_renderbuffer_for_format(ctx, format); > - GLenum srcType; > > assert(rb); > > @@ -157,20 +172,9 @@ _mesa_readpixels_needs_slow_path(const struct gl_context > *ctx, GLenum format, > >/* Conversion between signed and unsigned integers needs masking > * (it isn't just memcpy). */ > - srcType = _mesa_get_format_datatype(rb->Format); > - > - if ((srcType == GL_INT && > - _mesa_is_enum_format_integer(format) && > - (type == GL_UNSIGNED_INT || > -type == GL_UNSIGNED_SHORT || > -type == GL_UNSIGNED_BYTE)) || > - (srcType == GL_UNSIGNED_INT && > - _mesa_is_enum_format_integer(format) && > - (type == GL_INT || > -type == GL_SHORT || > -type == GL_BYTE))) { > + if (_mesa_need_signed_unsigned_int_conversion(rb->Format, format, > + type)) > return GL_TRUE; > - } You need to rebase your patch, this code does not exist any more. I moved it to Gallium where I am not sure that your change is what they want. You should probably just skip this part. With these changes, Reviewed-by: Iago Toral Quiroga >/* And finally, see if there are any transfer ops. */ >return _mesa_get_readpixels_transfer_ops(ctx, rb->Format, format, type, > diff --git a/src/mesa/main/readpix.h b/src/mesa/main/readpix.h > index f894036..a93e263 100644 > --- a/src/mesa/main/readpix.h > +++ b/src/mesa/main/readpix.h > @@ -46,6 +46,10 @@ _mesa_get_readpixels_transfer_ops(const struct gl_context > *ctx, >GLenum format, GLenum type, >GLboolean uses_blit); > > +extern bool > +_mesa_need_signed_unsigned_int_conversion(mesa_format rbFormat, > + GLenum format, GLenum type); > + > extern void > _mesa_readpixels(struct gl_context *ctx, > GLint x, GLint y, GLsizei width, GLsizei height, ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 03/14] mesa: Fix conditions to test signed, unsigned integer format
On Tue, 2015-06-16 at 11:15 -0700, Anuj Phogat wrote: > Signed-off-by: Anuj Phogat > Cc: > --- > src/mesa/main/readpix.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c > index caa2648..a9416ef 100644 > --- a/src/mesa/main/readpix.c > +++ b/src/mesa/main/readpix.c > @@ -160,10 +160,12 @@ _mesa_readpixels_needs_slow_path(const struct > gl_context *ctx, GLenum format, >srcType = _mesa_get_format_datatype(rb->Format); > >if ((srcType == GL_INT && > + _mesa_is_enum_format_integer(format) && > (type == GL_UNSIGNED_INT || > type == GL_UNSIGNED_SHORT || > type == GL_UNSIGNED_BYTE)) || >(srcType == GL_UNSIGNED_INT && > + _mesa_is_enum_format_integer(format) && > (type == GL_INT || > type == GL_SHORT || > type == GL_BYTE))) { As I mentioned in patch 4, this code does not exist any more, so this patch should probably be dropped. Iago ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 05/14] meta: Abort meta pbo path if readpixels need signed-unsigned conversion
On Fri, 2015-06-19 at 13:40 -0700, Anuj Phogat wrote: > On Tue, Jun 16, 2015 at 9:21 PM, Jason Ekstrand wrote: > > > > On Jun 16, 2015 11:15, "Anuj Phogat" wrote: > >> > >> Without this patch, piglit test fbo_integer_readpixels_sint_uint fails, > >> when > >> forced to use the meta pbo path. > >> > >> Signed-off-by: Anuj Phogat > >> Cc: > >> --- > >> src/mesa/drivers/common/meta_tex_subimage.c | 3 +++ > >> 1 file changed, 3 insertions(+) > >> > >> diff --git a/src/mesa/drivers/common/meta_tex_subimage.c > >> b/src/mesa/drivers/common/meta_tex_subimage.c > >> index 00364f8..84cbc50 100644 > >> --- a/src/mesa/drivers/common/meta_tex_subimage.c > >> +++ b/src/mesa/drivers/common/meta_tex_subimage.c > >> @@ -283,6 +283,9 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, > >> GLuint dims, > >> > >>if (_mesa_need_rgb_to_luminance_conversion(rb->Format, format)) > >> return false; > >> + > >> + if (_mesa_need_signed_unsigned_int_conversion(rb->Format, format, > >> type)) > >> + return false; > > > > Hrm... This seems fishy. Isn't glBlitFramebuffers supposed to handle format > > conversion with integers? If so we should probably fix it rather than just > > skip it for the meta pbo path. > > > As discussed offline, here is relevant text for glBlitFrameBuffer() from > OpenGL 4.5 spec, section 18.3.1: > "An INVALID_OPERATION error is generated if format conversions are not > supported, which occurs under any of the following conditions: > -The read buffer contains fixed-point or floating-point values and any draw > buffer contains neither fixed-point nor floating-point values. > -The read buffer contains unsigned integer values and any draw buffer does > not contain unsigned integer values. > - The read buffer contains signed integer values and any draw buffer does > not contain signed integer values." > > I'll add a comment here explaining the reason to avoid meta path. Is this code going to run only for glBlitFramebuffer? I see this function being called from code paths that implement glReadPixels and glGetTexImage too. Iago > >> } > >> > >> /* For arrays, use a tall (height * depth) 2D texture but taking into > >> -- > >> 1.9.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 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965/vec4: Fix liveness analysis with BRW_OPCODE_SEL
We only consider a vgrf defined by a given block if the block writes to it unconditionally. So far we have been checking this by testing that the instruction is not predicated, however, in the case of BRW_OPCODE_SEL, the predication is used to select the value to write, not to decide if the write is actually done. The consequence of this was increased life spans for affected vgrfs, which could lead to additional register pressure. Since NIR generates selects for conditional writes this was causing massive register pressure in a handful of piglit and dEQP tests that had a large number of select operations with the NIR-vec4 backend. Fixes the following piglit tests with the NIR-vec4 backend: spec/glsl-1.50/execution/variable-indexing/vs-output-array-vec4-index-wr-before-gs spec/glsl-1.50/execution/variable-indexing/gs-input-array-vec4-index-rd spec/glsl-1.50/execution/variable-indexing/vs-output-array-vec2-index-wr-before-gs spec/glsl-1.50/execution/variable-indexing/vs-output-array-vec3-index-wr-before-gs spec/glsl-1.50/execution/variable-indexing/vs-output-array-float-index-wr-before-gs Fixes the 80 dEQP tests with the NIR-vec4 backend in the following category: dEQP-GLES3.functional.ubo.* --- src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp index 29b4a53..cc688ef 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp @@ -96,7 +96,8 @@ vec4_live_variables::setup_def_use() * are the things that screen off preceding definitions of a * variable, and thus qualify for being in def[]. */ -if (inst->dst.file == GRF && !inst->predicate) { +if (inst->dst.file == GRF && +(!inst->predicate || inst->opcode == BRW_OPCODE_SEL)) { for (unsigned i = 0; i < inst->regs_written; i++) { for (int c = 0; c < 4; c++) { if (inst->dst.writemask & (1 << c)) { -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965/vec4: Fix liveness analysis with BRW_OPCODE_SEL
Iago Toral Quiroga writes: > We only consider a vgrf defined by a given block if the block writes to it > unconditionally. So far we have been checking this by testing that the > instruction is not predicated, however, in the case of BRW_OPCODE_SEL, > the predication is used to select the value to write, not to decide if > the write is actually done. The consequence of this was increased life > spans for affected vgrfs, which could lead to additional register pressure. > > Since NIR generates selects for conditional writes this was causing massive > register pressure in a handful of piglit and dEQP tests that had a large > number of select operations with the NIR-vec4 backend. > > Fixes the following piglit tests with the NIR-vec4 backend: > spec/glsl-1.50/execution/variable-indexing/vs-output-array-vec4-index-wr-before-gs > spec/glsl-1.50/execution/variable-indexing/gs-input-array-vec4-index-rd > spec/glsl-1.50/execution/variable-indexing/vs-output-array-vec2-index-wr-before-gs > spec/glsl-1.50/execution/variable-indexing/vs-output-array-vec3-index-wr-before-gs > spec/glsl-1.50/execution/variable-indexing/vs-output-array-float-index-wr-before-gs > > Fixes the 80 dEQP tests with the NIR-vec4 backend in the following category: > dEQP-GLES3.functional.ubo.* > --- > src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp > b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp > index 29b4a53..cc688ef 100644 > --- a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp > +++ b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp > @@ -96,7 +96,8 @@ vec4_live_variables::setup_def_use() > * are the things that screen off preceding definitions of a > * variable, and thus qualify for being in def[]. > */ > - if (inst->dst.file == GRF && !inst->predicate) { > + if (inst->dst.file == GRF && > + (!inst->predicate || inst->opcode == BRW_OPCODE_SEL)) { > for (unsigned i = 0; i < inst->regs_written; i++) { > for (int c = 0; c < 4; c++) { >if (inst->dst.writemask & (1 << c)) { Looks good, thanks, Reviewed-by: Francisco Jerez > -- > 1.9.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Register spilling issues in the NIR->vec4 backend
Hi, On Thu, 2015-07-16 at 08:15 -0700, Jason Ekstrand wrote: > > On Jul 15, 2015 11:20 PM, "Iago Toral" wrote: > > > > On Wed, 2015-07-15 at 11:02 -0700, Connor Abbott wrote: > > > On Wed, Jul 15, 2015 at 7:49 AM, Iago Toral > wrote: > > > > Hi, > > > > > > > > when we sent the patches for the new nir->vec4 backend we > mentioned that > > > > we had a few dEQP tests that would fail to link because of > register > > > > spilling. Now that we have added GS support we see a few > instances of > > > > this problem popping up in a few GS piglit tests too, for > example this > > > > one: > > > > > > > > > tests/spec/glsl-1.50/execution/variable-indexing/gs-input-array-vec4-index-rd.shader_test > > > > > > > > I have been looking into what is going on with these tests and I > came to > > > > the conclusion that the problem is a consequence of various > factors, but > > > > probably the main thing contributing to it is the way our SSA > pass > > > > works. That said, I am not that experienced with NIR, so it > could also > > > > be that my analysis is missing something and I am just arriving > to wrong > > > > conclusions, so I'll explain my thoughts below and hopefully > someone > > > > else with more NIR experience can jump in and confirm or reject > my > > > > analysis. > > > > > > > > The GS code in that test looks like this: > > > > > > > > for (int p = 0; p < 3; p++) { > > > >color = ((index >= ins[p].m1.length() ? > > > > ins[p].m2[index-ins[p].m1.length()] : > > > > ins[p].m1[index]) == expect) ? > > > >vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, > 1.0); > > > >gl_Position = gl_in[p].gl_Position; > > > >EmitVertex(); > > > > } > > > > > > > > One thing that is immediately contributing to the register > pressure is > > > > some really awful code generated because of the indirect array > indexing > > > > on the inputs inside the loop. This is because of the > > > > lower_variable_index_to_cond_assign lowering pass called from > > > > brw_shader.cpp. This pass will convert that color assignment > into a > > > > bunch of nested if/else statements which makes the generated > GLSL IR > > > > code rather large, involving plenty of temporaries too. This is > only > > > > made worse by the fact that loop unrolling will replicate that 3 > times. > > > > The result is a huge pile of GLSL IR with a few dozens of nested > if/else > > > > statements and temporaries that looks like [1] (that is only a > fragment > > > > of the GLSL IR). > > > > > > > > One thing that is particularly relevant in that code is that it > has > > > > multiple conditional assignments to the same variable > > > > (dereference_array_value) as a consequence of this lowering > pass. > > > > > > > > That much, however, is common to the NIR and non-NIR paths. The > problem > > > > in the NIR case is that all these assignments generate new SSA > values, > > > > which then become new registers in the final NIR form. This > leads to NIR > > > > code like [2]. In contrast, the old vec4 visitor path, is able > to have > > > > writes to the same variable write to the same register. > > > > > > > > As a result, if I print the code right before register > allocation in the > > > > NIR path [3] and I compare that to what we get with the old vec4 > visitor > > > > path at that same point [4], it is clearly visible that this > difference > > > > is allowing the vec4 visitor path to reduce register pressure > (see how > > > > in [4] we have multiple writes to vgrf5, while in [3] we always > write to > > > > a new vgrf every time). > > > > > > > > So, am I missing something or is this kind of result expected > with NIR > > > > programs? Is there anything in the nir->vec4 pass that we can do > to fix > > > > this or does this need to be fixed when going out of SSA moe > inside NIR? > > > > > > > > Iago > > > > > > > > [1] http://pastebin.com/5uA8ex2S > > > > [2] http://pastebin.com/pqLfvAVN > > > > [3] http://pastebin.com/64nSuUH8 > > > > [4] http://pastebin.com/WCrdYxzt > > > > > > > > ___ > > > > mesa-dev mailing list > > > > mesa-dev@lists.freedesktop.org > > > > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > > > > > > Hi Iago, > > > > > > Indeed, NIR does convert conditional writes to conditional > selectss -- > > > it's a required part of the conversion to SSA, and since our HW > has a > > > conditional select instruction that's just as fast as doing a > > > conditional move, we haven't bothered much to try and change it > back > > > during out-of-SSA. However, doing this shouldn't make things > worse. In > > > your example, vgrf9, vgrf15, and vgrf17 all have very short live > > > intervals and don't interfere with vgrf11 (unless there's another > use > > > of them somewhere after the snippet you pasted), which means that > the > > > register allocator is free to allocate the destinations of all the > > > selects to the same register. > > > > > >
Re: [Mesa-dev] [Nouveau] [PATCH] nv50: adjust min/max lod by base level on G80
Reviewed-by: Samuel Pitoiset On 07/20/2015 09:26 AM, Ilia Mirkin wrote: Make the assumption that there's a 1:1 TIC <-> TSC connection, and increase min/max lod by the relevant texture's base level. Also if there's no mipfilter, we have to enable it while forcing min/max lod to the base level. This fixes many, but not all, tex-miplevel-selection tests on G80. Signed-off-by: Ilia Mirkin --- All the textureLod tests fail. If I also adjust the lod_bias by the first_level, then the regular tests start failing. Not sure what the right move is here... need to trace the blob to see what it does here. src/gallium/drivers/nouveau/nv50/nv50_state.c | 1 + .../drivers/nouveau/nv50/nv50_stateobj_tex.h | 1 + src/gallium/drivers/nouveau/nv50/nv50_tex.c| 39 ++ 3 files changed, 41 insertions(+) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c index d4d41af..98c4c3a 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_state.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c @@ -464,6 +464,7 @@ nv50_sampler_state_create(struct pipe_context *pipe, struct nv50_tsc_entry *so = MALLOC_STRUCT(nv50_tsc_entry); float f[2]; + so->pipe = *cso; so->id = -1; so->tsc[0] = (0x00026000 | diff --git a/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h b/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h index 99548cb..9a19166 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h +++ b/src/gallium/drivers/nouveau/nv50/nv50_stateobj_tex.h @@ -5,6 +5,7 @@ #include "pipe/p_state.h" struct nv50_tsc_entry { + struct pipe_sampler_state pipe; int id; uint32_t tsc[8]; }; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_tex.c b/src/gallium/drivers/nouveau/nv50/nv50_tex.c index 17ae27f..d79c813 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_tex.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_tex.c @@ -344,6 +344,45 @@ nv50_validate_tsc(struct nv50_context *nv50, int s) PUSH_DATA (push, (i << 4) | 0); continue; } + if (nv50->base.screen->class_3d == NV50_3D_CLASS) { + struct nv50_tic_entry *tic = nv50_tic_entry(nv50->textures[s][i]); + + /* We must make sure that the MIN_LOD is at least set to the first + * level for the G80 + */ + bool need_update = false; + float min_lod = CLAMP( + tic->pipe.u.tex.first_level + tsc->pipe.min_lod, 0.0f, 15.0f); + float max_lod = CLAMP( + tic->pipe.u.tex.first_level + tsc->pipe.max_lod, 0.0f, 15.0f); + + if (tsc->pipe.min_mip_filter == PIPE_TEX_MIPFILTER_NONE) { +uint32_t old_tsc1 = tsc->tsc[1]; +tsc->tsc[1] &= ~NV50_TSC_1_MIPF__MASK; +if (tic->pipe.u.tex.first_level) { + tsc->tsc[1] |= NV50_TSC_1_MIPF_NEAREST; + max_lod = min_lod = tic->pipe.u.tex.first_level; +} +if (tsc->tsc[1] != old_tsc1) + need_update = true; + } + + uint32_t new_tsc2 = +(((int)(max_lod * 256.0f) & 0xfff) << 12) | +((int)(min_lod * 256.0f) & 0xfff); + if ((tsc->tsc[2] & 0xff) != new_tsc2) { +tsc->tsc[2] &= ~0xffu; +tsc->tsc[2] |= new_tsc2; +need_update = true; + } + + if (need_update && tsc->id >= 0) { +nv50_sifc_linear_u8(&nv50->base, nv50->screen->txc, +65536 + tsc->id * 32, +NOUVEAU_BO_VRAM, 32, tsc->tsc); +need_flush = TRUE; + } + } if (tsc->id < 0) { tsc->id = nv50_screen_tsc_alloc(nv50->screen, tsc); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965/fs: Remove redundant hand-unrolled first iteration of loop.
This seems rather silly and would lead to memory corruption if the size of a VGRF was allowed to be zero. --- src/mesa/drivers/dri/i965/brw_fs.cpp | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 960ea54..eafd676 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1565,16 +1565,12 @@ fs_visitor::split_virtual_grfs() int reg = 0; for (int i = 0; i < num_vars; i++) { + int offset = 0; + /* The first one should always be 0 as a quick sanity check. */ assert(split_points[reg] == false); - /* j = 0 case */ - new_reg_offset[reg] = 0; - reg++; - int offset = 1; - - /* j > 0 case */ - for (unsigned j = 1; j < alloc.sizes[i]; j++) { + for (unsigned j = 0; j < alloc.sizes[i]; j++) { /* If this is a split point, reset the offset to 0 and allocate a * new virtual GRF for the previous offset many registers */ -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965/fs: Remove redundant hand-unrolled first iteration of loop.
Francisco Jerez writes: > This seems rather silly and would lead to memory corruption if the > size of a VGRF was allowed to be zero. > --- > src/mesa/drivers/dri/i965/brw_fs.cpp | 10 +++--- > 1 file changed, 3 insertions(+), 7 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp > b/src/mesa/drivers/dri/i965/brw_fs.cpp > index 960ea54..eafd676 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp > @@ -1565,16 +1565,12 @@ fs_visitor::split_virtual_grfs() > > int reg = 0; > for (int i = 0; i < num_vars; i++) { > + int offset = 0; > + >/* The first one should always be 0 as a quick sanity check. */ >assert(split_points[reg] == false); > For correctness I've also changed this assertion locally to read "reg_count == reg || split_points[reg] == false". > - /* j = 0 case */ > - new_reg_offset[reg] = 0; > - reg++; > - int offset = 1; > - > - /* j > 0 case */ > - for (unsigned j = 1; j < alloc.sizes[i]; j++) { > + for (unsigned j = 0; j < alloc.sizes[i]; j++) { > /* If this is a split point, reset the offset to 0 and allocate a >* new virtual GRF for the previous offset many registers >*/ > -- > 2.4.3 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH excerpt] mesa: Rename _mesa_lookup_enum_by_nr() to _mesa_enum_to_string().
Looks OK to me. Thanks for doing this. Reviewed-by: Brian Paul On 07/18/2015 02:36 AM, Kenneth Graunke wrote: Generated by sed; no manual changes. Signed-off-by: Kenneth Graunke --- We talked about doing this back in 2013, but the patches never quite materialized. Here's the obvious sed job. Actual patch is here: http://cgit.freedesktop.org/~kwg/mesa/commit/?h=enumtostring I figured I'd spare the mailing list 146Kb of obvious diff. Thoughts? src/mapi/glapi/gen/gl_enums.py | 2 +- src/mesa/drivers/common/meta_blit.c | 2 +- src/mesa/drivers/common/meta_generate_mipmap.c | 2 +- src/mesa/drivers/dri/i915/i830_state.c | 20 ++-- src/mesa/drivers/dri/i915/intel_fbo.c| 2 +- src/mesa/drivers/dri/i915/intel_mipmap_tree.c| 2 +- src/mesa/drivers/dri/i915/intel_render.c | 2 +- src/mesa/drivers/dri/i915/intel_tex_image.c | 2 +- src/mesa/drivers/dri/i915/intel_tex_subimage.c | 2 +- src/mesa/drivers/dri/i915/intel_tris.c | 4 +- src/mesa/drivers/dri/i965/brw_draw.c | 8 +- src/mesa/drivers/dri/i965/brw_draw_upload.c | 2 +- src/mesa/drivers/dri/i965/gen6_cc.c | 4 +- src/mesa/drivers/dri/i965/intel_fbo.c| 2 +- src/mesa/drivers/dri/i965/intel_mipmap_tree.c| 2 +- src/mesa/drivers/dri/i965/intel_tex_image.c | 4 +- src/mesa/drivers/dri/i965/intel_tex_subimage.c | 4 +- src/mesa/drivers/dri/r200/r200_state.c | 2 +- src/mesa/drivers/dri/r200/r200_tex.c | 18 ++-- src/mesa/drivers/dri/radeon/radeon_common.c | 2 +- src/mesa/drivers/dri/radeon/radeon_fbo.c | 2 +- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 2 +- src/mesa/drivers/dri/radeon/radeon_pixel_read.c | 2 +- src/mesa/drivers/dri/radeon/radeon_state.c | 2 +- src/mesa/drivers/dri/radeon/radeon_swtcl.c | 2 +- src/mesa/drivers/dri/radeon/radeon_tex.c | 6 +- src/mesa/drivers/dri/radeon/radeon_texture.c | 4 +- src/mesa/main/api_validate.c | 2 +- src/mesa/main/atifragshader.c| 30 +++--- src/mesa/main/attrib.c | 2 +- src/mesa/main/blend.c| 34 +++ src/mesa/main/blit.c | 8 +- src/mesa/main/bufferobj.c| 14 +-- src/mesa/main/buffers.c | 22 ++--- src/mesa/main/clear.c| 8 +- src/mesa/main/condrender.c | 4 +- src/mesa/main/copyimage.c| 8 +- src/mesa/main/debug.c| 2 +- src/mesa/main/depth.c| 2 +- src/mesa/main/dlist.c| 14 +-- src/mesa/main/drawpix.c | 18 ++-- src/mesa/main/enable.c | 12 +-- src/mesa/main/enums.h| 2 +- src/mesa/main/errors.c | 4 +- src/mesa/main/fbobject.c | 72 +++--- src/mesa/main/feedback.c | 2 +- src/mesa/main/formatquery.c | 8 +- src/mesa/main/framebuffer.c | 2 +- src/mesa/main/genmipmap.c| 2 +- src/mesa/main/get.c | 8 +- src/mesa/main/getstring.c| 4 +- src/mesa/main/glformats.c| 6 +- src/mesa/main/hint.c | 4 +- src/mesa/main/light.c| 6 +- src/mesa/main/matrix.c | 8 +- src/mesa/main/objectlabel.c | 2 +- src/mesa/main/pipelineobj.c | 2 +- src/mesa/main/polygon.c | 8 +- src/mesa/main/program_resource.c | 20 ++-- src/mesa/main/queryobj.c | 28 +++--- src/mesa/main/readpix.c | 12 +-- src/mesa/main/samplerobj.c | 20 ++-- src/mesa/main/shader_query.cpp | 14 +-- src/mesa/main/shaderapi.c| 8 +- src/mesa/main/shaderimage.c | 2 +- src/mesa/main/tests/enum_strings.cpp | 4 +- src/mesa/main/texenv.c | 10 +- src/mesa/main/texformat.c| 2 +- src/mesa/main/texgen.c | 6 +- src/mesa/main/texgetimage.c | 4 +- src/mesa/main/teximage.c | 114 +++ src/mesa/main/texobj.c | 6 +- src/mesa/main/texparam.c | 24 ++--- src/mesa/main/texstate.c | 36 +++ src/mesa/main/texstate.h
Re: [Mesa-dev] [PATCH] svga: scons: remove unused HAVE_SYS_TYPES_H define
On 07/17/2015 02:14 PM, Emil Velikov wrote: On 17 July 2015 at 20:22, Brian Paul wrote: Can you elaborate in the commit message why this is being done or why the HAVE_SYS_TYPES_H definition is not needed? That saves me time having to research the issue myself. I'm not sure I can elaborate more than "it's unused" without sounding too repetitive. I can add "There isn't a single instance in mesa that mentions HAVE_SYS_TYPES_H, other than this file." if it makes it better. Ugh, I read it as "remove HAVE_SYS_TYPES_H define". Thanks. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCHv2 08/14] i965: Define and initialize image parameter structure.
This will be used to pass image meta-data to the shader when we cannot use typed surface reads and writes. All entries except surface_idx and size are otherwise unused and will get eliminated by the uniform packing pass. size will be used for bounds checking with some image formats and will be useful for ARB_shader_image_size too. surface_idx is always used. v2: Add CS support. Move the image_params array back to brw_stage_prog_data. --- I'm resending this (and also patches 9 and 10) because I had to make some rather intrusive changes during one of my last rebases -- The image_param array is now part of brw_stage_prog_data again instead of brw_stage_state (ironically as it was in my very first submission of these patches) because the compiler no longer has access to brw_stage_state since the brw_context pointer was removed from the visitors. src/mesa/drivers/dri/i965/brw_context.h | 54 src/mesa/drivers/dri/i965/brw_cs.cpp | 3 + src/mesa/drivers/dri/i965/brw_gs.c | 3 + src/mesa/drivers/dri/i965/brw_vs.c | 5 +- src/mesa/drivers/dri/i965/brw_wm.c | 4 ++ src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 82 6 files changed, 150 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index e16ad10..9ebad5b 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -361,6 +361,7 @@ struct brw_stage_prog_data { GLuint nr_params; /**< number of float params/constants */ GLuint nr_pull_params; + unsigned nr_image_params; unsigned curb_read_length; unsigned total_scratch; @@ -381,6 +382,59 @@ struct brw_stage_prog_data { */ const gl_constant_value **param; const gl_constant_value **pull_param; + + /** +* Image metadata passed to the shader as uniforms. This is deliberately +* ignored by brw_stage_prog_data_compare() because its contents don't have +* any influence on program compilation. +*/ + struct brw_image_param *image_param; +}; + +/* + * Image metadata structure as laid out in the shader parameter + * buffer. Entries have to be 16B-aligned for the vec4 back-end to be + * able to use them. That's okay because the padding and any unused + * entries [most of them except when we're doing untyped surface + * access] will be removed by the uniform packing pass. + */ +#define BRW_IMAGE_PARAM_SURFACE_IDX_OFFSET 0 +#define BRW_IMAGE_PARAM_OFFSET_OFFSET 4 +#define BRW_IMAGE_PARAM_SIZE_OFFSET 8 +#define BRW_IMAGE_PARAM_STRIDE_OFFSET 12 +#define BRW_IMAGE_PARAM_TILING_OFFSET 16 +#define BRW_IMAGE_PARAM_SWIZZLING_OFFSET20 +#define BRW_IMAGE_PARAM_SIZE24 + +struct brw_image_param { + /** Surface binding table index. */ + uint32_t surface_idx; + + /** Surface X, Y and Z dimensions. */ + uint32_t size[3]; + + /** Offset applied to the X and Y surface coordinates. */ + uint32_t offset[2]; + + /** X-stride in bytes, Y-stride in bytes, horizontal slice stride in +* pixels, vertical slice stride in pixels. +*/ + uint32_t stride[4]; + + /** Log2 of the tiling modulus in the X, Y and Z dimension. */ + uint32_t tiling[3]; + + /** +* Right shift to apply for bit 6 address swizzling. Two different +* swizzles can be specified and will be applied one after the other. The +* resulting address will be: +* +* addr' = addr ^ ((1 << 6) & ((addr >> swizzling[0]) ^ +* (addr >> swizzling[1]))) +* +* Use \c 0xff if any of the swizzles is not required. +*/ + uint32_t swizzling[2]; }; /* Data about a particular attempt to compile a program. Note that diff --git a/src/mesa/drivers/dri/i965/brw_cs.cpp b/src/mesa/drivers/dri/i965/brw_cs.cpp index d61bba0..144aa27 100644 --- a/src/mesa/drivers/dri/i965/brw_cs.cpp +++ b/src/mesa/drivers/dri/i965/brw_cs.cpp @@ -190,7 +190,10 @@ brw_codegen_cs_prog(struct brw_context *brw, rzalloc_array(NULL, const gl_constant_value *, param_count); prog_data.base.pull_param = rzalloc_array(NULL, const gl_constant_value *, param_count); + prog_data.base.image_param = + rzalloc_array(NULL, struct brw_image_param, cs->NumImages); prog_data.base.nr_params = param_count; + prog_data.base.nr_image_params = cs->NumImages; program = brw_cs_emit(brw, mem_ctx, key, &prog_data, &cp->program, prog, &program_size); diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 9c59c8a..d1a955a 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -69,7 +69,10 @@ brw_codegen_gs_prog(struct brw_context *brw, rzalloc_array(NULL, const gl_constant_value *, param_count); c.prog_data.base.base.pull_param = rzalloc_arr
[Mesa-dev] [PATCHv2 10/14] i965: Hook up image state upload.
v2: Add CS support. Move the image_params array back to brw_stage_prog_data. --- src/mesa/drivers/dri/i965/brw_context.h | 10 +++- src/mesa/drivers/dri/i965/brw_gs_surface_state.c | 25 src/mesa/drivers/dri/i965/brw_state.h| 4 ++ src/mesa/drivers/dri/i965/brw_state_upload.c | 12 src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 25 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 72 6 files changed, 146 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 9ebad5b..b6f993e 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -201,6 +201,7 @@ enum brw_state_id { BRW_STATE_STATS_WM, BRW_STATE_UNIFORM_BUFFER, BRW_STATE_ATOMIC_BUFFER, + BRW_STATE_IMAGE_UNITS, BRW_STATE_META_IN_PROGRESS, BRW_STATE_INTERPOLATION_MAP, BRW_STATE_PUSH_CONSTANT_ALLOCATION, @@ -282,6 +283,7 @@ enum brw_state_id { #define BRW_NEW_STATS_WM(1ull << BRW_STATE_STATS_WM) #define BRW_NEW_UNIFORM_BUFFER (1ull << BRW_STATE_UNIFORM_BUFFER) #define BRW_NEW_ATOMIC_BUFFER (1ull << BRW_STATE_ATOMIC_BUFFER) +#define BRW_NEW_IMAGE_UNITS (1ull << BRW_STATE_IMAGE_UNITS) #define BRW_NEW_META_IN_PROGRESS(1ull << BRW_STATE_META_IN_PROGRESS) #define BRW_NEW_INTERPOLATION_MAP (1ull << BRW_STATE_INTERPOLATION_MAP) #define BRW_NEW_PUSH_CONSTANT_ALLOCATION (1ull << BRW_STATE_PUSH_CONSTANT_ALLOCATION) @@ -1513,8 +1515,8 @@ struct brw_context } perfmon; int num_atoms[BRW_NUM_PIPELINES]; - const struct brw_tracked_state render_atoms[57]; - const struct brw_tracked_state compute_atoms[3]; + const struct brw_tracked_state render_atoms[60]; + const struct brw_tracked_state compute_atoms[4]; /* If (INTEL_DEBUG & DEBUG_BATCH) */ struct { @@ -1792,6 +1794,10 @@ void brw_upload_abo_surfaces(struct brw_context *brw, struct gl_shader_program *prog, struct brw_stage_state *stage_state, struct brw_stage_prog_data *prog_data); +void brw_upload_image_surfaces(struct brw_context *brw, + struct gl_shader *shader, + struct brw_stage_state *stage_state, + struct brw_stage_prog_data *prog_data); /* brw_surface_formats.c */ bool brw_render_target_supported(struct brw_context *brw, diff --git a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c index 0b8bfc3..0bb3074 100644 --- a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c @@ -119,3 +119,28 @@ const struct brw_tracked_state brw_gs_abo_surfaces = { }, .emit = brw_upload_gs_abo_surfaces, }; + +static void +brw_upload_gs_image_surfaces(struct brw_context *brw) +{ + struct gl_context *ctx = &brw->ctx; + /* BRW_NEW_GEOMETRY_PROGRAM */ + struct gl_shader_program *prog = + ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY]; + + if (prog) { + /* BRW_NEW_GS_PROG_DATA, BRW_NEW_IMAGE_UNITS */ + brw_upload_image_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_GEOMETRY], +&brw->gs.base, &brw->gs.prog_data->base.base); + } +} + +const struct brw_tracked_state brw_gs_image_surfaces = { + .dirty = { + .brw = BRW_NEW_BATCH | + BRW_NEW_GEOMETRY_PROGRAM | + BRW_NEW_GS_PROG_DATA | + BRW_NEW_IMAGE_UNITS, + }, + .emit = brw_upload_gs_image_surfaces, +}; diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 2eff1b5..0a09b44 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -72,8 +72,10 @@ extern const struct brw_tracked_state brw_vs_samplers; extern const struct brw_tracked_state brw_gs_samplers; extern const struct brw_tracked_state brw_vs_ubo_surfaces; extern const struct brw_tracked_state brw_vs_abo_surfaces; +extern const struct brw_tracked_state brw_vs_image_surfaces; extern const struct brw_tracked_state brw_gs_ubo_surfaces; extern const struct brw_tracked_state brw_gs_abo_surfaces; +extern const struct brw_tracked_state brw_gs_image_surfaces; extern const struct brw_tracked_state brw_vs_unit; extern const struct brw_tracked_state brw_gs_prog; extern const struct brw_tracked_state brw_wm_prog; @@ -84,7 +86,9 @@ extern const struct brw_tracked_state brw_gs_binding_table; extern const struct brw_tracked_state brw_vs_binding_table; extern const struct brw_tracked_state brw_wm_ubo_surfaces; extern const struct brw_tracked_state brw_wm_abo_surfaces; +extern const struct brw_tracked_state brw_wm_image_surfaces; extern const struct brw_tracked_state brw_cs_abo_surfaces; +extern const struct brw_tracked_state brw_cs_image_su
[Mesa-dev] [PATCHv2 09/14] i965: Reserve enough parameter entries for all image uniforms used in the program.
v2: Add CS support. --- src/mesa/drivers/dri/i965/brw_cs.cpp | 3 ++- src/mesa/drivers/dri/i965/brw_gs.c | 1 + src/mesa/drivers/dri/i965/brw_vs.c | 3 ++- src/mesa/drivers/dri/i965/brw_wm.c | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_cs.cpp b/src/mesa/drivers/dri/i965/brw_cs.cpp index 144aa27..232ea18 100644 --- a/src/mesa/drivers/dri/i965/brw_cs.cpp +++ b/src/mesa/drivers/dri/i965/brw_cs.cpp @@ -182,7 +182,8 @@ brw_codegen_cs_prog(struct brw_context *brw, * prog_data associated with the compiled program, and which will be freed * by the state cache. */ - int param_count = cs->num_uniform_components; + int param_count = cs->num_uniform_components + + cs->NumImages * BRW_IMAGE_PARAM_SIZE; /* The backend also sometimes adds params for texture size. */ param_count += 2 * ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits; diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index d1a955a..5c0d923 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -64,6 +64,7 @@ brw_codegen_gs_prog(struct brw_context *brw, /* We also upload clip plane data as uniforms */ param_count += MAX_CLIP_PLANES * 4; + param_count += gs->NumImages * BRW_IMAGE_PARAM_SIZE; c.prog_data.base.base.param = rzalloc_array(NULL, const gl_constant_value *, param_count); diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 20bc7a9..96aa56d 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -121,7 +121,8 @@ brw_codegen_vs_prog(struct brw_context *brw, * case being a float value that gets blown up to a vec4, so be * conservative here. */ - param_count = vs->num_uniform_components * 4; + param_count = (vs->num_uniform_components * 4 + + vs->NumImages * BRW_IMAGE_PARAM_SIZE); stage_prog_data->nr_image_params = vs->NumImages; } else { param_count = vp->program.Base.Parameters->NumParameters * 4; diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index e0e0bb7..9d3da49 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -195,7 +195,8 @@ brw_codegen_wm_prog(struct brw_context *brw, */ int param_count; if (fs) { - param_count = fs->num_uniform_components; + param_count = (fs->num_uniform_components + + fs->NumImages * BRW_IMAGE_PARAM_SIZE); prog_data.base.nr_image_params = fs->NumImages; } else { param_count = fp->program.Base.Parameters->NumParameters * 4; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 91387] Mesa 10.6.1 implementation error: invalid target in _swrast_choose_texture_sample_func
https://bugs.freedesktop.org/show_bug.cgi?id=91387 --- Comment #1 from Brian Paul --- Can you debug this a bit to see where this is happening and what the texture target is? I don't see how this would directly lead to a segfault in Mesa. After the error message we select the null_sample_func() function for texture sampling, which is a no-op. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: automake: replace $(RM) with rm -f
On 18 July 2015 at 23:13, Jonathan Gray wrote: > $(RM) is set to 'rm -f' by GNU make, this is not true of other versions > of make and RM is not one of the macros required by POSIX. > Slightly unfortunate but I think we can live with it. Would like to see if Matt/other have objections against this, but as-is Reviewed-by: Emil Velikov -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 83631] /usr/include/GL/glxext.h:480:143: error: 'GLintptr' has not been declared
https://bugs.freedesktop.org/show_bug.cgi?id=83631 --- Comment #8 from Emil Velikov --- With all due respect guys, should one take a closer look and remove the need for GL_GLEXT_LEGACY and its friends GL_GLEXT_PROTOTYPES/GLX_GLXEXT_PROTOTYPES. Iirc those were added as a workaround for ABI non-compliant users some ~10 years ago. Dropping the defines and fixing the build issues (not too many, I hope) seems like a better solution than adding another workaround/hack. -- 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] [Mesa-stable] [PATCH 16/18] i965: Prevent coordinate overflow in intel_emit_linear_blit
On Sat, Jul 18, 2015 at 1:24 AM, Chris Wilson wrote: > On Fri, Jul 17, 2015 at 05:12:54PM -0700, Anuj Phogat wrote: >> On Mon, Jul 6, 2015 at 3:33 AM, Chris Wilson >> wrote: >> > + do { >> > + /* The pitch given to the GPU must be DWORD aligned, and >> > + * we want width to match pitch. Max width is (1 << 15 - 1), >> > + * rounding that down to the nearest DWORD is 1 << 15 - 4 >> > + */ >> > + pitch = ROUND_DOWN_TO(MIN2(size, (1 << 15) - 64), 4); >> I understand why you are subtracting 64 in above statement, it'll >> be nice to update above comment explaining the reason. > > We use the pitch to set the copy width, so the maximum x coordinate > becomes src_x + pitch. Since src_x has a maximum value of 63, we want to > make sure that pitch is less than 32627-63. Simplified above. > >> > + height = (size < pitch || pitch == 0) ? 1 : size / pitch; > ... >> > + pitch *= height; >> > + if (size <= pitch) >> I think size < pitch will never be true. How about: >> assert(size < pitch); > > For a single row copy, size can be less than pitch. right. Reviewed-by: Anuj Phogat > -Chris > > -- > Chris Wilson, Intel Open Source Technology Centre > ___ > mesa-stable mailing list > mesa-sta...@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-stable ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: automake: replace $(RM) with rm -f
Hi, On 20 July 2015 at 17:40, Emil Velikov wrote: > On 18 July 2015 at 23:13, Jonathan Gray wrote: >> $(RM) is set to 'rm -f' by GNU make, this is not true of other versions >> of make and RM is not one of the macros required by POSIX. >> > Slightly unfortunate but I think we can live with it. Would like to > see if Matt/other have objections against this, but as-is I'd suggest using "RM ?= rm -f", but obviously that doesn't work on non-GNU make either ... Cheers, Daniel ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Register spilling issues in the NIR->vec4 backend
On Mon, Jul 20, 2015 at 03:35:26PM +0200, Iago Toral wrote: > Hi, > On Thu, 2015-07-16 at 08:15 -0700, Jason Ekstrand wrote: > > > > On Jul 15, 2015 11:20 PM, "Iago Toral" wrote: > > > > > > On Wed, 2015-07-15 at 11:02 -0700, Connor Abbott wrote: > > > > On Wed, Jul 15, 2015 at 7:49 AM, Iago Toral > > wrote: > > > > > Hi, > > > > > > > > > > when we sent the patches for the new nir->vec4 backend we > > mentioned that > > > > > we had a few dEQP tests that would fail to link because of > > register > > > > > spilling. Now that we have added GS support we see a few > > instances of > > > > > this problem popping up in a few GS piglit tests too, for > > example this > > > > > one: > > > > > > > > > > > > tests/spec/glsl-1.50/execution/variable-indexing/gs-input-array-vec4-index-rd.shader_test > > > > > > > > > > I have been looking into what is going on with these tests and I > > came to > > > > > the conclusion that the problem is a consequence of various > > factors, but > > > > > probably the main thing contributing to it is the way our SSA > > pass > > > > > works. That said, I am not that experienced with NIR, so it > > could also > > > > > be that my analysis is missing something and I am just arriving > > to wrong > > > > > conclusions, so I'll explain my thoughts below and hopefully > > someone > > > > > else with more NIR experience can jump in and confirm or reject > > my > > > > > analysis. > > > > > > > > > > The GS code in that test looks like this: > > > > > > > > > > for (int p = 0; p < 3; p++) { > > > > >color = ((index >= ins[p].m1.length() ? > > > > > ins[p].m2[index-ins[p].m1.length()] : > > > > > ins[p].m1[index]) == expect) ? > > > > >vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, > > 1.0); > > > > >gl_Position = gl_in[p].gl_Position; > > > > >EmitVertex(); > > > > > } > > > > > > > > > > One thing that is immediately contributing to the register > > pressure is > > > > > some really awful code generated because of the indirect array > > indexing > > > > > on the inputs inside the loop. This is because of the > > > > > lower_variable_index_to_cond_assign lowering pass called from > > > > > brw_shader.cpp. This pass will convert that color assignment > > into a > > > > > bunch of nested if/else statements which makes the generated > > GLSL IR > > > > > code rather large, involving plenty of temporaries too. This is > > only > > > > > made worse by the fact that loop unrolling will replicate that 3 > > times. > > > > > The result is a huge pile of GLSL IR with a few dozens of nested > > if/else > > > > > statements and temporaries that looks like [1] (that is only a > > fragment > > > > > of the GLSL IR). > > > > > > > > > > One thing that is particularly relevant in that code is that it > > has > > > > > multiple conditional assignments to the same variable > > > > > (dereference_array_value) as a consequence of this lowering > > pass. > > > > > > > > > > That much, however, is common to the NIR and non-NIR paths. The > > problem > > > > > in the NIR case is that all these assignments generate new SSA > > values, > > > > > which then become new registers in the final NIR form. This > > leads to NIR > > > > > code like [2]. In contrast, the old vec4 visitor path, is able > > to have > > > > > writes to the same variable write to the same register. > > > > > > > > > > As a result, if I print the code right before register > > allocation in the > > > > > NIR path [3] and I compare that to what we get with the old vec4 > > visitor > > > > > path at that same point [4], it is clearly visible that this > > difference > > > > > is allowing the vec4 visitor path to reduce register pressure > > (see how > > > > > in [4] we have multiple writes to vgrf5, while in [3] we always > > write to > > > > > a new vgrf every time). > > > > > > > > > > So, am I missing something or is this kind of result expected > > with NIR > > > > > programs? Is there anything in the nir->vec4 pass that we can do > > to fix > > > > > this or does this need to be fixed when going out of SSA moe > > inside NIR? > > > > > > > > > > Iago > > > > > > > > > > [1] http://pastebin.com/5uA8ex2S > > > > > [2] http://pastebin.com/pqLfvAVN > > > > > [3] http://pastebin.com/64nSuUH8 > > > > > [4] http://pastebin.com/WCrdYxzt > > > > > > > > > > ___ > > > > > mesa-dev mailing list > > > > > mesa-dev@lists.freedesktop.org > > > > > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > > > > > > > > Hi Iago, > > > > > > > > Indeed, NIR does convert conditional writes to conditional > > selectss -- > > > > it's a required part of the conversion to SSA, and since our HW > > has a > > > > conditional select instruction that's just as fast as doing a > > > > conditional move, we haven't bothered much to try and change it > > back > > > > during out-of-SSA. However, doing this shouldn't make things > > worse. In > > > > your example, vgrf9, v
Re: [Mesa-dev] [PATCH] nouveau: use bool instead of boolean
On 18/07/15 16:02, samuel.pitoiset wrote: > > > On 17/07/2015 23:08, Ilia Mirkin wrote: >> On Fri, Jul 17, 2015 at 5:02 PM, Emil Velikov >> wrote: >>> On 16/07/15 22:39, Samuel Pitoiset wrote: Signed-off-by: Samuel Pitoiset --- src/gallium/drivers/nouveau/codegen/nv50_ir.h | 2 +- .../drivers/nouveau/codegen/nv50_ir_driver.h | 14 +-- .../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 8 +- .../nouveau/codegen/nv50_ir_lowering_gm107.cpp | 2 +- .../drivers/nouveau/codegen/nv50_ir_peephole.cpp | 4 +- src/gallium/drivers/nouveau/nouveau_buffer.c | 118 ++--- src/gallium/drivers/nouveau/nouveau_buffer.h | 6 +- src/gallium/drivers/nouveau/nouveau_context.h | 4 +- src/gallium/drivers/nouveau/nouveau_fence.c| 36 +++ src/gallium/drivers/nouveau/nouveau_fence.h| 14 +-- src/gallium/drivers/nouveau/nouveau_screen.c | 6 +- src/gallium/drivers/nouveau/nouveau_screen.h | 6 +- src/gallium/drivers/nouveau/nouveau_video.c| 56 +- src/gallium/drivers/nouveau/nouveau_winsys.h | 4 +- src/gallium/drivers/nouveau/nv30/nv30_clear.c | 2 +- src/gallium/drivers/nouveau/nv30/nv30_context.c| 4 +- src/gallium/drivers/nouveau/nv30/nv30_context.h| 10 +- src/gallium/drivers/nouveau/nv30/nv30_draw.c | 22 ++-- src/gallium/drivers/nouveau/nv30/nv30_fragprog.c | 6 +- src/gallium/drivers/nouveau/nv30/nv30_miptree.c| 4 +- src/gallium/drivers/nouveau/nv30/nv30_push.c | 6 +- src/gallium/drivers/nouveau/nv30/nv30_query.c | 4 +- src/gallium/drivers/nouveau/nv30/nv30_resource.c | 4 +- src/gallium/drivers/nouveau/nv30/nv30_resource.h | 2 +- src/gallium/drivers/nouveau/nv30/nv30_screen.c | 10 +- src/gallium/drivers/nouveau/nv30/nv30_state.h | 4 +- .../drivers/nouveau/nv30/nv30_state_validate.c | 8 +- src/gallium/drivers/nouveau/nv30/nv30_transfer.c | 54 +- src/gallium/drivers/nouveau/nv30/nv30_vbo.c| 26 ++--- src/gallium/drivers/nouveau/nv30/nv30_vertprog.c | 12 +-- src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c | 46 src/gallium/drivers/nouveau/nv30/nvfx_shader.h | 4 +- src/gallium/drivers/nouveau/nv30/nvfx_vertprog.c | 50 - src/gallium/drivers/nouveau/nv50/nv50_blit.h | 10 +- src/gallium/drivers/nouveau/nv50/nv50_context.c| 14 +-- src/gallium/drivers/nouveau/nv50/nv50_context.h| 16 +-- src/gallium/drivers/nouveau/nv50/nv50_miptree.c| 26 ++--- src/gallium/drivers/nouveau/nv50/nv50_program.c| 18 ++-- src/gallium/drivers/nouveau/nv50/nv50_program.h| 6 +- src/gallium/drivers/nouveau/nv50/nv50_push.c | 8 +- src/gallium/drivers/nouveau/nv50/nv50_query.c | 38 +++ src/gallium/drivers/nouveau/nv50/nv50_resource.h | 6 +- src/gallium/drivers/nouveau/nv50/nv50_screen.c | 18 ++-- src/gallium/drivers/nouveau/nv50/nv50_screen.h | 16 +-- .../drivers/nouveau/nv50/nv50_shader_state.c | 18 ++-- src/gallium/drivers/nouveau/nv50/nv50_state.c | 24 ++--- .../drivers/nouveau/nv50/nv50_state_validate.c | 14 +-- src/gallium/drivers/nouveau/nv50/nv50_stateobj.h | 6 +- src/gallium/drivers/nouveau/nv50/nv50_surface.c| 64 +-- src/gallium/drivers/nouveau/nv50/nv50_tex.c| 22 ++-- src/gallium/drivers/nouveau/nv50/nv50_vbo.c| 32 +++--- src/gallium/drivers/nouveau/nvc0/nvc0_compute.c| 24 ++--- src/gallium/drivers/nouveau/nvc0/nvc0_compute.h| 2 +- src/gallium/drivers/nouveau/nvc0/nvc0_context.c| 12 +-- src/gallium/drivers/nouveau/nvc0/nvc0_context.h| 22 ++-- src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c| 12 +-- src/gallium/drivers/nouveau/nvc0/nvc0_program.c| 18 ++-- src/gallium/drivers/nouveau/nvc0/nvc0_program.h| 6 +- src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 84 +++ src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 24 ++--- src/gallium/drivers/nouveau/nvc0/nvc0_screen.h | 16 +-- .../drivers/nouveau/nvc0/nvc0_shader_state.c | 12 +-- src/gallium/drivers/nouveau/nvc0/nvc0_state.c | 20 ++-- .../drivers/nouveau/nvc0/nvc0_state_validate.c | 20 ++-- src/gallium/drivers/nouveau/nvc0/nvc0_stateobj.h | 8 +- src/gallium/drivers/nouveau/nvc0/nvc0_surface.c| 54 +- src/gallium/drivers/nouveau/nvc0/nvc0_tex.c| 38 +++ src/gallium/drivers/nouveau/nvc0/nvc0_transfer.c | 8 +- src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
[Mesa-dev] [PATCH 1/3] gallivm: Don't use raw_debug_ostream for dissasembling
All LLVM API calls that require an ostream object have been removed from the disassemble() function, so we don't need to use this class to wrap _debug_printf() we can just call this function directly. --- src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 27 +- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp index 405e648..ec88f33 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp @@ -123,7 +123,7 @@ lp_debug_dump_value(LLVMValueRef value) * - http://blog.llvm.org/2010/04/intro-to-llvm-mc-project.html */ static size_t -disassemble(const void* func, llvm::raw_ostream & Out) +disassemble(const void* func) { const uint8_t *bytes = (const uint8_t *)func; @@ -141,7 +141,8 @@ disassemble(const void* func, llvm::raw_ostream & Out) char outline[1024]; if (!D) { - Out << "error: couldn't create disassembler for triple " << Triple << "\n"; + _debug_printf("error: couldn't create disassembler for triple %s\n", +Triple.c_str()); return 0; } @@ -155,13 +156,13 @@ disassemble(const void* func, llvm::raw_ostream & Out) * so that between runs. */ - Out << llvm::format("%6lu:\t", (unsigned long)pc); + _debug_printf("%6lu:\t", (unsigned long)pc); Size = LLVMDisasmInstruction(D, (uint8_t *)bytes + pc, extent - pc, 0, outline, sizeof outline); if (!Size) { - Out << "invalid\n"; + _debug_printf("invalid\n"); pc += 1; break; } @@ -173,10 +174,10 @@ disassemble(const void* func, llvm::raw_ostream & Out) if (0) { unsigned i; for (i = 0; i < Size; ++i) { -Out << llvm::format("%02x ", bytes[pc + i]); +_debug_printf("%02x ", bytes[pc + i]); } for (; i < 16; ++i) { -Out << " "; +_debug_printf(" "); } } @@ -184,9 +185,9 @@ disassemble(const void* func, llvm::raw_ostream & Out) * Print the instruction. */ - Out << outline; + _debug_printf("%*s", Size, outline); - Out << "\n"; + _debug_printf("\n"); /* * Stop disassembling on return statements, if there is no record of a @@ -206,13 +207,12 @@ disassemble(const void* func, llvm::raw_ostream & Out) pc += Size; if (pc >= extent) { - Out << "disassembly larger than " << extent << "bytes, aborting\n"; + _debug_printf("disassembly larger than %ull bytes, aborting\n", extent); break; } } - Out << "\n"; - Out.flush(); + _debug_printf("\n"); LLVMDisasmDispose(D); @@ -229,9 +229,8 @@ disassemble(const void* func, llvm::raw_ostream & Out) extern "C" void lp_disassemble(LLVMValueRef func, const void *code) { - raw_debug_ostream Out; - Out << LLVMGetValueName(func) << ":\n"; - disassemble(code, Out); + _debug_printf("%s:\n", LLVMGetValueName(func)); + disassemble(code); } -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] gallivm: Add ifdefs so raw_debug_stream is only defined when used
Its only use is to implement a custom version of LLVMDumpValue on some Windows and embedded platforms. --- src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp index ec88f33..0a5c2cc 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp @@ -61,6 +61,7 @@ lp_check_alignment(const void *ptr, unsigned alignment) return ((uintptr_t)ptr & (alignment - 1)) == 0; } +#if (defined(PIPE_OS_WINDOWS) && !defined(PIPE_CC_MSVC)) || defined(PIPE_OS_EMBEDDED) class raw_debug_ostream : public llvm::raw_ostream @@ -91,6 +92,7 @@ raw_debug_ostream::write_impl(const char *Ptr, size_t Size) } } +#endif extern "C" const char * lp_get_module_id(LLVMModuleRef module) -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] gallivm: Initialize LLVM Modules's DataLayout to an empty string.
This fixes crashes in some piglit tests on radeonsi that use the draw module, and llvmpipe is likely completely broken without this on LLVM 3.8. This is just a temporary solution. The correct solution will require creating a TargetMachine during gallivm initialization and pulling the DataLayout from there. This will be a somewhat invasive change, and it will need to be validatated on multiple LLVM versions. --- src/gallium/auxiliary/gallivm/lp_bld_init.c | 28 +++- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index 384ea86..017d075 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -106,7 +106,6 @@ enum LLVM_CodeGenOpt_Level { static boolean create_pass_manager(struct gallivm_state *gallivm) { - char *td_str; assert(!gallivm->passmgr); assert(gallivm->target); @@ -122,10 +121,29 @@ create_pass_manager(struct gallivm_state *gallivm) // Old versions of LLVM get the DataLayout from the pass manager. LLVMAddTargetData(gallivm->target, gallivm->passmgr); - // New ones from the Module. - td_str = LLVMCopyStringRepOfTargetData(gallivm->target); - LLVMSetDataLayout(gallivm->module, td_str); - free(td_str); + /* Setting the module's DataLayout to an empty string will cause the +* ExecutionEngine to copy to the DataLayout string from its target +* machine to the module. As of LLVM 3.8 the module and the execution +* engine are required to have the same DataLayout. +* +* TODO: This is just a temporary work-around. The correct solution is +* for gallivm_init_state() to create a TargetMachine and pull the +* DataLayout from there. Currently, the TargetMachine used by llvmpipe +* is being implicitly created by the EngineBuilder in +* lp_build_create_jit_compiler_for_module() +*/ + +#if HAVE_LLVM < 0x0308 + { + char *td_str; + // New ones from the Module. + td_str = LLVMCopyStringRepOfTargetData(gallivm->target); + LLVMSetDataLayout(gallivm->module, td_str); + free(td_str); + } +#else + LLVMSetDataLayout(gallivm->module, ""); +#endif if ((gallivm_debug & GALLIVM_DEBUG_NO_OPT) == 0) { /* These are the passes currently listed in llvm-c/Transforms/Scalar.h, -- 1.9.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 05/14] meta: Abort meta pbo path if readpixels need signed-unsigned conversion
On Mon, Jul 20, 2015 at 5:10 AM, Iago Toral wrote: > On Fri, 2015-06-19 at 13:40 -0700, Anuj Phogat wrote: >> On Tue, Jun 16, 2015 at 9:21 PM, Jason Ekstrand wrote: >> > >> > On Jun 16, 2015 11:15, "Anuj Phogat" wrote: >> >> >> >> Without this patch, piglit test fbo_integer_readpixels_sint_uint fails, >> >> when >> >> forced to use the meta pbo path. >> >> >> >> Signed-off-by: Anuj Phogat >> >> Cc: >> >> --- >> >> src/mesa/drivers/common/meta_tex_subimage.c | 3 +++ >> >> 1 file changed, 3 insertions(+) >> >> >> >> diff --git a/src/mesa/drivers/common/meta_tex_subimage.c >> >> b/src/mesa/drivers/common/meta_tex_subimage.c >> >> index 00364f8..84cbc50 100644 >> >> --- a/src/mesa/drivers/common/meta_tex_subimage.c >> >> +++ b/src/mesa/drivers/common/meta_tex_subimage.c >> >> @@ -283,6 +283,9 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, >> >> GLuint dims, >> >> >> >>if (_mesa_need_rgb_to_luminance_conversion(rb->Format, format)) >> >> return false; >> >> + >> >> + if (_mesa_need_signed_unsigned_int_conversion(rb->Format, format, >> >> type)) >> >> + return false; >> > >> > Hrm... This seems fishy. Isn't glBlitFramebuffers supposed to handle >> > format >> > conversion with integers? If so we should probably fix it rather than just >> > skip it for the meta pbo path. >> > >> As discussed offline, here is relevant text for glBlitFrameBuffer() from >> OpenGL 4.5 spec, section 18.3.1: >> "An INVALID_OPERATION error is generated if format conversions are not >> supported, which occurs under any of the following conditions: >> -The read buffer contains fixed-point or floating-point values and any draw >> buffer contains neither fixed-point nor floating-point values. >> -The read buffer contains unsigned integer values and any draw buffer does >> not contain unsigned integer values. >> - The read buffer contains signed integer values and any draw buffer does >> not contain signed integer values." >> >> I'll add a comment here explaining the reason to avoid meta path. > > Is this code going to run only for glBlitFramebuffer? I see this > function being called from code paths that implement glReadPixels and > glGetTexImage too. > _mesa_meta_pbo_GetTexSubImage() is used only for glReadPixels and glGetTexImage. I quoted the glBliFrameBuffer restriction above because the function is later using _mesa_meta_BlitFramebuffer(), which doesn't support some format conversions. > Iago > >> >> } >> >> >> >> /* For arrays, use a tall (height * depth) 2D texture but taking into >> >> -- >> >> 1.9.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 > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 6/6] mesa: check for identity matrix in _mesa_LoadMatrixf()
On Fri, Jul 17, 2015 at 5:48 PM, Brian Paul wrote: > Google Earth often calls glLoadMatrixf() with an identity matrix instead > of glLoadIdentity() to set the modelview and texture matrices. In many > cases, the matrix is already the identity so the calls are redundant. > > By being a bit smarter in _mesa_LoadMatrixf() we can avoid quite a few > matrix-related state validations. > --- > src/mesa/main/matrix.c | 23 --- > 1 file changed, 20 insertions(+), 3 deletions(-) > > diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c > index 5ac97f8..e6bdff8 100644 > --- a/src/mesa/main/matrix.c > +++ b/src/mesa/main/matrix.c > @@ -330,8 +330,16 @@ _mesa_LoadIdentity( void ) > void GLAPIENTRY > _mesa_LoadMatrixf( const GLfloat *m ) > { > + static const GLfloat identity[16] = { > + 1.0f, 0.0f, 0.0f, 0.0f, > + 0.0f, 1.0f, 0.0f, 0.0f, > + 0.0f, 0.0f, 1.0f, 0.0f, > + 0.0f, 0.0f, 0.0f, 1.0f }; > GET_CURRENT_CONTEXT(ctx); > - if (!m) return; > + > + if (!m) > + return; > + > if (MESA_VERBOSE & VERBOSE_API) >_mesa_debug(ctx, >"glLoadMatrix(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f > %f\n", > @@ -341,8 +349,17 @@ _mesa_LoadMatrixf( const GLfloat *m ) >m[3], m[7], m[11], m[15]); > > FLUSH_VERTICES(ctx, 0); > - _math_matrix_loadf( ctx->CurrentStack->Top, m ); > - ctx->NewState |= ctx->CurrentStack->DirtyFlag; > + > + if (memcmp(m, identity, sizeof(identity)) == 0) { > + /* Setting the identity matrix */ > + if (_math_matrix_set_identity(ctx->CurrentStack->Top)) { > + ctx->NewState |= ctx->CurrentStack->DirtyFlag; > + } > + } > + else { > + _math_matrix_loadf(ctx->CurrentStack->Top, m); > + ctx->NewState |= ctx->CurrentStack->DirtyFlag; > + } > } > > > -- > 1.9.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev Series is: Reviewed-by: Anuj Phogat ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/6] mesa: move check for no-op glFrontFace call earlier
Patches 1, 2, and 3 are Reviewed-by: Ian Romanick The other patches look correct too, but the whole series is optimizations, so do you have any before / after performance data? On 07/17/2015 05:48 PM, Brian Paul wrote: > If the new mode matches the current mode, there can be no error. > --- > src/mesa/main/polygon.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c > index a1f0aa0..6be6f33 100644 > --- a/src/mesa/main/polygon.c > +++ b/src/mesa/main/polygon.c > @@ -93,14 +93,14 @@ _mesa_FrontFace( GLenum mode ) > if (MESA_VERBOSE&VERBOSE_API) >_mesa_debug(ctx, "glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode)); > > + if (ctx->Polygon.FrontFace == mode) > + return; > + > if (mode!=GL_CW && mode!=GL_CCW) { >_mesa_error( ctx, GL_INVALID_ENUM, "glFrontFace" ); >return; > } > > - if (ctx->Polygon.FrontFace == mode) > - return; > - > FLUSH_VERTICES(ctx, _NEW_POLYGON); > ctx->Polygon.FrontFace = mode; > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] swrast: remove unneeded & operators in _swrast_choose_texture_sample_func()
--- src/mesa/swrast/s_texfilter.c | 56 +-- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index abc1727..cd6395f 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -3713,7 +3713,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx, const struct gl_sampler_object *sampler) { if (!t || !_mesa_is_texture_complete(t, sampler)) { - return &null_sample_func; + return null_sample_func; } else { const GLboolean needLambda = @@ -3722,32 +3722,32 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx, switch (t->Target) { case GL_TEXTURE_1D: if (is_depth_texture(t)) { -return &sample_depth_texture; +return sample_depth_texture; } else if (needLambda) { -return &sample_lambda_1d; +return sample_lambda_1d; } else if (sampler->MinFilter == GL_LINEAR) { -return &sample_linear_1d; +return sample_linear_1d; } else { assert(sampler->MinFilter == GL_NEAREST); -return &sample_nearest_1d; +return sample_nearest_1d; } case GL_TEXTURE_2D: if (is_depth_texture(t)) { -return &sample_depth_texture; +return sample_depth_texture; } else if (needLambda) { /* Anisotropic filtering extension. Activated only if mipmaps are used */ if (sampler->MaxAnisotropy > 1.0 && sampler->MinFilter == GL_LINEAR_MIPMAP_LINEAR) { - return &sample_lambda_2d_aniso; + return sample_lambda_2d_aniso; } -return &sample_lambda_2d; +return sample_lambda_2d; } else if (sampler->MinFilter == GL_LINEAR) { -return &sample_linear_2d; +return sample_linear_2d; } else { /* check for a few optimized cases */ @@ -3772,72 +3772,72 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx, } case GL_TEXTURE_3D: if (needLambda) { -return &sample_lambda_3d; +return sample_lambda_3d; } else if (sampler->MinFilter == GL_LINEAR) { -return &sample_linear_3d; +return sample_linear_3d; } else { assert(sampler->MinFilter == GL_NEAREST); -return &sample_nearest_3d; +return sample_nearest_3d; } case GL_TEXTURE_CUBE_MAP: if (needLambda) { -return &sample_lambda_cube; +return sample_lambda_cube; } else if (sampler->MinFilter == GL_LINEAR) { -return &sample_linear_cube; +return sample_linear_cube; } else { assert(sampler->MinFilter == GL_NEAREST); -return &sample_nearest_cube; +return sample_nearest_cube; } case GL_TEXTURE_RECTANGLE_NV: if (is_depth_texture(t)) { -return &sample_depth_texture; +return sample_depth_texture; } else if (needLambda) { -return &sample_lambda_rect; +return sample_lambda_rect; } else if (sampler->MinFilter == GL_LINEAR) { -return &sample_linear_rect; +return sample_linear_rect; } else { assert(sampler->MinFilter == GL_NEAREST); -return &sample_nearest_rect; +return sample_nearest_rect; } case GL_TEXTURE_1D_ARRAY_EXT: if (is_depth_texture(t)) { -return &sample_depth_texture; +return sample_depth_texture; } else if (needLambda) { -return &sample_lambda_1d_array; +return sample_lambda_1d_array; } else if (sampler->MinFilter == GL_LINEAR) { -return &sample_linear_1d_array; +return sample_linear_1d_array; } else { assert(sampler->MinFilter == GL_NEAREST); -return &sample_nearest_1d_array; +return sample_nearest_1d_array; } case GL_TEXTURE_2D_ARRAY_EXT: if (is_depth_texture(t)) { -return &sample_depth_texture; +return sample_depth_texture; } else if (needLambda) { -return &sample_lambda_2d_array; +return sample_lambda_2d_array; } else if (sampler->MinFilter == GL_LINEAR) { -return &sample_linear_2d_array; +return sample_linear_2d_array; } else { assert(sampler->MinFilter == GL_NEAREST); -return &sample_nearest_2d_array; +
[Mesa-dev] [Bug 83631] /usr/include/GL/glxext.h:480:143: error: 'GLintptr' has not been declared
https://bugs.freedesktop.org/show_bug.cgi?id=83631 Ian Romanick changed: What|Removed |Added Status|NEW |NEEDINFO --- Comment #9 from Ian Romanick --- Emil is correct. If your code defines GL_EXT_LEGACY you are also certainly doing it wrong. What happens if you remove that define from your build? -- 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 4/6] mesa: optimize _math_matrix_set_identity() and return a bool result
On 07/17/2015 05:48 PM, Brian Paul wrote: > Skip memcpy() calls, etc. if the matrix is already the identity. Return > true/false to indicate if we're really changing the matrix or not. > --- > src/mesa/math/m_matrix.c | 23 +++ > src/mesa/math/m_matrix.h | 2 +- > 2 files changed, 16 insertions(+), 9 deletions(-) > > diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c > index ecf564c..37c7612 100644 > --- a/src/mesa/math/m_matrix.c > +++ b/src/mesa/math/m_matrix.c > @@ -1132,17 +1132,24 @@ _math_matrix_viewport(GLmatrix *m, const double > scale[3], > * > * Copies ::Identity into \p GLmatrix::m, and into GLmatrix::inv if not NULL. > * Sets the matrix type to identity, and clear the dirty flags. > + * \return true if prev matrix wasn't identity, false otherwise > */ > -void > -_math_matrix_set_identity( GLmatrix *mat ) > +bool > +_math_matrix_set_identity(GLmatrix *mat) > { > - memcpy( mat->m, Identity, 16*sizeof(GLfloat) ); > - memcpy( mat->inv, Identity, 16*sizeof(GLfloat) ); > + if (mat->type != MATRIX_IDENTITY || mat->flags) { > + memcpy(mat->m, Identity, 16 * sizeof(GLfloat)); > + memcpy(mat->inv, Identity, 16 * sizeof(GLfloat)); > + > + mat->type = MATRIX_IDENTITY; > + mat->flags = 0; > > - mat->type = MATRIX_IDENTITY; > - mat->flags &= ~(MAT_DIRTY_FLAGS| > -MAT_DIRTY_TYPE| > -MAT_DIRTY_INVERSE); > + return true; > + } > + else { Most places use } else { these days. > + /* no change */ > + return false; > + } > } > > /*@}*/ > diff --git a/src/mesa/math/m_matrix.h b/src/mesa/math/m_matrix.h > index 778d716..0bb63c8 100644 > --- a/src/mesa/math/m_matrix.h > +++ b/src/mesa/math/m_matrix.h > @@ -125,7 +125,7 @@ extern void > _math_matrix_viewport( GLmatrix *m, const double scale[3], > const double translate[3], double depthMax ); > > -extern void > +extern bool > _math_matrix_set_identity( GLmatrix *dest ); > > extern void > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 04/11] dri_interface: drop __NOT_HAVE_DRM_H magic
On 07/09/2015 01:12 PM, Emil Velikov wrote: > On 9 July 2015 at 18:50, Ian Romanick wrote: >> On 07/08/2015 10:07 AM, Emil Velikov wrote: >>> Signed-off-by: Emil Velikov >>> --- >>> include/GL/internal/dri_interface.h | 11 --- >>> 1 file changed, 11 deletions(-) >>> >>> diff --git a/include/GL/internal/dri_interface.h >>> b/include/GL/internal/dri_interface.h >>> index c827bb6..c0545b1 100644 >>> --- a/include/GL/internal/dri_interface.h >>> +++ b/include/GL/internal/dri_interface.h >>> @@ -40,20 +40,9 @@ >>> #ifndef DRI_INTERFACE_H >>> #define DRI_INTERFACE_H >>> >>> -/* For archs with no drm.h */ >>> -#if defined(__APPLE__) || defined(__CYGWIN__) || defined(__GNU__) >>> -#ifndef __NOT_HAVE_DRM_H >>> -#define __NOT_HAVE_DRM_H >>> -#endif >>> -#endif >>> - >>> -#ifndef __NOT_HAVE_DRM_H >> >> Shouldn't this get changed to use HAVE_LIBDRM as in later patches? > I thought about that, but that depends on if the versions of xserver > that we care about define it. From a quick look that is not the case > for older xservers, on the other hand drm* users which explicitly > include drm.h. If others don't mind when/if things break, I'm fine > using HAVE_LIBDRM here. Two questions come to mind... 1. Which X server versions build? 2. How hard would it be to patch the broken versions to work? It seems like it should be pretty easy, right? If all of the versions that we think people actually care about work, then I don't think we should worry. >> I >> guess drm_context_t and drm_drawable_t are ABI, so they shouldn't ever >> change. It does feel a little icky to redefine them when not necessary. >> > Yes it is rather nasty. Note that all of the "junk" is DRI1 stuff. I > was thinking about nuking/moving it, but with the see the "old dri > loader new module, and vice versa" topic still open, I've decided to > leave thing as is. > > -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] swrast: remove unneeded & operators in _swrast_choose_texture_sample_func()
On Mon, Jul 20, 2015 at 11:28 AM, Brian Paul wrote: > --- > src/mesa/swrast/s_texfilter.c | 56 > +-- > 1 file changed, 28 insertions(+), 28 deletions(-) > > diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c > index abc1727..cd6395f 100644 > --- a/src/mesa/swrast/s_texfilter.c > +++ b/src/mesa/swrast/s_texfilter.c > @@ -3713,7 +3713,7 @@ _swrast_choose_texture_sample_func( struct gl_context > *ctx, > const struct gl_sampler_object *sampler) > { > if (!t || !_mesa_is_texture_complete(t, sampler)) { > - return &null_sample_func; > + return null_sample_func; > } > else { >const GLboolean needLambda = > @@ -3722,32 +3722,32 @@ _swrast_choose_texture_sample_func( struct gl_context > *ctx, >switch (t->Target) { >case GL_TEXTURE_1D: > if (is_depth_texture(t)) { > -return &sample_depth_texture; > +return sample_depth_texture; > } > else if (needLambda) { > -return &sample_lambda_1d; > +return sample_lambda_1d; > } > else if (sampler->MinFilter == GL_LINEAR) { > -return &sample_linear_1d; > +return sample_linear_1d; > } > else { > assert(sampler->MinFilter == GL_NEAREST); > -return &sample_nearest_1d; > +return sample_nearest_1d; > } >case GL_TEXTURE_2D: > if (is_depth_texture(t)) { > -return &sample_depth_texture; > +return sample_depth_texture; > } > else if (needLambda) { > /* Anisotropic filtering extension. Activated only if mipmaps > are used */ > if (sampler->MaxAnisotropy > 1.0 && > sampler->MinFilter == GL_LINEAR_MIPMAP_LINEAR) { > - return &sample_lambda_2d_aniso; > + return sample_lambda_2d_aniso; > } > -return &sample_lambda_2d; > +return sample_lambda_2d; > } > else if (sampler->MinFilter == GL_LINEAR) { > -return &sample_linear_2d; > +return sample_linear_2d; > } > else { > /* check for a few optimized cases */ > @@ -3772,72 +3772,72 @@ _swrast_choose_texture_sample_func( struct gl_context > *ctx, > } >case GL_TEXTURE_3D: > if (needLambda) { > -return &sample_lambda_3d; > +return sample_lambda_3d; > } > else if (sampler->MinFilter == GL_LINEAR) { > -return &sample_linear_3d; > +return sample_linear_3d; > } > else { > assert(sampler->MinFilter == GL_NEAREST); > -return &sample_nearest_3d; > +return sample_nearest_3d; > } >case GL_TEXTURE_CUBE_MAP: > if (needLambda) { > -return &sample_lambda_cube; > +return sample_lambda_cube; > } > else if (sampler->MinFilter == GL_LINEAR) { > -return &sample_linear_cube; > +return sample_linear_cube; > } > else { > assert(sampler->MinFilter == GL_NEAREST); > -return &sample_nearest_cube; > +return sample_nearest_cube; > } >case GL_TEXTURE_RECTANGLE_NV: > if (is_depth_texture(t)) { > -return &sample_depth_texture; > +return sample_depth_texture; > } > else if (needLambda) { > -return &sample_lambda_rect; > +return sample_lambda_rect; > } > else if (sampler->MinFilter == GL_LINEAR) { > -return &sample_linear_rect; > +return sample_linear_rect; > } > else { > assert(sampler->MinFilter == GL_NEAREST); > -return &sample_nearest_rect; > +return sample_nearest_rect; > } >case GL_TEXTURE_1D_ARRAY_EXT: > if (is_depth_texture(t)) { > -return &sample_depth_texture; > +return sample_depth_texture; > } > else if (needLambda) { > -return &sample_lambda_1d_array; > +return sample_lambda_1d_array; > } > else if (sampler->MinFilter == GL_LINEAR) { > -return &sample_linear_1d_array; > +return sample_linear_1d_array; > } > else { > assert(sampler->MinFilter == GL_NEAREST); > -return &sample_nearest_1d_array; > +return sample_nearest_1d_array; > } >case GL_TEXTURE_2D_ARRAY_EXT: > if (is_depth_texture(t)) { > -return &sample_depth_texture; > +return sample_depth_texture; > } > else if (needLambda) { > -return &sample_lambda_2d_array; > +
Re: [Mesa-dev] [PATCH 06/18] i965: Pass the map-mode along to intel_mipmap_tree_map_raw()
On 07/06/2015 03:33 AM, Chris Wilson wrote: > Since we can distinguish when mapping between READ and WRITE, we can > pass along the map mode to avoid stalls and flushes where possible. > > Signed-off-by: Chris Wilson > --- > src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 28 > ++- > src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 3 ++- > 2 files changed, 17 insertions(+), 14 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > index e8bbc04..fcad043 100644 > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > @@ -1401,7 +1401,7 @@ intel_miptree_alloc_mcs(struct brw_context *brw, > * > * Note: the clear value for MCS buffers is all 1's, so we memset to 0xff. > */ > - void *data = intel_miptree_map_raw(brw, mt->mcs_mt); > + void *data = intel_miptree_map_raw(brw, mt->mcs_mt, GL_MAP_WRITE_BIT); > memset(data, 0xff, mt->mcs_mt->total_height * mt->mcs_mt->pitch); > intel_miptree_unmap_raw(brw, mt->mcs_mt); > mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_CLEAR; > @@ -2053,13 +2053,15 @@ intel_miptree_updownsample(struct brw_context *brw, > } > > void * > -intel_miptree_map_raw(struct brw_context *brw, struct intel_mipmap_tree *mt) > +intel_miptree_map_raw(struct brw_context *brw, > + struct intel_mipmap_tree *mt, > + GLbitfield mode) No tabs, only spaces. :) > { > /* CPU accesses to color buffers don't understand fast color clears, so > * resolve any pending fast color clears before we map. > */ > intel_miptree_resolve_color(brw, mt); > - return brw_bo_map(mt->bo, MAP_WRITE); > + return brw_bo_map(mt->bo, mode & GL_MAP_WRITE_BIT ? MAP_WRITE : MAP_READ); > } > > void > @@ -2088,7 +2090,7 @@ intel_miptree_map_gtt(struct brw_context *brw, > assert(y % bh == 0); > y /= bh; > > - base = intel_miptree_map_raw(brw, mt) + mt->offset; > + base = intel_miptree_map_raw(brw, mt, map->mode) + mt->offset; > > if (base == NULL) >map->ptr = NULL; > @@ -2155,7 +2157,7 @@ intel_miptree_map_blit(struct brw_context *brw, >} > } > > - map->ptr = intel_miptree_map_raw(brw, map->mt); > + map->ptr = intel_miptree_map_raw(brw, map->mt, map->mode); > > DBG("%s: %d,%d %dx%d from mt %p (%s) %d,%d = %p/%d\n", __func__, > map->x, map->y, map->w, map->h, > @@ -2219,7 +2221,7 @@ intel_miptree_map_movntdqa(struct brw_context *brw, > image_x += map->x; > image_y += map->y; > > - void *src = intel_miptree_map_raw(brw, mt); > + void *src = intel_miptree_map_raw(brw, mt, map->mode); > if (!src) >return; > src += image_y * mt->pitch; > @@ -2285,7 +2287,7 @@ intel_miptree_map_s8(struct brw_context *brw, > */ > if (!(map->mode & GL_MAP_INVALIDATE_RANGE_BIT)) { >uint8_t *untiled_s8_map = map->ptr; > - uint8_t *tiled_s8_map = intel_miptree_map_raw(brw, mt); > + uint8_t *tiled_s8_map = intel_miptree_map_raw(brw, mt, > GL_MAP_READ_BIT); >unsigned int image_x, image_y; > >intel_miptree_get_image_offset(mt, level, slice, &image_x, &image_y); > @@ -2322,7 +2324,7 @@ intel_miptree_unmap_s8(struct brw_context *brw, > if (map->mode & GL_MAP_WRITE_BIT) { >unsigned int image_x, image_y; >uint8_t *untiled_s8_map = map->ptr; > - uint8_t *tiled_s8_map = intel_miptree_map_raw(brw, mt); > + uint8_t *tiled_s8_map = intel_miptree_map_raw(brw, mt, > GL_MAP_WRITE_BIT); > >intel_miptree_get_image_offset(mt, level, slice, &image_x, &image_y); > > @@ -2377,7 +2379,7 @@ intel_miptree_unmap_etc(struct brw_context *brw, > image_x += map->x; > image_y += map->y; > > - uint8_t *dst = intel_miptree_map_raw(brw, mt) > + uint8_t *dst = intel_miptree_map_raw(brw, mt, GL_MAP_WRITE_BIT) > + image_y * mt->pitch > + image_x * mt->cpp; > > @@ -2428,8 +2430,8 @@ intel_miptree_map_depthstencil(struct brw_context *brw, > */ > if (!(map->mode & GL_MAP_INVALIDATE_RANGE_BIT)) { >uint32_t *packed_map = map->ptr; > - uint8_t *s_map = intel_miptree_map_raw(brw, s_mt); > - uint32_t *z_map = intel_miptree_map_raw(brw, z_mt); > + uint8_t *s_map = intel_miptree_map_raw(brw, s_mt, GL_MAP_READ_BIT); > + uint32_t *z_map = intel_miptree_map_raw(brw, z_mt, GL_MAP_READ_BIT); >unsigned int s_image_x, s_image_y; >unsigned int z_image_x, z_image_y; > > @@ -2489,8 +2491,8 @@ intel_miptree_unmap_depthstencil(struct brw_context > *brw, > > if (map->mode & GL_MAP_WRITE_BIT) { >uint32_t *packed_map = map->ptr; > - uint8_t *s_map = intel_miptree_map_raw(brw, s_mt); > - uint32_t *z_map = intel_miptree_map_raw(brw, z_mt); > + uint8_t *s_map = intel_miptree_map_raw(brw, s_mt, GL_MAP_WRITE_BIT); > + uint32_t *z_map = intel_miptree_map_raw(brw, z_mt
[Mesa-dev] ARB_copy_image support in Gallium
Hi Brian, You marked off ARB_copy_image (and ARB_clear_texture) as in-progress by VMware some months ago -- has there been any movement on that? It appears that Bioshock Infinite requires ARB_copy_image so might be nice to get that added in. The complication in implementing ARB_copy_image was that st/mesa will pick potentially different PIPE_FORMAT enums for the same internal format, depending on the parameters to the glTexImage call. A developer (irc handle Leftmost, I forget his real name, sorry) tried to wrestle with the issues this presents, but as I recall ended up coming up short. The final implementation probably needs some combination of resource_copy_region and blit. I think resource_copy_region currently is spec'd to require identical formats in src and dst, but that could be relaxed. Anyways, would be interested in hearing whether you guys have made any progress, or if you had thoughts on proper implementation. Cheers, -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] swrast: remove unneeded & operators in _swrast_choose_texture_sample_func()
Brian Paul writes: > --- > src/mesa/swrast/s_texfilter.c | 56 > +-- > 1 file changed, 28 insertions(+), 28 deletions(-) > > diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c > index abc1727..cd6395f 100644 > --- a/src/mesa/swrast/s_texfilter.c > +++ b/src/mesa/swrast/s_texfilter.c > @@ -3713,7 +3713,7 @@ _swrast_choose_texture_sample_func( struct gl_context > *ctx, > const struct gl_sampler_object *sampler) > { > if (!t || !_mesa_is_texture_complete(t, sampler)) { > - return &null_sample_func; > + return null_sample_func; Much prettier. Reviewed-by: Eric Anholt signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/6] mesa: move check for no-op glShadeModel call earlier
Brian Paul writes: > --- > src/mesa/main/light.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c > index 4021dbe..f215c93 100644 > --- a/src/mesa/main/light.c > +++ b/src/mesa/main/light.c > @@ -44,14 +44,14 @@ _mesa_ShadeModel( GLenum mode ) > if (MESA_VERBOSE & VERBOSE_API) >_mesa_debug(ctx, "glShadeModel %s\n", _mesa_lookup_enum_by_nr(mode)); > > + if (ctx->Light.ShadeModel == mode) > + return; > + > if (mode != GL_FLAT && mode != GL_SMOOTH) { >_mesa_error(ctx, GL_INVALID_ENUM, "glShadeModel"); >return; > } > > - if (ctx->Light.ShadeModel == mode) > - return; > - > FLUSH_VERTICES(ctx, _NEW_LIGHT); > ctx->Light.ShadeModel = mode; Patches 1-3 are: Reviewed-by: Eric Anholt I'm pretty skeptical of adding the memcmp in 6/6, though. signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] ARB_copy_image support in Gallium
On Mon, Jul 20, 2015 at 2:44 PM, Ilia Mirkin wrote: > Hi Brian, > > You marked off ARB_copy_image (and ARB_clear_texture) as in-progress > by VMware some months ago -- has there been any movement on that? It > appears that Bioshock Infinite requires ARB_copy_image so might be > nice to get that added in. > > The complication in implementing ARB_copy_image was that st/mesa will > pick potentially different PIPE_FORMAT enums for the same internal > format, depending on the parameters to the glTexImage call. A > developer (irc handle Leftmost, I forget his real name, sorry) tried > to wrestle with the issues this presents, but as I recall ended up > coming up short. > > The final implementation probably needs some combination of > resource_copy_region and blit. I think resource_copy_region currently > is spec'd to require identical formats in src and dst, but that could > be relaxed. > > Anyways, would be interested in hearing whether you guys have made any > progress, or if you had thoughts on proper implementation. > > Cheers, > > -ilia As an aside, here's a very naive implementation of the ext, which fails for lots of reasons not the least of which is that we default to BGRA instead of RGBA. Perhaps we could create a resource_copy_region version that also takes (or knows about) swizzles... that should also cover many (all?) of the situations I think. -ilia diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 7ea3846..b6b0081 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1864,6 +1864,28 @@ st_TextureView(struct gl_context *ctx, return GL_TRUE; } +static void +st_CopyImageSubData(struct gl_context *ctx, +struct gl_texture_image *src_image, +int src_x, int src_y, int src_z, +struct gl_texture_image *dst_image, +int dst_x, int dst_y, int dst_z, +int src_width, int src_height) +{ + struct st_context *st = st_context(ctx); + struct pipe_context *pipe = st->pipe; + struct st_texture_image *src = st_texture_image(src_image); + struct st_texture_image *dst = st_texture_image(dst_image); + + struct pipe_box box; + + u_box_2d_zslice(src_x, src_y, src_z, src_width, src_height, &box); + pipe->resource_copy_region(pipe, dst->pt, dst_image->Level, + dst_x, dst_y, dst_z, + src->pt, src_image->Level, + &box); +} + void st_init_texture_functions(struct dd_function_table *functions) @@ -1896,4 +1918,6 @@ st_init_texture_functions(struct dd_function_table *functions) functions->AllocTextureStorage = st_AllocTextureStorage; functions->TextureView = st_TextureView; + + functions->CopyImageSubData = st_CopyImageSubData; } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index b1057f3..9bff7b4 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -589,6 +589,7 @@ void st_init_extensions(struct pipe_screen *screen, * Extensions that are supported by all Gallium drivers: */ extensions->ARB_ES2_compatibility = GL_TRUE; + extensions->ARB_copy_image = GL_TRUE; extensions->ARB_draw_elements_base_vertex = GL_TRUE; extensions->ARB_explicit_attrib_location = GL_TRUE; extensions->ARB_explicit_uniform_location = GL_TRUE; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] gallivm: Initialize LLVM Modules's DataLayout to an empty string.
Am 20.07.2015 um 19:35 schrieb Tom Stellard: > This fixes crashes in some piglit tests on radeonsi that use the draw > module, and llvmpipe is likely completely broken without this on LLVM > 3.8. Yes, see https://llvm.org/bugs/show_bug.cgi?id=24172 > > This is just a temporary solution. The correct solution will require > creating a TargetMachine during gallivm initialization and pulling the > DataLayout from there. This will be a somewhat invasive change, and it > will need to be validatated on multiple LLVM versions. Reviewed-by: Roland Scheidegger > --- > src/gallium/auxiliary/gallivm/lp_bld_init.c | 28 +++- > 1 file changed, 23 insertions(+), 5 deletions(-) > > diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c > b/src/gallium/auxiliary/gallivm/lp_bld_init.c > index 384ea86..017d075 100644 > --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c > +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c > @@ -106,7 +106,6 @@ enum LLVM_CodeGenOpt_Level { > static boolean > create_pass_manager(struct gallivm_state *gallivm) > { > - char *td_str; > assert(!gallivm->passmgr); > assert(gallivm->target); > > @@ -122,10 +121,29 @@ create_pass_manager(struct gallivm_state *gallivm) > // Old versions of LLVM get the DataLayout from the pass manager. > LLVMAddTargetData(gallivm->target, gallivm->passmgr); > > - // New ones from the Module. > - td_str = LLVMCopyStringRepOfTargetData(gallivm->target); > - LLVMSetDataLayout(gallivm->module, td_str); > - free(td_str); > + /* Setting the module's DataLayout to an empty string will cause the > +* ExecutionEngine to copy to the DataLayout string from its target > +* machine to the module. As of LLVM 3.8 the module and the execution > +* engine are required to have the same DataLayout. > +* > +* TODO: This is just a temporary work-around. The correct solution is > +* for gallivm_init_state() to create a TargetMachine and pull the > +* DataLayout from there. Currently, the TargetMachine used by llvmpipe > +* is being implicitly created by the EngineBuilder in > +* lp_build_create_jit_compiler_for_module() > +*/ > + > +#if HAVE_LLVM < 0x0308 > + { > + char *td_str; > + // New ones from the Module. > + td_str = LLVMCopyStringRepOfTargetData(gallivm->target); > + LLVMSetDataLayout(gallivm->module, td_str); > + free(td_str); > + } > +#else > + LLVMSetDataLayout(gallivm->module, ""); > +#endif > > if ((gallivm_debug & GALLIVM_DEBUG_NO_OPT) == 0) { >/* These are the passes currently listed in llvm-c/Transforms/Scalar.h, > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/6] mesa: move check for no-op glFrontFace call earlier
On 07/20/2015 12:27 PM, Ian Romanick wrote: Patches 1, 2, and 3 are Reviewed-by: Ian Romanick The other patches look correct too, but the whole series is optimizations, so do you have any before / after performance data? No, I don't. I happened across these while looking at apitraces of Google Earth. It emits a surprising number of no-change/redundant GL commands. There are recurring sequences of drawing commands with needless glLoadIdentity() and glLoadMatrixf(identy) calls. Avoiding the state validation for that seems like a good thing. I did some quick and dirty counting of the number of times matrix validation was done and this reduces it, but I don't have a good way to measure an overall performance change. As for Eric's concern: "I'm pretty skeptical of adding the memcmp in 6/6, though." I don't think the memcmp() will be a big deal in practice. I think the only case where the whole 16-element comparison is needed is when the matrix is a pure translation (or identity). For other types of matrices, the m[0] element will usually not be 1.0 and the memcmp() would stop early. In any case, glLoadMatrix is not super common and I'd expect the 64-byte memcmp() to be cheaper than the matrix-analyze code in m_matrix.c I'm not super attached to this change so if you're unconvinced I won't mind dropping it. -Brian On 07/17/2015 05:48 PM, Brian Paul wrote: If the new mode matches the current mode, there can be no error. --- src/mesa/main/polygon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index a1f0aa0..6be6f33 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -93,14 +93,14 @@ _mesa_FrontFace( GLenum mode ) if (MESA_VERBOSE&VERBOSE_API) _mesa_debug(ctx, "glFrontFace %s\n", _mesa_lookup_enum_by_nr(mode)); + if (ctx->Polygon.FrontFace == mode) + return; + if (mode!=GL_CW && mode!=GL_CCW) { _mesa_error( ctx, GL_INVALID_ENUM, "glFrontFace" ); return; } - if (ctx->Polygon.FrontFace == mode) - return; - FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.FrontFace = mode; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] ARB_copy_image support in Gallium
On 07/20/2015 01:19 PM, Ilia Mirkin wrote: On Mon, Jul 20, 2015 at 2:44 PM, Ilia Mirkin wrote: Hi Brian, You marked off ARB_copy_image (and ARB_clear_texture) as in-progress by VMware some months ago -- has there been any movement on that? It appears that Bioshock Infinite requires ARB_copy_image so might be nice to get that added in. The complication in implementing ARB_copy_image was that st/mesa will pick potentially different PIPE_FORMAT enums for the same internal format, depending on the parameters to the glTexImage call. A developer (irc handle Leftmost, I forget his real name, sorry) tried to wrestle with the issues this presents, but as I recall ended up coming up short. The final implementation probably needs some combination of resource_copy_region and blit. I think resource_copy_region currently is spec'd to require identical formats in src and dst, but that could be relaxed. Anyways, would be interested in hearing whether you guys have made any progress, or if you had thoughts on proper implementation. Cheers, -ilia As an aside, here's a very naive implementation of the ext, which fails for lots of reasons not the least of which is that we default to BGRA instead of RGBA. Perhaps we could create a resource_copy_region version that also takes (or knows about) swizzles... that should also cover many (all?) of the situations I think. One of our interns did the implementation (with some contributions from me). I need to do a lot of clean-up before posting the patches here though. I was hoping to do that in the next month or two. If you need it sooner, I'll can see what I can do. There were several aspects to it: 1. Fix a few issues in the copyimage.c code. The business of wrapping renderbuffer src/dest surfaces with new texture objects made a mess in the state tracker so I refactored that code. Had to update the i965 code too. 2. The state tracker needed some tweaks in the format selection code to make better choices. 3. Still need to add a new PIPE_CAP so drivers can opt-in as they're tested/verified. 4. The util_resource_copy_region() code need a bunch of changes to allow softpipe/llvmpipe to work. 5. A lot of work in our VMware/svga driver. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] ARB_copy_image support in Gallium
Theoretically resource_copy_region should be the right function for that. Both ARB_copy_image and d3d10 ResourceCopyRegion define this as essentially the equivalent of memcpy. I guess the difficulty is that GL's view classes are a bit different compared to d3d10 typeless groups - d3d10 doesn't allow ResourceCopyRegion with swizzling (actually there are not even ANY formats which would have just different swizzling anyway in d3d10, though some got added back later). So, right now this does NOT require the same formats, but it is loosely specced in docs for the formats to be compatible. See util_is_format_compatible, according to that RGBA vs. RGBX would be compatible, though a depth and corresponding color format would be not (which is ok for gl but not d3d), things like RGBA8_UNORM vs. RGBA8_SINT would certainly qualify. Not sure though if I like the "memcpy with swizzling" idea. Sounds like that might not be easily implementable in general, unless you revert back to a quad blit, which is not the intention of either gl's nor d3d10's function. Sounds to me like it may be better to leave things as-is, with a fallback to quad blit if the formats require swizzling (or make sure not formats with different swizzling are picked in the first place). Roland Am 20.07.2015 um 20:44 schrieb Ilia Mirkin: > Hi Brian, > > You marked off ARB_copy_image (and ARB_clear_texture) as in-progress > by VMware some months ago -- has there been any movement on that? It > appears that Bioshock Infinite requires ARB_copy_image so might be > nice to get that added in. > > The complication in implementing ARB_copy_image was that st/mesa will > pick potentially different PIPE_FORMAT enums for the same internal > format, depending on the parameters to the glTexImage call. A > developer (irc handle Leftmost, I forget his real name, sorry) tried > to wrestle with the issues this presents, but as I recall ended up > coming up short. > > The final implementation probably needs some combination of > resource_copy_region and blit. I think resource_copy_region currently > is spec'd to require identical formats in src and dst, but that could > be relaxed. > > Anyways, would be interested in hearing whether you guys have made any > progress, or if you had thoughts on proper implementation. > > Cheers, > > -ilia > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=Of_nhwBq9J9BBkf9U_Kjb0VmZ0CyO1GKG1YhKRVSfqk&s=eng7skR_1fpZKpxc7xRJD-tfOjNKaHl0rRr3iBr7_QU&e= > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/5] utils: automake: remove uncommon $()
On Fri 17 Jul 2015, Emil Velikov wrote: > On 17 July 2015 at 19:11, Ilia Mirkin wrote: > > On Fri, Jul 17, 2015 at 2:11 PM, Eric Anholt wrote: > >> Matt Turner writes: > >> > >>> On Fri, Jul 17, 2015 at 10:17 AM, Emil Velikov > >>> wrote: > Cc: Eric Anholt > Signed-off-by: Emil Velikov > --- > src/util/tests/hash_table/Makefile.am | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/src/util/tests/hash_table/Makefile.am > b/src/util/tests/hash_table/Makefile.am > index 04a77e3..0c99e7b 100644 > --- a/src/util/tests/hash_table/Makefile.am > +++ b/src/util/tests/hash_table/Makefile.am > @@ -38,7 +38,6 @@ TESTS = \ > null_destroy \ > random_entry \ > remove_null \ > - replacement \ > - $() > + replacement > >>> > >>> To get the benefit of $() without some unknown incompatibility, pixman > >>> uses $(NULL) which of course relies on not having a variable named > >>> NULL. > >>> > >>> I might suggest that instead of removing them, but I'm not much > >>> opposed to removing them either. > >> > >> I do really like having a terminator on these lists. I find that > >> without them, I'll end up copy-and-pasting the wrong thing and missing > >> the trailing backslash on a line. > > > > Also makes diffs easier to read since you don't have spurious changes > > which just add a \ . I second Anholt. I prefer the sentinel too, but don't feel too strongly about it. I find that a sentinel helps me avoid making mistakes when adding new list members or when sorting the lists in $EDITOR. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] gallivm: Don't use raw_debug_ostream for dissasembling
On 20/07/15 18:35, Tom Stellard wrote: All LLVM API calls that require an ostream object have been removed from the disassemble() function, so we don't need to use this class to wrap _debug_printf() we can just call this function directly. --- src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 27 +- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp index 405e648..ec88f33 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp @@ -123,7 +123,7 @@ lp_debug_dump_value(LLVMValueRef value) * - http://blog.llvm.org/2010/04/intro-to-llvm-mc-project.html */ static size_t -disassemble(const void* func, llvm::raw_ostream & Out) +disassemble(const void* func) { const uint8_t *bytes = (const uint8_t *)func; @@ -141,7 +141,8 @@ disassemble(const void* func, llvm::raw_ostream & Out) char outline[1024]; if (!D) { - Out << "error: couldn't create disassembler for triple " << Triple << "\n"; + _debug_printf("error: couldn't create disassembler for triple %s\n", +Triple.c_str()); return 0; } @@ -155,13 +156,13 @@ disassemble(const void* func, llvm::raw_ostream & Out) * so that between runs. */ - Out << llvm::format("%6lu:\t", (unsigned long)pc); + _debug_printf("%6lu:\t", (unsigned long)pc); Size = LLVMDisasmInstruction(D, (uint8_t *)bytes + pc, extent - pc, 0, outline, sizeof outline); if (!Size) { - Out << "invalid\n"; + _debug_printf("invalid\n"); pc += 1; break; } @@ -173,10 +174,10 @@ disassemble(const void* func, llvm::raw_ostream & Out) if (0) { unsigned i; for (i = 0; i < Size; ++i) { -Out << llvm::format("%02x ", bytes[pc + i]); +_debug_printf("%02x ", bytes[pc + i]); } for (; i < 16; ++i) { -Out << " "; +_debug_printf(" "); } } @@ -184,9 +185,9 @@ disassemble(const void* func, llvm::raw_ostream & Out) * Print the instruction. */ - Out << outline; + _debug_printf("%*s", Size, outline); - Out << "\n"; + _debug_printf("\n"); /* * Stop disassembling on return statements, if there is no record of a @@ -206,13 +207,12 @@ disassemble(const void* func, llvm::raw_ostream & Out) pc += Size; if (pc >= extent) { - Out << "disassembly larger than " << extent << "bytes, aborting\n"; + _debug_printf("disassembly larger than %ull bytes, aborting\n", extent); break; } } - Out << "\n"; - Out.flush(); + _debug_printf("\n"); LLVMDisasmDispose(D); @@ -229,9 +229,8 @@ disassemble(const void* func, llvm::raw_ostream & Out) extern "C" void lp_disassemble(LLVMValueRef func, const void *code) { - raw_debug_ostream Out; - Out << LLVMGetValueName(func) << ":\n"; - disassemble(code, Out); + _debug_printf("%s:\n", LLVMGetValueName(func)); + disassemble(code); } Series looks good AFAICT. Reviewed-by: Jose Fonseca ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] ARB_copy_image support in Gallium
On Mon, Jul 20, 2015 at 3:53 PM, Brian Paul wrote: > On 07/20/2015 01:19 PM, Ilia Mirkin wrote: > >> On Mon, Jul 20, 2015 at 2:44 PM, Ilia Mirkin wrote: >>> >>> Hi Brian, >>> >>> You marked off ARB_copy_image (and ARB_clear_texture) as in-progress >>> by VMware some months ago -- has there been any movement on that? It >>> appears that Bioshock Infinite requires ARB_copy_image so might be >>> nice to get that added in. >>> >>> The complication in implementing ARB_copy_image was that st/mesa will >>> pick potentially different PIPE_FORMAT enums for the same internal >>> format, depending on the parameters to the glTexImage call. A >>> developer (irc handle Leftmost, I forget his real name, sorry) tried >>> to wrestle with the issues this presents, but as I recall ended up >>> coming up short. >>> >>> The final implementation probably needs some combination of >>> resource_copy_region and blit. I think resource_copy_region currently >>> is spec'd to require identical formats in src and dst, but that could >>> be relaxed. >>> >>> Anyways, would be interested in hearing whether you guys have made any >>> progress, or if you had thoughts on proper implementation. >>> >>> Cheers, >>> >>>-ilia >> >> >> As an aside, here's a very naive implementation of the ext, which >> fails for lots of reasons not the least of which is that we default to >> BGRA instead of RGBA. Perhaps we could create a resource_copy_region >> version that also takes (or knows about) swizzles... that should also >> cover many (all?) of the situations I think. > > > One of our interns did the implementation (with some contributions from me). > I need to do a lot of clean-up before posting the patches here though. I > was hoping to do that in the next month or two. If you need it sooner, I'll > can see what I can do. As there's a decent chance that tessellation and subroutine support will land in the next release (thus exposing GL 4.1 in several drivers), and there is an actual released game that requires ARB_copy_image, it would definitely be nice to see support land before the next mesa release is branched off, which should happen in about a month's time I guess. Cheers, -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965/vec4: Fix liveness analysis with BRW_OPCODE_SEL
On Monday, July 20, 2015 03:14:14 PM Iago Toral Quiroga wrote: > We only consider a vgrf defined by a given block if the block writes to it > unconditionally. So far we have been checking this by testing that the > instruction is not predicated, however, in the case of BRW_OPCODE_SEL, > the predication is used to select the value to write, not to decide if > the write is actually done. The consequence of this was increased life > spans for affected vgrfs, which could lead to additional register pressure. > > Since NIR generates selects for conditional writes this was causing massive > register pressure in a handful of piglit and dEQP tests that had a large > number of select operations with the NIR-vec4 backend. > > Fixes the following piglit tests with the NIR-vec4 backend: > spec/glsl-1.50/execution/variable-indexing/vs-output-array-vec4-index-wr-before-gs > spec/glsl-1.50/execution/variable-indexing/gs-input-array-vec4-index-rd > spec/glsl-1.50/execution/variable-indexing/vs-output-array-vec2-index-wr-before-gs > spec/glsl-1.50/execution/variable-indexing/vs-output-array-vec3-index-wr-before-gs > spec/glsl-1.50/execution/variable-indexing/vs-output-array-float-index-wr-before-gs > > Fixes the 80 dEQP tests with the NIR-vec4 backend in the following category: > dEQP-GLES3.functional.ubo.* > --- > src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp > b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp > index 29b4a53..cc688ef 100644 > --- a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp > +++ b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp > @@ -96,7 +96,8 @@ vec4_live_variables::setup_def_use() > * are the things that screen off preceding definitions of a > * variable, and thus qualify for being in def[]. > */ > - if (inst->dst.file == GRF && !inst->predicate) { > + if (inst->dst.file == GRF && > + (!inst->predicate || inst->opcode == BRW_OPCODE_SEL)) { > for (unsigned i = 0; i < inst->regs_written; i++) { > for (int c = 0; c < 4; c++) { >if (inst->dst.writemask & (1 << c)) { > Thanks! I made a similar fix in the FS backend a long time ago; apparently I forgot to check the vec4 backend. Good catch. NIR probably generates a lot more SELs, so it makes sense this would cause more trouble with that. Reviewed-by: Kenneth Graunke signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH rebased] nouveau: use bool instead of boolean
[resend without the patch to not anger the mailing list] On Mon, Jul 20, 2015 at 5:25 PM, Ilia Mirkin wrote: > In many places you end up changing comments where I think the full > "boolean" word makes more sense. e.g. > > - /* Deal with AND 1.0 here since nv50 can't fold into boolean float */ > + /* Deal with AND 1.0 here since nv50 can't fold into bool float */ > > - // boolean, i.e. 0/-1. However the rest of the logic assumes that true > + // bool, i.e. 0/-1. However the rest of the logic assumes that true > > probably some others. Please look over your patch and undo those. > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/7] configure.ac: null, android, gdi are not valid egl-platforms
2015-07-10 19:48 GMT+02:00 Emil Velikov : > ... and update the documentation to reflect reality. > null and gdi are gone, and surfaceless is a recent addition. > > Signed-off-by: Emil Velikov > --- > configure.ac | 3 --- > docs/egl.html | 6 +++--- > 2 files changed, 3 insertions(+), 6 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 9ffd69d..f3a24f2 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -1763,9 +1763,6 @@ for plat in $egl_platforms; do > AC_MSG_ERROR([EGL platform surfaceless requires > libdrm >= $LIBDRM_REQUIRED]) > ;; > > - android|gdi|null) > - ;; > - > *) > AC_MSG_ERROR([EGL platform '$plat' does not exist]) > ;; > diff --git a/docs/egl.html b/docs/egl.html > index 3ab1a60..30d8687 100644 > --- a/docs/egl.html > +++ b/docs/egl.html > @@ -88,10 +88,10 @@ types such as EGLNativeDisplayType or > EGLNativeWindowType defined for. > > The available platforms are x11, drm, > -wayland, null, android, > -haiku, and gdi. The android platform > +wayland, surfaceless, android, > +and haiku. The android platform > can only be built as a system component, part of AOSP, while the > -haiku and gdi platforms can only be built with > SCons. > +haiku platforms can only be built with SCons. ^ s/platforms/platform Apart from that this is: Reviewed-by: Thomas Helland > Unless for special needs, the build system should > select the right platforms automatically. > > -- > 2.4.5 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/7] egl: consolidate ifdef HAVE_LIBDRM blocks
This looks a lot better. The patch is: Reviewed-by: Thomas Helland 2015-07-10 19:49 GMT+02:00 Emil Velikov : > Move the code around rather than having it scattered. No functional > change. > > Signed-off-by: Emil Velikov > --- > src/egl/drivers/dri2/egl_dri2.c | 210 > +++- > 1 file changed, 102 insertions(+), 108 deletions(-) > > diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c > index 65194cb..a4f8db9 100644 > --- a/src/egl/drivers/dri2/egl_dri2.c > +++ b/src/egl/drivers/dri2/egl_dri2.c > @@ -1384,53 +1384,6 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, > _EGLContext *ctx, > return dri2_create_image_from_dri(disp, dri_image); > } > > -#ifdef HAVE_LIBDRM > -static _EGLImage * > -dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx, > - EGLClientBuffer buffer, const EGLint > *attr_list) > -{ > - struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); > - EGLint format, name, pitch, err; > - _EGLImageAttribs attrs; > - __DRIimage *dri_image; > - > - name = (EGLint) (uintptr_t) buffer; > - > - err = _eglParseImageAttribList(&attrs, disp, attr_list); > - if (err != EGL_SUCCESS) > - return NULL; > - > - if (attrs.Width <= 0 || attrs.Height <= 0 || > - attrs.DRMBufferStrideMESA <= 0) { > - _eglError(EGL_BAD_PARAMETER, > - "bad width, height or stride"); > - return NULL; > - } > - > - switch (attrs.DRMBufferFormatMESA) { > - case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA: > - format = __DRI_IMAGE_FORMAT_ARGB; > - pitch = attrs.DRMBufferStrideMESA; > - break; > - default: > - _eglError(EGL_BAD_PARAMETER, > - "dri2_create_image_khr: unsupported pixmap depth"); > - return NULL; > - } > - > - dri_image = > - dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen, > - attrs.Width, > - attrs.Height, > - format, > - name, > - pitch, > - NULL); > - > - return dri2_create_image_from_dri(disp, dri_image); > -} > -#endif > - > #ifdef HAVE_WAYLAND_PLATFORM > > /* This structure describes how a wl_buffer maps to one or more > @@ -1627,6 +1580,51 @@ dri2_create_wayland_buffer_from_image(_EGLDriver *drv, > _EGLDisplay *dpy, > } > > #ifdef HAVE_LIBDRM > +static _EGLImage * > +dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx, > + EGLClientBuffer buffer, const EGLint > *attr_list) > +{ > + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); > + EGLint format, name, pitch, err; > + _EGLImageAttribs attrs; > + __DRIimage *dri_image; > + > + name = (EGLint) (uintptr_t) buffer; > + > + err = _eglParseImageAttribList(&attrs, disp, attr_list); > + if (err != EGL_SUCCESS) > + return NULL; > + > + if (attrs.Width <= 0 || attrs.Height <= 0 || > + attrs.DRMBufferStrideMESA <= 0) { > + _eglError(EGL_BAD_PARAMETER, > + "bad width, height or stride"); > + return NULL; > + } > + > + switch (attrs.DRMBufferFormatMESA) { > + case EGL_DRM_BUFFER_FORMAT_ARGB32_MESA: > + format = __DRI_IMAGE_FORMAT_ARGB; > + pitch = attrs.DRMBufferStrideMESA; > + break; > + default: > + _eglError(EGL_BAD_PARAMETER, > + "dri2_create_image_khr: unsupported pixmap depth"); > + return NULL; > + } > + > + dri_image = > + dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen, > + attrs.Width, > + attrs.Height, > + format, > + name, > + pitch, > + NULL); > + > + return dri2_create_image_from_dri(disp, dri_image); > +} > + > static EGLBoolean > dri2_check_dma_buf_attribs(const _EGLImageAttribs *attrs) > { > @@ -1856,67 +1854,6 @@ dri2_create_image_dma_buf(_EGLDisplay *disp, > _EGLContext *ctx, > > return res; > } > -#endif > - > -_EGLImage * > -dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, > - _EGLContext *ctx, EGLenum target, > - EGLClientBuffer buffer, const EGLint *attr_list) > -{ > - (void) drv; > - > - switch (target) { > - case EGL_GL_TEXTURE_2D_KHR: > - case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR: > - case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR: > - case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR: > - case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR: > - case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR: > - case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR: > - return dri2_create_image_khr_tex
Re: [Mesa-dev] [PATCH 14/19] glsl: add uniform and program resource support
On Thu, Jul 9, 2015 at 9:17 AM, Dave Airlie wrote: > From: Dave Airlie > > This adds linker support for subroutine uniforms, they > have some subtle differences from real uniforms, we also hide > them and they are given internal uniform names. > > This also adds the subroutine locations and subroutine uniforms > to the program resource tracking for later use. > > Signed-off-by: Dave Airlie > --- > src/glsl/ir_uniform.h | 2 + > src/glsl/link_uniforms.cpp | 56 +-- > src/glsl/linker.cpp| 94 > +- > 3 files changed, 146 insertions(+), 6 deletions(-) > > diff --git a/src/glsl/ir_uniform.h b/src/glsl/ir_uniform.h > index e1b8014..be1b38d 100644 > --- a/src/glsl/ir_uniform.h > +++ b/src/glsl/ir_uniform.h > @@ -114,6 +114,8 @@ struct gl_uniform_storage { > > struct gl_opaque_uniform_index image[MESA_SHADER_STAGES]; > > + struct gl_opaque_uniform_index subroutine[MESA_SHADER_STAGES]; > + > /** > * Storage used by the driver for the uniform > */ > diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp > index 11ae06f..78a830a 100644 > --- a/src/glsl/link_uniforms.cpp > +++ b/src/glsl/link_uniforms.cpp > @@ -47,9 +47,10 @@ > static unsigned > values_for_type(const glsl_type *type) > { > - if (type->is_sampler()) { > + if (type->is_sampler() || type->is_subroutine()) { >return 1; > - } else if (type->is_array() && type->fields.array->is_sampler()) { > + } else if (type->is_array() && (type->fields.array->is_sampler() || > + type->fields.array->is_subroutine())) { >return type->array_size(); > } else { >return type->component_slots(); > @@ -284,6 +285,7 @@ public: > count_uniform_size(struct string_to_uint_map *map) >: num_active_uniforms(0), num_values(0), num_shader_samplers(0), > num_shader_images(0), num_shader_uniform_components(0), > +num_shader_subroutines(0), > is_ubo_var(false), map(map) > { >/* empty */ > @@ -294,6 +296,7 @@ public: >this->num_shader_samplers = 0; >this->num_shader_images = 0; >this->num_shader_uniform_components = 0; > + this->num_shader_subroutines = 0; > } > > void process(ir_variable *var) > @@ -331,6 +334,11 @@ public: > */ > unsigned num_shader_uniform_components; > > + /** > +* Number of subroutine uniforms used > +*/ > + unsigned num_shader_subroutines; > + > bool is_ubo_var; > > private: > @@ -348,7 +356,9 @@ private: > * count it for each shader target. > */ >const unsigned values = values_for_type(type); > - if (type->contains_sampler()) { > + if (type->contains_subroutine()) { > + this->num_shader_subroutines += values; > + } else if (type->contains_sampler()) { > this->num_shader_samplers += values; >} else if (type->contains_image()) { > this->num_shader_images += values; > @@ -421,6 +431,7 @@ public: >this->shader_shadow_samplers = 0; >this->next_sampler = 0; >this->next_image = 0; > + this->next_subroutine = 0; >memset(this->targets, 0, sizeof(this->targets)); > } > > @@ -535,6 +546,24 @@ private: >} > } > > + void handle_subroutines(const glsl_type *base_type, > + struct gl_uniform_storage *uniform) > + { > + if (base_type->is_subroutine()) { > + uniform->subroutine[shader_type].index = this->next_subroutine; > + uniform->subroutine[shader_type].active = true; > + > + /* Increment the subroutine index by 1 for non-arrays and by the > + * number of array elements for arrays. > + */ > + this->next_subroutine += MAX2(1, uniform->array_elements); > + > + } else { > + uniform->subroutine[shader_type].index = ~0; > + uniform->subroutine[shader_type].active = false; > + } > + } > + > virtual void visit_field(const glsl_type *type, const char *name, > bool row_major) > { > @@ -588,6 +617,7 @@ private: >/* This assigns uniform indices to sampler and image uniforms. */ >handle_samplers(base_type, &this->uniforms[id]); >handle_images(base_type, &this->uniforms[id]); > + handle_subroutines(base_type, &this->uniforms[id]); > >/* If there is already storage associated with this uniform or if the > * uniform is set as builtin, it means that it was set while processing > @@ -672,6 +702,7 @@ private: > struct gl_uniform_storage *uniforms; > unsigned next_sampler; > unsigned next_image; > + unsigned next_subroutine; > > public: > union gl_constant_value *values; > @@ -952,8 +983,11 @@ link_assign_uniform_locations(struct gl_shader_program > *prog, >sh->num_samplers = uniform_size.num_shader_samplers; >sh->NumImages = uniform_size.num_shad
Re: [Mesa-dev] [PATCH 15/19] program_resource: add subroutine support
On Thu, Jul 9, 2015 at 9:17 AM, Dave Airlie wrote: > From: Dave Airlie > > This fleshes out the ARB_program_query support for the > APIs that ARB_shader_subroutine introduces, leaving > some TODOs for later addition. > > Signed-off-by: Dave Airlie > --- > src/mesa/main/shader_query.cpp | 46 > ++ > 1 file changed, 46 insertions(+) > > diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp > index a6246a3..4fa5913 100644 > --- a/src/mesa/main/shader_query.cpp > +++ b/src/mesa/main/shader_query.cpp > @@ -61,6 +61,7 @@ DECL_RESOURCE_FUNC(UBO, gl_uniform_block); > DECL_RESOURCE_FUNC(UNI, gl_uniform_storage); > DECL_RESOURCE_FUNC(ATC, gl_active_atomic_buffer); > DECL_RESOURCE_FUNC(XFB, gl_transform_feedback_varying_info); > +DECL_RESOURCE_FUNC(SUB, gl_subroutine_function); > > void GLAPIENTRY > _mesa_BindAttribLocation(GLhandleARB program, GLuint index, > @@ -497,6 +498,24 @@ _mesa_program_resource_name(struct gl_program_resource > *res) >return RESOURCE_VAR(res)->name; > case GL_UNIFORM: >return RESOURCE_UNI(res)->name; > + case GL_VERTEX_SUBROUTINE_UNIFORM: > + case GL_GEOMETRY_SUBROUTINE_UNIFORM: > + case GL_FRAGMENT_SUBROUTINE_UNIFORM: > + /* TODO > + case GL_COMPUTE_SUBROUTINE_UNIFORM: > + case GL_TESS_CONTROL_SUBROUTINE_UNIFORM: > + case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM: > + */ > + return RESOURCE_UNI(res)->name + 9; > + case GL_VERTEX_SUBROUTINE: > + case GL_GEOMETRY_SUBROUTINE: > + case GL_FRAGMENT_SUBROUTINE: > + /* TODO > + case GL_COMPUTE_SUBROUTINE: > + case GL_TESS_CONTROL_SUBROUTINE: > + case GL_TESS_EVALUATION_SUBROUTINE: > + */ > + return RESOURCE_SUB(res)->name; Is there any reason not to add all tess and compute cases? Same for all the other cases below. > default: >assert(!"support for resource type not implemented"); > } > @@ -515,6 +534,9 @@ _mesa_program_resource_array_size(struct > gl_program_resource *res) > case GL_PROGRAM_OUTPUT: >return RESOURCE_VAR(res)->data.max_array_access; > case GL_UNIFORM: > + case GL_VERTEX_SUBROUTINE_UNIFORM: > + case GL_GEOMETRY_SUBROUTINE_UNIFORM: > + case GL_FRAGMENT_SUBROUTINE_UNIFORM: >return RESOURCE_UNI(res)->array_elements; > case GL_ATOMIC_COUNTER_BUFFER: > case GL_UNIFORM_BLOCK: > @@ -571,6 +593,12 @@ _mesa_program_resource_find_name(struct > gl_shader_program *shProg, >case GL_TRANSFORM_FEEDBACK_VARYING: >case GL_UNIFORM_BLOCK: >case GL_UNIFORM: > + case GL_VERTEX_SUBROUTINE_UNIFORM: > + case GL_GEOMETRY_SUBROUTINE_UNIFORM: > + case GL_FRAGMENT_SUBROUTINE_UNIFORM: > + case GL_VERTEX_SUBROUTINE: > + case GL_GEOMETRY_SUBROUTINE: > + case GL_FRAGMENT_SUBROUTINE: > if (strncmp(rname, name, baselen) == 0) { > /* Basename match, check if array or struct. */ > if (name[baselen] == '\0' || > @@ -651,6 +679,12 @@ _mesa_program_resource_find_index(struct > gl_shader_program *shProg, >case GL_PROGRAM_INPUT: >case GL_PROGRAM_OUTPUT: >case GL_UNIFORM: > + case GL_VERTEX_SUBROUTINE_UNIFORM: > + case GL_GEOMETRY_SUBROUTINE_UNIFORM: > + case GL_FRAGMENT_SUBROUTINE_UNIFORM: > + case GL_VERTEX_SUBROUTINE: > + case GL_GEOMETRY_SUBROUTINE: > + case GL_FRAGMENT_SUBROUTINE: > if (++idx == (int) index) > return res; > break; > @@ -740,6 +774,8 @@ program_resource_location(struct gl_shader_program > *shProg, > { > unsigned index, offset; > int array_index = -1; > + long offset_ret; > + const GLchar *base_name_end; > > if (res->Type == GL_PROGRAM_INPUT || res->Type == GL_PROGRAM_OUTPUT) { >array_index = array_index_of_resource(res, name); > @@ -780,6 +816,16 @@ program_resource_location(struct gl_shader_program > *shProg, >/* location in remap table + array element offset */ >return RESOURCE_UNI(res)->remap_location + offset; > > + case GL_VERTEX_SUBROUTINE_UNIFORM: > + case GL_GEOMETRY_SUBROUTINE_UNIFORM: > + case GL_FRAGMENT_SUBROUTINE_UNIFORM: > + /* TODO > + case GL_COMPUTE_SUBROUTINE_UNIFORM: > + case GL_TESS_CONTROL_SUBROUTINE_UNIFORM: > + case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM: > + */ > + offset_ret = parse_program_resource_name(name, &base_name_end); > + return > RESOURCE_UNI(res)->subroutine[_mesa_shader_stage_from_subroutine_uniform(res->Type)].index > + ((offset_ret != -1) ? offset_ret : 0); Oh man, this line is too long. Can it be reformatted to be shorter, ideally no more than 80 characters? Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/7] egl/wayland: use designated initializers
This patch is: Reviewed-by: Thomas Helland 2015-07-10 19:49 GMT+02:00 Emil Velikov : > Signed-off-by: Emil Velikov > --- > src/egl/drivers/dri2/platform_wayland.c | 26 +- > 1 file changed, 13 insertions(+), 13 deletions(-) > > diff --git a/src/egl/drivers/dri2/platform_wayland.c > b/src/egl/drivers/dri2/platform_wayland.c > index 1e12760..0b1adf8 100644 > --- a/src/egl/drivers/dri2/platform_wayland.c > +++ b/src/egl/drivers/dri2/platform_wayland.c > @@ -65,7 +65,7 @@ sync_callback(void *data, struct wl_callback *callback, > uint32_t serial) > } > > static const struct wl_callback_listener sync_listener = { > - sync_callback > + .done = sync_callback > }; > > static int > @@ -104,8 +104,8 @@ wl_buffer_release(void *data, struct wl_buffer *buffer) > dri2_surf->color_buffers[i].locked = 0; > } > > -static struct wl_buffer_listener wl_buffer_listener = { > - wl_buffer_release > +static const struct wl_buffer_listener wl_buffer_listener = { > + .release = wl_buffer_release > }; > > static void > @@ -598,7 +598,7 @@ wayland_throttle_callback(void *data, > } > > static const struct wl_callback_listener throttle_listener = { > - wayland_throttle_callback > + .done = wayland_throttle_callback > }; > > static void > @@ -944,10 +944,10 @@ drm_handle_authenticated(void *data, struct wl_drm *drm) > } > > static const struct wl_drm_listener drm_listener = { > - drm_handle_device, > - drm_handle_format, > - drm_handle_authenticated, > - drm_handle_capabilities > + .device = drm_handle_device, > + .format = drm_handle_format, > + .authenticated = drm_handle_authenticated, > + .capabilities = drm_handle_capabilities > }; > > static void > @@ -972,8 +972,8 @@ registry_handle_global_remove(void *data, struct > wl_registry *registry, > } > > static const struct wl_registry_listener registry_listener_drm = { > - registry_handle_global_drm, > - registry_handle_global_remove > + .global = registry_handle_global_drm, > + .global_remove = registry_handle_global_remove > }; > > static EGLBoolean > @@ -1729,7 +1729,7 @@ shm_handle_format(void *data, struct wl_shm *shm, > uint32_t format) > } > > static const struct wl_shm_listener shm_listener = { > - shm_handle_format > + .format = shm_handle_format > }; > > static void > @@ -1746,8 +1746,8 @@ registry_handle_global_swrast(void *data, struct > wl_registry *registry, uint32_t > } > > static const struct wl_registry_listener registry_listener_swrast = { > - registry_handle_global_swrast, > - registry_handle_global_remove > + .global = registry_handle_global_swrast, > + .global_remove = registry_handle_global_remove > }; > > static struct dri2_egl_display_vtbl dri2_wl_swrast_display_vtbl = { > -- > 2.4.5 > > ___ > 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 19/19] st/mesa: enable shader subroutine
If the extension is core only, we can rip out the checks, but the checks that test ctx->API == API_OPEGL_CORE should stay (if they are missing, they should be added). Marek On Thu, Jul 9, 2015 at 3:27 PM, Roland Scheidegger wrote: > Should expose that only if hw has glsl 130 support? > > Roland > > Am 09.07.2015 um 09:17 schrieb Dave Airlie: >> From: Dave Airlie >> >> I'm not sure if we shouldn't enable this everywhere >> and rip out the API checks, >> >> discuss, >> >> Signed-off-by: Dave Airlie >> --- >> src/mesa/state_tracker/st_extensions.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/src/mesa/state_tracker/st_extensions.c >> b/src/mesa/state_tracker/st_extensions.c >> index b1057f3..3b828fa 100644 >> --- a/src/mesa/state_tracker/st_extensions.c >> +++ b/src/mesa/state_tracker/st_extensions.c >> @@ -598,6 +598,7 @@ void st_init_extensions(struct pipe_screen *screen, >> extensions->ARB_half_float_vertex = GL_TRUE; >> extensions->ARB_internalformat_query = GL_TRUE; >> extensions->ARB_map_buffer_range = GL_TRUE; >> + extensions->ARB_shader_subroutine = GL_TRUE; >> extensions->ARB_texture_border_clamp = GL_TRUE; /* XXX temp */ >> extensions->ARB_texture_cube_map = GL_TRUE; >> extensions->ARB_texture_env_combine = GL_TRUE; >> > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/7] configure.ac: null, android, gdi are not valid egl-platforms
Hi Emil, I looked at the whole series, but didn't really feel qualified to review the whole bunch. I've sent reviews on the patches I felt I had a good take on. If you don't get anyone else to review the remainder then shout out and I'll give it a shot. - Thomas 2015-07-17 22:57 GMT+02:00 Emil Velikov : > Would anyone be interested is skimming over this trivial series ? > > Thanks > Emil > > On 10/07/15 18:49, Emil Velikov wrote: >> ... and update the documentation to reflect reality. >> null and gdi are gone, and surfaceless is a recent addition. >> >> Signed-off-by: Emil Velikov >> --- >> configure.ac | 3 --- >> docs/egl.html | 6 +++--- >> 2 files changed, 3 insertions(+), 6 deletions(-) >> >> diff --git a/configure.ac b/configure.ac >> index 9ffd69d..f3a24f2 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -1763,9 +1763,6 @@ for plat in $egl_platforms; do >> AC_MSG_ERROR([EGL platform surfaceless requires libdrm >> >= $LIBDRM_REQUIRED]) >> ;; >> >> - android|gdi|null) >> - ;; >> - >> *) >> AC_MSG_ERROR([EGL platform '$plat' does not exist]) >> ;; >> diff --git a/docs/egl.html b/docs/egl.html >> index 3ab1a60..30d8687 100644 >> --- a/docs/egl.html >> +++ b/docs/egl.html >> @@ -88,10 +88,10 @@ types such as EGLNativeDisplayType or >> EGLNativeWindowType defined for. >> >> The available platforms are x11, drm, >> -wayland, null, android, >> -haiku, and gdi. The android platform >> +wayland, surfaceless, android, >> +and haiku. The android platform >> can only be built as a system component, part of AOSP, while the >> -haiku and gdi platforms can only be built with >> SCons. >> +haiku platforms can only be built with SCons. >> Unless for special needs, the build system should >> select the right platforms automatically. >> >> > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/5] [RFC] Value range propagation for NIR
On Tue, Jul 14, 2015 at 3:08 PM, Thomas Helland wrote: > The deadline for GSoC is aproaching a bit faster than I'm > comfortable with, so I need to get this out on the list > for some review-action. It's not yet complete, but I think > it's getting there. At least it should be possible to infer > what I'm trying to do I think. > I haven't yet gotten to testing this a whole lot, as I > wanted to get some feedback before getting to lost with > all the debugging. It compiles though, so that's nice. > (apart from some . / -> blunders I got in there just before > sending out the pathces). > > Things I know are a bit iffy, and that I need to look into, > is the long citation from LLVM's SCCP at close-to-bottom of the pass. > TLDR of that section is: > Since we don't analyze blocks that are results of branching on > instructions that are undefined the assumptions that the > pass has made when we get to the end may be wrong. > I have a sketch in my mind on how to do that though, > so I don't think it should be that bad. > > I'm hoping to get a similar series on the list tomorrow > for the loop analysis pass. I just need to figure out > how to hook the pass up to the metadata system. > When these two series are out I'll let them soak > on the list for some comments while I go head-to-head with > the loop unrolling. FWIW, I'm working on something which will probably help you with loop unrolling. A while back, Jason and I realized that our infrastructure for moving pieces of control flow around was pretty inadequate. I'm working on refactoring things so that we have an API that can take a subset of a control flow list (think of it as like a series of statements in GLSL), extract it, and then re-insert it somewhere else. Patches should be coming soon. What you'll need on top is the ability to copy that bit of control flow, so that you can extract the body of the original loop before and after the limiting terminator, copy it repeatedly, insert the copies, and then delete the original. > Happy reviewing =) > > Thomas Helland (5): > nir/worklist: Split out the type-independent parts > nir: Add a worklist for SSA definitions > nir: Move nir_instr_get_dest_ssa_def to nir.c / nir.h > nir: Add a helper for iterating over blocks in a cf node > nir: Add a value range propagation pass > > src/glsl/Makefile.sources |3 + > src/glsl/nir/nir.c | 28 + > src/glsl/nir/nir.h |8 + > src/glsl/nir/nir_block_worklist.h | 112 +++ > src/glsl/nir/nir_live_variables.c |2 +- > src/glsl/nir/nir_opt_cse.c | 20 - > src/glsl/nir/nir_opt_value_range.c | 1330 > +++ > src/glsl/nir/nir_ssa_def_worklist.h | 100 +++ > src/glsl/nir/nir_worklist.c | 78 +- > src/glsl/nir/nir_worklist.h | 44 +- > 10 files changed, 1637 insertions(+), 88 deletions(-) > create mode 100644 src/glsl/nir/nir_block_worklist.h > create mode 100644 src/glsl/nir/nir_opt_value_range.c > create mode 100644 src/glsl/nir/nir_ssa_def_worklist.h > > -- > 2.4.5 > > ___ > 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] ARB_copy_image support in Gallium
Am 20.07.2015 um 22:46 schrieb Ilia Mirkin: > On Mon, Jul 20, 2015 at 3:53 PM, Brian Paul wrote: >> On 07/20/2015 01:19 PM, Ilia Mirkin wrote: >> >>> On Mon, Jul 20, 2015 at 2:44 PM, Ilia Mirkin wrote: Hi Brian, You marked off ARB_copy_image (and ARB_clear_texture) as in-progress by VMware some months ago -- has there been any movement on that? It appears that Bioshock Infinite requires ARB_copy_image so might be nice to get that added in. The complication in implementing ARB_copy_image was that st/mesa will pick potentially different PIPE_FORMAT enums for the same internal format, depending on the parameters to the glTexImage call. A developer (irc handle Leftmost, I forget his real name, sorry) tried to wrestle with the issues this presents, but as I recall ended up coming up short. The final implementation probably needs some combination of resource_copy_region and blit. I think resource_copy_region currently is spec'd to require identical formats in src and dst, but that could be relaxed. Anyways, would be interested in hearing whether you guys have made any progress, or if you had thoughts on proper implementation. Cheers, -ilia >>> >>> >>> As an aside, here's a very naive implementation of the ext, which >>> fails for lots of reasons not the least of which is that we default to >>> BGRA instead of RGBA. Perhaps we could create a resource_copy_region >>> version that also takes (or knows about) swizzles... that should also >>> cover many (all?) of the situations I think. >> >> >> One of our interns did the implementation (with some contributions from me). >> I need to do a lot of clean-up before posting the patches here though. I >> was hoping to do that in the next month or two. If you need it sooner, I'll >> can see what I can do. > > As there's a decent chance that tessellation and subroutine support > will land in the next release (thus exposing GL 4.1 in several > drivers), and there is an actual released game that requires > ARB_copy_image, it would definitely be nice to see support land before > the next mesa release is branched off, which should happen in about a > month's time I guess. > Are you sure it actually requires ARB_copy_image (not just optionally uses it)? Seems like it shouldn't be, since officially it only needs GL 4.1, and this extension only became core with 4.3. (There's also a mac version which doesn't support that feature neither). Roland ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] ARB_copy_image support in Gallium
On Mon, Jul 20, 2015 at 7:53 PM, Roland Scheidegger wrote: > Am 20.07.2015 um 22:46 schrieb Ilia Mirkin: >> On Mon, Jul 20, 2015 at 3:53 PM, Brian Paul wrote: >>> On 07/20/2015 01:19 PM, Ilia Mirkin wrote: >>> On Mon, Jul 20, 2015 at 2:44 PM, Ilia Mirkin wrote: > > Hi Brian, > > You marked off ARB_copy_image (and ARB_clear_texture) as in-progress > by VMware some months ago -- has there been any movement on that? It > appears that Bioshock Infinite requires ARB_copy_image so might be > nice to get that added in. > > The complication in implementing ARB_copy_image was that st/mesa will > pick potentially different PIPE_FORMAT enums for the same internal > format, depending on the parameters to the glTexImage call. A > developer (irc handle Leftmost, I forget his real name, sorry) tried > to wrestle with the issues this presents, but as I recall ended up > coming up short. > > The final implementation probably needs some combination of > resource_copy_region and blit. I think resource_copy_region currently > is spec'd to require identical formats in src and dst, but that could > be relaxed. > > Anyways, would be interested in hearing whether you guys have made any > progress, or if you had thoughts on proper implementation. > > Cheers, > >-ilia As an aside, here's a very naive implementation of the ext, which fails for lots of reasons not the least of which is that we default to BGRA instead of RGBA. Perhaps we could create a resource_copy_region version that also takes (or knows about) swizzles... that should also cover many (all?) of the situations I think. >>> >>> >>> One of our interns did the implementation (with some contributions from me). >>> I need to do a lot of clean-up before posting the patches here though. I >>> was hoping to do that in the next month or two. If you need it sooner, I'll >>> can see what I can do. >> >> As there's a decent chance that tessellation and subroutine support >> will land in the next release (thus exposing GL 4.1 in several >> drivers), and there is an actual released game that requires >> ARB_copy_image, it would definitely be nice to see support land before >> the next mesa release is branched off, which should happen in about a >> month's time I guess. >> > Are you sure it actually requires ARB_copy_image (not just optionally > uses it)? Seems like it shouldn't be, since officially it only needs GL > 4.1, and this extension only became core with 4.3. > (There's also a mac version which doesn't support that feature neither). I don't personally have the game myself. However the report is that on top of nouveau that (accurately) exposes GL 4.1 (i.e. has tess and subroutines merged in), it starts calling glCopyImageSubData without ARB_copy_image having been exposed. Mesa naturally returns INVALID_OPERATION, and nothing is drawn other than the cursor and subtitles. My naive implementation (earlier in the thread) makes the game operate properly. Cheers, -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gallium: replace INLINE with inline
Generated by running: git grep -l INLINE src/gallium/ | xargs sed -i 's/\bINLINE\b/inline/g' git grep -l INLINE src/mesa/state_tracker/ | xargs sed -i 's/\bINLINE\b/inline/g' git checkout src/gallium/state_trackers/clover/Doxyfile and manual edits to src/gallium/include/pipe/p_compiler.h src/gallium/README.portability to remove mentions of the inline define. Signed-off-by: Ilia Mirkin --- Most of the diff trimmed out, just left the files that I edited manually. Full patch available at https://github.com/imirkin/mesa/commit/8f6ff119779c9bac6a63b32494e9508ae9f34753.patch src/gallium/README.portability | 2 - src/gallium/auxiliary/cso_cache/cso_cache.c| 8 +- src/gallium/auxiliary/cso_cache/cso_context.c | 8 +- src/gallium/auxiliary/draw/draw_gs.c | 4 +- src/gallium/auxiliary/draw/draw_llvm.c | 2 +- src/gallium/auxiliary/draw/draw_llvm.h | 10 +- src/gallium/auxiliary/draw/draw_pipe.h | 2 +- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 2 +- src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 2 +- src/gallium/auxiliary/draw/draw_pipe_clip.c| 10 +- src/gallium/auxiliary/draw/draw_pipe_cull.c| 4 +- src/gallium/auxiliary/draw/draw_pipe_flatshade.c | 6 +- src/gallium/auxiliary/draw/draw_pipe_offset.c | 2 +- src/gallium/auxiliary/draw/draw_pipe_pstipple.c| 2 +- src/gallium/auxiliary/draw/draw_pipe_stipple.c | 4 +- src/gallium/auxiliary/draw/draw_pipe_twoside.c | 4 +- src/gallium/auxiliary/draw/draw_pipe_unfilled.c| 2 +- src/gallium/auxiliary/draw/draw_pipe_vbuf.c| 8 +- src/gallium/auxiliary/draw/draw_pipe_wide_line.c | 2 +- src/gallium/auxiliary/draw/draw_pipe_wide_point.c | 2 +- src/gallium/auxiliary/draw/draw_private.h | 4 +- .../auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 2 +- .../draw/draw_pt_fetch_shade_pipeline_llvm.c | 2 +- src/gallium/auxiliary/draw/draw_pt_post_vs.c | 4 +- src/gallium/auxiliary/draw/draw_pt_so_emit.c | 2 +- src/gallium/auxiliary/draw/draw_pt_vsplit.c| 12 +-- src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h| 2 +- src/gallium/auxiliary/draw/draw_vertex.h | 12 +-- src/gallium/auxiliary/draw/draw_vs.h | 4 +- src/gallium/auxiliary/gallivm/lp_bld_arit.c| 14 +-- src/gallium/auxiliary/gallivm/lp_bld_const.h | 6 +- src/gallium/auxiliary/gallivm/lp_bld_debug.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_format_aos.c | 4 +- src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_limits.h | 2 +- src/gallium/auxiliary/gallivm/lp_bld_sample.h | 8 +- src/gallium/auxiliary/gallivm/lp_bld_tgsi.h| 4 +- src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c| 8 +- src/gallium/auxiliary/gallivm/lp_bld_type.h| 30 +++--- src/gallium/auxiliary/os/os_memory_aligned.h | 4 +- src/gallium/auxiliary/os/os_memory_stdc.h | 2 +- src/gallium/auxiliary/os/os_mman.h | 4 +- src/gallium/auxiliary/os/os_thread.h | 34 +++--- src/gallium/auxiliary/os/os_time.h | 4 +- src/gallium/auxiliary/pipebuffer/pb_buffer.h | 18 ++-- .../auxiliary/pipebuffer/pb_buffer_fenced.c| 14 +-- .../auxiliary/pipebuffer/pb_buffer_malloc.c| 2 +- src/gallium/auxiliary/pipebuffer/pb_bufmgr_alt.c | 2 +- src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c | 8 +- src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c | 8 +- src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c| 4 +- .../auxiliary/pipebuffer/pb_bufmgr_ondemand.c | 4 +- src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c | 4 +- src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c | 6 +- src/gallium/auxiliary/rtasm/rtasm_x86sse.c | 4 +- src/gallium/auxiliary/rtasm/rtasm_x86sse.h | 4 +- .../auxiliary/target-helpers/inline_debug_helper.h | 2 +- .../auxiliary/target-helpers/inline_sw_helper.h| 8 +- .../target-helpers/inline_wrapper_sw_helper.h | 2 +- src/gallium/auxiliary/tgsi/tgsi_exec.c | 2 +- src/gallium/auxiliary/tgsi/tgsi_exec.h | 6 +- src/gallium/auxiliary/tgsi/tgsi_info.c | 2 +- src/gallium/auxiliary/tgsi/tgsi_parse.c| 2 +- src/gallium/auxiliary/tgsi/tgsi_parse.h| 2 +- src/gallium/auxiliary/tgsi/tgsi_sanity.c | 2 +- src/gallium/auxiliary/tgsi/tgsi_strings.c | 2 +- src/gallium/auxiliary/tgsi/tgsi_transform.h| 24 ++--- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 2 +- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 116 ++--- src/gallium/auxiliary/translate/translate.h| 6 +- src/gallium/auxiliary/translate/translate_cache
Re: [Mesa-dev] ARB_copy_image support in Gallium
Am 21.07.2015 um 02:10 schrieb Ilia Mirkin: > On Mon, Jul 20, 2015 at 7:53 PM, Roland Scheidegger > wrote: >> Am 20.07.2015 um 22:46 schrieb Ilia Mirkin: >>> On Mon, Jul 20, 2015 at 3:53 PM, Brian Paul wrote: On 07/20/2015 01:19 PM, Ilia Mirkin wrote: > On Mon, Jul 20, 2015 at 2:44 PM, Ilia Mirkin wrote: >> >> Hi Brian, >> >> You marked off ARB_copy_image (and ARB_clear_texture) as in-progress >> by VMware some months ago -- has there been any movement on that? It >> appears that Bioshock Infinite requires ARB_copy_image so might be >> nice to get that added in. >> >> The complication in implementing ARB_copy_image was that st/mesa will >> pick potentially different PIPE_FORMAT enums for the same internal >> format, depending on the parameters to the glTexImage call. A >> developer (irc handle Leftmost, I forget his real name, sorry) tried >> to wrestle with the issues this presents, but as I recall ended up >> coming up short. >> >> The final implementation probably needs some combination of >> resource_copy_region and blit. I think resource_copy_region currently >> is spec'd to require identical formats in src and dst, but that could >> be relaxed. >> >> Anyways, would be interested in hearing whether you guys have made any >> progress, or if you had thoughts on proper implementation. >> >> Cheers, >> >>-ilia > > > As an aside, here's a very naive implementation of the ext, which > fails for lots of reasons not the least of which is that we default to > BGRA instead of RGBA. Perhaps we could create a resource_copy_region > version that also takes (or knows about) swizzles... that should also > cover many (all?) of the situations I think. One of our interns did the implementation (with some contributions from me). I need to do a lot of clean-up before posting the patches here though. I was hoping to do that in the next month or two. If you need it sooner, I'll can see what I can do. >>> >>> As there's a decent chance that tessellation and subroutine support >>> will land in the next release (thus exposing GL 4.1 in several >>> drivers), and there is an actual released game that requires >>> ARB_copy_image, it would definitely be nice to see support land before >>> the next mesa release is branched off, which should happen in about a >>> month's time I guess. >>> >> Are you sure it actually requires ARB_copy_image (not just optionally >> uses it)? Seems like it shouldn't be, since officially it only needs GL >> 4.1, and this extension only became core with 4.3. >> (There's also a mac version which doesn't support that feature neither). > > I don't personally have the game myself. However the report is that on > top of nouveau that (accurately) exposes GL 4.1 (i.e. has tess and > subroutines merged in), it starts calling glCopyImageSubData without > ARB_copy_image having been exposed. Mesa naturally returns > INVALID_OPERATION, and nothing is drawn other than the cursor and > subtitles. My naive implementation (earlier in the thread) makes the > game operate properly. > Ah ok then. Maybe the game developers figured this feature is exposed on just about any (newer) drivers which support 4.1 anyway as everybody certainly can support it. Or they don't query for the availability correctly (i.e. the old-age beginner error of querying for a gl function pointer and assuming it works when the pointer is non-null though at this point I thought everybody would get that one right...). Roland ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 91254] (regresion) video using VA-API on Intel slow and freeze system with mesa 10.6 or 10.6.1
https://bugs.freedesktop.org/show_bug.cgi?id=91254 --- Comment #7 from Jordan Justen --- (In reply to Tomasz C. from comment #0) > * config and/or log files etc. > GLX Renderer: Mesa DRI Intel Ironlake Mobile GLX Version: 2.1 Mesa 10.6.0 > > The problem is on Intel Core i5 M 450 - first generation (Nehalem) of Intel > Core, also tested on the i3-3220T - third generation (Ivy Bridge) and > i3-4005U fourth generation (Haswell) and it works properly. > I did not test for second-generation (Sandy Bridge). To confirm, the issue only happens on Ironlake for you? I was unable to reproduce on GM45 or Ivy Bridge using 10.6.0 or master. I tried the 3, 5, 10 and 70 Mbps versions, with this command line: mpv --vo=opengl --hwdec=vaapi Jellyfish-3-Mbps.mkv -- 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] scons: Add additional GCC function attribute macros.
Match the attributes currently checked in configure.ac. Signed-off-by: Vinson Lee --- scons/gallium.py | 5 + 1 file changed, 5 insertions(+) diff --git a/scons/gallium.py b/scons/gallium.py index 51b84d7..af30c09 100755 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -380,11 +380,16 @@ def generate(env): 'HAVE___BUILTIN_EXPECT', 'HAVE___BUILTIN_FFS', 'HAVE___BUILTIN_FFSLL', +'HAVE_FUNC_ATTRIBUTE_CONST', 'HAVE_FUNC_ATTRIBUTE_FLATTEN', +'HAVE_FUNC_ATTRIBUTE_PURE', 'HAVE_FUNC_ATTRIBUTE_UNUSED', # GCC 3.0 'HAVE_FUNC_ATTRIBUTE_FORMAT', +'HAVE_FUNC_ATTRIBUTE_MALLOC', 'HAVE_FUNC_ATTRIBUTE_PACKED', +# GCC 3.3 +'HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT', # GCC 3.4 'HAVE___BUILTIN_CTZ', 'HAVE___BUILTIN_POPCOUNT', -- 2.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] mesa: Detect and provide macros for function attributes pure and const.
On Tue, Jul 14, 2015 at 11:45 AM, Eric Anholt wrote: > These are really useful hints to the compiler in the absence of link-time > optimization, and I'm going to use them in VC4. > > I've made the const attribute be ATTRIBUTE_CONST unlike other function > attributes, because we have other things in the tree #defining CONST for > their own unrelated purposes. > --- > configure.ac | 2 ++ > src/util/macros.h | 20 > 2 files changed, 22 insertions(+) > > diff --git a/configure.ac b/configure.ac > index bdfd134..38ad398 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -210,6 +210,8 @@ AX_GCC_FUNC_ATTRIBUTE([format]) > AX_GCC_FUNC_ATTRIBUTE([malloc]) > AX_GCC_FUNC_ATTRIBUTE([packed]) > AX_GCC_FUNC_ATTRIBUTE([unused]) > +AX_GCC_FUNC_ATTRIBUTE([const]) > +AX_GCC_FUNC_ATTRIBUTE([pure]) > AX_GCC_FUNC_ATTRIBUTE([warn_unused_result]) > > AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes) > diff --git a/src/util/macros.h b/src/util/macros.h > index 66698e7..4d16183 100644 > --- a/src/util/macros.h > +++ b/src/util/macros.h > @@ -130,6 +130,26 @@ do { \ > #define PACKED > #endif > > +/* Attribute pure is used for functions that have no effects other than their > + * return value. As a result, calls to it can be dead code eliminated. > + */ > +#ifdef HAVE_FUNC_ATTRIBUTE_PURE > +#define PURE __attribute__((__pure__)) > +#else > +#define PURE > +#endif > + > +/* Attribute const is used for functions that have no effects other than > their > + * return value, and only rely on the argument values to compute the return > + * value. As a result, calls to it can be CSEed. Note that using memory > + * pointed to by the arguments is not allowed for const functions. > + */ > +#ifdef HAVE_FUNC_ATTRIBUTE_CONST > +#define ATTRIBUTE_CONST __attribute__((__const__)) > +#else > +#define ATTRIBUTE_CONST > +#endif > + > #ifdef __cplusplus > /** > * Macro function that evaluates to true if T is a trivially > -- > 2.1.4 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev This patch introduced new compiler warnings. indirect_size.h:42:0: warning: "PURE" redefined #define PURE __attribute__((pure)) ^ In file included from glxclient.h:55:0, from indirect.h:52, from indirect.c:30: ../../src/util/macros.h:148:0: note: this is the location of the previous definition #define PURE __attribute__((__pure__)) ^ ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 19/19] st/mesa: enable shader subroutine
On 21 July 2015 at 08:50, Marek Olšák wrote: > If the extension is core only, we can rip out the checks, but the > checks that test ctx->API == API_OPEGL_CORE should stay (if they are > missing, they should be added). > I've reconsidered this, and I'm sticking with my original plan, NIR and the i965 driver will need some changes to support this, so I should really provide a way to turn it off. this is due to the subroutine type and the subroutine to int conversion function. Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/mesa: Silence GCC unused-variable warning.
Silence a release build warning. st_glsl_to_tgsi.cpp: In function 'pipe_error st_translate_program(gl_context*, uint, ureg_program*, glsl_to_tgsi_visitor*, const gl_program*, GLuint, const GLuint*, const GLuint*, const ubyte*, const ubyte*, const GLuint*, const GLuint*, GLuint, const GLuint*, const GLuint*, const ubyte*, const ubyte*, boolean, boolean)': st_glsl_to_tgsi.cpp:5461:36: warning: unused variable 'pscreen' [-Wunused-variable] struct pipe_screen *pscreen = st->pipe->screen; ^ Signed-off-by: Vinson Lee --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 25e30c7..c9d40c5 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5461,6 +5461,7 @@ st_translate_program( struct pipe_screen *pscreen = st->pipe->screen; assert(procType == TGSI_PROCESSOR_VERTEX); assert(pscreen->get_shader_param(pscreen, PIPE_SHADER_VERTEX, PIPE_SHADER_CAP_INTEGERS)); + (void) pscreen; if (!ctx->Const.NativeIntegers) { struct ureg_dst temp = ureg_DECL_local_temporary(t->ureg); ureg_U2F( t->ureg, ureg_writemask(temp, TGSI_WRITEMASK_X), t->systemValues[i]); -- 2.1.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/20] glsl/ir: add subroutine information storage to ir_function (v1.1)
From: Dave Airlie We need to store two sets of info into the ir_function, if this is a function definition with a subroutine list (subroutine_def) or if it a subroutine prototype. v1.1: add some more documentation. Reviewed-by: Chris Forbes Signed-off-by: Dave Airlie --- src/glsl/ir.cpp | 4 src/glsl/ir.h | 15 +++ src/glsl/ir_clone.cpp | 6 ++ src/glsl/ir_print_visitor.cpp | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 77f1736..7fba0b3 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1853,6 +1853,7 @@ static void steal_memory(ir_instruction *ir, void *new_ctx) { ir_variable *var = ir->as_variable(); + ir_function *fn = ir->as_function(); ir_constant *constant = ir->as_constant(); if (var != NULL && var->constant_value != NULL) steal_memory(var->constant_value, ir); @@ -1860,6 +1861,9 @@ steal_memory(ir_instruction *ir, void *new_ctx) if (var != NULL && var->constant_initializer != NULL) steal_memory(var->constant_initializer, ir); + if (fn != NULL && fn->subroutine_types) + ralloc_steal(new_ctx, fn->subroutine_types); + /* The components of aggregate constants are not visited by the normal * visitor, so steal their values by hand. */ diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 2d7f3d0..e273239 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1125,6 +1125,21 @@ public: * List of ir_function_signature for each overloaded function with this name. */ struct exec_list signatures; + + /** +* is this function a subroutine type declaration +* e.g. subroutine void type1(float arg1); +*/ + bool is_subroutine; + + /** +* is this function associated to a subroutine type +* e.g. subroutine (type1, type2) function_name { function_body }; +* would have num_subroutine_types 2, +* and pointers to the type1 and type2 types. +*/ + int num_subroutine_types; + const struct glsl_type **subroutine_types; }; inline const char *ir_function_signature::function_name() const diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp index 49834ff..a8fac18 100644 --- a/src/glsl/ir_clone.cpp +++ b/src/glsl/ir_clone.cpp @@ -267,6 +267,12 @@ ir_function::clone(void *mem_ctx, struct hash_table *ht) const { ir_function *copy = new(mem_ctx) ir_function(this->name); + copy->is_subroutine = this->is_subroutine; + copy->num_subroutine_types = this->num_subroutine_types; + copy->subroutine_types = ralloc_array(mem_ctx, const struct glsl_type *, copy->num_subroutine_types); + for (int i = 0; i < copy->num_subroutine_types; i++) + copy->subroutine_types[i] = this->subroutine_types[i]; + foreach_in_list(const ir_function_signature, sig, &this->signatures) { ir_function_signature *sig_copy = sig->clone(mem_ctx, ht); copy->add_signature(sig_copy); diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 922f98b..0ee03d9 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -230,7 +230,7 @@ void ir_print_visitor::visit(ir_function_signature *ir) void ir_print_visitor::visit(ir_function *ir) { - fprintf(f, "(function %s\n", ir->name); + fprintf(f, "(%s function %s\n", ir->is_subroutine ? "subroutine" : "", ir->name); indentation++; foreach_in_list(ir_function_signature, sig, &ir->signatures) { indent(); -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] ARB_shader_subroutine - now explicit!
So I revisited ARB_shader_subroutine again today, and noticed it was lacking wrt ARB_explicit_uniform_location thanks to some piglits from Igalia/Intel. So I've added support for that, cleaned up some things, like calculating the compatible shaders for a uniform at link time, stopped the dead code from eliminating subroutine uniforms so the queries continue to work, I've enabled tessellation bits where it makes sense as well. This series just enables it for gallium, I have the i965 changes to work on haswell ready as well, they are quite trivial. Since we have games actively depending on this, it would be nice to get it merged, so I don't spend more time rebasing than fixing. Dave. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 07/20] glsl/types: add new subroutine type (v3.1)
From: Dave Airlie This type will be used to store the name of subroutine types as in subroutine void myfunc(void); will store myfunc into a subroutine type. This is required to the parser can identify a subroutine type in a uniform decleration as a valid type, and also for looking up the type later. Also add contains_subroutine method. v2: handle subroutine to int comparisons, needed for lowering pass. v3: do subroutine to int with it's own IR operation to avoid hacking on asserts (Kayden) v3.1: fix warnings in this patch, fix nir, fix tgsi Reviewed-by: Chris Forbes Signed-off-by: Dave Airlie --- src/glsl/ast_to_hir.cpp| 1 + src/glsl/glsl_types.cpp| 66 ++ src/glsl/glsl_types.h | 19 + src/glsl/ir.cpp| 2 + src/glsl/ir.h | 1 + src/glsl/ir_builder.cpp| 6 +++ src/glsl/ir_builder.h | 1 + src/glsl/ir_clone.cpp | 1 + src/glsl/ir_validate.cpp | 4 ++ src/glsl/link_uniform_initializers.cpp | 1 + src/glsl/nir/nir_lower_io.c| 2 + src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 4 ++ 12 files changed, 108 insertions(+) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index b5c4ed9..3c920a4 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -971,6 +971,7 @@ do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1) case GLSL_TYPE_IMAGE: case GLSL_TYPE_INTERFACE: case GLSL_TYPE_ATOMIC_UINT: + case GLSL_TYPE_SUBROUTINE: /* I assume a comparison of a struct containing a sampler just * ignores the sampler present in the type. */ diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index aaf7c7c..5ebafb2 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -32,6 +32,7 @@ mtx_t glsl_type::mutex = _MTX_INITIALIZER_NP; hash_table *glsl_type::array_types = NULL; hash_table *glsl_type::record_types = NULL; hash_table *glsl_type::interface_types = NULL; +hash_table *glsl_type::subroutine_types = NULL; void *glsl_type::mem_ctx = NULL; void @@ -159,6 +160,22 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields, mtx_unlock(&glsl_type::mutex); } +glsl_type::glsl_type(const char *subroutine_name) : + gl_type(0), + base_type(GLSL_TYPE_SUBROUTINE), + sampler_dimensionality(0), sampler_shadow(0), sampler_array(0), + sampler_type(0), interface_packing(0), + vector_elements(0), matrix_columns(0), + length(0) +{ + mtx_lock(&glsl_type::mutex); + + init_ralloc_type_ctx(); + assert(subroutine_name != NULL); + this->name = ralloc_strdup(this->mem_ctx, subroutine_name); + this->vector_elements = 1; + mtx_unlock(&glsl_type::mutex); +} bool glsl_type::contains_sampler() const @@ -229,6 +246,22 @@ glsl_type::contains_opaque() const { } } +bool +glsl_type::contains_subroutine() const +{ + if (this->is_array()) { + return this->fields.array->contains_subroutine(); + } else if (this->is_record()) { + for (unsigned int i = 0; i < this->length; i++) { +if (this->fields.structure[i].type->contains_subroutine()) + return true; + } + return false; + } else { + return this->is_subroutine(); + } +} + gl_texture_index glsl_type::sampler_index() const { @@ -831,6 +864,36 @@ glsl_type::get_interface_instance(const glsl_struct_field *fields, return (glsl_type *) entry->data; } +const glsl_type * +glsl_type::get_subroutine_instance(const char *subroutine_name) +{ + const glsl_type key(subroutine_name); + + mtx_lock(&glsl_type::mutex); + + if (subroutine_types == NULL) { + subroutine_types = _mesa_hash_table_create(NULL, record_key_hash, + record_key_compare); + } + + const struct hash_entry *entry = _mesa_hash_table_search(subroutine_types, +&key); + if (entry == NULL) { + mtx_unlock(&glsl_type::mutex); + const glsl_type *t = new glsl_type(subroutine_name); + mtx_lock(&glsl_type::mutex); + + entry = _mesa_hash_table_insert(subroutine_types, t, (void *) t); + } + + assert(((glsl_type *) entry->data)->base_type == GLSL_TYPE_SUBROUTINE); + assert(strcmp(((glsl_type *) entry->data)->name, subroutine_name) == 0); + + mtx_unlock(&glsl_type::mutex); + + return (glsl_type *) entry->data; +} + const glsl_type * glsl_type::get_mul_type(const glsl_type *type_a, const glsl_type *type_b) @@ -963,6 +1026,7 @@ glsl_type::component_slots() const case GLSL_TYPE_SAMPLER: case GLSL_TYPE_ATOMIC_UINT: case GLSL_TYPE_VOID: + case GLSL_TYPE_SUBROUTINE: case GLSL_TYPE_ERROR: break; } @@ -983,6 +1047,7 @@ glsl_type::uniform_locations() const case GLSL_TYPE_BOOL: case GLSL_T
[Mesa-dev] [PATCH 02/20] glapi: Add ARB_shader_subroutine functions and enums (v2)
From: Chris Forbes v2: fix output="true" and LENGTH typo Reviewed-by: Tapani Pälli Reviewed-by: Kenneth Graunke Signed-off-by: Chris Forbes Signed-off-by: Dave Airlie --- src/mapi/glapi/gen/ARB_shader_subroutine.xml | 84 src/mapi/glapi/gen/Makefile.am | 1 + src/mapi/glapi/gen/gl_API.xml| 6 +- 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 src/mapi/glapi/gen/ARB_shader_subroutine.xml diff --git a/src/mapi/glapi/gen/ARB_shader_subroutine.xml b/src/mapi/glapi/gen/ARB_shader_subroutine.xml new file mode 100644 index 000..04b75cb --- /dev/null +++ b/src/mapi/glapi/gen/ARB_shader_subroutine.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am index 5b163b0..1922c15 100644 --- a/src/mapi/glapi/gen/Makefile.am +++ b/src/mapi/glapi/gen/Makefile.am @@ -151,6 +151,7 @@ API_XML = \ ARB_separate_shader_objects.xml \ ARB_shader_atomic_counters.xml \ ARB_shader_image_load_store.xml \ + ARB_shader_subroutine.xml \ ARB_sync.xml \ ARB_texture_barrier.xml \ ARB_texture_buffer_object.xml \ diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 2f33075..64314cf 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -8072,7 +8072,11 @@ http://www.w3.org/2001/XInclude"/> - + + +http://www.w3.org/2001/XInclude"/> + + http://www.w3.org/2001/XInclude"/> -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/20] glsl: Make `subroutine` a reserved keyword
From: Chris Forbes Reviewed-by: Tapani Pälli Reviewed-by: Kenneth Graunke Signed-off-by: Chris Forbes Signed-off-by: Dave Airlie --- src/glsl/glsl_lexer.ll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll index 845deeb..22055ce 100644 --- a/src/glsl/glsl_lexer.ll +++ b/src/glsl/glsl_lexer.ll @@ -578,7 +578,7 @@ usamplerBuffer KEYWORD(140, 300, 140, 0, USAMPLERBUFFER); resource KEYWORD(0, 300, 0, 0, RESOURCE); patch KEYWORD(0, 300, 0, 0, PATCH); sample KEYWORD_WITH_ALT(400, 300, 400, 0, yyextra->ARB_gpu_shader5_enable, SAMPLE); -subroutine KEYWORD(0, 300, 0, 0, SUBROUTINE); +subroutine KEYWORD_WITH_ALT(400, 300, 400, 0, yyextra->ARB_shader_subroutine_enable, SUBROUTINE); [_a-zA-Z][_a-zA-Z0-9]* { -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/20] mesa: add inline conversion functions for ARB_shader_subroutine
From: Dave Airlie This handles converting the shader stages to the internal prefix along with the program resource interfaces. Reviewed-by: Chris Forbes Signed-off-by: Dave Airlie --- src/mesa/main/shaderobj.h | 84 +++ 1 file changed, 84 insertions(+) diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h index 3d696a1..67c717b 100644 --- a/src/mesa/main/shaderobj.h +++ b/src/mesa/main/shaderobj.h @@ -120,6 +120,90 @@ _mesa_shader_enum_to_shader_stage(GLenum v) } +static inline const char * +_mesa_shader_stage_to_subroutine_prefix(gl_shader_stage stage) +{ + switch (stage) { + case MESA_SHADER_VERTEX: +return "__subu_v"; + case MESA_SHADER_GEOMETRY: +return "__subu_g"; + case MESA_SHADER_FRAGMENT: +return "__subu_f"; + case MESA_SHADER_COMPUTE: +return "__subu_c"; + default: +return NULL; + } +} + +static inline gl_shader_stage +_mesa_shader_stage_from_subroutine_uniform(GLenum subuniform) +{ + switch (subuniform) { + default: + case GL_VERTEX_SUBROUTINE_UNIFORM: + return MESA_SHADER_VERTEX; + case GL_GEOMETRY_SUBROUTINE_UNIFORM: + return MESA_SHADER_GEOMETRY; + case GL_FRAGMENT_SUBROUTINE_UNIFORM: + return MESA_SHADER_FRAGMENT; + case GL_COMPUTE_SUBROUTINE_UNIFORM: + return MESA_SHADER_COMPUTE; + /* TODO - COMPUTE, TESS */ + } +} + +static inline gl_shader_stage +_mesa_shader_stage_from_subroutine(GLenum subroutine) +{ + switch (subroutine) { + case GL_VERTEX_SUBROUTINE: + return MESA_SHADER_VERTEX; + case GL_GEOMETRY_SUBROUTINE: + return MESA_SHADER_GEOMETRY; + case GL_FRAGMENT_SUBROUTINE: + return MESA_SHADER_FRAGMENT; + case GL_COMPUTE_SUBROUTINE: + return MESA_SHADER_COMPUTE; + /* TODO - TESS */ + } +} + +static inline GLenum +_mesa_shader_stage_to_subroutine(gl_shader_stage stage) +{ + switch (stage) { + default: + case MESA_SHADER_VERTEX: + return GL_VERTEX_SUBROUTINE; + case MESA_SHADER_GEOMETRY: + return GL_GEOMETRY_SUBROUTINE; + case MESA_SHADER_FRAGMENT: + return GL_FRAGMENT_SUBROUTINE; + case MESA_SHADER_COMPUTE: + return GL_COMPUTE_SUBROUTINE; + /* TODO - TESS */ + } +} + +static inline GLenum +_mesa_shader_stage_to_subroutine_uniform(gl_shader_stage stage) +{ + switch (stage) { + default: + case MESA_SHADER_VERTEX: + return GL_VERTEX_SUBROUTINE_UNIFORM; + case MESA_SHADER_GEOMETRY: + return GL_GEOMETRY_SUBROUTINE_UNIFORM; + case MESA_SHADER_FRAGMENT: + return GL_FRAGMENT_SUBROUTINE_UNIFORM; + case MESA_SHADER_COMPUTE: + return GL_COMPUTE_SUBROUTINE_UNIFORM; + /* TODO - TESS */ + } +} + #ifdef __cplusplus } #endif -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 08/20] glsl: don't eliminate subroutine types.
From: Dave Airlie This stops dead code from removing subroutines types, we need these for the queries to work properly. Signed-off-by: Dave Airlie --- src/glsl/opt_dead_code.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/glsl/opt_dead_code.cpp b/src/glsl/opt_dead_code.cpp index 04e4d56..e4bf874 100644 --- a/src/glsl/opt_dead_code.cpp +++ b/src/glsl/opt_dead_code.cpp @@ -126,6 +126,9 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned) if (block_type->interface_packing != GLSL_INTERFACE_PACKING_PACKED) continue; } + +if (entry->var->type->is_subroutine()) + continue; } entry->var->remove(); -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/20] mesa: Add extension tracking for arb_shader_subroutine (v2)
From: Chris Forbes v2: [airlied]: merge version check update. Reviewed-by: Tapani Pälli Reviewed-by: Kenneth Graunke Signed-off-by: Chris Forbes Signed-off-by: Dave Airlie --- src/mesa/main/extensions.c | 1 + src/mesa/main/mtypes.h | 1 + src/mesa/main/version.c| 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index d753e5f..a20693b 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -155,6 +155,7 @@ static const struct extension extension_table[] = { { "GL_ARB_shader_precision",o(ARB_shader_precision), GL, 2010 }, { "GL_ARB_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 }, { "GL_ARB_shader_storage_buffer_object", o(ARB_shader_storage_buffer_object),GL, 2012 }, + { "GL_ARB_shader_subroutine", o(ARB_shader_subroutine), GLC,2010 }, { "GL_ARB_shader_texture_lod", o(ARB_shader_texture_lod), GL, 2009 }, { "GL_ARB_shading_language_100",o(dummy_true), GLL,2003 }, { "GL_ARB_shading_language_packing", o(ARB_shading_language_packing),GL, 2011 }, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 4b0a995..10c3954 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3704,6 +3704,7 @@ struct gl_extensions GLboolean ARB_shader_precision; GLboolean ARB_shader_stencil_export; GLboolean ARB_shader_storage_buffer_object; + GLboolean ARB_shader_subroutine; GLboolean ARB_shader_texture_lod; GLboolean ARB_shading_language_packing; GLboolean ARB_shading_language_420pack; diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 8bc00ac..fd7ae53 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -309,7 +309,7 @@ compute_version(const struct gl_extensions *extensions, extensions->ARB_gpu_shader5 && extensions->ARB_gpu_shader_fp64 && extensions->ARB_sample_shading && - false /*extensions->ARB_shader_subroutine*/ && + extensions->ARB_shader_subroutine && extensions->ARB_tessellation_shader && extensions->ARB_texture_buffer_object_rgb32 && extensions->ARB_texture_cube_map_array && -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 15/20] glsl: add uniform and program resource support (v2)
From: Dave Airlie This adds linker support for subroutine uniforms, they have some subtle differences from real uniforms, we also hide them and they are given internal uniform names. This also adds the subroutine locations and subroutine uniforms to the program resource tracking for later use. v1.1: drop is_subroutine_def v2: handle explicit location properly, ARB_explicit_location has a lot of language for subroutine shaders. Calculate a link time the number of compatible subroutines for a uniform, to make program resource easier later. Signed-off-by: Dave Airlie --- src/glsl/ir_uniform.h | 8 ++ src/glsl/link_uniforms.cpp | 103 - src/glsl/linker.cpp| 182 - 3 files changed, 286 insertions(+), 7 deletions(-) diff --git a/src/glsl/ir_uniform.h b/src/glsl/ir_uniform.h index e1b8014..0b6f720 100644 --- a/src/glsl/ir_uniform.h +++ b/src/glsl/ir_uniform.h @@ -114,6 +114,8 @@ struct gl_uniform_storage { struct gl_opaque_uniform_index image[MESA_SHADER_STAGES]; + struct gl_opaque_uniform_index subroutine[MESA_SHADER_STAGES]; + /** * Storage used by the driver for the uniform */ @@ -173,10 +175,16 @@ struct gl_uniform_storage { /** * The 'base location' for this uniform in the uniform remap table. For * arrays this is the first element in the array. +* for subroutines this is in shader subroutine uniform remap table. */ unsigned remap_location; /** +* The number of compatible subroutines with this subroutine uniform. +*/ + unsigned num_compatible_subroutines; + + /** * This is a compiler-generated uniform that should not be advertised * via the API. */ diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index e786ddc..254086d 100644 --- a/src/glsl/link_uniforms.cpp +++ b/src/glsl/link_uniforms.cpp @@ -47,9 +47,10 @@ static unsigned values_for_type(const glsl_type *type) { - if (type->is_sampler()) { + if (type->is_sampler() || type->is_subroutine()) { return 1; - } else if (type->is_array() && type->fields.array->is_sampler()) { + } else if (type->is_array() && (type->fields.array->is_sampler() || + type->fields.array->is_subroutine())) { return type->array_size(); } else { return type->component_slots(); @@ -284,6 +285,7 @@ public: count_uniform_size(struct string_to_uint_map *map) : num_active_uniforms(0), num_values(0), num_shader_samplers(0), num_shader_images(0), num_shader_uniform_components(0), +num_shader_subroutines(0), is_ubo_var(false), map(map) { /* empty */ @@ -294,6 +296,7 @@ public: this->num_shader_samplers = 0; this->num_shader_images = 0; this->num_shader_uniform_components = 0; + this->num_shader_subroutines = 0; } void process(ir_variable *var) @@ -331,6 +334,11 @@ public: */ unsigned num_shader_uniform_components; + /** +* Number of subroutine uniforms used +*/ + unsigned num_shader_subroutines; + bool is_ubo_var; private: @@ -348,7 +356,9 @@ private: * count it for each shader target. */ const unsigned values = values_for_type(type); - if (type->contains_sampler()) { + if (type->contains_subroutine()) { + this->num_shader_subroutines += values; + } else if (type->contains_sampler()) { this->num_shader_samplers += values; } else if (type->contains_image()) { this->num_shader_images += values; @@ -421,6 +431,7 @@ public: this->shader_shadow_samplers = 0; this->next_sampler = 0; this->next_image = 0; + this->next_subroutine = 0; memset(this->targets, 0, sizeof(this->targets)); } @@ -535,6 +546,24 @@ private: } } + void handle_subroutines(const glsl_type *base_type, + struct gl_uniform_storage *uniform) + { + if (base_type->is_subroutine()) { + uniform->subroutine[shader_type].index = this->next_subroutine; + uniform->subroutine[shader_type].active = true; + + /* Increment the subroutine index by 1 for non-arrays and by the + * number of array elements for arrays. + */ + this->next_subroutine += MAX2(1, uniform->array_elements); + + } else { + uniform->subroutine[shader_type].index = ~0; + uniform->subroutine[shader_type].active = false; + } + } + virtual void visit_field(const glsl_type *type, const char *name, bool row_major) { @@ -588,6 +617,7 @@ private: /* This assigns uniform indices to sampler and image uniforms. */ handle_samplers(base_type, &this->uniforms[id]); handle_images(base_type, &this->uniforms[id]); + handle_subroutines(base_type, &this->uniforms[id]); /* If there is already storage associated with this
[Mesa-dev] [PATCH 13/20] glsl/ir: add subroutine lowering pass (v2.3)
From: Dave Airlie This lowers the enhanced ir_call using the lookaside table of subroutines into an if ladder. This initially was done at the AST level but it caused some ordering issues so a separate pass was required. v2: clone return value derefs. v2.1: update for subroutine->int convert. v2.2: add a clone for the array index Reviewed-by: Chris Forbes Signed-off-by: Dave Airlie --- src/glsl/Makefile.sources | 1 + src/glsl/glsl_parser_extras.cpp | 1 + src/glsl/ir_optimization.h | 2 + src/glsl/lower_subroutine.cpp | 109 4 files changed, 113 insertions(+) create mode 100644 src/glsl/lower_subroutine.cpp diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources index d784a81..3f113c8 100644 --- a/src/glsl/Makefile.sources +++ b/src/glsl/Makefile.sources @@ -154,6 +154,7 @@ LIBGLSL_FILES = \ lower_packed_varyings.cpp \ lower_named_interface_blocks.cpp \ lower_packing_builtins.cpp \ + lower_subroutine.cpp \ lower_texture_projection.cpp \ lower_variable_index_to_cond_assign.cpp \ lower_vec_index_to_cond_assign.cpp \ diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 3618424..0891b6f 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -1561,6 +1561,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, struct gl_shader_compiler_options *options = &ctx->Const.ShaderCompilerOptions[shader->Stage]; + lower_subroutine(shader->ir, state); /* Do some optimization at compile time to reduce shader IR size * and reduce later work if the same shader is linked multiple times */ diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index e6939f3..fef5a83 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -135,6 +135,8 @@ void optimize_dead_builtin_variables(exec_list *instructions, bool lower_vertex_id(gl_shader *shader); +bool lower_subroutine(exec_list *instructions, struct _mesa_glsl_parse_state *state); + ir_rvalue * compare_index_block(exec_list *instructions, ir_variable *index, unsigned base, unsigned components, void *mem_ctx); diff --git a/src/glsl/lower_subroutine.cpp b/src/glsl/lower_subroutine.cpp new file mode 100644 index 000..e45ccfe --- /dev/null +++ b/src/glsl/lower_subroutine.cpp @@ -0,0 +1,109 @@ +/* + * Copyright © 2015 Red Hat + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file lower_subroutine.cpp + * + * lowers subroutines to an if ladder. + */ + +#include "glsl_types.h" +#include "glsl_parser_extras.h" +#include "ir.h" +#include "ir_builder.h" + +using namespace ir_builder; +namespace { + +class lower_subroutine_visitor : public ir_hierarchical_visitor { +public: + lower_subroutine_visitor() + { + this->progress = false; + } + + ir_visitor_status visit_leave(ir_call *); + bool progress; + struct _mesa_glsl_parse_state *state; +}; + +} + +bool +lower_subroutine(exec_list *instructions, struct _mesa_glsl_parse_state *state) +{ + lower_subroutine_visitor v; + v.state = state; + visit_list_elements(&v, instructions); + return v.progress; +} + +ir_visitor_status +lower_subroutine_visitor::visit_leave(ir_call *ir) +{ + if (!ir->sub_var) + return visit_continue; + + void *mem_ctx = ralloc_parent(ir); + ir_if *last_branch = NULL; + ir_dereference_variable *return_deref = ir->return_deref; + + for (int s = this->state->num_subroutines - 1; s >= 0; s--) { + ir_rvalue *var; + ir_constant *lc = new(mem_ctx)ir_constant(s); + ir_function *fn = this->state->subroutines[s]; + bool is_compat = false; + + for (int i = 0; i < fn->num_subroutine_types; i++) { + if (ir->sub_var->type->without_array() == fn->subroutine_types[i]
[Mesa-dev] [PATCH 11/20] glsl/ir: allow ir_call to handle subroutine calling
From: Dave Airlie This adds a ir_variable which contains the subroutine uniform and an array rvalue for the deref of that uniform, these are stored in the ir_call and lowered later. Reviewed-by: Chris Forbes Signed-off-by: Dave Airlie --- src/glsl/ir.h | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/glsl/ir.h b/src/glsl/ir.h index e273239..647a87b 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -1711,7 +1711,18 @@ public: ir_call(ir_function_signature *callee, ir_dereference_variable *return_deref, exec_list *actual_parameters) - : ir_instruction(ir_type_call), return_deref(return_deref), callee(callee) + : ir_instruction(ir_type_call), return_deref(return_deref), callee(callee), sub_var(NULL), array_idx(NULL) + { + assert(callee->return_type != NULL); + actual_parameters->move_nodes_to(& this->actual_parameters); + this->use_builtin = callee->is_builtin(); + } + + ir_call(ir_function_signature *callee, + ir_dereference_variable *return_deref, + exec_list *actual_parameters, + ir_variable *var, ir_rvalue *array_idx) + : ir_instruction(ir_type_call), return_deref(return_deref), callee(callee), sub_var(var), array_idx(array_idx) { assert(callee->return_type != NULL); actual_parameters->move_nodes_to(& this->actual_parameters); @@ -1759,6 +1770,14 @@ public: /** Should this call only bind to a built-in function? */ bool use_builtin; + + /* +* ARB_shader_subroutine support - +* the subroutine uniform variable and array index +* rvalue to be used in the lowering pass later. +*/ + ir_variable *sub_var; + ir_rvalue *array_idx; }; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 12/20] glsl: add ast/parser support for subroutine parsing storage (v3.2)
From: Dave Airlie This is the guts of the GLSL parser and AST support for shader subroutines. The code creates a subroutine type in the parser, and uses that there to validate the identifiers. The parser also distinguishes between subroutine types/function prototypes /uniforms and subroutine defintions for functions. Then in the AST conversion it recreates the types, and stores the subroutine definition info or subroutine info into the ir_function along with a side lookup table in the parser state. It also converts subroutine calls into the enhanced ir_call. v2: move to handling method calls in function handling not in field selection. v3: merge Chris's previous parser patches in here, to make it clearer what's changed in one place. v3.1: add more documentation, drop unused include v3.2: drop is_subroutine_def Reviewed-by: Chris Forbes Signed-off-by: Dave Airlie --- src/glsl/ast.h | 15 + src/glsl/ast_function.cpp| 120 +-- src/glsl/ast_to_hir.cpp | 96 +++ src/glsl/ast_type.cpp| 7 ++- src/glsl/glsl_lexer.ll | 8 +++ src/glsl/glsl_parser.yy | 114 + src/glsl/glsl_parser_extras.cpp | 22 +++ src/glsl/glsl_parser_extras.h| 19 +++ src/glsl/hir_field_selection.cpp | 39 - 9 files changed, 324 insertions(+), 116 deletions(-) diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 4921229..ff0a2ee 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -304,6 +304,16 @@ private: * Is this function call actually a constructor? */ bool cons; + ir_rvalue * + handle_method(exec_list *instructions, + struct _mesa_glsl_parse_state *state); +}; + +class ast_subroutine_list : public ast_node +{ +public: + virtual void print(void) const; + exec_list declarations; }; class ast_array_specifier : public ast_node { @@ -515,6 +525,10 @@ struct ast_type_qualifier { unsigned stream:1; /**< Has stream value assigned */ unsigned explicit_stream:1; /**< stream value assigned explicitly by shader code */ /** \} */ + + /** \name Qualifiers for GL_ARB_shader_subroutine */ + unsigned subroutine:1; /**< Is this marked 'subroutine' */ + unsigned subroutine_def:1; /**< Is this marked 'subroutine' with a list of types */ } /** \brief Set of flags, accessed by name. */ q; @@ -637,6 +651,7 @@ struct ast_type_qualifier { ast_type_qualifier q, ast_node* &node); + ast_subroutine_list *subroutine_list; }; class ast_declarator_list; diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp index 6749e99..803edf5 100644 --- a/src/glsl/ast_function.cpp +++ b/src/glsl/ast_function.cpp @@ -26,6 +26,7 @@ #include "glsl_types.h" #include "ir.h" #include "main/core.h" /* for MIN2 */ +#include "main/shaderobj.h" static ir_rvalue * convert_component(ir_rvalue *src, const glsl_type *desired_type); @@ -355,6 +356,8 @@ fix_parameter(void *mem_ctx, ir_rvalue *actual, const glsl_type *formal_type, static ir_rvalue * generate_call(exec_list *instructions, ir_function_signature *sig, exec_list *actual_parameters, + ir_variable *sub_var, + ir_rvalue *array_idx, struct _mesa_glsl_parse_state *state) { void *ctx = state; @@ -421,7 +424,8 @@ generate_call(exec_list *instructions, ir_function_signature *sig, deref = new(ctx) ir_dereference_variable(var); } - ir_call *call = new(ctx) ir_call(sig, deref, actual_parameters); + + ir_call *call = new(ctx) ir_call(sig, deref, actual_parameters, sub_var, array_idx); instructions->push_tail(call); /* Also emit any necessary out-parameter conversions. */ @@ -489,6 +493,40 @@ done: return sig; } +static ir_function_signature * +match_subroutine_by_name(const char *name, + exec_list *actual_parameters, + struct _mesa_glsl_parse_state *state, + ir_variable **var_r) +{ + void *ctx = state; + ir_function_signature *sig = NULL; + ir_function *f, *found = NULL; + const char *new_name; + ir_variable *var; + bool is_exact = false; + + new_name = ralloc_asprintf(ctx, "%s_%s", _mesa_shader_stage_to_subroutine_prefix(state->stage), name); + var = state->symbols->get_variable(new_name); + if (!var) + return NULL; + + for (int i = 0; i < state->num_subroutine_types; i++) { + f = state->subroutine_types[i]; + if (strcmp(f->name, var->type->without_array()->name)) + continue; + found = f; + break; + } + + if (!found) + return NULL; + *var_r = var; + sig = found->matching_signature(state, actual_parameters, + false, &is_exact); + return sig; +} + static void print_function_
[Mesa-dev] [PATCH 05/20] glsl: Add extension plumbing and define for ARB_shader_subroutine
From: Chris Forbes Reviewed-by: Tapani Pälli Reviewed-by: Kenneth Graunke Signed-off-by: Chris Forbes Signed-off-by: Dave Airlie --- src/glsl/glcpp/glcpp-parse.y| 3 +++ src/glsl/glsl_parser_extras.cpp | 1 + src/glsl/glsl_parser_extras.h | 2 ++ src/glsl/standalone_scaffolding.cpp | 1 + 4 files changed, 7 insertions(+) diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index ed1bffb..5534ff7 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -2486,6 +2486,9 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio if (extensions->ARB_shader_storage_buffer_object) add_builtin_define(parser, "GL_ARB_shader_storage_buffer_object", 1); + + if (extensions->ARB_shader_subroutine) + add_builtin_define(parser, "GL_ARB_shader_subroutine", 1); } } diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 5412f0b..a234eef 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -571,6 +571,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { EXT(ARB_shader_precision, true, false, ARB_shader_precision), EXT(ARB_shader_stencil_export,true, false, ARB_shader_stencil_export), EXT(ARB_shader_storage_buffer_object, true, false, ARB_shader_storage_buffer_object), + EXT(ARB_shader_subroutine,true, false, ARB_shader_subroutine), EXT(ARB_shader_texture_lod, true, false, ARB_shader_texture_lod), EXT(ARB_shading_language_420pack, true, false, ARB_shading_language_420pack), EXT(ARB_shading_language_packing, true, false, ARB_shading_language_packing), diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 4996b84..dd441c1 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -469,6 +469,8 @@ struct _mesa_glsl_parse_state { bool ARB_shader_stencil_export_warn; bool ARB_shader_storage_buffer_object_enable; bool ARB_shader_storage_buffer_object_warn; + bool ARB_shader_subroutine_enable; + bool ARB_shader_subroutine_warn; bool ARB_shader_texture_lod_enable; bool ARB_shader_texture_lod_warn; bool ARB_shading_language_420pack_enable; diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp index 172c6f4..15546c2 100644 --- a/src/glsl/standalone_scaffolding.cpp +++ b/src/glsl/standalone_scaffolding.cpp @@ -133,6 +133,7 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api) ctx->Extensions.ARB_sample_shading = true; ctx->Extensions.ARB_shader_bit_encoding = true; ctx->Extensions.ARB_shader_stencil_export = true; + ctx->Extensions.ARB_shader_subroutine = true; ctx->Extensions.ARB_shader_texture_lod = true; ctx->Extensions.ARB_shading_language_420pack = true; ctx->Extensions.ARB_shading_language_packing = true; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/20] mesa: Add glGet support for ARB_shader_subroutine implementation limits
From: Chris Forbes Reviewed-by: Tapani Pälli Reviewed-by: Kenneth Graunke Signed-off-by: Chris Forbes Signed-off-by: Dave Airlie --- src/mesa/main/config.h | 6 ++ src/mesa/main/get.c | 1 + src/mesa/main/get_hash_params.py | 4 src/mesa/main/tests/enum_strings.cpp | 9 + 4 files changed, 20 insertions(+) diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 177f176..6a04df1 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -274,6 +274,12 @@ #define MAX_VERTEX_STREAMS 4 /*@}*/ +/** For GL_ARB_shader_subroutine */ +/*@{*/ +#define MAX_SUBROUTINES 256 +#define MAX_SUBROUTINE_UNIFORM_LOCATIONS 1024 +/*@}*/ + /** For GL_INTEL_performance_query */ /*@{*/ #define MAX_PERFQUERY_QUERY_NAME_LENGTH 256 diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index ffafe51..9b16518 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -401,6 +401,7 @@ EXTRA_EXT(ARB_explicit_uniform_location); EXTRA_EXT(ARB_clip_control); EXTRA_EXT(EXT_polygon_offset_clamp); EXTRA_EXT(ARB_framebuffer_no_attachments); +EXTRA_EXT(ARB_shader_subroutine); static const int extra_ARB_color_buffer_float_or_glcore[] = { diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index c25e1b6..842ed6c 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -824,6 +824,10 @@ descriptor=[ [ "MIN_FRAGMENT_INTERPOLATION_OFFSET", "CONTEXT_FLOAT(Const.MinFragmentInterpolationOffset), extra_ARB_gpu_shader5" ], [ "MAX_FRAGMENT_INTERPOLATION_OFFSET", "CONTEXT_FLOAT(Const.MaxFragmentInterpolationOffset), extra_ARB_gpu_shader5" ], [ "FRAGMENT_INTERPOLATION_OFFSET_BITS", "CONST(FRAGMENT_INTERPOLATION_OFFSET_BITS), extra_ARB_gpu_shader5" ], + +# GL_ARB_shader_subroutine + [ "MAX_SUBROUTINES", "CONST(MAX_SUBROUTINES), extra_ARB_shader_subroutine" ], + [ "MAX_SUBROUTINE_UNIFORM_LOCATIONS", "CONST(MAX_SUBROUTINE_UNIFORM_LOCATIONS), extra_ARB_shader_subroutine" ], ]} ] diff --git a/src/mesa/main/tests/enum_strings.cpp b/src/mesa/main/tests/enum_strings.cpp index 84c1195..8218cc9 100644 --- a/src/mesa/main/tests/enum_strings.cpp +++ b/src/mesa/main/tests/enum_strings.cpp @@ -1731,6 +1731,10 @@ const struct enum_info everything[] = { { 0x8DDF, "GL_MAX_GEOMETRY_UNIFORM_COMPONENTS" }, { 0x8DE0, "GL_MAX_GEOMETRY_OUTPUT_VERTICES" }, { 0x8DE1, "GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS" }, + { 0x8DE5, "GL_ACTIVE_SUBROUTINES" }, + { 0x8DE6, "GL_ACTIVE_SUBROUTINE_UNIFORMS" }, + { 0x8DE7, "GL_MAX_SUBROUTINES" }, + { 0x8DE8, "GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS" }, { 0x8DF0, "GL_LOW_FLOAT" }, { 0x8DF1, "GL_MEDIUM_FLOAT" }, { 0x8DF2, "GL_HIGH_FLOAT" }, @@ -1759,6 +1763,11 @@ const struct enum_info everything[] = { { 0x8E44, "GL_TEXTURE_SWIZZLE_B" }, { 0x8E45, "GL_TEXTURE_SWIZZLE_A" }, { 0x8E46, "GL_TEXTURE_SWIZZLE_RGBA" }, + { 0x8E47, "GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS" }, + { 0x8E48, "GL_ACTIVE_SUBROUTINE_MAX_LENGTH" }, + { 0x8E49, "GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH" }, + { 0x8E4A, "GL_NUM_COMPATIBLE_SUBROUTINES" }, + { 0x8E4B, "GL_COMPATIBLE_SUBROUTINES" }, { 0x8E4C, "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION" }, { 0x8E4D, "GL_FIRST_VERTEX_CONVENTION" }, { 0x8E4E, "GL_LAST_VERTEX_CONVENTION" }, -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/20] mesa: Add stubs for ARB_shader_subroutine entrypoints
From: Chris Forbes Reviewed-by: Tapani Pälli Reviewed-by: Kenneth Graunke Signed-off-by: Chris Forbes Signed-off-by: Dave Airlie --- src/mesa/main/shaderapi.c | 63 +++ src/mesa/main/shaderapi.h | 35 ++ 2 files changed, 98 insertions(+) diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 3365c7a..afca9b1 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -1984,3 +1984,66 @@ _mesa_CreateShaderProgramv(GLenum type, GLsizei count, return _mesa_create_shader_program(ctx, GL_TRUE, type, count, strings); } + + +/** + * ARB_shader_subroutine + */ +GLint GLAPIENTRY +_mesa_GetSubroutineUniformLocation(GLuint program, GLenum shadertype, + const GLchar *name) +{ + return -1; +} + + +GLuint GLAPIENTRY +_mesa_GetSubroutineIndex(GLuint program, GLenum shadertype, + const GLchar *name) +{ + return GL_INVALID_INDEX; +} + + +GLvoid GLAPIENTRY +_mesa_GetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, + GLuint index, GLenum pname, GLint *values) +{ +} + + +GLvoid GLAPIENTRY +_mesa_GetActiveSubroutineUniformName(GLuint program, GLenum shadertype, + GLuint index, GLsizei bufsize, + GLsizei *length, GLchar *name) +{ +} + + +GLvoid GLAPIENTRY +_mesa_GetActiveSubroutineName(GLuint program, GLenum shadertype, + GLuint index, GLsizei bufsize, + GLsizei *length, GLchar *name) +{ +} + + +GLvoid GLAPIENTRY +_mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count, +const GLuint *indices) +{ +} + + +GLvoid GLAPIENTRY +_mesa_GetUniformSubroutineuiv(GLenum shadertype, GLint location, + GLuint *params) +{ +} + + +GLvoid GLAPIENTRY +_mesa_GetProgramStageiv(GLuint program, GLenum shadertype, +GLenum pname, GLint *values) +{ +} diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h index aba6d5d..eda7170 100644 --- a/src/mesa/main/shaderapi.h +++ b/src/mesa/main/shaderapi.h @@ -264,6 +264,41 @@ _mesa_get_program_resourceiv(struct gl_shader_program *shProg, GLsizei bufSize, GLsizei *length, GLint *params); +/* GL_ARB_shader_subroutine */ +extern GLint GLAPIENTRY +_mesa_GetSubroutineUniformLocation(GLuint program, GLenum shadertype, + const GLchar *name); + +extern GLuint GLAPIENTRY +_mesa_GetSubroutineIndex(GLuint program, GLenum shadertype, + const GLchar *name); + +extern GLvoid GLAPIENTRY +_mesa_GetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, + GLuint index, GLenum pname, GLint *values); + +extern GLvoid GLAPIENTRY +_mesa_GetActiveSubroutineUniformName(GLuint program, GLenum shadertype, + GLuint index, GLsizei bufsize, + GLsizei *length, GLchar *name); + +extern GLvoid GLAPIENTRY +_mesa_GetActiveSubroutineName(GLuint program, GLenum shadertype, + GLuint index, GLsizei bufsize, + GLsizei *length, GLchar *name); + +extern GLvoid GLAPIENTRY +_mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count, +const GLuint *indices); + +extern GLvoid GLAPIENTRY +_mesa_GetUniformSubroutineuiv(GLenum shadertype, GLint location, + GLuint *params); + +extern GLvoid GLAPIENTRY +_mesa_GetProgramStageiv(GLuint program, GLenum shadertype, +GLenum pname, GLint *values); + #ifdef __cplusplus } #endif -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 18/20] mesa: fill out the ARB_shader_subroutine APIs
From: Dave Airlie This fleshes out the APIs, using the program resource APIs where they should match. It also sets the default values to valid subroutines. Signed-off-by: Dave Airlie --- src/mesa/main/shaderapi.c | 450 +- src/mesa/main/shaderapi.h | 3 + 2 files changed, 450 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index afca9b1..3d17230 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -1071,6 +1071,7 @@ _mesa_use_program(struct gl_context *ctx, struct gl_shader_program *shProg) use_shader_program(ctx, i, shProg, &ctx->Shader); _mesa_active_program(ctx, shProg, "glUseProgram"); + _mesa_shader_program_init_subroutine_defaults(shProg); if (ctx->Driver.UseProgram) ctx->Driver.UseProgram(ctx, shProg); } @@ -1993,15 +1994,75 @@ GLint GLAPIENTRY _mesa_GetSubroutineUniformLocation(GLuint program, GLenum shadertype, const GLchar *name) { - return -1; -} + GET_CURRENT_CONTEXT(ctx); + const char *api_name = "glGetSubroutineUniformLocation"; + struct gl_shader_program *shProg; + GLenum resource_type; + gl_shader_stage stage; + if (!ctx->Extensions.ARB_shader_subroutine) { + _mesa_error(ctx, GL_INVALID_OPERATION, api_name); + return -1; + } + + if (!_mesa_validate_shader_target(ctx, shadertype)) { + _mesa_error(ctx, GL_INVALID_OPERATION, api_name); + return -1; + } + + shProg = _mesa_lookup_shader_program_err(ctx, program, api_name); + if (!shProg) + return -1; + + stage = _mesa_shader_enum_to_shader_stage(shadertype); + if (!shProg->_LinkedShaders[stage]) { + _mesa_error(ctx, GL_INVALID_OPERATION, api_name); + return -1; + } + + resource_type = _mesa_shader_stage_to_subroutine_uniform(stage); + return _mesa_program_resource_location(shProg, resource_type, name); +} GLuint GLAPIENTRY _mesa_GetSubroutineIndex(GLuint program, GLenum shadertype, const GLchar *name) { - return GL_INVALID_INDEX; + GET_CURRENT_CONTEXT(ctx); + const char *api_name = "glGetSubroutineIndex"; + struct gl_shader_program *shProg; + struct gl_program_resource *res; + GLenum resource_type; + gl_shader_stage stage; + + if (!ctx->Extensions.ARB_shader_subroutine) { + _mesa_error(ctx, GL_INVALID_OPERATION, api_name); + return -1; + } + + if (!_mesa_validate_shader_target(ctx, shadertype)) { + _mesa_error(ctx, GL_INVALID_OPERATION, api_name); + return -1; + } + + shProg = _mesa_lookup_shader_program_err(ctx, program, api_name); + if (!shProg) + return -1; + + stage = _mesa_shader_enum_to_shader_stage(shadertype); + if (!shProg->_LinkedShaders[stage]) { + _mesa_error(ctx, GL_INVALID_OPERATION, api_name); + return -1; + } + + resource_type = _mesa_shader_stage_to_subroutine(stage); + res = _mesa_program_resource_find_name(shProg, resource_type, name); + if (!res) { + _mesa_error(ctx, GL_INVALID_OPERATION, api_name); + return -1; + } + + return _mesa_program_resource_index(shProg, res); } @@ -2009,6 +2070,81 @@ GLvoid GLAPIENTRY _mesa_GetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values) { + GET_CURRENT_CONTEXT(ctx); + const char *api_name = "glGetActiveSubroutineUniformiv"; + struct gl_shader_program *shProg; + struct gl_shader *sh; + gl_shader_stage stage; + struct gl_program_resource *res; + const struct gl_uniform_storage *uni; + GLenum resource_type; + int count, i, j; + if (!ctx->Extensions.ARB_shader_subroutine) { + _mesa_error(ctx, GL_INVALID_OPERATION, api_name); + return; + } + + if (!_mesa_validate_shader_target(ctx, shadertype)) { + _mesa_error(ctx, GL_INVALID_OPERATION, api_name); + return; + } + + shProg = _mesa_lookup_shader_program_err(ctx, program, api_name); + if (!shProg) + return; + + stage = _mesa_shader_enum_to_shader_stage(shadertype); + resource_type = _mesa_shader_stage_to_subroutine_uniform(stage); + + sh = shProg->_LinkedShaders[stage]; + if (!sh) { + _mesa_error(ctx, GL_INVALID_OPERATION, api_name); + return; + } + + switch (pname) { + case GL_NUM_COMPATIBLE_SUBROUTINES: { + res = _mesa_program_resource_find_index(shProg, resource_type, index); + if (res) { + uni = res->Data; + values[0] = uni->num_compatible_subroutines; + } + break; + } + case GL_COMPATIBLE_SUBROUTINES: { + res = _mesa_program_resource_find_index(shProg, resource_type, index); + if (res) { + uni = res->Data; + count = 0; + for (i = 0; i < sh->NumSubroutineFunctions; i++) { +struct gl_subroutine_function *fn = &sh->SubroutineFunctions[i]; +for (j = 0; j < fn->num_compat_types; j++) { + if (fn->typ
[Mesa-dev] [PATCH 16/20] program_resource: add subroutine support (v2)
From: Dave Airlie This fleshes out the ARB_program_query support for the APIs that ARB_shader_subroutine introduces, leaving some TODOs for later addition. v2: reworked for lots of the ARB_program_interface_query entry points and tests Signed-off-by: Dave Airlie --- src/mesa/main/program_resource.c | 88 src/mesa/main/shader_query.cpp | 82 - 2 files changed, 151 insertions(+), 19 deletions(-) diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c index e77bb03..b5ef9b9 100644 --- a/src/mesa/main/program_resource.c +++ b/src/mesa/main/program_resource.c @@ -28,10 +28,11 @@ #include "main/mtypes.h" #include "main/shaderapi.h" #include "main/shaderobj.h" +#include "main/context.h" #include "program_resource.h" - +#include "ir_uniform.h" static bool -supported_interface_enum(GLenum iface) +supported_interface_enum(struct gl_context *ctx, GLenum iface) { switch (iface) { case GL_UNIFORM: @@ -41,18 +42,24 @@ supported_interface_enum(GLenum iface) case GL_TRANSFORM_FEEDBACK_VARYING: case GL_ATOMIC_COUNTER_BUFFER: return true; + /* arb shader subroutine is always enabled */ case GL_VERTEX_SUBROUTINE: - case GL_TESS_CONTROL_SUBROUTINE: - case GL_TESS_EVALUATION_SUBROUTINE: - case GL_GEOMETRY_SUBROUTINE: case GL_FRAGMENT_SUBROUTINE: - case GL_COMPUTE_SUBROUTINE: case GL_VERTEX_SUBROUTINE_UNIFORM: - case GL_TESS_CONTROL_SUBROUTINE_UNIFORM: - case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM: - case GL_GEOMETRY_SUBROUTINE_UNIFORM: case GL_FRAGMENT_SUBROUTINE_UNIFORM: + return ctx->Extensions.ARB_shader_subroutine; + case GL_GEOMETRY_SUBROUTINE: + case GL_GEOMETRY_SUBROUTINE_UNIFORM: + return _mesa_has_geometry_shaders(ctx) && ctx->Extensions.ARB_shader_subroutine; + case GL_COMPUTE_SUBROUTINE: case GL_COMPUTE_SUBROUTINE_UNIFORM: + return _mesa_has_compute_shaders(ctx) && ctx->Extensions.ARB_shader_subroutine; + case GL_TESS_CONTROL_SUBROUTINE: + case GL_TESS_EVALUATION_SUBROUTINE: + case GL_TESS_CONTROL_SUBROUTINE_UNIFORM: + case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM: + return ctx->Extensions.ARB_tessellation_shader && ctx->Extensions.ARB_shader_subroutine; + return false; case GL_BUFFER_VARIABLE: case GL_SHADER_STORAGE_BLOCK: default: @@ -79,7 +86,7 @@ _mesa_GetProgramInterfaceiv(GLuint program, GLenum programInterface, } /* Validate interface. */ - if (!supported_interface_enum(programInterface)) { + if (!supported_interface_enum(ctx, programInterface)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramInterfaceiv(%s)", _mesa_enum_to_string(programInterface)); return; @@ -143,6 +150,31 @@ _mesa_GetProgramInterfaceiv(GLuint program, GLenum programInterface, }; break; case GL_MAX_NUM_COMPATIBLE_SUBROUTINES: + switch (programInterface) { + case GL_VERTEX_SUBROUTINE_UNIFORM: + case GL_FRAGMENT_SUBROUTINE_UNIFORM: + case GL_GEOMETRY_SUBROUTINE_UNIFORM: + case GL_COMPUTE_SUBROUTINE_UNIFORM: + case GL_TESS_CONTROL_SUBROUTINE_UNIFORM: + case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM: { + for (i = 0, *params = 0; i < shProg->NumProgramResourceList; i++) { +if (shProg->ProgramResourceList[i].Type == programInterface) { + struct gl_uniform_storage *uni = + (struct gl_uniform_storage *) + shProg->ProgramResourceList[i].Data; + *params = MAX2(*params, uni->num_compatible_subroutines); +} + } + break; + } + + default: + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetProgramInterfaceiv(%s pname %s)", + _mesa_enum_to_string(programInterface), + _mesa_enum_to_string(pname)); + } + break; default: _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramInterfaceiv(pname %s)", @@ -206,6 +238,11 @@ _mesa_GetProgramResourceIndex(GLuint program, GLenum programInterface, if (!shProg || !name) return GL_INVALID_INDEX; + if (!supported_interface_enum(ctx, programInterface)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramResourceIndex(%s)", + _mesa_enum_to_string(programInterface)); + return GL_INVALID_INDEX; + } /* * For the interface TRANSFORM_FEEDBACK_VARYING, the value INVALID_INDEX * should be returned when querying the index assigned to the special names @@ -217,6 +254,14 @@ _mesa_GetProgramResourceIndex(GLuint program, GLenum programInterface, return GL_INVALID_INDEX; switch (programInterface) { + case GL_COMPUTE_SUBROUTINE: + case GL_COMPUTE_SUBROUTINE_UNIFORM: + case GL_GEOMETRY_SUBROUTINE: + case GL_GEOMETRY_SUBROUTINE_UNIFORM: + case GL_VERTEX_SUBROUTINE: + case GL_FRAGMENT_SUBROUTINE: + case GL_VE
[Mesa-dev] [PATCH 17/20] program: add subroutine uniform support (v1.1)
From: Dave Airlie Add support for the subroutine uniform type ir->mesa.cpp v1.1: add subroutine to int to switch Signed-off-by: Dave Airlie --- src/mesa/program/ir_to_mesa.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 2bd212e..20c0fad 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -534,6 +534,7 @@ type_size(const struct glsl_type *type) return size; case GLSL_TYPE_SAMPLER: case GLSL_TYPE_IMAGE: + case GLSL_TYPE_SUBROUTINE: /* Samplers take up one slot in UNIFORMS[], but they're baked in * at link time. */ @@ -1342,6 +1343,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_unop_dFdx_fine: case ir_unop_dFdy_coarse: case ir_unop_dFdy_fine: + case ir_unop_subroutine_to_int: assert(!"not supported"); break; @@ -2451,6 +2453,7 @@ _mesa_associate_uniform_storage(struct gl_context *ctx, break; case GLSL_TYPE_SAMPLER: case GLSL_TYPE_IMAGE: + case GLSL_TYPE_SUBROUTINE: format = uniform_native; columns = 1; break; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 14/20] mesa/mtypes: add gl_subroutine_function and uniform storage to shader (v2)
From: Dave Airlie This adds the necessary storage for subroutine info to gl_shader. v2: add comments, rename one member Signed-off-by: Dave Airlie --- src/mesa/main/mtypes.h | 28 1 file changed, 28 insertions(+) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 10c3954..046ba04 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2360,6 +2360,15 @@ struct gl_ati_fragment_shader_state struct ati_fragment_shader *Current; }; +/** + * Shader subroutine function definition + */ +struct gl_subroutine_function +{ + char *name; + int num_compat_types; + const struct glsl_type **types; +}; /** * A GLSL vertex or fragment shader object. @@ -2510,6 +2519,25 @@ struct gl_shader */ unsigned LocalSize[3]; } Comp; + + /** + * Number of types for subroutine uniforms. + */ + GLuint NumSubroutineUniformTypes; + + /** + * Subroutine uniform remap table + * based on the program level uniform remap table. + */ + GLuint NumSubroutineUniformRemapTable; + struct gl_uniform_storage **SubroutineUniformRemapTable; + + /** +* Num of subroutine functions for this stage +* and storage for them. +*/ + GLuint NumSubroutineFunctions; + struct gl_subroutine_function *SubroutineFunctions; }; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 19/20] st/mesa: add subroutine bits (v1.1)
From: Dave Airlie Just add support for the subroutine type to the glsl->tgsi convertor. v1.1: add subroutine to int support. Signed-off-by: Dave Airlie --- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 48d7de6..a1dd70f 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -797,7 +797,7 @@ glsl_to_tgsi_visitor::get_opcode(ir_instruction *ir, unsigned op, case TGSI_OPCODE_##c: \ if (type == GLSL_TYPE_DOUBLE) \ op = TGSI_OPCODE_##d; \ - else if (type == GLSL_TYPE_INT) \ + else if (type == GLSL_TYPE_INT || type == GLSL_TYPE_SUBROUTINE) \ op = TGSI_OPCODE_##i; \ else if (type == GLSL_TYPE_UINT) \ op = TGSI_OPCODE_##u; \ -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 20/20] st/mesa: enable shader subroutine
From: Dave Airlie since this touches drivers, only enable it on gallium for now for drivers reporting GLSL 1.30 or above. Signed-off-by: Dave Airlie --- src/mesa/state_tracker/st_extensions.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index b1057f3..e5796f9 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -693,6 +693,7 @@ void st_init_extensions(struct pipe_screen *screen, extensions->OES_depth_texture_cube_map = GL_TRUE; extensions->ARB_shading_language_420pack = GL_TRUE; extensions->ARB_texture_query_levels = GL_TRUE; + extensions->ARB_shader_subroutine = GL_TRUE; if (!options->disable_shader_bit_encoding) { extensions->ARB_shader_bit_encoding = GL_TRUE; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 02/20] glapi: Add ARB_shader_subroutine functions and enums (v2)
You're adding this extension as core-only, so the functions should only be accessible in core contexts. I believe that Ian added some magical way to get the dispatch logic to handle this. On Tue, Jul 21, 2015 at 1:19 AM, Dave Airlie wrote: > From: Chris Forbes > > v2: fix output="true" and LENGTH typo > > Reviewed-by: Tapani Pälli > Reviewed-by: Kenneth Graunke > Signed-off-by: Chris Forbes > Signed-off-by: Dave Airlie > --- > src/mapi/glapi/gen/ARB_shader_subroutine.xml | 84 > > src/mapi/glapi/gen/Makefile.am | 1 + > src/mapi/glapi/gen/gl_API.xml| 6 +- > 3 files changed, 90 insertions(+), 1 deletion(-) > create mode 100644 src/mapi/glapi/gen/ARB_shader_subroutine.xml > > diff --git a/src/mapi/glapi/gen/ARB_shader_subroutine.xml > b/src/mapi/glapi/gen/ARB_shader_subroutine.xml > new file mode 100644 > index 000..04b75cb > --- /dev/null > +++ b/src/mapi/glapi/gen/ARB_shader_subroutine.xml > @@ -0,0 +1,84 @@ > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am > index 5b163b0..1922c15 100644 > --- a/src/mapi/glapi/gen/Makefile.am > +++ b/src/mapi/glapi/gen/Makefile.am > @@ -151,6 +151,7 @@ API_XML = \ > ARB_separate_shader_objects.xml \ > ARB_shader_atomic_counters.xml \ > ARB_shader_image_load_store.xml \ > + ARB_shader_subroutine.xml \ > ARB_sync.xml \ > ARB_texture_barrier.xml \ > ARB_texture_buffer_object.xml \ > diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml > index 2f33075..64314cf 100644 > --- a/src/mapi/glapi/gen/gl_API.xml > +++ b/src/mapi/glapi/gen/gl_API.xml > @@ -8072,7 +8072,11 @@ > > xmlns:xi="http://www.w3.org/2001/XInclude"/> > > - > + > + > + xmlns:xi="http://www.w3.org/2001/XInclude"/> > + > + > > xmlns:xi="http://www.w3.org/2001/XInclude"/> > > -- > 2.4.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 09/20] mesa: add inline conversion functions for ARB_shader_subroutine
On Tue, Jul 21, 2015 at 1:19 AM, Dave Airlie wrote: > From: Dave Airlie > > This handles converting the shader stages to the internal > prefix along with the program resource interfaces. > > Reviewed-by: Chris Forbes > Signed-off-by: Dave Airlie > --- > src/mesa/main/shaderobj.h | 84 > +++ > 1 file changed, 84 insertions(+) > > diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h > index 3d696a1..67c717b 100644 > --- a/src/mesa/main/shaderobj.h > +++ b/src/mesa/main/shaderobj.h > @@ -120,6 +120,90 @@ _mesa_shader_enum_to_shader_stage(GLenum v) > } > > > +static inline const char * > +_mesa_shader_stage_to_subroutine_prefix(gl_shader_stage stage) > +{ > + switch (stage) { > + case MESA_SHADER_VERTEX: > +return "__subu_v"; > + case MESA_SHADER_GEOMETRY: > +return "__subu_g"; > + case MESA_SHADER_FRAGMENT: > +return "__subu_f"; > + case MESA_SHADER_COMPUTE: > +return "__subu_c"; > + default: > +return NULL; > + } > +} > + > +static inline gl_shader_stage > +_mesa_shader_stage_from_subroutine_uniform(GLenum subuniform) > +{ > + switch (subuniform) { > + default: > + case GL_VERTEX_SUBROUTINE_UNIFORM: > + return MESA_SHADER_VERTEX; > + case GL_GEOMETRY_SUBROUTINE_UNIFORM: > + return MESA_SHADER_GEOMETRY; > + case GL_FRAGMENT_SUBROUTINE_UNIFORM: > + return MESA_SHADER_FRAGMENT; > + case GL_COMPUTE_SUBROUTINE_UNIFORM: > + return MESA_SHADER_COMPUTE; > + /* TODO - COMPUTE, TESS */ Compute seems to be done already... > + } > +} > + > +static inline gl_shader_stage > +_mesa_shader_stage_from_subroutine(GLenum subroutine) > +{ > + switch (subroutine) { > + case GL_VERTEX_SUBROUTINE: > + return MESA_SHADER_VERTEX; > + case GL_GEOMETRY_SUBROUTINE: > + return MESA_SHADER_GEOMETRY; > + case GL_FRAGMENT_SUBROUTINE: > + return MESA_SHADER_FRAGMENT; > + case GL_COMPUTE_SUBROUTINE: > + return MESA_SHADER_COMPUTE; > + /* TODO - TESS */ > + } > +} > + > +static inline GLenum > +_mesa_shader_stage_to_subroutine(gl_shader_stage stage) > +{ > + switch (stage) { > + default: > + case MESA_SHADER_VERTEX: > + return GL_VERTEX_SUBROUTINE; > + case MESA_SHADER_GEOMETRY: > + return GL_GEOMETRY_SUBROUTINE; > + case MESA_SHADER_FRAGMENT: > + return GL_FRAGMENT_SUBROUTINE; > + case MESA_SHADER_COMPUTE: > + return GL_COMPUTE_SUBROUTINE; > + /* TODO - TESS */ > + } > +} > + > +static inline GLenum > +_mesa_shader_stage_to_subroutine_uniform(gl_shader_stage stage) > +{ > + switch (stage) { > + default: > + case MESA_SHADER_VERTEX: > + return GL_VERTEX_SUBROUTINE_UNIFORM; > + case MESA_SHADER_GEOMETRY: > + return GL_GEOMETRY_SUBROUTINE_UNIFORM; > + case MESA_SHADER_FRAGMENT: > + return GL_FRAGMENT_SUBROUTINE_UNIFORM; > + case MESA_SHADER_COMPUTE: > + return GL_COMPUTE_SUBROUTINE_UNIFORM; > + /* TODO - TESS */ > + } > +} > + > #ifdef __cplusplus > } > #endif > -- > 2.4.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 05/20] glsl: Add extension plumbing and define for ARB_shader_subroutine
I could be missing it, but does anything restrict the availability of this define to core contexts? I believe you have comparable issues elsewhere in the change (where you only look at the extension being enabled vs also looking at the API). On Tue, Jul 21, 2015 at 1:19 AM, Dave Airlie wrote: > From: Chris Forbes > > Reviewed-by: Tapani Pälli > Reviewed-by: Kenneth Graunke > Signed-off-by: Chris Forbes > Signed-off-by: Dave Airlie > --- > src/glsl/glcpp/glcpp-parse.y| 3 +++ > src/glsl/glsl_parser_extras.cpp | 1 + > src/glsl/glsl_parser_extras.h | 2 ++ > src/glsl/standalone_scaffolding.cpp | 1 + > 4 files changed, 7 insertions(+) > > diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y > index ed1bffb..5534ff7 100644 > --- a/src/glsl/glcpp/glcpp-parse.y > +++ b/src/glsl/glcpp/glcpp-parse.y > @@ -2486,6 +2486,9 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t > *parser, intmax_t versio > > if (extensions->ARB_shader_storage_buffer_object) > add_builtin_define(parser, > "GL_ARB_shader_storage_buffer_object", 1); > + > + if (extensions->ARB_shader_subroutine) > + add_builtin_define(parser, "GL_ARB_shader_subroutine", 1); >} > } > > diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp > index 5412f0b..a234eef 100644 > --- a/src/glsl/glsl_parser_extras.cpp > +++ b/src/glsl/glsl_parser_extras.cpp > @@ -571,6 +571,7 @@ static const _mesa_glsl_extension > _mesa_glsl_supported_extensions[] = { > EXT(ARB_shader_precision, true, false, > ARB_shader_precision), > EXT(ARB_shader_stencil_export,true, false, > ARB_shader_stencil_export), > EXT(ARB_shader_storage_buffer_object, true, false, > ARB_shader_storage_buffer_object), > + EXT(ARB_shader_subroutine,true, false, > ARB_shader_subroutine), > EXT(ARB_shader_texture_lod, true, false, > ARB_shader_texture_lod), > EXT(ARB_shading_language_420pack, true, false, > ARB_shading_language_420pack), > EXT(ARB_shading_language_packing, true, false, > ARB_shading_language_packing), > diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h > index 4996b84..dd441c1 100644 > --- a/src/glsl/glsl_parser_extras.h > +++ b/src/glsl/glsl_parser_extras.h > @@ -469,6 +469,8 @@ struct _mesa_glsl_parse_state { > bool ARB_shader_stencil_export_warn; > bool ARB_shader_storage_buffer_object_enable; > bool ARB_shader_storage_buffer_object_warn; > + bool ARB_shader_subroutine_enable; > + bool ARB_shader_subroutine_warn; > bool ARB_shader_texture_lod_enable; > bool ARB_shader_texture_lod_warn; > bool ARB_shading_language_420pack_enable; > diff --git a/src/glsl/standalone_scaffolding.cpp > b/src/glsl/standalone_scaffolding.cpp > index 172c6f4..15546c2 100644 > --- a/src/glsl/standalone_scaffolding.cpp > +++ b/src/glsl/standalone_scaffolding.cpp > @@ -133,6 +133,7 @@ void initialize_context_to_defaults(struct gl_context > *ctx, gl_api api) > ctx->Extensions.ARB_sample_shading = true; > ctx->Extensions.ARB_shader_bit_encoding = true; > ctx->Extensions.ARB_shader_stencil_export = true; > + ctx->Extensions.ARB_shader_subroutine = true; > ctx->Extensions.ARB_shader_texture_lod = true; > ctx->Extensions.ARB_shading_language_420pack = true; > ctx->Extensions.ARB_shading_language_packing = true; > -- > 2.4.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 16/20] program_resource: add subroutine support (v2)
On Tue, Jul 21, 2015 at 1:19 AM, Dave Airlie wrote: > @@ -366,18 +411,25 @@ _mesa_GetProgramResourceLocation(GLuint program, GLenum > programInterface, > case GL_PROGRAM_OUTPUT: >break; > > + case GL_VERTEX_SUBROUTINE_UNIFORM: > + case GL_FRAGMENT_SUBROUTINE_UNIFORM: > + if (ctx->Extensions.ARB_shader_subroutine) > + break; > + > + case GL_GEOMETRY_SUBROUTINE_UNIFORM: > + if (_mesa_has_geometry_shaders(ctx) && > ctx->Extensions.ARB_shader_subroutine) > + break; > + case GL_COMPUTE_SUBROUTINE_UNIFORM: > + if (_mesa_has_compute_shaders(ctx) && > ctx->Extensions.ARB_shader_subroutine) > + break; > + > /* For reference valid cases requiring additional extension support: > -* GL_ARB_shader_subroutine > * GL_ARB_tessellation_shader > -* GL_ARB_compute_shader > */ > - case GL_VERTEX_SUBROUTINE_UNIFORM: > case GL_TESS_CONTROL_SUBROUTINE_UNIFORM: > case GL_TESS_EVALUATION_SUBROUTINE_UNIFORM: > - case GL_GEOMETRY_SUBROUTINE_UNIFORM: > - case GL_FRAGMENT_SUBROUTINE_UNIFORM: > - case GL_COMPUTE_SUBROUTINE_UNIFORM: > - > + if (ctx->Extensions.ARB_tessellation_shader && > ctx->Extensions.ARB_shader_subroutine) > + break; So if you don't have compute shaders but you do have tessellation shaders, then GL_COMPUTE_SUBROUTINE_UNIFORM is OK? > default: >_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramResourceLocation(%s > %s)", >_mesa_enum_to_string(programInterface), name); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 05/14] meta: Abort meta pbo path if readpixels need signed-unsigned conversion
On Mon, 2015-07-20 at 10:56 -0700, Anuj Phogat wrote: > On Mon, Jul 20, 2015 at 5:10 AM, Iago Toral wrote: > > On Fri, 2015-06-19 at 13:40 -0700, Anuj Phogat wrote: > >> On Tue, Jun 16, 2015 at 9:21 PM, Jason Ekstrand > >> wrote: > >> > > >> > On Jun 16, 2015 11:15, "Anuj Phogat" wrote: > >> >> > >> >> Without this patch, piglit test fbo_integer_readpixels_sint_uint fails, > >> >> when > >> >> forced to use the meta pbo path. > >> >> > >> >> Signed-off-by: Anuj Phogat > >> >> Cc: > >> >> --- > >> >> src/mesa/drivers/common/meta_tex_subimage.c | 3 +++ > >> >> 1 file changed, 3 insertions(+) > >> >> > >> >> diff --git a/src/mesa/drivers/common/meta_tex_subimage.c > >> >> b/src/mesa/drivers/common/meta_tex_subimage.c > >> >> index 00364f8..84cbc50 100644 > >> >> --- a/src/mesa/drivers/common/meta_tex_subimage.c > >> >> +++ b/src/mesa/drivers/common/meta_tex_subimage.c > >> >> @@ -283,6 +283,9 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context > >> >> *ctx, > >> >> GLuint dims, > >> >> > >> >>if (_mesa_need_rgb_to_luminance_conversion(rb->Format, format)) > >> >> return false; > >> >> + > >> >> + if (_mesa_need_signed_unsigned_int_conversion(rb->Format, format, > >> >> type)) > >> >> + return false; > >> > > >> > Hrm... This seems fishy. Isn't glBlitFramebuffers supposed to handle > >> > format > >> > conversion with integers? If so we should probably fix it rather than > >> > just > >> > skip it for the meta pbo path. > >> > > >> As discussed offline, here is relevant text for glBlitFrameBuffer() from > >> OpenGL 4.5 spec, section 18.3.1: > >> "An INVALID_OPERATION error is generated if format conversions are not > >> supported, which occurs under any of the following conditions: > >> -The read buffer contains fixed-point or floating-point values and any draw > >> buffer contains neither fixed-point nor floating-point values. > >> -The read buffer contains unsigned integer values and any draw buffer does > >> not contain unsigned integer values. > >> - The read buffer contains signed integer values and any draw buffer does > >> not contain signed integer values." > >> > >> I'll add a comment here explaining the reason to avoid meta path. > > > > Is this code going to run only for glBlitFramebuffer? I see this > > function being called from code paths that implement glReadPixels and > > glGetTexImage too. > > > _mesa_meta_pbo_GetTexSubImage() is used only for glReadPixels and > glGetTexImage. I quoted the glBliFrameBuffer restriction above because > the function is later using _mesa_meta_BlitFramebuffer(), which doesn't > support some format conversions. If this function can be used to resolve ReadPixels and GetTexImage but the checks you add are *specific* to BlitFramebuffer, it does not look like this is the right place for them. Shouldn't you put them inside _mesa_meta_BlitFramebuffer instead? Otherwise they would affect to ReadPixels and GetTexImage too and I don't see the same restrictions applying to ReadPixels for example. Iago > >> >> } > >> >> > >> >> /* For arrays, use a tall (height * depth) 2D texture but taking > >> >> into > >> >> -- > >> >> 1.9.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 > > > > > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev