Demos (master): tests/clip: a simple interactive clipping test
Module: Demos Branch: master Commit: d3d37a67d7c7d2c77813f25cac94572c9399c41a URL: http://cgit.freedesktop.org/mesa/demos/commit/?id=d3d37a67d7c7d2c77813f25cac94572c9399c41a Author: Brian Paul Date: Wed Jun 8 20:35:53 2011 -0600 tests/clip: a simple interactive clipping test --- src/tests/CMakeLists.txt |1 + src/tests/Makefile.am|1 + src/tests/clip.c | 199 ++ 3 files changed, 201 insertions(+), 0 deletions(-) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index d2c6903..53aac25 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -41,6 +41,7 @@ set (targets bug_texstore_i8 bumpmap calibrate_rast + clip condrender copypixrate cva diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index 632f406..c8a575a 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -74,6 +74,7 @@ noinst_PROGRAMS = \ bug_3195 \ bug_texstore_i8 \ calibrate_rast \ + clip \ condrender \ copypixrate \ cva \ diff --git a/src/tests/clip.c b/src/tests/clip.c new file mode 100644 index 000..2e9104e --- /dev/null +++ b/src/tests/clip.c @@ -0,0 +1,199 @@ + +#include +#include +#include +#include "glut_wrap.h" + +static int Win; +static int WinWidth = 400, WinHeight = 400; +static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; +static GLboolean Anim = GL_FALSE; + +static int CurVert = 0, MoveAll = 0; +static GLfloat Verts[3][2]; + + +static void +Idle(void) +{ + Xrot += 3.0; + Yrot += 4.0; + Zrot += 2.0; + glutPostRedisplay(); +} + + +static void +Draw(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + + glBegin(GL_POLYGON); + glVertex2fv(Verts[0]); + glVertex2fv(Verts[1]); + glVertex2fv(Verts[2]); + glEnd(); + + glutSwapBuffers(); +} + + +static void +Reshape(int width, int height) +{ + WinWidth = width; + WinHeight = height; + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); +} + + +static void +RotVerts(void) +{ + float tx = Verts[0][0], ty = Verts[0][1]; + Verts[0][0] = Verts[1][0]; Verts[0][1] = Verts[1][1]; + Verts[1][0] = Verts[2][0]; Verts[1][1] = Verts[2][1]; + Verts[2][0] = tx;Verts[2][1] = ty; +} + +static void +Save(void) +{ + int i; + FILE *f = fopen("verts.txt", "w"); + for (i = 0; i < 3; i++) + fprintf(f, "%f %f\n", Verts[i][0], Verts[i][1]); + fclose(f); + printf("Saved data\n"); +} + +static void +Restore(void) +{ + int i; + FILE *f = fopen("verts.txt", "r"); + if (f) { + printf("Restoring data\n"); + for (i = 0; i < 3; i++) { + int n =fscanf(f, "%f %f\n", &Verts[i][0], &Verts[i][1]); + (void) n; + } + fclose(f); + } +} + +static void +Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case 'r': + RotVerts(); + break; + case 'a': + MoveAll = 1; + break; + case '0': + MoveAll = 0; + CurVert = 0; + break; + case '1': + MoveAll = 0; + CurVert = 1; + break; + case '2': + MoveAll = 0; + CurVert = 2; + break; + case 's': + Save(); + break; + case 27: + glutDestroyWindow(Win); + exit(0); + break; + } + glutPostRedisplay(); +} + +static void +move(float dx, float dy) +{ + int i; + + dx *= 0.05; + dy *= 0.05; + if (MoveAll) { + for (i = 0; i < 3; i++) { + Verts[i][0] += dx; + Verts[i][1] += dy; + } + } + else { + Verts[CurVert][0] += dx; + Verts[CurVert][1] += dy; + } + + printf("\n"); + for (i = 0; i < 3; i++) { + printf("%f %f\n", Verts[i][0], Verts[i][1]); + } +} + + +static void +SpecialKey(int key, int x, int y) +{ + switch (key) { + case GLUT_KEY_UP: + move(0, +1); + break; + case GLUT_KEY_DOWN: + move(0, -1); + break; + case GLUT_KEY_LEFT: + move(-1, 0); + break; + case GLUT_KEY_RIGHT: + move(1, 0); + break; + } + glutPostRedisplay(); +} + + +static void +Init(void) +{ + Verts[0][0] = 0.0; Verts[0][1] = 0.0; + Verts[1][0] = 1.2; Verts[1][1] = -0.5; + Verts[2][0] = 0.6; Verts[2][1] = -1.5; + + Restore(); + + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowSize(WinWidth, WinHeight); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); + Win = glutCreateWindow(argv[0]); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(SpecialKey); + glutDisplayFunc(Draw); + if (Anim) + glutIdleFunc(Idle); + Init(); + glutMainLoop(); + return 0; +} ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.10): r300g: fix texturing with non-3D textures and wrap R mode set to sample border
Module: Mesa Branch: 7.10 Commit: e5408efb20327c46fe67d35e18348ddd6300e282 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e5408efb20327c46fe67d35e18348ddd6300e282 Author: Marek Olšák Date: Thu Jun 9 04:23:14 2011 +0200 r300g: fix texturing with non-3D textures and wrap R mode set to sample border If the wrap R (3rd) mode is set to CLAMP or CLAMP_TO_BORDER and the texture isn't 3D, r300 always samples the border color regardless of texture coordinates. I HATE THIS HARDWARE. NOTE: This is a candidate for the 7.10 branch. (cherry picked from commit da8b4c07986e202b0596b729a5eec31c9aec5fcc) Conflicts: src/gallium/drivers/r300/r300_state_derived.c --- src/gallium/drivers/r300/r300_state_derived.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index d5fc8ec..e833d3d 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -782,6 +782,12 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300) texstate->filter0 |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE); } +/* The hardware doesn't like CLAMP and CLAMP_TO_BORDER + * for the 3rd coordinate if the texture isn't 3D. */ +if (tex->desc.b.b.target != PIPE_TEXTURE_3D) { +texstate->filter0 &= ~R300_TX_WRAP_R_MASK; +} + if (tex->desc.is_npot) { /* NPOT textures don't support mip filter, unfortunately. * This prevents incorrect rendering. */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r300g: fix texturing with non-3D textures and wrap R mode set to sample border
Module: Mesa Branch: master Commit: da8b4c07986e202b0596b729a5eec31c9aec5fcc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=da8b4c07986e202b0596b729a5eec31c9aec5fcc Author: Marek Olšák Date: Thu Jun 9 04:09:40 2011 +0200 r300g: fix texturing with non-3D textures and wrap R mode set to sample border If the wrap R (3rd) mode is set to CLAMP or CLAMP_TO_BORDER and the texture isn't 3D, r300 always samples the border color regardless of texture coordinates. I HATE THIS HARDWARE. NOTE: This is a candidate for the 7.10 branch. --- src/gallium/drivers/r300/r300_state_derived.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 121409b..f63114e 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -854,6 +854,12 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300) texstate->filter0 |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE); } +/* The hardware doesn't like CLAMP and CLAMP_TO_BORDER + * for the 3rd coordinate if the texture isn't 3D. */ +if (tex->b.b.b.target != PIPE_TEXTURE_3D) { +texstate->filter0 &= ~R300_TX_WRAP_R_MASK; +} + if (tex->tex.is_npot) { /* NPOT textures don't support mip filter, unfortunately. * This prevents incorrect rendering. */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r300g: don't enable aniso with nearest filtering
Module: Mesa Branch: master Commit: 466ce95ddff734d5090bcb1c5ada7a4f23e13226 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=466ce95ddff734d5090bcb1c5ada7a4f23e13226 Author: Marek Olšák Date: Thu Jun 9 03:36:37 2011 +0200 r300g: don't enable aniso with nearest filtering --- src/gallium/drivers/r300/r300_state_inlines.h | 80 - 1 files changed, 39 insertions(+), 41 deletions(-) diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 54dae1a..62c03b3 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -261,51 +261,49 @@ static INLINE uint32_t r300_translate_wrap(int wrap) } static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip, - int is_anisotropic) + boolean is_anisotropic) { uint32_t retval = 0; -if (is_anisotropic) -retval |= R300_TX_MIN_FILTER_ANISO | R300_TX_MAG_FILTER_ANISO; -else { -switch (min) { -case PIPE_TEX_FILTER_NEAREST: -retval |= R300_TX_MIN_FILTER_NEAREST; -break; -case PIPE_TEX_FILTER_LINEAR: -retval |= R300_TX_MIN_FILTER_LINEAR; -break; -default: -fprintf(stderr, "r300: Unknown texture filter %d\n", min); -assert(0); -break; -} -switch (mag) { -case PIPE_TEX_FILTER_NEAREST: -retval |= R300_TX_MAG_FILTER_NEAREST; -break; -case PIPE_TEX_FILTER_LINEAR: -retval |= R300_TX_MAG_FILTER_LINEAR; -break; -default: -fprintf(stderr, "r300: Unknown texture filter %d\n", mag); -assert(0); -break; -} + +switch (min) { +case PIPE_TEX_FILTER_NEAREST: +retval |= R300_TX_MIN_FILTER_NEAREST; +break; +case PIPE_TEX_FILTER_LINEAR: +retval |= is_anisotropic ? R300_TX_MIN_FILTER_ANISO : + R300_TX_MIN_FILTER_LINEAR; +break; +default: +fprintf(stderr, "r300: Unknown texture filter %d\n", min); +assert(0); } + +switch (mag) { +case PIPE_TEX_FILTER_NEAREST: +retval |= R300_TX_MAG_FILTER_NEAREST; +break; +case PIPE_TEX_FILTER_LINEAR: +retval |= is_anisotropic ? R300_TX_MAG_FILTER_ANISO : + R300_TX_MAG_FILTER_LINEAR; +break; +default: +fprintf(stderr, "r300: Unknown texture filter %d\n", mag); +assert(0); +} + switch (mip) { -case PIPE_TEX_MIPFILTER_NONE: -retval |= R300_TX_MIN_FILTER_MIP_NONE; -break; -case PIPE_TEX_MIPFILTER_NEAREST: -retval |= R300_TX_MIN_FILTER_MIP_NEAREST; -break; -case PIPE_TEX_MIPFILTER_LINEAR: -retval |= R300_TX_MIN_FILTER_MIP_LINEAR; -break; -default: -fprintf(stderr, "r300: Unknown texture filter %d\n", mip); -assert(0); -break; +case PIPE_TEX_MIPFILTER_NONE: +retval |= R300_TX_MIN_FILTER_MIP_NONE; +break; +case PIPE_TEX_MIPFILTER_NEAREST: +retval |= R300_TX_MIN_FILTER_MIP_NEAREST; +break; +case PIPE_TEX_MIPFILTER_LINEAR: +retval |= R300_TX_MIN_FILTER_MIP_LINEAR; +break; +default: +fprintf(stderr, "r300: Unknown texture filter %d\n", mip); +assert(0); } return retval; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600g: adjust vs/ps gprs on r600/r700 cards when needed.
Module: Mesa Branch: master Commit: 04554c7d3a3b28e8103e50ed54f1ac57c6c11017 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=04554c7d3a3b28e8103e50ed54f1ac57c6c11017 Author: Dave Airlie Date: Wed Jun 8 14:35:00 2011 +1000 r600g: adjust vs/ps gprs on r600/r700 cards when needed. Ideally we'd have a compiler and register spilling and all that but this is good enough for now to avoid the gpu hang in piglit, glsl-vs-vec4-indexing-temp-dst-in-nested-loop-combined on r600/r700 cards. based on r600c patch Andre Maasikas r600c: bump sq gpr resources if a shader needs more than default Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_pipe.h |2 + src/gallium/drivers/r600/r600_state.c | 43 + src/gallium/drivers/r600/r600_state_common.c |8 +++- src/gallium/winsys/r600/drm/r600_hw_context.c | 42 ++-- src/gallium/winsys/r600/drm/r600_priv.h |1 + 5 files changed, 77 insertions(+), 19 deletions(-) diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index d92b74e..332f932 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -205,6 +205,7 @@ struct r600_pipe_context { struct util_slab_mempoolpool_transfers; boolean blit; + unsigned default_ps_gprs, default_vs_gprs; }; struct r600_drawl { @@ -270,6 +271,7 @@ void r600_pipe_init_buffer_resource(struct r600_pipe_context *rctx, void r600_pipe_mod_buffer_resource(struct r600_pipe_resource_state *rstate, struct r600_resource *rbuffer, unsigned offset, unsigned stride); +void r600_adjust_gprs(struct r600_pipe_context *rctx); /* r600_texture.c */ void r600_init_screen_texture_functions(struct pipe_screen *screen); diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 3851042..5a1c456 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1025,6 +1025,46 @@ void r600_init_state_functions(struct r600_pipe_context *rctx) rctx->context.texture_barrier = r600_texture_barrier; } +void r600_adjust_gprs(struct r600_pipe_context *rctx) +{ + enum radeon_family family; + struct r600_pipe_state rstate; + unsigned num_ps_gprs = rctx->default_ps_gprs; + unsigned num_vs_gprs = rctx->default_vs_gprs; + unsigned tmp; + int diff; + + family = r600_get_family(rctx->radeon); + + if (family >= CHIP_CEDAR) + return; + + if (!rctx->ps_shader && !rctx->vs_shader) + return; + + if (rctx->ps_shader->shader.bc.ngpr > rctx->default_ps_gprs) + { + diff = rctx->ps_shader->shader.bc.ngpr - rctx->default_ps_gprs; + num_vs_gprs -= diff; + num_ps_gprs += diff; + } + + if (rctx->vs_shader->shader.bc.ngpr > rctx->default_vs_gprs) + { + diff = rctx->vs_shader->shader.bc.ngpr - rctx->default_vs_gprs; + num_ps_gprs -= diff; + num_vs_gprs += diff; + } + + tmp = 0; + tmp |= S_008C04_NUM_PS_GPRS(num_ps_gprs); + tmp |= S_008C04_NUM_VS_GPRS(num_vs_gprs); + rstate.nregs = 0; + r600_pipe_state_add_reg(&rstate, R_008C04_SQ_GPR_RESOURCE_MGMT_1, tmp, 0x0FFF, NULL); + + r600_context_pipe_state_set(&rctx->ctx, &rstate); +} + void r600_init_config(struct r600_pipe_context *rctx) { int ps_prio; @@ -1167,6 +1207,9 @@ void r600_init_config(struct r600_pipe_context *rctx) break; } + rctx->default_ps_gprs = num_ps_gprs; + rctx->default_vs_gprs = num_vs_gprs; + rstate->id = R600_PIPE_STATE_CONFIG; /* SQ_CONFIG */ diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index a670ac0..1eb9389 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -273,8 +273,10 @@ void r600_bind_ps_shader(struct pipe_context *ctx, void *state) if (state) { r600_context_pipe_state_set(&rctx->ctx, &rctx->ps_shader->rstate); } - if (rctx->ps_shader && rctx->vs_shader) + if (rctx->ps_shader && rctx->vs_shader) { r600_spi_update(rctx); + r600_adjust_gprs(rctx); + } } void r600_bind_vs_shader(struct pipe_context *ctx, void *state) @@ -286,8 +288,10 @@ void r600_bind_vs_shader(struct pipe_context *ctx, void *state) if (state) { r600_context_pipe_state_set(&rctx->ctx, &rctx->vs_shader->rstate); } - if (rctx->ps_shader && rctx->vs_shader) + if (rctx->ps_shader && rctx->vs_shader) { r600_spi_update(rctx); + r600_adjust_gprs(rctx); + } } void r600_delete_
Mesa (7.10): r300g: fix draw_vbo splitting on r3xx-r4xx
Module: Mesa Branch: 7.10 Commit: 8f8d7d0803a51d2f88493042b31fbf99ccf62f47 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f8d7d0803a51d2f88493042b31fbf99ccf62f47 Author: Marek Olšák Date: Thu Jun 9 01:38:24 2011 +0200 r300g: fix draw_vbo splitting on r3xx-r4xx NOTE: This is a candidate for the 7.10 branch. (cherry picked from commit 578d4539ba72a9f52e0cb3f615bb04bf9407b574) Conflicts: src/gallium/drivers/r300/r300_render.c --- src/gallium/drivers/r300/r300_render.c | 13 +++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index b4197e0..494c452 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -566,7 +566,12 @@ static void r300_draw_range_elements(struct pipe_context* pipe, minIndex, maxIndex, mode, start, count); } else { do { -short_count = MIN2(count, 65534); +/* The maximum must be divisible by 4 and 3, + * so that quad and triangle lists are split correctly. + * + * Strips, loops, and fans won't work. */ +short_count = MIN2(count, 65532); + r300_emit_draw_elements(r300, indexBuffer, indexSize, minIndex, maxIndex, mode, start, short_count); @@ -614,7 +619,11 @@ static void r300_draw_arrays(struct pipe_context* pipe, unsigned mode, r300_emit_draw_arrays(r300, mode, count); } else { do { -short_count = MIN2(count, 65535); +/* The maximum must be divisible by 4 and 3, + * so that quad and triangle lists are split correctly. + * + * Strips, loops, and fans won't work. */ +short_count = MIN2(count, 65532); r300_emit_draw_arrays(r300, mode, short_count); start += short_count; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600g: remove unused variable
Module: Mesa Branch: master Commit: d56fe67c6255b1ace84c025c83439ab8cb3f91fe URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d56fe67c6255b1ace84c025c83439ab8cb3f91fe Author: Marek Olšák Date: Thu Jun 9 01:34:24 2011 +0200 r600g: remove unused variable --- src/gallium/drivers/r600/r600_state.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 4e62857..3851042 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -407,7 +407,6 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c struct pipe_resource *texture, const struct pipe_sampler_view *state) { - struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; struct r600_pipe_sampler_view *resource = CALLOC_STRUCT(r600_pipe_sampler_view); struct r600_pipe_resource_state *rstate; const struct util_format_description *desc; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r300g: fix draw_vbo splitting on r3xx-r4xx
Module: Mesa Branch: master Commit: 578d4539ba72a9f52e0cb3f615bb04bf9407b574 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=578d4539ba72a9f52e0cb3f615bb04bf9407b574 Author: Marek Olšák Date: Thu Jun 9 00:50:29 2011 +0200 r300g: fix draw_vbo splitting on r3xx-r4xx NOTE: This is a candidate for the 7.10 branch. --- src/gallium/drivers/r300/r300_render.c | 15 ++- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 479503f..d9399d7 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -673,10 +673,11 @@ static void r300_draw_elements(struct r300_context *r300, indices3); } else { do { -if (indexSize == 2 && (start & 1)) -short_count = MIN2(count, 65535); -else -short_count = MIN2(count, 65534); +/* The maximum must be divisible by 4 and 3, + * so that quad and triangle lists are split correctly. + * + * Strips, loops, and fans won't work. */ +short_count = MIN2(count, 65532); r300_emit_draw_elements(r300, indexBuffer, indexSize, info->min_index, info->max_index, @@ -722,7 +723,11 @@ static void r300_draw_arrays(struct r300_context *r300, r300_emit_draw_arrays(r300, info->mode, count); } else { do { -short_count = MIN2(count, 65535); +/* The maximum must be divisible by 4 and 3, + * so that quad and triangle lists are split correctly. + * + * Strips, loops, and fans won't work. */ +short_count = MIN2(count, 65532); r300_emit_draw_arrays(r300, info->mode, short_count); start += short_count; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r300g: make translate_primitive table-driven
Module: Mesa Branch: master Commit: f48412c39f2ea3e2c25191814f519f84efec7a95 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f48412c39f2ea3e2c25191814f519f84efec7a95 Author: Marek Olšák Date: Thu Jun 9 00:33:45 2011 +0200 r300g: make translate_primitive table-driven --- src/gallium/drivers/r300/r300_render.c | 44 ++- 1 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index b24e7fa..479503f 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -46,30 +46,26 @@ static uint32_t r300_translate_primitive(unsigned prim) { -switch (prim) { -case PIPE_PRIM_POINTS: -return R300_VAP_VF_CNTL__PRIM_POINTS; -case PIPE_PRIM_LINES: -return R300_VAP_VF_CNTL__PRIM_LINES; -case PIPE_PRIM_LINE_LOOP: -return R300_VAP_VF_CNTL__PRIM_LINE_LOOP; -case PIPE_PRIM_LINE_STRIP: -return R300_VAP_VF_CNTL__PRIM_LINE_STRIP; -case PIPE_PRIM_TRIANGLES: -return R300_VAP_VF_CNTL__PRIM_TRIANGLES; -case PIPE_PRIM_TRIANGLE_STRIP: -return R300_VAP_VF_CNTL__PRIM_TRIANGLE_STRIP; -case PIPE_PRIM_TRIANGLE_FAN: -return R300_VAP_VF_CNTL__PRIM_TRIANGLE_FAN; -case PIPE_PRIM_QUADS: -return R300_VAP_VF_CNTL__PRIM_QUADS; -case PIPE_PRIM_QUAD_STRIP: -return R300_VAP_VF_CNTL__PRIM_QUAD_STRIP; -case PIPE_PRIM_POLYGON: -return R300_VAP_VF_CNTL__PRIM_POLYGON; -default: -return 0; -} +static const int prim_conv[] = { +R300_VAP_VF_CNTL__PRIM_POINTS, +R300_VAP_VF_CNTL__PRIM_LINES, +R300_VAP_VF_CNTL__PRIM_LINE_LOOP, +R300_VAP_VF_CNTL__PRIM_LINE_STRIP, +R300_VAP_VF_CNTL__PRIM_TRIANGLES, +R300_VAP_VF_CNTL__PRIM_TRIANGLE_STRIP, +R300_VAP_VF_CNTL__PRIM_TRIANGLE_FAN, +R300_VAP_VF_CNTL__PRIM_QUADS, +R300_VAP_VF_CNTL__PRIM_QUAD_STRIP, +R300_VAP_VF_CNTL__PRIM_POLYGON, +-1, +-1, +-1, +-1 +}; +unsigned hwprim = prim_conv[prim]; + +assert(hwprim != -1); +return hwprim; } static uint32_t r300_provoking_vertex_fixes(struct r300_context *r300, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: fix strict aliasing issues in u_format_r11g11b10f.h
Module: Mesa Branch: master Commit: d302804debeed13ced27fce222110c629e55d6f9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d302804debeed13ced27fce222110c629e55d6f9 Author: Roland Scheidegger Date: Thu Jun 9 01:11:52 2011 +0200 util: fix strict aliasing issues in u_format_r11g11b10f.h --- src/gallium/auxiliary/util/u_format_r11g11b10f.h | 24 ++--- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/gallium/auxiliary/util/u_format_r11g11b10f.h b/src/gallium/auxiliary/util/u_format_r11g11b10f.h index c4181d0..8e0572a 100644 --- a/src/gallium/auxiliary/util/u_format_r11g11b10f.h +++ b/src/gallium/auxiliary/util/u_format_r11g11b10f.h @@ -45,14 +45,18 @@ static INLINE unsigned f32_to_uf11(float val) { - uint32_t f32 = (*(uint32_t *) &val); + union { + float f; + uint32_t ui; + } f32 = {val}; + uint16_t uf11 = 0; /* Decode little-endian 32-bit floating-point value */ - int sign = (f32 >> 16) & 0x8000; + int sign = (f32.ui >> 16) & 0x8000; /* Map exponent to the range [-127,128] */ - int exponent = ((f32 >> 23) & 0xff) - 127; - int mantissa = f32 & 0x007f; + int exponent = ((f32.ui >> 23) & 0xff) - 127; + int mantissa = f32.ui & 0x007f; if (sign) return 0; @@ -111,14 +115,18 @@ static INLINE float uf11_to_f32(uint16_t val) static INLINE unsigned f32_to_uf10(float val) { - uint32_t f32 = (*(uint32_t *) &val); + union { + float f; + uint32_t ui; + } f32 = {val}; + uint16_t uf10 = 0; /* Decode little-endian 32-bit floating-point value */ - int sign = (f32 >> 16) & 0x8000; + int sign = (f32.ui >> 16) & 0x8000; /* Map exponent to the range [-127,128] */ - int exponent = ((f32 >> 23) & 0xff) - 127; - int mantissa = f32 & 0x007f; + int exponent = ((f32.ui >> 23) & 0xff) - 127; + int mantissa = f32.ui & 0x007f; if (sign) return 0; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: get rid of homegrown logbase2 implementation in drivers
Module: Mesa Branch: master Commit: c1090f3019bbe0ff92455e4a9268f8957af9cda0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1090f3019bbe0ff92455e4a9268f8957af9cda0 Author: Roland Scheidegger Date: Thu Jun 9 00:47:19 2011 +0200 mesa: get rid of homegrown logbase2 implementation in drivers Some of the logbase2 functions did just the same as _mesa_logbase2, though they were taking signed numbers (but it shouldn't matter for them). --- src/mesa/drivers/dri/intel/intel_tex_image.c | 16 +--- src/mesa/drivers/dri/unichrome/via_tex.c | 14 +- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 775fd10..bc39f4a 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -32,20 +32,6 @@ */ -static int -logbase2(int n) -{ - GLint i = 1; - GLint log2 = 0; - - while (n > i) { - i *= 2; - log2++; - } - - return log2; -} - /* Otherwise, store it in memory if (Border != 0) or (any dimension == * 1). @@ -118,7 +104,7 @@ intel_miptree_create_for_teximage(struct intel_context *intel, (intel->gen < 4 || firstLevel == 0)) { lastLevel = firstLevel; } else { -lastLevel = firstLevel + logbase2(MAX2(MAX2(width, height), depth)); +lastLevel = firstLevel + _mesa_logbase2(MAX2(MAX2(width, height), depth)); } } diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 1a0d1ea..fe5480f 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -196,18 +196,6 @@ viaChooseTexFormat( struct gl_context *ctx, GLint internalFormat, return MESA_FORMAT_NONE; /* never get here */ } -static int logbase2(int n) -{ - GLint i = 1; - GLint log2 = 0; - - while (n > i) { - i *= 2; - log2++; - } - - return log2; -} static const char *get_memtype_name( GLint memType ) { @@ -690,7 +678,7 @@ static void viaTexImage(struct gl_context *ctx, } assert(texImage->RowStride == postConvWidth); - viaImage->pitchLog2 = logbase2(postConvWidth * texelBytes); + viaImage->pitchLog2 = _mesa_logbase2(postConvWidth * texelBytes); /* allocate memory */ if (_mesa_is_format_compressed(texImage->TexFormat)) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: fix gcc version check for _mesa_bitcount
Module: Mesa Branch: master Commit: da009212fe121206a67cb65ca8f88777a9f7e44f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=da009212fe121206a67cb65ca8f88777a9f7e44f Author: Roland Scheidegger Date: Thu Jun 9 00:45:03 2011 +0200 mesa: fix gcc version check for _mesa_bitcount The version check was bogus, and only inside a non-gcc block anyway. --- src/mesa/main/imports.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index f262b25..0a572ec 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -511,9 +511,10 @@ _mesa_ffsll(int64_t val) return 0; } +#endif - -#if ((_GNUC__ == 3 && __GNUC_MINOR__ < 4) || __GNUC__ < 4) +#if !defined(__GNUC__) ||\ + ((_GNUC__ == 3 && __GNUC_MINOR__ < 4) && __GNUC__ < 4) /** * Return number of bits set in given GLuint. */ @@ -527,7 +528,6 @@ _mesa_bitcount(unsigned int n) return bits; } #endif -#endif /** ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: use __builtin_clz for logbase2 when available
Module: Mesa Branch: master Commit: b537f54b3a2bd47ec861f5c432c49529684eef21 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b537f54b3a2bd47ec861f5c432c49529684eef21 Author: Roland Scheidegger Date: Thu Jun 9 00:44:32 2011 +0200 mesa: use __builtin_clz for logbase2 when available Also rename to _mesa_logbase2 and move to imports.h to keep the ugly ifdef GNUC stuff outside other files (also to allow reuse). --- src/mesa/main/imports.h | 21 + src/mesa/main/teximage.c | 23 +++ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index ce7baab..3fa1db0 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -486,6 +486,27 @@ _mesa_next_pow_two_64(uint64_t x) } +/* + * Returns the floor form of binary logarithm for a 32-bit integer. + */ +static INLINE GLuint +_mesa_logbase2(GLuint n) +{ +#if defined(__GNUC__) && \ + ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4) + return (31 - __builtin_clz(n | 1)); +#else + GLuint pos = 0; + if (n >= 1<<16) { n >>= 16; pos += 16; } + if (n >= 1<< 8) { n >>= 8; pos += 8; } + if (n >= 1<< 4) { n >>= 4; pos += 4; } + if (n >= 1<< 2) { n >>= 2; pos += 2; } + if (n >= 1<< 1) { pos += 1; } + return pos; +#endif +} + + /** * Return 1 if this is a little endian machine, 0 if big endian. */ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 3e42911..0827cb8 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -80,23 +80,6 @@ _mesa_free_texmemory(void *m) } -/* - * Returns the floor form of binary logarithm for a 32-bit integer. - */ -static GLuint -logbase2(GLuint n) -{ - GLuint pos = 0; - if (n >= 1<<16) { n >>= 16; pos += 16; } - if (n >= 1<< 8) { n >>= 8; pos += 8; } - if (n >= 1<< 4) { n >>= 4; pos += 4; } - if (n >= 1<< 2) { n >>= 2; pos += 2; } - if (n >= 1<< 1) { pos += 1; } - return pos; -} - - - /** * Return the simple base format for a given internal texture format. * For example, given GL_LUMINANCE12_ALPHA4, return GL_LUMINANCE_ALPHA. @@ -1155,7 +1138,7 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLenum target, img->Depth = depth; img->Width2 = width - 2 * border; /* == 1 << img->WidthLog2; */ - img->WidthLog2 = logbase2(img->Width2); + img->WidthLog2 = _mesa_logbase2(img->Width2); if (height == 1) { /* 1-D texture */ img->Height2 = 1; @@ -1163,7 +1146,7 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLenum target, } else { img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */ - img->HeightLog2 = logbase2(img->Height2); + img->HeightLog2 = _mesa_logbase2(img->Height2); } if (depth == 1) { /* 2-D texture */ @@ -1172,7 +1155,7 @@ _mesa_init_teximage_fields(struct gl_context *ctx, GLenum target, } else { img->Depth2 = depth - 2 * border; /* == 1 << img->DepthLog2; */ - img->DepthLog2 = logbase2(img->Depth2); + img->DepthLog2 = _mesa_logbase2(img->Depth2); } img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: add gcc version check for builtins
Module: Mesa Branch: master Commit: b3d5822e932767a572f392ae2b3ca1dfee5f6b03 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3d5822e932767a572f392ae2b3ca1dfee5f6b03 Author: Roland Scheidegger Date: Wed Jun 8 23:23:24 2011 +0200 util: add gcc version check for builtins Looks like only next_power_of_two, logbase2 and bitcount use builtins requiring gcc 3.4, so maybe everything else compiles with older gcc. --- src/gallium/auxiliary/util/u_math.h |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 417f79f..0b52844 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -477,7 +477,7 @@ float_to_byte_tex(float f) static INLINE unsigned util_logbase2(unsigned n) { -#if defined(PIPE_CC_GCC) +#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 304) return ((sizeof(unsigned) * 8 - 1) - __builtin_clz(n | 1)); #else unsigned pos = 0; @@ -497,7 +497,7 @@ util_logbase2(unsigned n) static INLINE unsigned util_next_power_of_two(unsigned x) { -#if defined(PIPE_CC_GCC) +#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 304) if (x <= 1) return 1; @@ -529,7 +529,7 @@ util_next_power_of_two(unsigned x) static INLINE unsigned util_bitcount(unsigned n) { -#if defined(PIPE_CC_GCC) +#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 304) return __builtin_popcount(n); #else /* K&R classic bitcount. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: better logbase2/next_power_of_two implementations
Module: Mesa Branch: master Commit: 894db40f122175ed85e0d32d42296f2d56cf748e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=894db40f122175ed85e0d32d42296f2d56cf748e Author: Benjamin Bellec Date: Wed Jun 8 23:00:54 2011 +0200 util: better logbase2/next_power_of_two implementations Use __builtin_clz when available for logbase/next_power_of_two, and replace next_power_of_two with faster implementation otherwise. --- src/gallium/auxiliary/util/u_math.h | 32 1 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 65a99fc..417f79f 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -477,6 +477,9 @@ float_to_byte_tex(float f) static INLINE unsigned util_logbase2(unsigned n) { +#if defined(PIPE_CC_GCC) + return ((sizeof(unsigned) * 8 - 1) - __builtin_clz(n | 1)); +#else unsigned pos = 0; if (n >= 1<<16) { n >>= 16; pos += 16; } if (n >= 1<< 8) { n >>= 8; pos += 8; } @@ -484,6 +487,7 @@ util_logbase2(unsigned n) if (n >= 1<< 2) { n >>= 2; pos += 2; } if (n >= 1<< 1) { pos += 1; } return pos; +#endif } @@ -493,17 +497,29 @@ util_logbase2(unsigned n) static INLINE unsigned util_next_power_of_two(unsigned x) { - unsigned i; - - if (x == 0) - return 1; +#if defined(PIPE_CC_GCC) + if (x <= 1) + return 1; - --x; + return (1 << ((sizeof(unsigned) * 8) - __builtin_clz(x - 1))); +#else + unsigned val = x; - for (i = 1; i < sizeof(unsigned) * 8; i <<= 1) - x |= x >> i; + if (x <= 1) + return 1; - return x + 1; + if (util_is_power_of_two(x)) + return x; + + val--; + val = (val >> 1) | val; + val = (val >> 2) | val; + val = (val >> 4) | val; + val = (val >> 8) | val; + val = (val >> 16) | val; + val++; + return val; +#endif } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glx/xlib: Handle glXCreateContextAttribsARB in glXGetProcAddress.
Module: Mesa Branch: master Commit: 9f865646f1fb05cec72dcb1d7411670d38b0a9b4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f865646f1fb05cec72dcb1d7411670d38b0a9b4 Author: José Fonseca Date: Wed Jun 8 14:20:49 2011 +0100 glx/xlib: Handle glXCreateContextAttribsARB in glXGetProcAddress. --- src/gallium/state_trackers/glx/xlib/glx_getproc.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/gallium/state_trackers/glx/xlib/glx_getproc.c b/src/gallium/state_trackers/glx/xlib/glx_getproc.c index 26fcae7..bc29c31 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_getproc.c +++ b/src/gallium/state_trackers/glx/xlib/glx_getproc.c @@ -168,6 +168,9 @@ static struct name_address_pair GLX_functions[] = { /*** GLX_ARB_get_proc_address ***/ { "glXGetProcAddressARB", (__GLXextFuncPtr) glXGetProcAddressARB }, + /*** GLX_ARB_create_context ***/ + { "glXCreateContextAttribsARB", (__GLXextFuncPtr) glXCreateContextAttribsARB }, + /*** GLX_EXT_texture_from_pixmap ***/ { "glXBindTexImageEXT", (__GLXextFuncPtr) glXBindTexImageEXT }, { "glXReleaseTexImageEXT", (__GLXextFuncPtr) glXReleaseTexImageEXT }, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/gen7: Call gen7_create_constant_surface instead of brw_ [...].
Module: Mesa Branch: master Commit: 4ef8464068bc96ea9af71bbd18d121358db303b2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4ef8464068bc96ea9af71bbd18d121358db303b2 Author: Kenneth Graunke Date: Mon Jun 6 17:19:12 2011 -0700 i965/gen7: Call gen7_create_constant_surface instead of brw_[...]. Fixes 17 piglit tests: - glsl-vs-arrays-3 - glsl-vs-texturematrix-2 - glsl-vs-uniform-array-2 - arl - nv-arl - nv-init-zero-addr - vp-address-01 - vp-arl-constant-array - vp-arl-constant-array-huge - vp-arl-constant-array-huge-offset - vp-arl-constant-array-huge-offset-neg - vp-arl-constant-array-huge-relative-offset - vp-arl-constant-array-huge-varying - vp-arl-env-array - vp-arl-local-array - vp-arl-neg-array - vp-arl-neg-array-2 Fixes 4 glean tests: - glsl1-constant array of vec4 with variable indexing, vertex shader - glsl1-constant array with variable indexing, vertex shader - glsl1-constant array with variable indexing, vertex shader (2) - vp1-ARL test Signed-off-by: Kenneth Graunke Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i965/brw_state.h |6 ++ src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 10 -- src/mesa/drivers/dri/i965/gen7_wm_surface_state.c |2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 3aaa7c6..544ef7d 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -191,6 +191,12 @@ GLuint translate_tex_format(gl_format mesa_format, GLenum depth_mode, GLenum srgb_decode); +/* gen7_wm_surface_state.c */ +void gen7_create_constant_surface(struct brw_context *brw, + drm_intel_bo *bo, + int width, + uint32_t *out_offset); + /* brw_wm_sampler_state.c */ uint32_t translate_wrap_mode(GLenum wrap, bool using_nearest); void upload_default_color(struct brw_context *brw, diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c index 2b9b635..611f633 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c @@ -114,6 +114,7 @@ brw_update_vs_constant_surface( struct gl_context *ctx, GLuint surf) { struct brw_context *brw = brw_context(ctx); + struct intel_context *intel = &brw->intel; struct brw_vertex_program *vp = (struct brw_vertex_program *) brw->vertex_program; const struct gl_program_parameter_list *params = vp->program.Base.Parameters; @@ -128,8 +129,13 @@ brw_update_vs_constant_surface( struct gl_context *ctx, return; } - brw_create_constant_surface(brw, brw->vs.const_bo, params->NumParameters, - &brw->vs.surf_offset[surf]); + if (intel->gen >= 7) { + gen7_create_constant_surface(brw, brw->vs.const_bo, params->NumParameters, + &brw->vs.surf_offset[surf]); + } else { + brw_create_constant_surface(brw, brw->vs.const_bo, params->NumParameters, + &brw->vs.surf_offset[surf]); + } } diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c index d4eb550..00b562f 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c @@ -126,7 +126,7 @@ gen7_update_texture_surface(struct gl_context *ctx, GLuint unit) * Create the constant buffer surface. Vertex/fragment shader constants will * be read from this buffer with Data Port Read instructions/messages. */ -static void +void gen7_create_constant_surface(struct brw_context *brw, drm_intel_bo *bo, int width, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/gen7: Program stencil buffers on Ivybridge.
Module: Mesa Branch: master Commit: 626440add567174342d421a39252067c6a6fb901 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=626440add567174342d421a39252067c6a6fb901 Author: Kenneth Graunke Date: Mon May 23 14:01:16 2011 -0700 i965/gen7: Program stencil buffers on Ivybridge. Thanks to Chad's hard work implementing separate stencil and HiZ support, this is entirely straightforward. Signed-off-by: Kenneth Graunke Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i965/gen7_misc_state.c | 61 ++ 1 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c b/src/mesa/drivers/dri/i965/gen7_misc_state.c index 0240211..dd0ccd2 100644 --- a/src/mesa/drivers/dri/i965/gen7_misc_state.c +++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c @@ -75,41 +75,55 @@ static void emit_depthbuffer(struct brw_context *brw) struct intel_context *intel = &brw->intel; struct gl_context *ctx = &intel->ctx; struct gl_framebuffer *fb = ctx->DrawBuffer; + + /* _NEW_BUFFERS */ struct intel_renderbuffer *drb = intel_get_renderbuffer(fb, BUFFER_DEPTH); struct intel_renderbuffer *srb = intel_get_renderbuffer(fb, BUFFER_STENCIL); - struct intel_region *region = NULL; - /* _NEW_BUFFERS */ - if (drb) - region = drb->region; - else if (srb) - region = srb->region; + /* Gen7 doesn't support packed depth/stencil */ + assert(srb == NULL || srb != drb); + + if (drb == NULL) { + uint32_t dw1 = BRW_DEPTHFORMAT_D32_FLOAT << 18; + uint32_t dw3 = 0; + + if (srb == NULL) { +dw1 |= (BRW_SURFACE_NULL << 29); + } else { +struct intel_region *region = srb->region; + +/* _NEW_STENCIL: enable stencil buffer writes */ +dw1 |= ((ctx->Stencil.WriteMask != 0) << 27); + +/* 3DSTATE_STENCIL_BUFFER inherits surface type and dimensions. */ +dw1 |= (BRW_SURFACE_2D << 29); +dw3 = ((region->width - 1) << 4) | ((2 * region->height - 1) << 18); + } - if (region == NULL) { BEGIN_BATCH(7); OUT_BATCH(GEN7_3DSTATE_DEPTH_BUFFER << 16 | (7 - 2)); - OUT_BATCH((BRW_DEPTHFORMAT_D32_FLOAT << 18) | - (BRW_SURFACE_NULL << 29)); - OUT_BATCH(0); + OUT_BATCH(dw1); OUT_BATCH(0); + OUT_BATCH(dw3); OUT_BATCH(0); OUT_BATCH(0); OUT_BATCH(0); ADVANCE_BATCH(); } else { + struct intel_region *region = drb->region; uint32_t tile_x, tile_y, offset; offset = intel_region_tile_offsets(region, &tile_x, &tile_y); assert(region->tiling == I915_TILING_Y); - /* _NEW_DEPTH */ + /* _NEW_DEPTH, _NEW_STENCIL */ BEGIN_BATCH(7); OUT_BATCH(GEN7_3DSTATE_DEPTH_BUFFER << 16 | (7 - 2)); OUT_BATCH(((region->pitch * region->cpp) - 1) | (gen7_depth_format(brw) << 18) | (0 << 22) /* no HiZ buffer */ | - (0 << 27) /* no stencil write */ | + ((srb != NULL && ctx->Stencil.WriteMask != 0) << 27) | ((ctx->Depth.Mask != 0) << 28) | (BRW_SURFACE_2D << 29)); OUT_RELOC(region->buffer, @@ -129,12 +143,21 @@ static void emit_depthbuffer(struct brw_context *brw) OUT_BATCH(0); ADVANCE_BATCH(); - BEGIN_BATCH(4); - OUT_BATCH(GEN7_3DSTATE_STENCIL_BUFFER << 16 | (4 - 2)); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - ADVANCE_BATCH(); + if (srb == NULL) { + BEGIN_BATCH(3); + OUT_BATCH(GEN7_3DSTATE_STENCIL_BUFFER << 16 | (3 - 2)); + OUT_BATCH(0); + OUT_BATCH(0); + ADVANCE_BATCH(); + } else { + BEGIN_BATCH(3); + OUT_BATCH(GEN7_3DSTATE_STENCIL_BUFFER << 16 | (3 - 2)); + OUT_BATCH(srb->region->pitch * srb->region->cpp - 1); + OUT_RELOC(srb->region->buffer, + I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, + 0); + ADVANCE_BATCH(); + } BEGIN_BATCH(3); OUT_BATCH(GEN7_3DSTATE_CLEAR_PARAMS << 16 | (3 - 2)); @@ -148,7 +171,7 @@ static void emit_depthbuffer(struct brw_context *brw) */ const struct brw_tracked_state gen7_depthbuffer = { .dirty = { - .mesa = (_NEW_BUFFERS | _NEW_DEPTH), + .mesa = (_NEW_BUFFERS | _NEW_DEPTH | _NEW_STENCIL), .brw = BRW_NEW_BATCH, .cache = 0, }, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/gen7: Enable SIMD16 fragment shader dispatch.
Module: Mesa Branch: master Commit: acf82657f4d607e4477f03752613d42f239e4bd3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=acf82657f4d607e4477f03752613d42f239e4bd3 Author: Kenneth Graunke Date: Mon Jun 6 11:14:15 2011 -0700 i965/gen7: Enable SIMD16 fragment shader dispatch. Signed-off-by: Kenneth Graunke Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i965/gen7_wm_state.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c b/src/mesa/drivers/dri/i965/gen7_wm_state.c index 993d5bd..6a64eb8 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c @@ -232,9 +232,13 @@ upload_ps_state(struct brw_context *brw) OUT_BATCH(0); /* scratch space base offset */ OUT_BATCH(dw4); OUT_BATCH(dw5); - /* FINISHME: need to upload the SIMD16 program */ OUT_BATCH(0); /* kernel 1 pointer */ - OUT_BATCH(0); /* kernel 2 pointer */ + if (brw->wm.prog_data->prog_offset_16) { + OUT_RELOC(brw->wm.prog_bo, I915_GEM_DOMAIN_INSTRUCTION, 0, + brw->wm.prog_data->prog_offset_16); + } else { + OUT_BATCH(0); /* kernel 2 pointer */ + } ADVANCE_BATCH(); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/gen7: Add a prepare_depthbuffer function.
Module: Mesa Branch: master Commit: 53b53a141ee4da9bf03b42d6381823520cd2e980 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=53b53a141ee4da9bf03b42d6381823520cd2e980 Author: Kenneth Graunke Date: Mon May 23 14:40:51 2011 -0700 i965/gen7: Add a prepare_depthbuffer function. We need to call add_validated_bo to do proper aperture space accounting. Signed-off-by: Kenneth Graunke Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i965/gen7_misc_state.c | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c b/src/mesa/drivers/dri/i965/gen7_misc_state.c index 0364b61..0240211 100644 --- a/src/mesa/drivers/dri/i965/gen7_misc_state.c +++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c @@ -56,6 +56,20 @@ gen7_depth_format(struct brw_context *brw) return 0; } +static void prepare_depthbuffer(struct brw_context *brw) +{ + struct intel_context *intel = &brw->intel; + struct gl_context *ctx = &intel->ctx; + struct gl_framebuffer *fb = ctx->DrawBuffer; + struct intel_renderbuffer *drb = intel_get_renderbuffer(fb, BUFFER_DEPTH); + struct intel_renderbuffer *srb = intel_get_renderbuffer(fb, BUFFER_STENCIL); + + if (drb) + brw_add_validated_bo(brw, drb->region->buffer); + if (srb) + brw_add_validated_bo(brw, srb->region->buffer); +} + static void emit_depthbuffer(struct brw_context *brw) { struct intel_context *intel = &brw->intel; @@ -138,5 +152,6 @@ const struct brw_tracked_state gen7_depthbuffer = { .brw = BRW_NEW_BATCH, .cache = 0, }, + .prepare = prepare_depthbuffer, .emit = emit_depthbuffer, }; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/gen7: Don't emit 3DSTATE_GS_SVB_INDEX on Ivybridge.
Module: Mesa Branch: master Commit: 2a638076165eaa1294708a7e4518c2d72560e066 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a638076165eaa1294708a7e4518c2d72560e066 Author: Kenneth Graunke Date: Mon Jun 6 10:35:58 2011 -0700 i965/gen7: Don't emit 3DSTATE_GS_SVB_INDEX on Ivybridge. According to vol2a.07, it only applies from Cantiga to Sandybridge. I found this in my ringbuffers while investigating various GPU hangs. While it may not have been the cause, it seemed wise to remove it. Signed-off-by: Kenneth Graunke Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i965/brw_misc_state.c | 16 +--- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 4256234..a6de28b 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -606,13 +606,15 @@ static void upload_invarient_state( struct brw_context *brw ) OUT_BATCH(1); ADVANCE_BATCH(); - for (i = 0; i < 4; i++) { -BEGIN_BATCH(4); -OUT_BATCH(_3DSTATE_GS_SVB_INDEX << 16 | (4 - 2)); -OUT_BATCH(i << SVB_INDEX_SHIFT); -OUT_BATCH(0); -OUT_BATCH(0x); -ADVANCE_BATCH(); + if (intel->gen < 7) { +for (i = 0; i < 4; i++) { + BEGIN_BATCH(4); + OUT_BATCH(_3DSTATE_GS_SVB_INDEX << 16 | (4 - 2)); + OUT_BATCH(i << SVB_INDEX_SHIFT); + OUT_BATCH(0); + OUT_BATCH(0x); + ADVANCE_BATCH(); +} } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/gen7: gen7_emit_depthbuffer needs the _NEW_DEPTH dirty bit.
Module: Mesa Branch: master Commit: a00ca90815d8df3c087c49a2a7685f739d2d5c0a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a00ca90815d8df3c087c49a2a7685f739d2d5c0a Author: Kenneth Graunke Date: Mon May 23 11:55:39 2011 -0700 i965/gen7: gen7_emit_depthbuffer needs the _NEW_DEPTH dirty bit. For ctx->Depth.Mask. Signed-off-by: Kenneth Graunke Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i965/gen7_misc_state.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c b/src/mesa/drivers/dri/i965/gen7_misc_state.c index 8d5fc70..0364b61 100644 --- a/src/mesa/drivers/dri/i965/gen7_misc_state.c +++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c @@ -89,6 +89,7 @@ static void emit_depthbuffer(struct brw_context *brw) assert(region->tiling == I915_TILING_Y); + /* _NEW_DEPTH */ BEGIN_BATCH(7); OUT_BATCH(GEN7_3DSTATE_DEPTH_BUFFER << 16 | (7 - 2)); OUT_BATCH(((region->pitch * region->cpp) - 1) | @@ -133,7 +134,7 @@ static void emit_depthbuffer(struct brw_context *brw) */ const struct brw_tracked_state gen7_depthbuffer = { .dirty = { - .mesa = _NEW_BUFFERS, + .mesa = (_NEW_BUFFERS | _NEW_DEPTH), .brw = BRW_NEW_BATCH, .cache = 0, }, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/gen7: Remove stencil renderbuffer from gen7_depth_format.
Module: Mesa Branch: master Commit: bd265201da44093ce9c583fe04aa7db94f61453c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd265201da44093ce9c583fe04aa7db94f61453c Author: Kenneth Graunke Date: Mon May 23 11:24:43 2011 -0700 i965/gen7: Remove stencil renderbuffer from gen7_depth_format. Since Gen7 doesn't support packed depth/stencil, the stencil buffer can't possibly be relevant for determining the depth format. Signed-off-by: Kenneth Graunke Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i965/gen7_misc_state.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c b/src/mesa/drivers/dri/i965/gen7_misc_state.c index a180b67..8d5fc70 100644 --- a/src/mesa/drivers/dri/i965/gen7_misc_state.c +++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c @@ -35,13 +35,10 @@ gen7_depth_format(struct brw_context *brw) struct gl_context *ctx = &intel->ctx; struct gl_framebuffer *fb = ctx->DrawBuffer; struct intel_renderbuffer *drb = intel_get_renderbuffer(fb, BUFFER_DEPTH); - struct intel_renderbuffer *srb = intel_get_renderbuffer(fb, BUFFER_STENCIL); struct intel_region *region = NULL; if (drb) region = drb->region; - else if (srb) - region = srb->region; else return BRW_DEPTHFORMAT_D32_FLOAT; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/mesa: more helpful debug message in destroy_program_variants_cb()
Module: Mesa Branch: master Commit: e37e196151bd8c10a8475680ed91a82de8f7aad3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e37e196151bd8c10a8475680ed91a82de8f7aad3 Author: Brian Paul Date: Wed Jun 8 15:15:07 2011 -0600 st/mesa: more helpful debug message in destroy_program_variants_cb() --- src/mesa/state_tracker/st_program.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 0b1ad63..7a6d33d 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -1087,8 +1087,8 @@ destroy_program_variants(struct st_context *st, struct gl_program *program) } break; default: - _mesa_problem(NULL, "Unexpected program target in " -"destroy_program_variants_cb()"); + _mesa_problem(NULL, "Unexpected program target 0x%x in " +"destroy_program_variants_cb()", program->Target); } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: fix typos, update comments
Module: Mesa Branch: master Commit: 2d22186ca80cee2c5929f8fb59b18eec12995534 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d22186ca80cee2c5929f8fb59b18eec12995534 Author: Brian Paul Date: Wed Jun 8 15:07:15 2011 -0600 svga: fix typos, update comments --- src/gallium/drivers/svga/svga_cmd.c | 12 +--- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/svga/svga_cmd.c b/src/gallium/drivers/svga/svga_cmd.c index 1ed1d5d..ebcd4bc 100644 --- a/src/gallium/drivers/svga/svga_cmd.c +++ b/src/gallium/drivers/svga/svga_cmd.c @@ -46,10 +46,10 @@ * to have allocated the fifo space before converting. * * Results: - * id is filld out. + * id is filled out. * * Side effects: - * One surface relocation is preformed for texture handle. + * One surface relocation is performed for texture handle. * *-- */ @@ -224,7 +224,7 @@ SVGA3D_DestroyContext(struct svga_winsys_context *swc) // IN * containers for host VRAM objects like textures, vertex * buffers, and depth/stencil buffers. * - * Surfaces are hierarchial: + * Surfaces are hierarchical: * *- Surface may have multiple faces (for cube maps) * @@ -376,11 +376,9 @@ SVGA3D_DestroySurface(struct svga_winsys_context *swc, /* *-- * - * SVGA3D_BeginSurfaceDMA-- + * SVGA3D_SurfaceDMA-- * - * Begin a SURFACE_DMA command. This reserves space for it in - * the FIFO, and returns a pointer to the command's box array. - * This function must be paired with SVGA_FIFOCommitAll(). + * Emit a SURFACE_DMA command. * * When the SVGA3D device asynchronously processes this FIFO * command, a DMA operation is performed between host VRAM and ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glx: Remove some GLX_USE_APPLEGL guards around glapi
Module: Mesa Branch: master Commit: 3b23cf43a4ac308df8875025fed83b520105 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b23cf43a4ac308df8875025fed83b520105 Author: Jeremy Huddleston Date: Wed Jun 8 12:03:10 2011 -0700 glx: Remove some GLX_USE_APPLEGL guards around glapi Now that we're using glapi, we don't need some GLX_USE_APPLEGL ifdef-foo Signed-off-by: Jeremy Huddleston --- src/glx/glxcurrent.c | 10 +++--- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c index b300958..064fd71 100644 --- a/src/glx/glxcurrent.c +++ b/src/glx/glxcurrent.c @@ -43,10 +43,10 @@ #include "apple_glx.h" #include "apple_glx_context.h" -#else -#include "glapi.h" #endif +#include "glapi.h" + /* ** We setup some dummy structures here so that the API can be used ** even if no context is current. @@ -160,7 +160,7 @@ _X_HIDDEN void __glXSetCurrentContextNull(void) { __glXSetCurrentContext(&dummyContext); -#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL) +#if defined(GLX_DIRECT_RENDERING) _glapi_set_dispatch(NULL); /* no-op functions */ _glapi_set_context(NULL); #endif @@ -214,7 +214,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, struct glx_context *oldGC = __glXGetCurrentContext(); int ret = Success; -#ifndef GLX_USE_APPLEGL /* XXX: If this is left out, then libGL ends up not having this * symbol, and drivers using it fail to load. Compare the * implementation of this symbol to _glapi_noop_enable_warnings(), @@ -224,7 +223,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, * library, though. */ (void)_glthread_GetID(); -#endif /* Make sure that the new context has a nonzero ID. In the request, * a zero context ID is used only to mean that we bind to no current @@ -244,9 +242,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, return False; } -#ifndef GLX_USE_APPLEGL _glapi_check_multithread(); -#endif __glXLock(); if (oldGC == gc && ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): darwin: Use -fvisibility= hidden to set default symbol visibility
Module: Mesa Branch: master Commit: 1b90d7d36bba4ca24099cd4c0d1cc3d8ac7ae415 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1b90d7d36bba4ca24099cd4c0d1cc3d8ac7ae415 Author: Jeremy Huddleston Date: Wed Jun 8 11:47:00 2011 -0700 darwin: Use -fvisibility=hidden to set default symbol visibility Signed-off-by: Jeremy Huddleston --- configs/darwin|4 ++-- src/glx/apple/apple_glapi.c |4 src/glx/apple/apple_xgl_api.h | 23 +++ 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/configs/darwin b/configs/darwin index 9d3bbcf..9527f61 100644 --- a/configs/darwin +++ b/configs/darwin @@ -25,9 +25,9 @@ DEFINES = -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \ ARCH_FLAGS += $(RC_CFLAGS) -CFLAGS = -ggdb3 -Os -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing \ +CFLAGS = -ggdb3 -Os -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing -fvisibility=hidden \ -I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES) -CXXFLAGS = -ggdb3 -Os -Wall -fno-strict-aliasing \ +CXXFLAGS = -ggdb3 -Os -Wall -fno-strict-aliasing -fvisibility=hidden \ -I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES) # Library names (actual file names) diff --git a/src/glx/apple/apple_glapi.c b/src/glx/apple/apple_glapi.c index 9957050..f60cace 100644 --- a/src/glx/apple/apple_glapi.c +++ b/src/glx/apple/apple_glapi.c @@ -49,13 +49,9 @@ #define OPENGL_FRAMEWORK_PATH "/System/Library/Frameworks/OpenGL.framework/OpenGL" #endif -__private_extern__ struct _glapi_table * __ogl_framework_api = NULL; - -__private_extern__ struct _glapi_table * __applegl_api = NULL; -__private_extern__ void apple_xgl_init_direct(void) { static void *handle; const char *opengl_framework_path; diff --git a/src/glx/apple/apple_xgl_api.h b/src/glx/apple/apple_xgl_api.h index c6d8903..2365d64 100644 --- a/src/glx/apple/apple_xgl_api.h +++ b/src/glx/apple/apple_xgl_api.h @@ -29,24 +29,15 @@ #ifndef APPLE_XGL_API_H -__private_extern__ void -__applegl_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, +void __applegl_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +void __applegl_glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); +void __applegl_glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, +GLsizei width); -__private_extern__ void -__applegl_glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); +void __applegl_glDrawBuffer(GLenum mode); +void __applegl_glDrawBuffersARB(GLsizei n, const GLenum * bufs); -__private_extern__ void -__applegl_glCopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, - GLsizei width); - -__private_extern__ void -__applegl_glDrawBuffer(GLenum mode); - -__private_extern__ void -__applegl_glDrawBuffersARB(GLsizei n, const GLenum * bufs); - -__private_extern__ void -__applegl_glViewport(GLint x, GLint y, GLsizei width, GLsizei height); +void __applegl_glViewport(GLint x, GLint y, GLsizei width, GLsizei height); #endif ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): darwin: mklib: Make the real file match the id
Module: Mesa Branch: master Commit: 2835c5112de59a0713fe1c78efbe77ea855a3eed URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2835c5112de59a0713fe1c78efbe77ea855a3eed Author: Jeremy Huddleston Date: Wed Jun 8 11:20:38 2011 -0700 darwin: mklib: Make the real file match the id This makes mesa more consistent with glibtool and XCode where the generated file matches the dylib id rather using an extra symlink Signed-off-by: Jeremy Huddleston --- bin/mklib | 11 +++ 1 files changed, 3 insertions(+), 8 deletions(-) diff --git a/bin/mklib b/bin/mklib index a511375..2c7ed38 100755 --- a/bin/mklib +++ b/bin/mklib @@ -767,9 +767,8 @@ case $ARCH in OPTS="${OPTS} -exported_symbols_list ${EXPORTS}" fi -LINKNAME="lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}" -LINKNAME2="lib${LIBNAME}.${LIBSUFFIX}" -LIBNAME="lib${LIBNAME}.${MAJOR}.${MINOR}.${LIBSUFFIX}" +LINKNAME="lib${LIBNAME}.${LIBSUFFIX}" +LIBNAME="lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}" # examine first object to determine ABI set ${OBJECTS} @@ -782,9 +781,6 @@ case $ARCH in OPTS=${ALTOPTS} fi - # XXX can we always add -isysroot /Developer/SDKs/MacOSX10.4u.sdk - # to OPTS here? - # determine linker if [ $CPLUSPLUS = 1 ] ; then LINK="g++" @@ -796,8 +792,7 @@ case $ARCH in ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} ln -s ${LIBNAME} ${LINKNAME} -ln -s ${LIBNAME} ${LINKNAME2} -FINAL_LIBS="${LIBNAME} ${LINKNAME} ${LINKNAME2}" +FINAL_LIBS="${LIBNAME} ${LINKNAME}" fi ;; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): intel: Request DRI2 buffers for separate stencil and hiz
Module: Mesa Branch: master Commit: aea2236af60aee329e6ea73a41f2410d8eacc7b6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=aea2236af60aee329e6ea73a41f2410d8eacc7b6 Author: Chad Versace Date: Fri Jun 3 16:33:32 2011 -0700 intel: Request DRI2 buffers for separate stencil and hiz When it is sensible to do so, 1) intelCreateBuffer() now attaches separate depth and stencil buffers to the framebuffer it creates. 2) intel_update_renderbuffers() requests for the framebuffer a separate stencil buffer (DRI2BufferStencil). The criteria for "sensible" is: - The GLX config has nonzero depth and stencil bits. - The hardware supports separate stencil. - The X driver supports separate stencil, or its support has not yet been determined. If the hardware supports hiz too, then intel_update_renderbuffers() also requests DRI2BufferHiz. If after requesting DRI2BufferStencil we determine that X driver did not actually support separate stencil, we clean up the mistake and never ask for DRI2BufferStencil again. CC: Ian Romanick CC: Kristian Høgsberg Acked-by: Eric Anholt Reviewed-by: Kenneth Graunke Signed-off-by: Chad Versace --- src/mesa/drivers/dri/intel/intel_context.c | 428 +++- src/mesa/drivers/dri/intel/intel_screen.c | 28 ++- src/mesa/drivers/dri/intel/intel_screen.h |2 - 3 files changed, 444 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 3460e67..0c2ba41 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -33,6 +33,7 @@ #include "main/framebuffer.h" #include "main/imports.h" #include "main/points.h" +#include "main/renderbuffer.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -240,6 +241,26 @@ intel_process_dri2_buffer_no_separate_stencil(struct intel_context *intel, struct intel_renderbuffer *rb, const char *buffer_name); +static void +intel_query_dri2_buffers_with_separate_stencil(struct intel_context *intel, + __DRIdrawable *drawable, + __DRIbuffer **buffers, + unsigned **attachments, + int *count); + +static void +intel_process_dri2_buffer_with_separate_stencil(struct intel_context *intel, + __DRIdrawable *drawable, + __DRIbuffer *buffer, + struct intel_renderbuffer *rb, + const char *buffer_name); +static void +intel_verify_dri2_has_hiz(struct intel_context *intel, + __DRIdrawable *drawable, + __DRIbuffer **buffers, + unsigned **attachments, + int *count); + void intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) { @@ -247,9 +268,19 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) struct intel_renderbuffer *rb; struct intel_context *intel = context->driverPrivate; __DRIbuffer *buffers = NULL; + unsigned *attachments = NULL; int i, count; const char *region_name; + bool try_separate_stencil = + intel->has_separate_stencil && + intel->intelScreen->dri2_has_hiz != INTEL_DRI2_HAS_HIZ_FALSE && + intel->intelScreen->driScrnPriv->dri2.loader != NULL && + intel->intelScreen->driScrnPriv->dri2.loader->base.version > 2 && + intel->intelScreen->driScrnPriv->dri2.loader->getBuffersWithFormat != NULL; + + assert(!intel->must_use_separate_stencil || try_separate_stencil); + /* If we're rendering to the fake front buffer, make sure all the * pending drawing has landed on the real front buffer. Otherwise * when we eventually get to DRI2GetBuffersWithFormat the stale @@ -269,12 +300,17 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) if (unlikely(INTEL_DEBUG & DEBUG_DRI)) fprintf(stderr, "enter %s, drawable %p\n", __func__, drawable); + if (try_separate_stencil) { + intel_query_dri2_buffers_with_separate_stencil(intel, drawable, &buffers, +&attachments, &count); + } else { + intel_query_dri2_buffers_no_separate_stencil(intel, drawable, &buffers, + &count); + } + if (buffers == NULL) return; - intel_query_dri2_buffers_no_separate_stencil(intel, drawable, &buffers, - &count); - drawable->x = 0; drawable->y = 0; drawable->backX = 0; @@ -312,6 +348,12 @
Mesa (master): intel: Add assertions to intelCreateBuffer()
Module: Mesa Branch: master Commit: f4efb7ff4f9cb0f6386e9b53f4dcfd9ef23dc9d1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f4efb7ff4f9cb0f6386e9b53f4dcfd9ef23dc9d1 Author: Chad Versace Date: Thu May 26 14:55:54 2011 -0700 intel: Add assertions to intelCreateBuffer() Assert that the GLX config has an expected depth/stencil bit combination: one of d24/s8, d16/s0, d0/s0. These are the only depth/stencil configurations that we advertise. Remove the check for software stencil, because given the assertions' constraints the check always fails. CC: Ian Romanick CC: Kristian Høgsberg Acked-by: Eric Anholt Reviewed-by: Kenneth Graunke Signed-off-by: Chad Versace --- src/mesa/drivers/dri/intel/intel_screen.c | 15 --- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 646b960..21dc8dc 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -364,8 +364,6 @@ intelCreateBuffer(__DRIscreen * driScrnPriv, return GL_FALSE; /* not implemented */ } else { - GLboolean swStencil = (mesaVis->stencilBits > 0 && - mesaVis->depthBits != 24); gl_format rgbFormat; struct gl_framebuffer *fb = CALLOC_STRUCT(gl_framebuffer); @@ -391,6 +389,11 @@ intelCreateBuffer(__DRIscreen * driScrnPriv, _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &rb->Base); } + /* + * Assert here that the gl_config has an expected depth/stencil bit + * combination: one of d24/s8, d16/s0, d0/s0. (See intelInitScreen2(), + * which constructs the advertised configs.) + */ if (mesaVis->depthBits == 24) { assert(mesaVis->stencilBits == 8); /* combined depth/stencil buffer */ @@ -401,17 +404,23 @@ intelCreateBuffer(__DRIscreen * driScrnPriv, _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &depthStencilRb->Base); } else if (mesaVis->depthBits == 16) { +assert(mesaVis->stencilBits == 0); /* just 16-bit depth buffer, no hw stencil */ struct intel_renderbuffer *depthRb = intel_create_renderbuffer(MESA_FORMAT_Z16); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); } + else { +assert(mesaVis->depthBits == 0); +assert(mesaVis->stencilBits == 0); + } /* now add any/all software-based renderbuffers we may need */ _mesa_add_soft_renderbuffers(fb, GL_FALSE, /* never sw color */ GL_FALSE, /* never sw depth */ - swStencil, mesaVis->accumRedBits > 0, + GL_FALSE, /* never sw stencil */ + mesaVis->accumRedBits > 0, GL_FALSE, /* never sw alpha */ GL_FALSE /* never sw aux */ ); driDrawPriv->driverPrivate = fb; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): intel: Refactor intel_update_renderbuffers()
Module: Mesa Branch: master Commit: 89d34cfd3e7c96cefc489fbb995124e2dc4a97ec URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=89d34cfd3e7c96cefc489fbb995124e2dc4a97ec Author: Chad Versace Date: Fri Jun 3 16:14:25 2011 -0700 intel: Refactor intel_update_renderbuffers() Extract the code that queries DRI2 to obtain the DRIdrawable's buffers into intel_query_dri2_buffers_no_separate_stencil(). Extract the code that assigns the DRI buffer's DRM region to the corresponding renderbuffer into intel_process_dri2_buffer_no_separate_stencil(). Rationale - The next commit enables intel_update_renderbuffers() to query for separate stencil and hiz buffers. Without separating the separate-stencil and no-separate-stencil paths, intel_update_renderbuffers() degenerates into an impenetrable labyrinth of if-trees. CC: Ian Romanick CC: Kristian Høgsberg Acked-by: Eric Anholt Reviewed-by: Kenneth Graunke Signed-off-by: Chad Versace --- src/mesa/drivers/dri/intel/intel_context.c | 323 ++-- 1 files changed, 212 insertions(+), 111 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 0259891..3460e67 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -227,18 +227,27 @@ intel_bits_per_pixel(const struct intel_renderbuffer *rb) return _mesa_get_format_bytes(rb->Base.Format) * 8; } +static void +intel_query_dri2_buffers_no_separate_stencil(struct intel_context *intel, +__DRIdrawable *drawable, +__DRIbuffer **buffers, +int *count); + +static void +intel_process_dri2_buffer_no_separate_stencil(struct intel_context *intel, + __DRIdrawable *drawable, + __DRIbuffer *buffer, + struct intel_renderbuffer *rb, + const char *buffer_name); + void intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) { struct gl_framebuffer *fb = drawable->driverPrivate; struct intel_renderbuffer *rb; - struct intel_region *region, *depth_region; struct intel_context *intel = context->driverPrivate; - struct intel_renderbuffer *front_rb, *back_rb, *depth_rb, *stencil_rb; __DRIbuffer *buffers = NULL; - __DRIscreen *screen; int i, count; - unsigned int attachments[10]; const char *region_name; /* If we're rendering to the fake front buffer, make sure all the @@ -260,70 +269,12 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) if (unlikely(INTEL_DEBUG & DEBUG_DRI)) fprintf(stderr, "enter %s, drawable %p\n", __func__, drawable); - screen = intel->intelScreen->driScrnPriv; - - if (screen->dri2.loader - && (screen->dri2.loader->base.version > 2) - && (screen->dri2.loader->getBuffersWithFormat != NULL)) { - - front_rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT); - back_rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT); - depth_rb = intel_get_renderbuffer(fb, BUFFER_DEPTH); - stencil_rb = intel_get_renderbuffer(fb, BUFFER_STENCIL); - - i = 0; - if ((intel->is_front_buffer_rendering || - intel->is_front_buffer_reading || - !back_rb) && front_rb) { -attachments[i++] = __DRI_BUFFER_FRONT_LEFT; -attachments[i++] = intel_bits_per_pixel(front_rb); - } - - if (back_rb) { -attachments[i++] = __DRI_BUFFER_BACK_LEFT; -attachments[i++] = intel_bits_per_pixel(back_rb); - } - - if ((depth_rb != NULL) && (stencil_rb != NULL)) { -attachments[i++] = __DRI_BUFFER_DEPTH_STENCIL; -attachments[i++] = intel_bits_per_pixel(depth_rb); - } else if (depth_rb != NULL) { -attachments[i++] = __DRI_BUFFER_DEPTH; -attachments[i++] = intel_bits_per_pixel(depth_rb); - } else if (stencil_rb != NULL) { -attachments[i++] = __DRI_BUFFER_STENCIL; -attachments[i++] = intel_bits_per_pixel(stencil_rb); - } - - buffers = -(*screen->dri2.loader->getBuffersWithFormat)(drawable, - &drawable->w, - &drawable->h, - attachments, i / 2, - &count, - drawable->loaderPrivate); - } else if (screen->dri2.loader) { - i = 0; - if (intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT)) -attachments[i++] = __DRI_BUFFER_FRONT_LEFT; - if (intel_get_renderbuffer(fb, BUFFER_BACK_LEFT)) -attachments[i++] = __DRI_BUFFER_BACK_LEFT; - if (intel_get_renderbuffer(fb
Mesa (master): intel: Add function intel_renderbuffer_set_hiz_region()
Module: Mesa Branch: master Commit: 84294fe26ca5860c34e6541f633be4d093ab57f2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=84294fe26ca5860c34e6541f633be4d093ab57f2 Author: Chad Versace Date: Tue May 31 14:18:22 2011 -0700 intel: Add function intel_renderbuffer_set_hiz_region() It's the analog of intel_renderbuffer_set_region(), but for the hiz region of course. CC: Ian Romanick CC: Kristian Høgsberg Acked-by: Eric Anholt Reviewed-by: Kenneth Graunke Signed-off-by: Chad Versace --- src/mesa/drivers/dri/intel/intel_fbo.c | 12 src/mesa/drivers/dri/intel/intel_fbo.h |5 + 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 7434e0e..83f622d 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -321,6 +321,18 @@ intel_renderbuffer_set_region(struct intel_context *intel, } +void +intel_renderbuffer_set_hiz_region(struct intel_context *intel, + struct intel_renderbuffer *rb, + struct intel_region *region) +{ + struct intel_region *old = rb->hiz_region; + rb->hiz_region = NULL; + intel_region_reference(&rb->hiz_region, region); + intel_region_release(&old); +} + + /** * Create a new intel_renderbuffer which corresponds to an on-screen window, * not a user-created renderbuffer. diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h index 212dd9a..e9929b0 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.h +++ b/src/mesa/drivers/dri/intel/intel_fbo.h @@ -113,6 +113,11 @@ intel_renderbuffer_set_region(struct intel_context *intel, struct intel_renderbuffer *irb, struct intel_region *region); +extern void +intel_renderbuffer_set_hiz_region(struct intel_context *intel, + struct intel_renderbuffer *rb, + struct intel_region *region); + extern struct intel_renderbuffer * intel_create_renderbuffer(gl_format format); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): intel/intel_context.c: Remove unused functions
Module: Mesa Branch: master Commit: beb8b7da20c862549b96a500226caf3a610342d9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=beb8b7da20c862549b96a500226caf3a610342d9 Author: Chad Versace Date: Wed Jun 1 15:14:18 2011 -0700 intel/intel_context.c: Remove unused functions Remove functions intel_override_hiz() and intel_override_separate_stencil(). They are now located in intel_screen.c. CC: Ian Romanick CC: Kristian Høgsberg Acked-by: Eric Anholt Reviewed-by: Kenneth Graunke Signed-off-by: Chad Versace --- src/mesa/drivers/dri/intel/intel_context.c | 48 1 files changed, 0 insertions(+), 48 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 22704a3..0259891 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -610,54 +610,6 @@ intelInitDriverFunctions(struct dd_function_table *functions) intel_init_syncobj_functions(functions); } -/** - * Override intel->has_hiz with environment variable INTEL_HIZ. - * - * Valid values for INTEL_HIZ are "0" and "1". If an invalid valid value is - * encountered, a warning is emitted and INTEL_HIZ is ignored. - */ -static void -intel_override_hiz(struct intel_context *intel) -{ - const char *s = getenv("INTEL_HIZ"); - if (!s) { - return; - } else if (!strncmp("0", s, 2)) { - intel->has_hiz = false; - } else if (!strncmp("1", s, 2)) { - intel->has_hiz = true; - } else { - _mesa_warning(&intel->ctx, -"env variable INTEL_HIZ=\"%s\" has invalid value and " -"is ignored", s); - } -} - -/** - * Override intel->has_separate_stencil with environment variable - * INTEL_SEPARATE_STENCIL. - * - * Valid values for INTEL_SEPARATE_STENCIL are "0" and "1". If an invalid - * value is encountered, a warning is emitted and INTEL_SEPARATE_STENCIL is - * ignored. - */ -static void -intel_override_separate_stencil(struct intel_context *intel) -{ - const char *s = getenv("INTEL_SEPARATE_STENCIL"); - if (!s) { - return; - } else if (!strncmp("0", s, 2)) { - intel->has_separate_stencil = false; - } else if (!strncmp("1", s, 2)) { - intel->has_separate_stencil = true; - } else { - _mesa_warning(&intel->ctx, -"env variable INTEL_SEPARATE_STENCIL=\"%s\" has invalid " -"value and is ignored", s); - } -} - GLboolean intelInitContext(struct intel_context *intel, int api, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): intel: Add flags to intel_screen for hiz and separate stencil
Module: Mesa Branch: master Commit: 6b2bf272ee173bd8ee6c731500861de21fa01b5f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b2bf272ee173bd8ee6c731500861de21fa01b5f Author: Chad Versace Date: Thu May 26 15:24:48 2011 -0700 intel: Add flags to intel_screen for hiz and separate stencil Add the fields below to intel_screen. The expression in parens is the value to which intelInitScreen2() currently sets the field. GLboolean hw_has_separate_stencil (true iff gen >= 7) GLboolean hw_must_use_separate_stencil (true iff gen >= 7) GLboolean hw_has_hiz (always false) enum intel_dri2_has_hiz dri2_has_hiz (INTEL_DRI2_HAS_HIZ_UNKNOWN) The analogous fields in intel_context now inherit their values from intel_screen. When hiz and separate stencil become completely implemented for a given chipset, then the respective fields need to be enabled. CC: Ian Romanick CC: Kristian Høgsberg Acked-by: Eric Anholt Reviewed-by: Kenneth Graunke Signed-off-by: Chad Versace --- src/mesa/drivers/dri/intel/intel_context.c | 10 +--- src/mesa/drivers/dri/intel/intel_screen.c | 60 src/mesa/drivers/dri/intel/intel_screen.h | 10 + 3 files changed, 73 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index b6a017a..22704a3 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -704,14 +704,9 @@ intelInitContext(struct intel_context *intel, if (IS_GEN7(intel->intelScreen->deviceID)) { intel->needs_ff_sync = GL_TRUE; intel->has_luminance_srgb = GL_TRUE; - /* FINISHME: Enable intel->has_separate_stencil on Gen7. */ - /* FINISHME: Enable intel->must_use_separate_stencil on Gen7. */ - /* FINISHME: Enable intel->has_hiz on Gen7. */ } else if (IS_GEN6(intel->intelScreen->deviceID)) { intel->needs_ff_sync = GL_TRUE; intel->has_luminance_srgb = GL_TRUE; - /* FINISHME: Enable intel->has_separate_stencil on Gen6. */ - /* FINISHME: Enable intel->has_hiz on Gen6. */ } else if (IS_GEN5(intel->intelScreen->deviceID)) { intel->needs_ff_sync = GL_TRUE; intel->has_luminance_srgb = GL_TRUE; @@ -731,8 +726,9 @@ intelInitContext(struct intel_context *intel, } } - intel_override_hiz(intel); - intel_override_separate_stencil(intel); + intel->has_separate_stencil = intel->intelScreen->hw_has_separate_stencil; + intel->must_use_separate_stencil = intel->intelScreen->hw_must_use_separate_stencil; + intel->has_hiz = intel->intelScreen->hw_has_hiz; memset(&ctx->TextureFormatSupported, 0, sizeof(ctx->TextureFormatSupported)); diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index deca11d..646b960 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -507,6 +507,54 @@ intel_init_bufmgr(struct intel_screen *intelScreen) } /** + * Override intel_screen.hw_has_hiz with environment variable INTEL_HIZ. + * + * Valid values for INTEL_HIZ are "0" and "1". If an invalid valid value is + * encountered, a warning is emitted and INTEL_HIZ is ignored. + */ +static void +intel_override_hiz(struct intel_screen *intel) +{ + const char *s = getenv("INTEL_HIZ"); + if (!s) { + return; + } else if (!strncmp("0", s, 2)) { + intel->hw_has_hiz = false; + } else if (!strncmp("1", s, 2)) { + intel->hw_has_hiz = true; + } else { + fprintf(stderr, + "warning: env variable INTEL_HIZ=\"%s\" has invalid value " + "and is ignored", s); + } +} + +/** + * Override intel_screen.hw_has_separate_stencil with environment variable + * INTEL_SEPARATE_STENCIL. + * + * Valid values for INTEL_SEPARATE_STENCIL are "0" and "1". If an invalid + * valid value is encountered, a warning is emitted and INTEL_SEPARATE_STENCIL + * is ignored. + */ +static void +intel_override_separate_stencil(struct intel_screen *screen) +{ + const char *s = getenv("INTEL_SEPARATE_STENCIL"); + if (!s) { + return; + } else if (!strncmp("0", s, 2)) { + screen->hw_has_separate_stencil = false; + } else if (!strncmp("1", s, 2)) { + screen->hw_has_separate_stencil = true; + } else { + fprintf(stderr, + "warning: env variable INTEL_SEPARATE_STENCIL=\"%s\" has " + "invalid value and is ignored", s); + } +} + +/** * This is the driver specific part of the createNewScreen entry point. * Called when using DRI2. * @@ -570,6 +618,18 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp) intelScreen->gen = 2; } + /* +* FIXME: The hiz and separate stencil fields need updating once the +* FIXME: features are completely implemented for a given chipset. +*/ + intelScreen->hw_has_separate_stencil = intelScreen->gen >= 7; + intelScreen->hw_must_use_
Mesa (master): intel: Define enum intel_dri2_has_hiz
Module: Mesa Branch: master Commit: df9f533c67e06713ae1b7f759c3644ca610058fd URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=df9f533c67e06713ae1b7f759c3644ca610058fd Author: Chad Versace Date: Wed Jun 1 14:19:29 2011 -0700 intel: Define enum intel_dri2_has_hiz ... which indicates if the X driver supports DRI2BufferHiz and DRI2BufferStencil. I'm placing this in its own commit due to the large comment block. CC: Ian Romanick CC: Kristian Høgsberg Acked-by: Eric Anholt Reviewed-by: Kenneth Graunke Signed-off-by: Chad Versace --- src/mesa/drivers/dri/intel/intel_screen.h | 56 + 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h index 4613c98..5d13dfb 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.h +++ b/src/mesa/drivers/dri/intel/intel_screen.h @@ -34,6 +34,62 @@ #include "i915_drm.h" #include "xmlconfig.h" +/** + * \brief Does X driver support DRI2BufferHiz and DRI2BufferStencil? + * + * (Here, "X driver" referes to the DDX driver, xf86-video-intel). + * + * The DRI2 protocol does not allow us to query the X driver's version nor + * query for a list of buffer formats that the driver supports. So, to + * determine if the X driver supports DRI2BufferHiz and DRI2BufferStencil we + * must resort to a handshake. + * + * If the hardware lacks support for separate stencil (and consequently, lacks + * support for hiz also), then the X driver's separate stencil and hiz support + * is irrelevant and the handshake never occurs. + * + * Complications + * - + * The handshake is complicated by a bug in xf86-video-intel 2.15. Even though + * that version of the X driver did not supppot requests for DRI2BufferHiz or + * DRI2BufferStencil, if requested one it still allocated and returned one. + * The returned buffer, however, was incorrectly X tiled. + * + * How the handshake works + * --- + * (TODO: To be implemented on a future commit). + * + * Initially, intel_screen.dri2_has_hiz is set to unknown. The first time the + * user requests a depth and stencil buffer, intelCreateBuffers() creates a + * framebuffer with separate depth and stencil attachments (with formats + * x8_z24 and s8). + * + * Eventually, intel_update_renderbuffers() makes a DRI2 request for + * DRI2BufferStencil and DRI2BufferHiz. If the returned buffers are Y tiled, + * then we joyfully set intel_screen.dri2_has_hiz to true and continue as if + * nothing happend. + * + * If the buffers are X tiled, however, the handshake has failed and we must + * clean up. + *1. Angrily set intel_screen.dri2_has_hiz to false. + *2. Discard the framebuffer's depth and stencil attachments. + *3. Attach a packed depth/stencil buffer to the framebuffer (with format + * s8_z24). + *4. Make a DRI2 request for the new buffer, using attachment type + * DRI2BufferDepthStencil). + * + * Future Considerations + * - + * On a sunny day in the far future, when we are certain that no one has an + * xf86-video-intel installed without hiz and separate stencil support, then + * this enumerant and the handshake should die. + */ +enum intel_dri2_has_hiz { + INTEL_DRI2_HAS_HIZ_UNKNOWN, + INTEL_DRI2_HAS_HIZ_TRUE, + INTEL_DRI2_HAS_HIZ_FALSE, +}; + struct intel_screen { int deviceID; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): dri2: Add token for DRI2BufferHiz
Module: Mesa Branch: master Commit: 4501a5d6e8d00fd0d87625352ed5ba1a8861f72e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4501a5d6e8d00fd0d87625352ed5ba1a8861f72e Author: Chad Versace Date: Thu May 26 16:50:30 2011 -0700 dri2: Add token for DRI2BufferHiz CC: Ian Romanick CC: Kristian Høgsberg Acked-by: Eric Anholt Reviewed-by: Kenneth Graunke Signed-off-by: Chad Versace --- include/GL/internal/dri_interface.h |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index d791557..f022b44 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -692,6 +692,7 @@ struct __DRIswrastExtensionRec { #define __DRI_BUFFER_FAKE_FRONT_LEFT 7 #define __DRI_BUFFER_FAKE_FRONT_RIGHT 8 #define __DRI_BUFFER_DEPTH_STENCIL 9 /**< Only available with DRI2 1.1 */ +#define __DRI_BUFFER_HIZ 10 struct __DRIbufferRec { unsigned int attachment; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): intel: Define span functions for S8 renderbuffers
Module: Mesa Branch: master Commit: ff99103c0a8a1b9e76fff80f9753d2124da27da2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ff99103c0a8a1b9e76fff80f9753d2124da27da2 Author: Chad Versace Date: Wed Jun 1 11:31:56 2011 -0700 intel: Define span functions for S8 renderbuffers Since the stencil buffer is interleaved, the generic Mesa renderbuffer accessors do not suffice. Custom span functions are necessary. Acked-by: Kenneth Graunke Reviewed-by: Eric Anholt Signed-off-by: Chad Versace --- src/mesa/drivers/dri/intel/intel_span.c | 64 +++ 1 files changed, 64 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 5290342..a4a1d6b 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -1,6 +1,7 @@ /** * * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2011 Intel Corporation * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,9 +24,13 @@ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * Authors: + * Chad Versace + * **/ #include +#include #include "main/glheader.h" #include "main/macros.h" #include "main/mtypes.h" @@ -112,6 +117,64 @@ intel_set_span_functions(struct intel_context *intel, #define TAG2(x,y) intel_##x##y##_A8 #include "spantmp2.h" +/* - */ +/* s8 stencil span and pixel functions */ +/* - */ + +/* + * HAVE_HW_STENCIL_SPANS determines if stencil buffer read/writes are done with + * memcpy or for loops. Since the stencil buffer is interleaved, memcpy won't + * work. + */ +#define HAVE_HW_STENCIL_SPANS 0 + +#define LOCAL_STENCIL_VARS \ + (void) ctx; \ + int minx = 0; \ + int miny = 0; \ + int maxx = rb->Width; \ + int maxy = rb->Height; \ + int stride = rb->RowStride; \ + uint8_t *buf = rb->Data;\ + +/* Don't flip y. */ +#undef Y_FLIP +#define Y_FLIP(y) y + +/** + * \brief Get pointer offset into stencil buffer. + * + * The stencil buffer interleaves two rows into one. Yay for crazy hardware. + * The table below demonstrates how the pointer arithmetic behaves for a buffer + * with positive stride (s=stride). + * + * x| y | byte offset + * -- + * 0| 0 | 0 + * 0| 0 | 1 + * 1| 0 | 2 + * 1| 1 | 3 + * ... | ... | ... + * 0| 2 | s + * 0| 3 | s + 1 + * 1| 2 | s + 2 + * 1| 3 | s + 3 + * + * + */ +static inline intptr_t +intel_offset_S8(int stride, GLint x, GLint y) +{ + return 2 * ((y / 2) * stride + x) + y % 2; +} + +#define WRITE_STENCIL(x, y, src) buf[intel_offset_S8(stride, x, y)] = src; +#define READ_STENCIL(dest, x, y) dest = buf[intel_offset_S8(stride, x, y)] +#define TAG(x) intel_##x##_S8 +#include "stenciltmp.h" + +/* - */ + void intel_renderbuffer_map(struct intel_context *intel, struct gl_renderbuffer *rb) { @@ -332,6 +395,7 @@ static span_init_func intel_span_init_funcs[MESA_FORMAT_COUNT] = [MESA_FORMAT_Z16] = _mesa_set_renderbuffer_accessors, [MESA_FORMAT_X8_Z24] = _mesa_set_renderbuffer_accessors, [MESA_FORMAT_S8_Z24] = _mesa_set_renderbuffer_accessors, + [MESA_FORMAT_S8] = intel_InitStencilPointers_S8, [MESA_FORMAT_R8] = _mesa_set_renderbuffer_accessors, [MESA_FORMAT_RG88] = _mesa_set_renderbuffer_accessors, [MESA_FORMAT_R16] = _mesa_set_renderbuffer_accessors, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i965/brw: Emit state for hiz and separate stencil buffers
Module: Mesa Branch: master Commit: 2abc8cae87b4cd037ebde68b4b9a1d02254657df URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2abc8cae87b4cd037ebde68b4b9a1d02254657df Author: Chad Versace Date: Mon May 23 13:48:28 2011 -0700 i965/brw: Emit state for hiz and separate stencil buffers When emitting 3DSTATE_DEPTH_BUFFER, also emit 3DSTATE_HIER_DEPTH_BUFFER if there is a hiz buffer. Ditto for 3DSTATE_STENCIL_BUFFER and a separate stencil buffer. Reviewed-by: Eric Anholt Reviewed-by: Kenneth Graunke Signed-off-by: Chad Versace --- src/mesa/drivers/dri/i965/brw_misc_state.c | 114 -- src/mesa/drivers/dri/i965/brw_wm_surface_state.c |2 + 2 files changed, 107 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index 3ec9009..4256234 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -202,6 +202,8 @@ static void prepare_depthbuffer(struct brw_context *brw) if (drb) brw_add_validated_bo(brw, drb->region->buffer); + if (drb && drb->hiz_region) + brw_add_validated_bo(brw, drb->hiz_region->buffer); if (srb) brw_add_validated_bo(brw, srb->region->buffer); } @@ -212,14 +214,28 @@ static void emit_depthbuffer(struct brw_context *brw) struct gl_context *ctx = &intel->ctx; struct gl_framebuffer *fb = ctx->DrawBuffer; /* _NEW_BUFFERS */ - struct intel_renderbuffer *irb = intel_get_renderbuffer(fb, BUFFER_DEPTH); + struct intel_renderbuffer *depth_irb = intel_get_renderbuffer(fb, BUFFER_DEPTH); + struct intel_renderbuffer *stencil_irb = intel_get_renderbuffer(fb, BUFFER_STENCIL); + struct intel_region *hiz_region = depth_irb ? depth_irb->hiz_region : NULL; unsigned int len; - /* If we're combined depth stencil but no depth is attached, look -* up stencil. + /* +* If depth and stencil buffers are identical, then don't use separate +* stencil. */ - if (!irb) - irb = intel_get_renderbuffer(fb, BUFFER_STENCIL); + if (depth_irb && depth_irb == stencil_irb) { + stencil_irb = NULL; + } + + /* +* If stencil buffer uses combined depth/stencil format, but no depth buffer +* is attached, then use stencil buffer as depth buffer. +*/ + if (!depth_irb && stencil_irb + && stencil_irb->Base.Format == MESA_FORMAT_S8_Z24) { + depth_irb = stencil_irb; + stencil_irb = NULL; + } if (intel->gen >= 6) len = 7; @@ -228,7 +244,7 @@ static void emit_depthbuffer(struct brw_context *brw) else len = 5; - if (!irb) { + if (!depth_irb && !stencil_irb) { BEGIN_BATCH(len); OUT_BATCH(_3DSTATE_DEPTH_BUFFER << 16 | (len - 2)); OUT_BATCH((BRW_DEPTHFORMAT_D32_FLOAT << 18) | @@ -244,11 +260,57 @@ static void emit_depthbuffer(struct brw_context *brw) OUT_BATCH(0); ADVANCE_BATCH(); + + } else if (!depth_irb && stencil_irb) { + /* + * There exists a separate stencil buffer but no depth buffer. + * + * The stencil buffer inherits most of its fields from + * 3DSTATE_DEPTH_BUFFER: namely the tile walk, surface type, width, and + * height. + * + * Since the stencil buffer has quirky pitch requirements, its region + * was allocated with half height and double cpp. So we need + * a multiplier of 2 to obtain the surface's real height. + * + * Enable the hiz bit because it and the separate stencil bit must have + * the same value. From Section 2.11.5.6.1.1 3DSTATE_DEPTH_BUFFER, Bit + * 1.21 "Separate Stencil Enable": + * [DevIL]: If this field is enabled, Hierarchical Depth Buffer + * Enable must also be enabled. + * + * [DevGT]: This field must be set to the same value (enabled or + * disabled) as Hierarchical Depth Buffer Enable + */ + assert(intel->has_separate_stencil); + assert(stencil_irb->Base.Format == MESA_FORMAT_S8); + + BEGIN_BATCH(len); + OUT_BATCH(_3DSTATE_DEPTH_BUFFER << 16 | (len - 2)); + OUT_BATCH((BRW_DEPTHFORMAT_D32_FLOAT << 18) | + (1 << 21) | /* separate stencil enable */ + (1 << 22) | /* hiz enable */ + (BRW_TILEWALK_YMAJOR << 26) | + (BRW_SURFACE_2D << 29)); + OUT_BATCH(0); + OUT_BATCH(((stencil_irb->region->width - 1) << 6) | +(2 * stencil_irb->region->height - 1) << 19); + OUT_BATCH(0); + OUT_BATCH(0); + + if (intel->gen >= 6) +OUT_BATCH(0); + + ADVANCE_BATCH(); + } else { - struct intel_region *region = irb->region; + struct intel_region *region = depth_irb->region; unsigned int format; uint32_t tile_x, tile_y, offset; + /* If using separate stencil, hiz must be enabled. */ + assert(!stencil_irb || hiz_region); + switch (region->cpp) { case 2:
Mesa (master): st/egl: set EGL_ALPHA_MASK_SIZE
Module: Mesa Branch: master Commit: 6b492d09767531915aa631bec470af1cf4653a6c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b492d09767531915aa631bec470af1cf4653a6c Author: Chia-I Wu Date: Thu Jun 9 00:23:16 2011 +0800 st/egl: set EGL_ALPHA_MASK_SIZE --- src/gallium/state_trackers/egl/common/egl_g3d.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 4bd8656..29dbbef 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -259,6 +259,10 @@ init_config_attributes(_EGLConfig *conf, const struct native_config *nconf, conf->DepthSize = depth_stencil[0]; conf->StencilSize = depth_stencil[1]; + /* st/vega will allocate the mask on demand */ + if (api_mask & EGL_OPENVG_BIT) + conf->AlphaMaskSize = 8; + conf->SurfaceType = surface_type; conf->NativeRenderable = EGL_TRUE; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: merge glapidispatch.h into dispatch.h
Module: Mesa Branch: master Commit: 4bb748b609288205ddea750550185d7642025bff URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4bb748b609288205ddea750550185d7642025bff Author: Chia-I Wu Date: Wed Jun 8 22:24:32 2011 +0800 mesa: merge glapidispatch.h into dispatch.h glapidispatch.h was located in glapi and shared with mesa core. Because the way it was shared, mesa core must include it indirectly via main/dispatch.h. Now that it is no longer needed by glapi and is located in core mesa, merging it with main/dispatch.h to avoid wrong uses. --- src/glx/apple/apple_glapi.c|4 +- src/mapi/glapi/gen-es/Makefile |4 +- src/mapi/glapi/gen/Makefile|4 +- src/mapi/glapi/gen/gl_table.py | 19 +- src/mesa/SConscript|4 +- src/mesa/main/dispatch.h |12245 +++- src/mesa/main/es_generator.py |7 +- src/mesa/main/glapidispatch.h |12268 8 files changed, 12257 insertions(+), 12298 deletions(-) Diff: http://cgit.freedesktop.org/mesa/mesa/diff/?id=4bb748b609288205ddea750550185d7642025bff ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: fix function remapping for dlist
Module: Mesa Branch: master Commit: 0dc45374f2c62e33680f3a5729a18ba9ee40cd4d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0dc45374f2c62e33680f3a5729a18ba9ee40cd4d Author: Chia-I Wu Date: Wed Jun 8 21:51:41 2011 +0800 mesa: fix function remapping for dlist glapidispatch.h should not be included directly. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36282 --- src/mesa/main/dlist.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index c23593b..958f5a6 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -49,7 +49,6 @@ #include "eval.h" #include "framebuffer.h" #include "glapi/glapi.h" -#include "glapidispatch.h" #include "hash.h" #include "image.h" #include "light.h" ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: fix GLES remap table setup again
Module: Mesa Branch: master Commit: fed482f5e30ea6b230ed20982551b340570dc3e9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fed482f5e30ea6b230ed20982551b340570dc3e9 Author: Chia-I Wu Date: Wed Jun 8 22:04:16 2011 +0800 mesa: fix GLES remap table setup again Generate different glapidispatch.h's for GL and GLES. For GLES, we want a local remap table. This reverts commit 5af46e836073d2112b147b524e441bdb808cc128. The commit will break GL remap table setup when main/glapidispatch.h is regenerated. --- src/mapi/glapi/gen/gl_table.py | 22 +- src/mesa/main/es_generator.py |5 +++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/mapi/glapi/gen/gl_table.py b/src/mapi/glapi/gen/gl_table.py index c3cc616..bd3f3eb 100644 --- a/src/mapi/glapi/gen/gl_table.py +++ b/src/mapi/glapi/gen/gl_table.py @@ -149,14 +149,18 @@ class PrintRemapTable(gl_XML.gl_print_base): print '#else /* !_GLAPI_USE_REMAP_TABLE */' print '' - print '#define driDispatchRemapTable_size %u' % (count) - print 'extern int driDispatchRemapTable[ driDispatchRemapTable_size ];' - print '' - print '#if FEATURE_remap_table' - print '#define driDispatchRemapTable remap_table' - print 'static int remap_table[driDispatchRemapTable_size];' - print '#endif' - print '' + if self.es: + remap_table = "esLocalRemapTable" + + print '#define %s_size %u' % (remap_table, count) + print 'static int %s[ %s_size ];' % (remap_table, remap_table) + print '' + else: + remap_table = "driDispatchRemapTable" + + print '#define %s_size %u' % (remap_table, count) + print 'extern int %s[ %s_size ];' % (remap_table, remap_table) + print '' for f, index in functions: print '#define %s_remap_index %u' % (f.name, index) @@ -164,7 +168,7 @@ class PrintRemapTable(gl_XML.gl_print_base): print '' for f, index in functions: - print '#define _gloffset_%s driDispatchRemapTable[%s_remap_index]' % (f.name, f.name) + print '#define _gloffset_%s %s[%s_remap_index]' % (f.name, remap_table, f.name) print '' print '#endif /* _GLAPI_USE_REMAP_TABLE */' diff --git a/src/mesa/main/es_generator.py b/src/mesa/main/es_generator.py index 87d8bd3..5b49416 100644 --- a/src/mesa/main/es_generator.py +++ b/src/mesa/main/es_generator.py @@ -680,6 +680,7 @@ print """ #if FEATURE_remap_table +/* define esLocalRemapTable */ /* cannot include main/dispatch.h here */ #define _GLAPI_USE_REMAP_TABLE #include "%sapi/main/glapidispatch.h" @@ -701,7 +702,7 @@ init_remap_table(void) return; } - for (i = 0; i < driDispatchRemapTable_size; i++) { + for (i = 0; i < esLocalRemapTable_size; i++) { GLint offset; const char *spec; @@ -710,7 +711,7 @@ init_remap_table(void) spec = _mesa_function_pool + remap[i].pool_index; offset = _mesa_map_function_spec(spec); - remap_table[i] = offset; + esLocalRemapTable[i] = offset; } initialized = GL_TRUE; _glthread_UNLOCK_MUTEX(mutex); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600g: fix mixup in GPR resource reg setup
Module: Mesa Branch: master Commit: fe3a3434412482ff1b0a113e1008fd7dd7b42359 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe3a3434412482ff1b0a113e1008fd7dd7b42359 Author: Alex Deucher Date: Wed Jun 8 10:50:18 2011 -0400 r600g: fix mixup in GPR resource reg setup GLOBAL_GPR regs should be 0. Need to set the number of temp regs in SQ_GPR_RESOURCE_MGMT_1. Signed-off-by: Alex Deucher --- src/gallium/drivers/r600/evergreen_state.c | 13 ++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 9114734..9ebfe54 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1023,7 +1023,10 @@ static void cayman_init_config(struct r600_pipe_context *rctx) tmp |= S_008C00_EXPORT_SRC_C(1); r600_pipe_state_add_reg(rstate, R_008C00_SQ_CONFIG, tmp, 0x, NULL); - r600_pipe_state_add_reg(rstate, R_008C10_SQ_GLOBAL_GPR_RESOURCE_MGMT_1, (4 << 28), 0x, NULL); + /* always set the temp clauses */ + r600_pipe_state_add_reg(rstate, R_008C04_SQ_GPR_RESOURCE_MGMT_1, S_008C04_NUM_CLAUSE_TEMP_GPRS(4), 0x, NULL); + r600_pipe_state_add_reg(rstate, R_008C10_SQ_GLOBAL_GPR_RESOURCE_MGMT_1, 0, 0x, NULL); + r600_pipe_state_add_reg(rstate, R_008C14_SQ_GLOBAL_GPR_RESOURCE_MGMT_2, 0, 0x, NULL); r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, (1 << 8), 0x, NULL); r600_pipe_state_add_reg(rstate, R_028A48_PA_SC_MODE_CNTL_0, 0x0, 0x, NULL); @@ -1377,9 +1380,13 @@ void evergreen_init_config(struct r600_pipe_context *rctx) /* enable dynamic GPR resource management */ if (r600_get_minor_version(rctx->radeon) >= 7) { - r600_pipe_state_add_reg(rstate, R_008C10_SQ_GLOBAL_GPR_RESOURCE_MGMT_1, (4 << 28), 0x, NULL); + /* always set temp clauses */ + r600_pipe_state_add_reg(rstate, R_008C04_SQ_GPR_RESOURCE_MGMT_1, + S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs), 0x, NULL); + r600_pipe_state_add_reg(rstate, R_008C10_SQ_GLOBAL_GPR_RESOURCE_MGMT_1, 0, 0x, NULL); + r600_pipe_state_add_reg(rstate, R_008C14_SQ_GLOBAL_GPR_RESOURCE_MGMT_2, 0, 0x, NULL); r600_pipe_state_add_reg(rstate, R_008D8C_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, (1 << 8), 0x, NULL); - r600_pipe_state_add_reg(rstate, R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1, + r600_pipe_state_add_reg(rstate, R_028838_SQ_DYN_GPR_RESOURCE_LIMIT_1, S_028838_PS_GPRS(0x1e) | S_028838_VS_GPRS(0x1e) | S_028838_GS_GPRS(0x1e) | ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): vbo: run 'indent' on vbo_save_api.c
Module: Mesa Branch: master Commit: 7c2847a972cd68107348ba8fe3667dc211b78f3e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c2847a972cd68107348ba8fe3667dc211b78f3e Author: Brian Paul Date: Wed Jun 8 08:05:41 2011 -0600 vbo: run 'indent' on vbo_save_api.c --- src/mesa/vbo/vbo_save_api.c | 818 --- 1 files changed, 456 insertions(+), 362 deletions(-) diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index dd6e899..9041f79 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -100,12 +100,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. * NOTE: Old 'parity' issue is gone, but copying can still be * wrong-footed on replay. */ -static GLuint _save_copy_vertices( struct gl_context *ctx, - const struct vbo_save_vertex_list *node, - const GLfloat *src_buffer) +static GLuint +_save_copy_vertices(struct gl_context *ctx, +const struct vbo_save_vertex_list *node, +const GLfloat * src_buffer) { - struct vbo_save_context *save = &vbo_context( ctx )->save; - const struct _mesa_prim *prim = &node->prim[node->prim_count-1]; + struct vbo_save_context *save = &vbo_context(ctx)->save; + const struct _mesa_prim *prim = &node->prim[node->prim_count - 1]; GLuint nr = prim->count; GLuint sz = save->vertex_size; const GLfloat *src = src_buffer + prim->start * sz; @@ -114,55 +115,65 @@ static GLuint _save_copy_vertices( struct gl_context *ctx, if (prim->end) return 0; - - switch( prim->mode ) - { + + switch (prim->mode) { case GL_POINTS: return 0; case GL_LINES: - ovf = nr&1; - for (i = 0 ; i < ovf ; i++) -memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); + ovf = nr & 1; + for (i = 0; i < ovf; i++) + memcpy(dst + i * sz, src + (nr - ovf + i) * sz, +sz * sizeof(GLfloat)); return i; case GL_TRIANGLES: - ovf = nr%3; - for (i = 0 ; i < ovf ; i++) -memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); + ovf = nr % 3; + for (i = 0; i < ovf; i++) + memcpy(dst + i * sz, src + (nr - ovf + i) * sz, +sz * sizeof(GLfloat)); return i; case GL_QUADS: - ovf = nr&3; - for (i = 0 ; i < ovf ; i++) -memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); + ovf = nr & 3; + for (i = 0; i < ovf; i++) + memcpy(dst + i * sz, src + (nr - ovf + i) * sz, +sz * sizeof(GLfloat)); return i; case GL_LINE_STRIP: - if (nr == 0) -return 0; + if (nr == 0) + return 0; else { -memcpy( dst, src+(nr-1)*sz, sz*sizeof(GLfloat) ); -return 1; + memcpy(dst, src + (nr - 1) * sz, sz * sizeof(GLfloat)); + return 1; } case GL_LINE_LOOP: case GL_TRIANGLE_FAN: case GL_POLYGON: - if (nr == 0) -return 0; + if (nr == 0) + return 0; else if (nr == 1) { -memcpy( dst, src+0, sz*sizeof(GLfloat) ); -return 1; - } else { -memcpy( dst, src+0, sz*sizeof(GLfloat) ); -memcpy( dst+sz, src+(nr-1)*sz, sz*sizeof(GLfloat) ); -return 2; + memcpy(dst, src + 0, sz * sizeof(GLfloat)); + return 1; + } + else { + memcpy(dst, src + 0, sz * sizeof(GLfloat)); + memcpy(dst + sz, src + (nr - 1) * sz, sz * sizeof(GLfloat)); + return 2; } case GL_TRIANGLE_STRIP: case GL_QUAD_STRIP: switch (nr) { - case 0: ovf = 0; break; - case 1: ovf = 1; break; - default: ovf = 2 + (nr&1); break; + case 0: + ovf = 0; + break; + case 1: + ovf = 1; + break; + default: + ovf = 2 + (nr & 1); + break; } - for (i = 0 ; i < ovf ; i++) -memcpy( dst+i*sz, src+(nr-ovf+i)*sz, sz*sizeof(GLfloat) ); + for (i = 0; i < ovf; i++) + memcpy(dst + i * sz, src + (nr - ovf + i) * sz, +sz * sizeof(GLfloat)); return i; default: assert(0); @@ -171,9 +182,11 @@ static GLuint _save_copy_vertices( struct gl_context *ctx, } -static struct vbo_save_vertex_store *alloc_vertex_store( struct gl_context *ctx ) +static struct vbo_save_vertex_store * +alloc_vertex_store(struct gl_context *ctx) { - struct vbo_save_vertex_store *vertex_store = CALLOC_STRUCT(vbo_save_vertex_store); + struct vbo_save_vertex_store *vertex_store = + CALLOC_STRUCT(vbo_save_vertex_store); /* obj->Name needs to be non-zero, but won't ever be examined more * closely than that. In particular these buffers won't be entered @@ -185,12 +198,10 @@ static struct vbo_save_vertex_store *alloc_vertex_store( struct gl_context *ctx VBO_BUF_ID,
Mesa (master): mesa: add include/c99/*.h files to tarballs
Module: Mesa Branch: master Commit: 9404835ccdcd503b2cd50797f43b04ebe8db6873 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9404835ccdcd503b2cd50797f43b04ebe8db6873 Author: Brian Paul Date: Wed Jun 8 08:05:41 2011 -0600 mesa: add include/c99/*.h files to tarballs See https://bugs.freedesktop.org/show_bug.cgi?id=36238 NOTE: This is a candidate for the 7.10 branch. --- Makefile |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Makefile b/Makefile index 2fc35b2..07ec686 100644 --- a/Makefile +++ b/Makefile @@ -231,6 +231,7 @@ MAIN_FILES = \ $(DIRECTORY)/include/GL/wglext.h\ $(DIRECTORY)/include/GL/wmesa.h \ $(DIRECTORY)/include/pci_ids/*.h\ + $(DIRECTORY)/include/c99/*.h\ $(DIRECTORY)/src/getopt/SConscript \ $(DIRECTORY)/src/getopt/getopt*.[ch]\ $(DIRECTORY)/src/glsl/Makefile \ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): vbo: rename DO_FALLBACK -> dlist_fallback
Module: Mesa Branch: master Commit: f1733d16de56b1fbecc2b0f22fc3270b85a813cc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f1733d16de56b1fbecc2b0f22fc3270b85a813cc Author: Brian Paul Date: Wed Jun 8 08:05:41 2011 -0600 vbo: rename DO_FALLBACK -> dlist_fallback --- src/mesa/vbo/vbo_save_api.c | 18 +- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index cf821a7..dd6e899 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -681,7 +681,7 @@ do { \ * -- Flush current buffer * -- Fallback to opcodes for the rest of the begin/end object. */ -static void DO_FALLBACK( struct gl_context *ctx ) +static void dlist_fallback( struct gl_context *ctx ) { struct vbo_save_context *save = &vbo_context(ctx)->save; @@ -711,56 +711,56 @@ static void DO_FALLBACK( struct gl_context *ctx ) static void GLAPIENTRY _save_EvalCoord1f( GLfloat u ) { GET_CURRENT_CONTEXT(ctx); - DO_FALLBACK(ctx); + dlist_fallback(ctx); CALL_EvalCoord1f(ctx->Save, (u)); } static void GLAPIENTRY _save_EvalCoord1fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - DO_FALLBACK(ctx); + dlist_fallback(ctx); CALL_EvalCoord1fv(ctx->Save, (v)); } static void GLAPIENTRY _save_EvalCoord2f( GLfloat u, GLfloat v ) { GET_CURRENT_CONTEXT(ctx); - DO_FALLBACK(ctx); + dlist_fallback(ctx); CALL_EvalCoord2f(ctx->Save, (u, v)); } static void GLAPIENTRY _save_EvalCoord2fv( const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - DO_FALLBACK(ctx); + dlist_fallback(ctx); CALL_EvalCoord2fv(ctx->Save, (v)); } static void GLAPIENTRY _save_EvalPoint1( GLint i ) { GET_CURRENT_CONTEXT(ctx); - DO_FALLBACK(ctx); + dlist_fallback(ctx); CALL_EvalPoint1(ctx->Save, (i)); } static void GLAPIENTRY _save_EvalPoint2( GLint i, GLint j ) { GET_CURRENT_CONTEXT(ctx); - DO_FALLBACK(ctx); + dlist_fallback(ctx); CALL_EvalPoint2(ctx->Save, (i, j)); } static void GLAPIENTRY _save_CallList( GLuint l ) { GET_CURRENT_CONTEXT(ctx); - DO_FALLBACK(ctx); + dlist_fallback(ctx); CALL_CallList(ctx->Save, (l)); } static void GLAPIENTRY _save_CallLists( GLsizei n, GLenum type, const GLvoid *v ) { GET_CURRENT_CONTEXT(ctx); - DO_FALLBACK(ctx); + dlist_fallback(ctx); CALL_CallLists(ctx->Save, (n, type, v)); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): vbo: remove node->count > 0 test in vbo_save_playback_vertex_list()
Module: Mesa Branch: master Commit: 62811057f41bf7c027da6156a44383266c7f3952 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=62811057f41bf7c027da6156a44383266c7f3952 Author: Brian Paul Date: Wed Jun 8 08:05:41 2011 -0600 vbo: remove node->count > 0 test in vbo_save_playback_vertex_list() See piglit dlist-fdo31590.c test and http://bugs.freedesktop.org/show_bug.cgi?id=31590 In this case we had node->prim_count=1 but node->count==0 because the display list started with glBegin() but had no vertices. The call to glEvalCoord1f() triggered the DO_FALLBACK() path. When replaying the display list, the old condition basically no-op'd the call to vbo_save_playback_vertex_list call(). That led to the invalid operation error being raised in glEnd(). NOTE: This is a candidate for the 7.10 branch. --- src/mesa/vbo/vbo_save_draw.c | 20 +++- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index ca4cff3..a37af73 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -249,7 +249,7 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data) FLUSH_CURRENT(ctx, 0); - if (node->prim_count > 0 && node->count > 0) { + if (node->prim_count > 0) { if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END && node->prim[0].begin) { @@ -289,14 +289,16 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data) if (ctx->NewState) _mesa_update_state( ctx ); - vbo_context(ctx)->draw_prims(ctx, - save->inputs, - node->prim, - node->prim_count, - NULL, - GL_TRUE, - 0, /* Node is a VBO, so this is ok */ - node->count - 1); + if (node->count > 0) { + vbo_context(ctx)->draw_prims(ctx, + save->inputs, + node->prim, + node->prim_count, + NULL, + GL_TRUE, + 0,/* Node is a VBO, so this is ok */ + node->count - 1); + } } /* Copy to current? ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): vbo: check array indexes to prevent negative indexing
Module: Mesa Branch: master Commit: f1cdce95f606584a56eabf3b38eea19ff4c75757 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f1cdce95f606584a56eabf3b38eea19ff4c75757 Author: Brian Paul Date: Wed Jun 8 08:05:41 2011 -0600 vbo: check array indexes to prevent negative indexing See the piglit dlist-fdo31590.c test NOTE: This is a candidate for the 7.10 branch. --- src/mesa/vbo/vbo_exec_api.c | 12 src/mesa/vbo/vbo_save_api.c | 11 +-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 3c7c439..2b8d38e 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -608,11 +608,15 @@ static void GLAPIENTRY vbo_exec_End( void ) if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; - int idx = exec->vtx.vert_count; - int i = exec->vtx.prim_count - 1; - exec->vtx.prim[i].end = 1; - exec->vtx.prim[i].count = idx - exec->vtx.prim[i].start; + if (exec->vtx.prim_count > 0) { + /* close off current primitive */ + int idx = exec->vtx.vert_count; + int i = exec->vtx.prim_count - 1; + + exec->vtx.prim[i].end = 1; + exec->vtx.prim[i].count = idx - exec->vtx.prim[i].start; + } ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END; diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 836c76f..cf821a7 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -686,12 +686,11 @@ static void DO_FALLBACK( struct gl_context *ctx ) struct vbo_save_context *save = &vbo_context(ctx)->save; if (save->vert_count || save->prim_count) { - GLint i = save->prim_count - 1; - - /* Close off in-progress primitive. - */ - save->prim[i].count = (save->vert_count - - save->prim[i].start); + if (save->prim_count > 0) { + /* Close off in-progress primitive. */ + GLint i = save->prim_count - 1; + save->prim[i].count = save->vert_count - save->prim[i].start; + } /* Need to replay this display list with loopback, * unfortunately, otherwise this primitive won't be handled ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st: use _mesa_is_bufferobj()
Module: Mesa Branch: master Commit: a25271fcb8d12298e64890cad25919938ae12018 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a25271fcb8d12298e64890cad25919938ae12018 Author: Brian Paul Date: Wed Jun 8 08:05:41 2011 -0600 st: use _mesa_is_bufferobj() --- src/mesa/state_tracker/st_draw.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 46a4f9c..56955d3 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -42,6 +42,7 @@ #include "main/imports.h" #include "main/image.h" +#include "main/bufferobj.h" #include "main/macros.h" #include "main/mfeatures.h" #include "program/prog_uniform.h" @@ -336,7 +337,7 @@ setup_interleaved_attribs(struct gl_context *ctx, assert(element_size == array->Size * _mesa_sizeof_type(array->Type)); if (attr == 0) { - if (bufobj && bufobj->Name) { + if (bufobj && _mesa_is_bufferobj(bufobj)) { vbuffer->buffer = NULL; pipe_resource_reference(&vbuffer->buffer, stobj->buffer); vbuffer->buffer_offset = pointer_to_offset(low_addr); @@ -402,7 +403,7 @@ setup_non_interleaved_attribs(struct gl_context *ctx, assert(element_size == array->Size * _mesa_sizeof_type(array->Type)); - if (bufobj && bufobj->Name) { + if (bufobj && _mesa_is_bufferobj(bufobj)) { /* Attribute data is in a VBO. * Recall that for VBOs, the gl_client_array->Ptr field is * really an offset from the start of the VBO, not a pointer. @@ -493,7 +494,7 @@ setup_index_buffer(struct gl_context *ctx, } /* get/create the index buffer object */ - if (bufobj && bufobj->Name) { + if (bufobj && _mesa_is_bufferobj(bufobj)) { /* elements/indexes are in a real VBO */ struct st_buffer_object *stobj = st_buffer_object(bufobj); pipe_resource_reference(&ibuffer->buffer, stobj->buffer); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): vbo: added a comment
Module: Mesa Branch: master Commit: d329b68f350a6db9439f71a0d1a8d2a8e2fd426c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d329b68f350a6db9439f71a0d1a8d2a8e2fd426c Author: Brian Paul Date: Wed Jun 8 08:05:41 2011 -0600 vbo: added a comment --- src/mesa/vbo/vbo_save.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h index cd827ce..45cd299 100644 --- a/src/mesa/vbo/vbo_save.h +++ b/src/mesa/vbo/vbo_save.h @@ -73,7 +73,7 @@ struct vbo_save_vertex_list { GLuint current_size; GLuint buffer_offset; - GLuint count; + GLuint count;/**< vertex count */ GLuint wrap_count; /* number of copied vertices at start */ GLboolean dangling_attr_ref;/* current attr implicitly referenced outside the list */ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium: fix comments for pipe_stream_output_state
Module: Mesa Branch: master Commit: 713fb507596181f91990a0eb1470f0b95bf2f3d9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=713fb507596181f91990a0eb1470f0b95bf2f3d9 Author: Brian Paul Date: Wed Jun 8 08:05:40 2011 -0600 gallium: fix comments for pipe_stream_output_state --- src/gallium/include/pipe/p_state.h | 16 +--- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 86ef255..d442c15 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -372,19 +372,21 @@ struct pipe_resource unsigned flags; /**< bitmask of PIPE_RESOURCE_FLAG_x */ }; + +/** + * Stream output for vertex transform feedback. + */ struct pipe_stream_output_state { - /**< number of the output buffer to insert each element into */ + /** number of the output buffer to insert each element into */ int output_buffer[PIPE_MAX_SHADER_OUTPUTS]; - /**< which register to grab each output from */ + /** which register to grab each output from */ int register_index[PIPE_MAX_SHADER_OUTPUTS]; - /**< TGSI_WRITEMASK signifying which components to output */ + /** TGSI_WRITEMASK signifying which components to output */ ubyte register_mask[PIPE_MAX_SHADER_OUTPUTS]; - /**< number of outputs */ + /** number of outputs */ int num_outputs; - - /**< stride for an entire vertex, only used if all output_buffers -* are 0 */ + /** stride for an entire vertex, only used if all output_buffers are 0 */ unsigned stride; }; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: add more sampler types to is_sampler_type()
Module: Mesa Branch: master Commit: f9c2feb96b5854ca8030d94a5ea5b168ec818fe8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f9c2feb96b5854ca8030d94a5ea5b168ec818fe8 Author: Brian Paul Date: Wed Jun 8 08:05:40 2011 -0600 mesa: add more sampler types to is_sampler_type() --- src/mesa/main/uniforms.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index c9b12c8..771e039 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -109,12 +109,16 @@ is_sampler_type(GLenum type) case GL_SAMPLER_CUBE: case GL_SAMPLER_1D_SHADOW: case GL_SAMPLER_2D_SHADOW: + case GL_SAMPLER_CUBE_SHADOW: case GL_SAMPLER_2D_RECT_ARB: case GL_SAMPLER_2D_RECT_SHADOW_ARB: case GL_SAMPLER_1D_ARRAY_EXT: case GL_SAMPLER_2D_ARRAY_EXT: case GL_SAMPLER_1D_ARRAY_SHADOW_EXT: case GL_SAMPLER_2D_ARRAY_SHADOW_EXT: + case GL_SAMPLER_CUBE_MAP_ARRAY: + case GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW: + case GL_SAMPLER_BUFFER: return GL_TRUE; default: return GL_FALSE; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: remove old comment
Module: Mesa Branch: master Commit: 3d75c42bbf34c8a16de425da81b6fb02a8aa4b47 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d75c42bbf34c8a16de425da81b6fb02a8aa4b47 Author: Brian Paul Date: Wed Jun 8 08:05:40 2011 -0600 mesa: remove old comment --- src/mesa/main/uniforms.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c index 771e039..1c4fd82 100644 --- a/src/mesa/main/uniforms.c +++ b/src/mesa/main/uniforms.c @@ -1461,7 +1461,6 @@ _mesa_init_shader_uniform_dispatch(struct _glapi_table *exec) SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv); /* OpenGL 3.0 */ - /* XXX finish dispatch */ SET_Uniform1uiEXT(exec, _mesa_Uniform1ui); SET_Uniform2uiEXT(exec, _mesa_Uniform2ui); SET_Uniform3uiEXT(exec, _mesa_Uniform3ui); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium: s/bool/boolean/
Module: Mesa Branch: master Commit: 5f2deba9f3f3f9230a9fdd2848e20c1e23e98b8f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f2deba9f3f3f9230a9fdd2848e20c1e23e98b8f Author: Brian Paul Date: Wed Jun 8 08:05:40 2011 -0600 gallium: s/bool/boolean/ --- src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c |2 +- src/gallium/auxiliary/util/u_linkage.h |2 +- src/gallium/auxiliary/util/u_staging.c |2 +- src/gallium/auxiliary/util/u_staging.h |2 +- src/gallium/drivers/i915/i915_batchbuffer.h |2 +- src/gallium/drivers/nvfx/nvfx_surface.c |4 ++-- src/gallium/drivers/nvfx/nvfx_transfer.c |2 +- src/gallium/drivers/r300/r300_state_derived.c|2 +- src/gallium/drivers/r600/r600_asm.c |4 ++-- src/gallium/drivers/r600/r600_pipe.h | 10 +- src/gallium/tests/unit/u_format_test.c |4 ++-- src/gallium/winsys/r600/drm/r600_bomgr.c |2 +- src/gallium/winsys/r600/drm/r600_priv.h |4 ++-- 13 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c index ad51446..5ad32d9 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c @@ -105,7 +105,7 @@ analyse_tex(struct analysis_context *ctx, if (info->num_texs < Elements(info->tex)) { struct lp_tgsi_texture_info *tex_info = &info->tex[info->num_texs]; - bool indirect = FALSE; + boolean indirect = FALSE; unsigned readmask = 0; tex_info->target = inst->Texture.Texture; diff --git a/src/gallium/auxiliary/util/u_linkage.h b/src/gallium/auxiliary/util/u_linkage.h index 4720e0e..43ec917 100644 --- a/src/gallium/auxiliary/util/u_linkage.h +++ b/src/gallium/auxiliary/util/u_linkage.h @@ -35,7 +35,7 @@ struct util_semantic_set unsigned long masks[256 / 8 / sizeof(unsigned long)]; }; -static INLINE bool +static INLINE boolean util_semantic_set_contains(struct util_semantic_set *set, unsigned char value) { return !!(set->masks[value / (sizeof(long) * 8)] & (1 << (value / (sizeof(long) * 8; diff --git a/src/gallium/auxiliary/util/u_staging.c b/src/gallium/auxiliary/util/u_staging.c index b6bf241..b5e3793 100644 --- a/src/gallium/auxiliary/util/u_staging.c +++ b/src/gallium/auxiliary/util/u_staging.c @@ -55,7 +55,7 @@ util_staging_transfer_init(struct pipe_context *pipe, unsigned level, unsigned usage, const struct pipe_box *box, - bool direct, struct util_staging_transfer *tx) + boolean direct, struct util_staging_transfer *tx) { struct pipe_screen *pscreen = pipe->screen; diff --git a/src/gallium/auxiliary/util/u_staging.h b/src/gallium/auxiliary/util/u_staging.h index 49839d2..ddbb334 100644 --- a/src/gallium/auxiliary/util/u_staging.h +++ b/src/gallium/auxiliary/util/u_staging.h @@ -55,7 +55,7 @@ util_staging_transfer_init(struct pipe_context *pipe, unsigned level, unsigned usage, const struct pipe_box *box, - bool direct, struct util_staging_transfer *tx); + boolean direct, struct util_staging_transfer *tx); void util_staging_transfer_destroy(struct pipe_context *pipe, struct pipe_transfer *ptx); diff --git a/src/gallium/drivers/i915/i915_batchbuffer.h b/src/gallium/drivers/i915/i915_batchbuffer.h index 7855403..14ae749 100644 --- a/src/gallium/drivers/i915/i915_batchbuffer.h +++ b/src/gallium/drivers/i915/i915_batchbuffer.h @@ -95,7 +95,7 @@ static INLINE int i915_winsys_batchbuffer_reloc(struct i915_winsys_batchbuffer *batch, struct i915_winsys_buffer *buffer, enum i915_winsys_buffer_usage usage, - size_t offset, bool fenced) + size_t offset, boolean fenced) { return batch->iws->batchbuffer_reloc(batch, buffer, usage, offset, fenced); } diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c index ced2649..339906e 100644 --- a/src/gallium/drivers/nvfx/nvfx_surface.c +++ b/src/gallium/drivers/nvfx/nvfx_surface.c @@ -84,7 +84,7 @@ nvfx_region_set_format(struct nv04_region* rgn, enum pipe_format format) } static INLINE void -nvfx_region_init_for_surface(struct nv04_region* rgn, struct nvfx_surface* surf, unsigned x, unsigned y, bool for_write) +nvfx_region_init_for_surface(struct nv04_region* rgn, struct nvfx_surface* surf, unsigned x, unsigned y, boolean for_write) { rgn->x = x; rgn->y = y; @@ -120,7 +120,7 @@ nvfx_region_init_for_surface(struct nv04_region* rgn, struct nvfx_surface* surf, } static INLINE void -nvfx_region_init_for_subresource(struct nv04_region* rgn, struct pipe_resource* pt, unsigned level, unsigned x, unsigned y, unsigned z, bool for_write) +nvfx_reg
Mesa (master): draw: fix edge flag handling in clipper (for unfilled tris/ quads/polygons)
Module: Mesa Branch: master Commit: f6572017b94a137a4102342ebf6cd20dedc90271 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6572017b94a137a4102342ebf6cd20dedc90271 Author: Brian Paul Date: Wed Jun 8 08:05:40 2011 -0600 draw: fix edge flag handling in clipper (for unfilled tris/quads/polygons) Previously, we were errantly drawing some interior edges of clipped polygons and quads. Also, we were introducing extra edges where polygons intersected the view frustum clip planes. The main problem was that we were ignoring the edgeflags encoded in the primitive header's 'flags' field which are set during polygon/quad ->tri decomposition. We need to observe those during clipping. Since we can't modify the existing vert's edgeflag fields, we need to store them in a parallel array. Edge flags also need to be handled differently for view frustum planes vs. user-defined clip planes. In the former case we don't want to draw new clip edges but in the later case we do. This matches NVIDIA's behaviour and it just looks right. Finally, note that the LLVM draw code does not properly set vertex edge flags. It's OK on the regular software path though. --- src/gallium/auxiliary/draw/draw_pipe_clip.c | 62 -- 1 files changed, 57 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c index a10d8e9..b49502c 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c @@ -163,6 +163,7 @@ static void interp( const struct clip_stage *clip, */ static void emit_poly( struct draw_stage *stage, struct vertex_header **inlist, + const boolean *edgeflags, unsigned n, const struct prim_header *origPrim) { @@ -181,6 +182,9 @@ static void emit_poly( struct draw_stage *stage, edge_last = DRAW_PIPE_EDGE_FLAG_1; } + if (!edgeflags[0]) + edge_first = 0; + /* later stages may need the determinant, but only the sign matters */ header.det = origPrim->det; header.flags = DRAW_PIPE_RESET_STIPPLE | edge_first | edge_middle; @@ -199,7 +203,11 @@ static void emit_poly( struct draw_stage *stage, header.v[2] = inlist[0]; /* the provoking vertex */ } - if (i == n-1) + if (!edgeflags[i-1]) { + header.flags &= ~edge_middle; + } + + if (i == n - 1 && edgeflags[i]) header.flags |= edge_last; if (0) { @@ -248,15 +256,33 @@ do_clip_tri( struct draw_stage *stage, unsigned tmpnr = 0; unsigned n = 3; unsigned i; + boolean aEdges[MAX_CLIPPED_VERTICES]; + boolean bEdges[MAX_CLIPPED_VERTICES]; + boolean *inEdges = aEdges; + boolean *outEdges = bEdges; inlist[0] = header->v[0]; inlist[1] = header->v[1]; inlist[2] = header->v[2]; + /* +* Note: at this point we can't just use the per-vertex edge flags. +* We have to observe the edge flag bits set in header->flags which +* were set during primitive decomposition. Put those flags into +* an edge flags array which parallels the vertex array. +* Later, in the 'unfilled' pipeline stage we'll draw the edge if both +* the header.flags bit is set AND the per-vertex edgeflag field is set. +*/ + inEdges[0] = !!(header->flags & DRAW_PIPE_EDGE_FLAG_0); + inEdges[1] = !!(header->flags & DRAW_PIPE_EDGE_FLAG_1); + inEdges[2] = !!(header->flags & DRAW_PIPE_EDGE_FLAG_2); + while (clipmask && n >= 3) { const unsigned plane_idx = ffs(clipmask)-1; + const boolean is_user_clip_plane = plane_idx >= 6; const float *plane = clipper->plane[plane_idx]; struct vertex_header *vert_prev = inlist[0]; + boolean *edge_prev = &inEdges[0]; float dp_prev = dot4( vert_prev->clip, plane ); unsigned outcount = 0; @@ -266,9 +292,11 @@ do_clip_tri( struct draw_stage *stage, if (n >= MAX_CLIPPED_VERTICES) return; inlist[n] = inlist[0]; /* prevent rotation of vertices */ + inEdges[n] = inEdges[0]; for (i = 1; i <= n; i++) { struct vertex_header *vert = inlist[i]; + boolean *edge = &inEdges[i]; float dp = dot4( vert->clip, plane ); @@ -276,11 +304,13 @@ do_clip_tri( struct draw_stage *stage, assert(outcount < MAX_CLIPPED_VERTICES); if (outcount >= MAX_CLIPPED_VERTICES) return; +outEdges[outcount] = *edge_prev; outlist[outcount++] = vert_prev; } if (DIFFERENT_SIGNS(dp, dp_prev)) { struct vertex_header *new_vert; +boolean *new_edge; assert(tmpnr < MAX_CLIPPED_VERTICES + 1); if (tmpnr >= MAX_CLIPPED_VERTICES + 1) @@ -290,6 +320,8 @@ do_clip_tri( struct draw_stage *stage, assert(outcount < MAX_CLIPPED_VERTICES); if (outcount >= MAX_CLIPPED_VERTICES)