Re: [Mesa-dev] [PATCH] i965/fs: Replace subreg_offset with brw_reg's subnr.
On Thu, 2016-02-11 at 19:12 -0800, Kenneth Graunke wrote: > On Thursday, February 11, 2016 5:49:55 PM PST Matt Turner wrote: > > On Thu, Feb 11, 2016 at 3:33 PM, Francisco Jerez> wrote: > > > Would be really nice if we could also get rid of reg_offset as we're at > > > it. reg and subreg_offset basically represent the same thing but with > > > different units, couldn't we just have a single offset field in bytes? > > > Should it be part of brw_reg or backend_reg? I think I would lean > > > towards backend_reg. In that case does it make sense to move this into > > > brw_reg now only to move it back to backend_reg later on? > > > > That would be nice. > > > > I'm just not sure how to do it. brw_reg has to have the subnr field, > > and it's nice if that's the field the higher levels use too. > > > > I wonder -- is it possible that we could just get rid of reg_offset > > too? For gathering data we have load_payload, so it's not useful > > there. I think it's mainly useful for accessing elements of texturing > > results. Is doubt there is a way we could avoid that though? > > I disagree - I don't think this would be nice at all. > > When we designed the IR, we needed something to handle cases like > texturing results, where we actually need to store a whole vec4, > and can't break it into separate scalar components. (Note that > messages used MRFs; we didn't even know about send-from-GRF.) > > To handle this, Eric created an abstraction of "virtual registers with > size > 1", where we basically have an array of registers, each of which > holds a single scalar value. It can be thought of as a vecN, and > reg_offset is the array index - v[i] - selecting each of the logically > contiguous components. reg_offset only makes sense on these large > virtual registers - it has no meaning for real hardware registers. > > In contrast, subreg_offset (which came later) offered a way to access > particular channels of a single hardware register, such as g0.2. We > added this later to make the IR more expressive. > > While these are both offsets, they serve very different purposes. > > Replacing subreg_offset with subnr makes a lot of sense to me, as > both are basically a way to provide a byte offset for the start of > a register region, allowing unaligned register access. But reg_offset > is a different beast. > > If you want to be rid of it, then perhaps we should consider removing > the "VGRF of size > 1" abstraction. One could imagine a system where > we allocate separate VRFs for each scalar value, but record that > "VRFs 4, 12, and 63 need to be contiguous", passing that information > to the register allocator. There are certainly other fine approaches. > > I would also humbly request that you wait until FP64 lands before making > any major changes. It's very easy to conflate type size, number of SIMD > channels, and register offsets, and a lot of the FP64 work is fixing > places that are confused about that. I'd really like to avoid making > our Igalia friends' lives harder by making them rebase 100 patches on > IR redesigns. Thanks Ken for thinking about us :) I would definitely appreciate this! The patch count for fp64 is already above 150 and rebasing it on top of changes like these sounds quite scary to me. Iago ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH 4/4] glx: fix error code when there is no context bound
This sounds like a bug in the unit tests. I'll take a look in the morning. On February 11, 2016 9:34:36 PM Tapani Pälliwrote: On 02/12/2016 02:54 AM, Emil Velikov wrote: On 11 February 2016 at 12:04, Tapani Pälli wrote: From: Bernard Kilarski Signed-off-by: Bernard Kilarski Signed-off-by: Matt Roper Cc: "11.0 11.1" psc, attribute, value); @@ -166,7 +166,7 @@ glXQueryCurrentRendererStringMESA(int attribute) { struct glx_context *gc = __glXGetCurrentContext(); - if (gc == NULL) + if (gc == NULL || gc == ) Unless I'm missing something __glXGetCurrentContext() can never return NULL, right ? This was my initial impression also ... but I'm not sure what happens here but unit tests (glx-test) for some reason completely explode if you take out the null check and try running 'make check'. I think that is why also the dummyContext is introduced in those tests. I played around a bit with this change and linking phase with glx-test starts to print quite weird errors, actually complete unrelated ones, I guess because it cannot find the 'extern' declared 'dummyContext'. I'm not sure if this is actually problem with the tests rather than this code. In that case I see two possible solutions - Swap all the NULL checks, for == (some commit message would be great) or - Drop the null checks in this patch, and explain why we do that only here (the xid and vtable are implicitly zeroed for dummyContext, thus things will just work). Leaning for the latter for stable as it's shorter. Although doing the former on top (for master alone) also sounds like a good idea imho. return False; return __glXQueryRendererString(gc->psc, attribute); diff --git a/src/glx/tests/query_renderer_unittest.cpp b/src/glx/tests/query_renderer_unittest.cpp index 2f3c4ef..4c96260 100644 --- a/src/glx/tests/query_renderer_unittest.cpp +++ b/src/glx/tests/query_renderer_unittest.cpp @@ -40,6 +40,10 @@ struct attribute_test_vector { #define E(x) { # x, x } +/* This is necessary so that we don't have to link with glxcurrent.c + * which would require us to link with X libraries and what not. + */ +struct glx_context dummyContext; Perhaps we should initialize it (like in glxcurrent.c) for consistency, if anything else ? -Emil ___ mesa-stable mailing list mesa-sta...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-stable ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [v2] Compression support for single-sampled
On Thu, Feb 11, 2016 at 04:03:00PM -0800, Ben Widawsky wrote: > On Thu, Feb 11, 2016 at 08:33:53PM +0200, Topi Pohjolainen wrote: > > This series enables compression for single sampled color surfaces, > > also referred to as "lossless compression". This is yet only for > > driver internal use easing pressure on memory bandwidth and caches > > when writing, blending and sampling surfaces uing gpu. > > > > As a side effect the need for color buffer resolves after fast > > clears is also decreased. Current understanding is that sampling > > engine doesn't understand meta data (auxiliary buffer) for single > > sampled fast cleared surfaces. However, if the meta data is written > > with lossless compression enabled, even sampling engine is capable > > of reading both the color buffer and the auxiliary, and resolves > > can be omitted in those case. > > > > The final enabling patch is dependent on earlier two-patch series > > fixing state restore mechanism in i965-meta operations. > > > > v2 (Ben): Use combination of msaa_layout and number of samples > >instead of introducing explicit type for lossless > >compression. > > > > Other than the comments I left, > patch 6, 7, 9, 10 are: > Reviewed-by: Ben Widawsky> > I wouldn't mind a small comment in patch 6 about why INTEL_MSAA_LAYOUT_NONE is > fast clear (it seems like the resolve has such a comment)... up to you. A few > months from now I can imagine myself looking at it and being WTF. > > 6 and 9 would be a logical pair to squash IMO. I agree, I squashed them and added a comment: /* Only single sampled surfaces need to (and actually can) be resolved. */ > > I'm going to start back up tomorrow at patch #11. I want to take a bit of a > break. Thanks! ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 89330] piglit glsl-1.50 invariant-qualifier-in-out-block-01 regression
https://bugs.freedesktop.org/show_bug.cgi?id=89330 Timothy Arcerichanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #5 from Timothy Arceri --- Should be fixed by: commit61ceb36ead2e88cce4b4bac63793e94d343a3cc4 glsl: Allow invariant qualifer in block members in desktop OpenGL. Feedback from Khronos is that 'invariant' should be allowed on block members for desktop OpenGL. Fix piglit regression added by fe1e89a0: invariant-qualifier-in-out-block-01.vert v2: - Allow it for in/out blocks in OpenGL ES too, so when OES_shader_io_blocks is supported we don't need to do any change (Timothy) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89330 Signed-off-by: Samuel Iglesias Gonsálvez Reviewed-by: Timothy Arceri -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 79706] [TRACKER] Mesa regression tracker
https://bugs.freedesktop.org/show_bug.cgi?id=79706 Bug 79706 depends on bug 89330, which changed state. Bug 89330 Summary: piglit glsl-1.50 invariant-qualifier-in-out-block-01 regression https://bugs.freedesktop.org/show_bug.cgi?id=89330 What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 11/19] st/mesa: add compute shader states
Reviewed-by: Marek OlšákMarek On Thu, Feb 11, 2016 at 9:17 PM, Samuel Pitoiset wrote: > Changes from v2: > - use as much common code as possible (eg. st_basic_variant) > > Signed-off-by: Samuel Pitoiset > Reviewed-by: Marek Olšák (v1) > Reviewed-by: Ilia Mirkin (v1) > --- > src/mesa/state_tracker/st_atom.c| 2 +- > src/mesa/state_tracker/st_atom.h| 1 + > src/mesa/state_tracker/st_atom_shader.c | 32 > src/mesa/state_tracker/st_cb_program.c | 30 +++ > src/mesa/state_tracker/st_context.c | 1 + > src/mesa/state_tracker/st_context.h | 3 ++ > src/mesa/state_tracker/st_extensions.c | 7 ++- > src/mesa/state_tracker/st_program.c | 88 > + > src/mesa/state_tracker/st_program.h | 41 +++ > 9 files changed, 202 insertions(+), 3 deletions(-) > > diff --git a/src/mesa/state_tracker/st_atom.c > b/src/mesa/state_tracker/st_atom.c > index 2d89512..3427a92 100644 > --- a/src/mesa/state_tracker/st_atom.c > +++ b/src/mesa/state_tracker/st_atom.c > @@ -98,7 +98,7 @@ static const struct st_tracked_state *render_atoms[] = > */ > static const struct st_tracked_state *compute_atoms[] = > { > - /* will be updated in the next commit */ > + _update_cp, > }; > > > diff --git a/src/mesa/state_tracker/st_atom.h > b/src/mesa/state_tracker/st_atom.h > index 77e2163..ef33645 100644 > --- a/src/mesa/state_tracker/st_atom.h > +++ b/src/mesa/state_tracker/st_atom.h > @@ -58,6 +58,7 @@ extern const struct st_tracked_state st_update_gp; > extern const struct st_tracked_state st_update_tep; > extern const struct st_tracked_state st_update_tcp; > extern const struct st_tracked_state st_update_vp; > +extern const struct st_tracked_state st_update_cp; > extern const struct st_tracked_state st_update_rasterizer; > extern const struct st_tracked_state st_update_polygon_stipple; > extern const struct st_tracked_state st_update_viewport; > diff --git a/src/mesa/state_tracker/st_atom_shader.c > b/src/mesa/state_tracker/st_atom_shader.c > index c8650a5..a88f035 100644 > --- a/src/mesa/state_tracker/st_atom_shader.c > +++ b/src/mesa/state_tracker/st_atom_shader.c > @@ -255,3 +255,35 @@ const struct st_tracked_state st_update_tep = { > }, > update_tep /* update */ > }; > + > + > + > +static void > +update_cp( struct st_context *st ) > +{ > + struct st_compute_program *stcp; > + > + if (!st->ctx->ComputeProgram._Current) { > + cso_set_compute_shader_handle(st->cso_context, NULL); > + return; > + } > + > + stcp = st_compute_program(st->ctx->ComputeProgram._Current); > + assert(stcp->Base.Base.Target == GL_COMPUTE_PROGRAM_NV); > + > + st->cp_variant = st_get_cp_variant(st, >tgsi, >variants); > + > + st_reference_compprog(st, >cp, stcp); > + > + cso_set_compute_shader_handle(st->cso_context, > + st->cp_variant->driver_shader); > +} > + > +const struct st_tracked_state st_update_cp = { > + "st_update_cp", /* name */ > + { /* dirty */ > + 0, /* mesa */ > + ST_NEW_COMPUTE_PROGRAM /* st */ > + }, > + update_cp /* update */ > +}; > diff --git a/src/mesa/state_tracker/st_cb_program.c > b/src/mesa/state_tracker/st_cb_program.c > index ca493d8..27cc0f3 100644 > --- a/src/mesa/state_tracker/st_cb_program.c > +++ b/src/mesa/state_tracker/st_cb_program.c > @@ -74,6 +74,9 @@ st_bind_program(struct gl_context *ctx, GLenum target, > struct gl_program *prog) > case GL_TESS_EVALUATION_PROGRAM_NV: >st->dirty.st |= ST_NEW_TESSEVAL_PROGRAM; >break; > + case GL_COMPUTE_PROGRAM_NV: > + st->dirty_cp.st |= ST_NEW_COMPUTE_PROGRAM; > + break; > } > } > > @@ -92,6 +95,7 @@ st_use_program(struct gl_context *ctx, struct > gl_shader_program *shProg) > st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM; > st->dirty.st |= ST_NEW_TESSCTRL_PROGRAM; > st->dirty.st |= ST_NEW_TESSEVAL_PROGRAM; > + st->dirty_cp.st |= ST_NEW_COMPUTE_PROGRAM; > } > > > @@ -123,6 +127,10 @@ st_new_program(struct gl_context *ctx, GLenum target, > GLuint id) >struct st_tesseval_program *prog = > ST_CALLOC_STRUCT(st_tesseval_program); >return _mesa_init_gl_program(>Base.Base, target, id); > } > + case GL_COMPUTE_PROGRAM_NV: { > + struct st_compute_program *prog = ST_CALLOC_STRUCT(st_compute_program); > + return _mesa_init_gl_program(>Base.Base, target, id); > + } > default: >assert(0); >return NULL; > @@ -195,6 +203,17 @@ st_delete_program(struct gl_context *ctx, struct > gl_program *prog) > free_glsl_to_tgsi_visitor(sttep->glsl_to_tgsi); >} >break; > + case GL_COMPUTE_PROGRAM_NV: > + { > +
Re: [Mesa-dev] [PATCH 2/4] i965: Consider tessellation in get_pipeline_state_l3_weights.
Kenneth Graunkewrites: > On Thursday, February 11, 2016 11:28:44 PM PST Francisco Jerez wrote: >> Kenneth Graunke writes: >> >> > I think this was just missed; Curro and I were probably writing >> > code simultaneously and forgot to combine them at the end. >> > >> > Signed-off-by: Kenneth Graunke >> > Reviewed-by: Jordan Justen >> > --- >> > src/mesa/drivers/dri/i965/gen7_l3_state.c | 7 ++- >> > 1 file changed, 6 insertions(+), 1 deletion(-) >> > >> > diff --git a/src/mesa/drivers/dri/i965/gen7_l3_state.c b/src/mesa/drivers/ > dri/i965/gen7_l3_state.c >> > index 0c1813f..c4babc2 100644 >> > --- a/src/mesa/drivers/dri/i965/gen7_l3_state.c >> > +++ b/src/mesa/drivers/dri/i965/gen7_l3_state.c >> > @@ -298,7 +298,12 @@ static struct brw_l3_weights >> > get_pipeline_state_l3_weights(const struct brw_context *brw) >> > { >> > const struct brw_stage_state *stage_states[] = { >> > - >vs.base, >gs.base, >wm.base, >cs.base >> > + [MESA_SHADER_VERTEX] = >vs.base, >> > + [MESA_SHADER_TESS_CTRL] = >tcs.base, >> > + [MESA_SHADER_TESS_EVAL] = >tes.base, >> > + [MESA_SHADER_GEOMETRY] = >gs.base, >> > + [MESA_SHADER_FRAGMENT] = >wm.base, >> > + [MESA_SHADER_COMPUTE] = >cs.base >> >> Because the ordering of the stage_states entries is fully immaterial now >> (its just a set of brw_stage_state structs with no ordering implied), >> the designated initializers are pretty much just noise, would you mind >> leaving them out? With that changed this patch is: >> >> Reviewed-by: Francisco Jerez > > Ah, sorry, I pushed it a few hours ago with Jordan's review... > > The order definitely doesn't matter, but I thought the designated > initializers made it easy to see that they were all there. > > I'm happy to remove them if you prefer, though. Want me to send > a follow-up patch to do that? No worries, I just find it slightly redundant but if you like it this way... ;) > > --Ken signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: replace _strtoui64() with strtoull() for MSVC
On 11/02/16 23:08, Timothy Arceri wrote: Now that MSVC 2013 is required we can remove this. --- src/compiler/glsl/glsl_lexer.ll | 4 1 file changed, 4 deletions(-) diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll index e59f93e..9704fc7 100644 --- a/src/compiler/glsl/glsl_lexer.ll +++ b/src/compiler/glsl/glsl_lexer.ll @@ -113,11 +113,7 @@ literal_integer(char *text, int len, struct _mesa_glsl_parse_state *state, if (base == 16) digits += 2; -#ifdef _MSC_VER - unsigned __int64 value = _strtoui64(digits, NULL, base); -#else unsigned long long value = strtoull(digits, NULL, base); -#endif lval->n = (int)value; Looks good. Reviewed-by: Jose Fonseca___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] compiler/glsl: Fix uniform location counting.
This patch moves the calculation of current uniforms to link_uniforms, which makes use of UniformRemapTable which stores all the reserved uniform locations. Location assignment for implicit uniforms now tries to use any gaps left in the table after the location assignment for explicit uniforms. This gives us more space to store more uniforms. Patch is based on earlier patch with following changes/additions: 1: Move the counting of explicit locations to check_explicit_uniform_locations and then pass the number to link_assign_uniform_locations. 2: Count the number of empty slots in UniformRemapTable and store them in a list_head. 3: Try to find an empty slot for implicit locations from the list, if that fails resize UniformRemapTable. Fixes following CTS tests: ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array Signed-off-by: Tapani PälliSigned-off-by: Plamena Manolova Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93696 --- src/compiler/glsl/link_uniforms.cpp | 85 - src/compiler/glsl/linker.cpp| 73 --- src/compiler/glsl/linker.h | 17 +++- src/mesa/main/mtypes.h | 8 4 files changed, 148 insertions(+), 35 deletions(-) diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp index 7072c16..aa07de3 100644 --- a/src/compiler/glsl/link_uniforms.cpp +++ b/src/compiler/glsl/link_uniforms.cpp @@ -1038,9 +1038,43 @@ assign_hidden_uniform_slot_id(const char *name, unsigned hidden_id, uniform_size->map->put(hidden_uniform_start + hidden_id, name); } +/** + * Search through the list of empty blocks to find one that fits the current + * uniform. + */ +static int +find_empty_block(struct gl_shader_program *prog, + struct gl_uniform_storage *uniform) +{ + const unsigned entries = MAX2(1, uniform->array_elements); + +foreach_list_typed(struct empty_uniform_block, block, link, + >EmptyUniformLocations) { + /* Found a block with enough slots to fit the uniform */ + if (block->slots == entries) { + unsigned start = block->start; + exec_node_remove(>link); + ralloc_free(block); + + return start; + /* Found a block with more slots than needed. It can still be used. */ + } else if (block->slots > entries) { + unsigned start = block->start; + block->start += entries; + block->slots -= entries; + + return start; + } + } + + return -1; +} + void link_assign_uniform_locations(struct gl_shader_program *prog, - unsigned int boolean_true) + unsigned int boolean_true, + unsigned int num_explicit_uniform_locs, + unsigned int max_uniform_locs) { ralloc_free(prog->UniformStorage); prog->UniformStorage = NULL; @@ -1131,6 +1165,9 @@ link_assign_uniform_locations(struct gl_shader_program *prog, parcel_out_uniform_storage parcel(prog, prog->UniformHash, uniforms, data); + unsigned total_entries = num_explicit_uniform_locs; + unsigned empty_locs = prog->NumUniformRemapTable - num_explicit_uniform_locs; + for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) { if (prog->_LinkedShaders[i] == NULL) continue; @@ -1194,21 +1231,43 @@ link_assign_uniform_locations(struct gl_shader_program *prog, /* how many new entries for this uniform? */ const unsigned entries = MAX2(1, uniforms[i].array_elements); - /* resize remap table to fit new entries */ - prog->UniformRemapTable = - reralloc(prog, - prog->UniformRemapTable, - gl_uniform_storage *, - prog->NumUniformRemapTable + entries); + /* Find UniformRemapTable for empty blocks where we can fit this uniform. */ + int chosen_location = -1; + + if (empty_locs) + chosen_location = find_empty_block(prog, [i]); + + if (chosen_location != -1) { + empty_locs -= entries; + } else { + chosen_location = prog->NumUniformRemapTable; + + /* Add new entries to the total amount of entries. */ + total_entries += entries; + + /* resize remap table to fit new entries */ + prog->UniformRemapTable = +reralloc(prog, + prog->UniformRemapTable, + gl_uniform_storage *, + prog->NumUniformRemapTable + entries); + prog->NumUniformRemapTable += entries; + } /* set pointers for this uniform */ for (unsigned j = 0; j < entries; j++) - prog->UniformRemapTable[prog->NumUniformRemapTable+j] = [i]; +
[Mesa-dev] [Bug 38454] [KMS] ATI RV280 ennoying many OpenGL troubles
https://bugs.freedesktop.org/show_bug.cgi?id=38454 Timothy Arcerichanged: What|Removed |Added Component|Mesa core |Drivers/DRI/r200 Assignee|mesa-dev@lists.freedesktop. |dri-devel@lists.freedesktop |org |.org -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 54369] Make fails on Debian Squeeze 644
https://bugs.freedesktop.org/show_bug.cgi?id=54369 Timothy Arcerichanged: What|Removed |Added Status|NEEDINFO|RESOLVED Resolution|--- |NOTABUG --- Comment #3 from Timothy Arceri --- No reply and build system has changed a lot since report. Closing. -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: Use _aligned_malloc/free for MinGW too.
We already use these for gallium in src/gallium/auxiliary/os/os_memory_stdc.h and it's always better to minimize divergences between MinGW and MSVC. --- src/mesa/main/imports.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 230ebbc..14cd588 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -89,7 +89,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) if (err) return NULL; return mem; -#elif defined(_WIN32) && defined(_MSC_VER) +#elif defined(_WIN32) return _aligned_malloc(bytes, alignment); #else uintptr_t ptr, buf; @@ -131,7 +131,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment) } return mem; -#elif defined(_WIN32) && defined(_MSC_VER) +#elif defined(_WIN32) void *mem; mem = _aligned_malloc(bytes, alignment); @@ -178,7 +178,7 @@ _mesa_align_free(void *ptr) { #if defined(HAVE_POSIX_MEMALIGN) free(ptr); -#elif defined(_WIN32) && defined(_MSC_VER) +#elif defined(_WIN32) _aligned_free(ptr); #else if (ptr) { @@ -196,7 +196,7 @@ void * _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize, unsigned long alignment) { -#if defined(_WIN32) && defined(_MSC_VER) +#if defined(_WIN32) (void) oldSize; return _aligned_realloc(oldBuffer, newSize, alignment); #else -- 2.5.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 64952] Build failure in egl-static when using llvm-3.3
https://bugs.freedesktop.org/show_bug.cgi?id=64952 Timothy Arcerichanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |NOTABUG --- Comment #3 from Timothy Arceri --- No reply in 3 years. Closing. -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] include, gallium: Remove pre-MSVC 2013 compatibility.
On 11/02/16 22:13, Emil Velikov wrote: On 11 February 2016 at 13:02, Jose Fonsecawrote: --- Makefile.am | 1 - include/c99/inttypes.h| 305 -- include/c99/stdbool.h | 46 - include/c99/stdint.h | 247 include/c99_compat.h | 8 +- include/c99_math.h| 49 + src/gallium/auxiliary/util/u_cpu_detect.c | 3 +- 7 files changed, 10 insertions(+), 649 deletions(-) delete mode 100644 include/c99/inttypes.h delete mode 100644 include/c99/stdbool.h delete mode 100644 include/c99/stdint.h Seems like I was too late for the fun - there's a couple of cases in src/util/u_atomic.h and src/mesa/main/imports.h. Ah, thanks. I don't know how I missed those. They were trivial to remove so I went ahead and pushed a couple commits to remove them. Thank you Jose and everyone else involved behind the scenes, for all the work to make this happen ! I'm equally happy not to have to support MSVC 2008 anymore, but I can't take much credit -- Mesa and LLVM and most of our code was fairly portable to start with --, but transitioning the build systems, installation code, and everything else away from compilers bundled with Windows SDK 7.x to the full Microsoft Visual Studio suite was the big hurdle. Jose ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 78666] [r600g glsl-1.20] fs-const-array-of-struct-of-array broken on 6550D
https://bugs.freedesktop.org/show_bug.cgi?id=78666 Timothy Arcerichanged: What|Removed |Added Resolution|--- |WORKSFORME Status|NEW |RESOLVED --- Comment #4 from Timothy Arceri --- This was likely fixed a while ago. Tested and working fine on: OpenGL renderer string: Gallium 0.4 on AMD TURKS (DRM 2.41.0, LLVM 3.7.0) OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.1.0 (git-525f3c2) -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] include, gallium: Remove pre-MSVC 2013 compatibility.
On Fri, 2016-02-12 at 10:45 +, Jose Fonseca wrote: > On 11/02/16 22:13, Emil Velikov wrote: > > On 11 February 2016 at 13:02, Jose Fonseca> > wrote: > > > --- > > > Makefile.am | 1 - > > > include/c99/inttypes.h| 305 - > > > - > > > include/c99/stdbool.h | 46 - > > > include/c99/stdint.h | 247 - > > > --- > > > include/c99_compat.h | 8 +- > > > include/c99_math.h| 49 + > > > src/gallium/auxiliary/util/u_cpu_detect.c | 3 +- > > > 7 files changed, 10 insertions(+), 649 deletions(-) > > > delete mode 100644 include/c99/inttypes.h > > > delete mode 100644 include/c99/stdbool.h > > > delete mode 100644 include/c99/stdint.h > > > > > Seems like I was too late for the fun - there's a couple of cases > > in > > src/util/u_atomic.h and src/mesa/main/imports.h. > > Ah, thanks. I don't know how I missed those. > > They were trivial to remove so I went ahead and pushed a couple > commits > to remove them. > > > Thank you Jose and everyone else involved behind the scenes, for > > all > > the work to make this happen ! > > I'm equally happy not to have to support MSVC 2008 anymore, but I > can't > take much credit -- Mesa and LLVM and most of our code was fairly > portable to start with --, but transitioning the build systems, > installation code, and everything else away from compilers bundled > with > Windows SDK 7.x to the full Microsoft Visual Studio suite was the > big > hurdle. I also noticed this one today https://patchwork.freedesktop.org/patch/73404/ > > Jose > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 30489] mesa 7.9 fails to build on 32bit system with 64bit kernel
https://bugs.freedesktop.org/show_bug.cgi?id=30489 Timothy Arcerichanged: What|Removed |Added Resolution|--- |WONTFIX Status|NEW |RESOLVED --- Comment #2 from Timothy Arceri --- Not sure about Mesa 7.9 but current versions of Mesa cross compile just fine. -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 42154] g++: error: swrast_dri.so.tmp: No such file or directory on build for radeon 600g
https://bugs.freedesktop.org/show_bug.cgi?id=42154 Timothy Arcerichanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |NOTABUG --- Comment #1 from Timothy Arceri --- (In reply to Arthur Marsh from comment #0) > I tried to build mesa from git using the following: > > ./configure --prefix=/usr --enable-driglx-direct > --enable-gallium --enable-gles-overlay > --enable-gles1 --enable-gles2 --enable-glx-tls > --with-driver=dri --with-dri-driverdir=/usr/lib/dri > --with-egl-platforms='drm x11' > --with-state-trackers=egl,glx,dri,vega --with-dri-drivers=r600 > --enable-gallium-r600 --enable-shared-glapi > configure: WARNING: unrecognized options: --enable-gallium, > --enable-gles-overlay, --with-state-trackers, --enable-gallium-r600 > Looks like there was a problem with the configure options. The r600 driver builds fine and there have been a lot of updates to the build system since this bug report. Closing. -- You are receiving this mail because: You are the assignee for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/5] mesa: remove _ARB suffix from cube map enums
Ping. This is a pretty simple set of patches. -Brian On 02/11/2016 08:35 AM, Brian Paul wrote: Just minor clean-up so we're consistent everywhere. --- src/mesa/main/attrib.c | 4 ++-- src/mesa/main/enable.c | 4 ++-- src/mesa/main/genmipmap.c | 2 +- src/mesa/main/get.c | 2 +- src/mesa/main/mipmap.c | 14 +++--- src/mesa/main/texgetimage.c | 14 +++--- src/mesa/main/teximage.c| 34 +- src/mesa/main/teximage.h| 4 ++-- src/mesa/main/texobj.c | 26 +- src/mesa/main/texparam.c| 14 +++--- src/mesa/main/texstate.c| 2 +- 11 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 08f1317..61f7036 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -766,7 +766,7 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate) _mesa_set_enable(ctx, GL_TEXTURE_2D, !!(unit->Enabled & TEXTURE_2D_BIT)); _mesa_set_enable(ctx, GL_TEXTURE_3D, !!(unit->Enabled & TEXTURE_3D_BIT)); if (ctx->Extensions.ARB_texture_cube_map) { - _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB, + _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, !!(unit->Enabled & TEXTURE_CUBE_BIT)); } if (ctx->Extensions.NV_texture_rectangle) { @@ -837,7 +837,7 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate) /* don't restore state for unsupported targets to prevent * raising GL errors. */ - if (obj->Target == GL_TEXTURE_CUBE_MAP_ARB && + if (obj->Target == GL_TEXTURE_CUBE_MAP && !ctx->Extensions.ARB_texture_cube_map) { continue; } diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 3fd3c27..3985457 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -749,7 +749,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) return; /* GL_ARB_texture_cube_map */ - case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_CUBE_MAP: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_enum_error; CHECK_EXTENSION(ARB_texture_cube_map, cap); @@ -1450,7 +1450,7 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled; /* GL_ARB_texture_cube_map */ - case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_CUBE_MAP: CHECK_EXTENSION(ARB_texture_cube_map); return is_texture_enabled(ctx, TEXTURE_CUBE_BIT); diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c index 4ec8385..6c2d31d 100644 --- a/src/mesa/main/genmipmap.c +++ b/src/mesa/main/genmipmap.c @@ -123,7 +123,7 @@ _mesa_generate_texture_mipmap(struct gl_context *ctx, GLuint face; for (face = 0; face < 6; face++) { ctx->Driver.GenerateMipmap(ctx, - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + face, texObj); + GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texObj); } } else { diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 9005dc5..f40c570 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -642,7 +642,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_TEXTURE_3D: - case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_CUBE_MAP: case GL_TEXTURE_RECTANGLE_NV: case GL_TEXTURE_EXTERNAL_OES: v->value_bool = _mesa_IsEnabled(d->pname); diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 5046995..7fd6fbf 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1715,12 +1715,12 @@ _mesa_generate_mipmap_level(GLenum target, dstWidth, dstData[0]); break; case GL_TEXTURE_2D: - case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: make_2d_mipmap(datatype, comps, border, srcWidth, srcHeight, srcData[0], srcRowStride, dstWidth, dstHeight, dstData[0], dstRowStride); @@ -2024,7 +2024,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, /* only two types of compressed textures at this time */ assert(texObj->Target == GL_TEXTURE_2D || texObj->Target == GL_TEXTURE_2D_ARRAY
Re: [Mesa-dev] [RFC] vc4: Remove logically dead variable 'handled_qinst_cond'
Thanks Eric, that makes sense. I'll respin the patch, confirm no piglit regressions and send it back to the mailing list for your R-b. Regards, Rhys On Friday, February 12, 2016, Eric Anholtwrote: > Rhys Kidd > writes: > > > Variable no longer is read, and always set to true. > > > > Accordingly, the later assert() serves no active current purpose. The > prior > > limb of the test 'qinst->cond == QPU_COND_ALWAYS' will never trigger an > assert() > > as is. If it did previously define a relevant test, this should be > revisited > > in a subsequent patch. > > Looks like just a typo, was supposed to be set to false at the top. > Only the default case handles a cond on the qinst so far, so we want to > be sure that we didn't try to put a cond on any other type of qinst. > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Use _aligned_malloc/free for MinGW too.
On 02/12/2016 06:23 AM, Jose Fonseca wrote: We already use these for gallium in src/gallium/auxiliary/os/os_memory_stdc.h and it's always better to minimize divergences between MinGW and MSVC. --- src/mesa/main/imports.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 230ebbc..14cd588 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -89,7 +89,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) if (err) return NULL; return mem; -#elif defined(_WIN32) && defined(_MSC_VER) +#elif defined(_WIN32) return _aligned_malloc(bytes, alignment); #else uintptr_t ptr, buf; @@ -131,7 +131,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment) } return mem; -#elif defined(_WIN32) && defined(_MSC_VER) +#elif defined(_WIN32) void *mem; mem = _aligned_malloc(bytes, alignment); @@ -178,7 +178,7 @@ _mesa_align_free(void *ptr) { #if defined(HAVE_POSIX_MEMALIGN) free(ptr); -#elif defined(_WIN32) && defined(_MSC_VER) +#elif defined(_WIN32) _aligned_free(ptr); #else if (ptr) { @@ -196,7 +196,7 @@ void * _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize, unsigned long alignment) { -#if defined(_WIN32) && defined(_MSC_VER) +#if defined(_WIN32) (void) oldSize; return _aligned_realloc(oldBuffer, newSize, alignment); #else Reviewed-by: Brian Paul___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: Fix test for big-endian architecture in compiler.h
Hi, i think i found & fixed a bug in mesa concerning tests for big-endian machines. The defines tested don't exist or are wrongly defined so the test (probably) never fires. The gcc defines on my machine concerning big-endian are jochen@mac-mini:~/sources/mesa$ gcc -dM -E - < /dev/null | grep BIG #define __BIGGEST_ALIGNMENT__ 16 #define __BIG_ENDIAN__ 1 #define __FLOAT_WORD_ORDER__ __ORDER_BIG_ENDIAN__ #define _BIG_ENDIAN 1 #define __ORDER_BIG_ENDIAN__ 4321 #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ The tested values in current mesa are quite different :-) The following patch fixes this. diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index c5ee741..99c63cb 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -52,7 +52,7 @@ extern "C" { * Try to use a runtime test instead. * For now, only used by some DRI hardware drivers for color/texel packing. */ -#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN +#if defined(__BYTE_ORDER__) && defined(__BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ #if defined(__linux__) #include #define CPU_TO_LE32( x ) bswap_32( x ) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: need to check resource and set length even if bufSize is 0
This fixes a number of dEQP tests, such as: dEQP-GLES31.functional.program_interface_query.buffer_limited_query.resource_query It was expecting the length to be set even in the bufSize == 0 case. Also _mesa_get_program_resourceiv does some error checking on the resource which should probably happen even in the bufSize == 0 case as well although there's no dEQP test for that. Signed-off-by: Ilia Mirkin--- src/mesa/main/program_resource.c | 4 1 file changed, 4 deletions(-) diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c index 50659b0..0d9f8ae 100644 --- a/src/mesa/main/program_resource.c +++ b/src/mesa/main/program_resource.c @@ -357,10 +357,6 @@ _mesa_GetProgramResourceiv(GLuint program, GLenum programInterface, return; } - /* No need to write any properties, user requested none. */ - if (bufSize == 0) - return; - _mesa_get_program_resourceiv(shProg, programInterface, index, propCount, props, bufSize, length, params); } -- 2.4.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/7] st/mesa: use cso_save/restore_state() in st_cb_texture.c
This simplifies the error handling code too. --- src/mesa/state_tracker/st_cb_texture.c | 55 ++ 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 559347e..a4c4648 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1334,6 +1334,22 @@ try_pbo_upload_common(struct gl_context *ctx, return false; } + cso_save_state(cso, (CSO_BIT_FRAGMENT_SAMPLER_VIEWS | +CSO_BIT_VERTEX_ELEMENTS | +CSO_BIT_AUX_VERTEX_BUFFER_SLOT | +CSO_BIT_FRAMEBUFFER | +CSO_BIT_VIEWPORT | +CSO_BIT_BLEND | +CSO_BIT_RASTERIZER | +CSO_BIT_VERTEX_SHADER | +CSO_BIT_GEOMETRY_SHADER | +CSO_BIT_TESSCTRL_SHADER | +CSO_BIT_TESSEVAL_SHADER | +CSO_BIT_FRAGMENT_SHADER | +CSO_BIT_STREAM_OUTPUTS)); + cso_save_constant_buffer_slot0(cso, PIPE_SHADER_FRAGMENT); + + /* Set up the sampler_view */ { unsigned first_element = buf_offset; @@ -1346,7 +1362,7 @@ try_pbo_upload_common(struct gl_context *ctx, assert((last_element + 1) * bytes_per_pixel <= buffer->width0); if (last_element - first_element > ctx->Const.MaxTextureBufferSize - 1) - return false; + goto fail; memset(, 0, sizeof(templ)); templ.format = src_format; @@ -1359,9 +1375,8 @@ try_pbo_upload_common(struct gl_context *ctx, sampler_view = pipe->create_sampler_view(pipe, buffer, ); if (sampler_view == NULL) - return false; + goto fail; - cso_save_fragment_sampler_views(cso); cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, 1, _view); pipe_sampler_view_reference(_view, NULL); @@ -1386,7 +1401,7 @@ try_pbo_upload_common(struct gl_context *ctx, u_upload_alloc(st->uploader, 0, 8 * sizeof(float), 4, _offset, , (void **) ); if (!verts) - goto fail_vertex_upload; + goto fail; verts[0] = x0; verts[1] = y0; @@ -1404,10 +1419,8 @@ try_pbo_upload_common(struct gl_context *ctx, velem.vertex_buffer_index = cso_get_aux_vertex_buffer_slot(cso); velem.src_format = PIPE_FORMAT_R32G32_FLOAT; - cso_save_vertex_elements(cso); cso_set_vertex_elements(cso, 1, ); - cso_save_aux_vertex_buffer_slot(cso); cso_set_vertex_buffers(cso, velem.vertex_buffer_index, 1, ); pipe_resource_reference(, NULL); @@ -1436,7 +1449,7 @@ try_pbo_upload_common(struct gl_context *ctx, st->ctx->Const.UniformBufferOffsetAlignment, , _offset, ); if (!cb.buffer) -goto fail_constant_upload; +goto fail; u_upload_unmap(st->constbuf_uploader); } else { @@ -1446,7 +1459,6 @@ try_pbo_upload_common(struct gl_context *ctx, } cb.buffer_size = sizeof(constants); - cso_save_constant_buffer_slot0(cso, PIPE_SHADER_FRAGMENT); cso_set_constant_buffer(cso, PIPE_SHADER_FRAGMENT, 0, ); pipe_resource_reference(, NULL); @@ -1461,7 +1473,6 @@ try_pbo_upload_common(struct gl_context *ctx, fb.nr_cbufs = 1; pipe_surface_reference([0], surface); - cso_save_framebuffer(cso); cso_set_framebuffer(cso, ); pipe_surface_reference([0], NULL); @@ -1477,36 +1488,27 @@ try_pbo_upload_common(struct gl_context *ctx, vp.translate[1] = 0.5f * surface->height; vp.translate[2] = 0.0f; - cso_save_viewport(cso); cso_set_viewport(cso, ); } /* Blend state */ - cso_save_blend(cso); cso_set_blend(cso, >pbo_upload.blend); /* Rasterizer state */ - cso_save_rasterizer(cso); cso_set_rasterizer(cso, >pbo_upload.raster); /* Set up the shaders */ - cso_save_vertex_shader(cso); cso_set_vertex_shader_handle(cso, st->pbo_upload.vs); - cso_save_geometry_shader(cso); cso_set_geometry_shader_handle(cso, depth != 1 ? st->pbo_upload.gs : NULL); - cso_save_tessctrl_shader(cso); cso_set_tessctrl_shader_handle(cso, NULL); - cso_save_tesseval_shader(cso); cso_set_tesseval_shader_handle(cso, NULL); - cso_save_fragment_shader(cso); cso_set_fragment_shader_handle(cso, st->pbo_upload.fs); /* Disable stream output */ - cso_save_stream_outputs(cso); cso_set_stream_outputs(cso, 0, NULL, 0); if (depth == 1) { @@ -1518,22 +1520,9 @@ try_pbo_upload_common(struct gl_context *ctx, success = true; - cso_restore_framebuffer(cso); - cso_restore_viewport(cso); - cso_restore_blend(cso); - cso_restore_rasterizer(cso); - cso_restore_vertex_shader(cso); - cso_restore_geometry_shader(cso); -
[Mesa-dev] [PATCH 1/4] st/mesa: used _mesa_num_tex_faces() in st_finalize_texture()
--- src/mesa/state_tracker/st_cb_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index a4c4648..09ff4c1 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -2739,7 +2739,7 @@ st_finalize_texture(struct gl_context *ctx, { struct st_context *st = st_context(ctx); struct st_texture_object *stObj = st_texture_object(tObj); - const GLuint nr_faces = (stObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; + const GLuint nr_faces = _mesa_num_tex_faces(stObj->base.Target); GLuint face; const struct st_texture_image *firstImage; enum pipe_format firstImageFormat; -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 6/7] postprocess: use new cso_save/restore_state() functions
--- src/gallium/auxiliary/postprocess/pp_run.c | 58 +++--- 1 file changed, 20 insertions(+), 38 deletions(-) diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c index c6c7b88..9dc8fb5 100644 --- a/src/gallium/auxiliary/postprocess/pp_run.c +++ b/src/gallium/auxiliary/postprocess/pp_run.c @@ -115,27 +115,27 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in, } /* save state (restored below) */ - cso_save_blend(cso); - cso_save_depth_stencil_alpha(cso); - cso_save_fragment_shader(cso); - cso_save_framebuffer(cso); - cso_save_tessctrl_shader(cso); - cso_save_tesseval_shader(cso); - cso_save_geometry_shader(cso); - cso_save_rasterizer(cso); - cso_save_sample_mask(cso); - cso_save_min_samples(cso); - cso_save_fragment_samplers(cso); - cso_save_fragment_sampler_views(cso); - cso_save_stencil_ref(cso); - cso_save_stream_outputs(cso); - cso_save_vertex_elements(cso); - cso_save_vertex_shader(cso); - cso_save_viewport(cso); - cso_save_aux_vertex_buffer_slot(cso); + cso_save_state(cso, (CSO_BIT_BLEND | +CSO_BIT_DEPTH_STENCIL_ALPHA | +CSO_BIT_FRAGMENT_SHADER | +CSO_BIT_FRAMEBUFFER | +CSO_BIT_TESSCTRL_SHADER | +CSO_BIT_TESSEVAL_SHADER | +CSO_BIT_GEOMETRY_SHADER | +CSO_BIT_RASTERIZER | +CSO_BIT_SAMPLE_MASK | +CSO_BIT_MIN_SAMPLES | +CSO_BIT_FRAGMENT_SAMPLERS | +CSO_BIT_FRAGMENT_SAMPLER_VIEWS | +CSO_BIT_STENCIL_REF | +CSO_BIT_STREAM_OUTPUTS | +CSO_BIT_VERTEX_ELEMENTS | +CSO_BIT_VERTEX_SHADER | +CSO_BIT_VIEWPORT | +CSO_BIT_AUX_VERTEX_BUFFER_SLOT | +CSO_BIT_RENDER_CONDITION)); cso_save_constant_buffer_slot0(cso, PIPE_SHADER_VERTEX); cso_save_constant_buffer_slot0(cso, PIPE_SHADER_FRAGMENT); - cso_save_render_condition(cso); /* set default state */ cso_set_sample_mask(cso, ~0); @@ -186,27 +186,9 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in, } /* restore state we changed */ - cso_restore_blend(cso); - cso_restore_depth_stencil_alpha(cso); - cso_restore_fragment_shader(cso); - cso_restore_framebuffer(cso); - cso_restore_tessctrl_shader(cso); - cso_restore_tesseval_shader(cso); - cso_restore_geometry_shader(cso); - cso_restore_rasterizer(cso); - cso_restore_sample_mask(cso); - cso_restore_min_samples(cso); - cso_restore_fragment_samplers(cso); - cso_restore_fragment_sampler_views(cso); - cso_restore_stencil_ref(cso); - cso_restore_stream_outputs(cso); - cso_restore_vertex_elements(cso); - cso_restore_vertex_shader(cso); - cso_restore_viewport(cso); - cso_restore_aux_vertex_buffer_slot(cso); + cso_restore_state(cso); cso_restore_constant_buffer_slot0(cso, PIPE_SHADER_VERTEX); cso_restore_constant_buffer_slot0(cso, PIPE_SHADER_FRAGMENT); - cso_restore_render_condition(cso); pipe_resource_reference(>depth, NULL); pipe_resource_reference(, NULL); -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/7] cso: add new cso_save/restore_state() functions
cso_save_state() takes a bitmask of state items to save. Calling cso_restore_state() restores those states. --- src/gallium/auxiliary/cso_cache/cso_context.c | 109 ++ src/gallium/auxiliary/cso_cache/cso_context.h | 24 ++ 2 files changed, 133 insertions(+) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index a05c1c7..cbddb06 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -71,6 +71,8 @@ struct cso_context { boolean has_tessellation; boolean has_streamout; + unsigned saved_state; /**< bitmask of CSO_BIT_x flags */ + struct pipe_sampler_view *fragment_views[PIPE_MAX_SHADER_SAMPLER_VIEWS]; unsigned nr_fragment_views; @@ -1420,6 +1422,113 @@ cso_restore_constant_buffer_slot0(struct cso_context *cso, NULL); } + +/** + * Save all the CSO state items specified by the state_mask bitmask + * of CSO_BIT_x flags. + */ +void +cso_save_state(struct cso_context *cso, unsigned state_mask) +{ + assert(cso->saved_state == 0); + + cso->saved_state = state_mask; + + if (state_mask & CSO_BIT_AUX_VERTEX_BUFFER_SLOT) + cso_save_aux_vertex_buffer_slot(cso); + if (state_mask & CSO_BIT_BLEND) + cso_save_blend(cso); + if (state_mask & CSO_BIT_DEPTH_STENCIL_ALPHA) + cso_save_depth_stencil_alpha(cso); + if (state_mask & CSO_BIT_FRAGMENT_SAMPLERS) + cso_save_fragment_samplers(cso); + if (state_mask & CSO_BIT_FRAGMENT_SAMPLER_VIEWS) + cso_save_fragment_sampler_views(cso); + if (state_mask & CSO_BIT_FRAGMENT_SHADER) + cso_save_fragment_shader(cso); + if (state_mask & CSO_BIT_FRAMEBUFFER) + cso_save_framebuffer(cso); + if (state_mask & CSO_BIT_GEOMETRY_SHADER) + cso_save_geometry_shader(cso); + if (state_mask & CSO_BIT_MIN_SAMPLES) + cso_save_min_samples(cso); + if (state_mask & CSO_BIT_RASTERIZER) + cso_save_rasterizer(cso); + if (state_mask & CSO_BIT_RENDER_CONDITION) + cso_save_render_condition(cso); + if (state_mask & CSO_BIT_SAMPLE_MASK) + cso_save_sample_mask(cso); + if (state_mask & CSO_BIT_STENCIL_REF) + cso_save_stencil_ref(cso); + if (state_mask & CSO_BIT_STREAM_OUTPUTS) + cso_save_stream_outputs(cso); + if (state_mask & CSO_BIT_TESSCTRL_SHADER) + cso_save_tessctrl_shader(cso); + if (state_mask & CSO_BIT_TESSEVAL_SHADER) + cso_save_tesseval_shader(cso); + if (state_mask & CSO_BIT_VERTEX_ELEMENTS) + cso_save_vertex_elements(cso); + if (state_mask & CSO_BIT_VERTEX_SHADER) + cso_save_vertex_shader(cso); + if (state_mask & CSO_BIT_VIEWPORT) + cso_save_viewport(cso); +} + + +/** + * Restore the state which was saved by cso_save_state(). + */ +void +cso_restore_state(struct cso_context *cso) +{ + unsigned state_mask = cso->saved_state; + + assert(state_mask); + + if (state_mask & CSO_BIT_AUX_VERTEX_BUFFER_SLOT) + cso_restore_aux_vertex_buffer_slot(cso); + if (state_mask & CSO_BIT_BLEND) + cso_restore_blend(cso); + if (state_mask & CSO_BIT_DEPTH_STENCIL_ALPHA) + cso_restore_depth_stencil_alpha(cso); + if (state_mask & CSO_BIT_FRAGMENT_SAMPLERS) + cso_restore_fragment_samplers(cso); + if (state_mask & CSO_BIT_FRAGMENT_SAMPLER_VIEWS) + cso_restore_fragment_sampler_views(cso); + if (state_mask & CSO_BIT_FRAGMENT_SHADER) + cso_restore_fragment_shader(cso); + if (state_mask & CSO_BIT_FRAMEBUFFER) + cso_restore_framebuffer(cso); + if (state_mask & CSO_BIT_GEOMETRY_SHADER) + cso_restore_geometry_shader(cso); + if (state_mask & CSO_BIT_MIN_SAMPLES) + cso_restore_min_samples(cso); + if (state_mask & CSO_BIT_RASTERIZER) + cso_restore_rasterizer(cso); + if (state_mask & CSO_BIT_RENDER_CONDITION) + cso_restore_render_condition(cso); + if (state_mask & CSO_BIT_SAMPLE_MASK) + cso_restore_sample_mask(cso); + if (state_mask & CSO_BIT_STENCIL_REF) + cso_restore_stencil_ref(cso); + if (state_mask & CSO_BIT_STREAM_OUTPUTS) + cso_restore_stream_outputs(cso); + if (state_mask & CSO_BIT_TESSCTRL_SHADER) + cso_restore_tessctrl_shader(cso); + if (state_mask & CSO_BIT_TESSEVAL_SHADER) + cso_restore_tesseval_shader(cso); + if (state_mask & CSO_BIT_VERTEX_ELEMENTS) + cso_restore_vertex_elements(cso); + if (state_mask & CSO_BIT_VERTEX_SHADER) + cso_restore_vertex_shader(cso); + if (state_mask & CSO_BIT_VIEWPORT) + cso_restore_viewport(cso); + + cso->saved_state = 0; +} + + + /* drawing */ void diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 38bfb84..fa6fb18 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -188,6 +188,30 @@ void cso_save_render_condition(struct cso_context *cso); void cso_restore_render_condition(struct cso_context *cso);
[Mesa-dev] [PATCH 7/7] cso: make most of the cso_save/restore_x() functions static
Users of the CSO save/restore facility all use the new cso_save/restore_state() functions instead. --- src/gallium/auxiliary/cso_cache/cso_context.c | 108 +- src/gallium/auxiliary/cso_cache/cso_context.h | 47 --- 2 files changed, 70 insertions(+), 85 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index cbddb06..37a214d 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -427,13 +427,15 @@ enum pipe_error cso_set_blend(struct cso_context *ctx, return PIPE_OK; } -void cso_save_blend(struct cso_context *ctx) +static void +cso_save_blend(struct cso_context *ctx) { assert(!ctx->blend_saved); ctx->blend_saved = ctx->blend; } -void cso_restore_blend(struct cso_context *ctx) +static void +cso_restore_blend(struct cso_context *ctx) { if (ctx->blend != ctx->blend_saved) { ctx->blend = ctx->blend_saved; @@ -490,13 +492,15 @@ cso_set_depth_stencil_alpha(struct cso_context *ctx, return PIPE_OK; } -void cso_save_depth_stencil_alpha(struct cso_context *ctx) +static void +cso_save_depth_stencil_alpha(struct cso_context *ctx) { assert(!ctx->depth_stencil_saved); ctx->depth_stencil_saved = ctx->depth_stencil; } -void cso_restore_depth_stencil_alpha(struct cso_context *ctx) +static void +cso_restore_depth_stencil_alpha(struct cso_context *ctx) { if (ctx->depth_stencil != ctx->depth_stencil_saved) { ctx->depth_stencil = ctx->depth_stencil_saved; @@ -549,13 +553,15 @@ enum pipe_error cso_set_rasterizer(struct cso_context *ctx, return PIPE_OK; } -void cso_save_rasterizer(struct cso_context *ctx) +static void +cso_save_rasterizer(struct cso_context *ctx) { assert(!ctx->rasterizer_saved); ctx->rasterizer_saved = ctx->rasterizer; } -void cso_restore_rasterizer(struct cso_context *ctx) +static void +cso_restore_rasterizer(struct cso_context *ctx) { if (ctx->rasterizer != ctx->rasterizer_saved) { ctx->rasterizer = ctx->rasterizer_saved; @@ -583,13 +589,15 @@ void cso_delete_fragment_shader(struct cso_context *ctx, void *handle ) ctx->pipe->delete_fs_state(ctx->pipe, handle); } -void cso_save_fragment_shader(struct cso_context *ctx) +static void +cso_save_fragment_shader(struct cso_context *ctx) { assert(!ctx->fragment_shader_saved); ctx->fragment_shader_saved = ctx->fragment_shader; } -void cso_restore_fragment_shader(struct cso_context *ctx) +static void +cso_restore_fragment_shader(struct cso_context *ctx) { if (ctx->fragment_shader_saved != ctx->fragment_shader) { ctx->pipe->bind_fs_state(ctx->pipe, ctx->fragment_shader_saved); @@ -617,13 +625,15 @@ void cso_delete_vertex_shader(struct cso_context *ctx, void *handle ) ctx->pipe->delete_vs_state(ctx->pipe, handle); } -void cso_save_vertex_shader(struct cso_context *ctx) +static void +cso_save_vertex_shader(struct cso_context *ctx) { assert(!ctx->vertex_shader_saved); ctx->vertex_shader_saved = ctx->vertex_shader; } -void cso_restore_vertex_shader(struct cso_context *ctx) +static void +cso_restore_vertex_shader(struct cso_context *ctx) { if (ctx->vertex_shader_saved != ctx->vertex_shader) { ctx->pipe->bind_vs_state(ctx->pipe, ctx->vertex_shader_saved); @@ -642,12 +652,14 @@ void cso_set_framebuffer(struct cso_context *ctx, } } -void cso_save_framebuffer(struct cso_context *ctx) +static void +cso_save_framebuffer(struct cso_context *ctx) { util_copy_framebuffer_state(>fb_saved, >fb); } -void cso_restore_framebuffer(struct cso_context *ctx) +static void +cso_restore_framebuffer(struct cso_context *ctx) { if (memcmp(>fb, >fb_saved, sizeof(ctx->fb))) { util_copy_framebuffer_state(>fb, >fb_saved); @@ -684,13 +696,15 @@ cso_set_viewport_dims(struct cso_context *ctx, cso_set_viewport(ctx, ); } -void cso_save_viewport(struct cso_context *ctx) +static void +cso_save_viewport(struct cso_context *ctx) { ctx->vp_saved = ctx->vp; } -void cso_restore_viewport(struct cso_context *ctx) +static void +cso_restore_viewport(struct cso_context *ctx) { if (memcmp(>vp, >vp_saved, sizeof(ctx->vp))) { ctx->vp = ctx->vp_saved; @@ -716,12 +730,14 @@ void cso_set_sample_mask(struct cso_context *ctx, unsigned sample_mask) } } -void cso_save_sample_mask(struct cso_context *ctx) +static void +cso_save_sample_mask(struct cso_context *ctx) { ctx->sample_mask_saved = ctx->sample_mask; } -void cso_restore_sample_mask(struct cso_context *ctx) +static void +cso_restore_sample_mask(struct cso_context *ctx) { cso_set_sample_mask(ctx, ctx->sample_mask_saved); } @@ -734,12 +750,14 @@ void cso_set_min_samples(struct cso_context *ctx, unsigned min_samples) } } -void cso_save_min_samples(struct cso_context *ctx) +static void +cso_save_min_samples(struct cso_context *ctx) { ctx->min_samples_saved =
[Mesa-dev] [PATCH 5/7] gallium/hud: use new cso_save/restore_state() functions
--- src/gallium/auxiliary/hud/hud_context.c | 56 +++-- 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index 75afebe..fb99834 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -460,25 +460,25 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex) hud->constants.two_div_fb_width = 2.0f / hud->fb_width; hud->constants.two_div_fb_height = 2.0f / hud->fb_height; - cso_save_framebuffer(cso); - cso_save_sample_mask(cso); - cso_save_min_samples(cso); - cso_save_blend(cso); - cso_save_depth_stencil_alpha(cso); - cso_save_fragment_shader(cso); - cso_save_fragment_sampler_views(cso); - cso_save_fragment_samplers(cso); - cso_save_rasterizer(cso); - cso_save_viewport(cso); - cso_save_stream_outputs(cso); - cso_save_geometry_shader(cso); - cso_save_tessctrl_shader(cso); - cso_save_tesseval_shader(cso); - cso_save_vertex_shader(cso); - cso_save_vertex_elements(cso); - cso_save_aux_vertex_buffer_slot(cso); + cso_save_state(cso, (CSO_BIT_FRAMEBUFFER | +CSO_BIT_SAMPLE_MASK | +CSO_BIT_MIN_SAMPLES | +CSO_BIT_BLEND | +CSO_BIT_DEPTH_STENCIL_ALPHA | +CSO_BIT_FRAGMENT_SHADER | +CSO_BIT_FRAGMENT_SAMPLER_VIEWS | +CSO_BIT_FRAGMENT_SAMPLERS | +CSO_BIT_RASTERIZER | +CSO_BIT_VIEWPORT | +CSO_BIT_STREAM_OUTPUTS | +CSO_BIT_GEOMETRY_SHADER | +CSO_BIT_TESSCTRL_SHADER | +CSO_BIT_TESSEVAL_SHADER | +CSO_BIT_VERTEX_SHADER | +CSO_BIT_VERTEX_ELEMENTS | +CSO_BIT_AUX_VERTEX_BUFFER_SLOT | +CSO_BIT_RENDER_CONDITION)); cso_save_constant_buffer_slot0(cso, PIPE_SHADER_VERTEX); - cso_save_render_condition(cso); /* set states */ memset(_templ, 0, sizeof(surf_templ)); @@ -591,26 +591,8 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex) hud_pane_draw_colored_objects(hud, pane); } - /* restore states */ - cso_restore_framebuffer(cso); - cso_restore_sample_mask(cso); - cso_restore_min_samples(cso); - cso_restore_blend(cso); - cso_restore_depth_stencil_alpha(cso); - cso_restore_fragment_shader(cso); - cso_restore_fragment_sampler_views(cso); - cso_restore_fragment_samplers(cso); - cso_restore_rasterizer(cso); - cso_restore_viewport(cso); - cso_restore_stream_outputs(cso); - cso_restore_tessctrl_shader(cso); - cso_restore_tesseval_shader(cso); - cso_restore_geometry_shader(cso); - cso_restore_vertex_shader(cso); - cso_restore_vertex_elements(cso); - cso_restore_aux_vertex_buffer_slot(cso); + cso_restore_state(cso); cso_restore_constant_buffer_slot0(cso, PIPE_SHADER_VERTEX); - cso_restore_render_condition(cso); pipe_surface_reference(, NULL); } -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/5] mesa: remove _ARB suffix from cube map enums
On 02/12/2016 08:46 AM, Roland Scheidegger wrote: Am 11.02.2016 um 16:35 schrieb Brian Paul: Just minor clean-up so we're consistent everywhere. --- src/mesa/main/attrib.c | 4 ++-- src/mesa/main/enable.c | 4 ++-- src/mesa/main/genmipmap.c | 2 +- src/mesa/main/get.c | 2 +- src/mesa/main/mipmap.c | 14 +++--- src/mesa/main/texgetimage.c | 14 +++--- src/mesa/main/teximage.c| 34 +- src/mesa/main/teximage.h| 4 ++-- src/mesa/main/texobj.c | 26 +- src/mesa/main/texparam.c| 14 +++--- src/mesa/main/texstate.c| 2 +- 11 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 08f1317..61f7036 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -766,7 +766,7 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate) _mesa_set_enable(ctx, GL_TEXTURE_2D, !!(unit->Enabled & TEXTURE_2D_BIT)); _mesa_set_enable(ctx, GL_TEXTURE_3D, !!(unit->Enabled & TEXTURE_3D_BIT)); if (ctx->Extensions.ARB_texture_cube_map) { - _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB, + _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, !!(unit->Enabled & TEXTURE_CUBE_BIT)); } if (ctx->Extensions.NV_texture_rectangle) { @@ -837,7 +837,7 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate) /* don't restore state for unsupported targets to prevent * raising GL errors. */ - if (obj->Target == GL_TEXTURE_CUBE_MAP_ARB && + if (obj->Target == GL_TEXTURE_CUBE_MAP && !ctx->Extensions.ARB_texture_cube_map) { continue; } diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 3fd3c27..3985457 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -749,7 +749,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) return; /* GL_ARB_texture_cube_map */ - case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_CUBE_MAP: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_enum_error; CHECK_EXTENSION(ARB_texture_cube_map, cap); @@ -1450,7 +1450,7 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled; /* GL_ARB_texture_cube_map */ - case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_CUBE_MAP: CHECK_EXTENSION(ARB_texture_cube_map); return is_texture_enabled(ctx, TEXTURE_CUBE_BIT); diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c index 4ec8385..6c2d31d 100644 --- a/src/mesa/main/genmipmap.c +++ b/src/mesa/main/genmipmap.c @@ -123,7 +123,7 @@ _mesa_generate_texture_mipmap(struct gl_context *ctx, GLuint face; for (face = 0; face < 6; face++) { ctx->Driver.GenerateMipmap(ctx, - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + face, texObj); + GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texObj); } } else { diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 9005dc5..f40c570 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -642,7 +642,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_TEXTURE_1D: case GL_TEXTURE_2D: case GL_TEXTURE_3D: - case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_CUBE_MAP: case GL_TEXTURE_RECTANGLE_NV: case GL_TEXTURE_EXTERNAL_OES: v->value_bool = _mesa_IsEnabled(d->pname); diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 5046995..7fd6fbf 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1715,12 +1715,12 @@ _mesa_generate_mipmap_level(GLenum target, dstWidth, dstData[0]); break; case GL_TEXTURE_2D: - case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: make_2d_mipmap(datatype, comps, border, srcWidth, srcHeight, srcData[0], srcRowStride, dstWidth, dstHeight, dstData[0], dstRowStride); @@ -2024,7 +2024,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, /* only two types of compressed textures at this time */ assert(texObj->Target == GL_TEXTURE_2D || texObj->Target == GL_TEXTURE_2D_ARRAY ||
[Mesa-dev] [PATCH 3/4] st/mesa: use 'cso' instead of 'st->cso_context' in st_DrawTex()
--- src/mesa/state_tracker/st_cb_drawtex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index 39e4b21..d36d59b 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -256,7 +256,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; } cso_set_vertex_elements(cso, numAttribs, velements); - cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); + cso_set_stream_outputs(cso, 0, NULL, NULL); /* viewport state: viewport matching window dims */ { -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/5] mesa: remove _ARB suffix from cube map enums
Am 11.02.2016 um 16:35 schrieb Brian Paul: > Just minor clean-up so we're consistent everywhere. > --- > src/mesa/main/attrib.c | 4 ++-- > src/mesa/main/enable.c | 4 ++-- > src/mesa/main/genmipmap.c | 2 +- > src/mesa/main/get.c | 2 +- > src/mesa/main/mipmap.c | 14 +++--- > src/mesa/main/texgetimage.c | 14 +++--- > src/mesa/main/teximage.c| 34 +- > src/mesa/main/teximage.h| 4 ++-- > src/mesa/main/texobj.c | 26 +- > src/mesa/main/texparam.c| 14 +++--- > src/mesa/main/texstate.c| 2 +- > 11 files changed, 60 insertions(+), 60 deletions(-) > > diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c > index 08f1317..61f7036 100644 > --- a/src/mesa/main/attrib.c > +++ b/src/mesa/main/attrib.c > @@ -766,7 +766,7 @@ pop_texture_group(struct gl_context *ctx, struct > texture_state *texstate) >_mesa_set_enable(ctx, GL_TEXTURE_2D, !!(unit->Enabled & > TEXTURE_2D_BIT)); >_mesa_set_enable(ctx, GL_TEXTURE_3D, !!(unit->Enabled & > TEXTURE_3D_BIT)); >if (ctx->Extensions.ARB_texture_cube_map) { > - _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB, > + _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, >!!(unit->Enabled & TEXTURE_CUBE_BIT)); >} >if (ctx->Extensions.NV_texture_rectangle) { > @@ -837,7 +837,7 @@ pop_texture_group(struct gl_context *ctx, struct > texture_state *texstate) > /* don't restore state for unsupported targets to prevent >* raising GL errors. >*/ > - if (obj->Target == GL_TEXTURE_CUBE_MAP_ARB && > + if (obj->Target == GL_TEXTURE_CUBE_MAP && > !ctx->Extensions.ARB_texture_cube_map) { > continue; > } > diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c > index 3fd3c27..3985457 100644 > --- a/src/mesa/main/enable.c > +++ b/src/mesa/main/enable.c > @@ -749,7 +749,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, > GLboolean state) > return; > >/* GL_ARB_texture_cube_map */ > - case GL_TEXTURE_CUBE_MAP_ARB: > + case GL_TEXTURE_CUBE_MAP: > if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) > goto invalid_enum_error; > CHECK_EXTENSION(ARB_texture_cube_map, cap); > @@ -1450,7 +1450,7 @@ _mesa_IsEnabled( GLenum cap ) > return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled; > >/* GL_ARB_texture_cube_map */ > - case GL_TEXTURE_CUBE_MAP_ARB: > + case GL_TEXTURE_CUBE_MAP: > CHECK_EXTENSION(ARB_texture_cube_map); > return is_texture_enabled(ctx, TEXTURE_CUBE_BIT); > > diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c > index 4ec8385..6c2d31d 100644 > --- a/src/mesa/main/genmipmap.c > +++ b/src/mesa/main/genmipmap.c > @@ -123,7 +123,7 @@ _mesa_generate_texture_mipmap(struct gl_context *ctx, >GLuint face; >for (face = 0; face < 6; face++) { > ctx->Driver.GenerateMipmap(ctx, > - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + face, texObj); > + GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texObj); >} > } > else { > diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c > index 9005dc5..f40c570 100644 > --- a/src/mesa/main/get.c > +++ b/src/mesa/main/get.c > @@ -642,7 +642,7 @@ find_custom_value(struct gl_context *ctx, const struct > value_desc *d, union valu > case GL_TEXTURE_1D: > case GL_TEXTURE_2D: > case GL_TEXTURE_3D: > - case GL_TEXTURE_CUBE_MAP_ARB: > + case GL_TEXTURE_CUBE_MAP: > case GL_TEXTURE_RECTANGLE_NV: > case GL_TEXTURE_EXTERNAL_OES: >v->value_bool = _mesa_IsEnabled(d->pname); > diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c > index 5046995..7fd6fbf 100644 > --- a/src/mesa/main/mipmap.c > +++ b/src/mesa/main/mipmap.c > @@ -1715,12 +1715,12 @@ _mesa_generate_mipmap_level(GLenum target, > dstWidth, dstData[0]); >break; > case GL_TEXTURE_2D: > - case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: > - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: > - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: > - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: > - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: > - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: > + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: > + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: > + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: > + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: > + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: > + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: >make_2d_mipmap(datatype, comps, border, > srcWidth, srcHeight, srcData[0], srcRowStride, > dstWidth, dstHeight, dstData[0], dstRowStride); > @@ -2024,7 +2024,7 @@ generate_mipmap_compressed(struct gl_context *ctx, > GLenum target, > /* only two types of
[Mesa-dev] [PATCH 2/4] st/mesa: fix whitespace and add comment in st_DrawTex()
--- src/mesa/state_tracker/st_cb_drawtex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index 7e9a958..39e4b21 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -49,6 +49,7 @@ struct cached_shader /** * Simple linear list cache. * Most of the time there'll only be one cached shader. + * XXX This should be per-st_context state. */ static struct cached_shader CachedShaders[MAX_SHADERS]; static GLuint NumCachedShaders = 0; @@ -99,6 +100,7 @@ lookup_shader(struct pipe_context *pipe, return CachedShaders[i].handle; } + static void st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) @@ -158,7 +160,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, if (!vbuffer) { return; } - + z = CLAMP(z, 0.0f, 1.0f); /* positions (in clip coords) */ @@ -272,7 +274,6 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, cso_set_viewport(cso, ); } - util_draw_vertex_buffer(pipe, cso, vbuffer, cso_get_aux_vertex_buffer_slot(cso), offset, /* offset */ @@ -280,7 +281,6 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, 4, /* verts */ numAttribs); /* attribs/vert */ - pipe_resource_reference(, NULL); /* restore state */ -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/7] gallium/util: use new cso_save/restore_state() functions
--- src/gallium/auxiliary/util/u_blit.c | 52 + 1 file changed, 18 insertions(+), 34 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 9737c94..22c40d1 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -541,23 +541,23 @@ util_blit_pixels_tex(struct blit_state *ctx, PIPE_BIND_RENDER_TARGET)); /* save state (restored below) */ - cso_save_blend(ctx->cso); - cso_save_depth_stencil_alpha(ctx->cso); - cso_save_rasterizer(ctx->cso); - cso_save_sample_mask(ctx->cso); - cso_save_min_samples(ctx->cso); - cso_save_fragment_samplers(ctx->cso); - cso_save_fragment_sampler_views(ctx->cso); - cso_save_stream_outputs(ctx->cso); - cso_save_viewport(ctx->cso); - cso_save_framebuffer(ctx->cso); - cso_save_fragment_shader(ctx->cso); - cso_save_vertex_shader(ctx->cso); - cso_save_tessctrl_shader(ctx->cso); - cso_save_tesseval_shader(ctx->cso); - cso_save_geometry_shader(ctx->cso); - cso_save_vertex_elements(ctx->cso); - cso_save_aux_vertex_buffer_slot(ctx->cso); + cso_save_state(ctx->cso, (CSO_BIT_BLEND | + CSO_BIT_DEPTH_STENCIL_ALPHA | + CSO_BIT_RASTERIZER | + CSO_BIT_SAMPLE_MASK | + CSO_BIT_MIN_SAMPLES | + CSO_BIT_FRAGMENT_SAMPLERS | + CSO_BIT_FRAGMENT_SAMPLER_VIEWS | + CSO_BIT_STREAM_OUTPUTS | + CSO_BIT_VIEWPORT | + CSO_BIT_FRAMEBUFFER | + CSO_BIT_FRAGMENT_SHADER | + CSO_BIT_VERTEX_SHADER | + CSO_BIT_TESSCTRL_SHADER | + CSO_BIT_TESSEVAL_SHADER | + CSO_BIT_GEOMETRY_SHADER | + CSO_BIT_VERTEX_ELEMENTS | + CSO_BIT_AUX_VERTEX_BUFFER_SLOT)); /* set misc state we care about */ cso_set_blend(ctx->cso, >blend_write_color); @@ -625,21 +625,5 @@ util_blit_pixels_tex(struct blit_state *ctx, 2); /* attribs/vert */ /* restore state we changed */ - cso_restore_blend(ctx->cso); - cso_restore_depth_stencil_alpha(ctx->cso); - cso_restore_rasterizer(ctx->cso); - cso_restore_sample_mask(ctx->cso); - cso_restore_min_samples(ctx->cso); - cso_restore_fragment_samplers(ctx->cso); - cso_restore_fragment_sampler_views(ctx->cso); - cso_restore_viewport(ctx->cso); - cso_restore_framebuffer(ctx->cso); - cso_restore_fragment_shader(ctx->cso); - cso_restore_vertex_shader(ctx->cso); - cso_restore_tessctrl_shader(ctx->cso); - cso_restore_tesseval_shader(ctx->cso); - cso_restore_geometry_shader(ctx->cso); - cso_restore_vertex_elements(ctx->cso); - cso_restore_aux_vertex_buffer_slot(ctx->cso); - cso_restore_stream_outputs(ctx->cso); + cso_restore_state(ctx->cso); } -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4] st/mesa: rename attr variable in st_DrawTex()
Rename to 'tex_attr' to be a bit more clear. --- src/mesa/state_tracker/st_cb_drawtex.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index d36d59b..0fb54ce 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -152,7 +152,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, const GLfloat x0 = x, y0 = y, x1 = x + width, y1 = y + height; GLfloat *vbuf = NULL; - GLuint attr; + GLuint tex_attr; u_upload_alloc(st->uploader, 0, numAttribs * 4 * 4 * sizeof(GLfloat), 4, @@ -192,10 +192,10 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, SET_ATTRIB(3, 1, c[0], c[1], c[2], c[3]); semantic_names[1] = TGSI_SEMANTIC_COLOR; semantic_indexes[1] = 0; - attr = 2; + tex_attr = 2; } else { - attr = 1; + tex_attr = 1; } /* texcoords */ @@ -212,17 +212,17 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, const GLfloat t1 = (obj->CropRect[1] + obj->CropRect[3]) / ht; /*printf("crop texcoords: %g, %g .. %g, %g\n", s0, t0, s1, t1);*/ -SET_ATTRIB(0, attr, s0, t0, 0.0f, 1.0f); /* lower left */ -SET_ATTRIB(1, attr, s1, t0, 0.0f, 1.0f); /* lower right */ -SET_ATTRIB(2, attr, s1, t1, 0.0f, 1.0f); /* upper right */ -SET_ATTRIB(3, attr, s0, t1, 0.0f, 1.0f); /* upper left */ +SET_ATTRIB(0, tex_attr, s0, t0, 0.0f, 1.0f); /* lower left */ +SET_ATTRIB(1, tex_attr, s1, t0, 0.0f, 1.0f); /* lower right */ +SET_ATTRIB(2, tex_attr, s1, t1, 0.0f, 1.0f); /* upper right */ +SET_ATTRIB(3, tex_attr, s0, t1, 0.0f, 1.0f); /* upper left */ -semantic_names[attr] = st->needs_texcoord_semantic ? +semantic_names[tex_attr] = st->needs_texcoord_semantic ? TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC; /* XXX: should this use semantic index i instead of 0 ? */ -semantic_indexes[attr] = 0; +semantic_indexes[tex_attr] = 0; -attr++; +tex_attr++; } } -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 6/6] st/mesa: use new cso_set_viewport_dims() helper
On Fri, Feb 12, 2016 at 10:43 AM, Brian Paulwrote: > --- > src/mesa/state_tracker/st_cb_bitmap.c | 16 +++- > src/mesa/state_tracker/st_cb_clear.c | 13 ++--- > src/mesa/state_tracker/st_cb_drawpixels.c | 14 ++ > 3 files changed, 7 insertions(+), 36 deletions(-) > > diff --git a/src/mesa/state_tracker/st_cb_bitmap.c > b/src/mesa/state_tracker/st_cb_bitmap.c > index 5081639..5a11c0d 100644 > --- a/src/mesa/state_tracker/st_cb_bitmap.c > +++ b/src/mesa/state_tracker/st_cb_bitmap.c > @@ -267,19 +267,9 @@ setup_render_state(struct gl_context *ctx, > } > > /* viewport state: viewport matching window dims */ > - { > - const GLboolean invert = st->state.fb_orientation == Y_0_TOP; > - const GLfloat width = (GLfloat)st->state.framebuffer.width; > - const GLfloat height = (GLfloat)st->state.framebuffer.height; > - struct pipe_viewport_state vp; > - vp.scale[0] = 0.5f * width; > - vp.scale[1] = height * (invert ? -0.5f : 0.5f); > - vp.scale[2] = 0.5f; > - vp.translate[0] = 0.5f * width; > - vp.translate[1] = 0.5f * height; > - vp.translate[2] = 0.5f; > - cso_set_viewport(cso, ); > - } > + cso_set_viewport_dims(cso, st->state.framebuffer.width, > + st->state.framebuffer.height, > + st->state.fb_orientation == Y_0_TOP); > > cso_set_vertex_elements(cso, 3, st->util_velems); > > diff --git a/src/mesa/state_tracker/st_cb_clear.c > b/src/mesa/state_tracker/st_cb_clear.c > index 271f577..27925f9 100644 > --- a/src/mesa/state_tracker/st_cb_clear.c > +++ b/src/mesa/state_tracker/st_cb_clear.c > @@ -277,17 +277,8 @@ clear_with_quad(struct gl_context *ctx, unsigned > clear_buffers) > cso_set_rasterizer(cso, >clear.raster); > > /* viewport state: viewport matching window dims */ > - { > - const GLboolean invert = (st_fb_orientation(fb) == Y_0_TOP); > - struct pipe_viewport_state vp; > - vp.scale[0] = 0.5f * fb_width; > - vp.scale[1] = fb_height * (invert ? -0.5f : 0.5f); > - vp.scale[2] = 0.5f; > - vp.translate[0] = 0.5f * fb_width; > - vp.translate[1] = 0.5f * fb_height; > - vp.translate[2] = 0.5f; > - cso_set_viewport(cso, ); > - } > + cso_set_viewport_dims(st->cso_context, fb_width, fb_height, > + st_fb_orientation(fb) == Y_0_TOP); > > set_fragment_shader(st); > cso_set_tessctrl_shader_handle(cso, NULL); > diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c > b/src/mesa/state_tracker/st_cb_drawpixels.c > index 581419e..b1b61c8 100644 > --- a/src/mesa/state_tracker/st_cb_drawpixels.c > +++ b/src/mesa/state_tracker/st_cb_drawpixels.c > @@ -596,18 +596,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, > GLint y, GLfloat z, > } > > /* viewport state: viewport matching window dims */ > - { > - const float w = (float) ctx->DrawBuffer->Width; > - const float h = (float) ctx->DrawBuffer->Height; > - struct pipe_viewport_state vp; > - vp.scale[0] = 0.5f * w; > - vp.scale[1] = -0.5f * h; > - vp.scale[2] = 0.5f; > - vp.translate[0] = 0.5f * w; > - vp.translate[1] = 0.5f * h; > - vp.translate[2] = 0.5f; > - cso_set_viewport(cso, ); > - } > + cso_set_viewport_dims(cso, ctx->DrawBuffer->Width, > + ctx->DrawBuffer->Height, TRUE); Please use _mesa_geometric_width/height here instead of ctx->DrawBuffer (to support the future ARB_framebuffer_no_attachments use-case). [I believe the current patchset for that feature touched this up, but since it's not in, might as well get it right...) -ilia > > cso_set_vertex_elements(cso, 3, st->util_velems); > cso_set_stream_outputs(cso, 0, NULL, NULL); > -- > 1.9.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 6/6] st/mesa: use new cso_set_viewport_dims() helper
On 02/12/2016 09:06 AM, Ilia Mirkin wrote: On Fri, Feb 12, 2016 at 10:43 AM, Brian Paulwrote: --- src/mesa/state_tracker/st_cb_bitmap.c | 16 +++- src/mesa/state_tracker/st_cb_clear.c | 13 ++--- src/mesa/state_tracker/st_cb_drawpixels.c | 14 ++ 3 files changed, 7 insertions(+), 36 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 5081639..5a11c0d 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -267,19 +267,9 @@ setup_render_state(struct gl_context *ctx, } /* viewport state: viewport matching window dims */ - { - const GLboolean invert = st->state.fb_orientation == Y_0_TOP; - const GLfloat width = (GLfloat)st->state.framebuffer.width; - const GLfloat height = (GLfloat)st->state.framebuffer.height; - struct pipe_viewport_state vp; - vp.scale[0] = 0.5f * width; - vp.scale[1] = height * (invert ? -0.5f : 0.5f); - vp.scale[2] = 0.5f; - vp.translate[0] = 0.5f * width; - vp.translate[1] = 0.5f * height; - vp.translate[2] = 0.5f; - cso_set_viewport(cso, ); - } + cso_set_viewport_dims(cso, st->state.framebuffer.width, + st->state.framebuffer.height, + st->state.fb_orientation == Y_0_TOP); cso_set_vertex_elements(cso, 3, st->util_velems); diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 271f577..27925f9 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -277,17 +277,8 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) cso_set_rasterizer(cso, >clear.raster); /* viewport state: viewport matching window dims */ - { - const GLboolean invert = (st_fb_orientation(fb) == Y_0_TOP); - struct pipe_viewport_state vp; - vp.scale[0] = 0.5f * fb_width; - vp.scale[1] = fb_height * (invert ? -0.5f : 0.5f); - vp.scale[2] = 0.5f; - vp.translate[0] = 0.5f * fb_width; - vp.translate[1] = 0.5f * fb_height; - vp.translate[2] = 0.5f; - cso_set_viewport(cso, ); - } + cso_set_viewport_dims(st->cso_context, fb_width, fb_height, + st_fb_orientation(fb) == Y_0_TOP); set_fragment_shader(st); cso_set_tessctrl_shader_handle(cso, NULL); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 581419e..b1b61c8 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -596,18 +596,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, } /* viewport state: viewport matching window dims */ - { - const float w = (float) ctx->DrawBuffer->Width; - const float h = (float) ctx->DrawBuffer->Height; - struct pipe_viewport_state vp; - vp.scale[0] = 0.5f * w; - vp.scale[1] = -0.5f * h; - vp.scale[2] = 0.5f; - vp.translate[0] = 0.5f * w; - vp.translate[1] = 0.5f * h; - vp.translate[2] = 0.5f; - cso_set_viewport(cso, ); - } + cso_set_viewport_dims(cso, ctx->DrawBuffer->Width, + ctx->DrawBuffer->Height, TRUE); Please use _mesa_geometric_width/height here instead of ctx->DrawBuffer (to support the future ARB_framebuffer_no_attachments use-case). [I believe the current patchset for that feature touched this up, but since it's not in, might as well get it right...) Can I do that in a follow-on patch? I think the two changes should be separate. BTW, if gl_framebuffer::_HasAttachments is false, that means the glDrawPixels will effectively be a no-op, right? So the viewport size won't matter. I see other places where we use gl_framebuffer::Width/Height in the state tracker code instead of _mesa_geometric_width/height(). I suspect it may be the same story. Though, I guess it would be more consistent to use _mesa_geometric_width/height() everywhere. What do you think? -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/6] st/mesa: consolidate quad drawing code
The glClear, glBitmap and glDrawPixels code now use a new st_draw_quad() helper function. --- src/mesa/state_tracker/st_cb_bitmap.c | 66 +--- src/mesa/state_tracker/st_cb_clear.c | 91 -- src/mesa/state_tracker/st_cb_drawpixels.c | 120 ++ src/mesa/state_tracker/st_draw.c | 84 + src/mesa/state_tracker/st_draw.h | 7 ++ 5 files changed, 130 insertions(+), 238 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index b5387d7..5081639 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -41,6 +41,7 @@ #include "st_context.h" #include "st_atom.h" #include "st_atom_constbuf.h" +#include "st_draw.h" #include "st_program.h" #include "st_cb_bitmap.h" #include "st_texture.h" @@ -50,7 +51,6 @@ #include "pipe/p_shader_tokens.h" #include "util/u_inlines.h" #include "util/u_simple_shaders.h" -#include "util/u_upload_mgr.h" #include "program/prog_instruction.h" #include "cso_cache/cso_context.h" @@ -322,7 +322,6 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, { struct st_context *st = st_context(ctx); struct pipe_context *pipe = st->pipe; - struct pipe_vertex_buffer vb = {0}; const float fb_width = (float) st->state.framebuffer.width; const float fb_height = (float) st->state.framebuffer.height; const float x0 = (float) x; @@ -335,7 +334,6 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, const float clip_y0 = y0 / fb_height * 2.0f - 1.0f; const float clip_x1 = x1 / fb_width * 2.0f - 1.0f; const float clip_y1 = y1 / fb_height * 2.0f - 1.0f; - struct st_util_vertex *verts; /* limit checks */ { @@ -359,71 +357,13 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, tBot = (float) height; } - vb.stride = sizeof(struct st_util_vertex); - - u_upload_alloc(st->uploader, 0, 4 * sizeof(struct st_util_vertex), 4, - _offset, , (void **) ); - if (!vb.buffer) { + if (!st_draw_quad(st, clip_x0, clip_y0, clip_x1, clip_y1, z, + sLeft, tBot, sRight, tTop, color, 0)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBitmap"); - restore_render_state(ctx); - return; } - /* Positions are in clip coords since we need to do clipping in case -* the bitmap quad goes beyond the window bounds. -*/ - verts[0].x = clip_x0; - verts[0].y = clip_y0; - verts[0].z = z; - verts[0].r = color[0]; - verts[0].g = color[1]; - verts[0].b = color[2]; - verts[0].a = color[3]; - verts[0].s = sLeft; - verts[0].t = tTop; - - verts[1].x = clip_x1; - verts[1].y = clip_y0; - verts[1].z = z; - verts[1].r = color[0]; - verts[1].g = color[1]; - verts[1].b = color[2]; - verts[1].a = color[3]; - verts[1].s = sRight; - verts[1].t = tTop; - - verts[2].x = clip_x1; - verts[2].y = clip_y1; - verts[2].z = z; - verts[2].r = color[0]; - verts[2].g = color[1]; - verts[2].b = color[2]; - verts[2].a = color[3]; - verts[2].s = sRight; - verts[2].t = tBot; - - verts[3].x = clip_x0; - verts[3].y = clip_y1; - verts[3].z = z; - verts[3].r = color[0]; - verts[3].g = color[1]; - verts[3].b = color[2]; - verts[3].a = color[3]; - verts[3].s = sLeft; - verts[3].t = tBot; - - u_upload_unmap(st->uploader); - - cso_set_vertex_buffers(st->cso_context, - cso_get_aux_vertex_buffer_slot(st->cso_context), - 1, ); - - cso_draw_arrays(st->cso_context, PIPE_PRIM_TRIANGLE_FAN, 0, 4); - restore_render_state(ctx); - pipe_resource_reference(, NULL); - /* We uploaded modified constants, need to invalidate them. */ st->dirty.mesa |= _NEW_PROGRAM_CONSTANTS; } diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 9d043c1..b6bb6dc 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -44,6 +44,7 @@ #include "st_cb_bitmap.h" #include "st_cb_clear.h" #include "st_cb_fbo.h" +#include "st_draw.h" #include "st_format.h" #include "st_program.h" @@ -55,7 +56,6 @@ #include "util/u_framebuffer.h" #include "util/u_inlines.h" #include "util/u_simple_shaders.h" -#include "util/u_upload_mgr.h" #include "cso_cache/cso_context.h" @@ -168,77 +168,6 @@ set_vertex_shader_layered(struct st_context *st) /** - * Draw a screen-aligned quadrilateral. - * Coords are clip coords with y=0=bottom. - */ -static void -draw_quad(struct st_context *st, - float x0, float y0, float x1, float y1, GLfloat z, - unsigned num_instances, - const union pipe_color_union *color) -{ - struct cso_context *cso = st->cso_context; - struct pipe_vertex_buffer vb = {0}; - struct st_util_vertex *verts; - - vb.stride = sizeof(struct st_util_vertex); - -
[Mesa-dev] [PATCH 5/6] cso: add new cso_set_viewport_dims() helper
To simplify some viewport setting code in the state tracker. --- src/gallium/auxiliary/cso_cache/cso_context.c | 18 ++ src/gallium/auxiliary/cso_cache/cso_context.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 6b29b20..a05c1c7 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -664,6 +664,24 @@ void cso_set_viewport(struct cso_context *ctx, } } +/** + * Setup viewport state for given width and height (position is always (0,0)). + * Invert the Y axis if 'invert' is true. + */ +void +cso_set_viewport_dims(struct cso_context *ctx, + float width, float height, boolean invert) +{ + struct pipe_viewport_state vp; + vp.scale[0] = width * 0.5f; + vp.scale[1] = height * (invert ? -0.5f : 0.5f); + vp.scale[2] = 0.5f; + vp.translate[0] = 0.5f * width; + vp.translate[1] = 0.5f * height; + vp.translate[2] = 0.5f; + cso_set_viewport(ctx, ); +} + void cso_save_viewport(struct cso_context *ctx) { ctx->vp_saved = ctx->vp; diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index f0a2739..39afc15 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -159,6 +159,8 @@ void cso_restore_framebuffer(struct cso_context *cso); void cso_set_viewport(struct cso_context *cso, const struct pipe_viewport_state *vp); +void cso_set_viewport_dims(struct cso_context *ctx, + float width, float height, boolean invert); void cso_save_viewport(struct cso_context *cso); void cso_restore_viewport(struct cso_context *cso); -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/6] st/mesa: use 'cso' local var instead of st->cso_context
Just a little cleaner. --- src/mesa/state_tracker/st_cb_clear.c | 83 +-- src/mesa/state_tracker/st_cb_drawpixels.c | 2 +- src/mesa/state_tracker/st_cb_texture.c| 94 +++ 3 files changed, 89 insertions(+), 90 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index b6bb6dc..271f577 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -176,6 +176,7 @@ static void clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) { struct st_context *st = st_context(ctx); + struct cso_context *cso = st->cso_context; const struct gl_framebuffer *fb = ctx->DrawBuffer; const GLfloat fb_width = (GLfloat) fb->Width; const GLfloat fb_height = (GLfloat) fb->Height; @@ -195,21 +196,21 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) x1, y1); */ - cso_save_blend(st->cso_context); - cso_save_stencil_ref(st->cso_context); - cso_save_depth_stencil_alpha(st->cso_context); - cso_save_rasterizer(st->cso_context); - cso_save_sample_mask(st->cso_context); - cso_save_min_samples(st->cso_context); - cso_save_viewport(st->cso_context); - cso_save_fragment_shader(st->cso_context); - cso_save_stream_outputs(st->cso_context); - cso_save_vertex_shader(st->cso_context); - cso_save_tessctrl_shader(st->cso_context); - cso_save_tesseval_shader(st->cso_context); - cso_save_geometry_shader(st->cso_context); - cso_save_vertex_elements(st->cso_context); - cso_save_aux_vertex_buffer_slot(st->cso_context); + cso_save_blend(cso); + cso_save_stencil_ref(cso); + cso_save_depth_stencil_alpha(cso); + cso_save_rasterizer(cso); + cso_save_sample_mask(cso); + cso_save_min_samples(cso); + cso_save_viewport(cso); + cso_save_fragment_shader(cso); + cso_save_stream_outputs(cso); + cso_save_vertex_shader(cso); + cso_save_tessctrl_shader(cso); + cso_save_tesseval_shader(cso); + cso_save_geometry_shader(cso); + cso_save_vertex_elements(cso); + cso_save_aux_vertex_buffer_slot(cso); /* blend state: RGBA masking */ { @@ -239,7 +240,7 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) if (st->ctx->Color.DitherFlag) blend.dither = 1; } - cso_set_blend(st->cso_context, ); + cso_set_blend(cso, ); } /* depth_stencil state: always pass/set to ref value */ @@ -263,17 +264,17 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) depth_stencil.stencil[0].valuemask = 0xff; depth_stencil.stencil[0].writemask = ctx->Stencil.WriteMask[0] & 0xff; stencil_ref.ref_value[0] = ctx->Stencil.Clear; - cso_set_stencil_ref(st->cso_context, _ref); + cso_set_stencil_ref(cso, _ref); } - cso_set_depth_stencil_alpha(st->cso_context, _stencil); + cso_set_depth_stencil_alpha(cso, _stencil); } - cso_set_vertex_elements(st->cso_context, 2, st->util_velems); - cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); - cso_set_sample_mask(st->cso_context, ~0); - cso_set_min_samples(st->cso_context, 1); - cso_set_rasterizer(st->cso_context, >clear.raster); + cso_set_vertex_elements(cso, 2, st->util_velems); + cso_set_stream_outputs(cso, 0, NULL, NULL); + cso_set_sample_mask(cso, ~0); + cso_set_min_samples(cso, 1); + cso_set_rasterizer(cso, >clear.raster); /* viewport state: viewport matching window dims */ { @@ -285,12 +286,12 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) vp.translate[0] = 0.5f * fb_width; vp.translate[1] = 0.5f * fb_height; vp.translate[2] = 0.5f; - cso_set_viewport(st->cso_context, ); + cso_set_viewport(cso, ); } set_fragment_shader(st); - cso_set_tessctrl_shader_handle(st->cso_context, NULL); - cso_set_tesseval_shader_handle(st->cso_context, NULL); + cso_set_tessctrl_shader_handle(cso, NULL); + cso_set_tesseval_shader_handle(cso, NULL); if (num_layers > 1) set_vertex_shader_layered(st); @@ -314,21 +315,21 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) } /* Restore pipe state */ - cso_restore_blend(st->cso_context); - cso_restore_stencil_ref(st->cso_context); - cso_restore_depth_stencil_alpha(st->cso_context); - cso_restore_rasterizer(st->cso_context); - cso_restore_sample_mask(st->cso_context); - cso_restore_min_samples(st->cso_context); - cso_restore_viewport(st->cso_context); - cso_restore_fragment_shader(st->cso_context); - cso_restore_vertex_shader(st->cso_context); - cso_restore_tessctrl_shader(st->cso_context); - cso_restore_tesseval_shader(st->cso_context); - cso_restore_geometry_shader(st->cso_context); - cso_restore_vertex_elements(st->cso_context); - cso_restore_aux_vertex_buffer_slot(st->cso_context); - cso_restore_stream_outputs(st->cso_context); +
[Mesa-dev] [PATCH 2/6] st/mesa: overhaul vertex setup for clearing, glDrawPixels, glBitmap
Define a new st_util_vertex structure which is a bit smaller (9 floats versus the previous 12 floats per vertex). Clean up the glClear, glDrawPixels and glBitmap code that sets up the vertex data and does the drawing so it's all very similar. This can lead to more consolidation. --- src/mesa/state_tracker/st_cb_bitmap.c | 100 +++-- src/mesa/state_tracker/st_cb_clear.c | 69 --- src/mesa/state_tracker/st_cb_drawpixels.c | 140 ++ src/mesa/state_tracker/st_context.c | 25 -- src/mesa/state_tracker/st_context.h | 12 ++- 5 files changed, 185 insertions(+), 161 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 627b8cb..b5387d7 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -49,7 +49,6 @@ #include "pipe/p_defines.h" #include "pipe/p_shader_tokens.h" #include "util/u_inlines.h" -#include "util/u_draw_quad.h" #include "util/u_simple_shaders.h" #include "util/u_upload_mgr.h" #include "program/prog_instruction.h" @@ -282,7 +281,8 @@ setup_render_state(struct gl_context *ctx, cso_set_viewport(cso, ); } - cso_set_vertex_elements(cso, 3, st->velems_util_draw); + cso_set_vertex_elements(cso, 3, st->util_velems); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); } @@ -322,7 +322,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, { struct st_context *st = st_context(ctx); struct pipe_context *pipe = st->pipe; - struct pipe_resource *vbuf = NULL; + struct pipe_vertex_buffer vb = {0}; const float fb_width = (float) st->state.framebuffer.width; const float fb_height = (float) st->state.framebuffer.height; const float x0 = (float) x; @@ -335,8 +335,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, const float clip_y0 = y0 / fb_height * 2.0f - 1.0f; const float clip_x1 = x1 / fb_width * 2.0f - 1.0f; const float clip_y1 = y1 / fb_height * 2.0f - 1.0f; - float (*vertices)[3][4]; /**< vertex pos + color + texcoord */ - unsigned offset, i; + struct st_util_vertex *verts; /* limit checks */ { @@ -360,9 +359,11 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, tBot = (float) height; } - u_upload_alloc(st->uploader, 0, 4 * sizeof(vertices[0]), 4, - , , (void **) ); - if (!vbuf) { + vb.stride = sizeof(struct st_util_vertex); + + u_upload_alloc(st->uploader, 0, 4 * sizeof(struct st_util_vertex), 4, + _offset, , (void **) ); + if (!vb.buffer) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBitmap"); restore_render_state(ctx); return; @@ -371,50 +372,57 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, /* Positions are in clip coords since we need to do clipping in case * the bitmap quad goes beyond the window bounds. */ - vertices[0][0][0] = clip_x0; - vertices[0][0][1] = clip_y0; - vertices[0][2][0] = sLeft; - vertices[0][2][1] = tTop; - - vertices[1][0][0] = clip_x1; - vertices[1][0][1] = clip_y0; - vertices[1][2][0] = sRight; - vertices[1][2][1] = tTop; - - vertices[2][0][0] = clip_x1; - vertices[2][0][1] = clip_y1; - vertices[2][2][0] = sRight; - vertices[2][2][1] = tBot; - - vertices[3][0][0] = clip_x0; - vertices[3][0][1] = clip_y1; - vertices[3][2][0] = sLeft; - vertices[3][2][1] = tBot; - - /* same for all verts: */ - for (i = 0; i < 4; i++) { - vertices[i][0][2] = z; - vertices[i][0][3] = 1.0f; - vertices[i][1][0] = color[0]; - vertices[i][1][1] = color[1]; - vertices[i][1][2] = color[2]; - vertices[i][1][3] = color[3]; - vertices[i][2][2] = 0.0; /*R*/ - vertices[i][2][3] = 1.0; /*Q*/ - } + verts[0].x = clip_x0; + verts[0].y = clip_y0; + verts[0].z = z; + verts[0].r = color[0]; + verts[0].g = color[1]; + verts[0].b = color[2]; + verts[0].a = color[3]; + verts[0].s = sLeft; + verts[0].t = tTop; + + verts[1].x = clip_x1; + verts[1].y = clip_y0; + verts[1].z = z; + verts[1].r = color[0]; + verts[1].g = color[1]; + verts[1].b = color[2]; + verts[1].a = color[3]; + verts[1].s = sRight; + verts[1].t = tTop; + + verts[2].x = clip_x1; + verts[2].y = clip_y1; + verts[2].z = z; + verts[2].r = color[0]; + verts[2].g = color[1]; + verts[2].b = color[2]; + verts[2].a = color[3]; + verts[2].s = sRight; + verts[2].t = tBot; + + verts[3].x = clip_x0; + verts[3].y = clip_y1; + verts[3].z = z; + verts[3].r = color[0]; + verts[3].g = color[1]; + verts[3].b = color[2]; + verts[3].a = color[3]; + verts[3].s = sLeft; + verts[3].t = tBot; u_upload_unmap(st->uploader); - util_draw_vertex_buffer(pipe, st->cso_context, vbuf, - cso_get_aux_vertex_buffer_slot(st->cso_context), -
[Mesa-dev] [PATCH 6/6] st/mesa: use new cso_set_viewport_dims() helper
--- src/mesa/state_tracker/st_cb_bitmap.c | 16 +++- src/mesa/state_tracker/st_cb_clear.c | 13 ++--- src/mesa/state_tracker/st_cb_drawpixels.c | 14 ++ 3 files changed, 7 insertions(+), 36 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 5081639..5a11c0d 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -267,19 +267,9 @@ setup_render_state(struct gl_context *ctx, } /* viewport state: viewport matching window dims */ - { - const GLboolean invert = st->state.fb_orientation == Y_0_TOP; - const GLfloat width = (GLfloat)st->state.framebuffer.width; - const GLfloat height = (GLfloat)st->state.framebuffer.height; - struct pipe_viewport_state vp; - vp.scale[0] = 0.5f * width; - vp.scale[1] = height * (invert ? -0.5f : 0.5f); - vp.scale[2] = 0.5f; - vp.translate[0] = 0.5f * width; - vp.translate[1] = 0.5f * height; - vp.translate[2] = 0.5f; - cso_set_viewport(cso, ); - } + cso_set_viewport_dims(cso, st->state.framebuffer.width, + st->state.framebuffer.height, + st->state.fb_orientation == Y_0_TOP); cso_set_vertex_elements(cso, 3, st->util_velems); diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 271f577..27925f9 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -277,17 +277,8 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) cso_set_rasterizer(cso, >clear.raster); /* viewport state: viewport matching window dims */ - { - const GLboolean invert = (st_fb_orientation(fb) == Y_0_TOP); - struct pipe_viewport_state vp; - vp.scale[0] = 0.5f * fb_width; - vp.scale[1] = fb_height * (invert ? -0.5f : 0.5f); - vp.scale[2] = 0.5f; - vp.translate[0] = 0.5f * fb_width; - vp.translate[1] = 0.5f * fb_height; - vp.translate[2] = 0.5f; - cso_set_viewport(cso, ); - } + cso_set_viewport_dims(st->cso_context, fb_width, fb_height, + st_fb_orientation(fb) == Y_0_TOP); set_fragment_shader(st); cso_set_tessctrl_shader_handle(cso, NULL); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 581419e..b1b61c8 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -596,18 +596,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, } /* viewport state: viewport matching window dims */ - { - const float w = (float) ctx->DrawBuffer->Width; - const float h = (float) ctx->DrawBuffer->Height; - struct pipe_viewport_state vp; - vp.scale[0] = 0.5f * w; - vp.scale[1] = -0.5f * h; - vp.scale[2] = 0.5f; - vp.translate[0] = 0.5f * w; - vp.translate[1] = 0.5f * h; - vp.translate[2] = 0.5f; - cso_set_viewport(cso, ); - } + cso_set_viewport_dims(cso, ctx->DrawBuffer->Width, + ctx->DrawBuffer->Height, TRUE); cso_set_vertex_elements(cso, 3, st->util_velems); cso_set_stream_outputs(cso, 0, NULL, NULL); -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/7] st/mesa: use new cso_save/restore_state() functions
--- src/mesa/state_tracker/st_cb_bitmap.c | 36 src/mesa/state_tracker/st_cb_clear.c | 46 +++ src/mesa/state_tracker/st_cb_drawpixels.c | 46 +++ src/mesa/state_tracker/st_cb_drawtex.c| 26 ++--- 4 files changed, 53 insertions(+), 101 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 5a11c0d..6af9ade 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -213,18 +213,17 @@ setup_render_state(struct gl_context *ctx, COPY_4V(ctx->Current.Attrib[VERT_ATTRIB_COLOR0], colorSave); } - cso_save_rasterizer(cso); - cso_save_fragment_samplers(cso); - cso_save_fragment_sampler_views(cso); - cso_save_viewport(cso); - cso_save_fragment_shader(cso); - cso_save_stream_outputs(cso); - cso_save_vertex_shader(cso); - cso_save_tessctrl_shader(cso); - cso_save_tesseval_shader(cso); - cso_save_geometry_shader(cso); - cso_save_vertex_elements(cso); - cso_save_aux_vertex_buffer_slot(cso); + cso_save_state(cso, (CSO_BIT_RASTERIZER | +CSO_BIT_FRAGMENT_SAMPLERS | +CSO_BIT_FRAGMENT_SAMPLER_VIEWS | +CSO_BIT_VIEWPORT | +CSO_BIT_FRAGMENT_SHADER | +CSO_BIT_STREAM_OUTPUTS | +CSO_BIT_TESSCTRL_SHADER | +CSO_BIT_TESSEVAL_SHADER | +CSO_BIT_GEOMETRY_SHADER | +CSO_BIT_VERTEX_ELEMENTS | +CSO_BIT_AUX_VERTEX_BUFFER_SLOT)); /* rasterizer state: just scissor */ st->bitmap.rasterizer.scissor = ctx->Scissor.EnableFlags & 1; @@ -286,18 +285,7 @@ restore_render_state(struct gl_context *ctx) struct st_context *st = st_context(ctx); struct cso_context *cso = st->cso_context; - cso_restore_rasterizer(cso); - cso_restore_fragment_samplers(cso); - cso_restore_fragment_sampler_views(cso); - cso_restore_viewport(cso); - cso_restore_fragment_shader(cso); - cso_restore_vertex_shader(cso); - cso_restore_tessctrl_shader(cso); - cso_restore_tesseval_shader(cso); - cso_restore_geometry_shader(cso); - cso_restore_vertex_elements(cso); - cso_restore_aux_vertex_buffer_slot(cso); - cso_restore_stream_outputs(cso); + cso_restore_state(cso); } diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 27925f9..1adaa5e 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -196,21 +196,21 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) x1, y1); */ - cso_save_blend(cso); - cso_save_stencil_ref(cso); - cso_save_depth_stencil_alpha(cso); - cso_save_rasterizer(cso); - cso_save_sample_mask(cso); - cso_save_min_samples(cso); - cso_save_viewport(cso); - cso_save_fragment_shader(cso); - cso_save_stream_outputs(cso); - cso_save_vertex_shader(cso); - cso_save_tessctrl_shader(cso); - cso_save_tesseval_shader(cso); - cso_save_geometry_shader(cso); - cso_save_vertex_elements(cso); - cso_save_aux_vertex_buffer_slot(cso); + cso_save_state(cso, (CSO_BIT_BLEND | +CSO_BIT_STENCIL_REF | +CSO_BIT_DEPTH_STENCIL_ALPHA | +CSO_BIT_RASTERIZER | +CSO_BIT_SAMPLE_MASK | +CSO_BIT_MIN_SAMPLES | +CSO_BIT_VIEWPORT | +CSO_BIT_FRAGMENT_SHADER | +CSO_BIT_STREAM_OUTPUTS | +CSO_BIT_VERTEX_SHADER | +CSO_BIT_TESSCTRL_SHADER | +CSO_BIT_TESSEVAL_SHADER | +CSO_BIT_GEOMETRY_SHADER | +CSO_BIT_VERTEX_ELEMENTS | +CSO_BIT_AUX_VERTEX_BUFFER_SLOT)); /* blend state: RGBA masking */ { @@ -306,21 +306,7 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) } /* Restore pipe state */ - cso_restore_blend(cso); - cso_restore_stencil_ref(cso); - cso_restore_depth_stencil_alpha(cso); - cso_restore_rasterizer(cso); - cso_restore_sample_mask(cso); - cso_restore_min_samples(cso); - cso_restore_viewport(cso); - cso_restore_fragment_shader(cso); - cso_restore_vertex_shader(cso); - cso_restore_tessctrl_shader(cso); - cso_restore_tesseval_shader(cso); - cso_restore_geometry_shader(cso); - cso_restore_vertex_elements(cso); - cso_restore_aux_vertex_buffer_slot(cso); - cso_restore_stream_outputs(cso); + cso_restore_state(cso); } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index b1b61c8..ee172a0 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -459,6
[Mesa-dev] [PATCH 1/6] st/mesa: include u_draw.h, not u_draw_quad.h in st_draw.c
--- src/mesa/state_tracker/st_draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 10e294c..a299dd5 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -60,7 +60,7 @@ #include "util/u_inlines.h" #include "util/u_format.h" #include "util/u_prim.h" -#include "util/u_draw_quad.h" +#include "util/u_draw.h" #include "util/u_upload_mgr.h" #include "draw/draw_context.h" #include "cso_cache/cso_context.h" -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 94116] program interface queries not returning right data for UBO / GL_BLOCK_INDEX
https://bugs.freedesktop.org/show_bug.cgi?id=94116 Bug ID: 94116 Summary: program interface queries not returning right data for UBO / GL_BLOCK_INDEX Product: Mesa Version: git Hardware: Other OS: All Status: NEW Severity: normal Priority: medium Component: Mesa core Assignee: mesa-dev@lists.freedesktop.org Reporter: imir...@alum.mit.edu QA Contact: mesa-dev@lists.freedesktop.org Created attachment 121715 --> https://bugs.freedesktop.org/attachment.cgi?id=121715=edit Test results for dEQP-GLES31.functional.program_interface_query.uniform.block_index.* Not 100% sure that my diagnosis is correct, but it seems that there's some disagreement between the GL_BLOCK_INDEX being returned by glGetProgramResourceiv and the resource index accepted by glGetProgramResourceName. Note the output of these dEQP tests: MESA_GLES_VERSION_OVERRIDE=3.1 ./deqp-gles31 --deqp-visibility=hidden --deqp-case='dEQP-GLES31.functional.program_interface_query.uniform.block_index.*' dEQP Core git-0c2b7cdc3a0455e0486f88574021d3ccd22f28a8 (0x0c2b7cdc) starting.. target implementation = 'X11 EGL/GLX' Test case 'dEQP-GLES31.functional.program_interface_query.uniform.block_index.default_block'.. Compute shader compile time = 2.354000 ms Link time = 0.581000 ms Test case duration in microseconds = 6153 us Pass (Pass) Test case 'dEQP-GLES31.functional.program_interface_query.uniform.block_index.named_block'.. Compute shader compile time = 0.319000 ms Link time = 0.522000 ms Mesa: User error: GL_INVALID_VALUE in glGetProgramResourceName(index 1) Test case duration in microseconds = 2495 us Fail (query block name: glGetError() returned GL_INVALID_VALUE at es31fProgramInterfaceQueryTestCase.cpp:609) Test case 'dEQP-GLES31.functional.program_interface_query.uniform.block_index.unnamed_block'.. Compute shader compile time = 0.291000 ms Link time = 0.526000 ms Mesa: User error: GL_INVALID_VALUE in glGetProgramResourceName(index 1) Test case duration in microseconds = 2408 us Fail (query block name: glGetError() returned GL_INVALID_VALUE at es31fProgramInterfaceQueryTestCase.cpp:609) Test case 'dEQP-GLES31.functional.program_interface_query.uniform.block_index.block_array'.. Compute shader compile time = 0.398000 ms Link time = 1.887000 ms Test case duration in microseconds = 3985 us Fail (resource block index invalid) DONE! Now the difference between the default_block one and the others is that the others have a layout(binding=0). For default block, it returns GL_BLOCK_INDEX: -1, and it's all happy about that. I would sort of have assumed that for the others, the block index should be 0, but I'm not 100% sure. When it goes to use this block index as an argument to glGetProgramResouceName it errors out for the first 2, and for the last one it gets: Block name with index 1 is TargetInterface[1] Error, expected TargetInterface[0] So I suspect there's an off-by-one somewhere. Attaching the test result output from dEQP which includes the shaders. -- 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 https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 6/6] st/mesa: use new cso_set_viewport_dims() helper
On Fri, Feb 12, 2016 at 11:18 AM, Brian Paulwrote: > On 02/12/2016 09:06 AM, Ilia Mirkin wrote: >> >> On Fri, Feb 12, 2016 at 10:43 AM, Brian Paul wrote: >>> >>> --- >>> src/mesa/state_tracker/st_cb_bitmap.c | 16 +++- >>> src/mesa/state_tracker/st_cb_clear.c | 13 ++--- >>> src/mesa/state_tracker/st_cb_drawpixels.c | 14 ++ >>> 3 files changed, 7 insertions(+), 36 deletions(-) >>> >>> diff --git a/src/mesa/state_tracker/st_cb_bitmap.c >>> b/src/mesa/state_tracker/st_cb_bitmap.c >>> index 5081639..5a11c0d 100644 >>> --- a/src/mesa/state_tracker/st_cb_bitmap.c >>> +++ b/src/mesa/state_tracker/st_cb_bitmap.c >>> @@ -267,19 +267,9 @@ setup_render_state(struct gl_context *ctx, >>> } >>> >>> /* viewport state: viewport matching window dims */ >>> - { >>> - const GLboolean invert = st->state.fb_orientation == Y_0_TOP; >>> - const GLfloat width = (GLfloat)st->state.framebuffer.width; >>> - const GLfloat height = (GLfloat)st->state.framebuffer.height; >>> - struct pipe_viewport_state vp; >>> - vp.scale[0] = 0.5f * width; >>> - vp.scale[1] = height * (invert ? -0.5f : 0.5f); >>> - vp.scale[2] = 0.5f; >>> - vp.translate[0] = 0.5f * width; >>> - vp.translate[1] = 0.5f * height; >>> - vp.translate[2] = 0.5f; >>> - cso_set_viewport(cso, ); >>> - } >>> + cso_set_viewport_dims(cso, st->state.framebuffer.width, >>> + st->state.framebuffer.height, >>> + st->state.fb_orientation == Y_0_TOP); >>> >>> cso_set_vertex_elements(cso, 3, st->util_velems); >>> >>> diff --git a/src/mesa/state_tracker/st_cb_clear.c >>> b/src/mesa/state_tracker/st_cb_clear.c >>> index 271f577..27925f9 100644 >>> --- a/src/mesa/state_tracker/st_cb_clear.c >>> +++ b/src/mesa/state_tracker/st_cb_clear.c >>> @@ -277,17 +277,8 @@ clear_with_quad(struct gl_context *ctx, unsigned >>> clear_buffers) >>> cso_set_rasterizer(cso, >clear.raster); >>> >>> /* viewport state: viewport matching window dims */ >>> - { >>> - const GLboolean invert = (st_fb_orientation(fb) == Y_0_TOP); >>> - struct pipe_viewport_state vp; >>> - vp.scale[0] = 0.5f * fb_width; >>> - vp.scale[1] = fb_height * (invert ? -0.5f : 0.5f); >>> - vp.scale[2] = 0.5f; >>> - vp.translate[0] = 0.5f * fb_width; >>> - vp.translate[1] = 0.5f * fb_height; >>> - vp.translate[2] = 0.5f; >>> - cso_set_viewport(cso, ); >>> - } >>> + cso_set_viewport_dims(st->cso_context, fb_width, fb_height, >>> + st_fb_orientation(fb) == Y_0_TOP); >>> >>> set_fragment_shader(st); >>> cso_set_tessctrl_shader_handle(cso, NULL); >>> diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c >>> b/src/mesa/state_tracker/st_cb_drawpixels.c >>> index 581419e..b1b61c8 100644 >>> --- a/src/mesa/state_tracker/st_cb_drawpixels.c >>> +++ b/src/mesa/state_tracker/st_cb_drawpixels.c >>> @@ -596,18 +596,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, >>> GLint y, GLfloat z, >>> } >>> >>> /* viewport state: viewport matching window dims */ >>> - { >>> - const float w = (float) ctx->DrawBuffer->Width; >>> - const float h = (float) ctx->DrawBuffer->Height; >>> - struct pipe_viewport_state vp; >>> - vp.scale[0] = 0.5f * w; >>> - vp.scale[1] = -0.5f * h; >>> - vp.scale[2] = 0.5f; >>> - vp.translate[0] = 0.5f * w; >>> - vp.translate[1] = 0.5f * h; >>> - vp.translate[2] = 0.5f; >>> - cso_set_viewport(cso, ); >>> - } >>> + cso_set_viewport_dims(cso, ctx->DrawBuffer->Width, >>> + ctx->DrawBuffer->Height, TRUE); >> >> >> Please use _mesa_geometric_width/height here instead of >> ctx->DrawBuffer (to support the future ARB_framebuffer_no_attachments >> use-case). [I believe the current patchset for that feature touched >> this up, but since it's not in, might as well get it right...) > > > Can I do that in a follow-on patch? I think the two changes should be > separate. > > BTW, if gl_framebuffer::_HasAttachments is false, that means the > glDrawPixels will effectively be a no-op, right? So the viewport size won't > matter. Doesn't glDrawPixels run the current frag shader? That shader could have side-effects. It'll also increase GL_SAMPLES_PASSED I think. But yeah, there's like 0 reason for anyone to use glDrawPixels without real attachments :) But I think ctx->DrawBuffer will be null, so crashing isn't so great either. > > I see other places where we use gl_framebuffer::Width/Height in the state > tracker code instead of _mesa_geometric_width/height(). I suspect it may be > the same story. > > Though, I guess it would be more consistent to use > _mesa_geometric_width/height() everywhere. What do you think? You can do it later, or not do it at all and leave it for the ARB_fb_no_attach enablement patches. I was just coming at it from the point of
Re: [Mesa-dev] [v2 03/19] i965: Don't try to create aux buffer for non-msrt aux-buffer
On Fri, Feb 12, 2016 at 09:24:42AM +0200, Pohjolainen, Topi wrote: > On Thu, Feb 11, 2016 at 01:41:47PM -0800, Ben Widawsky wrote: > > On Thu, Feb 11, 2016 at 08:33:56PM +0200, Topi Pohjolainen wrote: > > > In addition to simply calling miptree_create() the higher level > > > call intel_miptree_create() also considers if the buffer should > > > be associated with an auxiliary buffer based on the given format. > > > > > > Here we are allocating an auxiliary buffer which in turn has such > > > format that would mislead intel_miptree_create_layout() later on > > > to try to associate the auxiliary buffer with an auxiliary buffer. > > > To prevent this the actual buffer creation logic was split out > > > into its own function. Lets invoke that instead. > > > > > > v2 (Ben): Do not signal msaa layout with explicit argument but > > > using layout_flags instead. > > > > > > Signed-off-by: Topi Pohjolainen> > > --- > > > src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 20 ++-- > > > 1 file changed, 10 insertions(+), 10 deletions(-) > > > > > > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > > b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > > index e8b3116..e1cf15b 100644 > > > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > > @@ -1541,16 +1541,16 @@ intel_miptree_alloc_non_msrt_mcs(struct > > > brw_context *brw, > > > if (brw->gen >= 8) { > > >layout_flags |= MIPTREE_LAYOUT_FORCE_HALIGN16; > > > } > > > - mt->mcs_mt = intel_miptree_create(brw, > > > - mt->target, > > > - format, > > > - mt->first_level, > > > - mt->last_level, > > > - mcs_width, > > > - mcs_height, > > > - mt->logical_depth0, > > > - 0 /* num_samples */, > > > - layout_flags); > > > + mt->mcs_mt = miptree_create(brw, > > > + mt->target, > > > + format, > > > + mt->first_level, > > > + mt->last_level, > > > + mcs_width, > > > + mcs_height, > > > + mt->logical_depth0, > > > + 0 /* num_samples */, > > > + layout_flags); > > > > > > return mt->mcs_mt; > > > } > > > > Perhaps I am missing something here, but don't you need to have > > mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED; ? > > You are correct that it gets dropped - but it gets dropped for auxiliary > miptree where it doesn't make any difference. Fast clear is tracked in the > parent miptree and it's fast_clear_state is set as before. I toyed earlier > with the idea of having "lighter, needed members only" data type for > auxiliary buffers but didn't pursue that after all. Sounds like you thought it through, and tested it :-) Reviewed-by: Ben Widawsky ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: recognize enums GL_COLOR_ATTACHMENT8-31 as valid
Similar as for AUX1-3, these enums aren't invalid (i.e. -1) but also not supported by mesa. Returning BUFFER_COUNT causes the proper error to be returned by ReadBuffer and other functions. This resolves some failures in dEQP-GLES31.functional.debug.negative_coverage.get_error.buffer.read_buffer Signed-off-by: Ilia Mirkin--- src/mesa/main/buffers.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 83e238a..3ca4b66 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -159,6 +159,9 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, GLenum buffer) case GL_COLOR_ATTACHMENT7_EXT: return BUFFER_BIT_COLOR7; default: + /* not an error, but also not supported */ + if (buffer >= GL_COLOR_ATTACHMENT8 && buffer <= GL_COLOR_ATTACHMENT31) +return 1 << BUFFER_COUNT; /* error */ return BAD_MASK; } @@ -214,6 +217,9 @@ read_buffer_enum_to_index(GLenum buffer) case GL_COLOR_ATTACHMENT7_EXT: return BUFFER_COLOR7; default: + /* not an error, but also not supported */ + if (buffer >= GL_COLOR_ATTACHMENT8 && buffer <= GL_COLOR_ATTACHMENT31) +return BUFFER_COUNT; /* error */ return -1; } -- 2.4.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965/fs: Replace subreg_offset with brw_reg's subnr.
On Thu, Feb 11, 2016 at 11:21 PM, Francisco Jerezwrote: > Matt Turner writes: > >> On Thu, Feb 11, 2016 at 7:31 PM, Francisco Jerez >> wrote: >>> Matt Turner writes: >>> On Thu, Feb 11, 2016 at 3:33 PM, Francisco Jerez wrote: > Would be really nice if we could also get rid of reg_offset as we're at > it. reg and subreg_offset basically represent the same thing but with > different units, couldn't we just have a single offset field in bytes? > Should it be part of brw_reg or backend_reg? I think I would lean > towards backend_reg. In that case does it make sense to move this into > brw_reg now only to move it back to backend_reg later on? That would be nice. I'm just not sure how to do it. brw_reg has to have the subnr field, and it's nice if that's the field the higher levels use too. >>> I guess at this point brw_reg is just an implementation detail of >>> backend_reg, if some of it doesn't make sense at the IR level >>> (e.g. because the IR wants more than 5 bits of sub-(V)GRF offset) >>> there's no need to keep the IR tied up to the lower-level brw_reg >>> representation. >> >> Do you have an example of where we might want a subreg_offset >= 32? > > reg_offset is basically a subreg_offset in 32B units, any use of > reg_offset is a good example I guess. ;) No, that's circular reasoning :) >> >> I think using brw_reg is nice... it pretty simply contains the bits >> that are common to the IR and the hardware. I'm not finding this limiting. > > I don't think it's limiting, but it's silly and error-prone to have two > different fields with the exact same semantics but different units. It > means anytime you need to find out what a register reads or writes you > need to add two terms, and anytime you need to specify a register region > you need to split up the offset in two terms (or use some of the helpers > we have for that purpose, e.g. byte_offset(), *or* assume that your > offset is a multiple of 32b as some places do which will blow up when we > start doing sub-dword types more extensively). FWIW, I haven't found the behavior of byte_offset -- that it increments reg_offset if we go past the end of the register -- to be useful. Do we actually rely on that somewhere? That's more in line with my previous question. I understand the argument that "they have the same semantics", but I don't know that we gain anything by combining them, and also one of the two is a hardware concept, and the other is an IR concept. Having them separate seems fine to me... ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4] mesa/clear: remove dead code handling ClearBufferiv(GL_DEPTH)
There's a hunk above which sets INVALID_ENUM for GL_DEPTH unconditionally. Signed-off-by: Ilia Mirkin--- src/mesa/main/clear.c | 19 --- 1 file changed, 19 deletions(-) diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c index 3bfcc5c..5c40a03 100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@ -386,25 +386,6 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) } } break; - case GL_DEPTH: - /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says: - * - * "The result of ClearBuffer is undefined if no conversion between - * the type of the specified value and the type of the buffer being - * cleared is defined (for example, if ClearBufferiv is called for a - * fixed- or floating-point buffer, or if ClearBufferfv is called - * for a signed or unsigned integer buffer). This is not an error." - * - * In this case we take "undefined" and "not an error" to mean "ignore." - * Note that we still need to generate an error for the invalid - * drawbuffer case (see the GL_STENCIL case above). - */ - if (drawbuffer != 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferiv(drawbuffer=%d)", - drawbuffer); - return; - } - return; default: _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferiv(buffer=%s)", _mesa_enum_to_string(buffer)); -- 2.4.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/4] mesa/clear: update ClearBufferuiv error handling for GL 4.5 spec
This fixes dEQP-GLES31.functional.debug.negative_coverage.get_error.buffer.clear_bufferuiv and brings the logic up to spec with GL 4.5 Signed-off-by: Ilia Mirkin--- src/mesa/main/clear.c | 29 + 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c index 568f600..9dbac3e 100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@ -445,32 +445,13 @@ _mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value) } } break; - case GL_DEPTH: - case GL_STENCIL: - /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says: - * - * "The result of ClearBuffer is undefined if no conversion between - * the type of the specified value and the type of the buffer being - * cleared is defined (for example, if ClearBufferiv is called for a - * fixed- or floating-point buffer, or if ClearBufferfv is called - * for a signed or unsigned integer buffer). This is not an error." - * - * In this case we take "undefined" and "not an error" to mean "ignore." - * Even though we could do something sensible for GL_STENCIL, page 263 - * (page 279 of the PDF) says: - * - * "Only ClearBufferiv should be used to clear stencil buffers." + default: + /* Page 498 of the PDF, section '17.4.3.1 Clearing Individual Buffers' + * of the OpenGL 4.5 spec states: * - * Note that we still need to generate an error for the invalid - * drawbuffer case (see the GL_STENCIL case in _mesa_ClearBufferiv). + *"An INVALID_ENUM error is generated by ClearBufferuiv and + * ClearNamedFramebufferuiv if buffer is not COLOR." */ - if (drawbuffer != 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferuiv(drawbuffer=%d)", - drawbuffer); - return; - } - return; - default: _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferuiv(buffer=%s)", _mesa_enum_to_string(buffer)); return; -- 2.4.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4] mesa/clear: update ClearBufferfv error handling for GL 4.5 spec
This fixes dEQP-GLES31.functional.debug.negative_coverage.get_error.buffer.clear_bufferfv and brings the logic up to spec with GL 4.5 Signed-off-by: Ilia Mirkin--- src/mesa/main/clear.c | 23 +-- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c index 9dbac3e..92f69ab 100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@ -543,26 +543,13 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value) } } break; - case GL_STENCIL: - /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says: - * - * "The result of ClearBuffer is undefined if no conversion between - * the type of the specified value and the type of the buffer being - * cleared is defined (for example, if ClearBufferiv is called for a - * fixed- or floating-point buffer, or if ClearBufferfv is called - * for a signed or unsigned integer buffer). This is not an error." + default: + /* Page 498 of the PDF, section '17.4.3.1 Clearing Individual Buffers' + * of the OpenGL 4.5 spec states: * - * In this case we take "undefined" and "not an error" to mean "ignore." - * Note that we still need to generate an error for the invalid - * drawbuffer case (see the GL_DEPTH case above). + *"An INVALID_ENUM error is generated by ClearBufferfv and + * ClearNamedFramebufferfv if buffer is not COLOR or DEPTH." */ - if (drawbuffer != 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferfv(drawbuffer=%d)", - drawbuffer); - return; - } - return; - default: _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferfv(buffer=%s)", _mesa_enum_to_string(buffer)); return; -- 2.4.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4] mesa/clear: simplify ClearBufferiv error handling
Might as well handle everything in the same error call. Signed-off-by: Ilia Mirkin--- src/mesa/main/clear.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c index 5c40a03..568f600 100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@ -325,18 +325,6 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) _mesa_update_state( ctx ); } - /* Page 498 of the PDF, section '17.4.3.1 Clearing Individual Buffers' -* of the OpenGL 4.5 spec states: -* -*"An INVALID_ENUM error is generated by ClearBufferiv and -* ClearNamedFramebufferiv if buffer is not COLOR or STENCIL." -*/ - if (buffer == GL_DEPTH || buffer == GL_DEPTH_STENCIL) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glClearBufferiv(buffer=GL_DEPTH || GL_DEPTH_STENCIL)"); - return; - } - switch (buffer) { case GL_STENCIL: /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says: @@ -387,6 +375,12 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value) } break; default: + /* Page 498 of the PDF, section '17.4.3.1 Clearing Individual Buffers' + * of the OpenGL 4.5 spec states: + * + *"An INVALID_ENUM error is generated by ClearBufferiv and + * ClearNamedFramebufferiv if buffer is not COLOR or STENCIL." + */ _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferiv(buffer=%s)", _mesa_enum_to_string(buffer)); return; -- 2.4.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: reset offset/size to 0 when removing atomic binding
Similar to commit dd9d2963d6 (mesa: AtomicBufferBindings should be initialized to zero.), we should reset these to zero when unbinding. This fixes a number of dEQP failures due to cross-test pollution. The tests properly unbound everything, but when querying the values again, the expectation was that they would be 0. Signed-off-by: Ilia Mirkin--- src/mesa/main/bufferobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index de1aba4..9aec425 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -3007,8 +3007,8 @@ set_atomic_buffer_binding(struct gl_context *ctx, _mesa_reference_buffer_object(ctx, >BufferObject, bufObj); if (bufObj == ctx->Shared->NullBufferObj) { - binding->Offset = -1; - binding->Size = -1; + binding->Offset = 0; + binding->Size = 0; } else { binding->Offset = offset; binding->Size = size; -- 2.4.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: avoid segfault in GetProgramPipelineInfoLog when no length
If there is no pipe info log, we would unconditionally deref length, which was only optionally there. _mesa_copy_string handles the source being null, as well as the length, so may as well just always call it. Fixes a segfault in dEQP-GLES31.functional.state_query.program_pipeline.info_log Signed-off-by: Ilia Mirkin--- src/mesa/main/pipelineobj.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index 0e4a0af..af17be2 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -964,8 +964,5 @@ _mesa_GetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, return; } - if (pipe->InfoLog) - _mesa_copy_string(infoLog, bufSize, length, pipe->InfoLog); - else - *length = 0; + _mesa_copy_string(infoLog, bufSize, length, pipe->InfoLog); } -- 2.4.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965/fs: Replace subreg_offset with brw_reg's subnr.
Matt Turnerwrites: > On Thu, Feb 11, 2016 at 11:21 PM, Francisco Jerez > wrote: >> Matt Turner writes: >> >>> On Thu, Feb 11, 2016 at 7:31 PM, Francisco Jerez >>> wrote: Matt Turner writes: > On Thu, Feb 11, 2016 at 3:33 PM, Francisco Jerez > wrote: >> Would be really nice if we could also get rid of reg_offset as we're at >> it. reg and subreg_offset basically represent the same thing but with >> different units, couldn't we just have a single offset field in bytes? >> Should it be part of brw_reg or backend_reg? I think I would lean >> towards backend_reg. In that case does it make sense to move this into >> brw_reg now only to move it back to backend_reg later on? > > That would be nice. > > I'm just not sure how to do it. brw_reg has to have the subnr field, > and it's nice if that's the field the higher levels use too. > I guess at this point brw_reg is just an implementation detail of backend_reg, if some of it doesn't make sense at the IR level (e.g. because the IR wants more than 5 bits of sub-(V)GRF offset) there's no need to keep the IR tied up to the lower-level brw_reg representation. >>> >>> Do you have an example of where we might want a subreg_offset >= 32? >> >> reg_offset is basically a subreg_offset in 32B units, any use of >> reg_offset is a good example I guess. ;) > > No, that's circular reasoning :) > How so? Because they have exactly the same semantics but subreg_offset has lower granularity, every use-case for reg_offset is a legitimate use-case of subreg_offset. >>> >>> I think using brw_reg is nice... it pretty simply contains the bits >>> that are common to the IR and the hardware. I'm not finding this limiting. >> >> I don't think it's limiting, but it's silly and error-prone to have two >> different fields with the exact same semantics but different units. It >> means anytime you need to find out what a register reads or writes you >> need to add two terms, and anytime you need to specify a register region >> you need to split up the offset in two terms (or use some of the helpers >> we have for that purpose, e.g. byte_offset(), *or* assume that your >> offset is a multiple of 32b as some places do which will blow up when we >> start doing sub-dword types more extensively). > > FWIW, I haven't found the behavior of byte_offset -- that it > increments reg_offset if we go past the end of the register -- to be > useful. Do we actually rely on that somewhere? That's more in line > with my previous question. > Without byte_offset() you have no sane way to do things like "give me the n-th scalar element from this register region" (several places indeed do it by poking the offset directly instead of going through the helper and they're all rather dubious if not outright broken, see e.g. fs_reg::set_smear() (which blows up for widths greater than 8 or types larger than a dword) or lower_integer_multiplication() which overwrites the subreg_offset of the destination without considering what the previous offset of the region was). > I understand the argument that "they have the same semantics", but I > don't know that we gain anything by combining them, Again, by combining them we spare ourselves from considering two terms rather than one for the *same* thing anytime we need to find out or specify what region of the (virtual) register file a backend_reg refers to. If you need some examples of why this is annoying and repetitive search for the many 'x.reg_offset * 32 + x.subreg_offset' in the backend: brw_fs_copy_propagation.cpp:355 brw_fs_copy_propagation.cpp:469 brw_fs_copy_propagation.cpp:471-472 brw_fs_copy_propagation.cpp:526 brw_fs.cpp:1650 [The list is by no means comprehensive, I just got bored of reading through the grep results] There are also some examples of places where we take into account reg_offset but don't take into account subreg_offset which illustrate what I meant by "error-prone". Was the omission intentional? How is the assumption justified that a region is 32B-aligned? Is it a bug? brw_fs_copy_propagation.cpp:354 brw_fs_copy_propagation.cpp:525 brw_fs.cpp:363 brw_fs.cpp:377 brw_fs.cpp:1496 ... > and also one of the two is a hardware concept, and the other is an IR > concept. Having them separate seems fine to me... The split between reg_ and subreg_offset might be a hardware concept, but it's of little use at the IR level and only a source of bugs in a world of variable SIMD-width and execution types. And our split between the two doesn't even match the hardware's. For the hardware a register is always 32B, while the reg_offset unit is in fact dependent on the register file in a way I won't claim to remember exactly (what leads to a number of dubious assert() calls that wouldn't be
Re: [Mesa-dev] [PATCH 4/4] mesa/clear: update ClearBufferfv error handling for GL 4.5 spec
On 02/12/2016 11:01 AM, Ilia Mirkin wrote: This fixes dEQP-GLES31.functional.debug.negative_coverage.get_error.buffer.clear_bufferfv and brings the logic up to spec with GL 4.5 Signed-off-by: Ilia Mirkin--- src/mesa/main/clear.c | 23 +-- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c index 9dbac3e..92f69ab 100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@ -543,26 +543,13 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value) } } break; - case GL_STENCIL: - /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says: - * - * "The result of ClearBuffer is undefined if no conversion between - * the type of the specified value and the type of the buffer being - * cleared is defined (for example, if ClearBufferiv is called for a - * fixed- or floating-point buffer, or if ClearBufferfv is called - * for a signed or unsigned integer buffer). This is not an error." + default: + /* Page 498 of the PDF, section '17.4.3.1 Clearing Individual Buffers' + * of the OpenGL 4.5 spec states: * - * In this case we take "undefined" and "not an error" to mean "ignore." - * Note that we still need to generate an error for the invalid - * drawbuffer case (see the GL_DEPTH case above). + *"An INVALID_ENUM error is generated by ClearBufferfv and + * ClearNamedFramebufferfv if buffer is not COLOR or DEPTH." */ - if (drawbuffer != 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferfv(drawbuffer=%d)", - drawbuffer); - return; - } - return; - default: _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferfv(buffer=%s)", _mesa_enum_to_string(buffer)); return; Series LGTM. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glsl: reject invalid input layout qualifiers
Global in validation is already handled, this will do the validation for variables, blocks and block members. This fixes some CTS tests for the new enhanced layouts transform feedback qualifiers. --- Applies on top of my component qualifier series: https://patchwork.freedesktop.org/series/2101/ src/compiler/glsl/ast_type.cpp | 13 + 1 file changed, 13 insertions(+) diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp index f7c89af..f40ba86 100644 --- a/src/compiler/glsl/ast_type.cpp +++ b/src/compiler/glsl/ast_type.cpp @@ -147,6 +147,12 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc, stream_layout_mask.flags.i = 0; stream_layout_mask.flags.q.stream = 1; + ast_type_qualifier input_layout_mask; + input_layout_mask.flags.i = 0; + input_layout_mask.flags.q.in = 1; + input_layout_mask.flags.q.explicit_component = 1; + input_layout_mask.flags.q.explicit_location = 1; + /* Uniform block layout qualifiers get to overwrite each * other (rightmost having priority), while all other * qualifiers currently don't allow duplicates. @@ -271,6 +277,13 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc, this->flags.i |= q.flags.i; + if (this->flags.q.in && + (this->flags.i & ~input_layout_mask.flags.i) != 0) { + _mesa_glsl_error(loc, state, + "invalid input layout qualifier used"); + return false; + } + if (q.flags.q.explicit_location) this->location = q.location; -- 2.5.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 94116] program interface queries not returning right data for UBO / GL_BLOCK_INDEX
https://bugs.freedesktop.org/show_bug.cgi?id=94116 Timothy Arcerichanged: What|Removed |Added CC||t_arc...@yahoo.com.au --- Comment #1 from Timothy Arceri --- Created attachment 121732 --> https://bugs.freedesktop.org/attachment.cgi?id=121732=edit Partial fix This is a partial fix although I wonder if it needs to apply to SSBO too. The problem is we are trying to match the program resource index not the block index. -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Reupload push and pull constants when we get new shader image unit state.
On Friday, February 12, 2016 12:20:15 PM PST Francisco Jerez wrote: > Fixes several of the > "dEQP-GLES31.functional.image_load_store*load_store*single_layer" dEQP > tests that use image formats we implement using untyped surface > messages. > > Cc: mesa-sta...@lists.freedesktop.org > Tested-by: Ilia Mirkin> --- > src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/ drivers/dri/i965/brw_wm_surface_state.c > index 5ab2f7f..8b12a48 100644 > --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c > +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c > @@ -1340,6 +1340,11 @@ brw_upload_image_surfaces(struct brw_context *brw, >} > >brw->ctx.NewDriverState |= BRW_NEW_SURFACES; > + /* This may have changed the image metadata dependent on the context > + * image unit state and passed to the program as uniforms, make sure > + * that push and pull constants are reuploaded. > + */ > + brw->NewGLState |= _NEW_PROGRAM_CONSTANTS; > } > } > > Reviewed-by: Kenneth Graunke signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH 4/4] glx: fix error code when there is no context bound
On 02/12/2016 11:55 PM, Emil Velikov wrote: On 12 February 2016 at 05:34, Tapani Pälliwrote: On 02/12/2016 02:54 AM, Emil Velikov wrote: On 11 February 2016 at 12:04, Tapani Pälli wrote: From: Bernard Kilarski Signed-off-by: Bernard Kilarski Signed-off-by: Matt Roper Cc: "11.0 11.1" psc, attribute, value); @@ -166,7 +166,7 @@ glXQueryCurrentRendererStringMESA(int attribute) { struct glx_context *gc = __glXGetCurrentContext(); - if (gc == NULL) + if (gc == NULL || gc == ) Unless I'm missing something __glXGetCurrentContext() can never return NULL, right ? This was my initial impression also ... but I'm not sure what happens here but unit tests (glx-test) for some reason completely explode if you take out the null check and try running 'make check'. I think that is why also the dummyContext is introduced in those tests. I played around a bit with this change and linking phase with glx-test starts to print quite weird errors, actually complete unrelated ones, I guess because it cannot find the 'extern' declared 'dummyContext'. I'm not sure if this is actually problem with the tests rather than this code. Double checking - the tests are going crazy when you remove the null check, even with the current/extra dummyContext ? That does sound quite strange. Yep that's the case. // Tapani ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965/bxt: Production thread counts
Signed-off-by: Ben Widawsky--- src/mesa/drivers/dri/i965/brw_device_info.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_device_info.c b/src/mesa/drivers/dri/i965/brw_device_info.c index 7ab70fe..4904e63 100644 --- a/src/mesa/drivers/dri/i965/brw_device_info.c +++ b/src/mesa/drivers/dri/i965/brw_device_info.c @@ -386,18 +386,18 @@ static const struct brw_device_info brw_device_info_bxt = { /* XXX: These are preliminary thread counts and URB sizes. */ .num_slices = 1, - .max_vs_threads = 56, - .max_hs_threads = 56, - .max_ds_threads = 56, - .max_gs_threads = 56, + .max_vs_threads = 112, + .max_hs_threads = 112, + .max_ds_threads = 112, + .max_gs_threads = 112, .max_wm_threads = 64 * 3, - .max_cs_threads = 28, + .max_cs_threads = 6 * 6, .urb = { - .size = 64, + .size = 192, .min_vs_entries = 34, - .max_vs_entries = 640, - .max_hs_entries = 80, - .max_ds_entries = 80, + .max_vs_entries = 704, + .max_hs_entries = 256, + .max_ds_entries = 416, .max_gs_entries = 256, } }; -- 2.7.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] [v2] i965/bxt: Production thread counts
v2: Forgot to squash in the comment removal Signed-off-by: Ben Widawsky--- src/mesa/drivers/dri/i965/brw_device_info.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_device_info.c b/src/mesa/drivers/dri/i965/brw_device_info.c index 7ab70fe..55c4d36 100644 --- a/src/mesa/drivers/dri/i965/brw_device_info.c +++ b/src/mesa/drivers/dri/i965/brw_device_info.c @@ -384,20 +384,19 @@ static const struct brw_device_info brw_device_info_bxt = { .gt = 1, .has_llc = false, - /* XXX: These are preliminary thread counts and URB sizes. */ .num_slices = 1, - .max_vs_threads = 56, - .max_hs_threads = 56, - .max_ds_threads = 56, - .max_gs_threads = 56, + .max_vs_threads = 112, + .max_hs_threads = 112, + .max_ds_threads = 112, + .max_gs_threads = 112, .max_wm_threads = 64 * 3, - .max_cs_threads = 28, + .max_cs_threads = 6 * 6, .urb = { - .size = 64, + .size = 192, .min_vs_entries = 34, - .max_vs_entries = 640, - .max_hs_entries = 80, - .max_ds_entries = 80, + .max_vs_entries = 704, + .max_hs_entries = 256, + .max_ds_entries = 416, .max_gs_entries = 256, } }; -- 2.7.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [v2 05/19] i965: Add helper for detecting lossless compression
On Thu, Feb 11, 2016 at 01:48:18PM -0800, Ben Widawsky wrote: > On Thu, Feb 11, 2016 at 08:33:58PM +0200, Topi Pohjolainen wrote: > > Signed-off-by: Topi Pohjolainen> > --- > > src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 26 > > ++ > > src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 4 > > 2 files changed, 30 insertions(+) > > > > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > index 5f739d9..31de1ff 100644 > > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > @@ -266,6 +266,32 @@ intel_miptree_supports_non_msrt_fast_clear(struct > > brw_context *brw, > >return true; > > } > > > > +/* On Gen9 support for color buffer compression was extended to single > > + * sampled surfaces. This is a helper considering both auxiliary buffer > > + * type and number of samples telling if the given miptree represents > > + * the new single sampled case - also called lossless compression. > > + */ > > +bool > > +intel_miptree_is_lossless_compressed(const struct brw_context *brw, > > + const struct intel_mipmap_tree *mt) > > +{ > > + /* Only available from Gen9 onwards. */ > > + if (brw->gen < 9) > > + return false; > > + > > + /* Compression always requires auxiliary buffer. */ > > + if (!mt->mcs_mt) > > + return false; > > + > > + /* Single sample compression is represented re-using msaa compression > > +* layout type: "Compressed Multisampled Surfaces". > > +*/ > > + if (mt->msaa_layout != INTEL_MSAA_LAYOUT_CMS) > > + return false; > > + > > + /* And finally distinguish between msaa and single sample case. */ > > + return mt->num_samples <= 1; > > +} > > > > /** > > * Determine depth format corresponding to a depth+stencil format, > > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h > > b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h > > index 64f73ea..13d4d7e 100644 > > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h > > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h > > @@ -667,6 +667,10 @@ intel_get_non_msrt_mcs_alignment(struct > > intel_mipmap_tree *mt, > > unsigned *width_px, unsigned *height); > > > > bool > > +intel_miptree_is_lossless_compressed(const struct brw_context *brw, > > + const struct intel_mipmap_tree *mt); > > + > > +bool > > intel_miptree_alloc_non_msrt_mcs(struct brw_context *brw, > > struct intel_mipmap_tree *mt); > > > > So I take it this was one of the big changes from my feedback earlier. Do you > prefer this result, or what? I can live with the old thing if you want it. I think I like this better, it avoids the CSS/CCS confusion. And in principle, both MCS and CCS_E are about compression, and the fact that hardware implements them separately only needs to be reflected in surface setup and color resolve logic. No need to go further. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: recognize enums GL_COLOR_ATTACHMENT8-31 as valid
On 02/12/2016 11:22 AM, Ilia Mirkin wrote: Similar as for AUX1-3, these enums aren't invalid (i.e. -1) but also not supported by mesa. Returning BUFFER_COUNT causes the proper error to be returned by ReadBuffer and other functions. This resolves some failures in dEQP-GLES31.functional.debug.negative_coverage.get_error.buffer.read_buffer Signed-off-by: Ilia Mirkin--- src/mesa/main/buffers.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 83e238a..3ca4b66 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -159,6 +159,9 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, GLenum buffer) case GL_COLOR_ATTACHMENT7_EXT: return BUFFER_BIT_COLOR7; default: + /* not an error, but also not supported */ + if (buffer >= GL_COLOR_ATTACHMENT8 && buffer <= GL_COLOR_ATTACHMENT31) +return 1 << BUFFER_COUNT; /* error */ return BAD_MASK; } @@ -214,6 +217,9 @@ read_buffer_enum_to_index(GLenum buffer) case GL_COLOR_ATTACHMENT7_EXT: return BUFFER_COLOR7; default: + /* not an error, but also not supported */ + if (buffer >= GL_COLOR_ATTACHMENT8 && buffer <= GL_COLOR_ATTACHMENT31) +return BUFFER_COUNT; /* error */ return -1; } Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: reset offset/size to 0 when removing atomic binding
On 02/12/2016 11:51 AM, Ilia Mirkin wrote: Similar to commit dd9d2963d6 (mesa: AtomicBufferBindings should be initialized to zero.), we should reset these to zero when unbinding. This fixes a number of dEQP failures due to cross-test pollution. The tests properly unbound everything, but when querying the values again, the expectation was that they would be 0. Signed-off-by: Ilia Mirkin--- src/mesa/main/bufferobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index de1aba4..9aec425 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -3007,8 +3007,8 @@ set_atomic_buffer_binding(struct gl_context *ctx, _mesa_reference_buffer_object(ctx, >BufferObject, bufObj); if (bufObj == ctx->Shared->NullBufferObj) { - binding->Offset = -1; - binding->Size = -1; + binding->Offset = 0; + binding->Size = 0; } else { binding->Offset = offset; binding->Size = size; Looks OK to me. Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: avoid segfault in GetProgramPipelineInfoLog when no length
On 02/12/2016 12:25 PM, Ilia Mirkin wrote: If there is no pipe info log, we would unconditionally deref length, which was only optionally there. _mesa_copy_string handles the source being null, as well as the length, so may as well just always call it. Fixes a segfault in dEQP-GLES31.functional.state_query.program_pipeline.info_log Signed-off-by: Ilia Mirkin--- src/mesa/main/pipelineobj.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c index 0e4a0af..af17be2 100644 --- a/src/mesa/main/pipelineobj.c +++ b/src/mesa/main/pipelineobj.c @@ -964,8 +964,5 @@ _mesa_GetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, return; } - if (pipe->InfoLog) - _mesa_copy_string(infoLog, bufSize, length, pipe->InfoLog); - else - *length = 0; + _mesa_copy_string(infoLog, bufSize, length, pipe->InfoLog); } Reviewed-by: Brian Paul ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH 4/4] glx: fix error code when there is no context bound
On 12 February 2016 at 05:34, Tapani Pälliwrote: > On 02/12/2016 02:54 AM, Emil Velikov wrote: >> >> On 11 February 2016 at 12:04, Tapani Pälli wrote: >>> >>> From: Bernard Kilarski >>> >>> Signed-off-by: Bernard Kilarski >>> Signed-off-by: Matt Roper >>> Cc: "11.0 11.1" >> --- >>> src/glx/glxcmds.c | 2 +- >>> src/glx/query_renderer.c | 4 ++-- >>> src/glx/tests/query_renderer_unittest.cpp | 4 >>> 3 files changed, 7 insertions(+), 3 deletions(-) >>> >>> diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c >>> index 93e8db5..4db67ec 100644 >>> --- a/src/glx/glxcmds.c >>> +++ b/src/glx/glxcmds.c >>> @@ -1727,7 +1727,7 @@ __glXSwapIntervalSGI(int interval) >>> CARD32 *interval_ptr; >>> CARD8 opcode; >>> >>> - if (gc == NULL) { >>> + if (gc == NULL || gc == ) { >>> return GLX_BAD_CONTEXT; >>> } >>> >>> diff --git a/src/glx/query_renderer.c b/src/glx/query_renderer.c >>> index 9108ec2..d49b8fe 100644 >>> --- a/src/glx/query_renderer.c >>> +++ b/src/glx/query_renderer.c >>> @@ -106,7 +106,7 @@ glXQueryCurrentRendererIntegerMESA(int attribute, >>> unsigned int *value) >>> { >>> struct glx_context *gc = __glXGetCurrentContext(); >>> >>> - if (gc == NULL) >>> + if (gc == NULL || gc == ) >>> return False; >>> >>> return __glXQueryRendererInteger(gc->psc, attribute, value); >>> @@ -166,7 +166,7 @@ glXQueryCurrentRendererStringMESA(int attribute) >>> { >>> struct glx_context *gc = __glXGetCurrentContext(); >>> >>> - if (gc == NULL) >>> + if (gc == NULL || gc == ) >> >> Unless I'm missing something __glXGetCurrentContext() can never return >> NULL, right ? > > > This was my initial impression also ... but I'm not sure what happens here > but unit tests (glx-test) for some reason completely explode if you take out > the null check and try running 'make check'. > > I think that is why also the dummyContext is introduced in those tests. I > played around a bit with this change and linking phase with glx-test starts > to print quite weird errors, actually complete unrelated ones, I guess > because it cannot find the 'extern' declared 'dummyContext'. I'm not sure if > this is actually problem with the tests rather than this code. > Double checking - the tests are going crazy when you remove the null check, even with the current/extra dummyContext ? That does sound quite strange. -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] egl/wayland: Try to use wl_surface.damage_buffer for SwapBuffersWithDamage
On 11 February 2016 at 16:34, Derek Foremanwrote: > Since commit d1314de293e9e4a63c35f094c3893aaaed8580b4 we ignore > damage passed to SwapBuffersWithDamage. > > Wayland 1.10 now has functionality that allows us to properly > process those damage rectangles, and a way to query if it's > available. > > Now we can use wl_surface.damage_buffer and interpret the incoming > damage as being in buffer co-ordinates. > > Signed-off-by: Derek Foreman > --- > src/egl/drivers/dri2/platform_wayland.c | 32 +--- > 1 file changed, 29 insertions(+), 3 deletions(-) > > diff --git a/src/egl/drivers/dri2/platform_wayland.c > b/src/egl/drivers/dri2/platform_wayland.c > index c2438f7..b5a5b59 100644 > --- a/src/egl/drivers/dri2/platform_wayland.c > +++ b/src/egl/drivers/dri2/platform_wayland.c > @@ -653,6 +653,30 @@ create_wl_buffer(struct dri2_egl_surface *dri2_surf) >_buffer_listener, dri2_surf); > } > > +static EGLBoolean > +try_damage_buffer(struct dri2_egl_surface *dri2_surf, > + const EGLint *rects, > + EGLint n_rects) > +{ > +#ifdef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION > + int i; > + > + if (wl_proxy_get_version((struct wl_proxy *) dri2_surf->wl_win->surface) > + < WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION) > + return EGL_FALSE; > + > + for (i = 0; i < n_rects; i++) { > + const int *rect = [i * 4]; > + > + wl_surface_damage_buffer(dri2_surf->wl_win->surface, > + rect[0], > + dri2_surf->base.Height - rect[1] - rect[3], > + rect[2], rect[3]); > + } > + return EGL_TRUE; > +#endif I'm slightly worried about keeping this compile time. For example if we compile against old wayland, and then run against a capable one... this code won't exist thus will never get executed. Thus leading to a handful of "wtf" moments. I would just ensure it's defined at the top. #ifndef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION #define WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION foo #endif Cheers, Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: reset offset/size to 0 when removing atomic binding
Ilia Mirkinwrites: > Similar to commit dd9d2963d6 (mesa: AtomicBufferBindings should be > initialized to zero.), we should reset these to zero when unbinding. > This fixes a number of dEQP failures due to cross-test pollution. The > tests properly unbound everything, but when querying the values again, > the expectation was that they would be 0. > > Signed-off-by: Ilia Mirkin Reviewed-by: Francisco Jerez > --- > src/mesa/main/bufferobj.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c > index de1aba4..9aec425 100644 > --- a/src/mesa/main/bufferobj.c > +++ b/src/mesa/main/bufferobj.c > @@ -3007,8 +3007,8 @@ set_atomic_buffer_binding(struct gl_context *ctx, > _mesa_reference_buffer_object(ctx, >BufferObject, bufObj); > > if (bufObj == ctx->Shared->NullBufferObj) { > - binding->Offset = -1; > - binding->Size = -1; > + binding->Offset = 0; > + binding->Size = 0; > } else { >binding->Offset = offset; >binding->Size = size; > -- > 2.4.10 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/nine: Forbid POSITION0 and fix depth input for PS3.0
On 12 February 2016 at 22:10, Axel Davywrote: > POSITION0 input is forbidden for PS3.0 apparently. > > Besides for depth input we weren't using the system value > version if needed > > Signed-off-by: Axel Davy > > --- > Could be better having it separated into two patches perhaps. Yes, pretty please. Lets leave the nine_get_position_input() helper out. > It should get into Mesa 11.2, to prevent regression caused > by the introduction of position as system value. > I'll keep an eye open, although feel free to slap the "Cc: mesa-stable..." tag. > @@ -2048,9 +2052,22 @@ DECL_SPECIAL(DCL) > unsigned interp_location = 0; > /* SM3 only, SM2 input semantic determined by file */ > assert(sem.reg.idx < Elements(tx->regs.v)); > + > +if (tgsi.Name == TGSI_SEMANTIC_POSITION) { > +/* Position0/PositionT0 are forbidden (likely because vPos > already does that) s/PositionT0/PositionT/ ? > + * is forbidden. */ Too much "forbidden" ? Just drop this line of the comment. > +if (sem.usage == D3DDECLUSAGE_POSITION && sem.usage_idx == 0 > || > +sem.usage == D3DDECLUSAGE_POSITIONT) > +return D3DERR_INVALIDCALL; Throw an empty newline, to improve readability. Thanks Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/5] mesa: make _mesa_tex_target_to_face() an inline function
On Thu, 2016-02-11 at 08:35 -0700, Brian Paul wrote: > --- > src/mesa/main/teximage.c | 14 -- > src/mesa/main/teximage.h | 15 +++ > 2 files changed, 15 insertions(+), 14 deletions(-) > > diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c > index 68a9752..57765d7 100644 > --- a/src/mesa/main/teximage.c > +++ b/src/mesa/main/teximage.c > @@ -116,20 +116,6 @@ adjust_for_oes_float_texture(GLenum format, > GLenum type) > return format; > } > > -/** > - * For cube map faces, return a face index in [0,5]. > - * For other targets return 0; > - */ > -GLuint > -_mesa_tex_target_to_face(GLenum target) > -{ > - if (_mesa_is_cube_face(target)) > - return (GLuint) target - (GLuint) > GL_TEXTURE_CUBE_MAP_POSITIVE_X; > - else > - return 0; > -} > - > - Series Reviewed-by: Timothy Arceriif you also remove the: extern GLuint _mesa_tex_target_to_face(GLenum target); > > /** > * Install gl_texture_image in a gl_texture_object according to the > target > diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h > index fe5b485..39ff8ea 100644 > --- a/src/mesa/main/teximage.h > +++ b/src/mesa/main/teximage.h > @@ -47,6 +47,21 @@ _mesa_is_cube_face(GLenum target) > target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z); > } > > + > +/** > + * For cube map faces, return a face index in [0,5]. > + * For other targets return 0; > + */ > +static inline GLuint > +_mesa_tex_target_to_face(GLenum target) > +{ > + if (_mesa_is_cube_face(target)) > + return (GLuint) target - (GLuint) > GL_TEXTURE_CUBE_MAP_POSITIVE_X; > + else > + return 0; > +} > + > + > /** Are any of the dimensions of given texture equal to zero? */ > static inline GLboolean > _mesa_is_zero_size_texture(const struct gl_texture_image *texImage) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH 4/4] glx: fix error code when there is no context bound
On 12 February 2016 at 02:28, Matt Turnerwrote: > On Thu, Feb 11, 2016 at 4:54 PM, Emil Velikov > wrote: >> On 11 February 2016 at 12:04, Tapani Pälli wrote: >>> From: Bernard Kilarski >>> >>> Signed-off-by: Bernard Kilarski >>> Signed-off-by: Matt Roper >>> Cc: "11.0 11.1" >> --- >>> src/glx/glxcmds.c | 2 +- >>> src/glx/query_renderer.c | 4 ++-- >>> src/glx/tests/query_renderer_unittest.cpp | 4 >>> 3 files changed, 7 insertions(+), 3 deletions(-) >>> >>> diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c >>> index 93e8db5..4db67ec 100644 >>> --- a/src/glx/glxcmds.c >>> +++ b/src/glx/glxcmds.c >>> @@ -1727,7 +1727,7 @@ __glXSwapIntervalSGI(int interval) >>> CARD32 *interval_ptr; >>> CARD8 opcode; >>> >>> - if (gc == NULL) { >>> + if (gc == NULL || gc == ) { >>>return GLX_BAD_CONTEXT; >>> } >>> >>> diff --git a/src/glx/query_renderer.c b/src/glx/query_renderer.c >>> index 9108ec2..d49b8fe 100644 >>> --- a/src/glx/query_renderer.c >>> +++ b/src/glx/query_renderer.c >>> @@ -106,7 +106,7 @@ glXQueryCurrentRendererIntegerMESA(int attribute, >>> unsigned int *value) >>> { >>> struct glx_context *gc = __glXGetCurrentContext(); >>> >>> - if (gc == NULL) >>> + if (gc == NULL || gc == ) >>>return False; >>> >>> return __glXQueryRendererInteger(gc->psc, attribute, value); >>> @@ -166,7 +166,7 @@ glXQueryCurrentRendererStringMESA(int attribute) >>> { >>> struct glx_context *gc = __glXGetCurrentContext(); >>> >>> - if (gc == NULL) >>> + if (gc == NULL || gc == ) >> Unless I'm missing something __glXGetCurrentContext() can never return >> NULL, right ? >> >> In that case I see two possible solutions >> - Swap all the NULL checks, for == (some commit >> message would be great) or >> - Drop the null checks in this patch, and explain why we do that only >> here (the xid and vtable are implicitly zeroed for dummyContext, thus >> things will just work). >> >> Leaning for the latter for stable as it's shorter. Although doing the >> former on top (for master alone) also sounds like a good idea imho. >> >>>return False; >>> >>> return __glXQueryRendererString(gc->psc, attribute); >>> diff --git a/src/glx/tests/query_renderer_unittest.cpp >>> b/src/glx/tests/query_renderer_unittest.cpp >>> index 2f3c4ef..4c96260 100644 >>> --- a/src/glx/tests/query_renderer_unittest.cpp >>> +++ b/src/glx/tests/query_renderer_unittest.cpp >>> @@ -40,6 +40,10 @@ struct attribute_test_vector { >>> #define E(x) { # x, x } >>> >>> >>> +/* This is necessary so that we don't have to link with glxcurrent.c >>> + * which would require us to link with X libraries and what not. >>> + */ >>> +struct glx_context dummyContext; >>> >> Perhaps we should initialize it (like in glxcurrent.c) for >> consistency, if anything else ? > > Global variables are initialized. :) I was referring to "initialize it with the same data as glxcurrent.c". Pardon if it wasn't clear enough. Such that should current/new tests, flex a code path that relies on the specific initial values things don't blow up. -Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/nine: Forbid POSITION0 and fix depth input for PS3.0
POSITION0 input is forbidden for PS3.0 apparently. Besides for depth input we weren't using the system value version if needed Signed-off-by: Axel Davy--- Could be better having it separated into two patches perhaps. It should get into Mesa 11.2, to prevent regression caused by the introduction of position as system value. src/gallium/state_trackers/nine/nine_shader.c | 44 +-- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index a7a7da2..40f06a8 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -830,6 +830,18 @@ nine_ureg_dst_register(unsigned file, int index) return ureg_dst(ureg_src_register(file, index)); } +static inline struct ureg_src +nine_get_position_input(struct shader_translator *tx) +{ +struct ureg_program *ureg = tx->ureg; + +if (tx->wpos_is_sysval) +return ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); +else +return ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, + 0, TGSI_INTERPOLATE_LINEAR); +} + static struct ureg_src tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param) { @@ -955,16 +967,8 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param) case D3DSPR_MISCTYPE: switch (param->idx) { case D3DSMO_POSITION: - if (ureg_src_is_undef(tx->regs.vPos)) { - if (tx->wpos_is_sysval) { - tx->regs.vPos = - ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); - } else { - tx->regs.vPos = - ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, 0, - TGSI_INTERPOLATE_LINEAR); - } - } + if (ureg_src_is_undef(tx->regs.vPos)) + tx->regs.vPos = nine_get_position_input(tx); if (tx->shift_wpos) { /* TODO: do this only once */ struct ureg_dst wpos = tx_scratch(tx); @@ -2048,9 +2052,22 @@ DECL_SPECIAL(DCL) unsigned interp_location = 0; /* SM3 only, SM2 input semantic determined by file */ assert(sem.reg.idx < Elements(tx->regs.v)); + +if (tgsi.Name == TGSI_SEMANTIC_POSITION) { +/* Position0/PositionT0 are forbidden (likely because vPos already does that) + * is forbidden. */ +if (sem.usage == D3DDECLUSAGE_POSITION && sem.usage_idx == 0 || +sem.usage == D3DDECLUSAGE_POSITIONT) +return D3DERR_INVALIDCALL; +/* Following code is for depth (PositionT is not possible) */ +tx->regs.v[sem.reg.idx] = nine_get_position_input(tx); +return D3D_OK; +} + if (sem.reg.mod & NINED3DSPDM_CENTROID || (tgsi.Name == TGSI_SEMANTIC_COLOR && tx->info->force_color_in_centroid)) interp_location = TGSI_INTERPOLATE_LOC_CENTROID; + tx->regs.v[sem.reg.idx] = ureg_DECL_fs_input_cyl_centroid( ureg, tgsi.Name, tgsi.Index, nine_tgsi_to_interp_mode(), @@ -3269,12 +3286,7 @@ shader_add_ps_fog_stage(struct shader_translator *tx, struct ureg_src src_col) } if (tx->info->fog_mode != D3DFOG_NONE) { -if (tx->wpos_is_sysval) { -depth = ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); -} else { -depth = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, 0, - TGSI_INTERPOLATE_LINEAR); -} +depth = nine_get_position_input(tx); depth = ureg_scalar(depth, TGSI_SWIZZLE_Z); } -- 2.7.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] virtio_gpu: Add virtio 1.0 PCI ID to driver map
From: Marc-André LureauAdd the virtio-gpu PCI ID for virtio 1.0 (according to the specification, "the PCI Device ID is calculated by adding 0x1040 to the Virtio Device ID") Signed-off-by: Marc-André Lureau --- include/pci_ids/virtio_gpu_pci_ids.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/pci_ids/virtio_gpu_pci_ids.h b/include/pci_ids/virtio_gpu_pci_ids.h index 2e6ecaf..9232cd2 100644 --- a/include/pci_ids/virtio_gpu_pci_ids.h +++ b/include/pci_ids/virtio_gpu_pci_ids.h @@ -1 +1,2 @@ CHIPSET(0x0010, VIRTGL, VIRTGL) +CHIPSET(0x1050, VIRTGL, VIRTGL) -- 2.5.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/9] Types, types, and more types
Series Reviewed-by: Jordan JustenOn 2016-02-11 22:16:18, Jason Ekstrand wrote: > This little series expands the GLSL type system in preparation for SPIR-V. > The first few patches are to glsl_types and add a bare sampler type, > function types, and an image type helper. The rest flesh out the nir_types > C wrappers so that we can do almost anything from C that we can from C++. > > Jason Ekstrand (9): > glsl/types: Rename sampler_type to sampled_type > glsl/types: Add a bare "sampler" type > glsl/types: Add support for function types > glsl/types: Add a helper for getting image types > glsl/types: Expose glsl_struct_field and glsl_function_param to C > nir/types: Add helpers for function types > nir/types: Add helpers for working with sampler and image types > nir/types: Add a few more glsl_type_is_ functions > nir/types: Add more type constructor functions > > src/compiler/builtin_type_macros.h | 1 + > src/compiler/glsl/ast_to_hir.cpp| 5 +- > src/compiler/glsl/builtin_functions.cpp | 4 +- > src/compiler/glsl/ir.cpp| 2 +- > src/compiler/glsl/ir_clone.cpp | 1 + > src/compiler/glsl/link_uniform_initializers.cpp | 1 + > src/compiler/glsl_types.cpp | 204 > +++- > src/compiler/glsl_types.h | 38 - > src/compiler/nir_types.cpp | 144 + > src/compiler/nir_types.h| 38 + > src/mesa/drivers/dri/i965/brw_fs.cpp| 1 + > src/mesa/drivers/dri/i965/brw_fs_nir.cpp| 2 +- > src/mesa/drivers/dri/i965/brw_shader.cpp| 1 + > src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 1 + > src/mesa/program/ir_to_mesa.cpp | 2 + > src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 1 + > 16 files changed, 428 insertions(+), 18 deletions(-) > > -- > 2.5.0.400.gff86faf > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: reject explicit location on atomic counter uniforms
On Thu, 2016-02-11 at 20:10 -0500, Ilia Mirkin wrote: > This fixes > > dEQP-GLES31.functional.uniform_location.negative.atomic_fragment > dEQP-GLES31.functional.uniform_location.negative.atomic_vertex > > Both of which have lines like > > layout(location = 3, binding = 0, offset = 0) uniform atomic_uint > uni0; > > The ARB_explicit_uniform_location spec makes a very tangential > mention > regarding atomic counters, but location isn't something that makes > sense > with them. > > Signed-off-by: Ilia Mirkin> --- > > Had no clue where to stick this check... this seemed like as good a > place as any. > > src/compiler/glsl/ast_to_hir.cpp | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/src/compiler/glsl/ast_to_hir.cpp > b/src/compiler/glsl/ast_to_hir.cpp > index dbeb5c0..9fce06b 100644 > --- a/src/compiler/glsl/ast_to_hir.cpp > +++ b/src/compiler/glsl/ast_to_hir.cpp > @@ -4179,6 +4179,11 @@ ast_declarator_list::hir(exec_list > *instructions, > state->atomic_counter_offsets[qual_binding] = > qual_offset; > } > } Maybe we should just make this: else { _mesa_glsl_error(, state, "invalid atomic counter layout qualifier"); } ?? > + > + if (type->qualifier.flags.q.explicit_location) { > + _mesa_glsl_error(, state, > + "atomic counters cannot have an explicit > location"); > + } > } > > if (this->declarations.is_empty()) { ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965: Reupload push and pull constants when we get new shader image unit state.
Fixes several of the "dEQP-GLES31.functional.image_load_store*load_store*single_layer" dEQP tests that use image formats we implement using untyped surface messages. Cc: mesa-sta...@lists.freedesktop.org Tested-by: Ilia Mirkin--- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 5ab2f7f..8b12a48 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -1340,6 +1340,11 @@ brw_upload_image_surfaces(struct brw_context *brw, } brw->ctx.NewDriverState |= BRW_NEW_SURFACES; + /* This may have changed the image metadata dependent on the context + * image unit state and passed to the program as uniforms, make sure + * that push and pull constants are reuploaded. + */ + brw->NewGLState |= _NEW_PROGRAM_CONSTANTS; } } -- 2.7.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 00/12] Some more Nine fixes
On 09/02/2016 14:58, Emil Velikov wrote: On 7 February 2016 at 23:13, Axel Davywrote: A few more patches I'd like to get in 11.2. There a few cleanup patches and some fixes. The last patch fixes build with llvm 32 bits when it isn't built with -mstackrealign. Basically Apps have a 4 byte aligned stack, and it needs to be converted at some point to 16 byte aligned stack to have SSE code and llvm work correctly. I think the better is to just realign at d3d entry points. Any suggestion whether that last patch should be sent to mesa stable or not ? As is the patch is a bit large, I'm thinking if it wouldn't be better to get it in if we get (m)any reports ? Although I won't object if you/others want to squeeze it in. st/nine: Align stack for entry points As mentioned on IRC, one can just add the alignment to the definition of WINAP in d3dtypes.h. Other, non nine, users of the macro, should not include d3dtypes.h so we ought to be fine. Alternatively ... But then I would have to duplicate the code to define PIPE_ALIGN_STACK. I'd better not have to maintain compiler detection code. create mode 100644 src/gallium/state_trackers/nine/nine_alignment.h Please add this new file to the list in src/gallium/state_trackers/nine/Makefile.sources Sure. I will also rename to nine_flags, because we may put other things not related to alignment in it. Thanks Emil And thanks to you ! Axel ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] egl/wayland: Try to use wl_surface.damage_buffer for SwapBuffersWithDamage
On 12/02/16 04:46 PM, Emil Velikov wrote: > On 11 February 2016 at 16:34, Derek Foremanwrote: >> Since commit d1314de293e9e4a63c35f094c3893aaaed8580b4 we ignore >> damage passed to SwapBuffersWithDamage. >> >> Wayland 1.10 now has functionality that allows us to properly >> process those damage rectangles, and a way to query if it's >> available. >> >> Now we can use wl_surface.damage_buffer and interpret the incoming >> damage as being in buffer co-ordinates. >> >> Signed-off-by: Derek Foreman >> --- >> src/egl/drivers/dri2/platform_wayland.c | 32 >> +--- >> 1 file changed, 29 insertions(+), 3 deletions(-) >> >> diff --git a/src/egl/drivers/dri2/platform_wayland.c >> b/src/egl/drivers/dri2/platform_wayland.c >> index c2438f7..b5a5b59 100644 >> --- a/src/egl/drivers/dri2/platform_wayland.c >> +++ b/src/egl/drivers/dri2/platform_wayland.c >> @@ -653,6 +653,30 @@ create_wl_buffer(struct dri2_egl_surface *dri2_surf) >>_buffer_listener, dri2_surf); >> } >> >> +static EGLBoolean >> +try_damage_buffer(struct dri2_egl_surface *dri2_surf, >> + const EGLint *rects, >> + EGLint n_rects) >> +{ >> +#ifdef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION >> + int i; >> + >> + if (wl_proxy_get_version((struct wl_proxy *) dri2_surf->wl_win->surface) >> + < WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION) >> + return EGL_FALSE; >> + >> + for (i = 0; i < n_rects; i++) { >> + const int *rect = [i * 4]; >> + >> + wl_surface_damage_buffer(dri2_surf->wl_win->surface, >> + rect[0], >> + dri2_surf->base.Height - rect[1] - rect[3], >> + rect[2], rect[3]); >> + } >> + return EGL_TRUE; >> +#endif > > I'm slightly worried about keeping this compile time. For example if > we compile against old wayland, and then run against a capable one... > this code won't exist thus will never get executed. Thus leading to a > handful of "wtf" moments. > > I would just ensure it's defined at the top. > > #ifndef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION > #define WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION foo > #endif If your wayland headers don't have WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION then compilation will fail because wl_proxy_get_version() isn't present. wl_proxy_get_version() will be formally introduced in the same wayland release (next Tuesday's 1.10 release) as wl_surface_damage_buffer(), so I'm intentionally using that as a tricky way to avoid the check entirely. Too tricky? If you prefer I can work out some autoconfy stuff to determine if wl_proxy_get_version() is available? > Cheers, > Emil > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 6/7] glx: remove incorrect refcounting of DRIdrawable
On 02/12/2016 06:56 AM, Michel Dänzer wrote: On 12.02.2016 05:58, Miklós Máté wrote: On 02/09/2016 05:02 PM, Ian Romanick wrote: On 02/08/2016 05:11 PM, Ian Romanick wrote: On 02/05/2016 01:11 PM, Miklós Máté wrote: dri drawables must never be released when unbound from a context as long as their corresponding glx objects (window, pixmap, pbuffer) still exist I'd really like to have Kristian weigh in, since DRI2 was his design, and this is all his code being affected. That said, I'm a little unsure about this change. The DRI drawables and associated resources will still get freed when the application eventually calls glXDestroyPBuffer or glXDestroyWindow. But I'm not 100% sure what will happen with GLX 1.2 applications... there are no glXDestroy* functions in GLX 1.2. In that case the application will have a soft leak because calling XDestroyWindow won't do anything on the client (or server?) for the DRI resources. I suspect that's what this code was trying to prevent. And this commit affirms that: commit bf69ce37f0dcbb479078ee676d5100ac63e20750 Author: Stéphane MarchesinDate: Wed Jun 15 15:09:12 2011 -0700 glx: implement drawable refcounting. The current dri context unbind logic will leak drawables until the process dies (they will then get released by the GEM code). There are two ways to fix this: either always call driReleaseDrawables every time we unbind a context (but that costs us round trips to the X server at getbuffers() time) or implement proper drawable refcounting. This patch implements the latter. Signed-off-by: Antoine Labour Signed-off-by: Stéphane Marchesin Reviewed-by: Adam Jackson Since we don't have any way to know when the corresponding GLX object ceases to exist, we don't know when it's safe to destroy the DRI object. I don't know how we can not leak and not prematurely destroy the object. :( That commit message exaggerates a little when it says "proper refcounting", because it only refcounts on bind (in driFetchDrawable), but not on create/destroy. With current Mesa the following happens: create glXPbuffer: dri drawable is created, refcount=0 bind it: refcount++ unbind it: refcount--, drawable is destroyed bind again: create new drawable, refcount=1 unbind again: refcount--, drawable is destroyed etc. Could that be fixed by starting with refcount=1 instead of 0? In theory, yes. In practice, no. I tried to add refcount=1 to the glXCreate* functions, but for example, you don't need to call glXCreateWindow: win=XCreateWindow(); glXMakeCurrent(dpy, win, glc); is fine. This is what the example on OpenGL wiki does, and more importantly, Wine does this, too. When should refcount=1 be set in such cases? I couldn't figure it out. They also say that "current unbind logic will leak drawables until the process dies", which is simply not true. The glXDestroy* calls properly dispose of the corresponding dri objects. With GLX 1.3 the dri drawables are correctly created and destroyed along with their corresponding glx objects even without the above commit. IMHO if someone deliberately uses GLX 1.2 or earlier, they know what they are doing (1.3 was released in 1998). I'd say that it's never safe to destroy a dri object until it's explicitly destroyed by the user, so I'm still convinced that my patch is correct. Unless I'm missing something, one issue I see with your patch is that a DRI drawable could be destroyed while it's still current for a context. This is an interesting question. The GLX 1.4 specification says on page 28 that "If draw is destroyed after glXMakeContextCurrent is called, then subsequent rendering commands will be processed and the context state will be updated, but the frame buffer state becomes undefined." This suggests that the lifetime of the draw buffer ends with destroy, not unbind. If this is true, we don't need refcount on makecurrent. However, on page 23 it says "The storage for the GLX pixmap will be freed when it is not current to any client." This is interesting, because one pixmap can be current to more than one client, and thus it needs to be refcounted across multiple processes. I think "storage" in this case means the server-side resources, and not the dri drawable, but I could be wrong. MM ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] egl/wayland: Try to use wl_surface.damage_buffer for SwapBuffersWithDamage
On 12 February 2016 at 23:09, Derek Foremanwrote: > On 12/02/16 04:46 PM, Emil Velikov wrote: >> On 11 February 2016 at 16:34, Derek Foreman wrote: >>> Since commit d1314de293e9e4a63c35f094c3893aaaed8580b4 we ignore >>> damage passed to SwapBuffersWithDamage. >>> >>> Wayland 1.10 now has functionality that allows us to properly >>> process those damage rectangles, and a way to query if it's >>> available. >>> >>> Now we can use wl_surface.damage_buffer and interpret the incoming >>> damage as being in buffer co-ordinates. >>> >>> Signed-off-by: Derek Foreman >>> --- >>> src/egl/drivers/dri2/platform_wayland.c | 32 >>> +--- >>> 1 file changed, 29 insertions(+), 3 deletions(-) >>> >>> diff --git a/src/egl/drivers/dri2/platform_wayland.c >>> b/src/egl/drivers/dri2/platform_wayland.c >>> index c2438f7..b5a5b59 100644 >>> --- a/src/egl/drivers/dri2/platform_wayland.c >>> +++ b/src/egl/drivers/dri2/platform_wayland.c >>> @@ -653,6 +653,30 @@ create_wl_buffer(struct dri2_egl_surface *dri2_surf) >>>_buffer_listener, dri2_surf); >>> } >>> >>> +static EGLBoolean >>> +try_damage_buffer(struct dri2_egl_surface *dri2_surf, >>> + const EGLint *rects, >>> + EGLint n_rects) >>> +{ >>> +#ifdef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION >>> + int i; >>> + >>> + if (wl_proxy_get_version((struct wl_proxy *) dri2_surf->wl_win->surface) >>> + < WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION) >>> + return EGL_FALSE; >>> + >>> + for (i = 0; i < n_rects; i++) { >>> + const int *rect = [i * 4]; >>> + >>> + wl_surface_damage_buffer(dri2_surf->wl_win->surface, >>> + rect[0], >>> + dri2_surf->base.Height - rect[1] - rect[3], >>> + rect[2], rect[3]); >>> + } >>> + return EGL_TRUE; >>> +#endif >> >> I'm slightly worried about keeping this compile time. For example if >> we compile against old wayland, and then run against a capable one... >> this code won't exist thus will never get executed. Thus leading to a >> handful of "wtf" moments. >> >> I would just ensure it's defined at the top. >> >> #ifndef WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION >> #define WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION foo >> #endif > > If your wayland headers don't have > WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION then compilation will fail > because wl_proxy_get_version() isn't present. > > wl_proxy_get_version() will be formally introduced in the same wayland > release (next Tuesday's 1.10 release) as wl_surface_damage_buffer(), so > I'm intentionally using that as a tricky way to avoid the check > entirely. Too tricky? > Slightly confusing/misleading, than anything else. > If you prefer I can work out some autoconfy stuff to determine if > wl_proxy_get_version() is available? > Personally I'd love to bump the wayland requirement... although we cannot do that yet. Can you please add a small comment * above the ifdef line. "wayland XX introduced wl_proxy_get_version() and CRAZY_LONG_MACRO_NAME" or anything that you feel will make it dead obvious. Thanks Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Fix test for big-endian architecture in compiler.h
Am 12.02.2016 um 10:01 schrieb Jochen Rollwagen: > Hi, > > i think i found & fixed a bug in mesa concerning tests for big-endian > machines. The defines tested don't exist or are wrongly defined so the > test (probably) never fires. The gcc defines on my machine concerning > big-endian are > > jochen@mac-mini:~/sources/mesa$ gcc -dM -E - < /dev/null | grep BIG > #define __BIGGEST_ALIGNMENT__ 16 > #define __BIG_ENDIAN__ 1 > #define __FLOAT_WORD_ORDER__ __ORDER_BIG_ENDIAN__ > #define _BIG_ENDIAN 1 > #define __ORDER_BIG_ENDIAN__ 4321 > #define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ > > The tested values in current mesa are quite different :-) > > The following patch fixes this. > > diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h > index c5ee741..99c63cb 100644 > --- a/src/mesa/main/compiler.h > +++ b/src/mesa/main/compiler.h > @@ -52,7 +52,7 @@ extern "C" { > * Try to use a runtime test instead. > * For now, only used by some DRI hardware drivers for color/texel > packing. > */ > -#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN > +#if defined(__BYTE_ORDER__) && defined(__BIG_ENDIAN__) && > __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ > #if defined(__linux__) > #include > #define CPU_TO_LE32( x ) bswap_32( x ) > Note that on some platforms this file would include endian.h - which defines those BYTE_ORDER etc. values. Albeit it includes this _after_ these ifdefs... But don't ask me how this is really supposed to work... Roland ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Enable tiled mem_copy with sRGB-formatted resources
On Thu, Feb 11, 2016 at 5:29 PM, Nanley Cherywrote: > From: Nanley Chery > > RGBA8 and BGRA8 unorm formats are compatible with the various > mem_copy functions. Their sRGB counterparts are also compatible > because they're also color-renderable (of importance when the > specified resource is a readbuffer) and they share the same > physical layout. > > Signed-off-by: Nanley Chery > --- > src/mesa/drivers/dri/i965/intel_tiled_memcpy.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c > b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c > index 2383401..3135458 100644 > --- a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c > +++ b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c > @@ -757,7 +757,9 @@ bool intel_get_memcpy(mesa_format tiledFormat, GLenum > format, >*cpp = 1; >*mem_copy = memcpy; > } else if ((tiledFormat == MESA_FORMAT_B8G8R8A8_UNORM) || > - (tiledFormat == MESA_FORMAT_B8G8R8X8_UNORM)) { > + (tiledFormat == MESA_FORMAT_B8G8R8X8_UNORM) || > + (tiledFormat == MESA_FORMAT_B8G8R8A8_SRGB) || > + (tiledFormat == MESA_FORMAT_B8G8R8X8_SRGB)) { >*cpp = 4; >if (format == GL_BGRA) { > *mem_copy = memcpy; > @@ -766,7 +768,9 @@ bool intel_get_memcpy(mesa_format tiledFormat, GLenum > format, > : rgba8_copy_aligned_src; >} > } else if ((tiledFormat == MESA_FORMAT_R8G8B8A8_UNORM) || > - (tiledFormat == MESA_FORMAT_R8G8B8X8_UNORM)) { > + (tiledFormat == MESA_FORMAT_R8G8B8X8_UNORM) || > + (tiledFormat == MESA_FORMAT_R8G8B8A8_SRGB) || > + (tiledFormat == MESA_FORMAT_R8G8B8X8_SRGB)) { >*cpp = 4; >if (format == GL_BGRA) { > /* Copying from RGBA to BGRA is the same as BGRA to RGBA so we can > -- > 2.7.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev We already allow memcpy for these format combinations on software read/write paths. It makes sense to allow them here too. Reviewed-by: Anuj Phogat ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] st/mesa: new st_DrawAtlasBitmaps() function for drawing bitmap text
This basically saves the current pipeline state, sets up state for rendering, constructs a set of textured quads, renders, then restores the previous pipeline state. It shouldn't be hard to implement a similar function for non-gallium drives. With some code refactoring, the vertex definition code could probably be shared. --- src/mesa/state_tracker/st_cb_bitmap.c | 143 +- src/mesa/state_tracker/st_context.h | 1 + 2 files changed, 141 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index d84bfef..461159b 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -33,6 +33,7 @@ #include "main/imports.h" #include "main/image.h" #include "main/bufferobj.h" +#include "main/dlist.h" #include "main/macros.h" #include "main/pbo.h" #include "program/program.h" @@ -51,6 +52,7 @@ #include "pipe/p_shader_tokens.h" #include "util/u_inlines.h" #include "util/u_simple_shaders.h" +#include "util/u_upload_mgr.h" #include "program/prog_instruction.h" #include "cso_cache/cso_context.h" @@ -182,7 +184,8 @@ make_bitmap_texture(struct gl_context *ctx, GLsizei width, GLsizei height, static void setup_render_state(struct gl_context *ctx, struct pipe_sampler_view *sv, - const GLfloat *color) + const GLfloat *color, + bool atlas) { struct st_context *st = st_context(ctx); struct cso_context *cso = st->cso_context; @@ -249,7 +252,10 @@ setup_render_state(struct gl_context *ctx, for (i = 0; i < st->state.num_samplers[PIPE_SHADER_FRAGMENT]; i++) { samplers[i] = >state.samplers[PIPE_SHADER_FRAGMENT][i]; } - samplers[fpv->bitmap_sampler] = >bitmap.sampler; + if (atlas) + samplers[fpv->bitmap_sampler] = >bitmap.atlas_sampler; + else + samplers[fpv->bitmap_sampler] = >bitmap.sampler; cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, num, (const struct pipe_sampler_state **) samplers); } @@ -324,7 +330,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, assert(height <= (GLsizei) maxSize); } - setup_render_state(ctx, sv, color); + setup_render_state(ctx, sv, color, false); /* convert Z from [0,1] to [-1,-1] to match viewport Z scale/bias */ z = z * 2.0f - 1.0f; @@ -571,6 +577,9 @@ init_bitmap_state(struct st_context *st) st->bitmap.sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST; st->bitmap.sampler.normalized_coords = st->internal_target == PIPE_TEXTURE_2D; + st->bitmap.atlas_sampler = st->bitmap.sampler; + st->bitmap.atlas_sampler.normalized_coords = 0; + /* init baseline rasterizer state once */ memset(>bitmap.rasterizer, 0, sizeof(st->bitmap.rasterizer)); st->bitmap.rasterizer.half_pixel_center = 1; @@ -665,11 +674,139 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y, } +/** + * Called via ctx->Driver.DrawAtlasBitmap() + */ +static void +st_DrawAtlasBitmaps(struct gl_context *ctx, +const struct gl_bitmap_atlas *atlas, +GLuint count, const GLubyte *ids) +{ + struct st_context *st = st_context(ctx); + struct pipe_context *pipe = st->pipe; + struct st_texture_object *stObj = st_texture_object(atlas->texObj); + struct pipe_sampler_view *sv; + /* convert Z from [0,1] to [-1,-1] to match viewport Z scale/bias */ + const float z = ctx->Current.RasterPos[2] * 2.0f - 1.0f; + const float *color = ctx->Current.RasterColor; + const float clip_x_scale = 2.0f / st->state.framebuffer.width; + const float clip_y_scale = 2.0f / st->state.framebuffer.height; + const unsigned num_verts = count * 4; + const unsigned num_vert_bytes = num_verts * sizeof(struct st_util_vertex); + struct st_util_vertex *verts; + struct pipe_vertex_buffer vb = {0}; + unsigned i; + + if (!st->bitmap.cache) { + init_bitmap_state(st); + } + + st_flush_bitmap_cache(st); + + st_validate_state(st); + + sv = st_create_texture_sampler_view(pipe, stObj->pt); + + setup_render_state(ctx, sv, color, true); + + vb.stride = sizeof(struct st_util_vertex); + + u_upload_alloc(st->uploader, 0, num_vert_bytes, 4, + _offset, , (void **) ); + + /* build quads vertex data */ + for (i = 0; i < count; i++) { + const GLfloat epsilon = 0.0001F; + const struct gl_bitmap_glyph *g = >glyphs[ids[i]]; + const float xmove = g->xmove, ymove = g->ymove; + const float xorig = g->xorig, yorig = g->yorig; + const float s0 = g->x, t0 = g->y; + const float s1 = s0 + g->w, t1 = t0 + g->h; + const float x0 = IFLOOR(ctx->Current.RasterPos[0] - xorig + epsilon); + const float y0 = IFLOOR(ctx->Current.RasterPos[1] - yorig + epsilon); + const float x1 = x0 + g->w, y1 = y0 + g->h; + const float clip_x0 = x0 * clip_x_scale - 1.0f; + const
[Mesa-dev] [PATCH 1/2] mesa: implement a display list / glBitmap texture atlas
This improves the performance of applications which use glXUseXFont() or wglUseFontBitmaps() and glCallLists() to draw bitmap text. Basically, we collect all the glBitmap images from the display lists and put them into a texture atlas. To render the bitmaps for a glCallLists() command, we render a set of textured quads where each quad is textured with one bitmap image. Actually, the rendering part has to be done by the Mesa driver or Mesa/gallium state tracker. Note that GLUT demos that use glutBitmapCharacter() don't benefit from this. --- src/mesa/main/dd.h | 8 ++ src/mesa/main/dlist.c | 383 + src/mesa/main/dlist.h | 38 + src/mesa/main/mtypes.h | 1 + src/mesa/main/shared.c | 15 ++ 5 files changed, 445 insertions(+) diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 19ef304..5d1370c 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -35,6 +35,7 @@ #include "glheader.h" +struct gl_bitmap_atlas; struct gl_buffer_object; struct gl_context; struct gl_display_list; @@ -154,6 +155,13 @@ struct dd_function_table { GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap ); + + /** +* Called by display list code for optimized glCallLists/glBitmap rendering +*/ + void (*DrawAtlasBitmaps)(struct gl_context *ctx, +const struct gl_bitmap_atlas *atlas, +GLuint count, const GLubyte *ids); /*@}*/ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 0e25efb..1927068 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -72,6 +72,9 @@ #include "vbo/vbo.h" +#define USE_BITMAP_ATLAS 1 + + /** * Other parts of Mesa (such as the VBO module) can plug into the display @@ -606,6 +609,259 @@ void mesa_print_display_list(GLuint list); /** + * Does the given display list only contain a single glBitmap call? + */ +static bool +is_bitmap_list(const struct gl_display_list *dlist) +{ + const Node *n = dlist->Head; + if (n[0].opcode == OPCODE_BITMAP) { + n += InstSize[OPCODE_BITMAP]; + if (n[0].opcode == OPCODE_END_OF_LIST) + return true; + } + return false; +} + + +/** + * Is the given display list an empty list? + */ +static bool +is_empty_list(const struct gl_display_list *dlist) +{ + const Node *n = dlist->Head; + return n[0].opcode == OPCODE_END_OF_LIST; +} + + +/** + * Delete/free a gl_bitmap_atlas. Called during context tear-down. + */ +void +_mesa_delete_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas) +{ + if (atlas->texObj) { + ctx->Driver.DeleteTexture(ctx, atlas->texObj); + } + free(atlas->glyphs); +} + + +/** + * Lookup a gl_bitmap_atlas by listBase ID. + */ +static struct gl_bitmap_atlas * +lookup_bitmap_atlas(struct gl_context *ctx, GLuint listBase) +{ + struct gl_bitmap_atlas *atlas; + + assert(listBase > 0); + atlas = _mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase); + return atlas; +} + + +/** + * Create new bitmap atlas and insert into hash table. + */ +static struct gl_bitmap_atlas * +alloc_bitmap_atlas(struct gl_context *ctx, GLuint listBase) +{ + struct gl_bitmap_atlas *atlas; + + assert(listBase > 0); + assert(_mesa_HashLookup(ctx->Shared->BitmapAtlas, listBase) == NULL); + + atlas = calloc(1, sizeof(*atlas)); + if (atlas) { + _mesa_HashInsert(ctx->Shared->BitmapAtlas, listBase, atlas); + } + + return atlas; +} + + +/** + * Try to build a bitmap atlas. This involves examining a sequence of + * display lists which contain glBitmap commands and putting the bitmap + * images into a texture map (the atlas). + * If we succeed, gl_bitmap_atlas::complete will be set to true. + * If we fail, gl_bitmap_atlas::incomplete will be set to true. + */ +static void +build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas, + GLuint listBase) +{ + unsigned i, row_height = 0, xpos = 0, ypos = 0; + GLubyte *map; + GLint map_stride; + + assert(atlas); + assert(!atlas->complete); + assert(atlas->numBitmaps > 0); + + /* We use a rectangle texture (non-normalized coords) for the atlas */ + assert(ctx->Extensions.NV_texture_rectangle); + + atlas->texWidth = 1024; + atlas->texHeight = 0; /* determined below */ + + atlas->glyphs = malloc(atlas->numBitmaps * sizeof(atlas->glyphs[0])); + if (!atlas->glyphs) { + /* give up */ + atlas->incomplete = true; + return; + } + + /* Loop over the display lists. They should all contain a single glBitmap +* call. If not, bail out. Also, compute the position and sizes of each +* bitmap in the atlas to determine the texture atlas size. +*/ + for (i = 0; i < atlas->numBitmaps; i++) { + const struct gl_display_list *list = _mesa_lookup_list(ctx, listBase + i); + const Node *n; +
[Mesa-dev] [PATCH 2/2] st/mesa: simplify st->ctx, ctx->st usage in a various places
--- src/mesa/state_tracker/st_cb_bitmap.c | 11 +-- src/mesa/state_tracker/st_cb_clear.c | 2 +- src/mesa/state_tracker/st_cb_drawpixels.c | 4 ++-- src/mesa/state_tracker/st_cb_drawtex.c| 6 +++--- src/mesa/state_tracker/st_cb_texture.c| 2 +- src/mesa/state_tracker/st_context.c | 10 +- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 6af9ade..d84bfef 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -193,7 +193,7 @@ setup_render_state(struct gl_context *ctx, key.st = st->has_shareable_shaders ? NULL : st; key.bitmap = GL_TRUE; key.clamp_color = st->clamp_frag_color_in_shader && - st->ctx->Color._ClampFragmentColor; + ctx->Color._ClampFragmentColor; fpv = st_get_fp_variant(st, st->fp, ); @@ -481,7 +481,7 @@ accum_bitmap(struct gl_context *ctx, struct st_context *st = ctx->st; struct bitmap_cache *cache = st->bitmap.cache; int px = -999, py = -999; - const GLfloat z = st->ctx->Current.RasterPos[2]; + const GLfloat z = ctx->Current.RasterPos[2]; if (width > BITMAP_CACHE_WIDTH || height > BITMAP_CACHE_HEIGHT) @@ -492,7 +492,7 @@ accum_bitmap(struct gl_context *ctx, py = y - cache->ypos; if (px < 0 || px + width > BITMAP_CACHE_WIDTH || py < 0 || py + height > BITMAP_CACHE_HEIGHT || - !TEST_EQ_4V(st->ctx->Current.RasterColor, cache->color) || + !TEST_EQ_4V(ctx->Current.RasterColor, cache->color) || ((fabs(z - cache->zpos) > Z_EPSILON))) { /* This bitmap would extend beyond cache bounds, or the bitmap * color is changing @@ -510,7 +510,7 @@ accum_bitmap(struct gl_context *ctx, cache->ypos = y - py; cache->zpos = z; cache->empty = GL_FALSE; - COPY_4FV(cache->color, st->ctx->Current.RasterColor); + COPY_4FV(cache->color, ctx->Current.RasterColor); } assert(px != -999); @@ -654,8 +654,7 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y, if (sv) { draw_bitmap_quad(ctx, x, y, ctx->Current.RasterPos[2], - width, height, sv, - st->ctx->Current.RasterColor); + width, height, sv, ctx->Current.RasterColor); pipe_sampler_view_reference(, NULL); } diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 1adaa5e..09292f5 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -237,7 +237,7 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) blend.rt[i].colormask |= PIPE_MASK_A; } - if (st->ctx->Color.DitherFlag) + if (ctx->Color.DitherFlag) blend.dither = 1; } cso_set_blend(cso, ); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 15a91c7..a3618e6 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -635,7 +635,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, const float tTop = invertTex ? maxYcoord : 0.0f; const float tBot = invertTex ? 0.0f : maxYcoord; - if (!st_draw_quad(ctx->st, clip_x0, clip_y0, clip_x1, clip_y1, z, + if (!st_draw_quad(st, clip_x0, clip_y0, clip_x1, clip_y1, z, sLeft, tBot, sRight, tTop, color, 0)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels"); } @@ -851,7 +851,7 @@ get_color_fp_variant(struct st_context *st) ctx->Pixel.AlphaScale != 1.0); key.pixelMaps = ctx->Pixel.MapColorFlag; key.clamp_color = st->clamp_frag_color_in_shader && - st->ctx->Color._ClampFragmentColor; + ctx->Color._ClampFragmentColor; fpv = st_get_fp_variant(st, st->fp, ); diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index 0fb54ce..83941d02 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -107,7 +107,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, { struct st_context *st = ctx->st; struct pipe_context *pipe = st->pipe; - struct cso_context *cso = ctx->st->cso_context; + struct cso_context *cso = st->cso_context; struct pipe_resource *vbuffer = NULL; GLuint i, numTexCoords, numAttribs; GLboolean emitColor; @@ -165,7 +165,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, /* positions (in clip coords) */ { - const struct gl_framebuffer *fb = st->ctx->DrawBuffer; + const struct gl_framebuffer *fb = ctx->DrawBuffer; const GLfloat fb_width = (GLfloat)fb->Width;
[Mesa-dev] [PATCH 1/2] st/mesa: use _mesa_geometric_width/height() in glDrawPixels code
--- src/mesa/state_tracker/st_cb_drawpixels.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index ee172a0..15a91c7 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -35,6 +35,7 @@ #include "main/bufferobj.h" #include "main/blit.h" #include "main/format_pack.h" +#include "main/framebuffer.h" #include "main/macros.h" #include "main/mtypes.h" #include "main/pack.h" @@ -456,6 +457,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, struct st_context *st = st_context(ctx); struct pipe_context *pipe = st->pipe; struct cso_context *cso = st->cso_context; + const unsigned fb_width = _mesa_geometric_width(ctx->DrawBuffer); + const unsigned fb_height = _mesa_geometric_height(ctx->DrawBuffer); GLfloat x0, y0, x1, y1; GLsizei maxSize; boolean normalized = sv[0]->texture->target == PIPE_TEXTURE_2D; @@ -597,8 +600,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, } /* viewport state: viewport matching window dims */ - cso_set_viewport_dims(cso, ctx->DrawBuffer->Width, - ctx->DrawBuffer->Height, TRUE); + cso_set_viewport_dims(cso, fb_width, fb_height, TRUE); cso_set_vertex_elements(cso, 3, st->util_velems); cso_set_stream_outputs(cso, 0, NULL, NULL); @@ -608,7 +610,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, * vertex shader and viewport transformation. */ if (st_fb_orientation(ctx->DrawBuffer) == Y_0_BOTTOM) { - y = ctx->DrawBuffer->Height - (int) (y + height * ctx->Pixel.ZoomY); + y = fb_height - (int) (y + height * ctx->Pixel.ZoomY); invertTex = !invertTex; } @@ -621,13 +623,10 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, z = z * 2.0f - 1.0f; { - const struct gl_framebuffer *fb = ctx->DrawBuffer; - const float fb_width = (float) fb->Width; - const float fb_height = (float) fb->Height; - const float clip_x0 = x0 / fb_width * 2.0f - 1.0f; - const float clip_y0 = y0 / fb_height * 2.0f - 1.0f; - const float clip_x1 = x1 / fb_width * 2.0f - 1.0f; - const float clip_y1 = y1 / fb_height * 2.0f - 1.0f; + const float clip_x0 = x0 / (float) fb_width * 2.0f - 1.0f; + const float clip_y0 = y0 / (float) fb_height * 2.0f - 1.0f; + const float clip_x1 = x1 / (float) fb_width * 2.0f - 1.0f; + const float clip_y1 = y1 / (float) fb_height * 2.0f - 1.0f; const float maxXcoord = normalized ? ((float) width / sv[0]->texture->width0) : (float) width; const float maxYcoord = normalized -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] configure.ac: enable_asm=yes when x-compiling across same X86 arch
Currently, configure script is forcing 'enable_asm' to be 'no' whenever cross-compilation is performed on X86 host. This is based on an assumption that target architecture is different from host's (i.e. ARM). But there's always a case that we do cross-compile for target that is also X86 based just like host in which same ASM codes will be supported. In other words, 'enable_asm' should not be forced to be "no" anymore in this case. This change removes this limitation by reseting enable_asm if the host is one of X86 based architectures and target has exactly same architecture with it in cross-compilation environment. Signed-off-by: Dongwon Kim--- configure.ac | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index b05f33d..0ad27c9 100644 --- a/configure.ac +++ b/configure.ac @@ -710,8 +710,10 @@ test "x$enable_asm" = xno && AC_MSG_RESULT([no]) if test "x$enable_asm" = xyes -a "x$cross_compiling" = xyes; then case "$host_cpu" in i?86 | x86_64 | amd64) -enable_asm=no -AC_MSG_RESULT([no, cross compiling]) +if test "x$host_cpu" != "x$target_cpu"; then +enable_asm=no +AC_MSG_RESULT([no, cross compiling]) +fi ;; esac fi -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] configure.ac: enable_asm=yes when x-compiling across same X86 arch
On Fri, Feb 12, 2016 at 5:04 PM, Dongwon Kimwrote: > Currently, configure script is forcing 'enable_asm' to be 'no' > whenever cross-compilation is performed on X86 host. This is > based on an assumption that target architecture is different > from host's (i.e. ARM). But there's always a case that we do > cross-compile for target that is also X86 based just like host > in which same ASM codes will be supported. In other words, > 'enable_asm' should not be forced to be "no" anymore in this > case. > > This change removes this limitation by reseting enable_asm > if the host is one of X86 based architectures and target > has exactly same architecture with it in cross-compilation > environment. > > Signed-off-by: Dongwon Kim > --- > configure.ac | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/configure.ac b/configure.ac > index b05f33d..0ad27c9 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -710,8 +710,10 @@ test "x$enable_asm" = xno && AC_MSG_RESULT([no]) > if test "x$enable_asm" = xyes -a "x$cross_compiling" = xyes; then > case "$host_cpu" in > i?86 | x86_64 | amd64) > -enable_asm=no > -AC_MSG_RESULT([no, cross compiling]) > +if test "x$host_cpu" != "x$target_cpu"; then > +enable_asm=no > +AC_MSG_RESULT([no, cross compiling]) > +fi > ;; Seems like a good idea to me. Reviewed-by: Matt Turner ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: reject explicit location on atomic counter uniforms
On Fri, 2016-02-12 at 18:45 -0500, Ilia Mirkin wrote: > On Fri, Feb 12, 2016 at 5:53 PM, Timothy Arceriu> wrote: > > On Thu, 2016-02-11 at 20:10 -0500, Ilia Mirkin wrote: > > > This fixes > > > > > > dEQP-GLES31.functional.uniform_location.negative.atomic_fragment > > > dEQP-GLES31.functional.uniform_location.negative.atomic_vertex > > > > > > Both of which have lines like > > > > > > layout(location = 3, binding = 0, offset = 0) uniform atomic_uint > > > uni0; > > > > > > The ARB_explicit_uniform_location spec makes a very tangential > > > mention > > > regarding atomic counters, but location isn't something that > > > makes > > > sense > > > with them. > > > > > > Signed-off-by: Ilia Mirkin > > > --- > > > > > > Had no clue where to stick this check... this seemed like as good > > > a > > > place as any. > > > > > > src/compiler/glsl/ast_to_hir.cpp | 5 + > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/src/compiler/glsl/ast_to_hir.cpp > > > b/src/compiler/glsl/ast_to_hir.cpp > > > index dbeb5c0..9fce06b 100644 > > > --- a/src/compiler/glsl/ast_to_hir.cpp > > > +++ b/src/compiler/glsl/ast_to_hir.cpp > > > @@ -4179,6 +4179,11 @@ ast_declarator_list::hir(exec_list > > > *instructions, > > > state->atomic_counter_offsets[qual_binding] = > > > qual_offset; > > > } > > > } > > > > Maybe we should just make this: > > else { > > _mesa_glsl_error(, state, "invalid atomic counter layout > > qualifier"); > > } > > Nope, that doesn't work. In this case > > layout(location = 3, binding = 0, offset = 0) > > it goes into the if () case above, as these are all merged by the > time > it goes into hir. Also, it's legal to just have binding, in which > case > it'd go into the else, which we don't want either. > > This has to be a standalone condition if I do it here. Right. I corrected myself on IRC. IMO it should be done something like this. /* Valid atomic layout qualifiers */ ast_type_qualifier atomic_layout_mask; atomic_layout_mask.flags.i = 0; atomic_layout_mask.flags.q.explicit_binding = 1; atomic_layout_mask.flags.q.explicit_offset = 1; atomic_layout_mask.flags.q.unifrom = 1 ; ??? if ((qual->flags.i & ~atomic_layout_mask.flags.i) != 0) _mesa_glsl_error(, state, "invalid atomic counter layout qualifier"); As I don't see why we should be treating location as a special case. > > An alternative, as mentioned on IRC, is to stick it into > apply_explicit_location in the if (uniform) check. Or maybe somewhere > else entirely. > > -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: reject explicit location on atomic counter uniforms
On Fri, Feb 12, 2016 at 8:52 PM, Timothy Arceriwrote: > On Fri, 2016-02-12 at 18:45 -0500, Ilia Mirkin wrote: >> On Fri, Feb 12, 2016 at 5:53 PM, Timothy Arceri > u> wrote: >> > On Thu, 2016-02-11 at 20:10 -0500, Ilia Mirkin wrote: >> > > This fixes >> > > >> > > dEQP-GLES31.functional.uniform_location.negative.atomic_fragment >> > > dEQP-GLES31.functional.uniform_location.negative.atomic_vertex >> > > >> > > Both of which have lines like >> > > >> > > layout(location = 3, binding = 0, offset = 0) uniform atomic_uint >> > > uni0; >> > > >> > > The ARB_explicit_uniform_location spec makes a very tangential >> > > mention >> > > regarding atomic counters, but location isn't something that >> > > makes >> > > sense >> > > with them. >> > > >> > > Signed-off-by: Ilia Mirkin >> > > --- >> > > >> > > Had no clue where to stick this check... this seemed like as good >> > > a >> > > place as any. >> > > >> > > src/compiler/glsl/ast_to_hir.cpp | 5 + >> > > 1 file changed, 5 insertions(+) >> > > >> > > diff --git a/src/compiler/glsl/ast_to_hir.cpp >> > > b/src/compiler/glsl/ast_to_hir.cpp >> > > index dbeb5c0..9fce06b 100644 >> > > --- a/src/compiler/glsl/ast_to_hir.cpp >> > > +++ b/src/compiler/glsl/ast_to_hir.cpp >> > > @@ -4179,6 +4179,11 @@ ast_declarator_list::hir(exec_list >> > > *instructions, >> > > state->atomic_counter_offsets[qual_binding] = >> > > qual_offset; >> > > } >> > >} >> > >> > Maybe we should just make this: >> >else { >> > _mesa_glsl_error(, state, "invalid atomic counter layout >> > qualifier"); >> >} >> >> Nope, that doesn't work. In this case >> >> layout(location = 3, binding = 0, offset = 0) >> >> it goes into the if () case above, as these are all merged by the >> time >> it goes into hir. Also, it's legal to just have binding, in which >> case >> it'd go into the else, which we don't want either. >> >> This has to be a standalone condition if I do it here. > > Right. I corrected myself on IRC. IMO it should be done something like > this. > >/* Valid atomic layout qualifiers */ >ast_type_qualifier atomic_layout_mask; >atomic_layout_mask.flags.i = 0; >atomic_layout_mask.flags.q.explicit_binding = 1; >atomic_layout_mask.flags.q.explicit_offset = 1; >atomic_layout_mask.flags.q.unifrom = 1 ; ??? > >if ((qual->flags.i & ~atomic_layout_mask.flags.i) != 0) > _mesa_glsl_error(, state, "invalid atomic counter layout > qualifier"); > > As I don't see why we should be treating location as a special case. Ah OK. But this should be done here, or moved into ast_type::merge_qualifier or whereever it does the other masking logic? -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/1] configure: Bail out on llvm-config component error
Signed-off-by: Jan Vesely--- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index 2750d4d..57330cb 100644 --- a/configure.ac +++ b/configure.ac @@ -2295,6 +2295,9 @@ dnl in LLVM_LIBS. if test "x$MESA_LLVM" != x0; then +if ! $LLVM_CONFIG --libs ${LLVM_COMPONENTS} >/dev/null; then + AC_MSG_ERROR([Calling ${LLVM_CONFIG} failed]) +fi LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`" dnl llvm-config may not give the right answer when llvm is a built as a -- 2.5.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] st/mesa: use _mesa_geometric_width/height() in glDrawPixels code
Reviewed-by: Ilia MirkinOn Fri, Feb 12, 2016 at 8:07 PM, Brian Paul wrote: > --- > src/mesa/state_tracker/st_cb_drawpixels.c | 19 +-- > 1 file changed, 9 insertions(+), 10 deletions(-) > > diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c > b/src/mesa/state_tracker/st_cb_drawpixels.c > index ee172a0..15a91c7 100644 > --- a/src/mesa/state_tracker/st_cb_drawpixels.c > +++ b/src/mesa/state_tracker/st_cb_drawpixels.c > @@ -35,6 +35,7 @@ > #include "main/bufferobj.h" > #include "main/blit.h" > #include "main/format_pack.h" > +#include "main/framebuffer.h" > #include "main/macros.h" > #include "main/mtypes.h" > #include "main/pack.h" > @@ -456,6 +457,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint > y, GLfloat z, > struct st_context *st = st_context(ctx); > struct pipe_context *pipe = st->pipe; > struct cso_context *cso = st->cso_context; > + const unsigned fb_width = _mesa_geometric_width(ctx->DrawBuffer); > + const unsigned fb_height = _mesa_geometric_height(ctx->DrawBuffer); > GLfloat x0, y0, x1, y1; > GLsizei maxSize; > boolean normalized = sv[0]->texture->target == PIPE_TEXTURE_2D; > @@ -597,8 +600,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint > y, GLfloat z, > } > > /* viewport state: viewport matching window dims */ > - cso_set_viewport_dims(cso, ctx->DrawBuffer->Width, > - ctx->DrawBuffer->Height, TRUE); > + cso_set_viewport_dims(cso, fb_width, fb_height, TRUE); > > cso_set_vertex_elements(cso, 3, st->util_velems); > cso_set_stream_outputs(cso, 0, NULL, NULL); > @@ -608,7 +610,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint > y, GLfloat z, > * vertex shader and viewport transformation. > */ > if (st_fb_orientation(ctx->DrawBuffer) == Y_0_BOTTOM) { > - y = ctx->DrawBuffer->Height - (int) (y + height * ctx->Pixel.ZoomY); > + y = fb_height - (int) (y + height * ctx->Pixel.ZoomY); >invertTex = !invertTex; > } > > @@ -621,13 +623,10 @@ draw_textured_quad(struct gl_context *ctx, GLint x, > GLint y, GLfloat z, > z = z * 2.0f - 1.0f; > > { > - const struct gl_framebuffer *fb = ctx->DrawBuffer; > - const float fb_width = (float) fb->Width; > - const float fb_height = (float) fb->Height; > - const float clip_x0 = x0 / fb_width * 2.0f - 1.0f; > - const float clip_y0 = y0 / fb_height * 2.0f - 1.0f; > - const float clip_x1 = x1 / fb_width * 2.0f - 1.0f; > - const float clip_y1 = y1 / fb_height * 2.0f - 1.0f; > + const float clip_x0 = x0 / (float) fb_width * 2.0f - 1.0f; > + const float clip_y0 = y0 / (float) fb_height * 2.0f - 1.0f; > + const float clip_x1 = x1 / (float) fb_width * 2.0f - 1.0f; > + const float clip_y1 = y1 / (float) fb_height * 2.0f - 1.0f; >const float maxXcoord = normalized ? > ((float) width / sv[0]->texture->width0) : (float) width; >const float maxYcoord = normalized > -- > 1.9.1 > > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: reject explicit location on atomic counter uniforms
On Fri, 2016-02-12 at 20:57 -0500, Ilia Mirkin wrote: > On Fri, Feb 12, 2016 at 8:52 PM, Timothy Arceriu> wrote: > > On Fri, 2016-02-12 at 18:45 -0500, Ilia Mirkin wrote: > > > On Fri, Feb 12, 2016 at 5:53 PM, Timothy Arceri > > om.a > > > u> wrote: > > > > On Thu, 2016-02-11 at 20:10 -0500, Ilia Mirkin wrote: > > > > > This fixes > > > > > > > > > > dEQP- > > > > > GLES31.functional.uniform_location.negative.atomic_fragment > > > > > dEQP- > > > > > GLES31.functional.uniform_location.negative.atomic_vertex > > > > > > > > > > Both of which have lines like > > > > > > > > > > layout(location = 3, binding = 0, offset = 0) uniform > > > > > atomic_uint > > > > > uni0; > > > > > > > > > > The ARB_explicit_uniform_location spec makes a very > > > > > tangential > > > > > mention > > > > > regarding atomic counters, but location isn't something that > > > > > makes > > > > > sense > > > > > with them. > > > > > > > > > > Signed-off-by: Ilia Mirkin > > > > > --- > > > > > > > > > > Had no clue where to stick this check... this seemed like as > > > > > good > > > > > a > > > > > place as any. > > > > > > > > > > src/compiler/glsl/ast_to_hir.cpp | 5 + > > > > > 1 file changed, 5 insertions(+) > > > > > > > > > > diff --git a/src/compiler/glsl/ast_to_hir.cpp > > > > > b/src/compiler/glsl/ast_to_hir.cpp > > > > > index dbeb5c0..9fce06b 100644 > > > > > --- a/src/compiler/glsl/ast_to_hir.cpp > > > > > +++ b/src/compiler/glsl/ast_to_hir.cpp > > > > > @@ -4179,6 +4179,11 @@ ast_declarator_list::hir(exec_list > > > > > *instructions, > > > > > state->atomic_counter_offsets[qual_binding] = > > > > > qual_offset; > > > > > } > > > > > } > > > > > > > > Maybe we should just make this: > > > > else { > > > > _mesa_glsl_error(, state, "invalid atomic counter > > > > layout > > > > qualifier"); > > > > } > > > > > > Nope, that doesn't work. In this case > > > > > > layout(location = 3, binding = 0, offset = 0) > > > > > > it goes into the if () case above, as these are all merged by the > > > time > > > it goes into hir. Also, it's legal to just have binding, in which > > > case > > > it'd go into the else, which we don't want either. > > > > > > This has to be a standalone condition if I do it here. > > > > Right. I corrected myself on IRC. IMO it should be done something > > like > > this. > > > > /* Valid atomic layout qualifiers */ > > ast_type_qualifier atomic_layout_mask; > > atomic_layout_mask.flags.i = 0; > > atomic_layout_mask.flags.q.explicit_binding = 1; > > atomic_layout_mask.flags.q.explicit_offset = 1; > > atomic_layout_mask.flags.q.unifrom = 1 ; ??? > > > > if ((qual->flags.i & ~atomic_layout_mask.flags.i) != 0) > > _mesa_glsl_error(, state, "invalid atomic counter layout > > qualifier"); > > > > As I don't see why we should be treating location as a special > > case. > > Ah OK. But this should be done here, or moved into > ast_type::merge_qualifier or whereever it does the other masking > logic? It would be nice to have it in ast_type::merge_qualifier or maybe a helper called from there but I don't think it knows what type its dealing with. It just knows about the qualifier and I'm not sure how easy it is to change that. It would be nice to go in a helper somewhere, but I think its ok for now to call it from this location. > > -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: reject explicit location on atomic counter uniforms
On Fri, Feb 12, 2016 at 5:53 PM, Timothy Arceriwrote: > On Thu, 2016-02-11 at 20:10 -0500, Ilia Mirkin wrote: >> This fixes >> >> dEQP-GLES31.functional.uniform_location.negative.atomic_fragment >> dEQP-GLES31.functional.uniform_location.negative.atomic_vertex >> >> Both of which have lines like >> >> layout(location = 3, binding = 0, offset = 0) uniform atomic_uint >> uni0; >> >> The ARB_explicit_uniform_location spec makes a very tangential >> mention >> regarding atomic counters, but location isn't something that makes >> sense >> with them. >> >> Signed-off-by: Ilia Mirkin >> --- >> >> Had no clue where to stick this check... this seemed like as good a >> place as any. >> >> src/compiler/glsl/ast_to_hir.cpp | 5 + >> 1 file changed, 5 insertions(+) >> >> diff --git a/src/compiler/glsl/ast_to_hir.cpp >> b/src/compiler/glsl/ast_to_hir.cpp >> index dbeb5c0..9fce06b 100644 >> --- a/src/compiler/glsl/ast_to_hir.cpp >> +++ b/src/compiler/glsl/ast_to_hir.cpp >> @@ -4179,6 +4179,11 @@ ast_declarator_list::hir(exec_list >> *instructions, >> state->atomic_counter_offsets[qual_binding] = >> qual_offset; >> } >>} > > Maybe we should just make this: >else { > _mesa_glsl_error(, state, "invalid atomic counter layout > qualifier"); >} Nope, that doesn't work. In this case layout(location = 3, binding = 0, offset = 0) it goes into the if () case above, as these are all merged by the time it goes into hir. Also, it's legal to just have binding, in which case it'd go into the else, which we don't want either. This has to be a standalone condition if I do it here. An alternative, as mentioned on IRC, is to stick it into apply_explicit_location in the if (uniform) check. Or maybe somewhere else entirely. -ilia ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev