[Mesa-dev] [PATCH] mesa: Restore NULL context check in _mesa_reference_renderbuffer_().
Starting KDE on i965 makes the X server die in a fire with the following assertion: X: intel_fbo.c:94: intel_delete_renderbuffer: Assertion `irb' failed. Obviously, this is rather unpleasant. Bisecting revealed that: 006918c0db77e945ac56b15bc64eba502b86d56c is the first bad commit commit 006918c0db77e945ac56b15bc64eba502b86d56c Author: Brian Paul bri...@vmware.com Date: Sat Dec 1 10:52:42 2012 -0700 mesa: remove warning message in _mesa_reference_renderbuffer_() We were warning when there was no current context and we're about to delete a renderbuffer, but that happens fairly often and isn't really a problem. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=57754 Note: This is a candidate for the stable branches. Tested-by: Ian Romanick ian.d.roman...@intel.com This commit removed not only the else emit warning block, but the whole NULL check as well. Apparently it's necessary, so put it back. Cc: Brian Paul bri...@vmware.com Cc: Ian Romanick i...@freedesktop.org --- src/mesa/main/renderbuffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) While this looks like an obvious fix, I'm not clear that it's the correct one. Seeing as we didn't pass a context before, I don't really understand why it matters...or would cause irb == NULL, anyway. Scrutiny welcome. This at least un-tanks my system in the meantime. diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index b426162..031c214 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -160,7 +160,8 @@ _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr, if (deleteFlag) { GET_CURRENT_CONTEXT(ctx); - oldRb-Delete(ctx, oldRb); + if (ctx) +oldRb-Delete(ctx, oldRb); } *ptr = NULL; -- 1.8.0.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] llvmpipe: fix txq for 1d/2d arrays.
Both patches look good to me Reviewed-by: Jose Fonseca jfons...@vmware.com - Original Message - From: Dave Airlie airl...@redhat.com Noticed would fail, we were doing two things wrong a) 1d arrays require the layers in height b) minifying the layers field. Signed-off-by: Dave Airlie airl...@redhat.com --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 22 +- src/gallium/drivers/llvmpipe/lp_setup.c | 6 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index ba265b2..c0389a8 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -1680,23 +1680,30 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, { LLVMValueRef lod; LLVMValueRef size; - int dims, i; + int dims, i, num_min; struct lp_build_context bld_int_vec; switch (static_state-target) { case PIPE_TEXTURE_1D: case PIPE_BUFFER: - dims = 1; + num_min = dims = 1; + break; + case PIPE_TEXTURE_1D_ARRAY: + num_min = 1; + dims = 2; break; case PIPE_TEXTURE_2D: case PIPE_TEXTURE_CUBE: case PIPE_TEXTURE_RECT: - dims = 2; + num_min = dims = 2; break; case PIPE_TEXTURE_3D: + num_min = dims = 3; + break; + case PIPE_TEXTURE_2D_ARRAY: + num_min = 2; dims = 3; break; - default: assert(0); return; @@ -1723,19 +1730,24 @@ lp_build_size_query_soa(struct gallivm_state *gallivm, dynamic_state-width(dynamic_state, gallivm, unit), lp_build_const_int32(gallivm, 0), ); + if (num_min == 1) + size = lp_build_minify(bld_int_vec, size, lod); if (dims = 2) { size = LLVMBuildInsertElement(gallivm-builder, size, dynamic_state-height(dynamic_state, gallivm, unit), lp_build_const_int32(gallivm, 1), ); } + if (num_min == 2) + size = lp_build_minify(bld_int_vec, size, lod); if (dims = 3) { size = LLVMBuildInsertElement(gallivm-builder, size, dynamic_state-depth(dynamic_state, gallivm, unit), lp_build_const_int32(gallivm, 2), ); } - size = lp_build_minify(bld_int_vec, size, lod); + if (num_min == 3) + size = lp_build_minify(bld_int_vec, size, lod); for (i=0; i dims; i++) { sizes_out[i] = lp_build_extract_broadcast(gallivm, bld_int_vec.type, int_type, diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 7d40d8c..3dfe335 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -678,7 +678,11 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup, struct lp_jit_texture *jit_tex; jit_tex = setup-fs.current.jit_context.textures[i]; jit_tex-width = tex-width0; - jit_tex-height = tex-height0; + if (tex-target == PIPE_TEXTURE_1D_ARRAY) { +jit_tex-height = tex-array_size; + } else { +jit_tex-height = tex-height0; + } jit_tex-first_level = view-u.tex.first_level; jit_tex-last_level = tex-last_level; -- 1.7.11.7 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 6/6] draw: fix/improve dirty state validation
Reviewed-by: Jose Fonseca jfons...@vmware.com Series looks excellent Brian. Thanks for nailing this issue. I never stop to be amazed on how state derivation bugs go unnoticed for so long, just because most apps ends up touch a lot of state at the same time. One could try to write piglit tests that draw something, change one bit of state, re-draw, but it would take a lot of tests to cover everything. Slight different issue -- you originally were looking into draw module and user buffer pointers -- is draw module actually properly flushing whenever user buffers are used? Or is that still outstanding? Jose - Original Message - This patch does two things: 1. Constant buffer state changes were broken (but happened to work by dumb luck). The problem is we weren't calling draw_do_flush() in draw_set_mapped_constant_buffer() when we changed that state. All the other draw_set_foo() functions were calling draw_do_flush() already. 2. Use a simpler state validation step when we're changing light-weight parameter state such as constant buffers, viewport dims or clip planes. There's no need to revalidate the whole pipeline when changing state like that. The new validation method is called bind_parameters() and is called instead of the prepare() method. A new DRAW_FLUSH_PARAMETER_CHANGE flag is used to signal these light-weight state changes. This results in a modest but measurable increase in FPS for many Mesa demos. --- src/gallium/auxiliary/draw/draw_context.c |6 ++- src/gallium/auxiliary/draw/draw_pipe.c |2 +- src/gallium/auxiliary/draw/draw_private.h |7 ++- src/gallium/auxiliary/draw/draw_pt.c | 14 ++- src/gallium/auxiliary/draw/draw_pt.h |7 +++ .../auxiliary/draw/draw_pt_fetch_shade_pipeline.c | 10 + .../draw/draw_pt_fetch_shade_pipeline_llvm.c | 43 --- src/gallium/auxiliary/draw/draw_pt_vsplit.c|2 +- 8 files changed, 68 insertions(+), 23 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index c231aba..bc2f0e1 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -289,7 +289,7 @@ void draw_set_rasterize_stage( struct draw_context *draw, void draw_set_clip_state( struct draw_context *draw, const struct pipe_clip_state *clip ) { - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_PARAMETER_CHANGE); memcpy(draw-plane[6], clip-ucp, sizeof(clip-ucp)); } @@ -301,7 +301,7 @@ void draw_set_clip_state( struct draw_context *draw, void draw_set_viewport_state( struct draw_context *draw, const struct pipe_viewport_state *viewport ) { - draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE ); + draw_do_flush(draw, DRAW_FLUSH_PARAMETER_CHANGE); draw-viewport = *viewport; /* struct copy */ draw-identity_viewport = (viewport-scale[0] == 1.0f viewport-scale[1] == 1.0f @@ -368,6 +368,8 @@ draw_set_mapped_constant_buffer(struct draw_context *draw, shader_type == PIPE_SHADER_GEOMETRY); debug_assert(slot PIPE_MAX_CONSTANT_BUFFERS); + draw_do_flush(draw, DRAW_FLUSH_PARAMETER_CHANGE); + switch (shader_type) { case PIPE_SHADER_VERTEX: draw-pt.user.vs_constants[slot] = buffer; diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c index ac449b7..f1ee6cb 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.c +++ b/src/gallium/auxiliary/draw/draw_pipe.c @@ -347,6 +347,6 @@ void draw_pipeline_flush( struct draw_context *draw, unsigned flags ) { draw-pipeline.first-flush( draw-pipeline.first, flags ); - if (!(flags DRAW_FLUSH_BACKEND)) + if (flags DRAW_FLUSH_STATE_CHANGE) draw-pipeline.first = draw-pipeline.validate; } diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index e52b3fd..2223fcb 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -144,6 +144,8 @@ struct draw_context unsigned opt; /** bitmask of PT_x flags */ unsigned eltSize; /* saved eltSize for flushing */ + boolean rebind_parameters; + struct { struct draw_pt_middle_end *fetch_emit; struct draw_pt_middle_end *fetch_shade_emit; @@ -434,8 +436,9 @@ void draw_pipeline_flush( struct draw_context *draw, * Flushing */ -#define DRAW_FLUSH_STATE_CHANGE 0x8 -#define DRAW_FLUSH_BACKEND 0x10 +#define DRAW_FLUSH_PARAMETER_CHANGE 0x1 /** Constants, viewport, etc */ +#define
[Mesa-dev] [Bug 57969] [softpipe] piglit timer_query regression
https://bugs.freedesktop.org/show_bug.cgi?id=57969 José Fonseca jfons...@vmware.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #1 from José Fonseca jfons...@vmware.com --- Thanks Vinson. Should be fixed with commit 122dfc5ee25ec4faf040baf5dc834d144bb3a42c Author: José Fonseca jose.r.fons...@gmail.com Date: Sat Dec 8 11:15:46 2012 + gallium/os: Fix nano-micro second concersion. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] softpipe: Use os_time_get_nano() everywhere.
From: José Fonseca jose.r.fons...@gmail.com --- src/gallium/drivers/softpipe/sp_query.c |8 src/gallium/drivers/softpipe/sp_screen.c |2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c index c173736..2dd82c8 100644 --- a/src/gallium/drivers/softpipe/sp_query.c +++ b/src/gallium/drivers/softpipe/sp_query.c @@ -91,7 +91,7 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) break; case PIPE_QUERY_TIMESTAMP_DISJOINT: case PIPE_QUERY_TIME_ELAPSED: - sq-start = 1000*os_time_get(); + sq-start = os_time_get_nano(); break; case PIPE_QUERY_SO_STATISTICS: sq-so.primitives_storage_needed = 0; @@ -131,7 +131,7 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q) /* fall through */ case PIPE_QUERY_TIMESTAMP_DISJOINT: case PIPE_QUERY_TIME_ELAPSED: - sq-end = 1000*os_time_get(); + sq-end = os_time_get_nano(); break; case PIPE_QUERY_SO_STATISTICS: sq-so.primitives_storage_needed = @@ -172,8 +172,8 @@ softpipe_get_query_result(struct pipe_context *pipe, break; case PIPE_QUERY_TIMESTAMP_DISJOINT: { struct pipe_query_data_timestamp_disjoint td; - /*os_get_time is in microseconds*/ - td.frequency = 100; + /* os_get_time_nano return nanoseconds */ + td.frequency = UINT64_C(10); td.disjoint = sq-end != sq-start; memcpy(vresult, td, sizeof(struct pipe_query_data_timestamp_disjoint)); diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 909fa1c..f344814 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -366,7 +366,7 @@ softpipe_flush_frontbuffer(struct pipe_screen *_screen, static uint64_t softpipe_get_timestamp(struct pipe_screen *_screen) { - return os_time_get()*1000; + return os_time_get_nano(); } /** -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 58012] New: Regression: Half Life 2 random crashes since 56e95d3c
https://bugs.freedesktop.org/show_bug.cgi?id=58012 Priority: medium Bug ID: 58012 Assignee: mesa-dev@lists.freedesktop.org Summary: Regression: Half Life 2 random crashes since 56e95d3c Severity: normal Classification: Unclassified OS: All Reporter: stefandoesin...@gmx.at Hardware: Other Status: NEW Version: git Component: Mesa core Product: Mesa Half Life 2 running in Wine crashes randomly on r300g. This is a regression. A bisect found this patch: 56e95d3ca231110188e5b910f4e17104f3176d52 is the first bad commit commit 56e95d3ca231110188e5b910f4e17104f3176d52 Author: Jordan Justen jordan.l.jus...@intel.com Date: Tue Dec 4 01:24:07 2012 -0800 mesa: validate that sync objects were created by mesa Previously, the user could send in a pointer that was not created by mesa. When we dereferenced that pointer, there would be an exception. Now we keep a set of pointers and verify that the pointer exists in that set before dereferencing it. Note: This fixes several crashing gles3conform tests. Signed-off-by: Jordan Justen jordan.l.jus...@intel.com Reviewed-by: Brian Paul bri...@vmware.com :04 04 d03812977c473d92fc0a9cb51844333cac23a441 9a2b9f9ab2ed82e2381f319fb60e7bfcbe7b6782 M src Thanks to Steam's crash handler it is tricky to get a backtrace. I managed to get some backtraces with function names but without source code references, and it appears that the crashes occur in various functions deleting GL objects - ARB shaders, VBOs, textures, maybe others. Half Life 2 also crashes on r600g, but I have not yet checked if it is caused by the same patch. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 58012] Regression: Half Life 2 random crashes since 56e95d3c
https://bugs.freedesktop.org/show_bug.cgi?id=58012 --- Comment #1 from Stefan Dösinger stefandoesin...@gmx.at --- Another note: My other benchmark programs seem to run fine. Those include 3DMark2000, 3DMark2001, Unigine Heaven(gl mode, inside wine), Trackmania Nations, World in Conflict and some very simple Direct3D overhead testers written by me. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 58012] Regression: Half Life 2 random crashes since 56e95d3c
https://bugs.freedesktop.org/show_bug.cgi?id=58012 --- Comment #2 from Henri Verbeet hverb...@gmail.com --- (In reply to comment #0) Thanks to Steam's crash handler it is tricky to get a backtrace. This is perhaps slightly OT here, but note that you can disable the steam crash handler by passing -nobreakpad to the application. Alternatively you can open the minidump files Steam writes with winedbg. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 6/6] draw: fix/improve dirty state validation
On 12/08/2012 03:48 AM, Jose Fonseca wrote: Reviewed-by: Jose Fonsecajfons...@vmware.com Series looks excellent Brian. Thanks for nailing this issue. I never stop to be amazed on how state derivation bugs go unnoticed for so long, just because most apps ends up touch a lot of state at the same time. One could try to write piglit tests that draw something, change one bit of state, re-draw, but it would take a lot of tests to cover everything. Slight different issue -- you originally were looking into draw module and user buffer pointers -- is draw module actually properly flushing whenever user buffers are used? Or is that still outstanding? That's separate. I have a fix for that too, but I need to rebase it on top of these changes, retest, etc. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: Restore NULL context check in _mesa_reference_renderbuffer_().
On 12/08/2012 01:10 AM, Kenneth Graunke wrote: Starting KDE on i965 makes the X server die in a fire with the following assertion: X: intel_fbo.c:94: intel_delete_renderbuffer: Assertion `irb' failed. Obviously, this is rather unpleasant. Bisecting revealed that: 006918c0db77e945ac56b15bc64eba502b86d56c is the first bad commit commit 006918c0db77e945ac56b15bc64eba502b86d56c Author: Brian Paulbri...@vmware.com Date: Sat Dec 1 10:52:42 2012 -0700 mesa: remove warning message in _mesa_reference_renderbuffer_() We were warning when there was no current context and we're about to delete a renderbuffer, but that happens fairly often and isn't really a problem. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=57754 Note: This is a candidate for the stable branches. Tested-by: Ian Romanickian.d.roman...@intel.com This commit removed not only the else emit warning block, but the whole NULL check as well. Apparently it's necessary, so put it back. Hi Kenneth, The assertion says the 'irb' is null, but you're checking if the context is null. Off hand, I think a irb==null check is needed in intel_delete_renderbuffer(). Maybe seeing a stack trace would shed more light on where the null irb/ctx is coming from. In any case, if you need to check for ctx==null, please do that in intel_delete_renderbuffer(). The deal is that some (most?) drivers don't need a context handle in order to free a renderbuffer. In the gallium state tracker we use the context to free a piece of context state that's associated with a renderbuffer, but the renderbuffer itself can be freed without a context. Sorry for the headaches this one is causing. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v3] mesa/uniform_query: Don't write to *params if there is an error
On 12/07/2012 05:34 PM, Matt Turner wrote: The GL 3.1 and ES 3.0 specs say of glGetActiveUniformsiv: If an error occurs, nothing will be written to params. So, make a pass through the indices and check that they're valid before the pass that actually writes to params. Checking pname happens on the first iteration of the second loop. Fixes es3conform's getactiveuniformsiv_for_nonexistent_uniform_indices test. --- src/mesa/main/uniform_query.cpp |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index cbdd39e..245e9a7 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -97,12 +97,16 @@ _mesa_GetActiveUniformsiv(GLuint program, for (i = 0; i uniformCount; i++) { GLuint index = uniformIndices[i]; - const struct gl_uniform_storage *uni =shProg-UniformStorage[index]; if (index= shProg-NumUserUniformStorage) { _mesa_error(ctx, GL_INVALID_VALUE, glGetActiveUniformsiv(index)); return; } + } + + for (i = 0; i uniformCount; i++) { + GLuint index = uniformIndices[i]; + const struct gl_uniform_storage *uni =shProg-UniformStorage[index]; switch (pname) { case GL_UNIFORM_TYPE: Reviewed-by: Brian Paul bri...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Mesa (master): r600g: Use default mul/mad function for tgsi-to-llvm
On 6 December 2012 21:34, Tom Stellard t...@stellard.net wrote: I asked idr about this on IRC and he said that IEEE rules are required for GLSL = 1.30 and they are compliant, but not required for GLSL 1.30. stringfellow added that the d3d9 spec required 0*anything = 0, which is probably why the hardware has those instructions. That also means that this will break a couple of d3d9 applications in Wine. That's fine, if perhaps a bit unfortunate, since technically it's not something Wine can depend on anyway, and d3d10 is going to require IEEE conventions. At some point there was talk about a EXT_zero_mul_conventions extension to select one or the other behaviour at the context level. (The main consideration for doing it at the context level instead of e.g. per-shader was that apparently NVIDIA hardware doesn't have separate instructions for this, and instead only has a global switch.) I don't think that extension went anywhere, although I'm not all that clear on the reasons. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/6] st/mesa: remove a weird msaa hack
It doesn't work and it's not clear how it's supposed to work. --- src/mesa/state_tracker/st_atom_rasterizer.c |3 +-- src/mesa/state_tracker/st_context.c | 17 - src/mesa/state_tracker/st_context.h |4 src/mesa/state_tracker/st_manager.c |7 +-- 4 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index d9e9d21..f20df9e 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -230,8 +230,7 @@ static void update_raster_state( struct st_context *st ) raster-line_stipple_factor = ctx-Line.StippleFactor - 1; /* _NEW_MULTISAMPLE */ - if (ctx-Multisample._Enabled || st-force_msaa) - raster-multisample = 1; + raster-multisample = ctx-Multisample._Enabled; /* _NEW_SCISSOR */ if (ctx-Scissor.Enabled) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 69bd503..efac9ee 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -97,22 +97,6 @@ void st_invalidate_state(struct gl_context * ctx, GLuint new_state) _vbo_InvalidateState(ctx, new_state); } - -/** - * Check for multisample env var override. - */ -int -st_get_msaa(void) -{ - const char *msaa = _mesa_getenv(__GL_FSAA_MODE); - if (msaa) - return atoi(msaa); - return 0; -} - - - - static struct st_context * st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, const struct st_config_options *options) @@ -193,7 +177,6 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, st-pixel_xfer.cache = _mesa_new_program_cache(); - st-force_msaa = st_get_msaa(); st-has_stencil_export = screen-get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 2cc5277..8e6f28b 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -185,7 +185,6 @@ struct st_context struct cso_context *cso_context; - int force_msaa; void *winsys_drawable_handle; /* The number of vertex buffers from the last call of validate_arrays. */ @@ -265,9 +264,6 @@ st_fb_orientation(const struct gl_framebuffer *fb) #define ST_CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T)) -extern int -st_get_msaa(void); - extern struct st_context * st_create_context(gl_api api, struct pipe_context *pipe, const struct gl_config *visual, diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index b065db0..e97b3f3 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -285,7 +285,6 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb, { struct gl_renderbuffer *rb; enum pipe_format format; - int samples; boolean sw; if (!stfb-iface) @@ -313,11 +312,7 @@ st_framebuffer_add_renderbuffer(struct st_framebuffer *stfb, if (format == PIPE_FORMAT_NONE) return FALSE; - samples = stfb-iface-visual-samples; - if (!samples) - samples = st_get_msaa(); - - rb = st_new_renderbuffer_fb(format, samples, sw); + rb = st_new_renderbuffer_fb(format, stfb-iface-visual-samples, sw); if (!rb) return FALSE; -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/6] gallium: manage render condition in cso_context and fix postprocessing w/ it
--- src/gallium/auxiliary/cso_cache/cso_context.c | 26 + src/gallium/auxiliary/cso_cache/cso_context.h |5 + src/gallium/auxiliary/postprocess/pp_run.c|3 +++ src/gallium/auxiliary/util/u_blit.c |3 +++ src/gallium/auxiliary/util/u_gen_mipmap.c |3 +++ src/mesa/state_tracker/st_cb_condrender.c | 11 +++ src/mesa/state_tracker/st_cb_texture.c| 12 src/mesa/state_tracker/st_context.h |4 src/mesa/state_tracker/st_gen_mipmap.c|9 - 9 files changed, 43 insertions(+), 33 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index b3decc5..b4ffac6 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -106,6 +106,8 @@ struct cso_context { void *vertex_shader, *vertex_shader_saved; void *geometry_shader, *geometry_shader_saved; void *velements, *velements_saved; + struct pipe_query *render_condition, *render_condition_saved; + uint render_condition_mode, render_condition_mode_saved; struct pipe_clip_state clip; struct pipe_clip_state clip_saved; @@ -723,6 +725,30 @@ void cso_restore_stencil_ref(struct cso_context *ctx) } } +void cso_set_render_condition(struct cso_context *ctx, + struct pipe_query *query, uint mode) +{ + struct pipe_context *pipe = ctx-pipe; + + if (ctx-render_condition != query || ctx-render_condition_mode != mode) { + pipe-render_condition(pipe, query, mode); + ctx-render_condition = query; + ctx-render_condition_mode = mode; + } +} + +void cso_save_render_condition(struct cso_context *ctx) +{ + ctx-render_condition_saved = ctx-render_condition; + ctx-render_condition_mode_saved = ctx-render_condition_mode; +} + +void cso_restore_render_condition(struct cso_context *ctx) +{ + cso_set_render_condition(ctx, ctx-render_condition_saved, +ctx-render_condition_mode_saved); +} + enum pipe_error cso_set_geometry_shader_handle(struct cso_context *ctx, void *handle) { diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 16158ed..b991eb9 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -173,6 +173,11 @@ enum pipe_error cso_set_stencil_ref(struct cso_context *cso, void cso_save_stencil_ref(struct cso_context *cso); void cso_restore_stencil_ref(struct cso_context *cso); +void cso_set_render_condition(struct cso_context *cso, + struct pipe_query *query, uint mode); +void cso_save_render_condition(struct cso_context *cso); +void cso_restore_render_condition(struct cso_context *cso); + /* clip state */ diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c index 6f06324..112458f 100644 --- a/src/gallium/auxiliary/postprocess/pp_run.c +++ b/src/gallium/auxiliary/postprocess/pp_run.c @@ -82,11 +82,13 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in, cso_save_vertex_shader(cso); cso_save_viewport(cso); cso_save_aux_vertex_buffer_slot(cso); + cso_save_render_condition(cso); /* set default state */ cso_set_sample_mask(cso, ~0); cso_set_stream_outputs(cso, 0, NULL, 0); cso_set_geometry_shader_handle(cso, NULL); + cso_set_render_condition(cso, NULL, 0); // Kept only for this frame. pipe_resource_reference(ppq-depth, indepth); @@ -139,6 +141,7 @@ pp_run(struct pp_queue_t *ppq, struct pipe_resource *in, cso_restore_vertex_shader(cso); cso_restore_viewport(cso); cso_restore_aux_vertex_buffer_slot(cso); + cso_restore_render_condition(cso); pipe_resource_reference(ppq-depth, NULL); pipe_resource_reference(refin, NULL); diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index ab1549e..9fe15b8 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -666,6 +666,7 @@ util_blit_pixels(struct blit_state *ctx, cso_save_geometry_shader(ctx-cso); cso_save_vertex_elements(ctx-cso); cso_save_aux_vertex_buffer_slot(ctx-cso); + cso_save_render_condition(ctx-cso); /* set misc state we care about */ if (writemask) @@ -677,6 +678,7 @@ util_blit_pixels(struct blit_state *ctx, cso_set_rasterizer(ctx-cso, ctx-rasterizer); cso_set_vertex_elements(ctx-cso, 2, ctx-velem); cso_set_stream_outputs(ctx-cso, 0, NULL, 0); + cso_set_render_condition(ctx-cso, NULL, 0); /* default sampler state */ ctx-sampler.normalized_coords = normalized; @@ -799,6 +801,7 @@ util_blit_pixels(struct blit_state *ctx, cso_restore_vertex_elements(ctx-cso); cso_restore_aux_vertex_buffer_slot(ctx-cso);
[Mesa-dev] [PATCH 3/6] gallium/cso: don't use the pipe_error return type where it's not needed
--- src/gallium/auxiliary/cso_cache/cso_context.c | 37 - src/gallium/auxiliary/cso_cache/cso_context.h | 28 --- 2 files changed, 24 insertions(+), 41 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index b4ffac6..3f6fd8c 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -547,15 +547,12 @@ void cso_restore_rasterizer(struct cso_context *ctx) } - -enum pipe_error cso_set_fragment_shader_handle(struct cso_context *ctx, - void *handle ) +void cso_set_fragment_shader_handle(struct cso_context *ctx, void *handle ) { if (ctx-fragment_shader != handle) { ctx-fragment_shader = handle; ctx-pipe-bind_fs_state(ctx-pipe, handle); } - return PIPE_OK; } void cso_delete_fragment_shader(struct cso_context *ctx, void *handle ) @@ -584,14 +581,12 @@ void cso_restore_fragment_shader(struct cso_context *ctx) } -enum pipe_error cso_set_vertex_shader_handle(struct cso_context *ctx, - void *handle ) +void cso_set_vertex_shader_handle(struct cso_context *ctx, void *handle) { if (ctx-vertex_shader != handle) { ctx-vertex_shader = handle; ctx-pipe-bind_vs_state(ctx-pipe, handle); } - return PIPE_OK; } void cso_delete_vertex_shader(struct cso_context *ctx, void *handle ) @@ -620,14 +615,13 @@ void cso_restore_vertex_shader(struct cso_context *ctx) } -enum pipe_error cso_set_framebuffer(struct cso_context *ctx, -const struct pipe_framebuffer_state *fb) +void cso_set_framebuffer(struct cso_context *ctx, + const struct pipe_framebuffer_state *fb) { if (memcmp(ctx-fb, fb, sizeof(*fb)) != 0) { util_copy_framebuffer_state(ctx-fb, fb); ctx-pipe-set_framebuffer_state(ctx-pipe, fb); } - return PIPE_OK; } void cso_save_framebuffer(struct cso_context *ctx) @@ -645,14 +639,13 @@ void cso_restore_framebuffer(struct cso_context *ctx) } -enum pipe_error cso_set_viewport(struct cso_context *ctx, - const struct pipe_viewport_state *vp) +void cso_set_viewport(struct cso_context *ctx, + const struct pipe_viewport_state *vp) { if (memcmp(ctx-vp, vp, sizeof(*vp))) { ctx-vp = *vp; ctx-pipe-set_viewport_state(ctx-pipe, vp); } - return PIPE_OK; } void cso_save_viewport(struct cso_context *ctx) @@ -670,24 +663,21 @@ void cso_restore_viewport(struct cso_context *ctx) } -enum pipe_error cso_set_blend_color(struct cso_context *ctx, -const struct pipe_blend_color *bc) +void cso_set_blend_color(struct cso_context *ctx, + const struct pipe_blend_color *bc) { if (memcmp(ctx-blend_color, bc, sizeof(ctx-blend_color))) { ctx-blend_color = *bc; ctx-pipe-set_blend_color(ctx-pipe, bc); } - return PIPE_OK; } -enum pipe_error cso_set_sample_mask(struct cso_context *ctx, -unsigned sample_mask) +void cso_set_sample_mask(struct cso_context *ctx, unsigned sample_mask) { if (ctx-sample_mask != sample_mask) { ctx-sample_mask = sample_mask; ctx-pipe-set_sample_mask(ctx-pipe, sample_mask); } - return PIPE_OK; } void cso_save_sample_mask(struct cso_context *ctx) @@ -700,14 +690,13 @@ void cso_restore_sample_mask(struct cso_context *ctx) cso_set_sample_mask(ctx, ctx-sample_mask_saved); } -enum pipe_error cso_set_stencil_ref(struct cso_context *ctx, -const struct pipe_stencil_ref *sr) +void cso_set_stencil_ref(struct cso_context *ctx, + const struct pipe_stencil_ref *sr) { if (memcmp(ctx-stencil_ref, sr, sizeof(ctx-stencil_ref))) { ctx-stencil_ref = *sr; ctx-pipe-set_stencil_ref(ctx-pipe, sr); } - return PIPE_OK; } void cso_save_stencil_ref(struct cso_context *ctx) @@ -749,8 +738,7 @@ void cso_restore_render_condition(struct cso_context *ctx) ctx-render_condition_mode_saved); } -enum pipe_error cso_set_geometry_shader_handle(struct cso_context *ctx, - void *handle) +void cso_set_geometry_shader_handle(struct cso_context *ctx, void *handle) { assert(ctx-has_geometry_shader || !handle); @@ -758,7 +746,6 @@ enum pipe_error cso_set_geometry_shader_handle(struct cso_context *ctx, ctx-geometry_shader = handle; ctx-pipe-bind_gs_state(ctx-pipe, handle); } - return PIPE_OK; } void cso_delete_geometry_shader(struct cso_context *ctx, void *handle) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index b991eb9..e8f5a9f 100644 ---
[Mesa-dev] [PATCH 4/6] gallium/util: move util_try_blit_via_copy_region to u_surface.c
--- src/gallium/auxiliary/util/u_blitter.c | 146 - src/gallium/auxiliary/util/u_blitter.h | 11 --- src/gallium/auxiliary/util/u_surface.c | 160 src/gallium/auxiliary/util/u_surface.h |4 + src/mesa/state_tracker/st_cb_texture.c |1 - 5 files changed, 164 insertions(+), 158 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index e788b65..e7baf3a 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -1822,149 +1822,3 @@ void util_blitter_custom_color(struct blitter_context *blitter, blitter_restore_render_cond(ctx); blitter_unset_running_flag(ctx); } - -/* Return whether this is an RGBA, Z, S, or combined ZS format. - */ -static unsigned get_format_mask(enum pipe_format format) -{ - const struct util_format_description *desc = util_format_description(format); - - assert(desc); - - if (util_format_has_depth(desc)) { - if (util_format_has_stencil(desc)) { - return PIPE_MASK_ZS; - } else { - return PIPE_MASK_Z; - } - } else { - if (util_format_has_stencil(desc)) { - return PIPE_MASK_S; - } else { - return PIPE_MASK_RGBA; - } - } -} - -/* Return if the box is totally inside the resource. - */ -static boolean is_box_inside_resource(const struct pipe_resource *res, - const struct pipe_box *box, - unsigned level) -{ - unsigned width = 1, height = 1, depth = 1; - - switch (res-target) { - case PIPE_BUFFER: - width = res-width0; - height = 1; - depth = 1; - break; - case PIPE_TEXTURE_1D: - width = u_minify(res-width0, level); - height = 1; - depth = 1; - break; - case PIPE_TEXTURE_2D: - case PIPE_TEXTURE_RECT: - width = u_minify(res-width0, level); - height = u_minify(res-height0, level); - depth = 1; - break; - case PIPE_TEXTURE_3D: - width = u_minify(res-width0, level); - height = u_minify(res-height0, level); - depth = u_minify(res-depth0, level); - break; - case PIPE_TEXTURE_CUBE: - width = u_minify(res-width0, level); - height = u_minify(res-height0, level); - depth = 6; - break; - case PIPE_TEXTURE_1D_ARRAY: - width = u_minify(res-width0, level); - height = 1; - depth = res-array_size; - break; - case PIPE_TEXTURE_2D_ARRAY: - width = u_minify(res-width0, level); - height = u_minify(res-height0, level); - depth = res-array_size; - break; - case PIPE_TEXTURE_CUBE_ARRAY: - width = u_minify(res-width0, level); - height = u_minify(res-height0, level); - depth = res-array_size; - assert(res-array_size % 6 == 0); - break; - case PIPE_MAX_TEXTURE_TYPES:; - } - - return box-x = 0 - box-x + box-width = (int) width - box-y = 0 - box-y + box-height = (int) height - box-z = 0 - box-z + box-depth = (int) depth; -} - -static unsigned get_sample_count(const struct pipe_resource *res) -{ - return res-nr_samples ? res-nr_samples : 1; -} - -boolean util_try_blit_via_copy_region(struct pipe_context *ctx, - const struct pipe_blit_info *blit) -{ - unsigned mask = get_format_mask(blit-dst.format); - - /* No format conversions. */ - if (blit-src.resource-format != blit-src.format || - blit-dst.resource-format != blit-dst.format || - !util_is_format_compatible( - util_format_description(blit-src.resource-format), - util_format_description(blit-dst.resource-format))) { - return FALSE; - } - - /* No masks, no filtering, no scissor. */ - if ((blit-mask mask) != mask || - blit-filter != PIPE_TEX_FILTER_NEAREST || - blit-scissor_enable) { - return FALSE; - } - - /* No flipping. */ - if (blit-src.box.width 0 || - blit-src.box.height 0 || - blit-src.box.depth 0) { - return FALSE; - } - - /* No scaling. */ - if (blit-src.box.width != blit-dst.box.width || - blit-src.box.height != blit-dst.box.height || - blit-src.box.depth != blit-dst.box.depth) { - return FALSE; - } - - /* No out-of-bounds access. */ - if (!is_box_inside_resource(blit-src.resource, blit-src.box, - blit-src.level) || - !is_box_inside_resource(blit-dst.resource, blit-dst.box, - blit-dst.level)) { - return FALSE; - } - - /* Sample counts must match. */ - if (get_sample_count(blit-src.resource) != - get_sample_count(blit-dst.resource)) { - return FALSE; - } - - ctx-resource_copy_region(ctx, blit-dst.resource, blit-dst.level, - blit-dst.box.x, blit-dst.box.y, blit-dst.box.z, - blit-src.resource,
[Mesa-dev] [PATCH 5/6] svga: stop using pipe_surface::usage
There are only 2 possible usages: render target and depth stencil. Both can be derived from the surface format, so the flag is redundant. And it's going away... --- src/gallium/drivers/svga/svga_surface.c | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c index 6c4f06d..d3c228b 100644 --- a/src/gallium/drivers/svga/svga_surface.c +++ b/src/gallium/drivers/svga/svga_surface.c @@ -191,9 +191,6 @@ svga_create_surface(struct pipe_context *pipe, struct svga_screen *ss = svga_screen(screen); struct svga_surface *s; unsigned face, zslice; - /* XXX surfaces should only be used for rendering purposes nowadays */ - boolean render = (surf_tmpl-usage (PIPE_BIND_RENDER_TARGET | - PIPE_BIND_DEPTH_STENCIL)) ? TRUE : FALSE; boolean view = FALSE; SVGA3dSurfaceFlags flags; SVGA3dSurfaceFormat format; @@ -224,26 +221,21 @@ svga_create_surface(struct pipe_context *pipe, s-base.u.tex.first_layer = surf_tmpl-u.tex.first_layer; s-base.u.tex.last_layer = surf_tmpl-u.tex.last_layer; - if (!render) { - flags = SVGA3D_SURFACE_HINT_TEXTURE; - } else { - if (surf_tmpl-usage PIPE_BIND_RENDER_TARGET) { - flags = SVGA3D_SURFACE_HINT_RENDERTARGET; - } - if (surf_tmpl-usage PIPE_BIND_DEPTH_STENCIL) { - flags = SVGA3D_SURFACE_HINT_DEPTHSTENCIL; - } + if (util_format_is_depth_or_stencil(surf_tmpl-format)) { + flags = SVGA3D_SURFACE_HINT_DEPTHSTENCIL; + } + else { + flags = SVGA3D_SURFACE_HINT_RENDERTARGET; } - format = svga_translate_format(ss, surf_tmpl-format, surf_tmpl-usage); + format = svga_translate_format(ss, surf_tmpl-format, 0); assert(format != SVGA3D_FORMAT_INVALID); if (svga_screen(screen)-debug.force_surface_view) view = TRUE; /* Currently only used for compressed textures */ - if (render - format != svga_translate_format(ss, surf_tmpl-format, surf_tmpl-usage)) { + if (format != svga_translate_format(ss, surf_tmpl-format, 0)) { view = TRUE; } -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 6/6] gallium: remove pipe_surface::usage
Not really used by anybody. --- src/gallium/auxiliary/postprocess/pp_init.c |4 ++-- src/gallium/auxiliary/postprocess/pp_program.c|1 - src/gallium/auxiliary/postprocess/pp_run.c|1 - src/gallium/auxiliary/util/u_blitter.c|7 --- src/gallium/auxiliary/util/u_debug.c |3 +-- src/gallium/auxiliary/util/u_dump_state.c |2 -- src/gallium/auxiliary/util/u_gen_mipmap.c |5 + src/gallium/auxiliary/util/u_inlines.h|9 +++-- src/gallium/auxiliary/util/u_surface.c|7 ++- src/gallium/auxiliary/util/u_surface.h|3 +-- src/gallium/auxiliary/util/u_surfaces.c |4 ++-- src/gallium/auxiliary/util/u_surfaces.h |6 +++--- src/gallium/auxiliary/vl/vl_idct.c|2 -- src/gallium/auxiliary/vl/vl_video_buffer.c|1 - src/gallium/drivers/i915/i915_surface.c |1 - src/gallium/drivers/llvmpipe/lp_texture.c |1 - src/gallium/drivers/noop/noop_state.c |1 - src/gallium/drivers/nouveau/nouveau_video.c |1 - src/gallium/drivers/nv30/nv30_miptree.c |1 - src/gallium/drivers/nv50/nv50_miptree.c |1 - src/gallium/drivers/nv50/nv50_resource.c |1 - src/gallium/drivers/nv50/nv50_surface.c |1 - src/gallium/drivers/nvc0/nvc0_surface.c |1 - src/gallium/drivers/r300/r300_texture.c |1 - src/gallium/drivers/r600/evergreen_compute_internal.c |1 - src/gallium/drivers/r600/r600_blit.c |4 src/gallium/drivers/r600/r600_texture.c |1 - src/gallium/drivers/radeonsi/r600_blit.c |2 -- src/gallium/drivers/radeonsi/r600_texture.c |1 - src/gallium/drivers/softpipe/sp_texture.c |1 - src/gallium/drivers/svga/svga_surface.c |1 - src/gallium/drivers/trace/tr_dump_state.c |2 -- src/gallium/include/pipe/p_state.h|1 - src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp |1 - src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h|2 -- src/gallium/state_trackers/vdpau/output.c |1 - src/gallium/state_trackers/vdpau/presentation.c |1 - src/gallium/state_trackers/vega/image.c | 10 +++--- src/gallium/state_trackers/vega/mask.c|6 ++ src/gallium/state_trackers/vega/renderer.c|3 +-- src/gallium/state_trackers/vega/vg_context.c |8 ++-- src/gallium/state_trackers/vega/vg_manager.c |4 +--- src/gallium/state_trackers/xa/xa_context.c|3 +-- src/gallium/state_trackers/xorg/xorg_exa.c|4 +--- src/gallium/state_trackers/xvmc/surface.c |1 - src/gallium/tests/graw/clear.c|1 - src/gallium/tests/graw/fs-test.c |1 - src/gallium/tests/graw/graw_util.h|2 -- src/gallium/tests/graw/gs-test.c |1 - src/gallium/tests/graw/quad-sample.c |1 - src/gallium/tests/graw/shader-leak.c |1 - src/gallium/tests/graw/tri-gs.c |1 - src/gallium/tests/graw/tri-instanced.c|1 - src/gallium/tests/graw/vs-test.c |1 - src/gallium/tests/trivial/quad-tex.c |1 - src/gallium/tests/trivial/tri.c |1 - src/mesa/state_tracker/st_atom_framebuffer.c |1 - src/mesa/state_tracker/st_cb_eglimage.c |8 ++-- src/mesa/state_tracker/st_cb_fbo.c|3 +-- src/mesa/state_tracker/st_cb_texture.c|1 - src/mesa/state_tracker/st_manager.c |8 +++- src/mesa/state_tracker/st_manager.h |3 +-- 62 files changed, 33 insertions(+), 126 deletions(-) diff --git a/src/gallium/auxiliary/postprocess/pp_init.c b/src/gallium/auxiliary/postprocess/pp_init.c index e059be6..d955273 100644 --- a/src/gallium/auxiliary/postprocess/pp_init.c +++ b/src/gallium/auxiliary/postprocess/pp_init.c @@ -213,7 +213,7 @@ pp_init_fbos(struct pp_queue_t *ppq, unsigned int w, tmp_res.depth0 = 1; tmp_res.array_size = 1; tmp_res.last_level = 0; - tmp_res.bind = p-surf.usage = PIPE_BIND_RENDER_TARGET; + tmp_res.bind = PIPE_BIND_RENDER_TARGET; if (!p-screen-is_format_supported(p-screen, tmp_res.format,
Re: [Mesa-dev] Mesa (master): r600g: Use default mul/mad function for tgsi-to-llvm
On Sat, Dec 8, 2012 at 8:55 AM, Henri Verbeet hverb...@gmail.com wrote: On 6 December 2012 21:34, Tom Stellard t...@stellard.net wrote: I asked idr about this on IRC and he said that IEEE rules are required for GLSL = 1.30 and they are compliant, but not required for GLSL 1.30. stringfellow added that the d3d9 spec required 0*anything = 0, which is probably why the hardware has those instructions. That also means that this will break a couple of d3d9 applications in Wine. That's fine, if perhaps a bit unfortunate, since technically it's not something Wine can depend on anyway, and d3d10 is going to require IEEE conventions. At some point there was talk about a EXT_zero_mul_conventions extension to select one or the other behaviour at the context level. (The main consideration for doing it at the context level instead of e.g. per-shader was that apparently NVIDIA hardware doesn't have separate instructions for this, and instead only has a global switch.) I don't think that extension went anywhere, although I'm not all that clear on the reasons. What about a mesa specific extension? Most people will be using wine on Linux anyway. Alex ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Mesa (master): r600g: Use default mul/mad function for tgsi-to-llvm
On 8 December 2012 16:01, Alex Deucher alexdeuc...@gmail.com wrote: What about a mesa specific extension? Most people will be using wine on Linux anyway. Sure, that works for us. Assuming Mesa is interested in a such an extension, of course. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] radeon/llvm: Split Word0 and Word1 in Export instruction
--- .../AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp | 4 +- lib/Target/AMDGPU/R600ISelLowering.cpp | 6 +- lib/Target/AMDGPU/R600Instructions.td | 99 -- 3 files changed, 60 insertions(+), 49 deletions(-) diff --git a/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp b/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp index 756f945..cb89ebe 100644 --- a/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp +++ b/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp @@ -174,8 +174,8 @@ void R600MCCodeEmitter::EncodeInstruction(const MCInst MI, raw_ostream OS, Emit(InstWord2, OS); break; } -case AMDGPU::EG_Export: -case AMDGPU::R600_Export: { +case AMDGPU::EG_ExportSwz: +case AMDGPU::R600_ExportSwz: uint64_t Inst = getBinaryCodeForInstr(MI, Fixups); EmitByte(INSTR_EXPORT, OS); Emit(Inst, OS); diff --git a/lib/Target/AMDGPU/R600ISelLowering.cpp b/lib/Target/AMDGPU/R600ISelLowering.cpp index 2218359..7787599 100644 --- a/lib/Target/AMDGPU/R600ISelLowering.cpp +++ b/lib/Target/AMDGPU/R600ISelLowering.cpp @@ -329,12 +329,12 @@ MachineBasicBlock * R600TargetLowering::EmitInstrWithCustomInserter( return BB; } - case AMDGPU::EG_Export: - case AMDGPU::R600_Export: { + case AMDGPU::EG_ExportSwz: + case AMDGPU::R600_ExportSwz: { bool EOP = (llvm::next(I)-getOpcode() == AMDGPU::RETURN)? 1 : 0; if (!EOP) return BB; -unsigned CfInst = (MI-getOpcode() == AMDGPU::EG_Export)? 84 : 40; +unsigned CfInst = (MI-getOpcode() == AMDGPU::EG_ExportSwz)? 84 : 40; BuildMI(*BB, I, BB-findDebugLoc(I), TII-get(MI-getOpcode())) .addOperand(MI-getOperand(0)) .addOperand(MI-getOperand(1)) diff --git a/lib/Target/AMDGPU/R600Instructions.td b/lib/Target/AMDGPU/R600Instructions.td index 880c05b..0afbd9d 100644 --- a/lib/Target/AMDGPU/R600Instructions.td +++ b/lib/Target/AMDGPU/R600Instructions.td @@ -478,6 +478,38 @@ def ExportType : SDTypeProfile0, 7, [SDTCisFP0, SDTCisInt1]; def EXPORT: SDNodeAMDGPUISD::EXPORT, ExportType, [SDNPHasChain, SDNPSideEffect]; +class ExportWord0 { + field bits32 Word0; + + bits13 arraybase; + bits2 type; + bits7 gpr; + bits2 elem_size; + + let Word0{12-0} = arraybase; + let Word0{14-13} = type; + let Word0{21-15} = gpr; + let Word0{22} = 0; // RW_REL + let Word0{29-23} = 0; // INDEX_GPR + let Word0{31-30} = elem_size; +} + +class ExportSwzWord1 { + field bits32 Word1; + + bits3 sw_x; + bits3 sw_y; + bits3 sw_z; + bits3 sw_w; + bits1 eop; + bits8 inst; + + let Word1{2-0} = sw_x; + let Word1{5-3} = sw_y; + let Word1{8-6} = sw_z; + let Word1{11-9} = sw_w; +} + multiclass ExportPatternInstruction ExportInst, bits8 cf_inst { def : Pat(int_R600_store_pixel_depth R600_Reg32:$reg), (ExportInst @@ -506,35 +538,16 @@ multiclass ExportPatternInstruction ExportInst, bits8 cf_inst { let isTerminator = 1, usesCustomInserter = 1 in { -class ExportInst : InstR600ISA( +class ExportSwzInst : InstR600ISA( outs), -(ins R600_Reg128:$src, i32imm:$type, i32imm:$arraybase, +(ins R600_Reg128:$gpr, i32imm:$type, i32imm:$arraybase, i32imm:$sw_x, i32imm:$sw_y, i32imm:$sw_z, i32imm:$sw_w, i32imm:$inst, i32imm:$eop), -!strconcat(EXPORT, $src), -[] { - bits13 arraybase; - bits2 type; - bits7 src; - - bits3 sw_x; - bits3 sw_y; - bits3 sw_z; - bits3 sw_w; - - bits1 eop; - bits8 inst; - - let Inst{12-0} = arraybase; - let Inst{14-13} = type; - let Inst{21-15} = src; - let Inst{22} = 0; // RW_REL - let Inst{29-23} = 0; // INDEX_GPR - let Inst{31-30} = 3; // ELEM_SIZE - let Inst{34-32} = sw_x; - let Inst{37-35} = sw_y; - let Inst{40-38} = sw_z; - let Inst{43-41} = sw_w; +!strconcat(EXPORT, $gpr), +[], ExportWord0, ExportSwzWord1 { + let elem_size = 3; + let Inst{31-0} = Word0; + let Inst{63-32} = Word1; } } // End isTerminator = 1, usesCustomInserter = 1 @@ -978,18 +991,17 @@ let Predicates = [isR600] in { defm DIV_r600 : DIV_CommonRECIP_IEEE_r600; def TGSI_LIT_Z_r600 : TGSI_LIT_Z_CommonMUL_LIT_r600, LOG_CLAMPED_r600, EXP_IEEE_r600; - def R600_Export : ExportInst { -let Inst{52-49} = 1; // BURST_COUNT -let Inst{53} = eop; -let Inst{54} = 1; // VALID_PIXEL_MODE -let Inst{62-55} = inst; -let Inst{63} = 1; // BARRIER - } - def : Pat(fsqrt R600_Reg32:$src), (MUL R600_Reg32:$src, (RECIPSQRT_CLAMPED_r600 R600_Reg32:$src)); - defm : ExportPatternR600_Export, 39; + def R600_ExportSwz : ExportSwzInst { +let Word1{20-17} = 1; // BURST_COUNT +let Word1{21} = eop; +let Word1{22} = 1; // VALID_PIXEL_MODE +let Word1{30-23} = inst; +let Word1{31} = 1; // BARRIER + } + defm : ExportPatternR600_ExportSwz, 39; } // Helper pattern for normalizing inputs to triginomic instructions for R700+ @@ -1124,16 +1136,15 @@ let hasSideEffects = 1 in { def : Pat(fp_to_uint R600_Reg32:$src0), (FLT_TO_UINT_eg
[Mesa-dev] [PATCH 2/3] radeon/llvm: Add a field for Export node (compMask) and factorise code handling store intrinsic
--- lib/Target/AMDGPU/R600ISelLowering.cpp | 91 -- lib/Target/AMDGPU/R600Instructions.td | 9 ++-- 2 files changed, 58 insertions(+), 42 deletions(-) diff --git a/lib/Target/AMDGPU/R600ISelLowering.cpp b/lib/Target/AMDGPU/R600ISelLowering.cpp index 7787599..1b6d909 100644 --- a/lib/Target/AMDGPU/R600ISelLowering.cpp +++ b/lib/Target/AMDGPU/R600ISelLowering.cpp @@ -360,6 +360,57 @@ MachineBasicBlock * R600TargetLowering::EmitInstrWithCustomInserter( using namespace llvm::Intrinsic; using namespace llvm::AMDGPUIntrinsic; +static SDValue +InsertScalarToRegisterExport(SelectionDAG DAG, DebugLoc DL, SDNode **ExportMap, +unsigned Slot, unsigned Channel, unsigned Inst, unsigned Type, +SDValue Scalar, SDValue Chain) { + if (!ExportMap[Slot]) { +SDValue Vector = DAG.getNode(ISD::INSERT_VECTOR_ELT, + DL, MVT::v4f32, + DAG.getUNDEF(MVT::v4f32), + Scalar, + DAG.getConstant(Channel, MVT::i32)); + +unsigned Mask = 1 Channel; + +const SDValue Ops[] = {Chain, Vector, DAG.getConstant(Inst, MVT::i32), +DAG.getConstant(Type, MVT::i32), DAG.getConstant(Slot, MVT::i32), +DAG.getConstant(Mask, MVT::i32)}; + +SDValue Res = DAG.getNode( +AMDGPUISD::EXPORT, +DL, +MVT::Other, +Ops, 6); + ExportMap[Slot] = Res.getNode(); + return Res; + } + + SDNode *ExportInstruction = (SDNode *) ExportMap[Slot] ; + SDValue PreviousVector = ExportInstruction-getOperand(1); + SDValue Vector = DAG.getNode(ISD::INSERT_VECTOR_ELT, + DL, MVT::v4f32, + PreviousVector, + Scalar, + DAG.getConstant(Channel, MVT::i32)); + + unsigned Mask = dyn_castConstantSDNode(ExportInstruction-getOperand(5)) + -getZExtValue(); + Mask |= (1 Channel); + + const SDValue Ops[] = {ExportInstruction-getOperand(0), Vector, + DAG.getConstant(Inst, MVT::i32), + DAG.getConstant(Type, MVT::i32), + DAG.getConstant(Slot, MVT::i32), + DAG.getConstant(Mask, MVT::i32)}; + + DAG.UpdateNodeOperands(ExportInstruction, + Ops, 6); + + return Chain; + +} + SDValue R600TargetLowering::LowerOperation(SDValue Op, SelectionDAG DAG) const { switch (Op.getOpcode()) { default: return AMDGPUTargetLowering::LowerOperation(Op, DAG); @@ -391,48 +442,14 @@ SDValue R600TargetLowering::LowerOperation(SDValue Op, SelectionDAG DAG) const MachineFunction MF = DAG.getMachineFunction(); R600MachineFunctionInfo *MFI = MF.getInfoR600MachineFunctionInfo(); int64_t RegIndex = castConstantSDNode(Op.getOperand(3))-getZExtValue(); - unsigned Slot = RegIndex / 4; SDNode **OutputsMap = MFI-Outputs; + return InsertScalarToRegisterExport(DAG, Op.getDebugLoc(), OutputsMap, + RegIndex / 4, RegIndex % 4, 0, 0, Op.getOperand(2), + Chain); - if (!OutputsMap[Slot]) { -SDValue Vector = DAG.getNode(ISD::INSERT_VECTOR_ELT, - Op.getDebugLoc(), MVT::v4f32, - DAG.getUNDEF(MVT::v4f32), - Op.getOperand(2), - DAG.getConstant(RegIndex % 4, MVT::i32)); - -const SDValue Ops[8] = {Chain, Vector, DAG.getConstant(0, MVT::i32), -DAG.getConstant(Slot, MVT::i32), DAG.getConstant(0, MVT::i32), -DAG.getConstant(1, MVT::i32), DAG.getConstant(2, MVT::i32), -DAG.getConstant(3, MVT::i32)}; - -SDValue Res = DAG.getNode( -AMDGPUISD::EXPORT, -Op.getDebugLoc(), -MVT::Other, -Ops, 8); - OutputsMap[Slot] = Res.getNode(); - return Res; } - SDNode *ExportInstruction = (SDNode *) OutputsMap[Slot] ; - SDValue PreviousVector = ExportInstruction-getOperand(1); - SDValue Vector = DAG.getNode(ISD::INSERT_VECTOR_ELT, - Op.getDebugLoc(), MVT::v4f32, - PreviousVector, - Op.getOperand(2), - DAG.getConstant(RegIndex % 4, MVT::i32)); - - const SDValue Ops[8] = {ExportInstruction-getOperand(0), Vector, DAG.getConstant(0, MVT::i32), - DAG.getConstant(Slot, MVT::i32), DAG.getConstant(0, MVT::i32), - DAG.getConstant(1, MVT::i32), DAG.getConstant(2, MVT::i32), - DAG.getConstant(3, MVT::i32)}; - - DAG.UpdateNodeOperands(ExportInstruction, - Ops, 8); - - return Chain; } // default for switch(IntrinsicID) default: break; diff --git a/lib/Target/AMDGPU/R600Instructions.td b/lib/Target/AMDGPU/R600Instructions.td index 0afbd9d..7c1df72 100644 --- a/lib/Target/AMDGPU/R600Instructions.td +++ b/lib/Target/AMDGPU/R600Instructions.td @@ -473,7 +473,7 @@ def INTERP_LOAD_P0 : R600_1OP 0xE0, INTERP_LOAD_P0, []; // Export Instructions //===--===// -def ExportType : SDTypeProfile0, 7, [SDTCisFP0, SDTCisInt1]; +def ExportType : SDTypeProfile0, 5, [SDTCisFP0, SDTCisInt1]; def EXPORT: SDNodeAMDGPUISD::EXPORT, ExportType, [SDNPHasChain, SDNPSideEffect]; @@
[Mesa-dev] [PATCH 3/3] radeon/llvm: Add an intrinsic to handle stream outputs.
--- .../AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp | 2 + lib/Target/AMDGPU/R600ISelLowering.cpp | 31 +++ lib/Target/AMDGPU/R600Instructions.td | 65 ++ lib/Target/AMDGPU/R600Intrinsics.td| 2 + lib/Target/AMDGPU/R600MachineFunctionInfo.cpp | 1 + lib/Target/AMDGPU/R600MachineFunctionInfo.h| 1 + 6 files changed, 102 insertions(+) diff --git a/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp b/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp index cb89ebe..018234a 100644 --- a/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp +++ b/lib/Target/AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp @@ -176,6 +176,8 @@ void R600MCCodeEmitter::EncodeInstruction(const MCInst MI, raw_ostream OS, } case AMDGPU::EG_ExportSwz: case AMDGPU::R600_ExportSwz: +case AMDGPU::EG_ExportBuf: +case AMDGPU::R600_ExportBuf: { uint64_t Inst = getBinaryCodeForInstr(MI, Fixups); EmitByte(INSTR_EXPORT, OS); Emit(Inst, OS); diff --git a/lib/Target/AMDGPU/R600ISelLowering.cpp b/lib/Target/AMDGPU/R600ISelLowering.cpp index 1b6d909..3a4283c 100644 --- a/lib/Target/AMDGPU/R600ISelLowering.cpp +++ b/lib/Target/AMDGPU/R600ISelLowering.cpp @@ -448,8 +448,39 @@ SDValue R600TargetLowering::LowerOperation(SDValue Op, SelectionDAG DAG) const RegIndex / 4, RegIndex % 4, 0, 0, Op.getOperand(2), Chain); +} +case AMDGPUIntrinsic::R600_store_stream_output : { + MachineFunction MF = DAG.getMachineFunction(); + R600MachineFunctionInfo *MFI = MF.getInfoR600MachineFunctionInfo(); + int64_t RegIndex = castConstantSDNode(Op.getOperand(3))-getZExtValue(); + int64_t BufIndex = castConstantSDNode(Op.getOperand(4))-getZExtValue(); + + SDNode **OutputsMap = MFI-StreamOutputs[BufIndex]; + unsigned Inst; + switch (castConstantSDNode(Op.getOperand(4))-getZExtValue() ) { + // STREAM3 + case 3: +Inst = 4; +break; + // STREAM2 + case 2: +Inst = 3; +break; + // STREAM1 + case 1: +Inst = 2; +break; + // STREAM0 + case 0: +Inst = 1; +break; + default: +assert(0 Wrong buffer id for stream outputs !); } + return InsertScalarToRegisterExport(DAG, Op.getDebugLoc(), OutputsMap, + RegIndex / 4, RegIndex % 4, Inst, 0, Op.getOperand(2), + Chain); } // default for switch(IntrinsicID) default: break; diff --git a/lib/Target/AMDGPU/R600Instructions.td b/lib/Target/AMDGPU/R600Instructions.td index 7c1df72..d89b03b 100644 --- a/lib/Target/AMDGPU/R600Instructions.td +++ b/lib/Target/AMDGPU/R600Instructions.td @@ -510,6 +510,18 @@ class ExportSwzWord1 { let Word1{11-9} = sw_w; } +class ExportBufWord1 { + field bits32 Word1; + + bits12 arraySize; + bits4 compMask; + bits1 eop; + bits8 inst; + + let Word1{11-0} = arraySize; + let Word1{15-12} = compMask; +} + multiclass ExportPatternInstruction ExportInst, bits8 cf_inst { def : Pat(int_R600_store_pixel_depth R600_Reg32:$reg), (ExportInst @@ -535,6 +547,30 @@ multiclass ExportPatternInstruction ExportInst, bits8 cf_inst { ; } +multiclass SteamOutputExportPatternInstruction ExportInst, +bits8 buf0inst, bits8 buf1inst, bits8 buf2inst, bits8 buf3inst { +// Stream0 + def : Pat(EXPORT (v4f32 R600_Reg128:$src), (i32 1), + (i32 imm:$type), (i32 imm:$arraybase), (i32 imm:$mask)), + (ExportInst R600_Reg128:$src, imm:$type, imm:$arraybase, + 4095, imm:$mask, buf0inst, 0); +// Stream1 + def : Pat(EXPORT (v4f32 R600_Reg128:$src), (i32 2), + (i32 imm:$type), (i32 imm:$arraybase), (i32 imm:$mask)), + (ExportInst R600_Reg128:$src, imm:$type, imm:$arraybase, + 4095, imm:$mask, buf1inst, 0); +// Stream2 + def : Pat(EXPORT (v4f32 R600_Reg128:$src), (i32 3), + (i32 imm:$type), (i32 imm:$arraybase), (i32 imm:$mask)), + (ExportInst R600_Reg128:$src, imm:$type, imm:$arraybase, + 4095, imm:$mask, buf2inst, 0); +// Stream3 + def : Pat(EXPORT (v4f32 R600_Reg128:$src), (i32 4), + (i32 imm:$type), (i32 imm:$arraybase), (i32 imm:$mask)), + (ExportInst R600_Reg128:$src, imm:$type, imm:$arraybase, + 4095, imm:$mask, buf3inst, 0); +} + let isTerminator = 1, usesCustomInserter = 1 in { class ExportSwzInst : InstR600ISA( @@ -551,6 +587,16 @@ class ExportSwzInst : InstR600ISA( } // End isTerminator = 1, usesCustomInserter = 1 +class ExportBufInst : InstR600ISA( +outs), +(ins R600_Reg128:$gpr, i32imm:$type, i32imm:$arraybase, +i32imm:$arraySize, i32imm:$compMask, i32imm:$inst, i32imm:$eop), +!strconcat(EXPORT, $gpr), +[], ExportWord0, ExportBufWord1 { + let elem_size = 0; + let Inst{31-0} = Word0; + let Inst{63-32} = Word1; +} let Predicates = [isR600toCayman] in { @@ -1001,6 +1047,15 @@ let Predicates = [isR600] in { let Word1{31} = 1; // BARRIER } defm :
Re: [Mesa-dev] [PATCH 2/2] R600: Convert global store address to dword offset during isel
Reviewed-By: Vincent Lejeune vljn at ovi.com Le jeudi 06 décembre 2012 à 14:09 -0800, Tom Stellard a écrit : From: Tom Stellard thomas.stell...@amd.com --- lib/Target/AMDGPU/AMDGPUISelLowering.cpp | 1 + lib/Target/AMDGPU/AMDGPUISelLowering.h | 1 + lib/Target/AMDGPU/AMDGPUInstrInfo.td | 3 +++ lib/Target/AMDGPU/AMDGPUInstructions.td | 5 lib/Target/AMDGPU/R600ISelLowering.cpp | 45 +++- lib/Target/AMDGPU/R600ISelLowering.h | 1 + lib/Target/AMDGPU/R600Instructions.td| 4 ++- 7 files changed, 46 insertions(+), 14 deletions(-) diff --git a/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/lib/Target/AMDGPU/AMDGPUISelLowering.cpp index 63b937f..1f31c2a 100644 --- a/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ b/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -387,6 +387,7 @@ const char* AMDGPUTargetLowering::getTargetNodeName(unsigned Opcode) const { NODE_NAME_CASE(BRANCH_COND); // AMDGPU DAG nodes + NODE_NAME_CASE(DWORDADDR) NODE_NAME_CASE(FRACT) NODE_NAME_CASE(FMAX) NODE_NAME_CASE(SMAX) diff --git a/lib/Target/AMDGPU/AMDGPUISelLowering.h b/lib/Target/AMDGPU/AMDGPUISelLowering.h index 992dab7..c7abaf6 100644 --- a/lib/Target/AMDGPU/AMDGPUISelLowering.h +++ b/lib/Target/AMDGPU/AMDGPUISelLowering.h @@ -111,6 +111,7 @@ enum { BRANCH_COND, // End AMDIL ISD Opcodes BITALIGN, + DWORDADDR, FRACT, FMAX, SMAX, diff --git a/lib/Target/AMDGPU/AMDGPUInstrInfo.td b/lib/Target/AMDGPU/AMDGPUInstrInfo.td index 23ca35a..96368e8 100644 --- a/lib/Target/AMDGPU/AMDGPUInstrInfo.td +++ b/lib/Target/AMDGPU/AMDGPUInstrInfo.td @@ -29,6 +29,9 @@ def AMDGPUDTIntTernaryOp : SDTypeProfile1, 3, [ // rotl(a, b) = bitalign(a, a, 32 - b) def AMDGPUbitalign : SDNodeAMDGPUISD::BITALIGN, AMDGPUDTIntTernaryOp; +// This argument to this node is a dword address. +def AMDGPUdwordaddr : SDNodeAMDGPUISD::DWORDADDR, SDTIntUnaryOp; + // out = a - floor(a) def AMDGPUfract : SDNodeAMDGPUISD::FRACT, SDTFPUnaryOp; diff --git a/lib/Target/AMDGPU/AMDGPUInstructions.td b/lib/Target/AMDGPU/AMDGPUInstructions.td index 443c6d4..e634d20 100644 --- a/lib/Target/AMDGPU/AMDGPUInstructions.td +++ b/lib/Target/AMDGPU/AMDGPUInstructions.td @@ -179,6 +179,11 @@ class BitConvert ValueType dt, ValueType st, RegisterClass rc : Pat (dt rc:$src0) ; +class DwordAddrPatValueType vt, RegisterClass rc : Pat + (vt (AMDGPUdwordaddr (vt rc:$addr))), + (vt rc:$addr) +; + include R600Instructions.td include SIInstrInfo.td diff --git a/lib/Target/AMDGPU/R600ISelLowering.cpp b/lib/Target/AMDGPU/R600ISelLowering.cpp index 5da52af..f7ae3c9 100644 --- a/lib/Target/AMDGPU/R600ISelLowering.cpp +++ b/lib/Target/AMDGPU/R600ISelLowering.cpp @@ -66,6 +66,11 @@ R600TargetLowering::R600TargetLowering(TargetMachine TM) : setOperationAction(ISD::SELECT, MVT::i32, Custom); setOperationAction(ISD::SELECT, MVT::f32, Custom); + setOperationAction(ISD::STORE, MVT::i32, Custom); + setOperationAction(ISD::STORE, MVT::f32, Custom); + setOperationAction(ISD::STORE, MVT::v4i32, Custom); + setOperationAction(ISD::STORE, MVT::v4f32, Custom); + setTargetDAGCombine(ISD::FP_ROUND); setSchedulingPreference(Sched::VLIW); @@ -137,23 +142,11 @@ MachineBasicBlock * R600TargetLowering::EmitInstrWithCustomInserter( case AMDGPU::RAT_WRITE_CACHELESS_32_eg: case AMDGPU::RAT_WRITE_CACHELESS_128_eg: { -// Convert to DWORD address -unsigned NewAddr = MRI.createVirtualRegister( - AMDGPU::R600_TReg32_XRegClass); -unsigned ShiftValue = MRI.createVirtualRegister( - AMDGPU::R600_TReg32RegClass); unsigned EOP = (llvm::next(I)-getOpcode() == AMDGPU::RETURN) ? 1 : 0; -// XXX In theory, we should be able to pass ShiftValue directly to -// the LSHR_eg instruction as an inline literal, but I tried doing it -// this way and it didn't produce the correct results. -TII-buildMovImm(*BB, I, ShiftValue, 2); -TII-buildDefaultInstruction(*BB, I, AMDGPU::LSHR_eg, NewAddr, - MI-getOperand(1).getReg(), - ShiftValue); BuildMI(*BB, I, BB-findDebugLoc(I), TII-get(MI-getOpcode())) .addOperand(MI-getOperand(0)) -.addReg(NewAddr) +.addOperand(MI-getOperand(1)) .addImm(EOP); // Set End of program bit break; } @@ -316,6 +309,7 @@ SDValue R600TargetLowering::LowerOperation(SDValue Op, SelectionDAG DAG) const case ISD::SELECT_CC: return LowerSELECT_CC(Op, DAG); case ISD::SELECT: return LowerSELECT(Op, DAG); case ISD::SETCC: return LowerSETCC(Op, DAG); + case ISD::STORE: return LowerSTORE(Op, DAG); case ISD::FPOW: return LowerFPOW(Op, DAG); case ISD::INTRINSIC_VOID: { SDValue Chain = Op.getOperand(0); @@ -763,6
[Mesa-dev] [Bug 58012] Regression: Half Life 2 random crashes since 56e95d3c
https://bugs.freedesktop.org/show_bug.cgi?id=58012 Jordan Justen jljus...@gmail.com changed: What|Removed |Added Assignee|mesa-dev@lists.freedesktop. |jljus...@gmail.com |org | -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glsl: Track UBO block names in the symbol table.
From: Kenneth Graunke kenn...@whitecape.org The GLSL 1.40 spec says: Uniform block names and variable names declared within uniform blocks are scoped at the program level. Track the block name in the symbol table and emit errors when conflicts exist. Fixes es3conform's uniform_buffer_object_block_name_conflict test, and fixes the piglit block-name-clashes-with-{variable,function,struct}.vert tests. NOTE: This is a candidate for the 9.0 branch. Reviewed-by: Ian Romanick ian.d.roman...@intel.com --- src/glsl/ast_to_hir.cpp| 6 ++ src/glsl/glsl_symbol_table.cpp | 14 +++--- src/glsl/glsl_symbol_table.h | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 94b63f6..71317f2 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -4054,6 +4054,12 @@ ast_uniform_block::hir(exec_list *instructions, struct gl_uniform_block *ubo = get_next_uniform_block(state); ubo-Name = ralloc_strdup(state-uniform_blocks, this-block_name); + if (!state-symbols-add_uniform_block(ubo)) { + YYLTYPE loc = this-get_location(); + _mesa_glsl_error(loc, state, Uniform block name `%s' already taken in + the current scope.\n, ubo-Name); + } + unsigned int num_variables = 0; foreach_list_typed(ast_declarator_list, decl_list, link, declarations) { foreach_list_const(node, decl_list-declarations) { diff --git a/src/glsl/glsl_symbol_table.cpp b/src/glsl/glsl_symbol_table.cpp index f934ea8..6171a27 100644 --- a/src/glsl/glsl_symbol_table.cpp +++ b/src/glsl/glsl_symbol_table.cpp @@ -41,13 +41,15 @@ public: ralloc_free(entry); } - symbol_table_entry(ir_variable *v) : v(v), f(0), t(0) {} - symbol_table_entry(ir_function *f) : v(0), f(f), t(0) {} - symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t) {} + symbol_table_entry(ir_variable *v) : v(v), f(0), t(0), u(0) {} + symbol_table_entry(ir_function *f) : v(0), f(f), t(0), u(0) {} + symbol_table_entry(const glsl_type *t) : v(0), f(0), t(t), u(0) {} + symbol_table_entry(struct gl_uniform_block *u) : v(0), f(0), t(t), u(u) {} ir_variable *v; ir_function *f; const glsl_type *t; + struct gl_uniform_block *u; }; glsl_symbol_table::glsl_symbol_table() @@ -132,6 +134,12 @@ bool glsl_symbol_table::add_function(ir_function *f) return _mesa_symbol_table_add_symbol(table, -1, f-name, entry) == 0; } +bool glsl_symbol_table::add_uniform_block(struct gl_uniform_block *u) +{ + symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(u); + return _mesa_symbol_table_add_symbol(table, -1, u-Name, entry) == 0; +} + void glsl_symbol_table::add_global_function(ir_function *f) { symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f); diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index 9f56027..f95fb8a 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -99,6 +99,7 @@ public: bool add_variable(ir_variable *v); bool add_type(const char *name, const glsl_type *t); bool add_function(ir_function *f); + bool add_uniform_block(struct gl_uniform_block *u); /*@}*/ /** -- 1.7.11.7 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa syncobj: don't store a pointer to the set_entry
The set_entry pointer can become invalid if the set table is re-hashed. This likely will fix https://bugs.freedesktop.org/show_bug.cgi?id=58012 (Regression since 56e95d3c) Signed-off-by: Jordan Justen jordan.l.jus...@intel.com Cc: Stefan Dösinger stefandoesin...@gmx.at Cc: Matt Turner matts...@gmail.com --- src/mesa/main/mtypes.h |1 - src/mesa/main/syncobj.c | 14 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b353e70..11a8322 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2513,7 +2513,6 @@ struct gl_query_state /** Sync object state */ struct gl_sync_object { - struct set_entry *SetEntry; GLenum Type; /** GL_SYNC_FENCE */ GLuint Name; /** Fence name */ GLint RefCount;/** Reference count */ diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c index f599982..b977bfa 100644 --- a/src/mesa/main/syncobj.c +++ b/src/mesa/main/syncobj.c @@ -199,10 +199,16 @@ _mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) void _mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) { + struct set_entry *entry; + _glthread_LOCK_MUTEX(ctx-Shared-Mutex); syncObj-RefCount--; if (syncObj-RefCount == 0) { - _mesa_set_remove(ctx-Shared-SyncObjects, syncObj-SetEntry); + entry = _mesa_set_search(ctx-Shared-SyncObjects, + _mesa_hash_pointer(syncObj), + syncObj); + assert (entry != NULL); + _mesa_set_remove(ctx-Shared-SyncObjects, entry); _glthread_UNLOCK_MUTEX(ctx-Shared-Mutex); ctx-Driver.DeleteSyncObject(ctx, syncObj); @@ -290,9 +296,9 @@ _mesa_FenceSync(GLenum condition, GLbitfield flags) ctx-Driver.FenceSync(ctx, syncObj, condition, flags); _glthread_LOCK_MUTEX(ctx-Shared-Mutex); - syncObj-SetEntry = _mesa_set_add(ctx-Shared-SyncObjects, -_mesa_hash_pointer(syncObj), -syncObj); + _mesa_set_add(ctx-Shared-SyncObjects, +_mesa_hash_pointer(syncObj), +syncObj); _glthread_UNLOCK_MUTEX(ctx-Shared-Mutex); return (GLsync) syncObj; -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] Support for string filenames in #line [version 2]
I sent an earlier proof-of-concept patch for adding support to #line for a filename as a string, (rather than just a numeric source number). Here in version 2, is a much more complete series, with the following changes: 1. The first patch in the series updates the previously-sent patch to correctly strip quotation marks from the string-literal when reading the filename. So the filename will appear without quotation marks in error messages. (The quotation marks are still added as required when re-emitting #lien directives for the downstream GLSL compiler to consume.) 2. A glcpp test is added for the above functionality, (filename appearing in an error message). 3. The glsl compiler is also updated to support #line with a string filename 4. New make check tests are added to test this, (as well as other tests for handling of #line by the glsl compiler). 5. The new tests uncovered two other bugs in the handling of #line: An off-by-one error in line numbers, and source numbers always being reset to 0. Both of these bugs are fixed in this series, (and tested by make check). 6. Some minor cleanups to the glsl lexer, (mostly reduction of duplicated code). 7. Instructing bison to expect exactly one shift/reduce conflict in its grammar, (the unavoidable conflict due to the dangling-else case), and to generate an error if any other conflicts are added to the grammar. NOTE: The commit message for patch 1 describes special behavior for GLES. The code for this behavior is present in the patch, but is currently disabled with an #if 0. This code should be re-enabled when the gles3 branch lands, (whether before or after this series). -Carl ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/10] glcpp: Add support to #line for a filnename, not just a source string number
Such as: #line 23 foo.c Having a filename here is quite useful and many other OpenGL implementations allow this. Note that for GLES we take the hard line and insist on a numeric source string number as per the specification and which glcpp has always supported: #line 23 3 --- src/glsl/glcpp/glcpp-lex.l | 28 ++ src/glsl/glcpp/glcpp-parse.y | 64 ++ src/glsl/glcpp/glcpp.h |8 +++--- src/glsl/glcpp/pp.c |4 +-- 4 files changed, 81 insertions(+), 23 deletions(-) diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l index fd28711..a6171cc 100644 --- a/src/glsl/glcpp/glcpp-lex.l +++ b/src/glsl/glcpp/glcpp-lex.l @@ -44,20 +44,20 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner); do {\ if (parser-has_new_line_number)\ yylineno = parser-new_line_number; \ - if (parser-has_new_source_number) \ - yylloc-source = parser-new_source_number; \ + if (parser-has_new_source) \ + yylloc-source = parser-new_source;\ yylloc-first_column = yycolumn + 1;\ yylloc-first_line = yylineno; \ yycolumn += yyleng; \ parser-has_new_line_number = 0;\ - parser-has_new_source_number = 0; \ + parser-has_new_source = 0; \ } while(0); #define YY_USER_INIT \ do {\ yylineno = 1; \ yycolumn = 1; \ - yylloc-source = 0; \ + yylloc-source = 0; \ } while(0) %} @@ -84,7 +84,7 @@ strings, we have to be careful to avoid OTHER matching and hiding something that CPP does care about. So we simply exclude all characters that appear in any other expressions. */ -OTHER [^][_#[:space:]#a-zA-Z0-9(){}.*~!/%^|;,=+-] +OTHER [^][_#[:space:]#a-zA-Z0-9(){}.*~!/%^|;,=+-] DIGITS [0-9][0-9]* DECIMAL_INTEGER[1-9][0-9]*[uU]? @@ -120,6 +120,24 @@ HEXADECIMAL_INTEGER0[xX][0-9a-fA-F]+[uU]? return SPACE; } +\(\\.|[^\\\n])*\ { + /* Drop the quotation marks when returning a string's literal value. +* +* Note: A truly *correct* solution would also interpret any +* escape sequences within the string. We intentionally don't +* do this. The rationale is for code savings and the +* justification is that strings aren't actually part of the +* GLSL language. We're only parsing them as a convenience for +* use in '#line XX foo.c' and even that isn't part of the +* specification. So, for this limited use case of filenames, +* escape sequences shouldn't be common, and when they are, +* users can deal with the un-interpreted escape sequence +* appearing in the filename in error messages. +*/ + yylval-str = ralloc_strndup (yyextra, yytext + 1, strlen(yytext) - 2); + return STRING_LITERAL; +} + {HASH}version{HSPACE}+ { yylval-str = ralloc_strdup (yyextra, yytext); yyextra-space_tokens = 0; diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index 380a1d9..eaf01cd 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -164,10 +164,10 @@ add_builtin_define(glcpp_parser_t *parser, const char *name, int value); %lex-param {glcpp_parser_t *parser} %expect 0 -%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH HASH_DEFINE FUNC_IDENTIFIER OBJ_IDENTIFIER HASH_ELIF HASH_ELSE HASH_ENDIF HASH_IF HASH_IFDEF HASH_IFNDEF HASH_LINE HASH_UNDEF HASH_VERSION IDENTIFIER IF_EXPANDED INTEGER INTEGER_STRING LINE_EXPANDED NEWLINE OTHER PLACEHOLDER SPACE +%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH HASH_DEFINE FUNC_IDENTIFIER OBJ_IDENTIFIER HASH_ELIF HASH_ELSE HASH_ENDIF HASH_IF HASH_IFDEF HASH_IFNDEF HASH_LINE HASH_UNDEF HASH_VERSION IDENTIFIER IF_EXPANDED INTEGER INTEGER_STRING LINE_EXPANDED NEWLINE OTHER PLACEHOLDER SPACE STRING_LITERAL %token PASTE %type ival expression INTEGER operator SPACE integer_constant -%type str IDENTIFIER FUNC_IDENTIFIER OBJ_IDENTIFIER INTEGER_STRING OTHER +%type str IDENTIFIER FUNC_IDENTIFIER OBJ_IDENTIFIER INTEGER_STRING OTHER STRING_LITERAL %type string_list identifier_list %type token preprocessing_token conditional_token %type token_list pp_tokens replacement_list text_line conditional_tokens @@ -229,13 +229,27 @@ expanded_line: | LINE_EXPANDED integer_constant integer_constant NEWLINE {
[Mesa-dev] [PATCH 02/10] glcpp: Add test for #line with a string filename
For which we just added support to the preprocessor. --- src/glsl/glcpp/tests/117-hash-line-with-filename.c |3 +++ src/glsl/glcpp/tests/117-hash-line-with-filename.c.expected |5 + 2 files changed, 8 insertions(+) create mode 100644 src/glsl/glcpp/tests/117-hash-line-with-filename.c create mode 100644 src/glsl/glcpp/tests/117-hash-line-with-filename.c.expected diff --git a/src/glsl/glcpp/tests/117-hash-line-with-filename.c b/src/glsl/glcpp/tests/117-hash-line-with-filename.c new file mode 100644 index 000..6c2bdc3 --- /dev/null +++ b/src/glsl/glcpp/tests/117-hash-line-with-filename.c @@ -0,0 +1,3 @@ +#line 1 some-file.c +__FILE__ +#error should list some-file.c in the error diff --git a/src/glsl/glcpp/tests/117-hash-line-with-filename.c.expected b/src/glsl/glcpp/tests/117-hash-line-with-filename.c.expected new file mode 100644 index 000..b0578e2 --- /dev/null +++ b/src/glsl/glcpp/tests/117-hash-line-with-filename.c.expected @@ -0,0 +1,5 @@ +some-file.c:2(1): preprocessor error: #error should list some-file.c in the error +#line 1 some-file.c +some-file.c + + -- 1.7.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/10] glsl: Use {HASH} expression consistently.
The {HASH} alias is identical to the open-coded regular expressions being replaced here, so no behavioral change, (just easier-to-read code). --- src/glsl/glsl_lexer.ll |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll index 2f66c58..4fca4ea 100644 --- a/src/glsl/glsl_lexer.ll +++ b/src/glsl/glsl_lexer.ll @@ -166,9 +166,9 @@ HASH^{SPC}#{SPC} [ \r\t]+ ; /* Preprocessor tokens. */ -^[ \t]*#[ \t]*$; -^[ \t]*#[ \t]*version { BEGIN PP; return VERSION_TOK; } -^[ \t]*#[ \t]*extension{ BEGIN PP; return EXTENSION; } +{HASH}$; +{HASH}version { BEGIN PP; return VERSION_TOK; } +{HASH}extension{ BEGIN PP; return EXTENSION; } {HASH}line{SPCP}{INT}{SPCP}{INT}{SPC}$ { /* Eat characters until the first digit is * encountered -- 1.7.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/10] glsl: Add make check tests for correct handling of #line directives
Verifing that both the source number and line number get correctly reflected into error messages. Note that this is distinct from existing testing of the proeprocessor, (in glcpp/tests), since here we are testing that the GLSL compiler itself is correctly handling those #line directives that are emitted by the preprocessor. --- src/glsl/tests/Makefile.am |1 + src/glsl/tests/directives-test | 33 src/glsl/tests/directives/.gitignore |1 + .../00-line-number-in-error-message.glsl |8 + .../00-line-number-in-error-message.glsl.expected |2 ++ .../01-hash-line-number-in-error-message.glsl | 11 +++ ...hash-line-number-in-error-message.glsl.expected |2 ++ .../directives/02-hash-line-number-increments.glsl | 13 .../02-hash-line-number-increments.glsl.expected |2 ++ .../directives/03-hash-line-source-number.glsl | 11 +++ .../03-hash-line-source-number.glsl.expected |2 ++ 11 files changed, 86 insertions(+) create mode 100755 src/glsl/tests/directives-test create mode 100644 src/glsl/tests/directives/.gitignore create mode 100644 src/glsl/tests/directives/00-line-number-in-error-message.glsl create mode 100644 src/glsl/tests/directives/00-line-number-in-error-message.glsl.expected create mode 100644 src/glsl/tests/directives/01-hash-line-number-in-error-message.glsl create mode 100644 src/glsl/tests/directives/01-hash-line-number-in-error-message.glsl.expected create mode 100644 src/glsl/tests/directives/02-hash-line-number-increments.glsl create mode 100644 src/glsl/tests/directives/02-hash-line-number-increments.glsl.expected create mode 100644 src/glsl/tests/directives/03-hash-line-source-number.glsl create mode 100644 src/glsl/tests/directives/03-hash-line-source-number.glsl.expected diff --git a/src/glsl/tests/Makefile.am b/src/glsl/tests/Makefile.am index 957bb55..5a6380d 100644 --- a/src/glsl/tests/Makefile.am +++ b/src/glsl/tests/Makefile.am @@ -9,6 +9,7 @@ TESTS_ENVIRONMENT= \ export PYTHON_FLAGS=$(PYTHON_FLAGS); TESTS = \ + directives-test \ optimization-test \ ralloc-test \ uniform-initializer-test diff --git a/src/glsl/tests/directives-test b/src/glsl/tests/directives-test new file mode 100755 index 000..9e33cf4 --- /dev/null +++ b/src/glsl/tests/directives-test @@ -0,0 +1,33 @@ +#!/bin/bash + +total=0 +pass=0 + +# These tests are for preprocessor directives that are emitted from +# the preprocessor itself (such as #line, #version, #extension, and +# #pragma) as opposed to those which are handled and removed by the +# preprocesor (such as #define, #ifdef, #if, #elid, #endif, etc.) + +echo == Testing preprocessor directives == +for test in directives/*.glsl; do +echo -n Testing $test... +../builtin_compiler/builtin_compiler $test 21 | grep -v ^Info log $test.out +total=$((total+1)) +if diff $test.expected $test.out /dev/null 21; then +echo PASS +pass=$((pass+1)) +else +echo FAIL +diff -u $test.expected $test.out +fi +done + +echo +echo $pass/$total tests returned correct results +echo + +if [[ $pass == $total ]]; then +exit 0 +else +exit 1 +fi diff --git a/src/glsl/tests/directives/.gitignore b/src/glsl/tests/directives/.gitignore new file mode 100644 index 000..f47cb20 --- /dev/null +++ b/src/glsl/tests/directives/.gitignore @@ -0,0 +1 @@ +*.out diff --git a/src/glsl/tests/directives/00-line-number-in-error-message.glsl b/src/glsl/tests/directives/00-line-number-in-error-message.glsl new file mode 100644 index 000..c994bb7 --- /dev/null +++ b/src/glsl/tests/directives/00-line-number-in-error-message.glsl @@ -0,0 +1,8 @@ +void main(void) +{ + /* Syntax error should be reported on source string 0, line 7. + * This is just a simple test of line numbers being tracked + * without any #line directives. + */ + if (; /* Syntax error on line 7 */ +} diff --git a/src/glsl/tests/directives/00-line-number-in-error-message.glsl.expected b/src/glsl/tests/directives/00-line-number-in-error-message.glsl.expected new file mode 100644 index 000..1251474 --- /dev/null +++ b/src/glsl/tests/directives/00-line-number-in-error-message.glsl.expected @@ -0,0 +1,2 @@ +0:7(6): error: syntax error, unexpected ';' + diff --git a/src/glsl/tests/directives/01-hash-line-number-in-error-message.glsl b/src/glsl/tests/directives/01-hash-line-number-in-error-message.glsl new file mode 100644 index 000..074669b --- /dev/null +++ b/src/glsl/tests/directives/01-hash-line-number-in-error-message.glsl @@ -0,0 +1,11 @@ +void main(void) +{ + + /* In this test, we verify that a #line directive causes the + * syntax error on the subsequent line to be reported against the + * line number in the #line directive, (so source 0, line 17). + */ + +#line 17 + if (; /*
[Mesa-dev] [PATCH 04/10] glsl: Fix an off-by-one error in line numbers in error messages
The #line directive specifies the line number for the subsequent line of text. So, since we will see another newline before that line, (and hence, increment yylineno one more time), we have to set the yylineno value to one less than we would otherwise. This is in addition to setting it to one less for sake of being zero-based, (which we were already doing). So, subtract 2 for the value we want. --- src/glsl/glsl_lexer.ll | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll index 4fca4ea..2a0e01b 100644 --- a/src/glsl/glsl_lexer.ll +++ b/src/glsl/glsl_lexer.ll @@ -177,11 +177,12 @@ HASH ^{SPC}#{SPC} while (!isdigit(*ptr)) ptr++; - /* Subtract one from the line number because - * yylineno is zero-based instead of - * one-based. + /* Subtract two from the line number parsed. + * 1 because yylineno is zero-based and + * 2 because #line gives the line number for + * the subsequent line of the source. */ - yylineno = strtol(ptr, ptr, 0) - 1; + yylineno = strtol(ptr, ptr, 0) - 2; yylloc-source = strtol(ptr, NULL, 0); } {HASH}line{SPCP}{INT}{SPC}${ @@ -192,11 +193,12 @@ HASH ^{SPC}#{SPC} while (!isdigit(*ptr)) ptr++; - /* Subtract one from the line number because - * yylineno is zero-based instead of - * one-based. + /* Subtract two from the line number parsed. + * 1 because yylineno is zero-based and + * 2 because #line gives the line number for + * the subsequent line of the source. */ - yylineno = strtol(ptr, ptr, 0) - 1; + yylineno = strtol(ptr, ptr, 0) - 2; } ^{SPC}#{SPC}pragma{SPCP}debug{SPC}\({SPC}on{SPC}\) { BEGIN PP; -- 1.7.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/10] glsl: Fix error message to include correct source string number
We were going through the work to parse a directive like #line 0 2 and setting the source to 2. But then, we were re-setting the source to 0 at the beginning of every lex action. Instead, reset it to 0 only once at the beginning of all lexing. With this fix, correct source numbers will actually appear in error messages. --- src/glsl/glsl_lexer.ll |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll index 2a0e01b..04cc778 100644 --- a/src/glsl/glsl_lexer.ll +++ b/src/glsl/glsl_lexer.ll @@ -36,13 +36,12 @@ static int classify_identifier(struct _mesa_glsl_parse_state *, const char *); #define YY_USER_ACTION \ do {\ - yylloc-source = 0; \ yylloc-first_column = yycolumn + 1; \ yylloc-first_line = yylineno + 1; \ yycolumn += yyleng; \ } while(0); -#define YY_USER_INIT yylineno = 0; yycolumn = 0; +#define YY_USER_INIT yylineno = 0; yycolumn = 0; yylloc-source = 0; /* A macro for handling reserved words and keywords across language versions. * -- 1.7.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 07/10] glsl: Instruct bison to expect one shift/reduce conflict
This one is unavoidable as C is inherently ambiguous, (from the point-of-view of the parser), in the dangling-else case. Now, C is unambiguous in that the dangling else should bind to the innermost if. This is exactly what bison accomplishes by preferring to shift rather than reduce. The expect statement here tells bison to expect one shift/reduce conflict silently. It will then trigger an error if any future changes in the grammar introduce additional conflicts. --- src/glsl/glsl_parser.yy |6 ++ 1 file changed, 6 insertions(+) diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index d849466..0af71e7 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -56,6 +56,12 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) %lex-param {void *scanner} %parse-param {struct _mesa_glsl_parse_state *state} +/* C grammar has 1 unavoidable shift/reduce conflict, (the dangling- + * else ambiguity), which bison correctly resolves by preferring + * to shift. + */ +%expect 1 + %union { int n; float real; -- 1.7.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/10] glsl: Add support to #line for a filnename, not just a source string number
Such as: #line 23 foo.c Having a filename here is quite useful and many other OpenGL implementations allow this. --- src/glsl/ast.h |2 +- src/glsl/glsl_lexer.ll | 56 ++- src/glsl/glsl_parser.yy |2 +- src/glsl/glsl_parser_extras.cpp |2 +- src/glsl/glsl_parser_extras.h |4 +-- 5 files changed, 48 insertions(+), 18 deletions(-) diff --git a/src/glsl/ast.h b/src/glsl/ast.h index 5074782..7d9ba69 100644 --- a/src/glsl/ast.h +++ b/src/glsl/ast.h @@ -116,7 +116,7 @@ public: * Source location of the AST node. */ struct { - unsigned source;/** GLSL source number. */ + char *source; /** GLSL source number. */ unsigned line; /** Line number within the source string. */ unsigned column;/** Column in the line. */ } location; diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll index ac06fd2..66e6377 100644 --- a/src/glsl/glsl_lexer.ll +++ b/src/glsl/glsl_lexer.ll @@ -41,7 +41,7 @@ static int classify_identifier(struct _mesa_glsl_parse_state *, const char *); yycolumn += yyleng; \ } while(0); -#define YY_USER_INIT yylineno = 0; yycolumn = 0; yylloc-source = 0; +#define YY_USER_INIT yylineno = 0; yycolumn = 0; yylloc-source = (char *) 0; /* A macro for handling reserved words and keywords across language versions. * @@ -160,6 +160,7 @@ INT ({DEC_INT}|{HEX_INT}|{OCT_INT}) SPC[ \t]* SPCP [ \t]+ HASH ^{SPC}#{SPC} +STRING_LITERAL \(\\.|[^\\\n])*\ %% /* Make state available to all actions. */ @@ -171,7 +172,12 @@ HASH ^{SPC}#{SPC} {HASH}$; {HASH}version { BEGIN PP; return VERSION_TOK; } {HASH}extension{ BEGIN PP; return EXTENSION; } -{HASH}line{SPCP}{INT}{SPCP}{INT}{SPC}$ { + /* We subtract 2 from the number in a #line directive because: +* 1. yylineno is zero-based, rather than one-based as desired, and +* 2. #line gives the line number for the subsequent line of the source, +*and we will increment yylineno before then at the next newline. +*/ +{HASH}line{SPCP}{INT}{SPCP}{STRING_LITERAL}$ { /* Eat characters until the first digit is * encountered */ @@ -179,13 +185,42 @@ HASH ^{SPC}#{SPC} while (!isdigit(*ptr)) ptr++; - /* Subtract two from the line number parsed. - * 1 because yylineno is zero-based and - * 2 because #line gives the line number for - * the subsequent line of the source. + yylineno = strtol(ptr, ptr, 0) - 2; + + /* Skip space before string. */ + while (isspace(*ptr)) + ptr++; + + /* Omit initial and final quotation marks + * when copying string value. + */ + yylloc-source = + ralloc_strndup(state, ptr+1, strlen(ptr)-2); + } +{HASH}line{SPCP}{INT}{SPCP}{INT}{SPC}$ { + /* Eat characters until the first digit is + * encountered */ + char *ptr = yytext; + while (!isdigit(*ptr)) + ptr++; + yylineno = strtol(ptr, ptr, 0) - 2; - yylloc-source = strtol(ptr, NULL, 0); + + /* Skip space before source number. */ + while (isspace(*ptr)) + ptr++; + + yylloc-source = ralloc_strdup(state, ptr); + ptr = yylloc-source; + + /* Terminate after digits to + * eliminate any trailing space. + */ + while (isdigit(*ptr)) + ptr++; + *ptr = '\0'; + } {HASH}line{SPCP}{INT}{SPC}${ /* Eat characters until the first digit is @@ -195,12 +230,7 @@ HASH ^{SPC}#{SPC} while (!isdigit(*ptr)) ptr++;
[Mesa-dev] [PATCH 08/10] glsl: Make state variable available to all actions.
We have arranged for the lexer function to receive an argument of type struct _mesa_gls_parse_state* but it comes in as void *yyextra. By including code immediately after the %% separator, we can declare a local variable of the correct type and name, (state), to hold this value for use by all actions. This is much simpler than redeclaring the state variable and assigning to it in multiple actions. --- src/glsl/glsl_lexer.ll |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll index 04cc778..ac06fd2 100644 --- a/src/glsl/glsl_lexer.ll +++ b/src/glsl/glsl_lexer.ll @@ -162,6 +162,9 @@ SPCP[ \t]+ HASH ^{SPC}#{SPC} %% + /* Make state available to all actions. */ + struct _mesa_glsl_parse_state *state = yyextra; + [ \r\t]+ ; /* Preprocessor tokens. */ @@ -541,7 +544,6 @@ usampler2DMSArray KEYWORD(0, 300, 0, 0, USAMPLER2DMSARRAY); [_a-zA-Z][_a-zA-Z0-9]* { - struct _mesa_glsl_parse_state *state = yyextra; void *ctx = state; yylval-identifier = ralloc_strdup(ctx, yytext); return classify_identifier(state, yytext); -- 1.7.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/10] glsl: Add test for '#line XX filename.c'
Verifying that the filename from the #line directive appears in subsequent error messages. --- src/glsl/tests/directives/04-hash-line-source-filename.glsl | 11 +++ .../directives/04-hash-line-source-filename.glsl.expected |2 ++ 2 files changed, 13 insertions(+) create mode 100644 src/glsl/tests/directives/04-hash-line-source-filename.glsl create mode 100644 src/glsl/tests/directives/04-hash-line-source-filename.glsl.expected diff --git a/src/glsl/tests/directives/04-hash-line-source-filename.glsl b/src/glsl/tests/directives/04-hash-line-source-filename.glsl new file mode 100644 index 000..6b56c95 --- /dev/null +++ b/src/glsl/tests/directives/04-hash-line-source-filename.glsl @@ -0,0 +1,11 @@ +void main(void) +{ + + /* In this test, we verify that a source filename in a #line + * directive is reflected in a subsequent error message. + * Syntax error should be reported on line 21 of foo.c. + */ + +#line 21 foo.c + if (; /* Syntax error */ +} diff --git a/src/glsl/tests/directives/04-hash-line-source-filename.glsl.expected b/src/glsl/tests/directives/04-hash-line-source-filename.glsl.expected new file mode 100644 index 000..12a3c82 --- /dev/null +++ b/src/glsl/tests/directives/04-hash-line-source-filename.glsl.expected @@ -0,0 +1,2 @@ +foo.c:21(6): error: syntax error, unexpected ';' + -- 1.7.10 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] mesa: don't advertise ARB_texture_buffer_object in legacy contexts
--- src/mesa/drivers/dri/intel/intel_extensions.c |5 + src/mesa/main/bufferobj.c |4 ++-- src/mesa/main/extensions.c|2 +- src/mesa/main/get.c |9 - src/mesa/main/teximage.c | 15 +++ src/mesa/main/texobj.c|6 +++--- src/mesa/main/texparam.c |2 +- 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index df886a5..7b2b595 100755 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -102,10 +102,7 @@ intelInitExtensions(struct gl_context *ctx) ctx-Extensions.ARB_blend_func_extended = !driQueryOptionb(intel-optionCache, disable_blend_func_extended); ctx-Extensions.ARB_draw_buffers_blend = true; ctx-Extensions.ARB_uniform_buffer_object = true; - - if (ctx-API == API_OPENGL_CORE) { - ctx-Extensions.ARB_texture_buffer_object = true; - } + ctx-Extensions.ARB_texture_buffer_object = true; } if (intel-gen = 5) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 6733644..4a84430 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -93,8 +93,8 @@ get_buffer_target(struct gl_context *ctx, GLenum target) } break; case GL_TEXTURE_BUFFER: - if (_mesa_is_desktop_gl(ctx) - ctx-Extensions.ARB_texture_buffer_object) { + if (ctx-API == API_OPENGL_CORE + ctx-Extensions.ARB_texture_buffer_object) { return ctx-Texture.BufferObject; } break; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 11cbea2..e86e436 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -126,7 +126,7 @@ static const struct extension extension_table[] = { { GL_ARB_shadow, o(ARB_shadow), GLL,2001 }, { GL_ARB_sync,o(ARB_sync), GL, 2003 }, { GL_ARB_texture_border_clamp, o(ARB_texture_border_clamp),GLL,2000 }, - { GL_ARB_texture_buffer_object, o(ARB_texture_buffer_object), GL, 2008 }, + { GL_ARB_texture_buffer_object, o(ARB_texture_buffer_object), GLC,2008 }, { GL_ARB_texture_compression, o(dummy_true), GLL,2000 }, { GL_ARB_texture_compression_rgtc, o(ARB_texture_compression_rgtc),GL, 2004 }, { GL_ARB_texture_cube_map,o(ARB_texture_cube_map), GLL,1999 }, diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 97dccd0..f3dbda2 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -129,6 +129,7 @@ enum value_extra { EXTRA_VERSION_31, EXTRA_VERSION_32, EXTRA_API_GL, + EXTRA_API_GL_CORE, EXTRA_API_ES2, EXTRA_NEW_BUFFERS, EXTRA_NEW_FRAG_CLAMP, @@ -283,6 +284,7 @@ static const int extra_GLSL_130[] = { }; static const int extra_texture_buffer_object[] = { + EXTRA_API_GL_CORE, EXTRA_VERSION_31, EXT(ARB_texture_buffer_object), EXTRA_END @@ -329,7 +331,6 @@ EXTRA_EXT2(ARB_vertex_program, ARB_fragment_program); EXTRA_EXT(ARB_geometry_shader4); EXTRA_EXT(ARB_color_buffer_float); EXTRA_EXT(EXT_framebuffer_sRGB); -EXTRA_EXT(ARB_texture_buffer_object); EXTRA_EXT(OES_EGL_image_external); EXTRA_EXT(ARB_blend_func_extended); EXTRA_EXT(ARB_uniform_buffer_object); @@ -879,6 +880,12 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d enabled++; } break; + case EXTRA_API_GL_CORE: +if (ctx-API == API_OPENGL_CORE) { + total++; + enabled++; +} +break; case EXTRA_NEW_BUFFERS: if (ctx-NewState _NEW_BUFFERS) _mesa_update_state(ctx); diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 83b7e14..47c4ed2 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -791,9 +791,9 @@ _mesa_select_tex_object(struct gl_context *ctx, case GL_PROXY_TEXTURE_2D_ARRAY_EXT: return arrayTex ? ctx-Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX] : NULL; case GL_TEXTURE_BUFFER: - return _mesa_is_desktop_gl(ctx) - ctx-Extensions.ARB_texture_buffer_object -? texUnit-CurrentTex[TEXTURE_BUFFER_INDEX] : NULL; + return ctx-API == API_OPENGL_CORE +ctx-Extensions.ARB_texture_buffer_object ? +texUnit-CurrentTex[TEXTURE_BUFFER_INDEX] : NULL; case GL_TEXTURE_EXTERNAL_OES: return
[Mesa-dev] [PATCH 1/2] mesa: disallow creation of GL 3.1 compatibility contexts
Death to driver-specific hacks! --- src/mesa/drivers/dri/intel/intel_extensions.c |6 +- src/mesa/main/version.c |6 ++ src/mesa/state_tracker/st_extensions.c|5 + 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 96288ab..df886a5 100755 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -89,11 +89,7 @@ intelInitExtensions(struct gl_context *ctx) ctx-Extensions.ARB_texture_rgb10_a2ui = true; if (intel-gen = 6) - if (ctx-API == API_OPENGL_CORE) { - ctx-Const.GLSLVersion = 140; - } else { - ctx-Const.GLSLVersion = 130; - } + ctx-Const.GLSLVersion = 140; else ctx-Const.GLSLVersion = 120; _mesa_override_glsl_version(ctx); diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index eef8f43..4373d7b 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -345,6 +345,12 @@ _mesa_compute_version(struct gl_context *ctx) switch (ctx-API) { case API_OPENGL_COMPAT: + /* Disable GLSL 1.40 and later for legacy contexts. + * This disallows creation of the GL 3.1 compatibility context. */ + if (ctx-Const.GLSLVersion 130) { + ctx-Const.GLSLVersion = 130; + } + /* fall through */ case API_OPENGL_CORE: compute_version(ctx); break; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 93ef7a9..726d868 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -570,10 +570,7 @@ void st_init_extensions(struct st_context *st) glsl_feature_level = screen-get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL); if (glsl_feature_level = 140) { - if (ctx-API == API_OPENGL_CORE) - ctx-Const.GLSLVersion = 140; - else - ctx-Const.GLSLVersion = 130; + ctx-Const.GLSLVersion = 140; } else if (glsl_feature_level = 130) { ctx-Const.GLSLVersion = 130; } else { -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] winsys/radeon: don't use BIND flags, add a flag for the cache bufmgr instead
--- src/gallium/drivers/r300/r300_flush.c |3 +-- src/gallium/drivers/r300/r300_query.c |4 ++-- src/gallium/drivers/r300/r300_screen_buffer.c | 12 ++-- src/gallium/drivers/r300/r300_texture.c |4 ++-- src/gallium/drivers/r600/r600_buffer.c| 10 ++ src/gallium/drivers/r600/r600_pipe.h |2 +- src/gallium/drivers/r600/r600_texture.c |2 +- src/gallium/drivers/radeonsi/r600_buffer.c|8 +--- src/gallium/drivers/radeonsi/r600_texture.c |2 +- src/gallium/drivers/radeonsi/radeonsi_pipe.h |2 +- src/gallium/winsys/radeon/drm/radeon_drm_bo.c |5 ++--- src/gallium/winsys/radeon/drm/radeon_winsys.h |4 ++-- 12 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index 732529a..2170c59 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -79,8 +79,7 @@ void r300_flush(struct pipe_context *pipe, if (rfence) { /* Create a fence, which is a dummy BO. */ -*rfence = r300-rws-buffer_create(r300-rws, 1, 1, - PIPE_BIND_CUSTOM, +*rfence = r300-rws-buffer_create(r300-rws, 1, 1, TRUE, RADEON_DOMAIN_GTT); /* Add the fence as a dummy relocation. */ r300-rws-cs_add_reloc(r300-cs, diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index 3ea6be7..4443362 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -57,8 +57,8 @@ static struct pipe_query *r300_create_query(struct pipe_context *pipe, else q-num_pipes = r300screen-info.r300_num_gb_pipes; -q-buf = r300-rws-buffer_create(r300-rws, 4096, 4096, - PIPE_BIND_CUSTOM, RADEON_DOMAIN_GTT); +q-buf = r300-rws-buffer_create(r300-rws, 4096, 4096, TRUE, + RADEON_DOMAIN_GTT); if (!q-buf) { FREE(q); return NULL; diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c index c92ec56..0c1e69b 100644 --- a/src/gallium/drivers/r300/r300_screen_buffer.c +++ b/src/gallium/drivers/r300/r300_screen_buffer.c @@ -101,9 +101,9 @@ r300_buffer_transfer_map( struct pipe_context *context, struct pb_buffer *new_buf; /* Create a new one in the same pipe_resource. */ -new_buf = r300-rws-buffer_create(r300-rws, - rbuf-b.b.width0, R300_BUFFER_ALIGNMENT, - rbuf-b.b.bind, rbuf-domain); +new_buf = r300-rws-buffer_create(r300-rws, rbuf-b.b.width0, + R300_BUFFER_ALIGNMENT, TRUE, + rbuf-domain); if (new_buf) { /* Discard the old buffer. */ pb_reference(rbuf-buf, NULL); @@ -181,9 +181,9 @@ struct pipe_resource *r300_buffer_create(struct pipe_screen *screen, } rbuf-buf = -r300screen-rws-buffer_create(r300screen-rws, - rbuf-b.b.width0, R300_BUFFER_ALIGNMENT, - rbuf-b.b.bind, rbuf-domain); +r300screen-rws-buffer_create(r300screen-rws, rbuf-b.b.width0, + R300_BUFFER_ALIGNMENT, TRUE, + rbuf-domain); if (!rbuf-buf) { FREE(rbuf); return NULL; diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 6197cf7..568558f 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -997,8 +997,8 @@ r300_texture_create_object(struct r300_screen *rscreen, /* Create the backing buffer if needed. */ if (!tex-buf) { -tex-buf = rws-buffer_create(rws, tex-tex.size_in_bytes, 2048, - base-bind, tex-domain); +tex-buf = rws-buffer_create(rws, tex-tex.size_in_bytes, 2048, TRUE, + tex-domain); if (!tex-buf) { goto fail; diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c index 3b8d227..9e2cf66 100644 --- a/src/gallium/drivers/r600/r600_buffer.c +++ b/src/gallium/drivers/r600/r600_buffer.c @@ -112,7 +112,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx, /* Create a new one in the same pipe_resource. */ /* XXX We probably want a different alignment for buffers and textures. */ r600_init_resource(rctx-screen, rbuffer, rbuffer-b.b.width0, 4096, -
Re: [Mesa-dev] [PATCH 1/2] mesa: disallow creation of GL 3.1 compatibility contexts
On 12/08/2012 02:02 PM, Marek Olšák wrote: Death to driver-specific hacks! This looks good to me, but Dave Airlie may have a different opinion. :) Drivers could enable GLSL 1.40 without 3.1 if they can support the full ARB_texbo. We didn't enable texbos on compatibility profiles because L, LA, A, and I format texbos would require extra instructions in the shader and NOS recompiles. Other hardware may not have this limitation. If someone were to enable that, we should have some piglit test for those cases. The series is: Reviewed-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/drivers/dri/intel/intel_extensions.c |6 +- src/mesa/main/version.c |6 ++ src/mesa/state_tracker/st_extensions.c|5 + 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 96288ab..df886a5 100755 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -89,11 +89,7 @@ intelInitExtensions(struct gl_context *ctx) ctx-Extensions.ARB_texture_rgb10_a2ui = true; if (intel-gen = 6) - if (ctx-API == API_OPENGL_CORE) { - ctx-Const.GLSLVersion = 140; - } else { - ctx-Const.GLSLVersion = 130; - } + ctx-Const.GLSLVersion = 140; else ctx-Const.GLSLVersion = 120; _mesa_override_glsl_version(ctx); diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index eef8f43..4373d7b 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -345,6 +345,12 @@ _mesa_compute_version(struct gl_context *ctx) switch (ctx-API) { case API_OPENGL_COMPAT: + /* Disable GLSL 1.40 and later for legacy contexts. + * This disallows creation of the GL 3.1 compatibility context. */ + if (ctx-Const.GLSLVersion 130) { + ctx-Const.GLSLVersion = 130; + } + /* fall through */ case API_OPENGL_CORE: compute_version(ctx); break; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 93ef7a9..726d868 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -570,10 +570,7 @@ void st_init_extensions(struct st_context *st) glsl_feature_level = screen-get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL); if (glsl_feature_level = 140) { - if (ctx-API == API_OPENGL_CORE) - ctx-Const.GLSLVersion = 140; - else - ctx-Const.GLSLVersion = 130; + ctx-Const.GLSLVersion = 140; } else if (glsl_feature_level = 130) { ctx-Const.GLSLVersion = 130; } else { ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/12] remove swrast dependencies in texture decompression code
This patch series removes all the swrast_texture_image references in the texture (de)compression code. Instead of exposing a bunch of _mesa_fetch_texel_XXX() functions there's a new _mesa_get_compressed_fetch_func() function that returns a texel fetcher given a compressed format. It's called by the swrast module. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] r600g: rework flusing and synchronization pattern v4
Hi Jerome, I'm okay with the simplification of r600_flush_emit, I'm not so okay with some other things. There's also some cruft unrelated to flushing. 1) R600_CONTEXT_FLUSH could have a better name, because it's not clear what it does. (it looks like it only flushed read-only bindings) 2) Don't use magic numbers when setting cp_coher_cntl unless you want to hide something from us / obfuscating the code. :) 3) The definition of R600_MAX_FLUSH_CS_DWORDS should be updated. 4) SURFACE_BASE_UPDATE is emitted twice in emit_framebuffer_state. I don't think splitting one packet into two packets doing the same thing is needed. 5) RS780 and RS880 don't need SURFACE_BASE_UPDATE for streamout. Their streamout hardware was actually copied from R700. Doing CHIP_RS780 instead of CHIP_RV770 was correct. The same for r600_flush_emit. 6) In r600_context_flush, don't remove the comment about flushing framebuffer caches, because it's still done there. 7) Masking out R600_CONTEXT_FLUSH in r600_context_emit_fence is not correct. We should still flush the caches later if they're dirty and even if the fence was emitted. You can't see this regression in piglit, because we don't have a test for that. 8) There's some inconsistent flushing between graphics and compute colorbuffer bindings. For graphics, you use (WAIT_IDLE | FLUSH_AND_INV), which makes sense. For compute, you use R600_CONTEXT_FLUSH (which is used for vertex buffers and the like elsewhere, but not colorbuffers). And one question: Why do you use set both FLUSH_AND_INV and STREAMOUT_FLUSH on Evergreen, while r600 only gets FLUSH_AND_INV? Did you overlook this? Marek On Thu, Dec 6, 2012 at 8:51 PM, j.gli...@gmail.com wrote: From: Jerome Glisse jgli...@redhat.com This bring r600g allmost inline with closed source driver when it comes to flushing and synchronization pattern. Signed-off-by: Jerome Glisse jgli...@redhat.com --- src/gallium/drivers/r600/evergreen_compute.c | 8 +- .../drivers/r600/evergreen_compute_internal.c | 4 +- src/gallium/drivers/r600/evergreen_state.c | 4 +- src/gallium/drivers/r600/r600.h| 16 +-- src/gallium/drivers/r600/r600_hw_context.c | 154 - src/gallium/drivers/r600/r600_state.c | 18 ++- src/gallium/drivers/r600/r600_state_common.c | 19 ++- 7 files changed, 61 insertions(+), 162 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index 44831a7..33a5910 100644 --- a/src/gallium/drivers/r600/evergreen_compute.c +++ b/src/gallium/drivers/r600/evergreen_compute.c @@ -98,7 +98,7 @@ static void evergreen_cs_set_vertex_buffer( /* The vertex instructions in the compute shaders use the texture cache, * so we need to invalidate it. */ - rctx-flags |= R600_CONTEXT_TEX_FLUSH; + rctx-flags |= R600_CONTEXT_FLUSH; state-enabled_mask |= 1 vb_index; state-dirty_mask |= 1 vb_index; state-atom.dirty = true; @@ -329,7 +329,7 @@ static void compute_emit_cs(struct r600_context *ctx, const uint *block_layout, */ r600_emit_command_buffer(ctx-cs, ctx-start_compute_cs_cmd); - ctx-flags |= R600_CONTEXT_CB_FLUSH; + ctx-flags |= R600_CONTEXT_FLUSH; r600_flush_emit(ctx); /* Emit colorbuffers. */ @@ -409,7 +409,7 @@ static void compute_emit_cs(struct r600_context *ctx, const uint *block_layout, /* XXX evergreen_flush_emit() hardcodes the CP_COHER_SIZE to 0x */ - ctx-flags |= R600_CONTEXT_CB_FLUSH; + ctx-flags |= R600_CONTEXT_FLUSH; r600_flush_emit(ctx); #if 0 @@ -468,7 +468,7 @@ void evergreen_emit_cs_shader( r600_write_value(cs, r600_context_bo_reloc(rctx, kernel-code_bo, RADEON_USAGE_READ)); - rctx-flags |= R600_CONTEXT_SHADERCONST_FLUSH; + rctx-flags |= R600_CONTEXT_FLUSH; } static void evergreen_launch_grid( diff --git a/src/gallium/drivers/r600/evergreen_compute_internal.c b/src/gallium/drivers/r600/evergreen_compute_internal.c index 7bc7fb4..187bcf1 100644 --- a/src/gallium/drivers/r600/evergreen_compute_internal.c +++ b/src/gallium/drivers/r600/evergreen_compute_internal.c @@ -538,7 +538,7 @@ void evergreen_set_tex_resource( util_format_get_blockwidth(tmp-resource.b.b.format) * view-base.texture-width0*height*depth; - pipe-ctx-flags |= R600_CONTEXT_TEX_FLUSH; + pipe-ctx-flags |= R600_CONTEXT_FLUSH; evergreen_emit_force_reloc(res); evergreen_emit_force_reloc(res); @@ -597,7 +597,7 @@ void evergreen_set_const_cache( res-usage = RADEON_USAGE_READ; res-coher_bo_size = size; - pipe-ctx-flags |= R600_CONTEXT_SHADERCONST_FLUSH; + pipe-ctx-flags |= R600_CONTEXT_FLUSH; }
Re: [Mesa-dev] [PATCH 1/2] r600g: rework flusing and synchronization pattern v4
On Sat, Dec 8, 2012 at 7:27 PM, Marek Olšák mar...@gmail.com wrote: Hi Jerome, I'm okay with the simplification of r600_flush_emit, I'm not so okay with some other things. There's also some cruft unrelated to flushing. 1) R600_CONTEXT_FLUSH could have a better name, because it's not clear what it does. (it looks like it only flushed read-only bindings) GPU_FLUSH ? 2) Don't use magic numbers when setting cp_coher_cntl unless you want to hide something from us / obfuscating the code. :) 3) The definition of R600_MAX_FLUSH_CS_DWORDS should be updated. Yes i haven't recomputed worst case 4) SURFACE_BASE_UPDATE is emitted twice in emit_framebuffer_state. I don't think splitting one packet into two packets doing the same thing is needed. It's need couple r6xx/r7xx gpu will lockup after couple hour of stressing, wasn't seeing lockup with it. 5) RS780 and RS880 don't need SURFACE_BASE_UPDATE for streamout. Their streamout hardware was actually copied from R700. Doing CHIP_RS780 instead of CHIP_RV770 was correct. The same for r600_flush_emit. fglrx mostly do the same on r7xx and r6xx for streamout as i am not sure i have any stressing test for that i side on fglrx side. 6) In r600_context_flush, don't remove the comment about flushing framebuffer caches, because it's still done there. 7) Masking out R600_CONTEXT_FLUSH in r600_context_emit_fence is not correct. We should still flush the caches later if they're dirty and even if the fence was emitted. You can't see this regression in piglit, because we don't have a test for that. True 8) There's some inconsistent flushing between graphics and compute colorbuffer bindings. For graphics, you use (WAIT_IDLE | FLUSH_AND_INV), which makes sense. For compute, you use R600_CONTEXT_FLUSH (which is used for vertex buffers and the like elsewhere, but not colorbuffers). I haven't paid much attention to compute side, i should probably look at it. And one question: Why do you use set both FLUSH_AND_INV and STREAMOUT_FLUSH on Evergreen, while r600 only gets FLUSH_AND_INV? Did you overlook this? No, just matching fglrx pattern, i don't think i tested without that change, but it definitly match fglrx. Cheers, Jerome Marek On Thu, Dec 6, 2012 at 8:51 PM, j.gli...@gmail.com wrote: From: Jerome Glisse jgli...@redhat.com This bring r600g allmost inline with closed source driver when it comes to flushing and synchronization pattern. Signed-off-by: Jerome Glisse jgli...@redhat.com --- src/gallium/drivers/r600/evergreen_compute.c | 8 +- .../drivers/r600/evergreen_compute_internal.c | 4 +- src/gallium/drivers/r600/evergreen_state.c | 4 +- src/gallium/drivers/r600/r600.h| 16 +-- src/gallium/drivers/r600/r600_hw_context.c | 154 - src/gallium/drivers/r600/r600_state.c | 18 ++- src/gallium/drivers/r600/r600_state_common.c | 19 ++- 7 files changed, 61 insertions(+), 162 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index 44831a7..33a5910 100644 --- a/src/gallium/drivers/r600/evergreen_compute.c +++ b/src/gallium/drivers/r600/evergreen_compute.c @@ -98,7 +98,7 @@ static void evergreen_cs_set_vertex_buffer( /* The vertex instructions in the compute shaders use the texture cache, * so we need to invalidate it. */ - rctx-flags |= R600_CONTEXT_TEX_FLUSH; + rctx-flags |= R600_CONTEXT_FLUSH; state-enabled_mask |= 1 vb_index; state-dirty_mask |= 1 vb_index; state-atom.dirty = true; @@ -329,7 +329,7 @@ static void compute_emit_cs(struct r600_context *ctx, const uint *block_layout, */ r600_emit_command_buffer(ctx-cs, ctx-start_compute_cs_cmd); - ctx-flags |= R600_CONTEXT_CB_FLUSH; + ctx-flags |= R600_CONTEXT_FLUSH; r600_flush_emit(ctx); /* Emit colorbuffers. */ @@ -409,7 +409,7 @@ static void compute_emit_cs(struct r600_context *ctx, const uint *block_layout, /* XXX evergreen_flush_emit() hardcodes the CP_COHER_SIZE to 0x */ - ctx-flags |= R600_CONTEXT_CB_FLUSH; + ctx-flags |= R600_CONTEXT_FLUSH; r600_flush_emit(ctx); #if 0 @@ -468,7 +468,7 @@ void evergreen_emit_cs_shader( r600_write_value(cs, r600_context_bo_reloc(rctx, kernel-code_bo, RADEON_USAGE_READ)); - rctx-flags |= R600_CONTEXT_SHADERCONST_FLUSH; + rctx-flags |= R600_CONTEXT_FLUSH; } static void evergreen_launch_grid( diff --git a/src/gallium/drivers/r600/evergreen_compute_internal.c b/src/gallium/drivers/r600/evergreen_compute_internal.c index 7bc7fb4..187bcf1 100644 --- a/src/gallium/drivers/r600/evergreen_compute_internal.c +++ b/src/gallium/drivers/r600/evergreen_compute_internal.c @@ -538,7 +538,7 @@ void
Re: [Mesa-dev] [PATCH] mesa: Restore NULL context check in _mesa_reference_renderbuffer_().
On 12/08/2012 05:40 AM, Brian Paul wrote: On 12/08/2012 01:10 AM, Kenneth Graunke wrote: Starting KDE on i965 makes the X server die in a fire with the following assertion: X: intel_fbo.c:94: intel_delete_renderbuffer: Assertion `irb' failed. Obviously, this is rather unpleasant. Bisecting revealed that: 006918c0db77e945ac56b15bc64eba502b86d56c is the first bad commit commit 006918c0db77e945ac56b15bc64eba502b86d56c Author: Brian Paulbri...@vmware.com Date: Sat Dec 1 10:52:42 2012 -0700 mesa: remove warning message in _mesa_reference_renderbuffer_() We were warning when there was no current context and we're about to delete a renderbuffer, but that happens fairly often and isn't really a problem. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=57754 Note: This is a candidate for the stable branches. Tested-by: Ian Romanickian.d.roman...@intel.com This commit removed not only the else emit warning block, but the whole NULL check as well. Apparently it's necessary, so put it back. Hi Kenneth, The assertion says the 'irb' is null, but you're checking if the context is null. Off hand, I think a irb==null check is needed in intel_delete_renderbuffer(). Maybe seeing a stack trace would shed more light on where the null irb/ctx is coming from. In any case, if you need to check for ctx==null, please do that in intel_delete_renderbuffer(). The deal is that some (most?) drivers don't need a context handle in order to free a renderbuffer. In the gallium state tracker we use the context to free a piece of context state that's associated with a renderbuffer, but the renderbuffer itself can be freed without a context. Sorry for the headaches this one is causing. -Brian Sorry for the false alarm...this was my fault. Apparently on my system X is loading an older i965_dri.so, but likely a new libGL. The incompatibility between the one-argument intel_delete_renderbuffer and two-argument gl_renderbuffer::Delete caused something stupid to happen...maybe I got the renderbuffer passed as the context, and NULL for the renderbuffer. I put both halves back in sync and everything's fine now. Again, my apologies for the trouble. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: Track UBO block names in the symbol table.
On 12/08/2012 12:45 PM, Ian Romanick wrote: From: Kenneth Graunke kenn...@whitecape.org The GLSL 1.40 spec says: Uniform block names and variable names declared within uniform blocks are scoped at the program level. Track the block name in the symbol table and emit errors when conflicts exist. Fixes es3conform's uniform_buffer_object_block_name_conflict test, and fixes the piglit block-name-clashes-with-{variable,function,struct}.vert tests. NOTE: This is a candidate for the 9.0 branch. Reviewed-by: Ian Romanick ian.d.roman...@intel.com --- src/glsl/ast_to_hir.cpp| 6 ++ src/glsl/glsl_symbol_table.cpp | 14 +++--- src/glsl/glsl_symbol_table.h | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) I'm fine with pushing this, but I wasn't sure whether using the struct gl_uniform_block in this way was going to be irritating when trying to implement blocks with instance names. But I suppose it can always be reworked. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev